diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-07-06 21:33:34 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-07-07 19:25:57 -0400 |
commit | 77e766099efc29d8b01db4b8244ff64fa3d3d0ca (patch) | |
tree | 6868acb2376388e5c02ed45a685ac31cc31a0bb1 /drivers/acpi/scan.c | |
parent | 44e4e66eeae5338b3ca0b28f8352e60bf18d5ba8 (diff) |
ACPI: Introduce acpi_device_sleep_wake function
The currect ACPI code attempts to execute _PSW at three different
places and in one of them only it tries to execute _DSW before _PSW,
which is inconsistent with the other two cases.
Move the execution of _DSW and _PSW into a separate function called
acpi_device_sleep_wake() and call it wherever appropriate instead of
executing _DSW and/or _PSW directly.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 6d85289f1c12..f276890cfde7 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -691,9 +691,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
691 | acpi_status status = 0; | 691 | acpi_status status = 0; |
692 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 692 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
693 | union acpi_object *package = NULL; | 693 | union acpi_object *package = NULL; |
694 | union acpi_object in_arg[3]; | 694 | int psw_error; |
695 | struct acpi_object_list arg_list = { 3, in_arg }; | ||
696 | acpi_status psw_status = AE_OK; | ||
697 | 695 | ||
698 | struct acpi_device_id button_device_ids[] = { | 696 | struct acpi_device_id button_device_ids[] = { |
699 | {"PNP0C0D", 0}, | 697 | {"PNP0C0D", 0}, |
@@ -725,39 +723,11 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
725 | * So it is necessary to call _DSW object first. Only when it is not | 723 | * So it is necessary to call _DSW object first. Only when it is not |
726 | * present will the _PSW object used. | 724 | * present will the _PSW object used. |
727 | */ | 725 | */ |
728 | /* | 726 | psw_error = acpi_device_sleep_wake(device, 0, 0, 0); |
729 | * Three agruments are needed for the _DSW object. | 727 | if (psw_error) |
730 | * Argument 0: enable/disable the wake capabilities | 728 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
731 | * When _DSW object is called to disable the wake capabilities, maybe | 729 | "error in _DSW or _PSW evaluation\n")); |
732 | * the first argument is filled. The value of the other two agruments | 730 | |
733 | * is meaningless. | ||
734 | */ | ||
735 | in_arg[0].type = ACPI_TYPE_INTEGER; | ||
736 | in_arg[0].integer.value = 0; | ||
737 | in_arg[1].type = ACPI_TYPE_INTEGER; | ||
738 | in_arg[1].integer.value = 0; | ||
739 | in_arg[2].type = ACPI_TYPE_INTEGER; | ||
740 | in_arg[2].integer.value = 0; | ||
741 | psw_status = acpi_evaluate_object(device->handle, "_DSW", | ||
742 | &arg_list, NULL); | ||
743 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
744 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n")); | ||
745 | /* | ||
746 | * When the _DSW object is not present, OSPM will call _PSW object. | ||
747 | */ | ||
748 | if (psw_status == AE_NOT_FOUND) { | ||
749 | /* | ||
750 | * Only one agruments is required for the _PSW object. | ||
751 | * agrument 0: enable/disable the wake capabilities | ||
752 | */ | ||
753 | arg_list.count = 1; | ||
754 | in_arg[0].integer.value = 0; | ||
755 | psw_status = acpi_evaluate_object(device->handle, "_PSW", | ||
756 | &arg_list, NULL); | ||
757 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
758 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in " | ||
759 | "evaluate _PSW\n")); | ||
760 | } | ||
761 | /* Power button, Lid switch always enable wakeup */ | 731 | /* Power button, Lid switch always enable wakeup */ |
762 | if (!acpi_match_device_ids(device, button_device_ids)) | 732 | if (!acpi_match_device_ids(device, button_device_ids)) |
763 | device->wakeup.flags.run_wake = 1; | 733 | device->wakeup.flags.run_wake = 1; |