diff options
-rw-r--r-- | drivers/acpi/battery.c | 19 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 22 | ||||
-rw-r--r-- | drivers/acpi/dock.c | 398 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 4 | ||||
-rw-r--r-- | drivers/acpi/power.c | 4 | ||||
-rw-r--r-- | drivers/acpi/processor_perflib.c | 22 | ||||
-rw-r--r-- | drivers/acpi/resource.c | 4 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 189 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 7 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 18 | ||||
-rw-r--r-- | drivers/acpi/utils.c | 70 | ||||
-rw-r--r-- | drivers/acpi/video.c | 56 | ||||
-rw-r--r-- | drivers/acpi/video_detect.c | 19 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp.h | 1 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 48 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 12 | ||||
-rw-r--r-- | include/acpi/acpi_drivers.h | 14 |
17 files changed, 330 insertions, 577 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index d405fbad406a..da9fcaac1e85 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -527,18 +527,14 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
527 | static int acpi_battery_set_alarm(struct acpi_battery *battery) | 527 | static int acpi_battery_set_alarm(struct acpi_battery *battery) |
528 | { | 528 | { |
529 | acpi_status status = 0; | 529 | acpi_status status = 0; |
530 | union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER }; | ||
531 | struct acpi_object_list arg_list = { 1, &arg0 }; | ||
532 | 530 | ||
533 | if (!acpi_battery_present(battery) || | 531 | if (!acpi_battery_present(battery) || |
534 | !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags)) | 532 | !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags)) |
535 | return -ENODEV; | 533 | return -ENODEV; |
536 | 534 | ||
537 | arg0.integer.value = battery->alarm; | ||
538 | |||
539 | mutex_lock(&battery->lock); | 535 | mutex_lock(&battery->lock); |
540 | status = acpi_evaluate_object(battery->device->handle, "_BTP", | 536 | status = acpi_execute_simple_method(battery->device->handle, "_BTP", |
541 | &arg_list, NULL); | 537 | battery->alarm); |
542 | mutex_unlock(&battery->lock); | 538 | mutex_unlock(&battery->lock); |
543 | 539 | ||
544 | if (ACPI_FAILURE(status)) | 540 | if (ACPI_FAILURE(status)) |
@@ -550,12 +546,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) | |||
550 | 546 | ||
551 | static int acpi_battery_init_alarm(struct acpi_battery *battery) | 547 | static int acpi_battery_init_alarm(struct acpi_battery *battery) |
552 | { | 548 | { |
553 | acpi_status status = AE_OK; | ||
554 | acpi_handle handle = NULL; | ||
555 | |||
556 | /* See if alarms are supported, and if so, set default */ | 549 | /* See if alarms are supported, and if so, set default */ |
557 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); | 550 | if (!acpi_has_method(battery->device->handle, "_BTP")) { |
558 | if (ACPI_FAILURE(status)) { | ||
559 | clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); | 551 | clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); |
560 | return 0; | 552 | return 0; |
561 | } | 553 | } |
@@ -1068,7 +1060,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
1068 | { | 1060 | { |
1069 | int result = 0; | 1061 | int result = 0; |
1070 | struct acpi_battery *battery = NULL; | 1062 | struct acpi_battery *battery = NULL; |
1071 | acpi_handle handle; | 1063 | |
1072 | if (!device) | 1064 | if (!device) |
1073 | return -EINVAL; | 1065 | return -EINVAL; |
1074 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); | 1066 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); |
@@ -1080,8 +1072,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
1080 | device->driver_data = battery; | 1072 | device->driver_data = battery; |
1081 | mutex_init(&battery->lock); | 1073 | mutex_init(&battery->lock); |
1082 | mutex_init(&battery->sysfs_lock); | 1074 | mutex_init(&battery->sysfs_lock); |
1083 | if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, | 1075 | if (acpi_has_method(battery->device->handle, "_BIX")) |
1084 | "_BIX", &handle))) | ||
1085 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); | 1076 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); |
1086 | result = acpi_battery_update(battery); | 1077 | result = acpi_battery_update(battery); |
1087 | if (result) | 1078 | if (result) |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a5bb33bab448..6fd27a9abcda 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -499,19 +499,6 @@ static void acpi_bus_check_scope(acpi_handle handle) | |||
499 | */ | 499 | */ |
500 | } | 500 | } |
501 | 501 | ||
502 | static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list); | ||
503 | int register_acpi_bus_notifier(struct notifier_block *nb) | ||
504 | { | ||
505 | return blocking_notifier_chain_register(&acpi_bus_notify_list, nb); | ||
506 | } | ||
507 | EXPORT_SYMBOL_GPL(register_acpi_bus_notifier); | ||
508 | |||
509 | void unregister_acpi_bus_notifier(struct notifier_block *nb) | ||
510 | { | ||
511 | blocking_notifier_chain_unregister(&acpi_bus_notify_list, nb); | ||
512 | } | ||
513 | EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier); | ||
514 | |||
515 | /** | 502 | /** |
516 | * acpi_bus_notify | 503 | * acpi_bus_notify |
517 | * --------------- | 504 | * --------------- |
@@ -525,9 +512,6 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) | |||
525 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n", | 512 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n", |
526 | type, handle)); | 513 | type, handle)); |
527 | 514 | ||
528 | blocking_notifier_call_chain(&acpi_bus_notify_list, | ||
529 | type, (void *)handle); | ||
530 | |||
531 | switch (type) { | 515 | switch (type) { |
532 | 516 | ||
533 | case ACPI_NOTIFY_BUS_CHECK: | 517 | case ACPI_NOTIFY_BUS_CHECK: |
@@ -593,8 +577,6 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) | |||
593 | static int __init acpi_bus_init_irq(void) | 577 | static int __init acpi_bus_init_irq(void) |
594 | { | 578 | { |
595 | acpi_status status; | 579 | acpi_status status; |
596 | union acpi_object arg = { ACPI_TYPE_INTEGER }; | ||
597 | struct acpi_object_list arg_list = { 1, &arg }; | ||
598 | char *message = NULL; | 580 | char *message = NULL; |
599 | 581 | ||
600 | 582 | ||
@@ -623,9 +605,7 @@ static int __init acpi_bus_init_irq(void) | |||
623 | 605 | ||
624 | printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message); | 606 | printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message); |
625 | 607 | ||
626 | arg.integer.value = acpi_irq_model; | 608 | status = acpi_execute_simple_method(NULL, "\\_PIC", acpi_irq_model); |
627 | |||
628 | status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL); | ||
629 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 609 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { |
630 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); | 610 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); |
631 | return -ENODEV; | 611 | return -ENODEV; |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 826560753389..b527c1bd8bb2 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -51,8 +51,6 @@ MODULE_PARM_DESC(immediate_undock, "1 (default) will cause the driver to " | |||
51 | " the driver to wait for userspace to write the undock sysfs file " | 51 | " the driver to wait for userspace to write the undock sysfs file " |
52 | " before undocking"); | 52 | " before undocking"); |
53 | 53 | ||
54 | static struct atomic_notifier_head dock_notifier_list; | ||
55 | |||
56 | static const struct acpi_device_id dock_device_ids[] = { | 54 | static const struct acpi_device_id dock_device_ids[] = { |
57 | {"LNXDOCK", 0}, | 55 | {"LNXDOCK", 0}, |
58 | {"", 0}, | 56 | {"", 0}, |
@@ -63,8 +61,6 @@ struct dock_station { | |||
63 | acpi_handle handle; | 61 | acpi_handle handle; |
64 | unsigned long last_dock_time; | 62 | unsigned long last_dock_time; |
65 | u32 flags; | 63 | u32 flags; |
66 | spinlock_t dd_lock; | ||
67 | struct mutex hp_lock; | ||
68 | struct list_head dependent_devices; | 64 | struct list_head dependent_devices; |
69 | 65 | ||
70 | struct list_head sibling; | 66 | struct list_head sibling; |
@@ -91,6 +87,12 @@ struct dock_dependent_device { | |||
91 | #define DOCK_EVENT 3 | 87 | #define DOCK_EVENT 3 |
92 | #define UNDOCK_EVENT 2 | 88 | #define UNDOCK_EVENT 2 |
93 | 89 | ||
90 | enum dock_callback_type { | ||
91 | DOCK_CALL_HANDLER, | ||
92 | DOCK_CALL_FIXUP, | ||
93 | DOCK_CALL_UEVENT, | ||
94 | }; | ||
95 | |||
94 | /***************************************************************************** | 96 | /***************************************************************************** |
95 | * Dock Dependent device functions * | 97 | * Dock Dependent device functions * |
96 | *****************************************************************************/ | 98 | *****************************************************************************/ |
@@ -101,7 +103,7 @@ struct dock_dependent_device { | |||
101 | * | 103 | * |
102 | * Add the dependent device to the dock's dependent device list. | 104 | * Add the dependent device to the dock's dependent device list. |
103 | */ | 105 | */ |
104 | static int | 106 | static int __init |
105 | add_dock_dependent_device(struct dock_station *ds, acpi_handle handle) | 107 | add_dock_dependent_device(struct dock_station *ds, acpi_handle handle) |
106 | { | 108 | { |
107 | struct dock_dependent_device *dd; | 109 | struct dock_dependent_device *dd; |
@@ -112,14 +114,21 @@ add_dock_dependent_device(struct dock_station *ds, acpi_handle handle) | |||
112 | 114 | ||
113 | dd->handle = handle; | 115 | dd->handle = handle; |
114 | INIT_LIST_HEAD(&dd->list); | 116 | INIT_LIST_HEAD(&dd->list); |
115 | |||
116 | spin_lock(&ds->dd_lock); | ||
117 | list_add_tail(&dd->list, &ds->dependent_devices); | 117 | list_add_tail(&dd->list, &ds->dependent_devices); |
118 | spin_unlock(&ds->dd_lock); | ||
119 | 118 | ||
120 | return 0; | 119 | return 0; |
121 | } | 120 | } |
122 | 121 | ||
122 | static void remove_dock_dependent_devices(struct dock_station *ds) | ||
123 | { | ||
124 | struct dock_dependent_device *dd, *aux; | ||
125 | |||
126 | list_for_each_entry_safe(dd, aux, &ds->dependent_devices, list) { | ||
127 | list_del(&dd->list); | ||
128 | kfree(dd); | ||
129 | } | ||
130 | } | ||
131 | |||
123 | /** | 132 | /** |
124 | * dock_init_hotplug - Initialize a hotplug device on a docking station. | 133 | * dock_init_hotplug - Initialize a hotplug device on a docking station. |
125 | * @dd: Dock-dependent device. | 134 | * @dd: Dock-dependent device. |
@@ -135,19 +144,16 @@ static int dock_init_hotplug(struct dock_dependent_device *dd, | |||
135 | int ret = 0; | 144 | int ret = 0; |
136 | 145 | ||
137 | mutex_lock(&hotplug_lock); | 146 | mutex_lock(&hotplug_lock); |
138 | 147 | if (WARN_ON(dd->hp_context)) { | |
139 | if (dd->hp_context) { | ||
140 | ret = -EEXIST; | 148 | ret = -EEXIST; |
141 | } else { | 149 | } else { |
142 | dd->hp_refcount = 1; | 150 | dd->hp_refcount = 1; |
143 | dd->hp_ops = ops; | 151 | dd->hp_ops = ops; |
144 | dd->hp_context = context; | 152 | dd->hp_context = context; |
145 | dd->hp_release = release; | 153 | dd->hp_release = release; |
154 | if (init) | ||
155 | init(context); | ||
146 | } | 156 | } |
147 | |||
148 | if (!WARN_ON(ret) && init) | ||
149 | init(context); | ||
150 | |||
151 | mutex_unlock(&hotplug_lock); | 157 | mutex_unlock(&hotplug_lock); |
152 | return ret; | 158 | return ret; |
153 | } | 159 | } |
@@ -162,27 +168,22 @@ static int dock_init_hotplug(struct dock_dependent_device *dd, | |||
162 | */ | 168 | */ |
163 | static void dock_release_hotplug(struct dock_dependent_device *dd) | 169 | static void dock_release_hotplug(struct dock_dependent_device *dd) |
164 | { | 170 | { |
165 | void (*release)(void *) = NULL; | ||
166 | void *context = NULL; | ||
167 | |||
168 | mutex_lock(&hotplug_lock); | 171 | mutex_lock(&hotplug_lock); |
169 | |||
170 | if (dd->hp_context && !--dd->hp_refcount) { | 172 | if (dd->hp_context && !--dd->hp_refcount) { |
173 | void (*release)(void *) = dd->hp_release; | ||
174 | void *context = dd->hp_context; | ||
175 | |||
171 | dd->hp_ops = NULL; | 176 | dd->hp_ops = NULL; |
172 | context = dd->hp_context; | ||
173 | dd->hp_context = NULL; | 177 | dd->hp_context = NULL; |
174 | release = dd->hp_release; | ||
175 | dd->hp_release = NULL; | 178 | dd->hp_release = NULL; |
179 | if (release) | ||
180 | release(context); | ||
176 | } | 181 | } |
177 | |||
178 | if (release && context) | ||
179 | release(context); | ||
180 | |||
181 | mutex_unlock(&hotplug_lock); | 182 | mutex_unlock(&hotplug_lock); |
182 | } | 183 | } |
183 | 184 | ||
184 | static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event, | 185 | static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event, |
185 | bool uevent) | 186 | enum dock_callback_type cb_type) |
186 | { | 187 | { |
187 | acpi_notify_handler cb = NULL; | 188 | acpi_notify_handler cb = NULL; |
188 | bool run = false; | 189 | bool run = false; |
@@ -192,8 +193,18 @@ static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event, | |||
192 | if (dd->hp_context) { | 193 | if (dd->hp_context) { |
193 | run = true; | 194 | run = true; |
194 | dd->hp_refcount++; | 195 | dd->hp_refcount++; |
195 | if (dd->hp_ops) | 196 | if (dd->hp_ops) { |
196 | cb = uevent ? dd->hp_ops->uevent : dd->hp_ops->handler; | 197 | switch (cb_type) { |
198 | case DOCK_CALL_FIXUP: | ||
199 | cb = dd->hp_ops->fixup; | ||
200 | break; | ||
201 | case DOCK_CALL_UEVENT: | ||
202 | cb = dd->hp_ops->uevent; | ||
203 | break; | ||
204 | default: | ||
205 | cb = dd->hp_ops->handler; | ||
206 | } | ||
207 | } | ||
197 | } | 208 | } |
198 | 209 | ||
199 | mutex_unlock(&hotplug_lock); | 210 | mutex_unlock(&hotplug_lock); |
@@ -220,63 +231,17 @@ find_dock_dependent_device(struct dock_station *ds, acpi_handle handle) | |||
220 | { | 231 | { |
221 | struct dock_dependent_device *dd; | 232 | struct dock_dependent_device *dd; |
222 | 233 | ||
223 | spin_lock(&ds->dd_lock); | 234 | list_for_each_entry(dd, &ds->dependent_devices, list) |
224 | list_for_each_entry(dd, &ds->dependent_devices, list) { | 235 | if (handle == dd->handle) |
225 | if (handle == dd->handle) { | ||
226 | spin_unlock(&ds->dd_lock); | ||
227 | return dd; | 236 | return dd; |
228 | } | 237 | |
229 | } | ||
230 | spin_unlock(&ds->dd_lock); | ||
231 | return NULL; | 238 | return NULL; |
232 | } | 239 | } |
233 | 240 | ||
234 | /***************************************************************************** | 241 | /***************************************************************************** |
235 | * Dock functions * | 242 | * Dock functions * |
236 | *****************************************************************************/ | 243 | *****************************************************************************/ |
237 | /** | 244 | static int __init is_battery(acpi_handle handle) |
238 | * is_dock - see if a device is a dock station | ||
239 | * @handle: acpi handle of the device | ||
240 | * | ||
241 | * If an acpi object has a _DCK method, then it is by definition a dock | ||
242 | * station, so return true. | ||
243 | */ | ||
244 | static int is_dock(acpi_handle handle) | ||
245 | { | ||
246 | acpi_status status; | ||
247 | acpi_handle tmp; | ||
248 | |||
249 | status = acpi_get_handle(handle, "_DCK", &tmp); | ||
250 | if (ACPI_FAILURE(status)) | ||
251 | return 0; | ||
252 | return 1; | ||
253 | } | ||
254 | |||
255 | static int is_ejectable(acpi_handle handle) | ||
256 | { | ||
257 | acpi_status status; | ||
258 | acpi_handle tmp; | ||
259 | |||
260 | status = acpi_get_handle(handle, "_EJ0", &tmp); | ||
261 | if (ACPI_FAILURE(status)) | ||
262 | return 0; | ||
263 | return 1; | ||
264 | } | ||
265 | |||
266 | static int is_ata(acpi_handle handle) | ||
267 | { | ||
268 | acpi_handle tmp; | ||
269 | |||
270 | if ((ACPI_SUCCESS(acpi_get_handle(handle, "_GTF", &tmp))) || | ||
271 | (ACPI_SUCCESS(acpi_get_handle(handle, "_GTM", &tmp))) || | ||
272 | (ACPI_SUCCESS(acpi_get_handle(handle, "_STM", &tmp))) || | ||
273 | (ACPI_SUCCESS(acpi_get_handle(handle, "_SDD", &tmp)))) | ||
274 | return 1; | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | static int is_battery(acpi_handle handle) | ||
280 | { | 245 | { |
281 | struct acpi_device_info *info; | 246 | struct acpi_device_info *info; |
282 | int ret = 1; | 247 | int ret = 1; |
@@ -292,17 +257,13 @@ static int is_battery(acpi_handle handle) | |||
292 | return ret; | 257 | return ret; |
293 | } | 258 | } |
294 | 259 | ||
295 | static int is_ejectable_bay(acpi_handle handle) | 260 | /* Check whether ACPI object is an ejectable battery or disk bay */ |
261 | static bool __init is_ejectable_bay(acpi_handle handle) | ||
296 | { | 262 | { |
297 | acpi_handle phandle; | 263 | if (acpi_has_method(handle, "_EJ0") && is_battery(handle)) |
264 | return true; | ||
298 | 265 | ||
299 | if (!is_ejectable(handle)) | 266 | return acpi_bay_match(handle); |
300 | return 0; | ||
301 | if (is_battery(handle) || is_ata(handle)) | ||
302 | return 1; | ||
303 | if (!acpi_get_parent(handle, &phandle) && is_ata(phandle)) | ||
304 | return 1; | ||
305 | return 0; | ||
306 | } | 267 | } |
307 | 268 | ||
308 | /** | 269 | /** |
@@ -320,7 +281,7 @@ int is_dock_device(acpi_handle handle) | |||
320 | if (!dock_station_count) | 281 | if (!dock_station_count) |
321 | return 0; | 282 | return 0; |
322 | 283 | ||
323 | if (is_dock(handle)) | 284 | if (acpi_dock_match(handle)) |
324 | return 1; | 285 | return 1; |
325 | 286 | ||
326 | list_for_each_entry(dock_station, &dock_stations, sibling) | 287 | list_for_each_entry(dock_station, &dock_stations, sibling) |
@@ -359,10 +320,8 @@ static int dock_present(struct dock_station *ds) | |||
359 | * handle if one does not exist already. This should cause | 320 | * handle if one does not exist already. This should cause |
360 | * acpi to scan for drivers for the given devices, and call | 321 | * acpi to scan for drivers for the given devices, and call |
361 | * matching driver's add routine. | 322 | * matching driver's add routine. |
362 | * | ||
363 | * Returns a pointer to the acpi_device corresponding to the handle. | ||
364 | */ | 323 | */ |
365 | static struct acpi_device * dock_create_acpi_device(acpi_handle handle) | 324 | static void dock_create_acpi_device(acpi_handle handle) |
366 | { | 325 | { |
367 | struct acpi_device *device; | 326 | struct acpi_device *device; |
368 | int ret; | 327 | int ret; |
@@ -375,10 +334,7 @@ static struct acpi_device * dock_create_acpi_device(acpi_handle handle) | |||
375 | ret = acpi_bus_scan(handle); | 334 | ret = acpi_bus_scan(handle); |
376 | if (ret) | 335 | if (ret) |
377 | pr_debug("error adding bus, %x\n", -ret); | 336 | pr_debug("error adding bus, %x\n", -ret); |
378 | |||
379 | acpi_bus_get_device(handle, &device); | ||
380 | } | 337 | } |
381 | return device; | ||
382 | } | 338 | } |
383 | 339 | ||
384 | /** | 340 | /** |
@@ -397,9 +353,29 @@ static void dock_remove_acpi_device(acpi_handle handle) | |||
397 | } | 353 | } |
398 | 354 | ||
399 | /** | 355 | /** |
400 | * hotplug_dock_devices - insert or remove devices on the dock station | 356 | * hot_remove_dock_devices - Remove dock station devices. |
357 | * @ds: Dock station. | ||
358 | */ | ||
359 | static void hot_remove_dock_devices(struct dock_station *ds) | ||
360 | { | ||
361 | struct dock_dependent_device *dd; | ||
362 | |||
363 | /* | ||
364 | * Walk the list in reverse order so that devices that have been added | ||
365 | * last are removed first (in case there are some indirect dependencies | ||
366 | * between them). | ||
367 | */ | ||
368 | list_for_each_entry_reverse(dd, &ds->dependent_devices, list) | ||
369 | dock_hotplug_event(dd, ACPI_NOTIFY_EJECT_REQUEST, false); | ||
370 | |||
371 | list_for_each_entry_reverse(dd, &ds->dependent_devices, list) | ||
372 | dock_remove_acpi_device(dd->handle); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * hotplug_dock_devices - Insert devices on a dock station. | ||
401 | * @ds: the dock station | 377 | * @ds: the dock station |
402 | * @event: either bus check or eject request | 378 | * @event: either bus check or device check request |
403 | * | 379 | * |
404 | * Some devices on the dock station need to have drivers called | 380 | * Some devices on the dock station need to have drivers called |
405 | * to perform hotplug operations after a dock event has occurred. | 381 | * to perform hotplug operations after a dock event has occurred. |
@@ -410,27 +386,21 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event) | |||
410 | { | 386 | { |
411 | struct dock_dependent_device *dd; | 387 | struct dock_dependent_device *dd; |
412 | 388 | ||
413 | mutex_lock(&ds->hp_lock); | 389 | /* Call driver specific post-dock fixups. */ |
390 | list_for_each_entry(dd, &ds->dependent_devices, list) | ||
391 | dock_hotplug_event(dd, event, DOCK_CALL_FIXUP); | ||
414 | 392 | ||
415 | /* | 393 | /* Call driver specific hotplug functions. */ |
416 | * First call driver specific hotplug functions | ||
417 | */ | ||
418 | list_for_each_entry(dd, &ds->dependent_devices, list) | 394 | list_for_each_entry(dd, &ds->dependent_devices, list) |
419 | dock_hotplug_event(dd, event, false); | 395 | dock_hotplug_event(dd, event, DOCK_CALL_HANDLER); |
420 | 396 | ||
421 | /* | 397 | /* |
422 | * Now make sure that an acpi_device is created for each | 398 | * Now make sure that an acpi_device is created for each dependent |
423 | * dependent device, or removed if this is an eject request. | 399 | * device. That will cause scan handlers to be attached to device |
424 | * This will cause acpi_drivers to be stopped/started if they | 400 | * objects or acpi_drivers to be stopped/started if they are present. |
425 | * exist | ||
426 | */ | 401 | */ |
427 | list_for_each_entry(dd, &ds->dependent_devices, list) { | 402 | list_for_each_entry(dd, &ds->dependent_devices, list) |
428 | if (event == ACPI_NOTIFY_EJECT_REQUEST) | 403 | dock_create_acpi_device(dd->handle); |
429 | dock_remove_acpi_device(dd->handle); | ||
430 | else | ||
431 | dock_create_acpi_device(dd->handle); | ||
432 | } | ||
433 | mutex_unlock(&ds->hp_lock); | ||
434 | } | 404 | } |
435 | 405 | ||
436 | static void dock_event(struct dock_station *ds, u32 event, int num) | 406 | static void dock_event(struct dock_station *ds, u32 event, int num) |
@@ -453,44 +423,13 @@ static void dock_event(struct dock_station *ds, u32 event, int num) | |||
453 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); | 423 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); |
454 | 424 | ||
455 | list_for_each_entry(dd, &ds->dependent_devices, list) | 425 | list_for_each_entry(dd, &ds->dependent_devices, list) |
456 | dock_hotplug_event(dd, event, true); | 426 | dock_hotplug_event(dd, event, DOCK_CALL_UEVENT); |
457 | 427 | ||
458 | if (num != DOCK_EVENT) | 428 | if (num != DOCK_EVENT) |
459 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); | 429 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); |
460 | } | 430 | } |
461 | 431 | ||
462 | /** | 432 | /** |
463 | * eject_dock - respond to a dock eject request | ||
464 | * @ds: the dock station | ||
465 | * | ||
466 | * This is called after _DCK is called, to execute the dock station's | ||
467 | * _EJ0 method. | ||
468 | */ | ||
469 | static void eject_dock(struct dock_station *ds) | ||
470 | { | ||
471 | struct acpi_object_list arg_list; | ||
472 | union acpi_object arg; | ||
473 | acpi_status status; | ||
474 | acpi_handle tmp; | ||
475 | |||
476 | /* all dock devices should have _EJ0, but check anyway */ | ||
477 | status = acpi_get_handle(ds->handle, "_EJ0", &tmp); | ||
478 | if (ACPI_FAILURE(status)) { | ||
479 | pr_debug("No _EJ0 support for dock device\n"); | ||
480 | return; | ||
481 | } | ||
482 | |||
483 | arg_list.count = 1; | ||
484 | arg_list.pointer = &arg; | ||
485 | arg.type = ACPI_TYPE_INTEGER; | ||
486 | arg.integer.value = 1; | ||
487 | |||
488 | status = acpi_evaluate_object(ds->handle, "_EJ0", &arg_list, NULL); | ||
489 | if (ACPI_FAILURE(status)) | ||
490 | pr_debug("Failed to evaluate _EJ0!\n"); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * handle_dock - handle a dock event | 433 | * handle_dock - handle a dock event |
495 | * @ds: the dock station | 434 | * @ds: the dock station |
496 | * @dock: to dock, or undock - that is the question | 435 | * @dock: to dock, or undock - that is the question |
@@ -550,27 +489,6 @@ static inline void complete_undock(struct dock_station *ds) | |||
550 | ds->flags &= ~(DOCK_UNDOCKING); | 489 | ds->flags &= ~(DOCK_UNDOCKING); |
551 | } | 490 | } |
552 | 491 | ||
553 | static void dock_lock(struct dock_station *ds, int lock) | ||
554 | { | ||
555 | struct acpi_object_list arg_list; | ||
556 | union acpi_object arg; | ||
557 | acpi_status status; | ||
558 | |||
559 | arg_list.count = 1; | ||
560 | arg_list.pointer = &arg; | ||
561 | arg.type = ACPI_TYPE_INTEGER; | ||
562 | arg.integer.value = !!lock; | ||
563 | status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL); | ||
564 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
565 | if (lock) | ||
566 | acpi_handle_warn(ds->handle, | ||
567 | "Locking device failed (0x%x)\n", status); | ||
568 | else | ||
569 | acpi_handle_warn(ds->handle, | ||
570 | "Unlocking device failed (0x%x)\n", status); | ||
571 | } | ||
572 | } | ||
573 | |||
574 | /** | 492 | /** |
575 | * dock_in_progress - see if we are in the middle of handling a dock event | 493 | * dock_in_progress - see if we are in the middle of handling a dock event |
576 | * @ds: the dock station | 494 | * @ds: the dock station |
@@ -588,37 +506,6 @@ static int dock_in_progress(struct dock_station *ds) | |||
588 | } | 506 | } |
589 | 507 | ||
590 | /** | 508 | /** |
591 | * register_dock_notifier - add yourself to the dock notifier list | ||
592 | * @nb: the callers notifier block | ||
593 | * | ||
594 | * If a driver wishes to be notified about dock events, they can | ||
595 | * use this function to put a notifier block on the dock notifier list. | ||
596 | * this notifier call chain will be called after a dock event, but | ||
597 | * before hotplugging any new devices. | ||
598 | */ | ||
599 | int register_dock_notifier(struct notifier_block *nb) | ||
600 | { | ||
601 | if (!dock_station_count) | ||
602 | return -ENODEV; | ||
603 | |||
604 | return atomic_notifier_chain_register(&dock_notifier_list, nb); | ||
605 | } | ||
606 | EXPORT_SYMBOL_GPL(register_dock_notifier); | ||
607 | |||
608 | /** | ||
609 | * unregister_dock_notifier - remove yourself from the dock notifier list | ||
610 | * @nb: the callers notifier block | ||
611 | */ | ||
612 | void unregister_dock_notifier(struct notifier_block *nb) | ||
613 | { | ||
614 | if (!dock_station_count) | ||
615 | return; | ||
616 | |||
617 | atomic_notifier_chain_unregister(&dock_notifier_list, nb); | ||
618 | } | ||
619 | EXPORT_SYMBOL_GPL(unregister_dock_notifier); | ||
620 | |||
621 | /** | ||
622 | * register_hotplug_dock_device - register a hotplug function | 509 | * register_hotplug_dock_device - register a hotplug function |
623 | * @handle: the handle of the device | 510 | * @handle: the handle of the device |
624 | * @ops: handlers to call after docking | 511 | * @ops: handlers to call after docking |
@@ -703,10 +590,10 @@ static int handle_eject_request(struct dock_station *ds, u32 event) | |||
703 | */ | 590 | */ |
704 | dock_event(ds, event, UNDOCK_EVENT); | 591 | dock_event(ds, event, UNDOCK_EVENT); |
705 | 592 | ||
706 | hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST); | 593 | hot_remove_dock_devices(ds); |
707 | undock(ds); | 594 | undock(ds); |
708 | dock_lock(ds, 0); | 595 | acpi_evaluate_lck(ds->handle, 0); |
709 | eject_dock(ds); | 596 | acpi_evaluate_ej0(ds->handle); |
710 | if (dock_present(ds)) { | 597 | if (dock_present(ds)) { |
711 | acpi_handle_err(ds->handle, "Unable to undock!\n"); | 598 | acpi_handle_err(ds->handle, "Unable to undock!\n"); |
712 | return -EBUSY; | 599 | return -EBUSY; |
@@ -717,18 +604,17 @@ static int handle_eject_request(struct dock_station *ds, u32 event) | |||
717 | 604 | ||
718 | /** | 605 | /** |
719 | * dock_notify - act upon an acpi dock notification | 606 | * dock_notify - act upon an acpi dock notification |
720 | * @handle: the dock station handle | 607 | * @ds: dock station |
721 | * @event: the acpi event | 608 | * @event: the acpi event |
722 | * @data: our driver data struct | ||
723 | * | 609 | * |
724 | * If we are notified to dock, then check to see if the dock is | 610 | * If we are notified to dock, then check to see if the dock is |
725 | * present and then dock. Notify all drivers of the dock event, | 611 | * present and then dock. Notify all drivers of the dock event, |
726 | * and then hotplug and devices that may need hotplugging. | 612 | * and then hotplug and devices that may need hotplugging. |
727 | */ | 613 | */ |
728 | static void dock_notify(acpi_handle handle, u32 event, void *data) | 614 | static void dock_notify(struct dock_station *ds, u32 event) |
729 | { | 615 | { |
730 | struct dock_station *ds = data; | 616 | acpi_handle handle = ds->handle; |
731 | struct acpi_device *tmp; | 617 | struct acpi_device *ad; |
732 | int surprise_removal = 0; | 618 | int surprise_removal = 0; |
733 | 619 | ||
734 | /* | 620 | /* |
@@ -751,8 +637,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data) | |||
751 | switch (event) { | 637 | switch (event) { |
752 | case ACPI_NOTIFY_BUS_CHECK: | 638 | case ACPI_NOTIFY_BUS_CHECK: |
753 | case ACPI_NOTIFY_DEVICE_CHECK: | 639 | case ACPI_NOTIFY_DEVICE_CHECK: |
754 | if (!dock_in_progress(ds) && acpi_bus_get_device(ds->handle, | 640 | if (!dock_in_progress(ds) && acpi_bus_get_device(handle, &ad)) { |
755 | &tmp)) { | ||
756 | begin_dock(ds); | 641 | begin_dock(ds); |
757 | dock(ds); | 642 | dock(ds); |
758 | if (!dock_present(ds)) { | 643 | if (!dock_present(ds)) { |
@@ -760,12 +645,10 @@ static void dock_notify(acpi_handle handle, u32 event, void *data) | |||
760 | complete_dock(ds); | 645 | complete_dock(ds); |
761 | break; | 646 | break; |
762 | } | 647 | } |
763 | atomic_notifier_call_chain(&dock_notifier_list, | ||
764 | event, NULL); | ||
765 | hotplug_dock_devices(ds, event); | 648 | hotplug_dock_devices(ds, event); |
766 | complete_dock(ds); | 649 | complete_dock(ds); |
767 | dock_event(ds, event, DOCK_EVENT); | 650 | dock_event(ds, event, DOCK_EVENT); |
768 | dock_lock(ds, 1); | 651 | acpi_evaluate_lck(ds->handle, 1); |
769 | acpi_update_all_gpes(); | 652 | acpi_update_all_gpes(); |
770 | break; | 653 | break; |
771 | } | 654 | } |
@@ -789,9 +672,8 @@ static void dock_notify(acpi_handle handle, u32 event, void *data) | |||
789 | } | 672 | } |
790 | 673 | ||
791 | struct dock_data { | 674 | struct dock_data { |
792 | acpi_handle handle; | ||
793 | unsigned long event; | ||
794 | struct dock_station *ds; | 675 | struct dock_station *ds; |
676 | u32 event; | ||
795 | }; | 677 | }; |
796 | 678 | ||
797 | static void acpi_dock_deferred_cb(void *context) | 679 | static void acpi_dock_deferred_cb(void *context) |
@@ -799,52 +681,31 @@ static void acpi_dock_deferred_cb(void *context) | |||
799 | struct dock_data *data = context; | 681 | struct dock_data *data = context; |
800 | 682 | ||
801 | acpi_scan_lock_acquire(); | 683 | acpi_scan_lock_acquire(); |
802 | dock_notify(data->handle, data->event, data->ds); | 684 | dock_notify(data->ds, data->event); |
803 | acpi_scan_lock_release(); | 685 | acpi_scan_lock_release(); |
804 | kfree(data); | 686 | kfree(data); |
805 | } | 687 | } |
806 | 688 | ||
807 | static int acpi_dock_notifier_call(struct notifier_block *this, | 689 | static void dock_notify_handler(acpi_handle handle, u32 event, void *data) |
808 | unsigned long event, void *data) | ||
809 | { | 690 | { |
810 | struct dock_station *dock_station; | 691 | struct dock_data *dd; |
811 | acpi_handle handle = data; | ||
812 | 692 | ||
813 | if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK | 693 | if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK |
814 | && event != ACPI_NOTIFY_EJECT_REQUEST) | 694 | && event != ACPI_NOTIFY_EJECT_REQUEST) |
815 | return 0; | 695 | return; |
816 | |||
817 | acpi_scan_lock_acquire(); | ||
818 | |||
819 | list_for_each_entry(dock_station, &dock_stations, sibling) { | ||
820 | if (dock_station->handle == handle) { | ||
821 | struct dock_data *dd; | ||
822 | acpi_status status; | ||
823 | |||
824 | dd = kmalloc(sizeof(*dd), GFP_KERNEL); | ||
825 | if (!dd) | ||
826 | break; | ||
827 | 696 | ||
828 | dd->handle = handle; | 697 | dd = kmalloc(sizeof(*dd), GFP_KERNEL); |
829 | dd->event = event; | 698 | if (dd) { |
830 | dd->ds = dock_station; | 699 | acpi_status status; |
831 | status = acpi_os_hotplug_execute(acpi_dock_deferred_cb, | ||
832 | dd); | ||
833 | if (ACPI_FAILURE(status)) | ||
834 | kfree(dd); | ||
835 | 700 | ||
836 | break; | 701 | dd->ds = data; |
837 | } | 702 | dd->event = event; |
703 | status = acpi_os_hotplug_execute(acpi_dock_deferred_cb, dd); | ||
704 | if (ACPI_FAILURE(status)) | ||
705 | kfree(dd); | ||
838 | } | 706 | } |
839 | |||
840 | acpi_scan_lock_release(); | ||
841 | return 0; | ||
842 | } | 707 | } |
843 | 708 | ||
844 | static struct notifier_block dock_acpi_notifier = { | ||
845 | .notifier_call = acpi_dock_notifier_call, | ||
846 | }; | ||
847 | |||
848 | /** | 709 | /** |
849 | * find_dock_devices - find devices on the dock station | 710 | * find_dock_devices - find devices on the dock station |
850 | * @handle: the handle of the device we are examining | 711 | * @handle: the handle of the device we are examining |
@@ -856,29 +717,16 @@ static struct notifier_block dock_acpi_notifier = { | |||
856 | * check to see if an object has an _EJD method. If it does, then it | 717 | * check to see if an object has an _EJD method. If it does, then it |
857 | * will see if it is dependent on the dock station. | 718 | * will see if it is dependent on the dock station. |
858 | */ | 719 | */ |
859 | static acpi_status | 720 | static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl, |
860 | find_dock_devices(acpi_handle handle, u32 lvl, void *context, void **rv) | 721 | void *context, void **rv) |
861 | { | 722 | { |
862 | acpi_status status; | ||
863 | acpi_handle tmp, parent; | ||
864 | struct dock_station *ds = context; | 723 | struct dock_station *ds = context; |
724 | acpi_handle ejd = NULL; | ||
865 | 725 | ||
866 | status = acpi_bus_get_ejd(handle, &tmp); | 726 | acpi_bus_get_ejd(handle, &ejd); |
867 | if (ACPI_FAILURE(status)) { | 727 | if (ejd == ds->handle) |
868 | /* try the parent device as well */ | ||
869 | status = acpi_get_parent(handle, &parent); | ||
870 | if (ACPI_FAILURE(status)) | ||
871 | goto fdd_out; | ||
872 | /* see if parent is dependent on dock */ | ||
873 | status = acpi_bus_get_ejd(parent, &tmp); | ||
874 | if (ACPI_FAILURE(status)) | ||
875 | goto fdd_out; | ||
876 | } | ||
877 | |||
878 | if (tmp == ds->handle) | ||
879 | add_dock_dependent_device(ds, handle); | 728 | add_dock_dependent_device(ds, handle); |
880 | 729 | ||
881 | fdd_out: | ||
882 | return AE_OK; | 730 | return AE_OK; |
883 | } | 731 | } |
884 | 732 | ||
@@ -988,13 +836,13 @@ static struct attribute_group dock_attribute_group = { | |||
988 | */ | 836 | */ |
989 | static int __init dock_add(acpi_handle handle) | 837 | static int __init dock_add(acpi_handle handle) |
990 | { | 838 | { |
991 | int ret, id; | 839 | struct dock_station *dock_station, ds = { NULL, }; |
992 | struct dock_station ds, *dock_station; | ||
993 | struct platform_device *dd; | 840 | struct platform_device *dd; |
841 | acpi_status status; | ||
842 | int ret; | ||
994 | 843 | ||
995 | id = dock_station_count; | 844 | dd = platform_device_register_data(NULL, "dock", dock_station_count, |
996 | memset(&ds, 0, sizeof(ds)); | 845 | &ds, sizeof(ds)); |
997 | dd = platform_device_register_data(NULL, "dock", id, &ds, sizeof(ds)); | ||
998 | if (IS_ERR(dd)) | 846 | if (IS_ERR(dd)) |
999 | return PTR_ERR(dd); | 847 | return PTR_ERR(dd); |
1000 | 848 | ||
@@ -1004,18 +852,15 @@ static int __init dock_add(acpi_handle handle) | |||
1004 | dock_station->dock_device = dd; | 852 | dock_station->dock_device = dd; |
1005 | dock_station->last_dock_time = jiffies - HZ; | 853 | dock_station->last_dock_time = jiffies - HZ; |
1006 | 854 | ||
1007 | mutex_init(&dock_station->hp_lock); | ||
1008 | spin_lock_init(&dock_station->dd_lock); | ||
1009 | INIT_LIST_HEAD(&dock_station->sibling); | 855 | INIT_LIST_HEAD(&dock_station->sibling); |
1010 | ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list); | ||
1011 | INIT_LIST_HEAD(&dock_station->dependent_devices); | 856 | INIT_LIST_HEAD(&dock_station->dependent_devices); |
1012 | 857 | ||
1013 | /* we want the dock device to send uevents */ | 858 | /* we want the dock device to send uevents */ |
1014 | dev_set_uevent_suppress(&dd->dev, 0); | 859 | dev_set_uevent_suppress(&dd->dev, 0); |
1015 | 860 | ||
1016 | if (is_dock(handle)) | 861 | if (acpi_dock_match(handle)) |
1017 | dock_station->flags |= DOCK_IS_DOCK; | 862 | dock_station->flags |= DOCK_IS_DOCK; |
1018 | if (is_ata(handle)) | 863 | if (acpi_ata_match(handle)) |
1019 | dock_station->flags |= DOCK_IS_ATA; | 864 | dock_station->flags |= DOCK_IS_ATA; |
1020 | if (is_battery(handle)) | 865 | if (is_battery(handle)) |
1021 | dock_station->flags |= DOCK_IS_BAT; | 866 | dock_station->flags |= DOCK_IS_BAT; |
@@ -1034,11 +879,19 @@ static int __init dock_add(acpi_handle handle) | |||
1034 | if (ret) | 879 | if (ret) |
1035 | goto err_rmgroup; | 880 | goto err_rmgroup; |
1036 | 881 | ||
882 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
883 | dock_notify_handler, dock_station); | ||
884 | if (ACPI_FAILURE(status)) { | ||
885 | ret = -ENODEV; | ||
886 | goto err_rmgroup; | ||
887 | } | ||
888 | |||
1037 | dock_station_count++; | 889 | dock_station_count++; |
1038 | list_add(&dock_station->sibling, &dock_stations); | 890 | list_add(&dock_station->sibling, &dock_stations); |
1039 | return 0; | 891 | return 0; |
1040 | 892 | ||
1041 | err_rmgroup: | 893 | err_rmgroup: |
894 | remove_dock_dependent_devices(dock_station); | ||
1042 | sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group); | 895 | sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group); |
1043 | err_unregister: | 896 | err_unregister: |
1044 | platform_device_unregister(dd); | 897 | platform_device_unregister(dd); |
@@ -1058,7 +911,7 @@ err_unregister: | |||
1058 | static __init acpi_status | 911 | static __init acpi_status |
1059 | find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv) | 912 | find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv) |
1060 | { | 913 | { |
1061 | if (is_dock(handle) || is_ejectable_bay(handle)) | 914 | if (acpi_dock_match(handle) || is_ejectable_bay(handle)) |
1062 | dock_add(handle); | 915 | dock_add(handle); |
1063 | 916 | ||
1064 | return AE_OK; | 917 | return AE_OK; |
@@ -1078,7 +931,6 @@ void __init acpi_dock_init(void) | |||
1078 | return; | 931 | return; |
1079 | } | 932 | } |
1080 | 933 | ||
1081 | register_acpi_bus_notifier(&dock_acpi_notifier); | ||
1082 | pr_info(PREFIX "%s: %d docks/bays found\n", | 934 | pr_info(PREFIX "%s: %d docks/bays found\n", |
1083 | ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count); | 935 | ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count); |
1084 | } | 936 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 80403c1a89f8..84bf06cec1f2 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1049,10 +1049,8 @@ int __init acpi_ec_ecdt_probe(void) | |||
1049 | * which needs it, has fake EC._INI method, so use it as flag. | 1049 | * which needs it, has fake EC._INI method, so use it as flag. |
1050 | * Keep boot_ec struct as it will be needed soon. | 1050 | * Keep boot_ec struct as it will be needed soon. |
1051 | */ | 1051 | */ |
1052 | acpi_handle dummy; | ||
1053 | if (!dmi_name_in_vendors("ASUS") || | 1052 | if (!dmi_name_in_vendors("ASUS") || |
1054 | ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", | 1053 | !acpi_has_method(boot_ec->handle, "_INI")) |
1055 | &dummy))) | ||
1056 | return -ENODEV; | 1054 | return -ENODEV; |
1057 | } | 1055 | } |
1058 | install: | 1056 | install: |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 5c28c894c0fc..1460c88a7c0e 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -637,9 +637,7 @@ int acpi_device_sleep_wake(struct acpi_device *dev, | |||
637 | } | 637 | } |
638 | 638 | ||
639 | /* Execute _PSW */ | 639 | /* Execute _PSW */ |
640 | arg_list.count = 1; | 640 | status = acpi_execute_simple_method(dev->handle, "_PSW", enable); |
641 | in_arg[0].integer.value = enable; | ||
642 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); | ||
643 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 641 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { |
644 | printk(KERN_ERR PREFIX "_PSW execution failed\n"); | 642 | printk(KERN_ERR PREFIX "_PSW execution failed\n"); |
645 | dev->wakeup.flags.valid = 0; | 643 | dev->wakeup.flags.valid = 0; |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 1e9732d809bf..51d7948611da 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -164,17 +164,12 @@ static void acpi_processor_ppc_ost(acpi_handle handle, int status) | |||
164 | {.type = ACPI_TYPE_INTEGER,}, | 164 | {.type = ACPI_TYPE_INTEGER,}, |
165 | }; | 165 | }; |
166 | struct acpi_object_list arg_list = {2, params}; | 166 | struct acpi_object_list arg_list = {2, params}; |
167 | acpi_handle temp; | ||
168 | 167 | ||
169 | params[0].integer.value = ACPI_PROCESSOR_NOTIFY_PERFORMANCE; | 168 | if (acpi_has_method(handle, "_OST")) { |
170 | params[1].integer.value = status; | 169 | params[0].integer.value = ACPI_PROCESSOR_NOTIFY_PERFORMANCE; |
171 | 170 | params[1].integer.value = status; | |
172 | /* when there is no _OST , skip it */ | 171 | acpi_evaluate_object(handle, "_OST", &arg_list, NULL); |
173 | if (ACPI_FAILURE(acpi_get_handle(handle, "_OST", &temp))) | 172 | } |
174 | return; | ||
175 | |||
176 | acpi_evaluate_object(handle, "_OST", &arg_list, NULL); | ||
177 | return; | ||
178 | } | 173 | } |
179 | 174 | ||
180 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) | 175 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) |
@@ -468,14 +463,11 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
468 | int acpi_processor_get_performance_info(struct acpi_processor *pr) | 463 | int acpi_processor_get_performance_info(struct acpi_processor *pr) |
469 | { | 464 | { |
470 | int result = 0; | 465 | int result = 0; |
471 | acpi_status status = AE_OK; | ||
472 | acpi_handle handle = NULL; | ||
473 | 466 | ||
474 | if (!pr || !pr->performance || !pr->handle) | 467 | if (!pr || !pr->performance || !pr->handle) |
475 | return -EINVAL; | 468 | return -EINVAL; |
476 | 469 | ||
477 | status = acpi_get_handle(pr->handle, "_PCT", &handle); | 470 | if (!acpi_has_method(pr->handle, "_PCT")) { |
478 | if (ACPI_FAILURE(status)) { | ||
479 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 471 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
480 | "ACPI-based processor performance control unavailable\n")); | 472 | "ACPI-based processor performance control unavailable\n")); |
481 | return -ENODEV; | 473 | return -ENODEV; |
@@ -501,7 +493,7 @@ int acpi_processor_get_performance_info(struct acpi_processor *pr) | |||
501 | */ | 493 | */ |
502 | update_bios: | 494 | update_bios: |
503 | #ifdef CONFIG_X86 | 495 | #ifdef CONFIG_X86 |
504 | if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){ | 496 | if (acpi_has_method(pr->handle, "_PPC")) { |
505 | if(boot_cpu_has(X86_FEATURE_EST)) | 497 | if(boot_cpu_has(X86_FEATURE_EST)) |
506 | printk(KERN_WARNING FW_BUG "BIOS needs update for CPU " | 498 | printk(KERN_WARNING FW_BUG "BIOS needs update for CPU " |
507 | "frequency support\n"); | 499 | "frequency support\n"); |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 3322b47ab7ca..b7201fc6f1e1 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -505,14 +505,12 @@ int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, | |||
505 | void *preproc_data) | 505 | void *preproc_data) |
506 | { | 506 | { |
507 | struct res_proc_context c; | 507 | struct res_proc_context c; |
508 | acpi_handle not_used; | ||
509 | acpi_status status; | 508 | acpi_status status; |
510 | 509 | ||
511 | if (!adev || !adev->handle || !list_empty(list)) | 510 | if (!adev || !adev->handle || !list_empty(list)) |
512 | return -EINVAL; | 511 | return -EINVAL; |
513 | 512 | ||
514 | status = acpi_get_handle(adev->handle, METHOD_NAME__CRS, ¬_used); | 513 | if (!acpi_has_method(adev->handle, METHOD_NAME__CRS)) |
515 | if (ACPI_FAILURE(status)) | ||
516 | return 0; | 514 | return 0; |
517 | 515 | ||
518 | c.list = list; | 516 | c.list = list; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 8a46c924effd..d5993e339a26 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -193,9 +193,6 @@ static acpi_status acpi_bus_online_companions(acpi_handle handle, u32 lvl, | |||
193 | static int acpi_scan_hot_remove(struct acpi_device *device) | 193 | static int acpi_scan_hot_remove(struct acpi_device *device) |
194 | { | 194 | { |
195 | acpi_handle handle = device->handle; | 195 | acpi_handle handle = device->handle; |
196 | acpi_handle not_used; | ||
197 | struct acpi_object_list arg_list; | ||
198 | union acpi_object arg; | ||
199 | struct device *errdev; | 196 | struct device *errdev; |
200 | acpi_status status; | 197 | acpi_status status; |
201 | unsigned long long sta; | 198 | unsigned long long sta; |
@@ -258,32 +255,15 @@ static int acpi_scan_hot_remove(struct acpi_device *device) | |||
258 | put_device(&device->dev); | 255 | put_device(&device->dev); |
259 | device = NULL; | 256 | device = NULL; |
260 | 257 | ||
261 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_LCK", ¬_used))) { | 258 | acpi_evaluate_lck(handle, 0); |
262 | arg_list.count = 1; | ||
263 | arg_list.pointer = &arg; | ||
264 | arg.type = ACPI_TYPE_INTEGER; | ||
265 | arg.integer.value = 0; | ||
266 | acpi_evaluate_object(handle, "_LCK", &arg_list, NULL); | ||
267 | } | ||
268 | |||
269 | arg_list.count = 1; | ||
270 | arg_list.pointer = &arg; | ||
271 | arg.type = ACPI_TYPE_INTEGER; | ||
272 | arg.integer.value = 1; | ||
273 | |||
274 | /* | 259 | /* |
275 | * TBD: _EJD support. | 260 | * TBD: _EJD support. |
276 | */ | 261 | */ |
277 | status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); | 262 | status = acpi_evaluate_ej0(handle); |
278 | if (ACPI_FAILURE(status)) { | 263 | if (status == AE_NOT_FOUND) |
279 | if (status == AE_NOT_FOUND) { | 264 | return -ENODEV; |
280 | return -ENODEV; | 265 | else if (ACPI_FAILURE(status)) |
281 | } else { | 266 | return -EIO; |
282 | acpi_handle_warn(handle, "Eject failed (0x%x)\n", | ||
283 | status); | ||
284 | return -EIO; | ||
285 | } | ||
286 | } | ||
287 | 267 | ||
288 | /* | 268 | /* |
289 | * Verify if eject was indeed successful. If not, log an error | 269 | * Verify if eject was indeed successful. If not, log an error |
@@ -654,7 +634,6 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
654 | { | 634 | { |
655 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 635 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
656 | acpi_status status; | 636 | acpi_status status; |
657 | acpi_handle temp; | ||
658 | unsigned long long sun; | 637 | unsigned long long sun; |
659 | int result = 0; | 638 | int result = 0; |
660 | 639 | ||
@@ -680,8 +659,7 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
680 | /* | 659 | /* |
681 | * If device has _STR, 'description' file is created | 660 | * If device has _STR, 'description' file is created |
682 | */ | 661 | */ |
683 | status = acpi_get_handle(dev->handle, "_STR", &temp); | 662 | if (acpi_has_method(dev->handle, "_STR")) { |
684 | if (ACPI_SUCCESS(status)) { | ||
685 | status = acpi_evaluate_object(dev->handle, "_STR", | 663 | status = acpi_evaluate_object(dev->handle, "_STR", |
686 | NULL, &buffer); | 664 | NULL, &buffer); |
687 | if (ACPI_FAILURE(status)) | 665 | if (ACPI_FAILURE(status)) |
@@ -711,8 +689,7 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
711 | * If device has _EJ0, 'eject' file is created that is used to trigger | 689 | * If device has _EJ0, 'eject' file is created that is used to trigger |
712 | * hot-removal function from userland. | 690 | * hot-removal function from userland. |
713 | */ | 691 | */ |
714 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); | 692 | if (acpi_has_method(dev->handle, "_EJ0")) { |
715 | if (ACPI_SUCCESS(status)) { | ||
716 | result = device_create_file(&dev->dev, &dev_attr_eject); | 693 | result = device_create_file(&dev->dev, &dev_attr_eject); |
717 | if (result) | 694 | if (result) |
718 | return result; | 695 | return result; |
@@ -734,9 +711,6 @@ end: | |||
734 | 711 | ||
735 | static void acpi_device_remove_files(struct acpi_device *dev) | 712 | static void acpi_device_remove_files(struct acpi_device *dev) |
736 | { | 713 | { |
737 | acpi_status status; | ||
738 | acpi_handle temp; | ||
739 | |||
740 | if (dev->flags.power_manageable) { | 714 | if (dev->flags.power_manageable) { |
741 | device_remove_file(&dev->dev, &dev_attr_power_state); | 715 | device_remove_file(&dev->dev, &dev_attr_power_state); |
742 | if (dev->power.flags.power_resources) | 716 | if (dev->power.flags.power_resources) |
@@ -747,20 +721,17 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
747 | /* | 721 | /* |
748 | * If device has _STR, remove 'description' file | 722 | * If device has _STR, remove 'description' file |
749 | */ | 723 | */ |
750 | status = acpi_get_handle(dev->handle, "_STR", &temp); | 724 | if (acpi_has_method(dev->handle, "_STR")) { |
751 | if (ACPI_SUCCESS(status)) { | ||
752 | kfree(dev->pnp.str_obj); | 725 | kfree(dev->pnp.str_obj); |
753 | device_remove_file(&dev->dev, &dev_attr_description); | 726 | device_remove_file(&dev->dev, &dev_attr_description); |
754 | } | 727 | } |
755 | /* | 728 | /* |
756 | * If device has _EJ0, remove 'eject' file. | 729 | * If device has _EJ0, remove 'eject' file. |
757 | */ | 730 | */ |
758 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); | 731 | if (acpi_has_method(dev->handle, "_EJ0")) |
759 | if (ACPI_SUCCESS(status)) | ||
760 | device_remove_file(&dev->dev, &dev_attr_eject); | 732 | device_remove_file(&dev->dev, &dev_attr_eject); |
761 | 733 | ||
762 | status = acpi_get_handle(dev->handle, "_SUN", &temp); | 734 | if (acpi_has_method(dev->handle, "_SUN")) |
763 | if (ACPI_SUCCESS(status)) | ||
764 | device_remove_file(&dev->dev, &dev_attr_sun); | 735 | device_remove_file(&dev->dev, &dev_attr_sun); |
765 | 736 | ||
766 | if (dev->pnp.unique_id) | 737 | if (dev->pnp.unique_id) |
@@ -1336,13 +1307,10 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | |||
1336 | 1307 | ||
1337 | static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | 1308 | static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) |
1338 | { | 1309 | { |
1339 | acpi_handle temp; | ||
1340 | acpi_status status = 0; | ||
1341 | int err; | 1310 | int err; |
1342 | 1311 | ||
1343 | /* Presence of _PRW indicates wake capable */ | 1312 | /* Presence of _PRW indicates wake capable */ |
1344 | status = acpi_get_handle(device->handle, "_PRW", &temp); | 1313 | if (!acpi_has_method(device->handle, "_PRW")) |
1345 | if (ACPI_FAILURE(status)) | ||
1346 | return; | 1314 | return; |
1347 | 1315 | ||
1348 | err = acpi_bus_extract_wakeup_device_power_package(device->handle, | 1316 | err = acpi_bus_extract_wakeup_device_power_package(device->handle, |
@@ -1372,7 +1340,6 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) | |||
1372 | struct acpi_device_power_state *ps = &device->power.states[state]; | 1340 | struct acpi_device_power_state *ps = &device->power.states[state]; |
1373 | char pathname[5] = { '_', 'P', 'R', '0' + state, '\0' }; | 1341 | char pathname[5] = { '_', 'P', 'R', '0' + state, '\0' }; |
1374 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 1342 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
1375 | acpi_handle handle; | ||
1376 | acpi_status status; | 1343 | acpi_status status; |
1377 | 1344 | ||
1378 | INIT_LIST_HEAD(&ps->resources); | 1345 | INIT_LIST_HEAD(&ps->resources); |
@@ -1395,8 +1362,7 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) | |||
1395 | 1362 | ||
1396 | /* Evaluate "_PSx" to see if we can do explicit sets */ | 1363 | /* Evaluate "_PSx" to see if we can do explicit sets */ |
1397 | pathname[2] = 'S'; | 1364 | pathname[2] = 'S'; |
1398 | status = acpi_get_handle(device->handle, pathname, &handle); | 1365 | if (acpi_has_method(device->handle, pathname)) |
1399 | if (ACPI_SUCCESS(status)) | ||
1400 | ps->flags.explicit_set = 1; | 1366 | ps->flags.explicit_set = 1; |
1401 | 1367 | ||
1402 | /* | 1368 | /* |
@@ -1415,28 +1381,21 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) | |||
1415 | 1381 | ||
1416 | static void acpi_bus_get_power_flags(struct acpi_device *device) | 1382 | static void acpi_bus_get_power_flags(struct acpi_device *device) |
1417 | { | 1383 | { |
1418 | acpi_status status; | ||
1419 | acpi_handle handle; | ||
1420 | u32 i; | 1384 | u32 i; |
1421 | 1385 | ||
1422 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ | 1386 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ |
1423 | status = acpi_get_handle(device->handle, "_PS0", &handle); | 1387 | if (!acpi_has_method(device->handle, "_PS0") && |
1424 | if (ACPI_FAILURE(status)) { | 1388 | !acpi_has_method(device->handle, "_PR0")) |
1425 | status = acpi_get_handle(device->handle, "_PR0", &handle); | 1389 | return; |
1426 | if (ACPI_FAILURE(status)) | ||
1427 | return; | ||
1428 | } | ||
1429 | 1390 | ||
1430 | device->flags.power_manageable = 1; | 1391 | device->flags.power_manageable = 1; |
1431 | 1392 | ||
1432 | /* | 1393 | /* |
1433 | * Power Management Flags | 1394 | * Power Management Flags |
1434 | */ | 1395 | */ |
1435 | status = acpi_get_handle(device->handle, "_PSC", &handle); | 1396 | if (acpi_has_method(device->handle, "_PSC")) |
1436 | if (ACPI_SUCCESS(status)) | ||
1437 | device->power.flags.explicit_get = 1; | 1397 | device->power.flags.explicit_get = 1; |
1438 | status = acpi_get_handle(device->handle, "_IRC", &handle); | 1398 | if (acpi_has_method(device->handle, "_IRC")) |
1439 | if (ACPI_SUCCESS(status)) | ||
1440 | device->power.flags.inrush_current = 1; | 1399 | device->power.flags.inrush_current = 1; |
1441 | 1400 | ||
1442 | /* | 1401 | /* |
@@ -1470,28 +1429,18 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) | |||
1470 | 1429 | ||
1471 | static void acpi_bus_get_flags(struct acpi_device *device) | 1430 | static void acpi_bus_get_flags(struct acpi_device *device) |
1472 | { | 1431 | { |
1473 | acpi_status status = AE_OK; | ||
1474 | acpi_handle temp = NULL; | ||
1475 | |||
1476 | /* Presence of _STA indicates 'dynamic_status' */ | 1432 | /* Presence of _STA indicates 'dynamic_status' */ |
1477 | status = acpi_get_handle(device->handle, "_STA", &temp); | 1433 | if (acpi_has_method(device->handle, "_STA")) |
1478 | if (ACPI_SUCCESS(status)) | ||
1479 | device->flags.dynamic_status = 1; | 1434 | device->flags.dynamic_status = 1; |
1480 | 1435 | ||
1481 | /* Presence of _RMV indicates 'removable' */ | 1436 | /* Presence of _RMV indicates 'removable' */ |
1482 | status = acpi_get_handle(device->handle, "_RMV", &temp); | 1437 | if (acpi_has_method(device->handle, "_RMV")) |
1483 | if (ACPI_SUCCESS(status)) | ||
1484 | device->flags.removable = 1; | 1438 | device->flags.removable = 1; |
1485 | 1439 | ||
1486 | /* Presence of _EJD|_EJ0 indicates 'ejectable' */ | 1440 | /* Presence of _EJD|_EJ0 indicates 'ejectable' */ |
1487 | status = acpi_get_handle(device->handle, "_EJD", &temp); | 1441 | if (acpi_has_method(device->handle, "_EJD") || |
1488 | if (ACPI_SUCCESS(status)) | 1442 | acpi_has_method(device->handle, "_EJ0")) |
1489 | device->flags.ejectable = 1; | 1443 | device->flags.ejectable = 1; |
1490 | else { | ||
1491 | status = acpi_get_handle(device->handle, "_EJ0", &temp); | ||
1492 | if (ACPI_SUCCESS(status)) | ||
1493 | device->flags.ejectable = 1; | ||
1494 | } | ||
1495 | } | 1444 | } |
1496 | 1445 | ||
1497 | static void acpi_device_get_busid(struct acpi_device *device) | 1446 | static void acpi_device_get_busid(struct acpi_device *device) |
@@ -1533,46 +1482,45 @@ static void acpi_device_get_busid(struct acpi_device *device) | |||
1533 | } | 1482 | } |
1534 | 1483 | ||
1535 | /* | 1484 | /* |
1485 | * acpi_ata_match - see if an acpi object is an ATA device | ||
1486 | * | ||
1487 | * If an acpi object has one of the ACPI ATA methods defined, | ||
1488 | * then we can safely call it an ATA device. | ||
1489 | */ | ||
1490 | bool acpi_ata_match(acpi_handle handle) | ||
1491 | { | ||
1492 | return acpi_has_method(handle, "_GTF") || | ||
1493 | acpi_has_method(handle, "_GTM") || | ||
1494 | acpi_has_method(handle, "_STM") || | ||
1495 | acpi_has_method(handle, "_SDD"); | ||
1496 | } | ||
1497 | |||
1498 | /* | ||
1536 | * acpi_bay_match - see if an acpi object is an ejectable driver bay | 1499 | * acpi_bay_match - see if an acpi object is an ejectable driver bay |
1537 | * | 1500 | * |
1538 | * If an acpi object is ejectable and has one of the ACPI ATA methods defined, | 1501 | * If an acpi object is ejectable and has one of the ACPI ATA methods defined, |
1539 | * then we can safely call it an ejectable drive bay | 1502 | * then we can safely call it an ejectable drive bay |
1540 | */ | 1503 | */ |
1541 | static int acpi_bay_match(acpi_handle handle) | 1504 | bool acpi_bay_match(acpi_handle handle) |
1542 | { | 1505 | { |
1543 | acpi_status status; | ||
1544 | acpi_handle tmp; | ||
1545 | acpi_handle phandle; | 1506 | acpi_handle phandle; |
1546 | 1507 | ||
1547 | status = acpi_get_handle(handle, "_EJ0", &tmp); | 1508 | if (!acpi_has_method(handle, "_EJ0")) |
1548 | if (ACPI_FAILURE(status)) | 1509 | return false; |
1549 | return -ENODEV; | 1510 | if (acpi_ata_match(handle)) |
1550 | 1511 | return true; | |
1551 | if ((ACPI_SUCCESS(acpi_get_handle(handle, "_GTF", &tmp))) || | 1512 | if (ACPI_FAILURE(acpi_get_parent(handle, &phandle))) |
1552 | (ACPI_SUCCESS(acpi_get_handle(handle, "_GTM", &tmp))) || | 1513 | return false; |
1553 | (ACPI_SUCCESS(acpi_get_handle(handle, "_STM", &tmp))) || | ||
1554 | (ACPI_SUCCESS(acpi_get_handle(handle, "_SDD", &tmp)))) | ||
1555 | return 0; | ||
1556 | |||
1557 | if (acpi_get_parent(handle, &phandle)) | ||
1558 | return -ENODEV; | ||
1559 | 1514 | ||
1560 | if ((ACPI_SUCCESS(acpi_get_handle(phandle, "_GTF", &tmp))) || | 1515 | return acpi_ata_match(phandle); |
1561 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_GTM", &tmp))) || | ||
1562 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_STM", &tmp))) || | ||
1563 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_SDD", &tmp)))) | ||
1564 | return 0; | ||
1565 | |||
1566 | return -ENODEV; | ||
1567 | } | 1516 | } |
1568 | 1517 | ||
1569 | /* | 1518 | /* |
1570 | * acpi_dock_match - see if an acpi object has a _DCK method | 1519 | * acpi_dock_match - see if an acpi object has a _DCK method |
1571 | */ | 1520 | */ |
1572 | static int acpi_dock_match(acpi_handle handle) | 1521 | bool acpi_dock_match(acpi_handle handle) |
1573 | { | 1522 | { |
1574 | acpi_handle tmp; | 1523 | return acpi_has_method(handle, "_DCK"); |
1575 | return acpi_get_handle(handle, "_DCK", &tmp); | ||
1576 | } | 1524 | } |
1577 | 1525 | ||
1578 | const char *acpi_device_hid(struct acpi_device *device) | 1526 | const char *acpi_device_hid(struct acpi_device *device) |
@@ -1610,34 +1558,26 @@ static void acpi_add_id(struct acpi_device_pnp *pnp, const char *dev_id) | |||
1610 | * lacks the SMBUS01 HID and the methods do not have the necessary "_" | 1558 | * lacks the SMBUS01 HID and the methods do not have the necessary "_" |
1611 | * prefix. Work around this. | 1559 | * prefix. Work around this. |
1612 | */ | 1560 | */ |
1613 | static int acpi_ibm_smbus_match(acpi_handle handle) | 1561 | static bool acpi_ibm_smbus_match(acpi_handle handle) |
1614 | { | 1562 | { |
1615 | acpi_handle h_dummy; | 1563 | char node_name[ACPI_PATH_SEGMENT_LENGTH]; |
1616 | struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL}; | 1564 | struct acpi_buffer path = { sizeof(node_name), node_name }; |
1617 | int result; | ||
1618 | 1565 | ||
1619 | if (!dmi_name_in_vendors("IBM")) | 1566 | if (!dmi_name_in_vendors("IBM")) |
1620 | return -ENODEV; | 1567 | return false; |
1621 | 1568 | ||
1622 | /* Look for SMBS object */ | 1569 | /* Look for SMBS object */ |
1623 | result = acpi_get_name(handle, ACPI_SINGLE_NAME, &path); | 1570 | if (ACPI_FAILURE(acpi_get_name(handle, ACPI_SINGLE_NAME, &path)) || |
1624 | if (result) | 1571 | strcmp("SMBS", path.pointer)) |
1625 | return result; | 1572 | return false; |
1626 | |||
1627 | if (strcmp("SMBS", path.pointer)) { | ||
1628 | result = -ENODEV; | ||
1629 | goto out; | ||
1630 | } | ||
1631 | 1573 | ||
1632 | /* Does it have the necessary (but misnamed) methods? */ | 1574 | /* Does it have the necessary (but misnamed) methods? */ |
1633 | result = -ENODEV; | 1575 | if (acpi_has_method(handle, "SBI") && |
1634 | if (ACPI_SUCCESS(acpi_get_handle(handle, "SBI", &h_dummy)) && | 1576 | acpi_has_method(handle, "SBR") && |
1635 | ACPI_SUCCESS(acpi_get_handle(handle, "SBR", &h_dummy)) && | 1577 | acpi_has_method(handle, "SBW")) |
1636 | ACPI_SUCCESS(acpi_get_handle(handle, "SBW", &h_dummy))) | 1578 | return true; |
1637 | result = 0; | 1579 | |
1638 | out: | 1580 | return false; |
1639 | kfree(path.pointer); | ||
1640 | return result; | ||
1641 | } | 1581 | } |
1642 | 1582 | ||
1643 | static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, | 1583 | static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, |
@@ -1685,11 +1625,11 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, | |||
1685 | */ | 1625 | */ |
1686 | if (acpi_is_video_device(handle)) | 1626 | if (acpi_is_video_device(handle)) |
1687 | acpi_add_id(pnp, ACPI_VIDEO_HID); | 1627 | acpi_add_id(pnp, ACPI_VIDEO_HID); |
1688 | else if (ACPI_SUCCESS(acpi_bay_match(handle))) | 1628 | else if (acpi_bay_match(handle)) |
1689 | acpi_add_id(pnp, ACPI_BAY_HID); | 1629 | acpi_add_id(pnp, ACPI_BAY_HID); |
1690 | else if (ACPI_SUCCESS(acpi_dock_match(handle))) | 1630 | else if (acpi_dock_match(handle)) |
1691 | acpi_add_id(pnp, ACPI_DOCK_HID); | 1631 | acpi_add_id(pnp, ACPI_DOCK_HID); |
1692 | else if (!acpi_ibm_smbus_match(handle)) | 1632 | else if (acpi_ibm_smbus_match(handle)) |
1693 | acpi_add_id(pnp, ACPI_SMBUS_IBM_HID); | 1633 | acpi_add_id(pnp, ACPI_SMBUS_IBM_HID); |
1694 | else if (list_empty(&pnp->ids) && handle == ACPI_ROOT_OBJECT) { | 1634 | else if (list_empty(&pnp->ids) && handle == ACPI_ROOT_OBJECT) { |
1695 | acpi_add_id(pnp, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ | 1635 | acpi_add_id(pnp, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ |
@@ -1900,7 +1840,6 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
1900 | struct acpi_device *device = NULL; | 1840 | struct acpi_device *device = NULL; |
1901 | int type; | 1841 | int type; |
1902 | unsigned long long sta; | 1842 | unsigned long long sta; |
1903 | acpi_status status; | ||
1904 | int result; | 1843 | int result; |
1905 | 1844 | ||
1906 | acpi_bus_get_device(handle, &device); | 1845 | acpi_bus_get_device(handle, &device); |
@@ -1921,10 +1860,8 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
1921 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && | 1860 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && |
1922 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { | 1861 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { |
1923 | struct acpi_device_wakeup wakeup; | 1862 | struct acpi_device_wakeup wakeup; |
1924 | acpi_handle temp; | ||
1925 | 1863 | ||
1926 | status = acpi_get_handle(handle, "_PRW", &temp); | 1864 | if (acpi_has_method(handle, "_PRW")) { |
1927 | if (ACPI_SUCCESS(status)) { | ||
1928 | acpi_bus_extract_wakeup_device_power_package(handle, | 1865 | acpi_bus_extract_wakeup_device_power_package(handle, |
1929 | &wakeup); | 1866 | &wakeup); |
1930 | acpi_power_resources_list_free(&wakeup.resources); | 1867 | acpi_power_resources_list_free(&wakeup.resources); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 187ab61889e6..81b0f03d97db 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -31,12 +31,9 @@ static u8 sleep_states[ACPI_S_STATE_COUNT]; | |||
31 | 31 | ||
32 | static void acpi_sleep_tts_switch(u32 acpi_state) | 32 | static void acpi_sleep_tts_switch(u32 acpi_state) |
33 | { | 33 | { |
34 | union acpi_object in_arg = { ACPI_TYPE_INTEGER }; | 34 | acpi_status status; |
35 | struct acpi_object_list arg_list = { 1, &in_arg }; | ||
36 | acpi_status status = AE_OK; | ||
37 | 35 | ||
38 | in_arg.integer.value = acpi_state; | 36 | status = acpi_execute_simple_method(NULL, "\\_TTS", acpi_state); |
39 | status = acpi_evaluate_object(NULL, "\\_TTS", &arg_list, NULL); | ||
40 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 37 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
41 | /* | 38 | /* |
42 | * OS can't evaluate the _TTS object correctly. Some warning | 39 | * OS can't evaluate the _TTS object correctly. Some warning |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index a33821ca3895..94523c79dc5f 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -239,26 +239,16 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) | |||
239 | 239 | ||
240 | static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) | 240 | static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) |
241 | { | 241 | { |
242 | acpi_status status = AE_OK; | ||
243 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | ||
244 | struct acpi_object_list arg_list = { 1, &arg0 }; | ||
245 | acpi_handle handle = NULL; | ||
246 | |||
247 | |||
248 | if (!tz) | 242 | if (!tz) |
249 | return -EINVAL; | 243 | return -EINVAL; |
250 | 244 | ||
251 | status = acpi_get_handle(tz->device->handle, "_SCP", &handle); | 245 | if (!acpi_has_method(tz->device->handle, "_SCP")) { |
252 | if (ACPI_FAILURE(status)) { | ||
253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); | 246 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); |
254 | return -ENODEV; | 247 | return -ENODEV; |
255 | } | 248 | } else if (ACPI_FAILURE(acpi_execute_simple_method(tz->device->handle, |
256 | 249 | "_SCP", mode))) { | |
257 | arg0.integer.value = mode; | ||
258 | |||
259 | status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); | ||
260 | if (ACPI_FAILURE(status)) | ||
261 | return -ENODEV; | 250 | return -ENODEV; |
251 | } | ||
262 | 252 | ||
263 | return 0; | 253 | return 0; |
264 | } | 254 | } |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 744371304313..552248b0005b 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -495,3 +495,73 @@ acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...) | |||
495 | kfree(buffer.pointer); | 495 | kfree(buffer.pointer); |
496 | } | 496 | } |
497 | EXPORT_SYMBOL(acpi_handle_printk); | 497 | EXPORT_SYMBOL(acpi_handle_printk); |
498 | |||
499 | /** | ||
500 | * acpi_has_method: Check whether @handle has a method named @name | ||
501 | * @handle: ACPI device handle | ||
502 | * @name: name of object or method | ||
503 | * | ||
504 | * Check whether @handle has a method named @name. | ||
505 | */ | ||
506 | bool acpi_has_method(acpi_handle handle, char *name) | ||
507 | { | ||
508 | acpi_handle tmp; | ||
509 | |||
510 | return ACPI_SUCCESS(acpi_get_handle(handle, name, &tmp)); | ||
511 | } | ||
512 | EXPORT_SYMBOL(acpi_has_method); | ||
513 | |||
514 | acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, | ||
515 | u64 arg) | ||
516 | { | ||
517 | union acpi_object obj = { .type = ACPI_TYPE_INTEGER }; | ||
518 | struct acpi_object_list arg_list = { .count = 1, .pointer = &obj, }; | ||
519 | |||
520 | obj.integer.value = arg; | ||
521 | |||
522 | return acpi_evaluate_object(handle, method, &arg_list, NULL); | ||
523 | } | ||
524 | EXPORT_SYMBOL(acpi_execute_simple_method); | ||
525 | |||
526 | /** | ||
527 | * acpi_evaluate_ej0: Evaluate _EJ0 method for hotplug operations | ||
528 | * @handle: ACPI device handle | ||
529 | * | ||
530 | * Evaluate device's _EJ0 method for hotplug operations. | ||
531 | */ | ||
532 | acpi_status acpi_evaluate_ej0(acpi_handle handle) | ||
533 | { | ||
534 | acpi_status status; | ||
535 | |||
536 | status = acpi_execute_simple_method(handle, "_EJ0", 1); | ||
537 | if (status == AE_NOT_FOUND) | ||
538 | acpi_handle_warn(handle, "No _EJ0 support for device\n"); | ||
539 | else if (ACPI_FAILURE(status)) | ||
540 | acpi_handle_warn(handle, "Eject failed (0x%x)\n", status); | ||
541 | |||
542 | return status; | ||
543 | } | ||
544 | |||
545 | /** | ||
546 | * acpi_evaluate_lck: Evaluate _LCK method to lock/unlock device | ||
547 | * @handle: ACPI device handle | ||
548 | * @lock: lock device if non-zero, otherwise unlock device | ||
549 | * | ||
550 | * Evaluate device's _LCK method if present to lock/unlock device | ||
551 | */ | ||
552 | acpi_status acpi_evaluate_lck(acpi_handle handle, int lock) | ||
553 | { | ||
554 | acpi_status status; | ||
555 | |||
556 | status = acpi_execute_simple_method(handle, "_LCK", !!lock); | ||
557 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
558 | if (lock) | ||
559 | acpi_handle_warn(handle, | ||
560 | "Locking device failed (0x%x)\n", status); | ||
561 | else | ||
562 | acpi_handle_warn(handle, | ||
563 | "Unlocking device failed (0x%x)\n", status); | ||
564 | } | ||
565 | |||
566 | return status; | ||
567 | } | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 3270d3c8ba4e..725143016f3b 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -355,14 +355,10 @@ static int | |||
355 | acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) | 355 | acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) |
356 | { | 356 | { |
357 | int status; | 357 | int status; |
358 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | ||
359 | struct acpi_object_list args = { 1, &arg0 }; | ||
360 | int state; | 358 | int state; |
361 | 359 | ||
362 | arg0.integer.value = level; | 360 | status = acpi_execute_simple_method(device->dev->handle, |
363 | 361 | "_BCM", level); | |
364 | status = acpi_evaluate_object(device->dev->handle, "_BCM", | ||
365 | &args, NULL); | ||
366 | if (ACPI_FAILURE(status)) { | 362 | if (ACPI_FAILURE(status)) { |
367 | ACPI_ERROR((AE_INFO, "Evaluating _BCM failed")); | 363 | ACPI_ERROR((AE_INFO, "Evaluating _BCM failed")); |
368 | return -EIO; | 364 | return -EIO; |
@@ -638,18 +634,15 @@ static int | |||
638 | acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | 634 | acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) |
639 | { | 635 | { |
640 | acpi_status status; | 636 | acpi_status status; |
641 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | ||
642 | struct acpi_object_list args = { 1, &arg0 }; | ||
643 | 637 | ||
644 | if (!video->cap._DOS) | 638 | if (!video->cap._DOS) |
645 | return 0; | 639 | return 0; |
646 | 640 | ||
647 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) | 641 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) |
648 | return -EINVAL; | 642 | return -EINVAL; |
649 | arg0.integer.value = (lcd_flag << 2) | bios_flag; | 643 | video->dos_setting = (lcd_flag << 2) | bios_flag; |
650 | video->dos_setting = arg0.integer.value; | 644 | status = acpi_execute_simple_method(video->device->handle, "_DOS", |
651 | status = acpi_evaluate_object(video->device->handle, "_DOS", | 645 | (lcd_flag << 2) | bios_flag); |
652 | &args, NULL); | ||
653 | if (ACPI_FAILURE(status)) | 646 | if (ACPI_FAILURE(status)) |
654 | return -EIO; | 647 | return -EIO; |
655 | 648 | ||
@@ -885,28 +878,21 @@ out: | |||
885 | 878 | ||
886 | static void acpi_video_device_find_cap(struct acpi_video_device *device) | 879 | static void acpi_video_device_find_cap(struct acpi_video_device *device) |
887 | { | 880 | { |
888 | acpi_handle h_dummy1; | 881 | if (acpi_has_method(device->dev->handle, "_ADR")) |
889 | |||
890 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { | ||
891 | device->cap._ADR = 1; | 882 | device->cap._ADR = 1; |
892 | } | 883 | if (acpi_has_method(device->dev->handle, "_BCL")) |
893 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) { | ||
894 | device->cap._BCL = 1; | 884 | device->cap._BCL = 1; |
895 | } | 885 | if (acpi_has_method(device->dev->handle, "_BCM")) |
896 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) { | ||
897 | device->cap._BCM = 1; | 886 | device->cap._BCM = 1; |
898 | } | 887 | if (acpi_has_method(device->dev->handle, "_BQC")) { |
899 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle,"_BQC",&h_dummy1))) | ||
900 | device->cap._BQC = 1; | 888 | device->cap._BQC = 1; |
901 | else if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCQ", | 889 | } else if (acpi_has_method(device->dev->handle, "_BCQ")) { |
902 | &h_dummy1))) { | ||
903 | printk(KERN_WARNING FW_BUG "_BCQ is used instead of _BQC\n"); | 890 | printk(KERN_WARNING FW_BUG "_BCQ is used instead of _BQC\n"); |
904 | device->cap._BCQ = 1; | 891 | device->cap._BCQ = 1; |
905 | } | 892 | } |
906 | 893 | ||
907 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { | 894 | if (acpi_has_method(device->dev->handle, "_DDC")) |
908 | device->cap._DDC = 1; | 895 | device->cap._DDC = 1; |
909 | } | ||
910 | 896 | ||
911 | if (acpi_video_backlight_support()) { | 897 | if (acpi_video_backlight_support()) { |
912 | struct backlight_properties props; | 898 | struct backlight_properties props; |
@@ -994,26 +980,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
994 | 980 | ||
995 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | 981 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) |
996 | { | 982 | { |
997 | acpi_handle h_dummy1; | 983 | if (acpi_has_method(video->device->handle, "_DOS")) |
998 | |||
999 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { | ||
1000 | video->cap._DOS = 1; | 984 | video->cap._DOS = 1; |
1001 | } | 985 | if (acpi_has_method(video->device->handle, "_DOD")) |
1002 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) { | ||
1003 | video->cap._DOD = 1; | 986 | video->cap._DOD = 1; |
1004 | } | 987 | if (acpi_has_method(video->device->handle, "_ROM")) |
1005 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) { | ||
1006 | video->cap._ROM = 1; | 988 | video->cap._ROM = 1; |
1007 | } | 989 | if (acpi_has_method(video->device->handle, "_GPD")) |
1008 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) { | ||
1009 | video->cap._GPD = 1; | 990 | video->cap._GPD = 1; |
1010 | } | 991 | if (acpi_has_method(video->device->handle, "_SPD")) |
1011 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) { | ||
1012 | video->cap._SPD = 1; | 992 | video->cap._SPD = 1; |
1013 | } | 993 | if (acpi_has_method(video->device->handle, "_VPO")) |
1014 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) { | ||
1015 | video->cap._VPO = 1; | 994 | video->cap._VPO = 1; |
1016 | } | ||
1017 | } | 995 | } |
1018 | 996 | ||
1019 | /* | 997 | /* |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index c3397748ba46..940edbf2fe8f 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -53,14 +53,13 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | |||
53 | void **retyurn_value) | 53 | void **retyurn_value) |
54 | { | 54 | { |
55 | long *cap = context; | 55 | long *cap = context; |
56 | acpi_handle h_dummy; | ||
57 | 56 | ||
58 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) && | 57 | if (acpi_has_method(handle, "_BCM") && |
59 | ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) { | 58 | acpi_has_method(handle, "_BCL")) { |
60 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " | 59 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " |
61 | "support\n")); | 60 | "support\n")); |
62 | *cap |= ACPI_VIDEO_BACKLIGHT; | 61 | *cap |= ACPI_VIDEO_BACKLIGHT; |
63 | if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) | 62 | if (!acpi_has_method(handle, "_BQC")) |
64 | printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " | 63 | printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " |
65 | "cannot determine initial brightness\n"); | 64 | "cannot determine initial brightness\n"); |
66 | /* We have backlight support, no need to scan further */ | 65 | /* We have backlight support, no need to scan further */ |
@@ -79,22 +78,20 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | |||
79 | */ | 78 | */ |
80 | long acpi_is_video_device(acpi_handle handle) | 79 | long acpi_is_video_device(acpi_handle handle) |
81 | { | 80 | { |
82 | acpi_handle h_dummy; | ||
83 | long video_caps = 0; | 81 | long video_caps = 0; |
84 | 82 | ||
85 | /* Is this device able to support video switching ? */ | 83 | /* Is this device able to support video switching ? */ |
86 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) || | 84 | if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS")) |
87 | ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy))) | ||
88 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | 85 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; |
89 | 86 | ||
90 | /* Is this device able to retrieve a video ROM ? */ | 87 | /* Is this device able to retrieve a video ROM ? */ |
91 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy))) | 88 | if (acpi_has_method(handle, "_ROM")) |
92 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | 89 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; |
93 | 90 | ||
94 | /* Is this device able to configure which video head to be POSTed ? */ | 91 | /* Is this device able to configure which video head to be POSTed ? */ |
95 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) && | 92 | if (acpi_has_method(handle, "_VPO") && |
96 | ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) && | 93 | acpi_has_method(handle, "_GPD") && |
97 | ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy))) | 94 | acpi_has_method(handle, "_SPD")) |
98 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; | 95 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; |
99 | 96 | ||
100 | /* Only check for backlight functionality if one of the above hit. */ | 97 | /* Only check for backlight functionality if one of the above hit. */ |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 6fdd49c6f0b9..6c781edabcc6 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -122,7 +122,6 @@ struct acpiphp_func { | |||
122 | struct acpiphp_slot *slot; /* parent */ | 122 | struct acpiphp_slot *slot; /* parent */ |
123 | 123 | ||
124 | struct list_head sibling; | 124 | struct list_head sibling; |
125 | struct notifier_block nb; | ||
126 | acpi_handle handle; | 125 | acpi_handle handle; |
127 | 126 | ||
128 | u8 function; /* pci function# */ | 127 | u8 function; /* pci function# */ |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 59df8575a48c..8bfad0dc29ab 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -119,15 +119,14 @@ static void free_bridge(struct kref *kref) | |||
119 | * TBD - figure out a way to only call fixups for | 119 | * TBD - figure out a way to only call fixups for |
120 | * systems that require them. | 120 | * systems that require them. |
121 | */ | 121 | */ |
122 | static int post_dock_fixups(struct notifier_block *nb, unsigned long val, | 122 | static void post_dock_fixups(acpi_handle not_used, u32 event, void *data) |
123 | void *v) | ||
124 | { | 123 | { |
125 | struct acpiphp_func *func = container_of(nb, struct acpiphp_func, nb); | 124 | struct acpiphp_func *func = data; |
126 | struct pci_bus *bus = func->slot->bridge->pci_bus; | 125 | struct pci_bus *bus = func->slot->bridge->pci_bus; |
127 | u32 buses; | 126 | u32 buses; |
128 | 127 | ||
129 | if (!bus->self) | 128 | if (!bus->self) |
130 | return NOTIFY_OK; | 129 | return; |
131 | 130 | ||
132 | /* fixup bad _DCK function that rewrites | 131 | /* fixup bad _DCK function that rewrites |
133 | * secondary bridge on slot | 132 | * secondary bridge on slot |
@@ -143,11 +142,11 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val, | |||
143 | | ((unsigned int)(bus->busn_res.end) << 16); | 142 | | ((unsigned int)(bus->busn_res.end) << 16); |
144 | pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); | 143 | pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); |
145 | } | 144 | } |
146 | return NOTIFY_OK; | ||
147 | } | 145 | } |
148 | 146 | ||
149 | 147 | ||
150 | static const struct acpi_dock_ops acpiphp_dock_ops = { | 148 | static const struct acpi_dock_ops acpiphp_dock_ops = { |
149 | .fixup = post_dock_fixups, | ||
151 | .handler = hotplug_event_func, | 150 | .handler = hotplug_event_func, |
152 | }; | 151 | }; |
153 | 152 | ||
@@ -201,7 +200,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
201 | struct acpiphp_bridge *bridge = (struct acpiphp_bridge *)context; | 200 | struct acpiphp_bridge *bridge = (struct acpiphp_bridge *)context; |
202 | struct acpiphp_slot *slot; | 201 | struct acpiphp_slot *slot; |
203 | struct acpiphp_func *newfunc; | 202 | struct acpiphp_func *newfunc; |
204 | acpi_handle tmp; | ||
205 | acpi_status status = AE_OK; | 203 | acpi_status status = AE_OK; |
206 | unsigned long long adr, sun; | 204 | unsigned long long adr, sun; |
207 | int device, function, retval, found = 0; | 205 | int device, function, retval, found = 0; |
@@ -232,19 +230,19 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
232 | newfunc->handle = handle; | 230 | newfunc->handle = handle; |
233 | newfunc->function = function; | 231 | newfunc->function = function; |
234 | 232 | ||
235 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) | 233 | if (acpi_has_method(handle, "_EJ0")) |
236 | newfunc->flags = FUNC_HAS_EJ0; | 234 | newfunc->flags = FUNC_HAS_EJ0; |
237 | 235 | ||
238 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_STA", &tmp))) | 236 | if (acpi_has_method(handle, "_STA")) |
239 | newfunc->flags |= FUNC_HAS_STA; | 237 | newfunc->flags |= FUNC_HAS_STA; |
240 | 238 | ||
241 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS0", &tmp))) | 239 | if (acpi_has_method(handle, "_PS0")) |
242 | newfunc->flags |= FUNC_HAS_PS0; | 240 | newfunc->flags |= FUNC_HAS_PS0; |
243 | 241 | ||
244 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS3", &tmp))) | 242 | if (acpi_has_method(handle, "_PS3")) |
245 | newfunc->flags |= FUNC_HAS_PS3; | 243 | newfunc->flags |= FUNC_HAS_PS3; |
246 | 244 | ||
247 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_DCK", &tmp))) | 245 | if (acpi_has_method(handle, "_DCK")) |
248 | newfunc->flags |= FUNC_HAS_DCK; | 246 | newfunc->flags |= FUNC_HAS_DCK; |
249 | 247 | ||
250 | status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun); | 248 | status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun); |
@@ -316,14 +314,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
316 | &acpiphp_dock_ops, newfunc, | 314 | &acpiphp_dock_ops, newfunc, |
317 | acpiphp_dock_init, acpiphp_dock_release)) | 315 | acpiphp_dock_init, acpiphp_dock_release)) |
318 | dbg("failed to register dock device\n"); | 316 | dbg("failed to register dock device\n"); |
319 | |||
320 | /* we need to be notified when dock events happen | ||
321 | * outside of the hotplug operation, since we may | ||
322 | * need to do fixups before we can hotplug. | ||
323 | */ | ||
324 | newfunc->nb.notifier_call = post_dock_fixups; | ||
325 | if (register_dock_notifier(&newfunc->nb)) | ||
326 | dbg("failed to register a dock notifier"); | ||
327 | } | 317 | } |
328 | 318 | ||
329 | /* install notify handler */ | 319 | /* install notify handler */ |
@@ -473,7 +463,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) | |||
473 | list_for_each_entry(func, &slot->funcs, sibling) { | 463 | list_for_each_entry(func, &slot->funcs, sibling) { |
474 | if (is_dock_device(func->handle)) { | 464 | if (is_dock_device(func->handle)) { |
475 | unregister_hotplug_dock_device(func->handle); | 465 | unregister_hotplug_dock_device(func->handle); |
476 | unregister_dock_notifier(&func->nb); | ||
477 | } | 466 | } |
478 | if (!(func->flags & FUNC_HAS_DCK)) { | 467 | if (!(func->flags & FUNC_HAS_DCK)) { |
479 | status = acpi_remove_notify_handler(func->handle, | 468 | status = acpi_remove_notify_handler(func->handle, |
@@ -843,25 +832,14 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot) | |||
843 | */ | 832 | */ |
844 | int acpiphp_eject_slot(struct acpiphp_slot *slot) | 833 | int acpiphp_eject_slot(struct acpiphp_slot *slot) |
845 | { | 834 | { |
846 | acpi_status status; | ||
847 | struct acpiphp_func *func; | 835 | struct acpiphp_func *func; |
848 | struct acpi_object_list arg_list; | ||
849 | union acpi_object arg; | ||
850 | 836 | ||
851 | list_for_each_entry(func, &slot->funcs, sibling) { | 837 | list_for_each_entry(func, &slot->funcs, sibling) { |
852 | /* We don't want to call _EJ0 on non-existing functions. */ | 838 | /* We don't want to call _EJ0 on non-existing functions. */ |
853 | if ((func->flags & FUNC_HAS_EJ0)) { | 839 | if ((func->flags & FUNC_HAS_EJ0)) { |
854 | /* _EJ0 method take one argument */ | 840 | if (ACPI_FAILURE(acpi_evaluate_ej0(func->handle))) |
855 | arg_list.count = 1; | ||
856 | arg_list.pointer = &arg; | ||
857 | arg.type = ACPI_TYPE_INTEGER; | ||
858 | arg.integer.value = 1; | ||
859 | |||
860 | status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL); | ||
861 | if (ACPI_FAILURE(status)) { | ||
862 | warn("%s: _EJ0 failed\n", __func__); | ||
863 | return -1; | 841 | return -1; |
864 | } else | 842 | else |
865 | break; | 843 | break; |
866 | } | 844 | } |
867 | } | 845 | } |
@@ -1171,7 +1149,6 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, | |||
1171 | */ | 1149 | */ |
1172 | void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle) | 1150 | void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle) |
1173 | { | 1151 | { |
1174 | acpi_handle dummy_handle; | ||
1175 | struct acpiphp_bridge *bridge; | 1152 | struct acpiphp_bridge *bridge; |
1176 | 1153 | ||
1177 | if (acpiphp_disabled) | 1154 | if (acpiphp_disabled) |
@@ -1200,8 +1177,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle) | |||
1200 | get_device(&bus->dev); | 1177 | get_device(&bus->dev); |
1201 | 1178 | ||
1202 | if (!pci_is_root_bus(bridge->pci_bus) && | 1179 | if (!pci_is_root_bus(bridge->pci_bus) && |
1203 | ACPI_SUCCESS(acpi_get_handle(bridge->handle, | 1180 | acpi_has_method(bridge->handle, "_EJ0")) { |
1204 | "_EJ0", &dummy_handle))) { | ||
1205 | dbg("found ejectable p2p bridge\n"); | 1181 | dbg("found ejectable p2p bridge\n"); |
1206 | bridge->flags |= BRIDGE_HAS_EJ0; | 1182 | bridge->flags |= BRIDGE_HAS_EJ0; |
1207 | bridge->func = acpiphp_bridge_handle_to_function(handle); | 1183 | bridge->func = acpiphp_bridge_handle_to_function(handle); |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 94383a70c1a3..904379b5f2fb 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -56,6 +56,16 @@ acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, | |||
56 | 56 | ||
57 | acpi_status | 57 | acpi_status |
58 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); | 58 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); |
59 | |||
60 | bool acpi_has_method(acpi_handle handle, char *name); | ||
61 | acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, | ||
62 | u64 arg); | ||
63 | acpi_status acpi_evaluate_ej0(acpi_handle handle); | ||
64 | acpi_status acpi_evaluate_lck(acpi_handle handle, int lock); | ||
65 | bool acpi_ata_match(acpi_handle handle); | ||
66 | bool acpi_bay_match(acpi_handle handle); | ||
67 | bool acpi_dock_match(acpi_handle handle); | ||
68 | |||
59 | #ifdef CONFIG_ACPI | 69 | #ifdef CONFIG_ACPI |
60 | 70 | ||
61 | #include <linux/proc_fs.h> | 71 | #include <linux/proc_fs.h> |
@@ -352,8 +362,6 @@ extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); | |||
352 | extern int register_acpi_notifier(struct notifier_block *); | 362 | extern int register_acpi_notifier(struct notifier_block *); |
353 | extern int unregister_acpi_notifier(struct notifier_block *); | 363 | extern int unregister_acpi_notifier(struct notifier_block *); |
354 | 364 | ||
355 | extern int register_acpi_bus_notifier(struct notifier_block *nb); | ||
356 | extern void unregister_acpi_bus_notifier(struct notifier_block *nb); | ||
357 | /* | 365 | /* |
358 | * External Functions | 366 | * External Functions |
359 | */ | 367 | */ |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index b420939f5eb5..1cedfcb1bd88 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -113,14 +113,13 @@ void pci_acpi_crs_quirks(void); | |||
113 | Dock Station | 113 | Dock Station |
114 | -------------------------------------------------------------------------- */ | 114 | -------------------------------------------------------------------------- */ |
115 | struct acpi_dock_ops { | 115 | struct acpi_dock_ops { |
116 | acpi_notify_handler fixup; | ||
116 | acpi_notify_handler handler; | 117 | acpi_notify_handler handler; |
117 | acpi_notify_handler uevent; | 118 | acpi_notify_handler uevent; |
118 | }; | 119 | }; |
119 | 120 | ||
120 | #if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE) | 121 | #ifdef CONFIG_ACPI_DOCK |
121 | extern int is_dock_device(acpi_handle handle); | 122 | extern int is_dock_device(acpi_handle handle); |
122 | extern int register_dock_notifier(struct notifier_block *nb); | ||
123 | extern void unregister_dock_notifier(struct notifier_block *nb); | ||
124 | extern int register_hotplug_dock_device(acpi_handle handle, | 123 | extern int register_hotplug_dock_device(acpi_handle handle, |
125 | const struct acpi_dock_ops *ops, | 124 | const struct acpi_dock_ops *ops, |
126 | void *context, | 125 | void *context, |
@@ -132,13 +131,6 @@ static inline int is_dock_device(acpi_handle handle) | |||
132 | { | 131 | { |
133 | return 0; | 132 | return 0; |
134 | } | 133 | } |
135 | static inline int register_dock_notifier(struct notifier_block *nb) | ||
136 | { | ||
137 | return -ENODEV; | ||
138 | } | ||
139 | static inline void unregister_dock_notifier(struct notifier_block *nb) | ||
140 | { | ||
141 | } | ||
142 | static inline int register_hotplug_dock_device(acpi_handle handle, | 134 | static inline int register_hotplug_dock_device(acpi_handle handle, |
143 | const struct acpi_dock_ops *ops, | 135 | const struct acpi_dock_ops *ops, |
144 | void *context, | 136 | void *context, |
@@ -150,6 +142,6 @@ static inline int register_hotplug_dock_device(acpi_handle handle, | |||
150 | static inline void unregister_hotplug_dock_device(acpi_handle handle) | 142 | static inline void unregister_hotplug_dock_device(acpi_handle handle) |
151 | { | 143 | { |
152 | } | 144 | } |
153 | #endif | 145 | #endif /* CONFIG_ACPI_DOCK */ |
154 | 146 | ||
155 | #endif /*__ACPI_DRIVERS_H__*/ | 147 | #endif /*__ACPI_DRIVERS_H__*/ |