On Thu, 6 Aug 2009, Madhavi Manchala wrote: > Dear Alan, > > Thanks for your information and help. > > As I explained in my previous emails, I have implemented the multiple > threads (two threads) in the gadget driver and it is working fine when > the storage driver issues commands sequentially. However, when the > storage driver issues the multiple commands (currently 2 commands at a > time) to the gadget driver, the gadget is not able to handle them. The > issue is like this, in the gadget driver, one thread sends the status > on the bulk in pipe which is for 10 bytes where as storage requested 4 > bytes and 10 bytes from two different threads. The gadget driver is > expecting 10 bytes first but the bulk_in callback gets 4 bytes which > results in a crash. I don't understand. Can you explain the problem more clearly? > Here my question is, the gadget driver first calls (invokes) the > start_transfer method, then only the bulk_in command complete callback > is invoked. But, is there any way to invoke the callback complete > method without calling the start_transfer method. You're talking about bulk_in_complete(), right? That function gets called whenever a bulk-IN transfer finishes. It sounds like you are asking if there's any way to finish a transfer without calling start_transfer(). The answer is No, since a transfer can't finish unless it is first started. > My idea is, if the > callback complete routine called first, then I will send the requested > number of bytes instead of sending the bytes to the upper layer > through start_transfer method. > > Please let me know if there are any ideas. I really don't understand why you are doing this. What reason is there to have more than one thread? Is it really much faster to submit two I/O operations at a time than to wait for the first operation to finish before submitting the second? 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