Re: [PATCH -next v6 10/26] iio: imu: smi330: #undef field_{get,prep}() before definition

Jonathan Cameron
2025-11-09T13:34:55Z

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

> Prepare for the advent of globally available common field_get() and
> field_prep() macros by undefining the symbols before defining local
> variants. This prevents redefinition warnings from the C preprocessor
> when introducing the common macros later.
>
> Suggested-by: Yury Norov <yury.norov@gmail.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
I tweaked the original driver to avoid the naming clash so this can be dropped
and we can replace with the new function next cycle.

Thanks,

Jonathan

> ---
> v6:
> - No changes,
>
> v5:
> - New.
> ---
> drivers/iio/imu/smi330/smi330_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/iio/imu/smi330/smi330_core.c b/drivers/iio/imu/smi330/smi330_core.c
> index d9178725ade3da83..a79964fe68fadf47 100644
> --- a/drivers/iio/imu/smi330/smi330_core.c
> +++ b/drivers/iio/imu/smi330/smi330_core.c
> @@ -68,7 +68,9 @@
> #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) { \