This fixes a problem from Chris' patch, letting the driverfs files
work again. The root cause was a duplicate "parent_dev" field,
now gone. This also adds minor cleanup in the hcd glue, renaming
the value being duplicated as the "controller" that the HCD is
driving. (A "parent" should rarely be used, but the "controller"
has reasonable uses all over the place ... like in dev_dbg calls!)
It's initted by the PCI bus glue, or by the SA-1111 bus glue.
Also makes some OHCI debug messages appear only when VERBOSE debug
is (manually) enabled. This was self-defense, otherwise running
the link/unlink "usbtest" cases could fill up the log filesystem
(with debug enabled).
Please merge; this'll help in some kinds of troubleshooting.
- Dave
--- ./drivers/usb-dist/core/hcd.h Mon Nov 11 06:37:46 2002
+++ ./drivers/usb/core/hcd.h Wed Nov 13 15:49:57 2002
@@ -75,8 +75,8 @@
int irq; /* irq allocated */
void *regs; /* device memory/io */
+ struct device *controller; /* handle to hardware */
/* a few non-PCI controllers exist, mostly for OHCI */
struct pci_dev *pdev; /* pci is typical */
- struct device *parent; /* parent device driver */
#ifdef CONFIG_PCI
int region; /* pci region for regs */
--- ./drivers/usb-dist/core/hcd-pci.c Mon Nov 11 06:37:46 2002
+++ ./drivers/usb/core/hcd-pci.c Wed Nov 13 15:55:52 2002
@@ -139,4 +139,5 @@
hcd->self.bus_name = dev->slot_name;
hcd->product_desc = dev->name;
+ hcd->controller = &dev->dev;
if ((retval = hcd_buffer_create (hcd)) != 0) {
--- ./drivers/usb-dist/host/ohci.h Mon Nov 11 06:37:47 2002
+++ ./drivers/usb/host/ohci.h Wed Nov 13 15:51:41 2002
@@ -350,9 +350,4 @@
spinlock_t lock;
- /*
- * parent device
- */
- struct device *parent_dev;
-
/*
* I/O memory used to communicate with the HC (dma-consistent)
--- ./drivers/usb-dist/host/ohci-hcd.c Mon Nov 11 06:37:46 2002
+++ ./drivers/usb/host/ohci-hcd.c Wed Nov 13 16:14:12 2002
@@ -272,5 +272,5 @@
unsigned long flags;
-#ifdef DEBUG
+#ifdef OHCI_VERBOSE_DEBUG
urb_print (urb, "UNLINK", 1);
#endif
@@ -515,5 +515,5 @@
usb_connect (udev);
udev->speed = USB_SPEED_FULL;
- if (usb_register_root_hub (udev, ohci->parent_dev) != 0) {
+ if (usb_register_root_hub (udev, ohci->hcd.controller) != 0) {
usb_free_dev (udev);
ohci->hcd.self.root_hub = NULL;
--- ./drivers/usb-dist/host/ohci-q.c Wed Nov 13 09:07:00 2002
+++ ./drivers/usb/host/ohci-q.c Wed Nov 13 16:14:12 2002
@@ -111,8 +111,10 @@
unsigned i;
+#ifdef OHCI_VERBOSE_DEBUG
dbg ("%s: link %sed %p branch %d [%dus.], interval %d",
ohci->hcd.self.bus_name,
(ed->hwINFO & ED_ISO) ? "iso " : "",
ed, ed->branch, ed->load, ed->interval);
+#endif
for (i = ed->branch; i < NUM_INTS; i += ed->interval) {
@@ -245,8 +247,10 @@
ohci->hcd.self.bandwidth_allocated -= ed->load / ed->interval;
+#ifdef OHCI_VERBOSE_DEBUG
dbg ("%s: unlink %sed %p branch %d [%dus.], interval %d",
ohci->hcd.self.bus_name,
(ed->hwINFO & ED_ISO) ? "iso " : "",
ed, ed->branch, ed->load, ed->interval);
+#endif
}
@@ -415,5 +419,4 @@
}
ed->hwINFO = info;
-
}
--- ./drivers/usb-dist/host/ohci-dbg.c Mon Nov 11 06:37:47 2002
+++ ./drivers/usb/host/ohci-dbg.c Wed Nov 13 16:14:12 2002
@@ -25,5 +25,6 @@
* small: 0) header + data packets 1) just header
*/
-static void urb_print (struct urb * urb, char * str, int small)
+static void __attribute__((unused))
+urb_print (struct urb * urb, char * str, int small)
{
unsigned int pipe= urb->pipe;
@@ -205,8 +206,4 @@
// dumps some of the state we know about
ohci_dump_status (controller);
-#ifdef OHCI_VERBOSE_DEBUG
- if (verbose)
- ohci_dump_periodic (controller, "hcca");
-#endif
if (controller->hcca)
dbg ("hcca frame #%04x", controller->hcca->frame_no);
@@ -511,6 +508,6 @@
static inline void create_debug_files (struct ohci_hcd *bus)
{
- device_create_file (bus->hcd.parent, &dev_attr_async);
- device_create_file (bus->hcd.parent, &dev_attr_periodic);
+ device_create_file (bus->hcd.controller, &dev_attr_async);
+ device_create_file (bus->hcd.controller, &dev_attr_periodic);
// registers
dbg ("%s: created debug files", bus->hcd.self.bus_name);
@@ -519,6 +516,6 @@
static inline void remove_debug_files (struct ohci_hcd *bus)
{
- device_remove_file (bus->hcd.parent, &dev_attr_async);
- device_remove_file (bus->hcd.parent, &dev_attr_periodic);
+ device_remove_file (bus->hcd.controller, &dev_attr_async);
+ device_remove_file (bus->hcd.controller, &dev_attr_periodic);
}
--- ./drivers/usb-dist/host/ohci-pci.c Mon Nov 11 06:37:47 2002
+++ ./drivers/usb/host/ohci-pci.c Wed Nov 13 15:58:38 2002
@@ -81,6 +81,4 @@
ohci->regs = hcd->regs;
- ohci->parent_dev = &ohci->hcd.pdev->dev;
-
if (hc_reset (ohci) < 0) {
ohci_stop (hcd);
--- ./drivers/usb-dist/host/ohci-sa1111.c Mon Nov 11 06:37:47 2002
+++ ./drivers/usb/host/ohci-sa1111.c Wed Nov 13 15:53:40 2002
@@ -177,5 +177,5 @@
hcd->regs = dev->mapbase;
hcd->pdev = SA1111_FAKE_PCIDEV;
- hcd->parent = &dev->dev;
+ hcd->controller = &dev->dev;
retval = hcd_buffer_create (hcd);
@@ -293,6 +293,4 @@
ohci->regs = hcd->regs;
- ohci->parent_dev = hcd->parent;
-
if (hc_reset (ohci) < 0) {
ohci_stop (hcd);