Re: [PATCH v5 18/18] iio: magnetometer: ak8975: make use of the macros from bits.h
From: Joshua Crofts
Date: Thu May 07 2026 - 06:06:45 EST
On Wed, 6 May 2026 at 23:25, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Wed, May 06, 2026 at 06:12:16PM +0100, Jonathan Cameron wrote:
> > On Tue, 05 May 2026 13:46:14 +0200
> > Joshua Crofts via B4 Relay <devnull+joshua.crofts1.gmail.com@xxxxxxxxxx> wrote:
>
> ...
>
> > > Make use of BIT() and GENMASK() where it makes sense.
>
> > One small thing in here. Feel free to just leave that for a separate patch
> > and for now leave it as 0x7
>
> ...
>
> > > -static const unsigned long ak8975_scan_masks[] = { 0x7, 0 };
> > > +static const unsigned long ak8975_scan_masks[] = { GENMASK(2, 0), 0 };
> > Hmm. This is a fun one... It's actually 3 separate bits so please represent it
> > as BIT(0) | BIT(1) | BIT(2)
>
> Ah, TIL.
>
> > or maybe add an enum for the channel scan indexes?
> > BIT(SCAN_X) | BIT(SCAN_Y) | BIT(SCAN_Z)
>
> This looks good to me.
Sure, simple enough.
--
Kind regards
CJD