通过SIMPLE_DEV_PM_OPS 定义这个驱动的suspend和resume函数,如果没有定义CONFIG_PM_SLEEP的时候就将CONFIG_PM_SLEEP定义为空函数,这样可以避免build error static SIMPLE_DEV_PM_OPS(asic3_led_pm_ops, asic3_led_suspend, asic3_led_resume); static struct platform_driver asic3_led_driver = { .probe = ...
const struct dev_pm_ops name = { \ SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ } 如果定义CONFIG_PM_SLEEP的话,就给suspend和resume的函数指针赋值 #ifdef CONFIG_PM_SLEEP #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ .suspend = suspend_fn, \ .resume = resume_fn, \ ...
int(*resume) (structdevice *dev); conststructattribute_group **groups; conststructdev_pm_ops *pm; structdriver_private *p; }; 那么可以将宏SIMPLE_DEV_PM_OPS使用到struct platform_driver定义中,例如gpio-keys.c中: staticSIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume...
int (*resume) (struct device *dev); const struct attribute_group **groups; const struct dev_pm_ops *pm; struct driver_private *p; }; 那么可以将宏SIMPLE_DEV_PM_OPS使用到struct platform_driver定义中,例如gpio-keys.c中: static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio...
static int __maybe_unused max31730_suspend(struct device *dev) static int max31730_suspend(struct device *dev) { struct max31730_data *data = dev_get_drvdata(dev); return max31730_write_config(data, MAX31730_STOP, 0); } static int __maybe_unused max31730_resume(struct device *de...
If CONFIG_PM is not set, the pm_ptr() will ensure that the struct dev_pm_ops and callbacks are removed without the need for __maybe_unused markings. In this case we can't simply use DEFINE_RUNTIME_DEV_PM_OPS() because that would provide suspend and resume functions without the checks...
staticDEFINE_SIMPLE_DEV_PM_OPS(titsc_pm_ops,titsc_suspend,titsc_resume); staticconststructof_device_idti_tsc_dt_ids[]={ { .compatible="ti,am3359-tsc", }, Expand All@@ -556,7 +556,7 @@ static struct platform_driver ti_tsc_driver = { ...
static int __maybe_unused wdt87xx_suspend(struct device *dev) static int wdt87xx_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); int error; @@ -1132,7 +1132,7 @@ static int __maybe_unused wdt87xx_suspend(struct device *dev) return 0; } static int...
static int nct6775_suspend(struct device *dev) { int err; u16 tmp; @@ -386,7 +386,7 @@ static int __maybe_unused nct6775_suspend(struct device *dev) return err; } static int __maybe_unused nct6775_resume(struct device *dev) static int nct6775_resume(struct device *dev) { struct...
static SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume); static DEFINE_SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume);static const struct of_device_id of_pwm_fan_match[] = { { .compatible = "pwm-fan", },...