]> rtime.felk.cvut.cz Git - linux-imx.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)
commitcecdb193c8d91a42d9489d00618cc3dfff92e55a
tree7d7e16d389efab64ff2c0799de50e0b19ab20077
parentae281795ec92d35dd1631401829124acab965b1f
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