On 3/20/22 14:10, Jonathan Cameron wrote:
On Sat, 12 Mar 2022 22:28:22 +0100
Marek Vasut <marex@xxxxxxx> wrote:
On 3/12/22 13:19, Andy Shevchenko wrote:
On Fri, Mar 11, 2022 at 8:50 PM Marek Vasut <marex@xxxxxxx> wrote:
Add compile-time static_assert wrapper to verify that shifted realbits
fit into storagebits. The macro is implemented in a more generic way so
it can be used to verify other values if required.
Thanks! I think we may leave it to maintainers to decide if it is
worth adding or not.
Right, that's why I placed it as 7/7, since the macro is ... not pretty.
It's ugly but that's all wrapped up in the macro so I'll take it and
see what blows up :)
Longer term, maybe we'd should add a general runtime check in the IIO core?
I wonder whether something like that could be made completely generic,
but, let's do that in the next step.
Not quite so nice as catching at compile time but would catch all such issues
the moment anyone actually tries out a driver with whatever device they've
just added support for.
I'll let this sit a little longer for additional review before picking it up
(missed this cycle anyway so lots of time).
A few other comments on this driver whilst we are here on things we should
cleanup at somepoint.
1) Move over to the read_avail callback rather than having the attribute
groups. It may well be slightly more code but then makes them available
to in kernel users. Slowly moving all drivers with _available for standard
ABI over to the callback is on the todo list but it will take a while...
2) Possibly introduced a static const array of
struct ad1015_chip_info {
all the per device stuff currently handled in code in probe
};
Then simply access that directly using the the device_match_data.
I found a small bug in the tla2024 integration, the attrs assignment is
wrong, so I'll send 1 and 2 above alongside V3 shortly.