Hi,
On 4/5/21 11:32 PM, Sebastian Reichel wrote:
[...]
+static void spwr_battery_unregister(struct spwr_battery_device *bat)
+{
+ ssam_notifier_unregister(bat->sdev->ctrl, &bat->notif);
+ cancel_delayed_work_sync(&bat->update_work);
+ device_remove_file(&bat->psy->dev, &alarm_attr);
+ power_supply_unregister(bat->psy);
power_supply_unregister being the last function call is a clear
sign, that devm_power_supply_register can be used instead.
Right, that works here. I normally try to not mix devm code with
non-devm code (apart from maybe allocations).
well allocations are usually done first and free'd last making
them the first targets in the conversion and pretty much a no
brainer.
Next merge window it's possible to easily go to full devm by
using devm_delayed_work_autocancel(), which has been merged
by Greg two weeks ago. Then last but not least do the ssam
notifier unregister via devm_add_action_or_reset and its fully
converted :)
Neat, I'll have a look at maybe adding some devm versions for the
SSAM notifiers. Should help in at least one other driver apart from
these two.
Thanks,
Max