All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 10/14] ASoC: wm9713: Cleanup printk usage
Date: Thu, 30 Oct 2014 21:01:07 +0100	[thread overview]
Message-ID: <1414699271-22797-11-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1414699271-22797-1-git-send-email-lars@metafoo.de>

Use dev_err()/dev_warn() instead of printk(KERN_ERR/KERN_WARNING. This is
common practice and makes it easy to find out which device generated the
message. While we are at it also align the error messages with the other
AC'97 drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/wm9713.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index bddee30..38e17d4 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -689,7 +689,8 @@ struct _pll_div {
  * to allow rounding later */
 #define FIXED_PLL_SIZE ((1 << 22) * 10)
 
-static void pll_factors(struct _pll_div *pll_div, unsigned int source)
+static void pll_factors(struct snd_soc_codec *codec,
+	struct _pll_div *pll_div, unsigned int source)
 {
 	u64 Kpart;
 	unsigned int K, Ndiv, Nmod, target;
@@ -724,7 +725,7 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int source)
 
 	Ndiv = target / source;
 	if ((Ndiv < 5) || (Ndiv > 12))
-		printk(KERN_WARNING
+		dev_warn(codec->dev,
 			"WM9713 PLL N value %u out of recommended range!\n",
 			Ndiv);
 
@@ -768,7 +769,7 @@ static int wm9713_set_pll(struct snd_soc_codec *codec,
 		return 0;
 	}
 
-	pll_factors(&pll_div, freq_in);
+	pll_factors(codec, &pll_div, freq_in);
 
 	if (pll_div.k == 0) {
 		reg = (pll_div.n << 12) | (pll_div.lf << 11) |
@@ -1104,8 +1105,11 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm)
 	soc_ac97_ops->reset(codec->ac97);
 	if (soc_ac97_ops->warm_reset)
 		soc_ac97_ops->warm_reset(codec->ac97);
-	if (ac97_read(codec, 0) != wm9713_reg[0])
+	if (ac97_read(codec, 0) != wm9713_reg[0]) {
+		dev_err(codec->dev, "Failed to reset: AC97 link error\n");
 		return -EIO;
+	}
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(wm9713_reset);
@@ -1163,10 +1167,8 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec)
 	u16 *cache = codec->reg_cache;
 
 	ret = wm9713_reset(codec, 1);
-	if (ret < 0) {
-		printk(KERN_ERR "could not reset AC97 codec\n");
+	if (ret < 0)
 		return ret;
-	}
 
 	wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
@@ -1205,10 +1207,8 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
 	 * a warm reset followed by an optional cold reset for codec */
 	wm9713_reset(codec, 0);
 	ret = wm9713_reset(codec, 1);
-	if (ret < 0) {
-		printk(KERN_ERR "Failed to reset WM9713: AC97 link error\n");
+	if (ret < 0)
 		goto reset_err;
-	}
 
 	wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
-- 
1.8.0

  parent reply	other threads:[~2014-10-30 20:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 20:00 [PATCH 00/14] ASoC: AC'97 driver cleanups Lars-Peter Clausen
2014-10-30 20:00 ` [PATCH 01/14] ASoC: ad1980: Remove unused header Lars-Peter Clausen
2014-10-31 17:19   ` Mark Brown
2014-10-30 20:00 ` [PATCH 02/14] ASoC: ad1980: Cleanup printk usage Lars-Peter Clausen
2014-10-31 17:19   ` Mark Brown
2014-10-30 20:01 ` [PATCH 03/14] ASoC: ad1980: Use table based control setup Lars-Peter Clausen
2014-10-31 17:19   ` Mark Brown
2014-10-30 20:01 ` [PATCH 04/14] ASoC: stac9766: Cleanup printk usage Lars-Peter Clausen
2014-10-30 20:01 ` [PATCH 05/14] ASoC: stac9766: Use table based control setup Lars-Peter Clausen
2014-10-30 20:01 ` [PATCH 06/14] ASoC: wm9705: Cleanup printk usage Lars-Peter Clausen
2014-10-30 20:01 ` [PATCH 07/14] ASoC: wm9705: Use table based control setup Lars-Peter Clausen
2014-10-30 20:01 ` [PATCH 08/14] ASoC: wm9712: Cleanup printk usage Lars-Peter Clausen
2014-10-31 17:32   ` Mark Brown
2014-10-30 20:01 ` [PATCH 09/14] ASoC: wm9712: Use table based control setup Lars-Peter Clausen
2014-10-31 17:32   ` Mark Brown
2014-10-30 20:01 ` Lars-Peter Clausen [this message]
2014-10-30 20:01 ` [PATCH 11/14] ASoC: wm9713: " Lars-Peter Clausen
2014-10-30 20:01 ` [PATCH 12/14] ASoC: wm9713: Move driver state struct allocation to driver probe Lars-Peter Clausen
2014-10-30 20:01 ` [PATCH 13/14] ASoC: wm9713: Use virtual control instead of virtual register Lars-Peter Clausen
2014-10-30 20:01 ` [PATCH 14/14] ASoC: wm9712/wm9713: Use shared controls Lars-Peter Clausen
2014-10-31 17:40   ` Mark Brown
2014-10-31 17:55     ` Lars-Peter Clausen
2014-10-31 10:35 ` [PATCH 00/14] ASoC: AC'97 driver cleanups Charles Keepax

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414699271-22797-11-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.