Re: [PATCH 4/6] iio: adc: ti-ads1015: Deduplicate channel macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 11, 2022 at 12:33:49PM +0100, Marek Vasut wrote:
> On 3/11/22 12:29, Andy Shevchenko wrote:
> > On Fri, Mar 11, 2022 at 1:55 AM Marek Vasut <marex@xxxxxxx> wrote:
> > > On 3/10/22 15:25, Andy Shevchenko wrote:
> > > > On Thu, Mar 10, 2022 at 01:34:00AM +0100, Marek Vasut wrote:

...

> > > > > -            .realbits = 12,                                 \
> > > > > +            .realbits = (_realbits),                        \
> > > > >               .storagebits = 16,                              \
> > > > 
> > > > This seems inconsistent a bit. What if the next chip wants to have more than
> > > > 16 bits in realbits?
> > > 
> > > When such a chip exists, this can be parametrized as well.
> > 
> > Yes, My point is that it's error prone.
> 
> Won't IIO core warn if realbits > storagebits ?

If it's the case, then it's very good!

...

> > > > I see two options:
> > > > 1) add static assert to make sure realbits <= storagebits;
> > > 
> > > Does static_assert work in array of structures (I don't think it does) ?
> > 
> > You can check, but IIRC some of the macros have it. Don't remember the
> > details, though.
> 
> I already checked before replying, hence my question, as I didn't find a way
> to make it work.

It seems that current use cases have it either in functions or in
the expressions as ({...}). I dunno if the result of ({...}) can be
a data structure or compound literal.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux