From 18f26034be2711254adfa8923dfd263b50d4018a Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 17 Jun 2019 17:15:01 +0900 Subject: ALSA: firewire-motu: unify the count of subscriber for packet streaming Two counters are used to maintain isochronous packet streaming for both directions. However, like the other drivers, they can be replaced with one counter. This commit unifies them. Signed-off-by: Takashi Sakamoto Signed-off-by: Takashi Iwai --- sound/firewire/motu/motu-stream.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'sound/firewire/motu/motu-stream.c') diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c index 73e7a5e527fc..c136d7f8c49c 100644 --- a/sound/firewire/motu/motu-stream.c +++ b/sound/firewire/motu/motu-stream.c @@ -207,7 +207,7 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) unsigned int curr_rate; int err = 0; - if (motu->capture_substreams == 0 && motu->playback_substreams == 0) + if (motu->substreams_counter == 0) return 0; /* Some packet queueing errors. */ @@ -271,8 +271,7 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) } } - if (!amdtp_stream_running(&motu->tx_stream) && - motu->capture_substreams > 0) { + if (!amdtp_stream_running(&motu->tx_stream)) { err = start_isoc_ctx(motu, &motu->tx_stream); if (err < 0) { dev_err(&motu->unit->device, @@ -291,15 +290,12 @@ stop_streams: void snd_motu_stream_stop_duplex(struct snd_motu *motu) { - if (motu->capture_substreams == 0) { + if (motu->substreams_counter == 0) { if (amdtp_stream_running(&motu->tx_stream)) stop_isoc_ctx(motu, &motu->tx_stream); - if (motu->playback_substreams == 0) { - if (amdtp_stream_running(&motu->rx_stream)) - stop_isoc_ctx(motu, &motu->rx_stream); - stop_both_streams(motu); - } + if (amdtp_stream_running(&motu->rx_stream)) + stop_isoc_ctx(motu, &motu->rx_stream); } } @@ -372,8 +368,7 @@ void snd_motu_stream_destroy_duplex(struct snd_motu *motu) destroy_stream(motu, AMDTP_IN_STREAM); destroy_stream(motu, AMDTP_OUT_STREAM); - motu->playback_substreams = 0; - motu->capture_substreams = 0; + motu->substreams_counter = 0; } static void motu_lock_changed(struct snd_motu *motu) -- cgit v1.2.3