aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-09-21 15:29:40 -0400
committerLen Brown <len.brown@intel.com>2009-09-25 14:24:28 -0400
commit8e029bf0a611ea3995bd1fae0285cbaf6eed7f16 (patch)
treed66e4bb1e3f5c02252297b888be4d32cb79bbd3e
parent5c478f499c9e6a3ac542c940f7b434686f4967a5 (diff)
ACPI: convert acpi_bus_scan() to operate on an acpi_handle
This patch changes acpi_bus_scan() to take an acpi_handle rather than an acpi_device pointer. I plan to use acpi_bus_scan() in the hotplug path, and I'd rather not assume that notifications only go to nodes that already have acpi_devices. This will also help remove the special case for adding the root node. We currently add the root by hand before acpi_bus_scan(), but using a handle here means we can start the acpi_bus_scan() directly with the root even though it doesn't have an acpi_device yet. Note that acpi_bus_scan() currently adds and/or starts the *children* of its device argument. It doesn't do anything with the device itself. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/scan.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index f205b368894b..4fe73596c5d3 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1387,7 +1387,7 @@ end:
1387 return result; 1387 return result;
1388} 1388}
1389 1389
1390static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) 1390static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops)
1391{ 1391{
1392 acpi_status status = AE_OK; 1392 acpi_status status = AE_OK;
1393 struct acpi_device *parent = NULL; 1393 struct acpi_device *parent = NULL;
@@ -1396,13 +1396,16 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
1396 acpi_handle chandle = NULL; 1396 acpi_handle chandle = NULL;
1397 acpi_object_type type = 0; 1397 acpi_object_type type = 0;
1398 u32 level = 1; 1398 u32 level = 1;
1399 int ret;
1399 1400
1400 1401 /*
1401 if (!start) 1402 * We must have an acpi_device for the starting node already, and
1402 return -EINVAL; 1403 * we scan its children.
1403 1404 */
1404 parent = start; 1405 phandle = handle;
1405 phandle = start->handle; 1406 ret = acpi_bus_get_device(phandle, &parent);
1407 if (ret)
1408 return ret;
1406 1409
1407 /* 1410 /*
1408 * Parse through the ACPI namespace, identify all 'devices', and 1411 * Parse through the ACPI namespace, identify all 'devices', and
@@ -1516,7 +1519,7 @@ acpi_bus_add(struct acpi_device **child,
1516 1519
1517 result = acpi_add_single_object(child, handle, type, &ops); 1520 result = acpi_add_single_object(child, handle, type, &ops);
1518 if (!result) 1521 if (!result)
1519 result = acpi_bus_scan(*child, &ops); 1522 result = acpi_bus_scan((*child)->handle, &ops);
1520 1523
1521 return result; 1524 return result;
1522} 1525}
@@ -1527,16 +1530,13 @@ int acpi_bus_start(struct acpi_device *device)
1527 int result; 1530 int result;
1528 struct acpi_bus_ops ops; 1531 struct acpi_bus_ops ops;
1529 1532
1530 1533 memset(&ops, 0, sizeof(ops));
1531 if (!device) 1534 ops.acpi_op_start = 1;
1532 return -EINVAL;
1533 1535
1534 result = acpi_start_single_object(device); 1536 result = acpi_start_single_object(device);
1535 if (!result) { 1537 if (!result)
1536 memset(&ops, 0, sizeof(ops)); 1538 result = acpi_bus_scan(device->handle, &ops);
1537 ops.acpi_op_start = 1; 1539
1538 result = acpi_bus_scan(device, &ops);
1539 }
1540 return result; 1540 return result;
1541} 1541}
1542EXPORT_SYMBOL(acpi_bus_start); 1542EXPORT_SYMBOL(acpi_bus_start);
@@ -1653,7 +1653,7 @@ int __init acpi_scan_init(void)
1653 result = acpi_bus_scan_fixed(); 1653 result = acpi_bus_scan_fixed();
1654 1654
1655 if (!result) 1655 if (!result)
1656 result = acpi_bus_scan(acpi_root, &ops); 1656 result = acpi_bus_scan(acpi_root->handle, &ops);
1657 1657
1658 if (result) 1658 if (result)
1659 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); 1659 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);