aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/uhci-q.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 23:30:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 23:30:48 -0400
commit5cc103506289de7ee0a0b526ae0381541990cad4 (patch)
treeae8a4958e70c6d1295030b40e333dcc007b3c074 /drivers/usb/host/uhci-q.c
parent73ecf3a6e3f0206bf56a0fefe3b3eda042fb7034 (diff)
parent92ca0dc5ee022e4c0e488177e1d8865a0778c6c2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (141 commits) USB: mct_u232: fix broken close USB: gadget: amd5536udc.c: fix error path USB: imx21-hcd - fix off by one resource size calculation usb: gadget: fix Kconfig warning usb: r8a66597-udc: Add processing when USB was removed. mxc_udc: add workaround for ENGcm09152 for i.MX35 USB: ftdi_sio: add device ids for ScienceScope USB: musb: AM35x: Workaround for fifo read issue USB: musb: add musb support for AM35x USB: AM35x: Add musb support usb: Fix linker errors with CONFIG_PM=n USB: ohci-sh - use resource_size instead of defining its own resource_len macro USB: isp1362-hcd - use resource_size instead of defining its own resource_len macro USB: isp116x-hcd - use resource_size instead of defining its own resource_len macro USB: xhci: Fix compile error when CONFIG_PM=n USB: accept some invalid ep0-maxpacket values USB: xHCI: PCI power management implementation USB: xHCI: bus power management implementation USB: xHCI: port remote wakeup implementation USB: xHCI: port power management implementation ... Manually fix up (non-data) conflict: the SCSI merge gad renamed the 'hw_sector_size' member to 'physical_block_size', and the USB tree brought a new use of it.
Diffstat (limited to 'drivers/usb/host/uhci-q.c')
-rw-r--r--drivers/usb/host/uhci-q.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index d3ade4018487..2090b45eb606 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -917,10 +917,13 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
917 unsigned long destination, status; 917 unsigned long destination, status;
918 int maxsze = le16_to_cpu(qh->hep->desc.wMaxPacketSize); 918 int maxsze = le16_to_cpu(qh->hep->desc.wMaxPacketSize);
919 int len = urb->transfer_buffer_length; 919 int len = urb->transfer_buffer_length;
920 dma_addr_t data = urb->transfer_dma; 920 int this_sg_len;
921 dma_addr_t data;
921 __le32 *plink; 922 __le32 *plink;
922 struct urb_priv *urbp = urb->hcpriv; 923 struct urb_priv *urbp = urb->hcpriv;
923 unsigned int toggle; 924 unsigned int toggle;
925 struct scatterlist *sg;
926 int i;
924 927
925 if (len < 0) 928 if (len < 0)
926 return -EINVAL; 929 return -EINVAL;
@@ -937,12 +940,26 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
937 if (usb_pipein(urb->pipe)) 940 if (usb_pipein(urb->pipe))
938 status |= TD_CTRL_SPD; 941 status |= TD_CTRL_SPD;
939 942
943 i = urb->num_sgs;
944 if (len > 0 && i > 0) {
945 sg = urb->sg;
946 data = sg_dma_address(sg);
947
948 /* urb->transfer_buffer_length may be smaller than the
949 * size of the scatterlist (or vice versa)
950 */
951 this_sg_len = min_t(int, sg_dma_len(sg), len);
952 } else {
953 sg = NULL;
954 data = urb->transfer_dma;
955 this_sg_len = len;
956 }
940 /* 957 /*
941 * Build the DATA TDs 958 * Build the DATA TDs
942 */ 959 */
943 plink = NULL; 960 plink = NULL;
944 td = qh->dummy_td; 961 td = qh->dummy_td;
945 do { /* Allow zero length packets */ 962 for (;;) { /* Allow zero length packets */
946 int pktsze = maxsze; 963 int pktsze = maxsze;
947 964
948 if (len <= pktsze) { /* The last packet */ 965 if (len <= pktsze) { /* The last packet */
@@ -965,10 +982,18 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
965 plink = &td->link; 982 plink = &td->link;
966 status |= TD_CTRL_ACTIVE; 983 status |= TD_CTRL_ACTIVE;
967 984
985 toggle ^= 1;
968 data += pktsze; 986 data += pktsze;
987 this_sg_len -= pktsze;
969 len -= maxsze; 988 len -= maxsze;
970 toggle ^= 1; 989 if (this_sg_len <= 0) {
971 } while (len > 0); 990 if (--i <= 0 || len <= 0)
991 break;
992 sg = sg_next(sg);
993 data = sg_dma_address(sg);
994 this_sg_len = min_t(int, sg_dma_len(sg), len);
995 }
996 }
972 997
973 /* 998 /*
974 * URB_ZERO_PACKET means adding a 0-length packet, if direction 999 * URB_ZERO_PACKET means adding a 0-length packet, if direction