usb: dwc3: Don't perform pm rt sync operations in atomic context
For mass storage function driver ep_disable will be called in worker thread context. Making sure controller is active and then calling ep_disable and then putting controller back to lpm is very difficult to achieve in mass storage driver. The reason is that fsg_disable raises an exception which actaully waits for the completion callback to come from gadget driver and if for some reason (like command timeout error) if it doesn't, then do_set_iterface will not be called which will do put_sync. This can prevent controller from going to lpm. To solve above problem, commit ad8d260c ("usb: dwc3: gadget: Check controller status with endpoint enable/disable") moved pm_runtime_sync operations from mass storage driver to gadget driver. But there is a chance that pm_runtime get_sync and put sync operations in gadget driver can be called in atomic context (taking spin_lock in function driver and then calling) and lead to crash. Adding in_lpm check and performing these operations only if controller is in lpm will ensure that these operations will be done only for mass storage driver and not be done in atomic context. For other function drivers where ep_disable will be called in atomic context, there is no chance that ep_disable will be called when controller is in lpm as bh_work or resume work will be called and will ensure controller to be out of LPM before ep_disable is called. Change-Id: I37635fd75e44a67deadbd4796b757d85d604aed4 Signed-off-by:Rohith Kollalsi <rkollals@codeaurora.org>
Loading
Please register or sign in to comment