net: phy: qcom: qca807x: normalize return value of gpio_get
Subsystems (5)
PATCH 1/1 net: phy: qcom: qca807x: 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 qca807x_gpio_get() is normalized to the [0, 1] range.
---
[First copy went to Andrew privately by mistake]
drivers/net/phy/qcom/qca807x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/qcom/qca807x.c +1 -1
@@ -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)
Signature · 5 lines
2.53.0.335.g19a08e0c02-goog -- Dmitry
Andrew Lunn
maintainerQuoted 5 lines · Dmitry Torokhov
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 <[email protected]>
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
Quoted 5 lines · Andrew Lunn
Quoted 4 lines · Dmitry Torokhov
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.
Quoted 7 lines
Quoted 1 line
Signed-off-by Dmitry Torokhov <[email protected]>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!
Signature · 1 line
Dmitry
Andrew Lunn
maintainerQuoted 8 lines · Dmitry Torokhov
Quoted 7 lines · Andrew Lunn
Quoted 5 lines · Dmitry Torokhov
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 <[email protected]>
Quoted 7 lines
Quoted 5 lines
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 <[email protected]> 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
Quoted 29 lines · Dmitry Torokhov
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 <[email protected]>---
[First copy went to Andrew privately by mistake]
drivers/net/phy/qcom/qca807x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/phy/qcom/qca807x.c +1
-2@@ -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
Quoted 3 lines
--
Dmitry
Quoted 5 lines · Dmitry Torokhov
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 <[email protected]>
Yours,
Linus Walleij