git: aca218556485 - stable/13 - LinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Jan 2023 16:24:51 UTC
The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=aca2185564859f967943058925ccc71975df911c commit aca2185564859f967943058925ccc71975df911c Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-11-28 22:31:28 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2023-01-18 13:24:27 +0000 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). Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D37527 (cherry picked from commit 4052b0e4b218f916b1f491a5ec9e41d38029215b) --- sys/compat/linuxkpi/common/include/linux/pm.h | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h index d67cebb9764a..eb3316088787 100644 --- a/sys/compat/linuxkpi/common/include/linux/pm.h +++ b/sys/compat/linuxkpi/common/include/linux/pm.h @@ -47,20 +47,36 @@ struct dev_pm_domain { #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 */