Skip to content

Commit 59e8d4b

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: scan: Use the acpi_match_acpi_device() helper
Instead of doing two pass parsing of the table, replace acpi_match_device_ids() with acpi_match_acpi_device(). Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent bf6067a commit 59e8d4b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

drivers/acpi/scan.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -929,26 +929,29 @@ static int acpi_bus_extract_wakeup_device_power_package(struct acpi_device *dev)
929929
return err;
930930
}
931931

932+
/* Do not use a button for S5 wakeup */
933+
#define ACPI_AVOID_WAKE_FROM_S5 BIT(0)
934+
932935
static bool acpi_wakeup_gpe_init(struct acpi_device *device)
933936
{
934937
static const struct acpi_device_id button_device_ids[] = {
935-
{"PNP0C0C", 0}, /* Power button */
936-
{"PNP0C0D", 0}, /* Lid */
937-
{"PNP0C0E", 0}, /* Sleep button */
938+
{"PNP0C0C", 0}, /* Power button */
939+
{"PNP0C0D", ACPI_AVOID_WAKE_FROM_S5}, /* Lid */
940+
{"PNP0C0E", ACPI_AVOID_WAKE_FROM_S5}, /* Sleep button */
938941
{"", 0},
939942
};
940943
struct acpi_device_wakeup *wakeup = &device->wakeup;
944+
const struct acpi_device_id *match;
941945
acpi_status status;
942946

943947
wakeup->flags.notifier_present = 0;
944948

945949
/* Power button, Lid switch always enable wakeup */
946-
if (!acpi_match_device_ids(device, button_device_ids)) {
947-
if (!acpi_match_device_ids(device, &button_device_ids[1])) {
948-
/* Do not use Lid/sleep button for S5 wakeup */
949-
if (wakeup->sleep_state == ACPI_STATE_S5)
950-
wakeup->sleep_state = ACPI_STATE_S4;
951-
}
950+
match = acpi_match_acpi_device(button_device_ids, device);
951+
if (match) {
952+
if ((match->driver_data & ACPI_AVOID_WAKE_FROM_S5) &&
953+
wakeup->sleep_state == ACPI_STATE_S5)
954+
wakeup->sleep_state = ACPI_STATE_S4;
952955
acpi_mark_gpe_for_wake(wakeup->gpe_device, wakeup->gpe_number);
953956
device_set_wakeup_capable(&device->dev, true);
954957
return true;

0 commit comments

Comments
 (0)