All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/4] ACPI: New helper for warning messages and replacing ACPI_EXCEPTION()
@ 2021-03-05 18:39 Rafael J. Wysocki
  2021-03-05 18:40 ` [PATCH v1 1/4] ACPI: processor: perflib: Eliminate redundant status check Rafael J. Wysocki
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-03-05 18:39 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Zhang Rui, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Jean Delvare, Guenter Roeck,
	linux-hwmon

Hi All,

The purpose of this series is to get rid of the remaining (questionable)
usage of ACPI_EXCEPTION() outside ACPICA.

The first patch is a tiny cleanup of the ACPI processor driver, but it is
depended on by the second one which in turn is depended on by the last two.

The second patch introduces a new helper function for logging messages
regarding ACPI object evaluation failures and makes some code under
drivers/acpi/ use it.

The other two patches use the new helper to get rid of ACPI_EXCEPTION()
and the related definitions from the acpi-als and acpi_power_meter drivers.

Please see the patch changelogs for details.

Thanks!




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/4] ACPI: processor: perflib: Eliminate redundant status check
  2021-03-05 18:39 [PATCH v1 0/4] ACPI: New helper for warning messages and replacing ACPI_EXCEPTION() Rafael J. Wysocki
@ 2021-03-05 18:40 ` Rafael J. Wysocki
  2021-03-05 18:41 ` [PATCH v1 2/4] ACPI: utils: Introduce acpi_evaluation_failure_warn() Rafael J. Wysocki
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-03-05 18:40 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Zhang Rui, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Jean Delvare, Guenter Roeck,
	linux-hwmon

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

One of the "status != AE_NOT_FOUND" checks in
acpi_processor_get_platform_limit() is redundant,
so rearrange the code to eliminate it.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/processor_perflib.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/acpi/processor_perflib.c
===================================================================
--- linux-pm.orig/drivers/acpi/processor_perflib.c
+++ linux-pm/drivers/acpi/processor_perflib.c
@@ -63,14 +63,15 @@ static int acpi_processor_get_platform_l
 	 * (e.g. 0 = states 0..n; 1 = states 1..n; etc.
 	 */
 	status = acpi_evaluate_integer(pr->handle, "_PPC", NULL, &ppc);
-
-	if (status != AE_NOT_FOUND)
+	if (status != AE_NOT_FOUND) {
 		acpi_processor_ppc_in_use = true;
 
-	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
-		acpi_handle_warn(pr->handle, "_PPC evaluation failed: %s\n",
-				 acpi_format_exception(status));
-		return -ENODEV;
+		if (ACPI_FAILURE(status)) {
+			acpi_handle_warn(pr->handle,
+					 "_PPC evaluation failed: %s\n",
+					 acpi_format_exception(status));
+			return -ENODEV;
+		}
 	}
 
 	pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 2/4] ACPI: utils: Introduce acpi_evaluation_failure_warn()
  2021-03-05 18:39 [PATCH v1 0/4] ACPI: New helper for warning messages and replacing ACPI_EXCEPTION() Rafael J. Wysocki
  2021-03-05 18:40 ` [PATCH v1 1/4] ACPI: processor: perflib: Eliminate redundant status check Rafael J. Wysocki
