public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Jonathan Cameron <jic23@kernel.org>
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 18:50:06 +0100	[thread overview]
Message-ID: <780e7f61-c283-d60e-2372-005fb8de56d1@denx.de> (raw)
In-Reply-To: <20220320131041.4efcf35b@jic23-huawei>

On 3/20/22 14:10, Jonathan Cameron wrote:
> 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?

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.

      reply	other threads:[~2022-03-20 17:50 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
2022-03-20 17:50         ` Marek Vasut [this message]

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=780e7f61-c283-d60e-2372-005fb8de56d1@denx.de \
    --to=marex@denx.de \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=daniel.baluta@nxp.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    /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