From: Li Jun Date: Sun, 12 Apr 2015 09:51:02 +0000 (+0800) Subject: usb: chipidea: otg: remove mutex unlock and lock while stop and start role X-Git-Tag: v3.18.14~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69e961c2193d21b1e754310c96dbcd8ffd224a3e;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-3.18-exynos7270.git usb: chipidea: otg: remove mutex unlock and lock while stop and start role [ Upstream commit a5a356cee89f86ff86cc3ce24136ca1f802c1bf1 ] Wrongly release mutex lock during otg_statemachine may result in re-enter otg_statemachine, which is not allowed, we should do next state transtition after previous one completed. Fixes: 826cfe751f3e ("usb: chipidea: add OTG fsm operation functions implementation") Cc: # v3.16+ Signed-off-by: Li Jun Signed-off-by: Peter Chen Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index caaabc5..34a52cd 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -537,7 +537,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on) { struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); - mutex_unlock(&fsm->lock); if (on) { ci_role_stop(ci); ci_role_start(ci, CI_ROLE_HOST); @@ -546,7 +545,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on) hw_device_reset(ci, USBMODE_CM_DC); ci_role_start(ci, CI_ROLE_GADGET); } - mutex_lock(&fsm->lock); return 0; } @@ -554,12 +552,10 @@ static int ci_otg_start_gadget(struct otg_fsm *fsm, int on) { struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); - mutex_unlock(&fsm->lock); if (on) usb_gadget_vbus_connect(&ci->gadget); else usb_gadget_vbus_disconnect(&ci->gadget); - mutex_lock(&fsm->lock); return 0; }