@ 2021-03-05 18:41 ` Rafael J. Wysocki
  2021-03-05 18:42 ` [PATCH v1 3/4] IIO: acpi-als: Get rid of ACPICA message printing Rafael J. Wysocki
  2021-03-05 18:43 ` [PATCH v1 4/4] hwmon: acpi_power_meter: " Rafael J. Wysocki
  3 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-03-05 18:41 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Zhang Rui, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Jean Delvare, Guenter Roeck,
	linux-hwmon, Linux PCI

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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 <rafael.j.wysocki@intel.com>
---
 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;
 	}
 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 3/4] IIO: acpi-als: Get rid of ACPICA message printing
  2021-03-05 18:39 [PATCH v1 0/4] ACPI: New helper for warning messages and replacing ACPI_EXCEPTION() Rafael J. Wysocki
  2021-03-05 18:40 ` [PATCH v1 1/4] ACPI: processor: perflib: Eliminate redundant status check Rafael J. Wysocki
  2021-03-05 18:41 ` [PATCH v1 2/4] ACPI: utils: Introduce acpi_evaluation_failure_warn() Rafael J. Wysocki
@ 2021-03-05 18:42 ` Rafael J. Wysocki
  2021-03-06 14:38   ` Jonathan Cameron
  2021-03-05 18:43 ` [PATCH v1 4/4] hwmon: acpi_power_meter: " Rafael J. Wysocki
  3 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-03-05 18:42 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Zhang Rui, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Jean Delvare, Guenter Roeck,
	linux-hwmon

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Use acpi_evaluation_failure_warn() introduced previously instead of
the ACPICA-specific ACPI_EXCEPTION() macro to log warning messages
regarding ACPI object evaluation failures and drop the
ACPI_MODULE_NAME() definition only used by the ACPICA message
printing macro.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/iio/light/acpi-als.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-pm/drivers/iio/light/acpi-als.c
===================================================================
--- linux-pm.orig/drivers/iio/light/acpi-als.c
+++ linux-pm/drivers/iio/light/acpi-als.c
@@ -26,8 +26,6 @@
 #define ACPI_ALS_DEVICE_NAME		"acpi-als"
 #define ACPI_ALS_NOTIFY_ILLUMINANCE	0x80
 
