All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: Use the first available device for ehci_gadget
@ 2021-11-05 16:52 Sean Anderson
  2021-11-06  3:16 ` Simon Glass
  2022-01-26 15:37 ` Simon Glass
  0 siblings, 2 replies; 3+ messages in thread
From: Sean Anderson @ 2021-11-05 16:52 UTC (permalink / raw)
  To: Bin Meng; +Cc: Simon Glass, Marek Vasut, Sean Anderson, u-boot

For whatever reason, usb_setup_ehci_gadget removes and probes USB device
0. However, not all systems have a device 0. Use the first device
instead.

The device probed should probably have something to do with the
controller (as specified by e.g. ums <controller> or fastboot
<controller>). In fact, I find it odd that we probe the USB device in
the first place, because this is just to set up the gadget itself.
Presumably, the controller should be probed by usb_gadget_initialize
somehow.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

 drivers/usb/host/usb-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index fd39c3345c..27e2fc6fcd 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -396,7 +396,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp)
 	int ret;
 
 	/* Find the old device and remove it */
-	ret = uclass_find_device_by_seq(UCLASS_USB, 0, &dev);
+	ret = uclass_find_first_device(UCLASS_USB, &dev);
 	if (ret)
 		return ret;
 	ret = device_remove(dev, DM_REMOVE_NORMAL);
@@ -419,7 +419,7 @@ int usb_remove_ehci_gadget(struct ehci_ctrl **ctlrp)
 	int ret;
 
 	/* Find the old device and remove it */
-	ret = uclass_find_device_by_seq(UCLASS_USB, 0, &dev);
+	ret = uclass_find_first_device(UCLASS_USB, &dev);
 	if (ret)
 		return ret;
 	ret = device_remove(dev, DM_REMOVE_NORMAL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: Use the first available device for ehci_gadget
  2021-11-05 16:52 [PATCH] usb: Use the first available device for ehci_gadget Sean Anderson
@ 2021-11-06  3:16 ` Simon Glass
  2022-01-26 15:37 ` Simon Glass
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-11-06  3:16 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Bin Meng, Marek Vasut, u-boot

On Fri, 5 Nov 2021 at 10:53, Sean Anderson <sean.anderson@seco.com> wrote:
>
> For whatever reason, usb_setup_ehci_gadget removes and probes USB device
> 0. However, not all systems have a device 0. Use the first device
> instead.
>
> The device probed should probably have something to do with the
> controller (as specified by e.g. ums <controller> or fastboot
> <controller>). In fact, I find it odd that we probe the USB device in
> the first place, because this is just to set up the gadget itself.
> Presumably, the controller should be probed by usb_gadget_initialize
> somehow.
>
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>
>  drivers/usb/host/usb-uclass.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: Use the first available device for ehci_gadget
  2021-11-05 16:52 [PATCH] usb: Use the first available device for ehci_gadget Sean Anderson
  2021-11-06  3:16 ` Simon Glass
@ 2022-01-26 15:37 ` Simon Glass
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-01-26 15:37 UTC (permalink / raw)
  To: Simon Glass; +Cc: Bin Meng, Marek Vasut, Sean Anderson, u-boot

On Fri, 5 Nov 2021 at 10:53, Sean Anderson <sean.anderson@seco.com> wrote:
>
> For whatever reason, usb_setup_ehci_gadget removes and probes USB device
> 0. However, not all systems have a device 0. Use the first device
> instead.
>
> The device probed should probably have something to do with the
> controller (as specified by e.g. ums <controller> or fastboot
> <controller>). In fact, I find it odd that we probe the USB device in
> the first place, because this is just to set up the gadget itself.
> Presumably, the controller should be probed by usb_gadget_initialize
> somehow.
>
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>
>  drivers/usb/host/usb-uclass.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-26 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 16:52 [PATCH] usb: Use the first available device for ehci_gadget Sean Anderson
2021-11-06  3:16 ` Simon Glass
2022-01-26 15:37 ` Simon Glass

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.