Commit f74f98be authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Takashi Iwai <tiwai@suse.de>

ALSA Core
- fixed oops at resume.
- block also the non-blocking devices until the resume is finished.
parent 3b43c523
...@@ -682,6 +682,7 @@ int snd_card_file_remove(snd_card_t *card, struct file *file) ...@@ -682,6 +682,7 @@ int snd_card_file_remove(snd_card_t *card, struct file *file)
int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file) int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file)
{ {
wait_queue_t wait; wait_queue_t wait;
int result = 0;
/* fastpath */ /* fastpath */
if (snd_power_get_state(card) == power_state) if (snd_power_get_state(card) == power_state)
...@@ -689,18 +690,24 @@ int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file ...@@ -689,18 +690,24 @@ int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(&card->power_sleep, &wait); add_wait_queue(&card->power_sleep, &wait);
while (1) { while (1) {
if (card->shutdown) if (card->shutdown) {
return -ENODEV; result = -ENODEV;
if (snd_power_get_state(card) == power_state) { break;
remove_wait_queue(&card->power_sleep, &wait);
return 0;
} }
if (file && (file->f_flags & O_NONBLOCK)) if (snd_power_get_state(card) == power_state)
return -EAGAIN; break;
#if 0 /* block all devices */
if (file && (file->f_flags & O_NONBLOCK)) {
result = -EAGAIN;
break;
}
#endif
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
snd_power_unlock(card); snd_power_unlock(card);
schedule_timeout(30 * HZ); schedule_timeout(30 * HZ);
snd_power_lock(card); snd_power_lock(card);
} }
remove_wait_queue(&card->power_sleep, &wait);
return result;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment