Skip to content

Commit b27b21a

Browse files
singalsulgirdwood
authored andcommitted
EQ IIR: Code style fixes for trace prints
This patch contains maintenance for module traces. Some redundant traces are removed and some new traces with useful information are added, especially if they are related to an error with configuration request. The long trace strings are shortened to and split to several lines at numbers print when possible. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent d80ed44 commit b27b21a

File tree

1 file changed

+28
-35
lines changed

1 file changed

+28
-35
lines changed

src/audio/eq_iir/eq_iir.c

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
tracev_event_comp(TRACE_CLASS_EQ_IIR, comp_ptr, \
4242
__e, ##__VA_ARGS__)
4343

44-
#define trace_eq_error(__e, ...) \
44+
#define trace_eq_error(__e, ...) \
4545
trace_error(TRACE_CLASS_EQ_IIR, __e, ##__VA_ARGS__)
4646
#define trace_eq_error_with_ids(comp_ptr, __e, ...) \
4747
trace_error_comp(TRACE_CLASS_EQ_IIR, comp_ptr, \
@@ -419,8 +419,6 @@ static int eq_iir_init_coef(struct sof_eq_iir_config *config,
419419
coef_data = &config->data[config->channels_in_config];
420420
for (i = 0; i < SOF_EQ_IIR_MAX_RESPONSES; i++) {
421421
if (i < config->number_of_responses) {
422-
trace_eq("eq_iir_setup(), "
423-
"index of respose start position = %u", j);
424422
eq = (struct sof_eq_iir_header_df2t *)&coef_data[j];
425423
lookup[i] = eq;
426424
j += SOF_EQ_IIR_NHEADER_DF2T
@@ -445,19 +443,26 @@ static int eq_iir_init_coef(struct sof_eq_iir_config *config,
445443
/* Initialize EQ channel to bypass and continue with
446444
* next channel response.
447445
*/
446+
trace_eq("eq_iir_init_coef(), ch %d is set to bypass",
447+
i);
448448
iir_reset_df2t(&iir[i]);
449449
continue;
450450
}
451451

452-
if (resp >= config->number_of_responses)
452+
if (resp >= config->number_of_responses) {
453+
trace_eq("eq_iir_init_coef(), requested response %d"
454+
" exceeds defined", resp);
453455
return -EINVAL;
456+
}
454457

455458
/* Initialize EQ coefficients */
456459
eq = lookup[resp];
457460
s = iir_delay_size_df2t(eq);
458461
if (s > 0) {
459462
size_sum += s;
460463
} else {
464+
trace_eq("eq_iir_init_coef(), sections count %d"
465+
" exceeds max", eq->num_sections);
461466
return -EINVAL;
462467
}
463468

@@ -543,8 +548,8 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp)
543548
* blob size is sane.
544549
*/
545550
if (bs > SOF_EQ_IIR_MAX_SIZE) {
546-
trace_eq_error("eq_iir_new() error: coefficients"
547-
" blob size = %u > SOF_EQ_IIR_MAX_SIZE", bs);
551+
trace_eq_error("eq_iir_new(), coefficients blob size %u "
552+
"exceeds maximum", bs);
548553
return NULL;
549554
}
550555

@@ -632,27 +637,25 @@ static int iir_cmd_get_data(struct comp_dev *dev,
632637
/* Copy back to user space */
633638
if (cd->config) {
634639
bs = cd->config->size;
635-
trace_eq_with_ids(dev, "value of block size: %u", bs);
640+
trace_eq_with_ids(dev, "iir_cmd_set_data(), size %u",
641+
bs);
636642
if (bs > SOF_EQ_IIR_MAX_SIZE || bs == 0 ||
637643
bs > max_size)
638644
return -EINVAL;
639645
ret = memcpy_s(cdata->data->data,
640646
((struct sof_abi_hdr *)
641-
(cdata->data))->size, cd->config,
642-
bs);
647+
(cdata->data))->size, cd->config, bs);
643648
assert(!ret);
644649

645650
cdata->data->abi = SOF_ABI_VERSION;
646651
cdata->data->size = bs;
647652
} else {
648-
trace_eq_error_with_ids(dev, "iir_cmd_get_data() error: "
649-
"invalid cd->config");
653+
trace_eq_error_with_ids(dev, "iir_cmd_get_data(), no config");
650654
ret = -EINVAL;
651655
}
652656
break;
653657
default:
654-
trace_eq_error_with_ids(dev, "iir_cmd_get_data() error: "
655-
"invalid cdata->cmd");
658+
trace_eq_error_with_ids(dev, "iir_cmd_get_data(), invalid command");
656659
ret = -EINVAL;
657660
break;
658661
}
@@ -675,8 +678,8 @@ static int iir_cmd_set_data(struct comp_dev *dev,
675678
request = (struct sof_eq_iir_config *)cdata->data->data;
676679
bs = request->size;
677680
if (bs > SOF_EQ_IIR_MAX_SIZE || bs == 0) {
678-
trace_eq_error_with_ids(dev, "iir_cmd_set_data() error: "
679-
"invalid blob size");
681+
trace_eq_error_with_ids(dev, "iir_cmd_set_data(), size %d"
682+
" is invalid", bs);
680683
return -EINVAL;
681684
}
682685

@@ -717,8 +720,7 @@ static int iir_cmd_set_data(struct comp_dev *dev,
717720

718721
break;
719722
default:
720-
trace_eq_error_with_ids(dev, "iir_cmd_set_data() error: "
721-
"invalid cdata->cmd");
723+
trace_eq_error_with_ids(dev, "iir_cmd_set_data(), invalid command");
722724
ret = -EINVAL;
723725
break;
724726
}
@@ -743,8 +745,7 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data,
743745
ret = iir_cmd_get_data(dev, cdata, max_data_size);
744746
break;
745747
default:
746-
trace_eq_error_with_ids(dev, "eq_iir_cmd() error: "
747-
"invalid command");
748+
trace_eq_error_with_ids(dev, "eq_iir_cmd(), invalid command");
748749
ret = -EINVAL;
749750
}
750751

@@ -786,8 +787,7 @@ static int eq_iir_copy(struct comp_dev *dev)
786787
/* Get source, sink, number of frames etc. to process. */
787788
ret = comp_get_copy_limits(dev, &cl);
788789
if (ret < 0) {
789-
trace_eq_error_with_ids(dev, "eq_iir_copy(): "
790-
"Failed comp_copy_helper()");
790+
trace_eq_error_with_ids(dev, "eq_iir_copy(), failed comp_get_copy_limits()");
791791
return ret;
792792
}
793793

@@ -839,29 +839,25 @@ static int eq_iir_prepare(struct comp_dev *dev)
839839
dev->params.frame_fmt = cd->sink_format;
840840

841841
if (sinkb->size < config->periods_sink * sink_period_bytes) {
842-
trace_eq_error_with_ids(dev, "eq_iir_prepare() error: "
843-
"sink buffer size is insufficient");
842+
trace_eq_error_with_ids(dev, "eq_iir_prepare(), sink buffer size %d"
843+
" is insufficient", sinkb->size);
844844
ret = -ENOMEM;
845845
goto err;
846846
}
847847

848848
/* Initialize EQ */
849-
trace_eq_with_ids(dev, "eq_iir_prepare(), source_format=%d, "
850-
"sink_format=%d", cd->source_format, cd->sink_format);
849+
trace_eq_with_ids(dev, "eq_iir_prepare(), source_format=%d, sink_format=%d",
850+
cd->source_format, cd->sink_format);
851851
if (cd->config) {
852852
ret = eq_iir_setup(cd, dev->params.channels);
853853
if (ret < 0) {
854-
trace_eq_error_with_ids(dev, "eq_iir_prepare() error: "
855-
"eq_iir_setup failed.");
854+
trace_eq_error_with_ids(dev, "eq_iir_prepare(), setup failed.");
856855
goto err;
857856
}
858857
cd->eq_iir_func = eq_iir_find_func(cd, fm_configured,
859858
ARRAY_SIZE(fm_configured));
860859
if (!cd->eq_iir_func) {
861-
trace_eq_error_with_ids(dev, "eq_iir_prepare() error: "
862-
"No processing function "
863-
"available, for configured "
864-
"mode.");
860+
trace_eq_error_with_ids(dev, "eq_iir_prepare(), No proc func");
865861
ret = -EINVAL;
866862
goto err;
867863
}
@@ -870,10 +866,7 @@ static int eq_iir_prepare(struct comp_dev *dev)
870866
cd->eq_iir_func = eq_iir_find_func(cd, fm_passthrough,
871867
ARRAY_SIZE(fm_passthrough));
872868
if (!cd->eq_iir_func) {
873-
trace_eq_error_with_ids(dev, "eq_iir_prepare() error: "
874-
"No processing function "
875-
"available, for pass-through "
876-
"mode.");
869+
trace_eq_error_with_ids(dev, "eq_iir_prepare(), No pass func");
877870
ret = -EINVAL;
878871
goto err;
879872
}

0 commit comments

Comments
 (0)