ALSA: fireworks: move mutex from function callees to callers
[deliverable/linux.git] / sound / firewire / fireworks / fireworks_midi.c
index cf9c6526043938aa905019c23992fdf496247403..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;
@@ -73,10 +81,10 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up)
        spin_lock_irqsave(&efw->lock, flags);
 
        if (up)
-               amdtp_stream_midi_trigger(&efw->tx_stream,
+               amdtp_am824_midi_trigger(&efw->tx_stream,
                                          substrm->number, substrm);
        else
-               amdtp_stream_midi_trigger(&efw->tx_stream,
+               amdtp_am824_midi_trigger(&efw->tx_stream,
                                          substrm->number, NULL);
 
        spin_unlock_irqrestore(&efw->lock, flags);
@@ -90,11 +98,11 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
        spin_lock_irqsave(&efw->lock, flags);
 
        if (up)
-               amdtp_stream_midi_trigger(&efw->rx_stream,
-                                         substrm->number, substrm);
+               amdtp_am824_midi_trigger(&efw->rx_stream,
+                                        substrm->number, substrm);
        else
-               amdtp_stream_midi_trigger(&efw->rx_stream,
-                                         substrm->number, NULL);
+               amdtp_am824_midi_trigger(&efw->rx_stream,
+                                        substrm->number, NULL);
 
        spin_unlock_irqrestore(&efw->lock, flags);
 }
This page took 0.02708 seconds and 5 git commands to generate.