From 21bf59e79be77a698fa3262de647afe8509b7e96 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 15 Jan 2013 13:24:13 +0100 Subject: [PATCH] --- yaml --- r: 350847 b: refs/heads/master c: 05404d8f7b5c831e1a2c24bb782f0fe8ea02354c h: refs/heads/master i: 350845: ae7cea11fcae04534ee1a55e77d97ff8faded532 350843: 2c343ece97dc462ca6b42969fbf62f9c13d7663a 350839: e212871fbc24f9f54b6abfe08a58e036c19f883d 350831: 8c69ade2b8ed9bde66cb8c09e13f730ea7053914 350815: bb606afbf7f8b62589e81b9c61f6e3a2bf1df068 350783: 0062aa9cbd8c6c9bbb1a851c0c13c51414ba32e8 350719: 15e90ca390e15325fc635f9e13a513ddf7bbb290 v: v3 --- [refs] | 2 +- trunk/drivers/acpi/scan.c | 46 +++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index cdc9d0d01f00..b1f0dc07462b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cecdb193c8d91a42d9489d00618cc3dfff92e55a +refs/heads/master: 05404d8f7b5c831e1a2c24bb782f0fe8ea02354c diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index 1ee62bd25828..d04d0b33656c 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -1374,22 +1374,6 @@ static int acpi_device_set_context(struct acpi_device *device) return -ENODEV; } -static acpi_status acpi_bus_remove(acpi_handle handle, u32 lvl_not_used, - void *not_used, void **ret_not_used) -{ - struct acpi_device *dev = NULL; - - if (acpi_bus_get_device(handle, &dev)) - return AE_OK; - - dev->removal_type = ACPI_BUS_REMOVAL_EJECT; - device_release_driver(&dev->dev); - - acpi_device_unregister(dev); - - return AE_OK; -} - static int acpi_add_single_object(struct acpi_device **child, acpi_handle handle, int type, unsigned long long sta, bool match_driver) @@ -1642,8 +1626,38 @@ int acpi_bus_add(acpi_handle handle) } EXPORT_SYMBOL(acpi_bus_add); +static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used, + void *not_used, void **ret_not_used) +{ + struct acpi_device *device = NULL; + + if (!acpi_bus_get_device(handle, &device)) { + device->removal_type = ACPI_BUS_REMOVAL_EJECT; + device_release_driver(&device->dev); + } + return AE_OK; +} + +static acpi_status acpi_bus_remove(acpi_handle handle, u32 lvl_not_used, + void *not_used, void **ret_not_used) +{ + struct acpi_device *device = NULL; + + if (!acpi_bus_get_device(handle, &device)) + acpi_device_unregister(device); + + return AE_OK; +} + int acpi_bus_trim(struct acpi_device *start) { + /* + * Execute acpi_bus_device_detach() as a post-order callback to detach + * all ACPI drivers from the device nodes being removed. + */ + acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, + acpi_bus_device_detach, NULL, NULL); + acpi_bus_device_detach(start->handle, 0, NULL, NULL); /* * Execute acpi_bus_remove() as a post-order callback to remove device * nodes in the given namespace scope.