From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"David Jander" <david@protonic.nl>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>
Subject: Re: [PATCH v2 2/2] iio: adc: Add TI ADS131M0x ADC driver
Date: Thu, 13 Nov 2025 22:51:36 +0200 [thread overview]
Message-ID: <CAHp75Vc=90S2wedh2f+wxcLsGYZH_RSvjLasUP1SC-oSpt+nUw@mail.gmail.com> (raw)
In-Reply-To: <aRXnQZvyOLpYjg2i@pengutronix.de>
On Thu, Nov 13, 2025 at 4:12 PM Oleksij Rempel <o.rempel@pengutronix.de> wrote:
> On Mon, Nov 10, 2025 at 10:46:02PM +0200, Andy Shevchenko wrote:
...
> > > - Handles both input and output CRC; uses a non-reflected CCITT (0x1021)
> > > implementation because the generic crc_ccitt helper is incompatible.
>
> For the crc_ccitt() related part I wrote this comment ^^^ :) in the
> commit message.
>
> Anyways, after some more research, looks like crc_itu_t() should be used. It
> seems to work.
I see, that's good news!
...
> > > +/* 24-bit resolution */
> > > +#define ADS131M_RESOLUTION_BITS 24
> > > +/* Divisor is 2^(Res - 1) for signed 2's complement */
> > > +#define ADS131M_SCALE_DIVISOR (1UL << (ADS131M_RESOLUTION_BITS - 1))
> >
> > Why not BIT() here?
>
> It's meant to signal an arithmetic calculation, BIT() is typically used
> for a hardware bitmask or a flag. Should i still use BIT() here or there
> is other way to describe it?
My understanding that the SCALE_DIVISOR is not a good name and here is
something like maximum resolution factor, and when MAX_ become in the
name, the (BIT($FOO) - 1) notation is a good thing that shows
directly how many bits that MAX is based on the HW bitfield or so. But
also note that $FOO == plain number, i.e. 24 is assumed here.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-11-13 20:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 6:14 [PATCH v2 0/2] iio: adc: Add support for TI ADS131M0x ADCs Oleksij Rempel
2025-11-10 6:14 ` [PATCH v2 1/2] bindings: iio: adc: Add bindings " Oleksij Rempel
2025-11-10 19:11 ` Conor Dooley
2025-11-10 6:14 ` [PATCH v2 2/2] iio: adc: Add TI ADS131M0x ADC driver Oleksij Rempel
2025-11-10 20:46 ` Andy Shevchenko
2025-11-13 14:12 ` Oleksij Rempel
2025-11-13 20:51 ` Andy Shevchenko [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='CAHp75Vc=90S2wedh2f+wxcLsGYZH_RSvjLasUP1SC-oSpt+nUw@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=conor+dt@kernel.org \
--cc=david@protonic.nl \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=o.rempel@pengutronix.de \
--cc=robh@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;
as well as URLs for NNTP newsgroup(s).