USB: sl811: remove CONFIG_USB_DEBUG dependency
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Jun 2013 18:33:03 +0000 (11:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jul 2013 23:35:17 +0000 (16:35 -0700)
This removes the dependency of the driver on CONFIG_USB_DEBUG and moves
it to us the dynamic debug subsystem instead.  Bonus is the fact that we
can now properly determine the exact hardware that is spitting out the
messages.

This lets debugging be enabled without having to rebuild the driver, an
important thing for users that can not do it.

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/sl811-hcd.c
drivers/usb/host/sl811.h

index b2ec7fe758ddcf3dba22f922493ca6cebdeaea10..c11c5d8f94e0f871cdc7d87c769eeb1ec7b6e88f 100644 (file)
@@ -100,7 +100,8 @@ static void port_power(struct sl811 *sl811, int is_on)
 
        if (sl811->board && sl811->board->port_power) {
                /* switch VBUS, at 500mA unless hub power budget gets set */
-               DBG("power %s\n", is_on ? "on" : "off");
+               dev_dbg(hcd->self.controller, "power %s\n",
+                       is_on ? "on" : "off");
                sl811->board->port_power(hcd->self.controller, is_on);
        }
 
@@ -282,7 +283,7 @@ static inline void sofirq_on(struct sl811 *sl811)
 {
        if (sl811->irq_enable & SL11H_INTMASK_SOFINTR)
                return;
-       VDBG("sof irq on\n");
+       dev_dbg(sl811_to_hcd(sl811)->self.controller, "sof irq on\n");
        sl811->irq_enable |= SL11H_INTMASK_SOFINTR;
 }
 
@@ -290,7 +291,7 @@ static inline void sofirq_off(struct sl811 *sl811)
 {
        if (!(sl811->irq_enable & SL11H_INTMASK_SOFINTR))
                return;
-       VDBG("sof irq off\n");
+       dev_dbg(sl811_to_hcd(sl811)->self.controller, "sof irq off\n");
        sl811->irq_enable &= ~SL11H_INTMASK_SOFINTR;
 }
 
@@ -338,7 +339,8 @@ static struct sl811h_ep     *start(struct sl811 *sl811, u8 bank)
        }
 
        if (unlikely(list_empty(&ep->hep->urb_list))) {
-               DBG("empty %p queue?\n", ep);
+               dev_dbg(sl811_to_hcd(sl811)->self.controller,
+                       "empty %p queue?\n", ep);
                return NULL;
        }
 
@@ -391,7 +393,8 @@ static struct sl811h_ep     *start(struct sl811 *sl811, u8 bank)
                status_packet(sl811, ep, urb, bank, control);
                break;
        default:
-               DBG("bad ep%p pid %02x\n", ep, ep->nextpid);
+               dev_dbg(sl811_to_hcd(sl811)->self.controller,
+                       "bad ep%p pid %02x\n", ep, ep->nextpid);
                ep = NULL;
        }
        return ep;
@@ -447,7 +450,8 @@ static void finish_request(
        }
 
        /* periodic deschedule */
