From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Armin Wolf <W_Armin@gmx.de>
Cc: Sebastian Reichel <sre@kernel.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC v2 3/5] power: supply: core: implement extension API
Date: Fri, 14 Jun 2024 09:02:29 +0200 [thread overview]
Message-ID: <3491c641-bee2-4100-8eb6-8e90d63330b0@t-8ch.de> (raw)
In-Reply-To: <76dff03c-08f6-4edc-af57-c0b8dbf55293@gmx.de>
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@weissschuh.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
<snip>
next prev parent reply other threads:[~2024-06-14 7:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-08 19:19 [PATCH RFC v2 0/5] power: supply: " Thomas Weißschuh
2024-06-08 19:19 ` [PATCH RFC v2 1/5] power: supply: sysfs: use power_supply_property_is_writeable() Thomas Weißschuh
2024-06-08 19:19 ` [PATCH RFC v2 2/5] power: supply: core: avoid iterating properties directly Thomas Weißschuh
2024-07-04 10:42 ` Sebastian Reichel
2024-06-08 19:19 ` [PATCH RFC v2 3/5] power: supply: core: implement extension API Thomas Weißschuh
2024-06-13 23:11 ` Armin Wolf
2024-06-14 7:02 ` Thomas Weißschuh [this message]
2024-06-19 23:14 ` Armin Wolf
2024-06-08 19:19 ` [PATCH RFC v2 4/5] power: supply: test-power: implement a power supply extension Thomas Weißschuh
2024-06-08 19:19 ` [PATCH RFC v2 5/5] platform/x86: system76: Use power_supply extension API Thomas Weißschuh
2024-07-04 10:44 ` (subset) [PATCH RFC v2 0/5] power: supply: " Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3491c641-bee2-4100-8eb6-8e90d63330b0@t-8ch.de \
--to=linux@weissschuh.net \
--cc=W_Armin@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®