aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore/devconnect.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/devconnect.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/devconnect.c')
-rw-r--r--drivers/usb/wusbcore/devconnect.c104
1 files changed, 16 insertions, 88 deletions
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index 26cbc89ea281..e2e7e4bc8463 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -91,10 +91,6 @@
91#include <linux/workqueue.h> 91#include <linux/workqueue.h>
92#include "wusbhc.h" 92#include "wusbhc.h"
93 93
94#undef D_LOCAL
95#define D_LOCAL 1
96#include <linux/uwb/debug.h>
97
98static void wusbhc_devconnect_acked_work(struct work_struct *work); 94static void wusbhc_devconnect_acked_work(struct work_struct *work);
99 95
100static void wusb_dev_free(struct wusb_dev *wusb_dev) 96static void wusb_dev_free(struct wusb_dev *wusb_dev)
@@ -234,6 +230,7 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
234 list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list); 230 list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list);
235 wusbhc->cack_count++; 231 wusbhc->cack_count++;
236 wusbhc_fill_cack_ie(wusbhc); 232 wusbhc_fill_cack_ie(wusbhc);
233
237 return wusb_dev; 234 return wusb_dev;
238} 235}
239 236
@@ -244,12 +241,9 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
244 */ 241 */
245static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) 242static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
246{ 243{
247 struct device *dev = wusbhc->dev;
248 d_fnstart(3, dev, "(wusbhc %p wusb_dev %p)\n", wusbhc, wusb_dev);
249 list_del_init(&wusb_dev->cack_node); 244 list_del_init(&wusb_dev->cack_node);
250 wusbhc->cack_count--; 245 wusbhc->cack_count--;
251 wusbhc_fill_cack_ie(wusbhc); 246 wusbhc_fill_cack_ie(wusbhc);
252 d_fnend(3, dev, "(wusbhc %p wusb_dev %p) = void\n", wusbhc, wusb_dev);
253} 247}
254 248
255/* 249/*
@@ -257,14 +251,11 @@ static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
257static 251static
258void wusbhc_devconnect_acked(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) 252void wusbhc_devconnect_acked(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
259{ 253{
260 struct device *dev = wusbhc->dev;
261 d_fnstart(3, dev, "(wusbhc %p wusb_dev %p)\n", wusbhc, wusb_dev);
262 wusbhc_cack_rm(wusbhc, wusb_dev); 254 wusbhc_cack_rm(wusbhc, wusb_dev);
263 if (wusbhc->cack_count) 255 if (wusbhc->cack_count)
264 wusbhc_mmcie_set(wusbhc, 0, 0, &wusbhc->cack_ie.hdr); 256 wusbhc_mmcie_set(wusbhc, 0, 0, &wusbhc->cack_ie.hdr);
265 else 257 else
266 wusbhc_mmcie_rm(wusbhc, &wusbhc->cack_ie.hdr); 258 wusbhc_mmcie_rm(wusbhc, &wusbhc->cack_ie.hdr);
267 d_fnend(3, dev, "(wusbhc %p wusb_dev %p) = void\n", wusbhc, wusb_dev);
268} 259}
269 260
270static void wusbhc_devconnect_acked_work(struct work_struct *work) 261static void wusbhc_devconnect_acked_work(struct work_struct *work)
@@ -314,7 +305,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
314 struct wusb_port *port; 305 struct wusb_port *port;
315 unsigned idx, devnum; 306 unsigned idx, devnum;
316 307
317 d_fnstart(3, dev, "(%p, %p, %s)\n", wusbhc, dnc, pr_cdid);
318 mutex_lock(&wusbhc->mutex); 308 mutex_lock(&wusbhc->mutex);
319 309
320 /* Check we are not handling it already */ 310 /* Check we are not handling it already */
@@ -367,7 +357,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
367 */ 357 */
368error_unlock: 358error_unlock:
369 mutex_unlock(&wusbhc->mutex); 359 mutex_unlock(&wusbhc->mutex);
370 d_fnend(3, dev, "(%p, %p, %s) = void\n", wusbhc, dnc, pr_cdid);
371 return; 360 return;
372 361
373} 362}
@@ -390,10 +379,8 @@ error_unlock:
390static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc, 379static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
391 struct wusb_port *port) 380 struct wusb_port *port)
392{ 381{
393 struct device *dev = wusbhc->dev;
394 struct wusb_dev *wusb_dev = port->wusb_dev; 382 struct wusb_dev *wusb_dev = port->wusb_dev;
395 383
396 d_fnstart(3, dev, "(wusbhc %p, port %p)\n", wusbhc, port);
397 port->status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE 384 port->status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE
398 | USB_PORT_STAT_SUSPEND | USB_PORT_STAT_RESET 385 | USB_PORT_STAT_SUSPEND | USB_PORT_STAT_RESET
399 | USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED); 386 | USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
@@ -410,7 +397,6 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
410 * section 6.2.11.2). */ 397 * section 6.2.11.2). */
411 wusbhc_gtk_rekey(wusbhc); 398 wusbhc_gtk_rekey(wusbhc);
412 399
413 d_fnend(3, dev, "(wusbhc %p, port %p) = void\n", wusbhc, port);
414 /* The Wireless USB part has forgotten about the device already; now 400 /* The Wireless USB part has forgotten about the device already; now
415 * khubd's timer will pick up the disconnection and remove the USB 401 * khubd's timer will pick up the disconnection and remove the USB
416 * device from the system 402 * device from the system
@@ -535,10 +521,6 @@ static struct wusb_dev *wusbhc_find_dev_by_addr(struct wusbhc *wusbhc, u8 addr)
535 */ 521 */
536static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) 522static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
537{ 523{
538 struct device *dev = wusbhc->dev;
539
540 d_printf(2, dev, "DN ALIVE: device 0x%02x pong\n", wusb_dev->addr);
541
542 mutex_lock(&wusbhc->mutex); 524 mutex_lock(&wusbhc->mutex);
543 wusb_dev->entry_ts = jiffies; 525 wusb_dev->entry_ts = jiffies;
544 __wusbhc_keep_alive(wusbhc); 526 __wusbhc_keep_alive(wusbhc);
@@ -571,11 +553,10 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc,
571 "no-beacon" 553 "no-beacon"
572 }; 554 };
573 555
574 d_fnstart(3, dev, "(%p, %p, %zu)\n", wusbhc, dn_hdr, size);
575 if (size < sizeof(*dnc)) { 556 if (size < sizeof(*dnc)) {
576 dev_err(dev, "DN CONNECT: short notification (%zu < %zu)\n", 557 dev_err(dev, "DN CONNECT: short notification (%zu < %zu)\n",
577 size, sizeof(*dnc)); 558 size, sizeof(*dnc));
578 goto out; 559 return;
579 } 560 }
580 561
581 dnc = container_of(dn_hdr, struct wusb_dn_connect, hdr); 562 dnc = container_of(dn_hdr, struct wusb_dn_connect, hdr);
@@ -587,10 +568,6 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc,
587 wusb_dn_connect_new_connection(dnc) ? "connect" : "reconnect"); 568 wusb_dn_connect_new_connection(dnc) ? "connect" : "reconnect");
588 /* ACK the connect */ 569 /* ACK the connect */
589 wusbhc_devconnect_ack(wusbhc, dnc, pr_cdid); 570 wusbhc_devconnect_ack(wusbhc, dnc, pr_cdid);
590out:
591 d_fnend(3, dev, "(%p, %p, %zu) = void\n",
592 wusbhc, dn_hdr, size);
593 return;
594} 571}
595 572
596/* 573/*
@@ -631,19 +608,17 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr,
631 struct device *dev = wusbhc->dev; 608 struct device *dev = wusbhc->dev;
632 struct wusb_dev *wusb_dev; 609 struct wusb_dev *wusb_dev;
633 610
634 d_fnstart(3, dev, "(%p, %p)\n", wusbhc, dn_hdr);
635
636 if (size < sizeof(struct wusb_dn_hdr)) { 611 if (size < sizeof(struct wusb_dn_hdr)) {
637 dev_err(dev, "DN data shorter than DN header (%d < %d)\n", 612 dev_err(dev, "DN data shorter than DN header (%d < %d)\n",
638 (int)size, (int)sizeof(struct wusb_dn_hdr)); 613 (int)size, (int)sizeof(struct wusb_dn_hdr));
639 goto out; 614 return;
640 } 615 }
641 616
642 wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr); 617 wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr);
643 if (wusb_dev == NULL && dn_hdr->bType != WUSB_DN_CONNECT) { 618 if (wusb_dev == NULL && dn_hdr->bType != WUSB_DN_CONNECT) {
644 dev_dbg(dev, "ignoring DN %d from unconnected device %02x\n", 619 dev_dbg(dev, "ignoring DN %d from unconnected device %02x\n",
645 dn_hdr->bType, srcaddr); 620 dn_hdr->bType, srcaddr);
646 goto out; 621 return;
647 } 622 }
648 623
649 switch (dn_hdr->bType) { 624 switch (dn_hdr->bType) {
@@ -668,9 +643,6 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr,
668 dev_warn(dev, "unknown DN %u (%d octets) from %u\n", 643 dev_warn(dev, "unknown DN %u (%d octets) from %u\n",
669 dn_hdr->bType, (int)size, srcaddr); 644 dn_hdr->bType, (int)size, srcaddr);
670 } 645 }
671out:
672 d_fnend(3, dev, "(%p, %p) = void\n", wusbhc, dn_hdr);
673 return;
674} 646}
675EXPORT_SYMBOL_GPL(wusbhc_handle_dn); 647EXPORT_SYMBOL_GPL(wusbhc_handle_dn);
676 648
@@ -700,59 +672,30 @@ void __wusbhc_dev_disable(struct wusbhc *wusbhc, u8 port_idx)
700 struct wusb_dev *wusb_dev; 672 struct wusb_dev *wusb_dev;
701 struct wuie_disconnect *ie; 673 struct wuie_disconnect *ie;
702 674
703 d_fnstart(3, dev, "(%p, %u)\n", wusbhc, port_idx);
704 result = 0;
705 wusb_dev = wusb_port_by_idx(wusbhc, port_idx)->wusb_dev; 675 wusb_dev = wusb_port_by_idx(wusbhc, port_idx)->wusb_dev;
706 if (wusb_dev == NULL) { 676 if (wusb_dev == NULL) {
707 /* reset no device? ignore */ 677 /* reset no device? ignore */
708 dev_dbg(dev, "DISCONNECT: no device at port %u, ignoring\n", 678 dev_dbg(dev, "DISCONNECT: no device at port %u, ignoring\n",
709 port_idx); 679 port_idx);
710 goto error; 680 return;
711 } 681 }
712 __wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, port_idx)); 682 __wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, port_idx));
713 683
714 result = -ENOMEM;
715 ie = kzalloc(sizeof(*ie), GFP_KERNEL); 684 ie = kzalloc(sizeof(*ie), GFP_KERNEL);
716 if (ie == NULL) 685 if (ie == NULL)
717 goto error; 686 return;
718 ie->hdr.bLength = sizeof(*ie); 687 ie->hdr.bLength = sizeof(*ie);
719 ie->hdr.bIEIdentifier = WUIE_ID_DEVICE_DISCONNECT; 688 ie->hdr.bIEIdentifier = WUIE_ID_DEVICE_DISCONNECT;
720 ie->bDeviceAddress = wusb_dev->addr; 689 ie->bDeviceAddress = wusb_dev->addr;
721 result = wusbhc_mmcie_set(wusbhc, 0, 0, &ie->hdr); 690 result = wusbhc_mmcie_set(wusbhc, 0, 0, &ie->hdr);
722 if (result < 0) { 691 if (result < 0)
723 dev_err(dev, "DISCONNECT: can't set MMC: %d\n", result); 692 dev_err(dev, "DISCONNECT: can't set MMC: %d\n", result);
724 goto error_kfree; 693 else {
694 /* At least 6 MMCs, assuming at least 1 MMC per zone. */
695 msleep(7*4);
696 wusbhc_mmcie_rm(wusbhc, &ie->hdr);
725 } 697 }
726
727 /* 120ms, hopefully 6 MMCs */
728 msleep(100);
729 wusbhc_mmcie_rm(wusbhc, &ie->hdr);
730error_kfree:
731 kfree(ie); 698 kfree(ie);
732error:
733 d_fnend(3, dev, "(%p, %u) = %d\n", wusbhc, port_idx, result);
734 return;
735}
736
737static void wusb_cap_descr_printf(const unsigned level, struct device *dev,
738 const struct usb_wireless_cap_descriptor *wcd)
739{
740 d_printf(level, dev,
741 "WUSB Capability Descriptor\n"
742 " bDevCapabilityType 0x%02x\n"
743 " bmAttributes 0x%02x\n"
744 " wPhyRates 0x%04x\n"
745 " bmTFITXPowerInfo 0x%02x\n"
746 " bmFFITXPowerInfo 0x%02x\n"
747 " bmBandGroup 0x%04x\n"
748 " bReserved 0x%02x\n",
749 wcd->bDevCapabilityType,
750 wcd->bmAttributes,
751 le16_to_cpu(wcd->wPHYRates),
752 wcd->bmTFITXPowerInfo,
753 wcd->bmFFITXPowerInfo,
754 wcd->bmBandGroup,
755 wcd->bReserved);
756} 699}
757 700
758/* 701/*
@@ -795,8 +738,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
795 } 738 }
796 cap_size = cap_hdr->bLength; 739 cap_size = cap_hdr->bLength;
797 cap_type = cap_hdr->bDevCapabilityType; 740 cap_type = cap_hdr->bDevCapabilityType;
798 d_printf(4, dev, "BOS Capability: 0x%02x (%zu bytes)\n",
799 cap_type, cap_size);
800 if (cap_size == 0) 741 if (cap_size == 0)
801 break; 742 break;
802 if (cap_size > top - itr) { 743 if (cap_size > top - itr) {
@@ -808,7 +749,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
808 result = -EBADF; 749 result = -EBADF;
809 goto error_bad_cap; 750 goto error_bad_cap;
810 } 751 }
811 d_dump(3, dev, itr, cap_size);
812 switch (cap_type) { 752 switch (cap_type) {
813 case USB_CAP_TYPE_WIRELESS_USB: 753 case USB_CAP_TYPE_WIRELESS_USB:
814 if (cap_size != sizeof(*wusb_dev->wusb_cap_descr)) 754 if (cap_size != sizeof(*wusb_dev->wusb_cap_descr))
@@ -816,10 +756,8 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
816 "descriptor is %zu bytes vs %zu " 756 "descriptor is %zu bytes vs %zu "
817 "needed\n", cap_size, 757 "needed\n", cap_size,
818 sizeof(*wusb_dev->wusb_cap_descr)); 758 sizeof(*wusb_dev->wusb_cap_descr));
819 else { 759 else
820 wusb_dev->wusb_cap_descr = itr; 760 wusb_dev->wusb_cap_descr = itr;
821 wusb_cap_descr_printf(3, dev, itr);
822 }
823 break; 761 break;
824 default: 762 default:
825 dev_err(dev, "BUG? Unknown BOS capability 0x%02x " 763 dev_err(dev, "BUG? Unknown BOS capability 0x%02x "
@@ -884,9 +822,7 @@ static int wusb_dev_bos_add(struct usb_device *usb_dev,
884 "%zu bytes): %zd\n", desc_size, result); 822 "%zu bytes): %zd\n", desc_size, result);
885 goto error_get_descriptor; 823 goto error_get_descriptor;
886 } 824 }
887 d_printf(2, dev, "Got BOS descriptor %zd bytes, %u capabilities\n", 825
888 result, bos->bNumDeviceCaps);
889 d_dump(2, dev, bos, result);
890 result = wusb_dev_bos_grok(usb_dev, wusb_dev, bos, result); 826 result = wusb_dev_bos_grok(usb_dev, wusb_dev, bos, result);
891 if (result < 0) 827 if (result < 0)
892 goto error_bad_bos; 828 goto error_bad_bos;
@@ -952,8 +888,6 @@ static void wusb_dev_add_ncb(struct usb_device *usb_dev)
952 if (usb_dev->wusb == 0 || usb_dev->devnum == 1) 888 if (usb_dev->wusb == 0 || usb_dev->devnum == 1)
953 return; /* skip non wusb and wusb RHs */ 889 return; /* skip non wusb and wusb RHs */
954 890
955 d_fnstart(3, dev, "(usb_dev %p)\n", usb_dev);
956
957 wusbhc = wusbhc_get_by_usb_dev(usb_dev); 891 wusbhc = wusbhc_get_by_usb_dev(usb_dev);
958 if (wusbhc == NULL) 892 if (wusbhc == NULL)
959 goto error_nodev; 893 goto error_nodev;
@@ -983,7 +917,6 @@ out:
983 wusb_dev_put(wusb_dev); 917 wusb_dev_put(wusb_dev);
984 wusbhc_put(wusbhc); 918 wusbhc_put(wusbhc);
985error_nodev: 919error_nodev:
986 d_fnend(3, dev, "(usb_dev %p) = void\n", usb_dev);
987 return; 920 return;
988 921
989 wusb_dev_sysfs_rm(wusb_dev); 922 wusb_dev_sysfs_rm(wusb_dev);
@@ -1070,11 +1003,10 @@ EXPORT_SYMBOL_GPL(__wusb_dev_get_by_usb_dev);
1070 1003
1071void wusb_dev_destroy(struct kref *_wusb_dev) 1004void wusb_dev_destroy(struct kref *_wusb_dev)
1072{ 1005{
1073 struct wusb_dev *wusb_dev 1006 struct wusb_dev *wusb_dev = container_of(_wusb_dev, struct wusb_dev, refcnt);
1074 = container_of(_wusb_dev, struct wusb_dev, refcnt); 1007
1075 list_del_init(&wusb_dev->cack_node); 1008 list_del_init(&wusb_dev->cack_node);
1076 wusb_dev_free(wusb_dev); 1009 wusb_dev_free(wusb_dev);
1077 d_fnend(1, NULL, "%s (wusb_dev %p) = void\n", __func__, wusb_dev);
1078} 1010}
1079EXPORT_SYMBOL_GPL(wusb_dev_destroy); 1011EXPORT_SYMBOL_GPL(wusb_dev_destroy);
1080 1012
@@ -1086,8 +1018,6 @@ EXPORT_SYMBOL_GPL(wusb_dev_destroy);
1086 */ 1018 */
1087int wusbhc_devconnect_create(struct wusbhc *wusbhc) 1019int wusbhc_devconnect_create(struct wusbhc *wusbhc)
1088{ 1020{
1089 d_fnstart(3, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
1090
1091 wusbhc->keep_alive_ie.hdr.bIEIdentifier = WUIE_ID_KEEP_ALIVE; 1021 wusbhc->keep_alive_ie.hdr.bIEIdentifier = WUIE_ID_KEEP_ALIVE;
1092 wusbhc->keep_alive_ie.hdr.bLength = sizeof(wusbhc->keep_alive_ie.hdr); 1022 wusbhc->keep_alive_ie.hdr.bLength = sizeof(wusbhc->keep_alive_ie.hdr);
1093 INIT_DELAYED_WORK(&wusbhc->keep_alive_timer, wusbhc_keep_alive_run); 1023 INIT_DELAYED_WORK(&wusbhc->keep_alive_timer, wusbhc_keep_alive_run);
@@ -1096,7 +1026,6 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc)
1096 wusbhc->cack_ie.hdr.bLength = sizeof(wusbhc->cack_ie.hdr); 1026 wusbhc->cack_ie.hdr.bLength = sizeof(wusbhc->cack_ie.hdr);
1097 INIT_LIST_HEAD(&wusbhc->cack_list); 1027 INIT_LIST_HEAD(&wusbhc->cack_list);
1098 1028
1099 d_fnend(3, wusbhc->dev, "(wusbhc %p) = void\n", wusbhc);
1100 return 0; 1029 return 0;
1101} 1030}
1102 1031
@@ -1105,8 +1034,7 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc)
1105 */ 1034 */
1106void wusbhc_devconnect_destroy(struct wusbhc *wusbhc) 1035void wusbhc_devconnect_destroy(struct wusbhc *wusbhc)
1107{ 1036{
1108 d_fnstart(3, wusbhc->dev, "(wusbhc %p)\n", wusbhc); 1037 /* no op */
1109 d_fnend(3, wusbhc->dev, "(wusbhc %p) = void\n", wusbhc);
1110} 1038}
1111 1039
1112/* 1040/*