Re: [PATCH v3 3/6] iio: potentiometer: Add channel information in device data

From: Andy Shevchenko
Date: Mon Feb 21 2022 - 15:41:36 EST


On Fri, Feb 18, 2022 at 5:20 AM Jagath Jog J <jagathjog1996@xxxxxxxxx> wrote:
>
> Adding each device wiper count and channel information into
> device private data.
> Utilizing addr member of struct iio_chan_spec to get the
> wiper register address so that the value can be read or write
> to the same address.

Looks much better!

...

> static const struct ds1803_cfg ds1803_cfg[] = {
> - [DS1803_010] = { .avail = { 0, 1, 255 }, .kohms = 10, },
> - [DS1803_050] = { .avail = { 0, 1, 255 }, .kohms = 50, },
> - [DS1803_100] = { .avail = { 0, 1, 255 }, .kohms = 100, },
> + [DS1803_010] = { .wipers = 2, .avail = { 0, 1, 255 }, .kohms = 10,
> + .channels = ds1803_channels,
> + .num_channels = ARRAY_SIZE(ds1803_channels) },
> + [DS1803_050] = { .wipers = 2, .avail = { 0, 1, 255 }, .kohms = 50,
> + .channels = ds1803_channels,
> + .num_channels = ARRAY_SIZE(ds1803_channels) },
> + [DS1803_100] = { .wipers = 2, .avail = { 0, 1, 255 }, .kohms = 100,
> + .channels = ds1803_channels,
> + .num_channels = ARRAY_SIZE(ds1803_channels) },
> };

Now, you may see you touch still the lines that are not changed, so
consider in the _previous_ patch to define each entry like the
following:

[DS1803_...] = {
.avail = {...},
.kohms = ...,
},

--
With Best Regards,
Andy Shevchenko