[PATCH 044/115] usb: gadget: dummy_hcd: set gadget.is_otg before calling bind()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

Before commit 53832daea ("usb: gadget: dummy_hcd: use the shared_hcd
infrastructure") the is_otg field was set in dummy_udc_probe(). It seems
to me that this field is used in gadget's bind function. Therefore I'm
moving it before the bind() callback is called.

Cc: Tatyana Brokhman <tlinder@xxxxxxxxxxxxxx
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/usb/gadget/dummy_hcd.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index cecc25a..834fb92 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -929,6 +929,14 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
 		dum->ep[0].ep.maxpacket = 9;
 	} else
 		dum->ep[0].ep.maxpacket = 64;
+
+	if (dum->gadget.speed == USB_SPEED_SUPER)
+		dum->gadget.is_otg =
+			(dummy_hcd_to_hcd(dum->ss_hcd)->self.otg_port != 0);
+	else
+		dum->gadget.is_otg =
+			(dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0);
+
 	list_del_init (&dum->ep [0].ep.ep_list);
 	INIT_LIST_HEAD(&dum->fifo_req.queue);
 
@@ -944,13 +952,6 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
 		return retval;
 	}
 
-	if (dum->gadget.speed == USB_SPEED_SUPER)
-		dum->gadget.is_otg =
-			(dummy_hcd_to_hcd(dum->ss_hcd)->self.otg_port != 0);
-	else
-		dum->gadget.is_otg =
-			(dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0);
-
 	/* khubd will enumerate this in a while */
 	dummy_pullup(&dum->gadget, 1);
 	return 0;
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux