ALSA: fireworks: move mutex from function callees to callers
[deliverable/linux.git] / sound / firewire / fireworks / fireworks_midi.c
index fba01bbba4564be493af246a3d40957da2c1465d..38232dcf6e03721dc394f9e2e74bac4790e00d7e 100644 (file)
@@ -17,8 +17,10 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream)
        if (err < 0)
                goto end;
 
+       mutex_lock(&efw->mutex);
        atomic_inc(&efw->capture_substreams);
        err = snd_efw_stream_start_duplex(efw, 0);
+       mutex_unlock(&efw->mutex);
        if (err < 0)
                snd_efw_stream_lock_release(efw);
 
@@ -35,8 +37,10 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream)
        if (err < 0)
                goto end;
 
+       mutex_lock(&efw->mutex);
        atomic_inc(&efw->playback_substreams);
        err = snd_efw_stream_start_duplex(efw, 0);
+       mutex_unlock(&efw->mutex);
        if (err < 0)
                snd_efw_stream_lock_release(efw);
 end:
@@ -47,8 +51,10 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream)
 {
        struct snd_efw *efw = substream->rmidi->private_data;
 
+       mutex_lock(&efw->mutex);
        atomic_dec(&efw->capture_substreams);
        snd_efw_stream_stop_duplex(efw);
+       mutex_unlock(&efw->mutex);
 
        snd_efw_stream_lock_release(efw);
        return 0;
@@ -58,8 +64,10 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
 {
        struct snd_efw *efw = substream->rmidi->private_data;
 
+       mutex_lock(&efw->mutex);
        atomic_dec(&efw->playback_substreams);
        snd_efw_stream_stop_duplex(efw);
+       mutex_unlock(&efw->mutex);
 
        snd_efw_stream_lock_release(efw);
        return 0;
This page took 0.036553 seconds and 5 git commands to generate.