Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2252585pxb; Fri, 5 Mar 2021 10:46:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/C6JJcDlEV9C6q3eodmNgUyIqv07ZeXwBG2i5P6uGV+KyJ5xFTgxzu6ZVF83/Jxw5mlQv X-Received: by 2002:a17:906:3105:: with SMTP id 5mr3663962ejx.168.1614969991023; Fri, 05 Mar 2021 10:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614969991; cv=none; d=google.com; s=arc-20160816; b=BHr2fiXddpnlhn8wpOAKRtdAf+u22KwiCKPEmBrrw0/Shv3cj1xXZaXG6sSBIF684/ Dy6kng7foOrT2SbOTJkbBl0C0tc+PwzGGM4K/cKl9nQyCA1SBizd5MVK71R/Uh20yEDz I1bmyfWXSKYCMEPT65avBvybs1+4CeckkawflKQQKeBbyKJPpRJM0cHfkS69eI1PcAHj 8EIBHElGvfmaUfzu/UIAY0ufxP7FNllLXrs7fmXsgVh1E5wlMikrBF2CHGTH2neXyxNu w9rqTJjdZubcTZyk5z3/lorsavlMgpz2RuZGew0FgeotDVklRa4+XtdGfRFS2sru/WAD nZPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VJ+OEEOAg9hrlxIfZu6SbLLFqu1aeg2nuNkpNyXNGPU=; b=px+XWVzk2K/QWnhBE1pbjdrSWhYIq73ka2axnCUyLEQ567PihBYvgoccYzJVd0z6+t xmqr7oRTOQZ0jHVlxliZ6V2yyknh4cixCeKHyXWXTkwXL15YHtX8v0+p8DIDrYXJccNI 7u5UXS7pKkCMNMgtEPOhLzDfU3iW53itHdSstk2qhfRqJQesTZbrXClJE2HftEREMAp7 9YX/nOBzyM8Omx6bpqCOKTP8OeHcNajamajO30OCH0JC1pRJZr1bwMcRgSak350MhjTV KqdzRSPEf/Bffpi8vQrVuceoHh9hWGxA2skpUd2plGYsxstyFFL3AJ0IsYvyScjQzW4P qWbw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gg25si1846486ejb.693.2021.03.05.10.46.08; Fri, 05 Mar 2021 10:46:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbhCESpO (ORCPT + 99 others); Fri, 5 Mar 2021 13:45:14 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:49578 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbhCESok (ORCPT ); Fri, 5 Mar 2021 13:44:40 -0500 Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 0.83.537) id 40b9a7510e5517b8; Fri, 5 Mar 2021 19:44:37 +0100 Received: from kreacher.localnet (89-64-81-9.dynamic.chello.pl [89.64.81.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 46B4D663EA1; Fri, 5 Mar 2021 19:44:36 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM , Zhang Rui , Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org, Linux PCI Subject: [PATCH v1 2/4] ACPI: utils: Introduce acpi_evaluation_failure_warn() Date: Fri, 05 Mar 2021 19:41:44 +0100 Message-ID: <3660317.i3jicEtL8u@kreacher> In-Reply-To: <2775419.haJ69vZeI0@kreacher> References: <2775419.haJ69vZeI0@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledruddtiedguddtiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepgfelheffhfetffelhfelteejffetteetgfetkeejvdfhfeeftdeufeevgeevieevnecukfhppeekledrieegrdekuddrleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekledrieegrdekuddrledphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepjhhitgdvfeeskhgvrhhnvghlrdhorhhgpdhrtghp thhtoheplhgrrhhssehmvghtrghfohhordguvgdprhgtphhtthhopehpmhgvvghrfiesphhmvggvrhifrdhnvghtpdhrtghpthhtoheplhhinhhugidqihhiohesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehjuggvlhhvrghrvgesshhushgvrdgtohhmpdhrtghpthhtoheplhhinhhugiesrhhovggtkhdquhhsrdhnvghtpdhrtghpthhtoheplhhinhhugidqhhifmhhonhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhptghisehvghgvrhdrkhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=12 Fuz1=12 Fuz2=12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Quite a few users of ACPI objects want to log a warning message if the evaluation fails which is a repeating pattern, so introduce a helper function for that purpose and convert some code where it is open-coded to using it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/pci_link.c | 6 ++---- drivers/acpi/processor_perflib.c | 10 +++------- drivers/acpi/processor_throttling.c | 16 ++++------------ drivers/acpi/utils.c | 14 ++++++++++++++ include/linux/acpi.h | 5 +++++ 5 files changed, 28 insertions(+), 23 deletions(-) Index: linux-pm/drivers/acpi/utils.c =================================================================== --- linux-pm.orig/drivers/acpi/utils.c +++ linux-pm/drivers/acpi/utils.c @@ -512,6 +512,20 @@ EXPORT_SYMBOL(__acpi_handle_debug); #endif /** + * acpi_evaluation_failure_warn - Log evaluation failure warning. + * @handle: Parent object handle. + * @name: Name of the object whose evaluation has failed. + * @status: Status value returned by the failing object evaluation. + */ +void acpi_evaluation_failure_warn(acpi_handle handle, const char *name, + acpi_status status) +{ + acpi_handle_warn(handle, "%s evaluation failed: %s\n", name, + acpi_format_exception(status)); +} +EXPORT_SYMBOL_GPL(acpi_evaluation_failure_warn); + +/** * acpi_has_method: Check whether @handle has a method named @name * @handle: ACPI device handle * @name: name of object or method Index: linux-pm/include/linux/acpi.h =================================================================== --- linux-pm.orig/include/linux/acpi.h +++ linux-pm/include/linux/acpi.h @@ -1027,9 +1027,14 @@ static inline void acpi_ec_set_gpe_wake_ __printf(3, 4) void acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...); +void acpi_evaluation_failure_warn(acpi_handle handle, const char *name, + acpi_status status); #else /* !CONFIG_ACPI */ static inline __printf(3, 4) void acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} +static inline void acpi_evaluation_failure_warn(acpi_handle handle, + const char *name, + acpi_status status) {} #endif /* !CONFIG_ACPI */ #if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG) Index: linux-pm/drivers/acpi/processor_throttling.c =================================================================== --- linux-pm.orig/drivers/acpi/processor_throttling.c +++ linux-pm/drivers/acpi/processor_throttling.c @@ -281,9 +281,7 @@ static int acpi_processor_get_platform_l status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) - acpi_handle_warn(pr->handle, - "_TPC evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(pr->handle, "_TPC", status); return -ENODEV; } @@ -416,9 +414,7 @@ static int acpi_processor_get_throttling status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) - acpi_handle_warn(pr->handle, - "_PTC evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(pr->handle, "_PTC", status); return -ENODEV; } @@ -503,9 +499,7 @@ static int acpi_processor_get_throttling status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer); if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) - acpi_handle_warn(pr->handle, - "_TSS evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(pr->handle, "_TSS", status); return -ENODEV; } @@ -586,9 +580,7 @@ static int acpi_processor_get_tsd(struct status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer); if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) - acpi_handle_warn(pr->handle, - "_TSD evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(pr->handle, "_TSD", status); return -ENODEV; } Index: linux-pm/drivers/acpi/pci_link.c =================================================================== --- linux-pm.orig/drivers/acpi/pci_link.c +++ linux-pm/drivers/acpi/pci_link.c @@ -256,8 +256,7 @@ static int acpi_pci_link_get_current(str status = acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_pci_link_check_current, &irq); if (ACPI_FAILURE(status)) { - acpi_handle_warn(handle, "_CRS evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(handle, "_CRS", status); result = -ENODEV; goto end; } @@ -345,8 +344,7 @@ static int acpi_pci_link_set(struct acpi /* check for total failure */ if (ACPI_FAILURE(status)) { - acpi_handle_warn(handle, "_SRS evaluation failed: %s", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(handle, "_SRS", status); result = -ENODEV; goto end; } Index: linux-pm/drivers/acpi/processor_perflib.c =================================================================== --- linux-pm.orig/drivers/acpi/processor_perflib.c +++ linux-pm/drivers/acpi/processor_perflib.c @@ -67,9 +67,7 @@ static int acpi_processor_get_platform_l acpi_processor_ppc_in_use = true; if (ACPI_FAILURE(status)) { - acpi_handle_warn(pr->handle, - "_PPC evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(pr->handle, "_PPC", status); return -ENODEV; } } @@ -199,8 +197,7 @@ static int acpi_processor_get_performanc status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); if (ACPI_FAILURE(status)) { - acpi_handle_warn(pr->handle, "_PCT evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(pr->handle, "_PCT", status); return -ENODEV; } @@ -300,8 +297,7 @@ static int acpi_processor_get_performanc status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); if (ACPI_FAILURE(status)) { - acpi_handle_warn(pr->handle, "_PSS evaluation failed: %s\n", - acpi_format_exception(status)); + acpi_evaluation_failure_warn(pr->handle, "_PSS", status); return -ENODEV; }