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

index cca888cce0d30affd0a03b3f89d1284614ed045d..ca06ad318ed6d334b5f32d1634d9e3fc1498fbbe 100644 (file)
@@ -37,7 +37,6 @@ static int midi_close(struct snd_rawmidi_substream *substream)
        mutex_lock(&dg00x->mutex);
        --dg00x->substreams_counter;
        snd_dg00x_stream_stop_duplex(dg00x);
-       snd_dg00x_stream_release_duplex(dg00x);
        mutex_unlock(&dg00x->mutex);
 
        snd_dg00x_stream_lock_release(dg00x);
index 9ed2ebdcf23a1ed7417f189ee32b7b35ed95e2fd..c38fbd6ded9f0ff31891b6061b2b894dce1e3b41 100644 (file)
@@ -189,7 +189,6 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
                --dg00x->substreams_counter;
 
        snd_dg00x_stream_stop_duplex(dg00x);
-       snd_dg00x_stream_release_duplex(dg00x);
 
        mutex_unlock(&dg00x->mutex);
 
index 3c5e1c5a2e11b8e8e86e3fe9c9efb65268d59e74..7c8e7ad48d03cf5dcc939d79498cd2ba795c06f8 100644 (file)
@@ -293,14 +293,6 @@ int snd_dg00x_stream_reserve_duplex(struct snd_dg00x *dg00x, unsigned int rate)
        return 0;
 }
 
-void snd_dg00x_stream_release_duplex(struct snd_dg00x *dg00x)
-{
-       if (dg00x->substreams_counter == 0) {
-               fw_iso_resources_free(&dg00x->tx_resources);
-               fw_iso_resources_free(&dg00x->rx_resources);
-       }
-}
-
 int snd_dg00x_stream_start_duplex(struct snd_dg00x *dg00x)
 {
        unsigned int generation = dg00x->rx_resources.generation;
@@ -372,8 +364,12 @@ error:
 
 void snd_dg00x_stream_stop_duplex(struct snd_dg00x *dg00x)
 {
-       if (dg00x->substreams_counter == 0)
+       if (dg00x->substreams_counter == 0) {
                finish_session(dg00x);
+
+               fw_iso_resources_free(&dg00x->tx_resources);
+               fw_iso_resources_free(&dg00x->rx_resources);
+       }
 }
 
 void snd_dg00x_stream_update_duplex(struct snd_dg00x *dg00x)
index 3fb1c49f6f9eef6329d1d395fd77a2da201d39e1..2d026b5b00797c0a6c9b43760da6775dc26b9342 100644 (file)
@@ -143,7 +143,6 @@ int snd_dg00x_stream_init_duplex(struct snd_dg00x *dg00x);
 int snd_dg00x_stream_reserve_duplex(struct snd_dg00x *dg00x, unsigned int rate);
 int snd_dg00x_stream_start_duplex(struct snd_dg00x *dg00x);
 void snd_dg00x_stream_stop_duplex(struct snd_dg00x *dg00x);
-void snd_dg00x_stream_release_duplex(struct snd_dg00x *dg00x);
 void snd_dg00x_stream_update_duplex(struct snd_dg00x *dg00x);
 void snd_dg00x_stream_destroy_duplex(struct snd_dg00x *dg00x);