From 33f767d767e9a684e9cd60704d4c049a2014c8d5 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Thu, 10 Jan 2013 13:13:49 +0100 Subject: ACPI: Rework acpi_get_child() to be more efficient Observe that acpi_get_child() doesn't need to use the helper struct acpi_find_child structure and change it to work without it. Also, using acpi_get_object_info() to get the output of _ADR for the given device is overkill, because that function does much more than just evaluating _ADR (let alone the additional memory allocation done by it). Moreover, acpi_get_child() doesn't need to loop any more once it has found a matching handle, so make it stop in that case. To prevent the results from changing, make it use do_acpi_find_child() as a post-order callback. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/glue.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 35da18113216..e9e486f79b35 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -95,40 +95,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) -- cgit v1.2.3-59-g8ed1b From 208f6cc9e5f83c9e2fb3a997dde3d4f6f5971384 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Wed, 9 Jan 2013 22:06:08 +0000 Subject: ACPI: SRAT: report non-volatile memory in debug Just as with the other memory affinity flags, report non-volatile memory with ACPI debug. Signed-off-by: Davidlohr Bueso Signed-off-by: Rafael J. Wysocki --- drivers/acpi/numa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index cb31298ca684..2935d3a2bd7a 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -116,14 +116,16 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) struct acpi_srat_mem_affinity *p = (struct acpi_srat_mem_affinity *)header; ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s\n", + "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n", (unsigned long)p->base_address, (unsigned long)p->length, p->proximity_domain, (p->flags & ACPI_SRAT_MEM_ENABLED)? "enabled" : "disabled", (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)? - " hot-pluggable" : "")); + " hot-pluggable" : "", + (p->flags & ACPI_SRAT_MEM_NON_VOLATILE)? + " non-volatile" : "")); } #endif /* ACPI_DEBUG_OUTPUT */ break; -- cgit v1.2.3-59-g8ed1b From bf6787ebb6c811ce41bc3f3f833a04d5f8978fa8 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 29 Nov 2012 11:53:13 +0000 Subject: ACPI video: remove unnecessary newline from error messages ACPI_ERROR() already appends a newline, so there is no need for the error messages to include one too. Signed-off-by: Colin Ian King Signed-off-by: Rafael J. Wysocki --- drivers/acpi/video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index ac9a69cd45f5..b03bb26365ae 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -673,7 +673,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) br->levels[i] = br->levels[i - level_ac_battery]; count += level_ac_battery; } else if (level_ac_battery > 2) - ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package\n")); + ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package")); /* Check if the _BCL package is in a reversed order */ if (max_level == br->levels[2]) { @@ -682,7 +682,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) acpi_video_cmp_level, NULL); } else if (max_level != br->levels[count - 1]) ACPI_ERROR((AE_INFO, - "Found unordered _BCL package\n")); + "Found unordered _BCL package")); br->count = count; device->brightness = br; -- cgit v1.2.3-59-g8ed1b From c628423777d9df5e48ea8c5695aacd105cf4f768 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 29 Nov 2012 11:53:14 +0000 Subject: ACPI sysfs: remove unnecessary newline from exception ACPI_EXCEPTION() already appends a newline, so there is no need for the invalid GPE message to include one too. Signed-off-by: Colin Ian King Signed-off-by: Rafael J. Wysocki --- drivers/acpi/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index ea61ca9129cd..41c0504470db 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -498,7 +498,7 @@ static int get_status(u32 index, acpi_event_status *status, result = acpi_get_gpe_device(index, handle); if (result) { ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, - "Invalid GPE 0x%x\n", index)); + "Invalid GPE 0x%x", index)); goto end; } result = acpi_get_gpe_status(*handle, index, status); -- cgit v1.2.3-59-g8ed1b From 7e3cf246b532a640ff1176d0b988aa0a9338e36f Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 29 Nov 2012 11:53:16 +0000 Subject: ACPI thermal: remove unnecessary newline from exception message ACPI_EXCEPTION() already appends a newline, so there is no need for the thermal trip point message to include one too. Signed-off-by: Colin Ian King Signed-off-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 506fbd4b5733..f46c44048e44 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -288,7 +288,7 @@ do { \ if (flags != ACPI_TRIPS_INIT) \ ACPI_EXCEPTION((AE_INFO, AE_ERROR, \ "ACPI thermal trip point %s changed\n" \ - "Please send acpidump to linux-acpi@vger.kernel.org\n", str)); \ + "Please send acpidump to linux-acpi@vger.kernel.org", str)); \ } while (0) static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) -- cgit v1.2.3-59-g8ed1b From ca4e713080dd7f23cd1cf5d3871e0b717ee9b254 Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada Date: Tue, 15 Jan 2013 23:57:16 +0100 Subject: ACPI / thermal: Use mode to enable/disable kernel thermal processing As per documentation, "mode" sysfs interface should be able to enable/disable thermal processing in the kernel, so that user space is able to take more control. Currently, ACPI thermal driver is not following this setting, so modify it to match the interface documentation. Signed-off-by: Srinivas Pandruvada Signed-off-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index f46c44048e44..dc047336cc37 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -531,6 +531,10 @@ static void acpi_thermal_check(void *data) { struct acpi_thermal *tz = data; + if (!tz->tz_enabled) { + pr_warn("thermal zone is disabled \n"); + return; + } thermal_zone_device_update(tz->thermal_zone); } -- cgit v1.2.3-59-g8ed1b From 5baa1be1cf4d118002503198bd3843e105868f65 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Thu, 17 Jan 2013 14:24:05 +0100 Subject: ACPI: fix obsolete comment in custom_method.c The comment describing the contents of the custom_method.c file is obsolete, so update it. [rjw: Subject and changelog] Signed-off-by: Zhang Rui Signed-off-by: Rafael J. Wysocki --- drivers/acpi/custom_method.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index 5d42c2414ae5..6adfc706a1de 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c @@ -1,5 +1,5 @@ /* - * debugfs.c - ACPI debugfs interface to userspace. + * custom_method.c - debugfs interface for customizing ACPI control method */ #include -- cgit v1.2.3-59-g8ed1b From 66f2fda93b67fa744d406e6dcf443f67bac204b6 Mon Sep 17 00:00:00 2001 From: Joseph Salisbury Date: Tue, 5 Feb 2013 00:16:29 +0000 Subject: ACPI: Add DMI entry for Sony VGN-FW41E_H This patch adds a quirk to allow the Sony VGN-FW41E_H to suspend/resume properly. References: http://bugs.launchpad.net/bugs/1113547 Signed-off-by: Joseph Salisbury Cc: All Signed-off-by: Rafael J. Wysocki --- drivers/acpi/sleep.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 2fcc67d34b11..df8505147b27 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -177,6 +177,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { }, { .callback = init_nvs_nosave, + .ident = "Sony Vaio VGN-FW41E_H", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW41E_H"), + }, + }, + { + .callback = init_nvs_nosave, .ident = "Sony Vaio VGN-FW21E", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), -- cgit v1.2.3-59-g8ed1b