ALSA: firewire-tascam: unify stop and release method for duplex streams
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 18 Jun 2019 13:26:15 +0000 (22:26 +0900)
committerTakashi Iwai <tiwai@suse.de>
Fri, 21 Jun 2019 09:46:58 +0000 (11:46 +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/tascam/tascam-pcm.c
sound/firewire/tascam/tascam-stream.c
sound/firewire/tascam/tascam.h

index 450711bef508702b6cf788a8981ec977fb21e64e..300683a82c68849f13c442f7f61fb4017f3cac07 100644 (file)
@@ -118,7 +118,6 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
                --tscm->substreams_counter;
 
        snd_tscm_stream_stop_duplex(tscm);
-       snd_tscm_stream_release_duplex(tscm);
 
        mutex_unlock(&tscm->mutex);
 
index f572dfc151141492dd93565cf9ea425c7cc83212..0e515b7be2766c8bc6f1d884de8151157604aaf4 100644 (file)
@@ -380,14 +380,6 @@ int snd_tscm_stream_reserve_duplex(struct snd_tscm *tscm, unsigned int rate)
        return 0;
 }
 
-void snd_tscm_stream_release_duplex(struct snd_tscm *tscm)
-{
-       if (tscm->substreams_counter == 0) {
-               fw_iso_resources_free(&tscm->tx_resources);
-               fw_iso_resources_free(&tscm->rx_resources);
-       }
-}
-
 int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate)
 {
        unsigned int generation = tscm->rx_resources.generation;
@@ -455,8 +447,12 @@ error:
 
 void snd_tscm_stream_stop_duplex(struct snd_tscm *tscm)
 {
-       if (tscm->substreams_counter == 0)
+       if (tscm->substreams_counter == 0) {
                finish_session(tscm);
+
+               fw_iso_resources_free(&tscm->tx_resources);
+               fw_iso_resources_free(&tscm->rx_resources);
+       }
 }
 
 void snd_tscm_stream_lock_changed(struct snd_tscm *tscm)
index 1cb75c374f118fdc869621b5348b829526129cc8..4ed88cceaedbe525282d4e3eae71fc49faa70137 100644 (file)
@@ -148,7 +148,6 @@ int snd_tscm_stream_init_duplex(struct snd_tscm *tscm);
 void snd_tscm_stream_update_duplex(struct snd_tscm *tscm);
 void snd_tscm_stream_destroy_duplex(struct snd_tscm *tscm);
 int snd_tscm_stream_reserve_duplex(struct snd_tscm *tscm, unsigned int rate);
-void snd_tscm_stream_release_duplex(struct snd_tscm *tscm);
 int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate);
 void snd_tscm_stream_stop_duplex(struct snd_tscm *tscm);