Skip to contentSkip to conversation

gpio: fix getting nonexclusive gpiods from DT

PATCH Applied Bartosz Golaszewski 3 participants 3 messages Oct 14, 2019 – Oct 16, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: fix getting nonexclusive gpiods from DT

From: Marco Felsch <[email protected]>

Since commit ec757001c818 ("gpio: Enable nonexclusive gpiods from DT nodes") we are able to get GPIOD_FLAGS_BIT_NONEXCLUSIVE marked gpios. Currently the gpiolib uses the wrong flags variable for the check. We need to check the gpiod_flags instead of the of_gpio_flags else we return -EBUSY for GPIOD_FLAGS_BIT_NONEXCLUSIVE marked and requested gpiod's.

Fixes ec757001c818 gpio: Enable nonexclusive gpiods from DT nodes
[Bartosz: the function was moved to gpiolib-of.c so updated the patch]
[Bartosz: backported to v5.3.y]
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -1
index d9074191edef..e4203c1eb869 100644
@@ -4303,7 +4303,7 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
 	transitory = flags & OF_GPIO_TRANSITORY;
 
 	ret = gpiod_request(desc, label);
-	if (ret == -EBUSY && (flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE))
+	if (ret == -EBUSY && (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE))
 		return desc;
 	if (ret)
 		return ERR_PTR(ret);
Signature · 1 line
2.23.0
maintainer Applied
#1 lore raw
Quoted 9 lines · Bartosz Golaszewski

From: Marco Felsch <[email protected]>

Since commit ec757001c818 ("gpio: Enable nonexclusive gpiods from DT nodes") we are able to get GPIOD_FLAGS_BIT_NONEXCLUSIVE marked gpios. Currently the gpiolib uses the wrong flags variable for the check. We need to check the gpiod_flags instead of the of_gpio_flags else we return -EBUSY for GPIOD_FLAGS_BIT_NONEXCLUSIVE marked and requested gpiod's.

Quoted 7 lines
Fixes ec757001c818 gpio: Enable nonexclusive gpiods from DT nodes
[Bartosz: the function was moved to gpiolib-of.c so updated the patch]
[Bartosz: backported to v5.3.y]

Queued this one for 5.3, thanks!

Signature · 2 lines
Thanks,
Sasha
#2 lore raw
In reply to Bartosz Golaszewski
Quoted 9 lines · Bartosz Golaszewski

From: Marco Felsch <[email protected]>

Since commit ec757001c818 ("gpio: Enable nonexclusive gpiods from DT nodes") we are able to get GPIOD_FLAGS_BIT_NONEXCLUSIVE marked gpios. Currently the gpiolib uses the wrong flags variable for the check. We need to check the gpiod_flags instead of the of_gpio_flags else we return -EBUSY for GPIOD_FLAGS_BIT_NONEXCLUSIVE marked and requested gpiod's.

Quoted 7 lines
Fixes ec757001c818 gpio: Enable nonexclusive gpiods from DT nodes
[Bartosz: the function was moved to gpiolib-of.c so updated the patch]
[Bartosz: backported to v5.3.y]

Thanks for fixing up this backport Bartosz, much appreciated!

Yours,
Linus Walleij