diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-11-17 19:05:14 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-11 00:50:48 -0500 |
commit | c4da6940a7a41c72781ff2d62ebd4b99f3749f14 (patch) | |
tree | 4151288416b35919c3344a6dc87915c4477c2ae1 | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) |
PNPACPI: save struct acpi_device, not just acpi_handle
Some drivers need to look at things in the acpi_device structure
besides the handle.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 17 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 9 |
2 files changed, 18 insertions, 8 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 83b8b5ac49c9..b2348fc2378e 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -80,7 +80,8 @@ static int pnpacpi_get_resources(struct pnp_dev *dev) | |||
80 | 80 | ||
81 | static int pnpacpi_set_resources(struct pnp_dev *dev) | 81 | static int pnpacpi_set_resources(struct pnp_dev *dev) |
82 | { | 82 | { |
83 | acpi_handle handle = dev->data; | 83 | struct acpi_device *acpi_dev = dev->data; |
84 | acpi_handle handle = acpi_dev->handle; | ||
84 | struct acpi_buffer buffer; | 85 | struct acpi_buffer buffer; |
85 | int ret; | 86 | int ret; |
86 | 87 | ||
@@ -103,7 +104,8 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
103 | 104 | ||
104 | static int pnpacpi_disable_resources(struct pnp_dev *dev) | 105 | static int pnpacpi_disable_resources(struct pnp_dev *dev) |
105 | { | 106 | { |
106 | acpi_handle handle = dev->data; | 107 | struct acpi_device *acpi_dev = dev->data; |
108 | acpi_handle handle = acpi_dev->handle; | ||
107 | int ret; | 109 | int ret; |
108 | 110 | ||
109 | dev_dbg(&dev->dev, "disable resources\n"); | 111 | dev_dbg(&dev->dev, "disable resources\n"); |
@@ -121,6 +123,8 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
121 | #ifdef CONFIG_ACPI_SLEEP | 123 | #ifdef CONFIG_ACPI_SLEEP |
122 | static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) | 124 | static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) |
123 | { | 125 | { |
126 | struct acpi_device *acpi_dev = dev->data; | ||
127 | acpi_handle handle = acpi_dev->handle; | ||
124 | int power_state; | 128 | int power_state; |
125 | 129 | ||
126 | power_state = acpi_pm_device_sleep_state(&dev->dev, NULL); | 130 | power_state = acpi_pm_device_sleep_state(&dev->dev, NULL); |
@@ -128,12 +132,15 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) | |||
128 | power_state = (state.event == PM_EVENT_ON) ? | 132 | power_state = (state.event == PM_EVENT_ON) ? |
129 | ACPI_STATE_D0 : ACPI_STATE_D3; | 133 | ACPI_STATE_D0 : ACPI_STATE_D3; |
130 | 134 | ||
131 | return acpi_bus_set_power((acpi_handle) dev->data, power_state); | 135 | return acpi_bus_set_power(handle, power_state); |
132 | } | 136 | } |
133 | 137 | ||
134 | static int pnpacpi_resume(struct pnp_dev *dev) | 138 | static int pnpacpi_resume(struct pnp_dev *dev) |
135 | { | 139 | { |
136 | return acpi_bus_set_power((acpi_handle) dev->data, ACPI_STATE_D0); | 140 | struct acpi_device *acpi_dev = dev->data; |
141 | acpi_handle handle = acpi_dev->handle; | ||
142 | |||
143 | return acpi_bus_set_power(handle, ACPI_STATE_D0); | ||
137 | } | 144 | } |
138 | #endif | 145 | #endif |
139 | 146 | ||
@@ -168,7 +175,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
168 | if (!dev) | 175 | if (!dev) |
169 | return -ENOMEM; | 176 | return -ENOMEM; |
170 | 177 | ||
171 | dev->data = device->handle; | 178 | dev->data = device; |
172 | /* .enabled means the device can decode the resources */ | 179 | /* .enabled means the device can decode the resources */ |
173 | dev->active = device->status.enabled; | 180 | dev->active = device->status.enabled; |
174 | status = acpi_get_handle(device->handle, "_SRS", &temp); | 181 | status = acpi_get_handle(device->handle, "_SRS", &temp); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index ef3a2cd3a7a0..5702b2c8691f 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -465,7 +465,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
465 | 465 | ||
466 | int pnpacpi_parse_allocated_resource(struct pnp_dev *dev) | 466 | int pnpacpi_parse_allocated_resource(struct pnp_dev *dev) |
467 | { | 467 | { |
468 | acpi_handle handle = dev->data; | 468 | struct acpi_device *acpi_dev = dev->data; |
469 | acpi_handle handle = acpi_dev->handle; | ||
469 | acpi_status status; | 470 | acpi_status status; |
470 | 471 | ||
471 | pnp_dbg(&dev->dev, "parse allocated resources\n"); | 472 | pnp_dbg(&dev->dev, "parse allocated resources\n"); |
@@ -773,7 +774,8 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
773 | 774 | ||
774 | int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) | 775 | int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) |
775 | { | 776 | { |
776 | acpi_handle handle = dev->data; | 777 | struct acpi_device *acpi_dev = dev->data; |
778 | acpi_handle handle = acpi_dev->handle; | ||
777 | acpi_status status; | 779 | acpi_status status; |
778 | struct acpipnp_parse_option_s parse_data; | 780 | struct acpipnp_parse_option_s parse_data; |
779 | 781 | ||
@@ -845,7 +847,8 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) | |||
845 | int pnpacpi_build_resource_template(struct pnp_dev *dev, | 847 | int pnpacpi_build_resource_template(struct pnp_dev *dev, |
846 | struct acpi_buffer *buffer) | 848 | struct acpi_buffer *buffer) |
847 | { | 849 | { |
848 | acpi_handle handle = dev->data; | 850 | struct acpi_device *acpi_dev = dev->data; |
851 | acpi_handle handle = acpi_dev->handle; | ||
849 | struct acpi_resource *resource; | 852 | struct acpi_resource *resource; |
850 | int res_cnt = 0; | 853 | int res_cnt = 0; |
851 | acpi_status status; | 854 | acpi_status status; |