* [PATCH] ALSA: firewire-lib: drop skip argument from helper functions to queue a packet
@ 2016-05-10 22:35 Takashi Sakamoto
2016-05-11 7:48 ` Clemens Ladisch
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Sakamoto @ 2016-05-10 22:35 UTC (permalink / raw)
To: clemens, tiwai; +Cc: alsa-devel, ffado-devel
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>
---
sound/firewire/amdtp-stream.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 830a95c..e7163bd 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -370,9 +370,8 @@ static void pcm_period_tasklet(unsigned long data)
snd_pcm_period_elapsed(pcm);
}
-static int queue_packet(struct amdtp_stream *s,
- unsigned int header_length,
- unsigned int payload_length, bool skip)
+static int queue_packet(struct amdtp_stream *s, unsigned int header_length,
+ unsigned int payload_length)
{
struct fw_iso_packet p = {0};
int err = 0;
@@ -383,8 +382,10 @@ static int queue_packet(struct amdtp_stream *s,
p.interrupt = IS_ALIGNED(s->packet_index + 1, INTERRUPT_INTERVAL);
p.tag = TAG_CIP;
p.header_length = header_length;
- p.payload_length = (!skip) ? payload_length : 0;
- p.skip = skip;
+ if (payload_length > 0)
+ p.payload_length = payload_length;
+ else
+ p.skip = true;
err = fw_iso_context_queue(s->context, &p, &s->buffer.iso_buffer,
s->buffer.packets[s->packet_index].offset);
if (err < 0) {
@@ -399,16 +400,15 @@ end:
}
static inline int queue_out_packet(struct amdtp_stream *s,
- unsigned int payload_length, bool skip)
+ unsigned int payload_length)
{
- return queue_packet(s, OUT_PACKET_HEADER_SIZE,
- payload_length, skip);
+ return queue_packet(s, OUT_PACKET_HEADER_SIZE, payload_length);
}
static inline int queue_in_packet(struct amdtp_stream *s)
{
return queue_packet(s, IN_PACKET_HEADER_SIZE,
- amdtp_stream_get_max_payload(s), false);
+ amdtp_stream_get_max_payload(s));
}
static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle)
@@ -438,7 +438,7 @@ static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle)
trace_out_packet(s, cycle, buffer, payload_length);
- if (queue_out_packet(s, payload_length, false) < 0)
+ if (queue_out_packet(s, payload_length) < 0)
return -EIO;
pcm = ACCESS_ONCE(s->pcm);
@@ -764,7 +764,7 @@ int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
if (s->direction == AMDTP_IN_STREAM)
err = queue_in_packet(s);
else
- err = queue_out_packet(s, 0, true);
+ err = queue_out_packet(s, 0);
if (err < 0)
goto err_context;
} while (s->packet_index > 0);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: firewire-lib: drop skip argument from helper functions to queue a packet
2016-05-10 22:35 [PATCH] ALSA: firewire-lib: drop skip argument from helper functions to queue a packet Takashi Sakamoto
@ 2016-05-11 7:48 ` Clemens Ladisch
2016-05-11 16:14 ` Takashi Sakamoto
0 siblings, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2016-05-11 7:48 UTC (permalink / raw)
To: Takashi Sakamoto; +Cc: tiwai, alsa-devel, ffado-devel
Takashi Sakamoto wrote:
> 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.
> @@ -383,8 +382,10 @@ static int queue_packet(struct amdtp_stream *s,
> p.tag = TAG_CIP;
> p.header_length = header_length;
> - p.payload_length = (!skip) ? payload_length : 0;
> - p.skip = skip;
> + if (payload_length > 0)
> + p.payload_length = payload_length;
> + else
> + p.skip = true;
This can be simplified to:
p.payload_length = payload_length;
p.skip = payload_length == 0;
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Regards,
Clemens
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: firewire-lib: drop skip argument from helper functions to queue a packet
2016-05-11 7:48 ` Clemens Ladisch
@ 2016-05-11 16:14 ` Takashi Sakamoto
2016-05-11 18:37 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Sakamoto @ 2016-05-11 16:14 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: tiwai, alsa-devel, ffado-devel
Hi Clemens,
On May 11 2016 16:48, Clemens Ladisch wrote:
> Takashi Sakamoto wrote:
>> 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.
>
>> @@ -383,8 +382,10 @@ static int queue_packet(struct amdtp_stream *s,
>> p.tag = TAG_CIP;
>> p.header_length = header_length;
>> - p.payload_length = (!skip) ? payload_length : 0;
>> - p.skip = skip;
>> + if (payload_length > 0)
>> + p.payload_length = payload_length;
>> + else
>> + p.skip = true;
>
> This can be simplified to:
> p.payload_length = payload_length;
> p.skip = payload_length == 0;
Yep, but I prefer to split assignment from evaluation in different
lines, just from my taste.
> Acked-by: Clemens Ladisch <clemens@ladisch.de>
Thanks
Takashi Sakamoto
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: firewire-lib: drop skip argument from helper functions to queue a packet
2016-05-11 16:14 ` Takashi Sakamoto
@ 2016-05-11 18:37 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2016-05-11 18:37 UTC (permalink / raw)
To: Takashi Sakamoto; +Cc: alsa-devel, Clemens Ladisch, ffado-devel
On Wed, 11 May 2016 18:14:53 +0200,
Takashi Sakamoto wrote:
>
> Hi Clemens,
>
> On May 11 2016 16:48, Clemens Ladisch wrote:
> > Takashi Sakamoto wrote:
> >> 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.
> >
> >> @@ -383,8 +382,10 @@ static int queue_packet(struct amdtp_stream *s,
> >> p.tag = TAG_CIP;
> >> p.header_length = header_length;
> >> - p.payload_length = (!skip) ? payload_length : 0;
> >> - p.skip = skip;
> >> + if (payload_length > 0)
> >> + p.payload_length = payload_length;
> >> + else
> >> + p.skip = true;
> >
> > This can be simplified to:
> > p.payload_length = payload_length;
> > p.skip = payload_length == 0;
>
> Yep, but I prefer to split assignment from evaluation in different
> lines, just from my taste.
>
> > Acked-by: Clemens Ladisch <clemens@ladisch.de>
OK, applied as is now.
thanks,
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-11 18:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10 22:35 [PATCH] ALSA: firewire-lib: drop skip argument from helper functions to queue a packet Takashi Sakamoto
2016-05-11 7:48 ` Clemens Ladisch
2016-05-11 16:14 ` Takashi Sakamoto
2016-05-11 18:37 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.