summaryrefslogtreecommitdiff
path: root/sound/firewire/fireface
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-06-02 16:12:58 +0900
committerTakashi Iwai <tiwai@suse.de>2019-06-11 11:36:26 +0200
commitf55e2a897962a55e15cc881ee86ee23f4817dffd (patch)
tree8c9463a92d7a711003ff02d743cb583b8bf53f91 /sound/firewire/fireface
parentb88f4d7c3812e3f3f746895cc4475b02c530303e (diff)
ALSA: fireface: minor code refactoring to finish streaming session
The operation to finish packet streaming corresponds to stopping isochronous contexts. This commit applies code refactoring to move codes to stop into a helper function to finish the session. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireface')
-rw-r--r--sound/firewire/fireface/ff-stream.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/sound/firewire/fireface/ff-stream.c b/sound/firewire/fireface/ff-stream.c
index 4f40dfb11979..884705ecf940 100644
--- a/sound/firewire/fireface/ff-stream.c
+++ b/sound/firewire/fireface/ff-stream.c
@@ -33,6 +33,9 @@ int snd_ff_stream_get_multiplier_mode(enum cip_sfc sfc,
static inline void finish_session(struct snd_ff *ff)
{
+ amdtp_stream_stop(&ff->tx_stream);
+ amdtp_stream_stop(&ff->rx_stream);
+
ff->spec->protocol->finish_session(ff);
ff->spec->protocol->switch_fetching_mode(ff, false);
}
@@ -112,9 +115,6 @@ int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate)
enum snd_ff_stream_mode mode;
int i;
- amdtp_stream_stop(&ff->tx_stream);
- amdtp_stream_stop(&ff->rx_stream);
-
finish_session(ff);
fw_iso_resources_free(&ff->tx_resources);
@@ -165,12 +165,8 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
return 0;
if (amdtp_streaming_error(&ff->tx_stream) ||
- amdtp_streaming_error(&ff->rx_stream)) {
- amdtp_stream_stop(&ff->tx_stream);
- amdtp_stream_stop(&ff->rx_stream);
-
+ amdtp_streaming_error(&ff->rx_stream))
finish_session(ff);
- }
/*
* Regardless of current source of clock signal, drivers transfer some
@@ -214,9 +210,6 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
return 0;
error:
- amdtp_stream_stop(&ff->tx_stream);
- amdtp_stream_stop(&ff->rx_stream);
-
finish_session(ff);
return err;
@@ -224,12 +217,8 @@ error:
void snd_ff_stream_stop_duplex(struct snd_ff *ff)
{
- if (ff->substreams_counter > 0)
- return;
-
- amdtp_stream_stop(&ff->tx_stream);
- amdtp_stream_stop(&ff->rx_stream);
- finish_session(ff);
+ if (ff->substreams_counter == 0)
+ finish_session(ff);
}
void snd_ff_stream_update_duplex(struct snd_ff *ff)