ALSA: firewire: block .remove callback of bus driver till all of ALSA character devic...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 10 Oct 2018 06:34:59 +0000 (15:34 +0900)
committerTakashi Iwai <tiwai@suse.de>
Wed, 10 Oct 2018 10:11:34 +0000 (12:11 +0200)
At present, in .remove callback of bus driver just decrease reference
count of device for ALSA card instance. This delegates release of the
device to a process in which the last of ALSA character device is
released.

On the other hand, the other drivers such as for devices on PCIe are
programmed to block .remove callback of bus driver till all of ALSA
character devices are released.

For consistency of behaviour for whole drivers, this probably confuses
users. This commit takes drivers in ALSA firewire stack to imitate the
above behaviour.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/bebob/bebob.c
sound/firewire/digi00x/digi00x.c
sound/firewire/fireface/ff.c
sound/firewire/fireworks/fireworks.c
sound/firewire/isight.c
sound/firewire/motu/motu.c
sound/firewire/oxfw/oxfw.c
sound/firewire/tascam/tascam.c

index 72b04214a3b5852583fdf6002acd9fc712c3c0c1..3a5579cb3aa8f6cb37f028897b25e8717b8bd8e4 100644 (file)
@@ -374,8 +374,8 @@ static void bebob_remove(struct fw_unit *unit)
        cancel_delayed_work_sync(&bebob->dwork);
 
        if (bebob->registered) {
-               /* No need to wait for releasing card object in this context. */
-               snd_card_free_when_closed(bebob->card);
+               // Block till all of ALSA character devices are released.
+               snd_card_free(bebob->card);
        } else {
                /* Don't forget this case. */
                bebob_free(bebob);
index 654420f1c9bd0d2df8e58c60d1b021e659db19b5..554d7ff737a28ee21a8b49ad83808c2e9d3a2574 100644 (file)
@@ -172,8 +172,8 @@ static void snd_dg00x_remove(struct fw_unit *unit)
        cancel_delayed_work_sync(&dg00x->dwork);
 
        if (dg00x->registered) {
-               /* No need to wait for releasing card object in this context. */
-               snd_card_free_when_closed(dg00x->card);
+               // Block till all of ALSA character devices are released.
+               snd_card_free(dg00x->card);
        } else {
                /* Don't forget this case. */
                dg00x_free(dg00x);
index 98731bd8816f48fc7f1db33ce3f0a35e9a7a902e..73425dfe63bf8d3bc37c97f7bbbbe856d0064f3d 100644 (file)
@@ -145,8 +145,8 @@ static void snd_ff_remove(struct fw_unit *unit)
        cancel_work_sync(&ff->dwork.work);
 
        if (ff->registered) {
-               /* No need to wait for releasing card object in this context. */
-               snd_card_free_when_closed(ff->card);
+               // Block till all of ALSA character devices are released.
+               snd_card_free(ff->card);
        } else {
                /* Don't forget this case. */
                ff_free(ff);
index f680e2f278062d6f8473cfdd9f437957a43750ff..5a17ead86e619f2200e29d09024b503e37490d19 100644 (file)
@@ -358,8 +358,8 @@ static void efw_remove(struct fw_unit *unit)
        cancel_delayed_work_sync(&efw->dwork);
 
        if (efw->registered) {
-               /* No need to wait for releasing card object in this context. */
-               snd_card_free_when_closed(efw->card);
+               // Block till all of ALSA character devices are released.
+               snd_card_free(efw->card);
        } else {
                /* Don't forget this case. */
                efw_free(efw);
index 30957477e005e060016ed31f9d968963ccd66b33..1f591c8805ea60c39b50c37022a3cc7a9b632c0a 100644 (file)
@@ -703,7 +703,8 @@ static void isight_remove(struct fw_unit *unit)
        isight_stop_streaming(isight);
        mutex_unlock(&isight->mutex);
 
-       snd_card_free_when_closed(isight->card);
+       // Block till all of ALSA character devices are released.
+       snd_card_free(isight->card);
 }
 
 static const struct ieee1394_device_id isight_id_table[] = {
index fd5726424c7a24879c1275ca76914efd9d38e30c..12680c85b37fb037e1d39e68b02cc3c742437e5e 100644 (file)
@@ -172,8 +172,8 @@ static void motu_remove(struct fw_unit *unit)
        cancel_delayed_work_sync(&motu->dwork);
 
        if (motu->registered) {
-               /* No need to wait for releasing card object in this context. */
-               snd_card_free_when_closed(motu->card);
+               // Block till all of ALSA character devices are released.
+               snd_card_free(motu->card);
        } else {
                /* Don't forget this case. */
                motu_free(motu);
index 6ac551786b93ebf6f73e601f838a6c7db3ea5e5b..36f905b371e65d6963fd3919b4dde22aea5da2d7 100644 (file)
@@ -327,8 +327,8 @@ static void oxfw_remove(struct fw_unit *unit)
        cancel_delayed_work_sync(&oxfw->dwork);
 
        if (oxfw->registered) {
-               /* No need to wait for releasing card object in this context. */
-               snd_card_free_when_closed(oxfw->card);
+               // Block till all of ALSA character devices are released.
+               snd_card_free(oxfw->card);
        } else {
                /* Don't forget this case. */
                oxfw_free(oxfw);
index 53f20153ba71b713b55d19fae82f1c71554c8742..6f7aaa8c84aa5e216060b4746db2887b1b70ba8f 100644 (file)
@@ -212,8 +212,8 @@ static void snd_tscm_remove(struct fw_unit *unit)
        cancel_delayed_work_sync(&tscm->dwork);
 
        if (tscm->registered) {
-               /* No need to wait for releasing card object in this context. */
-               snd_card_free_when_closed(tscm->card);
+               // Block till all of ALSA character devices are released.
+               snd_card_free(tscm->card);
        } else {
                /* Don't forget this case. */
                tscm_free(tscm);