power: supply: charger-manager: fix race-condition in sysfs registration

This registers custom sysfs properties using the native functionality
of the power-supply framework, which cleans up the code a bit and
fixes a race-condition. Before this patch the sysfs attributes were
not properly registered to udev.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Sebastian Reichel 2018-09-28 17:35:37 +02:00 committed by Sebastian Reichel
parent efcca6bdfb
commit 157ba1bb5f
2 changed files with 24 additions and 30 deletions

View file

@ -119,7 +119,7 @@ struct charger_regulator {
struct charger_cable *cables;
int num_cables;
struct attribute_group attr_g;
struct attribute_group attr_grp;
struct device_attribute attr_name;
struct device_attribute attr_state;
struct device_attribute attr_externally_control;
@ -186,6 +186,7 @@ struct charger_desc {
int num_charger_regulators;
struct charger_regulator *charger_regulators;
const struct attribute_group **sysfs_groups;
const char *psy_fuel_gauge;