aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-06-17 17:15:04 +0900
committerTakashi Iwai <tiwai@suse.de>2019-06-18 08:45:28 +0200
commitfc49769af4fdba92e8e4f7429e05bb20b0639f90 (patch)
treec7c0093d397a73fa024a6874bebc2f9b5bb35d8e /sound/firewire
parentALSA: firewire-motu: add helper function to keep isochronous resources (diff)
downloadlinux-dev-fc49769af4fdba92e8e4f7429e05bb20b0639f90.tar.xz
linux-dev-fc49769af4fdba92e8e4f7429e05bb20b0639f90.zip
ALSA: firewire-motu: code refactoring for condition to stop streaming
In snd_motu_stream_start_duplex() function, there're two points to stop packet streaming, however they can be merged. This commit merges them. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r--sound/firewire/motu/motu-stream.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c
index 35b4e0f72fe2..a3f45f2c817c 100644
--- a/sound/firewire/motu/motu-stream.c
+++ b/sound/firewire/motu/motu-stream.c
@@ -217,19 +217,11 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
if (motu->substreams_counter == 0)
return 0;
- /* Some packet queueing errors. */
- if (amdtp_streaming_error(&motu->rx_stream) ||
- amdtp_streaming_error(&motu->tx_stream)) {
- amdtp_stream_stop(&motu->rx_stream);
- amdtp_stream_stop(&motu->tx_stream);
- stop_both_streams(motu);
- }
-
err = snd_motu_stream_cache_packet_formats(motu);
if (err < 0)
return err;
- /* Stop stream if rate is different. */
+ // Stop stream if rate is different.
err = protocol->get_clock_rate(motu, &curr_rate);
if (err < 0) {
dev_err(&motu->unit->device,
@@ -238,7 +230,9 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
}
if (rate == 0)
rate = curr_rate;
- if (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);
stop_both_streams(motu);