summaryrefslogtreecommitdiff
path: root/sound/firewire/bebob/bebob_midi.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-06-10 05:30:17 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-06-10 05:30:17 -0300
commitd635711daa98be86d4c7fd01499c34f566b54ccb (patch)
treeaa5cc3760a27c3d57146498cb82fa549547de06c /sound/firewire/bebob/bebob_midi.c
parentc91265cd0efb83778f015b4d4b1129bd2cfd075e (diff)
Linux-libre 4.6.2-gnu
Diffstat (limited to 'sound/firewire/bebob/bebob_midi.c')
-rw-r--r--sound/firewire/bebob/bebob_midi.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sound/firewire/bebob/bebob_midi.c b/sound/firewire/bebob/bebob_midi.c
index 90d95be49..868eb0dec 100644
--- a/sound/firewire/bebob/bebob_midi.c
+++ b/sound/firewire/bebob/bebob_midi.c
@@ -17,8 +17,10 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream)
if (err < 0)
goto end;
- atomic_inc(&bebob->substreams_counter);
+ mutex_lock(&bebob->mutex);
+ bebob->substreams_counter++;
err = snd_bebob_stream_start_duplex(bebob, 0);
+ mutex_unlock(&bebob->mutex);
if (err < 0)
snd_bebob_stream_lock_release(bebob);
end:
@@ -34,8 +36,10 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream)
if (err < 0)
goto end;
- atomic_inc(&bebob->substreams_counter);
+ mutex_lock(&bebob->mutex);
+ bebob->substreams_counter++;
err = snd_bebob_stream_start_duplex(bebob, 0);
+ mutex_unlock(&bebob->mutex);
if (err < 0)
snd_bebob_stream_lock_release(bebob);
end:
@@ -46,8 +50,10 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream)
{
struct snd_bebob *bebob = substream->rmidi->private_data;
- atomic_dec(&bebob->substreams_counter);
+ mutex_lock(&bebob->mutex);
+ bebob->substreams_counter--;
snd_bebob_stream_stop_duplex(bebob);
+ mutex_unlock(&bebob->mutex);
snd_bebob_stream_lock_release(bebob);
return 0;
@@ -57,8 +63,10 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
{
struct snd_bebob *bebob = substream->rmidi->private_data;
- atomic_dec(&bebob->substreams_counter);
+ mutex_lock(&bebob->mutex);
+ bebob->substreams_counter--;
snd_bebob_stream_stop_duplex(bebob);
+ mutex_unlock(&bebob->mutex);
snd_bebob_stream_lock_release(bebob);
return 0;