]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
power: supply: core: add wakeup source inhibit by power_supply_config
authorThomas Weißschuh <linux@weissschuh.net>
Sat, 5 Oct 2024 10:05:03 +0000 (12:05 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 15 Oct 2024 20:22:20 +0000 (22:22 +0200)
To inhibit wakeup users currently have to use dedicated functions to
register the power supply: {,devm_}power_supply_register_no_ws().
This is inconsistent to other runtime settings which can be configured
through struct power_supply_config.
It's also not obvious what _no_ws() is meant to mean.

Extend power_supply_config to also be able to inhibit the wakeup source.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20241005-power-supply-no-wakeup-source-v1-1-1d62bf9bcb1d@weissschuh.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_core.c
include/linux/power_supply.h

index 5aefba2ddcda12a9f24d096fa361aa8e4ce1a681..a2005e3c6f38db50ffed89b6b0c767e25d7863c6 100644 (file)
@@ -1410,6 +1410,9 @@ __power_supply_register(struct device *parent,
        if (rc)
                goto device_add_failed;
 
+       if (cfg && cfg->no_wakeup_source)
+               ws = false;
+
        rc = device_init_wakeup(dev, ws);
        if (rc)
                goto wakeup_init_failed;
index 4e29ec39c18f26f3e15343e198f74e8a96613e92..9a64043798bd7885966e3ee927627128f1077ef1 100644 (file)
@@ -236,6 +236,8 @@ struct power_supply_config {
 
        char **supplied_to;
        size_t num_supplicants;
+
+       bool no_wakeup_source;
 };
 
 /* Description of power supply */