[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240112075828.GI1920897@google.com>
Date: Fri, 12 Jan 2024 07:58:28 +0000
From: Lee Jones <lee@...nel.org>
To: Karel Balej <karelb@...li.ms.mff.cuni.cz>
Cc: Karel Balej <balejk@...fyz.cz>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
Duje Mihanović <duje.mihanovic@...le.hr>,
~postmarketos/upstreaming@...ts.sr.ht, phone-devel@...r.kernel.org
Subject: Re: [RFC PATCH 1/5] mfd: 88pm88x: differences with respect to the
PMIC RFC series
On Thu, 11 Jan 2024, Karel Balej wrote:
> On Thu Jan 11, 2024 at 4:25 PM CET, Lee Jones wrote:
>
> [...]
>
> > > > > diff --git a/include/linux/mfd/88pm88x.h b/include/linux/mfd/88pm88x.h
> > > > > index a34c57447827..9a335f6b9c07 100644
> > > > > --- a/include/linux/mfd/88pm88x.h
> > > > > +++ b/include/linux/mfd/88pm88x.h
> > > > > @@ -49,6 +49,8 @@ struct pm88x_data {
> > > > > unsigned int whoami;
> > > > > struct reg_sequence *presets;
> > > > > unsigned int num_presets;
> > > > > + struct mfd_cell *devs;
> > > > > + unsigned int num_devs;
> > > >
> > > > Why are you adding extra abstraction?
> > >
> > > Right, this is probably not necessary now since I'm only implementing
> > > support for one of the chips - it's just that I keep thinking about it
> > > as a driver for both of them and thus tend to write it a bit more
> > > abstractly. Shall I then drop this and also the `presets` member which
> > > is also chip-specific?
> >
> > Even if you were to support multiple devices, this strategy is unusual
> > and isn't likely to be accepted.
>
> May I please ask what the recommended strategy is then? `switch`ing on
> the chip ID? I have taken this approach because it seemed to produce a
> cleaner/more straightforward code in comparison to that. Or are you only
> talking about the chip cells/subdevices in particular?
I'd have to see the implementation, but the general exception I'm taking
here is storing the use-once MFD cell data inside a data structure. If
you were to match on device ID it's *sometimes* acceptable to store the
pointers in local variables.
--
Lee Jones [李琼斯]
Powered by blists - more mailing lists