# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.562   -> 1.563  
#	drivers/usb/hcd/ohci-hcd.c	1.5     -> 1.6    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/03/26	david-b@pacbell.net	1.563
# 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.
# --------------------------------------------
#
diff -Nru a/drivers/usb/hcd/ohci-hcd.c b/drivers/usb/hcd/ohci-hcd.c
--- a/drivers/usb/hcd/ohci-hcd.c	Wed Apr  3 16:39:36 2002
+++ b/drivers/usb/hcd/ohci-hcd.c	Wed Apr  3 16:39:36 2002
@@ -153,10 +153,8 @@
 #endif
 	
 	/* every endpoint has a ed, locate and fill it */
-	if (! (ed = ep_add_ed (urb->dev, pipe, urb->interval, 1, mem_flags))) {
-		usb_dec_dev_use (urb->dev);	
+	if (! (ed = ep_add_ed (urb->dev, pipe, urb->interval, 1, mem_flags)))
 		return -ENOMEM;
-	}
 
 	/* for the private part of the URB we need the number of TDs (size) */
 	switch (usb_pipetype (pipe)) {
@@ -181,10 +179,8 @@
 			break;
 		case PIPE_ISOCHRONOUS: /* number of packets from URB */
 			size = urb->number_of_packets;
-			if (size <= 0) {
-				usb_dec_dev_use (urb->dev);	
+			if (size <= 0)
 				return -EINVAL;
-			}
 			for (i = 0; i < urb->number_of_packets; i++) {
   				urb->iso_frame_desc [i].actual_length = 0;
   				urb->iso_frame_desc [i].status = -EXDEV;
@@ -198,10 +194,8 @@
 	/* allocate the private part of the URB */
 	urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (struct td *),
 			mem_flags);
-	if (!urb_priv) {
-		usb_dec_dev_use (urb->dev);	
+	if (!urb_priv)
 		return -ENOMEM;
-	}
 	memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *));
 	
 	/* fill the private part of the URB */
@@ -216,7 +210,6 @@
 			urb_priv->length = i;
 			urb_free_priv (ohci, urb_priv);
 			spin_unlock_irqrestore (&ohci->lock, flags);
-			usb_dec_dev_use (urb->dev);	
 			return -ENOMEM;
 		}
 	}	
@@ -242,7 +235,6 @@
 			if (bustime < 0) {
 				urb_free_priv (ohci, urb_priv);
 				spin_unlock_irqrestore (&ohci->lock, flags);
-				usb_dec_dev_use (urb->dev);	
 				return bustime;
 			}
 			usb_claim_bandwidth (urb->dev, urb,
@@ -356,9 +348,6 @@
 {
 	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);
 }
 
@@ -445,7 +434,7 @@
  	writel (ohci->hc_control, &ohci->regs->control);
  
 	/* 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->intrenable);
 
@@ -517,10 +506,7 @@
 		writel (OHCI_INTR_WDH, &regs->intrenable); 
 	}
   
-	if (ints & OHCI_INTR_SO) {
-		dbg ("USB Schedule overrun");
-		writel (OHCI_INTR_SO, &regs->intrenable); 	 
-	}
+	/* could track INTR_SO to reduce available PCI/... bandwidth */
 
 	// FIXME:  this assumes SOF (1/ms) interrupts don't get lost...
 	if (ints & OHCI_INTR_SF) { 