-ACPI_MODULE_NAME("acpi-als");
-
 /*
  * So far, there's only one channel in here, but the specification for
  * ACPI0008 says there can be more to what the block can report. Like
@@ -91,7 +89,7 @@ static int acpi_als_read_value(struct ac
 				       &temp_val);
 
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Error reading ALS %s", prop));
+		acpi_evaluation_failure_warn(als->device->handle, prop, status);
 		return -EIO;
 	}
 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 4/4] hwmon: acpi_power_meter: Get rid of ACPICA message printing
  2021-03-05 18:39 [PATCH v1 0/4] ACPI: New helper for warning messages and replacing ACPI_EXCEPTION() Rafael J. Wysocki
                   ` (2 preceding siblings ...)
  2021-03-05 18:42 ` [PATCH v1 3/4] IIO: acpi-als: Get rid of ACPICA message printing Rafael J. Wysocki
@ 2021-03-05 18:43 ` Rafael J. Wysocki
  2021-03-06  3:20   ` Guenter Roeck
  3 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-03-05 18:43 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Zhang Rui, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Jean Delvare, Guenter Roeck,
	linux-hwmon

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Use acpi_evaluation_failure_warn() introduced previously instead of
the ACPICA-specific ACPI_EXCEPTION() macro to log warning messages
regarding ACPI object evaluation failures and use dev_err() instead
of ACPI_EXCEPTION() to log _PMC package parsing failures, which is
consistent with the other messages printed by the code in question.

Next, drop the ACPI_MODULE_NAME() definition only used by the ACPICA
message printing macro.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/hwmon/acpi_power_meter.c |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

Index: linux-pm/drivers/hwmon/acpi_power_meter.c
===================================================================
--- linux-pm.orig/drivers/hwmon/acpi_power_meter.c
+++ linux-pm/drivers/hwmon/acpi_power_meter.c
@@ -20,7 +20,6 @@
 #include <linux/acpi.h>
 
 #define ACPI_POWER_METER_NAME		"power_meter"
-ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
 #define ACPI_POWER_METER_DEVICE_NAME	"Power Meter"
 #define ACPI_POWER_METER_CLASS		"pwr_meter_resource"
 
@@ -114,7 +113,8 @@ static int update_avg_interval(struct ac
 	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GAI",
 				       NULL, &data);
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GAI"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GAI",
+					     status);
 		return -ENODEV;
 	}
 
@@ -166,7 +166,8 @@ static ssize_t set_avg_interval(struct d
 	mutex_unlock(&resource->lock);
 
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PAI"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PAI",
+					     status);
 		return -EINVAL;
 	}
 
@@ -186,7 +187,8 @@ static int update_cap(struct acpi_power_
 	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GHL",
 				       NULL, &data);
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GHL"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GHL",
+					     status);
 		return -ENODEV;
 	}
 
@@ -237,7 +239,8 @@ static ssize_t set_cap(struct device *de
 	mutex_unlock(&resource->lock);
 
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SHL"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_SHL",
+					     status);
 		return -EINVAL;
 	}
 
@@ -270,7 +273,8 @@ static int set_acpi_trip(struct acpi_pow
 	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PTP",
 				       &args, &data);
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTP"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PTP",
+					     status);
 		return -EINVAL;
 	}
 
@@ -322,7 +326,8 @@ static int update_meter(struct acpi_powe
 	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PMM",
 				       NULL, &data);
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMM"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMM",
+					     status);
 		return -ENODEV;
 	}
 
@@ -549,7 +554,8 @@ static int read_domain_devices(struct ac
 	status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMD", NULL,
 				      &buffer);
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMD"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMD",
+					     status);
 		return -ENODEV;
 	}
 
@@ -745,7 +751,8 @@ static int read_capabilities(struct acpi
 	status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMC", NULL,
 				      &buffer);
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMC"));
+		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMC",
+					     status);
 		return -ENODEV;
 	}
 
@@ -765,7 +772,9 @@ static int read_capabilities(struct acpi
 
 	status = acpi_extract_package(pss, &format, &state);
 	if (ACPI_FAILURE(status)) {
-		ACPI_EXCEPTION((AE_INFO, status, "Invalid data"));
+		dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME
+			"_PMC package parsing failed: %s\n",
+			acpi_format_exception(status));
 		res = -EFAULT;
 		goto end;
 	}




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 4/4] hwmon: acpi_power_meter: Get rid of ACPICA message printing
  2021-03-05 18:43 ` [PATCH v1 4/4] hwmon: acpi_power_meter: " Rafael J. Wysocki
@ 2021-03-06  3:20   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-03-06  3:20 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Linux PM, Zhang Rui, Jonathan Cameron,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	Jean Delvare, linux-hwmon

On Fri, Mar 05, 2021 at 07:43:54PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Use acpi_evaluation_failure_warn() introduced previously instead of
> the ACPICA-specific ACPI_EXCEPTION() macro to log warning messages
> regarding ACPI object evaluation failures and use dev_err() instead
> of ACPI_EXCEPTION() to log _PMC package parsing failures, which is
> consistent with the other messages printed by the code in question.
> 
> Next, drop the ACPI_MODULE_NAME() definition only used by the ACPICA
> message printing macro.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/hwmon/acpi_power_meter.c |   29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> Index: linux-pm/drivers/hwmon/acpi_power_meter.c
> ===================================================================
> --- linux-pm.orig/drivers/hwmon/acpi_power_meter.c
> +++ linux-pm/drivers/hwmon/acpi_power_meter.c
> @@ -20,7 +20,6 @@
>  #include <linux/acpi.h>
>  
>  #define ACPI_POWER_METER_NAME		"power_meter"
> -ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
>  #define ACPI_POWER_METER_DEVICE_NAME	"Power Meter"
>  #define ACPI_POWER_METER_CLASS		"pwr_meter_resource"
>  
> @@ -114,7 +113,8 @@ static int update_avg_interval(struct ac
>  	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GAI",
>  				       NULL, &data);
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GAI"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GAI",
> +					     status);
>  		return -ENODEV;
>  	}
>  
> @@ -166,7 +166,8 @@ static ssize_t set_avg_interval(struct d
>  	mutex_unlock(&resource->lock);
>  
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PAI"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PAI",
> +					     status);
>  		return -EINVAL;
>  	}
>  
> @@ -186,7 +187,8 @@ static int update_cap(struct acpi_power_
>  	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GHL",
>  				       NULL, &data);
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GHL"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_GHL",
> +					     status);
>  		return -ENODEV;
>  	}
>  
> @@ -237,7 +239,8 @@ static ssize_t set_cap(struct device *de
>  	mutex_unlock(&resource->lock);
>  
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SHL"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_SHL",
> +					     status);
>  		return -EINVAL;
>  	}
>  
> @@ -270,7 +273,8 @@ static int set_acpi_trip(struct acpi_pow
>  	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PTP",
>  				       &args, &data);
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTP"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PTP",
> +					     status);
>  		return -EINVAL;
>  	}
>  
> @@ -322,7 +326,8 @@ static int update_meter(struct acpi_powe
>  	status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PMM",
>  				       NULL, &data);
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMM"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMM",
> +					     status);
>  		return -ENODEV;
>  	}
>  
> @@ -549,7 +554,8 @@ static int read_domain_devices(struct ac
>  	status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMD", NULL,
>  				      &buffer);
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMD"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMD",
> +					     status);
>  		return -ENODEV;
>  	}
>  
> @@ -745,7 +751,8 @@ static int read_capabilities(struct acpi
>  	status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMC", NULL,
>  				      &buffer);
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMC"));
> +		acpi_evaluation_failure_warn(resource->acpi_dev->handle, "_PMC",
> +					     status);
>  		return -ENODEV;
>  	}
>  
> @@ -765,7 +772,9 @@ static int read_capabilities(struct acpi
>  
>  	status = acpi_extract_package(pss, &format, &state);
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Invalid data"));
> +		dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME
> +			"_PMC package parsing failed: %s\n",
> +			acpi_format_exception(status));
>  		res = -EFAULT;
>  		goto end;
>  	}
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 3/4] IIO: acpi-als: Get rid of ACPICA message printing
  2021-03-05 18:42 ` [PATCH v1 3/4] IIO: acpi-als: Get rid of ACPICA message printing Rafael J. Wysocki
@ 2021-03-06 14:38   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2021-03-06 14:38 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Linux PM, Zhang Rui, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, Jean Delvare, Guenter Roeck,
	linux-hwmon

On Fri, 05 Mar 2021 19:42:29 +0100
"Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:

> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Use acpi_evaluation_failure_warn() introduced previously instead of
> the ACPICA-specific ACPI_EXCEPTION() macro to log warning messages
> regarding ACPI object evaluation failures and drop the
> ACPI_MODULE_NAME() definition only used by the ACPICA message
> printing macro.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/iio/light/acpi-als.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> Index: linux-pm/drivers/iio/light/acpi-als.c
> ===================================================================
> --- linux-pm.orig/drivers/iio/light/acpi-als.c
> +++ linux-pm/drivers/iio/light/acpi-als.c
> @@ -26,8 +26,6 @@
>  #define ACPI_ALS_DEVICE_NAME		"acpi-als"
>  #define ACPI_ALS_NOTIFY_ILLUMINANCE	0x80
>  
> -ACPI_MODULE_NAME("acpi-als");
> -
>  /*
>   * So far, there's only one channel in here, but the specification for
>   * ACPI0008 says there can be more to what the block can report. Like
> @@ -91,7 +89,7 @@ static int acpi_als_read_value(struct ac
>  				       &temp_val);
>  
>  	if (ACPI_FAILURE(status)) {
> -		ACPI_EXCEPTION((AE_INFO, status, "Error reading ALS %s", prop));
> +		acpi_evaluation_failure_warn(als->device->handle, prop, status);
>  		return -EIO;
>  	}
>  
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-06 14:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 18:39 [PATCH v1 0/4] ACPI: New helper for warning messages and replacing ACPI_EXCEPTION() Rafael J. Wysocki
2021-03-05 18:40 ` [PATCH v1 1/4] ACPI: processor: perflib: Eliminate redundant status check Rafael J. Wysocki
2021-03-05 18:41 ` [PATCH v1 2/4] ACPI: utils: Introduce acpi_evaluation_failure_warn() Rafael J. Wysocki
2021-03-05 18:42 ` [PATCH v1 3/4] IIO: acpi-als: Get rid of ACPICA message printing Rafael J. Wysocki
2021-03-06 14:38   ` Jonathan Cameron
2021-03-05 18:43 ` [PATCH v1 4/4] hwmon: acpi_power_meter: " Rafael J. Wysocki
2021-03-06  3:20   ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.