From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linusw@kernel.org>, Bartosz Golaszewski <brgl@kernel.org>
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>,
Thomas Richard <thomas.richard@bootlin.com>,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: [PATCH 7/7] gpio: viperboard: normalize return value of gpio_get
Date: Wed, 18 Feb 2026 11:06:56 -0800 [thread overview]
Message-ID: <20260218190657.2974723-7-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20260218190657.2974723-1-dmitry.torokhov@gmail.com>
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>
---
drivers/gpio/gpio-viperboard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
index 15e495c109d2..89087fd48a81 100644
--- a/drivers/gpio/gpio-viperboard.c
+++ b/drivers/gpio/gpio-viperboard.c
@@ -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);
--
2.53.0.335.g19a08e0c02-goog
next prev parent reply other threads:[~2026-02-18 19:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 19:06 [PATCH 1/7] gpio: bd9571mwv: normalize return value of gpio_get Dmitry Torokhov
2026-02-18 19:06 ` [PATCH 2/7] gpio: cgbc: " Dmitry Torokhov
2026-02-18 19:06 ` [PATCH 3/7] gpio: da9055: " Dmitry Torokhov
2026-02-18 19:06 ` [PATCH 4/7] gpio: lp873x: " Dmitry Torokhov
2026-02-18 19:06 ` [PATCH 5/7] gpio: stp-xway: " Dmitry Torokhov
2026-02-18 19:06 ` [PATCH 6/7] gpio: tps65086: " Dmitry Torokhov
2026-02-18 19:06 ` Dmitry Torokhov [this message]
2026-02-18 20:23 ` [PATCH 1/7] gpio: bd9571mwv: " Bartosz Golaszewski
2026-02-18 21:02 ` Dmitry Torokhov
2026-02-19 8:57 ` Bartosz Golaszewski
2026-02-23 9:57 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260218190657.2974723-7-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=thomas.richard@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox