Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213613
b: refs/heads/master
c: 689d6ea
h: refs/heads/master
i:
  213611: 21736fd
v: v3
  • Loading branch information
Ming Lei authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 0ad0741 commit eee02b9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00be545e49d83485d49a598d3b7e090088934be8
refs/heads/master: 689d6eacd1b7c3677bfe6ee367766f21c3c80e26
33 changes: 29 additions & 4 deletions trunk/drivers/usb/host/uhci-q.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,13 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
unsigned long destination, status;
int maxsze = le16_to_cpu(qh->hep->desc.wMaxPacketSize);
int len = urb->transfer_buffer_length;
dma_addr_t data = urb->transfer_dma;
int this_sg_len;
dma_addr_t data;
__le32 *plink;
struct urb_priv *urbp = urb->hcpriv;
unsigned int toggle;
struct scatterlist *sg;
int i;

if (len < 0)
return -EINVAL;
Expand All @@ -937,12 +940,26 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
if (usb_pipein(urb->pipe))
status |= TD_CTRL_SPD;

i = urb->num_sgs;
if (len > 0 && i > 0) {
sg = urb->sg;
data = sg_dma_address(sg);

/* urb->transfer_buffer_length may be smaller than the
* size of the scatterlist (or vice versa)
*/
this_sg_len = min_t(int, sg_dma_len(sg), len);
} else {
sg = NULL;
data = urb->transfer_dma;
this_sg_len = len;
}
/*
* Build the DATA TDs
*/
plink = NULL;
td = qh->dummy_td;
do { /* Allow zero length packets */
for (;;) { /* Allow zero length packets */
int pktsze = maxsze;

if (len <= pktsze) { /* The last packet */
Expand All @@ -965,10 +982,18 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
plink = &td->link;
status |= TD_CTRL_ACTIVE;

toggle ^= 1;
data += pktsze;
this_sg_len -= pktsze;
len -= maxsze;
toggle ^= 1;
} while (len > 0);
if (this_sg_len <= 0) {
if (--i <= 0 || len <= 0)
break;
sg = sg_next(sg);
data = sg_dma_address(sg);
this_sg_len = min_t(int, sg_dma_len(sg), len);
}
}

/*
* URB_ZERO_PACKET means adding a 0-length packet, if direction
Expand Down

0 comments on commit eee02b9

Please sign in to comment.