diff options
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 1ee62bd25828..d04d0b33656c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1374,22 +1374,6 @@ static int acpi_device_set_context(struct acpi_device *device) | |||
1374 | return -ENODEV; | 1374 | return -ENODEV; |
1375 | } | 1375 | } |
1376 | 1376 | ||
1377 | static acpi_status acpi_bus_remove(acpi_handle handle, u32 lvl_not_used, | ||
1378 | void *not_used, void **ret_not_used) | ||
1379 | { | ||
1380 | struct acpi_device *dev = NULL; | ||
1381 | |||
1382 | if (acpi_bus_get_device(handle, &dev)) | ||
1383 | return AE_OK; | ||
1384 | |||
1385 | dev->removal_type = ACPI_BUS_REMOVAL_EJECT; | ||
1386 | device_release_driver(&dev->dev); | ||
1387 | |||
1388 | acpi_device_unregister(dev); | ||
1389 | |||
1390 | return AE_OK; | ||
1391 | } | ||
1392 | |||
1393 | static int acpi_add_single_object(struct acpi_device **child, | 1377 | static int acpi_add_single_object(struct acpi_device **child, |
1394 | acpi_handle handle, int type, | 1378 | acpi_handle handle, int type, |
1395 | unsigned long long sta, bool match_driver) | 1379 | unsigned long long sta, bool match_driver) |
@@ -1642,9 +1626,39 @@ int acpi_bus_add(acpi_handle handle) | |||
1642 | } | 1626 | } |
1643 | EXPORT_SYMBOL(acpi_bus_add); | 1627 | EXPORT_SYMBOL(acpi_bus_add); |
1644 | 1628 | ||
1629 | static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used, | ||
1630 | void *not_used, void **ret_not_used) | ||
1631 | { | ||
1632 | struct acpi_device *device = NULL; | ||
1633 | |||
1634 | if (!acpi_bus_get_device(handle, &device)) { | ||
1635 | device->removal_type = ACPI_BUS_REMOVAL_EJECT; | ||
1636 | device_release_driver(&device->dev); | ||
1637 | } | ||
1638 | return AE_OK; | ||
1639 | } | ||
1640 | |||
1641 | static acpi_status acpi_bus_remove(acpi_handle handle, u32 lvl_not_used, | ||
1642 | void *not_used, void **ret_not_used) | ||
1643 | { | ||
1644 | struct acpi_device *device = NULL; | ||
1645 | |||
1646 | if (!acpi_bus_get_device(handle, &device)) | ||
1647 | acpi_device_unregister(device); | ||
1648 | |||
1649 | return AE_OK; | ||
1650 | } | ||
1651 | |||
1645 | int acpi_bus_trim(struct acpi_device *start) | 1652 | int acpi_bus_trim(struct acpi_device *start) |
1646 | { | 1653 | { |
1647 | /* | 1654 | /* |
1655 | * Execute acpi_bus_device_detach() as a post-order callback to detach | ||
1656 | * all ACPI drivers from the device nodes being removed. | ||
1657 | */ | ||
1658 | acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, | ||
1659 | acpi_bus_device_detach, NULL, NULL); | ||
1660 | acpi_bus_device_detach(start->handle, 0, NULL, NULL); | ||
1661 | /* | ||
1648 | * Execute acpi_bus_remove() as a post-order callback to remove device | 1662 | * Execute acpi_bus_remove() as a post-order callback to remove device |
1649 | * nodes in the given namespace scope. | 1663 | * nodes in the given namespace scope. |
1650 | */ | 1664 | */ |