On Wed, Jun 10, 2009 at 03:00:39PM -0400, Alan Stern wrote: > On Tue, 9 Jun 2009, Sarah Sharp wrote: > > > Can the endpoint_reset method be called in interrupt context? I need to > > issue a command to the xHCI host controller hardware and wait on that > > command to complete before a driver can successfully submit new URBs for > > that endpoint. > > Have you found a solution for this problem? One of my patches in > Greg's tree will have to be revised if we allow endpoint_reset to be > called in interrupt context. I've been thinking about how to incorporate Pete's callback idea, but all my solutions so far have been rather kludgy. (And I'm not familiar with many kernel data structures, so I think rather slowly. :) The problem with a callback is I'm not sure if drivers would be happy with a callback that runs in interrupt context. If drivers would be able to deal with that, then usb_reset_endpoint() could just take a function to call when the reset is done, and a void pointer to pass that function. The HCD would just call that function when the endpoint reset is done. If drivers need to have the callback run in process context, then it gets more complicated. I think it could be done with a work queue and a couple of completions. Drivers would still submit a function and void pointer to usb_reset_endpoint(). That would create a new struct completion, call the HCD endpoint_reset() method with that completion, and submit a task to a work queue. That task, when called, would wait on the completion, and call the driver function when it was completed. It gets even more complicated when you consider how to retrofit the usb_clear_halt() function into this mess. That really wants the usb_reset_endpoint() to be synchronous, you'd need probably yet another struct completion in there somewhere. Anyone come up with a simpler solution? Sarah -- 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