Re: [PATCH 1/3] iio: adc: ltc2309: introduce chip_info structure
From: Andy Shevchenko
Date: Fri Mar 20 2026 - 10:50:20 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?
...
> + 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.
> + .read_delay_us = 0,
Unneeded.
> +};
--
With Best Regards,
Andy Shevchenko