Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 289685
b: refs/heads/master
c: 085deb1
h: refs/heads/master
i:
  289683: 41c7f03
v: v3
  • Loading branch information
Andiry Xu authored and Sarah Sharp committed Mar 13, 2012
1 parent 0a723da commit 60929ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 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: 2fdcd47b6980f4e26a97811a17f5be7cb919ef90
refs/heads/master: 085deb16845ee0b25385274b39c70cc07e6e4140
25 changes: 13 additions & 12 deletions trunk/drivers/usb/host/xhci-ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,24 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring,
}

/*
* Check to see if there's room to enqueue num_trbs on the ring. See rules
* above.
* Check to see if there's room to enqueue num_trbs on the ring and make sure
* enqueue pointer will not advance into dequeue segment. See rules above.
*/
static inline int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring,
unsigned int num_trbs)
{
if (ring->num_trbs_free >= num_trbs)
return 1;
int num_trbs_in_deq_seg;

return 0;
if (ring->num_trbs_free < num_trbs)
return 0;

if (ring->type != TYPE_COMMAND && ring->type != TYPE_EVENT) {
num_trbs_in_deq_seg = ring->dequeue - ring->deq_seg->trbs;
if (ring->num_trbs_free < num_trbs + num_trbs_in_deq_seg)
return 0;
}

return 1;
}

/* Ring the host controller doorbell after placing a command on the ring */
Expand Down Expand Up @@ -2529,13 +2537,6 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
return -ENOMEM;
}

if (ep_ring->enq_seg == ep_ring->deq_seg &&
ep_ring->dequeue > ep_ring->enqueue) {
xhci_err(xhci, "Can not expand the ring while dequeue "
"pointer has not passed the link TRB\n");
return -ENOMEM;
}

xhci_dbg(xhci, "ERROR no room on ep ring, "
"try ring expansion\n");
num_trbs_needed = num_trbs - ep_ring->num_trbs_free;
Expand Down

0 comments on commit 60929ac

Please sign in to comment.