Skip to content

Commit

Permalink
usb: gadget: dummy_hcd: set gadget.is_otg before calling bind()
Browse files Browse the repository at this point in the history
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@codeaurora.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Sebastian Andrzej Siewior authored and Greg Kroah-Hartman committed Jul 1, 2011
1 parent 2542787 commit 99fd140
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit 99fd140

Please sign in to comment.