On Thu, 25 Apr 2013, victor yeo wrote: > Hi, > > >> This is the stack dump when the completion routine is called without > >> an interrupt occurring first, is it useful? > >> > >> Backtrace: > >> [<c020c0fc>] (dump_backtrace+0x0/0x110) from [<c03ef5e4>] (dump_stack+0x18/0x1c) > >> r6:bf030da8 r5:c12aec00 r4:c12b4c00 r3:000000f8 > >> [<c03ef5cc>] (dump_stack+0x0/0x1c) from [<bf02fecc>] > >> (kagen2_ep_queue+0x520/0x598 [kagen2_udc]) > >> [<bf02f9ac>] (kagen2_ep_queue+0x0/0x598 [kagen2_udc]) from > >> [<bf036068>] (fsg_lun_open+0x578/0x1278 [g_file_storage]) > >> [<bf035f20>] (fsg_lun_open+0x430/0x1278 [g_file_storage]) from > >> [<bf037cd4>] (fsg_main_thread+0x10c/0x155c [g_file_storage]) > >> r8:00000000 r7:00000001 r6:c12896c0 r5:c12896bc r4:c1289600 > >> [<bf037bc8>] (fsg_main_thread+0x0/0x155c [g_file_storage]) from > >> [<c022f8f4>] (kthread+0x94/0xa0) > >> [<c022f860>] (kthread+0x0/0xa0) from [<c02191c8>] (do_exit+0x0/0x6f0) > >> r6:c02191c8 r5:c022f860 r4:c1327e00 > > > > This shows that kagen2_ep_queue() calls kareq->req.complete. Perhaps > > indirectly, through another function. If this is true then it's > > probably a bug. You should check it out. > > Yes, the kagen2_ep_queue() calls req->req.complete directly. I thought > this is necessary to pass the packets to gadget driver for processing? It is necessary to call req.complete when the request has _completed_! That's why the callback is named "complete"! > req->req.complete is mapped to bulk_out_complete() or > bulk_in_complete(). A bulk-out request isn't complete until the data has been received from the host. A bulk-in request isn't complete until the data has been sent to the host (or at least copied into a hardware buffer). kagen2_ep_queue() gets called when the bulk-out request is submitted, right? So the request is not complete at that time. It isn't complete until the host has sent the data. After all, if you haven't received the packets from the host yet, how can you pass the packets to the gadget driver for processing? 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