]> www.infradead.org Git - users/willy/xarray.git/commitdiff
power: reset: gpio-poweroff: Clarify the warning message
authorFabio Estevam <festevam@gmail.com>
Thu, 12 Dec 2024 13:04:56 +0000 (10:04 -0300)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 12 Dec 2024 22:34:50 +0000 (23:34 +0100)
When gpio-poweroff fails, a WARN_ON() is triggered without
an explanation to the user about the failure.

Add some comments explaining that the attempt to poweroff the system
via gpio-poweroff failed and convert it to a WARN() message with a
bit of context to provide some hint to the user.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20241212130456.580197-1-festevam@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/reset/gpio-poweroff.c

index 52cfeee2cb2844d88ab0b7d80dc38fb74ef581db..3eaae352ffb9cb7491a1d7b96bbd112d6caf714e 100644 (file)
@@ -44,7 +44,13 @@ static int gpio_poweroff_do_poweroff(struct sys_off_data *data)
        /* give it some time */
        mdelay(gpio_poweroff->timeout_ms);
 
-       WARN_ON(1);
+       /*
+        * If code reaches this point, it means that gpio-poweroff has failed
+        * to actually power off the system.
+        * Warn the user that the attempt to poweroff via gpio-poweroff
+        * has gone wrong.
+        */
+       WARN(1, "Failed to poweroff via gpio-poweroff mechanism\n");
 
        return NOTIFY_DONE;
 }