[PATCH v6 05/26] iio: dac: ad3530r: #undef field_prep() before local definition

Geert Uytterhoeven posted 26 patches 1 month, 1 week ago
[PATCH v6 05/26] iio: dac: ad3530r: #undef field_prep() before local definition
Posted by Geert Uytterhoeven 1 month, 1 week ago
Prepare for the advent of a globally available common field_prep() macro
by undefining the symbol before defining a local variant.  This prevents
redefinition warnings from the C preprocessor when introducing the common
macro later.

Suggested-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v6:
  - No changes,

v5:
  - New.
---
 drivers/iio/dac/ad3530r.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/dac/ad3530r.c b/drivers/iio/dac/ad3530r.c
index 6134613777b8e1d4..5684d11137f29948 100644
--- a/drivers/iio/dac/ad3530r.c
+++ b/drivers/iio/dac/ad3530r.c
@@ -54,6 +54,7 @@
 #define AD3531R_MAX_CHANNELS			4
 
 /* Non-constant mask variant of FIELD_PREP() */
+#undef field_prep
 #define field_prep(_mask, _val)	(((_val) << (ffs(_mask) - 1)) & (_mask))
 
 enum ad3530r_mode {
-- 
2.43.0
Re: [PATCH v6 05/26] iio: dac: ad3530r: #undef field_prep() before local definition
Posted by Jonathan Cameron 1 month, 1 week ago
On Thu,  6 Nov 2025 14:33:53 +0100
Geert Uytterhoeven <geert+renesas@glider.be> wrote:

> Prepare for the advent of a globally available common field_prep() macro
> by undefining the symbol before defining a local variant.  This prevents
> redefinition warnings from the C preprocessor when introducing the common
> macro later.
> 
> Suggested-by: Yury Norov <yury.norov@gmail.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>


> ---
> v6:
>   - No changes,
> 
> v5:
>   - New.
> ---
>  drivers/iio/dac/ad3530r.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/dac/ad3530r.c b/drivers/iio/dac/ad3530r.c
> index 6134613777b8e1d4..5684d11137f29948 100644
> --- a/drivers/iio/dac/ad3530r.c
> +++ b/drivers/iio/dac/ad3530r.c
> @@ -54,6 +54,7 @@
>  #define AD3531R_MAX_CHANNELS			4
>  
>  /* Non-constant mask variant of FIELD_PREP() */
> +#undef field_prep
>  #define field_prep(_mask, _val)	(((_val) << (ffs(_mask) - 1)) & (_mask))
>  
>  enum ad3530r_mode {