aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-07-07 21:07:58 +0900
committerTakashi Iwai <tiwai@suse.de>2019-07-08 14:50:41 +0200
commit02394af3e00df73c3674de0783d3a31c8162c840 (patch)
treec956a883e40fbdfd55e395dbfd29961ef3edb461 /sound
parentALSA: firewire-lib: code refactoring for error path of parser for CIP header (diff)
downloadlinux-dev-02394af3e00df73c3674de0783d3a31c8162c840.tar.xz
linux-dev-02394af3e00df73c3674de0783d3a31c8162c840.zip
ALSA: firewire-lib: code refactoring for post operation to data block counter
As a result of former commits, post operation to data block count for cases without CIP_DBC_IS_END_EVENT can be done just with data_block_counter member of amdtp_stream structure. This commit adds code refactoring to obsolete local variable for data block counter. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/firewire/amdtp-stream.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 0b9e643187e2..5e0346e272aa 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -616,9 +616,10 @@ static int check_cip_header(struct amdtp_stream *s, const __be32 *buf,
static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
const __be32 *ctx_header,
unsigned int *payload_length,
- unsigned int *data_blocks, unsigned int *dbc,
- unsigned int *syt, unsigned int index)
+ unsigned int *data_blocks, unsigned int *syt,
+ unsigned int index)
{
+ unsigned int dbc;
const __be32 *cip_header;
int err;
@@ -634,7 +635,7 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
if (!(s->flags & CIP_NO_HEADER)) {
cip_header = ctx_header + 2;
err = check_cip_header(s, cip_header, *payload_length,
- data_blocks, dbc, syt);
+ data_blocks, &dbc, syt);
if (err < 0)
return err;
} else {
@@ -645,12 +646,12 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
*syt = 0;
if (s->data_block_counter != UINT_MAX)
- *dbc = s->data_block_counter;
+ dbc = s->data_block_counter;
else
- *dbc = 0;
+ dbc = 0;
}
- s->data_block_counter = *dbc;
+ s->data_block_counter = dbc;
trace_amdtp_packet(s, cycle, cip_header, *payload_length, *data_blocks,
index);
@@ -758,7 +759,6 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp,
u32 cycle;
unsigned int payload_length;
unsigned int data_blocks;
- unsigned int dbc;
unsigned int syt;
__be32 *buffer;
unsigned int pcm_frames = 0;
@@ -768,7 +768,7 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp,
cycle = compute_cycle_count(ctx_header[1]);
err = parse_ir_ctx_header(s, cycle, ctx_header, &payload_length,
- &data_blocks, &dbc, &syt, i);
+ &data_blocks, &syt, i);
if (err < 0 && err != -EAGAIN)
break;
@@ -778,8 +778,8 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp,
data_blocks, &syt);
if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
- s->data_block_counter =
- (dbc + data_blocks) & 0xff;
+ s->data_block_counter += data_blocks;
+ s->data_block_counter &= 0xff;
}
}