Re: [PATCH 1/2] iio: pressure: bmp280: Allow multiple chips id per family of devices

From: Andy Shevchenko
Date: Fri Aug 18 2023 - 11:58:03 EST


On Fri, Aug 18, 2023 at 05:52:07PM +0200, Angel Iglesias wrote:
> On Fri, 2023-08-18 at 14:19 +0300, Andy Shevchenko wrote:
> > On Thu, Aug 17, 2023 at 11:05:21PM +0200, Angel Iglesias wrote:

...

> > > -       const unsigned int chip_id;
> >
> > Yeah, this const makes a little sense...
> >
> > > +       const unsigned int *chip_id;
> >
> > ...but not this :-)
>
> Isn't the same case as "const struct iio_chan_spec *channels" or "const int
> *oversampling_temp_avail". I thoght that this meant a pointer to a constant
> integer. On bmp280-core I declare the arrays with the modifiers static const.

Yes, and that is my point:
- old code makes a little sense
- new code makes a lot of sense

> > What I'm wondering is why it's int and not u8 / u16
> > (as it seems only a byte value there).
>
> Yeah, can be u8, as the reg width is 1 byte and this IDs are stored on one reg.
> I just carried over the int type from previous versions, but it's just wasting
> space :/

--
With Best Regards,
Andy Shevchenko