Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: AC: Clean up printing messages

Replace the ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() instances
in ac.c with acpi_handle_debug() and acpi_handle_info() calls,
respectively, which among other things causes the excessive log
level of the messages previously printed via ACPI_EXCEPTION() to
be increased.

Drop the _COMPONENT and ACPI_MODULE_NAME() definitions that are not
used any more, drop the no longer needed ACPI_AC_COMPONENT definition
from the headers and update the documentation accordingly.

While at it, replace the direct printk() invocation with pr_info(),
add a pr_fmt() definition to ac.c and drop the unneeded PREFIX
symbol definition from there.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>

+10 -16
-1
Documentation/firmware-guide/acpi/debug.rst
··· 52 52 ACPI_CA_DISASSEMBLER 0x00000800 53 53 ACPI_COMPILER 0x00001000 54 54 ACPI_TOOLS 0x00002000 55 - ACPI_AC_COMPONENT 0x00020000 56 55 ACPI_BATTERY_COMPONENT 0x00040000 57 56 ACPI_BUTTON_COMPONENT 0x00080000 58 57 ACPI_SBS_COMPONENT 0x00100000
+10 -13
drivers/acpi/ac.c
··· 6 6 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 7 7 */ 8 8 9 + #define pr_fmt(fmt) "ACPI: AC: " fmt 10 + 9 11 #include <linux/kernel.h> 10 12 #include <linux/module.h> 11 13 #include <linux/slab.h> ··· 20 18 #include <linux/acpi.h> 21 19 #include <acpi/battery.h> 22 20 23 - #define PREFIX "ACPI: " 24 - 25 21 #define ACPI_AC_CLASS "ac_adapter" 26 22 #define ACPI_AC_DEVICE_NAME "AC Adapter" 27 23 #define ACPI_AC_FILE_STATE "state" ··· 27 27 #define ACPI_AC_STATUS_OFFLINE 0x00 28 28 #define ACPI_AC_STATUS_ONLINE 0x01 29 29 #define ACPI_AC_STATUS_UNKNOWN 0xFF 30 - 31 - #define _COMPONENT ACPI_AC_COMPONENT 32 - ACPI_MODULE_NAME("ac"); 33 30 34 31 MODULE_AUTHOR("Paul Diefenbaugh"); 35 32 MODULE_DESCRIPTION("ACPI AC Adapter Driver"); ··· 99 102 status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, 100 103 &ac->state); 101 104 if (ACPI_FAILURE(status)) { 102 - ACPI_EXCEPTION((AE_INFO, status, 103 - "Error reading AC Adapter state")); 105 + acpi_handle_info(ac->device->handle, 106 + "Error reading AC Adapter state: %s\n", 107 + acpi_format_exception(status)); 104 108 ac->state = ACPI_AC_STATUS_UNKNOWN; 105 109 return -ENODEV; 106 110 } ··· 151 153 152 154 switch (event) { 153 155 default: 154 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 155 - "Unsupported event [0x%x]\n", event)); 156 + acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n", 157 + event); 156 158 fallthrough; 157 159 case ACPI_AC_NOTIFY_STATUS: 158 160 case ACPI_NOTIFY_BUS_CHECK: ··· 276 278 goto end; 277 279 } 278 280 279 - printk(KERN_INFO PREFIX "%s [%s] (%s)\n", 280 - acpi_device_name(device), acpi_device_bid(device), 281 - ac->state ? "on-line" : "off-line"); 281 + pr_info("%s [%s] (%s)\n", acpi_device_name(device), 282 + acpi_device_bid(device), ac->state ? "on-line" : "off-line"); 282 283 283 284 ac->battery_nb.notifier_call = acpi_ac_battery_notify; 284 285 register_acpi_notifier(&ac->battery_nb); ··· 345 348 for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++) 346 349 if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1", 347 350 acpi_ac_blacklist[i].hrv)) { 348 - pr_info(PREFIX "AC: found native %s PMIC, not loading\n", 351 + pr_info("found native %s PMIC, not loading\n", 349 352 acpi_ac_blacklist[i].hid); 350 353 return -ENODEV; 351 354 }
-1
drivers/acpi/sysfs.c
··· 52 52 ACPI_DEBUG_INIT(ACPI_COMPILER), 53 53 ACPI_DEBUG_INIT(ACPI_TOOLS), 54 54 55 - ACPI_DEBUG_INIT(ACPI_AC_COMPONENT), 56 55 ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT), 57 56 ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT), 58 57 ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT),
-1
include/acpi/acpi_drivers.h
··· 15 15 * Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst 16 16 * if you add to this list. 17 17 */ 18 - #define ACPI_AC_COMPONENT 0x00020000 19 18 #define ACPI_BATTERY_COMPONENT 0x00040000 20 19 #define ACPI_BUTTON_COMPONENT 0x00080000 21 20 #define ACPI_SBS_COMPONENT 0x00100000