summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-10-05 12:05:03 +0200
committerSebastian Reichel <sebastian.reichel@collabora.com>2024-10-15 22:22:20 +0200
commit49000fee9e639f62ba1f965ed2ae4c5ad18d19e2 (patch)
tree1ddaf734bd3627efe15df9de9d495be199615b5f
parentb5289ba57a27a212acad14b81ec6597ce140e01d (diff)
downloadlwn-49000fee9e639f62ba1f965ed2ae4c5ad18d19e2.tar.gz
lwn-49000fee9e639f62ba1f965ed2ae4c5ad18d19e2.zip
power: supply: core: add wakeup source inhibit by power_supply_config
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>
-rw-r--r--drivers/power/supply/power_supply_core.c3
-rw-r--r--include/linux/power_supply.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 5aefba2ddcda..a2005e3c6f38 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -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;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 4e29ec39c18f..9a64043798bd 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -236,6 +236,8 @@ struct power_supply_config {
char **supplied_to;
size_t num_supplicants;
+
+ bool no_wakeup_source;
};
/* Description of power supply */