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.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index f775fa0d850f..5d592e17d760 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -77,7 +77,9 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
77 void (*uevent)(struct acpi_device *, u32)) 77 void (*uevent)(struct acpi_device *, u32))
78{ 78{
79 acpi_lock_hp_context(); 79 acpi_lock_hp_context();
80 acpi_set_hp_context(adev, hp, notify, uevent, NULL); 80 hp->notify = notify;
81 hp->uevent = uevent;
82 acpi_set_hp_context(adev, hp);
81 acpi_unlock_hp_context(); 83 acpi_unlock_hp_context();
82} 84}
83EXPORT_SYMBOL_GPL(acpi_initialize_hp_context); 85EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
@@ -1421,14 +1423,13 @@ static int acpi_bus_extract_wakeup_device_power_package(acpi_handle handle,
1421 wakeup->sleep_state = sleep_state; 1423 wakeup->sleep_state = sleep_state;
1422 } 1424 }
1423 } 1425 }
1424 acpi_setup_gpe_for_wake(handle, wakeup->gpe_device, wakeup->gpe_number);
1425 1426
1426 out: 1427 out:
1427 kfree(buffer.pointer); 1428 kfree(buffer.pointer);
1428 return err; 1429 return err;
1429} 1430}
1430 1431
1431static void acpi_bus_set_run_wake_flags(struct acpi_device *device) 1432static void acpi_wakeup_gpe_init(struct acpi_device *device)
1432{ 1433{
1433 struct acpi_device_id button_device_ids[] = { 1434 struct acpi_device_id button_device_ids[] = {
1434 {"PNP0C0C", 0}, 1435 {"PNP0C0C", 0},
@@ -1436,29 +1437,33 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
1436 {"PNP0C0E", 0}, 1437 {"PNP0C0E", 0},
1437 {"", 0}, 1438 {"", 0},
1438 }; 1439 };
1440 struct acpi_device_wakeup *wakeup = &device->wakeup;
1439 acpi_status status; 1441 acpi_status status;
1440 acpi_event_status event_status; 1442 acpi_event_status event_status;
1441 1443
1442 device->wakeup.flags.notifier_present = 0; 1444 wakeup->flags.notifier_present = 0;
1443 1445
1444 /* Power button, Lid switch always enable wakeup */ 1446 /* Power button, Lid switch always enable wakeup */
1445 if (!acpi_match_device_ids(device, button_device_ids)) { 1447 if (!acpi_match_device_ids(device, button_device_ids)) {
1446 device->wakeup.flags.run_wake = 1; 1448 wakeup->flags.run_wake = 1;
1447 if (!acpi_match_device_ids(device, &button_device_ids[1])) { 1449 if (!acpi_match_device_ids(device, &button_device_ids[1])) {
1448 /* Do not use Lid/sleep button for S5 wakeup */ 1450 /* Do not use Lid/sleep button for S5 wakeup */
1449 if (device->wakeup.sleep_state == ACPI_STATE_S5) 1451 if (wakeup->sleep_state == ACPI_STATE_S5)
1450 device->wakeup.sleep_state = ACPI_STATE_S4; 1452 wakeup->sleep_state = ACPI_STATE_S4;
1451 } 1453 }
1454 acpi_mark_gpe_for_wake(wakeup->gpe_device, wakeup->gpe_number);
1452 device_set_wakeup_capable(&device->dev, true); 1455 device_set_wakeup_capable(&device->dev, true);
1453 return; 1456 return;
1454 } 1457 }
1455 1458
1456 status = acpi_get_gpe_status(device->wakeup.gpe_device, 1459 acpi_setup_gpe_for_wake(device->handle, wakeup->gpe_device,
1457 device->wakeup.gpe_number, 1460 wakeup->gpe_number);
1458 &event_status); 1461 status = acpi_get_gpe_status(wakeup->gpe_device, wakeup->gpe_number,
1459 if (status == AE_OK) 1462 &event_status);
1460 device->wakeup.flags.run_wake = 1463 if (ACPI_FAILURE(status))
1461 !!(event_status & ACPI_EVENT_FLAG_HANDLE); 1464 return;
1465
1466 wakeup->flags.run_wake = !!(event_status & ACPI_EVENT_FLAG_HANDLE);
1462} 1467}
1463 1468
1464static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) 1469static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
@@ -1478,7 +1483,7 @@ static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
1478 1483
1479 device->wakeup.flags.valid = 1; 1484 device->wakeup.flags.valid = 1;
1480 device->wakeup.prepare_count = 0; 1485 device->wakeup.prepare_count = 0;
1481 acpi_bus_set_run_wake_flags(device); 1486 acpi_wakeup_gpe_init(device);
1482 /* Call _PSW/_DSW object to disable its ability to wake the sleeping 1487 /* Call _PSW/_DSW object to disable its ability to wake the sleeping
1483 * system for the ACPI device with the _PRW object. 1488 * system for the ACPI device with the _PRW object.
1484 * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. 1489 * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW.