diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-12-20 18:36:44 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-03 07:09:38 -0500 |
commit | 4002bf384cc567a843a7d16c95db54a7d77b16c6 (patch) | |
tree | f4652320c6ca43960d71ec520ac055a335a0dbe0 /drivers/acpi/scan.c | |
parent | a2d06a1a0851fb3d7e775b9d878cdffb9e0300ee (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/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 7082d11ce5d2..eb7ecb1f2032 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, | |||
1582 | acpi_status status; | 1582 | acpi_status status; |
1583 | int result; | 1583 | int result; |
1584 | 1584 | ||
1585 | acpi_bus_get_device(handle, &device); | ||
1586 | if (device) | ||
1587 | goto out; | ||
1588 | |||
1585 | result = acpi_bus_type_and_status(handle, &type, &sta); | 1589 | result = acpi_bus_type_and_status(handle, &type, &sta); |
1586 | if (result) | 1590 | if (result) |
1587 | return AE_OK; | 1591 | return AE_OK; |
@@ -1598,18 +1602,14 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl, | |||
1598 | return AE_CTRL_DEPTH; | 1602 | return AE_CTRL_DEPTH; |
1599 | } | 1603 | } |
1600 | 1604 | ||
1601 | acpi_bus_get_device(handle, &device); | 1605 | acpi_add_single_object(&device, handle, type, sta, ACPI_BUS_ADD_BASIC); |
1602 | if (!device) { | 1606 | if (!device) |
1603 | acpi_add_single_object(&device, handle, type, sta, | 1607 | return AE_CTRL_DEPTH; |
1604 | ACPI_BUS_ADD_BASIC); | ||
1605 | if (!device) | ||
1606 | return AE_CTRL_DEPTH; | ||
1607 | 1608 | ||
1608 | device->add_type = context ? | 1609 | device->add_type = context ? ACPI_BUS_ADD_START : ACPI_BUS_ADD_MATCH; |
1609 | ACPI_BUS_ADD_START : ACPI_BUS_ADD_MATCH; | 1610 | acpi_hot_add_bind(device); |
1610 | acpi_hot_add_bind(device); | ||
1611 | } | ||
1612 | 1611 | ||
1612 | out: | ||
1613 | if (!*return_value) | 1613 | if (!*return_value) |
1614 | *return_value = device; | 1614 | *return_value = device; |
1615 | 1615 | ||