diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2014-05-20 20:30:11 +0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-06-30 21:33:35 +0400 |
commit | e56e69cc0ff4905914695f20c927aa71597be94c (patch) | |
tree | 755a4d0a2b8ba83d780e75a326ab75887d65fce8 /drivers/usb/gadget/net2280.c | |
parent | ae8e530a7e5d87592cb23996bee7fd6f1eb202ed (diff) | |
download | linux-e56e69cc0ff4905914695f20c927aa71597be94c.tar.xz |
usb: gadget: net2280: Use pr_* function
Driver was using custom functions WARNING, ERROR, DEBUG, instead of
pr_err, pr_dgb...
New ep_* macros have been created that use standard pr_* functions.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/net2280.c')
-rw-r--r-- | drivers/usb/gadget/net2280.c | 121 |
1 files changed, 59 insertions, 62 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index d506c83d204a..9ced9ff901e9 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -42,9 +42,6 @@ * (at your option) any later version. */ -#undef DEBUG /* messages on error and most fault paths */ -#undef VERBOSE /* extra debug messages (success too) */ - #include <linux/module.h> #include <linux/pci.h> #include <linux/dma-mapping.h> @@ -210,7 +207,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) * use it instead of troublesome (non-bulk) multi-packet DMA. */ if (ep->dma && (max % 4) != 0 && use_dma_chaining) { - DEBUG(ep->dev, "%s, no dma for maxpacket %d\n", + ep_dbg(ep->dev, "%s, no dma for maxpacket %d\n", ep->ep.name, ep->ep.maxpacket); ep->dma = NULL; } @@ -303,7 +300,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) } tmp = desc->bEndpointAddress; - DEBUG(dev, "enabled %s (ep%d%s-%s) %s max %04x\n", + ep_dbg(dev, "enabled %s (ep%d%s-%s) %s max %04x\n", _ep->name, tmp & 0x0f, DIR_STRING(tmp), type_string(desc->bmAttributes), ep->dma ? "dma" : "pio", max); @@ -431,7 +428,7 @@ static void ep_reset_338x(struct net2280_regs __iomem *regs, dmastat = readl(&ep->dma->dmastat); if (dmastat == 0x5002) { - WARNING(ep->dev, "The dmastat return = %x!!\n", + ep_warn(ep->dev, "The dmastat return = %x!!\n", dmastat); writel(0x5a, &ep->dma->dmastat); } @@ -476,7 +473,7 @@ static int net2280_disable(struct usb_ep *_ep) else ep_reset_228x(ep->dev->regs, ep); - VDEBUG(ep->dev, "disabled %s %s\n", + ep_vdbg(ep->dev, "disabled %s %s\n", ep->dma ? "dma" : "pio", _ep->name); /* synch memory views with the device */ @@ -572,7 +569,7 @@ static void write_fifo(struct net2280_ep *ep, struct usb_request *req) if (count > total) /* min() cannot be used on a bitfield */ count = total; - VDEBUG(ep->dev, "write %s fifo (IN) %d bytes%s req %p\n", + ep_vdbg(ep->dev, "write %s fifo (IN) %d bytes%s req %p\n", ep->ep.name, count, (count != ep->ep.maxpacket) ? " (short)" : "", req); @@ -684,7 +681,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) if (count > tmp) { /* as with DMA, data overflow gets flushed */ if ((tmp % ep->ep.maxpacket) != 0) { - ERROR(ep->dev, + ep_err(ep->dev, "%s out fifo %d bytes, expected %d\n", ep->ep.name, count, tmp); req->req.status = -EOVERFLOW; @@ -699,7 +696,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) is_short = (count == 0) || ((count % ep->ep.maxpacket) != 0); - VDEBUG(ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n", + ep_vdbg(ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n", ep->ep.name, count, is_short ? " (short)" : "", cleanup ? " flush" : "", prevent ? " nak" : "", req, req->req.actual, req->req.length); @@ -925,7 +922,7 @@ done(struct net2280_ep *ep, struct net2280_request *req, int status) usb_gadget_unmap_request(&dev->gadget, &req->req, ep->is_in); if (status && status != -ESHUTDOWN) - VDEBUG(dev, "complete %s req %p stat %d len %u/%u\n", + ep_vdbg(dev, "complete %s req %p stat %d len %u/%u\n", ep->ep.name, &req->req, status, req->req.actual, req->req.length); @@ -978,7 +975,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) } #if 0 - VDEBUG(dev, "%s queue req %p, len %d buf %p\n", + ep_vdbg(dev, "%s queue req %p, len %d buf %p\n", _ep->name, _req, _req->length, _req->buf); #endif @@ -1012,7 +1009,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) if (ep->num == 0 && _req->length == 0) { allow_status(ep); done(ep, req, 0); - VDEBUG(dev, "%s status ack\n", ep->ep.name); + ep_vdbg(dev, "%s status ack\n", ep->ep.name); goto done; } @@ -1131,7 +1128,7 @@ static void scan_dma_completions(struct net2280_ep *ep) * 0122, and 0124; not all cases trigger the warning. */ if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) { - WARNING(ep->dev, "%s lost packet sync!\n", + ep_warn(ep->dev, "%s lost packet sync!\n", ep->ep.name); req->req.status = -EOVERFLOW; } else { @@ -1139,7 +1136,7 @@ static void scan_dma_completions(struct net2280_ep *ep) if (tmp) { /* fifo gets flushed later */ ep->out_overflow = 1; - DEBUG(ep->dev, + ep_dbg(ep->dev, "%s dma, discard %d len %d\n", ep->ep.name, tmp, req->req.length); @@ -1175,7 +1172,7 @@ static void restart_dma(struct net2280_ep *ep) struct net2280_request *entry, *prev = NULL; int reqmode, done = 0; - DEBUG(ep->dev, "%s dma hiccup td %p\n", ep->ep.name, req->td); + ep_dbg(ep->dev, "%s dma hiccup td %p\n", ep->ep.name, req->td); ep->in_fifo_validate = likely(req->req.zero || (req->req.length % ep->ep.maxpacket) != 0); if (ep->in_fifo_validate) @@ -1295,7 +1292,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req) /* queue head may be partially complete. */ if (ep->queue.next == &req->queue) { if (ep->dma) { - DEBUG(ep->dev, "unlink (%s) dma\n", _ep->name); + ep_dbg(ep->dev, "unlink (%s) dma\n", _ep->name); _req->status = -ECONNRESET; abort_dma(ep); if (likely(ep->queue.next == &req->queue)) { @@ -1306,7 +1303,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req) -ECONNRESET); } } else { - DEBUG(ep->dev, "unlink (%s) pio\n", _ep->name); + ep_dbg(ep->dev, "unlink (%s) pio\n", _ep->name); done(ep, req, -ECONNRESET); } req = NULL; @@ -1379,7 +1376,7 @@ net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged) else if (ep->is_in && value && net2280_fifo_status(_ep) != 0) retval = -EAGAIN; else { - VDEBUG(ep->dev, "%s %s %s\n", _ep->name, + ep_vdbg(ep->dev, "%s %s %s\n", _ep->name, value ? "set" : "clear", wedged ? "wedge" : "halt"); /* set/clear, then synch memory views with the device */ @@ -1566,7 +1563,7 @@ static const struct usb_gadget_ops net2280_ops = { /*-------------------------------------------------------------------------*/ -#ifdef CONFIG_USB_GADGET_DEBUG_FILES +#ifdef CONFIG_USB_GADGET_PDEBUG_FILES /* FIXME move these into procfs, and use seq_file. * Sysfs _still_ doesn't behave for arbitrarily sized files, @@ -1928,8 +1925,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev) /*See if firmware needs to set up for workaround*/ if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) { - WARNING(dev, "Operate Defect 7374 workaround soft this time"); - WARNING(dev, "It will operate on cold-reboot and SS connect"); + ep_warn(dev, "Operate Defect 7374 workaround soft this time"); + ep_warn(dev, "It will operate on cold-reboot and SS connect"); /*GPEPs:*/ tmp = ((0 << ENDPOINT_NUMBER) | BIT(ENDPOINT_DIRECTION) | @@ -1985,8 +1982,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev) set_idx_reg(dev->regs, SCRATCH, scratch); } else{ - WARNING(dev, "Defect 7374 workaround soft will NOT operate"); - WARNING(dev, "It will operate on cold-reboot and SS connect"); + ep_warn(dev, "Defect 7374 workaround soft will NOT operate"); + ep_warn(dev, "It will operate on cold-reboot and SS connect"); } } @@ -2050,7 +2047,7 @@ static void usb_reset_338x(struct net2280 *dev) /* See if firmware needs to set up for workaround: */ if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) { - INFO(dev, "%s: Defect 7374 FsmValue 0x%08x\n", __func__, + ep_info(dev, "%s: Defect 7374 FsmValue 0x%08x\n", __func__, fsmvalue); } else { /* disable automatic responses, and irqs */ @@ -2187,7 +2184,7 @@ static void usb_reinit_338x(struct net2280 *dev) /* See if driver needs to set up for workaround: */ if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) - INFO(dev, "%s: Defect 7374 FsmValue %08x\n", + ep_info(dev, "%s: Defect 7374 FsmValue %08x\n", __func__, fsmvalue); else { tmp = readl(&dev->usb_ext->usbctl2) & @@ -2302,7 +2299,7 @@ static void ep0_start_338x(struct net2280 *dev) (0xf << DEFECT7374_FSM_FIELD); if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) - INFO(dev, "%s: Defect 7374 FsmValue %08x\n", __func__, + ep_info(dev, "%s: Defect 7374 FsmValue %08x\n", __func__, fsmvalue); else writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE) | @@ -2401,7 +2398,7 @@ static int net2280_start(struct usb_gadget *_gadget, ep0_start(dev); - DEBUG(dev, "%s ready, usbctl %08x stdrsp %08x\n", + ep_dbg(dev, "%s ready, usbctl %08x stdrsp %08x\n", driver->driver.name, readl(&dev->usb->usbctl), readl(&dev->usb->stdrsp)); @@ -2464,7 +2461,7 @@ static int net2280_stop(struct usb_gadget *_gadget, device_remove_file(&dev->pdev->dev, &dev_attr_function); device_remove_file(&dev->pdev->dev, &dev_attr_queues); - DEBUG(dev, "unregistered driver '%s'\n", + ep_dbg(dev, "unregistered driver '%s'\n", driver ? driver->driver.name : ""); return 0; @@ -2493,7 +2490,7 @@ static void handle_ep_small(struct net2280_ep *ep) t = readl(&ep->regs->ep_stat); ep->irqs++; #if 0 - VDEBUG(ep->dev, "%s ack ep_stat %08x, req %p\n", + ep_vdbg(ep->dev, "%s ack ep_stat %08x, req %p\n", ep->ep.name, t, req ? &req->req : 0); #endif if (!ep->is_in || ep->dev->pdev->device == 0x2280) @@ -2624,7 +2621,7 @@ static void handle_ep_small(struct net2280_ep *ep) if (!list_empty(&ep->queue)) restart_dma(ep); } else - DEBUG(ep->dev, "%s dma ep_stat %08x ??\n", + ep_dbg(ep->dev, "%s dma ep_stat %08x ??\n", ep->ep.name, t); return; @@ -2758,12 +2755,12 @@ static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r) if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) { - ERROR(dev, "FAIL: Defect 7374 workaround waited but failed " + ep_err(dev, "FAIL: Defect 7374 workaround waited but failed " "to detect SS host's data phase ACK."); - ERROR(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16" + ep_err(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16" "got 0x%2.2x.\n", state >> STATE); } else { - WARNING(dev, "INFO: Defect 7374 workaround waited about\n" + ep_warn(dev, "INFO: Defect 7374 workaround waited about\n" "%duSec for Control Read Data Phase ACK\n", DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout); } @@ -2953,7 +2950,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev, goto do_stall3; if (w_value != USB_ENDPOINT_HALT) goto do_stall3; - VDEBUG(dev, "%s clear halt\n", e->ep.name); + ep_vdbg(dev, "%s clear halt\n", e->ep.name); ep_stall(e, false); if (!list_empty(&e->queue) && e->td_dma) restart_dma(e); @@ -3024,7 +3021,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev, default: usb3_delegate: - VDEBUG(dev, "setup %02x.%02x v%04x i%04x l%04x ep_cfg %08x\n", + ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x ep_cfg %08x\n", r.bRequestType, r.bRequest, w_value, w_index, w_length, readl(&ep->cfg->ep_cfg)); @@ -3036,7 +3033,7 @@ usb3_delegate: } do_stall3: if (tmp < 0) { - VDEBUG(dev, "req %02x.%02x protocol STALL; stat %d\n", + ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n", r.bRequestType, r.bRequest, tmp); dev->protocol_stall = 1; /* TD 9.9 Halt Endpoint test. TD 9.22 Set feature test */ @@ -3061,7 +3058,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) stat &= ~BIT(INTA_ASSERTED); if (!stat) return; - /* DEBUG(dev, "irqstat0 %04x\n", stat); */ + /* ep_dbg(dev, "irqstat0 %04x\n", stat); */ /* starting a control request? */ if (unlikely(stat & BIT(SETUP_PACKET_INTERRUPT))) { @@ -3088,7 +3085,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) EP0_HS_MAX_PACKET_SIZE); } net2280_led_speed(dev, dev->gadget.speed); - DEBUG(dev, "%s\n", + ep_dbg(dev, "%s\n", usb_speed_string(dev->gadget.speed)); } @@ -3196,7 +3193,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) set_fifo_bytecount(ep, w_length); writel((__force u32)status, &dev->epregs[0].ep_data); allow_status(ep); - VDEBUG(dev, "%s stat %02x\n", ep->ep.name, status); + ep_vdbg(dev, "%s stat %02x\n", ep->ep.name, status); goto next_endpoints; } break; @@ -3212,10 +3209,10 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) if (!e) goto do_stall; if (e->wedged) { - VDEBUG(dev, "%s wedged, halt not cleared\n", + ep_vdbg(dev, "%s wedged, halt not cleared\n", ep->ep.name); } else { - VDEBUG(dev, "%s clear halt\n", e->ep.name); + ep_vdbg(dev, "%s clear halt\n", e->ep.name); clear_halt(e); if (ep->dev->pdev->vendor == PCI_VENDOR_ID_PLX && @@ -3243,13 +3240,13 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) if (dev->pdev->vendor == PCI_VENDOR_ID_PLX && e->dma) abort_dma(e); allow_status(ep); - VDEBUG(dev, "%s set halt\n", ep->ep.name); + ep_vdbg(dev, "%s set halt\n", ep->ep.name); goto next_endpoints; } break; default: delegate: - VDEBUG(dev, "setup %02x.%02x v%04x i%04x l%04x " + ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x " "ep_cfg %08x\n", u.r.bRequestType, u.r.bRequest, w_value, w_index, w_length, @@ -3263,7 +3260,7 @@ delegate: /* stall ep0 on error */ if (tmp < 0) { do_stall: - VDEBUG(dev, "req %02x.%02x protocol STALL; stat %d\n", + ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n", u.r.bRequestType, u.r.bRequest, tmp); dev->protocol_stall = 1; } @@ -3296,7 +3293,7 @@ next_endpoints: } if (stat) - DEBUG(dev, "unhandled irqstat0 %08x\n", stat); + ep_dbg(dev, "unhandled irqstat0 %08x\n", stat); } #define DMA_INTERRUPTS (BIT(DMA_D_INTERRUPT) | \ @@ -3329,7 +3326,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) ((readl(&dev->usb->usbctl) & BIT(VBUS_PIN)) == 0)) && (dev->gadget.speed != USB_SPEED_UNKNOWN)) { - DEBUG(dev, "disconnect %s\n", + ep_dbg(dev, "disconnect %s\n", dev->driver->driver.name); stop_activity(dev, dev->driver); ep0_start(dev); @@ -3381,7 +3378,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) if (!stat) return; - /* DEBUG(dev, "irqstat1 %08x\n", stat);*/ + /* ep_dbg(dev, "irqstat1 %08x\n", stat);*/ /* DMA status, for ep-{a,b,c,d} */ scratch = stat & DMA_INTERRUPTS; @@ -3418,7 +3415,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) */ if (!use_dma_chaining) { if (!(tmp & BIT(DMA_TRANSACTION_DONE_INTERRUPT))) { - DEBUG(ep->dev, "%s no xact done? %08x\n", + ep_dbg(ep->dev, "%s no xact done? %08x\n", ep->ep.name, tmp); continue; } @@ -3470,7 +3467,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) * if they appear very often, here's where to try recovering. */ if (stat & PCI_ERROR_INTERRUPTS) { - ERROR(dev, "pci dma error; stat %08x\n", stat); + ep_err(dev, "pci dma error; stat %08x\n", stat); stat &= ~PCI_ERROR_INTERRUPTS; /* these are fatal errors, but "maybe" they won't * happen again ... @@ -3481,7 +3478,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) } if (stat) - DEBUG(dev, "unhandled irqstat1 %08x\n", stat); + ep_dbg(dev, "unhandled irqstat1 %08x\n", stat); } static irqreturn_t net2280_irq(int irq, void *_dev) @@ -3557,7 +3554,7 @@ static void net2280_remove(struct pci_dev *pdev) pci_disable_device(pdev); device_remove_file(&pdev->dev, &dev_attr_registers); - INFO(dev, "unbind\n"); + ep_info(dev, "unbind\n"); } /* wrap this driver around the specified device, but @@ -3605,7 +3602,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) resource = pci_resource_start(pdev, 0); len = pci_resource_len(pdev, 0); if (!request_mem_region(resource, len, driver_name)) { - DEBUG(dev, "controller already in use\n"); + ep_dbg(dev, "controller already in use\n"); retval = -EBUSY; goto done; } @@ -3617,7 +3614,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) base = ioremap_nocache(resource, len); if (base == NULL) { - DEBUG(dev, "can't map memory\n"); + ep_dbg(dev, "can't map memory\n"); retval = -EFAULT; goto done; } @@ -3666,18 +3663,18 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* irq setup after old hardware is cleaned up */ if (!pdev->irq) { - ERROR(dev, "No IRQ. Check PCI setup!\n"); + ep_err(dev, "No IRQ. Check PCI setup!\n"); retval = -ENODEV; goto done; } if (use_msi && dev->pdev->vendor == PCI_VENDOR_ID_PLX) if (pci_enable_msi(pdev)) - ERROR(dev, "Failed to enable MSI mode\n"); + ep_err(dev, "Failed to enable MSI mode\n"); if (request_irq(pdev->irq, net2280_irq, IRQF_SHARED, driver_name, dev)) { - ERROR(dev, "request interrupt %d failed\n", pdev->irq); + ep_err(dev, "request interrupt %d failed\n", pdev->irq); retval = -EBUSY; goto done; } @@ -3690,7 +3687,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) 0 /* no alignment requirements */, 0 /* or page-crossing issues */); if (!dev->requests) { - DEBUG(dev, "can't get request pool\n"); + ep_dbg(dev, "can't get request pool\n"); retval = -ENOMEM; goto done; } @@ -3700,7 +3697,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) td = pci_pool_alloc(dev->requests, GFP_KERNEL, &dev->ep[i].td_dma); if (!td) { - DEBUG(dev, "can't get dummy %d\n", i); + ep_dbg(dev, "can't get dummy %d\n", i); retval = -ENOMEM; goto done; } @@ -3727,10 +3724,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev->chiprev = get_idx_reg(dev->regs, REG_CHIPREV) & 0xffff; /* done */ - INFO(dev, "%s\n", driver_desc); - INFO(dev, "irq %d, pci mem %p, chip rev %04x\n", + ep_info(dev, "%s\n", driver_desc); + ep_info(dev, "irq %d, pci mem %p, chip rev %04x\n", pdev->irq, base, dev->chiprev); - INFO(dev, "version: " DRIVER_VERSION "; dma %s %s\n", + ep_info(dev, "version: " DRIVER_VERSION "; dma %s %s\n", use_dma ? (use_dma_chaining ? "chaining" : "enabled") : "disabled", dev->enhanced_mode ? "enhanced mode" : "legacy mode"); |