Currently, the debug information is printed by local trace() macro, which has a number of problems being dependant on a local TRACE macro and whatnot. Replace it with dev_dbg(), which is a standard way of printing debug info for kernel drivers. Signed-off-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx> --- drivers/usb/gadget/ci13xxx_udc.c | 80 ++++++++++++++++++-------------------- drivers/usb/gadget/ci13xxx_udc.h | 17 -------- 2 files changed, 38 insertions(+), 59 deletions(-) diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 560b539..05fdd3c 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c @@ -778,7 +778,7 @@ static ssize_t show_device(struct device *dev, struct device_attribute *attr, struct usb_gadget *gadget = &udc->gadget; int n = 0; - trace(udc->dev, "%p\n", buf); + dev_dbg(udc->dev, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "[%s] EINVAL\n", __func__); return 0; @@ -820,7 +820,7 @@ static ssize_t show_driver(struct device *dev, struct device_attribute *attr, struct usb_gadget_driver *driver = udc->driver; int n = 0; - trace(udc->dev, "%p\n", buf); + dev_dbg(udc->dev, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(dev, "[%s] EINVAL\n", __func__); return 0; @@ -981,7 +981,7 @@ static ssize_t show_events(struct device *dev, struct device_attribute *attr, unsigned long flags; unsigned i, j, n = 0; - trace(dev->parent, "%p\n", buf); + dev_dbg(dev->parent, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(dev->parent, "[%s] EINVAL\n", __func__); return 0; @@ -1016,7 +1016,7 @@ static ssize_t store_events(struct device *dev, struct device_attribute *attr, { unsigned tty; - trace(dev->parent, "[%s] %p, %d\n", __func__, buf, count); + dev_dbg(dev->parent, "[%s] %p, %d\n", __func__, buf, count); if (attr == NULL || buf == NULL) { dev_err(dev, "[%s] EINVAL\n", __func__); goto done; @@ -1048,7 +1048,7 @@ static ssize_t show_inters(struct device *dev, struct device_attribute *attr, u32 intr; unsigned i, j, n = 0; - trace(udc->dev, "%p\n", buf); + dev_dbg(udc->dev, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "[%s] EINVAL\n", __func__); return 0; @@ -1121,7 +1121,7 @@ static ssize_t store_inters(struct device *dev, struct device_attribute *attr, unsigned long flags; unsigned en, bit; - trace(udc->dev, "%p, %d\n", buf, count); + dev_dbg(udc->dev, "%p, %d\n", buf, count); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "EINVAL\n"); goto done; @@ -1161,7 +1161,7 @@ static ssize_t show_port_test(struct device *dev, unsigned long flags; unsigned mode; - trace(udc->dev, "%p\n", buf); + dev_dbg(udc->dev, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "EINVAL\n"); return 0; @@ -1187,7 +1187,7 @@ static ssize_t store_port_test(struct device *dev, unsigned long flags; unsigned mode; - trace(udc->dev, "%p, %d\n", buf, count); + dev_dbg(udc->dev, "%p, %d\n", buf, count); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "[%s] EINVAL\n", __func__); goto done; @@ -1221,7 +1221,7 @@ static ssize_t show_qheads(struct device *dev, struct device_attribute *attr, unsigned long flags; unsigned i, j, n = 0; - trace(udc->dev, "%p\n", buf); + dev_dbg(udc->dev, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "[%s] EINVAL\n", __func__); return 0; @@ -1262,7 +1262,7 @@ static ssize_t show_registers(struct device *dev, u32 *dump; unsigned i, k, n = 0; - trace(udc->dev, "%p\n", buf); + dev_dbg(udc->dev, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "[%s] EINVAL\n", __func__); return 0; @@ -1300,7 +1300,7 @@ static ssize_t store_registers(struct device *dev, struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); unsigned long addr, data, flags; - trace(udc->dev, "%p, %d\n", buf, count); + dev_dbg(udc->dev, "%p, %d\n", buf, count); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "[%s] EINVAL\n", __func__); goto done; @@ -1337,7 +1337,7 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, struct ci13xxx_req *req = NULL; unsigned i, j, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); - trace(udc->dev, "%p\n", buf); + dev_dbg(udc->dev, "%p\n", buf); if (attr == NULL || buf == NULL) { dev_err(udc->dev, "[%s] EINVAL\n", __func__); return 0; @@ -1468,7 +1468,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) int ret = 0; unsigned length = mReq->req.length; - trace(udc->dev, "%p, %p", mEp, mReq); + dev_dbg(udc->dev, "%p, %p", mEp, mReq); /* don't queue twice */ if (mReq->req.status == -EALREADY) @@ -1570,7 +1570,7 @@ done: */ static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) { - trace(mEp->udc->dev, "%p, %p", mEp, mReq); + dev_dbg(mEp->udc->dev, "%p, %p", mEp, mReq); if (mReq->req.status != -EALREADY) return -EINVAL; @@ -1621,7 +1621,7 @@ static int _ep_nuke(struct ci13xxx_ep *mEp) __releases(mEp->lock) __acquires(mEp->lock) { - trace(mEp->udc->dev, "%p", mEp); + dev_dbg(mEp->udc->dev, "%p", mEp); if (mEp == NULL) return -EINVAL; @@ -1658,7 +1658,7 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); unsigned long flags; - trace(udc->dev, "%p", gadget); + dev_dbg(udc->dev, "%p", gadget); if (gadget == NULL) return -EINVAL; @@ -1707,7 +1707,7 @@ __acquires(udc->lock) { int retval; - trace(udc->dev, "%p", udc); + dev_dbg(udc->dev, "%p", udc); dbg_event(0xFF, "BUS RST", 0); @@ -1740,7 +1740,7 @@ __acquires(udc->lock) */ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req) { - trace(NULL, "%p, %p", ep, req); + dev_dbg(NULL, "%p, %p", ep, req); if (ep == NULL || req == NULL) return; @@ -1766,7 +1766,7 @@ __acquires(mEp->lock) gfp_t gfp_flags = GFP_ATOMIC; int dir, num, retval; - trace(udc->dev, "%p, %p", mEp, setup); + dev_dbg(udc->dev, "%p, %p", mEp, setup); if (mEp == NULL || setup == NULL) return -EINVAL; @@ -1829,7 +1829,7 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) struct ci13xxx *udc = req->context; unsigned long flags; - trace(udc->dev, "%p, %p", ep, req); + dev_dbg(udc->dev, "%p, %p", ep, req); spin_lock_irqsave(&udc->lock, flags); if (udc->test_mode) @@ -1850,7 +1850,7 @@ __acquires(mEp->lock) int retval; struct ci13xxx_ep *mEp; - trace(udc->dev, "%p", udc); + dev_dbg(udc->dev, "%p", udc); mEp = (udc->ep0_dir == TX) ? udc->ep0out : udc->ep0in; udc->status->context = udc; @@ -1878,7 +1878,7 @@ __acquires(mEp->lock) struct ci13xxx_ep *mEpTemp = mEp; int uninitialized_var(retval); - trace(mEp->udc->dev, "%p", mEp); + dev_dbg(mEp->udc->dev, "%p", mEp); if (list_empty(&mEp->qh.queue)) return -EINVAL; @@ -1921,7 +1921,7 @@ __acquires(udc->lock) unsigned i; u8 tmode = 0; - trace(udc->dev, "%p", udc); + dev_dbg(udc->dev, "%p", udc); for (i = 0; i < udc->hw_ep_max; i++) { struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; @@ -2114,7 +2114,7 @@ static int ep_enable(struct usb_ep *ep, int retval = 0; unsigned long flags; - trace(mEp->udc->dev, "%p, %p", ep, desc); + dev_dbg(mEp->udc->dev, "%p, %p", ep, desc); if (ep == NULL || desc == NULL) return -EINVAL; @@ -2171,7 +2171,7 @@ static int ep_disable(struct usb_ep *ep) int direction, retval = 0; unsigned long flags; - trace(mEp->udc->dev, "%p", ep); + dev_dbg(mEp->udc->dev, "%p", ep); if (ep == NULL) return -EINVAL; @@ -2210,7 +2210,7 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); struct ci13xxx_req *mReq = NULL; - trace(mEp->udc->dev, "%p, %i", ep, gfp_flags); + dev_dbg(mEp->udc->dev, "%p, %i", ep, gfp_flags); if (ep == NULL) return NULL; @@ -2244,7 +2244,7 @@ static void ep_free_request(struct usb_ep *ep, struct usb_request *req) struct ci13xxx_req *mReq = container_of(req, struct ci13xxx_req, req); unsigned long flags; - trace(mEp->udc->dev, "%p, %p", ep, req); + dev_dbg(mEp->udc->dev, "%p, %p", ep, req); if (ep == NULL || req == NULL) { return; @@ -2278,7 +2278,7 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, int retval = 0; unsigned long flags; - trace(mEp->udc->dev, "%p, %p, %X", ep, req, gfp_flags); + dev_dbg(mEp->udc->dev, "%p, %p, %X", ep, req, gfp_flags); if (ep == NULL || req == NULL || mEp->ep.desc == NULL) return -EINVAL; @@ -2341,7 +2341,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) struct ci13xxx_req *mReq = container_of(req, struct ci13xxx_req, req); unsigned long flags; - trace(mEp->udc->dev, "%p, %p", ep, req); + dev_dbg(mEp->udc->dev, "%p, %p", ep, req); if (ep == NULL || req == NULL || mReq->req.status != -EALREADY || mEp->ep.desc == NULL || list_empty(&mReq->queue) || @@ -2385,7 +2385,7 @@ static int ep_set_halt(struct usb_ep *ep, int value) int direction, retval = 0; unsigned long flags; - trace(mEp->udc->dev, "%p, %i", ep, value); + dev_dbg(mEp->udc->dev, "%p, %i", ep, value); if (ep == NULL || mEp->ep.desc == NULL) return -EINVAL; @@ -2428,7 +2428,7 @@ static int ep_set_wedge(struct usb_ep *ep) struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); unsigned long flags; - trace(mEp->udc->dev, "%p", ep); + dev_dbg(mEp->udc->dev, "%p", ep); if (ep == NULL || mEp->ep.desc == NULL) return -EINVAL; @@ -2453,7 +2453,7 @@ static void ep_fifo_flush(struct usb_ep *ep) struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); unsigned long flags; - trace(mEp->udc->dev, "%p", ep); + dev_dbg(mEp->udc->dev, "%p", ep); if (ep == NULL) { dev_err(mEp->udc->dev, "%02X: -EINVAL\n", _usb_addr(mEp)); @@ -2526,17 +2526,15 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget) unsigned long flags; int ret = 0; - trace(udc->dev, ""); - spin_lock_irqsave(&udc->lock, flags); if (!udc->remote_wakeup) { ret = -EOPNOTSUPP; - trace(udc->dev, "remote wakeup feature is not enabled\n"); + dev_dbg(udc->dev, "remote wakeup feature is not enabled\n"); goto out; } if (!hw_read(udc, OP_PORTSC, PORTSC_SUSP)) { ret = -EINVAL; - trace(udc->dev, "port is not suspended\n"); + dev_dbg(udc->dev, "port is not suspended\n"); goto out; } hw_write(udc, OP_PORTSC, PORTSC_FPR, PORTSC_FPR); @@ -2633,7 +2631,7 @@ static int ci13xxx_start(struct usb_gadget *gadget, unsigned long flags; int retval = -ENOMEM; - trace(udc->dev, "%p", driver); + dev_dbg(udc->dev, "%p", driver); if (driver->disconnect == NULL) return -EINVAL; @@ -2680,7 +2678,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget, struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); unsigned long flags; - trace(udc->dev, "%p", driver); + dev_dbg(udc->dev, "%p", driver); spin_lock_irqsave(&udc->lock, flags); @@ -2717,8 +2715,6 @@ static irqreturn_t udc_irq(int irq, void *data) irqreturn_t retval; u32 intr; - trace(udc ? udc->dev : NULL, ""); - if (udc == NULL) { dev_err(udc->dev, "ENODEV"); return IRQ_HANDLED; @@ -2789,7 +2785,7 @@ static irqreturn_t udc_irq(int irq, void *data) */ static void udc_release(struct device *dev) { - trace(dev->parent, "%p", dev); + dev_dbg(dev->parent, "%p", dev); } /** @@ -2808,7 +2804,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev, struct ci13xxx *udc; int retval = 0; - trace(dev, "%p, %p, %p", dev, regs, driver->name); + dev_dbg(dev, "%p, %p, %p", dev, regs, driver->name); if (dev == NULL || regs == NULL || driver == NULL || driver->name == NULL) diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h index a12fa56..553cc81 100644 --- a/drivers/usb/gadget/ci13xxx_udc.h +++ b/drivers/usb/gadget/ci13xxx_udc.h @@ -243,21 +243,4 @@ enum ci13xxx_regs { #define ENDPTCTRL_TXR BIT(22) /* reserved for port 0 */ #define ENDPTCTRL_TXE BIT(23) -/****************************************************************************** - * LOGGING - *****************************************************************************/ -#ifdef TRACE -#define trace(dev, format, args...) \ - do { \ - if (dev == NULL) \ - pr_debug("[%s] " format "\n", __func__, \ - ## args); \ - else \ - dev_printk(KERN_DEBUG, dev, "[%s] " format "\n", \ - __func__, ## args); \ - } while (0) -#else -#define trace(dev, format, args...) do {} while (0) -#endif - #endif /* _CI13XXX_h_ */ -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html