Re: [PATCH 2/2] hwmon: (pmbus/adp1050): add support for adp1051, adp1055 and ltp8800

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux