diff options
| author | Sebastian Reichel <sebastian.reichel@collabora.com> | 2018-09-27 09:46:03 -0400 |
|---|---|---|
| committer | Sebastian Reichel <sre@kernel.org> | 2018-12-12 18:15:06 -0500 |
| commit | cef8fe6a382cb556b590269e9d1dfc0241014903 (patch) | |
| tree | 0f96102a6fe960af19ee8b5d0b15b44ab23e1d56 | |
| parent | 4a040e7c72e6bd2ffc023ecca31e336aec9dbb87 (diff) | |
power: supply: core: add support for custom sysfs attributes
Add functionality to setup device specific sysfs attributes
in a race condition free manner
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| -rw-r--r-- | drivers/power/supply/power_supply_core.c | 1 | ||||
| -rw-r--r-- | include/linux/power_supply.h | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 93007cb202f0..569790ea6917 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c | |||
| @@ -1018,6 +1018,7 @@ __power_supply_register(struct device *parent, | |||
| 1018 | dev_set_drvdata(dev, psy); | 1018 | dev_set_drvdata(dev, psy); |
| 1019 | psy->desc = desc; | 1019 | psy->desc = desc; |
| 1020 | if (cfg) { | 1020 | if (cfg) { |
| 1021 | dev->groups = cfg->attr_grp; | ||
| 1021 | psy->drv_data = cfg->drv_data; | 1022 | psy->drv_data = cfg->drv_data; |
| 1022 | psy->of_node = | 1023 | psy->of_node = |
| 1023 | cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node; | 1024 | cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node; |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 84fe93f674a0..57b2ab82b951 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -204,6 +204,9 @@ struct power_supply_config { | |||
| 204 | /* Driver private data */ | 204 | /* Driver private data */ |
| 205 | void *drv_data; | 205 | void *drv_data; |
| 206 | 206 | ||
| 207 | /* Device specific sysfs attributes */ | ||
| 208 | const struct attribute_group **attr_grp; | ||
| 209 | |||
| 207 | char **supplied_to; | 210 | char **supplied_to; |
| 208 | size_t num_supplicants; | 211 | size_t num_supplicants; |
| 209 | }; | 212 | }; |
