firewire-lib: fix failure to capture MIDI messages in second or more port

amdtp_pull_midi() don't increment a buffer pointer when pointers for MIDI
ports are NULL. This causes failure to capture MIDI messages in devices with
second or more port such like M-Audio Ozonic and ProjectMix I/O.

This bug is reported:
[PATCH 06/39] firewire-lib: Add support for MIDI capture/playback
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074037.html
firewire-lib/bebob: obsolete NULL check before kfree()

To read /mm/slab.c, kfree() check a given pointer whether NULL or not
with ZERO_OR_NULL_PTR(). This commit obsoletes NULL check before calling
kfree().

This bug is reported:
[alsa-devel] [PATCH 09/39] firewire-lib: Add sort function for transmitted packet
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074039.html
firewire-lib: remove initial NULL for pcm pointer in handle_out_packet()

It's needless.

[alsa-devel] [PATCH 08/39] firewire-lib: Add support for duplex streams synchronization in blocking mode
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074038.html
firewire-lib: remove add_transfer_delay()
firewire-lib: rename 'amdtp_stream_callback' to 'amdtp_stream_first_callback'

This function is called just for first callback from Linux Firewire subsystem.
So its name should be with something like 'first' or 'initial'.

[alsa-devel] [PATCH 08/39] firewire-lib: Add support for duplex streams synchronization in blocking mode
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074038.html
firewire-lib: remove needless return in void function

It's needless.

[alsa-devel] [PATCH 08/39] firewire-lib: Add support for duplex streams synchronization in blocking mode
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074038.html
firewire-lib: arrange format for condition

There are no actual differences but maintainer hopes it.

[alsa-devel] [PATCH 05/39] firewire-lib: Add support for AMDTP in-stream and PCM capture
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074036.html
firewire-lib: use NULL instead of ERR_PTR(-1) for sync_slave pointer

This never gives any actual error code.

[alsa-devel] [PATCH 08/39] firewire-lib: Add support for duplex streams synchronization in blocking mode
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074038.html
firewire-lib: change amdtp_stream_set_sync()

I programmed this function as:
 - Clearing a flag at first
 - Setting the flag at last

But the flag was assigned twice. The first operation should be in branch of condition.

[alsa-devel] [PATCH 08/39] firewire-lib: Add support for duplex streams synchronization in blocking mode
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074038.html
firewire-lib: change codes to be a compile time constant

For efficiency.

[alsa-devel] [PATCH 05/39] firewire-lib: Add support for AMDTP in-stream and PCM capture
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074036.html
firewire-lib: normal NULL check for pcm pointer

This pointer doesn't become error pointer.

[alsa-devel] [PATCH 06/39] firewire-lib: Add support for MIDI capture/playback
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074037.html
firewire-lib: use stack to reduce executed opcodes in loop

As long as I know, in this case of write/read fuction, using auto variable
brings an advantage in loop. When I use structure member for loop index,
gcc generates opcodes to compare two registers after pushing the end value
into one of register. When I use auto variable for this purpose, gcc
generates opcodes to compare pointer value and register.

[alsa-devel] [PATCH 11/39] firewire-lib: Add support for channel mapping
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074041.html
firewire-lib: remove confirm to be zero when snd_rawmidi_transmit() fails

The snd_rawmidi_transmit() don't write bytes when failing.

[alsa-devel] [PATCH 06/39] firewire-lib: Add support for MIDI capture/playback
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074037.html
firewire-lib: replace hexadecimal 8bit value to int value

Here I expect compiler to apply widening conversion from int to __be32.

[alsa-devel] [PATCH 06/39] firewire-lib: Add support for MIDI capture/playback
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074037.html
firewire-lib: obsolete get_address() and introduce new two functions

The get_address() need 'master' parameter but codes in each branch don't
share much codes. It can be split to two functions and it's easy to
read.

[alsa-devel] [PATCH 14/39] firewire-lib: Add handling output connection by CMP
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074042.html
firewire-lib: remove FW_RETURN_TIMEOUT

I find a fact that M-Audio Firewire 1814 can certainly respond to
request command after bus reset. This means that FW_RETURN_TIMEOUT
and related codes can be obsoleted.
fireworks: use snprintf instead of snprintf

Just for a manner.
firewire-lib: Add support for deferred transaction

Some devices based on BeBoB use this type of transaction.

'Deferred Transaction' is defined in 'AV/C Digital Interface Command Set
General Specification' and is used by targets to make a response deferred
during processing it.

If a target may not be able to complete a command within 100msec since
receiving the command, then the target shall return INTERIM response,
to which final response will follow later. CONTROL/NOTIFY commands are
allowed for deferred transaction.

There is an issue. In the specification, the interval between INTERIM
response and final response is 'Unspecified interval'. The specification
depends on each subunit specification for this interval.

But we promise to finish this function for caller. In this reason, I use
FCP_TIMEOUT_MS for this interval. Currently it's 125msec.
firewire-lib: improvement for return value of AV/C commands

With previous commit, firewire-lib can handle deferred transaction
correctly. This means caller don't need to judge response code and
firewire-lib replace the codes to Linux's error codes.
bebob: improvement for command processing

With previous commit, firewire-lib can returns error codes instead of
response codes. The caller can just check return value as Linux's error
code.

And, with post commit, firewire-lib can handle command without response.
M-Audio Firewire 1814 and ProjectMix I/O are known as a device which use
this type of transaction (so rude). bebob_maudio.c has some codes for
this transaction but the codes are obsoleted.

Additionally, with post commit, firewire-lib can handle deferred
transaction. M-Audio Firewire 410 is known as a device which uses this
type of transaction. bebob_command.c has some codes for this transaction
but the codes can be obsoleted. But this device has a quirk to send a
wrong value for fdf field in AV/C Plug Signal Format command in its
beginning of startup and just after break connections.