Skip to content

Commit

Permalink
ACPI: Change the ordering of acpi_bus_check_add()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Jan 3, 2013
1 parent a2d06a1 commit 4002bf3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 4002bf3

Please sign in to comment.