Merge branch 'acpi-messages'

* acpi-messages:
  hwmon: acpi_power_meter: Get rid of ACPICA message printing
  IIO: acpi-als: Get rid of ACPICA message printing
  ACPI: utils: Introduce acpi_evaluation_failure_warn()
  ACPI: Drop unused ACPI_*_COMPONENT definitions and update documentation
  ACPI: sysfs: Get rid of ACPICA message printing
This commit is contained in:
Rafael J. Wysocki 2021-04-26 17:03:22 +02:00
commit ab497507c0
10 changed files with 61 additions and 75 deletions

View File

@ -1,18 +1,17 @@
.. SPDX-License-Identifier: GPL-2.0 .. SPDX-License-Identifier: GPL-2.0
================= ====================
ACPI Debug Output ACPI CA Debug Output
================= ====================
The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug The ACPI CA can generate debug output. This document describes how to use this
output. This document describes how to use this facility. facility.
Compile-time configuration Compile-time configuration
========================== ==========================
ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG. If this config The ACPI CA debug output is globally enabled by CONFIG_ACPI_DEBUG. If this
option is turned off, the debug messages are not even built into the config option is not set, the debug messages are not even built into the kernel.
kernel.
Boot- and run-time configuration Boot- and run-time configuration
================================ ================================
@ -27,16 +26,16 @@ debug_layer (component)
======================= =======================
The "debug_layer" is a mask that selects components of interest, e.g., a The "debug_layer" is a mask that selects components of interest, e.g., a
specific driver or part of the ACPI interpreter. To build the debug_layer specific part of the ACPI interpreter. To build the debug_layer bitmask, look
bitmask, look for the "#define _COMPONENT" in an ACPI source file. for the "#define _COMPONENT" in an ACPI source file.
You can set the debug_layer mask at boot-time using the acpi.debug_layer You can set the debug_layer mask at boot-time using the acpi.debug_layer
command line argument, and you can change it after boot by writing values command line argument, and you can change it after boot by writing values
to /sys/module/acpi/parameters/debug_layer. to /sys/module/acpi/parameters/debug_layer.
The possible components are defined in include/acpi/acoutput.h and The possible components are defined in include/acpi/acoutput.h.
include/acpi/acpi_drivers.h. Reading /sys/module/acpi/parameters/debug_layer
shows the supported mask values, currently these:: Reading /sys/module/acpi/parameters/debug_layer shows the supported mask values::
ACPI_UTILITIES 0x00000001 ACPI_UTILITIES 0x00000001
ACPI_HARDWARE 0x00000002 ACPI_HARDWARE 0x00000002
@ -52,11 +51,6 @@ shows the supported mask values, currently these::
ACPI_CA_DISASSEMBLER 0x00000800 ACPI_CA_DISASSEMBLER 0x00000800
ACPI_COMPILER 0x00001000 ACPI_COMPILER 0x00001000
ACPI_TOOLS 0x00002000 ACPI_TOOLS 0x00002000
ACPI_SBS_COMPONENT 0x00100000
ACPI_FAN_COMPONENT 0x00200000
ACPI_CONTAINER_COMPONENT 0x01000000
ACPI_SYSTEM_COMPONENT 0x02000000
ACPI_MEMORY_DEVICE_COMPONENT 0x08000000
debug_level debug_level
=========== ===========

View File

@ -256,8 +256,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
status = acpi_walk_resources(handle, METHOD_NAME__CRS, status = acpi_walk_resources(handle, METHOD_NAME__CRS,
acpi_pci_link_check_current, &irq); acpi_pci_link_check_current, &irq);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_handle_warn(handle, "_CRS evaluation failed: %s\n", acpi_evaluation_failure_warn(handle, "_CRS", status);
acpi_format_exception(status));
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }
@ -345,8 +344,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
/* check for total failure */ /* check for total failure */
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_handle_warn(handle, "_SRS evaluation failed: %s", acpi_evaluation_failure_warn(handle, "_SRS", status);
acpi_format_exception(status));
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }

View File

@ -67,9 +67,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
acpi_processor_ppc_in_use = true; acpi_processor_ppc_in_use = true;
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_handle_warn(pr->handle, acpi_evaluation_failure_warn(pr->handle, "_PPC", status);
"_PPC evaluation failed: %s\n",
acpi_format_exception(status));
return -ENODEV; return -ENODEV;
} }
} }
@ -199,8 +197,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_handle_warn(pr->handle, "_PCT evaluation failed: %s\n", acpi_evaluation_failure_warn(pr->handle, "_PCT", status);
acpi_format_exception(status));
return -ENODEV; return -ENODEV;
} }
@ -300,8 +297,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_handle_warn(pr->handle, "_PSS evaluation failed: %s\n", acpi_evaluation_failure_warn(pr->handle, "_PSS", status);
acpi_format_exception(status));
return -ENODEV; return -ENODEV;
} }

