Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio
cover 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(-)
Signature · 1 line
1.7.2
PATCH 1/5 ASoC: Fix compile error for nuc900-ac97.c
Fix below compile error by add a missing ';'.
CC sound/soc/nuc900/nuc900-ac97.osound/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
--- sound/soc/nuc900/nuc900-ac97.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/nuc900/nuc900-ac97.c +1 -1
@@ -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) {
Signature · 1 line
1.7.2
PATCH 2/5 ASoC: Fix prototype for nuc900_ac97_probe and nuc900_ac97_remove
In reply to Axel LinThis patch fixes below compile warning:
CC sound/soc/nuc900/nuc900-ac97.osound/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 | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
sound/soc/nuc900/nuc900-ac97.c +3 -4
@@ -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 = {
Signature · 1 line
1.7.2
PATCH 3/5 ASoC: Fix compile error for nuc900-pcm.c
In reply to Axel LinThis patch fixes below error:
CC sound/soc/nuc900/nuc900-pcm.osound/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
--- sound/soc/nuc900/nuc900-audio.h | 2 ++ sound/soc/nuc900/nuc900-pcm.c | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-)
sound/soc/nuc900/nuc900-audio.h +2 -0
@@ -110,4 +110,6 @@ struct nuc900_audio { }; +extern struct nuc900_audio *nuc900_ac97_data; +#endif /*end _NUC900_AUDIO_H */
sound/soc/nuc900/nuc900-pcm.c +1 -1
@@ -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) {
Signature · 1 line
1.7.2
RFC PATCH 4/5 ASoC: Fix missing spin_unlock_irqrestore
In reply to Axel LinIn 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.
---
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(-)
sound/soc/nuc900/nuc900-pcm.c +5 -4
@@ -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)
Signature · 1 line
1.7.2
Re: [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore
Quoted 2 lines · Axel Lin
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?
Wan ZongShun
Acked-byRe: [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore
2010/11/29 Mark Brown <[email protected]>:
Quoted 8 lines · Axel Lin
Quoted 3 lines
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!
Signature · 10 lines
*linux-arm-kernel mailing list mail addr:[email protected] you can subscribe by: http://lists.infradead.org/mailman/listinfo/linux-arm-kernel * linux-arm-NUC900 mailing list mail addr:[email protected] main web: https://groups.google.com/group/NUC900 you can subscribe it by sending me mail: [email protected]
Re: [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore
Quoted 4 lines · Wan ZongShun
I have tested it.
Thanks!
Acked-by Wan ZongShun <[email protected]>
Excellent, applied now - thanks to both of you!
PATCH 5/5 ASoC: Remove unneeded !! operations while checking return value of nuc900_checkready
In reply to Axel LinI think this unneededd !! operations just reduce the readability.
--- sound/soc/nuc900/nuc900-ac97.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/nuc900/nuc900-ac97.c +3 -3
@@ -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);
Signature · 1 line
1.7.2
Quoted 13 lines · Axel Lin
This serial fixes compile error and missing
spin_unlock_irqrestorefor NUC900 SoC audio.Regards,
AxelAxel Lin (5):
ASoC: Fix compile error fornuc900-ac97.c
ASoC: Fix prototype fornuc900_ac97_probeandnuc900_ac97_remove
ASoC: Fix compile error fornuc900-pcm.c
ASoC: Fix missingspin_unlock_irqrestore
ASoC: Remove unneeded !! operations while checking return value of
nuc900_checkready
Quoted 5 lines
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
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk