Skip to content

Commit ab49750

Browse files
committed
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
2 parents 25d9576 + ebf1bef commit ab49750

10 files changed

Lines changed: 61 additions & 75 deletions

File tree

Documentation/firmware-guide/acpi/debug.rst

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
.. SPDX-License-Identifier: GPL-2.0
22
3-
=================
4-
ACPI Debug Output
5-
=================
3+
====================
4+
ACPI CA Debug Output
5+
====================
66

7-
The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug
8-
output. This document describes how to use this facility.
7+
The ACPI CA can generate debug output. This document describes how to use this
8+
facility.
99

1010
Compile-time configuration
1111
==========================
1212

13-
ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG. If this config
14-
option is turned off, the debug messages are not even built into the
15-
kernel.
13+
The ACPI CA debug output is globally enabled by CONFIG_ACPI_DEBUG. If this
14+
config option is not set, the debug messages are not even built into the kernel.
1615

1716
Boot- and run-time configuration
1817
================================
@@ -27,16 +26,16 @@ debug_layer (component)
2726
=======================
2827

2928
The "debug_layer" is a mask that selects components of interest, e.g., a
30-
specific driver or part of the ACPI interpreter. To build the debug_layer
31-
bitmask, look for the "#define _COMPONENT" in an ACPI source file.
29+
specific part of the ACPI interpreter. To build the debug_layer bitmask, look
30+
for the "#define _COMPONENT" in an ACPI source file.
3231

3332
You can set the debug_layer mask at boot-time using the acpi.debug_layer
3433
command line argument, and you can change it after boot by writing values
3534
to /sys/module/acpi/parameters/debug_layer.
3635

37-
The possible components are defined in include/acpi/acoutput.h and
38-
include/acpi/acpi_drivers.h. Reading /sys/module/acpi/parameters/debug_layer
39-
shows the supported mask values, currently these::
36+
The possible components are defined in include/acpi/acoutput.h.
37+
38+
Reading /sys/module/acpi/parameters/debug_layer shows the supported mask values::
4039

4140
ACPI_UTILITIES 0x00000001
4241
ACPI_HARDWARE 0x00000002
@@ -52,11 +51,6 @@ shows the supported mask values, currently these::
5251
ACPI_CA_DISASSEMBLER 0x00000800
5352
ACPI_COMPILER 0x00001000
5453
ACPI_TOOLS 0x00002000
55-
ACPI_SBS_COMPONENT 0x00100000
56-
ACPI_FAN_COMPONENT 0x00200000
57-
ACPI_CONTAINER_COMPONENT 0x01000000
58-
ACPI_SYSTEM_COMPONENT 0x02000000
59-
ACPI_MEMORY_DEVICE_COMPONENT 0x08000000
6054

6155
debug_level
6256
===========

drivers/acpi/pci_link.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
256256
status = acpi_walk_resources(handle, METHOD_NAME__CRS,
257257
acpi_pci_link_check_current, &irq);
258258
if (ACPI_FAILURE(status)) {
259-
acpi_handle_warn(handle, "_CRS evaluation failed: %s\n",
260-
acpi_format_exception(status));
259+
acpi_evaluation_failure_warn(handle, "_CRS", status);
261260
result = -ENODEV;
262261
goto end;
263262
}
@@ -345,8 +344,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
345344

346345
/* check for total failure */
347346
if (ACPI_FAILURE(status)) {
348-
acpi_handle_warn(handle, "_SRS evaluation failed: %s",
349-
acpi_format_exception(status));
347+
acpi_evaluation_failure_warn(handle, "_SRS", status);
350348
result = -ENODEV;
351349
goto end;
352350
}

drivers/acpi/processor_perflib.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
6767
acpi_processor_ppc_in_use = true;
6868

6969
if (ACPI_FAILURE(status)) {
70-
acpi_handle_warn(pr->handle,
71-
"_PPC evaluation failed: %s\n",
72-
acpi_format_exception(status));
70+
acpi_evaluation_failure_warn(pr->handle, "_PPC", status);
7371
return -ENODEV;
7472
}
7573
}
@@ -199,8 +197,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
199197

200198
status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
201199
if (ACPI_FAILURE(status)) {
202-
acpi_handle_warn(pr->handle, "_PCT evaluation failed: %s\n",
203-
acpi_format_exception(status));
200+
acpi_evaluation_failure_warn(pr->handle, "_PCT", status);
204201
return -ENODEV;
205202
}
206203

@@ -300,8 +297,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
300297

301298
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
302299
if (ACPI_FAILURE(status)) {
303-
acpi_handle_warn(pr->handle, "_PSS evaluation failed: %s\n",
304-
acpi_format_exception(status));
300+
acpi_evaluation_failure_warn(pr->handle, "_PSS", status);
305301
return -ENODEV;
306302
}
307303

