From patchwork Wed Jan 20 18:57:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 367168 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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham 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 40D66C433DB for ; Wed, 20 Jan 2021 19:03:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E159B23433 for ; Wed, 20 Jan 2021 19:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392484AbhATTD2 (ORCPT ); Wed, 20 Jan 2021 14:03:28 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:52026 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392425AbhATTDY (ORCPT ); Wed, 20 Jan 2021 14:03:24 -0500 Received: from 89-64-80-175.dynamic.chello.pl (89.64.80.175) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.537) id 7fd8987296b51fa0; Wed, 20 Jan 2021 20:02:16 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Erik Kaneda Subject: [PATCH v1 1/6] ACPI: power: Clean up printing messages Date: Wed, 20 Jan 2021 19:57:03 +0100 Message-ID: <2085818.bEvWYRANqJ@kreacher> In-Reply-To: <2809410.8bz27usjlQ@kreacher> References: <2809410.8bz27usjlQ@kreacher> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Rafael J. Wysocki Replace all of the ACPI_DEBUG_PRINT() instances in power.c with acpi_handle_debug() or pr_debug(), depending on the context, drop the _COMPONENT and ACPI_MODULE_NAME() definitions that are not used any more, and replace the direct invocations of printk() in there with acpi_handle_info() or pr_info(), depending on the context. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/power.c | 44 +++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) Index: linux-pm/drivers/acpi/power.c =================================================================== --- linux-pm.orig/drivers/acpi/power.c +++ linux-pm/drivers/acpi/power.c @@ -21,6 +21,8 @@ * may be shared by multiple devices. */ +#define pr_fmt(fmt) "ACPI: PM: " fmt + #include #include #include @@ -32,8 +34,6 @@ #include "sleep.h" #include "internal.h" -#define _COMPONENT ACPI_POWER_COMPONENT -ACPI_MODULE_NAME("power"); #define ACPI_POWER_CLASS "power_resource" #define ACPI_POWER_DEVICE_NAME "Power Resource" #define ACPI_POWER_RESOURCE_STATE_OFF 0x00 @@ -181,9 +181,6 @@ static int acpi_power_get_state(acpi_han { acpi_status status = AE_OK; unsigned long long sta = 0; - char node_name[5]; - struct acpi_buffer buffer = { sizeof(node_name), node_name }; - if (!handle || !state) return -EINVAL; @@ -195,11 +192,8 @@ static int acpi_power_get_state(acpi_han *state = (sta & 0x01)?ACPI_POWER_RESOURCE_STATE_ON: ACPI_POWER_RESOURCE_STATE_OFF; - acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", - node_name, - *state ? "on" : "off")); + acpi_handle_debug(handle, "Power resource is %s\n", + *state ? "on" : "off"); return 0; } @@ -229,8 +223,7 @@ static int acpi_power_get_list_state(str break; } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", - cur_state ? "on" : "off")); + pr_debug("Power resource list is %s\n", cur_state ? "on" : "off"); *state = cur_state; return 0; @@ -357,8 +350,7 @@ static int __acpi_power_on(struct acpi_p if (ACPI_FAILURE(status)) return -ENODEV; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n", - resource->name)); + pr_debug("Power resource [%s] turned on\n", resource->name); /* * If there are other dependents on this power resource we need to @@ -383,9 +375,7 @@ static int acpi_power_on_unlocked(struct int result = 0; if (resource->ref_count++) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Power resource [%s] already on\n", - resource->name)); + pr_debug("Power resource [%s] already on\n", resource->name); } else { result = __acpi_power_on(resource); if (result) @@ -413,8 +403,8 @@ static int __acpi_power_off(struct acpi_ if (ACPI_FAILURE(status)) return -ENODEV; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned off\n", - resource->name)); + pr_debug("Power resource [%s] turned off\n", resource->name); + return 0; } @@ -423,16 +413,12 @@ static int acpi_power_off_unlocked(struc int result = 0; if (!resource->ref_count) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Power resource [%s] already off\n", - resource->name)); + pr_debug("Power resource [%s] already off\n", resource->name); return 0; } if (--resource->ref_count) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Power resource [%s] still in use\n", - resource->name)); + pr_debug("Power resource [%s] still in use\n", resource->name); } else { result = __acpi_power_off(resource); if (result) @@ -672,7 +658,7 @@ int acpi_device_sleep_wake(struct acpi_d if (ACPI_SUCCESS(status)) { return 0; } else if (status != AE_NOT_FOUND) { - printk(KERN_ERR PREFIX "_DSW execution failed\n"); + acpi_handle_info(dev->handle, "_DSW execution failed\n"); dev->wakeup.flags.valid = 0; return -ENODEV; } @@ -680,7 +666,7 @@ int acpi_device_sleep_wake(struct acpi_d /* Execute _PSW */ status = acpi_execute_simple_method(dev->handle, "_PSW", enable); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - printk(KERN_ERR PREFIX "_PSW execution failed\n"); + acpi_handle_info(dev->handle, "_PSW execution failed\n"); dev->wakeup.flags.valid = 0; return -ENODEV; } @@ -960,8 +946,8 @@ int acpi_add_power_resource(acpi_handle if (result) goto err; - printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), - acpi_device_bid(device), state ? "on" : "off"); + pr_info("%s [%s] (%s)\n", acpi_device_name(device), + acpi_device_bid(device), state ? "on" : "off"); device->flags.match_driver = true; result = acpi_device_add(device, acpi_release_power_resource); From patchwork Wed Jan 20 19:00:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 367167 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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham 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 5F30FC433DB for ; Wed, 20 Jan 2021 19:03:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D0B7233FE for ; Wed, 20 Jan 2021 19:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392316AbhATTDX (ORCPT ); Wed, 20 Jan 2021 14:03:23 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:50644 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392408AbhATTDV (ORCPT ); Wed, 20 Jan 2021 14:03:21 -0500 Received: from 89-64-80-175.dynamic.chello.pl (89.64.80.175) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.537) id 9a478b5d78da3b74; Wed, 20 Jan 2021 20:02:11 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Erik Kaneda Subject: [PATCH v1 5/6] ACPI: utils: Clean up printing messages Date: Wed, 20 Jan 2021 20:00:32 +0100 Message-ID: <4589427.MynsCsldvn@kreacher> In-Reply-To: <2809410.8bz27usjlQ@kreacher> References: <2809410.8bz27usjlQ@kreacher> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Rafael J. Wysocki Replace all of the ACPI_DEBUG_PRINT() instances in utils.c with pr_debug() and acpi_handle_debug(), drop the _COMPONENT and ACPI_MODULE_NAME() definitions that are not used any more and replace direct printk() invocations with pr_debug() calls (the log level in there is way excessive). Also add a special pr_fmt() definition, but this only affects the pr_debug() messages mentioned above. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/utils.c | 56 ++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 38 deletions(-) Index: linux-pm/drivers/acpi/utils.c =================================================================== --- linux-pm.orig/drivers/acpi/utils.c +++ linux-pm/drivers/acpi/utils.c @@ -6,6 +6,8 @@ * Copyright (C) 2001, 2002 Paul Diefenbaugh */ +#define pr_fmt(fmt) "ACPI: utils: " fmt + #include #include #include @@ -18,24 +20,12 @@ #include "internal.h" #include "sleep.h" -#define _COMPONENT ACPI_BUS_COMPONENT -ACPI_MODULE_NAME("utils"); - /* -------------------------------------------------------------------------- Object Evaluation Helpers -------------------------------------------------------------------------- */ -static void -acpi_util_eval_error(acpi_handle h, acpi_string p, acpi_status s) +static void acpi_util_eval_error(acpi_handle h, acpi_string p, acpi_status s) { -#ifdef ACPI_DEBUG_OUTPUT - char prefix[80] = {'\0'}; - struct acpi_buffer buffer = {sizeof(prefix), prefix}; - acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate [%s.%s]: %s\n", - (char *) prefix, p, acpi_format_exception(s))); -#else - return; -#endif + acpi_handle_debug(h, "Evaluate [%s]: %s\n", p, acpi_format_exception(s)); } acpi_status @@ -53,25 +43,24 @@ acpi_extract_package(union acpi_object * if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) { - printk(KERN_WARNING PREFIX "Invalid package argument\n"); + pr_debug("Invalid package argument\n"); return AE_BAD_PARAMETER; } if (!format || !format->pointer || (format->length < 1)) { - printk(KERN_WARNING PREFIX "Invalid format argument\n"); + pr_debug("Invalid format argument\n"); return AE_BAD_PARAMETER; } if (!buffer) { - printk(KERN_WARNING PREFIX "Invalid buffer argument\n"); + pr_debug("Invalid buffer argument\n"); return AE_BAD_PARAMETER; } format_count = (format->length / sizeof(char)) - 1; if (format_count > package->package.count) { - printk(KERN_WARNING PREFIX "Format specifies more objects [%d]" - " than exist in package [%d].\n", - format_count, package->package.count); + pr_debug("Format specifies more objects [%d] than present [%d]\n", + format_count, package->package.count); return AE_BAD_DATA; } @@ -99,10 +88,8 @@ acpi_extract_package(union acpi_object * tail_offset += sizeof(char *); break; default: - printk(KERN_WARNING PREFIX "Invalid package element" - " [%d]: got number, expecting" - " [%c]\n", - i, format_string[i]); + pr_debug("Invalid package element [%d]: got number, expected [%c]\n", + i, format_string[i]); return AE_BAD_DATA; } break; @@ -123,10 +110,8 @@ acpi_extract_package(union acpi_object * tail_offset += sizeof(u8 *); break; default: - printk(KERN_WARNING PREFIX "Invalid package element" - " [%d] got string/buffer," - " expecting [%c]\n", - i, format_string[i]); + pr_debug("Invalid package element [%d] got string/buffer, expected [%c]\n", + i, format_string[i]); return AE_BAD_DATA; } break; @@ -137,19 +122,15 @@ acpi_extract_package(union acpi_object * tail_offset += sizeof(void *); break; default: - printk(KERN_WARNING PREFIX "Invalid package element" - " [%d] got reference," - " expecting [%c]\n", - i, format_string[i]); + pr_debug("Invalid package element [%d] got reference, expected [%c]\n", + i, format_string[i]); return AE_BAD_DATA; } break; case ACPI_TYPE_PACKAGE: default: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Found unsupported element at index=%d\n", - i)); + pr_debug("Unsupported element at index=%d\n", i); /* TBD: handle nested packages... */ return AE_SUPPORT; } @@ -289,7 +270,7 @@ acpi_evaluate_integer(acpi_handle handle *data = element.integer.value; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data)); + acpi_handle_debug(handle, "Return value [%llu]\n", *data); return AE_OK; } @@ -363,8 +344,7 @@ acpi_evaluate_reference(acpi_handle hand /* Get the acpi_handle. */ list->handles[i] = element->reference.handle; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found reference [%p]\n", - list->handles[i])); + acpi_handle_debug(list->handles[i], "Found in reference list\n"); } end: