@@ -401,6 +401,14 @@ int snd_card_disconnect(struct snd_card *card)
}
spin_unlock(&card->files_lock);
+#ifdef CONFIG_PM
+ /* wake up sleepers here before other callbacks for avoiding potential
+ * deadlocks with other locks (e.g. in kctls);
+ * then this notifies the shutdown and sleepers would abort immediately
+ */
+ wake_up_all(&card->power_sleep);
+#endif
+
/* notify all connected devices about disconnection */
/* at this point, they cannot respond to any calls except release() */
@@ -424,9 +432,6 @@ int snd_card_disconnect(struct snd_card *card)
clear_bit(card->number, snd_cards_lock);
mutex_unlock(&snd_card_mutex);
-#ifdef CONFIG_PM
- wake_up(&card->power_sleep);
-#endif
return 0;
}
EXPORT_SYMBOL(snd_card_disconnect);