RE: [PATCH 1/3] iio: adc: ltc2309: introduce chip_info structure
From: Jones, Carlos jr
Date: Mon Mar 23 2026 - 07:13:39 EST
> > > + unsigned int num_channels;
> > > + unsigned int read_delay_us;
> > > +};
> > > +
> > > /**
> > > * struct ltc2309 - internal device data structure
> > > * @dev: Device reference
> > > * @client: I2C reference
> > > * @lock: Lock to serialize data access
> > > * @vref_mv: Internal voltage reference
> > > + * @chip_info: Chip-specific configuration data
> > See below. Maybe more appropriate to copy the read_delay rather than
> > keeping pointer to full structure around.
> >
> > > +
> > > ret = i2c_master_recv(ltc2309->client, (char *)&buf, 2);
> > > if (ret < 0) {
> > > dev_err(ltc2309->dev, "i2c read failed: %pe\n", ERR_PTR(ret));
> > @@
> > > -156,6 +169,12 @@ static const struct iio_info ltc2309_info = {
> > > .read_raw = ltc2309_read_raw,
> > > };
> > >
> > > +static const struct ltc2309_chip_info ltc2309_chip_info = {
> > > + .channels = ltc2309_channels,
> > > + .num_channels = ARRAY_SIZE(ltc2309_channels),
> > > + .read_delay_us = 0,
> > > +};
> > > +
> > > static int ltc2309_probe(struct i2c_client *client) {
> > > struct iio_dev *indio_dev;
> > > @@ -169,11 +188,12 @@ static int ltc2309_probe(struct i2c_client
> *client)
> > > ltc2309 = iio_priv(indio_dev);
> > > ltc2309->dev = &indio_dev->dev;
> > > ltc2309->client = client;
> > > + ltc2309->chip_info = <c2309_chip_info;
> >
> > Given only the read_delay_us is used after probe, I'd add a variable
> > for that and copy just that value over. If you have other changes
> > that are coming in the near future that will add more fields to the
> > structure that are needed after probe, then fine to leave it as you
> > have it (but add a mention in the commit message).
> >
>
> As, I have no visibility into the other similar devices that may require more
> fields to the structure, let me revert the structure changes and use a local
> variable to deal with the read_delay_us instead. Thanks.
>
Not a local variable, I meant replace the chip info with the read_delay_us
instead.
struct ltc2309 {
struct device *dev;
struct i2c_client *client;
struct mutex lock; /* serialize data access */
int vref_mv;
unsigned int read_delay_us;
};