drivers/acpi/processor_throttling.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
281281
status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
282282
if (ACPI_FAILURE(status)) {
283283
if (status != AE_NOT_FOUND)
284-
acpi_handle_warn(pr->handle,
285-
"_TPC evaluation failed: %s\n",
286-
acpi_format_exception(status));
284+
acpi_evaluation_failure_warn(pr->handle, "_TPC", status);
287285

288286
return -ENODEV;
289287
}
@@ -416,9 +414,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
416414
status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
417415
if (ACPI_FAILURE(status)) {
418416
if (status != AE_NOT_FOUND)
419-
acpi_handle_warn(pr->handle,
420-
"_PTC evaluation failed: %s\n",
421-
acpi_format_exception(status));
417+
acpi_evaluation_failure_warn(pr->handle, "_PTC", status);
422418

423419
return -ENODEV;
424420
}
@@ -503,9 +499,7 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
503499
status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
504500
if (ACPI_FAILURE(status)) {
505501
if (status != AE_NOT_FOUND)
506-
acpi_handle_warn(pr->handle,
507-
"_TSS evaluation failed: %s\n",
508-
acpi_format_exception(status));
502+
acpi_evaluation_failure_warn(pr->handle, "_TSS", status);
509503

510504
return -ENODEV;
511505
}
@@ -586,9 +580,7 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
586580
status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
587581
if (ACPI_FAILURE(status)) {
588582
if (status != AE_NOT_FOUND)
589-
acpi_handle_warn(pr->handle,
590-
"_TSD evaluation failed: %s\n",
591-
acpi_format_exception(status));
583+
acpi_evaluation_failure_warn(pr->handle, "_TSD", status);
592584

593585
return -ENODEV;
594586
}

drivers/acpi/sysfs.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
#include "internal.h"
1414

