]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - include/linux/pm.h
PM: Add convenience macro to make switching to dev_pm_ops less error-prone
[mirror_ubuntu-jammy-kernel.git] / include / linux / pm.h
index 2b6e20df0e524ddad3716aa91709b8a5c8c8e12c..3b7e04b95bd233197ddfe2189d0d14e2c8997f4d 100644 (file)
@@ -213,6 +213,20 @@ struct dev_pm_ops {
        int (*runtime_idle)(struct device *dev);
 };
 
+/*
+ * Use this if you want to use the same suspend and resume callbacks for suspend
+ * to RAM and hibernation.
+ */
+#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
+struct dev_pm_ops name = { \
+       .suspend = suspend_fn, \
+       .resume = resume_fn, \
+       .freeze = suspend_fn, \
+       .thaw = resume_fn, \
+       .poweroff = suspend_fn, \
+       .restore = resume_fn, \
+}
+
 /**
  * PM_EVENT_ messages
  *