[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2b7d9f31-a24b-4dac-b57e-8cca165a79b1@gmx.de>
Date: Thu, 20 Jun 2024 01:14:01 +0200
From: Armin Wolf <W_Armin@....de>
To: Thomas Weißschuh <linux@...ssschuh.net>
Cc: Sebastian Reichel <sre@...nel.org>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC v2 3/5] power: supply: core: implement extension API
Am 14.06.24 um 09:02 schrieb Thomas Weißschuh:
> Hi!
>
> On 2024-06-14 01:11:29+0000, Armin Wolf wrote:
>> Am 08.06.24 um 21:19 schrieb Thomas Weißschuh:
>>
>>> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
>>> ---
>>> drivers/power/supply/power_supply.h | 13 ++-
>>> drivers/power/supply/power_supply_core.c | 128 ++++++++++++++++++++++++++++--
>>> drivers/power/supply/power_supply_hwmon.c | 2 +-
>>> drivers/power/supply/power_supply_sysfs.c | 37 ++++++++-
>>> include/linux/power_supply.h | 26 ++++++
>>> 5 files changed, 192 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/drivers/power/supply/power_supply.h b/drivers/power/supply/power_supply.h
>>> index 622be1f0a180..686b66161900 100644
>>> --- a/drivers/power/supply/power_supply.h
>>> +++ b/drivers/power/supply/power_supply.h
>>> @@ -13,8 +13,17 @@ struct device;
>>> struct device_type;
>>> struct power_supply;
>>>
>>> -extern bool power_supply_has_property(const struct power_supply_desc *psy_desc,
>>> - enum power_supply_property psp);
>>> +struct psy_ext_registration {
>>> + struct list_head list_head;
>>> + const struct power_supply_ext *ext;
>>> +};
>>> +
>>> +#define psy_for_each_extension(psy, pos) list_for_each_entry(pos, &(psy)->extensions, list_head)
>> sorry for taking so long to respond, the patch looks good to me except one single thing:
>>
>> when removing a power supply extension, the driver has to be sure that no one is still using
>> the removed extension. So you might want to add some sort of locking when using a power supply
>> extension.
> That was part of the v1 of the series [0].
> I dropped it in v2 to focus on the external API and semantics first.
> IMO now that we have the loop macro anyways that can also take care of
> the locking: psy_for_each_extension_locked()
>
> [0] https://lore.kernel.org/all/20240606-power-supply-extensions-v1-4-b45669290bdc@weissschuh.net/
>
> Thomas
Sounds good to me.
Thanks,
Armin Wolf
> <snip>
Powered by blists - more mailing lists