提交 62fcbdd9 编写于 作者: R Rafael J. Wysocki

ACPI: Use struct dev_pm_ops for power management in the fan driver

Make the ACPI fan driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct acpi_device_ops.
Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
上级 67699c5f
...@@ -46,8 +46,6 @@ MODULE_LICENSE("GPL"); ...@@ -46,8 +46,6 @@ MODULE_LICENSE("GPL");
static int acpi_fan_add(struct acpi_device *device); static int acpi_fan_add(struct acpi_device *device);
static int acpi_fan_remove(struct acpi_device *device, int type); static int acpi_fan_remove(struct acpi_device *device, int type);
static int acpi_fan_suspend(struct acpi_device *device);
static int acpi_fan_resume(struct acpi_device *device);
static const struct acpi_device_id fan_device_ids[] = { static const struct acpi_device_id fan_device_ids[] = {
{"PNP0C0B", 0}, {"PNP0C0B", 0},
...@@ -55,6 +53,10 @@ static const struct acpi_device_id fan_device_ids[] = { ...@@ -55,6 +53,10 @@ static const struct acpi_device_id fan_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, fan_device_ids); MODULE_DEVICE_TABLE(acpi, fan_device_ids);
static int acpi_fan_suspend(struct device *dev);
static int acpi_fan_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume);
static struct acpi_driver acpi_fan_driver = { static struct acpi_driver acpi_fan_driver = {
.name = "fan", .name = "fan",
.class = ACPI_FAN_CLASS, .class = ACPI_FAN_CLASS,
...@@ -62,9 +64,8 @@ static struct acpi_driver acpi_fan_driver = { ...@@ -62,9 +64,8 @@ static struct acpi_driver acpi_fan_driver = {
.ops = { .ops = {
.add = acpi_fan_add, .add = acpi_fan_add,
.remove = acpi_fan_remove, .remove = acpi_fan_remove,
.suspend = acpi_fan_suspend,
.resume = acpi_fan_resume,
}, },
.drv.pm = &acpi_fan_pm,
}; };
/* thermal cooling device callbacks */ /* thermal cooling device callbacks */
...@@ -183,24 +184,24 @@ static int acpi_fan_remove(struct acpi_device *device, int type) ...@@ -183,24 +184,24 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
return 0; return 0;
} }
static int acpi_fan_suspend(struct acpi_device *device) static int acpi_fan_suspend(struct device *dev)
{ {
if (!device) if (!dev)
return -EINVAL; return -EINVAL;
acpi_bus_set_power(device->handle, ACPI_STATE_D0); acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0);
return AE_OK; return AE_OK;
} }
static int acpi_fan_resume(struct acpi_device *device) static int acpi_fan_resume(struct device *dev)
{ {
int result; int result;
if (!device) if (!dev)
return -EINVAL; return -EINVAL;
result = acpi_bus_update_power(device->handle, NULL); result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL);
if (result) if (result)
printk(KERN_ERR PREFIX "Error updating fan power state\n"); printk(KERN_ERR PREFIX "Error updating fan power state\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册