]> git.karo-electronics.de Git - linux-beck.git/commitdiff
PM / Sleep: Add macro to define common late/early system PM callbacks
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 10 Dec 2013 13:37:42 +0000 (14:37 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 22 Dec 2013 00:39:14 +0000 (01:39 +0100)
We use the same approach as for the existing SET_SYSTEM_SLEEP_PM_OPS,
but for the late and early callbacks instead.

The new SET_LATE_SYSTEM_SLEEP_PM_OPS, defined for CONFIG_PM_SLEEP, will
point ->suspend_late, ->freeze_late and ->poweroff_late to the same
function. Vice verse happens for ->resume_early, ->thaw_early and
->restore_early.

Cc: Kevin Hilman <khilman@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
include/linux/pm.h

index a224c7f5c377e796969a6d96b684d96b7779c9b5..970b705e9967844fff9d97829b5d062a178c656f 100644 (file)
@@ -311,6 +311,18 @@ struct dev_pm_ops {
 #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
 #endif
 
+#ifdef CONFIG_PM_SLEEP
+#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+       .suspend_late = suspend_fn, \
+       .resume_early = resume_fn, \
+       .freeze_late = suspend_fn, \
+       .thaw_early = resume_fn, \
+       .poweroff_late = suspend_fn, \
+       .restore_early = resume_fn,
+#else
+#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
+#endif
+
 #ifdef CONFIG_PM_RUNTIME
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
        .runtime_suspend = suspend_fn, \