Linux Power Management development
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>, Armin Wolf <w_armin@gmx.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 5/5] ACPI: fan: Use acpi_handle_debug/err() for diagnostic messages
Date: Wed, 25 Nov 2026 15:10:29 +0100	[thread overview]
Message-ID: <2374022.iZASKD2KPV@rafael.j.wysocki> (raw)
In-Reply-To: <2859850.mvXUDI8C0e@rafael.j.wysocki>

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

Use acpi_handle_debug() or acpi_handle_err() for printing all of the
remaining diagnostic messages in the ACPI fan driver core code that
are still printed relative to the fan ACPI device object.

It is better to print them relative the device object's path in the
ACPI namespace because that's where the problems actually happen.

Also, add FW_BUG to error messages printed on errors that cause probe
to fail.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
---

v1 -> v2:
   * Add R-by from Armin (thanks!)

---
 drivers/acpi/fan_core.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
index f1efa0db9958..95ffacfa22c9 100644
--- a/drivers/acpi/fan_core.c
+++ b/drivers/acpi/fan_core.c
@@ -109,7 +109,8 @@ static int fan_get_state_acpi4(struct acpi_fan *fan, unsigned long *state)
 	if (fan->fif.fine_grain_ctrl) {
 		/* This control should be same what we set using _FSL by spec */
 		if (fst.control > 100) {
-			dev_dbg(&device->dev, "Invalid control value returned\n");
+			acpi_handle_debug(device->handle,
+					  "Invalid control value returned\n");
 			goto match_fps;
 		}
 
@@ -123,7 +124,7 @@ static int fan_get_state_acpi4(struct acpi_fan *fan, unsigned long *state)
 			break;
 	}
 	if (i == fan->fps_count) {
-		dev_dbg(&device->dev, "No matching fps control value\n");
+		acpi_handle_debug(device->handle, "No matching fps control value\n");
 		return -EINVAL;
 	}
 
@@ -193,7 +194,7 @@ static int fan_set_state_acpi4(struct acpi_fan *fan, unsigned long state)
 
 	status = acpi_execute_simple_method(device->handle, "_FSL", value);
 	if (ACPI_FAILURE(status)) {
-		dev_dbg(&device->dev, "Failed to set state by _FSL\n");
+		acpi_handle_debug(device->handle, "Failed to set state by _FSL\n");
 		return -ENODEV;
 	}
 
@@ -236,13 +237,13 @@ static int acpi_fan_get_fif(struct acpi_fan *fan, struct acpi_device *device)
 
 	union acpi_object *obj __free(acpi_object_free) = buffer.pointer;
 	if (!obj || obj->type != ACPI_TYPE_PACKAGE) {
-		dev_err(&device->dev, "Invalid _FIF data\n");
+		acpi_handle_err(device->handle, FW_BUG "Invalid _FIF data\n");
 		return -ENODATA;
 	}
 
 	status = acpi_extract_package(obj, &format, &fif);
 	if (ACPI_FAILURE(status)) {
-		dev_err(&device->dev, "Invalid _FIF element\n");
+		acpi_handle_err(device->handle, FW_BUG "Invalid _FIF element\n");
 		return -ENODATA;
 	}
 
@@ -281,7 +282,7 @@ static int acpi_fan_get_fps(struct acpi_fan *fan, struct device *dev,
 
 	union acpi_object *obj __free(acpi_object_free) = buffer.pointer;
 	if (!obj || obj->type != ACPI_TYPE_PACKAGE || obj->package.count < 2) {
-		dev_err(&device->dev, "Invalid _FPS data\n");
+		acpi_handle_err(device->handle, FW_BUG "Invalid _FPS data\n");
 		return -ENODATA;
 	}
 
@@ -297,7 +298,8 @@ static int acpi_fan_get_fps(struct acpi_fan *fan, struct device *dev,
 		status = acpi_extract_package(&obj->package.elements[i + 1],
 					      &format, &fps);
 		if (ACPI_FAILURE(status)) {
-			dev_err(&device->dev, "Invalid _FPS element\n");
+			acpi_handle_err(device->handle,
+					FW_BUG "Invalid _FPS element\n");
 			return -ENODATA;
 		}
 	}
-- 
2.51.0





      parent reply	other threads:[~2026-11-25 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2859850.mvXUDI8C0e@rafael.j.wysocki>
2026-11-25 14:09 ` [PATCH v2 4/5] ACPI: fan: Add local variable dev to acpi_fan_probe() Rafael J. Wysocki
2026-11-25 14:10 ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2374022.iZASKD2KPV@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=w_armin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox