SIMPLE_DEV_PM_OPS 定义如下: #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ const struct dev_pm_ops name = { \ SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ } 1. 2. 3. 4. 如果定义CONFIG_PM_SLEEP的话,就给suspend和resume的函数指针赋值 #ifdef CONFIG_PM_SLEEP #defi...
.poweroff = suspend_fn, \ .restore = resume_fn, #else #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) #endif 可以看到如果没有定义CONFIG_PM_SLEEP的话,SIMPLE_DEV_PM_OPS 就相当于空函数 #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ const struct dev_pm_ops name = ...
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 (*suspend) (struct device *dev, pm_message_t state); 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 S...
platform_driver 包含probe、remove、一个device_driver实例、电源管理函数suspend、resume。 电源管理可以用suspend, resume,但已经过时,更好的办法是实现device_driver中的dev_pm_ops结构体成员。 device_driver定义 structdevice_driver{constchar*name;structbus_type*bus;structmodule*owner;constchar*mod_name;/* us...
static DEFINE_SIMPLE_DEV_PM_OPS(max31730_pm_ops, max31730_suspend, max31730_resume); static struct i2c_driver max31730_driver = { .class = I2C_CLASS_HWMON, .driver = { .name = "max31730", .of_match_table = of_match_ptr(max31730_of_match), .pm = &max31730_pm_ops, .pm ...
> > const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; > > > > + pci_dev->skip_bus_pm = false; > > + > > if (pci_has_legacy_pm_support(pci_dev)) > > return pci_legacy_suspend(dev, PMSG_HIBERNATE); ...
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...
@@ -665,17 +665,17 @@ int vga_switcheroo_init_domain_pm_ops(struct device *dev, domain->ops.runtime_suspend = vga_switcheroo_runtime_suspend; domain->ops.runtime_resume = vga_switcheroo_runtime_resume; - dev->pm_domain = domain; ...
pm_runtime_suspend(dev); pm_runtime_disable(dev); dev_set_drvdata(dev,NULL); device_remove_file(dev, &dev_attr_formated_output); cyttsp4_debug_probe_create_formated_failed: device_remove_file(dev, &dev_attr_int_count); cyttsp4_debug_probe_create_int_count_failed: ...