diff options
author | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-03-01 23:58:27 +0100 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-03-06 00:21:34 +0100 |
commit | ea1ec769d1f01a9900127e83e63dfdd77d096c8a (patch) | |
tree | 74f6b911a89263e44e30acfdfcb6019c1a3b980d /drivers/power | |
parent | power: supply: core: add power_supply_for_each_device() (diff) | |
download | linux-ea1ec769d1f01a9900127e83e63dfdd77d096c8a.tar.xz linux-ea1ec769d1f01a9900127e83e63dfdd77d096c8a.zip |
power: supply: core: simplify power_supply_class_init
Technically the sysfs attributes should be initialized
before the class is registered, since that will use them.
As a nice side effect this nicely simplifies the code,
since it allows dropping the helper variable.
Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20240301-psy-class-cleanup-v1-2-aebe8c4b6b08@collabora.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/power_supply_core.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 0eb8a57dda70..4daea6ed8f1d 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -1622,15 +1622,8 @@ EXPORT_SYMBOL_GPL(power_supply_get_drvdata); static int __init power_supply_class_init(void) { - int err; - - err = class_register(&power_supply_class); - if (err) - return err; - power_supply_init_attrs(); - - return 0; + return class_register(&power_supply_class); } static void __exit power_supply_class_exit(void) |