aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/dock.c8
-rw-r--r--drivers/acpi/scan.c28
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c10
-rw-r--r--include/acpi/acpi_bus.h2
4 files changed, 21 insertions, 27 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 420d24fc9388..78648f811049 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -336,13 +336,9 @@ static struct acpi_device * dock_create_acpi_device(acpi_handle handle)
336static void dock_remove_acpi_device(acpi_handle handle) 336static void dock_remove_acpi_device(acpi_handle handle)
337{ 337{
338 struct acpi_device *device; 338 struct acpi_device *device;
339 int ret;
340 339
341 if (!acpi_bus_get_device(handle, &device)) { 340 if (!acpi_bus_get_device(handle, &device))
342 ret = acpi_bus_trim(device); 341 acpi_bus_trim(device);
343 if (ret)
344 pr_debug("error removing bus, %x\n", -ret);
345 }
346} 342}
347 343
348/** 344/**
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index b206ce5e1faf..774b17dc7999 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -52,6 +52,7 @@ static const struct acpi_device_id acpi_platform_device_ids[] = {
52 52
53static LIST_HEAD(acpi_device_list); 53static LIST_HEAD(acpi_device_list);
54static LIST_HEAD(acpi_bus_id_list); 54static LIST_HEAD(acpi_bus_id_list);
55static DEFINE_MUTEX(acpi_scan_lock);
55DEFINE_MUTEX(acpi_device_lock); 56DEFINE_MUTEX(acpi_device_lock);
56LIST_HEAD(acpi_wakeup_device_list); 57LIST_HEAD(acpi_wakeup_device_list);
57 58
@@ -127,13 +128,8 @@ void acpi_bus_hot_remove_device(void *context)
127 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 128 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
128 "Hot-removing device %s...\n", dev_name(&device->dev))); 129 "Hot-removing device %s...\n", dev_name(&device->dev)));
129 130
130 if (acpi_bus_trim(device)) { 131 acpi_bus_trim(device);
131 printk(KERN_ERR PREFIX 132 /* Device node has been released. */
132 "Removing device failed\n");
133 goto err_out;
134 }
135
136 /* device has been freed */
137 device = NULL; 133 device = NULL;
138 134
139 /* power off device */ 135 /* power off device */
@@ -1616,19 +1612,22 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used,
1616int acpi_bus_scan(acpi_handle handle) 1612int acpi_bus_scan(acpi_handle handle)
1617{ 1613{
1618 void *device = NULL; 1614 void *device = NULL;
1615 int error = 0;
1616
1617 mutex_lock(&acpi_scan_lock);
1619 1618
1620 if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device))) 1619 if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device)))
1621 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, 1620 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
1622 acpi_bus_check_add, NULL, NULL, &device); 1621 acpi_bus_check_add, NULL, NULL, &device);
1623 1622
1624 if (!device) 1623 if (!device)
1625 return -ENODEV; 1624 error = -ENODEV;
1626 1625 else if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL)))
1627 if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL)))
1628 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, 1626 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
1629 acpi_bus_device_attach, NULL, NULL, NULL); 1627 acpi_bus_device_attach, NULL, NULL, NULL);
1630 1628
1631 return 0; 1629 mutex_unlock(&acpi_scan_lock);
1630 return error;
1632} 1631}
1633EXPORT_SYMBOL(acpi_bus_scan); 1632EXPORT_SYMBOL(acpi_bus_scan);
1634 1633
@@ -1655,8 +1654,10 @@ static acpi_status acpi_bus_remove(acpi_handle handle, u32 lvl_not_used,
1655 return AE_OK; 1654 return AE_OK;
1656} 1655}
1657 1656
1658int acpi_bus_trim(struct acpi_device *start) 1657void acpi_bus_trim(struct acpi_device *start)
1659{ 1658{
1659 mutex_lock(&acpi_scan_lock);
1660
1660 /* 1661 /*
1661 * Execute acpi_bus_device_detach() as a post-order callback to detach 1662 * Execute acpi_bus_device_detach() as a post-order callback to detach
1662 * all ACPI drivers from the device nodes being removed. 1663 * all ACPI drivers from the device nodes being removed.
@@ -1671,7 +1672,8 @@ int acpi_bus_trim(struct acpi_device *start)
1671 acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, 1672 acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL,
1672 acpi_bus_remove, NULL, NULL); 1673 acpi_bus_remove, NULL, NULL);
1673 acpi_bus_remove(start->handle, 0, NULL, NULL); 1674 acpi_bus_remove(start->handle, 0, NULL, NULL);
1674 return 0; 1675
1676 mutex_unlock(&acpi_scan_lock);
1675} 1677}
1676EXPORT_SYMBOL_GPL(acpi_bus_trim); 1678EXPORT_SYMBOL_GPL(acpi_bus_trim);
1677 1679
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 9e2b1f6dbe41..d1a6f4a25da8 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -742,8 +742,7 @@ static int acpiphp_bus_add(struct acpiphp_func *func)
742 /* this shouldn't be in here, so remove 742 /* this shouldn't be in here, so remove
743 * the bus then re-add it... 743 * the bus then re-add it...
744 */ 744 */
745 ret_val = acpi_bus_trim(device); 745 acpi_bus_trim(device);
746 dbg("acpi_bus_trim return %x\n", ret_val);
747 } 746 }
748 747
749 ret_val = acpi_bus_scan(func->handle); 748 ret_val = acpi_bus_scan(func->handle);
@@ -772,11 +771,8 @@ static int acpiphp_bus_trim(acpi_handle handle)
772 return retval; 771 return retval;
773 } 772 }
774 773
775 retval = acpi_bus_trim(device); 774 acpi_bus_trim(device);
776 if (retval) 775 return 0;
777 err("cannot remove from acpi list\n");
778
779 return retval;
780} 776}
781 777
782static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) 778static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index fc76b1f7ef06..ad0a86ac5cce 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -386,7 +386,7 @@ int acpi_bus_register_driver(struct acpi_driver *driver);
386void acpi_bus_unregister_driver(struct acpi_driver *driver); 386void acpi_bus_unregister_driver(struct acpi_driver *driver);
387int acpi_bus_scan(acpi_handle handle); 387int acpi_bus_scan(acpi_handle handle);
388void acpi_bus_hot_remove_device(void *context); 388void acpi_bus_hot_remove_device(void *context);
389int acpi_bus_trim(struct acpi_device *start); 389void acpi_bus_trim(struct acpi_device *start);
390acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); 390acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
391int acpi_match_device_ids(struct acpi_device *device, 391int acpi_match_device_ids(struct acpi_device *device,
392 const struct acpi_device_id *ids); 392 const struct acpi_device_id *ids);