* [PATCH fix] Revert "USB: bcma: Add a check for devm_gpiod_get"
@ 2021-08-31 6:54 Rafał Miłecki
2021-10-01 8:59 ` Geert Uytterhoeven
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2021-08-31 6:54 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Liu Shixin, linux-usb, Rafał Miłecki, Chuhong Yuan
From: Rafał Miłecki <rafal@milecki.pl>
This reverts commit f3de5d857bb2362b00e2a8d4bc886cd49dcb66db.
That commit broke USB on all routers that have USB always powered on and
don't require toggling any GPIO. It's a majority of devices actually.
The original code worked and seemed safe: vcc GPIO is optional and
bcma_hci_platform_power_gpio() takes care of checking the pointer before
using it.
This revert fixes:
[ 10.801127] bcma_hcd: probe of bcma0:11 failed with error -2
Cc: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
drivers/usb/host/bcma-hcd.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c
index 337b425dd4b0..2df52f75f6b3 100644
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
@@ -406,12 +406,9 @@ static int bcma_hcd_probe(struct bcma_device *core)
return -ENOMEM;
usb_dev->core = core;
- if (core->dev.of_node) {
+ if (core->dev.of_node)
usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc",
GPIOD_OUT_HIGH);
- if (IS_ERR(usb_dev->gpio_desc))
- return PTR_ERR(usb_dev->gpio_desc);
- }
switch (core->id.id) {
case BCMA_CORE_USB20_HOST:
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH fix] Revert "USB: bcma: Add a check for devm_gpiod_get"
2021-08-31 6:54 [PATCH fix] Revert "USB: bcma: Add a check for devm_gpiod_get" Rafał Miłecki
@ 2021-10-01 8:59 ` Geert Uytterhoeven
0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2021-10-01 8:59 UTC (permalink / raw)
To: Rafał Miłecki
Cc: Greg Kroah-Hartman, Liu Shixin, linux-usb,
Rafał Miłecki, Chuhong Yuan, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]
Hi Rafał,
On Tue, 31 Aug 2021, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> This reverts commit f3de5d857bb2362b00e2a8d4bc886cd49dcb66db.
>
> That commit broke USB on all routers that have USB always powered on and
> don't require toggling any GPIO. It's a majority of devices actually.
>
> The original code worked and seemed safe: vcc GPIO is optional and
> bcma_hci_platform_power_gpio() takes care of checking the pointer before
> using it.
>
> This revert fixes:
> [ 10.801127] bcma_hcd: probe of bcma0:11 failed with error -2
>
> Cc: Chuhong Yuan <hslester96@gmail.com>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Thanks for your patch, which is being backported to stable.
> --- a/drivers/usb/host/bcma-hcd.c
> +++ b/drivers/usb/host/bcma-hcd.c
> @@ -406,12 +406,9 @@ static int bcma_hcd_probe(struct bcma_device *core)
> return -ENOMEM;
> usb_dev->core = core;
>
> - if (core->dev.of_node) {
> + if (core->dev.of_node)
> usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc",
> GPIOD_OUT_HIGH);
> - if (IS_ERR(usb_dev->gpio_desc))
> - return PTR_ERR(usb_dev->gpio_desc);
> - }
This means real errors and probe deferral are no longer handled.
What about using devm_gpiod_get_optional() instead?
After that, the check in bcma_hci_platform_power_gpio() can be removed,
as gpiod_set_value() handles NULL pointers fine.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-01 8:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 6:54 [PATCH fix] Revert "USB: bcma: Add a check for devm_gpiod_get" Rafał Miłecki
2021-10-01 8:59 ` Geert Uytterhoeven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.