* [PATCH] power: supply: sbs-manager: normalize return value of gpio_get
@ 2026-02-18 20:59 Dmitry Torokhov
2026-02-19 10:42 ` Bartosz Golaszewski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2026-02-18 20:59 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Linus Walleij, Bartosz Golaszewski, Xichao Zhao, Baolin Wang,
AngeloGioacchino Del Regno, linux-pm, linux-kernel, linux-gpio
The GPIO get callback is expected to return 0 or 1 (or a negative error
code). Ensure that the value returned by sbsm_gpio_get_value() is
normalized to the [0, 1] range.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/power/supply/sbs-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/sbs-manager.c b/drivers/power/supply/sbs-manager.c
index 6fe526222f7f..343ad4ab4082 100644
--- a/drivers/power/supply/sbs-manager.c
+++ b/drivers/power/supply/sbs-manager.c
@@ -199,7 +199,7 @@ static int sbsm_gpio_get_value(struct gpio_chip *gc, unsigned int off)
if (ret < 0)
return ret;
- return ret & BIT(off);
+ return !!(ret & BIT(off));
}
/*
--
2.53.0.335.g19a08e0c02-goog
--
Dmitry
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] power: supply: sbs-manager: normalize return value of gpio_get
2026-02-18 20:59 [PATCH] power: supply: sbs-manager: normalize return value of gpio_get Dmitry Torokhov
@ 2026-02-19 10:42 ` Bartosz Golaszewski
2026-02-19 17:25 ` Linus Walleij
2026-03-02 23:41 ` Sebastian Reichel
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-02-19 10:42 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Linus Walleij, Bartosz Golaszewski, Xichao Zhao, Baolin Wang,
AngeloGioacchino Del Regno, linux-pm, linux-kernel, linux-gpio,
Sebastian Reichel
On Wed, 18 Feb 2026 21:59:49 +0100, Dmitry Torokhov
<dmitry.torokhov@gmail.com> said:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by sbsm_gpio_get_value() is
> normalized to the [0, 1] range.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/power/supply/sbs-manager.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/sbs-manager.c b/drivers/power/supply/sbs-manager.c
> index 6fe526222f7f..343ad4ab4082 100644
> --- a/drivers/power/supply/sbs-manager.c
> +++ b/drivers/power/supply/sbs-manager.c
> @@ -199,7 +199,7 @@ static int sbsm_gpio_get_value(struct gpio_chip *gc, unsigned int off)
> if (ret < 0)
> return ret;
>
> - return ret & BIT(off);
> + return !!(ret & BIT(off));
> }
>
> /*
> --
> 2.53.0.335.g19a08e0c02-goog
>
>
> --
> Dmitry
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] power: supply: sbs-manager: normalize return value of gpio_get
2026-02-18 20:59 [PATCH] power: supply: sbs-manager: normalize return value of gpio_get Dmitry Torokhov
2026-02-19 10:42 ` Bartosz Golaszewski
@ 2026-02-19 17:25 ` Linus Walleij
2026-03-02 23:41 ` Sebastian Reichel
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2026-02-19 17:25 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Sebastian Reichel, Bartosz Golaszewski, Xichao Zhao, Baolin Wang,
AngeloGioacchino Del Regno, linux-pm, linux-kernel, linux-gpio
On Wed, Feb 18, 2026 at 9:59 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by sbsm_gpio_get_value() is
> normalized to the [0, 1] range.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] power: supply: sbs-manager: normalize return value of gpio_get
2026-02-18 20:59 [PATCH] power: supply: sbs-manager: normalize return value of gpio_get Dmitry Torokhov
2026-02-19 10:42 ` Bartosz Golaszewski
2026-02-19 17:25 ` Linus Walleij
@ 2026-03-02 23:41 ` Sebastian Reichel
2 siblings, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2026-03-02 23:41 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov
Cc: Linus Walleij, Bartosz Golaszewski, Xichao Zhao, Baolin Wang,
AngeloGioacchino Del Regno, linux-pm, linux-kernel, linux-gpio
On Wed, 18 Feb 2026 12:59:49 -0800, Dmitry Torokhov wrote:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by sbsm_gpio_get_value() is
> normalized to the [0, 1] range.
>
>
Applied, thanks!
[1/1] power: supply: sbs-manager: normalize return value of gpio_get
commit: b4512ae0d55a5632294a16eae765e8b4c41b8856
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-02 23:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 20:59 [PATCH] power: supply: sbs-manager: normalize return value of gpio_get Dmitry Torokhov
2026-02-19 10:42 ` Bartosz Golaszewski
2026-02-19 17:25 ` Linus Walleij
2026-03-02 23:41 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox