From 108e051cd48d4a79439bcfb517cc5cb659d34dfd Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Thu, 8 Dec 2016 17:37:53 -0800 Subject: [PATCH] usb: gadget: Reset notify count to 0 upon completion for RNDIS When host RNDIS sends reset message it skips response available notification and directly sends get encap response. This causes notify count to become > 1. As a result when notify completion happens driver is queuing another notify response available when there is no legitimate response to send from device side. Hence reset notify count back to 0 after the completion of notify response, so that next notification will only be sent when there is a send encap command sent by host. Change-Id: I242478408f8cb60fb5af5c741dbf2e8bf3e38af8 Signed-off-by: Hemant Kumar --- drivers/usb/gadget/function/f_gsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index af20033b621f..961af43bc9bd 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -1467,7 +1467,15 @@ static void gsi_ctrl_notify_resp_complete(struct usb_ep *ep, event->bNotificationType, req->status); /* FALLTHROUGH */ case 0: - /* + /* no need to handle multiple resp available for RNDIS */ + if (gsi->prot_id == IPA_USB_RNDIS) { + atomic_set(&gsi->c_port.notify_count, 0); + log_event_dbg("notify_count = %d", + atomic_read(&gsi->c_port.notify_count)); + break; + } + + /* * handle multiple pending resp available * notifications by queuing same until we're done, * rest of the notification require queuing new