Commit 34e02698 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

USB ohci-hcd update

It updates the "ohci-hcd" driver to address two issues, one            
of which could potentially have caused oopses.  First, it takes
out calls to usb_dec_dev_use() on the submit error path; that's
already done elsewhere.  (Noted by Georg Acher.)  Second,
it removes some pointless diagnostics.  One is for schedule
overrun interrupts, the other is for accessing the frame counter.
parent bcb7d7c4
...@@ -153,10 +153,8 @@ static int ohci_urb_enqueue ( ...@@ -153,10 +153,8 @@ static int ohci_urb_enqueue (
#endif #endif
/* every endpoint has a ed, locate and fill it */ /* every endpoint has a ed, locate and fill it */
if (! (ed = ep_add_ed (urb->dev, pipe, urb->interval, 1, mem_flags))) { if (! (ed = ep_add_ed (urb->dev, pipe, urb->interval, 1, mem_flags)))
usb_dec_dev_use (urb->dev);
return -ENOMEM; return -ENOMEM;
}
/* for the private part of the URB we need the number of TDs (size) */ /* for the private part of the URB we need the number of TDs (size) */
switch (usb_pipetype (pipe)) { switch (usb_pipetype (pipe)) {
...@@ -181,10 +179,8 @@ static int ohci_urb_enqueue ( ...@@ -181,10 +179,8 @@ static int ohci_urb_enqueue (
break; break;
case PIPE_ISOCHRONOUS: /* number of packets from URB */ case PIPE_ISOCHRONOUS: /* number of packets from URB */
size = urb->number_of_packets; size = urb->number_of_packets;
if (size <= 0) { if (size <= 0)
usb_dec_dev_use (urb->dev);
return -EINVAL; return -EINVAL;
}
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
urb->iso_frame_desc [i].actual_length = 0; urb->iso_frame_desc [i].actual_length = 0;
urb->iso_frame_desc [i].status = -EXDEV; urb->iso_frame_desc [i].status = -EXDEV;
...@@ -198,10 +194,8 @@ static int ohci_urb_enqueue ( ...@@ -198,10 +194,8 @@ static int ohci_urb_enqueue (
/* allocate the private part of the URB */ /* allocate the private part of the URB */
urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (struct td *), urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (struct td *),
mem_flags); mem_flags);
if (!urb_priv) { if (!urb_priv)
usb_dec_dev_use (urb->dev);
return -ENOMEM; return -ENOMEM;
}
memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *)); memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *));
/* fill the private part of the URB */ /* fill the private part of the URB */
...@@ -216,7 +210,6 @@ static int ohci_urb_enqueue ( ...@@ -216,7 +210,6 @@ static int ohci_urb_enqueue (
urb_priv->length = i; urb_priv->length = i;
urb_free_priv (ohci, urb_priv); urb_free_priv (ohci, urb_priv);
spin_unlock_irqrestore (&ohci->lock, flags); spin_unlock_irqrestore (&ohci->lock, flags);
usb_dec_dev_use (urb->dev);
return -ENOMEM; return -ENOMEM;
} }
} }
...@@ -242,7 +235,6 @@ static int ohci_urb_enqueue ( ...@@ -242,7 +235,6 @@ static int ohci_urb_enqueue (
if (bustime < 0) { if (bustime < 0) {
urb_free_priv (ohci, urb_priv); urb_free_priv (ohci, urb_priv);
spin_unlock_irqrestore (&ohci->lock, flags); spin_unlock_irqrestore (&ohci->lock, flags);
usb_dec_dev_use (urb->dev);
return bustime; return bustime;
} }
usb_claim_bandwidth (urb->dev, urb, usb_claim_bandwidth (urb->dev, urb,
...@@ -356,9 +348,6 @@ static int ohci_get_frame (struct usb_hcd *hcd) ...@@ -356,9 +348,6 @@ static int ohci_get_frame (struct usb_hcd *hcd)
{ {
struct ohci_hcd *ohci = hcd_to_ohci (hcd); struct ohci_hcd *ohci = hcd_to_ohci (hcd);
#ifdef OHCI_VERBOSE_DEBUG
dbg ("%s: ohci_get_frame", hcd->bus_name);
#endif
return le16_to_cpu (ohci->hcca->frame_no); return le16_to_cpu (ohci->hcca->frame_no);
} }
...@@ -445,7 +434,7 @@ static int hc_start (struct ohci_hcd *ohci) ...@@ -445,7 +434,7 @@ static int hc_start (struct ohci_hcd *ohci)
writel (ohci->hc_control, &ohci->regs->control); writel (ohci->hc_control, &ohci->regs->control);
/* Choose the interrupts we care about now, others later on demand */ /* Choose the interrupts we care about now, others later on demand */
mask = OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_WDH | OHCI_INTR_SO; mask = OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_WDH;
writel (mask, &ohci->regs->intrstatus); writel (mask, &ohci->regs->intrstatus);
writel (mask, &ohci->regs->intrenable); writel (mask, &ohci->regs->intrenable);
...@@ -517,10 +506,7 @@ static void ohci_irq (struct usb_hcd *hcd) ...@@ -517,10 +506,7 @@ static void ohci_irq (struct usb_hcd *hcd)
writel (OHCI_INTR_WDH, &regs->intrenable); writel (OHCI_INTR_WDH, &regs->intrenable);
} }
if (ints & OHCI_INTR_SO) { /* could track INTR_SO to reduce available PCI/... bandwidth */
dbg ("USB Schedule overrun");
writel (OHCI_INTR_SO, &regs->intrenable);
}
// FIXME: this assumes SOF (1/ms) interrupts don't get lost... // FIXME: this assumes SOF (1/ms) interrupts don't get lost...
if (ints & OHCI_INTR_SF) { if (ints & OHCI_INTR_SF) {
......
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