aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-03-15 15:51:13 +0100
committerTakashi Iwai <tiwai@suse.de>2016-03-15 16:11:53 +0100
commitd213a4adb1bc2a8193dd28cc718bf3071dafd7ab (patch)
tree92e1ebf86c5185d8414e7c54a2f8d7a0194a18c1
parent404b2e2456d18b0d0573d61e9a921be742bb9216 (diff)
downloadhda-emu-d213a4adb1bc2a8193dd28cc718bf3071dafd7ab.tar.gz
Add pm_runtime_get_if_in_use() wrapper
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/linux/pm_runtime.h1
-rw-r--r--snd-wrapper.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 4cbc2d1..c3ec139 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -17,6 +17,7 @@ static inline void pm_runtime_get_noresume(struct device *dev) { dev->pmcnt++; }
static inline void pm_runtime_put_noidle(struct device *dev) { dev->pmcnt--; }
int pm_runtime_get_sync(struct device *dev);
+int pm_runtime_get_if_in_use(struct device *dev);
int pm_runtime_put_autosuspend(struct device *dev);
int pm_runtime_force_suspend(struct device *dev);
int pm_runtime_force_resume(struct device *dev);
diff --git a/snd-wrapper.c b/snd-wrapper.c
index c090a20..6644742 100644
--- a/snd-wrapper.c
+++ b/snd-wrapper.c
@@ -850,6 +850,15 @@ int pm_runtime_get_sync(struct device *dev)
return 0;
}
+int pm_runtime_get_if_in_use(struct device *dev)
+{
+ if (dev->pmcnt > 0) {
+ dev->pmcnt++;
+ return 1;
+ }
+ return 0;
+}
+
static void check_suspend(struct device *dev)
{
if (!dev->pmcnt && !dev->pmsuspended && dev->pmallow) {