From 30a6a1a4eed170b4a55d4d1787ace3acf437ab13 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 19 Nov 2012 14:39:12 +0000 Subject: ASoC: dapm: Standardise ASoC DAPM messages Currently ASoC has a mixture of message prefixes e.g. "ASoC", "asoc" or none and message types e.g. pr_debug or dev_dbg. Make sure all ASoC core messages use the same "ASoC" prefix and convert any component device specific messages to use dev_dbg instead of pr_debug. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 134 ++++++++++++++++++++++++++++----------------------- 1 file changed, 74 insertions(+), 60 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 6e35bcae02d..1e36bc81e5a 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -220,7 +220,7 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg) else if (w->platform) return snd_soc_platform_read(w->platform, reg); - dev_err(w->dapm->dev, "no valid widget read method\n"); + dev_err(w->dapm->dev, "ASoC: no valid widget read method\n"); return -1; } @@ -231,7 +231,7 @@ static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val) else if (w->platform) return snd_soc_platform_write(w->platform, reg, val); - dev_err(w->dapm->dev, "no valid widget write method\n"); + dev_err(w->dapm->dev, "ASoC: no valid widget write method\n"); return -1; } @@ -546,7 +546,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) wlist = kzalloc(wlistsize, GFP_KERNEL); if (wlist == NULL) { dev_err(dapm->dev, - "asoc: can't allocate widget list for %s\n", + "ASoC: can't allocate widget list for %s\n", w->name); return -ENOMEM; } @@ -595,9 +595,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) prefix); ret = snd_ctl_add(card, path->kcontrol); if (ret < 0) { - dev_err(dapm->dev, - "asoc: failed to add dapm kcontrol %s: %d\n", - path->long_name, ret); + dev_err(dapm->dev, "ASoC: failed to add widget" + " %s dapm kcontrol %s: %d\n", + w->name, path->long_name, ret); kfree(wlist); kfree(path->long_name); path->long_name = NULL; @@ -626,7 +626,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) if (w->num_kcontrols != 1) { dev_err(dapm->dev, - "asoc: mux %s has incorrect number of controls\n", + "ASoC: mux %s has incorrect number of controls\n", w->name); return -EINVAL; } @@ -645,7 +645,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) wlist = krealloc(wlist, wlistsize, GFP_KERNEL); if (wlist == NULL) { dev_err(dapm->dev, - "asoc: can't allocate widget list for %s\n", w->name); + "ASoC: can't allocate widget list for %s\n", w->name); return -ENOMEM; } wlist->num_widgets = wlistentries; @@ -677,7 +677,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) name + prefix_len, prefix); ret = snd_ctl_add(card, kcontrol); if (ret < 0) { - dev_err(dapm->dev, "failed to add kcontrol %s: %d\n", + dev_err(dapm->dev, "ASoC: failed to add kcontrol %s: %d\n", w->name, ret); kfree(wlist); return ret; @@ -699,7 +699,7 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w) { if (w->num_kcontrols) dev_err(w->dapm->dev, - "asoc: PGA controls not supported: '%s'\n", w->name); + "ASoC: PGA controls not supported: '%s'\n", w->name); return 0; } @@ -725,7 +725,7 @@ static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget) case SNDRV_CTL_POWER_D3hot: case SNDRV_CTL_POWER_D3cold: if (widget->ignore_suspend) - dev_dbg(widget->dapm->dev, "%s ignoring suspend\n", + dev_dbg(widget->dapm->dev, "ASoC: %s ignoring suspend\n", widget->name); return widget->ignore_suspend; default: @@ -757,14 +757,14 @@ static int dapm_list_add_widget(struct snd_soc_dapm_widget_list **list, wlistentries * sizeof(struct snd_soc_dapm_widget *); *list = krealloc(wlist, wlistsize, GFP_KERNEL); if (*list == NULL) { - dev_err(w->dapm->dev, "can't allocate widget list for %s\n", + dev_err(w->dapm->dev, "ASoC: can't allocate widget list for %s\n", w->name); return -ENOMEM; } wlist = *list; /* insert the widget */ - dev_dbg(w->dapm->dev, "added %s in widget list pos %d\n", + dev_dbg(w->dapm->dev, "ASoC: added %s in widget list pos %d\n", w->name, wlist->num_widgets); wlist->widgets[wlist->num_widgets] = w; @@ -844,7 +844,8 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, int err; err = dapm_list_add_widget(list, path->sink); if (err < 0) { - dev_err(widget->dapm->dev, "could not add widget %s\n", + dev_err(widget->dapm->dev, + "ASoC: could not add widget %s\n", widget->name); return con; } @@ -943,7 +944,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, int err; err = dapm_list_add_widget(list, path->source); if (err < 0) { - dev_err(widget->dapm->dev, "could not add widget %s\n", + dev_err(widget->dapm->dev, + "ASoC: could not add widget %s\n", widget->name); return con; } @@ -1024,7 +1026,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, ret = regulator_allow_bypass(w->regulator, true); if (ret != 0) dev_warn(w->dapm->dev, - "Failed to bypass %s: %d\n", + "ASoC: Failed to bypass %s: %d\n", w->name, ret); } @@ -1034,7 +1036,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, ret = regulator_allow_bypass(w->regulator, false); if (ret != 0) dev_warn(w->dapm->dev, - "Failed to unbypass %s: %d\n", + "ASoC: Failed to unbypass %s: %d\n", w->name, ret); } @@ -1253,7 +1255,7 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm, ret = w->event(w, NULL, event); trace_snd_soc_dapm_widget_event_done(w, event); if (ret < 0) - pr_err("%s: %s event failed: %d\n", + dev_err(dapm->dev, "ASoC: %s: %s event failed: %d\n", ev_name, w->name, ret); } } @@ -1402,7 +1404,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm, if (ret < 0) dev_err(w->dapm->dev, - "Failed to apply widget power: %d\n", ret); + "ASoC: Failed to apply widget power: %d\n", ret); } if (!list_empty(&pending)) @@ -1431,20 +1433,21 @@ static void dapm_widget_update(struct snd_soc_dapm_context *dapm) (w->event_flags & SND_SOC_DAPM_PRE_REG)) { ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG); if (ret != 0) - pr_err("%s DAPM pre-event failed: %d\n", + dev_err(dapm->dev, "ASoC: %s DAPM pre-event failed: %d\n", w->name, ret); } ret = soc_widget_update_bits_locked(w, update->reg, update->mask, update->val); if (ret < 0) - pr_err("%s DAPM update failed: %d\n", w->name, ret); + dev_err(dapm->dev, "ASoC: %s DAPM update failed: %d\n", + w->name, ret); if (w->event && (w->event_flags & SND_SOC_DAPM_POST_REG)) { ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG); if (ret != 0) - pr_err("%s DAPM post-event failed: %d\n", + dev_err(dapm->dev, "ASoC: %s DAPM post-event failed: %d\n", w->name, ret); } } @@ -1466,7 +1469,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie) ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY); if (ret != 0) dev_err(d->dev, - "Failed to turn on bias: %d\n", ret); + "ASoC: Failed to turn on bias: %d\n", ret); } /* Prepare for a STADDBY->ON or ON->STANDBY transition */ @@ -1474,7 +1477,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie) ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE); if (ret != 0) dev_err(d->dev, - "Failed to prepare bias: %d\n", ret); + "ASoC: Failed to prepare bias: %d\n", ret); } } @@ -1492,7 +1495,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie) d->target_bias_level == SND_SOC_BIAS_OFF)) { ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY); if (ret != 0) - dev_err(d->dev, "Failed to apply standby bias: %d\n", + dev_err(d->dev, "ASoC: Failed to apply standby bias: %d\n", ret); } @@ -1501,7 +1504,8 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie) d->target_bias_level == SND_SOC_BIAS_OFF) { ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_OFF); if (ret != 0) - dev_err(d->dev, "Failed to turn off bias: %d\n", ret); + dev_err(d->dev, "ASoC: Failed to turn off bias: %d\n", + ret); if (d->dev) pm_runtime_put(d->dev); @@ -1512,7 +1516,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie) d->target_bias_level == SND_SOC_BIAS_ON) { ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_ON); if (ret != 0) - dev_err(d->dev, "Failed to apply active bias: %d\n", + dev_err(d->dev, "ASoC: Failed to apply active bias: %d\n", ret); } } @@ -1838,7 +1842,7 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, if (!dapm->debugfs_dapm) { dev_warn(dapm->dev, - "Failed to create DAPM debugfs directory\n"); + "ASoC: Failed to create DAPM debugfs directory\n"); return; } @@ -2123,7 +2127,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); if (!w) { - dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); + dev_err(dapm->dev, "ASoC: DAPM unknown pin %s\n", pin); return -EINVAL; } @@ -2212,8 +2216,16 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, if (!wsource) wsource = wtsource; - if (wsource == NULL || wsink == NULL) + if (wsource == NULL) { + dev_err(dapm->dev, "ASoC: no source widget found for %s\n", + route->source); return -ENODEV; + } + if (wsink == NULL) { + dev_err(dapm->dev, "ASoC: no sink widget found for %s\n", + route->sink); + return -ENODEV; + } path = kzalloc(sizeof(struct snd_soc_dapm_path), GFP_KERNEL); if (!path) @@ -2308,7 +2320,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, return 0; err: - dev_warn(dapm->dev, "asoc: no dapm match for %s --> %s --> %s\n", + dev_warn(dapm->dev, "ASoC: no dapm match for %s --> %s --> %s\n", source, control, sink); kfree(path); return ret; @@ -2325,7 +2337,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm, if (route->control) { dev_err(dapm->dev, - "Removal of routes with controls not supported\n"); + "ASoC: Removal of routes with controls not supported\n"); return -EINVAL; } @@ -2360,7 +2372,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm, list_del(&path->list_source); kfree(path); } else { - dev_warn(dapm->dev, "Route %s->%s does not exist\n", + dev_warn(dapm->dev, "ASoC: Route %s->%s does not exist\n", source, sink); } @@ -2389,8 +2401,10 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, for (i = 0; i < num; i++) { r = snd_soc_dapm_add_route(dapm, route); if (r < 0) { - dev_err(dapm->dev, "Failed to add route %s->%s\n", - route->source, route->sink); + dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n", + route->source, + route->control ? route->control : "direct", + route->sink); ret = r; } route++; @@ -2438,19 +2452,19 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm, int count = 0; if (!source) { - dev_err(dapm->dev, "Unable to find source %s for weak route\n", + dev_err(dapm->dev, "ASoC: Unable to find source %s for weak route\n", route->source); return -ENODEV; } if (!sink) { - dev_err(dapm->dev, "Unable to find sink %s for weak route\n", + dev_err(dapm->dev, "ASoC: Unable to find sink %s for weak route\n", route->sink); return -ENODEV; } if (route->control || route->connected) - dev_warn(dapm->dev, "Ignoring control for weak route %s->%s\n", + dev_warn(dapm->dev, "ASoC: Ignoring control for weak route %s->%s\n", route->source, route->sink); list_for_each_entry(path, &source->sinks, list_source) { @@ -2461,10 +2475,10 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm, } if (count == 0) - dev_err(dapm->dev, "No path found for weak route %s->%s\n", + dev_err(dapm->dev, "ASoC: No path found for weak route %s->%s\n", route->source, route->sink); if (count > 1) - dev_warn(dapm->dev, "%d paths found for weak route %s->%s\n", + dev_warn(dapm->dev, "ASoC: %d paths found for weak route %s->%s\n", count, route->source, route->sink); return 0; @@ -2601,7 +2615,7 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, if (snd_soc_volsw_is_stereo(mc)) dev_warn(widget->dapm->dev, - "Control '%s' is stereo, which is not supported\n", + "ASoC: Control '%s' is stereo, which is not supported\n", kcontrol->id.name); ucontrol->value.integer.value[0] = @@ -2644,7 +2658,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, if (snd_soc_volsw_is_stereo(mc)) dev_warn(widget->dapm->dev, - "Control '%s' is stereo, which is not supported\n", + "ASoC: Control '%s' is stereo, which is not supported\n", kcontrol->id.name); val = (ucontrol->value.integer.value[0] & mask); @@ -3021,7 +3035,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, w->regulator = devm_regulator_get(dapm->dev, w->name); if (IS_ERR(w->regulator)) { ret = PTR_ERR(w->regulator); - dev_err(dapm->dev, "Failed to request %s: %d\n", + dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n", w->name, ret); return NULL; } @@ -3031,7 +3045,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, w->clk = devm_clk_get(dapm->dev, w->name); if (IS_ERR(w->clk)) { ret = PTR_ERR(w->clk); - dev_err(dapm->dev, "Failed to request %s: %d\n", + dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n", w->name, ret); return NULL; } @@ -3182,7 +3196,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, if (config->formats) { fmt = ffs(config->formats) - 1; } else { - dev_warn(w->dapm->dev, "Invalid format %llx specified\n", + dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", config->formats); fmt = 0; } @@ -3215,7 +3229,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, params, source); if (ret != 0) { dev_err(source->dev, - "hw_params() failed: %d\n", ret); + "ASoC: hw_params() failed: %d\n", ret); goto out; } } @@ -3226,7 +3240,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, sink); if (ret != 0) { dev_err(sink->dev, - "hw_params() failed: %d\n", ret); + "ASoC: hw_params() failed: %d\n", ret); goto out; } } @@ -3235,14 +3249,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMU: ret = snd_soc_dai_digital_mute(sink, 0); if (ret != 0 && ret != -ENOTSUPP) - dev_warn(sink->dev, "Failed to unmute: %d\n", ret); + dev_warn(sink->dev, "ASoC: Failed to unmute: %d\n", ret); ret = 0; break; case SND_SOC_DAPM_PRE_PMD: ret = snd_soc_dai_digital_mute(sink, 1); if (ret != 0 && ret != -ENOTSUPP) - dev_warn(sink->dev, "Failed to mute: %d\n", ret); + dev_warn(sink->dev, "ASoC: Failed to mute: %d\n", ret); ret = 0; break; @@ -3281,11 +3295,11 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, template.event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD; - dev_dbg(card->dev, "adding %s widget\n", link_name); + dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name); w = snd_soc_dapm_new_control(&card->dapm, &template); if (!w) { - dev_err(card->dev, "Failed to create %s widget\n", + dev_err(card->dev, "ASoC: Failed to create %s widget\n", link_name); return -ENOMEM; } @@ -3319,12 +3333,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, template.name = dai->driver->playback.stream_name; template.sname = dai->driver->playback.stream_name; - dev_dbg(dai->dev, "adding %s widget\n", + dev_dbg(dai->dev, "ASoC: adding %s widget\n", template.name); w = snd_soc_dapm_new_control(dapm, &template); if (!w) { - dev_err(dapm->dev, "Failed to create %s widget\n", + dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", dai->driver->playback.stream_name); } @@ -3337,12 +3351,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, template.name = dai->driver->capture.stream_name; template.sname = dai->driver->capture.stream_name; - dev_dbg(dai->dev, "adding %s widget\n", + dev_dbg(dai->dev, "ASoC: adding %s widget\n", template.name); w = snd_soc_dapm_new_control(dapm, &template); if (!w) { - dev_err(dapm->dev, "Failed to create %s widget\n", + dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", dai->driver->capture.stream_name); } @@ -3518,11 +3532,11 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); if (!w) { - dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); + dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin); return -EINVAL; } - dev_dbg(w->dapm->dev, "dapm: force enable pin %s\n", pin); + dev_dbg(w->dapm->dev, "ASoC: force enable pin %s\n", pin); w->connected = 1; w->force = 1; dapm_mark_dirty(w, "force enable"); @@ -3605,7 +3619,7 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, false); if (!w) { - dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); + dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin); return -EINVAL; } @@ -3664,7 +3678,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec) struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_widget *w; - dev_dbg(codec->dev, "Auto NC: DAPMs: card:%p codec:%p\n", + dev_dbg(codec->dev, "ASoC: Auto NC: DAPMs: card:%p codec:%p\n", &card->dapm, &codec->dapm); list_for_each_entry(w, &card->widgets, list) { @@ -3674,7 +3688,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec) case snd_soc_dapm_input: case snd_soc_dapm_output: case snd_soc_dapm_micbias: - dev_dbg(codec->dev, "Auto NC: Checking widget %s\n", + dev_dbg(codec->dev, "ASoC: Auto NC: Checking widget %s\n", w->name); if (!snd_soc_dapm_widget_in_card_paths(card, w)) { dev_dbg(codec->dev, -- cgit v1.2.3 From 204b62c6bc1b8d3ce405c59281585af523b14172 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 19 Nov 2012 14:39:13 +0000 Subject: ASoC: cache: Standardise ASoC cache messages Currently ASoC has a mixture of message prefixes e.g. "ASoC", "asoc" or none and message types e.g. pr_debug or dev_dbg. Make sure all ASoC core messages use the same "ASoC" prefix and convert any component device specific messages to use dev_dbg instead of pr_debug. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-cache.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 9d56f0218f4..e72f55428f0 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c @@ -88,7 +88,7 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) ret = snd_soc_write(codec, i, val); if (ret) return ret; - dev_dbg(codec->dev, "Synced register %#x, value = %#x\n", + dev_dbg(codec->dev, "ASoC: Synced register %#x, value = %#x\n", i, val); } return 0; @@ -156,7 +156,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) /* Fall back to flat compression */ if (i == ARRAY_SIZE(cache_types)) { - dev_warn(codec->dev, "Could not match compress type: %d\n", + dev_warn(codec->dev, "ASoC: Could not match compress type: %d\n", codec->compress_type); i = 0; } @@ -166,7 +166,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) if (codec->cache_ops->init) { if (codec->cache_ops->name) - dev_dbg(codec->dev, "Initializing %s cache for %s codec\n", + dev_dbg(codec->dev, "ASoC: Initializing %s cache for %s codec\n", codec->cache_ops->name, codec->name); return codec->cache_ops->init(codec); } @@ -181,7 +181,7 @@ int snd_soc_cache_exit(struct snd_soc_codec *codec) { if (codec->cache_ops && codec->cache_ops->exit) { if (codec->cache_ops->name) - dev_dbg(codec->dev, "Destroying %s cache for %s codec\n", + dev_dbg(codec->dev, "ASoC: Destroying %s cache for %s codec\n", codec->cache_ops->name, codec->name); return codec->cache_ops->exit(codec); } @@ -265,7 +265,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec) name = "unknown"; if (codec->cache_ops->name) - dev_dbg(codec->dev, "Syncing %s cache for %s codec\n", + dev_dbg(codec->dev, "ASoC: Syncing %s cache for %s codec\n", codec->cache_ops->name, codec->name); trace_snd_soc_cache_sync(codec, name, "start"); ret = codec->cache_ops->sync(codec); -- cgit v1.2.3 From 008d55e258d8d9a5bfe03d652779cd14c770c60a Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 19 Nov 2012 14:39:14 +0000 Subject: ASoC: Jack: Standardise ASoC Jack messages Currently ASoC has a mixture of message prefixes e.g. "ASoC", "asoc" or none and message types e.g. pr_debug or dev_dbg. Make sure all ASoC core messages use the same "ASoC" prefix and convert any component device specific messages to use dev_dbg instead of pr_debug. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-jack.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index 1ab5fe04bfc..8da7d8a8ee7 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -172,12 +172,13 @@ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, for (i = 0; i < count; i++) { if (!pins[i].pin) { - printk(KERN_ERR "No name for pin %d\n", i); + dev_err(jack->codec->dev, "ASoC: No name for pin %d\n", + i); return -EINVAL; } if (!pins[i].mask) { - printk(KERN_ERR "No mask for pin %d (%s)\n", i, - pins[i].pin); + dev_err(jack->codec->dev, "ASoC: No mask for pin %d" + " (%s)\n", i, pins[i].pin); return -EINVAL; } @@ -297,13 +298,13 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, for (i = 0; i < count; i++) { if (!gpio_is_valid(gpios[i].gpio)) { - printk(KERN_ERR "Invalid gpio %d\n", + dev_err(jack->codec->dev, "ASoC: Invalid gpio %d\n", gpios[i].gpio); ret = -EINVAL; goto undo; } if (!gpios[i].name) { - printk(KERN_ERR "No name for gpio %d\n", + dev_err(jack->codec->dev, "ASoC: No name for gpio %d\n", gpios[i].gpio); ret = -EINVAL; goto undo; @@ -332,7 +333,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, if (gpios[i].wake) { ret = irq_set_irq_wake(gpio_to_irq(gpios[i].gpio), 1); if (ret != 0) - printk(KERN_ERR + dev_err(jack->codec->dev, "ASoC: " "Failed to mark GPIO %d as wake source: %d\n", gpios[i].gpio, ret); } -- cgit v1.2.3 From 103d84a3cbe1e70a2ade5a901d2e31cda41b14a0 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 19 Nov 2012 14:39:15 +0000 Subject: ASoC: pcm: Standardise ASoC PCM messages Currently ASoC has a mixture of message prefixes e.g. "ASoC", "asoc" or none and message types e.g. pr_debug or dev_dbg. Make sure all ASoC core messages use the same "ASoC" prefix and convert any component device specific messages to use dev_dbg instead of pr_debug. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-pcm.c | 193 ++++++++++++++++++++++++++-------------------------- 1 file changed, 98 insertions(+), 95 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ef22d0bd9e9..314102ad862 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -43,7 +43,7 @@ static int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, struct snd_soc_pcm_runtime *be = dpcm->be; - dev_dbg(be->dev, "pm: BE %s event %d dir %d\n", + dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", be->dai_link->name, event, dir); snd_soc_dapm_stream_event(be, dir, event); @@ -70,18 +70,19 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, */ if (!soc_dai->rate) { dev_warn(soc_dai->dev, - "Not enforcing symmetric_rates due to race\n"); + "ASoC: Not enforcing symmetric_rates due to race\n"); return 0; } - dev_dbg(soc_dai->dev, "Symmetry forces %dHz rate\n", soc_dai->rate); + dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n", soc_dai->rate); ret = snd_pcm_hw_constraint_minmax(substream->runtime, SNDRV_PCM_HW_PARAM_RATE, soc_dai->rate, soc_dai->rate); if (ret < 0) { dev_err(soc_dai->dev, - "Unable to apply rate symmetry constraint: %d\n", ret); + "ASoC: Unable to apply rate symmetry constraint: %d\n", + ret); return ret; } @@ -118,7 +119,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream, sample_sizes[i], bits); if (ret != 0) dev_warn(dai->dev, - "Failed to set MSB %d/%d: %d\n", + "ASoC: Failed to set MSB %d/%d: %d\n", bits, sample_sizes[i], ret); } } @@ -149,8 +150,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) if (cpu_dai->driver->ops->startup) { ret = cpu_dai->driver->ops->startup(substream, cpu_dai); if (ret < 0) { - dev_err(cpu_dai->dev, "can't open interface %s: %d\n", - cpu_dai->name, ret); + dev_err(cpu_dai->dev, "ASoC: can't open interface" + " %s: %d\n", cpu_dai->name, ret); goto out; } } @@ -158,8 +159,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) if (platform->driver->ops && platform->driver->ops->open) { ret = platform->driver->ops->open(substream); if (ret < 0) { - dev_err(platform->dev, "can't open platform %s: %d\n", - platform->name, ret); + dev_err(platform->dev, "ASoC: can't open platform" + " %s: %d\n", platform->name, ret); goto platform_err; } } @@ -167,8 +168,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) if (codec_dai->driver->ops->startup) { ret = codec_dai->driver->ops->startup(substream, codec_dai); if (ret < 0) { - dev_err(codec_dai->dev, "can't open codec %s: %d\n", - codec_dai->name, ret); + dev_err(codec_dai->dev, "ASoC: can't open codec" + " %s: %d\n", codec_dai->name, ret); goto codec_dai_err; } } @@ -176,7 +177,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) if (rtd->dai_link->ops && rtd->dai_link->ops->startup) { ret = rtd->dai_link->ops->startup(substream); if (ret < 0) { - pr_err("asoc: %s startup failed: %d\n", + pr_err("ASoC: %s startup failed: %d\n", rtd->dai_link->name, ret); goto machine_err; } @@ -238,18 +239,18 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ret = -EINVAL; snd_pcm_limit_hw_rates(runtime); if (!runtime->hw.rates) { - printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", + printk(KERN_ERR "ASoC: %s <-> %s No matching rates\n", codec_dai->name, cpu_dai->name); goto config_err; } if (!runtime->hw.formats) { - printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", + printk(KERN_ERR "ASoC: %s <-> %s No matching formats\n", codec_dai->name, cpu_dai->name); goto config_err; } if (!runtime->hw.channels_min || !runtime->hw.channels_max || runtime->hw.channels_min > runtime->hw.channels_max) { - printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", + printk(KERN_ERR "ASoC: %s <-> %s No matching channels\n", codec_dai->name, cpu_dai->name); goto config_err; } @@ -270,12 +271,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) goto config_err; } - pr_debug("asoc: %s <-> %s info:\n", + pr_debug("ASoC: %s <-> %s info:\n", codec_dai->name, cpu_dai->name); - pr_debug("asoc: rate mask 0x%x\n", runtime->hw.rates); - pr_debug("asoc: min ch %d max ch %d\n", runtime->hw.channels_min, + pr_debug("ASoC: rate mask 0x%x\n", runtime->hw.rates); + pr_debug("ASoC: min ch %d max ch %d\n", runtime->hw.channels_min, runtime->hw.channels_max); - pr_debug("asoc: min rate %d max rate %d\n", runtime->hw.rate_min, + pr_debug("ASoC: min rate %d max rate %d\n", runtime->hw.rate_min, runtime->hw.rate_max); dynamic: @@ -330,7 +331,7 @@ static void close_delayed_work(struct work_struct *work) mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); - pr_debug("pop wq checking: %s status: %s waiting: %s\n", + dev_dbg(rtd->dev, "ASoC: pop wq checking: %s status: %s waiting: %s\n", codec_dai->driver->playback.stream_name, codec_dai->playback_active ? "active" : "inactive", codec_dai->pop_wait ? "yes" : "no"); @@ -444,7 +445,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) if (rtd->dai_link->ops && rtd->dai_link->ops->prepare) { ret = rtd->dai_link->ops->prepare(substream); if (ret < 0) { - pr_err("asoc: machine prepare error: %d\n", ret); + dev_err(rtd->card->dev, "ASoC: machine prepare error:" + " %d\n", ret); goto out; } } @@ -452,8 +454,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) if (platform->driver->ops && platform->driver->ops->prepare) { ret = platform->driver->ops->prepare(substream); if (ret < 0) { - dev_err(platform->dev, "platform prepare error: %d\n", - ret); + dev_err(platform->dev, "ASoC: platform prepare error:" + " %d\n", ret); goto out; } } @@ -461,7 +463,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) if (codec_dai->driver->ops->prepare) { ret = codec_dai->driver->ops->prepare(substream, codec_dai); if (ret < 0) { - dev_err(codec_dai->dev, "DAI prepare error: %d\n", + dev_err(codec_dai->dev, "ASoC: DAI prepare error: %d\n", ret); goto out; } @@ -470,7 +472,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) if (cpu_dai->driver->ops->prepare) { ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); if (ret < 0) { - dev_err(cpu_dai->dev, "DAI prepare error: %d\n", + dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n", ret); goto out; } @@ -512,7 +514,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) { ret = rtd->dai_link->ops->hw_params(substream, params); if (ret < 0) { - pr_err("asoc: machine hw_params failed: %d\n", ret); + dev_err(rtd->card->dev, "ASoC: machine hw_params" + " failed: %d\n", ret); goto out; } } @@ -520,8 +523,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (codec_dai->driver->ops->hw_params) { ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai); if (ret < 0) { - dev_err(codec_dai->dev, "can't set %s hw params: %d\n", - codec_dai->name, ret); + dev_err(codec_dai->dev, "ASoC: can't set %s hw params:" + " %d\n", codec_dai->name, ret); goto codec_err; } } @@ -529,7 +532,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (cpu_dai->driver->ops->hw_params) { ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai); if (ret < 0) { - dev_err(cpu_dai->dev, "%s hw params failed: %d\n", + dev_err(cpu_dai->dev, "ASoC: %s hw params failed: %d\n", cpu_dai->name, ret); goto interface_err; } @@ -538,7 +541,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (platform->driver->ops && platform->driver->ops->hw_params) { ret = platform->driver->ops->hw_params(substream, params); if (ret < 0) { - dev_err(platform->dev, "%s hw params failed: %d\n", + dev_err(platform->dev, "ASoC: %s hw params failed: %d\n", platform->name, ret); goto platform_err; } @@ -760,7 +763,7 @@ static void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) struct snd_soc_dpcm *dpcm, *d; list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { - dev_dbg(fe->dev, "BE %s disconnect check for %s\n", + dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", stream ? "capture" : "playback", dpcm->be->dai_link->name); @@ -815,7 +818,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, } } - dev_err(card->dev, "can't get %s BE for %s\n", + dev_err(card->dev, "ASoC: can't get %s BE for %s\n", stream ? "capture" : "playback", widget->name); return NULL; } @@ -866,7 +869,7 @@ static int dpcm_path_get(struct snd_soc_pcm_runtime *fe, /* get number of valid DAI paths and their widgets */ paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, &list); - dev_dbg(fe->dev, "found %d audio %s paths\n", paths, + dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, stream ? "capture" : "playback"); *list_ = list; @@ -903,7 +906,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, if (widget && widget_in_list(list, widget)) continue; - dev_dbg(fe->dev, "pruning %s BE %s for %s\n", + dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", stream ? "capture" : "playback", dpcm->be->dai_link->name, fe->dai_link->name); dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; @@ -911,7 +914,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, prune++; } - dev_dbg(fe->dev, "found %d old BE paths for pruning\n", prune); + dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune); return prune; } @@ -932,7 +935,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, /* is there a valid BE rtd for this widget */ be = dpcm_get_be(card, list->widgets[i], stream); if (!be) { - dev_err(fe->dev, "no BE found for %s\n", + dev_err(fe->dev, "ASoC: no BE found for %s\n", list->widgets[i]->name); continue; } @@ -948,7 +951,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, /* newly connected FE and BE */ err = dpcm_be_connect(fe, be, stream); if (err < 0) { - dev_err(fe->dev, "can't connect %s\n", + dev_err(fe->dev, "ASoC: can't connect %s\n", list->widgets[i]->name); break; } else if (err == 0) /* already connected */ @@ -959,7 +962,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, new++; } - dev_dbg(fe->dev, "found %d new BE paths\n", new); + dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new); return new; } @@ -998,7 +1001,7 @@ static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe, snd_soc_dpcm_get_substream(be, stream); if (be->dpcm[stream].users == 0) - dev_err(be->dev, "no users %s at close - state %d\n", + dev_err(be->dev, "ASoC: no users %s at close - state %d\n", stream ? "capture" : "playback", be->dpcm[stream].state); @@ -1032,7 +1035,7 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) /* first time the dpcm is open ? */ if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) - dev_err(be->dev, "too many users %s at open %d\n", + dev_err(be->dev, "ASoC: too many users %s at open %d\n", stream ? "capture" : "playback", be->dpcm[stream].state); @@ -1043,15 +1046,15 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) continue; - dev_dbg(be->dev, "dpcm: open BE %s\n", be->dai_link->name); + dev_dbg(be->dev, "ASoC: open BE %s\n", be->dai_link->name); be_substream->runtime = be->dpcm[stream].runtime; err = soc_pcm_open(be_substream); if (err < 0) { - dev_err(be->dev, "BE open failed %d\n", err); + dev_err(be->dev, "ASoC: BE open failed %d\n", err); be->dpcm[stream].users--; if (be->dpcm[stream].users < 0) - dev_err(be->dev, "no users %s at unwind %d\n", + dev_err(be->dev, "ASoC: no users %s at unwind %d\n", stream ? "capture" : "playback", be->dpcm[stream].state); @@ -1076,7 +1079,7 @@ unwind: continue; if (be->dpcm[stream].users == 0) - dev_err(be->dev, "no users %s at close %d\n", + dev_err(be->dev, "ASoC: no users %s at close %d\n", stream ? "capture" : "playback", be->dpcm[stream].state); @@ -1128,16 +1131,16 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) ret = dpcm_be_dai_startup(fe, fe_substream->stream); if (ret < 0) { - dev_err(fe->dev,"dpcm: failed to start some BEs %d\n", ret); + dev_err(fe->dev,"ASoC: failed to start some BEs %d\n", ret); goto be_err; } - dev_dbg(fe->dev, "dpcm: open FE %s\n", fe->dai_link->name); + dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name); /* start the DAI frontend */ ret = soc_pcm_open(fe_substream); if (ret < 0) { - dev_err(fe->dev,"dpcm: failed to start FE %d\n", ret); + dev_err(fe->dev,"ASoC: failed to start FE %d\n", ret); goto unwind; } @@ -1172,7 +1175,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) continue; if (be->dpcm[stream].users == 0) - dev_err(be->dev, "no users %s at close - state %d\n", + dev_err(be->dev, "ASoC: no users %s at close - state %d\n", stream ? "capture" : "playback", be->dpcm[stream].state); @@ -1183,7 +1186,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) continue; - dev_dbg(be->dev, "dpcm: close BE %s\n", + dev_dbg(be->dev, "ASoC: close BE %s\n", dpcm->fe->dai_link->name); soc_pcm_close(be_substream); @@ -1204,7 +1207,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) /* shutdown the BEs */ dpcm_be_dai_shutdown(fe, substream->stream); - dev_dbg(fe->dev, "dpcm: close FE %s\n", fe->dai_link->name); + dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); /* now shutdown the frontend */ soc_pcm_close(substream); @@ -1243,7 +1246,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) continue; - dev_dbg(be->dev, "dpcm: hw_free BE %s\n", + dev_dbg(be->dev, "ASoC: hw_free BE %s\n", dpcm->fe->dai_link->name); soc_pcm_hw_free(be_substream); @@ -1262,12 +1265,12 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; - dev_dbg(fe->dev, "dpcm: hw_free FE %s\n", fe->dai_link->name); + dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); /* call hw_free on the frontend */ err = soc_pcm_hw_free(substream); if (err < 0) - dev_err(fe->dev,"dpcm: hw_free FE %s failed\n", + dev_err(fe->dev,"ASoC: hw_free FE %s failed\n", fe->dai_link->name); /* only hw_params backends that are either sinks or sources @@ -1305,7 +1308,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) continue; - dev_dbg(be->dev, "dpcm: hw_params BE %s\n", + dev_dbg(be->dev, "ASoC: hw_params BE %s\n", dpcm->fe->dai_link->name); /* copy params for each dpcm */ @@ -1318,7 +1321,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) &dpcm->hw_params); if (ret < 0) { dev_err(be->dev, - "dpcm: hw_params BE fixup failed %d\n", + "ASoC: hw_params BE fixup failed %d\n", ret); goto unwind; } @@ -1327,7 +1330,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params); if (ret < 0) { dev_err(dpcm->be->dev, - "dpcm: hw_params BE failed %d\n", ret); + "ASoC: hw_params BE failed %d\n", ret); goto unwind; } @@ -1374,18 +1377,18 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, sizeof(struct snd_pcm_hw_params)); ret = dpcm_be_dai_hw_params(fe, substream->stream); if (ret < 0) { - dev_err(fe->dev,"dpcm: hw_params BE failed %d\n", ret); + dev_err(fe->dev,"ASoC: hw_params BE failed %d\n", ret); goto out; } - dev_dbg(fe->dev, "dpcm: hw_params FE %s rate %d chan %x fmt %d\n", + dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n", fe->dai_link->name, params_rate(params), params_channels(params), params_format(params)); /* call hw_params on the frontend */ ret = soc_pcm_hw_params(substream, params); if (ret < 0) { - dev_err(fe->dev,"dpcm: hw_params FE failed %d\n", ret); + dev_err(fe->dev,"ASoC: hw_params FE failed %d\n", ret); dpcm_be_dai_hw_free(fe, stream); } else fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; @@ -1401,12 +1404,12 @@ static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm, { int ret; - dev_dbg(dpcm->be->dev, "dpcm: trigger BE %s cmd %d\n", + dev_dbg(dpcm->be->dev, "ASoC: trigger BE %s cmd %d\n", dpcm->fe->dai_link->name, cmd); ret = soc_pcm_trigger(substream, cmd); if (ret < 0) - dev_err(dpcm->be->dev,"dpcm: trigger BE failed %d\n", ret); + dev_err(dpcm->be->dev,"ASoC: trigger BE failed %d\n", ret); return ret; } @@ -1517,12 +1520,12 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) case SND_SOC_DPCM_TRIGGER_PRE: /* call trigger on the frontend before the backend. */ - dev_dbg(fe->dev, "dpcm: pre trigger FE %s cmd %d\n", + dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", fe->dai_link->name, cmd); ret = soc_pcm_trigger(substream, cmd); if (ret < 0) { - dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); + dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); goto out; } @@ -1533,11 +1536,11 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); if (ret < 0) { - dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); + dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); goto out; } - dev_dbg(fe->dev, "dpcm: post trigger FE %s cmd %d\n", + dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", fe->dai_link->name, cmd); ret = soc_pcm_trigger(substream, cmd); @@ -1545,17 +1548,17 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) case SND_SOC_DPCM_TRIGGER_BESPOKE: /* bespoke trigger() - handles both FE and BEs */ - dev_dbg(fe->dev, "dpcm: bespoke trigger FE %s cmd %d\n", + dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n", fe->dai_link->name, cmd); ret = soc_pcm_bespoke_trigger(substream, cmd); if (ret < 0) { - dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); + dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); goto out; } break; default: - dev_err(fe->dev, "dpcm: invalid trigger cmd %d for %s\n", cmd, + dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, fe->dai_link->name); ret = -EINVAL; goto out; @@ -1598,12 +1601,12 @@ static int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) continue; - dev_dbg(be->dev, "dpcm: prepare BE %s\n", + dev_dbg(be->dev, "ASoC: prepare BE %s\n", dpcm->fe->dai_link->name); ret = soc_pcm_prepare(be_substream); if (ret < 0) { - dev_err(be->dev, "dpcm: backend prepare failed %d\n", + dev_err(be->dev, "ASoC: backend prepare failed %d\n", ret); break; } @@ -1620,13 +1623,13 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); - dev_dbg(fe->dev, "dpcm: prepare FE %s\n", fe->dai_link->name); + dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; /* there is no point preparing this FE if there are no BEs */ if (list_empty(&fe->dpcm[stream].be_clients)) { - dev_err(fe->dev, "dpcm: no backend DAIs enabled for %s\n", + dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n", fe->dai_link->name); ret = -EINVAL; goto out; @@ -1639,7 +1642,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) /* call prepare on the frontend */ ret = soc_pcm_prepare(substream); if (ret < 0) { - dev_err(fe->dev,"dpcm: prepare FE %s failed\n", + dev_err(fe->dev,"ASoC: prepare FE %s failed\n", fe->dai_link->name); goto out; } @@ -1673,33 +1676,33 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; int err; - dev_dbg(fe->dev, "runtime %s close on FE %s\n", + dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n", stream ? "capture" : "playback", fe->dai_link->name); if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) { /* call bespoke trigger - FE takes care of all BE triggers */ - dev_dbg(fe->dev, "dpcm: bespoke trigger FE %s cmd stop\n", + dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n", fe->dai_link->name); err = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP); if (err < 0) - dev_err(fe->dev,"dpcm: trigger FE failed %d\n", err); + dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); } else { - dev_dbg(fe->dev, "dpcm: trigger FE %s cmd stop\n", + dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n", fe->dai_link->name); err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); if (err < 0) - dev_err(fe->dev,"dpcm: trigger FE failed %d\n", err); + dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); } err = dpcm_be_dai_hw_free(fe, stream); if (err < 0) - dev_err(fe->dev,"dpcm: hw_free FE failed %d\n", err); + dev_err(fe->dev,"ASoC: hw_free FE failed %d\n", err); err = dpcm_be_dai_shutdown(fe, stream); if (err < 0) - dev_err(fe->dev,"dpcm: shutdown FE failed %d\n", err); + dev_err(fe->dev,"ASoC: shutdown FE failed %d\n", err); /* run the stream event for each BE */ dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); @@ -1715,7 +1718,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; int ret; - dev_dbg(fe->dev, "runtime %s open on FE %s\n", + dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", stream ? "capture" : "playback", fe->dai_link->name); /* Only start the BE if the FE is ready */ @@ -1761,22 +1764,22 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) { /* call trigger on the frontend - FE takes care of all BE triggers */ - dev_dbg(fe->dev, "dpcm: bespoke trigger FE %s cmd start\n", + dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n", fe->dai_link->name); ret = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START); if (ret < 0) { - dev_err(fe->dev,"dpcm: bespoke trigger FE failed %d\n", ret); + dev_err(fe->dev,"ASoC: bespoke trigger FE failed %d\n", ret); goto hw_free; } } else { - dev_dbg(fe->dev, "dpcm: trigger FE %s cmd start\n", + dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n", fe->dai_link->name); ret = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_START); if (ret < 0) { - dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); + dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret); goto hw_free; } } @@ -1805,7 +1808,7 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; ret = dpcm_run_update_startup(fe, stream); if (ret < 0) - dev_err(fe->dev, "failed to startup some BEs\n"); + dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; return ret; @@ -1818,7 +1821,7 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; ret = dpcm_run_update_shutdown(fe, stream); if (ret < 0) - dev_err(fe->dev, "failed to shutdown some BEs\n"); + dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; return ret; @@ -1853,7 +1856,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget) continue; /* DAPM sync will call this to update DSP paths */ - dev_dbg(fe->dev, "DPCM runtime update for FE %s\n", + dev_dbg(fe->dev, "ASoC: DPCM runtime update for FE %s\n", fe->dai_link->name); /* skip if FE doesn't have playback capability */ @@ -1862,7 +1865,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget) paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); if (paths < 0) { - dev_warn(fe->dev, "%s no valid %s path\n", + dev_warn(fe->dev, "ASoC: %s no valid %s path\n", fe->dai_link->name, "playback"); mutex_unlock(&card->mutex); return paths; @@ -1891,7 +1894,7 @@ capture: paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); if (paths < 0) { - dev_warn(fe->dev, "%s no valid %s path\n", + dev_warn(fe->dev, "ASoC: %s no valid %s path\n", fe->dai_link->name, "capture"); mutex_unlock(&card->mutex); return paths; @@ -1934,7 +1937,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute) if (be->dai_link->ignore_suspend) continue; - dev_dbg(be->dev, "BE digital mute %s\n", be->dai_link->name); + dev_dbg(be->dev, "ASoC: BE digital mute %s\n", be->dai_link->name); if (drv->ops->digital_mute && dai->playback_active) drv->ops->digital_mute(dai, mute); @@ -1955,7 +1958,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) fe->dpcm[stream].runtime = fe_substream->runtime; if (dpcm_path_get(fe, stream, &list) <= 0) { - dev_dbg(fe->dev, "asoc: %s no valid %s route\n", + dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", fe->dai_link->name, stream ? "capture" : "playback"); } @@ -2039,11 +2042,11 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) capture, &pcm); } if (ret < 0) { - dev_err(rtd->card->dev, "can't create pcm for %s\n", + dev_err(rtd->card->dev, "ASoC: can't create pcm for %s\n", rtd->dai_link->name); return ret; } - dev_dbg(rtd->card->dev, "registered pcm #%d %s\n",num, new_name); + dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n",num, new_name); /* DAPM dai link stream work */ INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); @@ -2097,7 +2100,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) if (platform->driver->pcm_new) { ret = platform->driver->pcm_new(rtd); if (ret < 0) { - dev_err(platform->dev, "pcm constructor failed\n"); + dev_err(platform->dev, "ASoC: pcm constructor failed\n"); return ret; } } -- cgit v1.2.3 From f110bfc7ac552f2518d38067e5facf53c24748ba Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 19 Nov 2012 14:47:09 +0000 Subject: ASoC: core: Standardise ASoC messages Currently ASoC has a mixture of message prefixes e.g. "ASoC", "asoc" or none and message types e.g. pr_debug or dev_dbg. Make sure all ASoC core messages use the same "ASoC" prefix and convert any component device specific messages to use dev_dbg instead of pr_debug. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 241 ++++++++++++++++++++++++++------------------------- 1 file changed, 123 insertions(+), 118 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 10d21be383f..cee37ee6f18 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -271,7 +271,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec) codec->debugfs_codec_root = debugfs_create_dir(codec->name, debugfs_card_root); if (!codec->debugfs_codec_root) { - dev_warn(codec->dev, "Failed to create codec debugfs directory\n"); + dev_warn(codec->dev, "ASoC: Failed to create codec debugfs" + " directory\n"); return; } @@ -284,7 +285,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec) codec->debugfs_codec_root, codec, &codec_reg_fops); if (!codec->debugfs_reg) - dev_warn(codec->dev, "Failed to create codec register debugfs file\n"); + dev_warn(codec->dev, "ASoC: Failed to create codec register" + " debugfs file\n"); snd_soc_dapm_debugfs_init(&codec->dapm, codec->debugfs_codec_root); } @@ -302,7 +304,7 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform) debugfs_card_root); if (!platform->debugfs_platform_root) { dev_warn(platform->dev, - "Failed to create platform debugfs directory\n"); + "ASoC: Failed to create platform debugfs directory\n"); return; } @@ -430,7 +432,7 @@ static void soc_init_card_debugfs(struct snd_soc_card *card) &card->pop_time); if (!card->debugfs_pop_time) dev_warn(card->dev, - "Failed to create pop time debugfs file\n"); + "ASoC: Failed to create pop time debugfs file\n"); } static void soc_cleanup_card_debugfs(struct snd_soc_card *card) @@ -475,7 +477,7 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, !strcmp(card->rtd[i].dai_link->name, dai_link)) return card->rtd[i].pcm->streams[stream].substream; } - dev_dbg(card->dev, "failed to find dai link %s\n", dai_link); + dev_dbg(card->dev, "ASoC: failed to find dai link %s\n", dai_link); return NULL; } EXPORT_SYMBOL_GPL(snd_soc_get_dai_substream); @@ -489,7 +491,7 @@ struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, if (!strcmp(card->rtd[i].dai_link->name, dai_link)) return &card->rtd[i]; } - dev_dbg(card->dev, "failed to find rtd %s\n", dai_link); + dev_dbg(card->dev, "ASoC: failed to find rtd %s\n", dai_link); return NULL; } EXPORT_SYMBOL_GPL(snd_soc_get_pcm_runtime); @@ -519,7 +521,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec) codec->card->snd_card->number, 0, codec->name); err = device_register(&codec->ac97->dev); if (err < 0) { - snd_printk(KERN_ERR "Can't register ac97 bus\n"); + dev_err(codec->dev, "ASoC: Can't register ac97 bus\n"); codec->ac97->dev.bus = NULL; return err; } @@ -628,7 +630,8 @@ int snd_soc_suspend(struct device *dev) */ if (codec->dapm.idle_bias_off) { dev_dbg(codec->dev, - "idle_bias_off CODEC on over suspend\n"); + "ASoC: idle_bias_off CODEC on" + " over suspend\n"); break; } case SND_SOC_BIAS_OFF: @@ -639,7 +642,8 @@ int snd_soc_suspend(struct device *dev) regcache_mark_dirty(codec->control_data); break; default: - dev_dbg(codec->dev, "CODEC is on over suspend\n"); + dev_dbg(codec->dev, "ASoC: CODEC is on" + " over suspend\n"); break; } } @@ -676,7 +680,7 @@ static void soc_resume_deferred(struct work_struct *work) * so userspace apps are blocked from touching us */ - dev_dbg(card->dev, "starting resume work\n"); + dev_dbg(card->dev, "ASoC: starting resume work\n"); /* Bring us up into D2 so that DAPM starts enabling things */ snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D2); @@ -708,7 +712,8 @@ static void soc_resume_deferred(struct work_struct *work) codec->suspended = 0; break; default: - dev_dbg(codec->dev, "CODEC was on over suspend\n"); + dev_dbg(codec->dev, "ASoC: CODEC was on over" + " suspend\n"); break; } } @@ -758,7 +763,7 @@ static void soc_resume_deferred(struct work_struct *work) if (card->resume_post) card->resume_post(card); - dev_dbg(card->dev, "resume work completed\n"); + dev_dbg(card->dev, "ASoC: resume work completed\n"); /* userspace can access us now we are back as we were before */ snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D0); @@ -790,12 +795,12 @@ int snd_soc_resume(struct device *dev) ac97_control |= cpu_dai->driver->ac97_control; } if (ac97_control) { - dev_dbg(dev, "Resuming AC97 immediately\n"); + dev_dbg(dev, "ASoC: Resuming AC97 immediately\n"); soc_resume_deferred(&card->deferred_resume_work); } else { - dev_dbg(dev, "Scheduling resume work\n"); + dev_dbg(dev, "ASoC: Scheduling resume work\n"); if (!schedule_work(&card->deferred_resume_work)) - dev_err(dev, "resume work item may be lost\n"); + dev_err(dev, "ASoC: resume work item may be lost\n"); } return 0; @@ -818,7 +823,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) struct snd_soc_dai *codec_dai, *cpu_dai; const char *platform_name; - dev_dbg(card->dev, "binding %s at idx %d\n", dai_link->name, num); + dev_dbg(card->dev, "ASoC: binding %s at idx %d\n", dai_link->name, num); /* Find CPU DAI from registered DAIs*/ list_for_each_entry(cpu_dai, &dai_list, list) { @@ -836,7 +841,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) } if (!rtd->cpu_dai) { - dev_err(card->dev, "CPU DAI %s not registered\n", + dev_err(card->dev, "ASoC: CPU DAI %s not registered\n", dai_link->cpu_dai_name); return -EPROBE_DEFER; } @@ -867,14 +872,14 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) } if (!rtd->codec_dai) { - dev_err(card->dev, "CODEC DAI %s not registered\n", + dev_err(card->dev, "ASoC: CODEC DAI %s not registered\n", dai_link->codec_dai_name); return -EPROBE_DEFER; } } if (!rtd->codec) { - dev_err(card->dev, "CODEC %s not registered\n", + dev_err(card->dev, "ASoC: CODEC %s not registered\n", dai_link->codec_name); return -EPROBE_DEFER; } @@ -898,7 +903,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) rtd->platform = platform; } if (!rtd->platform) { - dev_err(card->dev, "platform %s not registered\n", + dev_err(card->dev, "ASoC: platform %s not registered\n", dai_link->platform_name); return -EPROBE_DEFER; } @@ -915,8 +920,8 @@ static int soc_remove_platform(struct snd_soc_platform *platform) if (platform->driver->remove) { ret = platform->driver->remove(platform); if (ret < 0) - pr_err("asoc: failed to remove %s: %d\n", - platform->name, ret); + dev_err(platform->dev, "ASoC: failed to remove %d\n", + ret); } /* Make sure all DAPM widgets are freed */ @@ -937,9 +942,7 @@ static void soc_remove_codec(struct snd_soc_codec *codec) if (codec->driver->remove) { err = codec->driver->remove(codec); if (err < 0) - dev_err(codec->dev, - "asoc: failed to remove %s: %d\n", - codec->name, err); + dev_err(codec->dev, "ASoC: failed to remove %d\n", err); } /* Make sure all DAPM widgets are freed */ @@ -971,8 +974,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order) if (codec_dai->driver->remove) { err = codec_dai->driver->remove(codec_dai); if (err < 0) - pr_err("asoc: failed to remove %s: %d\n", - codec_dai->name, err); + dev_err(codec_dai->dev, + "ASoC: failed to remove %s: %d\n", + codec_dai->name, err); } codec_dai->probed = 0; list_del(&codec_dai->card_list); @@ -984,8 +988,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order) if (cpu_dai->driver->remove) { err = cpu_dai->driver->remove(cpu_dai); if (err < 0) - pr_err("asoc: failed to remove %s: %d\n", - cpu_dai->name, err); + dev_err(cpu_dai->dev, + "ASoC: failed to remove %s: %d\n", + cpu_dai->name, err); } cpu_dai->probed = 0; list_del(&cpu_dai->card_list); @@ -1099,8 +1104,7 @@ static int soc_probe_codec(struct snd_soc_card *card, ret = driver->probe(codec); if (ret < 0) { dev_err(codec->dev, - "asoc: failed to probe CODEC %s: %d\n", - codec->name, ret); + "ASoC: failed to probe CODEC %d\n", ret); goto err_probe; } } @@ -1163,8 +1167,7 @@ static int soc_probe_platform(struct snd_soc_card *card, ret = driver->probe(platform); if (ret < 0) { dev_err(platform->dev, - "asoc: failed to probe platform %s: %d\n", - platform->name, ret); + "ASoC: failed to probe platform %d\n", ret); goto err_probe; } } @@ -1229,7 +1232,7 @@ static int soc_post_component_init(struct snd_soc_card *card, else if (dailess && aux_dev->init) ret = aux_dev->init(&codec->dapm); if (ret < 0) { - dev_err(card->dev, "asoc: failed to init %s: %d\n", name, ret); + dev_err(card->dev, "ASoC: failed to init %s: %d\n", name, ret); return ret; } codec->name_prefix = temp; @@ -1253,7 +1256,7 @@ static int soc_post_component_init(struct snd_soc_card *card, ret = device_add(rtd->dev); if (ret < 0) { dev_err(card->dev, - "asoc: failed to register runtime device: %d\n", ret); + "ASoC: failed to register runtime device: %d\n", ret); return ret; } rtd->dev_registered = 1; @@ -1262,14 +1265,13 @@ static int soc_post_component_init(struct snd_soc_card *card, ret = snd_soc_dapm_sys_add(rtd->dev); if (ret < 0) dev_err(codec->dev, - "asoc: failed to add codec dapm sysfs entries: %d\n", - ret); + "ASoC: failed to add codec dapm sysfs entries: %d\n", ret); /* add codec sysfs entries */ ret = device_create_file(rtd->dev, &dev_attr_codec_reg); if (ret < 0) dev_err(codec->dev, - "asoc: failed to add codec sysfs files: %d\n", ret); + "ASoC: failed to add codec sysfs files: %d\n", ret); #ifdef CONFIG_DEBUG_FS /* add DPCM sysfs entries */ @@ -1278,7 +1280,7 @@ static int soc_post_component_init(struct snd_soc_card *card, ret = soc_dpcm_debugfs_add(rtd); if (ret < 0) - dev_err(rtd->dev, "asoc: failed to add dpcm sysfs entries: %d\n", ret); + dev_err(rtd->dev, "ASoC: failed to add dpcm sysfs entries: %d\n", ret); out: #endif @@ -1333,7 +1335,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) struct snd_soc_dapm_widget *play_w, *capture_w; int ret; - dev_dbg(card->dev, "probe %s dai link %d late %d\n", + dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n", card->name, num, order); /* config components */ @@ -1359,8 +1361,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) if (cpu_dai->driver->probe) { ret = cpu_dai->driver->probe(cpu_dai); if (ret < 0) { - pr_err("asoc: failed to probe CPU DAI %s: %d\n", - cpu_dai->name, ret); + dev_err(cpu_dai->dev, + "ASoC: failed to probe CPU DAI %s: %d\n", + cpu_dai->name, ret); module_put(cpu_dai->dev->driver->owner); return ret; } @@ -1375,8 +1378,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) if (codec_dai->driver->probe) { ret = codec_dai->driver->probe(codec_dai); if (ret < 0) { - pr_err("asoc: failed to probe CODEC DAI %s: %d\n", - codec_dai->name, ret); + dev_err(codec_dai->dev, + "ASoC: failed to probe CODEC DAI %s: %d\n", + codec_dai->name, ret); return ret; } } @@ -1396,13 +1400,14 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) ret = device_create_file(rtd->dev, &dev_attr_pmdown_time); if (ret < 0) - pr_warn("asoc: failed to add pmdown_time sysfs:%d\n", ret); + dev_warn(rtd->dev, "ASoC: failed to add pmdown_time sysfs: %d\n", + ret); if (cpu_dai->driver->compress_dai) { /*create compress_device"*/ ret = soc_new_compress(rtd, num); if (ret < 0) { - pr_err("asoc: can't create compress %s\n", + dev_err(card->dev, "ASoC: can't create compress %s\n", dai_link->stream_name); return ret; } @@ -1412,7 +1417,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) /* create the pcm */ ret = soc_new_pcm(rtd, num); if (ret < 0) { - pr_err("asoc: can't create pcm %s :%d\n", + dev_err(card->dev, "ASoC: can't create pcm %s :%d\n", dai_link->stream_name, ret); return ret; } @@ -1424,7 +1429,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) ret = snd_soc_dapm_new_pcm(card, dai_link->params, capture_w, play_w); if (ret != 0) { - dev_err(card->dev, "Can't link %s to %s: %d\n", + dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n", play_w->name, capture_w->name, ret); return ret; } @@ -1436,7 +1441,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) ret = snd_soc_dapm_new_pcm(card, dai_link->params, capture_w, play_w); if (ret != 0) { - dev_err(card->dev, "Can't link %s to %s: %d\n", + dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n", play_w->name, capture_w->name, ret); return ret; } @@ -1473,7 +1478,8 @@ static int soc_register_ac97_dai_link(struct snd_soc_pcm_runtime *rtd) ret = soc_ac97_dev_register(rtd->codec); if (ret < 0) { - pr_err("asoc: AC97 device register failed:%d\n", ret); + dev_err(rtd->codec->dev, + "ASoC: AC97 device register failed: %d\n", ret); return ret; } @@ -1502,7 +1508,7 @@ static int soc_check_aux_dev(struct snd_soc_card *card, int num) return 0; } - dev_err(card->dev, "%s not registered\n", aux_dev->codec_name); + dev_err(card->dev, "ASoC: %s not registered\n", aux_dev->codec_name); return -EPROBE_DEFER; } @@ -1518,7 +1524,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num) if (!strcmp(codec->name, aux_dev->codec_name)) { if (codec->probed) { dev_err(codec->dev, - "asoc: codec already probed"); + "ASoC: codec already probed"); ret = -EBUSY; goto out; } @@ -1526,7 +1532,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num) } } /* codec not found */ - dev_err(card->dev, "asoc: codec %s not found", aux_dev->codec_name); + dev_err(card->dev, "ASoC: codec %s not found", aux_dev->codec_name); return -EPROBE_DEFER; found: @@ -1569,8 +1575,8 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec, codec->compress_type = compress_type; ret = snd_soc_cache_init(codec); if (ret < 0) { - dev_err(codec->dev, "Failed to set cache compression type: %d\n", - ret); + dev_err(codec->dev, "ASoC: Failed to set cache compression" + " type: %d\n", ret); return ret; } codec->cache_init = 1; @@ -1626,8 +1632,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, card->owner, 0, &card->snd_card); if (ret < 0) { - pr_err("asoc: can't create sound card for card %s: %d\n", - card->name, ret); + dev_err(card->dev, "ASoC: can't create sound card for" + " card %s: %d\n", card->name, ret); goto base_error; } card->snd_card->dev = card->dev; @@ -1663,8 +1669,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) for (i = 0; i < card->num_links; i++) { ret = soc_probe_link_components(card, i, order); if (ret < 0) { - pr_err("asoc: failed to instantiate card %s: %d\n", - card->name, ret); + dev_err(card->dev, + "ASoC: failed to instantiate card %d\n", + ret); goto probe_dai_err; } } @@ -1676,8 +1683,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) for (i = 0; i < card->num_links; i++) { ret = soc_probe_link_dais(card, i, order); if (ret < 0) { - pr_err("asoc: failed to instantiate card %s: %d\n", - card->name, ret); + dev_err(card->dev, + "ASoC: failed to instantiate card %d\n", + ret); goto probe_dai_err; } } @@ -1686,8 +1694,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) for (i = 0; i < card->num_aux_devs; i++) { ret = soc_probe_aux_dev(card, i); if (ret < 0) { - pr_err("asoc: failed to add auxiliary devices %s: %d\n", - card->name, ret); + dev_err(card->dev, + "ASoC: failed to add auxiliary devices %d\n", + ret); goto probe_aux_dev_err; } } @@ -1712,7 +1721,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) dai_fmt); if (ret != 0 && ret != -ENOTSUPP) dev_warn(card->rtd[i].codec_dai->dev, - "Failed to set DAI format: %d\n", + "ASoC: Failed to set DAI format: %d\n", ret); } @@ -1723,7 +1732,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) dai_fmt); if (ret != 0 && ret != -ENOTSUPP) dev_warn(card->rtd[i].cpu_dai->dev, - "Failed to set DAI format: %d\n", + "ASoC: Failed to set DAI format: %d\n", ret); } else if (dai_fmt) { /* Flip the polarity for the "CPU" end */ @@ -1748,7 +1757,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) dai_fmt); if (ret != 0 && ret != -ENOTSUPP) dev_warn(card->rtd[i].cpu_dai->dev, - "Failed to set DAI format: %d\n", + "ASoC: Failed to set DAI format: %d\n", ret); } } @@ -1775,7 +1784,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) if (card->late_probe) { ret = card->late_probe(card); if (ret < 0) { - dev_err(card->dev, "%s late_probe() failed: %d\n", + dev_err(card->dev, "ASoC: %s late_probe() failed: %d\n", card->name, ret); goto probe_aux_dev_err; } @@ -1789,8 +1798,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) ret = snd_card_register(card->snd_card); if (ret < 0) { - pr_err("asoc: failed to register soundcard for %s: %d\n", - card->name, ret); + dev_err(card->dev, "ASoC: failed to register soundcard %d\n", + ret); goto probe_aux_dev_err; } @@ -1799,8 +1808,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) for (i = 0; i < card->num_rtd; i++) { ret = soc_register_ac97_dai_link(&card->rtd[i]); if (ret < 0) { - pr_err("asoc: failed to register AC97 %s: %d\n", - card->name, ret); + dev_err(card->dev, "ASoC: failed to register AC97:" + " %d\n", ret); while (--i >= 0) soc_unregister_ac97_dai_link(card->rtd[i].codec); goto probe_aux_dev_err; @@ -1846,7 +1855,7 @@ static int soc_probe(struct platform_device *pdev) return -EINVAL; dev_warn(&pdev->dev, - "ASoC machine %s should use snd_soc_register_card()\n", + "ASoC: machine %s should use snd_soc_register_card()\n", card->name); /* Bodge while we unpick instantiation */ @@ -1996,7 +2005,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform, unsigned int ret; if (!platform->driver->read) { - dev_err(platform->dev, "platform has no read back\n"); + dev_err(platform->dev, "ASoC: platform has no read back\n"); return -1; } @@ -2012,7 +2021,7 @@ int snd_soc_platform_write(struct snd_soc_platform *platform, unsigned int reg, unsigned int val) { if (!platform->driver->write) { - dev_err(platform->dev, "platform has no write back\n"); + dev_err(platform->dev, "ASoC: platform has no write back\n"); return -1; } @@ -2283,7 +2292,8 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev, err = snd_ctl_add(card, snd_soc_cnew(control, data, control->name, prefix)); if (err < 0) { - dev_err(dev, "Failed to add %s: %d\n", control->name, err); + dev_err(dev, "ASoC: Failed to add %s: %d\n", + control->name, err); return err; } } @@ -3534,15 +3544,14 @@ int snd_soc_register_card(struct snd_soc_card *card) * not both or neither. */ if (!!link->codec_name == !!link->codec_of_node) { - dev_err(card->dev, - "Neither/both codec name/of_node are set for %s\n", - link->name); + dev_err(card->dev, "ASoC: Neither/both codec" + " name/of_node are set for %s\n", link->name); return -EINVAL; } /* Codec DAI name must be specified */ if (!link->codec_dai_name) { - dev_err(card->dev, "codec_dai_name not set for %s\n", - link->name); + dev_err(card->dev, "ASoC: codec_dai_name not" + " set for %s\n", link->name); return -EINVAL; } @@ -3551,8 +3560,8 @@ int snd_soc_register_card(struct snd_soc_card *card) * can be left unspecified, and a dummy platform will be used. */ if (link->platform_name && link->platform_of_node) { - dev_err(card->dev, - "Both platform name/of_node are set for %s\n", link->name); + dev_err(card->dev, "ASoC: Both platform name/of_node" + " are set for %s\n", link->name); return -EINVAL; } @@ -3562,9 +3571,8 @@ int snd_soc_register_card(struct snd_soc_card *card) * name alone.. */ if (link->cpu_name && link->cpu_of_node) { - dev_err(card->dev, - "Neither/both cpu name/of_node are set for %s\n", - link->name); + dev_err(card->dev, "ASoC: Neither/both " + "cpu name/of_node are set for %s\n",link->name); return -EINVAL; } /* @@ -3573,9 +3581,8 @@ int snd_soc_register_card(struct snd_soc_card *card) */ if (!link->cpu_dai_name && !(link->cpu_name || link->cpu_of_node)) { - dev_err(card->dev, - "Neither cpu_dai_name nor cpu_name/of_node are set for %s\n", - link->name); + dev_err(card->dev, "ASoC: Neither cpu_dai_name nor " + "cpu_name/of_node are set for %s\n", link->name); return -EINVAL; } } @@ -3622,7 +3629,7 @@ int snd_soc_unregister_card(struct snd_soc_card *card) { if (card->instantiated) soc_cleanup_card_resources(card); - dev_dbg(card->dev, "Unregistered card '%s'\n", card->name); + dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name); return 0; } @@ -3679,8 +3686,8 @@ static inline char *fmt_multiple_name(struct device *dev, struct snd_soc_dai_driver *dai_drv) { if (dai_drv->name == NULL) { - pr_err("asoc: error - multiple DAI %s registered with no name\n", - dev_name(dev)); + dev_err(dev, "ASoC: error - multiple DAI %s registered with" + " no name\n", dev_name(dev)); return NULL; } @@ -3698,7 +3705,7 @@ int snd_soc_register_dai(struct device *dev, struct snd_soc_codec *codec; struct snd_soc_dai *dai; - dev_dbg(dev, "dai register %s\n", dev_name(dev)); + dev_dbg(dev, "ASoC: dai register %s\n", dev_name(dev)); dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); if (dai == NULL) @@ -3721,7 +3728,7 @@ int snd_soc_register_dai(struct device *dev, list_for_each_entry(codec, &codec_list, list) { if (codec->dev == dev) { - dev_dbg(dev, "Mapped DAI %s to CODEC %s\n", + dev_dbg(dev, "ASoC: Mapped DAI %s to CODEC %s\n", dai->name, codec->name); dai->codec = codec; break; @@ -3735,7 +3742,7 @@ int snd_soc_register_dai(struct device *dev, mutex_unlock(&client_mutex); - pr_debug("Registered DAI '%s'\n", dai->name); + dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name); return 0; } @@ -3761,7 +3768,7 @@ found: list_del(&dai->list); mutex_unlock(&client_mutex); - pr_debug("Unregistered DAI '%s'\n", dai->name); + dev_dbg(dev, "ASoC: Unregistered DAI '%s'\n", dai->name); kfree(dai->name); kfree(dai); } @@ -3780,7 +3787,7 @@ int snd_soc_register_dais(struct device *dev, struct snd_soc_dai *dai; int i, ret = 0; - dev_dbg(dev, "dai register %s #%Zu\n", dev_name(dev), count); + dev_dbg(dev, "ASoC: dai register %s #%Zu\n", dev_name(dev), count); for (i = 0; i < count; i++) { @@ -3812,8 +3819,8 @@ int snd_soc_register_dais(struct device *dev, list_for_each_entry(codec, &codec_list, list) { if (codec->dev == dev) { - dev_dbg(dev, "Mapped DAI %s to CODEC %s\n", - dai->name, codec->name); + dev_dbg(dev, "ASoC: Mapped DAI %s to " + "CODEC %s\n", dai->name, codec->name); dai->codec = codec; break; } @@ -3826,7 +3833,7 @@ int snd_soc_register_dais(struct device *dev, mutex_unlock(&client_mutex); - pr_debug("Registered DAI '%s'\n", dai->name); + dev_dbg(dai->dev, "ASoC: Registered DAI '%s'\n", dai->name); } return 0; @@ -3864,7 +3871,7 @@ int snd_soc_register_platform(struct device *dev, { struct snd_soc_platform *platform; - dev_dbg(dev, "platform register %s\n", dev_name(dev)); + dev_dbg(dev, "ASoC: platform register %s\n", dev_name(dev)); platform = kzalloc(sizeof(struct snd_soc_platform), GFP_KERNEL); if (platform == NULL) @@ -3888,7 +3895,7 @@ int snd_soc_register_platform(struct device *dev, list_add(&platform->list, &platform_list); mutex_unlock(&client_mutex); - pr_debug("Registered platform '%s'\n", platform->name); + dev_dbg(dev, "ASoC: Registered platform '%s'\n", platform->name); return 0; } @@ -3914,7 +3921,7 @@ found: list_del(&platform->list); mutex_unlock(&client_mutex); - pr_debug("Unregistered platform '%s'\n", platform->name); + dev_dbg(dev, "ASoC: Unregistered platform '%s'\n", platform->name); kfree(platform->name); kfree(platform); } @@ -4043,11 +4050,11 @@ int snd_soc_register_codec(struct device *dev, if (num_dai) { ret = snd_soc_register_dais(dev, dai_drv, num_dai); if (ret < 0) - dev_err(codec->dev, "Failed to regster DAIs: %d\n", - ret); + dev_err(codec->dev, "ASoC: Failed to regster" + " DAIs: %d\n", ret); } - pr_debug("Registered codec '%s'\n", codec->name); + dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n", codec->name); return 0; fail: @@ -4082,7 +4089,7 @@ found: list_del(&codec->list); mutex_unlock(&client_mutex); - pr_debug("Unregistered codec '%s'\n", codec->name); + dev_dbg(codec->dev, "ASoC: Unregistered codec '%s'\n", codec->name); snd_soc_cache_exit(codec); kfree(codec->reg_def_copy); @@ -4106,7 +4113,7 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card, */ if (ret < 0 && ret != -EINVAL) { dev_err(card->dev, - "Property '%s' could not be read: %d\n", + "ASoC: Property '%s' could not be read: %d\n", propname, ret); return ret; } @@ -4125,15 +4132,13 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, num_routes = of_property_count_strings(np, propname); if (num_routes < 0 || num_routes & 1) { - dev_err(card->dev, - "Property '%s' does not exist or its length is not even\n", - propname); + dev_err(card->dev, "ASoC: Property '%s' does not exist or its" + " length is not even\n", propname); return -EINVAL; } num_routes /= 2; if (!num_routes) { - dev_err(card->dev, - "Property '%s's length is zero\n", + dev_err(card->dev, "ASoC: Property '%s's length is zero\n", propname); return -EINVAL; } @@ -4142,7 +4147,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, GFP_KERNEL); if (!routes) { dev_err(card->dev, - "Could not allocate DAPM route table\n"); + "ASoC: Could not allocate DAPM route table\n"); return -EINVAL; } @@ -4150,9 +4155,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ret = of_property_read_string_index(np, propname, 2 * i, &routes[i].sink); if (ret) { - dev_err(card->dev, - "Property '%s' index %d could not be read: %d\n", - propname, 2 * i, ret); + dev_err(card->dev, "ASoC: Property '%s' index %d" + " could not be read: %d\n", propname, 2 * i, + ret); kfree(routes); return -EINVAL; } @@ -4160,8 +4165,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, (2 * i) + 1, &routes[i].source); if (ret) { dev_err(card->dev, - "Property '%s' index %d could not be read: %d\n", - propname, (2 * i) + 1, ret); + "ASoC: Property '%s' index %d could not be" + " read: %d\n", propname, (2 * i) + 1, ret); kfree(routes); return -EINVAL; } -- cgit v1.2.3 From b1bc7b3c9c46d9966f22f05c7cdd9b3e67b13d55 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 26 Sep 2012 14:25:17 +0100 Subject: ASoC: pcm: Report error code when we fail to init platform Signed-off-by: Mark Brown --- sound/soc/soc-pcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 314102ad862..5c3ca2a3466 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2100,7 +2100,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) if (platform->driver->pcm_new) { ret = platform->driver->pcm_new(rtd); if (ret < 0) { - dev_err(platform->dev, "ASoC: pcm constructor failed\n"); + dev_err(platform->dev, + "ASoC: pcm constructor failed: %d\n", + ret); return ret; } } -- cgit v1.2.3