ChangeSet 1.924.3.5, 2002/11/30 00:08:25-08:00, david-b@pacbell.net

[PATCH] reduce debug message volume

This reduces the debug message volume a bit, mostly by using the
new dev_dbg() macros instead of the usb dbg() ones in some places
during HCD init/shutdown.  Likewise dev_info().


diff -Nru a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
--- a/drivers/usb/core/hcd-pci.c	Sun Dec  1 23:06:15 2002
+++ b/drivers/usb/core/hcd-pci.c	Sun Dec  1 23:06:15 2002
@@ -146,7 +146,7 @@
 		goto clean_2;
 	}
 
-	info ("%s @ %s, %s", hcd->description,  dev->slot_name, dev->dev.name);
+	dev_info (*hcd->controller, "%s\n", hcd->product_desc);
 
 #ifndef __sparc__
 	sprintf (buf, "%d", dev->irq);
@@ -155,7 +155,8 @@
 #endif
 	if (request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ, hcd->description, hcd)
 			!= 0) {
-		err ("request interrupt %s failed", bufp);
+		dev_err (*hcd->controller,
+				"request interrupt %s failed\n", bufp);
 		retval = -EBUSY;
 		goto clean_3;
 	}
@@ -163,7 +164,7 @@
 
 	hcd->regs = base;
 	hcd->region = region;
-	info ("irq %s, %s %p", bufp,
+	dev_info (*hcd->controller, "irq %s, %s %p\n", bufp,
 		(driver->flags & HCD_MEMORY) ? "pci mem" : "io base",
 		base);
 
@@ -205,19 +206,20 @@
 	hcd = pci_get_drvdata(dev);
 	if (!hcd)
 		return;
-	info ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
+	dev_info (*hcd->controller, "remove, state %x\n", hcd->state);
 
 	if (in_interrupt ()) BUG ();
 
 	hub = hcd->self.root_hub;
 	hcd->state = USB_STATE_QUIESCING;
 
-	dbg ("%s: roothub graceful disconnect", hcd->self.bus_name);
+	dev_dbg (*hcd->controller, "roothub graceful disconnect\n");
 	usb_disconnect (&hub);
 
 	hcd->driver->stop (hcd);
 	hcd_buffer_destroy (hcd);
 	hcd->state = USB_STATE_HALT;
+	pci_set_drvdata (dev, 0);
 
 	free_irq (hcd->irq, hcd);
 	if (hcd->driver->flags & HCD_MEMORY) {
@@ -230,9 +232,12 @@
 	}
 
 	usb_deregister_bus (&hcd->self);
-	if (atomic_read (&hcd->self.refcnt) != 1)
-		err ("usb_hcd_pci_remove %s, count != 1", hcd->self.bus_name);
-
+	if (atomic_read (&hcd->self.refcnt) != 1) {
+		dev_warn (*hcd->controller,
+			"dangling refs (%d) to bus %d!\n",
+			atomic_read (&hcd->self.refcnt) - 1,
+			hcd->self.busnum);
+	}
 	hcd->driver->hcd_free (hcd);
 }
 EXPORT_SYMBOL (usb_hcd_pci_remove);
@@ -279,7 +284,7 @@
 	int			retval;
 
 	hcd = pci_get_drvdata(dev);
-	info ("suspend %s to state %d", hcd->self.bus_name, state);
+	dev_info (*hcd->controller, "suspend to state %d\n", state);
 
 	pci_save_state (dev, hcd->pci_state);
 
@@ -308,19 +313,19 @@
 	int			retval;
 
 	hcd = pci_get_drvdata(dev);
-	info ("resume %s", hcd->self.bus_name);
+	dev_info (*hcd->controller, "resume\n");
 
 	/* guard against multiple resumes (APM bug?) */
 	atomic_inc (&hcd->resume_count);
 	if (atomic_read (&hcd->resume_count) != 1) {
-		err ("concurrent PCI resumes for %s", hcd->self.bus_name);
+		dev_err (*hcd->controller, "concurrent PCI resumes\n");
 		retval = 0;
 		goto done;
 	}
 
 	retval = -EBUSY;
 	if (hcd->state != USB_STATE_SUSPENDED) {
-		dbg ("can't resume, not suspended!");
+		dev_dbg (*hcd->controller, "can't resume, not suspended!\n");
 		goto done;
 	}
 	hcd->state = USB_STATE_RESUMING;
@@ -330,7 +335,7 @@
 
 	retval = hcd->driver->resume (hcd);
 	if (!HCD_IS_RUNNING (hcd->state)) {
-		dbg ("resume %s failure, retval %d", hcd->self.bus_name, retval);
+		dev_dbg (*hcd->controller, "resume fail, retval %d\n", retval);
 		usb_hc_died (hcd);
 // FIXME:  recover, reset etc.
 	} else {
diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c	Sun Dec  1 23:06:15 2002
+++ b/drivers/usb/core/hcd.c	Sun Dec  1 23:06:15 2002
@@ -715,7 +715,8 @@
 	sprintf (&usb_dev->dev.bus_id[0], "usb%d", usb_dev->bus->busnum);
 	retval = usb_new_device (usb_dev, parent_dev);
 	if (retval)
-		err("%s - usb_new_device failed with value %d", __FUNCTION__, retval);
+		dev_err (*parent_dev, "can't register root hub for %s, %d\n",
+				usb_dev->dev.bus_id, retval);
 	return retval;
 }
 EXPORT_SYMBOL (usb_register_root_hub);
@@ -1286,13 +1287,7 @@
 
 	// NOTE:  a generic device/urb monitoring hook would go here.
 	// hcd_monitor_hook(MONITOR_URB_FINISH, urb, dev)
-	// It would catch exit/unlink paths for all urbs, but non-exit
-	// completions for periodic urbs need hooks inside the HCD.
-	// hcd_monitor_hook(MONITOR_URB_UPDATE, urb, dev)
-
-	if (urb->status)
-		dbg ("giveback urb %p status %d len %d",
-			urb, urb->status, urb->actual_length);
+	// It would catch exit/unlink paths for all urbs.
 
 	/* lower level hcd code should use *_dma exclusively */
 	if (!(urb->transfer_flags & URB_NO_DMA_MAP)) {
