ALSA: fireworks/bebob: Shorten critical section for stream_stop_duplex()
[firefly-linux-kernel-4.4.55.git] / sound / firewire / bebob / bebob_stream.c
index bc4f82776fdaf690e296aa11a27c5fa77b44c19e..ef4d0c9f65781a2e2684a143264a8b3aad12d8be 100644 (file)
@@ -655,8 +655,6 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
        struct amdtp_stream *master, *slave;
        atomic_t *master_substreams, *slave_substreams;
 
-       mutex_lock(&bebob->mutex);
-
        if (bebob->master == &bebob->rx_stream) {
                slave  = &bebob->tx_stream;
                master = &bebob->rx_stream;
@@ -669,6 +667,8 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
                master_substreams = &bebob->capture_substreams;
        }
 
+       mutex_lock(&bebob->mutex);
+
        if (atomic_read(slave_substreams) == 0) {
                amdtp_stream_pcm_abort(slave);
                amdtp_stream_stop(slave);