RE: [PATCH 1/3] iio: adc: ltc2309: introduce chip_info structure
From: Jones, Carlos jr
Date: Mon Mar 23 2026 - 06:41:51 EST
> On Fri, Mar 20, 2026 at 10:08:17PM +0800, Carlos Jones Jr wrote:
> > This is a preparatory patch that introduces a chip_info structure to
> > the LTC2309 driver to facilitate adding support for additional chip
> > variants with different channel configurations and timing
> > requirements.
> >
> > The chip_info structure contains chip-specific data including the
> > channel specifications, number of channels, and read delay timing.
> > This change does not modify the existing LTC2309 functionality.
>
> ...
>
> > struct ltc2309 {
> > struct device *dev;
> > struct i2c_client *client;
> > struct mutex lock; /* serialize data access */
> > int vref_mv;
> > + const struct ltc2309_chip_info *chip_info;
> > };
>
> Have you checked the layout with `pahole` tool? Does it agree with your
> choice?
>
> ...
Will revert addition of const struct ltc2309_chip_info *chip_info since it is
indeed, wasteful to carry the pointer to the full structure when only the
read delay is used after probe.
> > + .read_delay_us = 0,
>
> Unneeded.
>
Will convert to variable to copy this value over instead. Thanks.
>
> > + if (ltc2309->chip_info->read_delay_us)
> > + usleep_range(ltc2309->chip_info->read_delay_us,
> > + ltc2309->chip_info->read_delay_us * 2);
>
> fsleep()
>
> ...
>
> > +static const struct ltc2309_chip_info ltc2309_chip_info = {
> > + .channels = ltc2309_channels,
> > + .num_channels = ARRAY_SIZE(ltc2309_channels),
>
> Perhaps you also want to add (currently missing?) array_size.h.
>
> > +};
>
> --
> With Best Regards,
> Andy Shevchenko
>
Noted and thanks for both fsleep and array_size.h