Commit bf510ac3 authored by Douglas Schilling Landgraf's avatar Douglas Schilling Landgraf Committed by Mauro Carvalho Chehab

V4L/DVB (10521): em28xx-audio: Add lock for users

Added lock for users count
Signed-off-by: default avatarDouglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent df39ca64
...@@ -313,7 +313,9 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) ...@@ -313,7 +313,9 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
dprintk("changing alternate number to 7\n"); dprintk("changing alternate number to 7\n");
} }
mutex_lock(&dev->lock);
dev->adev.users++; dev->adev.users++;
mutex_unlock(&dev->lock);
snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
dev->adev.capture_pcm_substream = substream; dev->adev.capture_pcm_substream = substream;
...@@ -328,12 +330,12 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) ...@@ -328,12 +330,12 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream)
{ {
struct em28xx *dev = snd_pcm_substream_chip(substream); struct em28xx *dev = snd_pcm_substream_chip(substream);
dev->adev.users--;
dprintk("closing device\n"); dprintk("closing device\n");
dev->mute = 1; dev->mute = 1;
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
dev->adev.users--;
em28xx_audio_analog_set(dev); em28xx_audio_analog_set(dev);
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment