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

ACPI: battery: Clean up printing messages

Replace the ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() instances
in battery.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_BATTERY_COMPONENT
definition from the headers and update the documentation accordingly.

While at it, update the pr_fmt() definition and drop the unneeded
PREFIX sybmbol definition from battery.c. Also adapt the existing
pr_info() calls to the new pr_fmt() definition.

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>

+16 -20
-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_BATTERY_COMPONENT 0x00040000 56 55 ACPI_BUTTON_COMPONENT 0x00080000 57 56 ACPI_SBS_COMPONENT 0x00100000 58 57 ACPI_FAN_COMPONENT 0x00200000
+16 -17
drivers/acpi/battery.c
··· 8 8 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 9 9 */ 10 10 11 - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 11 + #define pr_fmt(fmt) "ACPI: battery: " fmt 12 12 13 13 #include <linux/async.h> 14 14 #include <linux/delay.h> ··· 29 29 30 30 #include <acpi/battery.h> 31 31 32 - #define PREFIX "ACPI: " 33 - 34 32 #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF 35 33 #define ACPI_BATTERY_CAPACITY_VALID(capacity) \ 36 34 ((capacity) != 0 && (capacity) != ACPI_BATTERY_VALUE_UNKNOWN) ··· 41 43 #define ACPI_BATTERY_STATE_DISCHARGING 0x1 42 44 #define ACPI_BATTERY_STATE_CHARGING 0x2 43 45 #define ACPI_BATTERY_STATE_CRITICAL 0x4 44 - 45 - #define _COMPONENT ACPI_BATTERY_COMPONENT 46 - 47 - ACPI_MODULE_NAME("battery"); 48 46 49 47 MODULE_AUTHOR("Paul Diefenbaugh"); 50 48 MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>"); ··· 460 466 static int acpi_battery_get_status(struct acpi_battery *battery) 461 467 { 462 468 if (acpi_bus_get_status(battery->device)) { 463 - ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Evaluating _STA")); 469 + acpi_handle_info(battery->device->handle, 470 + "_STA evaluation failed\n"); 464 471 return -ENODEV; 465 472 } 466 473 return 0; ··· 530 535 mutex_unlock(&battery->lock); 531 536 532 537 if (ACPI_FAILURE(status)) { 533 - ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", 534 - use_bix ? "_BIX":"_BIF")); 538 + acpi_handle_info(battery->device->handle, 539 + "%s evaluation failed: %s\n", 540 + use_bix ?"_BIX":"_BIF", 541 + acpi_format_exception(status)); 535 542 } else { 536 543 result = extract_battery_info(use_bix, 537 544 battery, ··· 570 573 mutex_unlock(&battery->lock); 571 574 572 575 if (ACPI_FAILURE(status)) { 573 - ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 576 + acpi_handle_info(battery->device->handle, 577 + "_BST evaluation failed: %s", 578 + acpi_format_exception(status)); 574 579 return -ENODEV; 575 580 } 576 581 ··· 589 590 battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN && 590 591 (s16)(battery->rate_now) < 0) { 591 592 battery->rate_now = abs((s16)battery->rate_now); 592 - pr_warn_once(FW_BUG "battery: (dis)charge rate invalid.\n"); 593 + pr_warn_once(FW_BUG "(dis)charge rate invalid.\n"); 593 594 } 594 595 595 596 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) ··· 624 625 if (ACPI_FAILURE(status)) 625 626 return -ENODEV; 626 627 627 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", battery->alarm)); 628 + acpi_handle_debug(battery->device->handle, "Alarm set to %d\n", 629 + battery->alarm); 630 + 628 631 return 0; 629 632 } 630 633 ··· 1202 1201 if (result) 1203 1202 goto fail; 1204 1203 1205 - pr_info(PREFIX "%s Slot [%s] (battery %s)\n", 1206 - ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), 1204 + pr_info("Slot [%s] (battery %s)\n", acpi_device_bid(device), 1207 1205 device->status.battery_present ? "present" : "absent"); 1208 1206 1209 1207 battery->pm_nb.notifier_call = battery_notify; ··· 1282 1282 if (battery_check_pmic) { 1283 1283 for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++) 1284 1284 if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) { 1285 - pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME 1286 - ": found native %s PMIC, not loading\n", 1285 + pr_info("found native %s PMIC, not loading\n", 1287 1286 acpi_battery_blacklist[i]); 1288 1287 return; 1289 1288 }
-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_BATTERY_COMPONENT), 56 55 ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT), 57 56 ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT), 58 57 ACPI_DEBUG_INIT(ACPI_FAN_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_BATTERY_COMPONENT 0x00040000 19 18 #define ACPI_BUTTON_COMPONENT 0x00080000 20 19 #define ACPI_SBS_COMPONENT 0x00100000 21 20 #define ACPI_FAN_COMPONENT 0x00200000