From: Takashi Sakamoto Date: Thu, 20 May 2021 04:01:49 +0000 (+0900) Subject: ALSA: firewire-lib: code refactoring for selection of IT context header length X-Git-Tag: accepted/tizen/unified/20230118.172025~6918^2~9^2~240 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=233dbbc7af5d279a5b1cc92ab08f15f7c2d64ad7;p=platform%2Fkernel%2Flinux-rpi.git ALSA: firewire-lib: code refactoring for selection of IT context header length This commit refactors regarding to the size of CIP header. Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20210520040154.80450-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai --- diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 3613529..87644cb 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -526,7 +526,7 @@ static void generate_cip_header(struct amdtp_stream *s, __be32 cip_header[2], } static void build_it_pkt_header(struct amdtp_stream *s, unsigned int cycle, - struct fw_iso_packet *params, + struct fw_iso_packet *params, unsigned int header_length, unsigned int data_blocks, unsigned int data_block_counter, unsigned int syt, unsigned int index) @@ -537,16 +537,15 @@ static void build_it_pkt_header(struct amdtp_stream *s, unsigned int cycle, payload_length = data_blocks * sizeof(__be32) * s->data_block_quadlets; params->payload_length = payload_length; - if (!(s->flags & CIP_NO_HEADER)) { + if (header_length > 0) { cip_header = (__be32 *)params->header; generate_cip_header(s, cip_header, data_block_counter, syt); - params->header_length = 2 * sizeof(__be32); - payload_length += params->header_length; + params->header_length = header_length; } else { cip_header = NULL; } - trace_amdtp_packet(s, cycle, cip_header, payload_length, data_blocks, + trace_amdtp_packet(s, cycle, cip_header, payload_length + header_length, data_blocks, data_block_counter, s->packet_index, index); } @@ -904,6 +903,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, const __be32 *ctx_header = header; unsigned int events_per_period = d->events_per_period; unsigned int event_count = s->ctx_data.rx.event_count; + unsigned int pkt_header_length; unsigned int packets; int i; @@ -918,6 +918,11 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, process_ctx_payloads(s, s->pkt_descs, packets); + if (!(s->flags & CIP_NO_HEADER)) + pkt_header_length = IT_PKT_HEADER_SIZE_CIP; + else + pkt_header_length = 0; + for (i = 0; i < packets; ++i) { const struct pkt_desc *desc = s->pkt_descs + i; unsigned int syt; @@ -932,7 +937,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, else syt = s->ctx_data.rx.syt_override; - build_it_pkt_header(s, desc->cycle, &template.params, + build_it_pkt_header(s, desc->cycle, &template.params, pkt_header_length, desc->data_blocks, desc->data_block_counter, syt, i);