Merge branch 'master' into for-next
[linux-2.6.git] / drivers / usb / wusbcore / wa-xfer.c
index c038635..608d61a 100644 (file)
  *     xfers-per-ripe, blocks-per-rpipe, rpipes-per-host), at the end
  *     we are going to have to rebuild all this based on an scheduler,
  *     to where we have a list of transactions to do and based on the
- *     availability of the different requried components (blocks,
+ *     availability of the different required components (blocks,
  *     rpipes, segment slots, etc), we go scheduling them. Painful.
  */
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <linux/slab.h>
 #include <linux/hash.h>
+
 #include "wa-hc.h"
 #include "wusbhc.h"
 
-#undef D_LOCAL
-#define D_LOCAL 0 /* 0 disabled, > 0 different levels... */
-#include <linux/uwb/debug.h>
-
 enum {
        WA_SEGS_MAX = 255,
 };
@@ -180,7 +178,6 @@ static void wa_xfer_destroy(struct kref *_xfer)
                }
        }
        kfree(xfer);
-       d_printf(2, NULL, "xfer %p destroyed\n", xfer);
 }
 
 static void wa_xfer_get(struct wa_xfer *xfer)
@@ -190,10 +187,7 @@ static void wa_xfer_get(struct wa_xfer *xfer)
 
 static void wa_xfer_put(struct wa_xfer *xfer)
 {
-       d_fnstart(3, NULL, "(xfer %p) -- ref count bef put %d\n",
-                   xfer, atomic_read(&xfer->refcnt.refcount));
        kref_put(&xfer->refcnt, wa_xfer_destroy);
-       d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
 }
 
 /*
@@ -209,7 +203,7 @@ static void wa_xfer_put(struct wa_xfer *xfer)
 static void wa_xfer_giveback(struct wa_xfer *xfer)
 {
        unsigned long flags;
-       d_fnstart(3, NULL, "(xfer %p)\n", xfer);
+
        spin_lock_irqsave(&xfer->wa->xfer_list_lock, flags);
        list_del_init(&xfer->list_node);
        spin_unlock_irqrestore(&xfer->wa->xfer_list_lock, flags);
@@ -217,7 +211,6 @@ static void wa_xfer_giveback(struct wa_xfer *xfer)
        wusbhc_giveback_urb(xfer->wa->wusb, xfer->urb, xfer->result);
        wa_put(xfer->wa);
        wa_xfer_put(xfer);
-       d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
 }
 
 /*
@@ -227,13 +220,10 @@ static void wa_xfer_giveback(struct wa_xfer *xfer)
  */
 static void wa_xfer_completion(struct wa_xfer *xfer)
 {
-       d_fnstart(3, NULL, "(xfer %p)\n", xfer);
        if (xfer->wusb_dev)
                wusb_dev_put(xfer->wusb_dev);
        rpipe_put(xfer->ep->hcpriv);
        wa_xfer_giveback(xfer);
-       d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
-       return;
 }
 
 /*
@@ -243,12 +233,12 @@ static void wa_xfer_completion(struct wa_xfer *xfer)
  */
 static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
 {
+       struct device *dev = &xfer->wa->usb_iface->dev;
        unsigned result, cnt;
        struct wa_seg *seg;
        struct urb *urb = xfer->urb;
        unsigned found_short = 0;
 
-       d_fnstart(3, NULL, "(xfer %p)\n", xfer);
        result = xfer->segs_done == xfer->segs_submitted;
        if (result == 0)
                goto out;
@@ -258,10 +248,8 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
                switch (seg->status) {
                case WA_SEG_DONE:
                        if (found_short && seg->result > 0) {
-                               if (printk_ratelimit())
-                                       printk(KERN_ERR "xfer %p#%u: bad short "
-                                              "segments (%zu)\n", xfer, cnt,
-                                              seg->result);
+                               dev_dbg(dev, "xfer %p#%u: bad short segments (%zu)\n",
+                                       xfer, cnt, seg->result);
                                urb->status = -EINVAL;
                                goto out;
                        }
@@ -269,36 +257,30 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
                        if (seg->result < xfer->seg_size
                            && cnt != xfer->segs-1)
                                found_short = 1;
-                       d_printf(2, NULL, "xfer %p#%u: DONE short %d "
-                                "result %zu urb->actual_length %d\n",
-                                xfer, seg->index, found_short, seg->result,
-                                urb->actual_length);
+                       dev_dbg(dev, "xfer %p#%u: DONE short %d "
+                               "result %zu urb->actual_length %d\n",
+                               xfer, seg->index, found_short, seg->result,
+                               urb->actual_length);
                        break;
                case WA_SEG_ERROR:
                        xfer->result = seg->result;
-                       d_printf(2, NULL, "xfer %p#%u: ERROR result %zu\n",
-                                xfer, seg->index, seg->result);
+                       dev_dbg(dev, "xfer %p#%u: ERROR result %zu\n",
+                               xfer, seg->index, seg->result);
                        goto out;
                case WA_SEG_ABORTED:
-                       WARN_ON(urb->status != -ECONNRESET
-                               && urb->status != -ENOENT);
-                       d_printf(2, NULL, "xfer %p#%u ABORTED: result %d\n",
-                                xfer, seg->index, urb->status);
+                       dev_dbg(dev, "xfer %p#%u ABORTED: result %d\n",
+                               xfer, seg->index, urb->status);
                        xfer->result = urb->status;
                        goto out;
                default:
-                       /* if (printk_ratelimit()) */
-                               printk(KERN_ERR "xfer %p#%u: "
-                                      "is_done bad state %d\n",
-                                      xfer, cnt, seg->status);
+                       dev_warn(dev, "xfer %p#%u: is_done bad state %d\n",
+                                xfer, cnt, seg->status);
                        xfer->result = -EINVAL;
-                       WARN_ON(1);
                        goto out;
                }
        }
        xfer->result = 0;
 out:
