[alsa-devel] [PATCH 04/17] firewire-lib: Split some codes into functions to reuse in future

Clemens Ladisch clemens at ladisch.de
Mon Nov 25 16:27:18 CET 2013


Takashi Sakamoto wrote:
> Some codes can be reused in handling transmitted stream. This commit adds new
> functions. This commit also renames some functions to keep naming consistency.

> +++ b/sound/firewire/amdtp.c

> +#define TRANSMIT_PACKET_HEADER_SIZE	4
> ...
> +static inline int queue_out_packet(struct amdtp_stream *s,
> +				   unsigned int payload_length, bool skip)
> +{
> +	return queue_packet(s, RECEIVE_PACKET_HEADER_SIZE,
> +			    payload_length, skip);

And this is what I complained about for patch 3.

> +static void check_pcm_pointer(struct amdtp_stream *s,

Thw word "check" does not imply that the pointers get changed.  Please
use something like "update_pcm_pointers".

> +static int queue_packet(struct amdtp_stream *s,
> +{
> +	p.skip = (!skip) ? 0: 1;

	p.skip = skip;

> @@ -612,8 +618,8 @@ int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
>  	s->context = fw_iso_context_create(fw_parent_device(s->unit)->card,
>  					   FW_ISO_CONTEXT_TRANSMIT,
>  					   channel, speed, 0,
> -					   out_packet_callback, s);
> +					   out_stream_callback, s);
> -	if (IS_ERR(s->context)) {
> +	if (!amdtp_stream_running(s)) {

The stream is not yet running at this point, so using this function here
would be confusing.


Regards,
Clemens


More information about the Alsa-devel mailing list