Re: [PATCH v5 18/18] iio: magnetometer: ak8975: make use of the macros from bits.h

From: Andy Shevchenko

Date: Wed May 06 2026 - 17:25:56 EST


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.

> (and there will be an unused here SCAN_TIMESTAMP

--
With Best Regards,
Andy Shevchenko