Skip to content

Commit

Permalink
power: supply: core: simplify power_supply_class_init
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sre committed Mar 5, 2024
1 parent 68ade09 commit ea1ec76
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions drivers/power/supply/power_supply_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ea1ec76

Please sign in to comment.