ALSA: firewire-motu: unify stop and release method for duplex streams
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 18 Jun 2019 13:26:17 +0000 (22:26 +0900)
committerTakashi Iwai <tiwai@suse.de>
Fri, 21 Jun 2019 09:47:02 +0000 (11:47 +0200)
>From callbacks for pcm and rawmidi interfaces, the functions to stop
and release duplex streams are called at the same time. This commit
merges the two functions.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/motu/motu-midi.c
sound/firewire/motu/motu-pcm.c
sound/firewire/motu/motu-stream.c
sound/firewire/motu/motu.h

index a463730c72bc23a8ba7b4ea74b4d14a7ce20b805..4520c0060b8374726c60429c716bb6b869c76dd7 100644 (file)
@@ -40,7 +40,6 @@ static int midi_close(struct snd_rawmidi_substream *substream)
 
        --motu->substreams_counter;
        snd_motu_stream_stop_duplex(motu);
-       snd_motu_stream_release_duplex(motu);
 
        mutex_unlock(&motu->mutex);
 
index b9852c911b98cb4aa91d6377edb1a176e657abe4..60c691d189524b7ec6bd389d78d803a12ede65c4 100644 (file)
@@ -224,7 +224,6 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
                --motu->substreams_counter;
 
        snd_motu_stream_stop_duplex(motu);
-       snd_motu_stream_release_duplex(motu);
 
        mutex_unlock(&motu->mutex);
 
index 82891583b7364286f737a2762bb249b5f2263582..8aab5db71c0f91b76d6dabef4575bc2f91abce62 100644 (file)
@@ -200,14 +200,6 @@ int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate)
        return 0;
 }
 
-void snd_motu_stream_release_duplex(struct snd_motu *motu)
-{
-       if (motu->substreams_counter == 0) {
-               fw_iso_resources_free(&motu->tx_resources);
-               fw_iso_resources_free(&motu->rx_resources);
-       }
-}
-
 static int ensure_packet_formats(struct snd_motu *motu)
 {
        __be32 reg;
@@ -301,8 +293,12 @@ stop_streams:
 
 void snd_motu_stream_stop_duplex(struct snd_motu *motu)
 {
-       if (motu->substreams_counter == 0)
+       if (motu->substreams_counter == 0) {
                finish_session(motu);
+
+               fw_iso_resources_free(&motu->tx_resources);
+               fw_iso_resources_free(&motu->rx_resources);
+       }
 }
 
 static int init_stream(struct snd_motu *motu, enum amdtp_stream_direction dir)
index 32cd42873fd0e42ae4221f33f093083acceb9049..a4ac320f2c9ef976e71689bcece8d323906def36 100644 (file)
@@ -154,7 +154,6 @@ int snd_motu_stream_init_duplex(struct snd_motu *motu);
 void snd_motu_stream_destroy_duplex(struct snd_motu *motu);
 int snd_motu_stream_cache_packet_formats(struct snd_motu *motu);
 int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate);
-void snd_motu_stream_release_duplex(struct snd_motu *motu);
 int snd_motu_stream_start_duplex(struct snd_motu *motu);
 void snd_motu_stream_stop_duplex(struct snd_motu *motu);
 int snd_motu_stream_lock_try(struct snd_motu *motu);