-       DBG("deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch);
+       dev_dbg(sl811_to_hcd(sl811)->self.controller,
+               "deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch);
        for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) {
                struct sl811h_ep        *temp;
                struct sl811h_ep        **prev = &sl811->periodic[i];
@@ -593,7 +597,8 @@ static inline u8 checkdone(struct sl811 *sl811)
                ctl = sl811_read(sl811, SL811_EP_A(SL11H_HOSTCTLREG));
                if (ctl & SL11H_HCTLMASK_ARM)
                        sl811_write(sl811, SL811_EP_A(SL11H_HOSTCTLREG), 0);
-               DBG("%s DONE_A: ctrl %02x sts %02x\n",
+               dev_dbg(sl811_to_hcd(sl811)->self.controller,
+                       "%s DONE_A: ctrl %02x sts %02x\n",
                        (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost",
                        ctl,
                        sl811_read(sl811, SL811_EP_A(SL11H_PKTSTATREG)));
@@ -604,7 +609,8 @@ static inline u8 checkdone(struct sl811 *sl811)
                ctl = sl811_read(sl811, SL811_EP_B(SL11H_HOSTCTLREG));
                if (ctl & SL11H_HCTLMASK_ARM)
                        sl811_write(sl811, SL811_EP_B(SL11H_HOSTCTLREG), 0);
-               DBG("%s DONE_B: ctrl %02x sts %02x\n",
+               dev_dbg(sl811_to_hcd(sl811)->self.controller,
+                       "%s DONE_B: ctrl %02x sts %02x\n",
                        (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost",
                        ctl,
                        sl811_read(sl811, SL811_EP_B(SL11H_PKTSTATREG)));
@@ -665,7 +671,7 @@ retry:
                 * this one has nothing scheduled.
                 */
                if (sl811->next_periodic) {
-                       // ERR("overrun to slot %d\n", index);
+                       // dev_err(hcd->self.controller, "overrun to slot %d\n", index);
                        sl811->stat_overrun++;
                }
                if (sl811->periodic[index])
@@ -723,7 +729,7 @@ retry:
 
        } else if (irqstat & SL11H_INTMASK_RD) {
                if (sl811->port1 & USB_PORT_STAT_SUSPEND) {
-                       DBG("wakeup\n");
+                       dev_dbg(hcd->self.controller, "wakeup\n");
                        sl811->port1 |= USB_PORT_STAT_C_SUSPEND << 16;
                        sl811->stat_wake++;
                } else
@@ -852,8 +858,9 @@ static int sl811h_urb_enqueue(
 
                if (ep->maxpacket > H_MAXPACKET) {
                        /* iso packets up to 240 bytes could work... */
-                       DBG("dev %d ep%d maxpacket %d\n",
-                               udev->devnum, epnum, ep->maxpacket);
+                       dev_dbg(hcd->self.controller,
+                               "dev %d ep%d maxpacket %d\n", udev->devnum,
+                               epnum, ep->maxpacket);
                        retval = -EINVAL;
                        kfree(ep);
                        goto fail;
@@ -917,7 +924,8 @@ static int sl811h_urb_enqueue(
                 * to share the faster parts of the tree without needing
                 * dummy/placeholder nodes
                 */
-               DBG("schedule qh%d/%p branch %d\n", ep->period, ep, ep->branch);
+               dev_dbg(hcd->self.controller, "schedule qh%d/%p branch %d\n",
+                       ep->period, ep, ep->branch);
                for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) {
                        struct sl811h_ep        **prev = &sl811->periodic[i];
                        struct sl811h_ep        *here = *prev;
@@ -976,7 +984,8 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
                } else if (sl811->active_a == ep) {
                        if (time_before_eq(sl811->jiffies_a, jiffies)) {
                                /* happens a lot with lowspeed?? */
-                               DBG("giveup on DONE_A: ctrl %02x sts %02x\n",
+                               dev_dbg(hcd->self.controller,
+                                       "giveup on DONE_A: ctrl %02x sts %02x\n",
                                        sl811_read(sl811,
                                                SL811_EP_A(SL11H_HOSTCTLREG)),
                                        sl811_read(sl811,
@@ -990,7 +999,8 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
                } else if (sl811->active_b == ep) {
                        if (time_before_eq(sl811->jiffies_a, jiffies)) {
                                /* happens a lot with lowspeed?? */
-                               DBG("giveup on DONE_B: ctrl %02x sts %02x\n",
+                               dev_dbg(hcd->self.controller,
+                                       "giveup on DONE_B: ctrl %02x sts %02x\n",
                                        sl811_read(sl811,
                                                SL811_EP_B(SL11H_HOSTCTLREG)),
                                        sl811_read(sl811,
@@ -1008,7 +1018,8 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
                if (urb)
                        finish_request(sl811, ep, urb, 0);
                else
-                       VDBG("dequeue, urb %p active %s; wait4irq\n", urb,
+                       dev_dbg(sl811_to_hcd(sl811)->self.controller,
+                               "dequeue, urb %p active %s; wait4irq\n", urb,
                                (sl811->active_a == ep) ? "A" : "B");
        } else
                retval = -EINVAL;
@@ -1029,7 +1040,7 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
        if (!list_empty(&hep->urb_list))
                msleep(3);
        if (!list_empty(&hep->urb_list))
-               WARNING("ep %p not empty?\n", ep);
+               dev_warn(hcd->self.controller, "ep %p not empty?\n", ep);
 
        kfree(ep);
        hep->hcpriv = NULL;
@@ -1132,7 +1143,7 @@ sl811h_timer(unsigned long _sl811)
 
        switch (signaling) {
        case SL11H_CTL1MASK_SE0:
-               DBG("end reset\n");
+               dev_dbg(sl811_to_hcd(sl811)->self.controller, "end reset\n");
                sl811->port1 = (USB_PORT_STAT_C_RESET << 16)
                                 | USB_PORT_STAT_POWER;
                sl811->ctrl1 = 0;
@@ -1141,11 +1152,12 @@ sl811h_timer(unsigned long _sl811)
                        irqstat &= ~SL11H_INTMASK_RD;
                break;
        case SL11H_CTL1MASK_K:
-               DBG("end resume\n");
+               dev_dbg(sl811_to_hcd(sl811)->self.controller, "end resume\n");
                sl811->port1 &= ~USB_PORT_STAT_SUSPEND;
                break;
        default:
-               DBG("odd timer signaling: %02x\n", signaling);
+               dev_dbg(sl811_to_hcd(sl811)->self.controller,
+                       "odd timer signaling: %02x\n", signaling);
                break;
        }
        sl811_write(sl811, SL11H_IRQ_STATUS, irqstat);
@@ -1243,7 +1255,7 @@ sl811h_hub_control(
                                break;
 
                        /* 20 msec of resume/K signaling, other irqs blocked */
-                       DBG("start resume...\n");
+                       dev_dbg(hcd->self.controller, "start resume...\n");
                        sl811->irq_enable = 0;
                        sl811_write(sl811, SL11H_IRQ_ENABLE,
                                                sl811->irq_enable);
@@ -1281,7 +1293,8 @@ sl811h_hub_control(
 #ifndef        VERBOSE
        if (*(u16*)(buf+2))     /* only if wPortChange is interesting */
 #endif
-               DBG("GetPortStatus %08x\n", sl811->port1);
+               dev_dbg(hcd->self.controller, "GetPortStatus %08x\n",
+                       sl811->port1);
                break;
        case SetPortFeature:
                if (wIndex != 1 || wLength != 0)
@@ -1293,7 +1306,7 @@ sl811h_hub_control(
                        if (!(sl811->port1 & USB_PORT_STAT_ENABLE))
                                goto error;
 
-                       DBG("suspend...\n");
+                       dev_dbg(hcd->self.controller,"suspend...\n");
                        sl811->ctrl1 &= ~SL11H_CTL1MASK_SOF_ENA;
                        sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
                        break;
@@ -1338,7 +1351,7 @@ static int
 sl811h_bus_suspend(struct usb_hcd *hcd)
 {
        // SOFs off
-       DBG("%s\n", __func__);
+       dev_dbg(hcd->self.controller, "%s\n", __func__);
        return 0;
 }
 
@@ -1346,7 +1359,7 @@ static int
 sl811h_bus_resume(struct usb_hcd *hcd)
 {
        // SOFs on
-       DBG("%s\n", __func__);
+       dev_dbg(hcd->self.controller, "%s\n", __func__);
        return 0;
 }
 
@@ -1648,7 +1661,7 @@ sl811h_probe(struct platform_device *dev)
 
        /* refuse to confuse usbcore */
        if (dev->dev.dma_mask) {
-               DBG("no we won't dma\n");
+               dev_dbg(&dev->dev, "no we won't dma\n");
                return -EINVAL;
        }
 
@@ -1716,7 +1729,7 @@ sl811h_probe(struct platform_device *dev)
                break;
        default:
                /* reject case 0, SL11S is less functional */
-               DBG("chiprev %02x\n", tmp);
+               dev_dbg(&dev->dev, "chiprev %02x\n", tmp);
                retval = -ENXIO;
                goto err6;
        }
@@ -1747,7 +1760,7 @@ sl811h_probe(struct platform_device *dev)
        if (!ioaddr)
                iounmap(addr_reg);
  err2:
-       DBG("init error, %d\n", retval);
+       dev_dbg(&dev->dev, "init error, %d\n", retval);
        return retval;
 }
 
index b6b8c1f233dd8caa62caebf5b44c92a8480a9b37..7ac5c5ee4a3e40e3a5abe7cfdcd37e9e910485e5 100644 (file)
@@ -242,25 +242,8 @@ sl811_read_buf(struct sl811 *sl811, int addr, void *buf, size_t count)
 
 /*-------------------------------------------------------------------------*/
 
-#ifdef DEBUG
-#define DBG(stuff...)          printk(KERN_DEBUG "sl811: " stuff)
-#else
-#define DBG(stuff...)          do{}while(0)
-#endif
-
-#ifdef VERBOSE
-#    define VDBG               DBG
-#else
-#    define VDBG(stuff...)     do{}while(0)
-#endif
-
 #ifdef PACKET_TRACE
-#    define PACKET             VDBG
+#    define PACKET             pr_debug("sl811: "stuff)
 #else
 #    define PACKET(stuff...)   do{}while(0)
 #endif
-
-#define ERR(stuff...)          printk(KERN_ERR "sl811: " stuff)
-#define WARNING(stuff...)      printk(KERN_WARNING "sl811: " stuff)
-#define INFO(stuff...)         printk(KERN_INFO "sl811: " stuff)
-