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 1B0A6C433E6 for ; Thu, 4 Feb 2021 18:30:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0FC464F45 for ; Thu, 4 Feb 2021 18:30:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239157AbhBDSap (ORCPT ); Thu, 4 Feb 2021 13:30:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:40198 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239128AbhBDS3M (ORCPT ); Thu, 4 Feb 2021 13:29:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612463265; 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=bgQhr2F2iWGQLtH9Fikx9Lr/KlJCKowpxuZEQeaIbIk=; b=WHMfwaS3Hxa8ikrScJlcg8Eabz8xshgtkrjalx+3bNYJTzvUWlzo9k24QEymGWCOfQwLxk 8fSFNMZE/J0mMfDNSdG7iZV8iT81h76XVl8CJVxHlE8DuiBTLAv7X+IPmBTJth/+LE5kLb QvZaMmUA2tGrZJh6nuyB/B6vNyv5atg= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-IY2s8spUPjOCmDOivphg_g-1; Thu, 04 Feb 2021 13:27:41 -0500 X-MC-Unique: IY2s8spUPjOCmDOivphg_g-1 Received: by mail-ej1-f71.google.com with SMTP id hx26so3292943ejc.3 for ; Thu, 04 Feb 2021 10:27:41 -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:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bgQhr2F2iWGQLtH9Fikx9Lr/KlJCKowpxuZEQeaIbIk=; b=iqNYlJFxPZKh9WQ1a1nEpyxCCxaITOCbDevn5mO53eaX7VSPkfpWCwOjDssFLZ9QJz 9fijZ+CahL79EnXnzXXacqp1TPpb4YnQlEY3iSBpbMeYmcBQD9mCQJEQGC7MoNK3L+r4 byfekcG9ioglNI9HHfEVYDQtcgkL0cAY9QviPSxNWc4/RQSstFQ9TOrKbqJMRFzI3Vtx rKONyeQtAcWkPfZoCFGzVxV0rswIL9s3Tcl967HJpHL3yphas0gw3Y2uVPHqC2nEKnhO a55Z0neOCO8SUt2YaSK0w9cPgp3kvh5bMyk4Kp8YCMIV6RhQmNJ/IA1Xyay/edLaHYK7 F1NA== X-Gm-Message-State: AOAM530XDFUF9qs1wblG3UWL8jObJnyy1JXZkp52hGtsfcsHtDb1U+Ec s5r2Ig7Vwkw+HutPNrM330gV+la5lrHDUuT+dQfjB/49niKUrtQ2YEqaaLBVhm88v1IR/O9KL10 Ek7AGr4RLjAq63U81W7nlgt8t X-Received: by 2002:a17:906:e106:: with SMTP id gj6mr366079ejb.337.1612463260222; Thu, 04 Feb 2021 10:27:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7EHttt3Ocd9Um49oN8bi+MGMe8Aenc72i4nYwgueWCXVsUO9BQN9mkLPSJXZLI9oq4d/yRg== X-Received: by 2002:a17:906:e106:: with SMTP id gj6mr366017ejb.337.1612463259068; Thu, 04 Feb 2021 10:27:39 -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 bf8sm2945126edb.34.2021.02.04.10.27.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Feb 2021 10:27:38 -0800 (PST) Subject: Re: [PATCH v3 2/5] ACPI: battery: Clean up printing messages 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> From: Hans de Goede Message-ID: <3ca5dcaa-094a-9f4f-a802-81c54a681c96@redhat.com> Date: Thu, 4 Feb 2021 19:27:38 +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: <1731128.lCOlkKr4QW@kreacher> 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/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) ? With that fixed, or explained, this is: Reviewed-by: Hans de Goede 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 > > >