Re: [PATCH v2 2/4] iio: potentiometer: Add available functionality

From: Andy Shevchenko
Date: Mon Feb 14 2022 - 06:36:53 EST


On Mon, Feb 14, 2022 at 5:36 AM Jagath Jog J <jagathjog1996@xxxxxxxxx> wrote:
>
> Adding available functionality for ds1803 driver which
> will show the minimum, step and maximum values
> it can accepts through sysfs entry.

accept

...

> struct ds1803_cfg {
> int kohms;
> + int avail[3];
> };
>
> static const struct ds1803_cfg ds1803_cfg[] = {
> - [DS1803_010] = { .kohms = 10, },
> - [DS1803_050] = { .kohms = 50, },
> - [DS1803_100] = { .kohms = 100, },
> + [DS1803_010] = { .avail = { 0, 1, 255 }, .kohms = 10, },
> + [DS1803_050] = { .avail = { 0, 1, 255 }, .kohms = 50, },
> + [DS1803_100] = { .avail = { 0, 1, 255 }, .kohms = 100, },
> };

Please, do it rather with additional data:

static const int ds1803_range[] = { ... };

.avail = ..._range,

Also, looking into the next patch, can you move the structure to the
place where it's more appropriate?

--
With Best Regards,
Andy Shevchenko