Re: [PATCH -next v6 23/26] iio: imu: smi330: Convert to common field_{get,prep}() helpers

Jonathan Cameron
2025-11-09T13:39:21Z

On Thu, 6 Nov 2025 14:34:11 +0100
Geert Uytterhoeven <geert+renesas@glider.be> wrote:

> Drop the driver-specific field_get() and field_prep() macros, in favor
> of the globally available variants from <linux/bitfield.h>.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

This will need a revist next cycle. I preferred not to have
the odd looking undef in the driver at introduction so prefixed with smi330_
instead. Only one instance so it wasn't worth comments to make ti clear what was going on.

J

> ---
> v6:
> - No changes,
>
> v5:
> - New.
> ---
> drivers/iio/imu/smi330/smi330_core.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/iio/imu/smi330/smi330_core.c b/drivers/iio/imu/smi330/smi330_core.c
> index a79964fe68fadf47..83e0dff5d973d046 100644
> --- a/drivers/iio/imu/smi330/smi330_core.c
> +++ b/drivers/iio/imu/smi330/smi330_core.c
> @@ -67,12 +67,6 @@
> #define SMI330_CHIP_ID 0x42
> #define SMI330_SOFT_RESET_DELAY 2000
>
> -/* Non-constant mask variant of FIELD_GET() and FIELD_PREP() */
> -#undef field_get
> -#define field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
> -#undef field_prep
> -#define field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))
> -
> #define SMI330_ACCEL_CHANNEL(_axis) { \
> .type = IIO_ACCEL, \
> .modified = 1, \