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:
parent
55038a6306
commit
4052b0e4b2
@ -53,20 +53,36 @@ struct dev_pm_info {
|
|||||||
#define PM_EVENT_FREEZE 0x0001
|
#define PM_EVENT_FREEZE 0x0001
|
||||||
#define PM_EVENT_SUSPEND 0x0002
|
#define PM_EVENT_SUSPEND 0x0002
|
||||||
|
|
||||||
|
#define pm_sleep_ptr(_p) \
|
||||||
|
IS_ENABLED(CONFIG_PM_SLEEP) ? (_p) : NULL
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
|
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
|
||||||
const struct dev_pm_ops _name = { \
|
const struct dev_pm_ops _name = { \
|
||||||
.suspend = _suspendfunc, \
|
.suspend = _suspendfunc, \
|
||||||
.resume = _resumefunc, \
|
.resume = _resumefunc, \
|
||||||
.freeze = _suspendfunc, \
|
.freeze = _suspendfunc, \
|
||||||
.thaw = _resumefunc, \
|
.thaw = _resumefunc, \
|
||||||
.poweroff = _suspendfunc, \
|
.poweroff = _suspendfunc, \
|
||||||
.restore = _resumefunc, \
|
.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
|
#else
|
||||||
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
|
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
|
||||||
const struct dev_pm_ops _name = { \
|
const struct dev_pm_ops _name = { \
|
||||||
}
|
}
|
||||||
|
#define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
|
||||||
|
const struct dev_pm_ops _name = { \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _LINUXKPI_LINUX_PM_H */
|
#endif /* _LINUXKPI_LINUX_PM_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user