]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
usb: musb: gadget: complete request only if data is transfered over
authorMing Lei <tom.leiming@gmail.com>
Mon, 20 Sep 2010 07:32:05 +0000 (10:32 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 24 Sep 2010 18:05:01 +0000 (11:05 -0700)
Complete the current request only if the data transfer is over.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Anand Gadiyar <gadiyar@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/musb/musb_gadget.c

index f3ee04f2e17d5c1719809c00a2a85268f0bca014..fa826f9e262bb22cdb1051315b31e1ba266a0d27 100644 (file)
@@ -501,14 +501,14 @@ void musb_g_tx(struct musb *musb, u8 epnum)
                                request->zero = 0;
                        }
 
-                       /* ... or if not, then complete it. */
-                       musb_g_giveback(musb_ep, request, 0);
-
-                       request = musb_ep->desc ? next_request(musb_ep) : NULL;
-                       if (!request) {
-                               DBG(4, "%s idle now\n",
-                                       musb_ep->end_point.name);
-                               return;
+                       if (request->actual == request->length) {
+                               musb_g_giveback(musb_ep, request, 0);
+                               request = musb_ep->desc ? next_request(musb_ep) : NULL;
+                               if (!request) {
+                                       DBG(4, "%s idle now\n",
+                                               musb_ep->end_point.name);
+                                       return;
+                               }
                        }
                }