Re: [PATCH 2/7] iio: light: opt3001: use macros from bits.h header
From: Andy Shevchenko
Date: Mon May 11 2026 - 07:01:58 EST
On Mon, May 11, 2026 at 12:04:07PM +0200, Joshua Crofts via B4 Relay wrote:
> Use GENMASK() and BIT() macros from bits.h header where it makes
> sense. While at it, remove unused macro.
...
> #define OPT3001_CONFIGURATION_M_SHUTDOWN (0 << 9)
> -#define OPT3001_CONFIGURATION_M_SINGLE (1 << 9)
> +#define OPT3001_CONFIGURATION_M_SINGLE BIT(9)
> #define OPT3001_CONFIGURATION_M_CONTINUOUS (2 << 9) /* also 3 << 9 */
No to this and similar changes. It's clear that this is a shifted plain value,
it's not a bitfield. If in doubt, always consult with datasheet, if there is
no such publicly available, ask driver author/maintainers of the subsystem.
(The rule of thumb, whenever you see `0 << (x)` in the group of definitions,
the above applies.)
--
With Best Regards,
Andy Shevchenko