aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-09-21 15:30:11 -0400
committerLen Brown <len.brown@intel.com>2009-09-25 14:24:32 -0400
commite3b87f8a9d5a61f6367c66d1bb0a4e19d251194d (patch)
tree9054b93f90f9de3b536f656727c947c1d34b4519 /drivers/acpi
parent778cbc1d3abd434b6d882714630235e3711bb15b (diff)
ACPI: handle re-enumeration, when acpi_devices might already exist
acpi_bus_scan() traverses the namespace to enumerate devices and uses acpi_add_single_object() to create acpi_devices. When the platform notifies us of a hot-plug event, we need to traverse part of the namespace again to figure out what appeared or disappeared. (We don't yet call acpi_bus_scan() during hot-plug, but I plan to do that in the future.) This patch makes acpi_add_single_object() notice when we already have an acpi_device, so we don't need to make a new one. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/scan.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 954bd01f295a..2c4cac576a7e 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1400,10 +1400,10 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
1400 void *context, void **return_value) 1400 void *context, void **return_value)
1401{ 1401{
1402 struct acpi_bus_ops *ops = context; 1402 struct acpi_bus_ops *ops = context;
1403 struct acpi_device *device = NULL;
1404 acpi_status status;
1405 int type; 1403 int type;
1406 unsigned long long sta; 1404 unsigned long long sta;
1405 struct acpi_device *device;
1406 acpi_status status;
1407 int result; 1407 int result;
1408 1408
1409 result = acpi_bus_type_and_status(handle, &type, &sta); 1409 result = acpi_bus_type_and_status(handle, &type, &sta);
@@ -1414,13 +1414,16 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
1414 !(sta & ACPI_STA_DEVICE_FUNCTIONING)) 1414 !(sta & ACPI_STA_DEVICE_FUNCTIONING))
1415 return AE_CTRL_DEPTH; 1415 return AE_CTRL_DEPTH;
1416 1416
1417 if (ops->acpi_op_add) 1417 /*
1418 status = acpi_add_single_object(&device, handle, type, sta, 1418 * We may already have an acpi_device from a previous enumeration. If
1419 ops); 1419 * so, we needn't add it again, but we may still have to start it.
1420 else 1420 */
1421 status = acpi_bus_get_device(handle, &device); 1421 device = NULL;
1422 acpi_bus_get_device(handle, &device);
1423 if (ops->acpi_op_add && !device)
1424 acpi_add_single_object(&device, handle, type, sta, ops);
1422 1425
1423 if (ACPI_FAILURE(status)) 1426 if (!device)
1424 return AE_CTRL_DEPTH; 1427 return AE_CTRL_DEPTH;
1425 1428
1426 if (ops->acpi_op_start && !(ops->acpi_op_add)) { 1429 if (ops->acpi_op_start && !(ops->acpi_op_add)) {