All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] ACPI: PM: Debug improvements
@ 2022-04-04 14:59 Rafael J. Wysocki
  2022-04-04 15:00 ` [PATCH v1 1/3] ACPI: PM: Convert debug message in acpi_device_get_power() Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-04-04 14:59 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Linux PM

Hi All,

This patch series improves messaging related to ACPI device power management
debug.

Please refer to the patch changelogs for details.

Thanks!




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

* [PATCH v1 1/3] ACPI: PM: Convert debug message in acpi_device_get_power()
  2022-04-04 14:59 [PATCH v1 0/3] ACPI: PM: Debug improvements Rafael J. Wysocki
@ 2022-04-04 15:00 ` Rafael J. Wysocki
  2022-04-04 15:02 ` [PATCH v1 2/3] ACPI: PM: Change pr_fmt() in device_pm.c Rafael J. Wysocki
  2022-04-04 15:03 ` [PATCH v1 3/3] ACPI: PM: Unify debug messages in acpi_device_set_power() Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-04-04 15:00 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Linux PM

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

Convert the debug message printed by acpi_device_get_power() to
acpi_handle_debug(), because that function is also called when
the ACPI device object name has not been set yet and the dev_dbg()
message printed by it at that time is not useful.

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

Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -130,8 +130,8 @@ int acpi_device_get_power(struct acpi_de
 	*state = result;
 
  out:
-	dev_dbg(&device->dev, "Device power state is %s\n",
-		acpi_power_state_string(*state));
+	acpi_handle_debug(device->handle, "Power state: %s\n",
+			  acpi_power_state_string(*state));
 
 	return 0;
 }




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

* [PATCH v1 2/3] ACPI: PM: Change pr_fmt() in device_pm.c
  2022-04-04 14:59 [PATCH v1 0/3] ACPI: PM: Debug improvements Rafael J. Wysocki
  2022-04-04 15:00 ` [PATCH v1 1/3] ACPI: PM: Convert debug message in acpi_device_get_power() Rafael J. Wysocki
@ 2022-04-04 15:02 ` Rafael J. Wysocki
  2022-04-04 15:03 ` [PATCH v1 3/3] ACPI: PM: Unify debug messages in acpi_device_set_power() Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-04-04 15:02 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Linux PM

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

All messages printed by functions in this file either contain
the "ACPI" or "acpi" string regardless of the format, or they don't
need to contain it at all.

In the former case, the "ACPI:" string added by the format is
redundant, so drop it from there.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/device_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -10,7 +10,7 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
-#define pr_fmt(fmt) "ACPI: PM: " fmt
+#define pr_fmt(fmt) "PM: " fmt
 
 #include <linux/acpi.h>
 #include <linux/export.h>




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

* [PATCH v1 3/3] ACPI: PM: Unify debug messages in acpi_device_set_power()
  2022-04-04 14:59 [PATCH v1 0/3] ACPI: PM: Debug improvements Rafael J. Wysocki
  2022-04-04 15:00 ` [PATCH v1 1/3] ACPI: PM: Convert debug message in acpi_device_get_power() Rafael J. Wysocki
  2022-04-04 15:02 ` [PATCH v1 2/3] ACPI: PM: Change pr_fmt() in device_pm.c Rafael J. Wysocki
@ 2022-04-04 15:03 ` Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-04-04 15:03 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Linux PM

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

Convert all of the debug messages printed by acpi_device_set_power()
to acpi_handle_debug() and adjust them slightly for consistency with
acpi_device_get_power() and other acpi_device_set_power() debug
messages.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/device_pm.c |   36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -174,8 +174,8 @@ int acpi_device_set_power(struct acpi_de
 
 	/* There is a special case for D0 addressed below. */
 	if (state > ACPI_STATE_D0 && state == device->power.state) {
-		dev_dbg(&device->dev, "Device already in %s\n",
-			acpi_power_state_string(state));
+		acpi_handle_debug(device->handle, "Already in %s\n",
+				  acpi_power_state_string(state));
 		return 0;
 	}
 
@@ -189,17 +189,17 @@ int acpi_device_set_power(struct acpi_de
 		if (!device->power.states[ACPI_STATE_D3_COLD].flags.valid)
 			target_state = state;
 	} else if (!device->power.states[state].flags.valid) {
-		dev_warn(&device->dev, "Power state %s not supported\n",
-			 acpi_power_state_string(state));
+		acpi_handle_debug(device->handle, "Power state %s not supported\n",
+				  acpi_power_state_string(state));
 		return -ENODEV;
 	}
 
-	if (!device->power.flags.ignore_parent &&
-	    device->parent && (state < device->parent->power.state)) {
-		dev_warn(&device->dev,
-			 "Cannot transition to power state %s for parent in %s\n",
-			 acpi_power_state_string(state),
-			 acpi_power_state_string(device->parent->power.state));
+	if (!device->power.flags.ignore_parent && device->parent &&
+	    state < device->parent->power.state) {
+		acpi_handle_debug(device->handle,
+				  "Cannot transition to %s for parent in %s\n",
+				  acpi_power_state_string(state),
+				  acpi_power_state_string(device->parent->power.state));
 		return -ENODEV;
 	}
 
@@ -216,9 +216,10 @@ int acpi_device_set_power(struct acpi_de
 		 * (deeper) states to higher-power (shallower) states.
 		 */
 		if (state < device->power.state) {
-			dev_warn(&device->dev, "Cannot transition from %s to %s\n",
-				 acpi_power_state_string(device->power.state),
-				 acpi_power_state_string(state));
+			acpi_handle_debug(device->handle,
+					  "Cannot transition from %s to %s\n",
+					  acpi_power_state_string(device->power.state),
+					  acpi_power_state_string(state));
 			return -ENODEV;
 		}
 
@@ -271,12 +272,13 @@ int acpi_device_set_power(struct acpi_de
 
  end:
 	if (result) {
-		dev_warn(&device->dev, "Failed to change power state to %s\n",
-			 acpi_power_state_string(target_state));
+		acpi_handle_debug(device->handle,
+				  "Failed to change power state to %s\n",
+				  acpi_power_state_string(target_state));
 	} else {
 		device->power.state = target_state;
-		dev_dbg(&device->dev, "Power state changed to %s\n",
-			acpi_power_state_string(target_state));
+		acpi_handle_debug(device->handle, "Power state changed to %s\n",
+				  acpi_power_state_string(target_state));
 	}
 
 	return result;




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

end of thread, other threads:[~2022-04-04 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 14:59 [PATCH v1 0/3] ACPI: PM: Debug improvements Rafael J. Wysocki
2022-04-04 15:00 ` [PATCH v1 1/3] ACPI: PM: Convert debug message in acpi_device_get_power() Rafael J. Wysocki
2022-04-04 15:02 ` [PATCH v1 2/3] ACPI: PM: Change pr_fmt() in device_pm.c Rafael J. Wysocki
2022-04-04 15:03 ` [PATCH v1 3/3] ACPI: PM: Unify debug messages in acpi_device_set_power() Rafael J. Wysocki

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.