Commit 43c72bb3 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] ohci-hcd, driverfs files work again, less debug output

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).
parent 89f0f973
......@@ -138,6 +138,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
hcd->pdev = dev;
hcd->self.bus_name = dev->slot_name;
hcd->product_desc = dev->name;
hcd->controller = &dev->dev;
if ((retval = hcd_buffer_create (hcd)) != 0) {
clean_3:
......
......@@ -74,10 +74,10 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */
struct hc_driver *driver; /* hw-specific hooks */
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 */
u32 pci_state [16]; /* for PM state save */
......
......@@ -24,7 +24,8 @@
/* debug| print the main components of an URB
* 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;
......@@ -204,10 +205,6 @@ static void ohci_dump (struct ohci_hcd *controller, int verbose)
// 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);
ohci_dump_roothub (controller, 1);
......@@ -510,16 +507,16 @@ static DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
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);
}
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);
}
#else /* empty stubs for creating those files */
......
......@@ -271,7 +271,7 @@ static int ohci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
unsigned long flags;
#ifdef DEBUG
#ifdef OHCI_VERBOSE_DEBUG
urb_print (urb, "UNLINK", 1);
#endif
......@@ -514,7 +514,7 @@ static int hc_start (struct ohci_hcd *ohci)
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;
disable (ohci);
......
......@@ -80,8 +80,6 @@ ohci_pci_start (struct usb_hcd *hcd)
}
ohci->regs = hcd->regs;
ohci->parent_dev = &ohci->hcd.pdev->dev;
if (hc_reset (ohci) < 0) {
ohci_stop (hcd);
return -ENODEV;
......
......@@ -110,10 +110,12 @@ static void periodic_link (struct ohci_hcd *ohci, struct ed *ed)
{
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) {
struct ed **prev = &ohci->periodic [i];
......@@ -244,10 +246,12 @@ static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed)
}
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
}
/* unlink an ed from one of the HC chains.
......@@ -414,7 +418,6 @@ static struct ed *ed_get (
}
}
ed->hwINFO = info;
}
done:
......
......@@ -176,7 +176,7 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
hcd->irq = dev->irq[1];
hcd->regs = dev->mapbase;
hcd->pdev = SA1111_FAKE_PCIDEV;
hcd->parent = &dev->dev;
hcd->controller = &dev->dev;
retval = hcd_buffer_create (hcd);
if (retval != 0) {
......@@ -292,8 +292,6 @@ ohci_sa1111_start (struct usb_hcd *hcd)
}
ohci->regs = hcd->regs;
ohci->parent_dev = hcd->parent;
if (hc_reset (ohci) < 0) {
ohci_stop (hcd);
return -ENODEV;
......
......@@ -349,11 +349,6 @@ struct hash_list_t {
struct ohci_hcd {
spinlock_t lock;
/*
* parent device
*/
struct device *parent_dev;
/*
* I/O memory used to communicate with the HC (dma-consistent)
*/
......
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