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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7d164a966b0d..c6d60910e8a8 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -633,6 +633,7 @@ static int acpi_device_register(struct acpi_device *device)
633 INIT_LIST_HEAD(&device->wakeup_list); 633 INIT_LIST_HEAD(&device->wakeup_list);
634 INIT_LIST_HEAD(&device->physical_node_list); 634 INIT_LIST_HEAD(&device->physical_node_list);
635 mutex_init(&device->physical_node_lock); 635 mutex_init(&device->physical_node_lock);
636 INIT_LIST_HEAD(&device->power_dependent);
636 637
637 new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); 638 new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
638 if (!new_bus_id) { 639 if (!new_bus_id) {
@@ -706,8 +707,14 @@ static void acpi_device_unregister(struct acpi_device *device)
706 707
707 acpi_detach_data(device->handle, acpi_bus_data_handler); 708 acpi_detach_data(device->handle, acpi_bus_data_handler);
708 709
710 acpi_power_add_remove_device(device, false);
709 acpi_device_remove_files(device); 711 acpi_device_remove_files(device);
710 device_unregister(&device->dev); 712 device_unregister(&device->dev);
713 /*
714 * Drop the reference counts of all power resources the device depends
715 * on and turn off the ones that have no more references.
716 */
717 acpi_power_transition(device, ACPI_STATE_D3_COLD);
711} 718}
712 719
713/* -------------------------------------------------------------------------- 720/* --------------------------------------------------------------------------
@@ -1441,6 +1448,7 @@ static int acpi_add_single_object(struct acpi_device **child,
1441 1448
1442end: 1449end:
1443 if (!result) { 1450 if (!result) {
1451 acpi_power_add_remove_device(device, true);
1444 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); 1452 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
1445 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1453 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1446 "Adding %s [%s] parent %s\n", dev_name(&device->dev), 1454 "Adding %s [%s] parent %s\n", dev_name(&device->dev),