提交 25bfe662 编写于 作者: M Mark Brown

ASoC: pcm: Improve error logging

Use the standard logging macros and use dev_ variants where we can, also
reporting error codes whenever we report an error. These changes (the
error codes in particular) make it noticeably easier to figure out what
went wrong just from the basic dmesg output.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: NLiam Girdwood <lrg@ti.com>
上级 bc6c117e
...@@ -123,8 +123,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -123,8 +123,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if (cpu_dai->driver->ops->startup) { if (cpu_dai->driver->ops->startup) {
ret = cpu_dai->driver->ops->startup(substream, cpu_dai); ret = cpu_dai->driver->ops->startup(substream, cpu_dai);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't open interface %s\n", dev_err(cpu_dai->dev, "can't open interface %s: %d\n",
cpu_dai->name); cpu_dai->name, ret);
goto out; goto out;
} }
} }
...@@ -132,7 +132,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -132,7 +132,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if (platform->driver->ops && platform->driver->ops->open) { if (platform->driver->ops && platform->driver->ops->open) {
ret = platform->driver->ops->open(substream); ret = platform->driver->ops->open(substream);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't open platform %s\n", platform->name); dev_err(platform->dev, "can't open platform %s: %d\n",
platform->name, ret);
goto platform_err; goto platform_err;
} }
} }
...@@ -140,8 +141,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -140,8 +141,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if (codec_dai->driver->ops->startup) { if (codec_dai->driver->ops->startup) {
ret = codec_dai->driver->ops->startup(substream, codec_dai); ret = codec_dai->driver->ops->startup(substream, codec_dai);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't open codec %s\n", dev_err(codec_dai->dev, "can't open codec %s: %d\n",
codec_dai->name); codec_dai->name, ret);
goto codec_dai_err; goto codec_dai_err;
} }
} }
...@@ -149,7 +150,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -149,7 +150,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if (rtd->dai_link->ops && rtd->dai_link->ops->startup) { if (rtd->dai_link->ops && rtd->dai_link->ops->startup) {
ret = rtd->dai_link->ops->startup(substream); ret = rtd->dai_link->ops->startup(substream);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: %s startup failed\n", rtd->dai_link->name); pr_err("asoc: %s startup failed: %d\n",
rtd->dai_link->name, ret);
goto machine_err; goto machine_err;
} }
} }
...@@ -413,7 +415,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -413,7 +415,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if (rtd->dai_link->ops && rtd->dai_link->ops->prepare) { if (rtd->dai_link->ops && rtd->dai_link->ops->prepare) {
ret = rtd->dai_link->ops->prepare(substream); ret = rtd->dai_link->ops->prepare(substream);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: machine prepare error\n"); pr_err("asoc: machine prepare error: %d\n", ret);
goto out; goto out;
} }
} }
...@@ -421,7 +423,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -421,7 +423,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if (platform->driver->ops && platform->driver->ops->prepare) { if (platform->driver->ops && platform->driver->ops->prepare) {
ret = platform->driver->ops->prepare(substream); ret = platform->driver->ops->prepare(substream);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: platform prepare error\n"); dev_err(platform->dev, "platform prepare error: %d\n",
ret);
goto out; goto out;
} }
} }
...@@ -429,7 +432,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -429,7 +432,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if (codec_dai->driver->ops->prepare) { if (codec_dai->driver->ops->prepare) {
ret = codec_dai->driver->ops->prepare(substream, codec_dai); ret = codec_dai->driver->ops->prepare(substream, codec_dai);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: codec DAI prepare error\n"); dev_err(codec_dai->dev, "DAI prepare error: %d\n",
ret);
goto out; goto out;
} }
} }
...@@ -437,7 +441,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -437,7 +441,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if (cpu_dai->driver->ops->prepare) { if (cpu_dai->driver->ops->prepare) {
ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); ret = cpu_dai->driver->ops->prepare(substream, cpu_dai);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: cpu DAI prepare error\n"); dev_err(cpu_dai->dev, "DAI prepare error: %d\n",
ret);
goto out; goto out;
} }
} }
...@@ -484,7 +489,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -484,7 +489,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) { if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) {
ret = rtd->dai_link->ops->hw_params(substream, params); ret = rtd->dai_link->ops->hw_params(substream, params);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: machine hw_params failed\n"); pr_err("asoc: machine hw_params failed: %d\n", ret);
goto out; goto out;
} }
} }
...@@ -492,8 +497,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -492,8 +497,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (codec_dai->driver->ops->hw_params) { if (codec_dai->driver->ops->hw_params) {
ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai); ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't set codec %s hw params\n", dev_err(codec_dai->dev, "can't set %s hw params: %d\n",
codec_dai->name); codec_dai->name, ret);
goto codec_err; goto codec_err;
} }
} }
...@@ -501,8 +506,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -501,8 +506,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (cpu_dai->driver->ops->hw_params) { if (cpu_dai->driver->ops->hw_params) {
ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai); ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: interface %s hw params failed\n", dev_err(cpu_dai->dev, "%s hw params failed: %d\n",
cpu_dai->name); cpu_dai->name, ret);
goto interface_err; goto interface_err;
} }
} }
...@@ -510,8 +515,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -510,8 +515,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (platform->driver->ops && platform->driver->ops->hw_params) { if (platform->driver->ops && platform->driver->ops->hw_params) {
ret = platform->driver->ops->hw_params(substream, params); ret = platform->driver->ops->hw_params(substream, params);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: platform %s hw params failed\n", dev_err(platform->dev, "%s hw params failed: %d\n",
platform->name); platform->name, ret);
goto platform_err; goto platform_err;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册