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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
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);
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);
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);
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);
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[] = {
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);
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);
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);