Commit e62b94a6 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Bartosz Golaszewski
Browse files

gpio: stp-xway: normalize return value of gpio_get



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: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/20260218190657.2974723-5-dmitry.torokhov@gmail.com


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
parent 5a32ebab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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));
}

/**