[PATCH v13 13/13] gpio: pl061: use string_choices helpers for IRQ trigger logging

From: Long Zhao via B4 Relay

Date: Mon Nov 02 2026 - 01:54:21 EST


From: Long Zhao <longzhao@xxxxxxxxxxxxx>

Add str_rising_falling() next to the other str_* helpers and use
str_high_low() / str_rising_falling() for the level and edge debug
lines.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Signed-off-by: Long Zhao <longzhao@xxxxxxxxxxxxx>
---
drivers/gpio/gpio-pl061.c | 7 +++----
include/linux/string_choices.h | 6 ++++++
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 63ec5363dd5f..86c22378e759 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -26,6 +26,7 @@
#include <linux/regmap.h>
#include <linux/seq_file.h>
#include <linux/spinlock.h>
+#include <linux/string_choices.h>

#define GPIODIR 0x400
#define GPIOIS 0x404
@@ -195,8 +196,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger)
gpioiev &= ~bit;
irq_set_handler_locked(d, handle_level_irq);
dev_dbg(parent, "line %d: IRQ on %s level\n",
- offset,
- polarity ? "HIGH" : "LOW");
+ offset, str_high_low(polarity));
} else if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
/* Disable level detection */
gpiois &= ~bit;
@@ -219,8 +219,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger)
gpioiev &= ~bit;
irq_set_handler_locked(d, handle_edge_irq);
dev_dbg(parent, "line %d: IRQ on %s edge\n",
- offset,
- rising ? "RISING" : "FALLING");
+ offset, str_rising_falling(rising));
} else {
/* No trigger: disable everything */
gpiois &= ~bit;
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index ee84087d4b26..c3a0360334d6 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -65,6 +65,12 @@ static inline const char *str_read_write(bool v)
}
#define str_write_read(v) str_read_write(!(v))

+static inline const char *str_rising_falling(bool v)
+{
+ return v ? "rising" : "falling";
+}
+#define str_falling_rising(v) str_rising_falling(!(v))
+
static inline const char *str_true_false(bool v)
{
return v ? "true" : "false";

--
2.34.1