[ALSA] Decentralize PM control
Modules: ALSA Core,Control Midlevel,/oss/Makefile
Remove the centralized PM control in the sound core.
Each driver is responsible to get callbacks from bus/driver now.
SND_GENERIC_DRIVER is removed together with this action.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/core/control.c b/sound/core/control.c
index 1a14338..03ae9bb 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1023,36 +1023,6 @@
return 0;
}
-#ifdef CONFIG_PM
-/*
- * change the power state
- */
-static int snd_ctl_set_power_state(struct snd_card *card, unsigned int power_state)
-{
- switch (power_state) {
- case SNDRV_CTL_POWER_D0:
- if (card->power_state != power_state) {
- card->pm_resume(card);
- snd_power_change_state(card, power_state);
- }
- break;
- case SNDRV_CTL_POWER_D3hot:
- if (card->power_state != power_state) {
- card->pm_suspend(card, PMSG_SUSPEND);
- snd_power_change_state(card, power_state);
- }
- break;
- case SNDRV_CTL_POWER_D1:
- case SNDRV_CTL_POWER_D2:
- case SNDRV_CTL_POWER_D3cold:
- /* not supported yet */
- default:
- return -EINVAL;
- }
- return 0;
-}
-#endif
-
static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct snd_ctl_file *ctl;
@@ -1092,19 +1062,7 @@
case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS:
return snd_ctl_subscribe_events(ctl, ip);
case SNDRV_CTL_IOCTL_POWER:
- if (get_user(err, ip))
- return -EFAULT;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-#ifdef CONFIG_PM
- if (card->pm_suspend && card->pm_resume) {
- snd_power_lock(card);
- err = snd_ctl_set_power_state(card, err);
- snd_power_unlock(card);
- } else
-#endif
- err = -ENOPROTOOPT;
- return err;
+ return -ENOPROTOOPT;
case SNDRV_CTL_IOCTL_POWER_STATE:
#ifdef CONFIG_PM
return put_user(card->power_state, ip) ? -EFAULT : 0;