From 0871614c5db5f6bb55a5e4f3861ba14cd4e85eb5 Mon Sep 17 00:00:00 2001 From: Manu Gautam Date: Fri, 1 Nov 2019 11:15:11 +0530 Subject: [PATCH] usb: gsi: Prevent function remote-wakeup without function suspend Some hosts enable function remote-wakeup immediately after enumeration. But they don't perform function_suspend before U3 and also don't disable function remote-wakeup even if entering deep sleep state and don't intend to wakeup from USB. One of the reason could be that they rely on device to initiate remote-wakeup only if it function suspended. Hence, update the check to initiate function remote-wakeup only if device is function suspended. Change-Id: I3d6bb817d9174f94051b1e1ef74dc9c941c66f4c Signed-off-by: Manu Gautam --- drivers/usb/gadget/function/f_gsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index fda01d234681..79688d192e72 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -38,7 +38,8 @@ static inline bool usb_gsi_remote_wakeup_allowed(struct usb_function *f) struct f_gsi *gsi = func_to_gsi(f); if (f->config->cdev->gadget->speed >= USB_SPEED_SUPER) - remote_wakeup_allowed = gsi->func_wakeup_allowed; + remote_wakeup_allowed = + gsi->func_is_suspended ? gsi->func_wakeup_allowed : false; else remote_wakeup_allowed = usb_get_remote_wakeup_status(f->config->cdev->gadget);