View File

@ -281,9 +281,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status != AE_NOT_FOUND) if (status != AE_NOT_FOUND)
acpi_handle_warn(pr->handle, acpi_evaluation_failure_warn(pr->handle, "_TPC", status);
"_TPC evaluation failed: %s\n",
acpi_format_exception(status));
return -ENODEV; return -ENODEV;
} }
@ -416,9 +414,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status != AE_NOT_FOUND) if (status != AE_NOT_FOUND)
acpi_handle_warn(pr->handle, acpi_evaluation_failure_warn(pr->handle, "_PTC", status);
"_PTC evaluation failed: %s\n",
acpi_format_exception(status));
return -ENODEV; return -ENODEV;
} }
@ -503,9 +499,7 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status != AE_NOT_FOUND) if (status != AE_NOT_FOUND)
acpi_handle_warn(pr->handle, acpi_evaluation_failure_warn(pr->handle, "_TSS", status);
"_TSS evaluation failed: %s\n",
acpi_format_exception(status));
return -ENODEV; return -ENODEV;
} }
@ -586,9 +580,7 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status != AE_NOT_FOUND) if (status != AE_NOT_FOUND)
acpi_handle_warn(pr->handle, acpi_evaluation_failure_warn(pr->handle, "_TSD", status);
"_TSD evaluation failed: %s\n",
acpi_format_exception(status));
return -ENODEV; return -ENODEV;
} }

View File

