Skip to content

Commit

Permalink
ALSA: firewire-motu: code refactoring to finish streaming session
Browse files Browse the repository at this point in the history
The operation to finish packet streaming includes stopping isochronous
contexts. This commit merges it to the helper function.

Signed-off-by: Takashi Sakamoto <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed Jun 18, 2019
1 parent e63a151 commit ec694fb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions sound/firewire/motu/motu-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ static void finish_session(struct snd_motu *motu)
if (err < 0)
return;

amdtp_stream_stop(&motu->tx_stream);
amdtp_stream_stop(&motu->rx_stream);

err = snd_motu_transaction_read(motu, ISOC_COMM_CONTROL_OFFSET, &reg,
sizeof(reg));
if (err < 0)
Expand Down Expand Up @@ -219,11 +222,8 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
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);
amdtp_streaming_error(&motu->tx_stream))
finish_session(motu);
}

if (!amdtp_stream_running(&motu->rx_stream)) {
err = protocol->set_clock_rate(motu, rate);
Expand Down Expand Up @@ -278,13 +278,8 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)

void snd_motu_stream_stop_duplex(struct snd_motu *motu)
{
if (motu->substreams_counter == 0) {
amdtp_stream_stop(&motu->tx_stream);
amdtp_stream_stop(&motu->rx_stream);

fw_iso_resources_free(&motu->tx_resources);
fw_iso_resources_free(&motu->rx_resources);
}
if (motu->substreams_counter == 0)
finish_session(motu);
}

static int init_stream(struct snd_motu *motu, enum amdtp_stream_direction dir)
Expand Down

0 comments on commit ec694fb

Please sign in to comment.