aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d53162997f32..09f65f57bebe 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -835,7 +835,7 @@ static int acpi_bus_extract_wakeup_device_power_package(acpi_handle handle,
835 return err; 835 return err;
836} 836}
837 837
838static void acpi_wakeup_gpe_init(struct acpi_device *device) 838static bool acpi_wakeup_gpe_init(struct acpi_device *device)
839{ 839{
840 static const struct acpi_device_id button_device_ids[] = { 840 static const struct acpi_device_id button_device_ids[] = {
841 {"PNP0C0C", 0}, 841 {"PNP0C0C", 0},
@@ -845,13 +845,11 @@ static void acpi_wakeup_gpe_init(struct acpi_device *device)
845 }; 845 };
846 struct acpi_device_wakeup *wakeup = &device->wakeup; 846 struct acpi_device_wakeup *wakeup = &device->wakeup;
847 acpi_status status; 847 acpi_status status;
848 acpi_event_status event_status;
849 848
850 wakeup->flags.notifier_present = 0; 849 wakeup->flags.notifier_present = 0;
851 850
852 /* Power button, Lid switch always enable wakeup */ 851 /* Power button, Lid switch always enable wakeup */
853 if (!acpi_match_device_ids(device, button_device_ids)) { 852 if (!acpi_match_device_ids(device, button_device_ids)) {
854 wakeup->flags.run_wake = 1;
855 if (!acpi_match_device_ids(device, &button_device_ids[1])) { 853 if (!acpi_match_device_ids(device, &button_device_ids[1])) {
856 /* Do not use Lid/sleep button for S5 wakeup */ 854 /* Do not use Lid/sleep button for S5 wakeup */
857 if (wakeup->sleep_state == ACPI_STATE_S5) 855 if (wakeup->sleep_state == ACPI_STATE_S5)
@@ -859,17 +857,12 @@ static void acpi_wakeup_gpe_init(struct acpi_device *device)
859 } 857 }
860 acpi_mark_gpe_for_wake(wakeup->gpe_device, wakeup->gpe_number); 858 acpi_mark_gpe_for_wake(wakeup->gpe_device, wakeup->gpe_number);
861 device_set_wakeup_capable(&device->dev, true); 859 device_set_wakeup_capable(&device->dev, true);
862 return; 860 return true;
863 } 861 }
864 862
865 acpi_setup_gpe_for_wake(device->handle, wakeup->gpe_device, 863 status = acpi_setup_gpe_for_wake(device->handle, wakeup->gpe_device,
866 wakeup->gpe_number); 864 wakeup->gpe_number);
867 status = acpi_get_gpe_status(wakeup->gpe_device, wakeup->gpe_number, 865 return ACPI_SUCCESS(status);
868 &event_status);
869 if (ACPI_FAILURE(status))
870 return;
871
872 wakeup->flags.run_wake = !!(event_status & ACPI_EVENT_FLAG_HAS_HANDLER);
873} 866}
874 867
875static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) 868static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
@@ -887,10 +880,10 @@ static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
887 return; 880 return;
888 } 881 }
889 882
890 device->wakeup.flags.valid = 1; 883 device->wakeup.flags.valid = acpi_wakeup_gpe_init(device);
891 device->wakeup.prepare_count = 0; 884 device->wakeup.prepare_count = 0;
892 acpi_wakeup_gpe_init(device); 885 /*
893 /* Call _PSW/_DSW object to disable its ability to wake the sleeping 886 * Call _PSW/_DSW object to disable its ability to wake the sleeping
894 * system for the ACPI device with the _PRW object. 887 * system for the ACPI device with the _PRW object.
895 * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. 888 * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW.
896 * So it is necessary to call _DSW object first. Only when it is not 889 * So it is necessary to call _DSW object first. Only when it is not