LinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS

Extend pm.h by pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS().
For the moment this duplicates some parts (as can be seen in the earlier
review I tried to simplify bits but given our implementation this
was easier in the end).

While here and cleanup the SIMPLE_DEV_PM_OPS() bits (white-space only).

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D37527
This commit is contained in:
Bjoern A. Zeeb 2022-11-28 22:31:28 +00:00
parent 55038a6306
commit 4052b0e4b2

View File

@ -53,20 +53,36 @@ struct dev_pm_info {
#define PM_EVENT_FREEZE 0x0001
#define PM_EVENT_SUSPEND 0x0002
#define pm_sleep_ptr(_p) \
IS_ENABLED(CONFIG_PM_SLEEP) ? (_p) : NULL
#ifdef CONFIG_PM_SLEEP
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
const struct dev_pm_ops _name = { \
.suspend = _suspendfunc, \
.resume = _resumefunc, \
.freeze = _suspendfunc, \
.thaw = _resumefunc, \
.poweroff = _suspendfunc, \
.restore = _resumefunc, \
.suspend = _suspendfunc, \
.resume = _resumefunc, \
.freeze = _suspendfunc, \
.thaw = _resumefunc, \
.poweroff = _suspendfunc, \
.restore = _resumefunc, \
}
#define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
const struct dev_pm_ops _name = { \
.suspend = _suspendfunc, \
.resume = _resumefunc, \
.freeze = _suspendfunc, \
.thaw = _resumefunc, \
.poweroff = _suspendfunc, \
.restore = _resumefunc, \
}
#else
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
const struct dev_pm_ops _name = { \
}
#define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
const struct dev_pm_ops _name = { \
}
#endif
#endif /* _LINUXKPI_LINUX_PM_H */