Update of /cvsroot/alsa/alsa-kernel/core
In directory usw-pr-cvs1:/tmp/cvs-serv13159
Modified Files:
pcm_native.c
Log Message:
Fixed spinlock/sleep race for prepare and reset
Index: pcm_native.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_native.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- pcm_native.c 25 Aug 2002 13:02:42 -0000 1.23
+++ pcm_native.c 3 Oct 2002 10:16:21 -0000 1.24
@@ -947,7 +947,10 @@
static int snd_pcm_reset(snd_pcm_substream_t *substream)
{
int res;
+
+ spin_lock_irq(&substream->runtime->lock);
_SND_PCM_ACTION(reset, substream, 0, res, 0);
+ spin_unlock_irq(&substream->runtime->lock);
return res;
}
@@ -984,6 +987,7 @@
{
int res;
snd_card_t *card = substream->pcm->card;
+
snd_power_lock(card);
while (snd_power_get_state(card) != SNDRV_CTL_POWER_D0) {
if (substream->ffile->f_flags & O_NONBLOCK) {
@@ -993,7 +997,9 @@
snd_power_wait(card);
}
+ spin_lock_irq(&substream->runtime->lock);
_SND_PCM_ACTION(prepare, substream, 0, res, 0);
+ spin_unlock_irq(&substream->runtime->lock);
_power_unlock:
snd_power_unlock(card);
@@ -2051,21 +2057,9 @@
case SNDRV_PCM_IOCTL_CHANNEL_INFO:
return snd_pcm_channel_info(substream, (snd_pcm_channel_info_t *) arg);
case SNDRV_PCM_IOCTL_PREPARE:
- {
- int res;
- spin_lock_irq(&substream->runtime->lock);
- res = snd_pcm_prepare(substream);
- spin_unlock_irq(&substream->runtime->lock);
- return res;
- }
+ return snd_pcm_prepare(substream);
case SNDRV_PCM_IOCTL_RESET:
- {
- int res;
- spin_lock_irq(&substream->runtime->lock);
- res = snd_pcm_reset(substream);
- spin_unlock_irq(&substream->runtime->lock);
- return res;
- }
+ return snd_pcm_reset(substream);
case SNDRV_PCM_IOCTL_START:
{
int res;
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog