ChangeSet 1.2181.25.9, 2005/03/22 08:59:49+01:00, [EMAIL PROTECTED]

        [ALSA] Add proper spin/irq locks to suspend
        
        PCM Midlevel
        Add the proper spin/irq locks to PCM suspend functions so that PCM
        trigger and pointer callbacks can be called safely without irqsave.
        
        Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>



 pcm_native.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)


diff -Nru a/sound/core/pcm_native.c b/sound/core/pcm_native.c
--- a/sound/core/pcm_native.c   2005-03-30 16:10:55 -08:00
+++ b/sound/core/pcm_native.c   2005-03-30 16:10:55 -08:00
@@ -1038,7 +1038,13 @@
  */
 int snd_pcm_suspend(snd_pcm_substream_t *substream)
 {
-       return snd_pcm_action(&snd_pcm_action_suspend, substream, 0);
+       int err;
+       unsigned long flags;
+
+       snd_pcm_stream_lock_irqsave(substream, flags);
+       err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0);
+       snd_pcm_stream_unlock_irqrestore(substream, flags);
+       return err;
 }
 
 /**
@@ -1057,11 +1063,8 @@
                        /* FIXME: the open/close code should lock this as well 
*/
                        if (substream->runtime == NULL)
                                continue;
-                       snd_pcm_stream_lock(substream);
-                       if (substream->runtime->status->state != 
SNDRV_PCM_STATE_SUSPENDED)
-                               err = snd_pcm_suspend(substream);
-                       snd_pcm_stream_unlock(substream);
-                       if (err < 0)
+                       err = snd_pcm_suspend(substream);
+                       if (err < 0 && err != -EBUSY)
                                return err;
                }
        }
-
To unsubscribe from this list: send the line "unsubscribe bk-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