Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: hdac_hda: improve error logs

We have a couple of duplicate logs and missing information, add
__func__ consistently and make sure useful error codes are logged.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240325221925.206507-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Mark Brown
ea5fee22 6a928341

+24 -20
+24 -20
sound/soc/codecs/hdac_hda.c
··· 230 230 format_val = snd_hdac_stream_format(params_channels(params), bits, params_rate(params)); 231 231 if (!format_val) { 232 232 dev_err(dai->dev, 233 - "invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n", 233 + "%s: invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n", 234 + __func__, 234 235 params_rate(params), params_channels(params), 235 236 params_format(params), maxbps); 236 237 ··· 267 266 struct snd_soc_component *component = dai->component; 268 267 struct hda_pcm_stream *hda_stream; 269 268 struct hdac_hda_priv *hda_pvt; 270 - struct hdac_device *hdev; 271 269 unsigned int format_val; 272 270 struct hda_pcm *pcm; 273 271 unsigned int stream; 274 272 int ret = 0; 275 273 276 274 hda_pvt = snd_soc_component_get_drvdata(component); 277 - hdev = &hda_pvt->codec->core; 278 275 pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai); 279 276 if (!pcm) 280 277 return -EINVAL; ··· 285 286 ret = snd_hda_codec_prepare(hda_pvt->codec, hda_stream, 286 287 stream, format_val, substream); 287 288 if (ret < 0) 288 - dev_err(&hdev->dev, "codec prepare failed %d\n", ret); 289 + dev_err(dai->dev, "%s: failed %d\n", __func__, ret); 289 290 290 291 return ret; 291 292 } ··· 297 298 struct hdac_hda_priv *hda_pvt; 298 299 struct hda_pcm_stream *hda_stream; 299 300 struct hda_pcm *pcm; 301 + int ret; 300 302 301 303 hda_pvt = snd_soc_component_get_drvdata(component); 302 304 pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai); ··· 308 308 309 309 hda_stream = &pcm->stream[substream->stream]; 310 310 311 - return hda_stream->ops.open(hda_stream, hda_pvt->codec, substream); 311 + ret = hda_stream->ops.open(hda_stream, hda_pvt->codec, substream); 312 + if (ret < 0) 313 + dev_err(dai->dev, "%s: failed %d\n", __func__, ret); 314 + 315 + return ret; 312 316 } 313 317 314 318 static void hdac_hda_dai_close(struct snd_pcm_substream *substream, ··· 371 367 pcm_name = "HDMI 3"; 372 368 break; 373 369 default: 374 - dev_err(&hcodec->core.dev, "invalid dai id %d\n", dai->id); 370 + dev_err(dai->dev, "%s: invalid dai id %d\n", __func__, dai->id); 375 371 return NULL; 376 372 } 377 373 ··· 385 381 } 386 382 } 387 383 388 - dev_err(&hcodec->core.dev, "didn't find PCM for DAI %s\n", dai->name); 384 + dev_err(dai->dev, "%s: didn't find PCM for DAI %s\n", __func__, dai->name); 389 385 return NULL; 390 386 } 391 387 ··· 415 411 416 412 hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev)); 417 413 if (!hlink) { 418 - dev_err(&hdev->dev, "hdac link not found\n"); 414 + dev_err(&hdev->dev, "%s: hdac link not found\n", __func__); 419 415 return -EIO; 420 416 } 421 417 ··· 433 429 ret = snd_hda_codec_device_new(hcodec->bus, component->card->snd_card, 434 430 hdev->addr, hcodec, true); 435 431 if (ret < 0) { 436 - dev_err(&hdev->dev, "failed to create hda codec %d\n", ret); 432 + dev_err(&hdev->dev, "%s: failed to create hda codec %d\n", __func__, ret); 437 433 goto error_no_pm; 438 434 } 439 435 ··· 450 446 if (fw) { 451 447 ret = snd_hda_load_patch(hcodec->bus, fw->size, fw->data); 452 448 if (ret < 0) { 453 - dev_err(&hdev->dev, "failed to load hda patch %d\n", ret); 449 + dev_err(&hdev->dev, "%s: failed to load hda patch %d\n", __func__, ret); 454 450 goto error_no_pm; 455 451 } 456 452 release_firmware(fw); ··· 474 470 475 471 ret = snd_hda_codec_set_name(hcodec, hcodec->preset->name); 476 472 if (ret < 0) { 477 - dev_err(&hdev->dev, "name failed %s\n", hcodec->preset->name); 473 + dev_err(&hdev->dev, "%s: name failed %s\n", __func__, hcodec->preset->name); 478 474 goto error_pm; 479 475 } 480 476 481 477 ret = snd_hdac_regmap_init(&hcodec->core); 482 478 if (ret < 0) { 483 - dev_err(&hdev->dev, "regmap init failed\n"); 479 + dev_err(&hdev->dev, "%s: regmap init failed\n", __func__); 484 480 goto error_pm; 485 481 } 486 482 ··· 488 484 if (patch) { 489 485 ret = patch(hcodec); 490 486 if (ret < 0) { 491 - dev_err(&hdev->dev, "patch failed %d\n", ret); 487 + dev_err(&hdev->dev, "%s: patch failed %d\n", __func__, ret); 492 488 goto error_regmap; 493 489 } 494 490 } else { 495 - dev_dbg(&hdev->dev, "no patch file found\n"); 491 + dev_dbg(&hdev->dev, "%s: no patch file found\n", __func__); 496 492 } 497 493 498 494 ret = snd_hda_codec_parse_pcms(hcodec); 499 495 if (ret < 0) { 500 - dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret); 496 + dev_err(&hdev->dev, "%s: unable to map pcms to dai %d\n", __func__, ret); 501 497 goto error_patch; 502 498 } 503 499 ··· 505 501 if (!is_hdmi_codec(hcodec)) { 506 502 ret = snd_hda_codec_build_controls(hcodec); 507 503 if (ret < 0) { 508 - dev_err(&hdev->dev, "unable to create controls %d\n", 509 - ret); 504 + dev_err(&hdev->dev, "%s: unable to create controls %d\n", 505 + __func__, ret); 510 506 goto error_patch; 511 507 } 512 508 } ··· 552 548 553 549 hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev)); 554 550 if (!hlink) { 555 - dev_err(&hdev->dev, "hdac link not found\n"); 551 + dev_err(&hdev->dev, "%s: hdac link not found\n", __func__); 556 552 return; 557 553 } 558 554 ··· 628 624 /* hold the ref while we probe */ 629 625 hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev)); 630 626 if (!hlink) { 631 - dev_err(&hdev->dev, "hdac link not found\n"); 627 + dev_err(&hdev->dev, "%s: hdac link not found\n", __func__); 632 628 return -EIO; 633 629 } 634 630 snd_hdac_ext_bus_link_get(hdev->bus, hlink); ··· 644 640 ARRAY_SIZE(hdac_hda_dais)); 645 641 646 642 if (ret < 0) { 647 - dev_err(&hdev->dev, "failed to register HDA codec %d\n", ret); 643 + dev_err(&hdev->dev, "%s: failed to register HDA codec %d\n", __func__, ret); 648 644 return ret; 649 645 } 650 646