[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Vc=90S2wedh2f+wxcLsGYZH_RSvjLasUP1SC-oSpt+nUw@mail.gmail.com>
Date: Thu, 13 Nov 2025 22:51:36 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Jonathan Cameron <jic23@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
David Jander <david@...tonic.nl>, kernel@...gutronix.de, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
David Lechner <dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>
Subject: Re: [PATCH v2 2/2] iio: adc: Add TI ADS131M0x ADC driver
On Thu, Nov 13, 2025 at 4:12 PM Oleksij Rempel <o.rempel@...gutronix.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
Powered by blists - more mailing lists