[alsa-devel] [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio
This serial fixes compile error and missing spin_unlock_irqrestore for NUC900 SoC audio.
Regards, Axel
Axel Lin (5): ASoC: Fix compile error for nuc900-ac97.c ASoC: Fix prototype for nuc900_ac97_probe and nuc900_ac97_remove ASoC: Fix compile error for nuc900-pcm.c ASoC: Fix missing spin_unlock_irqrestore ASoC: Remove unneeded !! operations while checking return value of nuc900_checkready
sound/soc/nuc900/nuc900-ac97.c | 15 +++++++-------- sound/soc/nuc900/nuc900-audio.h | 2 ++ sound/soc/nuc900/nuc900-pcm.c | 11 ++++++----- 3 files changed, 15 insertions(+), 13 deletions(-)
Fix below compile error by add a missing ';'.
CC sound/soc/nuc900/nuc900-ac97.o sound/soc/nuc900/nuc900-ac97.c:300: warning: initialization from incompatible pointer type sound/soc/nuc900/nuc900-ac97.c:301: warning: initialization from incompatible pointer type sound/soc/nuc900/nuc900-ac97.c:318: error: expected ',' or ';' before 'static' sound/soc/nuc900/nuc900-ac97.c:405: error: 'nuc900_ac97_drvprobe' undeclared here (not in a function) make[3]: *** [sound/soc/nuc900/nuc900-ac97.o] Error 1 make[2]: *** [sound/soc/nuc900] Error 2 make[1]: *** [sound/soc] Error 2 make: *** [sound] Error 2
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/nuc900/nuc900-ac97.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index e00e39d..4f056b4 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -313,7 +313,7 @@ static struct snd_soc_dai_driver nuc900_ac97_dai = { .channels_max = 2, }, .ops = &nuc900_ac97_dai_ops, -} +};
static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) {
This patch fixes below compile warning:
CC sound/soc/nuc900/nuc900-ac97.o sound/soc/nuc900/nuc900-ac97.c:300: warning: initialization from incompatible pointer type sound/soc/nuc900/nuc900-ac97.c:301: warning: initialization from incompatible pointer type
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/nuc900/nuc900-ac97.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index 4f056b4..3d9d8b1 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -263,8 +263,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, return ret; }
-static int nuc900_ac97_probe(struct platform_device *pdev, - struct snd_soc_dai *dai) +static int nuc900_ac97_probe(struct snd_soc_dai *dai) { struct nuc900_audio *nuc900_audio = nuc900_ac97_data; unsigned long val; @@ -284,12 +283,12 @@ static int nuc900_ac97_probe(struct platform_device *pdev, return 0; }
-static void nuc900_ac97_remove(struct platform_device *pdev, - struct snd_soc_dai *dai) +static int nuc900_ac97_remove(struct snd_soc_dai *dai) { struct nuc900_audio *nuc900_audio = nuc900_ac97_data;
clk_disable(nuc900_audio->clk); + return 0; }
static struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
This patch fixes below error:
CC sound/soc/nuc900/nuc900-pcm.o sound/soc/nuc900/nuc900-pcm.c: In function 'nuc900_dma_open': sound/soc/nuc900/nuc900-pcm.c:267: error: 'nuc900_ac97_data' undeclared (first use in this function) sound/soc/nuc900/nuc900-pcm.c:267: error: (Each undeclared identifier is reported only once sound/soc/nuc900/nuc900-pcm.c:267: error: for each function it appears in.) sound/soc/nuc900/nuc900-pcm.c: At top level: sound/soc/nuc900/nuc900-pcm.c:337: error: expected ',' or ';' before 'static' sound/soc/nuc900/nuc900-pcm.c:354: error: 'nuc900_soc_platform_probe' undeclared here (not in a function) make[3]: *** [sound/soc/nuc900/nuc900-pcm.o] Error 1 make[2]: *** [sound/soc/nuc900] Error 2 make[1]: *** [sound/soc] Error 2 make: *** [sound] Error 2
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/nuc900/nuc900-audio.h | 2 ++ sound/soc/nuc900/nuc900-pcm.c | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/sound/soc/nuc900/nuc900-audio.h b/sound/soc/nuc900/nuc900-audio.h index aeed8ea..59f7e8e 100644 --- a/sound/soc/nuc900/nuc900-audio.h +++ b/sound/soc/nuc900/nuc900-audio.h @@ -110,4 +110,6 @@ struct nuc900_audio {
};
+extern struct nuc900_audio *nuc900_ac97_data; + #endif /*end _NUC900_AUDIO_H */ diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c index 195d1ac..2245f8b 100644 --- a/sound/soc/nuc900/nuc900-pcm.c +++ b/sound/soc/nuc900/nuc900-pcm.c @@ -332,7 +332,7 @@ static struct snd_soc_platform_driver nuc900_soc_platform = { .ops = &nuc900_dma_ops, .pcm_new = nuc900_dma_new, .pcm_free = nuc900_dma_free_dma_buffers, -} +};
static int __devinit nuc900_soc_platform_probe(struct platform_device *pdev) {
In nuc900_dma_hw_params(), if snd_pcm_lib_malloc_pages failed it returns without calling spin_unlock_irqrestore().
Since snd_pcm_lib_malloc_pages() does not touch struct nuc900_audio, we don't need to hold the lock while calling snd_pcm_lib_malloc_pages(). Fix it by moving spin_lock_irqsave() down to after snd_pcm_lib_malloc_pages().
In nuc900_dma_prepare(), spin_unlock_irqrestore() is missing in the error path. Fix it by removing the return in default case.
Signed-off-by: Axel Lin axel.lin@gmail.com ---
hi ZongShun, I don't have this hardware handy, could you help to test this patch if you think this patch is ok.
Regards, Axel
sound/soc/nuc900/nuc900-pcm.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c index 2245f8b..8263f56 100644 --- a/sound/soc/nuc900/nuc900-pcm.c +++ b/sound/soc/nuc900/nuc900-pcm.c @@ -50,12 +50,12 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream, unsigned long flags; int ret = 0;
- spin_lock_irqsave(&nuc900_audio->lock, flags); - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); if (ret < 0) return ret;
+ spin_lock_irqsave(&nuc900_audio->lock, flags); + nuc900_audio->substream = substream; nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr; nuc900_audio->buffersize[substream->stream] = @@ -169,6 +169,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct nuc900_audio *nuc900_audio = runtime->private_data; unsigned long flags, val; + int ret = 0;
spin_lock_irqsave(&nuc900_audio->lock, flags);
@@ -197,10 +198,10 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream) AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); break; default: - return -EINVAL; + ret = -EINVAL; } spin_unlock_irqrestore(&nuc900_audio->lock, flags); - return 0; + return ret; }
static int nuc900_dma_trigger(struct snd_pcm_substream *substream, int cmd)
On Mon, Nov 29, 2010 at 05:42:47PM +0800, Axel Lin wrote:
I don't have this hardware handy, could you help to test this patch if you think this patch is ok.
I've applied everything except this one - Wan, can you let us know how the testing goes please?
2010/11/29 Mark Brown broonie@opensource.wolfsonmicro.com:
On Mon, Nov 29, 2010 at 05:42:47PM +0800, Axel Lin wrote:
I don't have this hardware handy, could you help to test this patch if you think this patch is ok.
I've applied everything except this one - Wan, can you let us know how the testing goes please?
Hi all,
I have tested it.
Thanks! Acked-by: Wan ZongShun mcuos.com@gmail.com
On Tue, Nov 30, 2010 at 09:36:29AM +0800, Wan ZongShun wrote:
I have tested it.
Thanks! Acked-by: Wan ZongShun mcuos.com@gmail.com
Excellent, applied now - thanks to both of you!
I think this unneededd !! operations just reduce the readability.
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/nuc900/nuc900-ac97.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index 3d9d8b1..dac6732 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -49,7 +49,7 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97, mutex_lock(&ac97_mutex);
val = nuc900_checkready(); - if (!!val) { + if (val) { dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); goto out; } @@ -102,7 +102,7 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg, mutex_lock(&ac97_mutex);
tmp = nuc900_checkready(); - if (!!tmp) + if (tmp) dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
/* clear the R_WB bit and write register index */ @@ -149,7 +149,7 @@ static void nuc900_ac97_warm_reset(struct snd_ac97 *ac97) udelay(100);
val = nuc900_checkready(); - if (!!val) + if (val) dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
mutex_unlock(&ac97_mutex);
On Mon, 2010-11-29 at 17:38 +0800, Axel Lin wrote:
This serial fixes compile error and missing spin_unlock_irqrestore for NUC900 SoC audio.
Regards, Axel
Axel Lin (5): ASoC: Fix compile error for nuc900-ac97.c ASoC: Fix prototype for nuc900_ac97_probe and nuc900_ac97_remove ASoC: Fix compile error for nuc900-pcm.c ASoC: Fix missing spin_unlock_irqrestore ASoC: Remove unneeded !! operations while checking return value of nuc900_checkready
sound/soc/nuc900/nuc900-ac97.c | 15 +++++++-------- sound/soc/nuc900/nuc900-audio.h | 2 ++ sound/soc/nuc900/nuc900-pcm.c | 11 ++++++----- 3 files changed, 15 insertions(+), 13 deletions(-)
All
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
participants (4)
-
Axel Lin
-
Liam Girdwood
-
Mark Brown
-
Wan ZongShun