diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-30 23:46:02 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-15 01:33:11 +0200 |
commit | 96c0a4d4902c3d5f56bde95d3e2d96689ca64b6d (patch) | |
tree | e9ef696424afa94c1c2ecc5917436c1f8d681738 /drivers/acpi/dock.c | |
parent | ACPI / dock: Drop the hp_lock mutex from struct dock_station (diff) | |
download | linux-96c0a4d4902c3d5f56bde95d3e2d96689ca64b6d.tar.xz linux-96c0a4d4902c3d5f56bde95d3e2d96689ca64b6d.zip |
ACPI / dock: Rework and simplify find_dock_devices()
Since acpi_walk_namespace() calls find_dock_devices() during tree
pre-order visit, the latter doesn't need to add devices whose
parents have _EJD pointing to the docking station to the list of
that station's dependent devices, because those parents are going to
be added to that list anyway and the removal of a parent will take
care of the removal of its children in those cases.
For this reason, rework find_dock_devices() to only call
add_dock_dependent_device() for devices whose _EJD point directy to
the docking station represented by its context argument and simplify
it slightly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r-- | drivers/acpi/dock.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index c10761533d6f..7c86d01346e6 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -741,29 +741,16 @@ static struct notifier_block dock_acpi_notifier = { * check to see if an object has an _EJD method. If it does, then it * will see if it is dependent on the dock station. */ -static acpi_status __init -find_dock_devices(acpi_handle handle, u32 lvl, void *context, void **rv) +static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl, + void *context, void **rv) { - acpi_status status; - acpi_handle tmp, parent; struct dock_station *ds = context; + acpi_handle ejd = NULL; - status = acpi_bus_get_ejd(handle, &tmp); - if (ACPI_FAILURE(status)) { - /* try the parent device as well */ - status = acpi_get_parent(handle, &parent); - if (ACPI_FAILURE(status)) - goto fdd_out; - /* see if parent is dependent on dock */ - status = acpi_bus_get_ejd(parent, &tmp); - if (ACPI_FAILURE(status)) - goto fdd_out; - } - - if (tmp == ds->handle) + acpi_bus_get_ejd(handle, &ejd); + if (ejd == ds->handle) add_dock_dependent_device(ds, handle); -fdd_out: return AE_OK; } |