mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
gpio: viperboard: 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 vprbrd_gpiob_get() in the output case is normalized to the [0, 1] range. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Link: https://patch.msgid.link/20260218190657.2974723-7-dmitry.torokhov@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
committed by
Bartosz Golaszewski
parent
9eb7ecfd20
commit
c08381ad56
@@ -288,7 +288,7 @@ static int vprbrd_gpiob_get(struct gpio_chip *chip,
|
||||
|
||||
/* if io is set to output, just return the saved value */
|
||||
if (gpio->gpiob_out & (1 << offset))
|
||||
return gpio->gpiob_val & (1 << offset);
|
||||
return !!(gpio->gpiob_val & (1 << offset));
|
||||
|
||||
mutex_lock(&vb->lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user