lkml.org 
[lkml]   [2021]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] power: supply: Add battery driver for Surface Aggregator Module
From
Date
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

\
 
 \ /
  Last update: 2021-04-06 00:35    [W:0.042 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site