diff options
| author | Li Jun <jun.li@freescale.com> | 2015-04-12 05:51:02 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-28 06:51:30 -0400 |
| commit | a5a356cee89f86ff86cc3ce24136ca1f802c1bf1 (patch) | |
| tree | b76a87e85f668e4c95c6ec4966994266c0bebcc0 | |
| parent | 8e779c6c4a398763c21371fe40f649206041dc1e (diff) | |
usb: chipidea: otg: remove mutex unlock and lock while stop and start role
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: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/usb/chipidea/otg_fsm.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 083acf45ad5a..19d655a743b5 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c | |||
| @@ -520,7 +520,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on) | |||
| 520 | { | 520 | { |
| 521 | struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); | 521 | struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); |
| 522 | 522 | ||
| 523 | mutex_unlock(&fsm->lock); | ||
| 524 | if (on) { | 523 | if (on) { |
| 525 | ci_role_stop(ci); | 524 | ci_role_stop(ci); |
| 526 | ci_role_start(ci, CI_ROLE_HOST); | 525 | ci_role_start(ci, CI_ROLE_HOST); |
| @@ -529,7 +528,6 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on) | |||
| 529 | hw_device_reset(ci); | 528 | hw_device_reset(ci); |
| 530 | ci_role_start(ci, CI_ROLE_GADGET); | 529 | ci_role_start(ci, CI_ROLE_GADGET); |
| 531 | } | 530 | } |
| 532 | mutex_lock(&fsm->lock); | ||
| 533 | return 0; | 531 | return 0; |
| 534 | } | 532 | } |
| 535 | 533 | ||
| @@ -537,12 +535,10 @@ static int ci_otg_start_gadget(struct otg_fsm *fsm, int on) | |||
| 537 | { | 535 | { |
| 538 | struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); | 536 | struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); |
| 539 | 537 | ||
| 540 | mutex_unlock(&fsm->lock); | ||
| 541 | if (on) | 538 | if (on) |
| 542 | usb_gadget_vbus_connect(&ci->gadget); | 539 | usb_gadget_vbus_connect(&ci->gadget); |
| 543 | else | 540 | else |
| 544 | usb_gadget_vbus_disconnect(&ci->gadget); | 541 | usb_gadget_vbus_disconnect(&ci->gadget); |
| 545 | mutex_lock(&fsm->lock); | ||
| 546 | 542 | ||
| 547 | return 0; | 543 | return 0; |
| 548 | } | 544 | } |
