Commit c4da6940 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Len Brown

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: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 22763c5c
...@@ -80,7 +80,8 @@ static int pnpacpi_get_resources(struct pnp_dev *dev) ...@@ -80,7 +80,8 @@ static int pnpacpi_get_resources(struct pnp_dev *dev)
static int pnpacpi_set_resources(struct pnp_dev *dev) static int pnpacpi_set_resources(struct pnp_dev *dev)
{ {
acpi_handle handle = dev->data; struct acpi_device *acpi_dev = dev->data;
acpi_handle handle = acpi_dev->handle;
struct acpi_buffer buffer; struct acpi_buffer buffer;
int ret; int ret;
...@@ -103,7 +104,8 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) ...@@ -103,7 +104,8 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
static int pnpacpi_disable_resources(struct pnp_dev *dev) static int pnpacpi_disable_resources(struct pnp_dev *dev)
{ {
acpi_handle handle = dev->data; struct acpi_device *acpi_dev = dev->data;
acpi_handle handle = acpi_dev->handle;
int ret; int ret;
dev_dbg(&dev->dev, "disable resources\n"); dev_dbg(&dev->dev, "disable resources\n");
...@@ -121,6 +123,8 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) ...@@ -121,6 +123,8 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
#ifdef CONFIG_ACPI_SLEEP #ifdef CONFIG_ACPI_SLEEP
static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
{ {
struct acpi_device *acpi_dev = dev->data;
acpi_handle handle = acpi_dev->handle;
int power_state; int power_state;
power_state = acpi_pm_device_sleep_state(&dev->dev, NULL); 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,12 +132,15 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
power_state = (state.event == PM_EVENT_ON) ? power_state = (state.event == PM_EVENT_ON) ?
ACPI_STATE_D0 : ACPI_STATE_D3; ACPI_STATE_D0 : ACPI_STATE_D3;
return acpi_bus_set_power((acpi_handle) dev->data, power_state); return acpi_bus_set_power(handle, power_state);
} }
static int pnpacpi_resume(struct pnp_dev *dev) static int pnpacpi_resume(struct pnp_dev *dev)
{ {
return acpi_bus_set_power((acpi_handle) dev->data, ACPI_STATE_D0); struct acpi_device *acpi_dev = dev->data;
acpi_handle handle = acpi_dev->handle;
return acpi_bus_set_power(handle, ACPI_STATE_D0);
} }
#endif #endif
...@@ -168,7 +175,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) ...@@ -168,7 +175,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
dev->data = device->handle; dev->data = device;
/* .enabled means the device can decode the resources */ /* .enabled means the device can decode the resources */
dev->active = device->status.enabled; dev->active = device->status.enabled;
status = acpi_get_handle(device->handle, "_SRS", &temp); status = acpi_get_handle(device->handle, "_SRS", &temp);
......
...@@ -465,7 +465,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, ...@@ -465,7 +465,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
int pnpacpi_parse_allocated_resource(struct pnp_dev *dev) int pnpacpi_parse_allocated_resource(struct pnp_dev *dev)
{ {
acpi_handle handle = dev->data; struct acpi_device *acpi_dev = dev->data;
acpi_handle handle = acpi_dev->handle;
acpi_status status; acpi_status status;
pnp_dbg(&dev->dev, "parse allocated resources\n"); pnp_dbg(&dev->dev, "parse allocated resources\n");
...@@ -773,7 +774,8 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, ...@@ -773,7 +774,8 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev)
{ {
acpi_handle handle = dev->data; struct acpi_device *acpi_dev = dev->data;
acpi_handle handle = acpi_dev->handle;
acpi_status status; acpi_status status;
struct acpipnp_parse_option_s parse_data; struct acpipnp_parse_option_s parse_data;
...@@ -845,7 +847,8 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) ...@@ -845,7 +847,8 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data)
int pnpacpi_build_resource_template(struct pnp_dev *dev, int pnpacpi_build_resource_template(struct pnp_dev *dev,
struct acpi_buffer *buffer) struct acpi_buffer *buffer)
{ {
acpi_handle handle = dev->data; struct acpi_device *acpi_dev = dev->data;
acpi_handle handle = acpi_dev->handle;
struct acpi_resource *resource; struct acpi_resource *resource;
int res_cnt = 0; int res_cnt = 0;
acpi_status status; acpi_status status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment