summaryrefslogtreecommitdiffstats
path: root/sound/core/control.c
diff options
context:
space:
mode:
authorGiuliano Pochini <pochini@shiny.it>2006-03-13 14:11:11 +0100
committerJaroslav Kysela <perex@suse.cz>2006-03-22 10:37:23 +0100
commit646494007b48e8897888cd407c2b7d1d69cb2e58 (patch)
tree02d72d5f844ecb0ce3c25b1b8401ca3b172fa866 /sound/core/control.c
parent9230d2148a0c53188c216b446cf17ea213ebca8a (diff)
downloadtalos-op-linux-646494007b48e8897888cd407c2b7d1d69cb2e58.tar.gz
talos-op-linux-646494007b48e8897888cd407c2b7d1d69cb2e58.zip
[ALSA] make control.c suspend aware
Modules: Control Midlevel This patch prevents user-space apps from accessing the hardware via control interface while the soundcard is suspended. Signed-off-by: Giuliano Pochini <pochini@shiny.it> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r--sound/core/control.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 0c29679a8576..9742bdba0de1 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -658,7 +658,11 @@ static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl,
if (copy_from_user(&info, _info, sizeof(info)))
return -EFAULT;
- result = snd_ctl_elem_info(ctl, &info);
+ snd_power_lock(ctl->card);
+ result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0, NULL);
+ if (result >= 0)
+ result = snd_ctl_elem_info(ctl, &info);
+ snd_power_unlock(ctl->card);
if (result >= 0)
if (copy_to_user(_info, &info, sizeof(info)))
return -EFAULT;
@@ -708,7 +712,11 @@ static int snd_ctl_elem_read_user(struct snd_card *card,
kfree(control);
return -EFAULT;
}
- result = snd_ctl_elem_read(card, control);
+ snd_power_lock(card);
+ result = snd_power_wait(card, SNDRV_CTL_POWER_D0, NULL);
+ if (result >= 0)
+ result = snd_ctl_elem_read(card, control);
+ snd_power_unlock(card);
if (result >= 0)
if (copy_to_user(_control, control, sizeof(*control)))
result = -EFAULT;
@@ -758,6 +766,7 @@ static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
struct snd_ctl_elem_value __user *_control)
{
struct snd_ctl_elem_value *control;
+ struct snd_card *card;
int result;
control = kmalloc(sizeof(*control), GFP_KERNEL);
@@ -767,7 +776,12 @@ static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
kfree(control);
return -EFAULT;
}
- result = snd_ctl_elem_write(file->card, file, control);
+ card = file->card;
+ snd_power_lock(card);
+ result = snd_power_wait(card, SNDRV_CTL_POWER_D0, NULL);
+ if (result >= 0)
+ result = snd_ctl_elem_write(card, file, control);
+ snd_power_unlock(card);
if (result >= 0)
if (copy_to_user(_control, control, sizeof(*control)))
result = -EFAULT;
OpenPOWER on IntegriCloud