]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI / scan: Change the implementation of acpi_bus_trim()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 15 Jan 2013 12:24:02 +0000 (13:24 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 15 Jan 2013 12:24:02 +0000 (13:24 +0100)
commit19e4a47e0fa876158611d9eb694f2d3b7bf06fe5
tree7d7e16d389efab64ff2c0799de50e0b19ab20077
parent24a79a133400336d9ae4a150b18ba3e47d668018
ACPI / scan: Change the implementation of acpi_bus_trim()

The current acpi_bus_trim() implementation is not really
straightforward and may be simplified significantly by using
acpi_walk_namespace() with acpi_bus_remove() as a post-order
callback.

Observe that acpi_bus_remove(), as called by acpi_bus_trim(), cannot
actually fail, because its first argument is guaranteed not to be
NULL thanks to the acpi_bus_get_device() check in acpi_bus_trim(),
so simply move the acpi_bus_get_device() check to acpi_bus_remove()
and use acpi_walk_namespace() to execute it for every device under
start->handle as a post-order callback.  The, run it directly for
start->handle itself.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
drivers/acpi/scan.c