]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MLK-9794-2 usb: common: otg: clear host_request_flag when leaves peripheral
authorLi Jun <B47624@freescale.com>
Tue, 4 Nov 2014 12:12:31 +0000 (20:12 +0800)
committerLi Jun <jun.li@freescale.com>
Wed, 21 Jan 2015 14:11:11 +0000 (22:11 +0800)
This patch clear host_request_flag when leaves peripheral state, instead of
entering host state, this can make sure this flag can be cleared after try
to do role switch, no matter the role switch succeeds or not.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
drivers/usb/common/usb-otg-fsm.c

index 0eb67580c756a7dec288710c7cda705168c741b6..296402b15cd0fb21fc5113b531ff9b0809193296 100644 (file)
@@ -78,6 +78,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
                fsm->b_srp_done = 0;
                break;
        case OTG_STATE_B_PERIPHERAL:
+               if (fsm->otg->gadget)
+                       fsm->otg->gadget->host_request_flag = 0;
                break;
        case OTG_STATE_B_WAIT_ACON:
                otg_del_timer(fsm, B_ASE0_BRST);
@@ -107,6 +109,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
        case OTG_STATE_A_PERIPHERAL:
                otg_del_timer(fsm, A_BIDL_ADIS);
                fsm->a_bidl_adis_tmout = 0;
+               if (fsm->otg->gadget)
+                       fsm->otg->gadget->host_request_flag = 0;
                break;
        case OTG_STATE_A_WAIT_VFALL:
                otg_del_timer(fsm, A_WAIT_VFALL);