Commit 0d404451 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: convert more dbg() calls to dev_dbg for the ohci driver

parent a55b871a
......@@ -73,9 +73,9 @@ urb_print (struct urb * urb, char * str, int small)
#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 ohci_dump_intr_mask (char *label, __u32 mask)
);
}
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 char *hcfs2string (int state)
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 (&regs->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 (&regs->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 @@ static void ohci_dump_status (struct ohci_hcd *controller)
);
temp = readl (&regs->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 @@ static void ohci_dump_status (struct ohci_hcd *controller)
(temp & OHCI_HCR) ? " HCR" : ""
);
ohci_dump_intr_mask ("intrstatus", readl (&regs->intrstatus));
ohci_dump_intr_mask ("intrenable", readl (&regs->intrenable));
ohci_dump_intr_mask (dev, "intrstatus", readl (&regs->intrstatus));
ohci_dump_intr_mask (dev, "intrenable", readl (&regs->intrenable));
// intrdisable always same as intrenable
// ohci_dump_intr_mask ("intrdisable", readl (&regs->intrdisable));
// ohci_dump_intr_mask (dev, "intrdisable", readl (&regs->intrdisable));
maybe_print_eds ("ed_periodcurrent", readl (&regs->ed_periodcurrent));
maybe_print_eds (dev, "ed_periodcurrent", readl (&regs->ed_periodcurrent));
maybe_print_eds ("ed_controlhead", readl (&regs->ed_controlhead));
maybe_print_eds ("ed_controlcurrent", readl (&regs->ed_controlcurrent));
maybe_print_eds (dev, "ed_controlhead", readl (&regs->ed_controlhead));
maybe_print_eds (dev, "ed_controlcurrent", readl (&regs->ed_controlcurrent));
maybe_print_eds ("ed_bulkhead", readl (&regs->ed_bulkhead));
maybe_print_eds ("ed_bulkcurrent", readl (&regs->ed_bulkcurrent));
maybe_print_eds (dev, "ed_bulkhead", readl (&regs->ed_bulkhead));
maybe_print_eds (dev, "ed_bulkcurrent", readl (&regs->ed_bulkcurrent));
maybe_print_eds ("donehead", readl (&regs->donehead));
maybe_print_eds (dev, "donehead", readl (&regs->donehead));
}
static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
......@@ -166,7 +167,8 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
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 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
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_roothub (struct ohci_hcd *controller, int verbose)
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 @@ ohci_dump_ed (struct ohci_hcd *ohci, char *label, struct ed *ed, int verbose)
}
}
#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 @@ static inline void create_debug_files (struct ohci_hcd *bus)
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)
......@@ -519,12 +522,5 @@ static inline void remove_debug_files (struct ohci_hcd *bus)
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 */
/*-------------------------------------------------------------------------*/
......@@ -71,6 +71,13 @@
*/
#include <linux/config.h>
#ifdef CONFIG_USB_DEBUG
# define DEBUG
#else
# undef DEBUG
#endif
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
......@@ -84,13 +91,6 @@
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h> /* for in_interrupt () */
#ifdef CONFIG_USB_DEBUG
# define DEBUG
#else
# undef DEBUG
#endif
#include <linux/usb.h>
#include <linux/version.h>
#include "../core/hcd.h"
......@@ -383,7 +383,7 @@ static int hc_reset (struct ohci_hcd *ohci)
/* 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 @@ static int hc_reset (struct ohci_hcd *ohci)
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 @@ static int hc_reset (struct ohci_hcd *ohci)
/* 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 @@ static int hc_reset (struct ohci_hcd *ohci)
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 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
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 @@ static void ohci_stop (struct usb_hcd *hcd)
{
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);
......
......@@ -41,9 +41,10 @@ static u32 roothub_portstatus (struct ohci_hcd *hc, int i)
/*-------------------------------------------------------------------------*/
#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" : "", \
......
......@@ -206,8 +206,8 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed)
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 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
}
/* 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),
......
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