Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10794
b: refs/heads/master
c: b81d343
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent cf82532 commit d40117b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 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: 0c0382e32d46f606951010b202382be14d180a17
refs/heads/master: b81d34363c0b17c47f4ef63d5888c4f47f315d29
39 changes: 26 additions & 13 deletions trunk/drivers/usb/host/uhci-q.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,16 @@ static void uhci_insert_td_frame_list(struct uhci_hcd *uhci, struct uhci_td *td,
}
}

static void uhci_remove_td(struct uhci_hcd *uhci, struct uhci_td *td)
static inline void uhci_remove_td_frame_list(struct uhci_hcd *uhci,
struct uhci_td *td)
{
/* If it's not inserted, don't remove it */
if (td->frame == -1 && list_empty(&td->fl_list))
if (td->frame == -1) {
WARN_ON(!list_empty(&td->fl_list));
return;
}

if (td->frame != -1 && uhci->frame_cpu[td->frame] == td) {
if (uhci->frame_cpu[td->frame] == td) {
if (list_empty(&td->fl_list)) {
uhci->frame[td->frame] = td->link;
uhci->frame_cpu[td->frame] = NULL;
Expand All @@ -132,13 +135,20 @@ static void uhci_remove_td(struct uhci_hcd *uhci, struct uhci_td *td)
ptd->link = td->link;
}

wmb();
td->link = UHCI_PTR_TERM;

list_del_init(&td->fl_list);
td->frame = -1;
}

static void unlink_isochronous_tds(struct uhci_hcd *uhci, struct urb *urb)
{
struct urb_priv *urbp = (struct urb_priv *) urb->hcpriv;
struct uhci_td *td;

list_for_each_entry(td, &urbp->td_list, list)
uhci_remove_td_frame_list(uhci, td);
wmb();
}

/*
* Inserts a td list into qh.
*/
Expand Down Expand Up @@ -498,7 +508,6 @@ static void uhci_destroy_urb_priv(struct uhci_hcd *uhci, struct urb *urb)

list_for_each_entry_safe(td, tmp, &urbp->td_list, list) {
uhci_remove_td_from_urb(td);
uhci_remove_td(uhci, td);
list_add(&td->remove_list, &uhci->td_remove_list);
}

Expand Down Expand Up @@ -1068,6 +1077,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)
struct uhci_td *td;
int i, ret, frame;
int status, destination;
struct urb_priv *urbp = (struct urb_priv *) urb->hcpriv;

status = TD_CTRL_ACTIVE | TD_CTRL_IOS;
destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);
Expand All @@ -1076,11 +1086,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)
if (ret)
return ret;

frame = urb->start_frame;
for (i = 0; i < urb->number_of_packets; i++, frame += urb->interval) {
if (!urb->iso_frame_desc[i].length)
continue;

for (i = 0; i < urb->number_of_packets; i++) {
td = uhci_alloc_td(uhci);
if (!td)
return -ENOMEM;
Expand All @@ -1091,8 +1097,12 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)

if (i + 1 >= urb->number_of_packets)
td->status |= cpu_to_le32(TD_CTRL_IOC);
}

frame = urb->start_frame;
list_for_each_entry(td, &urbp->td_list, list) {
uhci_insert_td_frame_list(uhci, td, frame);
frame += urb->interval;
}

return -EINPROGRESS;
Expand All @@ -1105,7 +1115,7 @@ static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb)
int status;
int i, ret = 0;

urb->actual_length = 0;
urb->actual_length = urb->error_count = 0;

i = 0;
list_for_each_entry(td, &urbp->td_list, list) {
Expand All @@ -1129,6 +1139,7 @@ static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb)

i++;
}
unlink_isochronous_tds(uhci, urb);

return ret;
}
Expand Down Expand Up @@ -1361,6 +1372,8 @@ static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
goto done;
list_del_init(&urbp->urb_list);

if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS)
unlink_isochronous_tds(uhci, urb);
uhci_unlink_generic(uhci, urb);

uhci_get_current_frame_number(uhci);
Expand Down

0 comments on commit d40117b

Please sign in to comment.