ChangeSet 1.924.3.7, 2002/11/30 00:09:00-08:00, [EMAIL PROTECTED]

[PATCH] ehci, more diagnostics use dev_*() macros

This reduces the quantity of messages, by using the
newer dev_*() macros, and by deleting some messages.


diff -Nru a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
--- a/drivers/usb/host/ehci-dbg.c       Sun Dec  1 23:06:05 2002
+++ b/drivers/usb/host/ehci-dbg.c       Sun Dec  1 23:06:05 2002
@@ -45,7 +45,8 @@
 {
        u32     params = readl (&ehci->caps->hcs_params);
 
-       dbg ("%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d",
+       ehci_dbg (ehci,
+               "%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d\n",
                label, params,
                HCS_DEBUG_PORT (params),
                HCS_INDICATOR (params) ? " ind" : "",
@@ -67,9 +68,8 @@
                                ((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
                        strcat(buf, tmp);
                }
-               dbg ("%s: %s portroute %s", 
-                       hcd_to_bus (&ehci->hcd)->bus_name, label,
-                       buf);
+               ehci_dbg (ehci, "%s portroute %s\n",
+                               label, buf);
        }
 }
 #else
@@ -88,19 +88,16 @@
 {
        u32     params = readl (&ehci->caps->hcc_params);
 
-       if (HCC_EXT_CAPS (params)) {
-               // EHCI 0.96 ... could interpret these (legacy?)
-               dbg ("%s extended capabilities at pci %2x",
-                       label, HCC_EXT_CAPS (params));
-       }
        if (HCC_ISOC_CACHE (params)) {
-               dbg ("%s hcc_params %04x caching frame %s%s%s",
+               ehci_dbg (ehci,
+                    "%s hcc_params %04x caching frame %s%s%s\n",
                     label, params,
                     HCC_PGM_FRAMELISTLEN (params) ? "256/512/1024" : "1024",
                     HCC_CANPARK (params) ? " park" : "",
                     HCC_64BIT_ADDR (params) ? " 64 bit addr" : "");
        } else {
-               dbg ("%s hcc_params %04x caching %d uframes %s%s%s",
+               ehci_dbg (ehci,
+                    "%s hcc_params %04x thresh %d uframes %s%s%s\n",
                     label,
                     params,
                     HCC_ISOC_THRES (params),
@@ -246,19 +243,19 @@
 #define dbg_status(ehci, label, status) { \
        char _buf [80]; \
        dbg_status_buf (_buf, sizeof _buf, label, status); \
-       dbg ("%s", _buf); \
+       ehci_dbg (ehci, "%s\n", _buf); \
 }
 
 #define dbg_cmd(ehci, label, command) { \
        char _buf [80]; \
        dbg_command_buf (_buf, sizeof _buf, label, command); \
-       dbg ("%s", _buf); \
+       ehci_dbg (ehci, "%s\n", _buf); \
 }
 
-#define dbg_port(hcd, label, port, status) { \
+#define dbg_port(ehci, label, port, status) { \
        char _buf [80]; \
        dbg_port_buf (_buf, sizeof _buf, label, port, status); \
-       dbg ("%s", _buf); \
+       ehci_dbg (ehci, "%s\n", _buf); \
 }
 
 /*-------------------------------------------------------------------------*/
diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c       Sun Dec  1 23:06:05 2002
+++ b/drivers/usb/host/ehci-hcd.c       Sun Dec  1 23:06:05 2002
@@ -262,7 +262,7 @@
        spin_lock_irqsave (&ehci->lock, flags);
        /* guard against lost IAA, which wedges everything */
        ehci_irq (&ehci->hcd);
-       /* unlink the last qh after it's idled a while */
+       /* stop async processing after it's idled a while */
        if (ehci->async_idle) {
                start_unlink_async (ehci, ehci->async);
                ehci->async_idle = 0;
@@ -289,12 +289,13 @@
                        pci_read_config_dword (ehci->hcd.pdev, where, &cap);
                } while ((cap & (1 << 16)) && msec);
                if (cap & (1 << 16)) {
-                       info ("BIOS handoff failed (%d, %04x)", where, cap);
+                       dev_info (*ehci->hcd.controller,
+                               "BIOS handoff failed (%d, %04x)\n",
+                               where, cap);
                        return 1;
                } 
-               dbg ("BIOS handoff succeeded");
-       } else
-               dbg ("BIOS handoff not needed");
+               ehci_dbg (ehci, "BIOS handoff succeeded\n");
+       }
        return 0;
 }
 
@@ -325,14 +326,15 @@
                u32             cap;
 
                pci_read_config_dword (ehci->hcd.pdev, temp, &cap);
-               dbg ("capability %04x at %02x", cap, temp);
+               ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp);
                switch (cap & 0xff) {
                case 1:                 /* BIOS/SMM/... handoff */
                        if (bios_handoff (ehci, temp, cap) != 0)
                                return -EOPNOTSUPP;
                        break;
                case 0:                 /* illegal reserved capability */
-                       warn ("illegal capability!");
+                       dev_warn (*ehci->hcd.controller,
+                                       "illegal capability!\n");
                        cap = 0;
                        /* FALLTHROUGH */
                default:                /* unknown */
@@ -404,7 +406,8 @@
        if (HCC_64BIT_ADDR (hcc_params)) {
                writel (0, &ehci->regs->segment);
                if (!pci_set_dma_mask (ehci->hcd.pdev, 0xffffffffffffffffULL))
-                       info ("enabled 64bit PCI DMA (DAC)");
+                       dev_info (*ehci->hcd.controller,
+                               "enabled 64bit PCI DMA (DAC)\n");
        }
 
        /* clear interrupt enables, set irq latency */
@@ -451,10 +454,10 @@
         /* PCI Serial Bus Release Number is at 0x60 offset */
        pci_read_config_byte (hcd->pdev, 0x60, &tempbyte);
        temp = readw (&ehci->caps->hci_version);
-       info ("USB %x.%x support enabled, EHCI rev %x.%02x, %s %s",
-             ((tempbyte & 0xf0)>>4), (tempbyte & 0x0f),
-              temp >> 8, temp & 0xff,
-              hcd_name, DRIVER_VERSION);
+       dev_info (*hcd->controller,
+               "USB %x.%x enabled, EHCI %x.%02x, driver %s\n",
+               ((tempbyte & 0xf0)>>4), (tempbyte & 0x0f),
+               temp >> 8, temp & 0xff, DRIVER_VERSION);
 
        /*
         * From here on, khubd concurrently accesses the root
@@ -486,13 +489,13 @@
 {
        struct ehci_hcd         *ehci = hcd_to_ehci (hcd);
 
-       dbg ("%s: stop", hcd_to_bus (hcd)->bus_name);
+       ehci_dbg (ehci, "stop\n");
 
        /* no more interrupts ... */
        if (hcd->state == USB_STATE_RUNNING)
                ehci_ready (ehci);
        if (in_interrupt ())            /* should not happen!! */
-               err ("stopped %s!", RUN_CONTEXT);
+               dev_err (*hcd->controller, "stopped %s!\n", RUN_CONTEXT);
        else
                del_timer_sync (&ehci->watchdog);
        ehci_reset (ehci);
@@ -508,9 +511,9 @@
        ehci_mem_cleanup (ehci);
 
 #ifdef EHCI_STATS
-       dbg ("irq normal %ld err %ld reclaim %ld",
+       ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld\n",
                ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim);
-       dbg ("complete %ld unlink %ld",
+       ehci_dbg (ehci, "complete %ld unlink %ld\n",
                ehci->stats.complete, ehci->stats.unlink);
 #endif
 
@@ -754,8 +757,8 @@
        struct ehci_qh          *qh = (struct ehci_qh *) urb->hcpriv;
        unsigned long           flags;
 
-       dbg ("%s urb_dequeue %p qh %p state %d",
-               hcd_to_bus (hcd)->bus_name, urb, qh, qh->qh_state);
+       ehci_vdbg (ehci, "urb_dequeue %p qh %p state %d\n",
+               urb, qh, qh->qh_state);
 
        switch (usb_pipetype (urb->pipe)) {
        // case PIPE_CONTROL:
@@ -998,7 +1001,6 @@
 
 static int __init init (void) 
 {
-       dbg (DRIVER_INFO);
        if (usb_disabled())
                return -ENODEV;
 
diff -Nru a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
--- a/drivers/usb/host/ehci-hub.c       Sun Dec  1 23:06:05 2002
+++ b/drivers/usb/host/ehci-hub.c       Sun Dec  1 23:06:05 2002
@@ -40,18 +40,15 @@
 
        /* if reset finished and it's still not enabled -- handoff */
        if (!(port_status & PORT_PE)) {
-               dbg ("%s port %d full speed, give to companion, 0x%x",
-                       hcd_to_bus (&ehci->hcd)->bus_name,
-                       index + 1, port_status);
+               ehci_dbg (ehci, "port %d full speed --> companion\n",
+                       index + 1);
 
                // what happens if HCS_N_CC(params) == 0 ?
                port_status |= PORT_OWNER;
                writel (port_status, &ehci->regs->port_status [index]);
 
        } else
-               dbg ("%s port %d high speed",
-                       hcd_to_bus (&ehci->hcd)->bus_name,
-                       index + 1);
+               ehci_dbg (ehci, "port %d high speed\n", index + 1);
 
        return port_status;
 }
@@ -277,7 +274,7 @@
 #ifndef        EHCI_VERBOSE_DEBUG
        if (status & ~0xffff)   /* only if wPortChange is interesting */
 #endif
-               dbg_port (hcd, "GetStatus", wIndex + 1, temp);
+               dbg_port (ehci, "GetStatus", wIndex + 1, temp);
                // we "know" this alignment is good, caller used kmalloc()...
                *((u32 *) buf) = cpu_to_le32 (status);
                break;
@@ -313,14 +310,12 @@
                        /* line status bits may report this as low speed */
                        if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECT
                                        && PORT_USB11 (temp)) {
-                               dbg ("%s port %d low speed, give to companion",
-                                       hcd_to_bus (&ehci->hcd)->bus_name,
+                               ehci_dbg (ehci,
+                                       "port %d low speed --> companion\n",
                                        wIndex + 1);
                                temp |= PORT_OWNER;
                        } else {
-                               vdbg ("%s port %d reset",
-                                       hcd_to_bus (&ehci->hcd)->bus_name,
-                                       wIndex + 1);
+                               ehci_vdbg (ehci, "port %d reset", wIndex + 1);
                                temp |= PORT_RESET;
                                temp &= ~PORT_PE;
 
diff -Nru a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
--- a/drivers/usb/host/ehci-mem.c       Sun Dec  1 23:06:05 2002
+++ b/drivers/usb/host/ehci-mem.c       Sun Dec  1 23:06:05 2002
@@ -103,7 +103,7 @@
        /* dummy td enables safe urb queuing */
        qh->dummy = ehci_qtd_alloc (ehci, flags);
        if (qh->dummy == 0) {
-               dbg ("no dummy td");
+               ehci_dbg (ehci, "no dummy td\n");
                pci_pool_free (ehci->qh_pool, qh, qh->qh_dma);
                qh = 0;
        }
@@ -113,19 +113,17 @@
 /* to share a qh (cpu threads, or hc) */
 static inline struct ehci_qh *qh_get (/* ehci, */ struct ehci_qh *qh)
 {
-       // dbg ("get %p (%d++)", qh, qh->refcount.counter);
        atomic_inc (&qh->refcount);
        return qh;
 }
 
 static void qh_put (struct ehci_hcd *ehci, struct ehci_qh *qh)
 {
-       // dbg ("put %p (--%d)", qh, qh->refcount.counter);
        if (!atomic_dec_and_test (&qh->refcount))
                return;
        /* clean qtds first, and know this is not linked */
        if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) {
-               dbg ("unused qh not empty!");
+               ehci_dbg (ehci, "unused qh not empty!\n");
                BUG ();
        }
        if (qh->dummy)
diff -Nru a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
--- a/drivers/usb/host/ehci-q.c Sun Dec  1 23:06:05 2002
+++ b/drivers/usb/host/ehci-q.c Sun Dec  1 23:06:05 2002
@@ -130,8 +130,9 @@
                else    /* unknown */
                        urb->status = -EPROTO;
 
-               dbg ("ep %d-%s qtd token %08x --> status %d",
-                       /* devpath */
+               ehci_vdbg (ehci,
+                       "dev%d ep%d%s qtd token %08x --> status %d\n",
+                       usb_pipedev (urb->pipe),
                        usb_pipeendpoint (urb->pipe),
                        usb_pipein (urb->pipe) ? "in" : "out",
                        token, urb->status);


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to