Skip to contentSkip to conversation

ASoC: codec: wm8400: replace printk() calls with dev_*() device aware logging

PATCH In review [email protected] 3 participants 3 messages Oct 25, 2025 – Oct 30, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: codec: wm8400: replace printk() calls with dev_*() device aware logging

From: HariKrishna Sagala <[email protected]>

Replace direct printk() calls with the appropriate dev_*() logging APIs.Use dev_err, dev_warn, dev_info, or dev_dbg to reflect the correct severity level. Pass the canonical struct device pointer so logs include device context and become traceable to specific hardware instances.Improve log clarity, make messages filterable by device and align the driver with kernel logging conventions to aid debugging and maintenance.

---

This patch replaces direct printk() calls with the dev_*() logging APIs. The change uses dev_err/dev_warn/dev_info/dev_dbg and converts messages to dev_*() where applicable. Note that this file already uses dev_*() logging in other sections and the patch makes the remaining calls consistent with those existing usages. I have verified compilation with the configs "CONFIG_COMPILE_TEST","CONFIG_MFD_WM8400" enabled and booted. Runtime testing is requested to confirm logging output, device prefixes and that there are no regressions.Please report any failures or unexpected log behavior and I will update the patch accordingly.

 sound/soc/codecs/wm8400.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/codecs/wm8400.c +5 -4
index 5ad6d5b63ffc..d716775cedc2 100644
@@ -318,6 +318,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
 	struct soc_mixer_control *mc =
 		(struct soc_mixer_control *)kcontrol->private_value;
+	struct wm8400_priv *wm8400 = snd_soc_component_get_drvdata(component);
 	u32 reg_shift = mc->shift;
 	int ret = 0;
 	u16 reg;
@@ -326,7 +327,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
 	case WM8400_SPEAKER_MIXER | (WM8400_LDSPK << 8) :
 		reg = snd_soc_component_read(component, WM8400_OUTPUT_MIXER1);
 		if (reg & WM8400_LDLO) {
-			printk(KERN_WARNING
+			dev_warn(wm8400->wm8400->dev,
 			"Cannot set as Output Mixer 1 LDLO Set\n");
 			ret = -1;
 		}
@@ -334,7 +335,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
 	case WM8400_SPEAKER_MIXER | (WM8400_RDSPK << 8):
 		reg = snd_soc_component_read(component, WM8400_OUTPUT_MIXER2);
 		if (reg & WM8400_RDRO) {
-			printk(KERN_WARNING
+			dev_warn(wm8400->wm8400->dev,
 			"Cannot set as Output Mixer 2 RDRO Set\n");
 			ret = -1;
 		}
@@ -342,7 +343,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
 	case WM8400_OUTPUT_MIXER1 | (WM8400_LDLO << 8):
 		reg = snd_soc_component_read(component, WM8400_SPEAKER_MIXER);
 		if (reg & WM8400_LDSPK) {
-			printk(KERN_WARNING
+			dev_warn(wm8400->wm8400->dev,
 			"Cannot set as Speaker Mixer LDSPK Set\n");
 			ret = -1;
 		}
@@ -350,7 +351,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
 	case WM8400_OUTPUT_MIXER2 | (WM8400_RDRO << 8):
 		reg = snd_soc_component_read(component, WM8400_SPEAKER_MIXER);
 		if (reg & WM8400_RDSPK) {
-			printk(KERN_WARNING
+			dev_warn(wm8400->wm8400->dev,
 			"Cannot set as Speaker Mixer RDSPK Set\n");
 			ret = -1;
 		}

base-commit: 6548d364a3e850326831799d7e3ea2d7bb97ba08

Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Sat, Oct 25, 2025 at 10:00:11AM +0530, [email protected] wrote:

From: HariKrishna Sagala <[email protected]>

Replace direct printk() calls with the appropriate dev_*() logging APIs.Use dev_err, dev_warn, dev_info, or dev_dbg to reflect the correct severity level. Pass the canonical struct device pointer so logs include device context and become traceable to specific hardware instances.Improve log clarity, make messages filterable by device and align the driver with kernel logging conventions to aid debugging and maintenance.

Quoted 2 lines

---

Thanks,
Charles

maintainer
#2 lore raw
In reply to [email protected]
Quoted 9 lines · On Sat, 25 Oct 2025 10:00:11 +0530, [email protected] wrote:

Replace direct printk() calls with the appropriate dev_*() logging APIs.Use dev_err, dev_warn, dev_info, or dev_dbg to reflect the correct severity level. Pass the canonical struct device pointer so logs include device context and become traceable to specific hardware instances.Improve log clarity, make messages filterable by device and align the driver with kernel logging conventions to aid debugging and maintenance.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codec: wm8400: replace printk() calls with dev_*() device aware logging

      commit: 6ef8e042cdcaabe3e3c68592ba8bfbaee2fa10a3

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark