Skip to content

Commit efc75b5

Browse files
softwareckilgirdwood
authored andcommitted
audio: kpb: Sanitize log messages
Remove unnecessary function names from log messages. Zephyr automatically adds function names to log entries. In some places, after changing the function name, log messages were not corrected. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent afc5dc8 commit efc75b5

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

src/audio/kpb.c

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,17 @@ static int kpb_set_verify_ipc_params(struct comp_dev *dev,
254254
kpb->host_sink = NULL;
255255

256256
if (!kpb_is_sample_width_supported(kpb->config.sampling_width)) {
257-
comp_err(dev, "kpb_set_verify_ipc_params(): requested sampling width not supported");
257+
comp_err(dev, "requested sampling width not supported");
258258
return -EINVAL;
259259
}
260260

261261
if (kpb->config.channels > KPB_MAX_SUPPORTED_CHANNELS) {
262-
comp_err(dev, "kpb_set_verify_ipc_params(): no of channels exceeded the limit");
262+
comp_err(dev, "no of channels exceeded the limit");
263263
return -EINVAL;
264264
}
265265

266266
if (kpb->config.sampling_freq != KPB_SAMPLNG_FREQUENCY) {
267-
comp_err(dev, "kpb_set_verify_ipc_params(): requested sampling frequency not supported");
267+
comp_err(dev, "requested sampling frequency not supported");
268268
return -EINVAL;
269269
}
270270

@@ -389,7 +389,7 @@ static int kpb_unbind(struct comp_dev *dev, struct bind_info *unbind_data)
389389
struct ipc4_module_bind_unbind *bu;
390390
int buf_id;
391391

392-
comp_dbg(dev, "kpb_bind()");
392+
comp_dbg(dev, "kpb_unbind()");
393393

394394
bu = unbind_data->ipc4_data;
395395
buf_id = IPC4_COMP_ID(bu->extension.r.src_queue, bu->extension.r.dst_queue);
@@ -421,7 +421,7 @@ static int kpb_set_verify_ipc_params(struct comp_dev *dev,
421421
ipc_config->size);
422422

423423
if (ret) {
424-
comp_err(dev, "kpb_new(): cannot memcpy_s %d bytes into sof_kpb_config (%zu)\n",
424+
comp_err(dev, "cannot memcpy_s %d bytes into sof_kpb_config (%zu)\n",
425425
ipc_config->size, sizeof(kpb->config));
426426
return -EINVAL;
427427
}
@@ -431,17 +431,17 @@ static int kpb_set_verify_ipc_params(struct comp_dev *dev,
431431
kpb->host_sink = NULL;
432432

433433
if (!kpb_is_sample_width_supported(kpb->config.sampling_width)) {
434-
comp_err(dev, "kpb_set_verify_ipc_params(): requested sampling width not supported");
434+
comp_err(dev, "requested sampling width not supported");
435435
return -EINVAL;
436436
}
437437

438438
if (kpb->config.channels > KPB_MAX_SUPPORTED_CHANNELS) {
439-
comp_err(dev, "kpb_set_verify_ipc_params(): no of channels exceeded the limit");
439+
comp_err(dev, "no of channels exceeded the limit");
440440
return -EINVAL;
441441
}
442442

443443
if (kpb->config.sampling_freq != KPB_SAMPLNG_FREQUENCY) {
444-
comp_err(dev, "kpb_set_verify_ipc_params(): requested sampling frequency not supported");
444+
comp_err(dev, "requested sampling frequency not supported");
445445
return -EINVAL;
446446
}
447447

@@ -485,7 +485,7 @@ static struct comp_dev *kpb_new(const struct comp_driver *drv,
485485

486486
/* make sure data size is not bigger than config space */
487487
if (ipc_config_size > kpb_config_size) {
488-
comp_cl_err(&comp_kpb, "kpb_new(): ipc config size %zu too big",
488+
comp_cl_err(&comp_kpb, "ipc config size %zu too big",
489489
ipc_config_size);
490490
return NULL;
491491
}
@@ -635,7 +635,7 @@ static size_t kpb_allocate_history_buffer(struct comp_data *kpb,
635635
}
636636
}
637637

638-
comp_cl_info(&comp_kpb, "kpb_allocate_history_buffer(): allocated %zu bytes",
638+
comp_cl_info(&comp_kpb, "allocated %zu bytes for history buffer",
639639
allocated_size);
640640

641641
return allocated_size;
@@ -688,7 +688,7 @@ static void kpb_free(struct comp_dev *dev)
688688
ret = ams_helper_unregister_consumer(dev, kpb->kpd_uuid_id,
689689
kpb_ams_kpd_notification);
690690
if (ret)
691-
comp_err(dev, "kpb_free(): AMS unregister error %d", ret);
691+
comp_err(dev, "AMS unregister error %d", ret);
692692
#else
693693
/* Unregister KPB from notifications */
694694
notifier_unregister(dev, NULL, NOTIFIER_ID_KPB_CLIENT_EVT);
@@ -732,7 +732,7 @@ static int kbp_verify_params(struct comp_dev *dev,
732732

733733
ret = comp_verify_params(dev, 0, params);
734734
if (ret < 0) {
735-
comp_err(dev, "kpb_verify_params(): comp_verify_params() failed");
735+
comp_err(dev, "comp_verify_params() failed");
736736
return ret;
737737
}
738738

@@ -752,15 +752,15 @@ static int kpb_params(struct comp_dev *dev,
752752
int err;
753753

754754
if (dev->state == COMP_STATE_PREPARE) {
755-
comp_err(dev, "kpb_params(): kpb has been already configured.");
755+
comp_err(dev, "kpb has been already configured.");
756756
return PPL_STATUS_PATH_STOP;
757757
}
758758

759759
kpb_set_params(dev, params);
760760

761761
err = kbp_verify_params(dev, params);
762762
if (err < 0) {
763-
comp_err(dev, "kpb_params(): pcm params verification failed");
763+
comp_err(dev, "pcm params verification failed");
764764
return -EINVAL;
765765
}
766766

@@ -794,7 +794,7 @@ static int kpb_prepare(struct comp_dev *dev)
794794

795795
if (kpb->state == KPB_STATE_RESETTING ||
796796
kpb->state == KPB_STATE_RESET_FINISHING) {
797-
comp_cl_err(&comp_kpb, "kpb_prepare(): can not prepare KPB due to ongoing reset, state log %x",
797+
comp_cl_err(&comp_kpb, "can not prepare KPB due to ongoing reset, state log %x",
798798
kpb->state_log);
799799
return -EBUSY;
800800
}
@@ -830,7 +830,7 @@ static int kpb_prepare(struct comp_dev *dev)
830830

831831
/* Have we allocated what we requested? */
832832
if (kpb->hd.buffer_size < hb_size_req) {
833-
comp_cl_err(&comp_kpb, "kpb_prepare(): failed to allocate space for KPB buffer");
833+
comp_cl_err(&comp_kpb, "failed to allocate space for KPB buffer");
834834
kpb_free_history_buffer(kpb->hd.c_hb);
835835
kpb->hd.c_hb = NULL;
836836
kpb->hd.buffer_size = 0;
@@ -914,7 +914,7 @@ static int kpb_prepare(struct comp_dev *dev)
914914
#endif /* CONFIG_IPC_MAJOR_4 */
915915

916916
if (!kpb->sel_sink) {
917-
comp_err(dev, "kpb_prepare(): could not find sink: sel_sink %p",
917+
comp_err(dev, "could not find sink: sel_sink %p",
918918
kpb->sel_sink);
919919
ret = -EIO;
920920
}
@@ -952,7 +952,7 @@ static int kpb_reset(struct comp_dev *dev)
952952
int ret = 0;
953953
int i;
954954

955-
comp_cl_info(&comp_kpb, "kpb_reset(): resetting from state %d, state log %x",
955+
comp_cl_info(&comp_kpb, "resetting from state %d, state log %x",
956956
kpb->state, kpb->state_log);
957957

958958
switch (kpb->state) {
@@ -1189,7 +1189,7 @@ static int kpb_copy(struct comp_dev *dev)
11891189
comp_dbg(dev, "kpb_copy()");
11901190

11911191
if (list_is_empty(&dev->bsource_list)) {
1192-
comp_err(dev, "kpb_copy(): no source.");
1192+
comp_err(dev, "no source.");
11931193
return -EINVAL;
11941194
}
11951195

@@ -1198,7 +1198,7 @@ static int kpb_copy(struct comp_dev *dev)
11981198

11991199
/* Validate source */
12001200
if (!audio_stream_get_rptr(&source->stream)) {
1201-
comp_err(dev, "kpb_copy(): invalid source pointers.");
1201+
comp_err(dev, "invalid source pointers.");
12021202
ret = -EINVAL;
12031203
return ret;
12041204
}
@@ -1210,7 +1210,7 @@ static int kpb_copy(struct comp_dev *dev)
12101210
ret = PPL_STATUS_PATH_STOP;
12111211

12121212
if (!sink) {
1213-
comp_err(dev, "kpb_copy(): no sink.");
1213+
comp_err(dev, "no sink.");
12141214
ret = -EINVAL;
12151215
break;
12161216
}
@@ -1225,14 +1225,14 @@ static int kpb_copy(struct comp_dev *dev)
12251225

12261226
/* Validate sink */
12271227
if (!audio_stream_get_wptr(&sink->stream)) {
1228-
comp_err(dev, "kpb_copy(): invalid selector sink pointers.");
1228+
comp_err(dev, "invalid selector sink pointers.");
12291229
ret = -EINVAL;
12301230
break;
12311231
}
12321232

12331233
copy_bytes = audio_stream_get_copy_bytes(&source->stream, &sink->stream);
12341234
if (!copy_bytes) {
1235-
comp_err(dev, "kpb_copy(): nothing to copy sink->free %u source->avail %u",
1235+
comp_err(dev, "nothing to copy sink->free %u source->avail %u",
12361236
audio_stream_get_free_bytes(&sink->stream),
12371237
audio_stream_get_avail_bytes(&source->stream));
12381238
ret = PPL_STATUS_PATH_STOP;
@@ -1253,7 +1253,7 @@ static int kpb_copy(struct comp_dev *dev)
12531253
produced_bytes = copy_bytes * kpb->num_of_sel_mic / channels;
12541254
produced_bytes = ROUND_DOWN(produced_bytes, total_bytes_per_sample);
12551255
if (!copy_bytes) {
1256-
comp_err(dev, "kpb_copy(): nothing to copy sink->free %u source->avail %u",
1256+
comp_err(dev, "nothing to copy sink->free %u source->avail %u",
12571257
free,
12581258
avail);
12591259
ret = PPL_STATUS_PATH_STOP;
@@ -1268,7 +1268,7 @@ static int kpb_copy(struct comp_dev *dev)
12681268
ret = kpb_buffer_data(dev, source, copy_bytes);
12691269

12701270
if (ret) {
1271-
comp_err(dev, "kpb_copy(): internal buffering failed.");
1271+
comp_err(dev, "internal buffering failed.");
12721272
break;
12731273
}
12741274
ret = PPL_STATUS_PATH_STOP;
@@ -1280,7 +1280,7 @@ static int kpb_copy(struct comp_dev *dev)
12801280
kpb->hd.buffered,
12811281
copy_bytes);
12821282
} else {
1283-
comp_err(dev, "kpb_copy(): too much data to buffer.");
1283+
comp_err(dev, "too much data to buffer.");
12841284
}
12851285

12861286
if (kpb->num_of_sel_mic == 0)
@@ -1296,21 +1296,21 @@ static int kpb_copy(struct comp_dev *dev)
12961296
sink = kpb->host_sink;
12971297

12981298
if (!sink) {
1299-
comp_err(dev, "kpb_copy(): no sink.");
1299+
comp_err(dev, "no sink.");
13001300
ret = -EINVAL;
13011301
break;
13021302
}
13031303

13041304
/* Validate sink */
13051305
if (!audio_stream_get_wptr(&sink->stream)) {
1306-
comp_err(dev, "kpb_copy(): invalid host sink pointers.");
1306+
comp_err(dev, "invalid host sink pointers.");
13071307
ret = -EINVAL;
13081308
break;
13091309
}
13101310

13111311
copy_bytes = audio_stream_get_copy_bytes(&source->stream, &sink->stream);
13121312
if (!copy_bytes) {
1313-
comp_err(dev, "kpb_copy(): nothing to copy sink->free %u source->avail %u",
1313+
comp_err(dev, "nothing to copy sink->free %u source->avail %u",
13141314
audio_stream_get_free_bytes(&sink->stream),
13151315
audio_stream_get_avail_bytes(&source->stream));
13161316
/* NOTE! We should stop further pipeline copy due to
@@ -1342,20 +1342,20 @@ static int kpb_copy(struct comp_dev *dev)
13421342
kpb->hd.free -= copy_bytes;
13431343

13441344
if (ret) {
1345-
comp_err(dev, "kpb_copy(): internal buffering failed.");
1345+
comp_err(dev, "internal buffering failed.");
13461346
break;
13471347
}
13481348

13491349
comp_update_buffer_consume(source, copy_bytes);
13501350
} else {
1351-
comp_warn(dev, "kpb_copy(): buffering skipped (no data to copy, avail %u, free %zu",
1351+
comp_warn(dev, "buffering skipped (no data to copy, avail %u, free %zu",
13521352
audio_stream_get_avail_bytes(&source->stream),
13531353
kpb->hd.free);
13541354
}
13551355

13561356
break;
13571357
default:
1358-
comp_cl_err(&comp_kpb, "kpb_copy(): wrong state (state %d, state log %x)",
1358+
comp_cl_err(&comp_kpb, "wrong state (state %d, state log %x)",
13591359
kpb->state, kpb->state_log);
13601360
ret = -EIO;
13611361
break;
@@ -1395,7 +1395,7 @@ static int kpb_buffer_data(struct comp_dev *dev,
13951395
if (kpb->state != KPB_STATE_RUN &&
13961396
kpb->state != KPB_STATE_DRAINING &&
13971397
kpb->state != KPB_STATE_INIT_DRAINING) {
1398-
comp_err(dev, "kpb_buffer_data(): wrong state! (current state %d, state log %x)",
1398+
comp_err(dev, "wrong state! (current state %d, state log %x)",
13991399
kpb->state, kpb->state_log);
14001400
return PPL_STATUS_PATH_STOP;
14011401
}
@@ -1420,12 +1420,12 @@ static int kpb_buffer_data(struct comp_dev *dev,
14201420
timeout = k_cyc_to_ms_near64(current_time - timeout);
14211421
if (timeout <= UINT_MAX)
14221422
comp_err(dev,
1423-
"kpb_buffer_data(): timeout of %u [ms] (current state %d, state log %x)",
1423+
"timeout of %u [ms] (current state %d, state log %x)",
14241424
(unsigned int)(timeout), kpb->state,
14251425
kpb->state_log);
14261426
else
14271427
comp_err(dev,
1428-
"kpb_buffer_data(): timeout > %u [ms] (current state %d, state log %x)",
1428+
"timeout > %u [ms] (current state %d, state log %x)",
14291429
UINT_MAX, kpb->state,
14301430
kpb->state_log);
14311431
return -ETIME;
@@ -1505,7 +1505,7 @@ static void kpb_event_handler(void *arg, enum notify_id type, void *event_data)
15051505
struct kpb_event_data *evd = event_data;
15061506
struct kpb_client *cli = evd->client_data;
15071507

1508-
comp_info(dev, "kpb_event_handler(): received event with ID: %d ",
1508+
comp_info(dev, "received event with ID: %d ",
15091509
evd->event_id);
15101510

15111511
switch (evd->event_id) {
@@ -1522,7 +1522,7 @@ static void kpb_event_handler(void *arg, enum notify_id type, void *event_data)
15221522
/*TODO*/
15231523
break;
15241524
default:
1525-
comp_err(dev, "kpb_cmd(): unsupported command");
1525+
comp_err(dev, "unsupported command");
15261526
break;
15271527
}
15281528
}
@@ -1544,17 +1544,17 @@ static int kpb_register_client(struct comp_data *kpb, struct kpb_client *cli)
15441544
comp_cl_info(&comp_kpb, "kpb_register_client()");
15451545

15461546
if (!cli) {
1547-
comp_cl_err(&comp_kpb, "kpb_register_client(): no client data");
1547+
comp_cl_err(&comp_kpb, "no client data");
15481548
return -EINVAL;
15491549
}
15501550
/* Do we have a room for a new client? */
15511551
if (kpb->kpb_no_of_clients >= KPB_MAX_NO_OF_CLIENTS ||
15521552
cli->id >= KPB_MAX_NO_OF_CLIENTS) {
1553-
comp_cl_err(&comp_kpb, "kpb_register_client(): no free room for client = %u ",
1553+
comp_cl_err(&comp_kpb, "no free room for client = %u",
15541554
cli->id);
15551555
ret = -EINVAL;
15561556
} else if (kpb->clients[cli->id].state != KPB_CLIENT_UNREGISTERED) {
1557-
comp_cl_err(&comp_kpb, "kpb_register_client(): client = %u already registered",
1557+
comp_cl_err(&comp_kpb, "client = %u already registered",
15581558
cli->id);
15591559
ret = -EINVAL;
15601560
} else {
@@ -1598,19 +1598,19 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli)
15981598
kpb->config.channels;
15991599
size_t period_bytes_limit;
16001600

1601-
comp_info(dev, "kpb_init_draining(): requested draining of %d [ms] from history buffer",
1601+
comp_info(dev, "requested draining of %d [ms] from history buffer",
16021602
cli->drain_req);
16031603

16041604
if (kpb->state != KPB_STATE_RUN) {
1605-
comp_err(dev, "kpb_init_draining(): wrong KPB state");
1605+
comp_err(dev, "wrong KPB state");
16061606
} else if (cli->id > KPB_MAX_NO_OF_CLIENTS) {
1607-
comp_err(dev, "kpb_init_draining(): wrong client id");
1607+
comp_err(dev, "wrong client id");
16081608
/* TODO: check also if client is registered */
16091609
} else if (!is_sink_ready) {
1610-
comp_err(dev, "kpb_init_draining(): sink not ready for draining");
1610+
comp_err(dev, "sink not ready for draining");
16111611
} else if (kpb->hd.buffered < drain_req ||
16121612
cli->drain_req > KPB_MAX_DRAINING_REQ) {
1613-
comp_cl_err(&comp_kpb, "kpb_init_draining(): not enough data in history buffer");
1613+
comp_cl_err(&comp_kpb, "not enough data in history buffer");
16141614
} else {
16151615
/* Draining accepted, find proper buffer to start reading
16161616
* At this point we are guaranteed that there is enough data
@@ -1641,7 +1641,7 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli)
16411641
(uintptr_t)buff->start_addr;
16421642
buffered += local_buffered;
16431643
} else {
1644-
comp_err(dev, "kpb_init_draining(): incorrect buffer label");
1644+
comp_err(dev, "incorrect buffer label");
16451645
}
16461646
/* Check if this is already sufficient to start draining
16471647
* if not, go to previous buffer and continue
@@ -1689,7 +1689,7 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli)
16891689
drain_interval = k_ms_to_cyc_ceil64(host_period_size / bytes_per_ms) /
16901690
KPB_DRAIN_NUM_OF_PPL_PERIODS_AT_ONCE;
16911691
period_bytes_limit = host_period_size;
1692-
comp_info(dev, "kpb_init_draining(): sync_draining_mode selected with interval %u [uS].",
1692+
comp_info(dev, "sync_draining_mode selected with interval %u [uS].",
16931693
(unsigned int)k_cyc_to_us_near64(drain_interval));
16941694
} else {
16951695
/* Unlimited draining */
@@ -2423,7 +2423,7 @@ static inline bool validate_host_params(struct comp_dev *dev,
24232423
static inline void kpb_change_state(struct comp_data *kpb,
24242424
enum kpb_state state)
24252425
{
2426-
comp_cl_dbg(&comp_kpb, "kpb_change_state(): from %d to %d",
2426+
comp_cl_dbg(&comp_kpb, "change state from %d to %d",
24272427
kpb->state, state);
24282428
kpb->state = state;
24292429
kpb->state_log = (kpb->state_log << 4) | state;

0 commit comments

Comments
 (0)