diff mbox

[2/2] USB: musb-gadget: fix OUT transfer in double buffer case

Message ID 1282909068-2968-1-git-send-email-tom.leiming@gmail.com (mailing list archive)
State New, archived
Delegated to: Felipe Balbi
Headers show

Commit Message

Ming Lei Aug. 27, 2010, 11:37 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h
index 916065b..dff91ce 100644
--- a/drivers/usb/musb/musb_dma.h
+++ b/drivers/usb/musb/musb_dma.h
@@ -89,6 +89,8 @@  struct musb_hw_ep;
 # if !ANOMALY_05000456
 #  define USE_MODE1
 # endif
+#else
+#  define USE_MODE1
 #endif
 
 /*
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index e0bd1c1..f1c44b9 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -662,10 +662,11 @@  static void rxstate(struct musb *musb, struct musb_request *req)
 				if (request->actual < request->length) {
 					int transfer_size = 0;
 #ifdef USE_MODE1
-					transfer_size = min(request->length,
+					transfer_size = min(request->length - request->actual,
 							channel->max_len);
 #else
-					transfer_size = len;
+					transfer_size = min(request->length - request->actual,
+							len);
 #endif
 					if (transfer_size <= musb_ep->packet_sz)
 						musb_ep->dma->desired_mode = 0;