-       d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
        return result;
 }
 
@@ -424,8 +406,6 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
        struct urb *urb = xfer->urb;
        struct wa_rpipe *rpipe = xfer->ep->hcpriv;
 
-       d_fnstart(3, dev, "(xfer %p [rpipe %p] urb %p)\n",
-                 xfer, rpipe, urb);
        switch (rpipe->descr.bmAttribute & 0x3) {
        case USB_ENDPOINT_XFER_CONTROL:
                *pxfer_type = WA_XFER_TYPE_CTL;
@@ -472,12 +452,10 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
        if (xfer->segs == 0 && *pxfer_type == WA_XFER_TYPE_CTL)
                xfer->segs = 1;
 error:
-       d_fnend(3, dev, "(xfer %p [rpipe %p] urb %p) = %d\n",
-               xfer, rpipe, urb, (int)result);
        return result;
 }
 
-/** Fill in the common request header and xfer-type specific data. */
+/* Fill in the common request header and xfer-type specific data. */
 static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer,
                                 struct wa_xfer_hdr *xfer_hdr0,
                                 enum wa_xfer_type xfer_type,
@@ -534,14 +512,13 @@ static void wa_seg_dto_cb(struct urb *urb)
        unsigned rpipe_ready = 0;
        u8 done = 0;
 
