Commit f55e2a89 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b88f4d7c
...@@ -33,6 +33,9 @@ int snd_ff_stream_get_multiplier_mode(enum cip_sfc sfc, ...@@ -33,6 +33,9 @@ int snd_ff_stream_get_multiplier_mode(enum cip_sfc sfc,
static inline void finish_session(struct snd_ff *ff) 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->finish_session(ff);
ff->spec->protocol->switch_fetching_mode(ff, false); 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) ...@@ -112,9 +115,6 @@ int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate)
enum snd_ff_stream_mode mode; enum snd_ff_stream_mode mode;
int i; int i;
amdtp_stream_stop(&ff->tx_stream);
amdtp_stream_stop(&ff->rx_stream);
finish_session(ff); finish_session(ff);
fw_iso_resources_free(&ff->tx_resources); fw_iso_resources_free(&ff->tx_resources);
...@@ -165,12 +165,8 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate) ...@@ -165,12 +165,8 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
return 0; return 0;
if (amdtp_streaming_error(&ff->tx_stream) || if (amdtp_streaming_error(&ff->tx_stream) ||
amdtp_streaming_error(&ff->rx_stream)) { amdtp_streaming_error(&ff->rx_stream))
amdtp_stream_stop(&ff->tx_stream);
amdtp_stream_stop(&ff->rx_stream);
finish_session(ff); finish_session(ff);
}
/* /*
* Regardless of current source of clock signal, drivers transfer some * 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) ...@@ -214,9 +210,6 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
return 0; return 0;
error: error:
amdtp_stream_stop(&ff->tx_stream);
amdtp_stream_stop(&ff->rx_stream);
finish_session(ff); finish_session(ff);
return err; return err;
...@@ -224,11 +217,7 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate) ...@@ -224,11 +217,7 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
void snd_ff_stream_stop_duplex(struct snd_ff *ff) void snd_ff_stream_stop_duplex(struct snd_ff *ff)
{ {
if (ff->substreams_counter > 0) if (ff->substreams_counter == 0)
return;
amdtp_stream_stop(&ff->tx_stream);
amdtp_stream_stop(&ff->rx_stream);
finish_session(ff); finish_session(ff);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment