Skip to content

Commit f55e2a8

Browse files
takaswietiwai
authored andcommitted
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>
1 parent b88f4d7 commit f55e2a8

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

‎sound/firewire/fireface/ff-stream.c‎

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ int snd_ff_stream_get_multiplier_mode(enum cip_sfc sfc,
3333

3434
static inline void finish_session(struct snd_ff *ff)
3535
{
36+
amdtp_stream_stop(&ff->tx_stream);
37+
amdtp_stream_stop(&ff->rx_stream);
38+
3639
ff->spec->protocol->finish_session(ff);
3740
ff->spec->protocol->switch_fetching_mode(ff, false);
3841
}
@@ -112,9 +115,6 @@ int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate)
112115
enum snd_ff_stream_mode mode;
113116
int i;
114117

115-
amdtp_stream_stop(&ff->tx_stream);
116-
amdtp_stream_stop(&ff->rx_stream);
117-
118118
finish_session(ff);
119119

120120
fw_iso_resources_free(&ff->tx_resources);
@@ -165,12 +165,8 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
165165
return 0;
166166

167167
if (amdtp_streaming_error(&ff->tx_stream) ||
168-
amdtp_streaming_error(&ff->rx_stream)) {
169-
amdtp_stream_stop(&ff->tx_stream);
170-
amdtp_stream_stop(&ff->rx_stream);
171-
168+
amdtp_streaming_error(&ff->rx_stream))
172169
finish_session(ff);
173-
}
174170

175171
/*
176172
* Regardless of current source of clock signal, drivers transfer some
@@ -214,22 +210,15 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
214210

215211
return 0;
216212
error:
217-
amdtp_stream_stop(&ff->tx_stream);
218-
amdtp_stream_stop(&ff->rx_stream);
219-
220213
finish_session(ff);
221214

222215
return err;
223216
}
224217

225218
void snd_ff_stream_stop_duplex(struct snd_ff *ff)
226219
{
227-
if (ff->substreams_counter > 0)
228-
return;
229-
230-
amdtp_stream_stop(&ff->tx_stream);
231-
amdtp_stream_stop(&ff->rx_stream);
232-
finish_session(ff);
220+
if (ff->substreams_counter == 0)
221+
finish_session(ff);
233222
}
234223

235224
void snd_ff_stream_update_duplex(struct snd_ff *ff)

0 commit comments

Comments
 (0)