OSDN Git Service

PM / sleep: Add macro to define common noirq system PM callbacks
authorGrygorii Strashko <Grygorii.Strashko@linaro.org>
Mon, 27 Apr 2015 18:24:30 +0000 (21:24 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 12 May 2015 21:51:36 +0000 (23:51 +0200)
The same approach is used as for the existing SET_SYSTEM_SLEEP_PM_OPS,
but for noirq callbacks.

New SET_NOIRQ_SYSTEM_SLEEP_PM_OPS, defined for CONFIG_PM_SLEEP, will
point ->suspend_noirq, ->freeze_noirq and ->poweroff_noirq to the same
function. Vice versa happens for ->resume_noirq, ->thaw_noirq and
->restore_noirq.

Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
include/linux/pm.h

index 2d29c64..4890743 100644 (file)
@@ -342,6 +342,18 @@ struct dev_pm_ops {
 #define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
 #endif
 
+#ifdef CONFIG_PM_SLEEP
+#define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+       .suspend_noirq = suspend_fn, \
+       .resume_noirq = resume_fn, \
+       .freeze_noirq = suspend_fn, \
+       .thaw_noirq = resume_fn, \
+       .poweroff_noirq = suspend_fn, \
+       .restore_noirq = resume_fn,
+#else
+#define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
+#endif
+
 #ifdef CONFIG_PM
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
        .runtime_suspend = suspend_fn, \