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

index 6172dad87c4e78b1214030ef1f39385ce85741cc..436f0c3c0fbba75ee5cedac70bece1bcb56dff3d 100644 (file)
@@ -40,7 +40,6 @@ static int midi_close(struct snd_rawmidi_substream *substream)
 
        --dice->substreams_counter;
        snd_dice_stream_stop_duplex(dice);
-       snd_dice_stream_release_duplex(dice);
 
        mutex_unlock(&dice->mutex);
 
index 00b55dfc3b2c6127751bec69de748e64815853ea..8368073f7fa0a483d82bed4a4a2a53a24f7275b5 100644 (file)
@@ -265,7 +265,6 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
                --dice->substreams_counter;
 
        snd_dice_stream_stop_duplex(dice);
-       snd_dice_stream_release_duplex(dice);
 
        mutex_unlock(&dice->mutex);
 
index e9e5c5fffb7056971b1677c9ac814d32fbea6df8..433714a117a0b77f020d8640d717e2d0067433e0 100644 (file)
@@ -336,12 +336,6 @@ error:
        return err;
 }
 
-void snd_dice_stream_release_duplex(struct snd_dice *dice)
-{
-       if (dice->substreams_counter == 0)
-               release_resources(dice);
-}
-
 static int start_streams(struct snd_dice *dice, enum amdtp_stream_direction dir,
                         unsigned int rate, struct reg_params *params)
 {
@@ -494,6 +488,8 @@ void snd_dice_stream_stop_duplex(struct snd_dice *dice)
        if (dice->substreams_counter == 0) {
                if (get_register_params(dice, &tx_params, &rx_params) >= 0)
                        finish_session(dice, &tx_params, &rx_params);
+
+               release_resources(dice);
        }
 }
 
index f95073b85010170812cb0ea0216cf5b36202536e..fd3f483283d5018817bf0649218c62be4155857b 100644 (file)
@@ -210,7 +210,6 @@ void snd_dice_stream_stop_duplex(struct snd_dice *dice);
 int snd_dice_stream_init_duplex(struct snd_dice *dice);
 void snd_dice_stream_destroy_duplex(struct snd_dice *dice);
 int snd_dice_stream_reserve_duplex(struct snd_dice *dice, unsigned int rate);
-void snd_dice_stream_release_duplex(struct snd_dice *dice);
 void snd_dice_stream_update_duplex(struct snd_dice *dice);
 int snd_dice_stream_detect_current_formats(struct snd_dice *dice);