Skip to contentSkip to conversation

Patch to /sound/soc/pxa/pxa2xx_pcm.c, WHO IS INTERESTED?

DISCUSSION Mark Brown 2 participants 3 messages Dec 19, 2008 1 message not in the archive

lore
Share & tools
lore

Mark Brown

author
#1 lore raw
In reply to a message not in the archive
Quoted 2 lines · sware

Patch is to 2.6.27.9 (yesterday), notice .10 is up today, patch should still apply.

Thanks for your patch. Unfortunately all this code has been moved about a lot in the latest code in order to share the code with the non-ASoC AC97 driver so your patch won't apply - see the topic/asoc branch of

	git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git

for the latest code. Could you rebase your work against that, please? Also, please include a Signed-off-by line for patch submissions - for details see Documentation/SubmittingPatches

sound/soc/pxa/pxa2xx-pcm.c static int pxa2xx_pcm_hw_free(struct snd · line 144

Quoted 13 lines

diff -uprN -X linux-2.6.27.9.orig/Documentation/dontdiff linux-2.6.27.9.orig/sound/soc/pxa/pxa2xx-pcm.c linux-2.6.27.9.snd_modified/sound/soc/pxa/pxa2xx-pcm.c

sound/soc/pxa/pxa2xx-pcm.c +5 -1
@@ -137,13 +137,18 @@ static int pxa2xx_pcm_hw_free(struct snd
 {
 	struct pxa2xx_runtime_data *prtd = substream->runtime->private_data;
 
-	if (prtd && prtd->params)
+	if (!prtd)
+			return 0;
+	if (!prtd->params)
+			return 0;
+

prtd should always be there - the code should at least complain loudly if it's NULL. params might potentially be hit, though.

sound/soc/pxa/pxa2xx-pcm.c static int pxa2xx_pcm_hw_free(struct snd · line 152

Quoted 10 lines
sound/soc/pxa/pxa2xx-pcm.c +3 -2
 		*prtd->params->drcmr = 0;
 
-	if (prtd->dma_ch) {
+	if (prtd->dma_ch >= 0) {
 		snd_pcm_set_runtime_buffer(substream, NULL);
 		pxa_free_dma(prtd->dma_ch);
-		prtd->dma_ch = 0;
+		prtd->dma_ch = -1;	/* invalid channel */
+        prtd->params = NULL;
 	}

This bit is good.

sound/soc/pxa/pxa2xx-pcm.c static int pxa2xx_pcm_close(struct snd_p · line 277

Quoted 8 lines
sound/soc/pxa/pxa2xx-pcm.c +2 -0
@@ -266,6 +271,8 @@ static int pxa2xx_pcm_close(struct snd_p
 	dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE,
 			      prtd->dma_desc_array, prtd->dma_desc_array_phys);
 	kfree(prtd);
+	runtime->private_data = NULL;
+
 	return 0;
 }

As is this.

#2 lore raw

At Fri, 19 Dec 2008 11:57:38 +0000,

Quoted 9 lines · Mark Brown

Review static int pxa2xx_pcm_close(struct snd_p · line 277

Quoted 9 lines
(quoted diff) +2 -0
@@ -266,6 +271,8 @@ static int pxa2xx_pcm_close(struct snd_p
 	dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE,
 			      prtd->dma_desc_array, prtd->dma_desc_array_phys);
 	kfree(prtd);
+	runtime->private_data = NULL;
+
 	return 0;
 }

This looks superfluous. The runtime instance will be anyway freed soon after the close callback.

Just a subtle thing, though.

Takashi

author
#3 lore raw
Quoted 8 lines · Takashi Iwai
Quoted 3 lines · Mark Brown

Review

Quoted 3 lines
(quoted diff) +2 -0
 	kfree(prtd);
+	runtime->private_data = NULL;
+

This looks superfluous. The runtime instance will be anyway freed soon after the close callback.

Even if it wasn't the driver will overwrite it on open(). OTOH it doesn't do any harm either.