aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/usb/host/hwa-hc.c55
-rw-r--r--drivers/usb/wusbcore/crypto.c30
-rw-r--r--drivers/usb/wusbcore/dev-sysfs.c4
-rw-r--r--drivers/usb/wusbcore/devconnect.c104
-rw-r--r--drivers/usb/wusbcore/rh.c64
-rw-r--r--drivers/usb/wusbcore/security.c75
-rw-r--r--drivers/usb/wusbcore/wa-rpipe.c68
-rw-r--r--drivers/usb/wusbcore/wa-xfer.c180
-rw-r--r--drivers/uwb/beacon.c10
-rw-r--r--drivers/uwb/est.c14
-rw-r--r--drivers/uwb/hwa-rc.c30
-rw-r--r--drivers/uwb/i1480/dfu/dfu.c10
-rw-r--r--drivers/uwb/i1480/dfu/mac.c18
-rw-r--r--drivers/uwb/i1480/dfu/usb.c26
-rw-r--r--drivers/uwb/i1480/i1480u-wlp/rx.c25
-rw-r--r--drivers/uwb/i1480/i1480u-wlp/tx.c66
-rw-r--r--drivers/uwb/lc-dev.c21
-rw-r--r--drivers/uwb/neh.c7
-rw-r--r--drivers/uwb/reset.c2
-rw-r--r--drivers/uwb/umc-dev.c8
-rw-r--r--drivers/uwb/uwbd.c74
-rw-r--r--drivers/uwb/whc-rc.c53
-rw-r--r--drivers/uwb/wlp/eda.c33
-rw-r--r--drivers/uwb/wlp/messages.c181
-rw-r--r--drivers/uwb/wlp/sysfs.c2
-rw-r--r--drivers/uwb/wlp/txrx.c37
-rw-r--r--drivers/uwb/wlp/wlp-lc.c61
-rw-r--r--drivers/uwb/wlp/wss-lc.c130
28 files changed, 220 insertions, 1168 deletions
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index 2a4d36fa70b0..8582236e4cad 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -62,16 +62,12 @@
62#include "../wusbcore/wa-hc.h" 62#include "../wusbcore/wa-hc.h"
63#include "../wusbcore/wusbhc.h" 63#include "../wusbcore/wusbhc.h"
64 64
65#define D_LOCAL 0
66#include <linux/uwb/debug.h>
67
68struct hwahc { 65struct hwahc {
69 struct wusbhc wusbhc; /* has to be 1st */ 66 struct wusbhc wusbhc; /* has to be 1st */
70 struct wahc wa; 67 struct wahc wa;
71 u8 buffer[16]; /* for misc usb transactions */
72}; 68};
73 69
74/** 70/*
75 * FIXME should be wusbhc 71 * FIXME should be wusbhc
76 * 72 *
77 * NOTE: we need to cache the Cluster ID because later...there is no 73 * NOTE: we need to cache the Cluster ID because later...there is no
@@ -125,7 +121,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
125 struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); 121 struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
126 struct device *dev = &hwahc->wa.usb_iface->dev; 122 struct device *dev = &hwahc->wa.usb_iface->dev;
127 123
128 d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
129 mutex_lock(&wusbhc->mutex); 124 mutex_lock(&wusbhc->mutex);
130 wa_nep_disarm(&hwahc->wa); 125 wa_nep_disarm(&hwahc->wa);
131 result = __wa_set_feature(&hwahc->wa, WA_RESET); 126 result = __wa_set_feature(&hwahc->wa, WA_RESET);
@@ -133,7 +128,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
133 dev_err(dev, "error commanding HC to reset: %d\n", result); 128 dev_err(dev, "error commanding HC to reset: %d\n", result);
134 goto error_unlock; 129 goto error_unlock;
135 } 130 }
136 d_printf(3, dev, "reset: waiting for device to change state\n");
137 result = __wa_wait_status(&hwahc->wa, WA_STATUS_RESETTING, 0); 131 result = __wa_wait_status(&hwahc->wa, WA_STATUS_RESETTING, 0);
138 if (result < 0) { 132 if (result < 0) {
139 dev_err(dev, "error waiting for HC to reset: %d\n", result); 133 dev_err(dev, "error waiting for HC to reset: %d\n", result);
@@ -141,7 +135,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
141 } 135 }
142error_unlock: 136error_unlock:
143 mutex_unlock(&wusbhc->mutex); 137 mutex_unlock(&wusbhc->mutex);
144 d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
145 return result; 138 return result;
146} 139}
147 140
@@ -154,15 +147,9 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
154 int result; 147 int result;
155 struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); 148 struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
156 struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); 149 struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
157 struct device *dev = &hwahc->wa.usb_iface->dev;
158 150
159 /* Set up a Host Info WUSB Information Element */
160 d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
161 result = -ENOSPC; 151 result = -ENOSPC;
162 mutex_lock(&wusbhc->mutex); 152 mutex_lock(&wusbhc->mutex);
163 /* Start the numbering from the top so that the bottom
164 * range of the unauth addr space is used for devices,
165 * the top for HCs; use 0xfe - RC# */
166 addr = wusb_cluster_id_get(); 153 addr = wusb_cluster_id_get();
167 if (addr == 0) 154 if (addr == 0)
168 goto error_cluster_id_get; 155 goto error_cluster_id_get;
@@ -176,7 +163,6 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
176 result = 0; 163 result = 0;
177out: 164out:
178 mutex_unlock(&wusbhc->mutex); 165 mutex_unlock(&wusbhc->mutex);
179 d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
180 return result; 166 return result;
181 167
182error_set_cluster_id: 168error_set_cluster_id:
@@ -213,18 +199,11 @@ static int hwahc_op_resume(struct usb_hcd *usb_hcd)
213 */ 199 */
214static void hwahc_op_stop(struct usb_hcd *usb_hcd) 200static void hwahc_op_stop(struct usb_hcd *usb_hcd)
215{ 201{
216 int result;
217 struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); 202 struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
218 struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
219 struct wahc *wa = &hwahc->wa;
220 struct device *dev = &wa->usb_iface->dev;
221 203
222 d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
223 mutex_lock(&wusbhc->mutex); 204 mutex_lock(&wusbhc->mutex);
224 wusb_cluster_id_put(wusbhc->cluster_id); 205 wusb_cluster_id_put(wusbhc->cluster_id);
225 mutex_unlock(&wusbhc->mutex); 206 mutex_unlock(&wusbhc->mutex);
226 d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
227 return;
228} 207}
229 208
230static int hwahc_op_get_frame_number(struct usb_hcd *usb_hcd) 209static int hwahc_op_get_frame_number(struct usb_hcd *usb_hcd)
@@ -573,11 +552,11 @@ static int wa_fill_descr(struct wahc *wa)
573 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength); 552 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
574 while (itr_size >= sizeof(*hdr)) { 553 while (itr_size >= sizeof(*hdr)) {
575 hdr = (struct usb_descriptor_header *) itr; 554 hdr = (struct usb_descriptor_header *) itr;
576 d_printf(3, dev, "Extra device descriptor: " 555 dev_dbg(dev, "Extra device descriptor: "
577 "type %02x/%u bytes @ %zu (%zu left)\n", 556 "type %02x/%u bytes @ %zu (%zu left)\n",
578 hdr->bDescriptorType, hdr->bLength, 557 hdr->bDescriptorType, hdr->bLength,
579 (itr - usb_dev->rawdescriptors[actconfig_idx]), 558 (itr - usb_dev->rawdescriptors[actconfig_idx]),
580 itr_size); 559 itr_size);
581 if (hdr->bDescriptorType == USB_DT_WIRE_ADAPTER) 560 if (hdr->bDescriptorType == USB_DT_WIRE_ADAPTER)
582 goto found; 561 goto found;
583 itr += hdr->bLength; 562 itr += hdr->bLength;
@@ -786,7 +765,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
786{ 765{
787 struct wusbhc *wusbhc = &hwahc->wusbhc; 766 struct wusbhc *wusbhc = &hwahc->wusbhc;
788 767
789 d_fnstart(1, NULL, "(hwahc %p)\n", hwahc);
790 mutex_lock(&wusbhc->mutex); 768 mutex_lock(&wusbhc->mutex);
791 __wa_destroy(&hwahc->wa); 769 __wa_destroy(&hwahc->wa);
792 wusbhc_destroy(&hwahc->wusbhc); 770 wusbhc_destroy(&hwahc->wusbhc);
@@ -796,7 +774,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
796 usb_put_intf(hwahc->wa.usb_iface); 774 usb_put_intf(hwahc->wa.usb_iface);
797 usb_put_dev(hwahc->wa.usb_dev); 775 usb_put_dev(hwahc->wa.usb_dev);
798 mutex_unlock(&wusbhc->mutex); 776 mutex_unlock(&wusbhc->mutex);
799 d_fnend(1, NULL, "(hwahc %p) = void\n", hwahc);
800} 777}
801 778
802static void hwahc_init(struct hwahc *hwahc) 779static void hwahc_init(struct hwahc *hwahc)
@@ -813,7 +790,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
813 struct hwahc *hwahc; 790 struct hwahc *hwahc;
814 struct device *dev = &usb_iface->dev; 791 struct device *dev = &usb_iface->dev;
815 792
816 d_fnstart(4, dev, "(%p, %p)\n", usb_iface, id);
817 result = -ENOMEM; 793 result = -ENOMEM;
818 usb_hcd = usb_create_hcd(&hwahc_hc_driver, &usb_iface->dev, "wusb-hwa"); 794 usb_hcd = usb_create_hcd(&hwahc_hc_driver, &usb_iface->dev, "wusb-hwa");
819 if (usb_hcd == NULL) { 795 if (usb_hcd == NULL) {
@@ -840,7 +816,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
840 dev_err(dev, "Cannot setup phase B of WUSBHC: %d\n", result); 816 dev_err(dev, "Cannot setup phase B of WUSBHC: %d\n", result);
841 goto error_wusbhc_b_create; 817 goto error_wusbhc_b_create;
842 } 818 }
843 d_fnend(4, dev, "(%p, %p) = 0\n", usb_iface, id);
844 return 0; 819 return 0;
845 820
846error_wusbhc_b_create: 821error_wusbhc_b_create:
@@ -850,7 +825,6 @@ error_add_hcd:
850error_hwahc_create: 825error_hwahc_create:
851 usb_put_hcd(usb_hcd); 826 usb_put_hcd(usb_hcd);
852error_alloc: 827error_alloc:
853 d_fnend(4, dev, "(%p, %p) = %d\n", usb_iface, id, result);
854 return result; 828 return result;
855} 829}
856 830
@@ -864,16 +838,12 @@ static void hwahc_disconnect(struct usb_interface *usb_iface)
864 wusbhc = usb_hcd_to_wusbhc(usb_hcd); 838 wusbhc = usb_hcd_to_wusbhc(usb_hcd);
865 hwahc = container_of(wusbhc, struct hwahc, wusbhc); 839 hwahc = container_of(wusbhc, struct hwahc, wusbhc);
866 840
867 d_fnstart(1, NULL, "(hwahc %p [usb_iface %p])\n", hwahc, usb_iface);
868 wusbhc_b_destroy(&hwahc->wusbhc); 841 wusbhc_b_destroy(&hwahc->wusbhc);
869 usb_remove_hcd(usb_hcd); 842 usb_remove_hcd(usb_hcd);
870 hwahc_destroy(hwahc); 843 hwahc_destroy(hwahc);
871 usb_put_hcd(usb_hcd); 844 usb_put_hcd(usb_hcd);
872 d_fnend(1, NULL, "(hwahc %p [usb_iface %p]) = void\n", hwahc,
873 usb_iface);
874} 845}
875 846
876/** USB device ID's that we handle */
877static struct usb_device_id hwahc_id_table[] = { 847static struct usb_device_id hwahc_id_table[] = {
878 /* FIXME: use class labels for this */ 848 /* FIXME: use class labels for this */
879 { USB_INTERFACE_INFO(0xe0, 0x02, 0x01), }, 849 { USB_INTERFACE_INFO(0xe0, 0x02, 0x01), },
@@ -890,18 +860,7 @@ static struct usb_driver hwahc_driver = {
890 860
891static int __init hwahc_driver_init(void) 861static int __init hwahc_driver_init(void)
892{ 862{
893 int result; 863 return usb_register(&hwahc_driver);
894 result = usb_register(&hwahc_driver);
895 if (result < 0) {
896 printk(KERN_ERR "WA-CDS: Cannot register USB driver: %d\n",
897 result);
898 goto error_usb_register;
899 }
900 return 0;
901
902error_usb_register:
903 return result;
904
905} 864}
906module_init(hwahc_driver_init); 865module_init(hwahc_driver_init);
907 866
diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c
index 0ca860305feb..9d9128ac8c8e 100644
--- a/drivers/usb/wusbcore/crypto.c
+++ b/drivers/usb/wusbcore/crypto.c
@@ -51,7 +51,6 @@
51#include <linux/uwb.h> 51#include <linux/uwb.h>
52#include <linux/usb/wusb.h> 52#include <linux/usb/wusb.h>
53#include <linux/scatterlist.h> 53#include <linux/scatterlist.h>
54#define D_LOCAL 0
55#include <linux/uwb/debug.h> 54#include <linux/uwb/debug.h>
56 55
57static int debug_crypto_verify = 0; 56static int debug_crypto_verify = 0;
@@ -207,9 +206,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
207 const u8 bzero[16] = { 0 }; 206 const u8 bzero[16] = { 0 };
208 size_t zero_padding; 207 size_t zero_padding;
209 208
210 d_fnstart(3, NULL, "(tfm_cbc %p, tfm_aes %p, mic %p, "
211 "n %p, a %p, b %p, blen %zu)\n",
212 tfm_cbc, tfm_aes, mic, n, a, b, blen);
213 /* 209 /*
214 * These checks should be compile time optimized out 210 * These checks should be compile time optimized out
215 * ensure @a fills b1's mac_header and following fields 211 * ensure @a fills b1's mac_header and following fields
@@ -251,16 +247,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
251 b1.la = cpu_to_be16(blen + 14); 247 b1.la = cpu_to_be16(blen + 14);
252 memcpy(&b1.mac_header, a, sizeof(*a)); 248 memcpy(&b1.mac_header, a, sizeof(*a));
253 249
254 d_printf(4, NULL, "I: B0 (%zu bytes)\n", sizeof(b0));
255 d_dump(4, NULL, &b0, sizeof(b0));
256 d_printf(4, NULL, "I: B1 (%zu bytes)\n", sizeof(b1));
257 d_dump(4, NULL, &b1, sizeof(b1));
258 d_printf(4, NULL, "I: B (%zu bytes)\n", blen);
259 d_dump(4, NULL, b, blen);
260 d_printf(4, NULL, "I: B 0-padding (%zu bytes)\n", zero_padding);
261 d_printf(4, NULL, "D: IV before crypto (%zu)\n", ivsize);
262 d_dump(4, NULL, iv, ivsize);
263
264 sg_init_table(sg, ARRAY_SIZE(sg)); 250 sg_init_table(sg, ARRAY_SIZE(sg));
265 sg_set_buf(&sg[0], &b0, sizeof(b0)); 251 sg_set_buf(&sg[0], &b0, sizeof(b0));
266 sg_set_buf(&sg[1], &b1, sizeof(b1)); 252 sg_set_buf(&sg[1], &b1, sizeof(b1));
@@ -277,8 +263,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
277 result); 263 result);
278 goto error_cbc_crypt; 264 goto error_cbc_crypt;
279 } 265 }
280 d_printf(4, NULL, "D: MIC tag\n");
281 d_dump(4, NULL, iv, ivsize);
282 266
283 /* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5] 267 /* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5]
284 * The procedure is to AES crypt the A0 block and XOR the MIC 268 * The procedure is to AES crypt the A0 block and XOR the MIC
@@ -293,17 +277,10 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
293 ax.counter = 0; 277 ax.counter = 0;
294 crypto_cipher_encrypt_one(tfm_aes, (void *)&ax, (void *)&ax); 278 crypto_cipher_encrypt_one(tfm_aes, (void *)&ax, (void *)&ax);
295 bytewise_xor(mic, &ax, iv, 8); 279 bytewise_xor(mic, &ax, iv, 8);
296 d_printf(4, NULL, "D: CTR[MIC]\n");
297 d_dump(4, NULL, &ax, 8);
298 d_printf(4, NULL, "D: CCM-MIC tag\n");
299 d_dump(4, NULL, mic, 8);
300 result = 8; 280 result = 8;
301error_cbc_crypt: 281error_cbc_crypt:
302 kfree(dst_buf); 282 kfree(dst_buf);
303error_dst_buf: 283error_dst_buf:
304 d_fnend(3, NULL, "(tfm_cbc %p, tfm_aes %p, mic %p, "
305 "n %p, a %p, b %p, blen %zu)\n",
306 tfm_cbc, tfm_aes, mic, n, a, b, blen);
307 return result; 284 return result;
308} 285}
309 286
@@ -325,10 +302,6 @@ ssize_t wusb_prf(void *out, size_t out_size,
325 u64 sfn = 0; 302 u64 sfn = 0;
326 __le64 sfn_le; 303 __le64 sfn_le;
327 304
328 d_fnstart(3, NULL, "(out %p, out_size %zu, key %p, _n %p, "
329 "a %p, b %p, blen %zu, len %zu)\n", out, out_size,
330 key, _n, a, b, blen, len);
331
332 tfm_cbc = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); 305 tfm_cbc = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
333 if (IS_ERR(tfm_cbc)) { 306 if (IS_ERR(tfm_cbc)) {
334 result = PTR_ERR(tfm_cbc); 307 result = PTR_ERR(tfm_cbc);
@@ -370,9 +343,6 @@ error_alloc_aes:
370error_setkey_cbc: 343error_setkey_cbc:
371 crypto_free_blkcipher(tfm_cbc); 344 crypto_free_blkcipher(tfm_cbc);
372error_alloc_cbc: 345error_alloc_cbc:
373 d_fnend(3, NULL, "(out %p, out_size %zu, key %p, _n %p, "
374 "a %p, b %p, blen %zu, len %zu) = %d\n", out, out_size,
375 key, _n, a, b, blen, len, (int)bytes);
376 return result; 346 return result;
377} 347}
378 348
diff --git a/drivers/usb/wusbcore/dev-sysfs.c b/drivers/usb/wusbcore/dev-sysfs.c
index 7897a19652e5..101834576236 100644
--- a/drivers/usb/wusbcore/dev-sysfs.c
+++ b/drivers/usb/wusbcore/dev-sysfs.c
@@ -28,10 +28,6 @@
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include "wusbhc.h" 29#include "wusbhc.h"
30 30
31#undef D_LOCAL
32#define D_LOCAL 4
33#include <linux/uwb/debug.h>
34
35static ssize_t wusb_disconnect_store(struct device *dev, 31static ssize_t wusb_disconnect_store(struct device *dev,
36 struct device_attribute *attr, 32 struct device_attribute *attr,
37 const char *buf, size_t size) 33 const char *buf, size_t size)
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/*
diff --git a/drivers/usb/wusbcore/rh.c b/drivers/usb/wusbcore/rh.c
index 1c733192ec2a..95c6fa3bf6b2 100644
--- a/drivers/usb/wusbcore/rh.c
+++ b/drivers/usb/wusbcore/rh.c
@@ -71,9 +71,6 @@
71 */ 71 */
72#include "wusbhc.h" 72#include "wusbhc.h"
73 73
74#define D_LOCAL 0
75#include <linux/uwb/debug.h>
76
77/* 74/*
78 * Reset a fake port 75 * Reset a fake port
79 * 76 *
@@ -142,7 +139,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf)
142 size_t cnt, size; 139 size_t cnt, size;
143 unsigned long *buf = (unsigned long *) _buf; 140 unsigned long *buf = (unsigned long *) _buf;
144 141
145 d_fnstart(1, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
146 /* WE DON'T LOCK, see comment */ 142 /* WE DON'T LOCK, see comment */
147 size = wusbhc->ports_max + 1 /* hub bit */; 143 size = wusbhc->ports_max + 1 /* hub bit */;
148 size = (size + 8 - 1) / 8; /* round to bytes */ 144 size = (size + 8 - 1) / 8; /* round to bytes */
@@ -151,8 +147,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf)
151 set_bit(cnt + 1, buf); 147 set_bit(cnt + 1, buf);
152 else 148 else
153 clear_bit(cnt + 1, buf); 149 clear_bit(cnt + 1, buf);
154 d_fnend(1, wusbhc->dev, "(wusbhc %p) %u, buffer:\n", wusbhc, (int)size);
155 d_dump(1, wusbhc->dev, _buf, size);
156 return size; 150 return size;
157} 151}
158EXPORT_SYMBOL_GPL(wusbhc_rh_status_data); 152EXPORT_SYMBOL_GPL(wusbhc_rh_status_data);
@@ -201,9 +195,7 @@ static int wusbhc_rh_get_hub_descr(struct wusbhc *wusbhc, u16 wValue,
201static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature) 195static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature)
202{ 196{
203 int result; 197 int result;
204 struct device *dev = wusbhc->dev;
205 198
206 d_fnstart(4, dev, "(%p, feature 0x%04u)\n", wusbhc, feature);
207 switch (feature) { 199 switch (feature) {
208 case C_HUB_LOCAL_POWER: 200 case C_HUB_LOCAL_POWER:
209 /* FIXME: maybe plug bit 0 to the power input status, 201 /* FIXME: maybe plug bit 0 to the power input status,
@@ -215,7 +207,6 @@ static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature)
215 default: 207 default:
216 result = -EPIPE; 208 result = -EPIPE;
217 } 209 }
218 d_fnend(4, dev, "(%p, feature 0x%04u), %d\n", wusbhc, feature, result);
219 return result; 210 return result;
220} 211}
221 212
@@ -242,14 +233,10 @@ static int wusbhc_rh_get_hub_status(struct wusbhc *wusbhc, u32 *buf,
242static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature, 233static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature,
243 u8 selector, u8 port_idx) 234 u8 selector, u8 port_idx)
244{ 235{
245 int result = -EINVAL;
246 struct device *dev = wusbhc->dev; 236 struct device *dev = wusbhc->dev;
247 237
248 d_fnstart(4, dev, "(feat 0x%04u, selector 0x%u, port_idx %d)\n",
249 feature, selector, port_idx);
250
251 if (port_idx > wusbhc->ports_max) 238 if (port_idx > wusbhc->ports_max)
252 goto error; 239 return -EINVAL;
253 240
254 switch (feature) { 241 switch (feature) {
255 /* According to USB2.0[11.24.2.13]p2, these features 242 /* According to USB2.0[11.24.2.13]p2, these features
@@ -259,35 +246,27 @@ static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature,
259 case USB_PORT_FEAT_C_SUSPEND: 246 case USB_PORT_FEAT_C_SUSPEND:
260 case USB_PORT_FEAT_C_CONNECTION: 247 case USB_PORT_FEAT_C_CONNECTION:
261 case USB_PORT_FEAT_C_RESET: 248 case USB_PORT_FEAT_C_RESET:
262 result = 0; 249 return 0;
263 break;
264
265 case USB_PORT_FEAT_POWER: 250 case USB_PORT_FEAT_POWER:
266 /* No such thing, but we fake it works */ 251 /* No such thing, but we fake it works */
267 mutex_lock(&wusbhc->mutex); 252 mutex_lock(&wusbhc->mutex);
268 wusb_port_by_idx(wusbhc, port_idx)->status |= USB_PORT_STAT_POWER; 253 wusb_port_by_idx(wusbhc, port_idx)->status |= USB_PORT_STAT_POWER;
269 mutex_unlock(&wusbhc->mutex); 254 mutex_unlock(&wusbhc->mutex);
270 result = 0; 255 return 0;
271 break;
272 case USB_PORT_FEAT_RESET: 256 case USB_PORT_FEAT_RESET:
273 result = wusbhc_rh_port_reset(wusbhc, port_idx); 257 return wusbhc_rh_port_reset(wusbhc, port_idx);
274 break;
275 case USB_PORT_FEAT_ENABLE: 258 case USB_PORT_FEAT_ENABLE:
276 case USB_PORT_FEAT_SUSPEND: 259 case USB_PORT_FEAT_SUSPEND:
277 dev_err(dev, "(port_idx %d) set feat %d/%d UNIMPLEMENTED\n", 260 dev_err(dev, "(port_idx %d) set feat %d/%d UNIMPLEMENTED\n",
278 port_idx, feature, selector); 261 port_idx, feature, selector);
279 result = -ENOSYS; 262 return -ENOSYS;
280 break;
281 default: 263 default:
282 dev_err(dev, "(port_idx %d) set feat %d/%d UNKNOWN\n", 264 dev_err(dev, "(port_idx %d) set feat %d/%d UNKNOWN\n",
283 port_idx, feature, selector); 265 port_idx, feature, selector);
284 result = -EPIPE; 266 return -EPIPE;
285 break;
286 } 267 }
287error: 268
288 d_fnend(4, dev, "(feat 0x%04u, selector 0x%u, port_idx %d) = %d\n", 269 return 0;
289 feature, selector, port_idx, result);
290 return result;
291} 270}
292 271
293/* 272/*
@@ -298,17 +277,13 @@ error:
298static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature, 277static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
299 u8 selector, u8 port_idx) 278 u8 selector, u8 port_idx)
300{ 279{
301 int result = -EINVAL; 280 int result = 0;
302 struct device *dev = wusbhc->dev; 281 struct device *dev = wusbhc->dev;
303 282
304 d_fnstart(4, dev, "(wusbhc %p feat 0x%04x selector %d port_idx %d)\n",
305 wusbhc, feature, selector, port_idx);
306
307 if (port_idx > wusbhc->ports_max) 283 if (port_idx > wusbhc->ports_max)
308 goto error; 284 return -EINVAL;
309 285
310 mutex_lock(&wusbhc->mutex); 286 mutex_lock(&wusbhc->mutex);
311 result = 0;
312 switch (feature) { 287 switch (feature) {
313 case USB_PORT_FEAT_POWER: /* fake port always on */ 288 case USB_PORT_FEAT_POWER: /* fake port always on */
314 /* According to USB2.0[11.24.2.7.1.4], no need to implement? */ 289 /* According to USB2.0[11.24.2.7.1.4], no need to implement? */
@@ -328,10 +303,8 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
328 break; 303 break;
329 case USB_PORT_FEAT_SUSPEND: 304 case USB_PORT_FEAT_SUSPEND:
330 case USB_PORT_FEAT_C_SUSPEND: 305 case USB_PORT_FEAT_C_SUSPEND:
331 case 0xffff: /* ??? FIXME */
332 dev_err(dev, "(port_idx %d) Clear feat %d/%d UNIMPLEMENTED\n", 306 dev_err(dev, "(port_idx %d) Clear feat %d/%d UNIMPLEMENTED\n",
333 port_idx, feature, selector); 307 port_idx, feature, selector);
334 /* dump_stack(); */
335 result = -ENOSYS; 308 result = -ENOSYS;
336 break; 309 break;
337 default: 310 default:
@@ -341,9 +314,7 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
341 break; 314 break;
342 } 315 }
343 mutex_unlock(&wusbhc->mutex); 316 mutex_unlock(&wusbhc->mutex);
344error: 317
345 d_fnend(4, dev, "(wusbhc %p feat 0x%04x selector %d port_idx %d) = "
346 "%d\n", wusbhc, feature, selector, port_idx, result);
347 return result; 318 return result;
348} 319}
349 320
@@ -355,22 +326,17 @@ error:
355static int wusbhc_rh_get_port_status(struct wusbhc *wusbhc, u16 port_idx, 326static int wusbhc_rh_get_port_status(struct wusbhc *wusbhc, u16 port_idx,
356 u32 *_buf, u16 wLength) 327 u32 *_buf, u16 wLength)
357{ 328{
358 int result = -EINVAL;
359 u16 *buf = (u16 *) _buf; 329 u16 *buf = (u16 *) _buf;
360 330
361 d_fnstart(1, wusbhc->dev, "(wusbhc %p port_idx %u wLength %u)\n",
362 wusbhc, port_idx, wLength);
363 if (port_idx > wusbhc->ports_max) 331 if (port_idx > wusbhc->ports_max)
364 goto error; 332 return -EINVAL;
333
365 mutex_lock(&wusbhc->mutex); 334 mutex_lock(&wusbhc->mutex);
366 buf[0] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->status); 335 buf[0] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->status);
367 buf[1] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->change); 336 buf[1] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->change);
368 result = 0;
369 mutex_unlock(&wusbhc->mutex); 337 mutex_unlock(&wusbhc->mutex);
370error: 338
371 d_fnend(1, wusbhc->dev, "(wusbhc %p) = %d, buffer:\n", wusbhc, result); 339 return 0;
372 d_dump(1, wusbhc->dev, _buf, wLength);
373 return result;
374} 340}
375 341
376/* 342/*
diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c
index ac00640bba64..f4aa28eca70d 100644
--- a/drivers/usb/wusbcore/security.c
+++ b/drivers/usb/wusbcore/security.c
@@ -27,19 +27,6 @@
27#include <linux/random.h> 27#include <linux/random.h>
28#include "wusbhc.h" 28#include "wusbhc.h"
29 29
30/*
31 * DEBUG & SECURITY WARNING!!!!
32 *
33 * If you enable this past 1, the debug code will weaken the
34 * cryptographic safety of the system (on purpose, for debugging).
35 *
36 * Weaken means:
37 * we print secret keys and intermediate values all the way,
38 */
39#undef D_LOCAL
40#define D_LOCAL 2
41#include <linux/uwb/debug.h>
42
43static void wusbhc_set_gtk_callback(struct urb *urb); 30static void wusbhc_set_gtk_callback(struct urb *urb);
44static void wusbhc_gtk_rekey_done_work(struct work_struct *work); 31static void wusbhc_gtk_rekey_done_work(struct work_struct *work);
45 32
@@ -219,7 +206,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
219 const void *itr, *top; 206 const void *itr, *top;
220 char buf[64]; 207 char buf[64];
221 208
222 d_fnstart(3, dev, "(usb_dev %p, wusb_dev %p)\n", usb_dev, wusb_dev);
223 result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, 209 result = usb_get_descriptor(usb_dev, USB_DT_SECURITY,
224 0, &secd, sizeof(secd)); 210 0, &secd, sizeof(secd));
225 if (result < sizeof(secd)) { 211 if (result < sizeof(secd)) {
@@ -228,8 +214,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
228 goto error_secd; 214 goto error_secd;
229 } 215 }
230 secd_size = le16_to_cpu(secd.wTotalLength); 216 secd_size = le16_to_cpu(secd.wTotalLength);
231 d_printf(5, dev, "got %d bytes of sec descriptor, total is %d\n",
232 result, secd_size);
233 secd_buf = kmalloc(secd_size, GFP_KERNEL); 217 secd_buf = kmalloc(secd_size, GFP_KERNEL);
234 if (secd_buf == NULL) { 218 if (secd_buf == NULL) {
235 dev_err(dev, "Can't allocate space for security descriptors\n"); 219 dev_err(dev, "Can't allocate space for security descriptors\n");
@@ -242,7 +226,6 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
242 "not enough data: %d\n", result); 226 "not enough data: %d\n", result);
243 goto error_secd_all; 227 goto error_secd_all;
244 } 228 }
245 d_printf(5, dev, "got %d bytes of sec descriptors\n", result);
246 bytes = 0; 229 bytes = 0;
247 itr = secd_buf + sizeof(secd); 230 itr = secd_buf + sizeof(secd);
248 top = secd_buf + result; 231 top = secd_buf + result;
@@ -279,14 +262,12 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
279 goto error_no_ccm1; 262 goto error_no_ccm1;
280 } 263 }
281 wusb_dev->ccm1_etd = *ccm1_etd; 264 wusb_dev->ccm1_etd = *ccm1_etd;
282 dev_info(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n", 265 dev_dbg(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n",
283 buf, wusb_et_name(ccm1_etd->bEncryptionType), 266 buf, wusb_et_name(ccm1_etd->bEncryptionType),
284 ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex); 267 ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex);
285 result = 0; 268 result = 0;
286 kfree(secd_buf); 269 kfree(secd_buf);
287out: 270out:
288 d_fnend(3, dev, "(usb_dev %p, wusb_dev %p) = %d\n",
289 usb_dev, wusb_dev, result);
290 return result; 271 return result;
291 272
292 273
@@ -303,32 +284,6 @@ void wusb_dev_sec_rm(struct wusb_dev *wusb_dev)
303 /* Nothing so far */ 284 /* Nothing so far */
304} 285}
305 286
306static void hs_printk(unsigned level, struct device *dev,
307 struct usb_handshake *hs)
308{
309 d_printf(level, dev,
310 " bMessageNumber: %u\n"
311 " bStatus: %u\n"
312 " tTKID: %02x %02x %02x\n"
313 " CDID: %02x %02x %02x %02x %02x %02x %02x %02x\n"
314 " %02x %02x %02x %02x %02x %02x %02x %02x\n"
315 " nonce: %02x %02x %02x %02x %02x %02x %02x %02x\n"
316 " %02x %02x %02x %02x %02x %02x %02x %02x\n"
317 " MIC: %02x %02x %02x %02x %02x %02x %02x %02x\n",
318 hs->bMessageNumber, hs->bStatus,
319 hs->tTKID[2], hs->tTKID[1], hs->tTKID[0],
320 hs->CDID[0], hs->CDID[1], hs->CDID[2], hs->CDID[3],
321 hs->CDID[4], hs->CDID[5], hs->CDID[6], hs->CDID[7],
322 hs->CDID[8], hs->CDID[9], hs->CDID[10], hs->CDID[11],
323 hs->CDID[12], hs->CDID[13], hs->CDID[14], hs->CDID[15],
324 hs->nonce[0], hs->nonce[1], hs->nonce[2], hs->nonce[3],
325 hs->nonce[4], hs->nonce[5], hs->nonce[6], hs->nonce[7],
326 hs->nonce[8], hs->nonce[9], hs->nonce[10], hs->nonce[11],
327 hs->nonce[12], hs->nonce[13], hs->nonce[14], hs->nonce[15],
328 hs->MIC[0], hs->MIC[1], hs->MIC[2], hs->MIC[3],
329 hs->MIC[4], hs->MIC[5], hs->MIC[6], hs->MIC[7]);
330}
331
332/** 287/**
333 * Update the address of an unauthenticated WUSB device 288 * Update the address of an unauthenticated WUSB device
334 * 289 *
@@ -421,9 +376,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
421 get_random_bytes(&hs[0].nonce, sizeof(hs[0].nonce)); 376 get_random_bytes(&hs[0].nonce, sizeof(hs[0].nonce));
422 memset(hs[0].MIC, 0, sizeof(hs[0].MIC)); /* Per WUSB1.0[T7-22] */ 377 memset(hs[0].MIC, 0, sizeof(hs[0].MIC)); /* Per WUSB1.0[T7-22] */
423 378
424 d_printf(1, dev, "I: sending hs1:\n");
425 hs_printk(2, dev, &hs[0]);
426
427 result = usb_control_msg( 379 result = usb_control_msg(
428 usb_dev, usb_sndctrlpipe(usb_dev, 0), 380 usb_dev, usb_sndctrlpipe(usb_dev, 0),
429 USB_REQ_SET_HANDSHAKE, 381 USB_REQ_SET_HANDSHAKE,
@@ -444,8 +396,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
444 dev_err(dev, "Handshake2: request failed: %d\n", result); 396 dev_err(dev, "Handshake2: request failed: %d\n", result);
445 goto error_hs2; 397 goto error_hs2;
446 } 398 }
447 d_printf(1, dev, "got HS2:\n");
448 hs_printk(2, dev, &hs[1]);
449 399
450 result = -EINVAL; 400 result = -EINVAL;
451 if (hs[1].bMessageNumber != 2) { 401 if (hs[1].bMessageNumber != 2) {
@@ -486,10 +436,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
486 result); 436 result);
487 goto error_hs2; 437 goto error_hs2;
488 } 438 }
489 d_printf(2, dev, "KCK:\n");
490 d_dump(2, dev, keydvt_out.kck, sizeof(keydvt_out.kck));
491 d_printf(2, dev, "PTK:\n");
492 d_dump(2, dev, keydvt_out.ptk, sizeof(keydvt_out.ptk));
493 439
494 /* Compute MIC and verify it */ 440 /* Compute MIC and verify it */
495 result = wusb_oob_mic(mic, keydvt_out.kck, &ccm_n, &hs[1]); 441 result = wusb_oob_mic(mic, keydvt_out.kck, &ccm_n, &hs[1]);
@@ -499,8 +445,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
499 goto error_hs2; 445 goto error_hs2;
500 } 446 }
501 447
502 d_printf(2, dev, "MIC:\n");
503 d_dump(2, dev, mic, sizeof(mic));
504 if (memcmp(hs[1].MIC, mic, sizeof(hs[1].MIC))) { 448 if (memcmp(hs[1].MIC, mic, sizeof(hs[1].MIC))) {
505 dev_err(dev, "Handshake2 failed: MIC mismatch\n"); 449 dev_err(dev, "Handshake2 failed: MIC mismatch\n");
506 goto error_hs2; 450 goto error_hs2;
@@ -520,9 +464,6 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
520 goto error_hs2; 464 goto error_hs2;
521 } 465 }
522 466
523 d_printf(1, dev, "I: sending hs3:\n");
524 hs_printk(2, dev, &hs[2]);
525
526 result = usb_control_msg( 467 result = usb_control_msg(
527 usb_dev, usb_sndctrlpipe(usb_dev, 0), 468 usb_dev, usb_sndctrlpipe(usb_dev, 0),
528 USB_REQ_SET_HANDSHAKE, 469 USB_REQ_SET_HANDSHAKE,
@@ -533,14 +474,11 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
533 goto error_hs3; 474 goto error_hs3;
534 } 475 }
535 476
536 d_printf(1, dev, "I: turning on encryption on host for device\n");
537 d_dump(2, dev, keydvt_out.ptk, sizeof(keydvt_out.ptk));
538 result = wusbhc->set_ptk(wusbhc, wusb_dev->port_idx, tkid, 477 result = wusbhc->set_ptk(wusbhc, wusb_dev->port_idx, tkid,
539 keydvt_out.ptk, sizeof(keydvt_out.ptk)); 478 keydvt_out.ptk, sizeof(keydvt_out.ptk));
540 if (result < 0) 479 if (result < 0)
541 goto error_wusbhc_set_ptk; 480 goto error_wusbhc_set_ptk;
542 481
543 d_printf(1, dev, "I: setting a GTK\n");
544 result = wusb_dev_set_gtk(wusbhc, wusb_dev); 482 result = wusb_dev_set_gtk(wusbhc, wusb_dev);
545 if (result < 0) { 483 if (result < 0) {
546 dev_err(dev, "Set GTK for device: request failed: %d\n", 484 dev_err(dev, "Set GTK for device: request failed: %d\n",
@@ -550,13 +488,12 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev,
550 488
551 /* Update the device's address from unauth to auth */ 489 /* Update the device's address from unauth to auth */
552 if (usb_dev->authenticated == 0) { 490 if (usb_dev->authenticated == 0) {
553 d_printf(1, dev, "I: updating addres to auth from non-auth\n");
554 result = wusb_dev_update_address(wusbhc, wusb_dev); 491 result = wusb_dev_update_address(wusbhc, wusb_dev);
555 if (result < 0) 492 if (result < 0)
556 goto error_dev_update_address; 493 goto error_dev_update_address;
557 } 494 }
558 result = 0; 495 result = 0;
559 d_printf(1, dev, "I: 4way handshke done, device authenticated\n"); 496 dev_info(dev, "device authenticated\n");
560 497
561error_dev_update_address: 498error_dev_update_address:
562error_wusbhc_set_gtk: 499error_wusbhc_set_gtk:
@@ -569,10 +506,8 @@ error_hs1:
569 memset(&keydvt_in, 0, sizeof(keydvt_in)); 506 memset(&keydvt_in, 0, sizeof(keydvt_in));
570 memset(&ccm_n, 0, sizeof(ccm_n)); 507 memset(&ccm_n, 0, sizeof(ccm_n));
571 memset(mic, 0, sizeof(mic)); 508 memset(mic, 0, sizeof(mic));
572 if (result < 0) { 509 if (result < 0)
573 /* error path */
574 wusb_dev_set_encryption(usb_dev, 0); 510 wusb_dev_set_encryption(usb_dev, 0);
575 }
576error_dev_set_encryption: 511error_dev_set_encryption:
577 kfree(hs); 512 kfree(hs);
578error_kzalloc: 513error_kzalloc:
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);
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index c038635d1c64..238a96aee3a1 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -82,13 +82,10 @@
82#include <linux/init.h> 82#include <linux/init.h>
83#include <linux/spinlock.h> 83#include <linux/spinlock.h>
84#include <linux/hash.h> 84#include <linux/hash.h>
85
85#include "wa-hc.h" 86#include "wa-hc.h"
86#include "wusbhc.h" 87#include "wusbhc.h"
87 88
88#undef D_LOCAL
89#define D_LOCAL 0 /* 0 disabled, > 0 different levels... */
90#include <linux/uwb/debug.h>
91
92enum { 89enum {
93 WA_SEGS_MAX = 255, 90 WA_SEGS_MAX = 255,
94}; 91};
@@ -180,7 +177,6 @@ static void wa_xfer_destroy(struct kref *_xfer)
180 } 177 }
181 } 178 }
182 kfree(xfer); 179 kfree(xfer);
183 d_printf(2, NULL, "xfer %p destroyed\n", xfer);
184} 180}
185 181
186static void wa_xfer_get(struct wa_xfer *xfer) 182static void wa_xfer_get(struct wa_xfer *xfer)
@@ -190,10 +186,7 @@ static void wa_xfer_get(struct wa_xfer *xfer)
190 186
191static void wa_xfer_put(struct wa_xfer *xfer) 187static void wa_xfer_put(struct wa_xfer *xfer)
192{ 188{
193 d_fnstart(3, NULL, "(xfer %p) -- ref count bef put %d\n",
194 xfer, atomic_read(&xfer->refcnt.refcount));
195 kref_put(&xfer->refcnt, wa_xfer_destroy); 189 kref_put(&xfer->refcnt, wa_xfer_destroy);
196 d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
197} 190}
198 191
199/* 192/*
@@ -209,7 +202,7 @@ static void wa_xfer_put(struct wa_xfer *xfer)
209static void wa_xfer_giveback(struct wa_xfer *xfer) 202static void wa_xfer_giveback(struct wa_xfer *xfer)
210{ 203{
211 unsigned long flags; 204 unsigned long flags;
212 d_fnstart(3, NULL, "(xfer %p)\n", xfer); 205
213 spin_lock_irqsave(&xfer->wa->xfer_list_lock, flags); 206 spin_lock_irqsave(&xfer->wa->xfer_list_lock, flags);
214 list_del_init(&xfer->list_node); 207 list_del_init(&xfer->list_node);
215 spin_unlock_irqrestore(&xfer->wa->xfer_list_lock, flags); 208 spin_unlock_irqrestore(&xfer->wa->xfer_list_lock, flags);
@@ -217,7 +210,6 @@ static void wa_xfer_giveback(struct wa_xfer *xfer)
217 wusbhc_giveback_urb(xfer->wa->wusb, xfer->urb, xfer->result); 210 wusbhc_giveback_urb(xfer->wa->wusb, xfer->urb, xfer->result);
218 wa_put(xfer->wa); 211 wa_put(xfer->wa);
219 wa_xfer_put(xfer); 212 wa_xfer_put(xfer);
220 d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
221} 213}
222 214
223/* 215/*
@@ -227,13 +219,10 @@ static void wa_xfer_giveback(struct wa_xfer *xfer)
227 */ 219 */
228static void wa_xfer_completion(struct wa_xfer *xfer) 220static void wa_xfer_completion(struct wa_xfer *xfer)
229{ 221{
230 d_fnstart(3, NULL, "(xfer %p)\n", xfer);
231 if (xfer->wusb_dev) 222 if (xfer->wusb_dev)
232 wusb_dev_put(xfer->wusb_dev); 223 wusb_dev_put(xfer->wusb_dev);
233 rpipe_put(xfer->ep->hcpriv); 224 rpipe_put(xfer->ep->hcpriv);
234 wa_xfer_giveback(xfer); 225 wa_xfer_giveback(xfer);
235 d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
236 return;
237} 226}
238 227
239/* 228/*
@@ -243,12 +232,12 @@ static void wa_xfer_completion(struct wa_xfer *xfer)
243 */ 232 */
244static unsigned __wa_xfer_is_done(struct wa_xfer *xfer) 233static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
245{ 234{
235 struct device *dev = &xfer->wa->usb_iface->dev;
246 unsigned result, cnt; 236 unsigned result, cnt;
247 struct wa_seg *seg; 237 struct wa_seg *seg;
248 struct urb *urb = xfer->urb; 238 struct urb *urb = xfer->urb;
249 unsigned found_short = 0; 239 unsigned found_short = 0;
250 240
251 d_fnstart(3, NULL, "(xfer %p)\n", xfer);
252 result = xfer->segs_done == xfer->segs_submitted; 241 result = xfer->segs_done == xfer->segs_submitted;
253 if (result == 0) 242 if (result == 0)
254 goto out; 243 goto out;
@@ -258,10 +247,8 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
258 switch (seg->status) { 247 switch (seg->status) {
259 case WA_SEG_DONE: 248 case WA_SEG_DONE:
260 if (found_short && seg->result > 0) { 249 if (found_short && seg->result > 0) {
261 if (printk_ratelimit()) 250 dev_dbg(dev, "xfer %p#%u: bad short segments (%zu)\n",
262 printk(KERN_ERR "xfer %p#%u: bad short " 251 xfer, cnt, seg->result);
263 "segments (%zu)\n", xfer, cnt,
264 seg->result);
265 urb->status = -EINVAL; 252 urb->status = -EINVAL;
266 goto out; 253 goto out;
267 } 254 }
@@ -269,36 +256,30 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
269 if (seg->result < xfer->seg_size 256 if (seg->result < xfer->seg_size
270 && cnt != xfer->segs-1) 257 && cnt != xfer->segs-1)
271 found_short = 1; 258 found_short = 1;
272 d_printf(2, NULL, "xfer %p#%u: DONE short %d " 259 dev_dbg(dev, "xfer %p#%u: DONE short %d "
273 "result %zu urb->actual_length %d\n", 260 "result %zu urb->actual_length %d\n",
274 xfer, seg->index, found_short, seg->result, 261 xfer, seg->index, found_short, seg->result,
275 urb->actual_length); 262 urb->actual_length);
276 break; 263 break;
277 case WA_SEG_ERROR: 264 case WA_SEG_ERROR:
278 xfer->result = seg->result; 265 xfer->result = seg->result;
279 d_printf(2, NULL, "xfer %p#%u: ERROR result %zu\n", 266 dev_dbg(dev, "xfer %p#%u: ERROR result %zu\n",
280 xfer, seg->index, seg->result); 267 xfer, seg->index, seg->result);
281 goto out; 268 goto out;
282 case WA_SEG_ABORTED: 269 case WA_SEG_ABORTED:
283 WARN_ON(urb->status != -ECONNRESET 270 dev_dbg(dev, "xfer %p#%u ABORTED: result %d\n",
284 && urb->status != -ENOENT); 271 xfer, seg->index, urb->status);
285 d_printf(2, NULL, "xfer %p#%u ABORTED: result %d\n",
286 xfer, seg->index, urb->status);
287 xfer->result = urb->status; 272 xfer->result = urb->status;
288 goto out; 273 goto out;
289 default: 274 default:
290 /* if (printk_ratelimit()) */ 275 dev_warn(dev, "xfer %p#%u: is_done bad state %d\n",
291 printk(KERN_ERR "xfer %p#%u: " 276 xfer, cnt, seg->status);
292 "is_done bad state %d\n",
293 xfer, cnt, seg->status);
294 xfer->result = -EINVAL; 277 xfer->result = -EINVAL;
295 WARN_ON(1);
296 goto out; 278 goto out;
297 } 279 }
298 } 280 }
299 xfer->result = 0; 281 xfer->result = 0;
300out: 282out:
301 d_fnend(3, NULL, "(xfer %p) = void\n", xfer);
302 return result; 283 return result;
303} 284}
304 285
@@ -424,8 +405,6 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
424 struct urb *urb = xfer->urb; 405 struct urb *urb = xfer->urb;
425 struct wa_rpipe *rpipe = xfer->ep->hcpriv; 406 struct wa_rpipe *rpipe = xfer->ep->hcpriv;
426 407
427 d_fnstart(3, dev, "(xfer %p [rpipe %p] urb %p)\n",
428 xfer, rpipe, urb);
429 switch (rpipe->descr.bmAttribute & 0x3) { 408 switch (rpipe->descr.bmAttribute & 0x3) {
430 case USB_ENDPOINT_XFER_CONTROL: 409 case USB_ENDPOINT_XFER_CONTROL:
431 *pxfer_type = WA_XFER_TYPE_CTL; 410 *pxfer_type = WA_XFER_TYPE_CTL;
@@ -472,12 +451,10 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
472 if (xfer->segs == 0 && *pxfer_type == WA_XFER_TYPE_CTL) 451 if (xfer->segs == 0 && *pxfer_type == WA_XFER_TYPE_CTL)
473 xfer->segs = 1; 452 xfer->segs = 1;
474error: 453error:
475 d_fnend(3, dev, "(xfer %p [rpipe %p] urb %p) = %d\n",
476 xfer, rpipe, urb, (int)result);
477 return result; 454 return result;
478} 455}
479 456
480/** Fill in the common request header and xfer-type specific data. */ 457/* Fill in the common request header and xfer-type specific data. */
481static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer, 458static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer,
482 struct wa_xfer_hdr *xfer_hdr0, 459 struct wa_xfer_hdr *xfer_hdr0,
483 enum wa_xfer_type xfer_type, 460 enum wa_xfer_type xfer_type,
@@ -534,14 +511,13 @@ static void wa_seg_dto_cb(struct urb *urb)
534 unsigned rpipe_ready = 0; 511 unsigned rpipe_ready = 0;
535 u8 done = 0; 512 u8 done = 0;
536 513
537 d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
538 switch (urb->status) { 514 switch (urb->status) {
539 case 0: 515 case 0:
540 spin_lock_irqsave(&xfer->lock, flags); 516 spin_lock_irqsave(&xfer->lock, flags);
541 wa = xfer->wa; 517 wa = xfer->wa;
542 dev = &wa->usb_iface->dev; 518 dev = &wa->usb_iface->dev;
543 d_printf(2, dev, "xfer %p#%u: data out done (%d bytes)\n", 519 dev_dbg(dev, "xfer %p#%u: data out done (%d bytes)\n",
544 xfer, seg->index, urb->actual_length); 520 xfer, seg->index, urb->actual_length);
545 if (seg->status < WA_SEG_PENDING) 521 if (seg->status < WA_SEG_PENDING)
546 seg->status = WA_SEG_PENDING; 522 seg->status = WA_SEG_PENDING;
547 seg->result = urb->actual_length; 523 seg->result = urb->actual_length;
@@ -555,9 +531,8 @@ static void wa_seg_dto_cb(struct urb *urb)
555 wa = xfer->wa; 531 wa = xfer->wa;
556 dev = &wa->usb_iface->dev; 532 dev = &wa->usb_iface->dev;
557 rpipe = xfer->ep->hcpriv; 533 rpipe = xfer->ep->hcpriv;
558 if (printk_ratelimit()) 534 dev_dbg(dev, "xfer %p#%u: data out error %d\n",
559 dev_err(dev, "xfer %p#%u: data out error %d\n", 535 xfer, seg->index, urb->status);
560 xfer, seg->index, urb->status);
561 if (edc_inc(&wa->nep_edc, EDC_MAX_ERRORS, 536 if (edc_inc(&wa->nep_edc, EDC_MAX_ERRORS,
562 EDC_ERROR_TIMEFRAME)){ 537 EDC_ERROR_TIMEFRAME)){
563 dev_err(dev, "DTO: URB max acceptable errors " 538 dev_err(dev, "DTO: URB max acceptable errors "
@@ -578,7 +553,6 @@ static void wa_seg_dto_cb(struct urb *urb)
578 if (rpipe_ready) 553 if (rpipe_ready)
579 wa_xfer_delayed_run(rpipe); 554 wa_xfer_delayed_run(rpipe);
580 } 555 }
581 d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
582} 556}
583 557
584/* 558/*
@@ -610,14 +584,12 @@ static void wa_seg_cb(struct urb *urb)
610 unsigned rpipe_ready; 584 unsigned rpipe_ready;
611 u8 done = 0; 585 u8 done = 0;
612 586
613 d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
614 switch (urb->status) { 587 switch (urb->status) {
615 case 0: 588 case 0:
616 spin_lock_irqsave(&xfer->lock, flags); 589 spin_lock_irqsave(&xfer->lock, flags);
617 wa = xfer->wa; 590 wa = xfer->wa;
618 dev = &wa->usb_iface->dev; 591 dev = &wa->usb_iface->dev;
619 d_printf(2, dev, "xfer %p#%u: request done\n", 592 dev_dbg(dev, "xfer %p#%u: request done\n", xfer, seg->index);
620 xfer, seg->index);
621 if (xfer->is_inbound && seg->status < WA_SEG_PENDING) 593 if (xfer->is_inbound && seg->status < WA_SEG_PENDING)
622 seg->status = WA_SEG_PENDING; 594 seg->status = WA_SEG_PENDING;
623 spin_unlock_irqrestore(&xfer->lock, flags); 595 spin_unlock_irqrestore(&xfer->lock, flags);
@@ -652,7 +624,6 @@ static void wa_seg_cb(struct urb *urb)
652 if (rpipe_ready) 624 if (rpipe_ready)
653 wa_xfer_delayed_run(rpipe); 625 wa_xfer_delayed_run(rpipe);
654 } 626 }
655 d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
656} 627}
657 628
658/* 629/*
@@ -750,9 +721,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb)
750 size_t xfer_hdr_size, cnt, transfer_size; 721 size_t xfer_hdr_size, cnt, transfer_size;
751 struct wa_xfer_hdr *xfer_hdr0, *xfer_hdr; 722 struct wa_xfer_hdr *xfer_hdr0, *xfer_hdr;
752 723
753 d_fnstart(3, dev, "(xfer %p [rpipe %p] urb %p)\n",
754 xfer, xfer->ep->hcpriv, urb);
755
756 result = __wa_xfer_setup_sizes(xfer, &xfer_type); 724 result = __wa_xfer_setup_sizes(xfer, &xfer_type);
757 if (result < 0) 725 if (result < 0)
758 goto error_setup_sizes; 726 goto error_setup_sizes;
@@ -788,8 +756,6 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb)
788 result = 0; 756 result = 0;
789error_setup_segs: 757error_setup_segs:
790error_setup_sizes: 758error_setup_sizes:
791 d_fnend(3, dev, "(xfer %p [rpipe %p] urb %p) = %d\n",
792 xfer, xfer->ep->hcpriv, urb, result);
793 return result; 759 return result;
794} 760}
795 761
@@ -843,9 +809,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
843 struct wa_xfer *xfer; 809 struct wa_xfer *xfer;
844 unsigned long flags; 810 unsigned long flags;
845 811
846 d_fnstart(1, dev, "(rpipe #%d) %d segments available\n",
847 le16_to_cpu(rpipe->descr.wRPipeIndex),
848 atomic_read(&rpipe->segs_available));
849 spin_lock_irqsave(&rpipe->seg_lock, flags); 812 spin_lock_irqsave(&rpipe->seg_lock, flags);
850 while (atomic_read(&rpipe->segs_available) > 0 813 while (atomic_read(&rpipe->segs_available) > 0
851 && !list_empty(&rpipe->seg_list)) { 814 && !list_empty(&rpipe->seg_list)) {
@@ -854,10 +817,8 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
854 list_del(&seg->list_node); 817 list_del(&seg->list_node);
855 xfer = seg->xfer; 818 xfer = seg->xfer;
856 result = __wa_seg_submit(rpipe, xfer, seg); 819 result = __wa_seg_submit(rpipe, xfer, seg);
857 d_printf(1, dev, "xfer %p#%u submitted from delayed " 820 dev_dbg(dev, "xfer %p#%u submitted from delayed [%d segments available] %d\n",
858 "[%d segments available] %d\n", 821 xfer, seg->index, atomic_read(&rpipe->segs_available), result);
859 xfer, seg->index,
860 atomic_read(&rpipe->segs_available), result);
861 if (unlikely(result < 0)) { 822 if (unlikely(result < 0)) {
862 spin_unlock_irqrestore(&rpipe->seg_lock, flags); 823 spin_unlock_irqrestore(&rpipe->seg_lock, flags);
863 spin_lock_irqsave(&xfer->lock, flags); 824 spin_lock_irqsave(&xfer->lock, flags);
@@ -868,10 +829,6 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
868 } 829 }
869 } 830 }
870 spin_unlock_irqrestore(&rpipe->seg_lock, flags); 831 spin_unlock_irqrestore(&rpipe->seg_lock, flags);
871 d_fnend(1, dev, "(rpipe #%d) = void, %d segments available\n",
872 le16_to_cpu(rpipe->descr.wRPipeIndex),
873 atomic_read(&rpipe->segs_available));
874
875} 832}
876 833
877/* 834/*
@@ -894,9 +851,6 @@ static int __wa_xfer_submit(struct wa_xfer *xfer)
894 u8 available; 851 u8 available;
895 u8 empty; 852 u8 empty;
896 853
897 d_fnstart(3, dev, "(xfer %p [rpipe %p])\n",
898 xfer, xfer->ep->hcpriv);
899
900 spin_lock_irqsave(&wa->xfer_list_lock, flags); 854 spin_lock_irqsave(&wa->xfer_list_lock, flags);
901 list_add_tail(&xfer->list_node, &wa->xfer_list); 855 list_add_tail(&xfer->list_node, &wa->xfer_list);
902 spin_unlock_irqrestore(&wa->xfer_list_lock, flags); 856 spin_unlock_irqrestore(&wa->xfer_list_lock, flags);
@@ -908,30 +862,24 @@ static int __wa_xfer_submit(struct wa_xfer *xfer)
908 available = atomic_read(&rpipe->segs_available); 862 available = atomic_read(&rpipe->segs_available);
909 empty = list_empty(&rpipe->seg_list); 863 empty = list_empty(&rpipe->seg_list);
910 seg = xfer->seg[cnt]; 864 seg = xfer->seg[cnt];
911 d_printf(2, dev, "xfer %p#%u: available %u empty %u (%s)\n", 865 dev_dbg(dev, "xfer %p#%u: available %u empty %u (%s)\n",
912 xfer, cnt, available, empty, 866 xfer, cnt, available, empty,
913 available == 0 || !empty ? "delayed" : "submitted"); 867 available == 0 || !empty ? "delayed" : "submitted");
914 if (available == 0 || !empty) { 868 if (available == 0 || !empty) {
915 d_printf(1, dev, "xfer %p#%u: delayed\n", xfer, cnt); 869 dev_dbg(dev, "xfer %p#%u: delayed\n", xfer, cnt);
916 seg->status = WA_SEG_DELAYED; 870 seg->status = WA_SEG_DELAYED;
917 list_add_tail(&seg->list_node, &rpipe->seg_list); 871 list_add_tail(&seg->list_node, &rpipe->seg_list);
918 } else { 872 } else {
919 result = __wa_seg_submit(rpipe, xfer, seg); 873 result = __wa_seg_submit(rpipe, xfer, seg);
920 if (result < 0) 874 if (result < 0) {
875 __wa_xfer_abort(xfer);
921 goto error_seg_submit; 876 goto error_seg_submit;
877 }
922 } 878 }
923 xfer->segs_submitted++; 879 xfer->segs_submitted++;
924 } 880 }
925 spin_unlock_irqrestore(&rpipe->seg_lock, flags);
926 d_fnend(3, dev, "(xfer %p [rpipe %p]) = void\n", xfer,
927 xfer->ep->hcpriv);
928 return result;
929
930error_seg_submit: 881error_seg_submit:
931 __wa_xfer_abort(xfer);
932 spin_unlock_irqrestore(&rpipe->seg_lock, flags); 882 spin_unlock_irqrestore(&rpipe->seg_lock, flags);
933 d_fnend(3, dev, "(xfer %p [rpipe %p]) = void\n", xfer,
934 xfer->ep->hcpriv);
935 return result; 883 return result;
936} 884}
937 885
@@ -964,11 +912,9 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
964 struct urb *urb = xfer->urb; 912 struct urb *urb = xfer->urb;
965 struct wahc *wa = xfer->wa; 913 struct wahc *wa = xfer->wa;
966 struct wusbhc *wusbhc = wa->wusb; 914 struct wusbhc *wusbhc = wa->wusb;
967 struct device *dev = &wa->usb_iface->dev;
968 struct wusb_dev *wusb_dev; 915 struct wusb_dev *wusb_dev;
969 unsigned done; 916 unsigned done;
970 917
971 d_fnstart(3, dev, "(wa %p urb %p)\n", wa, urb);
972 result = rpipe_get_by_ep(wa, xfer->ep, urb, xfer->gfp); 918 result = rpipe_get_by_ep(wa, xfer->ep, urb, xfer->gfp);
973 if (result < 0) 919 if (result < 0)
974 goto error_rpipe_get; 920 goto error_rpipe_get;
@@ -997,7 +943,6 @@ static void wa_urb_enqueue_b(struct wa_xfer *xfer)
997 if (result < 0) 943 if (result < 0)
998 goto error_xfer_submit; 944 goto error_xfer_submit;
999 spin_unlock_irqrestore(&xfer->lock, flags); 945 spin_unlock_irqrestore(&xfer->lock, flags);
1000 d_fnend(3, dev, "(wa %p urb %p) = void\n", wa, urb);
1001 return; 946 return;
1002 947
1003 /* this is basically wa_xfer_completion() broken up wa_xfer_giveback() 948 /* this is basically wa_xfer_completion() broken up wa_xfer_giveback()
@@ -1015,7 +960,6 @@ error_dev_gone:
1015error_rpipe_get: 960error_rpipe_get:
1016 xfer->result = result; 961 xfer->result = result;
1017 wa_xfer_giveback(xfer); 962 wa_xfer_giveback(xfer);
1018 d_fnend(3, dev, "(wa %p urb %p) = (void) %d\n", wa, urb, result);
1019 return; 963 return;
1020 964
1021error_xfer_submit: 965error_xfer_submit:
@@ -1024,8 +968,6 @@ error_xfer_submit:
1024 spin_unlock_irqrestore(&xfer->lock, flags); 968 spin_unlock_irqrestore(&xfer->lock, flags);
1025 if (done) 969 if (done)
1026 wa_xfer_completion(xfer); 970 wa_xfer_completion(xfer);
1027 d_fnend(3, dev, "(wa %p urb %p) = (void) %d\n", wa, urb, result);
1028 return;
1029} 971}
1030 972
1031/* 973/*
@@ -1041,11 +983,9 @@ error_xfer_submit:
1041void wa_urb_enqueue_run(struct work_struct *ws) 983void wa_urb_enqueue_run(struct work_struct *ws)
1042{ 984{
1043 struct wahc *wa = container_of(ws, struct wahc, xfer_work); 985 struct wahc *wa = container_of(ws, struct wahc, xfer_work);
1044 struct device *dev = &wa->usb_iface->dev;
1045 struct wa_xfer *xfer, *next; 986 struct wa_xfer *xfer, *next;
1046 struct urb *urb; 987 struct urb *urb;
1047 988
1048 d_fnstart(3, dev, "(wa %p)\n", wa);
1049 spin_lock_irq(&wa->xfer_list_lock); 989 spin_lock_irq(&wa->xfer_list_lock);
1050 list_for_each_entry_safe(xfer, next, &wa->xfer_delayed_list, 990 list_for_each_entry_safe(xfer, next, &wa->xfer_delayed_list,
1051 list_node) { 991 list_node) {
@@ -1059,7 +999,6 @@ void wa_urb_enqueue_run(struct work_struct *ws)
1059 spin_lock_irq(&wa->xfer_list_lock); 999 spin_lock_irq(&wa->xfer_list_lock);
1060 } 1000 }
1061 spin_unlock_irq(&wa->xfer_list_lock); 1001 spin_unlock_irq(&wa->xfer_list_lock);
1062 d_fnend(3, dev, "(wa %p) = void\n", wa);
1063} 1002}
1064EXPORT_SYMBOL_GPL(wa_urb_enqueue_run); 1003EXPORT_SYMBOL_GPL(wa_urb_enqueue_run);
1065 1004
@@ -1084,9 +1023,6 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
1084 unsigned long my_flags; 1023 unsigned long my_flags;
1085 unsigned cant_sleep = irqs_disabled() | in_atomic(); 1024 unsigned cant_sleep = irqs_disabled() | in_atomic();
1086 1025
1087 d_fnstart(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x)\n",
1088 wa, ep, urb, urb->transfer_buffer_length, gfp);
1089
1090 if (urb->transfer_buffer == NULL 1026 if (urb->transfer_buffer == NULL
1091 && !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) 1027 && !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
1092 && urb->transfer_buffer_length != 0) { 1028 && urb->transfer_buffer_length != 0) {
@@ -1108,11 +1044,13 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
1108 xfer->gfp = gfp; 1044 xfer->gfp = gfp;
1109 xfer->ep = ep; 1045 xfer->ep = ep;
1110 urb->hcpriv = xfer; 1046 urb->hcpriv = xfer;
1111 d_printf(2, dev, "xfer %p urb %p pipe 0x%02x [%d bytes] %s %s %s\n", 1047
1112 xfer, urb, urb->pipe, urb->transfer_buffer_length, 1048 dev_dbg(dev, "xfer %p urb %p pipe 0x%02x [%d bytes] %s %s %s\n",
1113 urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? "dma" : "nodma", 1049 xfer, urb, urb->pipe, urb->transfer_buffer_length,
1114 urb->pipe & USB_DIR_IN ? "inbound" : "outbound", 1050 urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? "dma" : "nodma",
1115 cant_sleep ? "deferred" : "inline"); 1051 urb->pipe & USB_DIR_IN ? "inbound" : "outbound",
1052 cant_sleep ? "deferred" : "inline");
1053
1116 if (cant_sleep) { 1054 if (cant_sleep) {
1117 usb_get_urb(urb); 1055 usb_get_urb(urb);
1118 spin_lock_irqsave(&wa->xfer_list_lock, my_flags); 1056 spin_lock_irqsave(&wa->xfer_list_lock, my_flags);
@@ -1122,15 +1060,11 @@ int wa_urb_enqueue(struct wahc *wa, struct usb_host_endpoint *ep,
1122 } else { 1060 } else {
1123 wa_urb_enqueue_b(xfer); 1061 wa_urb_enqueue_b(xfer);
1124 } 1062 }
1125 d_fnend(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x) = 0\n",
1126 wa, ep, urb, urb->transfer_buffer_length, gfp);
1127 return 0; 1063 return 0;
1128 1064
1129error_dequeued: 1065error_dequeued:
1130 kfree(xfer); 1066 kfree(xfer);
1131error_kmalloc: 1067error_kmalloc:
1132 d_fnend(3, dev, "(wa %p ep %p urb %p [%d] gfp 0x%x) = %d\n",
1133 wa, ep, urb, urb->transfer_buffer_length, gfp, result);
1134 return result; 1068 return result;
1135} 1069}
1136EXPORT_SYMBOL_GPL(wa_urb_enqueue); 1070EXPORT_SYMBOL_GPL(wa_urb_enqueue);
@@ -1155,7 +1089,6 @@ EXPORT_SYMBOL_GPL(wa_urb_enqueue);
1155 */ 1089 */
1156int wa_urb_dequeue(struct wahc *wa, struct urb *urb) 1090int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
1157{ 1091{
1158 struct device *dev = &wa->usb_iface->dev;
1159 unsigned long flags, flags2; 1092 unsigned long flags, flags2;
1160 struct wa_xfer *xfer; 1093 struct wa_xfer *xfer;
1161 struct wa_seg *seg; 1094 struct wa_seg *seg;
@@ -1163,9 +1096,6 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
1163 unsigned cnt; 1096 unsigned cnt;
1164 unsigned rpipe_ready = 0; 1097 unsigned rpipe_ready = 0;
1165 1098
1166 d_fnstart(3, dev, "(wa %p, urb %p)\n", wa, urb);
1167
1168 d_printf(1, dev, "xfer %p urb %p: aborting\n", urb->hcpriv, urb);
1169 xfer = urb->hcpriv; 1099 xfer = urb->hcpriv;
1170 if (xfer == NULL) { 1100 if (xfer == NULL) {
1171 /* NOthing setup yet enqueue will see urb->status != 1101 /* NOthing setup yet enqueue will see urb->status !=
@@ -1234,13 +1164,11 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb)
1234 wa_xfer_completion(xfer); 1164 wa_xfer_completion(xfer);
1235 if (rpipe_ready) 1165 if (rpipe_ready)
1236 wa_xfer_delayed_run(rpipe); 1166 wa_xfer_delayed_run(rpipe);
1237 d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
1238 return 0; 1167 return 0;
1239 1168
1240out_unlock: 1169out_unlock:
1241 spin_unlock_irqrestore(&xfer->lock, flags); 1170 spin_unlock_irqrestore(&xfer->lock, flags);
1242out: 1171out:
1243 d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
1244 return 0; 1172 return 0;
1245 1173
1246dequeue_delayed: 1174dequeue_delayed:
@@ -1250,7 +1178,6 @@ dequeue_delayed:
1250 spin_unlock_irqrestore(&xfer->lock, flags); 1178 spin_unlock_irqrestore(&xfer->lock, flags);
1251 wa_xfer_giveback(xfer); 1179 wa_xfer_giveback(xfer);
1252 usb_put_urb(urb); /* we got a ref in enqueue() */ 1180 usb_put_urb(urb); /* we got a ref in enqueue() */
1253 d_fnend(3, dev, "(wa %p, urb %p) = 0\n", wa, urb);
1254 return 0; 1181 return 0;
1255} 1182}
1256EXPORT_SYMBOL_GPL(wa_urb_dequeue); 1183EXPORT_SYMBOL_GPL(wa_urb_dequeue);
@@ -1326,7 +1253,6 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
1326 u8 usb_status; 1253 u8 usb_status;
1327 unsigned rpipe_ready = 0; 1254 unsigned rpipe_ready = 0;
1328 1255
1329 d_fnstart(3, dev, "(wa %p xfer %p)\n", wa, xfer);
1330 spin_lock_irqsave(&xfer->lock, flags); 1256 spin_lock_irqsave(&xfer->lock, flags);
1331 seg_idx = xfer_result->bTransferSegment & 0x7f; 1257 seg_idx = xfer_result->bTransferSegment & 0x7f;
1332 if (unlikely(seg_idx >= xfer->segs)) 1258 if (unlikely(seg_idx >= xfer->segs))
@@ -1334,8 +1260,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
1334 seg = xfer->seg[seg_idx]; 1260 seg = xfer->seg[seg_idx];
1335 rpipe = xfer->ep->hcpriv; 1261 rpipe = xfer->ep->hcpriv;
1336 usb_status = xfer_result->bTransferStatus; 1262 usb_status = xfer_result->bTransferStatus;
1337 d_printf(2, dev, "xfer %p#%u: bTransferStatus 0x%02x (seg %u)\n", 1263 dev_dbg(dev, "xfer %p#%u: bTransferStatus 0x%02x (seg %u)\n",
1338 xfer, seg_idx, usb_status, seg->status); 1264 xfer, seg_idx, usb_status, seg->status);
1339 if (seg->status == WA_SEG_ABORTED 1265 if (seg->status == WA_SEG_ABORTED
1340 || seg->status == WA_SEG_ERROR) /* already handled */ 1266 || seg->status == WA_SEG_ERROR) /* already handled */
1341 goto segment_aborted; 1267 goto segment_aborted;
@@ -1391,10 +1317,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer)
1391 wa_xfer_completion(xfer); 1317 wa_xfer_completion(xfer);
1392 if (rpipe_ready) 1318 if (rpipe_ready)
1393 wa_xfer_delayed_run(rpipe); 1319 wa_xfer_delayed_run(rpipe);
1394 d_fnend(3, dev, "(wa %p xfer %p) = void\n", wa, xfer);
1395 return; 1320 return;
1396 1321
1397
1398error_submit_buf_in: 1322error_submit_buf_in:
1399 if (edc_inc(&wa->dti_edc, EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) { 1323 if (edc_inc(&wa->dti_edc, EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
1400 dev_err(dev, "DTI: URB max acceptable errors " 1324 dev_err(dev, "DTI: URB max acceptable errors "
@@ -1416,11 +1340,8 @@ error_complete:
1416 wa_xfer_completion(xfer); 1340 wa_xfer_completion(xfer);
1417 if (rpipe_ready) 1341 if (rpipe_ready)
1418 wa_xfer_delayed_run(rpipe); 1342 wa_xfer_delayed_run(rpipe);
1419 d_fnend(3, dev, "(wa %p xfer %p) = void [segment/DTI-submit error]\n",
1420 wa, xfer);
1421 return; 1343 return;
1422 1344
1423
1424error_bad_seg: 1345error_bad_seg:
1425 spin_unlock_irqrestore(&xfer->lock, flags); 1346 spin_unlock_irqrestore(&xfer->lock, flags);
1426 wa_urb_dequeue(wa, xfer->urb); 1347 wa_urb_dequeue(wa, xfer->urb);
@@ -1431,17 +1352,11 @@ error_bad_seg:
1431 "exceeded, resetting device\n"); 1352 "exceeded, resetting device\n");
1432 wa_reset_all(wa); 1353 wa_reset_all(wa);
1433 } 1354 }
1434 d_fnend(3, dev, "(wa %p xfer %p) = void [bad seg]\n", wa, xfer);
1435 return; 1355 return;
1436 1356
1437
1438segment_aborted: 1357segment_aborted:
1439 /* nothing to do, as the aborter did the completion */ 1358 /* nothing to do, as the aborter did the completion */
1440 spin_unlock_irqrestore(&xfer->lock, flags); 1359 spin_unlock_irqrestore(&xfer->lock, flags);
1441 d_fnend(3, dev, "(wa %p xfer %p) = void [segment aborted]\n",
1442 wa, xfer);
1443 return;
1444
1445} 1360}
1446 1361
1447/* 1362/*
@@ -1465,15 +1380,14 @@ static void wa_buf_in_cb(struct urb *urb)
1465 unsigned long flags; 1380 unsigned long flags;
1466 u8 done = 0; 1381 u8 done = 0;
1467 1382
1468 d_fnstart(3, NULL, "(urb %p [%d])\n", urb, urb->status);
1469 switch (urb->status) { 1383 switch (urb->status) {
1470 case 0: 1384 case 0:
1471 spin_lock_irqsave(&xfer->lock, flags); 1385 spin_lock_irqsave(&xfer->lock, flags);
1472 wa = xfer->wa; 1386 wa = xfer->wa;
1473 dev = &wa->usb_iface->dev; 1387 dev = &wa->usb_iface->dev;
1474 rpipe = xfer->ep->hcpriv; 1388 rpipe = xfer->ep->hcpriv;
1475 d_printf(2, dev, "xfer %p#%u: data in done (%zu bytes)\n", 1389 dev_dbg(dev, "xfer %p#%u: data in done (%zu bytes)\n",
1476 xfer, seg->index, (size_t)urb->actual_length); 1390 xfer, seg->index, (size_t)urb->actual_length);
1477 seg->status = WA_SEG_DONE; 1391 seg->status = WA_SEG_DONE;
1478 seg->result = urb->actual_length; 1392 seg->result = urb->actual_length;
1479 xfer->segs_done++; 1393 xfer->segs_done++;
@@ -1514,7 +1428,6 @@ static void wa_buf_in_cb(struct urb *urb)
1514 if (rpipe_ready) 1428 if (rpipe_ready)
1515 wa_xfer_delayed_run(rpipe); 1429 wa_xfer_delayed_run(rpipe);
1516 } 1430 }
1517 d_fnend(3, NULL, "(urb %p [%d]) = void\n", urb, urb->status);
1518} 1431}
1519 1432
1520/* 1433/*
@@ -1553,14 +1466,12 @@ static void wa_xfer_result_cb(struct urb *urb)
1553 struct wa_xfer *xfer; 1466 struct wa_xfer *xfer;
1554 u8 usb_status; 1467 u8 usb_status;
1555 1468
1556 d_fnstart(3, dev, "(%p)\n", wa);
1557 BUG_ON(wa->dti_urb != urb); 1469 BUG_ON(wa->dti_urb != urb);
1558 switch (wa->dti_urb->status) { 1470 switch (wa->dti_urb->status) {
1559 case 0: 1471 case 0:
1560 /* We have a xfer result buffer; check it */ 1472 /* We have a xfer result buffer; check it */
1561 d_printf(2, dev, "DTI: xfer result %d bytes at %p\n", 1473 dev_dbg(dev, "DTI: xfer result %d bytes at %p\n",
1562 urb->actual_length, urb->transfer_buffer); 1474 urb->actual_length, urb->transfer_buffer);
1563 d_dump(3, dev, urb->transfer_buffer, urb->actual_length);
1564 if (wa->dti_urb->actual_length != sizeof(*xfer_result)) { 1475 if (wa->dti_urb->actual_length != sizeof(*xfer_result)) {
1565 dev_err(dev, "DTI Error: xfer result--bad size " 1476 dev_err(dev, "DTI Error: xfer result--bad size "
1566 "xfer result (%d bytes vs %zu needed)\n", 1477 "xfer result (%d bytes vs %zu needed)\n",
@@ -1622,7 +1533,6 @@ static void wa_xfer_result_cb(struct urb *urb)
1622 wa_reset_all(wa); 1533 wa_reset_all(wa);
1623 } 1534 }
1624out: 1535out:
1625 d_fnend(3, dev, "(%p) = void\n", wa);
1626 return; 1536 return;
1627} 1537}
1628 1538
@@ -1653,7 +1563,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)
1653 struct wa_notif_xfer *notif_xfer; 1563 struct wa_notif_xfer *notif_xfer;
1654 const struct usb_endpoint_descriptor *dti_epd = wa->dti_epd; 1564 const struct usb_endpoint_descriptor *dti_epd = wa->dti_epd;
1655 1565
1656 d_fnstart(4, dev, "(%p, %p)\n", wa, notif_hdr);
1657 notif_xfer = container_of(notif_hdr, struct wa_notif_xfer, hdr); 1566 notif_xfer = container_of(notif_hdr, struct wa_notif_xfer, hdr);
1658 BUG_ON(notif_hdr->bNotifyType != WA_NOTIF_TRANSFER); 1567 BUG_ON(notif_hdr->bNotifyType != WA_NOTIF_TRANSFER);
1659 1568
@@ -1693,7 +1602,6 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)
1693 goto error_dti_urb_submit; 1602 goto error_dti_urb_submit;
1694 } 1603 }
1695out: 1604out:
1696 d_fnend(4, dev, "(%p, %p) = void\n", wa, notif_hdr);
1697 return; 1605 return;
1698 1606
1699error_dti_urb_submit: 1607error_dti_urb_submit:
@@ -1704,6 +1612,4 @@ error_buf_in_urb_alloc:
1704error_dti_urb_alloc: 1612error_dti_urb_alloc:
1705error: 1613error:
1706 wa_reset_all(wa); 1614 wa_reset_all(wa);
1707 d_fnend(4, dev, "(%p, %p) = void\n", wa, notif_hdr);
1708 return;
1709} 1615}
diff --git a/drivers/uwb/beacon.c b/drivers/uwb/beacon.c
index d9c60cb94993..0315093e2216 100644
--- a/drivers/uwb/beacon.c
+++ b/drivers/uwb/beacon.c
@@ -22,19 +22,16 @@
22 * 22 *
23 * FIXME: docs 23 * FIXME: docs
24 */ 24 */
25
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/module.h> 27#include <linux/module.h>
29#include <linux/device.h> 28#include <linux/device.h>
30#include <linux/err.h> 29#include <linux/err.h>
31#include <linux/kdev_t.h> 30#include <linux/kdev_t.h>
32#include "uwb-internal.h"
33 31
34#define D_LOCAL 0 32#include "uwb-internal.h"
35#include <linux/uwb/debug.h>
36 33
37/** Start Beaconing command structure */ 34/* Start Beaconing command structure */
38struct uwb_rc_cmd_start_beacon { 35struct uwb_rc_cmd_start_beacon {
39 struct uwb_rccb rccb; 36 struct uwb_rccb rccb;
40 __le16 wBPSTOffset; 37 __le16 wBPSTOffset;
@@ -176,9 +173,6 @@ struct uwb_beca_e *__uwb_beca_find_bydev(struct uwb_rc *rc,
176{ 173{
177 struct uwb_beca_e *bce, *next; 174 struct uwb_beca_e *bce, *next;
178 list_for_each_entry_safe(bce, next, &rc->uwb_beca.list, node) { 175 list_for_each_entry_safe(bce, next, &rc->uwb_beca.list, node) {
179 d_printf(6, NULL, "looking for addr %02x:%02x in %02x:%02x\n",
180 dev_addr->data[0], dev_addr->data[1],
181 bce->dev_addr.data[0], bce->dev_addr.data[1]);
182 if (!memcmp(&bce->dev_addr, dev_addr, sizeof(bce->dev_addr))) 176 if (!memcmp(&bce->dev_addr, dev_addr, sizeof(bce->dev_addr)))
183 goto out; 177 goto out;
184 } 178 }
diff --git a/drivers/uwb/est.c b/drivers/uwb/est.c
index 5fe566b7c845..328fcc2b6099 100644
--- a/drivers/uwb/est.c
+++ b/drivers/uwb/est.c
@@ -40,10 +40,8 @@
40 * uwb_est_get_size() 40 * uwb_est_get_size()
41 */ 41 */
42#include <linux/spinlock.h> 42#include <linux/spinlock.h>
43#define D_LOCAL 0
44#include <linux/uwb/debug.h>
45#include "uwb-internal.h"
46 43
44#include "uwb-internal.h"
47 45
48struct uwb_est { 46struct uwb_est {
49 u16 type_event_high; 47 u16 type_event_high;
@@ -52,7 +50,6 @@ struct uwb_est {
52 const struct uwb_est_entry *entry; 50 const struct uwb_est_entry *entry;
53}; 51};
54 52
55
56static struct uwb_est *uwb_est; 53static struct uwb_est *uwb_est;
57static u8 uwb_est_size; 54static u8 uwb_est_size;
58static u8 uwb_est_used; 55static u8 uwb_est_used;
@@ -440,21 +437,12 @@ ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb,
440 u8 *ptr = (u8 *) rceb; 437 u8 *ptr = (u8 *) rceb;
441 438
442 read_lock_irqsave(&uwb_est_lock, flags); 439 read_lock_irqsave(&uwb_est_lock, flags);
443 d_printf(2, dev, "Size query for event 0x%02x/%04x/%02x,"
444 " buffer size %ld\n",
445 (unsigned) rceb->bEventType,
446 (unsigned) le16_to_cpu(rceb->wEvent),
447 (unsigned) rceb->bEventContext,
448 (long) rceb_size);
449 size = -ENOSPC; 440 size = -ENOSPC;
450 if (rceb_size < sizeof(*rceb)) 441 if (rceb_size < sizeof(*rceb))
451 goto out; 442 goto out;
452 event = le16_to_cpu(rceb->wEvent); 443 event = le16_to_cpu(rceb->wEvent);
453 type_event_high = rceb->bEventType << 8 | (event & 0xff00) >> 8; 444 type_event_high = rceb->bEventType << 8 | (event & 0xff00) >> 8;
454 for (itr = 0; itr < uwb_est_used; itr++) { 445 for (itr = 0; itr < uwb_est_used; itr++) {
455 d_printf(3, dev, "Checking EST 0x%04x/%04x/%04x\n",
456 uwb_est[itr].type_event_high, uwb_est[itr].vendor,
457 uwb_est[itr].product);
458 if (uwb_est[itr].type_event_high != type_event_high) 446 if (uwb_est[itr].type_event_high != type_event_high)
459 continue; 447 continue;
460 size = uwb_est_get_size(rc, &uwb_est[itr], 448 size = uwb_est_get_size(rc, &uwb_est[itr],
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 158e98d08af9..559f8784acf3 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -57,9 +57,8 @@
57#include <linux/usb/wusb.h> 57#include <linux/usb/wusb.h>
58#include <linux/usb/wusb-wa.h> 58#include <linux/usb/wusb-wa.h>
59#include <linux/uwb.h> 59#include <linux/uwb.h>
60
60#include "uwb-internal.h" 61#include "uwb-internal.h"
61#define D_LOCAL 1
62#include <linux/uwb/debug.h>
63 62
64/* The device uses commands and events from the WHCI specification, although 63/* The device uses commands and events from the WHCI specification, although
65 * reporting itself as WUSB compliant. */ 64 * reporting itself as WUSB compliant. */
@@ -630,17 +629,13 @@ void hwarc_neep_cb(struct urb *urb)
630 629
631 switch (result = urb->status) { 630 switch (result = urb->status) {
632 case 0: 631 case 0:
633 d_printf(3, dev, "NEEP: receive stat %d, %zu bytes\n",
634 urb->status, (size_t)urb->actual_length);
635 uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer, 632 uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer,
636 urb->actual_length); 633 urb->actual_length);
637 break; 634 break;
638 case -ECONNRESET: /* Not an error, but a controlled situation; */ 635 case -ECONNRESET: /* Not an error, but a controlled situation; */
639 case -ENOENT: /* (we killed the URB)...so, no broadcast */ 636 case -ENOENT: /* (we killed the URB)...so, no broadcast */
640 d_printf(2, dev, "NEEP: URB reset/noent %d\n", urb->status);
641 goto out; 637 goto out;
642 case -ESHUTDOWN: /* going away! */ 638 case -ESHUTDOWN: /* going away! */
643 d_printf(2, dev, "NEEP: URB down %d\n", urb->status);
644 goto out; 639 goto out;
645 default: /* On general errors, retry unless it gets ugly */ 640 default: /* On general errors, retry unless it gets ugly */
646 if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS, 641 if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS,
@@ -649,7 +644,6 @@ void hwarc_neep_cb(struct urb *urb)
649 dev_err(dev, "NEEP: URB error %d\n", urb->status); 644 dev_err(dev, "NEEP: URB error %d\n", urb->status);
650 } 645 }
651 result = usb_submit_urb(urb, GFP_ATOMIC); 646 result = usb_submit_urb(urb, GFP_ATOMIC);
652 d_printf(3, dev, "NEEP: submit %d\n", result);
653 if (result < 0) { 647 if (result < 0) {
654 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", 648 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
655 result); 649 result);
@@ -758,11 +752,11 @@ static int hwarc_get_version(struct uwb_rc *rc)
758 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength); 752 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
759 while (itr_size >= sizeof(*hdr)) { 753 while (itr_size >= sizeof(*hdr)) {
760 hdr = (struct usb_descriptor_header *) itr; 754 hdr = (struct usb_descriptor_header *) itr;
761 d_printf(3, dev, "Extra device descriptor: " 755 dev_dbg(dev, "Extra device descriptor: "
762 "type %02x/%u bytes @ %zu (%zu left)\n", 756 "type %02x/%u bytes @ %zu (%zu left)\n",
763 hdr->bDescriptorType, hdr->bLength, 757 hdr->bDescriptorType, hdr->bLength,
764 (itr - usb_dev->rawdescriptors[actconfig_idx]), 758 (itr - usb_dev->rawdescriptors[actconfig_idx]),
765 itr_size); 759 itr_size);
766 if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL) 760 if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL)
767 goto found; 761 goto found;
768 itr += hdr->bLength; 762 itr += hdr->bLength;
@@ -794,8 +788,7 @@ found:
794 goto error; 788 goto error;
795 } 789 }
796 rc->version = version; 790 rc->version = version;
797 d_printf(3, dev, "Device supports WUSB protocol version 0x%04x \n", 791 dev_dbg(dev, "Device supports WUSB protocol version 0x%04x \n", rc->version);
798 rc->version);
799 result = 0; 792 result = 0;
800error: 793error:
801 return result; 794 return result;
@@ -876,7 +869,6 @@ static void hwarc_disconnect(struct usb_interface *iface)
876 uwb_rc_rm(uwb_rc); 869 uwb_rc_rm(uwb_rc);
877 usb_put_intf(hwarc->usb_iface); 870 usb_put_intf(hwarc->usb_iface);
878 usb_put_dev(hwarc->usb_dev); 871 usb_put_dev(hwarc->usb_dev);
879 d_printf(1, &hwarc->usb_iface->dev, "freed hwarc %p\n", hwarc);
880 kfree(hwarc); 872 kfree(hwarc);
881 uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */ 873 uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */
882} 874}
@@ -924,13 +916,7 @@ static struct usb_driver hwarc_driver = {
924 916
925static int __init hwarc_driver_init(void) 917static int __init hwarc_driver_init(void)
926{ 918{
927 int result; 919 return usb_register(&hwarc_driver);
928 result = usb_register(&hwarc_driver);
929 if (result < 0)
930 printk(KERN_ERR "HWA-RC: Cannot register USB driver: %d\n",
931 result);
932 return result;
933
934} 920}
935module_init(hwarc_driver_init); 921module_init(hwarc_driver_init);
936 922
diff --git a/drivers/uwb/i1480/dfu/dfu.c b/drivers/uwb/i1480/dfu/dfu.c
index 9097b3b30385..da7b1d08003c 100644
--- a/drivers/uwb/i1480/dfu/dfu.c
+++ b/drivers/uwb/i1480/dfu/dfu.c
@@ -34,10 +34,7 @@
34#include <linux/uwb.h> 34#include <linux/uwb.h>
35#include <linux/random.h> 35#include <linux/random.h>
36 36
37#define D_LOCAL 0 37/*
38#include <linux/uwb/debug.h>
39
40/**
41 * i1480_rceb_check - Check RCEB for expected field values 38 * i1480_rceb_check - Check RCEB for expected field values
42 * @i1480: pointer to device for which RCEB is being checked 39 * @i1480: pointer to device for which RCEB is being checked
43 * @rceb: RCEB being checked 40 * @rceb: RCEB being checked
@@ -83,7 +80,7 @@ int i1480_rceb_check(const struct i1480 *i1480, const struct uwb_rceb *rceb,
83EXPORT_SYMBOL_GPL(i1480_rceb_check); 80EXPORT_SYMBOL_GPL(i1480_rceb_check);
84 81
85 82
86/** 83/*
87 * Execute a Radio Control Command 84 * Execute a Radio Control Command
88 * 85 *
89 * Command data has to be in i1480->cmd_buf. 86 * Command data has to be in i1480->cmd_buf.
@@ -101,7 +98,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
101 u8 expected_type = reply->bEventType; 98 u8 expected_type = reply->bEventType;
102 u8 context; 99 u8 context;
103 100
104 d_fnstart(3, i1480->dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
105 init_completion(&i1480->evt_complete); 101 init_completion(&i1480->evt_complete);
106 i1480->evt_result = -EINPROGRESS; 102 i1480->evt_result = -EINPROGRESS;
107 do { 103 do {
@@ -150,8 +146,6 @@ ssize_t i1480_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size,
150 result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context, 146 result = i1480_rceb_check(i1480, i1480->evt_buf, cmd_name, context,
151 expected_type, expected_event); 147 expected_type, expected_event);
152error: 148error:
153 d_fnend(3, i1480->dev, "(%p, %s, %zu) = %zd\n",
154 i1480, cmd_name, cmd_size, result);
155 return result; 149 return result;
156} 150}
157EXPORT_SYMBOL_GPL(i1480_cmd); 151EXPORT_SYMBOL_GPL(i1480_cmd);
diff --git a/drivers/uwb/i1480/dfu/mac.c b/drivers/uwb/i1480/dfu/mac.c
index 2e4d8f07c165..694d0daf88ab 100644
--- a/drivers/uwb/i1480/dfu/mac.c
+++ b/drivers/uwb/i1480/dfu/mac.c
@@ -31,9 +31,6 @@
31#include <linux/uwb.h> 31#include <linux/uwb.h>
32#include "i1480-dfu.h" 32#include "i1480-dfu.h"
33 33
34#define D_LOCAL 0
35#include <linux/uwb/debug.h>
36
37/* 34/*
38 * Descriptor for a continuous segment of MAC fw data 35 * Descriptor for a continuous segment of MAC fw data
39 */ 36 */
@@ -184,10 +181,6 @@ ssize_t i1480_fw_cmp(struct i1480 *i1480, struct fw_hdr *hdr)
184 } 181 }
185 if (memcmp(i1480->cmd_buf, bin + src_itr, result)) { 182 if (memcmp(i1480->cmd_buf, bin + src_itr, result)) {
186 u8 *buf = i1480->cmd_buf; 183 u8 *buf = i1480->cmd_buf;
187 d_printf(2, i1480->dev,
188 "original data @ %p + %u, %zu bytes\n",
189 bin, src_itr, result);
190 d_dump(4, i1480->dev, bin + src_itr, result);
191 for (cnt = 0; cnt < result; cnt++) 184 for (cnt = 0; cnt < result; cnt++)
192 if (bin[src_itr + cnt] != buf[cnt]) { 185 if (bin[src_itr + cnt] != buf[cnt]) {
193 dev_err(i1480->dev, "byte failed at " 186 dev_err(i1480->dev, "byte failed at "
@@ -224,7 +217,6 @@ int mac_fw_hdrs_push(struct i1480 *i1480, struct fw_hdr *hdr,
224 struct fw_hdr *hdr_itr; 217 struct fw_hdr *hdr_itr;
225 int verif_retry_count; 218 int verif_retry_count;
226 219
227 d_fnstart(3, dev, "(%p, %p)\n", i1480, hdr);
228 /* Now, header by header, push them to the hw */ 220 /* Now, header by header, push them to the hw */
229 for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) { 221 for (hdr_itr = hdr; hdr_itr != NULL; hdr_itr = hdr_itr->next) {
230 verif_retry_count = 0; 222 verif_retry_count = 0;
@@ -264,7 +256,6 @@ retry:
264 break; 256 break;
265 } 257 }
266 } 258 }
267 d_fnend(3, dev, "(%zd)\n", result);
268 return result; 259 return result;
269} 260}
270 261
@@ -337,11 +328,9 @@ int __mac_fw_upload(struct i1480 *i1480, const char *fw_name,
337 const struct firmware *fw; 328 const struct firmware *fw;
338 struct fw_hdr *fw_hdrs; 329 struct fw_hdr *fw_hdrs;
339 330
340 d_fnstart(3, i1480->dev, "(%p, %s, %s)\n", i1480, fw_name, fw_tag);
341 result = request_firmware(&fw, fw_name, i1480->dev); 331 result = request_firmware(&fw, fw_name, i1480->dev);
342 if (result < 0) /* Up to caller to complain on -ENOENT */ 332 if (result < 0) /* Up to caller to complain on -ENOENT */
343 goto out; 333 goto out;
344 d_printf(3, i1480->dev, "%s fw '%s': uploading\n", fw_tag, fw_name);
345 result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size); 334 result = fw_hdrs_load(i1480, &fw_hdrs, fw->data, fw->size);
346 if (result < 0) { 335 if (result < 0) {
347 dev_err(i1480->dev, "%s fw '%s': failed to parse firmware " 336 dev_err(i1480->dev, "%s fw '%s': failed to parse firmware "
@@ -363,8 +352,6 @@ out_hdrs_release:
363out_release: 352out_release:
364 release_firmware(fw); 353 release_firmware(fw);
365out: 354out:
366 d_fnend(3, i1480->dev, "(%p, %s, %s) = %d\n", i1480, fw_name, fw_tag,
367 result);
368 return result; 355 return result;
369} 356}
370 357
@@ -433,7 +420,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
433 int result; 420 int result;
434 u32 *val = (u32 *) i1480->cmd_buf; 421 u32 *val = (u32 *) i1480->cmd_buf;
435 422
436 d_fnstart(3, i1480->dev, "(i1480 %p)\n", i1480);
437 for (cnt = 0; cnt < 10; cnt++) { 423 for (cnt = 0; cnt < 10; cnt++) {
438 msleep(100); 424 msleep(100);
439 result = i1480->read(i1480, 0x80080000, 4); 425 result = i1480->read(i1480, 0x80080000, 4);
@@ -447,7 +433,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
447 dev_err(i1480->dev, "Timed out waiting for fw to start\n"); 433 dev_err(i1480->dev, "Timed out waiting for fw to start\n");
448 result = -ETIMEDOUT; 434 result = -ETIMEDOUT;
449out: 435out:
450 d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
451 return result; 436 return result;
452 437
453} 438}
@@ -467,7 +452,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
467 int result = 0, deprecated_name = 0; 452 int result = 0, deprecated_name = 0;
468 struct i1480_rceb *rcebe = (void *) i1480->evt_buf; 453 struct i1480_rceb *rcebe = (void *) i1480->evt_buf;
469 454
470 d_fnstart(3, i1480->dev, "(%p)\n", i1480);
471 result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC"); 455 result = __mac_fw_upload(i1480, i1480->mac_fw_name, "MAC");
472 if (result == -ENOENT) { 456 if (result == -ENOENT) {
473 result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate, 457 result = __mac_fw_upload(i1480, i1480->mac_fw_name_deprecate,
@@ -501,7 +485,6 @@ int i1480_mac_fw_upload(struct i1480 *i1480)
501 dev_err(i1480->dev, "MAC fw '%s': initialization event returns " 485 dev_err(i1480->dev, "MAC fw '%s': initialization event returns "
502 "wrong size (%zu bytes vs %zu needed)\n", 486 "wrong size (%zu bytes vs %zu needed)\n",
503 i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe)); 487 i1480->mac_fw_name, i1480->evt_result, sizeof(*rcebe));
504 dump_bytes(i1480->dev, rcebe, min(i1480->evt_result, (ssize_t)32));
505 goto error_size; 488 goto error_size;
506 } 489 }
507 result = -EIO; 490 result = -EIO;
@@ -522,6 +505,5 @@ error_fw_not_running:
522error_init_timeout: 505error_init_timeout:
523error_size: 506error_size:
524error_setup: 507error_setup:
525 d_fnend(3, i1480->dev, "(i1480 %p) = %d\n", i1480, result);
526 return result; 508 return result;
527} 509}
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index b7ea525fc06a..686795e97195 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -43,10 +43,6 @@
43#include <linux/usb/wusb-wa.h> 43#include <linux/usb/wusb-wa.h>
44#include "i1480-dfu.h" 44#include "i1480-dfu.h"
45 45
46#define D_LOCAL 0
47#include <linux/uwb/debug.h>
48
49
50struct i1480_usb { 46struct i1480_usb {
51 struct i1480 i1480; 47 struct i1480 i1480;
52 struct usb_device *usb_dev; 48 struct usb_device *usb_dev;
@@ -117,8 +113,6 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
117 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 113 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
118 size_t buffer_size, itr = 0; 114 size_t buffer_size, itr = 0;
119 115
120 d_fnstart(3, i1480->dev, "(%p, 0x%08x, %p, %zu)\n",
121 i1480, memory_address, buffer, size);
122 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ 116 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
123 while (size > 0) { 117 while (size > 0) {
124 buffer_size = size < i1480->buf_size ? size : i1480->buf_size; 118 buffer_size = size < i1480->buf_size ? size : i1480->buf_size;
@@ -131,16 +125,10 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
131 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */); 125 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */);
132 if (result < 0) 126 if (result < 0)
133 break; 127 break;
134 d_printf(3, i1480->dev,
135 "wrote @ 0x%08x %u bytes (of %zu bytes requested)\n",
136 memory_address, result, buffer_size);
137 d_dump(4, i1480->dev, i1480->cmd_buf, result);
138 itr += result; 128 itr += result;
139 memory_address += result; 129 memory_address += result;
140 size -= result; 130 size -= result;
141 } 131 }
142 d_fnend(3, i1480->dev, "(%p, 0x%08x, %p, %zu) = %d\n",
143 i1480, memory_address, buffer, size, result);
144 return result; 132 return result;
145} 133}
146 134
@@ -165,8 +153,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
165 size_t itr, read_size = i1480->buf_size; 153 size_t itr, read_size = i1480->buf_size;
166 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 154 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
167 155
168 d_fnstart(3, i1480->dev, "(%p, 0x%08x, %zu)\n",
169 i1480, addr, size);
170 BUG_ON(size > i1480->buf_size); 156 BUG_ON(size > i1480->buf_size);
171 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */ 157 BUG_ON(size & 0x3); /* Needs to be a multiple of 4 */
172 BUG_ON(read_size > 512); 158 BUG_ON(read_size > 512);
@@ -200,10 +186,6 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
200 } 186 }
201 result = bytes; 187 result = bytes;
202out: 188out:
203 d_fnend(3, i1480->dev, "(%p, 0x%08x, %zu) = %zd\n",
204 i1480, addr, size, result);
205 if (result > 0)
206 d_dump(4, i1480->dev, i1480->cmd_buf, result);
207 return result; 189 return result;
208} 190}
209 191
@@ -259,7 +241,6 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
259 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480); 241 struct i1480_usb *i1480_usb = container_of(i1480, struct i1480_usb, i1480);
260 struct usb_endpoint_descriptor *epd; 242 struct usb_endpoint_descriptor *epd;
261 243
262 d_fnstart(3, dev, "(%p)\n", i1480);
263 init_completion(&i1480->evt_complete); 244 init_completion(&i1480->evt_complete);
264 i1480->evt_result = -EINPROGRESS; 245 i1480->evt_result = -EINPROGRESS;
265 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; 246 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc;
@@ -281,14 +262,12 @@ int i1480_usb_wait_init_done(struct i1480 *i1480)
281 goto error_wait; 262 goto error_wait;
282 } 263 }
283 usb_kill_urb(i1480_usb->neep_urb); 264 usb_kill_urb(i1480_usb->neep_urb);
284 d_fnend(3, dev, "(%p) = 0\n", i1480);
285 return 0; 265 return 0;
286 266
287error_wait: 267error_wait:
288 usb_kill_urb(i1480_usb->neep_urb); 268 usb_kill_urb(i1480_usb->neep_urb);
289error_submit: 269error_submit:
290 i1480->evt_result = result; 270 i1480->evt_result = result;
291 d_fnend(3, dev, "(%p) = %d\n", i1480, result);
292 return result; 271 return result;
293} 272}
294 273
@@ -319,7 +298,6 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
319 struct uwb_rccb *cmd = i1480->cmd_buf; 298 struct uwb_rccb *cmd = i1480->cmd_buf;
320 u8 iface_no; 299 u8 iface_no;
321 300
322 d_fnstart(3, dev, "(%p, %s, %zu)\n", i1480, cmd_name, cmd_size);
323 /* Post a read on the notification & event endpoint */ 301 /* Post a read on the notification & event endpoint */
324 iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber; 302 iface_no = i1480_usb->usb_iface->cur_altsetting->desc.bInterfaceNumber;
325 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc; 303 epd = &i1480_usb->usb_iface->cur_altsetting->endpoint[0].desc;
@@ -347,15 +325,11 @@ int i1480_usb_cmd(struct i1480 *i1480, const char *cmd_name, size_t cmd_size)
347 cmd_name, result); 325 cmd_name, result);
348 goto error_submit_ep0; 326 goto error_submit_ep0;
349 } 327 }
350 d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
351 i1480, cmd_name, cmd_size, result);
352 return result; 328 return result;
353 329
354error_submit_ep0: 330error_submit_ep0:
355 usb_kill_urb(i1480_usb->neep_urb); 331 usb_kill_urb(i1480_usb->neep_urb);
356error_submit_ep1: 332error_submit_ep1:
357 d_fnend(3, dev, "(%p, %s, %zu) = %d\n",
358 i1480, cmd_name, cmd_size, result);
359 return result; 333 return result;
360} 334}
361 335
diff --git a/drivers/uwb/i1480/i1480u-wlp/rx.c b/drivers/uwb/i1480/i1480u-wlp/rx.c
index 9fc035354a76..34f4cf9a7d34 100644
--- a/drivers/uwb/i1480/i1480u-wlp/rx.c
+++ b/drivers/uwb/i1480/i1480u-wlp/rx.c
@@ -68,11 +68,7 @@
68#include <linux/etherdevice.h> 68#include <linux/etherdevice.h>
69#include "i1480u-wlp.h" 69#include "i1480u-wlp.h"
70 70
71#define D_LOCAL 0 71/*
72#include <linux/uwb/debug.h>
73
74
75/**
76 * Setup the RX context 72 * Setup the RX context
77 * 73 *
78 * Each URB is provided with a transfer_buffer that is the data field 74 * Each URB is provided with a transfer_buffer that is the data field
@@ -129,7 +125,7 @@ error:
129} 125}
130 126
131 127
132/** Release resources associated to the rx context */ 128/* Release resources associated to the rx context */
133void i1480u_rx_release(struct i1480u *i1480u) 129void i1480u_rx_release(struct i1480u *i1480u)
134{ 130{
135 int cnt; 131 int cnt;
@@ -155,7 +151,7 @@ void i1480u_rx_unlink_urbs(struct i1480u *i1480u)
155 } 151 }
156} 152}
157 153
158/** Fix an out-of-sequence packet */ 154/* Fix an out-of-sequence packet */
159#define i1480u_fix(i1480u, msg...) \ 155#define i1480u_fix(i1480u, msg...) \
160do { \ 156do { \
161 if (printk_ratelimit()) \ 157 if (printk_ratelimit()) \
@@ -166,7 +162,7 @@ do { \
166} while (0) 162} while (0)
167 163
168 164
169/** Drop an out-of-sequence packet */ 165/* Drop an out-of-sequence packet */
170#define i1480u_drop(i1480u, msg...) \ 166#define i1480u_drop(i1480u, msg...) \
171do { \ 167do { \
172 if (printk_ratelimit()) \ 168 if (printk_ratelimit()) \
@@ -177,7 +173,7 @@ do { \
177 173
178 174
179 175
180/** Finalizes setting up the SKB and delivers it 176/* Finalizes setting up the SKB and delivers it
181 * 177 *
182 * We first pass the incoming frame to WLP substack for verification. It 178 * We first pass the incoming frame to WLP substack for verification. It
183 * may also be a WLP association frame in which case WLP will take over the 179 * may also be a WLP association frame in which case WLP will take over the
@@ -192,18 +188,11 @@ void i1480u_skb_deliver(struct i1480u *i1480u)
192 struct net_device *net_dev = i1480u->net_dev; 188 struct net_device *net_dev = i1480u->net_dev;
193 struct device *dev = &i1480u->usb_iface->dev; 189 struct device *dev = &i1480u->usb_iface->dev;
194 190
195 d_printf(6, dev, "RX delivered pre skb(%p), %u bytes\n",
196 i1480u->rx_skb, i1480u->rx_skb->len);
197 d_dump(7, dev, i1480u->rx_skb->data, i1480u->rx_skb->len);
198 should_parse = wlp_receive_frame(dev, &i1480u->wlp, i1480u->rx_skb, 191 should_parse = wlp_receive_frame(dev, &i1480u->wlp, i1480u->rx_skb,
199 &i1480u->rx_srcaddr); 192 &i1480u->rx_srcaddr);
200 if (!should_parse) 193 if (!should_parse)
201 goto out; 194 goto out;
202 i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev); 195 i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev);
203 d_printf(5, dev, "RX delivered skb(%p), %u bytes\n",
204 i1480u->rx_skb, i1480u->rx_skb->len);
205 d_dump(7, dev, i1480u->rx_skb->data,
206 i1480u->rx_skb->len > 72 ? 72 : i1480u->rx_skb->len);
207 i1480u->stats.rx_packets++; 196 i1480u->stats.rx_packets++;
208 i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size; 197 i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size;
209 net_dev->last_rx = jiffies; 198 net_dev->last_rx = jiffies;
@@ -216,7 +205,7 @@ out:
216} 205}
217 206
218 207
219/** 208/*
220 * Process a buffer of data received from the USB RX endpoint 209 * Process a buffer of data received from the USB RX endpoint
221 * 210 *
222 * First fragment arrives with next or last fragment. All other fragments 211 * First fragment arrives with next or last fragment. All other fragments
@@ -404,7 +393,7 @@ out:
404} 393}
405 394
406 395
407/** 396/*
408 * Called when an RX URB has finished receiving or has found some kind 397 * Called when an RX URB has finished receiving or has found some kind
409 * of error condition. 398 * of error condition.
410 * 399 *
diff --git a/drivers/uwb/i1480/i1480u-wlp/tx.c b/drivers/uwb/i1480/i1480u-wlp/tx.c
index 3426bfb68240..39032cc3503e 100644
--- a/drivers/uwb/i1480/i1480u-wlp/tx.c
+++ b/drivers/uwb/i1480/i1480u-wlp/tx.c
@@ -55,8 +55,6 @@
55 */ 55 */
56 56
57#include "i1480u-wlp.h" 57#include "i1480u-wlp.h"
58#define D_LOCAL 5
59#include <linux/uwb/debug.h>
60 58
61enum { 59enum {
62 /* This is only for Next and Last TX packets */ 60 /* This is only for Next and Last TX packets */
@@ -64,7 +62,7 @@ enum {
64 - sizeof(struct untd_hdr_rst), 62 - sizeof(struct untd_hdr_rst),
65}; 63};
66 64
67/** Free resources allocated to a i1480u tx context. */ 65/* Free resources allocated to a i1480u tx context. */
68static 66static
69void i1480u_tx_free(struct i1480u_tx *wtx) 67void i1480u_tx_free(struct i1480u_tx *wtx)
70{ 68{
@@ -99,7 +97,7 @@ void i1480u_tx_unlink_urbs(struct i1480u *i1480u)
99} 97}
100 98
101 99
102/** 100/*
103 * Callback for a completed tx USB URB. 101 * Callback for a completed tx USB URB.
104 * 102 *
105 * TODO: 103 * TODO:
@@ -149,8 +147,6 @@ void i1480u_tx_cb(struct urb *urb)
149 <= i1480u->tx_inflight.threshold 147 <= i1480u->tx_inflight.threshold
150 && netif_queue_stopped(net_dev) 148 && netif_queue_stopped(net_dev)
151 && i1480u->tx_inflight.threshold != 0) { 149 && i1480u->tx_inflight.threshold != 0) {
152 if (d_test(2) && printk_ratelimit())
153 d_printf(2, dev, "Restart queue. \n");
154 netif_start_queue(net_dev); 150 netif_start_queue(net_dev);
155 atomic_inc(&i1480u->tx_inflight.restart_count); 151 atomic_inc(&i1480u->tx_inflight.restart_count);
156 } 152 }
@@ -158,7 +154,7 @@ void i1480u_tx_cb(struct urb *urb)
158} 154}
159 155
160 156
161/** 157/*
162 * Given a buffer that doesn't fit in a single fragment, create an 158 * Given a buffer that doesn't fit in a single fragment, create an
163 * scatter/gather structure for delivery to the USB pipe. 159 * scatter/gather structure for delivery to the USB pipe.
164 * 160 *
@@ -253,15 +249,11 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
253 /* Now do each remaining fragment */ 249 /* Now do each remaining fragment */
254 result = -EINVAL; 250 result = -EINVAL;
255 while (pl_size_left > 0) { 251 while (pl_size_left > 0) {
256 d_printf(5, NULL, "ITR HDR: pl_size_left %zu buf_itr %zu\n",
257 pl_size_left, buf_itr - wtx->buf);
258 if (buf_itr + sizeof(*untd_hdr_rst) - wtx->buf 252 if (buf_itr + sizeof(*untd_hdr_rst) - wtx->buf
259 > wtx->buf_size) { 253 > wtx->buf_size) {
260 printk(KERN_ERR "BUG: no space for header\n"); 254 printk(KERN_ERR "BUG: no space for header\n");
261 goto error_bug; 255 goto error_bug;
262 } 256 }
263 d_printf(5, NULL, "ITR HDR 2: pl_size_left %zu buf_itr %zu\n",
264 pl_size_left, buf_itr - wtx->buf);
265 untd_hdr_rst = buf_itr; 257 untd_hdr_rst = buf_itr;
266 buf_itr += sizeof(*untd_hdr_rst); 258 buf_itr += sizeof(*untd_hdr_rst);
267 if (pl_size_left > i1480u_MAX_PL_SIZE) { 259 if (pl_size_left > i1480u_MAX_PL_SIZE) {
@@ -271,9 +263,6 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
271 frg_pl_size = pl_size_left; 263 frg_pl_size = pl_size_left;
272 untd_hdr_set_type(&untd_hdr_rst->hdr, i1480u_PKT_FRAG_LST); 264 untd_hdr_set_type(&untd_hdr_rst->hdr, i1480u_PKT_FRAG_LST);
273 } 265 }
274 d_printf(5, NULL,
275 "ITR PL: pl_size_left %zu buf_itr %zu frg_pl_size %zu\n",
276 pl_size_left, buf_itr - wtx->buf, frg_pl_size);
277 untd_hdr_set_rx_tx(&untd_hdr_rst->hdr, 0); 266 untd_hdr_set_rx_tx(&untd_hdr_rst->hdr, 0);
278 untd_hdr_rst->hdr.len = cpu_to_le16(frg_pl_size); 267 untd_hdr_rst->hdr.len = cpu_to_le16(frg_pl_size);
279 untd_hdr_rst->padding = 0; 268 untd_hdr_rst->padding = 0;
@@ -286,9 +275,6 @@ int i1480u_tx_create_n(struct i1480u_tx *wtx, struct sk_buff *skb,
286 buf_itr += frg_pl_size; 275 buf_itr += frg_pl_size;
287 pl_itr += frg_pl_size; 276 pl_itr += frg_pl_size;
288 pl_size_left -= frg_pl_size; 277 pl_size_left -= frg_pl_size;
289 d_printf(5, NULL,
290 "ITR PL 2: pl_size_left %zu buf_itr %zu frg_pl_size %zu\n",
291 pl_size_left, buf_itr - wtx->buf, frg_pl_size);
292 } 278 }
293 dev_kfree_skb_irq(skb); 279 dev_kfree_skb_irq(skb);
294 return 0; 280 return 0;
@@ -308,7 +294,7 @@ error_buf_alloc:
308} 294}
309 295
310 296
311/** 297/*
312 * Given a buffer that fits in a single fragment, fill out a @wtx 298 * Given a buffer that fits in a single fragment, fill out a @wtx
313 * struct for transmitting it down the USB pipe. 299 * struct for transmitting it down the USB pipe.
314 * 300 *
@@ -346,7 +332,7 @@ int i1480u_tx_create_1(struct i1480u_tx *wtx, struct sk_buff *skb,
346} 332}
347 333
348 334
349/** 335/*
350 * Given a skb to transmit, massage it to become palatable for the TX pipe 336 * Given a skb to transmit, massage it to become palatable for the TX pipe
351 * 337 *
352 * This will break the buffer in chunks smaller than 338 * This will break the buffer in chunks smaller than
@@ -425,7 +411,7 @@ error_wtx_alloc:
425 return NULL; 411 return NULL;
426} 412}
427 413
428/** 414/*
429 * Actual fragmentation and transmission of frame 415 * Actual fragmentation and transmission of frame
430 * 416 *
431 * @wlp: WLP substack data structure 417 * @wlp: WLP substack data structure
@@ -447,20 +433,12 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
447 struct i1480u_tx *wtx; 433 struct i1480u_tx *wtx;
448 struct wlp_tx_hdr *wlp_tx_hdr; 434 struct wlp_tx_hdr *wlp_tx_hdr;
449 static unsigned char dev_bcast[2] = { 0xff, 0xff }; 435 static unsigned char dev_bcast[2] = { 0xff, 0xff };
450#if 0
451 int lockup = 50;
452#endif
453 436
454 d_fnstart(6, dev, "(skb %p (%u), net_dev %p)\n", skb, skb->len,
455 net_dev);
456 BUG_ON(i1480u->wlp.rc == NULL); 437 BUG_ON(i1480u->wlp.rc == NULL);
457 if ((net_dev->flags & IFF_UP) == 0) 438 if ((net_dev->flags & IFF_UP) == 0)
458 goto out; 439 goto out;
459 result = -EBUSY; 440 result = -EBUSY;
460 if (atomic_read(&i1480u->tx_inflight.count) >= i1480u->tx_inflight.max) { 441 if (atomic_read(&i1480u->tx_inflight.count) >= i1480u->tx_inflight.max) {
461 if (d_test(2) && printk_ratelimit())
462 d_printf(2, dev, "Max frames in flight "
463 "stopping queue.\n");
464 netif_stop_queue(net_dev); 442 netif_stop_queue(net_dev);
465 goto error_max_inflight; 443 goto error_max_inflight;
466 } 444 }
@@ -489,21 +467,6 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
489 wlp_tx_hdr_set_delivery_id_type(wlp_tx_hdr, i1480u->options.pca_base_priority); 467 wlp_tx_hdr_set_delivery_id_type(wlp_tx_hdr, i1480u->options.pca_base_priority);
490 } 468 }
491 469
492#if 0
493 dev_info(dev, "TX delivering skb -> USB, %zu bytes\n", skb->len);
494 dump_bytes(dev, skb->data, skb->len > 72 ? 72 : skb->len);
495#endif
496#if 0
497 /* simulates a device lockup after every lockup# packets */
498 if (lockup && ((i1480u->stats.tx_packets + 1) % lockup) == 0) {
499 /* Simulate a dropped transmit interrupt */
500 net_dev->trans_start = jiffies;
501 netif_stop_queue(net_dev);
502 dev_err(dev, "Simulate lockup at %ld\n", jiffies);
503 return result;
504 }
505#endif
506
507 result = usb_submit_urb(wtx->urb, GFP_ATOMIC); /* Go baby */ 470 result = usb_submit_urb(wtx->urb, GFP_ATOMIC); /* Go baby */
508 if (result < 0) { 471 if (result < 0) {
509 dev_err(dev, "TX: cannot submit URB: %d\n", result); 472 dev_err(dev, "TX: cannot submit URB: %d\n", result);
@@ -513,8 +476,6 @@ int i1480u_xmit_frame(struct wlp *wlp, struct sk_buff *skb,
513 } 476 }
514 atomic_inc(&i1480u->tx_inflight.count); 477 atomic_inc(&i1480u->tx_inflight.count);
515 net_dev->trans_start = jiffies; 478 net_dev->trans_start = jiffies;
516 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
517 net_dev, result);
518 return result; 479 return result;
519 480
520error_tx_urb_submit: 481error_tx_urb_submit:
@@ -522,13 +483,11 @@ error_tx_urb_submit:
522error_wtx_alloc: 483error_wtx_alloc:
523error_max_inflight: 484error_max_inflight:
524out: 485out:
525 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
526 net_dev, result);
527 return result; 486 return result;
528} 487}
529 488
530 489
531/** 490/*
532 * Transmit an skb Called when an skbuf has to be transmitted 491 * Transmit an skb Called when an skbuf has to be transmitted
533 * 492 *
534 * The skb is first passed to WLP substack to ensure this is a valid 493 * The skb is first passed to WLP substack to ensure this is a valid
@@ -551,9 +510,6 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
551 struct device *dev = &i1480u->usb_iface->dev; 510 struct device *dev = &i1480u->usb_iface->dev;
552 struct uwb_dev_addr dst; 511 struct uwb_dev_addr dst;
553 512
554 d_fnstart(6, dev, "(skb %p (%u), net_dev %p)\n", skb, skb->len,
555 net_dev);
556 BUG_ON(i1480u->wlp.rc == NULL);
557 if ((net_dev->flags & IFF_UP) == 0) 513 if ((net_dev->flags & IFF_UP) == 0)
558 goto error; 514 goto error;
559 result = wlp_prepare_tx_frame(dev, &i1480u->wlp, skb, &dst); 515 result = wlp_prepare_tx_frame(dev, &i1480u->wlp, skb, &dst);
@@ -562,31 +518,25 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
562 "Dropping packet.\n", result); 518 "Dropping packet.\n", result);
563 goto error; 519 goto error;
564 } else if (result == 1) { 520 } else if (result == 1) {
565 d_printf(6, dev, "WLP will transmit frame. \n");
566 /* trans_start time will be set when WLP actually transmits 521 /* trans_start time will be set when WLP actually transmits
567 * the frame */ 522 * the frame */
568 goto out; 523 goto out;
569 } 524 }
570 d_printf(6, dev, "Transmitting frame. \n");
571 result = i1480u_xmit_frame(&i1480u->wlp, skb, &dst); 525 result = i1480u_xmit_frame(&i1480u->wlp, skb, &dst);
572 if (result < 0) { 526 if (result < 0) {
573 dev_err(dev, "Frame TX failed (%d).\n", result); 527 dev_err(dev, "Frame TX failed (%d).\n", result);
574 goto error; 528 goto error;
575 } 529 }
576 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
577 net_dev, result);
578 return NETDEV_TX_OK; 530 return NETDEV_TX_OK;
579error: 531error:
580 dev_kfree_skb_any(skb); 532 dev_kfree_skb_any(skb);
581 i1480u->stats.tx_dropped++; 533 i1480u->stats.tx_dropped++;
582out: 534out:
583 d_fnend(6, dev, "(skb %p (%u), net_dev %p) = %d\n", skb, skb->len,
584 net_dev, result);
585 return NETDEV_TX_OK; 535 return NETDEV_TX_OK;
586} 536}
587 537
588 538
589/** 539/*
590 * Called when a pkt transmission doesn't complete in a reasonable period 540 * Called when a pkt transmission doesn't complete in a reasonable period
591 * Device reset may sleep - do it outside of interrupt context (delayed) 541 * Device reset may sleep - do it outside of interrupt context (delayed)
592 */ 542 */
diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c
index 15f856c9689a..f78087b85918 100644
--- a/drivers/uwb/lc-dev.c
+++ b/drivers/uwb/lc-dev.c
@@ -22,7 +22,6 @@
22 * 22 *
23 * FIXME: docs 23 * FIXME: docs
24 */ 24 */
25
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/device.h> 26#include <linux/device.h>
28#include <linux/err.h> 27#include <linux/err.h>
@@ -30,10 +29,6 @@
30#include <linux/random.h> 29#include <linux/random.h>
31#include "uwb-internal.h" 30#include "uwb-internal.h"
32 31
33#define D_LOCAL 1
34#include <linux/uwb/debug.h>
35
36
37/* We initialize addresses to 0xff (invalid, as it is bcast) */ 32/* We initialize addresses to 0xff (invalid, as it is bcast) */
38static inline void uwb_dev_addr_init(struct uwb_dev_addr *addr) 33static inline void uwb_dev_addr_init(struct uwb_dev_addr *addr)
39{ 34{
@@ -104,12 +99,9 @@ static void uwb_dev_sys_release(struct device *dev)
104{ 99{
105 struct uwb_dev *uwb_dev = to_uwb_dev(dev); 100 struct uwb_dev *uwb_dev = to_uwb_dev(dev);
106 101
107 d_fnstart(4, NULL, "(dev %p uwb_dev %p)\n", dev, uwb_dev);
108 uwb_bce_put(uwb_dev->bce); 102 uwb_bce_put(uwb_dev->bce);
109 d_printf(0, &uwb_dev->dev, "uwb_dev %p freed\n", uwb_dev);
110 memset(uwb_dev, 0x69, sizeof(*uwb_dev)); 103 memset(uwb_dev, 0x69, sizeof(*uwb_dev));
111 kfree(uwb_dev); 104 kfree(uwb_dev);
112 d_fnend(4, NULL, "(dev %p uwb_dev %p) = void\n", dev, uwb_dev);
113} 105}
114 106
115/* 107/*
@@ -275,12 +267,8 @@ static struct attribute_group *groups[] = {
275 */ 267 */
276static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev) 268static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev)
277{ 269{
278 int result;
279 struct device *dev; 270 struct device *dev;
280 271
281 d_fnstart(4, NULL, "(uwb_dev %p parent_dev %p)\n", uwb_dev, parent_dev);
282 BUG_ON(parent_dev == NULL);
283
284 dev = &uwb_dev->dev; 272 dev = &uwb_dev->dev;
285 /* Device sysfs files are only useful for neighbor devices not 273 /* Device sysfs files are only useful for neighbor devices not
286 local radio controllers. */ 274 local radio controllers. */
@@ -289,18 +277,14 @@ static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev)
289 dev->parent = parent_dev; 277 dev->parent = parent_dev;
290 dev_set_drvdata(dev, uwb_dev); 278 dev_set_drvdata(dev, uwb_dev);
291 279
292 result = device_add(dev); 280 return device_add(dev);
293 d_fnend(4, NULL, "(uwb_dev %p parent_dev %p) = %d\n", uwb_dev, parent_dev, result);
294 return result;
295} 281}
296 282
297 283
298static void __uwb_dev_sys_rm(struct uwb_dev *uwb_dev) 284static void __uwb_dev_sys_rm(struct uwb_dev *uwb_dev)
299{ 285{
300 d_fnstart(4, NULL, "(uwb_dev %p)\n", uwb_dev);
301 dev_set_drvdata(&uwb_dev->dev, NULL); 286 dev_set_drvdata(&uwb_dev->dev, NULL);
302 device_del(&uwb_dev->dev); 287 device_del(&uwb_dev->dev);
303 d_fnend(4, NULL, "(uwb_dev %p) = void\n", uwb_dev);
304} 288}
305 289
306 290
@@ -384,7 +368,6 @@ int __uwb_dev_offair(struct uwb_dev *uwb_dev, struct uwb_rc *rc)
384 struct device *dev = &uwb_dev->dev; 368 struct device *dev = &uwb_dev->dev;
385 char macbuf[UWB_ADDR_STRSIZE], devbuf[UWB_ADDR_STRSIZE]; 369 char macbuf[UWB_ADDR_STRSIZE], devbuf[UWB_ADDR_STRSIZE];
386 370
387 d_fnstart(3, NULL, "(dev %p [uwb_dev %p], uwb_rc %p)\n", dev, uwb_dev, rc);
388 uwb_mac_addr_print(macbuf, sizeof(macbuf), &uwb_dev->mac_addr); 371 uwb_mac_addr_print(macbuf, sizeof(macbuf), &uwb_dev->mac_addr);
389 uwb_dev_addr_print(devbuf, sizeof(devbuf), &uwb_dev->dev_addr); 372 uwb_dev_addr_print(devbuf, sizeof(devbuf), &uwb_dev->dev_addr);
390 dev_info(dev, "uwb device (mac %s dev %s) disconnected from %s %s\n", 373 dev_info(dev, "uwb device (mac %s dev %s) disconnected from %s %s\n",
@@ -393,7 +376,7 @@ int __uwb_dev_offair(struct uwb_dev *uwb_dev, struct uwb_rc *rc)
393 rc ? dev_name(rc->uwb_dev.dev.parent) : ""); 376 rc ? dev_name(rc->uwb_dev.dev.parent) : "");
394 uwb_dev_rm(uwb_dev); 377 uwb_dev_rm(uwb_dev);
395 uwb_dev_put(uwb_dev); /* for the creation in _onair() */ 378 uwb_dev_put(uwb_dev); /* for the creation in _onair() */
396 d_fnend(3, NULL, "(dev %p [uwb_dev %p], uwb_rc %p) = 0\n", dev, uwb_dev, rc); 379
397 return 0; 380 return 0;
398} 381}
399 382
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c
index 6df18eda1fdb..0af8916d9bef 100644
--- a/drivers/uwb/neh.c
+++ b/drivers/uwb/neh.c
@@ -86,8 +86,6 @@
86#include <linux/err.h> 86#include <linux/err.h>
87 87
88#include "uwb-internal.h" 88#include "uwb-internal.h"
89#define D_LOCAL 0
90#include <linux/uwb/debug.h>
91 89
92/* 90/*
93 * UWB Radio Controller Notification/Event Handle 91 * UWB Radio Controller Notification/Event Handle
@@ -479,8 +477,6 @@ void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size)
479 size_t size, real_size, event_size; 477 size_t size, real_size, event_size;
480 int needtofree; 478 int needtofree;
481 479
482 d_fnstart(3, dev, "(rc %p buf %p %zu buf_size)\n", rc, buf, buf_size);
483 d_printf(2, dev, "groking event block: %zu bytes\n", buf_size);
484 itr = buf; 480 itr = buf;
485 size = buf_size; 481 size = buf_size;
486 while (size > 0) { 482 while (size > 0) {
@@ -528,10 +524,7 @@ void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size)
528 524
529 itr += real_size; 525 itr += real_size;
530 size -= real_size; 526 size -= real_size;
531 d_printf(2, dev, "consumed %zd bytes, %zu left\n",
532 event_size, size);
533 } 527 }
534 d_fnend(3, dev, "(rc %p buf %p %zu buf_size) = void\n", rc, buf, buf_size);
535} 528}
536EXPORT_SYMBOL_GPL(uwb_rc_neh_grok); 529EXPORT_SYMBOL_GPL(uwb_rc_neh_grok);
537 530
diff --git a/drivers/uwb/reset.c b/drivers/uwb/reset.c
index ce8283cc8098..70f8050221ff 100644
--- a/drivers/uwb/reset.c
+++ b/drivers/uwb/reset.c
@@ -32,8 +32,6 @@
32#include <linux/err.h> 32#include <linux/err.h>
33 33
34#include "uwb-internal.h" 34#include "uwb-internal.h"
35#define D_LOCAL 0
36#include <linux/uwb/debug.h>
37 35
38/** 36/**
39 * Command result codes (WUSB1.0[T8-69]) 37 * Command result codes (WUSB1.0[T8-69])
diff --git a/drivers/uwb/umc-dev.c b/drivers/uwb/umc-dev.c
index 53207e14cd8f..1fc7d8270bb8 100644
--- a/drivers/uwb/umc-dev.c
+++ b/drivers/uwb/umc-dev.c
@@ -7,8 +7,6 @@
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/uwb/umc.h> 9#include <linux/uwb/umc.h>
10#define D_LOCAL 0
11#include <linux/uwb/debug.h>
12 10
13static void umc_device_release(struct device *dev) 11static void umc_device_release(struct device *dev)
14{ 12{
@@ -53,8 +51,6 @@ int umc_device_register(struct umc_dev *umc)
53{ 51{
54 int err; 52 int err;
55 53
56 d_fnstart(3, &umc->dev, "(umc_dev %p)\n", umc);
57
58 err = request_resource(umc->resource.parent, &umc->resource); 54 err = request_resource(umc->resource.parent, &umc->resource);
59 if (err < 0) { 55 if (err < 0) {
60 dev_err(&umc->dev, "can't allocate resource range " 56 dev_err(&umc->dev, "can't allocate resource range "
@@ -68,13 +64,11 @@ int umc_device_register(struct umc_dev *umc)
68 err = device_register(&umc->dev); 64 err = device_register(&umc->dev);
69 if (err < 0) 65 if (err < 0)
70 goto error_device_register; 66 goto error_device_register;
71 d_fnend(3, &umc->dev, "(umc_dev %p) = 0\n", umc);
72 return 0; 67 return 0;
73 68
74error_device_register: 69error_device_register:
75 release_resource(&umc->resource); 70 release_resource(&umc->resource);
76error_request_resource: 71error_request_resource:
77 d_fnend(3, &umc->dev, "(umc_dev %p) = %d\n", umc, err);
78 return err; 72 return err;
79} 73}
80EXPORT_SYMBOL_GPL(umc_device_register); 74EXPORT_SYMBOL_GPL(umc_device_register);
@@ -94,10 +88,8 @@ void umc_device_unregister(struct umc_dev *umc)
94 if (!umc) 88 if (!umc)
95 return; 89 return;
96 dev = get_device(&umc->dev); 90 dev = get_device(&umc->dev);
97 d_fnstart(3, dev, "(umc_dev %p)\n", umc);
98 device_unregister(&umc->dev); 91 device_unregister(&umc->dev);
99 release_resource(&umc->resource); 92 release_resource(&umc->resource);
100 d_fnend(3, dev, "(umc_dev %p) = void\n", umc);
101 put_device(dev); 93 put_device(dev);
102} 94}
103EXPORT_SYMBOL_GPL(umc_device_unregister); 95EXPORT_SYMBOL_GPL(umc_device_unregister);
diff --git a/drivers/uwb/uwbd.c b/drivers/uwb/uwbd.c
index ec42ce92dbce..57bd6bfef37e 100644
--- a/drivers/uwb/uwbd.c
+++ b/drivers/uwb/uwbd.c
@@ -68,17 +68,13 @@
68 * 68 *
69 * Handler functions are called normally uwbd_evt_handle_*(). 69 * Handler functions are called normally uwbd_evt_handle_*().
70 */ 70 */
71
72#include <linux/kthread.h> 71#include <linux/kthread.h>
73#include <linux/module.h> 72#include <linux/module.h>
74#include <linux/freezer.h> 73#include <linux/freezer.h>
75#include "uwb-internal.h"
76
77#define D_LOCAL 1
78#include <linux/uwb/debug.h>
79 74
75#include "uwb-internal.h"
80 76
81/** 77/*
82 * UWBD Event handler function signature 78 * UWBD Event handler function signature
83 * 79 *
84 * Return !0 if the event needs not to be freed (ie the handler 80 * Return !0 if the event needs not to be freed (ie the handler
@@ -101,9 +97,8 @@ struct uwbd_event {
101 const char *name; 97 const char *name;
102}; 98};
103 99
104/** Table of handlers for and properties of the UWBD Radio Control Events */ 100/* Table of handlers for and properties of the UWBD Radio Control Events */
105static 101static struct uwbd_event uwbd_urc_events[] = {
106struct uwbd_event uwbd_events[] = {
107 [UWB_RC_EVT_IE_RCV] = { 102 [UWB_RC_EVT_IE_RCV] = {
108 .handler = uwbd_evt_handle_rc_ie_rcv, 103 .handler = uwbd_evt_handle_rc_ie_rcv,
109 .name = "IE_RECEIVED" 104 .name = "IE_RECEIVED"
@@ -146,23 +141,15 @@ struct uwbd_evt_type_handler {
146 size_t size; 141 size_t size;
147}; 142};
148 143
149#define UWBD_EVT_TYPE_HANDLER(n,a) { \ 144/* Table of handlers for each UWBD Event type. */
150 .name = (n), \ 145static struct uwbd_evt_type_handler uwbd_urc_evt_type_handlers[] = {
151 .uwbd_events = (a), \ 146 [UWB_RC_CET_GENERAL] = {
152 .size = sizeof(a)/sizeof((a)[0]) \ 147 .name = "URC",
153} 148 .uwbd_events = uwbd_urc_events,
154 149 .size = ARRAY_SIZE(uwbd_urc_events),
155 150 },
156/** Table of handlers for each UWBD Event type. */
157static
158struct uwbd_evt_type_handler uwbd_evt_type_handlers[] = {
159 [UWB_RC_CET_GENERAL] = UWBD_EVT_TYPE_HANDLER("RC", uwbd_events)
160}; 151};
161 152
162static const
163size_t uwbd_evt_type_handlers_len =
164 sizeof(uwbd_evt_type_handlers) / sizeof(uwbd_evt_type_handlers[0]);
165
166static const struct uwbd_event uwbd_message_handlers[] = { 153static const struct uwbd_event uwbd_message_handlers[] = {
167 [UWB_EVT_MSG_RESET] = { 154 [UWB_EVT_MSG_RESET] = {
168 .handler = uwbd_msg_handle_reset, 155 .handler = uwbd_msg_handle_reset,
@@ -170,7 +157,7 @@ static const struct uwbd_event uwbd_message_handlers[] = {
170 }, 157 },
171}; 158};
172 159
173/** 160/*
174 * Handle an URC event passed to the UWB Daemon 161 * Handle an URC event passed to the UWB Daemon
175 * 162 *
176 * @evt: the event to handle 163 * @evt: the event to handle
@@ -190,6 +177,7 @@ static const struct uwbd_event uwbd_message_handlers[] = {
190static 177static
191int uwbd_event_handle_urc(struct uwb_event *evt) 178int uwbd_event_handle_urc(struct uwb_event *evt)
192{ 179{
180 int result = -EINVAL;
193 struct uwbd_evt_type_handler *type_table; 181 struct uwbd_evt_type_handler *type_table;
194 uwbd_evt_handler_f handler; 182 uwbd_evt_handler_f handler;
195 u8 type, context; 183 u8 type, context;
@@ -199,26 +187,24 @@ int uwbd_event_handle_urc(struct uwb_event *evt)
199 event = le16_to_cpu(evt->notif.rceb->wEvent); 187 event = le16_to_cpu(evt->notif.rceb->wEvent);
200 context = evt->notif.rceb->bEventContext; 188 context = evt->notif.rceb->bEventContext;
201 189
202 if (type > uwbd_evt_type_handlers_len) { 190 if (type > ARRAY_SIZE(uwbd_urc_evt_type_handlers))
203 printk(KERN_ERR "UWBD: event type %u: unknown (too high)\n", type); 191 goto out;
204 return -EINVAL; 192 type_table = &uwbd_urc_evt_type_handlers[type];
205 } 193 if (type_table->uwbd_events == NULL)
206 type_table = &uwbd_evt_type_handlers[type]; 194 goto out;
207 if (type_table->uwbd_events == NULL) { 195 if (event > type_table->size)
208 printk(KERN_ERR "UWBD: event type %u: unknown\n", type); 196 goto out;
209 return -EINVAL;
210 }
211 if (event > type_table->size) {
212 printk(KERN_ERR "UWBD: event %s[%u]: unknown (too high)\n",
213 type_table->name, event);
214 return -EINVAL;
215 }
216 handler = type_table->uwbd_events[event].handler; 197 handler = type_table->uwbd_events[event].handler;
217 if (handler == NULL) { 198 if (handler == NULL)
218 printk(KERN_ERR "UWBD: event %s[%u]: unknown\n", type_table->name, event); 199 goto out;
219 return -EINVAL; 200
220 } 201 result = (*handler)(evt);
221 return (*handler)(evt); 202out:
203 if (result < 0)
204 dev_err(&evt->rc->uwb_dev.dev,
205 "UWBD: event 0x%02x/%04x/%02x, handling failed: %d\n",
206 type, event, context, result);
207 return result;
222} 208}
223 209
224static void uwbd_event_handle_message(struct uwb_event *evt) 210static void uwbd_event_handle_message(struct uwb_event *evt)
diff --git a/drivers/uwb/whc-rc.c b/drivers/uwb/whc-rc.c
index 5f00386e26c7..19a1dd129212 100644
--- a/drivers/uwb/whc-rc.c
+++ b/drivers/uwb/whc-rc.c
@@ -48,10 +48,8 @@
48#include <linux/uwb.h> 48#include <linux/uwb.h>
49#include <linux/uwb/whci.h> 49#include <linux/uwb/whci.h>
50#include <linux/uwb/umc.h> 50#include <linux/uwb/umc.h>
51#include "uwb-internal.h"
52 51
53#define D_LOCAL 0 52#include "uwb-internal.h"
54#include <linux/uwb/debug.h>
55 53
56/** 54/**
57 * Descriptor for an instance of the UWB Radio Control Driver that 55 * Descriptor for an instance of the UWB Radio Control Driver that
@@ -97,13 +95,8 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
97 struct device *dev = &whcrc->umc_dev->dev; 95 struct device *dev = &whcrc->umc_dev->dev;
98 u32 urccmd; 96 u32 urccmd;
99 97
100 d_fnstart(3, dev, "(%p, %p, %zu)\n", uwb_rc, cmd, cmd_size); 98 if (cmd_size >= 4096)
101 might_sleep(); 99 return -EINVAL;
102
103 if (cmd_size >= 4096) {
104 result = -E2BIG;
105 goto error;
106 }
107 100
108 /* 101 /*
109 * If the URC is halted, then the hardware has reset itself. 102 * If the URC is halted, then the hardware has reset itself.
@@ -114,16 +107,14 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
114 if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) { 107 if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) {
115 dev_err(dev, "requesting reset of halted radio controller\n"); 108 dev_err(dev, "requesting reset of halted radio controller\n");
116 uwb_rc_reset_all(uwb_rc); 109 uwb_rc_reset_all(uwb_rc);
117 result = -EIO; 110 return -EIO;
118 goto error;
119 } 111 }
120 112
121 result = wait_event_timeout(whcrc->cmd_wq, 113 result = wait_event_timeout(whcrc->cmd_wq,
122 !(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2); 114 !(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2);
123 if (result == 0) { 115 if (result == 0) {
124 dev_err(dev, "device is not ready to execute commands\n"); 116 dev_err(dev, "device is not ready to execute commands\n");
125 result = -ETIMEDOUT; 117 return -ETIMEDOUT;
126 goto error;
127 } 118 }
128 119
129 memmove(whcrc->cmd_buf, cmd, cmd_size); 120 memmove(whcrc->cmd_buf, cmd, cmd_size);
@@ -136,10 +127,7 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
136 whcrc->rc_base + URCCMD); 127 whcrc->rc_base + URCCMD);
137 spin_unlock(&whcrc->irq_lock); 128 spin_unlock(&whcrc->irq_lock);
138 129
139error: 130 return 0;
140 d_fnend(3, dev, "(%p, %p, %zu) = %d\n",
141 uwb_rc, cmd, cmd_size, result);
142 return result;
143} 131}
144 132
145static int whcrc_reset(struct uwb_rc *rc) 133static int whcrc_reset(struct uwb_rc *rc)
@@ -166,34 +154,25 @@ static int whcrc_reset(struct uwb_rc *rc)
166static 154static
167void whcrc_enable_events(struct whcrc *whcrc) 155void whcrc_enable_events(struct whcrc *whcrc)
168{ 156{
169 struct device *dev = &whcrc->umc_dev->dev;
170 u32 urccmd; 157 u32 urccmd;
171 158
172 d_fnstart(4, dev, "(whcrc %p)\n", whcrc);
173
174 le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR); 159 le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR);
175 160
176 spin_lock(&whcrc->irq_lock); 161 spin_lock(&whcrc->irq_lock);
177 urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE; 162 urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE;
178 le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD); 163 le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD);
179 spin_unlock(&whcrc->irq_lock); 164 spin_unlock(&whcrc->irq_lock);
180
181 d_fnend(4, dev, "(whcrc %p) = void\n", whcrc);
182} 165}
183 166
184static void whcrc_event_work(struct work_struct *work) 167static void whcrc_event_work(struct work_struct *work)
185{ 168{
186 struct whcrc *whcrc = container_of(work, struct whcrc, event_work); 169 struct whcrc *whcrc = container_of(work, struct whcrc, event_work);
187 struct device *dev = &whcrc->umc_dev->dev;
188 size_t size; 170 size_t size;
189 u64 urcevtaddr; 171 u64 urcevtaddr;
190 172
191 urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR); 173 urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR);
192 size = urcevtaddr & URCEVTADDR_OFFSET_MASK; 174 size = urcevtaddr & URCEVTADDR_OFFSET_MASK;
193 175
194 d_printf(3, dev, "received %zu octet event\n", size);
195 d_dump(4, dev, whcrc->evt_buf, size > 32 ? 32 : size);
196
197 uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size); 176 uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size);
198 whcrc_enable_events(whcrc); 177 whcrc_enable_events(whcrc);
199} 178}
@@ -216,22 +195,15 @@ irqreturn_t whcrc_irq_cb(int irq, void *_whcrc)
216 return IRQ_NONE; 195 return IRQ_NONE;
217 le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS); 196 le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS);
218 197
219 d_printf(4, dev, "acked 0x%08x, urcsts 0x%08x\n",
220 le_readl(whcrc->rc_base + URCSTS), urcsts);
221
222 if (urcsts & URCSTS_HSE) { 198 if (urcsts & URCSTS_HSE) {
223 dev_err(dev, "host system error -- hardware halted\n"); 199 dev_err(dev, "host system error -- hardware halted\n");
224 /* FIXME: do something sensible here */ 200 /* FIXME: do something sensible here */
225 goto out; 201 goto out;
226 } 202 }
227 if (urcsts & URCSTS_ER) { 203 if (urcsts & URCSTS_ER)
228 d_printf(3, dev, "ER: event ready\n");
229 schedule_work(&whcrc->event_work); 204 schedule_work(&whcrc->event_work);
230 } 205 if (urcsts & URCSTS_RCI)
231 if (urcsts & URCSTS_RCI) {
232 d_printf(3, dev, "RCI: ready to execute another command\n");
233 wake_up_all(&whcrc->cmd_wq); 206 wake_up_all(&whcrc->cmd_wq);
234 }
235out: 207out:
236 return IRQ_HANDLED; 208 return IRQ_HANDLED;
237} 209}
@@ -250,8 +222,7 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
250 whcrc->area = umc_dev->resource.start; 222 whcrc->area = umc_dev->resource.start;
251 whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1; 223 whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1;
252 result = -EBUSY; 224 result = -EBUSY;
253 if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) 225 if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) {
254 == NULL) {
255 dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n", 226 dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n",
256 whcrc->rc_len, whcrc->area, result); 227 whcrc->rc_len, whcrc->area, result);
257 goto error_request_region; 228 goto error_request_region;
@@ -286,8 +257,6 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
286 dev_err(dev, "Can't allocate evt transfer buffer\n"); 257 dev_err(dev, "Can't allocate evt transfer buffer\n");
287 goto error_evt_buffer; 258 goto error_evt_buffer;
288 } 259 }
289 d_printf(3, dev, "UWB RC Interface: %zu bytes at 0x%p, irq %u\n",
290 whcrc->rc_len, whcrc->rc_base, umc_dev->irq);
291 return 0; 260 return 0;
292 261
293error_evt_buffer: 262error_evt_buffer:
@@ -396,7 +365,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
396 struct whcrc *whcrc; 365 struct whcrc *whcrc;
397 struct device *dev = &umc_dev->dev; 366 struct device *dev = &umc_dev->dev;
398 367
399 d_fnstart(3, dev, "(umc_dev %p)\n", umc_dev);
400 result = -ENOMEM; 368 result = -ENOMEM;
401 uwb_rc = uwb_rc_alloc(); 369 uwb_rc = uwb_rc_alloc();
402 if (uwb_rc == NULL) { 370 if (uwb_rc == NULL) {
@@ -428,7 +396,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
428 if (result < 0) 396 if (result < 0)
429 goto error_rc_add; 397 goto error_rc_add;
430 umc_set_drvdata(umc_dev, whcrc); 398 umc_set_drvdata(umc_dev, whcrc);
431 d_fnend(3, dev, "(umc_dev %p) = 0\n", umc_dev);
432 return 0; 399 return 0;
433 400
434error_rc_add: 401error_rc_add:
@@ -438,7 +405,6 @@ error_setup_rc_umc:
438error_alloc: 405error_alloc:
439 uwb_rc_put(uwb_rc); 406 uwb_rc_put(uwb_rc);
440error_rc_alloc: 407error_rc_alloc:
441 d_fnend(3, dev, "(umc_dev %p) = %d\n", umc_dev, result);
442 return result; 408 return result;
443} 409}
444 410
@@ -461,7 +427,6 @@ static void whcrc_remove(struct umc_dev *umc_dev)
461 whcrc_release_rc_umc(whcrc); 427 whcrc_release_rc_umc(whcrc);
462 kfree(whcrc); 428 kfree(whcrc);
463 uwb_rc_put(uwb_rc); 429 uwb_rc_put(uwb_rc);
464 d_printf(1, &umc_dev->dev, "freed whcrc %p\n", whcrc);
465} 430}
466 431
467static int whcrc_pre_reset(struct umc_dev *umc) 432static int whcrc_pre_reset(struct umc_dev *umc)
diff --git a/drivers/uwb/wlp/eda.c b/drivers/uwb/wlp/eda.c
index cdfe8dfc4340..0b4659e4bbd7 100644
--- a/drivers/uwb/wlp/eda.c
+++ b/drivers/uwb/wlp/eda.c
@@ -51,9 +51,7 @@
51 * the tag and address of the transmitting neighbor. 51 * the tag and address of the transmitting neighbor.
52 */ 52 */
53 53
54#define D_LOCAL 5
55#include <linux/netdevice.h> 54#include <linux/netdevice.h>
56#include <linux/uwb/debug.h>
57#include <linux/etherdevice.h> 55#include <linux/etherdevice.h>
58#include <linux/wlp.h> 56#include <linux/wlp.h>
59#include "wlp-internal.h" 57#include "wlp-internal.h"
@@ -304,7 +302,6 @@ int wlp_eda_for_virtual(struct wlp_eda *eda,
304{ 302{
305 int result = 0; 303 int result = 0;
306 struct wlp *wlp = container_of(eda, struct wlp, eda); 304 struct wlp *wlp = container_of(eda, struct wlp, eda);
307 struct device *dev = &wlp->rc->uwb_dev.dev;
308 struct wlp_eda_node *itr; 305 struct wlp_eda_node *itr;
309 unsigned long flags; 306 unsigned long flags;
310 int found = 0; 307 int found = 0;
@@ -313,40 +310,14 @@ int wlp_eda_for_virtual(struct wlp_eda *eda,
313 list_for_each_entry(itr, &eda->cache, list_node) { 310 list_for_each_entry(itr, &eda->cache, list_node) {
314 if (!memcmp(itr->virt_addr, virt_addr, 311 if (!memcmp(itr->virt_addr, virt_addr,
315 sizeof(itr->virt_addr))) { 312 sizeof(itr->virt_addr))) {
316 d_printf(6, dev, "EDA: looking for "
317 "%02x:%02x:%02x:%02x:%02x:%02x hit %02x:%02x "
318 "wss %p tag 0x%02x state %u\n",
319 virt_addr[0], virt_addr[1],
320 virt_addr[2], virt_addr[3],
321 virt_addr[4], virt_addr[5],
322 itr->dev_addr.data[1],
323 itr->dev_addr.data[0], itr->wss,
324 itr->tag, itr->state);
325 result = (*function)(wlp, itr, priv); 313 result = (*function)(wlp, itr, priv);
326 *dev_addr = itr->dev_addr; 314 *dev_addr = itr->dev_addr;
327 found = 1; 315 found = 1;
328 break; 316 break;
329 } else 317 }
330 d_printf(6, dev, "EDA: looking for "
331 "%02x:%02x:%02x:%02x:%02x:%02x "
332 "against "
333 "%02x:%02x:%02x:%02x:%02x:%02x miss\n",
334 virt_addr[0], virt_addr[1],
335 virt_addr[2], virt_addr[3],
336 virt_addr[4], virt_addr[5],
337 itr->virt_addr[0], itr->virt_addr[1],
338 itr->virt_addr[2], itr->virt_addr[3],
339 itr->virt_addr[4], itr->virt_addr[5]);
340 } 318 }
341 if (!found) { 319 if (!found)
342 if (printk_ratelimit())
343 dev_err(dev, "EDA: Eth addr %02x:%02x:%02x"
344 ":%02x:%02x:%02x not found.\n",
345 virt_addr[0], virt_addr[1],
346 virt_addr[2], virt_addr[3],
347 virt_addr[4], virt_addr[5]);
348 result = -ENODEV; 320 result = -ENODEV;
349 }
350 spin_unlock_irqrestore(&eda->lock, flags); 321 spin_unlock_irqrestore(&eda->lock, flags);
351 return result; 322 return result;
352} 323}
diff --git a/drivers/uwb/wlp/messages.c b/drivers/uwb/wlp/messages.c
index a64cb8241713..aa42fcee4c4f 100644
--- a/drivers/uwb/wlp/messages.c
+++ b/drivers/uwb/wlp/messages.c
@@ -24,8 +24,7 @@
24 */ 24 */
25 25
26#include <linux/wlp.h> 26#include <linux/wlp.h>
27#define D_LOCAL 6 27
28#include <linux/uwb/debug.h>
29#include "wlp-internal.h" 28#include "wlp-internal.h"
30 29
31static 30static
@@ -105,24 +104,18 @@ static inline void wlp_set_attr_hdr(struct wlp_attr_hdr *hdr, unsigned type,
105#define wlp_set(type, type_code, name) \ 104#define wlp_set(type, type_code, name) \
106static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \ 105static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
107{ \ 106{ \
108 d_fnstart(6, NULL, "(attribute %p)\n", attr); \
109 wlp_set_attr_hdr(&attr->hdr, type_code, \ 107 wlp_set_attr_hdr(&attr->hdr, type_code, \
110 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \ 108 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \
111 attr->name = value; \ 109 attr->name = value; \
112 d_dump(6, NULL, attr, sizeof(*attr)); \
113 d_fnend(6, NULL, "(attribute %p)\n", attr); \
114 return sizeof(*attr); \ 110 return sizeof(*attr); \
115} 111}
116 112
117#define wlp_pset(type, type_code, name) \ 113#define wlp_pset(type, type_code, name) \
118static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \ 114static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
119{ \ 115{ \
120 d_fnstart(6, NULL, "(attribute %p)\n", attr); \
121 wlp_set_attr_hdr(&attr->hdr, type_code, \ 116 wlp_set_attr_hdr(&attr->hdr, type_code, \
122 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \ 117 sizeof(*attr) - sizeof(struct wlp_attr_hdr)); \
123 attr->name = *value; \ 118 attr->name = *value; \
124 d_dump(6, NULL, attr, sizeof(*attr)); \
125 d_fnend(6, NULL, "(attribute %p)\n", attr); \
126 return sizeof(*attr); \ 119 return sizeof(*attr); \
127} 120}
128 121
@@ -139,11 +132,8 @@ static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value) \
139static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value, \ 132static size_t wlp_set_##name(struct wlp_attr_##name *attr, type value, \
140 size_t len) \ 133 size_t len) \
141{ \ 134{ \
142 d_fnstart(6, NULL, "(attribute %p)\n", attr); \
143 wlp_set_attr_hdr(&attr->hdr, type_code, len); \ 135 wlp_set_attr_hdr(&attr->hdr, type_code, len); \
144 memcpy(attr->name, value, len); \ 136 memcpy(attr->name, value, len); \
145 d_dump(6, NULL, attr, sizeof(*attr) + len); \
146 d_fnend(6, NULL, "(attribute %p)\n", attr); \
147 return sizeof(*attr) + len; \ 137 return sizeof(*attr) + len; \
148} 138}
149 139
@@ -182,7 +172,7 @@ static size_t wlp_set_wss_info(struct wlp_attr_wss_info *attr,
182 size_t datalen; 172 size_t datalen;
183 void *ptr = attr->wss_info; 173 void *ptr = attr->wss_info;
184 size_t used = sizeof(*attr); 174 size_t used = sizeof(*attr);
185 d_fnstart(6, NULL, "(attribute %p)\n", attr); 175
186 datalen = sizeof(struct wlp_wss_info) + strlen(wss->name); 176 datalen = sizeof(struct wlp_wss_info) + strlen(wss->name);
187 wlp_set_attr_hdr(&attr->hdr, WLP_ATTR_WSS_INFO, datalen); 177 wlp_set_attr_hdr(&attr->hdr, WLP_ATTR_WSS_INFO, datalen);
188 used = wlp_set_wssid(ptr, &wss->wssid); 178 used = wlp_set_wssid(ptr, &wss->wssid);
@@ -190,9 +180,6 @@ static size_t wlp_set_wss_info(struct wlp_attr_wss_info *attr,
190 used += wlp_set_accept_enrl(ptr + used, wss->accept_enroll); 180 used += wlp_set_accept_enrl(ptr + used, wss->accept_enroll);
191 used += wlp_set_wss_sec_status(ptr + used, wss->secure_status); 181 used += wlp_set_wss_sec_status(ptr + used, wss->secure_status);
192 used += wlp_set_wss_bcast(ptr + used, &wss->bcast); 182 used += wlp_set_wss_bcast(ptr + used, &wss->bcast);
193 d_dump(6, NULL, attr, sizeof(*attr) + datalen);
194 d_fnend(6, NULL, "(attribute %p, used %d)\n",
195 attr, (int)(sizeof(*attr) + used));
196 return sizeof(*attr) + used; 183 return sizeof(*attr) + used;
197} 184}
198 185
@@ -414,7 +401,6 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
414 size_t used = 0; 401 size_t used = 0;
415 ssize_t result = -EINVAL; 402 ssize_t result = -EINVAL;
416 403
417 d_printf(6, dev, "WLP: WSS info: Retrieving WSS name\n");
418 result = wlp_get_wss_name(wlp, ptr, info->name, buflen); 404 result = wlp_get_wss_name(wlp, ptr, info->name, buflen);
419 if (result < 0) { 405 if (result < 0) {
420 dev_err(dev, "WLP: unable to obtain WSS name from " 406 dev_err(dev, "WLP: unable to obtain WSS name from "
@@ -422,7 +408,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
422 goto error_parse; 408 goto error_parse;
423 } 409 }
424 used += result; 410 used += result;
425 d_printf(6, dev, "WLP: WSS info: Retrieving accept enroll\n"); 411
426 result = wlp_get_accept_enrl(wlp, ptr + used, &info->accept_enroll, 412 result = wlp_get_accept_enrl(wlp, ptr + used, &info->accept_enroll,
427 buflen - used); 413 buflen - used);
428 if (result < 0) { 414 if (result < 0) {
@@ -437,7 +423,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
437 goto error_parse; 423 goto error_parse;
438 } 424 }
439 used += result; 425 used += result;
440 d_printf(6, dev, "WLP: WSS info: Retrieving secure status\n"); 426
441 result = wlp_get_wss_sec_status(wlp, ptr + used, &info->sec_status, 427 result = wlp_get_wss_sec_status(wlp, ptr + used, &info->sec_status,
442 buflen - used); 428 buflen - used);
443 if (result < 0) { 429 if (result < 0) {
@@ -452,7 +438,7 @@ static ssize_t wlp_get_wss_info_attrs(struct wlp *wlp,
452 goto error_parse; 438 goto error_parse;
453 } 439 }
454 used += result; 440 used += result;
455 d_printf(6, dev, "WLP: WSS info: Retrieving broadcast\n"); 441
456 result = wlp_get_wss_bcast(wlp, ptr + used, &info->bcast, 442 result = wlp_get_wss_bcast(wlp, ptr + used, &info->bcast,
457 buflen - used); 443 buflen - used);
458 if (result < 0) { 444 if (result < 0) {
@@ -530,7 +516,7 @@ static ssize_t wlp_get_wss_info(struct wlp *wlp, struct wlp_attr_wss_info *attr,
530 len = result; 516 len = result;
531 used = sizeof(*attr); 517 used = sizeof(*attr);
532 ptr = attr; 518 ptr = attr;
533 d_printf(6, dev, "WLP: WSS info: Retrieving WSSID\n"); 519
534 result = wlp_get_wssid(wlp, ptr + used, wssid, buflen - used); 520 result = wlp_get_wssid(wlp, ptr + used, wssid, buflen - used);
535 if (result < 0) { 521 if (result < 0) {
536 dev_err(dev, "WLP: unable to obtain WSSID from WSS info.\n"); 522 dev_err(dev, "WLP: unable to obtain WSSID from WSS info.\n");
@@ -553,8 +539,6 @@ static ssize_t wlp_get_wss_info(struct wlp *wlp, struct wlp_attr_wss_info *attr,
553 goto out; 539 goto out;
554 } 540 }
555 result = used; 541 result = used;
556 d_printf(6, dev, "WLP: Successfully parsed WLP information "
557 "attribute. used %zu bytes\n", used);
558out: 542out:
559 return result; 543 return result;
560} 544}
@@ -598,8 +582,6 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp,
598 struct wlp_wssid_e *wssid_e; 582 struct wlp_wssid_e *wssid_e;
599 char buf[WLP_WSS_UUID_STRSIZE]; 583 char buf[WLP_WSS_UUID_STRSIZE];
600 584
601 d_fnstart(6, dev, "wlp %p, attr %p, neighbor %p, wss %p, buflen %d \n",
602 wlp, attr, neighbor, wss, (int)buflen);
603 if (buflen < 0) 585 if (buflen < 0)
604 goto out; 586 goto out;
605 587
@@ -638,8 +620,7 @@ static ssize_t wlp_get_all_wss_info(struct wlp *wlp,
638 wss->accept_enroll = wss_info.accept_enroll; 620 wss->accept_enroll = wss_info.accept_enroll;
639 wss->state = WLP_WSS_STATE_PART_ENROLLED; 621 wss->state = WLP_WSS_STATE_PART_ENROLLED;
640 wlp_wss_uuid_print(buf, sizeof(buf), &wssid); 622 wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
641 d_printf(2, dev, "WLP: Found WSS %s. Enrolling.\n", 623 dev_dbg(dev, "WLP: Found WSS %s. Enrolling.\n", buf);
642 buf);
643 } else { 624 } else {
644 wssid_e = wlp_create_wssid_e(wlp, neighbor); 625 wssid_e = wlp_create_wssid_e(wlp, neighbor);
645 if (wssid_e == NULL) { 626 if (wssid_e == NULL) {
@@ -660,9 +641,6 @@ error_parse:
660 if (result < 0 && !enroll) /* this was a discovery */ 641 if (result < 0 && !enroll) /* this was a discovery */
661 wlp_remove_neighbor_tmp_info(neighbor); 642 wlp_remove_neighbor_tmp_info(neighbor);
662out: 643out:
663 d_fnend(6, dev, "wlp %p, attr %p, neighbor %p, wss %p, buflen %d, "
664 "result %d \n", wlp, attr, neighbor, wss, (int)buflen,
665 (int)result);
666 return result; 644 return result;
667 645
668} 646}
@@ -718,7 +696,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
718 struct sk_buff *_skb; 696 struct sk_buff *_skb;
719 void *d1_itr; 697 void *d1_itr;
720 698
721 d_fnstart(6, dev, "wlp %p\n", wlp);
722 if (wlp->dev_info == NULL) { 699 if (wlp->dev_info == NULL) {
723 result = __wlp_setup_device_info(wlp); 700 result = __wlp_setup_device_info(wlp);
724 if (result < 0) { 701 if (result < 0) {
@@ -728,24 +705,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
728 } 705 }
729 } 706 }
730 info = wlp->dev_info; 707 info = wlp->dev_info;
731 d_printf(6, dev, "Local properties:\n"
732 "Device name (%d bytes): %s\n"
733 "Model name (%d bytes): %s\n"
734 "Manufacturer (%d bytes): %s\n"
735 "Model number (%d bytes): %s\n"
736 "Serial number (%d bytes): %s\n"
737 "Primary device type: \n"
738 " Category: %d \n"
739 " OUI: %02x:%02x:%02x \n"
740 " OUI Subdivision: %u \n",
741 (int)strlen(info->name), info->name,
742 (int)strlen(info->model_name), info->model_name,
743 (int)strlen(info->manufacturer), info->manufacturer,
744 (int)strlen(info->model_nr), info->model_nr,
745 (int)strlen(info->serial), info->serial,
746 info->prim_dev_type.category,
747 info->prim_dev_type.OUI[0], info->prim_dev_type.OUI[1],
748 info->prim_dev_type.OUI[2], info->prim_dev_type.OUIsubdiv);
749 _skb = dev_alloc_skb(sizeof(*_d1) 708 _skb = dev_alloc_skb(sizeof(*_d1)
750 + sizeof(struct wlp_attr_uuid_e) 709 + sizeof(struct wlp_attr_uuid_e)
751 + sizeof(struct wlp_attr_wss_sel_mthd) 710 + sizeof(struct wlp_attr_wss_sel_mthd)
@@ -768,7 +727,6 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
768 goto error; 727 goto error;
769 } 728 }
770 _d1 = (void *) _skb->data; 729 _d1 = (void *) _skb->data;
771 d_printf(6, dev, "D1 starts at %p \n", _d1);
772 _d1->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 730 _d1->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
773 _d1->hdr.type = WLP_FRAME_ASSOCIATION; 731 _d1->hdr.type = WLP_FRAME_ASSOCIATION;
774 _d1->type = WLP_ASSOC_D1; 732 _d1->type = WLP_ASSOC_D1;
@@ -791,25 +749,8 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
791 used += wlp_set_prim_dev_type(d1_itr + used, &info->prim_dev_type); 749 used += wlp_set_prim_dev_type(d1_itr + used, &info->prim_dev_type);
792 used += wlp_set_wlp_assc_err(d1_itr + used, WLP_ASSOC_ERROR_NONE); 750 used += wlp_set_wlp_assc_err(d1_itr + used, WLP_ASSOC_ERROR_NONE);
793 skb_put(_skb, sizeof(*_d1) + used); 751 skb_put(_skb, sizeof(*_d1) + used);
794 d_printf(6, dev, "D1 message:\n");
795 d_dump(6, dev, _d1, sizeof(*_d1)
796 + sizeof(struct wlp_attr_uuid_e)
797 + sizeof(struct wlp_attr_wss_sel_mthd)
798 + sizeof(struct wlp_attr_dev_name)
799 + strlen(info->name)
800 + sizeof(struct wlp_attr_manufacturer)
801 + strlen(info->manufacturer)
802 + sizeof(struct wlp_attr_model_name)
803 + strlen(info->model_name)
804 + sizeof(struct wlp_attr_model_nr)
805 + strlen(info->model_nr)
806 + sizeof(struct wlp_attr_serial)
807 + strlen(info->serial)
808 + sizeof(struct wlp_attr_prim_dev_type)
809 + sizeof(struct wlp_attr_wlp_assc_err));
810 *skb = _skb; 752 *skb = _skb;
811error: 753error:
812 d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
813 return result; 754 return result;
814} 755}
815 756
@@ -837,7 +778,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
837 void *d2_itr; 778 void *d2_itr;
838 size_t mem_needed; 779 size_t mem_needed;
839 780
840 d_fnstart(6, dev, "wlp %p\n", wlp);
841 if (wlp->dev_info == NULL) { 781 if (wlp->dev_info == NULL) {
842 result = __wlp_setup_device_info(wlp); 782 result = __wlp_setup_device_info(wlp);
843 if (result < 0) { 783 if (result < 0) {
@@ -847,24 +787,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
847 } 787 }
848 } 788 }
849 info = wlp->dev_info; 789 info = wlp->dev_info;
850 d_printf(6, dev, "Local properties:\n"
851 "Device name (%d bytes): %s\n"
852 "Model name (%d bytes): %s\n"
853 "Manufacturer (%d bytes): %s\n"
854 "Model number (%d bytes): %s\n"
855 "Serial number (%d bytes): %s\n"
856 "Primary device type: \n"
857 " Category: %d \n"
858 " OUI: %02x:%02x:%02x \n"
859 " OUI Subdivision: %u \n",
860 (int)strlen(info->name), info->name,
861 (int)strlen(info->model_name), info->model_name,
862 (int)strlen(info->manufacturer), info->manufacturer,
863 (int)strlen(info->model_nr), info->model_nr,
864 (int)strlen(info->serial), info->serial,
865 info->prim_dev_type.category,
866 info->prim_dev_type.OUI[0], info->prim_dev_type.OUI[1],
867 info->prim_dev_type.OUI[2], info->prim_dev_type.OUIsubdiv);
868 mem_needed = sizeof(*_d2) 790 mem_needed = sizeof(*_d2)
869 + sizeof(struct wlp_attr_uuid_e) 791 + sizeof(struct wlp_attr_uuid_e)
870 + sizeof(struct wlp_attr_uuid_r) 792 + sizeof(struct wlp_attr_uuid_r)
@@ -892,7 +814,6 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
892 goto error; 814 goto error;
893 } 815 }
894 _d2 = (void *) _skb->data; 816 _d2 = (void *) _skb->data;
895 d_printf(6, dev, "D2 starts at %p \n", _d2);
896 _d2->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 817 _d2->hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
897 _d2->hdr.type = WLP_FRAME_ASSOCIATION; 818 _d2->hdr.type = WLP_FRAME_ASSOCIATION;
898 _d2->type = WLP_ASSOC_D2; 819 _d2->type = WLP_ASSOC_D2;
@@ -917,11 +838,8 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
917 used += wlp_set_prim_dev_type(d2_itr + used, &info->prim_dev_type); 838 used += wlp_set_prim_dev_type(d2_itr + used, &info->prim_dev_type);
918 used += wlp_set_wlp_assc_err(d2_itr + used, WLP_ASSOC_ERROR_NONE); 839 used += wlp_set_wlp_assc_err(d2_itr + used, WLP_ASSOC_ERROR_NONE);
919 skb_put(_skb, sizeof(*_d2) + used); 840 skb_put(_skb, sizeof(*_d2) + used);
920 d_printf(6, dev, "D2 message:\n");
921 d_dump(6, dev, _d2, mem_needed);
922 *skb = _skb; 841 *skb = _skb;
923error: 842error:
924 d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
925 return result; 843 return result;
926} 844}
927 845
@@ -947,7 +865,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
947 struct sk_buff *_skb; 865 struct sk_buff *_skb;
948 struct wlp_nonce tmp; 866 struct wlp_nonce tmp;
949 867
950 d_fnstart(6, dev, "wlp %p\n", wlp);
951 _skb = dev_alloc_skb(sizeof(*f0)); 868 _skb = dev_alloc_skb(sizeof(*f0));
952 if (_skb == NULL) { 869 if (_skb == NULL) {
953 dev_err(dev, "WLP: Unable to allocate memory for F0 " 870 dev_err(dev, "WLP: Unable to allocate memory for F0 "
@@ -955,7 +872,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
955 goto error_alloc; 872 goto error_alloc;
956 } 873 }
957 f0 = (void *) _skb->data; 874 f0 = (void *) _skb->data;
958 d_printf(6, dev, "F0 starts at %p \n", f0);
959 f0->f0_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 875 f0->f0_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
960 f0->f0_hdr.hdr.type = WLP_FRAME_ASSOCIATION; 876 f0->f0_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
961 f0->f0_hdr.type = WLP_ASSOC_F0; 877 f0->f0_hdr.type = WLP_ASSOC_F0;
@@ -969,7 +885,6 @@ int wlp_build_assoc_f0(struct wlp *wlp, struct sk_buff **skb,
969 *skb = _skb; 885 *skb = _skb;
970 result = 0; 886 result = 0;
971error_alloc: 887error_alloc:
972 d_fnend(6, dev, "wlp %p, result %d \n", wlp, result);
973 return result; 888 return result;
974} 889}
975 890
@@ -1242,12 +1157,9 @@ void wlp_handle_d1_frame(struct work_struct *ws)
1242 enum wlp_wss_sel_mthd sel_mthd = 0; 1157 enum wlp_wss_sel_mthd sel_mthd = 0;
1243 struct wlp_device_info dev_info; 1158 struct wlp_device_info dev_info;
1244 enum wlp_assc_error assc_err; 1159 enum wlp_assc_error assc_err;
1245 char uuid[WLP_WSS_UUID_STRSIZE];
1246 struct sk_buff *resp = NULL; 1160 struct sk_buff *resp = NULL;
1247 1161
1248 /* Parse D1 frame */ 1162 /* Parse D1 frame */
1249 d_fnstart(6, dev, "WLP: handle D1 frame. wlp = %p, skb = %p\n",
1250 wlp, skb);
1251 mutex_lock(&wss->mutex); 1163 mutex_lock(&wss->mutex);
1252 mutex_lock(&wlp->mutex); /* to access wlp->uuid */ 1164 mutex_lock(&wlp->mutex); /* to access wlp->uuid */
1253 memset(&dev_info, 0, sizeof(dev_info)); 1165 memset(&dev_info, 0, sizeof(dev_info));
@@ -1258,30 +1170,6 @@ void wlp_handle_d1_frame(struct work_struct *ws)
1258 kfree_skb(skb); 1170 kfree_skb(skb);
1259 goto out; 1171 goto out;
1260 } 1172 }
1261 wlp_wss_uuid_print(uuid, sizeof(uuid), &uuid_e);
1262 d_printf(6, dev, "From D1 frame:\n"
1263 "UUID-E: %s\n"
1264 "Selection method: %d\n"
1265 "Device name (%d bytes): %s\n"
1266 "Model name (%d bytes): %s\n"
1267 "Manufacturer (%d bytes): %s\n"
1268 "Model number (%d bytes): %s\n"
1269 "Serial number (%d bytes): %s\n"
1270 "Primary device type: \n"
1271 " Category: %d \n"
1272 " OUI: %02x:%02x:%02x \n"
1273 " OUI Subdivision: %u \n",
1274 uuid, sel_mthd,
1275 (int)strlen(dev_info.name), dev_info.name,
1276 (int)strlen(dev_info.model_name), dev_info.model_name,
1277 (int)strlen(dev_info.manufacturer), dev_info.manufacturer,
1278 (int)strlen(dev_info.model_nr), dev_info.model_nr,
1279 (int)strlen(dev_info.serial), dev_info.serial,
1280 dev_info.prim_dev_type.category,
1281 dev_info.prim_dev_type.OUI[0],
1282 dev_info.prim_dev_type.OUI[1],
1283 dev_info.prim_dev_type.OUI[2],
1284 dev_info.prim_dev_type.OUIsubdiv);
1285 1173
1286 kfree_skb(skb); 1174 kfree_skb(skb);
1287 if (!wlp_uuid_is_set(&wlp->uuid)) { 1175 if (!wlp_uuid_is_set(&wlp->uuid)) {
@@ -1316,7 +1204,6 @@ out:
1316 kfree(frame_ctx); 1204 kfree(frame_ctx);
1317 mutex_unlock(&wlp->mutex); 1205 mutex_unlock(&wlp->mutex);
1318 mutex_unlock(&wss->mutex); 1206 mutex_unlock(&wss->mutex);
1319 d_fnend(6, dev, "WLP: handle D1 frame. wlp = %p\n", wlp);
1320} 1207}
1321 1208
1322/** 1209/**
@@ -1546,10 +1433,8 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb,
1546 void *ptr = skb->data; 1433 void *ptr = skb->data;
1547 size_t len = skb->len; 1434 size_t len = skb->len;
1548 size_t used; 1435 size_t used;
1549 char buf[WLP_WSS_UUID_STRSIZE];
1550 struct wlp_frame_assoc *assoc = ptr; 1436 struct wlp_frame_assoc *assoc = ptr;
1551 1437
1552 d_fnstart(6, dev, "wlp %p, skb %p \n", wlp, skb);
1553 used = sizeof(*assoc); 1438 used = sizeof(*assoc);
1554 result = wlp_get_wssid(wlp, ptr + used, wssid, len - used); 1439 result = wlp_get_wssid(wlp, ptr + used, wssid, len - used);
1555 if (result < 0) { 1440 if (result < 0) {
@@ -1572,14 +1457,7 @@ int wlp_parse_c3c4_frame(struct wlp *wlp, struct sk_buff *skb,
1572 wlp_assoc_frame_str(assoc->type)); 1457 wlp_assoc_frame_str(assoc->type));
1573 goto error_parse; 1458 goto error_parse;
1574 } 1459 }
1575 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
1576 d_printf(6, dev, "WLP: parsed: WSSID %s, tag 0x%02x, virt "
1577 "%02x:%02x:%02x:%02x:%02x:%02x \n", buf, *tag,
1578 virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
1579 virt_addr->data[3], virt_addr->data[4], virt_addr->data[5]);
1580
1581error_parse: 1460error_parse:
1582 d_fnend(6, dev, "wlp %p, skb %p, result = %d \n", wlp, skb, result);
1583 return result; 1461 return result;
1584} 1462}
1585 1463
@@ -1600,7 +1478,6 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
1600 } *c; 1478 } *c;
1601 struct sk_buff *_skb; 1479 struct sk_buff *_skb;
1602 1480
1603 d_fnstart(6, dev, "wlp %p, wss %p \n", wlp, wss);
1604 _skb = dev_alloc_skb(sizeof(*c)); 1481 _skb = dev_alloc_skb(sizeof(*c));
1605 if (_skb == NULL) { 1482 if (_skb == NULL) {
1606 dev_err(dev, "WLP: Unable to allocate memory for C1/C2 " 1483 dev_err(dev, "WLP: Unable to allocate memory for C1/C2 "
@@ -1608,7 +1485,6 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
1608 goto error_alloc; 1485 goto error_alloc;
1609 } 1486 }
1610 c = (void *) _skb->data; 1487 c = (void *) _skb->data;
1611 d_printf(6, dev, "C1/C2 starts at %p \n", c);
1612 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 1488 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
1613 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION; 1489 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
1614 c->c_hdr.type = type; 1490 c->c_hdr.type = type;
@@ -1616,12 +1492,9 @@ int wlp_build_assoc_c1c2(struct wlp *wlp, struct wlp_wss *wss,
1616 wlp_set_msg_type(&c->c_hdr.msg_type, type); 1492 wlp_set_msg_type(&c->c_hdr.msg_type, type);
1617 wlp_set_wssid(&c->wssid, &wss->wssid); 1493 wlp_set_wssid(&c->wssid, &wss->wssid);
1618 skb_put(_skb, sizeof(*c)); 1494 skb_put(_skb, sizeof(*c));
1619 d_printf(6, dev, "C1/C2 message:\n");
1620 d_dump(6, dev, c, sizeof(*c));
1621 *skb = _skb; 1495 *skb = _skb;
1622 result = 0; 1496 result = 0;
1623error_alloc: 1497error_alloc:
1624 d_fnend(6, dev, "wlp %p, wss %p, result %d \n", wlp, wss, result);
1625 return result; 1498 return result;
1626} 1499}
1627 1500
@@ -1660,7 +1533,6 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
1660 } *c; 1533 } *c;
1661 struct sk_buff *_skb; 1534 struct sk_buff *_skb;
1662 1535
1663 d_fnstart(6, dev, "wlp %p, wss %p \n", wlp, wss);
1664 _skb = dev_alloc_skb(sizeof(*c)); 1536 _skb = dev_alloc_skb(sizeof(*c));
1665 if (_skb == NULL) { 1537 if (_skb == NULL) {
1666 dev_err(dev, "WLP: Unable to allocate memory for C3/C4 " 1538 dev_err(dev, "WLP: Unable to allocate memory for C3/C4 "
@@ -1668,7 +1540,6 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
1668 goto error_alloc; 1540 goto error_alloc;
1669 } 1541 }
1670 c = (void *) _skb->data; 1542 c = (void *) _skb->data;
1671 d_printf(6, dev, "C3/C4 starts at %p \n", c);
1672 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID); 1543 c->c_hdr.hdr.mux_hdr = cpu_to_le16(WLP_PROTOCOL_ID);
1673 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION; 1544 c->c_hdr.hdr.type = WLP_FRAME_ASSOCIATION;
1674 c->c_hdr.type = type; 1545 c->c_hdr.type = type;
@@ -1678,12 +1549,9 @@ int wlp_build_assoc_c3c4(struct wlp *wlp, struct wlp_wss *wss,
1678 wlp_set_wss_tag(&c->wss_tag, wss->tag); 1549 wlp_set_wss_tag(&c->wss_tag, wss->tag);
1679 wlp_set_wss_virt(&c->wss_virt, &wss->virtual_addr); 1550 wlp_set_wss_virt(&c->wss_virt, &wss->virtual_addr);
1680 skb_put(_skb, sizeof(*c)); 1551 skb_put(_skb, sizeof(*c));
1681 d_printf(6, dev, "C3/C4 message:\n");
1682 d_dump(6, dev, c, sizeof(*c));
1683 *skb = _skb; 1552 *skb = _skb;
1684 result = 0; 1553 result = 0;
1685error_alloc: 1554error_alloc:
1686 d_fnend(6, dev, "wlp %p, wss %p, result %d \n", wlp, wss, result);
1687 return result; 1555 return result;
1688} 1556}
1689 1557
@@ -1709,10 +1577,7 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \
1709 struct device *dev = &wlp->rc->uwb_dev.dev; \ 1577 struct device *dev = &wlp->rc->uwb_dev.dev; \
1710 int result; \ 1578 int result; \
1711 struct sk_buff *skb = NULL; \ 1579 struct sk_buff *skb = NULL; \
1712 d_fnstart(6, dev, "wlp %p, wss %p, neighbor: %02x:%02x\n", \ 1580 \
1713 wlp, wss, dev_addr->data[1], dev_addr->data[0]); \
1714 d_printf(6, dev, "WLP: Constructing %s frame. \n", \
1715 wlp_assoc_frame_str(id)); \
1716 /* Build the frame */ \ 1581 /* Build the frame */ \
1717 result = wlp_build_assoc_##type(wlp, wss, &skb); \ 1582 result = wlp_build_assoc_##type(wlp, wss, &skb); \
1718 if (result < 0) { \ 1583 if (result < 0) { \
@@ -1721,9 +1586,6 @@ static int wlp_send_assoc_##type(struct wlp *wlp, struct wlp_wss *wss, \
1721 goto error_build_assoc; \ 1586 goto error_build_assoc; \
1722 } \ 1587 } \
1723 /* Send the frame */ \ 1588 /* Send the frame */ \
1724 d_printf(6, dev, "Transmitting %s frame to %02x:%02x \n", \
1725 wlp_assoc_frame_str(id), \
1726 dev_addr->data[1], dev_addr->data[0]); \
1727 BUG_ON(wlp->xmit_frame == NULL); \ 1589 BUG_ON(wlp->xmit_frame == NULL); \
1728 result = wlp->xmit_frame(wlp, skb, dev_addr); \ 1590 result = wlp->xmit_frame(wlp, skb, dev_addr); \
1729 if (result < 0) { \ 1591 if (result < 0) { \
@@ -1740,8 +1602,6 @@ error_xmit: \
1740 /* We could try again ... */ \ 1602 /* We could try again ... */ \
1741 dev_kfree_skb_any(skb);/*we need to free if tx fails*/ \ 1603 dev_kfree_skb_any(skb);/*we need to free if tx fails*/ \
1742error_build_assoc: \ 1604error_build_assoc: \
1743 d_fnend(6, dev, "wlp %p, wss %p, neighbor: %02x:%02x\n", \
1744 wlp, wss, dev_addr->data[1], dev_addr->data[0]); \
1745 return result; \ 1605 return result; \
1746} 1606}
1747 1607
@@ -1794,12 +1654,9 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1794 struct uwb_dev_addr *src = &frame_ctx->src; 1654 struct uwb_dev_addr *src = &frame_ctx->src;
1795 int result; 1655 int result;
1796 struct wlp_uuid wssid; 1656 struct wlp_uuid wssid;
1797 char buf[WLP_WSS_UUID_STRSIZE];
1798 struct sk_buff *resp = NULL; 1657 struct sk_buff *resp = NULL;
1799 1658
1800 /* Parse C1 frame */ 1659 /* Parse C1 frame */
1801 d_fnstart(6, dev, "WLP: handle C1 frame. wlp = %p, c1 = %p\n",
1802 wlp, c1);
1803 mutex_lock(&wss->mutex); 1660 mutex_lock(&wss->mutex);
1804 result = wlp_get_wssid(wlp, (void *)c1 + sizeof(*c1), &wssid, 1661 result = wlp_get_wssid(wlp, (void *)c1 + sizeof(*c1), &wssid,
1805 len - sizeof(*c1)); 1662 len - sizeof(*c1));
@@ -1807,12 +1664,8 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1807 dev_err(dev, "WLP: unable to obtain WSSID from C1 frame.\n"); 1664 dev_err(dev, "WLP: unable to obtain WSSID from C1 frame.\n");
1808 goto out; 1665 goto out;
1809 } 1666 }
1810 wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
1811 d_printf(6, dev, "Received C1 frame with WSSID %s \n", buf);
1812 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)) 1667 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))
1813 && wss->state == WLP_WSS_STATE_ACTIVE) { 1668 && wss->state == WLP_WSS_STATE_ACTIVE) {
1814 d_printf(6, dev, "WSSID from C1 frame is known locally "
1815 "and is active\n");
1816 /* Construct C2 frame */ 1669 /* Construct C2 frame */
1817 result = wlp_build_assoc_c2(wlp, wss, &resp); 1670 result = wlp_build_assoc_c2(wlp, wss, &resp);
1818 if (result < 0) { 1671 if (result < 0) {
@@ -1820,8 +1673,6 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1820 goto out; 1673 goto out;
1821 } 1674 }
1822 } else { 1675 } else {
1823 d_printf(6, dev, "WSSID from C1 frame is not known locally "
1824 "or is not active\n");
1825 /* Construct F0 frame */ 1676 /* Construct F0 frame */
1826 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV); 1677 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV);
1827 if (result < 0) { 1678 if (result < 0) {
@@ -1830,8 +1681,6 @@ void wlp_handle_c1_frame(struct work_struct *ws)
1830 } 1681 }
1831 } 1682 }
1832 /* Send C2 frame */ 1683 /* Send C2 frame */
1833 d_printf(6, dev, "Transmitting response (C2/F0) frame to %02x:%02x \n",
1834 src->data[1], src->data[0]);
1835 BUG_ON(wlp->xmit_frame == NULL); 1684 BUG_ON(wlp->xmit_frame == NULL);
1836 result = wlp->xmit_frame(wlp, resp, src); 1685 result = wlp->xmit_frame(wlp, resp, src);
1837 if (result < 0) { 1686 if (result < 0) {
@@ -1846,7 +1695,6 @@ out:
1846 kfree_skb(frame_ctx->skb); 1695 kfree_skb(frame_ctx->skb);
1847 kfree(frame_ctx); 1696 kfree(frame_ctx);
1848 mutex_unlock(&wss->mutex); 1697 mutex_unlock(&wss->mutex);
1849 d_fnend(6, dev, "WLP: handle C1 frame. wlp = %p\n", wlp);
1850} 1698}
1851 1699
1852/** 1700/**
@@ -1868,27 +1716,20 @@ void wlp_handle_c3_frame(struct work_struct *ws)
1868 struct sk_buff *skb = frame_ctx->skb; 1716 struct sk_buff *skb = frame_ctx->skb;
1869 struct uwb_dev_addr *src = &frame_ctx->src; 1717 struct uwb_dev_addr *src = &frame_ctx->src;
1870 int result; 1718 int result;
1871 char buf[WLP_WSS_UUID_STRSIZE];
1872 struct sk_buff *resp = NULL; 1719 struct sk_buff *resp = NULL;
1873 struct wlp_uuid wssid; 1720 struct wlp_uuid wssid;
1874 u8 tag; 1721 u8 tag;
1875 struct uwb_mac_addr virt_addr; 1722 struct uwb_mac_addr virt_addr;
1876 1723
1877 /* Parse C3 frame */ 1724 /* Parse C3 frame */
1878 d_fnstart(6, dev, "WLP: handle C3 frame. wlp = %p, skb = %p\n",
1879 wlp, skb);
1880 mutex_lock(&wss->mutex); 1725 mutex_lock(&wss->mutex);
1881 result = wlp_parse_c3c4_frame(wlp, skb, &wssid, &tag, &virt_addr); 1726 result = wlp_parse_c3c4_frame(wlp, skb, &wssid, &tag, &virt_addr);
1882 if (result < 0) { 1727 if (result < 0) {
1883 dev_err(dev, "WLP: unable to obtain values from C3 frame.\n"); 1728 dev_err(dev, "WLP: unable to obtain values from C3 frame.\n");
1884 goto out; 1729 goto out;
1885 } 1730 }
1886 wlp_wss_uuid_print(buf, sizeof(buf), &wssid);
1887 d_printf(6, dev, "Received C3 frame with WSSID %s \n", buf);
1888 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)) 1731 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))
1889 && wss->state >= WLP_WSS_STATE_ACTIVE) { 1732 && wss->state >= WLP_WSS_STATE_ACTIVE) {
1890 d_printf(6, dev, "WSSID from C3 frame is known locally "
1891 "and is active\n");
1892 result = wlp_eda_update_node(&wlp->eda, src, wss, 1733 result = wlp_eda_update_node(&wlp->eda, src, wss,
1893 (void *) virt_addr.data, tag, 1734 (void *) virt_addr.data, tag,
1894 WLP_WSS_CONNECTED); 1735 WLP_WSS_CONNECTED);
@@ -1913,8 +1754,6 @@ void wlp_handle_c3_frame(struct work_struct *ws)
1913 } 1754 }
1914 } 1755 }
1915 } else { 1756 } else {
1916 d_printf(6, dev, "WSSID from C3 frame is not known locally "
1917 "or is not active\n");
1918 /* Construct F0 frame */ 1757 /* Construct F0 frame */
1919 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV); 1758 result = wlp_build_assoc_f0(wlp, &resp, WLP_ASSOC_ERROR_INV);
1920 if (result < 0) { 1759 if (result < 0) {
@@ -1923,8 +1762,6 @@ void wlp_handle_c3_frame(struct work_struct *ws)
1923 } 1762 }
1924 } 1763 }
1925 /* Send C4 frame */ 1764 /* Send C4 frame */
1926 d_printf(6, dev, "Transmitting response (C4/F0) frame to %02x:%02x \n",
1927 src->data[1], src->data[0]);
1928 BUG_ON(wlp->xmit_frame == NULL); 1765 BUG_ON(wlp->xmit_frame == NULL);
1929 result = wlp->xmit_frame(wlp, resp, src); 1766 result = wlp->xmit_frame(wlp, resp, src);
1930 if (result < 0) { 1767 if (result < 0) {
@@ -1939,8 +1776,6 @@ out:
1939 kfree_skb(frame_ctx->skb); 1776 kfree_skb(frame_ctx->skb);
1940 kfree(frame_ctx); 1777 kfree(frame_ctx);
1941 mutex_unlock(&wss->mutex); 1778 mutex_unlock(&wss->mutex);
1942 d_fnend(6, dev, "WLP: handle C3 frame. wlp = %p, skb = %p\n",
1943 wlp, skb);
1944} 1779}
1945 1780
1946 1781
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c
index 1bb9b1f97d47..0370399ff4bb 100644
--- a/drivers/uwb/wlp/sysfs.c
+++ b/drivers/uwb/wlp/sysfs.c
@@ -23,8 +23,8 @@
23 * FIXME: Docs 23 * FIXME: Docs
24 * 24 *
25 */ 25 */
26
27#include <linux/wlp.h> 26#include <linux/wlp.h>
27
28#include "wlp-internal.h" 28#include "wlp-internal.h"
29 29
30static 30static
diff --git a/drivers/uwb/wlp/txrx.c b/drivers/uwb/wlp/txrx.c
index c701bd1a2887..cd2035768b47 100644
--- a/drivers/uwb/wlp/txrx.c
+++ b/drivers/uwb/wlp/txrx.c
@@ -26,12 +26,10 @@
26 26
27#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
28#include <linux/wlp.h> 28#include <linux/wlp.h>
29#define D_LOCAL 5
30#include <linux/uwb/debug.h>
31#include "wlp-internal.h"
32 29
30#include "wlp-internal.h"
33 31
34/** 32/*
35 * Direct incoming association msg to correct parsing routine 33 * Direct incoming association msg to correct parsing routine
36 * 34 *
37 * We only expect D1, E1, C1, C3 messages as new. All other incoming 35 * We only expect D1, E1, C1, C3 messages as new. All other incoming
@@ -48,35 +46,31 @@ void wlp_direct_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
48 struct device *dev = &wlp->rc->uwb_dev.dev; 46 struct device *dev = &wlp->rc->uwb_dev.dev;
49 struct wlp_frame_assoc *assoc = (void *) skb->data; 47 struct wlp_frame_assoc *assoc = (void *) skb->data;
50 struct wlp_assoc_frame_ctx *frame_ctx; 48 struct wlp_assoc_frame_ctx *frame_ctx;
51 d_fnstart(5, dev, "wlp %p, skb %p\n", wlp, skb); 49
52 frame_ctx = kmalloc(sizeof(*frame_ctx), GFP_ATOMIC); 50 frame_ctx = kmalloc(sizeof(*frame_ctx), GFP_ATOMIC);
53 if (frame_ctx == NULL) { 51 if (frame_ctx == NULL) {
54 dev_err(dev, "WLP: Unable to allocate memory for association " 52 dev_err(dev, "WLP: Unable to allocate memory for association "
55 "frame handling.\n"); 53 "frame handling.\n");
56 kfree_skb(skb); 54 kfree_skb(skb);
57 goto out; 55 return;
58 } 56 }
59 frame_ctx->wlp = wlp; 57 frame_ctx->wlp = wlp;
60 frame_ctx->skb = skb; 58 frame_ctx->skb = skb;
61 frame_ctx->src = *src; 59 frame_ctx->src = *src;
62 switch (assoc->type) { 60 switch (assoc->type) {
63 case WLP_ASSOC_D1: 61 case WLP_ASSOC_D1:
64 d_printf(5, dev, "Received a D1 frame.\n");
65 INIT_WORK(&frame_ctx->ws, wlp_handle_d1_frame); 62 INIT_WORK(&frame_ctx->ws, wlp_handle_d1_frame);
66 schedule_work(&frame_ctx->ws); 63 schedule_work(&frame_ctx->ws);
67 break; 64 break;
68 case WLP_ASSOC_E1: 65 case WLP_ASSOC_E1:
69 d_printf(5, dev, "Received a E1 frame. FIXME?\n");
70 kfree_skb(skb); /* Temporary until we handle it */ 66 kfree_skb(skb); /* Temporary until we handle it */
71 kfree(frame_ctx); /* Temporary until we handle it */ 67 kfree(frame_ctx); /* Temporary until we handle it */
72 break; 68 break;
73 case WLP_ASSOC_C1: 69 case WLP_ASSOC_C1:
74 d_printf(5, dev, "Received a C1 frame.\n");
75 INIT_WORK(&frame_ctx->ws, wlp_handle_c1_frame); 70 INIT_WORK(&frame_ctx->ws, wlp_handle_c1_frame);
76 schedule_work(&frame_ctx->ws); 71 schedule_work(&frame_ctx->ws);
77 break; 72 break;
78 case WLP_ASSOC_C3: 73 case WLP_ASSOC_C3:
79 d_printf(5, dev, "Received a C3 frame.\n");
80 INIT_WORK(&frame_ctx->ws, wlp_handle_c3_frame); 74 INIT_WORK(&frame_ctx->ws, wlp_handle_c3_frame);
81 schedule_work(&frame_ctx->ws); 75 schedule_work(&frame_ctx->ws);
82 break; 76 break;
@@ -87,11 +81,9 @@ void wlp_direct_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
87 kfree(frame_ctx); 81 kfree(frame_ctx);
88 break; 82 break;
89 } 83 }
90out:
91 d_fnend(5, dev, "wlp %p\n", wlp);
92} 84}
93 85
94/** 86/*
95 * Process incoming association frame 87 * Process incoming association frame
96 * 88 *
97 * Although it could be possible to deal with some incoming association 89 * Although it could be possible to deal with some incoming association
@@ -112,7 +104,6 @@ void wlp_receive_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
112 struct wlp_frame_assoc *assoc = (void *) skb->data; 104 struct wlp_frame_assoc *assoc = (void *) skb->data;
113 struct wlp_session *session = wlp->session; 105 struct wlp_session *session = wlp->session;
114 u8 version; 106 u8 version;
115 d_fnstart(5, dev, "wlp %p, skb %p\n", wlp, skb);
116 107
117 if (wlp_get_version(wlp, &assoc->version, &version, 108 if (wlp_get_version(wlp, &assoc->version, &version,
118 sizeof(assoc->version)) < 0) 109 sizeof(assoc->version)) < 0)
@@ -150,14 +141,12 @@ void wlp_receive_assoc_frame(struct wlp *wlp, struct sk_buff *skb,
150 } else { 141 } else {
151 wlp_direct_assoc_frame(wlp, skb, src); 142 wlp_direct_assoc_frame(wlp, skb, src);
152 } 143 }
153 d_fnend(5, dev, "wlp %p\n", wlp);
154 return; 144 return;
155error: 145error:
156 kfree_skb(skb); 146 kfree_skb(skb);
157 d_fnend(5, dev, "wlp %p\n", wlp);
158} 147}
159 148
160/** 149/*
161 * Verify incoming frame is from connected neighbor, prep to pass to WLP client 150 * Verify incoming frame is from connected neighbor, prep to pass to WLP client
162 * 151 *
163 * Verification proceeds according to WLP 0.99 [7.3.1]. The source address 152 * Verification proceeds according to WLP 0.99 [7.3.1]. The source address
@@ -176,7 +165,6 @@ int wlp_verify_prep_rx_frame(struct wlp *wlp, struct sk_buff *skb,
176 struct wlp_eda_node eda_entry; 165 struct wlp_eda_node eda_entry;
177 struct wlp_frame_std_abbrv_hdr *hdr = (void *) skb->data; 166 struct wlp_frame_std_abbrv_hdr *hdr = (void *) skb->data;
178 167
179 d_fnstart(6, dev, "wlp %p, skb %p \n", wlp, skb);
180 /*verify*/ 168 /*verify*/
181 result = wlp_copy_eda_node(&wlp->eda, src, &eda_entry); 169 result = wlp_copy_eda_node(&wlp->eda, src, &eda_entry);
182 if (result < 0) { 170 if (result < 0) {
@@ -207,11 +195,10 @@ int wlp_verify_prep_rx_frame(struct wlp *wlp, struct sk_buff *skb,
207 /*prep*/ 195 /*prep*/
208 skb_pull(skb, sizeof(*hdr)); 196 skb_pull(skb, sizeof(*hdr));
209out: 197out:
210 d_fnend(6, dev, "wlp %p, skb %p, result = %d \n", wlp, skb, result);
211 return result; 198 return result;
212} 199}
213 200
214/** 201/*
215 * Receive a WLP frame from device 202 * Receive a WLP frame from device
216 * 203 *
217 * @returns: 1 if calling function should free the skb 204 * @returns: 1 if calling function should free the skb
@@ -226,14 +213,12 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb,
226 struct wlp_frame_hdr *hdr; 213 struct wlp_frame_hdr *hdr;
227 int result = 0; 214 int result = 0;
228 215
229 d_fnstart(6, dev, "skb (%p), len (%u)\n", skb, len);
230 if (len < sizeof(*hdr)) { 216 if (len < sizeof(*hdr)) {
231 dev_err(dev, "Not enough data to parse WLP header.\n"); 217 dev_err(dev, "Not enough data to parse WLP header.\n");
232 result = -EINVAL; 218 result = -EINVAL;
233 goto out; 219 goto out;
234 } 220 }
235 hdr = ptr; 221 hdr = ptr;
236 d_dump(6, dev, hdr, sizeof(*hdr));
237 if (le16_to_cpu(hdr->mux_hdr) != WLP_PROTOCOL_ID) { 222 if (le16_to_cpu(hdr->mux_hdr) != WLP_PROTOCOL_ID) {
238 dev_err(dev, "Not a WLP frame type.\n"); 223 dev_err(dev, "Not a WLP frame type.\n");
239 result = -EINVAL; 224 result = -EINVAL;
@@ -270,7 +255,6 @@ int wlp_receive_frame(struct device *dev, struct wlp *wlp, struct sk_buff *skb,
270 "WLP header.\n"); 255 "WLP header.\n");
271 goto out; 256 goto out;
272 } 257 }
273 d_printf(5, dev, "Association frame received.\n");
274 wlp_receive_assoc_frame(wlp, skb, src); 258 wlp_receive_assoc_frame(wlp, skb, src);
275 break; 259 break;
276 default: 260 default:
@@ -283,13 +267,12 @@ out:
283 kfree_skb(skb); 267 kfree_skb(skb);
284 result = 0; 268 result = 0;
285 } 269 }
286 d_fnend(6, dev, "skb (%p)\n", skb);
287 return result; 270 return result;
288} 271}
289EXPORT_SYMBOL_GPL(wlp_receive_frame); 272EXPORT_SYMBOL_GPL(wlp_receive_frame);
290 273
291 274
292/** 275/*
293 * Verify frame from network stack, prepare for further transmission 276 * Verify frame from network stack, prepare for further transmission
294 * 277 *
295 * @skb: the socket buffer that needs to be prepared for transmission (it 278 * @skb: the socket buffer that needs to be prepared for transmission (it
@@ -343,9 +326,7 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
343 int result = -EINVAL; 326 int result = -EINVAL;
344 struct ethhdr *eth_hdr = (void *) skb->data; 327 struct ethhdr *eth_hdr = (void *) skb->data;
345 328
346 d_fnstart(6, dev, "wlp (%p), skb (%p) \n", wlp, skb);
347 if (is_broadcast_ether_addr(eth_hdr->h_dest)) { 329 if (is_broadcast_ether_addr(eth_hdr->h_dest)) {
348 d_printf(6, dev, "WLP: handling broadcast frame. \n");
349 result = wlp_eda_for_each(&wlp->eda, wlp_wss_send_copy, skb); 330 result = wlp_eda_for_each(&wlp->eda, wlp_wss_send_copy, skb);
350 if (result < 0) { 331 if (result < 0) {
351 if (printk_ratelimit()) 332 if (printk_ratelimit())
@@ -357,7 +338,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
357 result = 1; 338 result = 1;
358 /* Frame will be transmitted by WLP. */ 339 /* Frame will be transmitted by WLP. */
359 } else { 340 } else {
360 d_printf(6, dev, "WLP: handling unicast frame. \n");
361 result = wlp_eda_for_virtual(&wlp->eda, eth_hdr->h_dest, dst, 341 result = wlp_eda_for_virtual(&wlp->eda, eth_hdr->h_dest, dst,
362 wlp_wss_prep_hdr, skb); 342 wlp_wss_prep_hdr, skb);
363 if (unlikely(result < 0)) { 343 if (unlikely(result < 0)) {
@@ -368,7 +348,6 @@ int wlp_prepare_tx_frame(struct device *dev, struct wlp *wlp,
368 } 348 }
369 } 349 }
370out: 350out:
371 d_fnend(6, dev, "wlp (%p), skb (%p). result = %d \n", wlp, skb, result);
372 return result; 351 return result;
373} 352}
374EXPORT_SYMBOL_GPL(wlp_prepare_tx_frame); 353EXPORT_SYMBOL_GPL(wlp_prepare_tx_frame);
diff --git a/drivers/uwb/wlp/wlp-lc.c b/drivers/uwb/wlp/wlp-lc.c
index e531093c4162..13db739c4e39 100644
--- a/drivers/uwb/wlp/wlp-lc.c
+++ b/drivers/uwb/wlp/wlp-lc.c
@@ -21,12 +21,9 @@
21 * 21 *
22 * FIXME: docs 22 * FIXME: docs
23 */ 23 */
24
25#include <linux/wlp.h> 24#include <linux/wlp.h>
26#define D_LOCAL 6
27#include <linux/uwb/debug.h>
28#include "wlp-internal.h"
29 25
26#include "wlp-internal.h"
30 27
31static 28static
32void wlp_neighbor_init(struct wlp_neighbor_e *neighbor) 29void wlp_neighbor_init(struct wlp_neighbor_e *neighbor)
@@ -61,11 +58,6 @@ int __wlp_alloc_device_info(struct wlp *wlp)
61static 58static
62void __wlp_fill_device_info(struct wlp *wlp) 59void __wlp_fill_device_info(struct wlp *wlp)
63{ 60{
64 struct device *dev = &wlp->rc->uwb_dev.dev;
65
66 BUG_ON(wlp->fill_device_info == NULL);
67 d_printf(6, dev, "Retrieving device information "
68 "from device driver.\n");
69 wlp->fill_device_info(wlp, wlp->dev_info); 61 wlp->fill_device_info(wlp, wlp->dev_info);
70} 62}
71 63
@@ -127,7 +119,7 @@ void wlp_remove_neighbor_tmp_info(struct wlp_neighbor_e *neighbor)
127 } 119 }
128} 120}
129 121
130/** 122/*
131 * Populate WLP neighborhood cache with neighbor information 123 * Populate WLP neighborhood cache with neighbor information
132 * 124 *
133 * A new neighbor is found. If it is discoverable then we add it to the 125 * A new neighbor is found. If it is discoverable then we add it to the
@@ -141,10 +133,7 @@ int wlp_add_neighbor(struct wlp *wlp, struct uwb_dev *dev)
141 int discoverable; 133 int discoverable;
142 struct wlp_neighbor_e *neighbor; 134 struct wlp_neighbor_e *neighbor;
143 135
144 d_fnstart(6, &dev->dev, "uwb %p \n", dev); 136 /*
145 d_printf(6, &dev->dev, "Found neighbor device %02x:%02x \n",
146 dev->dev_addr.data[1], dev->dev_addr.data[0]);
147 /**
148 * FIXME: 137 * FIXME:
149 * Use contents of WLP IE found in beacon cache to determine if 138 * Use contents of WLP IE found in beacon cache to determine if
150 * neighbor is discoverable. 139 * neighbor is discoverable.
@@ -167,7 +156,6 @@ int wlp_add_neighbor(struct wlp *wlp, struct uwb_dev *dev)
167 list_add(&neighbor->node, &wlp->neighbors); 156 list_add(&neighbor->node, &wlp->neighbors);
168 } 157 }
169error_no_mem: 158error_no_mem:
170 d_fnend(6, &dev->dev, "uwb %p, result = %d \n", dev, result);
171 return result; 159 return result;
172} 160}
173 161
@@ -255,8 +243,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
255 dev_err(dev, "Unable to send D1 frame to neighbor " 243 dev_err(dev, "Unable to send D1 frame to neighbor "
256 "%02x:%02x (%d)\n", dev_addr->data[1], 244 "%02x:%02x (%d)\n", dev_addr->data[1],
257 dev_addr->data[0], result); 245 dev_addr->data[0], result);
258 d_printf(6, dev, "Add placeholders into buffer next to "
259 "neighbor information we have (dev address).\n");
260 goto out; 246 goto out;
261 } 247 }
262 /* Create session, wait for response */ 248 /* Create session, wait for response */
@@ -284,8 +270,6 @@ int wlp_d1d2_exchange(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
284 /* Parse message in session->data: it will be either D2 or F0 */ 270 /* Parse message in session->data: it will be either D2 or F0 */
285 skb = session.data; 271 skb = session.data;
286 resp = (void *) skb->data; 272 resp = (void *) skb->data;
287 d_printf(6, dev, "Received response to D1 frame. \n");
288 d_dump(6, dev, skb->data, skb->len > 72 ? 72 : skb->len);
289 273
290 if (resp->type == WLP_ASSOC_F0) { 274 if (resp->type == WLP_ASSOC_F0) {
291 result = wlp_parse_f0(wlp, skb); 275 result = wlp_parse_f0(wlp, skb);
@@ -337,10 +321,9 @@ int wlp_enroll_neighbor(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
337 struct device *dev = &wlp->rc->uwb_dev.dev; 321 struct device *dev = &wlp->rc->uwb_dev.dev;
338 char buf[WLP_WSS_UUID_STRSIZE]; 322 char buf[WLP_WSS_UUID_STRSIZE];
339 struct uwb_dev_addr *dev_addr = &neighbor->uwb_dev->dev_addr; 323 struct uwb_dev_addr *dev_addr = &neighbor->uwb_dev->dev_addr;
324
340 wlp_wss_uuid_print(buf, sizeof(buf), wssid); 325 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
341 d_fnstart(6, dev, "wlp %p, neighbor %p, wss %p, wssid %p (%s)\n", 326
342 wlp, neighbor, wss, wssid, buf);
343 d_printf(6, dev, "Complete me.\n");
344 result = wlp_d1d2_exchange(wlp, neighbor, wss, wssid); 327 result = wlp_d1d2_exchange(wlp, neighbor, wss, wssid);
345 if (result < 0) { 328 if (result < 0) {
346 dev_err(dev, "WLP: D1/D2 message exchange for enrollment " 329 dev_err(dev, "WLP: D1/D2 message exchange for enrollment "
@@ -360,13 +343,10 @@ int wlp_enroll_neighbor(struct wlp *wlp, struct wlp_neighbor_e *neighbor,
360 goto error; 343 goto error;
361 } else { 344 } else {
362 wss->state = WLP_WSS_STATE_ENROLLED; 345 wss->state = WLP_WSS_STATE_ENROLLED;
363 d_printf(2, dev, "WLP: Success Enrollment into unsecure WSS " 346 dev_dbg(dev, "WLP: Success Enrollment into unsecure WSS "
364 "%s using neighbor %02x:%02x. \n", buf, 347 "%s using neighbor %02x:%02x. \n",
365 dev_addr->data[1], dev_addr->data[0]); 348 buf, dev_addr->data[1], dev_addr->data[0]);
366 } 349 }
367
368 d_fnend(6, dev, "wlp %p, neighbor %p, wss %p, wssid %p (%s)\n",
369 wlp, neighbor, wss, wssid, buf);
370out: 350out:
371 return result; 351 return result;
372error: 352error:
@@ -449,7 +429,6 @@ ssize_t wlp_discover(struct wlp *wlp)
449 int result = 0; 429 int result = 0;
450 struct device *dev = &wlp->rc->uwb_dev.dev; 430 struct device *dev = &wlp->rc->uwb_dev.dev;
451 431
452 d_fnstart(6, dev, "wlp %p \n", wlp);
453 mutex_lock(&wlp->nbmutex); 432 mutex_lock(&wlp->nbmutex);
454 /* Clear current neighborhood cache. */ 433 /* Clear current neighborhood cache. */
455 __wlp_neighbors_release(wlp); 434 __wlp_neighbors_release(wlp);
@@ -469,7 +448,6 @@ ssize_t wlp_discover(struct wlp *wlp)
469 } 448 }
470error_dev_for_each: 449error_dev_for_each:
471 mutex_unlock(&wlp->nbmutex); 450 mutex_unlock(&wlp->nbmutex);
472 d_fnend(6, dev, "wlp %p \n", wlp);
473 return result; 451 return result;
474} 452}
475 453
@@ -492,9 +470,6 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev,
492 int result; 470 int result;
493 switch (event) { 471 switch (event) {
494 case UWB_NOTIF_ONAIR: 472 case UWB_NOTIF_ONAIR:
495 d_printf(6, dev, "UWB device %02x:%02x is onair\n",
496 uwb_dev->dev_addr.data[1],
497 uwb_dev->dev_addr.data[0]);
498 result = wlp_eda_create_node(&wlp->eda, 473 result = wlp_eda_create_node(&wlp->eda,
499 uwb_dev->mac_addr.data, 474 uwb_dev->mac_addr.data,
500 &uwb_dev->dev_addr); 475 &uwb_dev->dev_addr);
@@ -505,18 +480,11 @@ void wlp_uwb_notifs_cb(void *_wlp, struct uwb_dev *uwb_dev,
505 uwb_dev->dev_addr.data[0]); 480 uwb_dev->dev_addr.data[0]);
506 break; 481 break;
507 case UWB_NOTIF_OFFAIR: 482 case UWB_NOTIF_OFFAIR:
508 d_printf(6, dev, "UWB device %02x:%02x is offair\n",
509 uwb_dev->dev_addr.data[1],
510 uwb_dev->dev_addr.data[0]);
511 wlp_eda_rm_node(&wlp->eda, &uwb_dev->dev_addr); 483 wlp_eda_rm_node(&wlp->eda, &uwb_dev->dev_addr);
512 mutex_lock(&wlp->nbmutex); 484 mutex_lock(&wlp->nbmutex);
513 list_for_each_entry_safe(neighbor, next, &wlp->neighbors, 485 list_for_each_entry_safe(neighbor, next, &wlp->neighbors, node) {
514 node) { 486 if (neighbor->uwb_dev == uwb_dev)
515 if (neighbor->uwb_dev == uwb_dev) {
516 d_printf(6, dev, "Removing device from "
517 "neighborhood.\n");
518 __wlp_neighbor_release(neighbor); 487 __wlp_neighbor_release(neighbor);
519 }
520 } 488 }
521 mutex_unlock(&wlp->nbmutex); 489 mutex_unlock(&wlp->nbmutex);
522 break; 490 break;
@@ -538,14 +506,13 @@ static void wlp_channel_changed(struct uwb_pal *pal, int channel)
538 506
539int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev) 507int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev)
540{ 508{
541 struct device *dev = &rc->uwb_dev.dev;
542 int result; 509 int result;
543 510
544 d_fnstart(6, dev, "wlp %p\n", wlp);
545 BUG_ON(wlp->fill_device_info == NULL); 511 BUG_ON(wlp->fill_device_info == NULL);
546 BUG_ON(wlp->xmit_frame == NULL); 512 BUG_ON(wlp->xmit_frame == NULL);
547 BUG_ON(wlp->stop_queue == NULL); 513 BUG_ON(wlp->stop_queue == NULL);
548 BUG_ON(wlp->start_queue == NULL); 514 BUG_ON(wlp->start_queue == NULL);
515
549 wlp->rc = rc; 516 wlp->rc = rc;
550 wlp->ndev = ndev; 517 wlp->ndev = ndev;
551 wlp_eda_init(&wlp->eda);/* Set up address cache */ 518 wlp_eda_init(&wlp->eda);/* Set up address cache */
@@ -560,15 +527,12 @@ int wlp_setup(struct wlp *wlp, struct uwb_rc *rc, struct net_device *ndev)
560 if (result < 0) 527 if (result < 0)
561 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler); 528 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
562 529
563 d_fnend(6, dev, "wlp %p, result = %d\n", wlp, result);
564 return result; 530 return result;
565} 531}
566EXPORT_SYMBOL_GPL(wlp_setup); 532EXPORT_SYMBOL_GPL(wlp_setup);
567 533
568void wlp_remove(struct wlp *wlp) 534void wlp_remove(struct wlp *wlp)
569{ 535{
570 struct device *dev = &wlp->rc->uwb_dev.dev;
571 d_fnstart(6, dev, "wlp %p\n", wlp);
572 wlp_neighbors_release(wlp); 536 wlp_neighbors_release(wlp);
573 uwb_pal_unregister(&wlp->pal); 537 uwb_pal_unregister(&wlp->pal);
574 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler); 538 uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
@@ -578,9 +542,6 @@ void wlp_remove(struct wlp *wlp)
578 kfree(wlp->dev_info); 542 kfree(wlp->dev_info);
579 mutex_unlock(&wlp->mutex); 543 mutex_unlock(&wlp->mutex);
580 wlp->rc = NULL; 544 wlp->rc = NULL;
581 /* We have to use NULL here because this function can be called
582 * when the device disappeared. */
583 d_fnend(6, NULL, "wlp %p\n", wlp);
584} 545}
585EXPORT_SYMBOL_GPL(wlp_remove); 546EXPORT_SYMBOL_GPL(wlp_remove);
586 547
diff --git a/drivers/uwb/wlp/wss-lc.c b/drivers/uwb/wlp/wss-lc.c
index 96b18c9bd6e9..5913c7a5d922 100644
--- a/drivers/uwb/wlp/wss-lc.c
+++ b/drivers/uwb/wlp/wss-lc.c
@@ -43,14 +43,11 @@
43 * wlp_wss_release() 43 * wlp_wss_release()
44 * wlp_wss_reset() 44 * wlp_wss_reset()
45 */ 45 */
46
47#include <linux/etherdevice.h> /* for is_valid_ether_addr */ 46#include <linux/etherdevice.h> /* for is_valid_ether_addr */
48#include <linux/skbuff.h> 47#include <linux/skbuff.h>
49#include <linux/wlp.h> 48#include <linux/wlp.h>
50#define D_LOCAL 5
51#include <linux/uwb/debug.h>
52#include "wlp-internal.h"
53 49
50#include "wlp-internal.h"
54 51
55size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key) 52size_t wlp_wss_key_print(char *buf, size_t bufsize, u8 *key)
56{ 53{
@@ -116,9 +113,6 @@ struct uwb_mac_addr wlp_wss_sel_bcast_addr(struct wlp_wss *wss)
116 */ 113 */
117void wlp_wss_reset(struct wlp_wss *wss) 114void wlp_wss_reset(struct wlp_wss *wss)
118{ 115{
119 struct wlp *wlp = container_of(wss, struct wlp, wss);
120 struct device *dev = &wlp->rc->uwb_dev.dev;
121 d_fnstart(5, dev, "wss (%p) \n", wss);
122 memset(&wss->wssid, 0, sizeof(wss->wssid)); 116 memset(&wss->wssid, 0, sizeof(wss->wssid));
123 wss->hash = 0; 117 wss->hash = 0;
124 memset(&wss->name[0], 0, sizeof(wss->name)); 118 memset(&wss->name[0], 0, sizeof(wss->name));
@@ -127,7 +121,6 @@ void wlp_wss_reset(struct wlp_wss *wss)
127 memset(&wss->master_key[0], 0, sizeof(wss->master_key)); 121 memset(&wss->master_key[0], 0, sizeof(wss->master_key));
128 wss->tag = 0; 122 wss->tag = 0;
129 wss->state = WLP_WSS_STATE_NONE; 123 wss->state = WLP_WSS_STATE_NONE;
130 d_fnend(5, dev, "wss (%p) \n", wss);
131} 124}
132 125
133/** 126/**
@@ -145,7 +138,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str)
145 struct device *dev = &wlp->rc->uwb_dev.dev; 138 struct device *dev = &wlp->rc->uwb_dev.dev;
146 int result; 139 int result;
147 140
148 d_fnstart(5, dev, "wss (%p), wssid: %s\n", wss, wssid_str);
149 result = kobject_set_name(&wss->kobj, "wss-%s", wssid_str); 141 result = kobject_set_name(&wss->kobj, "wss-%s", wssid_str);
150 if (result < 0) 142 if (result < 0)
151 return result; 143 return result;
@@ -162,7 +154,6 @@ int wlp_wss_sysfs_add(struct wlp_wss *wss, char *wssid_str)
162 result); 154 result);
163 goto error_sysfs_create_group; 155 goto error_sysfs_create_group;
164 } 156 }
165 d_fnend(5, dev, "Completed. result = %d \n", result);
166 return 0; 157 return 0;
167error_sysfs_create_group: 158error_sysfs_create_group:
168 159
@@ -214,22 +205,14 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid,
214 struct wlp *wlp = container_of(wss, struct wlp, wss); 205 struct wlp *wlp = container_of(wss, struct wlp, wss);
215 struct device *dev = &wlp->rc->uwb_dev.dev; 206 struct device *dev = &wlp->rc->uwb_dev.dev;
216 struct wlp_neighbor_e *neighbor; 207 struct wlp_neighbor_e *neighbor;
217 char buf[WLP_WSS_UUID_STRSIZE];
218 int result = -ENXIO; 208 int result = -ENXIO;
219 struct uwb_dev_addr *dev_addr; 209 struct uwb_dev_addr *dev_addr;
220 210
221 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
222 d_fnstart(5, dev, "wss %p, wssid %s, registrar %02x:%02x \n",
223 wss, buf, dest->data[1], dest->data[0]);
224 mutex_lock(&wlp->nbmutex); 211 mutex_lock(&wlp->nbmutex);
225 list_for_each_entry(neighbor, &wlp->neighbors, node) { 212 list_for_each_entry(neighbor, &wlp->neighbors, node) {
226 dev_addr = &neighbor->uwb_dev->dev_addr; 213 dev_addr = &neighbor->uwb_dev->dev_addr;
227 if (!memcmp(dest, dev_addr, sizeof(*dest))) { 214 if (!memcmp(dest, dev_addr, sizeof(*dest))) {
228 d_printf(5, dev, "Neighbor %02x:%02x is valid, " 215 result = wlp_enroll_neighbor(wlp, neighbor, wss, wssid);
229 "enrolling. \n",
230 dev_addr->data[1], dev_addr->data[0]);
231 result = wlp_enroll_neighbor(wlp, neighbor, wss,
232 wssid);
233 break; 216 break;
234 } 217 }
235 } 218 }
@@ -237,8 +220,6 @@ int wlp_wss_enroll_target(struct wlp_wss *wss, struct wlp_uuid *wssid,
237 dev_err(dev, "WLP: Cannot find neighbor %02x:%02x. \n", 220 dev_err(dev, "WLP: Cannot find neighbor %02x:%02x. \n",
238 dest->data[1], dest->data[0]); 221 dest->data[1], dest->data[0]);
239 mutex_unlock(&wlp->nbmutex); 222 mutex_unlock(&wlp->nbmutex);
240 d_fnend(5, dev, "wss %p, wssid %s, registrar %02x:%02x, result %d \n",
241 wss, buf, dest->data[1], dest->data[0], result);
242 return result; 223 return result;
243} 224}
244 225
@@ -260,16 +241,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid)
260 char buf[WLP_WSS_UUID_STRSIZE]; 241 char buf[WLP_WSS_UUID_STRSIZE];
261 int result = -ENXIO; 242 int result = -ENXIO;
262 243
263 wlp_wss_uuid_print(buf, sizeof(buf), wssid); 244
264 d_fnstart(5, dev, "wss %p, wssid %s \n", wss, buf);
265 mutex_lock(&wlp->nbmutex); 245 mutex_lock(&wlp->nbmutex);
266 list_for_each_entry(neighbor, &wlp->neighbors, node) { 246 list_for_each_entry(neighbor, &wlp->neighbors, node) {
267 list_for_each_entry(wssid_e, &neighbor->wssid, node) { 247 list_for_each_entry(wssid_e, &neighbor->wssid, node) {
268 if (!memcmp(wssid, &wssid_e->wssid, sizeof(*wssid))) { 248 if (!memcmp(wssid, &wssid_e->wssid, sizeof(*wssid))) {
269 d_printf(5, dev, "Found WSSID %s in neighbor "
270 "%02x:%02x cache. \n", buf,
271 neighbor->uwb_dev->dev_addr.data[1],
272 neighbor->uwb_dev->dev_addr.data[0]);
273 result = wlp_enroll_neighbor(wlp, neighbor, 249 result = wlp_enroll_neighbor(wlp, neighbor,
274 wss, wssid); 250 wss, wssid);
275 if (result == 0) /* enrollment success */ 251 if (result == 0) /* enrollment success */
@@ -279,10 +255,11 @@ int wlp_wss_enroll_discovered(struct wlp_wss *wss, struct wlp_uuid *wssid)
279 } 255 }
280 } 256 }
281out: 257out:
282 if (result == -ENXIO) 258 if (result == -ENXIO) {
259 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
283 dev_err(dev, "WLP: Cannot find WSSID %s in cache. \n", buf); 260 dev_err(dev, "WLP: Cannot find WSSID %s in cache. \n", buf);
261 }
284 mutex_unlock(&wlp->nbmutex); 262 mutex_unlock(&wlp->nbmutex);
285 d_fnend(5, dev, "wss %p, wssid %s, result %d \n", wss, buf, result);
286 return result; 263 return result;
287} 264}
288 265
@@ -307,27 +284,22 @@ int wlp_wss_enroll(struct wlp_wss *wss, struct wlp_uuid *wssid,
307 struct uwb_dev_addr bcast = {.data = {0xff, 0xff} }; 284 struct uwb_dev_addr bcast = {.data = {0xff, 0xff} };
308 285
309 wlp_wss_uuid_print(buf, sizeof(buf), wssid); 286 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
287
310 if (wss->state != WLP_WSS_STATE_NONE) { 288 if (wss->state != WLP_WSS_STATE_NONE) {
311 dev_err(dev, "WLP: Already enrolled in WSS %s.\n", buf); 289 dev_err(dev, "WLP: Already enrolled in WSS %s.\n", buf);
312 result = -EEXIST; 290 result = -EEXIST;
313 goto error; 291 goto error;
314 } 292 }
315 if (!memcmp(&bcast, devaddr, sizeof(bcast))) { 293 if (!memcmp(&bcast, devaddr, sizeof(bcast)))
316 d_printf(5, dev, "Request to enroll in discovered WSS "
317 "with WSSID %s \n", buf);
318 result = wlp_wss_enroll_discovered(wss, wssid); 294 result = wlp_wss_enroll_discovered(wss, wssid);
319 } else { 295 else
320 d_printf(5, dev, "Request to enroll in WSSID %s with "
321 "registrar %02x:%02x\n", buf, devaddr->data[1],
322 devaddr->data[0]);
323 result = wlp_wss_enroll_target(wss, wssid, devaddr); 296 result = wlp_wss_enroll_target(wss, wssid, devaddr);
324 }
325 if (result < 0) { 297 if (result < 0) {
326 dev_err(dev, "WLP: Unable to enroll into WSS %s, result %d \n", 298 dev_err(dev, "WLP: Unable to enroll into WSS %s, result %d \n",
327 buf, result); 299 buf, result);
328 goto error; 300 goto error;
329 } 301 }
330 d_printf(2, dev, "Successfully enrolled into WSS %s \n", buf); 302 dev_dbg(dev, "Successfully enrolled into WSS %s \n", buf);
331 result = wlp_wss_sysfs_add(wss, buf); 303 result = wlp_wss_sysfs_add(wss, buf);
332 if (result < 0) { 304 if (result < 0) {
333 dev_err(dev, "WLP: Unable to set up sysfs for WSS kobject.\n"); 305 dev_err(dev, "WLP: Unable to set up sysfs for WSS kobject.\n");
@@ -363,7 +335,6 @@ int wlp_wss_activate(struct wlp_wss *wss)
363 u8 hash; /* only include one hash */ 335 u8 hash; /* only include one hash */
364 } ie_data; 336 } ie_data;
365 337
366 d_fnstart(5, dev, "Activating WSS %p. \n", wss);
367 BUG_ON(wss->state != WLP_WSS_STATE_ENROLLED); 338 BUG_ON(wss->state != WLP_WSS_STATE_ENROLLED);
368 wss->hash = wlp_wss_comp_wssid_hash(&wss->wssid); 339 wss->hash = wlp_wss_comp_wssid_hash(&wss->wssid);
369 wss->tag = wss->hash; 340 wss->tag = wss->hash;
@@ -382,7 +353,6 @@ int wlp_wss_activate(struct wlp_wss *wss)
382 wss->state = WLP_WSS_STATE_ACTIVE; 353 wss->state = WLP_WSS_STATE_ACTIVE;
383 result = 0; 354 result = 0;
384error_wlp_ie: 355error_wlp_ie:
385 d_fnend(5, dev, "Activating WSS %p, result = %d \n", wss, result);
386 return result; 356 return result;
387} 357}
388 358
@@ -405,7 +375,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
405 int result = 0; 375 int result = 0;
406 char buf[WLP_WSS_UUID_STRSIZE]; 376 char buf[WLP_WSS_UUID_STRSIZE];
407 377
408 d_fnstart(5, dev, "Enrollment and activation requested. \n");
409 mutex_lock(&wss->mutex); 378 mutex_lock(&wss->mutex);
410 result = wlp_wss_enroll(wss, wssid, devaddr); 379 result = wlp_wss_enroll(wss, wssid, devaddr);
411 if (result < 0) { 380 if (result < 0) {
@@ -424,7 +393,6 @@ int wlp_wss_enroll_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
424error_activate: 393error_activate:
425error_enroll: 394error_enroll:
426 mutex_unlock(&wss->mutex); 395 mutex_unlock(&wss->mutex);
427 d_fnend(5, dev, "Completed. result = %d \n", result);
428 return result; 396 return result;
429} 397}
430 398
@@ -447,11 +415,9 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
447 struct device *dev = &wlp->rc->uwb_dev.dev; 415 struct device *dev = &wlp->rc->uwb_dev.dev;
448 int result = 0; 416 int result = 0;
449 char buf[WLP_WSS_UUID_STRSIZE]; 417 char buf[WLP_WSS_UUID_STRSIZE];
450 d_fnstart(5, dev, "Request to create new WSS.\n"); 418
451 result = wlp_wss_uuid_print(buf, sizeof(buf), wssid); 419 result = wlp_wss_uuid_print(buf, sizeof(buf), wssid);
452 d_printf(5, dev, "Request to create WSS: WSSID=%s, name=%s, " 420
453 "sec_status=%u, accepting enrollment=%u \n",
454 buf, name, sec_status, accept);
455 if (!mutex_trylock(&wss->mutex)) { 421 if (!mutex_trylock(&wss->mutex)) {
456 dev_err(dev, "WLP: WLP association session in progress.\n"); 422 dev_err(dev, "WLP: WLP association session in progress.\n");
457 return -EBUSY; 423 return -EBUSY;
@@ -498,7 +464,6 @@ int wlp_wss_create_activate(struct wlp_wss *wss, struct wlp_uuid *wssid,
498 result = 0; 464 result = 0;
499out: 465out:
500 mutex_unlock(&wss->mutex); 466 mutex_unlock(&wss->mutex);
501 d_fnend(5, dev, "Completed. result = %d \n", result);
502 return result; 467 return result;
503} 468}
504 469
@@ -520,16 +485,12 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
520{ 485{
521 int result = 0; 486 int result = 0;
522 struct device *dev = &wlp->rc->uwb_dev.dev; 487 struct device *dev = &wlp->rc->uwb_dev.dev;
523 char buf[WLP_WSS_UUID_STRSIZE];
524 DECLARE_COMPLETION_ONSTACK(completion); 488 DECLARE_COMPLETION_ONSTACK(completion);
525 struct wlp_session session; 489 struct wlp_session session;
526 struct sk_buff *skb; 490 struct sk_buff *skb;
527 struct wlp_frame_assoc *resp; 491 struct wlp_frame_assoc *resp;
528 struct wlp_uuid wssid; 492 struct wlp_uuid wssid;
529 493
530 wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
531 d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
532 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
533 mutex_lock(&wlp->mutex); 494 mutex_lock(&wlp->mutex);
534 /* Send C1 association frame */ 495 /* Send C1 association frame */
535 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C1); 496 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C1);
@@ -565,8 +526,6 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
565 /* Parse message in session->data: it will be either C2 or F0 */ 526 /* Parse message in session->data: it will be either C2 or F0 */
566 skb = session.data; 527 skb = session.data;
567 resp = (void *) skb->data; 528 resp = (void *) skb->data;
568 d_printf(5, dev, "Received response to C1 frame. \n");
569 d_dump(5, dev, skb->data, skb->len > 72 ? 72 : skb->len);
570 if (resp->type == WLP_ASSOC_F0) { 529 if (resp->type == WLP_ASSOC_F0) {
571 result = wlp_parse_f0(wlp, skb); 530 result = wlp_parse_f0(wlp, skb);
572 if (result < 0) 531 if (result < 0)
@@ -584,11 +543,9 @@ int wlp_wss_is_active(struct wlp *wlp, struct wlp_wss *wss,
584 result = 0; 543 result = 0;
585 goto error_resp_parse; 544 goto error_resp_parse;
586 } 545 }
587 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid))) { 546 if (!memcmp(&wssid, &wss->wssid, sizeof(wssid)))
588 d_printf(5, dev, "WSSID in C2 frame matches local "
589 "active WSS.\n");
590 result = 1; 547 result = 1;
591 } else { 548 else {
592 dev_err(dev, "WLP: Received a C2 frame without matching " 549 dev_err(dev, "WLP: Received a C2 frame without matching "
593 "WSSID.\n"); 550 "WSSID.\n");
594 result = 0; 551 result = 0;
@@ -598,8 +555,6 @@ error_resp_parse:
598out: 555out:
599 wlp->session = NULL; 556 wlp->session = NULL;
600 mutex_unlock(&wlp->mutex); 557 mutex_unlock(&wlp->mutex);
601 d_fnend(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
602 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
603 return result; 558 return result;
604} 559}
605 560
@@ -620,16 +575,8 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss,
620{ 575{
621 struct device *dev = &wlp->rc->uwb_dev.dev; 576 struct device *dev = &wlp->rc->uwb_dev.dev;
622 int result = 0; 577 int result = 0;
623 char buf[WLP_WSS_UUID_STRSIZE];
624 wlp_wss_uuid_print(buf, sizeof(buf), wssid);
625 d_fnstart(5, dev, "wlp %p, wss %p, wssid %s, tag %u, virtual "
626 "%02x:%02x:%02x:%02x:%02x:%02x \n", wlp, wss, buf, *tag,
627 virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
628 virt_addr->data[3], virt_addr->data[4], virt_addr->data[5]);
629 578
630 if (!memcmp(wssid, &wss->wssid, sizeof(*wssid))) { 579 if (!memcmp(wssid, &wss->wssid, sizeof(*wssid))) {
631 d_printf(5, dev, "WSSID from neighbor frame matches local "
632 "active WSS.\n");
633 /* Update EDA cache */ 580 /* Update EDA cache */
634 result = wlp_eda_update_node(&wlp->eda, dev_addr, wss, 581 result = wlp_eda_update_node(&wlp->eda, dev_addr, wss,
635 (void *) virt_addr->data, *tag, 582 (void *) virt_addr->data, *tag,
@@ -638,18 +585,9 @@ int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss,
638 dev_err(dev, "WLP: Unable to update EDA cache " 585 dev_err(dev, "WLP: Unable to update EDA cache "
639 "with new connected neighbor information.\n"); 586 "with new connected neighbor information.\n");
640 } else { 587 } else {
641 dev_err(dev, "WLP: Neighbor does not have matching " 588 dev_err(dev, "WLP: Neighbor does not have matching WSSID.\n");
642 "WSSID.\n");
643 result = -EINVAL; 589 result = -EINVAL;
644 } 590 }
645
646 d_fnend(5, dev, "wlp %p, wss %p, wssid %s, tag %u, virtual "
647 "%02x:%02x:%02x:%02x:%02x:%02x, result = %d \n",
648 wlp, wss, buf, *tag,
649 virt_addr->data[0], virt_addr->data[1], virt_addr->data[2],
650 virt_addr->data[3], virt_addr->data[4], virt_addr->data[5],
651 result);
652
653 return result; 591 return result;
654} 592}
655 593
@@ -665,7 +603,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
665{ 603{
666 int result; 604 int result;
667 struct device *dev = &wlp->rc->uwb_dev.dev; 605 struct device *dev = &wlp->rc->uwb_dev.dev;
668 char buf[WLP_WSS_UUID_STRSIZE];
669 struct wlp_uuid wssid; 606 struct wlp_uuid wssid;
670 u8 tag; 607 u8 tag;
671 struct uwb_mac_addr virt_addr; 608 struct uwb_mac_addr virt_addr;
@@ -674,9 +611,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
674 struct wlp_frame_assoc *resp; 611 struct wlp_frame_assoc *resp;
675 struct sk_buff *skb; 612 struct sk_buff *skb;
676 613
677 wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
678 d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
679 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
680 mutex_lock(&wlp->mutex); 614 mutex_lock(&wlp->mutex);
681 /* Send C3 association frame */ 615 /* Send C3 association frame */
682 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C3); 616 result = wlp_send_assoc_frame(wlp, wss, dev_addr, WLP_ASSOC_C3);
@@ -711,8 +645,6 @@ int wlp_wss_connect_neighbor(struct wlp *wlp, struct wlp_wss *wss,
711 /* Parse message in session->data: it will be either C4 or F0 */ 645 /* Parse message in session->data: it will be either C4 or F0 */
712 skb = session.data; 646 skb = session.data;
713 resp = (void *) skb->data; 647 resp = (void *) skb->data;
714 d_printf(5, dev, "Received response to C3 frame. \n");
715 d_dump(5, dev, skb->data, skb->len > 72 ? 72 : skb->len);
716 if (resp->type == WLP_ASSOC_F0) { 648 if (resp->type == WLP_ASSOC_F0) {
717 result = wlp_parse_f0(wlp, skb); 649 result = wlp_parse_f0(wlp, skb);
718 if (result < 0) 650 if (result < 0)
@@ -744,8 +676,6 @@ out:
744 WLP_WSS_CONNECT_FAILED); 676 WLP_WSS_CONNECT_FAILED);
745 wlp->session = NULL; 677 wlp->session = NULL;
746 mutex_unlock(&wlp->mutex); 678 mutex_unlock(&wlp->mutex);
747 d_fnend(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
748 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
749 return result; 679 return result;
750} 680}
751 681
@@ -780,12 +710,8 @@ void wlp_wss_connect_send(struct work_struct *ws)
780 struct wlp_wss *wss = &wlp->wss; 710 struct wlp_wss *wss = &wlp->wss;
781 int result; 711 int result;
782 struct device *dev = &wlp->rc->uwb_dev.dev; 712 struct device *dev = &wlp->rc->uwb_dev.dev;
783 char buf[WLP_WSS_UUID_STRSIZE];
784 713
785 mutex_lock(&wss->mutex); 714 mutex_lock(&wss->mutex);
786 wlp_wss_uuid_print(buf, sizeof(buf), &wss->wssid);
787 d_fnstart(5, dev, "wlp %p, wss %p (wssid %s), neighbor %02x:%02x \n",
788 wlp, wss, buf, dev_addr->data[1], dev_addr->data[0]);
789 if (wss->state < WLP_WSS_STATE_ACTIVE) { 715 if (wss->state < WLP_WSS_STATE_ACTIVE) {
790 if (printk_ratelimit()) 716 if (printk_ratelimit())
791 dev_err(dev, "WLP: Attempting to connect with " 717 dev_err(dev, "WLP: Attempting to connect with "
@@ -836,7 +762,6 @@ out:
836 BUG_ON(wlp->start_queue == NULL); 762 BUG_ON(wlp->start_queue == NULL);
837 wlp->start_queue(wlp); 763 wlp->start_queue(wlp);
838 mutex_unlock(&wss->mutex); 764 mutex_unlock(&wss->mutex);
839 d_fnend(5, dev, "wlp %p, wss %p (wssid %s)\n", wlp, wss, buf);
840} 765}
841 766
842/** 767/**
@@ -855,7 +780,6 @@ int wlp_wss_prep_hdr(struct wlp *wlp, struct wlp_eda_node *eda_entry,
855 struct sk_buff *skb = _skb; 780 struct sk_buff *skb = _skb;
856 struct wlp_frame_std_abbrv_hdr *std_hdr; 781 struct wlp_frame_std_abbrv_hdr *std_hdr;
857 782
858 d_fnstart(6, dev, "wlp %p \n", wlp);
859 if (eda_entry->state == WLP_WSS_CONNECTED) { 783 if (eda_entry->state == WLP_WSS_CONNECTED) {
860 /* Add WLP header */ 784 /* Add WLP header */
861 BUG_ON(skb_headroom(skb) < sizeof(*std_hdr)); 785 BUG_ON(skb_headroom(skb) < sizeof(*std_hdr));
@@ -873,7 +797,6 @@ int wlp_wss_prep_hdr(struct wlp *wlp, struct wlp_eda_node *eda_entry,
873 dev_addr->data[0]); 797 dev_addr->data[0]);
874 result = -EINVAL; 798 result = -EINVAL;
875 } 799 }
876 d_fnend(6, dev, "wlp %p \n", wlp);
877 return result; 800 return result;
878} 801}
879 802
@@ -893,16 +816,9 @@ int wlp_wss_connect_prep(struct wlp *wlp, struct wlp_eda_node *eda_entry,
893{ 816{
894 int result = 0; 817 int result = 0;
895 struct device *dev = &wlp->rc->uwb_dev.dev; 818 struct device *dev = &wlp->rc->uwb_dev.dev;
896 struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr;
897 unsigned char *eth_addr = eda_entry->eth_addr;
898 struct sk_buff *skb = _skb; 819 struct sk_buff *skb = _skb;
899 struct wlp_assoc_conn_ctx *conn_ctx; 820 struct wlp_assoc_conn_ctx *conn_ctx;
900 821
901 d_fnstart(5, dev, "wlp %p\n", wlp);
902 d_printf(5, dev, "To neighbor %02x:%02x with eth "
903 "%02x:%02x:%02x:%02x:%02x:%02x\n", dev_addr->data[1],
904 dev_addr->data[0], eth_addr[0], eth_addr[1], eth_addr[2],
905 eth_addr[3], eth_addr[4], eth_addr[5]);
906 if (eda_entry->state == WLP_WSS_UNCONNECTED) { 822 if (eda_entry->state == WLP_WSS_UNCONNECTED) {
907 /* We don't want any more packets while we set up connection */ 823 /* We don't want any more packets while we set up connection */
908 BUG_ON(wlp->stop_queue == NULL); 824 BUG_ON(wlp->stop_queue == NULL);
@@ -929,12 +845,9 @@ int wlp_wss_connect_prep(struct wlp *wlp, struct wlp_eda_node *eda_entry,
929 "previously. Not retrying. \n"); 845 "previously. Not retrying. \n");
930 result = -ENONET; 846 result = -ENONET;
931 goto out; 847 goto out;
932 } else { /* eda_entry->state == WLP_WSS_CONNECTED */ 848 } else /* eda_entry->state == WLP_WSS_CONNECTED */
933 d_printf(5, dev, "Neighbor is connected, preparing frame.\n");
934 result = wlp_wss_prep_hdr(wlp, eda_entry, skb); 849 result = wlp_wss_prep_hdr(wlp, eda_entry, skb);
935 }
936out: 850out:
937 d_fnend(5, dev, "wlp %p, result = %d \n", wlp, result);
938 return result; 851 return result;
939} 852}
940 853
@@ -957,8 +870,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry,
957 struct sk_buff *copy; 870 struct sk_buff *copy;
958 struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr; 871 struct uwb_dev_addr *dev_addr = &eda_entry->dev_addr;
959 872
960 d_fnstart(5, dev, "to neighbor %02x:%02x, skb (%p) \n",
961 dev_addr->data[1], dev_addr->data[0], skb);
962 copy = skb_copy(skb, GFP_ATOMIC); 873 copy = skb_copy(skb, GFP_ATOMIC);
963 if (copy == NULL) { 874 if (copy == NULL) {
964 if (printk_ratelimit()) 875 if (printk_ratelimit())
@@ -988,8 +899,6 @@ int wlp_wss_send_copy(struct wlp *wlp, struct wlp_eda_node *eda_entry,
988 dev_kfree_skb_irq(copy);/*we need to free if tx fails */ 899 dev_kfree_skb_irq(copy);/*we need to free if tx fails */
989 } 900 }
990out: 901out:
991 d_fnend(5, dev, "to neighbor %02x:%02x \n", dev_addr->data[1],
992 dev_addr->data[0]);
993 return result; 902 return result;
994} 903}
995 904
@@ -1005,7 +914,7 @@ int wlp_wss_setup(struct net_device *net_dev, struct wlp_wss *wss)
1005 struct wlp *wlp = container_of(wss, struct wlp, wss); 914 struct wlp *wlp = container_of(wss, struct wlp, wss);
1006 struct device *dev = &wlp->rc->uwb_dev.dev; 915 struct device *dev = &wlp->rc->uwb_dev.dev;
1007 int result = 0; 916 int result = 0;
1008 d_fnstart(5, dev, "wss (%p) \n", wss); 917
1009 mutex_lock(&wss->mutex); 918 mutex_lock(&wss->mutex);
1010 wss->kobj.parent = &net_dev->dev.kobj; 919 wss->kobj.parent = &net_dev->dev.kobj;
1011 if (!is_valid_ether_addr(net_dev->dev_addr)) { 920 if (!is_valid_ether_addr(net_dev->dev_addr)) {
@@ -1018,7 +927,6 @@ int wlp_wss_setup(struct net_device *net_dev, struct wlp_wss *wss)
1018 sizeof(wss->virtual_addr.data)); 927 sizeof(wss->virtual_addr.data));
1019out: 928out:
1020 mutex_unlock(&wss->mutex); 929 mutex_unlock(&wss->mutex);
1021 d_fnend(5, dev, "wss (%p) \n", wss);
1022 return result; 930 return result;
1023} 931}
1024EXPORT_SYMBOL_GPL(wlp_wss_setup); 932EXPORT_SYMBOL_GPL(wlp_wss_setup);
@@ -1035,8 +943,7 @@ EXPORT_SYMBOL_GPL(wlp_wss_setup);
1035void wlp_wss_remove(struct wlp_wss *wss) 943void wlp_wss_remove(struct wlp_wss *wss)
1036{ 944{
1037 struct wlp *wlp = container_of(wss, struct wlp, wss); 945 struct wlp *wlp = container_of(wss, struct wlp, wss);
1038 struct device *dev = &wlp->rc->uwb_dev.dev; 946
1039 d_fnstart(5, dev, "wss (%p) \n", wss);
1040 mutex_lock(&wss->mutex); 947 mutex_lock(&wss->mutex);
1041 if (wss->state == WLP_WSS_STATE_ACTIVE) 948 if (wss->state == WLP_WSS_STATE_ACTIVE)
1042 uwb_rc_ie_rm(wlp->rc, UWB_IE_WLP); 949 uwb_rc_ie_rm(wlp->rc, UWB_IE_WLP);
@@ -1050,6 +957,5 @@ void wlp_wss_remove(struct wlp_wss *wss)
1050 wlp_eda_release(&wlp->eda); 957 wlp_eda_release(&wlp->eda);
1051 wlp_eda_init(&wlp->eda); 958 wlp_eda_init(&wlp->eda);
1052 mutex_unlock(&wss->mutex); 959 mutex_unlock(&wss->mutex);
1053 d_fnend(5, dev, "wss (%p) \n", wss);
1054} 960}
1055EXPORT_SYMBOL_GPL(wlp_wss_remove); 961EXPORT_SYMBOL_GPL(wlp_wss_remove);