aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-06-27 17:26:59 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-07-01 07:31:01 -0400
commite579e2dd8f056cfeaf4d2b313a35ddafb3c4e531 (patch)
tree7d424aa0da9a7d76077c71d4212e826f92f5ab50 /drivers/acpi
parent1be532de834ab7b18ce20dc2e56e724770beb79d (diff)
ACPI: Use struct dev_pm_ops for power management in the power driver
Make the ACPI power resource 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: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/power.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index dd6d6a3c678..894d45c6bc6 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -60,7 +60,6 @@ ACPI_MODULE_NAME("power");
60 60
61static int acpi_power_add(struct acpi_device *device); 61static int acpi_power_add(struct acpi_device *device);
62static int acpi_power_remove(struct acpi_device *device, int type); 62static int acpi_power_remove(struct acpi_device *device, int type);
63static int acpi_power_resume(struct acpi_device *device);
64 63
65static const struct acpi_device_id power_device_ids[] = { 64static const struct acpi_device_id power_device_ids[] = {
66 {ACPI_POWER_HID, 0}, 65 {ACPI_POWER_HID, 0},
@@ -68,6 +67,9 @@ static const struct acpi_device_id power_device_ids[] = {
68}; 67};
69MODULE_DEVICE_TABLE(acpi, power_device_ids); 68MODULE_DEVICE_TABLE(acpi, power_device_ids);
70 69
70static int acpi_power_resume(struct device *dev);
71static SIMPLE_DEV_PM_OPS(acpi_power_pm, NULL, acpi_power_resume);
72
71static struct acpi_driver acpi_power_driver = { 73static struct acpi_driver acpi_power_driver = {
72 .name = "power", 74 .name = "power",
73 .class = ACPI_POWER_CLASS, 75 .class = ACPI_POWER_CLASS,
@@ -75,8 +77,8 @@ static struct acpi_driver acpi_power_driver = {
75 .ops = { 77 .ops = {
76 .add = acpi_power_add, 78 .add = acpi_power_add,
77 .remove = acpi_power_remove, 79 .remove = acpi_power_remove,
78 .resume = acpi_power_resume,
79 }, 80 },
81 .drv.pm = &acpi_power_pm,
80}; 82};
81 83
82/* 84/*
@@ -771,14 +773,16 @@ static int acpi_power_remove(struct acpi_device *device, int type)
771 return 0; 773 return 0;
772} 774}
773 775
774static int acpi_power_resume(struct acpi_device *device) 776static int acpi_power_resume(struct device *dev)
775{ 777{
776 int result = 0, state; 778 int result = 0, state;
779 struct acpi_device *device;
777 struct acpi_power_resource *resource; 780 struct acpi_power_resource *resource;
778 781
779 if (!device) 782 if (!dev)
780 return -EINVAL; 783 return -EINVAL;
781 784
785 device = to_acpi_device(dev);
782 resource = acpi_driver_data(device); 786 resource = acpi_driver_data(device);
783 if (!resource) 787 if (!resource)
784 return -EINVAL; 788 return -EINVAL;