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

index 938985c2d4a8181ce9ac7dd4653f8b2903df5a8c..75228e769687a9b0be1586bbedd1d73a18a20c4b 100644 (file)
@@ -233,7 +233,6 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
                --ff->substreams_counter;
 
        snd_ff_stream_stop_duplex(ff);
-       snd_ff_stream_release_duplex(ff);
 
        mutex_unlock(&ff->mutex);
 
index 884705ecf9401496b5adeade925735943f1f5d46..049920a6d43ed631b8596b7e90ac78fc8ca163e4 100644 (file)
@@ -149,14 +149,6 @@ int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate)
        return 0;
 }
 
-void snd_ff_stream_release_duplex(struct snd_ff *ff)
-{
-       if (ff->substreams_counter == 0) {
-               fw_iso_resources_free(&ff->tx_resources);
-               fw_iso_resources_free(&ff->rx_resources);
-       }
-}
-
 int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
 {
        int err;
@@ -217,8 +209,12 @@ error:
 
 void snd_ff_stream_stop_duplex(struct snd_ff *ff)
 {
-       if (ff->substreams_counter == 0)
+       if (ff->substreams_counter == 0) {
                finish_session(ff);
+
+               fw_iso_resources_free(&ff->tx_resources);
+               fw_iso_resources_free(&ff->rx_resources);
+       }
 }
 
 void snd_ff_stream_update_duplex(struct snd_ff *ff)
index fe5739ee1c88b7dd0d58c8424234fbe15343c327..9b52c368f6de4037cf3c0a0ae73d2fc468e26039 100644 (file)
@@ -139,7 +139,6 @@ int snd_ff_stream_get_multiplier_mode(enum cip_sfc sfc,
 int snd_ff_stream_init_duplex(struct snd_ff *ff);
 void snd_ff_stream_destroy_duplex(struct snd_ff *ff);
 int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate);
-void snd_ff_stream_release_duplex(struct snd_ff *ff);
 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_update_duplex(struct snd_ff *ff);