diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-15 13:58:43 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-15 13:58:43 +0100 |
commit | a68d35323b091f51e0957313f0f871f187879143 (patch) | |
tree | 837f44a7eee4a51ee2aa3c61e5d759a091b540e1 /drivers/acpi/glue.c | |
parent | e8f71df723339b6d3861886f58c245812d1994f8 (diff) | |
parent | 66f2fda93b67fa744d406e6dcf443f67bac204b6 (diff) | |
download | linux-a68d35323b091f51e0957313f0f871f187879143.tar.bz2 |
Merge branch 'acpi-assorted'
* acpi-assorted:
ACPI: Add DMI entry for Sony VGN-FW41E_H
ACPI: fix obsolete comment in custom_method.c
ACPI / thermal: Use mode to enable/disable kernel thermal processing
ACPI thermal: remove unnecessary newline from exception message
ACPI sysfs: remove unnecessary newline from exception
ACPI video: remove unnecessary newline from error messages
ACPI: SRAT: report non-volatile memory in debug
ACPI: Rework acpi_get_child() to be more efficient
Diffstat (limited to 'drivers/acpi/glue.c')
-rw-r--r-- | drivers/acpi/glue.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 9aee4fc2b218..ef6f155469b5 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -98,40 +98,31 @@ static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) return ret; } -/* Get device's handler per its address under its parent */ -struct acpi_find_child { - acpi_handle handle; - u64 address; -}; - -static acpi_status -do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) +static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, + void *addr_p, void **ret_p) { + unsigned long long addr; acpi_status status; - struct acpi_device_info *info; - struct acpi_find_child *find = context; - - status = acpi_get_object_info(handle, &info); - if (ACPI_SUCCESS(status)) { - if ((info->address == find->address) - && (info->valid & ACPI_VALID_ADR)) - find->handle = handle; - kfree(info); + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); + if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { + *ret_p = handle; + return AE_CTRL_TERMINATE; } return AE_OK; } acpi_handle acpi_get_child(acpi_handle parent, u64 address) { - struct acpi_find_child find = { NULL, address }; + void *ret = NULL; if (!parent) return NULL; - acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, - 1, do_acpi_find_child, NULL, &find, NULL); - return find.handle; -} + acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, + do_acpi_find_child, &address, &ret); + return (acpi_handle)ret; +} EXPORT_SYMBOL(acpi_get_child); static int acpi_bind_one(struct device *dev, acpi_handle handle) |