Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/pm.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct dev_pm_info { | struct dev_pm_info { | ||||
atomic_t usage_count; | atomic_t usage_count; | ||||
}; | }; | ||||
#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) \ | |||||
hselasky: This macro is no longer used? Cleanup? | |||||
Done Inline Actionsit's still needed by a driver. bz: it's still needed by a driver. | |||||
IS_ENABLED(CONFIG_PM_SLEEP) ? (_p) : NULL | |||||
Done Inline ActionsAnother way to do this: #if IS_ENABLED(CONFIG_PM_SLEEP) #define PM_SLEEP_PASS(...) __VA_ARGS__ #else #define PM_SLEEP_PASS(...) #endif There is no point initializing something to NULL here. hselasky: Another way to do this:
```
#if IS_ENABLED(CONFIG_PM_SLEEP)
#define PM_SLEEP_PASS(...)… | |||||
#ifdef CONFIG_PM_SLEEP | #ifdef CONFIG_PM_SLEEP | ||||
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ | #define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ | ||||
Done Inline ActionsIsn't IS_ENABLED() already expanding to something with ()'s Maybe you can unwrap it one time? hselasky: Isn't IS_ENABLED() already expanding to something with ()'s Maybe you can unwrap it one time? | |||||
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 = { \ | |||||
} | |||||
#define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ | |||||
const struct dev_pm_ops _name = { \ | const struct dev_pm_ops _name = { \ | ||||
} | } | ||||
#endif | #endif | ||||
#endif /* _LINUXKPI_LINUX_PM_H */ | #endif /* _LINUXKPI_LINUX_PM_H */ |
This macro is no longer used? Cleanup?