summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorDouglas Schilling Landgraf <dougsland@redhat.com>2009-02-08 02:11:13 -0200
committerDouglas Schilling Landgraf <dougsland@redhat.com>2009-02-08 02:11:13 -0200
commit88f9e29eb77d77129e59b899af1ef9e462997409 (patch)
tree8a563a49c2863c3593c0bc87c8610e649b703728 /linux
parentc06f528a6de5324f104965c8a90907211963e29e (diff)
downloadmediapointer-dvb-s2-88f9e29eb77d77129e59b899af1ef9e462997409.tar.gz
mediapointer-dvb-s2-88f9e29eb77d77129e59b899af1ef9e462997409.tar.bz2
em28xx-audio: Add lock for users
From: Douglas Schilling Landgraf <dougsland@redhat.com> Added lock for users count Priority: high Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-audio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-audio.c b/linux/drivers/media/video/em28xx/em28xx-audio.c
index a5a28eb19..5102ff75f 100644
--- a/linux/drivers/media/video/em28xx/em28xx-audio.c
+++ b/linux/drivers/media/video/em28xx/em28xx-audio.c
@@ -356,7 +356,9 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
dprintk("changing alternate number to 7\n");
}
+ mutex_lock(&dev->lock);
dev->adev.users++;
+ mutex_unlock(&dev->lock);
snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
dev->adev.capture_pcm_substream = substream;
@@ -375,12 +377,12 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream)
#endif
{
struct em28xx *dev = snd_pcm_substream_chip(substream);
- dev->adev.users--;
dprintk("closing device\n");
dev->mute = 1;
mutex_lock(&dev->lock);
+ dev->adev.users--;
em28xx_audio_analog_set(dev);
mutex_unlock(&dev->lock);