diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-08-15 08:25:50 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-08-30 08:45:50 +0200 |
commit | daa150ef7d437d17973210f47a1c58623415df94 (patch) | |
tree | e41056adf7f00cad4681051d4b7d6b524ea8a68f /sound/usb/usbaudio.c | |
parent | 9624ea812c7afd2e403c56366cadddb9ecfb88c6 (diff) | |
download | op-kernel-dev-daa150ef7d437d17973210f47a1c58623415df94.zip op-kernel-dev-daa150ef7d437d17973210f47a1c58623415df94.tar.gz |
[ALSA] usb-audio: properly lock hwptr_done accesses
USB generic driver
Take the substream lock when reading hwptr_done to avoid a race
condition with the updates in the URB callbacks.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r-- | sound/usb/usbaudio.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 3f7930c..8d4a085 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -815,8 +815,14 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) */ static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) { - snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; - return subs->hwptr_done; + snd_usb_substream_t *subs; + snd_pcm_uframes_t hwptr_done; + + subs = (snd_usb_substream_t *)substream->runtime->private_data; + spin_lock(&subs->lock); + hwptr_done = subs->hwptr_done; + spin_unlock(&subs->lock); + return hwptr_done; } |