* [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get
@ 2026-02-18 20:57 Dmitry Torokhov
2026-02-18 22:55 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-02-18 20:57 UTC (permalink / raw)
To: Andrew Lunn
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Linus Walleij, Bartosz Golaszewski, netdev,
linux-arm-msm, 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 qca807x_gpio_get() is
normalized to the [0, 1] range.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
[First copy went to Andrew privately by mistake]
drivers/net/phy/qcom/qca807x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c
index d8f1ce5a7128..6004da5741af 100644
--- a/drivers/net/phy/qcom/qca807x.c
+++ b/drivers/net/phy/qcom/qca807x.c
@@ -375,7 +375,7 @@ static int qca807x_gpio_get(struct gpio_chip *gc, unsigned int offset)
reg = QCA807X_MMD7_LED_FORCE_CTRL(offset);
val = phy_read_mmd(priv->phy, MDIO_MMD_AN, reg);
- return FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
+ return !!FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
}
static int qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
--
2.53.0.335.g19a08e0c02-goog
--
Dmitry
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-18 20:57 [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
@ 2026-02-18 22:55 ` Andrew Lunn
2026-02-18 23:01 ` Dmitry Torokhov
2026-02-19 10:48 ` Bartosz Golaszewski
2026-02-19 18:26 ` Linus Walleij
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-02-18 22:55 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Linus Walleij, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio
On Wed, Feb 18, 2026 at 12:57:17PM -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 qca807x_gpio_get() is
> normalized to the [0, 1] range.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This appears to be a fix. Please add a Fixes: tag.
Also, please put net into the Subject.
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-18 22:55 ` Andrew Lunn
@ 2026-02-18 23:01 ` Dmitry Torokhov
2026-02-18 23:11 ` Andrew Lunn
0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2026-02-18 23:01 UTC (permalink / raw)
To: Andrew Lunn
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Linus Walleij, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio
On February 18, 2026 2:55:32 PM PST, Andrew Lunn <andrew@lunn.ch> wrote:
>On Wed, Feb 18, 2026 at 12:57:17PM -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 qca807x_gpio_get() is
>> normalized to the [0, 1] range.
>>
>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
>This appears to be a fix. Please add a Fixes: tag.
>
>Also, please put net into the Subject.
>
>https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Will do, however I am not sure what should be tagged as "Fixes" - original driver commit or the change in gpiolib tightening the checks?
Thanks!
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-18 23:01 ` Dmitry Torokhov
@ 2026-02-18 23:11 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2026-02-18 23:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Linus Walleij, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio
On Wed, Feb 18, 2026 at 03:01:22PM -0800, Dmitry Torokhov wrote:
> On February 18, 2026 2:55:32 PM PST, Andrew Lunn <andrew@lunn.ch> wrote:
> >On Wed, Feb 18, 2026 at 12:57:17PM -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 qca807x_gpio_get() is
> >> normalized to the [0, 1] range.
> >>
> >> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >
> >This appears to be a fix. Please add a Fixes: tag.
> >
> >Also, please put net into the Subject.
> >
> >https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
>
> Will do, however I am not sure what should be tagged as "Fixes" - original driver commit or the change in gpiolib tightening the checks?
commit 60befd2ea1c2061775838ea7bac5cc2b1353afd0
Author: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Date: Tue Dec 22 16:37:28 2015 +0200
suggests the check is to do with bugs when you have 32 GPIOs, and so
the top bit for the 31st GPIO turns the value negative and results in
an error code. However, this driver only has 2 GPIOs, so it is not an
issue.
So i would go for when the gpiolib tightened up the checks.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-18 20:57 [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
2026-02-18 22:55 ` Andrew Lunn
@ 2026-02-19 10:48 ` Bartosz Golaszewski
2026-02-19 18:26 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2026-02-19 10:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Linus Walleij, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio, Andrew Lunn
On Wed, 18 Feb 2026 21:57:17 +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 qca807x_gpio_get() is
> normalized to the [0, 1] range.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>
> [First copy went to Andrew privately by mistake]
>
> drivers/net/phy/qcom/qca807x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c
> index d8f1ce5a7128..6004da5741af 100644
> --- a/drivers/net/phy/qcom/qca807x.c
> +++ b/drivers/net/phy/qcom/qca807x.c
> @@ -375,7 +375,7 @@ static int qca807x_gpio_get(struct gpio_chip *gc, unsigned int offset)
> reg = QCA807X_MMD7_LED_FORCE_CTRL(offset);
> val = phy_read_mmd(priv->phy, MDIO_MMD_AN, reg);
>
> - return FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
> + return !!FIELD_GET(QCA807X_GPIO_FORCE_MODE_MASK, val);
> }
>
> static int qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
> --
> 2.53.0.335.g19a08e0c02-goog
>
>
> --
> Dmitry
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get
2026-02-18 20:57 [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
2026-02-18 22:55 ` Andrew Lunn
2026-02-19 10:48 ` Bartosz Golaszewski
@ 2026-02-19 18:26 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2026-02-19 18:26 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bartosz Golaszewski, netdev,
linux-arm-msm, linux-kernel, linux-gpio
On Wed, Feb 18, 2026 at 9:57 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 qca807x_gpio_get() 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] 6+ messages in thread
end of thread, other threads:[~2026-02-19 18:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 20:57 [PATCH] net: phy: qcom: qca807x: normalize return value of gpio_get Dmitry Torokhov
2026-02-18 22:55 ` Andrew Lunn
2026-02-18 23:01 ` Dmitry Torokhov
2026-02-18 23:11 ` Andrew Lunn
2026-02-19 10:48 ` Bartosz Golaszewski
2026-02-19 18:26 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox