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>
This commit is contained in:
parent
b8b0e24c22
commit
02394af3e0
|
@ -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,
|
static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
|
||||||
const __be32 *ctx_header,
|
const __be32 *ctx_header,
|
||||||
unsigned int *payload_length,
|
unsigned int *payload_length,
|
||||||
unsigned int *data_blocks, unsigned int *dbc,
|
unsigned int *data_blocks, unsigned int *syt,
|
||||||
unsigned int *syt, unsigned int index)
|
unsigned int index)
|
||||||
{
|
{
|
||||||
|
unsigned int dbc;
|
||||||
const __be32 *cip_header;
|
const __be32 *cip_header;
|
||||||
int err;
|
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)) {
|
if (!(s->flags & CIP_NO_HEADER)) {
|
||||||
cip_header = ctx_header + 2;
|
cip_header = ctx_header + 2;
|
||||||
err = check_cip_header(s, cip_header, *payload_length,
|
err = check_cip_header(s, cip_header, *payload_length,
|
||||||
data_blocks, dbc, syt);
|
data_blocks, &dbc, syt);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
|
@ -645,12 +646,12 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
|
||||||
*syt = 0;
|
*syt = 0;
|
||||||
|
|
||||||
if (s->data_block_counter != UINT_MAX)
|
if (s->data_block_counter != UINT_MAX)
|
||||||
*dbc = s->data_block_counter;
|
dbc = s->data_block_counter;
|
||||||
else
|
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,
|
trace_amdtp_packet(s, cycle, cip_header, *payload_length, *data_blocks,
|
||||||
index);
|
index);
|
||||||
|
@ -758,7 +759,6 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp,
|
||||||
u32 cycle;
|
u32 cycle;
|
||||||
unsigned int payload_length;
|
unsigned int payload_length;
|
||||||
unsigned int data_blocks;
|
unsigned int data_blocks;
|
||||||
unsigned int dbc;
|
|
||||||
unsigned int syt;
|
unsigned int syt;
|
||||||
__be32 *buffer;
|
__be32 *buffer;
|
||||||
unsigned int pcm_frames = 0;
|
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]);
|
cycle = compute_cycle_count(ctx_header[1]);
|
||||||
err = parse_ir_ctx_header(s, cycle, ctx_header, &payload_length,
|
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)
|
if (err < 0 && err != -EAGAIN)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -778,8 +778,8 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp,
|
||||||
data_blocks, &syt);
|
data_blocks, &syt);
|
||||||
|
|
||||||
if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
|
if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
|
||||||
s->data_block_counter =
|
s->data_block_counter += data_blocks;
|
||||||
(dbc + data_blocks) & 0xff;
|
s->data_block_counter &= 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue