diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index eaddb7a89c70d93a4bd47c2f7f038c8c9326d4f8..15ea22fc1f5e4c579eed1180057b14705a783f2d 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -167,7 +167,7 @@ acpi_memory_get_device(acpi_handle handle, * Now add the notified device. This creates the acpi_device * and invokes .add function */ - result = acpi_bus_add(handle); + result = acpi_bus_scan(handle); if (result) { acpi_handle_warn(handle, "Cannot add acpi bus\n"); return -EINVAL; diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index f8fb2281f34a550662b06453fc16097a8486b7cc..cc79d3e53a3919f9cf84df850ae9fc846549fb45 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -166,7 +166,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) if (!ACPI_FAILURE(status) || device) break; - result = acpi_bus_add(handle); + result = acpi_bus_scan(handle); if (result) { acpi_handle_warn(handle, "Failed to add container\n"); break; diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 4a56a8b2e51e488a5be8828a6c47e5c77eb64c65..420d24fc938832a8bff776e1f6126468fade7bf0 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -317,7 +317,7 @@ static struct acpi_device * dock_create_acpi_device(acpi_handle handle) * no device created for this object, * so we should create one. */ - ret = acpi_bus_add(handle); + ret = acpi_bus_scan(handle); if (ret) pr_debug("error adding bus, %x\n", -ret); diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index a24ee43e06e4073e1d96ab4482419d8c3957695e..9c5929a17d3ae2f8704dd3ce9cdd58a6742686fb 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -699,7 +699,7 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, if (!acpi_bus_get_device(handle, &device)) break; - result = acpi_bus_add(handle); + result = acpi_bus_scan(handle); if (result) { acpi_handle_err(handle, "Unable to add the device\n"); break; diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 388b59c096dcfda934c99c33a482f902fb785294..7c43bdc36abccf90155c2dfe7341ae890535fc7b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1577,26 +1577,8 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used, return status; } -static int acpi_bus_scan(acpi_handle handle) -{ - void *device = NULL; - - if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device))) - acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, - acpi_bus_check_add, NULL, NULL, &device); - - if (!device) - return -ENODEV; - - if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL))) - acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, - acpi_bus_device_attach, NULL, NULL, NULL); - - return 0; -} - /** - * acpi_bus_add - Add ACPI device node objects in a given namespace scope. + * acpi_bus_scan - Add ACPI device node objects in a given namespace scope. * @handle: Root of the namespace scope to scan. * * Scan a given ACPI tree (probably recently hot-plugged) and create and add @@ -1607,18 +1589,24 @@ static int acpi_bus_scan(acpi_handle handle) * in the table trunk from which the kernel could create a device and add an * appropriate driver. */ -int acpi_bus_add(acpi_handle handle) +int acpi_bus_scan(acpi_handle handle) { - int err; + void *device = NULL; - err = acpi_bus_scan(handle); - if (err) - return err; + if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device))) + acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, + acpi_bus_check_add, NULL, NULL, &device); + + if (!device) + return -ENODEV; + + if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL))) + acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, + acpi_bus_device_attach, NULL, NULL, NULL); - acpi_update_all_gpes(); return 0; } -EXPORT_SYMBOL(acpi_bus_add); +EXPORT_SYMBOL(acpi_bus_scan); static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used, void *not_used, void **ret_not_used) @@ -1708,13 +1696,15 @@ int __init acpi_scan_init(void) return result; result = acpi_bus_get_device(ACPI_ROOT_OBJECT, &acpi_root); - if (!result) - result = acpi_bus_scan_fixed(); - if (result) + return result; + + result = acpi_bus_scan_fixed(); + if (result) { acpi_device_unregister(acpi_root); - else - acpi_update_all_gpes(); + return result; + } - return result; + acpi_update_all_gpes(); + return 0; } diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 22006f2d9dd5780e20734465587b7dabfb4a43bb..9e2b1f6dbe41a01cd0e6e571e1b859e6b963069f 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -746,7 +746,7 @@ static int acpiphp_bus_add(struct acpiphp_func *func) dbg("acpi_bus_trim return %x\n", ret_val); } - ret_val = acpi_bus_add(func->handle); + ret_val = acpi_bus_scan(func->handle); if (!ret_val) ret_val = acpi_bus_get_device(func->handle, &device); @@ -1129,7 +1129,7 @@ static void handle_bridge_insertion(acpi_handle handle, u32 type) return; } - if (acpi_bus_add(handle)) { + if (acpi_bus_scan(handle)) { err("cannot add bridge to acpi list\n"); return; } diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index 2e006ee5738b556228431e130be1fa4b0f29f209..ae606b3e991e90694728ae3d1f8c380c5762774d 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c @@ -447,9 +447,9 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) if (ACPI_SUCCESS(ret) && (adr>>16) == (slot->device_num + 1)) { - ret = acpi_bus_add(chandle); + ret = acpi_bus_scan(chandle); if (ACPI_FAILURE(ret)) { - printk(KERN_ERR "%s: acpi_bus_add " + printk(KERN_ERR "%s: acpi_bus_scan " "failed (0x%x) for slot %d " "func %d\n", __func__, ret, (int)(adr>>16), diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 567851b4f04309b3f23aed40b11af65b31e5ce86..2c722deb2490b88612fadce7f7160390f4ad3099 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -346,7 +346,7 @@ static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 ty #endif int acpi_bus_register_driver(struct acpi_driver *driver); void acpi_bus_unregister_driver(struct acpi_driver *driver); -int acpi_bus_add(acpi_handle handle); +int acpi_bus_scan(acpi_handle handle); void acpi_bus_hot_remove_device(void *context); int acpi_bus_trim(struct acpi_device *start); acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);