aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-02-21 09:55:00 -0500
committerTakashi Iwai <tiwai@suse.de>2015-02-23 03:11:24 -0500
commitdec84316dd53c90e93b4ee849483bd4bd1e9a585 (patch)
tree3725938633e83ba9bf303e171323bbb911a0ba9f /sound/firewire/bebob
parentd23c2cc4485d10f0cedfef99dd2961d9652b1b3f (diff)
ALSA: fireworks/bebob/dice/oxfw: make it possible to shutdown safely
A part of these drivers, especially BeBoB driver, are programmed to wait some events. Thus the drivers should not destroy any data in .remove() context. This commit moves some destructors from 'struct fw_driver.remove()' to 'struct snd_card.private_free()' to shutdown safely. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: <stable@vger.kernel.org> # 3.19+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/bebob')
-rw-r--r--sound/firewire/bebob/bebob.c10
-rw-r--r--sound/firewire/bebob/bebob_stream.c4
2 files changed, 6 insertions, 8 deletions
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
index b612599fb543..611b7dae7ee5 100644
--- a/sound/firewire/bebob/bebob.c
+++ b/sound/firewire/bebob/bebob.c
@@ -127,8 +127,11 @@ bebob_card_free(struct snd_card *card)
127{ 127{
128 struct snd_bebob *bebob = card->private_data; 128 struct snd_bebob *bebob = card->private_data;
129 129
130 snd_bebob_stream_destroy_duplex(bebob);
130 fw_unit_put(bebob->unit); 131 fw_unit_put(bebob->unit);
131 132
133 kfree(bebob->maudio_special_quirk);
134
132 if (bebob->card_index >= 0) { 135 if (bebob->card_index >= 0) {
133 mutex_lock(&devices_mutex); 136 mutex_lock(&devices_mutex);
134 clear_bit(bebob->card_index, devices_used); 137 clear_bit(bebob->card_index, devices_used);
@@ -314,10 +317,9 @@ static void bebob_remove(struct fw_unit *unit)
314 if (bebob == NULL) 317 if (bebob == NULL)
315 return; 318 return;
316 319
317 kfree(bebob->maudio_special_quirk); 320 /* Awake bus-reset waiters. */
318 321 if (!completion_done(&bebob->bus_reset))
319 snd_bebob_stream_destroy_duplex(bebob); 322 complete_all(&bebob->bus_reset);
320 snd_card_disconnect(bebob->card);
321 323
322 /* No need to wait for releasing card object in this context. */ 324 /* No need to wait for releasing card object in this context. */
323 snd_card_free_when_closed(bebob->card); 325 snd_card_free_when_closed(bebob->card);
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
index fcca3eebc91f..98e4fc8121a1 100644
--- a/sound/firewire/bebob/bebob_stream.c
+++ b/sound/firewire/bebob/bebob_stream.c
@@ -716,14 +716,10 @@ void snd_bebob_stream_update_duplex(struct snd_bebob *bebob)
716 */ 716 */
717void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob) 717void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob)
718{ 718{
719 mutex_lock(&bebob->mutex);
720
721 amdtp_stream_destroy(&bebob->rx_stream); 719 amdtp_stream_destroy(&bebob->rx_stream);
722 amdtp_stream_destroy(&bebob->tx_stream); 720 amdtp_stream_destroy(&bebob->tx_stream);
723 721
724 destroy_both_connections(bebob); 722 destroy_both_connections(bebob);
725
726 mutex_unlock(&bebob->mutex);
727} 723}
728 724
729/* 725/*