Hi, On Mon, Jul 22, 2013 at 10:55:28AM -0400, Alan Stern wrote: > On Mon, 22 Jul 2013, Felipe Balbi wrote: > > > before changing to configured state, we need > > to wait until gadget driver has had a chance > > to process the request. > > > > In case of USB_GADGET_DELAYED_STATUS, that means > > we need to defer usb_gadget_set_state() until > > the upcoming usb_ep_queue(). > > > > Reported-by: Alan Stern <[email protected]> > > Signed-off-by: Felipe Balbi <[email protected]> > > --- > > drivers/usb/dwc3/ep0.c | 13 +++++++++++-- > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c > > index 007651c..7fa93f4 100644 > > --- a/drivers/usb/dwc3/ep0.c > > +++ b/drivers/usb/dwc3/ep0.c > > @@ -148,6 +148,7 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, > > > > direction = !dwc->ep0_expect_in; > > dwc->delayed_status = false; > > + usb_gadget_set_state(&dwc->gadget, USB_STATE_CONFIGURED); > > Isn't this overkill? Do you really want to call usb_gadget_set_state() > every time the gadget driver queues a transfer on ep0? > > Or am I missing an important part of the context?
heh, you're missing context, that will only be called when we had
delayed status flag set:
| static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep,
| struct dwc3_request *req)
| {
[ ... ]
| /*
| * In case gadget driver asked us to delay the STATUS phase,
| * handle it here.
| */
| if (dwc->delayed_status) {
| unsigned direction;
|
| direction = !dwc->ep0_expect_in;
| dwc->delayed_status = false;
| usb_gadget_set_state(&dwc->gadget, USB_STATE_CONFIGURED);
|
| if (dwc->ep0state == EP0_STATUS_PHASE)
| __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
| else
| dev_dbg(dwc->dev, "too early for delayed status\n");
|
| return 0;
| }
[ ... ]
| return 0;
| }
--
balbi
signature.asc
Description: Digital signature
