aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm.h
diff options
context:
space:
mode:
authorAlbin Tonnerre <albin.tonnerre@free-electrons.com>2009-08-05 17:59:59 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2009-09-14 14:27:00 -0400
commit9d62ec6ca71d71c8a0d2cb1004f476d33f668955 (patch)
tree9add05fac4a177024f6de235b5d9b82054e24b27 /include/linux/pm.h
parent8dd2b42665f9d4ca4fded99f048631b60f669dc5 (diff)
PM: Add convenience macro to make switching to dev_pm_ops less error-prone
In a number of cases, the .suspend, .freeze, .poweroff and .resume, .thaw, .restore functions are identical. However, they all need to be assigned to avoid regressionsm as the previous code called .suspend resp. .resume in all those cases. SIMPLE_DEV_PM_OPS helps to deal with this case. [rjw: Changed the name of the macro and added the comment explaining its purpose.] Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r--include/linux/pm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 2b6e20df0e52..3b7e04b95bd2 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -213,6 +213,20 @@ struct dev_pm_ops {
213 int (*runtime_idle)(struct device *dev); 213 int (*runtime_idle)(struct device *dev);
214}; 214};
215 215
216/*
217 * Use this if you want to use the same suspend and resume callbacks for suspend
218 * to RAM and hibernation.
219 */
220#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
221struct dev_pm_ops name = { \
222 .suspend = suspend_fn, \
223 .resume = resume_fn, \
224 .freeze = suspend_fn, \
225 .thaw = resume_fn, \
226 .poweroff = suspend_fn, \
227 .restore = resume_fn, \
228}
229
216/** 230/**
217 * PM_EVENT_ messages 231 * PM_EVENT_ messages
218 * 232 *