ChangeSet 1.971, 2002/12/30 22:44:47-08:00, greg@kroah.com USB: convert more dbg() calls to dev_dbg for the ohci driver diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c --- a/drivers/usb/host/ohci-dbg.c Mon Dec 30 22:51:57 2002 +++ b/drivers/usb/host/ohci-dbg.c Mon Dec 30 22:51:57 2002 @@ -73,9 +73,9 @@ #endif } -static void ohci_dump_intr_mask (char *label, __u32 mask) +static void ohci_dump_intr_mask (struct device *dev, char *label, __u32 mask) { - dbg ("%s: 0x%08x%s%s%s%s%s%s%s%s%s", + dev_dbg (*dev, "%s: 0x%08x%s%s%s%s%s%s%s%s%s\n", label, mask, (mask & OHCI_INTR_MIE) ? " MIE" : "", @@ -90,10 +90,10 @@ ); } -static void maybe_print_eds (char *label, __u32 value) +static void maybe_print_eds (struct device *dev, char *label, __u32 value) { if (value) - dbg ("%s %08x", label, value); + dev_dbg (*dev, "%s %08x\n", label, value); } static char *hcfs2string (int state) @@ -111,15 +111,16 @@ static void ohci_dump_status (struct ohci_hcd *controller) { struct ohci_regs *regs = controller->regs; + struct device *dev = controller->hcd.controller; __u32 temp; temp = readl (®s->revision) & 0xff; - dbg ("OHCI %d.%d, %s legacy support registers", + dev_dbg (*dev, "OHCI %d.%d, %s legacy support registers\n", 0x03 & (temp >> 4), (temp & 0x0f), (temp & 0x10) ? "with" : "NO"); temp = readl (®s->control); - dbg ("control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d", temp, + dev_dbg (*dev, "control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n", temp, (temp & OHCI_CTRL_RWE) ? " RWE" : "", (temp & OHCI_CTRL_RWC) ? " RWC" : "", (temp & OHCI_CTRL_IR) ? " IR" : "", @@ -132,7 +133,7 @@ ); temp = readl (®s->cmdstatus); - dbg ("cmdstatus: 0x%08x SOC=%d%s%s%s%s", temp, + dev_dbg (*dev, "cmdstatus: 0x%08x SOC=%d%s%s%s%s\n", temp, (temp & OHCI_SOC) >> 16, (temp & OHCI_OCR) ? " OCR" : "", (temp & OHCI_BLF) ? " BLF" : "", @@ -140,20 +141,20 @@ (temp & OHCI_HCR) ? " HCR" : "" ); - ohci_dump_intr_mask ("intrstatus", readl (®s->intrstatus)); - ohci_dump_intr_mask ("intrenable", readl (®s->intrenable)); + ohci_dump_intr_mask (dev, "intrstatus", readl (®s->intrstatus)); + ohci_dump_intr_mask (dev, "intrenable", readl (®s->intrenable)); // intrdisable always same as intrenable - // ohci_dump_intr_mask ("intrdisable", readl (®s->intrdisable)); + // ohci_dump_intr_mask (dev, "intrdisable", readl (®s->intrdisable)); - maybe_print_eds ("ed_periodcurrent", readl (®s->ed_periodcurrent)); + maybe_print_eds (dev, "ed_periodcurrent", readl (®s->ed_periodcurrent)); - maybe_print_eds ("ed_controlhead", readl (®s->ed_controlhead)); - maybe_print_eds ("ed_controlcurrent", readl (®s->ed_controlcurrent)); + maybe_print_eds (dev, "ed_controlhead", readl (®s->ed_controlhead)); + maybe_print_eds (dev, "ed_controlcurrent", readl (®s->ed_controlcurrent)); - maybe_print_eds ("ed_bulkhead", readl (®s->ed_bulkhead)); - maybe_print_eds ("ed_bulkcurrent", readl (®s->ed_bulkcurrent)); + maybe_print_eds (dev, "ed_bulkhead", readl (®s->ed_bulkhead)); + maybe_print_eds (dev, "ed_bulkcurrent", readl (®s->ed_bulkcurrent)); - maybe_print_eds ("donehead", readl (®s->donehead)); + maybe_print_eds (dev, "donehead", readl (®s->donehead)); } static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose) @@ -166,7 +167,8 @@ ndp = (temp & RH_A_NDP); if (verbose) { - dbg ("roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d", temp, + dev_dbg (*controller->hcd.controller, + "roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d\n", temp, ((temp & RH_A_POTPGT) >> 24) & 0xff, (temp & RH_A_NOCP) ? " NOCP" : "", (temp & RH_A_OCPM) ? " OCPM" : "", @@ -176,13 +178,15 @@ ndp ); temp = roothub_b (controller); - dbg ("roothub.b: %08x PPCM=%04x DR=%04x", + dev_dbg (*controller->hcd.controller, + "roothub.b: %08x PPCM=%04x DR=%04x\n", temp, (temp & RH_B_PPCM) >> 16, (temp & RH_B_DR) ); temp = roothub_status (controller); - dbg ("roothub.status: %08x%s%s%s%s%s%s", + dev_dbg (*controller->hcd.controller, + "roothub.status: %08x%s%s%s%s%s%s\n", temp, (temp & RH_HS_CRWE) ? " CRWE" : "", (temp & RH_HS_OCIC) ? " OCIC" : "", @@ -201,12 +205,14 @@ static void ohci_dump (struct ohci_hcd *controller, int verbose) { - dbg ("OHCI controller %s state", controller->hcd.self.bus_name); + dev_dbg (*controller->hcd.controller, + "OHCI controller state\n"); // dumps some of the state we know about ohci_dump_status (controller); if (controller->hcca) - dbg ("hcca frame #%04x", controller->hcca->frame_no); + dev_dbg (*controller->hcd.controller, + "hcca frame #%04x\n", controller->hcca->frame_no); ohci_dump_roothub (controller, 1); } @@ -312,16 +318,13 @@ } } -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,32) -# define DRIVERFS_DEBUG_FILES -#endif +#else +static inline void ohci_dump (struct ohci_hcd *controller, int verbose) {} #endif /* DEBUG */ /*-------------------------------------------------------------------------*/ -#ifdef DRIVERFS_DEBUG_FILES - static ssize_t show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) { @@ -510,7 +513,7 @@ 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); + dev_dbg (*bus->hcd.controller, "created debug files\n"); } static inline void remove_debug_files (struct ohci_hcd *bus) @@ -518,13 +521,6 @@ 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 */ - -static inline void create_debug_files (struct ohci_hcd *bus) { } -static inline void remove_debug_files (struct ohci_hcd *bus) { } - -#endif /* DRIVERFS_DEBUG_FILES */ /*-------------------------------------------------------------------------*/ diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c --- a/drivers/usb/host/ohci-hcd.c Mon Dec 30 22:51:57 2002 +++ b/drivers/usb/host/ohci-hcd.c Mon Dec 30 22:51:57 2002 @@ -71,6 +71,13 @@ */ #include + +#ifdef CONFIG_USB_DEBUG +# define DEBUG +#else +# undef DEBUG +#endif + #include #include #include @@ -84,13 +91,6 @@ #include #include #include /* for in_interrupt () */ - -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#else -# undef DEBUG -#endif - #include #include #include "../core/hcd.h" @@ -383,7 +383,7 @@ /* SMM owns the HC? not for long! */ if (readl (&ohci->regs->control) & OHCI_CTRL_IR) { - dbg ("USB HC TakeOver from BIOS/SMM"); + dev_dbg (*ohci->hcd.controller, "USB HC TakeOver from BIOS/SMM\n"); /* this timeout is arbitrary. we make it long, so systems * depending on usb keyboards may be usable even if the @@ -396,7 +396,7 @@ while (readl (&ohci->regs->control) & OHCI_CTRL_IR) { wait_ms (10); if (--temp == 0) { - err ("USB HC TakeOver failed!"); + dev_err (*ohci->hcd.controller, "USB HC TakeOver failed!\n"); return -1; } } @@ -405,7 +405,7 @@ /* Disable HC interrupts */ writel (OHCI_INTR_MIE, &ohci->regs->intrdisable); - dbg ("USB HC reset_hc %s: ctrl = 0x%x ;", + dev_dbg (*ohci->hcd.controller, "USB HC reset_hc %s: ctrl = 0x%x ;\n", ohci->hcd.self.bus_name, readl (&ohci->regs->control)); @@ -422,7 +422,7 @@ temp = 30; /* ... allow extra time */ while ((readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) { if (--temp == 0) { - err ("USB HC reset timed out!"); + dev_err (*ohci->hcd.controller, "USB HC reset timed out!"); return -1; } udelay (1); @@ -562,9 +562,7 @@ hcd->self.bus_name); // e.g. due to PCI Master/Target Abort -#ifdef DEBUG ohci_dump (ohci, 1); -#endif hc_reset (ohci); } @@ -596,14 +594,11 @@ { struct ohci_hcd *ohci = hcd_to_ohci (hcd); - dbg ("%s: stop %s controller%s", - hcd->self.bus_name, + dev_dbg (*hcd->controller, "stop %s controller%s\n", hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS), ohci->disabled ? " (disabled)" : "" ); -#ifdef DEBUG ohci_dump (ohci, 1); -#endif if (!ohci->disabled) hc_reset (ohci); diff -Nru a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c --- a/drivers/usb/host/ohci-hub.c Mon Dec 30 22:51:57 2002 +++ b/drivers/usb/host/ohci-hub.c Mon Dec 30 22:51:57 2002 @@ -41,9 +41,10 @@ /*-------------------------------------------------------------------------*/ #define dbg_port(hc,label,num,value) \ - dbg ("%s: %s roothub.portstatus [%d] " \ - "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s", \ - hc->hcd.self.bus_name, label, num, temp, \ + dev_dbg (*hc->hcd.controller, \ + "%s roothub.portstatus [%d] " \ + "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \ + label, num, temp, \ (temp & RH_PS_PRSC) ? " PRSC" : "", \ (temp & RH_PS_OCIC) ? " OCIC" : "", \ (temp & RH_PS_PSSC) ? " PSSC" : "", \ diff -Nru a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c --- a/drivers/usb/host/ohci-q.c Mon Dec 30 22:51:57 2002 +++ b/drivers/usb/host/ohci-q.c Mon Dec 30 22:51:57 2002 @@ -206,8 +206,8 @@ default: branch = balance (ohci, ed->interval, ed->load); if (branch < 0) { - dbg ("%s: ERR %d, interval %d msecs, load %d", - ohci->hcd.self.bus_name, + dev_dbg (*ohci->hcd.controller, + "ERR %d, interval %d msecs, load %d\n", branch, ed->interval, ed->load); // FIXME if there are TDs queued, fail them! return branch; @@ -786,7 +786,8 @@ } /* help for troubleshooting: */ - dbg ("urb %p usb-%s-%s ep-%d-%s cc %d --> status %d", + dev_dbg (urb->dev->dev, + "urb %p usb-%s-%s ep-%d-%s cc %d --> status %d\n", urb, urb->dev->bus->bus_name, urb->dev->devpath, usb_pipeendpoint (urb->pipe),