From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC7D3C433E0 for ; Thu, 4 Feb 2021 18:33:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A620864F51 for ; Thu, 4 Feb 2021 18:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239174AbhBDSdr (ORCPT ); Thu, 4 Feb 2021 13:33:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34641 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239160AbhBDSdO (ORCPT ); Thu, 4 Feb 2021 13:33:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612463506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cw6yNBHOi0gV1ybYwsZTPvMb8Nk42GJP0B50G947cPI=; b=YUzTlDloBQhJV30xadbZ1APHXEVUiCnLsdna77LYddlaQDZIMicRDPxDIEgkkecRncTami TDi/y2MJ6YhKZx8hEBUh6iJ5HH9OpMEcRTbaYougvHRyRipLHD8Cw9zGpEhQHfV3BWT07F mLee9zhqBhBUXoyAmWST02NtpSBzgCQ= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-157-ErhZhf-NNZe7Lcg4lrXl4Q-1; Thu, 04 Feb 2021 13:31:44 -0500 X-MC-Unique: ErhZhf-NNZe7Lcg4lrXl4Q-1 Received: by mail-ed1-f70.google.com with SMTP id u26so3615928edv.18 for ; Thu, 04 Feb 2021 10:31:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cw6yNBHOi0gV1ybYwsZTPvMb8Nk42GJP0B50G947cPI=; b=cFxc9jUnYH5l8fIXAoqQYQhX7ZBBbJFkvH8eVdN66zfRZLOllU3cw2jRc856nBG2r5 p5LCj/1F2Jo2obfQPSAIHC4L2N+vyK1jKoprfIlJB29IEbZc38CxghrN9VtZzGJ6Lq9r W8Yz5ayMC9tvlnh3KxU8LyiEosIc+WM5kK2yUL8QhuCpj6gezznhk+ufT71aOppTdA4R DaA6iGrCeD0b0l0HZPDIf17+j6KDGCYAT4XVHDSgVUcOP9yN5flSAX4LnhxVsfWconyp WV/zx1V30H86oNtmZWwXLNd+f7aO7J8E0BXMiKTGXMbxWWNVbXD2H6uju0QS9Z0URe9d Gv+Q== X-Gm-Message-State: AOAM532bxTqBdMgqCsax6RuH0BoYTAtqZ3tPppSgUFwTVRULkPtEsD22 KId8CeoKvZNQ7PXokzQWdkjeiU0jh5PGhkfpfPHk+EPLJhXiWK5vyfquP04Cp9zn7B910bilUrg HlgAVIhOviAZMvcKDTB5cjg9e X-Received: by 2002:aa7:c94c:: with SMTP id h12mr328562edt.40.1612463503630; Thu, 04 Feb 2021 10:31:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbYgYZaJKMYeumdOWnVdGLbGKEebTgojFuPzk62ylvgOplomfQSo9d8Ys/fCPdGVCoRwsiXw== X-Received: by 2002:aa7:c94c:: with SMTP id h12mr328539edt.40.1612463503417; Thu, 04 Feb 2021 10:31:43 -0800 (PST) Received: from x1.localdomain (2001-1c00-0c1e-bf00-37a3-353b-be90-1238.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:37a3:353b:be90:1238]) by smtp.gmail.com with ESMTPSA id bo24sm2845011edb.51.2021.02.04.10.31.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Feb 2021 10:31:42 -0800 (PST) Subject: Re: [PATCH v3 2/5] ACPI: battery: Clean up printing messages From: Hans de Goede To: "Rafael J. Wysocki" , Linux ACPI Cc: Linux PM , LKML , "Rafael J. Wysocki" , Zhang Rui , Erik Kaneda , Joe Perches , Hanjun Guo References: <2367702.B5bJTmGzJm@kreacher> <1991501.dpTHplkurC@kreacher> <1961054.9MKZ8ejxOh@kreacher> <1731128.lCOlkKr4QW@kreacher> <3ca5dcaa-094a-9f4f-a802-81c54a681c96@redhat.com> Message-ID: <16884c35-811a-b095-27f2-f43394f3efc2@redhat.com> Date: Thu, 4 Feb 2021 19:31:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <3ca5dcaa-094a-9f4f-a802-81c54a681c96@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2/4/21 7:27 PM, Hans de Goede wrote: > Hi, > > On 2/3/21 7:44 PM, Rafael J. Wysocki wrote: >> From: Rafael J. Wysocki >> >> 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 >> --- >> >> v2 -> v3: Also adapt the existing pr_info() calls to the new pr_fmt() >> definition. >> >> v1 -> v2: Changelog update. >> >> --- >> Documentation/firmware-guide/acpi/debug.rst | 1 >> drivers/acpi/battery.c | 33 +++++++++++++--------------- >> drivers/acpi/sysfs.c | 1 >> include/acpi/acpi_drivers.h | 1 >> 4 files changed, 16 insertions(+), 20 deletions(-) >> >> Index: linux-pm/drivers/acpi/battery.c >> =================================================================== >> --- linux-pm.orig/drivers/acpi/battery.c >> +++ linux-pm/drivers/acpi/battery.c >> @@ -8,7 +8,7 @@ >> * Copyright (C) 2001, 2002 Paul Diefenbaugh >> */ >> >> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt >> +#define pr_fmt(fmt) "ACPI: battery: " fmt >> >> #include >> #include >> @@ -29,8 +29,6 @@ >> >> #include >> >> -#define PREFIX "ACPI: " >> - >> #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF >> #define ACPI_BATTERY_CAPACITY_VALID(capacity) \ >> ((capacity) != 0 && (capacity) != ACPI_BATTERY_VALUE_UNKNOWN) >> @@ -44,10 +42,6 @@ >> #define ACPI_BATTERY_STATE_CHARGING 0x2 >> #define ACPI_BATTERY_STATE_CRITICAL 0x4 >> >> -#define _COMPONENT ACPI_BATTERY_COMPONENT >> - >> -ACPI_MODULE_NAME("battery"); >> - >> MODULE_AUTHOR("Paul Diefenbaugh"); >> MODULE_AUTHOR("Alexey Starikovskiy "); >> MODULE_DESCRIPTION("ACPI Battery Driver"); >> @@ -466,7 +460,8 @@ static int extract_package(struct acpi_b >> static int acpi_battery_get_status(struct acpi_battery *battery) >> { >> if (acpi_bus_get_status(battery->device)) { >> - ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Evaluating _STA")); >> + acpi_handle_info(battery->device->handle, >> + "_STA evaluation failed\n"); > > Missing ": %s", acpi_format_exception(status), or is that intentional > (I did not see this mentioned in the commit msg) ? Ah, after noticing that you did the same thing in patch 4/5 and there the passed in status was bogus, I now notice that the status here was hard-coded to AE_ERROR, so not meaningful. That answers my own question, so this is: Reviewed-by: Hans de Goede As is. Regards, Hans >> return -ENODEV; >> } >> return 0; >> @@ -535,8 +530,10 @@ static int acpi_battery_get_info(struct >> mutex_unlock(&battery->lock); >> >> if (ACPI_FAILURE(status)) { >> - ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", >> - use_bix ? "_BIX":"_BIF")); >> + acpi_handle_info(battery->device->handle, >> + "%s evaluation failed: %s\n", >> + use_bix ?"_BIX":"_BIF", >> + acpi_format_exception(status)); >> } else { >> result = extract_battery_info(use_bix, >> battery, >> @@ -573,7 +570,9 @@ static int acpi_battery_get_state(struct >> mutex_unlock(&battery->lock); >> >> if (ACPI_FAILURE(status)) { >> - ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); >> + acpi_handle_info(battery->device->handle, >> + "_BST evaluation failed: %s", >> + acpi_format_exception(status)); >> return -ENODEV; >> } >> >> @@ -590,7 +589,7 @@ static int acpi_battery_get_state(struct >> battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN && >> (s16)(battery->rate_now) < 0) { >> battery->rate_now = abs((s16)battery->rate_now); >> - pr_warn_once(FW_BUG "battery: (dis)charge rate invalid.\n"); >> + pr_warn_once(FW_BUG "(dis)charge rate invalid.\n"); >> } >> >> if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) >> @@ -625,7 +624,9 @@ static int acpi_battery_set_alarm(struct >> if (ACPI_FAILURE(status)) >> return -ENODEV; >> >> - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", battery->alarm)); >> + acpi_handle_debug(battery->device->handle, "Alarm set to %d\n", >> + battery->alarm); >> + >> return 0; >> } >> >> @@ -1201,8 +1202,7 @@ static int acpi_battery_add(struct acpi_ >> if (result) >> goto fail; >> >> - pr_info(PREFIX "%s Slot [%s] (battery %s)\n", >> - ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), >> + pr_info("Slot [%s] (battery %s)\n", acpi_device_bid(device), >> device->status.battery_present ? "present" : "absent"); >> >> battery->pm_nb.notifier_call = battery_notify; >> @@ -1282,8 +1282,7 @@ static void __init acpi_battery_init_asy >> if (battery_check_pmic) { >> for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++) >> if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) { >> - pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME >> - ": found native %s PMIC, not loading\n", >> + pr_info("found native %s PMIC, not loading\n", >> acpi_battery_blacklist[i]); >> return; >> } >> Index: linux-pm/Documentation/firmware-guide/acpi/debug.rst >> =================================================================== >> --- linux-pm.orig/Documentation/firmware-guide/acpi/debug.rst >> +++ linux-pm/Documentation/firmware-guide/acpi/debug.rst >> @@ -52,7 +52,6 @@ shows the supported mask values, current >> ACPI_CA_DISASSEMBLER 0x00000800 >> ACPI_COMPILER 0x00001000 >> ACPI_TOOLS 0x00002000 >> - ACPI_BATTERY_COMPONENT 0x00040000 >> ACPI_BUTTON_COMPONENT 0x00080000 >> ACPI_SBS_COMPONENT 0x00100000 >> ACPI_FAN_COMPONENT 0x00200000 >> Index: linux-pm/drivers/acpi/sysfs.c >> =================================================================== >> --- linux-pm.orig/drivers/acpi/sysfs.c >> +++ linux-pm/drivers/acpi/sysfs.c >> @@ -52,7 +52,6 @@ static const struct acpi_dlayer acpi_deb >> ACPI_DEBUG_INIT(ACPI_COMPILER), >> ACPI_DEBUG_INIT(ACPI_TOOLS), >> >> - ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT), >> ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT), >> ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT), >> ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT), >> Index: linux-pm/include/acpi/acpi_drivers.h >> =================================================================== >> --- linux-pm.orig/include/acpi/acpi_drivers.h >> +++ linux-pm/include/acpi/acpi_drivers.h >> @@ -15,7 +15,6 @@ >> * Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst >> * if you add to this list. >> */ >> -#define ACPI_BATTERY_COMPONENT 0x00040000 >> #define ACPI_BUTTON_COMPONENT 0x00080000 >> #define ACPI_SBS_COMPONENT 0x00100000 >> #define ACPI_FAN_COMPONENT 0x00200000 >> >> >>