hi alan: 2011/1/2 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>: > On Sat, 1 Jan 2011, vichy wrote: > >> after tracing the source code, I found usb_hcd_giveback_urb will be >> called in ehci_urb_done when interrupt happen and that is the normal >> path. > > Yes. > >> But what makes me confuse is when timeout happen such as >> wait_for_completion_timeout in usb_start_wait_urb, which function will >> call usb_hcd_giveback_urb and bring -2 to it originally I guess maybe >> the ehci_watchdog, but I think it is not, because the function has no >> idea of the time out parameter, right? > > No, not ehci_watchdog. It's the same function as above, ehci_urb_done. Thanks for your help :) after studying the source again, I guess when timeout happen, the ehci_urb_done is called by end_unlink_async to screen out the previous commands. Why I ask this question is I found something abnormal I purposely dump the the token of the qtd in timeout urb under qh_completions and it shows: (I set a bit when driver fail on wait_for_completion_timeout, and check this bit in qh_completions) urb 84718200 toke 0x80000e00 ehci -ehci.0: ehci_urb_done 1 urb 84718200 ep0out status -150 len 0/0 usb 2-1: ifconfig timed out on ep0out len=0/0 The active bit is 0, and if I remember correctly this bit should be already set in qh_urb_transaction. Meanwhile, I also add message as below: wmb (); dummy->hw_token = token; if(token != dummy->hw_token) printk("Not identy token=0x%x, dummy->hw_token=0x%x\n",token, dummy->hw_token); but i didn't see it in the log. I also grep the source and I didn't find any place to clear this bit. Did I miss anything or I need to do more experiments? appreciate your kind help :) vichy > >> BTW, under what circumstance the status of urb will be -150? >> I grep include/linux and didn't find amy error number which is -150. >> appreciate your kind help :) > > include/linux is not the right directory. You should be looking in > arch/*/include/asm and include/asm-generic/errno*.h. If you are using > an x86 architecture then the URB status should never be -150. But if > you are using a MIPS architecture then -150 is the same as > -EINPROGRESS. > > Alan Stern > > -- 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