[PATCH v6 04/26] gpio: aspeed: #undef field_{get,prep}() before local definition

Geert Uytterhoeven
2025-11-06T13:35:14Z

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>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
v6:
- Add Acked-by,

v5:
- New.
---
drivers/gpio/gpio-aspeed.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 7953a9c4e36d7550..ef4ccaf74a5b379e 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -32,7 +32,9 @@
#include "gpiolib.h"

/* 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 GPIO_G7_IRQ_STS_BASE 0x100
--
2.43.0