Commit 958ffea3 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] hcds, remove urb->next

This makes the hcds stop expecting urb->next to exist.

        ehci-hcd ... remove obsolete sanity check
        usb-uhci-hcd ... remove code (wouldn't be called)

Two "old style" drivers got updated too (uhci, usb-uhci)
so that folk can use them in case of problems with their
"new style" analogues.
parent 33720d55
......@@ -964,15 +964,6 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags)
if (urb->iso_frame_desc [0].offset != 0)
return -EINVAL;
/*
* NOTE doing this for now, anticipating periodic URB models
* get updated to be "explicit resubmit".
*/
if (urb->next) {
dbg ("use explicit resubmit for ISO");
return -EINVAL;
}
/* allocate ITDs w/o locking anything */
status = itd_urb_transaction (ehci, urb, mem_flags);
if (status < 0)
......
......@@ -106,8 +106,6 @@ static void wakeup_hc(struct uhci *uhci);
/* to make sure it doesn't hog all of the bandwidth */
#define DEPTH_INTERVAL 5
#define MAX_URB_LOOP 2048 /* Maximum number of linked URB's */
/*
* Technically, updating td->status here is a race, but it's not really a
* problem. The worst that can happen is that we set the IOC bit again
......@@ -2296,8 +2294,7 @@ static void uhci_call_completion(struct urb *urb)
struct urb_priv *urbp;
struct usb_device *dev = urb->dev;
struct uhci *uhci = (struct uhci *)dev->bus->hcpriv;
int is_ring = 0, killed, resubmit_interrupt, status;
struct urb *nurb;
int killed, resubmit_interrupt, status;
unsigned long flags;
spin_lock_irqsave(&urb->lock, flags);
......@@ -2313,29 +2310,6 @@ static void uhci_call_completion(struct urb *urb)
resubmit_interrupt = (usb_pipetype(urb->pipe) == PIPE_INTERRUPT &&
urb->interval);
nurb = urb->next;
if (nurb && !killed) {
int count = 0;
while (nurb && nurb != urb && count < MAX_URB_LOOP) {
if (nurb->status == -ENOENT ||
nurb->status == -ECONNABORTED ||
nurb->status == -ECONNRESET) {
killed = 1;
break;
}
nurb = nurb->next;
count++;
}
if (count == MAX_URB_LOOP)
err("uhci_call_completion: too many linked URB's, loop? (first loop)");
/* Check to see if chain is a ring */
is_ring = (nurb == urb);
}
if (urbp->transfer_buffer_dma_handle)
pci_dma_sync_single(uhci->dev, urbp->transfer_buffer_dma_handle,
urb->transfer_buffer_length, usb_pipein(urb->pipe) ?
......@@ -2369,17 +2343,12 @@ static void uhci_call_completion(struct urb *urb)
if (resubmit_interrupt && !killed) {
urb->dev = dev;
uhci_reset_interrupt(urb);
} else {
if (is_ring && !killed) {
urb->dev = dev;
uhci_submit_urb(urb, GFP_ATOMIC);
} else {
/* We decrement the usage count after we're done */
/* with everything */
usb_put_dev(dev);
usb_put_urb(urb);
}
}
}
static void uhci_finish_completion(struct uhci *uhci)
......
......@@ -100,9 +100,6 @@
// NO serviceable parts below!
/*--------------------------------------------------------------------------*/
// How much URBs with ->next are walked
#define MAX_NEXT_COUNT 2048
static struct uhci *devs = NULL;
/* used by userspace UHCI data structure dumper */
......
......@@ -1215,10 +1215,9 @@ static int process_iso (struct uhci_hcd *uhci, struct urb *urb, int mode)
// called with urb_list_lock set
static int process_urb (struct uhci_hcd *uhci, struct list_head *p)
{
struct urb *urb, *urbt;
struct usb_device *usb_dev;
struct urb *urb;
urb_priv_t *priv;
int type, n, ret = 0;
int type, ret = 0;
priv=list_entry (p, urb_priv_t, urb_list);
urb=priv->urb;
......@@ -1251,42 +1250,13 @@ static int process_urb (struct uhci_hcd *uhci, struct list_head *p)
uhci_free_priv(uhci, urb, urb->hcpriv);
if (type != PIPE_INTERRUPT) { // process_interrupt does completion on its own
// FIXME: How to detect killed URBs in a ring?
if (type == PIPE_ISOCHRONOUS) {
for (n=0, urbt = urb->next; urbt && (urbt != urb) && (n<MAX_NEXT_COUNT); urbt = urbt->next, n++)
continue;
if (urbt && (n<MAX_NEXT_COUNT)) {
usb_dev=urb->dev;
urb->dev = NULL;
spin_unlock(&uhci->urb_list_lock);
if (urb->complete)
urb->complete (urb);
urb->dev=usb_dev;
uhci_urb_enqueue(&uhci->hcd, urb, GFP_ATOMIC); // FIXME memflags!
spin_lock(&uhci->urb_list_lock);
}
else {
spin_unlock(&uhci->urb_list_lock);
dbg("giveback iso urb %p, status %i, length %i\n",
urb, urb->status, urb->transfer_buffer_length);
usb_hcd_giveback_urb(&uhci->hcd, urb);
spin_lock(&uhci->urb_list_lock);
}
}
else {
spin_unlock(&uhci->urb_list_lock);
dbg("giveback urb %p, status %i, length %i\n",
urb, urb->status, urb->transfer_buffer_length);
usb_hcd_giveback_urb(&uhci->hcd, urb);
spin_lock(&uhci->urb_list_lock);
}
}
}
return ret;
}
/*###########################################################################*/
......
......@@ -125,9 +125,6 @@ _static int process_transfer (uhci_t *s, struct urb *urb, int mode);
_static int process_interrupt (uhci_t *s, struct urb *urb);
_static int process_iso (uhci_t *s, struct urb *urb, int force);
// How much URBs with ->next are walked
#define MAX_NEXT_COUNT 2048
static uhci_t *devs = NULL;
/* used by userspace UHCI data structure dumper */
......@@ -2662,78 +2659,12 @@ _static int process_urb (uhci_t *s, struct list_head *p)
#endif
if ((usb_pipetype (urb->pipe) != PIPE_INTERRUPT)) { // process_interrupt does completion on its own
struct urb *next_urb = urb->next;
int is_ring = 0;
int contains_killed = 0;
int loop_count=0;
if (next_urb) {
// Find out if the URBs are linked to a ring
while (next_urb != NULL && next_urb != urb && loop_count < MAX_NEXT_COUNT) {
if (next_urb->status == -ENOENT) {// killed URBs break ring structure & resubmission
contains_killed = 1;
break;
}
next_urb = next_urb->next;
loop_count++;
}
if (loop_count == MAX_NEXT_COUNT)
err("process_urb: Too much linked URBs in ring detection!");
if (next_urb == urb)
is_ring=1;
}
// Submit idle/non-killed URBs linked with urb->next
// Stop before the current URB
next_urb = urb->next;
if (next_urb && !contains_killed) {
int ret_submit;
next_urb = urb->next;
loop_count=0;
while (next_urb != NULL && next_urb != urb && loop_count < MAX_NEXT_COUNT) {
if (next_urb->status != -EINPROGRESS) {
if (next_urb->status == -ENOENT)
break;
spin_unlock(&s->urb_list_lock);
// FIXME!!!
// We need to know the real state, so
// GFP_ATOMIC is probably not correct
ret_submit=uhci_submit_urb(next_urb, GFP_ATOMIC);
spin_lock(&s->urb_list_lock);
if (ret_submit)
break;
}
loop_count++;
next_urb = next_urb->next;
}
if (loop_count == MAX_NEXT_COUNT)
err("process_urb: Too much linked URBs in resubmission!");
}
// Completion
if (urb->complete) {
int was_unlinked = (urb->status == -ENOENT);
urb->dev = NULL;
spin_unlock(&s->urb_list_lock);
urb->complete ((struct urb *) urb);
// Re-submit the URB if ring-linked
if (is_ring && !was_unlinked && !contains_killed) {
urb->dev=usb_dev;
// FIXME!!!
// We need to know the real state, so
// GFP_ATOMIC is probably not correct
uhci_submit_urb (urb, GFP_ATOMIC);
}
spin_lock(&s->urb_list_lock);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment