2021-11-16 20:06:26

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH] ACPI: PM: Emit debug messages when enabling/disabling wakeup power

From: Rafael J. Wysocki <[email protected]>

Print additional debug messages when enabling and disabling wakeup
power for an ACPI device object to facilitate more fine-grained
debugging of problems in that area.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
drivers/acpi/power.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -716,6 +716,9 @@ int acpi_enable_wakeup_device_power(stru

mutex_lock(&acpi_device_lock);

+ dev_dbg(&dev->dev, "Enabling wakeup power (count %d)\n",
+ dev->wakeup.prepare_count);
+
if (dev->wakeup.prepare_count++)
goto out;

@@ -734,8 +737,11 @@ int acpi_enable_wakeup_device_power(stru
if (err) {
acpi_power_off_list(&dev->wakeup.resources);
dev->wakeup.prepare_count = 0;
+ goto out;
}

+ dev_dbg(&dev->dev, "Wakeup power enabled\n");
+
out:
mutex_unlock(&acpi_device_lock);
return err;
@@ -757,6 +763,9 @@ int acpi_disable_wakeup_device_power(str

mutex_lock(&acpi_device_lock);

+ dev_dbg(&dev->dev, "Disabling wakeup power (count %d)\n",
+ dev->wakeup.prepare_count);
+
/* Do nothing if wakeup power has not been enabled for this device. */
if (dev->wakeup.prepare_count <= 0)
goto out;
@@ -782,8 +791,11 @@ int acpi_disable_wakeup_device_power(str
if (err) {
dev_err(&dev->dev, "Cannot turn off wakeup power resources\n");
dev->wakeup.flags.valid = 0;
+ goto out;
}

+ dev_dbg(&dev->dev, "Wakeup power disabled\n");
+
out:
mutex_unlock(&acpi_device_lock);
return err;