@ -12,9 +12,6 @@
#include "internal.h" #include "internal.h"
#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME("sysfs");
#ifdef CONFIG_ACPI_DEBUG #ifdef CONFIG_ACPI_DEBUG
/* /*
* ACPI debug sysfs I/F, including: * ACPI debug sysfs I/F, including:
@ -51,12 +48,6 @@ static const struct acpi_dlayer acpi_debug_layers[] = {
ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER), ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER),
ACPI_DEBUG_INIT(ACPI_COMPILER), ACPI_DEBUG_INIT(ACPI_COMPILER),
ACPI_DEBUG_INIT(ACPI_TOOLS), ACPI_DEBUG_INIT(ACPI_TOOLS),
ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT),
ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT),
ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT),
ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT),
ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT),
}; };
static const struct acpi_dlevel acpi_debug_levels[] = { static const struct acpi_dlevel acpi_debug_levels[] = {
@ -650,8 +641,7 @@ static int get_status(u32 index, acpi_event_status *ret,
if (index < num_gpes) { if (index < num_gpes) {
status = acpi_get_gpe_device(index, handle); status = acpi_get_gpe_device(index, handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, pr_warn("Invalid GPE 0x%x", index);
"Invalid GPE 0x%x", index));
return -ENXIO; return -ENXIO;
} }
status = acpi_get_gpe_status(*handle, index, ret); status = acpi_get_gpe_status(*handle, index, ret);

View File

@ -511,6 +511,20 @@ __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle,
EXPORT_SYMBOL(__acpi_handle_debug); EXPORT_SYMBOL(__acpi_handle_debug);
#endif #endif
/**
* acpi_evaluation_failure_warn - Log evaluation failure warning.
* @handle: Parent object handle.
* @name: Name of the object whose evaluation has failed.
* @status: Status value returned by the failing object evaluation.
*/
void acpi_evaluation_failure_warn(acpi_handle handle, const char *name,
acpi_status status)
{
acpi_handle_warn(handle, "%s evaluation failed: %s\n", name,
acpi_format_exception(status));
}
EXPORT_SYMBOL_GPL(acpi_evaluation_failure_warn);
/** /**
* acpi_has_method: Check whether @handle has a method named @name * acpi_has_method: Check whether @handle has a method named @name
* @handle: ACPI device handle * @handle: ACPI device handle

View File

@ -20,7 +20,6 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#define ACPI_POWER_METER_NAME "power_meter" #define ACPI_POWER_METER_NAME "power_meter"
ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
#define ACPI_POWER_METER_DEVICE_NAME "Power Meter" #define ACPI_POWER_METER_DEVICE_NAME "Power Meter"
#define ACPI_POWER_METER_CLASS "pwr_meter_resource" #define ACPI_POWER_METER_CLASS "pwr_meter_resource"
@ -114,7 +113,8 @@ static int update_avg_interval(struct acpi_power_meter_resource *resource)
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GAI", status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GAI",
NULL, &data); NULL, &data);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GAI")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GAI",
status);
return -ENODEV; return -ENODEV;
} }
@ -166,7 +166,8 @@ static ssize_t set_avg_interval(struct device *dev,
mutex_unlock(&resource->lock); mutex_unlock(&resource->lock);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PAI")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PAI",
status);
return -EINVAL; return -EINVAL;
} }
@ -186,7 +187,8 @@ static int update_cap(struct acpi_power_meter_resource *resource)
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GHL", status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GHL",
NULL, &data); NULL, &data);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GHL")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GHL",
status);
return -ENODEV; return -ENODEV;
} }
@ -237,7 +239,8 @@ static ssize_t set_cap(struct device *dev, struct device_attribute *devattr,
mutex_unlock(&resource->lock); mutex_unlock(&resource->lock);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SHL")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_SHL",
status);
return -EINVAL; return -EINVAL;
} }
@ -270,7 +273,8 @@ static int set_acpi_trip(struct acpi_power_meter_resource *resource)
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PTP", status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PTP",
&args, &data); &args, &data);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTP")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PTP",
status);
return -EINVAL; return -EINVAL;
} }
@ -322,7 +326,8 @@ static int update_meter(struct acpi_power_meter_resource *resource)
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PMM", status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PMM",
NULL, &data); NULL, &data);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMM")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMM",
status);
return -ENODEV; return -ENODEV;
} }
@ -549,7 +554,8 @@ static int read_domain_devices(struct acpi_power_meter_resource *resource)
status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMD", NULL, status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMD", NULL,
&buffer); &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMD")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMD",
status);
return -ENODEV; return -ENODEV;
} }
@ -745,7 +751,8 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMC", NULL, status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMC", NULL,
&buffer); &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMC")); acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMC",
status);
return -ENODEV; return -ENODEV;
} }
@ -765,7 +772,9 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
status = acpi_extract_package(pss, &format, &state); status = acpi_extract_package(pss, &format, &state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Invalid data")); dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME
"_PMC package parsing failed: %s\n",
acpi_format_exception(status));
res = -EFAULT; res = -EFAULT;
goto end; goto end;
} }

View File

@ -26,8 +26,6 @@
#define ACPI_ALS_DEVICE_NAME "acpi-als" #define ACPI_ALS_DEVICE_NAME "acpi-als"
#define ACPI_ALS_NOTIFY_ILLUMINANCE 0x80 #define ACPI_ALS_NOTIFY_ILLUMINANCE 0x80
ACPI_MODULE_NAME("acpi-als");
/* /*
* So far, there's only one channel in here, but the specification for * So far, there's only one channel in here, but the specification for
* ACPI0008 says there can be more to what the block can report. Like * ACPI0008 says there can be more to what the block can report. Like
@ -91,7 +89,7 @@ static int acpi_als_read_value(struct acpi_als *als, char *prop, s32 *val)
&temp_val); &temp_val);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Error reading ALS %s", prop)); acpi_evaluation_failure_warn(als->device->handle, prop, status);
return -EIO; return -EIO;
} }

View File

@ -11,16 +11,6 @@
#define ACPI_MAX_STRING 80 #define ACPI_MAX_STRING 80
/*
* Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst
* if you add to this list.
*/
#define ACPI_SBS_COMPONENT 0x00100000
#define ACPI_FAN_COMPONENT 0x00200000
#define ACPI_CONTAINER_COMPONENT 0x01000000
#define ACPI_SYSTEM_COMPONENT 0x02000000
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000
/* /*
* _HID definitions * _HID definitions
* HIDs must conform to ACPI spec(6.1.4) * HIDs must conform to ACPI spec(6.1.4)

View File

@ -1034,9 +1034,14 @@ static inline void acpi_ec_set_gpe_wake_mask(u8 action) {}
__printf(3, 4) __printf(3, 4)
void acpi_handle_printk(const char *level, acpi_handle handle, void acpi_handle_printk(const char *level, acpi_handle handle,
const char *fmt, ...); const char *fmt, ...);
void acpi_evaluation_failure_warn(acpi_handle handle, const char *name,
acpi_status status);
#else /* !CONFIG_ACPI */ #else /* !CONFIG_ACPI */
static inline __printf(3, 4) void static inline __printf(3, 4) void
acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
static inline void acpi_evaluation_failure_warn(acpi_handle handle,
const char *name,
acpi_status status) {}
#endif /* !CONFIG_ACPI */ #endif /* !CONFIG_ACPI */
#if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG) #if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)