From: Tony Lindgren Date: Thu, 22 Sep 2016 20:58:29 +0000 (-0500) Subject: usb: musb: Fix PM runtime for disconnect after unconfigure X-Git-Tag: v4.9-rc1~146^2~11 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=4e719183667e1363b0d81add5212aee2f149d727;p=linux.git usb: musb: Fix PM runtime for disconnect after unconfigure If we unconfigure musb as a USB peripheral with cable connected, and then remove the cable, no interrupts will happen. And musb thinks we're still connected keeping the device active. Now with the session bit based PM runtime working for musb, we can fix this issue by calling musb irq_work. That rechecks the devctl register and reconfigures PM runtime based on the devctl. Fixes: 467d5c980709 ("usb: musb: Implement session bit based runtime PM for musb-core") Signed-off-by: Tony Lindgren Signed-off-by: Bin Liu Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 6d1e975e9605..bff4869a57cd 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1964,6 +1964,9 @@ static int musb_gadget_stop(struct usb_gadget *g) * that currently misbehaves. */ + /* Force check of devctl register for PM runtime */ + schedule_work(&musb->irq_work); + pm_runtime_mark_last_busy(musb->controller); pm_runtime_put_autosuspend(musb->controller);