linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio
@ 2010-11-29  9:38 Axel Lin
  2010-11-29  9:39 ` [PATCH 1/5] ASoC: Fix compile error for nuc900-ac97.c Axel Lin
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Axel Lin @ 2010-11-29  9:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Wan ZongShun, alsa-devel

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(-)

-- 
1.7.2




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] ASoC: Fix compile error for nuc900-ac97.c
  2010-11-29  9:38 [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Axel Lin
@ 2010-11-29  9:39 ` Axel Lin
  2010-11-29  9:40 ` [PATCH 2/5] ASoC: Fix prototype for nuc900_ac97_probe and nuc900_ac97_remove Axel Lin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Axel Lin @ 2010-11-29  9:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Wan ZongShun, alsa-devel

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)
 {
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] ASoC: Fix prototype for nuc900_ac97_probe and nuc900_ac97_remove
  2010-11-29  9:38 [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Axel Lin
  2010-11-29  9:39 ` [PATCH 1/5] ASoC: Fix compile error for nuc900-ac97.c Axel Lin
@ 2010-11-29  9:40 ` Axel Lin
  2010-11-29  9:40 ` [PATCH 3/5] ASoC: Fix compile error for nuc900-pcm.c Axel Lin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Axel Lin @ 2010-11-29  9:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Wan ZongShun, alsa-devel

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 = {
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] ASoC: Fix compile error for nuc900-pcm.c
  2010-11-29  9:38 [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Axel Lin
  2010-11-29  9:39 ` [PATCH 1/5] ASoC: Fix compile error for nuc900-ac97.c Axel Lin
  2010-11-29  9:40 ` [PATCH 2/5] ASoC: Fix prototype for nuc900_ac97_probe and nuc900_ac97_remove Axel Lin
@ 2010-11-29  9:40 ` Axel Lin
  2010-11-29  9:42 ` [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore Axel Lin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Axel Lin @ 2010-11-29  9:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Wan ZongShun, alsa-devel

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)
 {
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore
  2010-11-29  9:38 [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Axel Lin
                   ` (2 preceding siblings ...)
  2010-11-29  9:40 ` [PATCH 3/5] ASoC: Fix compile error for nuc900-pcm.c Axel Lin
@ 2010-11-29  9:42 ` Axel Lin
  2010-11-29 11:47   ` Mark Brown
  2010-11-29  9:43 ` [PATCH 5/5] ASoC: Remove unneeded !! operations while checking return value of nuc900_checkready Axel Lin
  2010-11-29 11:18 ` [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Liam Girdwood
  5 siblings, 1 reply; 10+ messages in thread
From: Axel Lin @ 2010-11-29  9:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Wan ZongShun, alsa-devel

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)
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] ASoC: Remove unneeded !! operations while checking return value of nuc900_checkready
  2010-11-29  9:38 [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Axel Lin
                   ` (3 preceding siblings ...)
  2010-11-29  9:42 ` [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore Axel Lin
@ 2010-11-29  9:43 ` Axel Lin
  2010-11-29 11:18 ` [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Liam Girdwood
  5 siblings, 0 replies; 10+ messages in thread
From: Axel Lin @ 2010-11-29  9:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Wan ZongShun, alsa-devel

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);
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio
  2010-11-29  9:38 [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Axel Lin
                   ` (4 preceding siblings ...)
  2010-11-29  9:43 ` [PATCH 5/5] ASoC: Remove unneeded !! operations while checking return value of nuc900_checkready Axel Lin
@ 2010-11-29 11:18 ` Liam Girdwood
  5 siblings, 0 replies; 10+ messages in thread
From: Liam Girdwood @ 2010-11-29 11:18 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Mark Brown, Wan ZongShun, alsa-devel

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>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore
  2010-11-29  9:42 ` [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore Axel Lin
@ 2010-11-29 11:47   ` Mark Brown
  2010-11-30  1:36     ` Wan ZongShun
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2010-11-29 11:47 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Wan ZongShun, alsa-devel

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?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore
  2010-11-29 11:47   ` Mark Brown
@ 2010-11-30  1:36     ` Wan ZongShun
  2010-11-30 11:13       ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Wan ZongShun @ 2010-11-30  1:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Axel Lin, linux-kernel, Liam Girdwood, alsa-devel

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>


-- 
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@gmail.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore
  2010-11-30  1:36     ` Wan ZongShun
@ 2010-11-30 11:13       ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2010-11-30 11:13 UTC (permalink / raw)
  To: Wan ZongShun; +Cc: Axel Lin, linux-kernel, Liam Girdwood, alsa-devel

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!

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-11-30 11:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-29  9:38 [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Axel Lin
2010-11-29  9:39 ` [PATCH 1/5] ASoC: Fix compile error for nuc900-ac97.c Axel Lin
2010-11-29  9:40 ` [PATCH 2/5] ASoC: Fix prototype for nuc900_ac97_probe and nuc900_ac97_remove Axel Lin
2010-11-29  9:40 ` [PATCH 3/5] ASoC: Fix compile error for nuc900-pcm.c Axel Lin
2010-11-29  9:42 ` [RFC][PATCH 4/5] ASoC: Fix missing spin_unlock_irqrestore Axel Lin
2010-11-29 11:47   ` Mark Brown
2010-11-30  1:36     ` Wan ZongShun
2010-11-30 11:13       ` Mark Brown
2010-11-29  9:43 ` [PATCH 5/5] ASoC: Remove unneeded !! operations while checking return value of nuc900_checkready Axel Lin
2010-11-29 11:18 ` [PATCH 0/5] Fix compile error and missing spin_unlock_irqrestore for NUC900 SoC audio Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).