From: Jonathan Cameron <jic23@kernel.org>
To: Marek Vasut <marex@denx.de>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
linux-iio <linux-iio@vger.kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v2 7/7] iio: adc: ti-ads1015: Add static assert to test if shifted realbits fit into storagebits
Date: Sun, 20 Mar 2022 13:10:41 +0000 [thread overview]
Message-ID: <20220320131041.4efcf35b@jic23-huawei> (raw)
In-Reply-To: <65e934d0-b002-1cf1-1b4d-1ff53d04df50@denx.de>
On Sat, 12 Mar 2022 22:28:22 +0100
Marek Vasut <marex@denx.de> wrote:
> On 3/12/22 13:19, Andy Shevchenko wrote:
> > On Fri, Mar 11, 2022 at 8:50 PM Marek Vasut <marex@denx.de> 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?
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.
Jonathan
next prev parent reply other threads:[~2022-03-20 13:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 18:49 [PATCH v2 1/7] dt-bindings: iio: adc: ti,ads1015: Add missing ADS1115 compatible string Marek Vasut
2022-03-11 18:49 ` [PATCH v2 2/7] dt-bindings: iio: adc: ti,ads1015: Add TLA2024 " Marek Vasut
2022-03-11 18:49 ` [PATCH v2 3/7] iio: adc: ti-ads1015: Switch to static const writeable ranges table Marek Vasut
2022-03-11 18:49 ` [PATCH v2 4/7] iio: adc: ti-ads1015: Deduplicate channel macros Marek Vasut
2022-03-11 18:49 ` [PATCH v2 5/7] iio: adc: ti-ads1015: Make channel event_spec optional Marek Vasut
2022-03-11 18:49 ` [PATCH v2 6/7] iio: adc: ti-ads1015: Add TLA2024 support Marek Vasut
2022-03-11 18:49 ` [PATCH v2 7/7] iio: adc: ti-ads1015: Add static assert to test if shifted realbits fit into storagebits Marek Vasut
2022-03-12 12:19 ` Andy Shevchenko
2022-03-12 21:28 ` Marek Vasut
2022-03-20 13:10 ` Jonathan Cameron [this message]
2022-03-20 17:50 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220320131041.4efcf35b@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=daniel.baluta@nxp.com \
--cc=linux-iio@vger.kernel.org \
--cc=marex@denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox