aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2016-05-10 18:35:09 -0400
committerTakashi Iwai <tiwai@suse.de>2016-05-11 14:36:28 -0400
commitff38e0c70adce96de0be0bf470cbb9e283ba6965 (patch)
treee112d370316a7f7bd96f713332367b0292f6b2ec
parenta9c4284bf5a95c4788e7fbf3c46b14dcbfda3a6d (diff)
ALSA: firewire-lib: drop skip argument from helper functions to queue a packet
On most of audio and music units on IEEE 1394 bus which ALSA firewire stack supports (or plans to support), CIP with two quadlets header is used. Thus, there's no cases to queue packets with blank payload. If such packets are going to be queued, it means that they're for skips of the cycle. This commit simplifies helper functions to queue a packet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/firewire/amdtp-stream.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index bf10ca3adc57..00060c4a9deb 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -368,9 +368,8 @@ static void pcm_period_tasklet(unsigned long data)
368 snd_pcm_period_elapsed(pcm); 368 snd_pcm_period_elapsed(pcm);
369} 369}
370 370
371static int queue_packet(struct amdtp_stream *s, 371static int queue_packet(struct amdtp_stream *s, unsigned int header_length,
372 unsigned int header_length, 372 unsigned int payload_length)
373 unsigned int payload_length, bool skip)
374{ 373{
375 struct fw_iso_packet p = {0}; 374 struct fw_iso_packet p = {0};
376 int err = 0; 375 int err = 0;
@@ -381,8 +380,10 @@ static int queue_packet(struct amdtp_stream *s,
381 p.interrupt = IS_ALIGNED(s->packet_index + 1, INTERRUPT_INTERVAL); 380 p.interrupt = IS_ALIGNED(s->packet_index + 1, INTERRUPT_INTERVAL);
382 p.tag = TAG_CIP; 381 p.tag = TAG_CIP;
383 p.header_length = header_length; 382 p.header_length = header_length;
384 p.payload_length = (!skip) ? payload_length : 0; 383 if (payload_length > 0)
385 p.skip = skip; 384 p.payload_length = payload_length;
385 else
386 p.skip = true;
386 err = fw_iso_context_queue(s->context, &p, &s->buffer.iso_buffer, 387 err = fw_iso_context_queue(s->context, &p, &s->buffer.iso_buffer,
387 s->buffer.packets[s->packet_index].offset); 388 s->buffer.packets[s->packet_index].offset);
388 if (err < 0) { 389 if (err < 0) {
@@ -397,16 +398,15 @@ end:
397} 398}
398 399
399static inline int queue_out_packet(struct amdtp_stream *s, 400static inline int queue_out_packet(struct amdtp_stream *s,
400 unsigned int payload_length, bool skip) 401 unsigned int payload_length)
401{ 402{
402 return queue_packet(s, OUT_PACKET_HEADER_SIZE, 403 return queue_packet(s, OUT_PACKET_HEADER_SIZE, payload_length);
403 payload_length, skip);
404} 404}
405 405
406static inline int queue_in_packet(struct amdtp_stream *s) 406static inline int queue_in_packet(struct amdtp_stream *s)
407{ 407{
408 return queue_packet(s, IN_PACKET_HEADER_SIZE, 408 return queue_packet(s, IN_PACKET_HEADER_SIZE,
409 amdtp_stream_get_max_payload(s), false); 409 amdtp_stream_get_max_payload(s));
410} 410}
411 411
412static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle, 412static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle,
@@ -437,7 +437,7 @@ static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle,
437 437
438 trace_out_packet(s, cycle, buffer, payload_length, index); 438 trace_out_packet(s, cycle, buffer, payload_length, index);
439 439
440 if (queue_out_packet(s, payload_length, false) < 0) 440 if (queue_out_packet(s, payload_length) < 0)
441 return -EIO; 441 return -EIO;
442 442
443 pcm = ACCESS_ONCE(s->pcm); 443 pcm = ACCESS_ONCE(s->pcm);
@@ -764,7 +764,7 @@ int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
764 if (s->direction == AMDTP_IN_STREAM) 764 if (s->direction == AMDTP_IN_STREAM)
765 err = queue_in_packet(s); 765 err = queue_in_packet(s);
766 else 766 else
767 err = queue_out_packet(s, 0, true); 767 err = queue_out_packet(s, 0);
768 if (err < 0) 768 if (err < 0)
769 goto err_context; 769 goto err_context;
770 } while (s->packet_index > 0); 770 } while (s->packet_index > 0);