15-
#define _COMPONENT ACPI_SYSTEM_COMPONENT
16-
ACPI_MODULE_NAME("sysfs");
17-
1815
#ifdef CONFIG_ACPI_DEBUG
1916
/*
2017
* ACPI debug sysfs I/F, including:
@@ -51,12 +48,6 @@ static const struct acpi_dlayer acpi_debug_layers[] = {
5148
ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER),
5249
ACPI_DEBUG_INIT(ACPI_COMPILER),
5350
ACPI_DEBUG_INIT(ACPI_TOOLS),
54-
55-
ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT),
56-
ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT),
57-
ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT),
58-
ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT),
59-
ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT),
6051
};
6152

6253
static const struct acpi_dlevel acpi_debug_levels[] = {
@@ -650,8 +641,7 @@ static int get_status(u32 index, acpi_event_status *ret,
650641
if (index < num_gpes) {
651642
status = acpi_get_gpe_device(index, handle);
652643
if (ACPI_FAILURE(status)) {
653-
ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND,
654-
"Invalid GPE 0x%x", index));
644+
pr_warn("Invalid GPE 0x%x", index);
655645
return -ENXIO;
656646
}
657647
status = acpi_get_gpe_status(*handle, index, ret);

drivers/acpi/utils.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,20 @@ __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle,
511511
EXPORT_SYMBOL(__acpi_handle_debug);
512512
#endif
513513

514+
/**
515+
* acpi_evaluation_failure_warn - Log evaluation failure warning.
516+
* @handle: Parent object handle.
517+
* @name: Name of the object whose evaluation has failed.
518+
* @status: Status value returned by the failing object evaluation.
519+
*/
520+
void acpi_evaluation_failure_warn(acpi_handle handle, const char *name,
521+
acpi_status status)
522+
{
523+
acpi_handle_warn(handle, "%s evaluation failed: %s\n", name,
524+
acpi_format_exception(status));
525+
}
526+
EXPORT_SYMBOL_GPL(acpi_evaluation_failure_warn);
527+
514528
/**
515529
* acpi_has_method: Check whether @handle has a method named @name
516530
* @handle: ACPI device handle

drivers/hwmon/acpi_power_meter.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/acpi.h>
2121

2222
#define ACPI_POWER_METER_NAME "power_meter"
23-
ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
2423
#define ACPI_POWER_METER_DEVICE_NAME "Power Meter"
2524
#define ACPI_POWER_METER_CLASS "pwr_meter_resource"
2625

@@ -114,7 +113,8 @@ static int update_avg_interval(struct acpi_power_meter_resource *resource)
114113
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GAI",
115114
NULL, &data);
116115
if (ACPI_FAILURE(status)) {
117-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GAI"));
116+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GAI",
117+
status);
118118
return -ENODEV;
119119
}
120120

@@ -166,7 +166,8 @@ static ssize_t set_avg_interval(struct device *dev,
166166
mutex_unlock(&resource->lock);
167167

168168
if (ACPI_FAILURE(status)) {
169-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PAI"));
169+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PAI",
170+
status);
170171
return -EINVAL;
171172
}
172173

@@ -186,7 +187,8 @@ static int update_cap(struct acpi_power_meter_resource *resource)
186187
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GHL",
187188
NULL, &data);
188189
if (ACPI_FAILURE(status)) {
189-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GHL"));
190+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GHL",
191+
status);
190192
return -ENODEV;
191193
}
192194

@@ -237,7 +239,8 @@ static ssize_t set_cap(struct device *dev, struct device_attribute *devattr,
237239
mutex_unlock(&resource->lock);
238240

239241
if (ACPI_FAILURE(status)) {
240-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SHL"));
242+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_SHL",
243+
status);
241244
return -EINVAL;
242245
}
243246

@@ -270,7 +273,8 @@ static int set_acpi_trip(struct acpi_power_meter_resource *resource)
270273
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PTP",
271274
&args, &data);
272275
if (ACPI_FAILURE(status)) {
273-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTP"));
276+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PTP",
277+
status);
274278
return -EINVAL;
275279
}
276280

@@ -322,7 +326,8 @@ static int update_meter(struct acpi_power_meter_resource *resource)
322326
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PMM",
323327
NULL, &data);
324328
if (ACPI_FAILURE(status)) {
325-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMM"));
329+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMM",
330+
status);
326331
return -ENODEV;
327332
}
328333

@@ -549,7 +554,8 @@ static int read_domain_devices(struct acpi_power_meter_resource *resource)
549554
status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMD", NULL,
550555
&buffer);
551556
if (ACPI_FAILURE(status)) {
552-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMD"));
557+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMD",
558+
status);
553559
return -ENODEV;
554560
}
555561

@@ -745,7 +751,8 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
745751
status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMC", NULL,
746752
&buffer);
747753
if (ACPI_FAILURE(status)) {
748-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMC"));
754+
acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMC",
755+
status);
749756
return -ENODEV;
750757
}
751758

@@ -765,7 +772,9 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
765772

766773
status = acpi_extract_package(pss, &format, &state);
767774
if (ACPI_FAILURE(status)) {
768-
ACPI_EXCEPTION((AE_INFO, status, "Invalid data"));
775+
dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME
776+
"_PMC package parsing failed: %s\n",
777+
acpi_format_exception(status));
769778
res = -EFAULT;
770779
goto end;
771780
}

drivers/iio/light/acpi-als.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#define ACPI_ALS_DEVICE_NAME "acpi-als"
2727
#define ACPI_ALS_NOTIFY_ILLUMINANCE 0x80
2828

29-
ACPI_MODULE_NAME("acpi-als");
30-
3129
/*
3230
* So far, there's only one channel in here, but the specification for
3331
* 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)
9189
&temp_val);
9290

9391
if (ACPI_FAILURE(status)) {
94-
ACPI_EXCEPTION((AE_INFO, status, "Error reading ALS %s", prop));
92+
acpi_evaluation_failure_warn(als->device->handle, prop, status);
9593
return -EIO;
9694
}
9795

include/acpi/acpi_drivers.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@
1111

1212
#define ACPI_MAX_STRING 80
1313

14-
/*
15-
* Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst
16-
* if you add to this list.
17-
*/
18-
#define ACPI_SBS_COMPONENT 0x00100000
19-
#define ACPI_FAN_COMPONENT 0x00200000
20-
#define ACPI_CONTAINER_COMPONENT 0x01000000
21-
#define ACPI_SYSTEM_COMPONENT 0x02000000
22-
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000
23-
2414
/*
2515
* _HID definitions
2616
* HIDs must conform to ACPI spec(6.1.4)

include/linux/acpi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,14 @@ static inline void acpi_ec_set_gpe_wake_mask(u8 action) {}
10341034
__printf(3, 4)
10351035
void acpi_handle_printk(const char *level, acpi_handle handle,
10361036
const char *fmt, ...);
1037+
void acpi_evaluation_failure_warn(acpi_handle handle, const char *name,
1038+
acpi_status status);
10371039
#else /* !CONFIG_ACPI */
10381040
static inline __printf(3, 4) void
10391041
acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
1042+
static inline void acpi_evaluation_failure_warn(acpi_handle handle,
1043+
const char *name,
1044+
acpi_status status) {}
10401045
#endif /* !CONFIG_ACPI */
10411046

10421047
#if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)

0 commit comments

Comments
 (0)