diff options
author | Ricardo B. Marliere <ricardo@marliere.net> | 2024-02-24 23:15:41 +0300 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-02-25 23:05:53 +0300 |
commit | 7b46b60944d77e361a727cd8ce46aec31c146e26 (patch) | |
tree | 62e6b62846a9e642abe7f6dba074c5cf688aa920 /drivers/power/supply/power_supply.h | |
parent | 9e6047c01159697cfd2f9b7788af9fe90fc7f544 (diff) | |
download | linux-7b46b60944d77e361a727cd8ce46aec31c146e26.tar.xz |
power: supply: core: constify the struct device_type usage
Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
power_supply_dev_type variable to be a constant structure as well, placing
it into read-only memory which can not be modified at runtime.
In order to accomplish that, export power_supply_attr_group in
power_supply.h and use it with the macro __ATTRIBUTE_GROUPS when defining
power_supply_dev_type in power_supply_core.c. Therefore the attribute group
is no longer static. Lastly, because power_supply_attr_groups is no longer
dynamically associated to power_supply_dev_type in
power_supply_init_attrs(), make the function receive zero arguments.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20240224-device_cleanup-power-v2-1-465ff94b896c@marliere.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply/power_supply.h')
-rw-r--r-- | drivers/power/supply/power_supply.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/power/supply/power_supply.h b/drivers/power/supply/power_supply.h index 645eee4d6b6a..232fdd8c1212 100644 --- a/drivers/power/supply/power_supply.h +++ b/drivers/power/supply/power_supply.h @@ -13,9 +13,11 @@ struct device; struct device_type; struct power_supply; +extern const struct attribute_group power_supply_attr_group; + #ifdef CONFIG_SYSFS -extern void power_supply_init_attrs(struct device_type *dev_type); +extern void power_supply_init_attrs(void); extern int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env); #else |