aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-11-21 17:30:23 +0100
committerTakashi Iwai <tiwai@suse.de>2016-11-21 17:30:23 +0100
commit4b0ae98622adce0a182a2540e16f087e96308453 (patch)
tree915576754f04bf08cb45fba0af46e23c3965e4a2
parentbc6fdcc9d1cba4232413d199720b6f48fe5be0d2 (diff)
downloadhda-emu-4b0ae98622adce0a182a2540e16f087e96308453.tar.gz
Fix the regression wrt runtime PM
The pm_runtime_get_if_in_use() should return -EINVAL when no runtime PM is used. But we didn't check it, thus it resulted as if the codec power were down. Fix it by referring to the actual power_save value in pm_runtime_get_if_in_use(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--hda-emu.c7
-rw-r--r--snd-wrapper.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/hda-emu.c b/hda-emu.c
index a92db15..60d33bc 100644
--- a/hda-emu.c
+++ b/hda-emu.c
@@ -212,15 +212,14 @@ int hda_get_power_save(void)
void hda_set_power_save(int val)
{
-#ifdef NEW_HDA_INFRA
- snd_hda_set_power_save(bus, val * 1000);
-#else /* !NEW_HDA_INFRA */
#ifdef HDA_OLD_POWER_SAVE
*power_save_parameter = val;
#else
power_save = val;
+#ifdef NEW_HDA_INFRA
+ snd_hda_set_power_save(bus, val * 1000);
#endif
-#endif /* NEW_HDA_INFRA */
+#endif /* HDA_OLD_POWER_SAVE */
}
/*
diff --git a/snd-wrapper.c b/snd-wrapper.c
index 6644742..2747bd0 100644
--- a/snd-wrapper.c
+++ b/snd-wrapper.c
@@ -852,6 +852,8 @@ int pm_runtime_get_sync(struct device *dev)
int pm_runtime_get_if_in_use(struct device *dev)
{
+ if (!hda_get_power_save())
+ return -EINVAL;
if (dev->pmcnt > 0) {
dev->pmcnt++;
return 1;