]> 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)
commit17c92a8476a671d7f1a2c60d9c927040eed3e12d
tree7d7e16d389efab64ff2c0799de50e0b19ab20077
parent159bc34a597ad8b0e467adeed064d467244a9bc7
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