aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-12-21 00:36:44 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-03 13:09:38 +0100
commit4002bf384cc567a843a7d16c95db54a7d77b16c6 (patch)
treef4652320c6ca43960d71ec520ac055a335a0dbe0 /drivers
parenta2d06a1a0851fb3d7e775b9d878cdffb9e0300ee (diff)
ACPI: Change the ordering of acpi_bus_check_add()
If acpi_bus_check_add() is called for a handle already having an existing struct acpi_device object attached, it is not necessary to check the type and status of the device correspondig to it, so change the ordering of acpi_bus_check_add() to avoid that. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Acked-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/scan.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7082d11ce5d..eb7ecb1f203 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1582,6 +1582,10 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
acpi_status status;
int result;
+ acpi_bus_get_device(handle, &device);
+ if (device)
+ goto out;
+
result = acpi_bus_type_and_status(handle, &type, &sta);
if (result)
return AE_OK;
@@ -1598,18 +1602,14 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
return AE_CTRL_DEPTH;
}
- acpi_bus_get_device(handle, &device);
- if (!device) {
- acpi_add_single_object(&device, handle, type, sta,
- ACPI_BUS_ADD_BASIC);
- if (!device)
- return AE_CTRL_DEPTH;
+ acpi_add_single_object(&device, handle, type, sta, ACPI_BUS_ADD_BASIC);
+ if (!device)
+ return AE_CTRL_DEPTH;
- device->add_type = context ?
- ACPI_BUS_ADD_START : ACPI_BUS_ADD_MATCH;
- acpi_hot_add_bind(device);
- }
+ device->add_type = context ? ACPI_BUS_ADD_START : ACPI_BUS_ADD_MATCH;
+ acpi_hot_add_bind(device);
+ out:
if (!*return_value)
*return_value = device;