aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore/wa-rpipe.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:22:50 -0500
committerDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:22:50 -0500
commitbce83697c5fe84a7a5d38c96fbbe43b4bc028c3e (patch)
treeb8e920af66f5b4de509e95a7295cedbe42878dd6 /drivers/usb/wusbcore/wa-rpipe.c
parent02f11ee181baa562df23e105ba930902f0d0b1bf (diff)
uwb: use dev_dbg() for debug messages
Instead of the home-grown d_fnstart(), d_fnend() and d_printf() macros, use dev_dbg() or remove the message entirely. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/usb/wusbcore/wa-rpipe.c')
-rw-r--r--drivers/usb/wusbcore/wa-rpipe.c68
1 files changed, 17 insertions, 51 deletions
diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c
index f18e4aae66e9..7369655f69cd 100644
--- a/drivers/usb/wusbcore/wa-rpipe.c
+++ b/drivers/usb/wusbcore/wa-rpipe.c
@@ -60,13 +60,10 @@
60#include <linux/init.h> 60#include <linux/init.h>
61#include <asm/atomic.h> 61#include <asm/atomic.h>
62#include <linux/bitmap.h> 62#include <linux/bitmap.h>
63
63#include "wusbhc.h" 64#include "wusbhc.h"
64#include "wa-hc.h" 65#include "wa-hc.h"
65 66
66#define D_LOCAL 0
67#include <linux/uwb/debug.h>
68
69
70static int __rpipe_get_descr(struct wahc *wa, 67static int __rpipe_get_descr(struct wahc *wa,
71 struct usb_rpipe_descriptor *descr, u16 index) 68 struct usb_rpipe_descriptor *descr, u16 index)
72{ 69{
@@ -76,7 +73,6 @@ static int __rpipe_get_descr(struct wahc *wa,
76 /* Get the RPIPE descriptor -- we cannot use the usb_get_descriptor() 73 /* Get the RPIPE descriptor -- we cannot use the usb_get_descriptor()
77 * function because the arguments are different. 74 * function because the arguments are different.
78 */ 75 */
79 d_printf(1, dev, "rpipe %u: get descr\n", index);
80 result = usb_control_msg( 76 result = usb_control_msg(
81 wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0), 77 wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0),
82 USB_REQ_GET_DESCRIPTOR, 78 USB_REQ_GET_DESCRIPTOR,
@@ -115,7 +111,6 @@ static int __rpipe_set_descr(struct wahc *wa,
115 /* we cannot use the usb_get_descriptor() function because the 111 /* we cannot use the usb_get_descriptor() function because the
116 * arguments are different. 112 * arguments are different.
117 */ 113 */
118 d_printf(1, dev, "rpipe %u: set descr\n", index);
119 result = usb_control_msg( 114 result = usb_control_msg(
120 wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0), 115 wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
121 USB_REQ_SET_DESCRIPTOR, 116 USB_REQ_SET_DESCRIPTOR,
@@ -174,13 +169,12 @@ void rpipe_destroy(struct kref *_rpipe)
174{ 169{
175 struct wa_rpipe *rpipe = container_of(_rpipe, struct wa_rpipe, refcnt); 170 struct wa_rpipe *rpipe = container_of(_rpipe, struct wa_rpipe, refcnt);
176 u8 index = le16_to_cpu(rpipe->descr.wRPipeIndex); 171 u8 index = le16_to_cpu(rpipe->descr.wRPipeIndex);
177 d_fnstart(1, NULL, "(rpipe %p %u)\n", rpipe, index); 172
178 if (rpipe->ep) 173 if (rpipe->ep)
179 rpipe->ep->hcpriv = NULL; 174 rpipe->ep->hcpriv = NULL;
180 rpipe_put_idx(rpipe->wa, index); 175 rpipe_put_idx(rpipe->wa, index);
181 wa_put(rpipe->wa); 176 wa_put(rpipe->wa);
182 kfree(rpipe); 177 kfree(rpipe);
183 d_fnend(1, NULL, "(rpipe %p %u)\n", rpipe, index);
184} 178}
185EXPORT_SYMBOL_GPL(rpipe_destroy); 179EXPORT_SYMBOL_GPL(rpipe_destroy);
186 180
@@ -202,7 +196,6 @@ static int rpipe_get_idle(struct wa_rpipe **prpipe, struct wahc *wa, u8 crs,
202 struct wa_rpipe *rpipe; 196 struct wa_rpipe *rpipe;
203 struct device *dev = &wa->usb_iface->dev; 197 struct device *dev = &wa->usb_iface->dev;
204 198
205 d_fnstart(3, dev, "(wa %p crs 0x%02x)\n", wa, crs);
206 rpipe = kzalloc(sizeof(*rpipe), gfp); 199 rpipe = kzalloc(sizeof(*rpipe), gfp);
207 if (rpipe == NULL) 200 if (rpipe == NULL)
208 return -ENOMEM; 201 return -ENOMEM;
@@ -223,14 +216,12 @@ static int rpipe_get_idle(struct wa_rpipe **prpipe, struct wahc *wa, u8 crs,
223 } 216 }
224 *prpipe = NULL; 217 *prpipe = NULL;
225 kfree(rpipe); 218 kfree(rpipe);
226 d_fnend(3, dev, "(wa %p crs 0x%02x) = -ENXIO\n", wa, crs);
227 return -ENXIO; 219 return -ENXIO;
228 220
229found: 221found:
230 set_bit(rpipe_idx, wa->rpipe_bm); 222 set_bit(rpipe_idx, wa->rpipe_bm);
231 rpipe->wa = wa_get(wa); 223 rpipe->wa = wa_get(wa);
232 *prpipe = rpipe; 224 *prpipe = rpipe;
233 d_fnstart(3, dev, "(wa %p crs 0x%02x) = 0\n", wa, crs);
234 return 0; 225 return 0;
235} 226}
236 227
@@ -239,7 +230,6 @@ static int __rpipe_reset(struct wahc *wa, unsigned index)
239 int result; 230 int result;
240 struct device *dev = &wa->usb_iface->dev; 231 struct device *dev = &wa->usb_iface->dev;
241 232
242 d_printf(1, dev, "rpipe %u: reset\n", index);
243 result = usb_control_msg( 233 result = usb_control_msg(
244 wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0), 234 wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
245 USB_REQ_RPIPE_RESET, 235 USB_REQ_RPIPE_RESET,
@@ -276,7 +266,6 @@ static struct usb_wireless_ep_comp_descriptor *rpipe_epc_find(
276 struct usb_descriptor_header *hdr; 266 struct usb_descriptor_header *hdr;
277 struct usb_wireless_ep_comp_descriptor *epcd; 267 struct usb_wireless_ep_comp_descriptor *epcd;
278 268
279 d_fnstart(3, dev, "(ep %p)\n", ep);
280 if (ep->desc.bEndpointAddress == 0) { 269 if (ep->desc.bEndpointAddress == 0) {
281 epcd = &epc0; 270 epcd = &epc0;
282 goto out; 271 goto out;
@@ -310,7 +299,6 @@ static struct usb_wireless_ep_comp_descriptor *rpipe_epc_find(
310 itr_size -= hdr->bDescriptorType; 299 itr_size -= hdr->bDescriptorType;
311 } 300 }
312out: 301out:
313 d_fnend(3, dev, "(ep %p) = %p\n", ep, epcd);
314 return epcd; 302 return epcd;
315} 303}
316 304
@@ -329,8 +317,6 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
329 struct usb_wireless_ep_comp_descriptor *epcd; 317 struct usb_wireless_ep_comp_descriptor *epcd;
330 u8 unauth; 318 u8 unauth;
331 319
332 d_fnstart(3, dev, "(rpipe %p wa %p ep %p, urb %p)\n",
333 rpipe, wa, ep, urb);
334 epcd = rpipe_epc_find(dev, ep); 320 epcd = rpipe_epc_find(dev, ep);
335 if (epcd == NULL) { 321 if (epcd == NULL) {
336 dev_err(dev, "ep 0x%02x: can't find companion descriptor\n", 322 dev_err(dev, "ep 0x%02x: can't find companion descriptor\n",
@@ -350,10 +336,12 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
350 /* FIXME: use maximum speed as supported or recommended by device */ 336 /* FIXME: use maximum speed as supported or recommended by device */
351 rpipe->descr.bSpeed = usb_pipeendpoint(urb->pipe) == 0 ? 337 rpipe->descr.bSpeed = usb_pipeendpoint(urb->pipe) == 0 ?
352 UWB_PHY_RATE_53 : UWB_PHY_RATE_200; 338 UWB_PHY_RATE_53 : UWB_PHY_RATE_200;
353 d_printf(2, dev, "addr %u (0x%02x) rpipe #%u ep# %u speed %d\n", 339
354 urb->dev->devnum, urb->dev->devnum | unauth, 340 dev_dbg(dev, "addr %u (0x%02x) rpipe #%u ep# %u speed %d\n",
355 le16_to_cpu(rpipe->descr.wRPipeIndex), 341 urb->dev->devnum, urb->dev->devnum | unauth,
356 usb_pipeendpoint(urb->pipe), rpipe->descr.bSpeed); 342 le16_to_cpu(rpipe->descr.wRPipeIndex),
343 usb_pipeendpoint(urb->pipe), rpipe->descr.bSpeed);
344
357 /* see security.c:wusb_update_address() */ 345 /* see security.c:wusb_update_address() */
358 if (unlikely(urb->dev->devnum == 0x80)) 346 if (unlikely(urb->dev->devnum == 0x80))
359 rpipe->descr.bDeviceAddress = 0; 347 rpipe->descr.bDeviceAddress = 0;
@@ -384,8 +372,6 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
384 } 372 }
385 result = 0; 373 result = 0;
386error: 374error:
387 d_fnend(3, dev, "(rpipe %p wa %p ep %p urb %p) = %d\n",
388 rpipe, wa, ep, urb, result);
389 return result; 375 return result;
390} 376}
391 377
@@ -405,8 +391,6 @@ static int rpipe_check_aim(const struct wa_rpipe *rpipe, const struct wahc *wa,
405 u8 unauth = (usb_dev->wusb && !usb_dev->authenticated) ? 0x80 : 0; 391 u8 unauth = (usb_dev->wusb && !usb_dev->authenticated) ? 0x80 : 0;
406 u8 portnum = wusb_port_no_to_idx(urb->dev->portnum); 392 u8 portnum = wusb_port_no_to_idx(urb->dev->portnum);
407 393
408 d_fnstart(3, dev, "(rpipe %p wa %p ep %p, urb %p)\n",
409 rpipe, wa, ep, urb);
410#define AIM_CHECK(rdf, val, text) \ 394#define AIM_CHECK(rdf, val, text) \
411 do { \ 395 do { \
412 if (rpipe->descr.rdf != (val)) { \ 396 if (rpipe->descr.rdf != (val)) { \
@@ -451,8 +435,6 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep,
451 struct wa_rpipe *rpipe; 435 struct wa_rpipe *rpipe;
452 u8 eptype; 436 u8 eptype;
453 437
454 d_fnstart(3, dev, "(wa %p ep %p urb %p gfp 0x%08x)\n", wa, ep, urb,
455 gfp);
456 mutex_lock(&wa->rpipe_mutex); 438 mutex_lock(&wa->rpipe_mutex);
457 rpipe = ep->hcpriv; 439 rpipe = ep->hcpriv;
458 if (rpipe != NULL) { 440 if (rpipe != NULL) {
@@ -462,9 +444,9 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep,
462 goto error; 444 goto error;
463 } 445 }
464 __rpipe_get(rpipe); 446 __rpipe_get(rpipe);
465 d_printf(2, dev, "ep 0x%02x: reusing rpipe %u\n", 447 dev_dbg(dev, "ep 0x%02x: reusing rpipe %u\n",
466 ep->desc.bEndpointAddress, 448 ep->desc.bEndpointAddress,
467 le16_to_cpu(rpipe->descr.wRPipeIndex)); 449 le16_to_cpu(rpipe->descr.wRPipeIndex));
468 } else { 450 } else {
469 /* hmm, assign idle rpipe, aim it */ 451 /* hmm, assign idle rpipe, aim it */
470 result = -ENOBUFS; 452 result = -ENOBUFS;
@@ -480,14 +462,12 @@ int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep,
480 ep->hcpriv = rpipe; 462 ep->hcpriv = rpipe;
481 rpipe->ep = ep; 463 rpipe->ep = ep;
482 __rpipe_get(rpipe); /* for caching into ep->hcpriv */ 464 __rpipe_get(rpipe); /* for caching into ep->hcpriv */
483 d_printf(2, dev, "ep 0x%02x: using rpipe %u\n", 465 dev_dbg(dev, "ep 0x%02x: using rpipe %u\n",
484 ep->desc.bEndpointAddress, 466 ep->desc.bEndpointAddress,
485 le16_to_cpu(rpipe->descr.wRPipeIndex)); 467 le16_to_cpu(rpipe->descr.wRPipeIndex));
486 } 468 }
487 d_dump(4, dev, &rpipe->descr, sizeof(rpipe->descr));
488error: 469error:
489 mutex_unlock(&wa->rpipe_mutex); 470 mutex_unlock(&wa->rpipe_mutex);
490 d_fnend(3, dev, "(wa %p ep %p urb %p gfp 0x%08x)\n", wa, ep, urb, gfp);
491 return result; 471 return result;
492} 472}
493 473
@@ -507,7 +487,7 @@ int wa_rpipes_create(struct wahc *wa)
507void wa_rpipes_destroy(struct wahc *wa) 487void wa_rpipes_destroy(struct wahc *wa)
508{ 488{
509 struct device *dev = &wa->usb_iface->dev; 489 struct device *dev = &wa->usb_iface->dev;
510 d_fnstart(3, dev, "(wa %p)\n", wa); 490
511 if (!bitmap_empty(wa->rpipe_bm, wa->rpipes)) { 491 if (!bitmap_empty(wa->rpipe_bm, wa->rpipes)) {
512 char buf[256]; 492 char buf[256];
513 WARN_ON(1); 493 WARN_ON(1);
@@ -515,7 +495,6 @@ void wa_rpipes_destroy(struct wahc *wa)
515 dev_err(dev, "BUG: pipes not released on exit: %s\n", buf); 495 dev_err(dev, "BUG: pipes not released on exit: %s\n", buf);
516 } 496 }
517 kfree(wa->rpipe_bm); 497 kfree(wa->rpipe_bm);
518 d_fnend(3, dev, "(wa %p)\n", wa);
519} 498}
520 499
521/* 500/*
@@ -530,33 +509,20 @@ void wa_rpipes_destroy(struct wahc *wa)
530 */ 509 */
531void rpipe_ep_disable(struct wahc *wa, struct usb_host_endpoint *ep) 510void rpipe_ep_disable(struct wahc *wa, struct usb_host_endpoint *ep)
532{ 511{
533 struct device *dev = &wa->usb_iface->dev;
534 struct wa_rpipe *rpipe; 512 struct wa_rpipe *rpipe;
535 d_fnstart(2, dev, "(wa %p ep %p)\n", wa, ep); 513
536 mutex_lock(&wa->rpipe_mutex); 514 mutex_lock(&wa->rpipe_mutex);
537 rpipe = ep->hcpriv; 515 rpipe = ep->hcpriv;
538 if (rpipe != NULL) { 516 if (rpipe != NULL) {
539 unsigned rc = atomic_read(&rpipe->refcnt.refcount);
540 int result;
541 u16 index = le16_to_cpu(rpipe->descr.wRPipeIndex); 517 u16 index = le16_to_cpu(rpipe->descr.wRPipeIndex);
542 518
543 if (rc != 1) 519 usb_control_msg(
544 d_printf(1, dev, "(wa %p ep %p) rpipe %p refcnt %u\n",
545 wa, ep, rpipe, rc);
546
547 d_printf(1, dev, "rpipe %u: abort\n", index);
548 result = usb_control_msg(
549 wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0), 520 wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0),
550 USB_REQ_RPIPE_ABORT, 521 USB_REQ_RPIPE_ABORT,
551 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE, 522 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE,
552 0, index, NULL, 0, 1000 /* FIXME: arbitrary */); 523 0, index, NULL, 0, 1000 /* FIXME: arbitrary */);
553 if (result < 0 && result != -ENODEV /* dev is gone */)
554 d_printf(1, dev, "(wa %p rpipe %u): abort failed: %d\n",
555 wa, index, result);
556 rpipe_put(rpipe); 524 rpipe_put(rpipe);
557 } 525 }
558 mutex_unlock(&wa->rpipe_mutex); 526 mutex_unlock(&wa->rpipe_mutex);
559 d_fnend(2, dev, "(wa %p ep %p)\n", wa, ep);
560 return;
561} 527}
562EXPORT_SYMBOL_GPL(rpipe_ep_disable); 528EXPORT_SYMBOL_GPL(rpipe_ep_disable);