Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1579987pxb; Thu, 4 Feb 2021 17:29:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJytjaXhBGkgv/Ua2dAKxFQ0cINjFgh7NpOriDlgO05lRbIuE6JdC9Uh7zLsya7DFWsln9IY X-Received: by 2002:a05:6402:27cd:: with SMTP id c13mr1247037ede.263.1612488598682; Thu, 04 Feb 2021 17:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612488598; cv=none; d=google.com; s=arc-20160816; b=K93OEXZp/dIr+b78cNWrP4/xEVL/dvoM5j5Tw32TRESzY8ANd5Inmyutmvm/zpYTXG kcGxSy00RsFX/T5A4aKBArUhAwVW5M6ek/LyIZm4/KDkOaocj7fP4OFnv912zg8aFB92 G4qFt9IsN3VO7Exu5q5efe0aFLBjlzikeLQaw1lLfJff4yy4j9M5Mgo464PyE6e7Sr5b ZqdhgC0z7wnxc7cjpCzcQt9fLv1mxyU3RX4+7vBOh0ut2jHbrod1ILYmT2zWayUyZOyx PRSQ0NKCTtBc1vbKy8MlIIttryzEVJDMfUTd27bfXBvSu90JoeeOJTKJktHJ329adWkH UIIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:dkim-signature; bh=cw6yNBHOi0gV1ybYwsZTPvMb8Nk42GJP0B50G947cPI=; b=R4XF5qIagkXTOP7SL0Wrkxo8hj5InvFbwtJE5i4VRpz5FM43gVWykknEVZfzFLsoiY qc7+BIwK3sBjV4bVH4Ps6qhySv1QLR+Q0rzjOdwK1GrOtECAKeYBq/vDWhdBPYoaaOnq KoGo1ROCNeXDQYLkKkP5aaG9jeYIG7Kv/tnl3+/XnWqOaK5coFE1IWOGt/FHeNnCMG3k 1qHRmY+j+d37ppQVx1GrVl/Y2+y3gxuYSZn2BLnU8kTM95J6wPlHv8Ivu3UdCQLemJta sBIN3Jp0D1s1dJwMc+QS3AhI/fT92yAikK/EToEh5jekNPGIvXMsgySKytaMHdkBlQ93 JWqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YUzTlDlo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si4285229edi.439.2021.02.04.17.29.34; Thu, 04 Feb 2021 17:29:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YUzTlDlo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239087AbhBDSde (ORCPT + 99 others); Thu, 4 Feb 2021 13:33:34 -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-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 >> >> >>