From e9000bd1eb0b523187e6f98276d5610fe01357f3 Mon Sep 17 00:00:00 2001 From: Chandana Kishori Chiluveru Date: Fri, 1 Jun 2018 12:59:53 +0530 Subject: [PATCH] usb: gsi: Fix runtime PM usage count for MBIM interface GSI Driver get the usage count in work handler when set_alt 1 happens and this counter will decrement in disconnect work due to cable disconnect or in gsi_suspend for suspended state. In this case set alt to 0 came for MBIM interface and clear the data_interface_up flag. After that suspend happens and does not decrement the counter in gsi_suspend. This causes a mismatch of usage count and usb not entering to low power mode. Fix this by checking for USB_PROT_GPS_CTRL instead of data_interface_up. Change-Id: Iaabf3de46ed72e33980d1e3e386e8ca0ae651c74 Signed-off-by: Chandana Kishori Chiluveru --- drivers/usb/gadget/function/f_gsi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index cd6f8f1c7017..797398d37957 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -2580,7 +2580,11 @@ static void gsi_suspend(struct usb_function *f) return; } - if (!gsi->data_interface_up) { + /* + * GPS doesn't use any data interface, hence bail out as there is no + * GSI specific handling needed. + */ + if (gsi->prot_id == IPA_USB_GPS) { log_event_dbg("%s: suspend done\n", __func__); return; } @@ -2614,7 +2618,7 @@ static void gsi_resume(struct usb_function *f) /* Check any pending cpkt, and queue immediately on resume */ gsi_ctrl_send_notification(gsi); - if (!gsi->data_interface_up) { + if (gsi->prot_id == IPA_USB_GPS) { log_event_dbg("%s: resume done\n", __func__); return; }