[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5e6692b9-d043-8a18-8d76-afb235caddbb@gmail.com>
Date: Tue, 6 Apr 2021 00:34:28 +0200
From: Maximilian Luz <luzmaximilian@...il.com>
To: Sebastian Reichel <sebastian.reichel@...labora.com>
Cc: Hans de Goede <hdegoede@...hat.com>, linux-pm@...r.kernel.org,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] power: supply: Add battery driver for Surface
Aggregator Module
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
Powered by blists - more mailing lists