-       d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
        switch (urb->status) {
        case 0:
                spin_lock_irqsave(&xfer->lock, flags);
                wa = xfer->wa;
                dev = &wa->usb_iface->dev;
-               d_printf(2, dev, "xfer %p#%u: data out done (%d bytes)\n",
-                          xfer, seg->index, urb->actual_length);
+               dev_dbg(dev, "xfer %p#%u: data out done (%d bytes)\n",
+                       xfer, seg->index, urb->actual_length);
                if (seg->status < WA_SEG_PENDING)
                        seg->status = WA_SEG_PENDING;
                seg->result = urb->actual_length;
@@ -555,9 +532,8 @@ static void wa_seg_dto_cb(struct urb *urb)
                wa = xfer->wa;
                dev = &wa->usb_iface->dev;
                rpipe = xfer->ep->hcpriv;
-               if (printk_ratelimit())
-                       dev_err(dev, "xfer %p#%u: data out error %d\n",
-                               xfer, seg->index, urb->status);
+               dev_dbg(dev, "xfer %p#%u: data out error %d\n",
+                       xfer, seg->index, urb->status);
                if (edc_inc(&wa->nep_edc, EDC_MAX_ERRORS,
                            EDC_ERROR_TIMEFRAME)){
                        dev_err(dev, "DTO: URB max acceptable errors "
@@ -578,13 +554,12 @@ static void wa_seg_dto_cb(struct urb *urb)
                if (rpipe_ready)
                        wa_xfer_delayed_run(rpipe);
        }
-       d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
 }
 
 /*
  * Callback for the segment request
  *
- * If succesful transition state (unless already transitioned or
+ * If successful transition state (unless already transitioned or
  * outbound transfer); otherwise, take a note of the error, mark this
  * segment done and try completion.
  *
@@ -610,14 +585,12 @@ static void wa_seg_cb(struct urb *urb)
        unsigned rpipe_ready;
        u8 done = 0;
 
-       d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
        switch (urb->status) {
        case 0:
                spin_lock_irqsave(&xfer->lock, flags);
                wa = xfer->wa;
                dev = &wa->usb_iface->dev;
-               d_printf(2, dev, "xfer %p#%u: request done\n",
-                          xfer, seg->index);
+               dev_dbg(dev, "xfer %p#%u: request done\n", xfer, seg->index);
                if (xfer->is_inbound && seg->status < WA_SEG_PENDING)
                        seg->status = WA_SEG_PENDING;
                spin_unlock_irqrestore(&xfer->lock, flags);
@@ -652,7 +625,6 @@ static void wa_seg_cb(struct urb *urb)
                if (rpipe_ready)
                        wa_xfer_delayed_run(rpipe);
        }
-       d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
 }
 
 /*
@@ -750,9 +722,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb)
        size_t xfer_hdr_size, cnt, transfer_size;
        struct wa_xfer_hdr *xfer_hdr0, *xfer_hdr;
 
-       d_fnstart(3, dev, "(xfer %p [rpipe %p] urb %p)\n",
-                 xfer, xfer->ep->hcpriv, urb);
-
        result = __wa_xfer_setup_sizes(xfer, &xfer_type);
        if (result < 0)
                goto error_setup_sizes;
@@ -788,8 +757,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb)
        result = 0;
 error_setup_segs:
 error_setup_sizes:
-       d_fnend(3, dev, "(xfer %p [rpipe %p] urb %p) = %d\n",
-               xfer, xfer->ep->hcpriv, urb, result);
        return result;
 }
 
@@ -843,9 +810,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
        struct wa_xfer *xfer;
        unsigned long flags;
 
-       d_fnstart(1, dev, "(rpipe #%d) %d segments available\n",
-                 le16_to_cpu(rpipe->descr.wRPipeIndex),
-                 atomic_read(&rpipe->segs_available));
        spin_lock_irqsave(&rpipe->seg_lock, flags);
        while (atomic_read(&rpipe->segs_available) > 0
              && !list_empty(&rpipe->seg_list)) {
@@ -854,10 +818,8 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
                list_del(&seg->list_node);
                xfer = seg->xfer;
                result = __wa_seg_submit(rpipe, xfer, seg);
-               d_printf(1, dev, "xfer %p#%u submitted from delayed "
-                        "[%d segments available] %d\n",
-                        xfer, seg->index,
-                        atomic_read(&rpipe->segs_available), result);
+               dev_dbg(dev, "xfer %p#%u submitted from delayed [%d segments available] %d\n",
+                       xfer, seg->index, atomic_read(&rpipe->segs_available), result);
                if (unlikely(result < 0)) {
                        spin_unlock_irqrestore(&rpipe->seg_lock, flags);
                        spin_lock_irqsave(&xfer->lock, flags);
@@ -868,10 +830,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
                }
        }
        spin_unlock_irqrestore(&rpipe->seg_lock, flags);
-       d_fnend(1, dev, "(rpipe #%d) = void, %d segments available\n",
-               le16_to_cpu(rpipe->descr.wRPipeIndex),
-               atomic_read(&rpipe->segs_available));
-
 }
 
 /*
@@ -894,9 +852,6 @@ static int __wa_xfer_submit(struct wa_xfer *xfer)
        u8 available;
        u8 empty;
 
-       d_fnstart(3, dev, "(xfer %p [rpipe %p])\n",
-                 xfer, xfer->ep->hcpriv);
-
        spin_lock_irqsave(&wa->xfer_list_lock, flags);
        list_add_tail(&xfer->list_node, &wa->xfer_list);
        spin_unlock_irqrestore(&wa->xfer_list_lock, flags);
@@ -908,30 +863,24 @@ static int __wa_xfer_submit(struct wa_xfer *xfer)
                available = atomic_read(&rpipe->segs_available);
                empty = list_empty(&rpipe->seg_list);
                seg = xfer->seg[cnt];
-               d_printf(2, dev, "xfer %p#%u: available %u empty %u (%s)\n",
-                        xfer, cnt, available, empty,
-                        available == 0 || !empty ? "delayed" : "submitted");
+               dev_dbg(dev, "xfer %p#%u: available %u empty %u (%s)\n",
+                       xfer, cnt, available, empty,
+                       available == 0 || !empty ? "delayed" : "submitted");
                if (available == 0 || !empty) {
-                       d_printf(1, dev, "xfer %p#%u: delayed\n", xfer, cnt);
+                       dev_dbg(dev, "xfer %p#%u: delayed\n", xfer, cnt);
                        seg->status = WA_SEG_DELAYED;
                        list_add_tail(&seg->list_node, &rpipe->seg_list);
                } else {
                        result = __wa_seg_submit(rpipe, xfer, seg);
-                       if (result < 0)
+                       if (result < 0) {
+                               __wa_xfer_abort(xfer);
                                goto error_seg_submit;
+                       }
                }
                xfer->segs_submitted++;
        }
-       spin_unlock_irqrestore(&rpipe->seg_lock, flags);
-       d_fnend(3, dev, "(xfer %p [rpipe %p]) = void\n", xfer,
-               xfer->ep->hcpriv);
-       return result;
-
 error_seg_submit:
-       __wa_xfer_abort(xfer);
        spin_unlock_irqrestore(&rpipe->seg_lock, flags);
-       d_fnend(3, dev, "(xfer %p [rpipe %p]) = void\n", xfer,
-               xfer->ep->hcpriv);
        return result;
 }
 
@@ -964,19 +913,19 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
        struct urb *urb = xfer->urb;
        struct wahc *wa = xfer->wa;
        struct wusbhc *wusbhc = wa->wusb;
-       struct device *dev = &wa->usb_iface->dev;
        struct wusb_dev *wusb_dev;
        unsigned done;
 
-       d_fnstart(3, dev, "(wa %p urb %p)\n", wa, urb);
        result = rpipe_get_by_ep(wa, xfer->ep, urb, xfer->gfp);
        if (result < 0)
                goto error_rpipe_get;
        result = -ENODEV;
        /* FIXME: segmentation broken -- kills DWA */
        mutex_lock(&wusbhc->mutex);             /* get a WUSB dev */
-       if (urb->dev == NULL)
+       if (urb->dev == NULL) {
+               mutex_unlock(&wusbhc->mutex);
                goto error_dev_gone;
+       }
        wusb_dev = __wusb_dev_get_by_usb_dev(wusbhc, urb->dev);
        if (wusb_dev == NULL) {
                mutex_unlock(&wusbhc->mutex);
@@ -997,7 +946,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
        if (result < 0)
                goto error_xfer_submit;
        spin_unlock_irqrestore(&xfer->lock, flags);
-       d_fnend(3, dev, "(wa %p urb %p) = void\n", wa, urb);
        return;
 
        /* this is basically wa_xfer_completion() broken up wa_xfer_giveback()
@@ -1015,7 +963,6 @@ error_dev_gone:
 error_rpipe_get:
        xfer->result = result;
        wa_xfer_giveback(xfer);
-       d_fnend(3, dev, "(wa %p urb %p) = (void) %d\n", wa, urb, result);
        return;
 
 error_xfer_submit:
@@ -1024,8 +971,6 @@ error_xfer_submit:
        spin_unlock_irqrestore(&xfer->lock, flags);
        if (done)
                wa_xfer_completion(xfer);
-       d_fnend(3, dev, "(wa %p urb %p) = (void) %d\n", wa, urb, result);
-       return;
 }
 
 /*
@@ -1041,11 +986,9 @@ error_xfer_submit:
 void wa_urb_enqueue_run(struct work_struct *ws)
 {
        struct wahc *wa = container_of(ws, struct wahc, xfer_work);
-       struct device *dev = &wa->usb_iface->dev;
        struct wa_xfer *xfer, *next;
        struct urb *urb;
 
-       d_fnstart(3, dev, "(wa %p)\n", wa);
        spin_lock_irq(&wa->xfer_list_lock);
        list_for_each_entry_safe(xfer, next, &wa->xfer_delayed_list,
                                 list_node) {
@@ -1059,7 +1002,6 @@ void wa_urb_enqueue_run(struct work_struct *ws)
                spin_lock_irq(&wa->xfer_list_lock);
        }
        spin_unlock_irq(&wa->xfer_list_lock);
-       d_fnend(3, dev, "(wa %p) = void\n", wa);
 }
 EXPORT_SYMBOL_GPL(wa_urb_enqueue_run);
 
@@ -1084,9 +1026,6 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
        unsigned long my_flags;
        unsigned cant_sleep = irqs_disabled() | in_atomic();
 
-       d_fnstart(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x)\n",
-                 wa, ep, urb, urb->transfer_buffer_length, gfp);
-
        if (urb->transfer_buffer == NULL
            && !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
            && urb->transfer_buffer_length != 0) {
@@ -1108,11 +1047,13 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
        xfer->gfp = gfp;
        xfer->ep = ep;
        urb->hcpriv = xfer;
-       d_printf(2, dev, "xfer %p urb %p pipe 0x%02x [%d bytes] %s %s %s\n",
-                xfer, urb, urb->pipe, urb->transfer_buffer_length,
-                urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? "dma" : "nodma",
-                urb->pipe & USB_DIR_IN ? "inbound" : "outbound",
-                cant_sleep ? "deferred" : "inline");
+
+       dev_dbg(dev, "xfer %p urb %p pipe 0x%02x [%d bytes] %s %s %s\n",
+               xfer, urb, urb->pipe, urb->transfer_buffer_length,
+               urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? "dma" : "nodma",
+               urb->pipe & USB_DIR_IN ? "inbound" : "outbound",
+               cant_sleep ? "deferred" : "inline");
+
        if (cant_sleep) {
                usb_get_urb(urb);
                spin_lock_irqsave(&wa->xfer_list_lock, my_flags);
@@ -1122,15 +1063,11 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
        } else {
                wa_urb_enqueue_b(xfer);
        }
-       d_fnend(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x) = 0\n",
-               wa, ep, urb, urb->transfer_buffer_length, gfp);
        return 0;
 
 error_dequeued:
        kfree(xfer);
 error_kmalloc:
-       d_fnend(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x) = %d\n",
-               wa, ep, urb, urb->transfer_buffer_length, gfp, result);
        return result;
 }
 EXPORT_SYMBOL_GPL(wa_urb_enqueue);
@@ -1155,7 +1092,6 @@ EXPORT_SYMBOL_GPL(wa_urb_enqueue);
  */
 int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
 {
-       struct device *dev = &wa->usb_iface->dev;
        unsigned long flags, flags2;
        struct wa_xfer *xfer;
        struct wa_seg *seg;
@@ -1163,9 +1099,6 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
        unsigned cnt;
        unsigned rpipe_ready = 0;
 
-       d_fnstart(3, dev, "(wa %p, urb %p)\n", wa, urb);
-
-       d_printf(1, dev, "xfer %p urb %p: aborting\n", urb->hcpriv, urb);
        xfer = urb->hcpriv;
        if (xfer == NULL) {
                /* NOthing setup yet enqueue will see urb->status !=
@@ -1234,13 +1167,11 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
        wa_xfer_completion(xfer);
        if (rpipe_ready)
                wa_xfer_delayed_run(rpipe);
-       d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
        return 0;
 
 out_unlock:
        spin_unlock_irqrestore(&xfer->lock, flags);
 out:
-       d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
        return 0;
 
 dequeue_delayed:
@@ -1250,7 +1181,6 @@ dequeue_delayed:
        spin_unlock_irqrestore(&xfer->lock, flags);
        wa_xfer_giveback(xfer);
        usb_put_urb(urb);               /* we got a ref in enqueue() */
-       d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
        return 0;
 }
 EXPORT_SYMBOL_GPL(wa_urb_dequeue);
@@ -1326,7 +1256,6 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
        u8 usb_status;
        unsigned rpipe_ready = 0;
 
-       d_fnstart(3, dev, "(wa %p xfer %p)\n", wa, xfer);
        spin_lock_irqsave(&xfer->lock, flags);
        seg_idx = xfer_result->bTransferSegment & 0x7f;
        if (unlikely(seg_idx >= xfer->segs))
@@ -1334,8 +1263,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
        seg = xfer->seg[seg_idx];
        rpipe = xfer->ep->hcpriv;
        usb_status = xfer_result->bTransferStatus;
-       d_printf(2, dev, "xfer %p#%u: bTransferStatus 0x%02x (seg %u)\n",
-                xfer, seg_idx, usb_status, seg->status);
+       dev_dbg(dev, "xfer %p#%u: bTransferStatus 0x%02x (seg %u)\n",
+               xfer, seg_idx, usb_status, seg->status);
        if (seg->status == WA_SEG_ABORTED
            || seg->status == WA_SEG_ERROR)     /* already handled */
                goto segment_aborted;
@@ -1391,10 +1320,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
                wa_xfer_completion(xfer);
        if (rpipe_ready)
                wa_xfer_delayed_run(rpipe);
-       d_fnend(3, dev, "(wa %p xfer %p) = void\n", wa, xfer);
        return;
 
-
 error_submit_buf_in:
        if (edc_inc(&wa->dti_edc, EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
                dev_err(dev, "DTI: URB max acceptable errors "
@@ -1416,11 +1343,8 @@ error_complete:
                wa_xfer_completion(xfer);
        if (rpipe_ready)
                wa_xfer_delayed_run(rpipe);
-       d_fnend(3, dev, "(wa %p xfer %p) = void [segment/DTI-submit error]\n",
-               wa, xfer);
        return;
 
-
 error_bad_seg:
        spin_unlock_irqrestore(&xfer->lock, flags);
        wa_urb_dequeue(wa, xfer->urb);
@@ -1431,23 +1355,17 @@ error_bad_seg:
                        "exceeded, resetting device\n");
                wa_reset_all(wa);
        }
-       d_fnend(3, dev, "(wa %p xfer %p) = void [bad seg]\n", wa, xfer);
        return;
 
-
 segment_aborted:
        /* nothing to do, as the aborter did the completion */
        spin_unlock_irqrestore(&xfer->lock, flags);
-       d_fnend(3, dev, "(wa %p xfer %p) = void [segment aborted]\n",
-               wa, xfer);
-       return;
-
 }
 
 /*
  * Callback for the IN data phase
  *
- * If succesful transition state; otherwise, take a note of the
+ * If successful transition state; otherwise, take a note of the
  * error, mark this segment done and try completion.
  *
  * Note we don't access until we are sure that the transfer hasn't
@@ -1465,15 +1383,14 @@ static void wa_buf_in_cb(struct urb *urb)
        unsigned long flags;
        u8 done = 0;
 
-       d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
        switch (urb->status) {
        case 0:
                spin_lock_irqsave(&xfer->lock, flags);
                wa = xfer->wa;
                dev = &wa->usb_iface->dev;
                rpipe = xfer->ep->hcpriv;
-               d_printf(2, dev, "xfer %p#%u: data in done (%zu bytes)\n",
-                          xfer, seg->index, (size_t)urb->actual_length);
+               dev_dbg(dev, "xfer %p#%u: data in done (%zu bytes)\n",
+                       xfer, seg->index, (size_t)urb->actual_length);
                seg->status = WA_SEG_DONE;
                seg->result = urb->actual_length;
                xfer->segs_done++;
@@ -1514,7 +1431,6 @@ static void wa_buf_in_cb(struct urb *urb)
                if (rpipe_ready)
                        wa_xfer_delayed_run(rpipe);
        }
-       d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
 }
 
 /*
@@ -1553,14 +1469,12 @@ static void wa_xfer_result_cb(struct urb *urb)
        struct wa_xfer *xfer;
        u8 usb_status;
 
-       d_fnstart(3, dev, "(%p)\n", wa);
        BUG_ON(wa->dti_urb != urb);
        switch (wa->dti_urb->status) {
        case 0:
                /* We have a xfer result buffer; check it */
-               d_printf(2, dev, "DTI: xfer result %d bytes at %p\n",
-                          urb->actual_length, urb->transfer_buffer);
-               d_dump(3, dev, urb->transfer_buffer, urb->actual_length);
+               dev_dbg(dev, "DTI: xfer result %d bytes at %p\n",
+                       urb->actual_length, urb->transfer_buffer);
                if (wa->dti_urb->actual_length != sizeof(*xfer_result)) {
                        dev_err(dev, "DTI Error: xfer result--bad size "
                                "xfer result (%d bytes vs %zu needed)\n",
@@ -1622,7 +1536,6 @@ static void wa_xfer_result_cb(struct urb *urb)
                wa_reset_all(wa);
        }
 out:
-       d_fnend(3, dev, "(%p) = void\n", wa);
        return;
 }
 
@@ -1653,7 +1566,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)
        struct wa_notif_xfer *notif_xfer;
        const struct usb_endpoint_descriptor *dti_epd = wa->dti_epd;
 
-       d_fnstart(4, dev, "(%p, %p)\n", wa, notif_hdr);
        notif_xfer = container_of(notif_hdr, struct wa_notif_xfer, hdr);
        BUG_ON(notif_hdr->bNotifyType != WA_NOTIF_TRANSFER);
 
@@ -1693,7 +1605,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)
                goto error_dti_urb_submit;
        }
 out:
-       d_fnend(4, dev, "(%p, %p) = void\n", wa, notif_hdr);
        return;
 
 error_dti_urb_submit:
@@ -1704,6 +1615,4 @@ error_buf_in_urb_alloc:
 error_dti_urb_alloc:
 error:
        wa_reset_all(wa);
-       d_fnend(4, dev, "(%p, %p) = void\n", wa, notif_hdr);
-       return;
 }