aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:22:50 -0500
committerDavid Vrabel <david.vrabel@csr.com>2008-12-22 13:22:50 -0500
commitbce83697c5fe84a7a5d38c96fbbe43b4bc028c3e (patch)
treeb8e920af66f5b4de509e95a7295cedbe42878dd6 /drivers/usb
parent02f11ee181baa562df23e105ba930902f0d0b1bf (diff)
uwb: use dev_dbg() for debug messages
Instead of the home-grown d_fnstart(), d_fnend() and d_printf() macros, use dev_dbg() or remove the message entirely. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/usb')
-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
8 files changed, 103 insertions, 477 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}