Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=646ab160ff5e672838209dbd679d50af63fbd366
Commit:     646ab160ff5e672838209dbd679d50af63fbd366
Parent:     fca7f38892fa713d5221e26fd3ee57817b4bc031
Author:     Harald Welte <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 24 12:49:39 2007 +0200
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 15:57:57 2007 +0200

    [ALSA] s3c24xx-pcm: fix hw_params dma handling
    
    Since the PCM emulation can call multiple times to hw_setup(), but we
    can only once allocate/request the DMA channel, we have to handle
    this gracefully.
    
    Signed-off-by: Harald Welte <[EMAIL PROTECTED]>
    Signed-off-by: Arnaud Patard <[EMAIL PROTECTED]>
    Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 sound/soc/s3c24xx/s3c24xx-pcm.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
index bfbdc3c..4107a87 100644
--- a/sound/soc/s3c24xx/s3c24xx-pcm.c
+++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -158,18 +158,22 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream 
*substream,
        if (!dma)
                return 0;
 
-       /* prepare DMA */
-       prtd->params = dma;
+       /* this may get called several times by oss emulation
+        * with different params -HW */
+       if (prtd->params == NULL) {
+               /* prepare DMA */
+               prtd->params = dma;
 
-       DBG("params %p, client %p, channel %d\n", prtd->params,
-               prtd->params->client, prtd->params->channel);
+               DBG("params %p, client %p, channel %d\n", prtd->params,
+                       prtd->params->client, prtd->params->channel);
 
-       ret = s3c2410_dma_request(prtd->params->channel,
-                                 prtd->params->client, NULL);
+               ret = s3c2410_dma_request(prtd->params->channel,
+                                         prtd->params->client, NULL);
 
-       if (ret) {
-               DBG(KERN_ERR "failed to get dma channel\n");
-               return ret;
+               if (ret) {
+                       DBG(KERN_ERR "failed to get dma channel\n");
+                       return ret;
+               }
        }
 
        /* channel needs configuring for mem=>device, increment memory addr,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to