On Mon, Jul 11, 2011 at 5:31 PM, Felipe Balbi <balbi@xxxxxx> wrote: > Hi, > > On Mon, Jul 11, 2011 at 05:18:18PM +0800, Bob Liu wrote: >> g_zero test during loopback mode will fail like this: >> zero gadget: can't loop ep6out to ep5in: -22 >> >> The reason is this check "if (request->ep != musb_ep)" in musb_gadget, >> this patch rm it. >> >> Signed-off-by: Bob Liu <lliubbo@xxxxxxxxx> >> --- >> drivers/usb/musb/musb_gadget.c | 3 --- >> 1 files changed, 0 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c >> index b67a062..7318a20 100644 >> --- a/drivers/usb/musb/musb_gadget.c >> +++ b/drivers/usb/musb/musb_gadget.c >> @@ -1289,9 +1289,6 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, >> request = to_musb_request(req); >> request->musb = musb; >> >> - if (request->ep != musb_ep) >> - return -EINVAL; > > I believe the problem is somewhere else. If request->ep != musb_ep we > would be queueing a request to the wrong endpoint. Is g_zero simply Oh, I found after this patch ./testusb -t5 -c 2 -s 256 -D /proc/bus/usb/002/019 will hang although ./testusb -t5 -c 1 -s 256 -D /proc/bus/usb/002/019 can pass. > re-using a request it just received from ep6out and queueing it straight > away to ep5in ?? I mean.. I'm not sure we should allow: I think so, see loopback_complete in f_loopback.c 200 if (ep == loop->out_ep) { 201 /* loop this OUT packet back IN to the host */ 202 req->zero = (req->actual < req->length); 203 req->length = req->actual; 204 status = usb_ep_queue(loop->in_ep, req, GFP_ATOMIC); 205 if (status == 0) 206 return; 207 208 /* "should never get here" */ 209 ERROR(cdev, "can't loop %s to %s: %d\n", 210 ep->name, loop->in_ep->name, 211 status); 212 } BTW: Would you please do g_zero testing on your platform to check whether this error "zero gadget: can't loop xxx to xxx: -22" also happen. Thanks. > > usb_ep_alloc_request(ep6out, GFP_KERNEL); > usb_ep_queue(ep5in, GFP_KERNEL); > > The request, clearly, wasn't queued for that endpoint. > > -- > balbi > -- Regards, --Bob -- 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