From a4dd6e88d38cbaef787f6be01109e15b0a78983f Mon Sep 17 00:00:00 2001 From: Li Jun Date: Tue, 25 Nov 2014 12:08:48 +0800 Subject: [PATCH] MLK-9897-2 usb: otg-fsm: check B-device state before sending polling request While system resume, the connected udev as B-device may not has been resumed, if HNP polling request is sent to it, HNP polling may fail, this patch adds check of the udev state to make sure it finished resume and to be configured state before sending host request message, otherwise try next HNP polling request. Acked-by: Peter Chen Signed-off-by: Li Jun (cherry picked from commit 2cff5eb7bd4feb70cd28ac4655e7433e57a17938) (cherry picked from commit b6eea060a3760bdb24d1514a5130a346daba81c9) --- drivers/usb/common/usb-otg-fsm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 65f8b7bbd928..1476c10c5a7c 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -157,6 +157,13 @@ static void otg_hnp_polling_work(struct work_struct *work) return; } + if (udev->state != USB_STATE_CONFIGURED) { + dev_dbg(&udev->dev, "the B dev is not resumed!\n"); + schedule_delayed_work(&fsm->hnp_polling_work, + msecs_to_jiffies(T_HOST_REQ_POLL)); + return; + } + /* * Legacy otg test device does not support HNP polling, * start HNP directly for legacy otg test device.