aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/pnpacpi/core.c20
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c9
2 files changed, 20 insertions, 9 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 83b8b5ac49c9..5314bf630bc4 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);
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
466int pnpacpi_parse_allocated_resource(struct pnp_dev *dev) 466int 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
774int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) 775int __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)
845int pnpacpi_build_resource_template(struct pnp_dev *dev, 847int 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;