diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-08-15 02:25:50 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-08-30 02:45:50 -0400 |
commit | daa150ef7d437d17973210f47a1c58623415df94 (patch) | |
tree | e41056adf7f00cad4681051d4b7d6b524ea8a68f /sound | |
parent | 9624ea812c7afd2e403c56366cadddb9ecfb88c6 (diff) |
[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')
-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 3f7930c0b616..8d4a085f642a 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) | |||
815 | */ | 815 | */ |
816 | static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) | 816 | static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) |
817 | { | 817 | { |
818 | snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; | 818 | snd_usb_substream_t *subs; |
819 | return subs->hwptr_done; | 819 | snd_pcm_uframes_t hwptr_done; |
820 | |||
821 | subs = (snd_usb_substream_t *)substream->runtime->private_data; | ||
822 | spin_lock(&subs->lock); | ||
823 | hwptr_done = subs->hwptr_done; | ||
824 | spin_unlock(&subs->lock); | ||
825 | return hwptr_done; | ||
820 | } | 826 | } |
821 | 827 | ||
822 | 828 | ||