diff options
-rw-r--r-- | include/sound/core.h | 2 | ||||
-rw-r--r-- | sound/core/control.c | 6 | ||||
-rw-r--r-- | sound/core/control_compat.c | 6 | ||||
-rw-r--r-- | sound/core/init.c | 9 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 10 |
5 files changed, 13 insertions, 20 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index 7f32c12b4a0a..d1d043f6cb80 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -170,7 +170,7 @@ static inline void snd_power_change_state(struct snd_card *card, unsigned int st | |||
170 | } | 170 | } |
171 | 171 | ||
172 | /* init.c */ | 172 | /* init.c */ |
173 | int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file); | 173 | int snd_power_wait(struct snd_card *card, unsigned int power_state); |
174 | 174 | ||
175 | #else /* ! CONFIG_PM */ | 175 | #else /* ! CONFIG_PM */ |
176 | 176 | ||
diff --git a/sound/core/control.c b/sound/core/control.c index 574745314e70..22565c9b9603 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -664,7 +664,7 @@ static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl, | |||
664 | if (copy_from_user(&info, _info, sizeof(info))) | 664 | if (copy_from_user(&info, _info, sizeof(info))) |
665 | return -EFAULT; | 665 | return -EFAULT; |
666 | snd_power_lock(ctl->card); | 666 | snd_power_lock(ctl->card); |
667 | result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0, NULL); | 667 | result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); |
668 | if (result >= 0) | 668 | if (result >= 0) |
669 | result = snd_ctl_elem_info(ctl, &info); | 669 | result = snd_ctl_elem_info(ctl, &info); |
670 | snd_power_unlock(ctl->card); | 670 | snd_power_unlock(ctl->card); |
@@ -718,7 +718,7 @@ static int snd_ctl_elem_read_user(struct snd_card *card, | |||
718 | return -EFAULT; | 718 | return -EFAULT; |
719 | } | 719 | } |
720 | snd_power_lock(card); | 720 | snd_power_lock(card); |
721 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0, NULL); | 721 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0); |
722 | if (result >= 0) | 722 | if (result >= 0) |
723 | result = snd_ctl_elem_read(card, control); | 723 | result = snd_ctl_elem_read(card, control); |
724 | snd_power_unlock(card); | 724 | snd_power_unlock(card); |
@@ -783,7 +783,7 @@ static int snd_ctl_elem_write_user(struct snd_ctl_file *file, | |||
783 | } | 783 | } |
784 | card = file->card; | 784 | card = file->card; |
785 | snd_power_lock(card); | 785 | snd_power_lock(card); |
786 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0, NULL); | 786 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0); |
787 | if (result >= 0) | 787 | if (result >= 0) |
788 | result = snd_ctl_elem_write(card, file, control); | 788 | result = snd_ctl_elem_write(card, file, control); |
789 | snd_power_unlock(card); | 789 | snd_power_unlock(card); |
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 84fef5084e17..3c0161bb5ba4 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c | |||
@@ -109,7 +109,7 @@ static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl, | |||
109 | goto error; | 109 | goto error; |
110 | 110 | ||
111 | snd_power_lock(ctl->card); | 111 | snd_power_lock(ctl->card); |
112 | err = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0, NULL); | 112 | err = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); |
113 | if (err >= 0) | 113 | if (err >= 0) |
114 | err = snd_ctl_elem_info(ctl, data); | 114 | err = snd_ctl_elem_info(ctl, data); |
115 | snd_power_unlock(ctl->card); | 115 | snd_power_unlock(ctl->card); |
@@ -294,7 +294,7 @@ static int snd_ctl_elem_read_user_compat(struct snd_card *card, | |||
294 | goto error; | 294 | goto error; |
295 | 295 | ||
296 | snd_power_lock(card); | 296 | snd_power_lock(card); |
297 | err = snd_power_wait(card, SNDRV_CTL_POWER_D0, NULL); | 297 | err = snd_power_wait(card, SNDRV_CTL_POWER_D0); |
298 | if (err >= 0) | 298 | if (err >= 0) |
299 | err = snd_ctl_elem_read(card, data); | 299 | err = snd_ctl_elem_read(card, data); |
300 | snd_power_unlock(card); | 300 | snd_power_unlock(card); |
@@ -320,7 +320,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, | |||
320 | goto error; | 320 | goto error; |
321 | 321 | ||
322 | snd_power_lock(card); | 322 | snd_power_lock(card); |
323 | err = snd_power_wait(card, SNDRV_CTL_POWER_D0, NULL); | 323 | err = snd_power_wait(card, SNDRV_CTL_POWER_D0); |
324 | if (err >= 0) | 324 | if (err >= 0) |
325 | err = snd_ctl_elem_write(card, file, data); | 325 | err = snd_ctl_elem_write(card, file, data); |
326 | snd_power_unlock(card); | 326 | snd_power_unlock(card); |
diff --git a/sound/core/init.c b/sound/core/init.c index 5bb8a8b23d51..39ed2e5bb0af 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -722,13 +722,12 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) | |||
722 | * snd_power_wait - wait until the power-state is changed. | 722 | * snd_power_wait - wait until the power-state is changed. |
723 | * @card: soundcard structure | 723 | * @card: soundcard structure |
724 | * @power_state: expected power state | 724 | * @power_state: expected power state |
725 | * @file: file structure for the O_NONBLOCK check (optional) | ||
726 | * | 725 | * |
727 | * Waits until the power-state is changed. | 726 | * Waits until the power-state is changed. |
728 | * | 727 | * |
729 | * Note: the power lock must be active before call. | 728 | * Note: the power lock must be active before call. |
730 | */ | 729 | */ |
731 | int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file) | 730 | int snd_power_wait(struct snd_card *card, unsigned int power_state) |
732 | { | 731 | { |
733 | wait_queue_t wait; | 732 | wait_queue_t wait; |
734 | int result = 0; | 733 | int result = 0; |
@@ -745,12 +744,6 @@ int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file | |||
745 | } | 744 | } |
746 | if (snd_power_get_state(card) == power_state) | 745 | if (snd_power_get_state(card) == power_state) |
747 | break; | 746 | break; |
748 | #if 0 /* block all devices */ | ||
749 | if (file && (file->f_flags & O_NONBLOCK)) { | ||
750 | result = -EAGAIN; | ||
751 | break; | ||
752 | } | ||
753 | #endif | ||
754 | set_current_state(TASK_UNINTERRUPTIBLE); | 747 | set_current_state(TASK_UNINTERRUPTIBLE); |
755 | snd_power_unlock(card); | 748 | snd_power_unlock(card); |
756 | schedule_timeout(30 * HZ); | 749 | schedule_timeout(30 * HZ); |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 01f150f0990e..7010eb271cc7 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1170,7 +1170,7 @@ static int snd_pcm_resume(struct snd_pcm_substream *substream) | |||
1170 | int res; | 1170 | int res; |
1171 | 1171 | ||
1172 | snd_power_lock(card); | 1172 | snd_power_lock(card); |
1173 | if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile)) >= 0) | 1173 | if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0)) >= 0) |
1174 | res = snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 0); | 1174 | res = snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 0); |
1175 | snd_power_unlock(card); | 1175 | snd_power_unlock(card); |
1176 | return res; | 1176 | return res; |
@@ -1198,7 +1198,7 @@ static int snd_pcm_xrun(struct snd_pcm_substream *substream) | |||
1198 | 1198 | ||
1199 | snd_power_lock(card); | 1199 | snd_power_lock(card); |
1200 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | 1200 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { |
1201 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile); | 1201 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0); |
1202 | if (result < 0) | 1202 | if (result < 0) |
1203 | goto _unlock; | 1203 | goto _unlock; |
1204 | } | 1204 | } |
@@ -1319,7 +1319,7 @@ int snd_pcm_prepare(struct snd_pcm_substream *substream) | |||
1319 | struct snd_card *card = substream->pcm->card; | 1319 | struct snd_card *card = substream->pcm->card; |
1320 | 1320 | ||
1321 | snd_power_lock(card); | 1321 | snd_power_lock(card); |
1322 | if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile)) >= 0) | 1322 | if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0)) >= 0) |
1323 | res = snd_pcm_action_nonatomic(&snd_pcm_action_prepare, substream, 0); | 1323 | res = snd_pcm_action_nonatomic(&snd_pcm_action_prepare, substream, 0); |
1324 | snd_power_unlock(card); | 1324 | snd_power_unlock(card); |
1325 | return res; | 1325 | return res; |
@@ -1410,7 +1410,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream) | |||
1410 | 1410 | ||
1411 | snd_power_lock(card); | 1411 | snd_power_lock(card); |
1412 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | 1412 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { |
1413 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile); | 1413 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0); |
1414 | if (result < 0) { | 1414 | if (result < 0) { |
1415 | snd_power_unlock(card); | 1415 | snd_power_unlock(card); |
1416 | return result; | 1416 | return result; |
@@ -1533,7 +1533,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) | |||
1533 | 1533 | ||
1534 | snd_power_lock(card); | 1534 | snd_power_lock(card); |
1535 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | 1535 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { |
1536 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile); | 1536 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0); |
1537 | if (result < 0) | 1537 | if (result < 0) |
1538 | goto _unlock; | 1538 | goto _unlock; |
1539 | } | 1539 | } |