aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/pnpacpi/core.c')
-rw-r--r--drivers/pnp/pnpacpi/core.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 83b8b5ac49c..5314bf630bc 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
81static int pnpacpi_set_resources(struct pnp_dev *dev) 81static 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
104static int pnpacpi_disable_resources(struct pnp_dev *dev) 105static 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
122static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) 124static 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,16 +132,19 @@ 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
134static int pnpacpi_resume(struct pnp_dev *dev) 138static 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
140static struct pnp_protocol pnpacpi_protocol = { 147struct pnp_protocol pnpacpi_protocol = {
141 .name = "Plug and Play ACPI", 148 .name = "Plug and Play ACPI",
142 .get = pnpacpi_get_resources, 149 .get = pnpacpi_get_resources,
143 .set = pnpacpi_set_resources, 150 .set = pnpacpi_set_resources,
@@ -147,6 +154,7 @@ static struct pnp_protocol pnpacpi_protocol = {
147 .resume = pnpacpi_resume, 154 .resume = pnpacpi_resume,
148#endif 155#endif
149}; 156};
157EXPORT_SYMBOL(pnpacpi_protocol);
150 158
151static int __init pnpacpi_add_device(struct acpi_device *device) 159static int __init pnpacpi_add_device(struct acpi_device *device)
152{ 160{
@@ -168,7 +176,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
168 if (!dev) 176 if (!dev)
169 return -ENOMEM; 177 return -ENOMEM;
170 178
171 dev->data = device->handle; 179 dev->data = device;
172 /* .enabled means the device can decode the resources */ 180 /* .enabled means the device can decode the resources */
173 dev->active = device->status.enabled; 181 dev->active = device->status.enabled;
174 status = acpi_get_handle(device->handle, "_SRS", &temp); 182 status = acpi_get_handle(device->handle, "_SRS", &temp);