diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2019-06-17 17:15:07 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-06-18 08:45:30 +0200 |
commit | ec694fba2ac9406cb3fc3c3216db3de9ed3174a7 (patch) | |
tree | 003296109c40903c8460c8bc34556ead5799634e | |
parent | e63a15185a7a5ac1fd65dd368de52196d66c0cac (diff) |
ALSA: firewire-motu: code refactoring to finish streaming session
The operation to finish packet streaming includes stopping isochronous
contexts. This commit merges it to the helper function.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/firewire/motu/motu-stream.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c index 4fbec35eaad5..53c43848b137 100644 --- a/sound/firewire/motu/motu-stream.c +++ b/sound/firewire/motu/motu-stream.c @@ -101,6 +101,9 @@ static void finish_session(struct snd_motu *motu) if (err < 0) return; + amdtp_stream_stop(&motu->tx_stream); + amdtp_stream_stop(&motu->rx_stream); + err = snd_motu_transaction_read(motu, ISOC_COMM_CONTROL_OFFSET, ®, sizeof(reg)); if (err < 0) @@ -219,11 +222,8 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) rate = curr_rate; if (rate != curr_rate || amdtp_streaming_error(&motu->rx_stream) || - amdtp_streaming_error(&motu->tx_stream)) { - amdtp_stream_stop(&motu->rx_stream); - amdtp_stream_stop(&motu->tx_stream); + amdtp_streaming_error(&motu->tx_stream)) finish_session(motu); - } if (!amdtp_stream_running(&motu->rx_stream)) { err = protocol->set_clock_rate(motu, rate); @@ -278,13 +278,8 @@ stop_streams: void snd_motu_stream_stop_duplex(struct snd_motu *motu) { - if (motu->substreams_counter == 0) { - amdtp_stream_stop(&motu->tx_stream); - amdtp_stream_stop(&motu->rx_stream); - - fw_iso_resources_free(&motu->tx_resources); - fw_iso_resources_free(&motu->rx_resources); - } + if (motu->substreams_counter == 0) + finish_session(motu); } static int init_stream(struct snd_motu *motu, enum amdtp_stream_direction dir) |