diff options
author | Thomas Renninger <trenn@suse.de> | 2010-01-29 11:48:52 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-01-31 21:43:32 -0500 |
commit | 7779688fc3d1ceddad84846a7b0affbe8e78ec6e (patch) | |
tree | fff56e1fea8656749666280b857ecac04560e70a | |
parent | d2f6650a950dadd20667a04a9dc785f240d43695 (diff) |
ACPI: acpi_bus_{scan,bus,add}: return -ENODEV if no device was found
Callers (acpi_memhotplug.c, dock.c and others) check for the return
value of acpi_bus_add() and assume a valid device was returned in
case zero was returned.
Thus return -ENODEV if no device was found in acpi_bus_scan and
propagate this through acpi_bus_add and acpi_bus_start.
Also remove a confusing comment in acpiphp_glue.c, acpi_bus_scan
will and cannot invoke if acpi_bus_add returns no valid device.
Signed-off-by: Thomas Renninger <trenn@suse.de>
Acked-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/acpi/scan.c | 24 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 6 |
2 files changed, 19 insertions, 11 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 8044583f3034..3e009674f333 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1336,9 +1336,25 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops, | |||
1336 | 1336 | ||
1337 | if (child) | 1337 | if (child) |
1338 | *child = device; | 1338 | *child = device; |
1339 | return 0; | 1339 | |
1340 | if (device) | ||
1341 | return 0; | ||
1342 | else | ||
1343 | return -ENODEV; | ||
1340 | } | 1344 | } |
1341 | 1345 | ||
1346 | /* | ||
1347 | * acpi_bus_add and acpi_bus_start | ||
1348 | * | ||
1349 | * scan a given ACPI tree and (probably recently hot-plugged) | ||
1350 | * create and add or starts found devices. | ||
1351 | * | ||
1352 | * If no devices were found -ENODEV is returned which does not | ||
1353 | * mean that this is a real error, there just have been no suitable | ||
1354 | * ACPI objects in the table trunk from which the kernel could create | ||
1355 | * a device and add/start an appropriate driver. | ||
1356 | */ | ||
1357 | |||
1342 | int | 1358 | int |
1343 | acpi_bus_add(struct acpi_device **child, | 1359 | acpi_bus_add(struct acpi_device **child, |
1344 | struct acpi_device *parent, acpi_handle handle, int type) | 1360 | struct acpi_device *parent, acpi_handle handle, int type) |
@@ -1348,8 +1364,7 @@ acpi_bus_add(struct acpi_device **child, | |||
1348 | memset(&ops, 0, sizeof(ops)); | 1364 | memset(&ops, 0, sizeof(ops)); |
1349 | ops.acpi_op_add = 1; | 1365 | ops.acpi_op_add = 1; |
1350 | 1366 | ||
1351 | acpi_bus_scan(handle, &ops, child); | 1367 | return acpi_bus_scan(handle, &ops, child); |
1352 | return 0; | ||
1353 | } | 1368 | } |
1354 | EXPORT_SYMBOL(acpi_bus_add); | 1369 | EXPORT_SYMBOL(acpi_bus_add); |
1355 | 1370 | ||
@@ -1363,8 +1378,7 @@ int acpi_bus_start(struct acpi_device *device) | |||
1363 | memset(&ops, 0, sizeof(ops)); | 1378 | memset(&ops, 0, sizeof(ops)); |
1364 | ops.acpi_op_start = 1; | 1379 | ops.acpi_op_start = 1; |
1365 | 1380 | ||
1366 | acpi_bus_scan(device->handle, &ops, NULL); | 1381 | return acpi_bus_scan(device->handle, &ops, NULL); |
1367 | return 0; | ||
1368 | } | 1382 | } |
1369 | EXPORT_SYMBOL(acpi_bus_start); | 1383 | EXPORT_SYMBOL(acpi_bus_start); |
1370 | 1384 | ||
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 8e952fdab764..cb2fd01eddae 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -720,12 +720,6 @@ static int acpiphp_bus_add(struct acpiphp_func *func) | |||
720 | -ret_val); | 720 | -ret_val); |
721 | goto acpiphp_bus_add_out; | 721 | goto acpiphp_bus_add_out; |
722 | } | 722 | } |
723 | /* | ||
724 | * try to start anyway. We could have failed to add | ||
725 | * simply because this bus had previously been added | ||
726 | * on another add. Don't bother with the return value | ||
727 | * we just keep going. | ||
728 | */ | ||
729 | ret_val = acpi_bus_start(device); | 723 | ret_val = acpi_bus_start(device); |
730 | 724 | ||
731 | acpiphp_bus_add_out: | 725 | acpiphp_bus_add_out: |