[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zz4OTBF66WfvnP2P@smile.fi.intel.com>
Date: Wed, 20 Nov 2024 18:29:00 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Cedric Encarnacion <cedricjustine.encarnacion@...log.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-doc@...r.kernel.org,
linux-hwmon@...r.kernel.org, Jean Delvare <jdelvare@...e.com>,
Jonathan Corbet <corbet@....net>,
Delphine CC Chiu <Delphine_CC_Chiu@...ynn.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Radu Sabau <radu.sabau@...log.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Alexis Czezar Torreno <alexisczezar.torreno@...log.com>
Subject: Re: [PATCH 2/2] hwmon: (pmbus/adp1050): add support for adp1051,
adp1055 and ltp8800
On Wed, Nov 20, 2024 at 06:53:58AM -0800, Guenter Roeck wrote:
> On 11/20/24 05:52, Andy Shevchenko wrote:
> > On Wed, Nov 20, 2024 at 11:58:26AM +0800, Cedric Encarnacion wrote:
...
> > > +#if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR)
> >
> > Why? Is the data type undefined without this?
>
> Look into other drivers. That is how it is implemented there,
> and not really the point. One has to know about an alternative to use it.
>
> > > +static const struct regulator_desc adp1050_reg_desc[] = {
> > > + PMBUS_REGULATOR_ONE("vout"),
> > > +};
> > > +#endif /* CONFIG_SENSORS_ADP1050_REGULATOR */
> >
> > Note, this can be dropped anyway in order to use PTR_IF() below, if required.
>
> FWIW, PTR_IF() isn't widely used, and I for my part was not aware that
> it exists.
Yeah, it's a relatively new one...
...
> > > +#if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR)
> > > + .num_regulators = 1,
> > > + .reg_desc = adp1050_reg_desc,
> > > +#endif
> >
> > Ditto, are the fields not defined without the symbol?
>
> They are, but they must be 0/NULL. PTR_IF() would be an alternative.
> It is a bit odd to use it for a non-pointer, but it is type-agnostic,
> so using it should be ok to avoid the #ifdefs. We should maybe adopt
> that mechanism for other PMBus drivers.
I see, thanks for elaboration on all of this.
...
> > Please, split this patch to at least two:
> > 1) Introduce chip_info;
>
> That would really be "Use driver data to point to chip info".
I agree on the title, what I meant is the rough description of what
should be done in the change.
> > 2) add new devices.
>
> I don't really care much about separating those two (after all, they are
> related), but adding regulator support to the driver is a major change
> and should be a separate patch. On top of that, it isn't even mentioned
> in the patch description.
Indeed, that's why I mentioned "at least" in the reply.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists