diff options
-rw-r--r-- | drivers/acpi/battery.c | 11 | ||||
-rw-r--r-- | drivers/acpi/ec.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 | 99 | ||||
-rw-r--r-- | drivers/acpi/utils.c | 15 | ||||
-rw-r--r-- | drivers/acpi/video.c | 39 | ||||
-rw-r--r-- | drivers/acpi/video_detect.c | 19 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 3 |
9 files changed, 80 insertions, 136 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 082b4dd252a8..a7627166e18b 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -548,12 +548,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) | |||
548 | 548 | ||
549 | static int acpi_battery_init_alarm(struct acpi_battery *battery) | 549 | static int acpi_battery_init_alarm(struct acpi_battery *battery) |
550 | { | 550 | { |
551 | acpi_status status = AE_OK; | ||
552 | acpi_handle handle = NULL; | ||
553 | |||
554 | /* See if alarms are supported, and if so, set default */ | 551 | /* See if alarms are supported, and if so, set default */ |
555 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); | 552 | if (!acpi_has_method(battery->device->handle, "_BTP")) { |
556 | if (ACPI_FAILURE(status)) { | ||
557 | clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); | 553 | clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); |
558 | return 0; | 554 | return 0; |
559 | } | 555 | } |
@@ -1066,7 +1062,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
1066 | { | 1062 | { |
1067 | int result = 0; | 1063 | int result = 0; |
1068 | struct acpi_battery *battery = NULL; | 1064 | struct acpi_battery *battery = NULL; |
1069 | acpi_handle handle; | 1065 | |
1070 | if (!device) | 1066 | if (!device) |
1071 | return -EINVAL; | 1067 | return -EINVAL; |
1072 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); | 1068 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); |
@@ -1078,8 +1074,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
1078 | device->driver_data = battery; | 1074 | device->driver_data = battery; |
1079 | mutex_init(&battery->lock); | 1075 | mutex_init(&battery->lock); |
1080 | mutex_init(&battery->sysfs_lock); | 1076 | mutex_init(&battery->sysfs_lock); |
1081 | if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, | 1077 | if (acpi_has_method(battery->device->handle, "_BIX")) |
1082 | "_BIX", &handle))) | ||
1083 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); | 1078 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); |
1084 | result = acpi_battery_update(battery); | 1079 | result = acpi_battery_update(battery); |
1085 | if (result) | 1080 | if (result) |
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/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 10985573aaa7..ada0b4cf2ba5 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -193,7 +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; | 196 | struct acpi_object_list arg_list; |
198 | union acpi_object arg; | 197 | union acpi_object arg; |
199 | struct device *errdev; | 198 | struct device *errdev; |
@@ -258,7 +257,7 @@ static int acpi_scan_hot_remove(struct acpi_device *device) | |||
258 | put_device(&device->dev); | 257 | put_device(&device->dev); |
259 | device = NULL; | 258 | device = NULL; |
260 | 259 | ||
261 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_LCK", ¬_used))) { | 260 | if (acpi_has_method(handle, "_LCK")) { |
262 | arg_list.count = 1; | 261 | arg_list.count = 1; |
263 | arg_list.pointer = &arg; | 262 | arg_list.pointer = &arg; |
264 | arg.type = ACPI_TYPE_INTEGER; | 263 | arg.type = ACPI_TYPE_INTEGER; |
@@ -652,7 +651,6 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
652 | { | 651 | { |
653 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 652 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
654 | acpi_status status; | 653 | acpi_status status; |
655 | acpi_handle temp; | ||
656 | unsigned long long sun; | 654 | unsigned long long sun; |
657 | int result = 0; | 655 | int result = 0; |
658 | 656 | ||
@@ -678,8 +676,7 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
678 | /* | 676 | /* |
679 | * If device has _STR, 'description' file is created | 677 | * If device has _STR, 'description' file is created |
680 | */ | 678 | */ |
681 | status = acpi_get_handle(dev->handle, "_STR", &temp); | 679 | if (acpi_has_method(dev->handle, "_STR")) { |
682 | if (ACPI_SUCCESS(status)) { | ||
683 | status = acpi_evaluate_object(dev->handle, "_STR", | 680 | status = acpi_evaluate_object(dev->handle, "_STR", |
684 | NULL, &buffer); | 681 | NULL, &buffer); |
685 | if (ACPI_FAILURE(status)) | 682 | if (ACPI_FAILURE(status)) |
@@ -709,8 +706,7 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
709 | * If device has _EJ0, 'eject' file is created that is used to trigger | 706 | * If device has _EJ0, 'eject' file is created that is used to trigger |
710 | * hot-removal function from userland. | 707 | * hot-removal function from userland. |
711 | */ | 708 | */ |
712 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); | 709 | if (acpi_has_method(dev->handle, "_EJ0")) { |
713 | if (ACPI_SUCCESS(status)) { | ||
714 | result = device_create_file(&dev->dev, &dev_attr_eject); | 710 | result = device_create_file(&dev->dev, &dev_attr_eject); |
715 | if (result) | 711 | if (result) |
716 | return result; | 712 | return result; |
@@ -732,9 +728,6 @@ end: | |||
732 | 728 | ||
733 | static void acpi_device_remove_files(struct acpi_device *dev) | 729 | static void acpi_device_remove_files(struct acpi_device *dev) |
734 | { | 730 | { |
735 | acpi_status status; | ||
736 | acpi_handle temp; | ||
737 | |||
738 | if (dev->flags.power_manageable) { | 731 | if (dev->flags.power_manageable) { |
739 | device_remove_file(&dev->dev, &dev_attr_power_state); | 732 | device_remove_file(&dev->dev, &dev_attr_power_state); |
740 | if (dev->power.flags.power_resources) | 733 | if (dev->power.flags.power_resources) |
@@ -745,20 +738,17 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
745 | /* | 738 | /* |
746 | * If device has _STR, remove 'description' file | 739 | * If device has _STR, remove 'description' file |
747 | */ | 740 | */ |
748 | status = acpi_get_handle(dev->handle, "_STR", &temp); | 741 | if (acpi_has_method(dev->handle, "_STR")) { |
749 | if (ACPI_SUCCESS(status)) { | ||
750 | kfree(dev->pnp.str_obj); | 742 | kfree(dev->pnp.str_obj); |
751 | device_remove_file(&dev->dev, &dev_attr_description); | 743 | device_remove_file(&dev->dev, &dev_attr_description); |
752 | } | 744 | } |
753 | /* | 745 | /* |
754 | * If device has _EJ0, remove 'eject' file. | 746 | * If device has _EJ0, remove 'eject' file. |
755 | */ | 747 | */ |
756 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); | 748 | if (acpi_has_method(dev->handle, "_EJ0")) |
757 | if (ACPI_SUCCESS(status)) | ||
758 | device_remove_file(&dev->dev, &dev_attr_eject); | 749 | device_remove_file(&dev->dev, &dev_attr_eject); |
759 | 750 | ||
760 | status = acpi_get_handle(dev->handle, "_SUN", &temp); | 751 | if (acpi_has_method(dev->handle, "_SUN")) |
761 | if (ACPI_SUCCESS(status)) | ||
762 | device_remove_file(&dev->dev, &dev_attr_sun); | 752 | device_remove_file(&dev->dev, &dev_attr_sun); |
763 | 753 | ||
764 | if (dev->pnp.unique_id) | 754 | if (dev->pnp.unique_id) |
@@ -1334,13 +1324,10 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | |||
1334 | 1324 | ||
1335 | static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | 1325 | static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) |
1336 | { | 1326 | { |
1337 | acpi_handle temp; | ||
1338 | acpi_status status = 0; | ||
1339 | int err; | 1327 | int err; |
1340 | 1328 | ||
1341 | /* Presence of _PRW indicates wake capable */ | 1329 | /* Presence of _PRW indicates wake capable */ |
1342 | status = acpi_get_handle(device->handle, "_PRW", &temp); | 1330 | if (!acpi_has_method(device->handle, "_PRW")) |
1343 | if (ACPI_FAILURE(status)) | ||
1344 | return; | 1331 | return; |
1345 | 1332 | ||
1346 | err = acpi_bus_extract_wakeup_device_power_package(device->handle, | 1333 | err = acpi_bus_extract_wakeup_device_power_package(device->handle, |
@@ -1370,7 +1357,6 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) | |||
1370 | struct acpi_device_power_state *ps = &device->power.states[state]; | 1357 | struct acpi_device_power_state *ps = &device->power.states[state]; |
1371 | char pathname[5] = { '_', 'P', 'R', '0' + state, '\0' }; | 1358 | char pathname[5] = { '_', 'P', 'R', '0' + state, '\0' }; |
1372 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 1359 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
1373 | acpi_handle handle; | ||
1374 | acpi_status status; | 1360 | acpi_status status; |
1375 | 1361 | ||
1376 | INIT_LIST_HEAD(&ps->resources); | 1362 | INIT_LIST_HEAD(&ps->resources); |
@@ -1393,8 +1379,7 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) | |||
1393 | 1379 | ||
1394 | /* Evaluate "_PSx" to see if we can do explicit sets */ | 1380 | /* Evaluate "_PSx" to see if we can do explicit sets */ |
1395 | pathname[2] = 'S'; | 1381 | pathname[2] = 'S'; |
1396 | status = acpi_get_handle(device->handle, pathname, &handle); | 1382 | if (acpi_has_method(device->handle, pathname)) |
1397 | if (ACPI_SUCCESS(status)) | ||
1398 | ps->flags.explicit_set = 1; | 1383 | ps->flags.explicit_set = 1; |
1399 | 1384 | ||
1400 | /* | 1385 | /* |
@@ -1413,28 +1398,21 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) | |||
1413 | 1398 | ||
1414 | static void acpi_bus_get_power_flags(struct acpi_device *device) | 1399 | static void acpi_bus_get_power_flags(struct acpi_device *device) |
1415 | { | 1400 | { |
1416 | acpi_status status; | ||
1417 | acpi_handle handle; | ||
1418 | u32 i; | 1401 | u32 i; |
1419 | 1402 | ||
1420 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ | 1403 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ |
1421 | status = acpi_get_handle(device->handle, "_PS0", &handle); | 1404 | if (!acpi_has_method(device->handle, "_PS0") && |
1422 | if (ACPI_FAILURE(status)) { | 1405 | !acpi_has_method(device->handle, "_PR0")) |
1423 | status = acpi_get_handle(device->handle, "_PR0", &handle); | 1406 | return; |
1424 | if (ACPI_FAILURE(status)) | ||
1425 | return; | ||
1426 | } | ||
1427 | 1407 | ||
1428 | device->flags.power_manageable = 1; | 1408 | device->flags.power_manageable = 1; |
1429 | 1409 | ||
1430 | /* | 1410 | /* |
1431 | * Power Management Flags | 1411 | * Power Management Flags |
1432 | */ | 1412 | */ |
1433 | status = acpi_get_handle(device->handle, "_PSC", &handle); | 1413 | if (acpi_has_method(device->handle, "_PSC")) |
1434 | if (ACPI_SUCCESS(status)) | ||
1435 | device->power.flags.explicit_get = 1; | 1414 | device->power.flags.explicit_get = 1; |
1436 | status = acpi_get_handle(device->handle, "_IRC", &handle); | 1415 | if (acpi_has_method(device->handle, "_IRC")) |
1437 | if (ACPI_SUCCESS(status)) | ||
1438 | device->power.flags.inrush_current = 1; | 1416 | device->power.flags.inrush_current = 1; |
1439 | 1417 | ||
1440 | /* | 1418 | /* |
@@ -1468,28 +1446,18 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) | |||
1468 | 1446 | ||
1469 | static void acpi_bus_get_flags(struct acpi_device *device) | 1447 | static void acpi_bus_get_flags(struct acpi_device *device) |
1470 | { | 1448 | { |
1471 | acpi_status status = AE_OK; | ||
1472 | acpi_handle temp = NULL; | ||
1473 | |||
1474 | /* Presence of _STA indicates 'dynamic_status' */ | 1449 | /* Presence of _STA indicates 'dynamic_status' */ |
1475 | status = acpi_get_handle(device->handle, "_STA", &temp); | 1450 | if (acpi_has_method(device->handle, "_STA")) |
1476 | if (ACPI_SUCCESS(status)) | ||
1477 | device->flags.dynamic_status = 1; | 1451 | device->flags.dynamic_status = 1; |
1478 | 1452 | ||
1479 | /* Presence of _RMV indicates 'removable' */ | 1453 | /* Presence of _RMV indicates 'removable' */ |
1480 | status = acpi_get_handle(device->handle, "_RMV", &temp); | 1454 | if (acpi_has_method(device->handle, "_RMV")) |
1481 | if (ACPI_SUCCESS(status)) | ||
1482 | device->flags.removable = 1; | 1455 | device->flags.removable = 1; |
1483 | 1456 | ||
1484 | /* Presence of _EJD|_EJ0 indicates 'ejectable' */ | 1457 | /* Presence of _EJD|_EJ0 indicates 'ejectable' */ |
1485 | status = acpi_get_handle(device->handle, "_EJD", &temp); | 1458 | if (acpi_has_method(device->handle, "_EJD") || |
1486 | if (ACPI_SUCCESS(status)) | 1459 | acpi_has_method(device->handle, "_EJ0")) |
1487 | device->flags.ejectable = 1; | 1460 | device->flags.ejectable = 1; |
1488 | else { | ||
1489 | status = acpi_get_handle(device->handle, "_EJ0", &temp); | ||
1490 | if (ACPI_SUCCESS(status)) | ||
1491 | device->flags.ejectable = 1; | ||
1492 | } | ||
1493 | } | 1461 | } |
1494 | 1462 | ||
1495 | static void acpi_device_get_busid(struct acpi_device *device) | 1463 | static void acpi_device_get_busid(struct acpi_device *device) |
@@ -1538,27 +1506,24 @@ static void acpi_device_get_busid(struct acpi_device *device) | |||
1538 | */ | 1506 | */ |
1539 | static int acpi_bay_match(acpi_handle handle) | 1507 | static int acpi_bay_match(acpi_handle handle) |
1540 | { | 1508 | { |
1541 | acpi_status status; | ||
1542 | acpi_handle tmp; | ||
1543 | acpi_handle phandle; | 1509 | acpi_handle phandle; |
1544 | 1510 | ||
1545 | status = acpi_get_handle(handle, "_EJ0", &tmp); | 1511 | if (!acpi_has_method(handle, "_EJ0")) |
1546 | if (ACPI_FAILURE(status)) | ||
1547 | return -ENODEV; | 1512 | return -ENODEV; |
1548 | 1513 | ||
1549 | if ((ACPI_SUCCESS(acpi_get_handle(handle, "_GTF", &tmp))) || | 1514 | if (acpi_has_method(handle, "_GTF") || |
1550 | (ACPI_SUCCESS(acpi_get_handle(handle, "_GTM", &tmp))) || | 1515 | acpi_has_method(handle, "_GTM") || |
1551 | (ACPI_SUCCESS(acpi_get_handle(handle, "_STM", &tmp))) || | 1516 | acpi_has_method(handle, "_STM") || |
1552 | (ACPI_SUCCESS(acpi_get_handle(handle, "_SDD", &tmp)))) | 1517 | acpi_has_method(handle, "_SDD")) |
1553 | return 0; | 1518 | return 0; |
1554 | 1519 | ||
1555 | if (acpi_get_parent(handle, &phandle)) | 1520 | if (acpi_get_parent(handle, &phandle)) |
1556 | return -ENODEV; | 1521 | return -ENODEV; |
1557 | 1522 | ||
1558 | if ((ACPI_SUCCESS(acpi_get_handle(phandle, "_GTF", &tmp))) || | 1523 | if (acpi_has_method(phandle, "_GTF") || |
1559 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_GTM", &tmp))) || | 1524 | acpi_has_method(phandle, "_GTM") || |
1560 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_STM", &tmp))) || | 1525 | acpi_has_method(phandle, "_STM") || |
1561 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_SDD", &tmp)))) | 1526 | acpi_has_method(phandle, "_SDD")) |
1562 | return 0; | 1527 | return 0; |
1563 | 1528 | ||
1564 | return -ENODEV; | 1529 | return -ENODEV; |
@@ -1610,7 +1575,6 @@ static void acpi_add_id(struct acpi_device_pnp *pnp, const char *dev_id) | |||
1610 | */ | 1575 | */ |
1611 | static int acpi_ibm_smbus_match(acpi_handle handle) | 1576 | static int acpi_ibm_smbus_match(acpi_handle handle) |
1612 | { | 1577 | { |
1613 | acpi_handle h_dummy; | ||
1614 | struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL}; | 1578 | struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL}; |
1615 | int result; | 1579 | int result; |
1616 | 1580 | ||
@@ -1629,9 +1593,9 @@ static int acpi_ibm_smbus_match(acpi_handle handle) | |||
1629 | 1593 | ||
1630 | /* Does it have the necessary (but misnamed) methods? */ | 1594 | /* Does it have the necessary (but misnamed) methods? */ |
1631 | result = -ENODEV; | 1595 | result = -ENODEV; |
1632 | if (ACPI_SUCCESS(acpi_get_handle(handle, "SBI", &h_dummy)) && | 1596 | if (acpi_has_method(handle, "SBI") && |
1633 | ACPI_SUCCESS(acpi_get_handle(handle, "SBR", &h_dummy)) && | 1597 | acpi_has_method(handle, "SBR") && |
1634 | ACPI_SUCCESS(acpi_get_handle(handle, "SBW", &h_dummy))) | 1598 | acpi_has_method(handle, "SBW")) |
1635 | result = 0; | 1599 | result = 0; |
1636 | out: | 1600 | out: |
1637 | kfree(path.pointer); | 1601 | kfree(path.pointer); |
@@ -1898,7 +1862,6 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
1898 | struct acpi_device *device = NULL; | 1862 | struct acpi_device *device = NULL; |
1899 | int type; | 1863 | int type; |
1900 | unsigned long long sta; | 1864 | unsigned long long sta; |
1901 | acpi_status status; | ||
1902 | int result; | 1865 | int result; |
1903 | 1866 | ||
1904 | acpi_bus_get_device(handle, &device); | 1867 | acpi_bus_get_device(handle, &device); |
@@ -1919,10 +1882,8 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
1919 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && | 1882 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && |
1920 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { | 1883 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { |
1921 | struct acpi_device_wakeup wakeup; | 1884 | struct acpi_device_wakeup wakeup; |
1922 | acpi_handle temp; | ||
1923 | 1885 | ||
1924 | status = acpi_get_handle(handle, "_PRW", &temp); | 1886 | if (acpi_has_method(handle, "_PRW")) { |
1925 | if (ACPI_SUCCESS(status)) { | ||
1926 | acpi_bus_extract_wakeup_device_power_package(handle, | 1887 | acpi_bus_extract_wakeup_device_power_package(handle, |
1927 | &wakeup); | 1888 | &wakeup); |
1928 | acpi_power_resources_list_free(&wakeup.resources); | 1889 | acpi_power_resources_list_free(&wakeup.resources); |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 744371304313..b08d97376f84 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -495,3 +495,18 @@ 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); | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 5d7075d25700..a84533e67b9d 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -875,28 +875,21 @@ out: | |||
875 | 875 | ||
876 | static void acpi_video_device_find_cap(struct acpi_video_device *device) | 876 | static void acpi_video_device_find_cap(struct acpi_video_device *device) |
877 | { | 877 | { |
878 | acpi_handle h_dummy1; | 878 | if (acpi_has_method(device->dev->handle, "_ADR")) |
879 | |||
880 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { | ||
881 | device->cap._ADR = 1; | 879 | device->cap._ADR = 1; |
882 | } | 880 | if (acpi_has_method(device->dev->handle, "_BCL")) |
883 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) { | ||
884 | device->cap._BCL = 1; | 881 | device->cap._BCL = 1; |
885 | } | 882 | if (acpi_has_method(device->dev->handle, "_BCM")) |
886 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) { | ||
887 | device->cap._BCM = 1; | 883 | device->cap._BCM = 1; |
888 | } | 884 | if (acpi_has_method(device->dev->handle, "_BQC")) { |
889 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle,"_BQC",&h_dummy1))) | ||
890 | device->cap._BQC = 1; | 885 | device->cap._BQC = 1; |
891 | else if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCQ", | 886 | } else if (acpi_has_method(device->dev->handle, "_BCQ")) { |
892 | &h_dummy1))) { | ||
893 | printk(KERN_WARNING FW_BUG "_BCQ is used instead of _BQC\n"); | 887 | printk(KERN_WARNING FW_BUG "_BCQ is used instead of _BQC\n"); |
894 | device->cap._BCQ = 1; | 888 | device->cap._BCQ = 1; |
895 | } | 889 | } |
896 | 890 | ||
897 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { | 891 | if (acpi_has_method(device->dev->handle, "_DDC")) |
898 | device->cap._DDC = 1; | 892 | device->cap._DDC = 1; |
899 | } | ||
900 | 893 | ||
901 | if (acpi_video_backlight_support()) { | 894 | if (acpi_video_backlight_support()) { |
902 | struct backlight_properties props; | 895 | struct backlight_properties props; |
@@ -984,26 +977,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
984 | 977 | ||
985 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | 978 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) |
986 | { | 979 | { |
987 | acpi_handle h_dummy1; | 980 | if (acpi_has_method(video->device->handle, "_DOS")) |
988 | |||
989 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { | ||
990 | video->cap._DOS = 1; | 981 | video->cap._DOS = 1; |
991 | } | 982 | if (acpi_has_method(video->device->handle, "_DOD")) |
992 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) { | ||
993 | video->cap._DOD = 1; | 983 | video->cap._DOD = 1; |
994 | } | 984 | if (acpi_has_method(video->device->handle, "_ROM")) |
995 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) { | ||
996 | video->cap._ROM = 1; | 985 | video->cap._ROM = 1; |
997 | } | 986 | if (acpi_has_method(video->device->handle, "_GPD")) |
998 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) { | ||
999 | video->cap._GPD = 1; | 987 | video->cap._GPD = 1; |
1000 | } | 988 | if (acpi_has_method(video->device->handle, "_SPD")) |
1001 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) { | ||
1002 | video->cap._SPD = 1; | 989 | video->cap._SPD = 1; |
1003 | } | 990 | if (acpi_has_method(video->device->handle, "_VPO")) |
1004 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) { | ||
1005 | video->cap._VPO = 1; | 991 | video->cap._VPO = 1; |
1006 | } | ||
1007 | } | 992 | } |
1008 | 993 | ||
1009 | /* | 994 | /* |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index e6bd910bc6ed..ddefa5f954e2 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -51,14 +51,13 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | |||
51 | void **retyurn_value) | 51 | void **retyurn_value) |
52 | { | 52 | { |
53 | long *cap = context; | 53 | long *cap = context; |
54 | acpi_handle h_dummy; | ||
55 | 54 | ||
56 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) && | 55 | if (acpi_has_method(handle, "_BCM") && |
57 | ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) { | 56 | acpi_has_method(handle, "_BCL")) { |
58 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " | 57 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " |
59 | "support\n")); | 58 | "support\n")); |
60 | *cap |= ACPI_VIDEO_BACKLIGHT; | 59 | *cap |= ACPI_VIDEO_BACKLIGHT; |
61 | if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) | 60 | if (!acpi_has_method(handle, "_BQC")) |
62 | printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " | 61 | printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " |
63 | "cannot determine initial brightness\n"); | 62 | "cannot determine initial brightness\n"); |
64 | /* We have backlight support, no need to scan further */ | 63 | /* We have backlight support, no need to scan further */ |
@@ -77,22 +76,20 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | |||
77 | */ | 76 | */ |
78 | long acpi_is_video_device(acpi_handle handle) | 77 | long acpi_is_video_device(acpi_handle handle) |
79 | { | 78 | { |
80 | acpi_handle h_dummy; | ||
81 | long video_caps = 0; | 79 | long video_caps = 0; |
82 | 80 | ||
83 | /* Is this device able to support video switching ? */ | 81 | /* Is this device able to support video switching ? */ |
84 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) || | 82 | if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS")) |
85 | ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy))) | ||
86 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | 83 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; |
87 | 84 | ||
88 | /* Is this device able to retrieve a video ROM ? */ | 85 | /* Is this device able to retrieve a video ROM ? */ |
89 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy))) | 86 | if (acpi_has_method(handle, "_ROM")) |
90 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | 87 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; |
91 | 88 | ||
92 | /* Is this device able to configure which video head to be POSTed ? */ | 89 | /* Is this device able to configure which video head to be POSTed ? */ |
93 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) && | 90 | if (acpi_has_method(handle, "_VPO") && |
94 | ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) && | 91 | acpi_has_method(handle, "_GPD") && |
95 | ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy))) | 92 | acpi_has_method(handle, "_SPD")) |
96 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; | 93 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; |
97 | 94 | ||
98 | /* Only check for backlight functionality if one of the above hit. */ | 95 | /* Only check for backlight functionality if one of the above hit. */ |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 56e6b68c8d2f..62b2811bade4 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -56,6 +56,9 @@ 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 | |||
59 | #ifdef CONFIG_ACPI | 62 | #ifdef CONFIG_ACPI |
60 | 63 | ||
61 | #include <linux/proc_fs.h> | 64 | #include <linux/proc_fs.h> |