[PATCH 5/7] gpio: stp-xway: normalize return value of gpio_get

From: Dmitry Torokhov

Date: Wed Feb 18 2026 - 14:08:11 EST


The GPIO get callback is expected to return 0 or 1 (or a negative error
code). Ensure that the value returned by xway_stp_get() is normalized
to the [0, 1] range.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/gpio/gpio-stp-xway.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index 493c027afdd6..78d6c78d4aab 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -102,7 +102,7 @@ static int xway_stp_get(struct gpio_chip *gc, unsigned int gpio)
{
struct xway_stp *chip = gpiochip_get_data(gc);

- return (xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio));
+ return !!(xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio));
}

/**
--
2.53.0.335.g19a08e0c02-goog