From: Li Jun <b47...@freescale.com> This patch adds host_request_flag in usb_gadget to store host request from application, clear the flag when otg leaves host state.
Signed-off-by: Li Jun <b47...@freescale.com> --- drivers/usb/common/usb-otg-fsm.c | 4 ++++ include/linux/usb/gadget.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 1c56739..4d35631 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -84,6 +84,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) fsm->b_ase0_brst_tmout = 0; break; case OTG_STATE_B_HOST: + if (fsm->otg->gadget) + fsm->otg->gadget->host_request_flag = 0; break; case OTG_STATE_A_IDLE: fsm->adp_prb = 0; @@ -98,6 +100,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) break; case OTG_STATE_A_HOST: otg_del_timer(fsm, A_WAIT_ENUM); + if (fsm->otg->gadget) + fsm->otg->gadget->host_request_flag = 0; break; case OTG_STATE_A_SUSPEND: otg_del_timer(fsm, A_AIDL_BDIS); diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index c3a6185..3b17e99 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -562,6 +562,7 @@ struct usb_gadget { unsigned b_hnp_enable:1; unsigned a_hnp_support:1; unsigned a_alt_hnp_support:1; + unsigned host_request_flag:1; unsigned quirk_ep_out_aligned_size:1; }; #define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html