Skip to content

Commit bce8369

Browse files
author
David Vrabel
committed
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>
1 parent 02f11ee commit bce8369

28 files changed

Lines changed: 220 additions & 1168 deletions

‎drivers/usb/host/hwa-hc.c‎

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,12 @@
6262
#include "../wusbcore/wa-hc.h"
6363
#include "../wusbcore/wusbhc.h"
6464

65-
#define D_LOCAL 0
66-
#include <linux/uwb/debug.h>
67-
6865
struct hwahc {
6966
struct wusbhc wusbhc; /* has to be 1st */
7067
struct wahc wa;
71-
u8 buffer[16]; /* for misc usb transactions */
7268
};
7369

74-
/**
70+
/*
7571
* FIXME should be wusbhc
7672
*
7773
* NOTE: we need to cache the Cluster ID because later...there is no
@@ -125,23 +121,20 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
125121
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
126122
struct device *dev = &hwahc->wa.usb_iface->dev;
127123

128-
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
129124
mutex_lock(&wusbhc->mutex);
130125
wa_nep_disarm(&hwahc->wa);
131126
result = __wa_set_feature(&hwahc->wa, WA_RESET);
132127
if (result < 0) {
133128
dev_err(dev, "error commanding HC to reset: %d\n", result);
134129
goto error_unlock;
135130
}
136-
d_printf(3, dev, "reset: waiting for device to change state\n");
137131
result = __wa_wait_status(&hwahc->wa, WA_STATUS_RESETTING, 0);
138132
if (result < 0) {
139133
dev_err(dev, "error waiting for HC to reset: %d\n", result);
140134
goto error_unlock;
141135
}
142136
error_unlock:
143137
mutex_unlock(&wusbhc->mutex);
144-
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
145138
return result;
146139
}
147140

@@ -154,15 +147,9 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
154147
int result;
155148
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
156149
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
157-
struct device *dev = &hwahc->wa.usb_iface->dev;
158150

159-
/* Set up a Host Info WUSB Information Element */
160-
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
161151
result = -ENOSPC;
162152
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# */
166153
addr = wusb_cluster_id_get();
167154
if (addr == 0)
168155
goto error_cluster_id_get;
@@ -176,7 +163,6 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
176163
result = 0;
177164
out:
178165
mutex_unlock(&wusbhc->mutex);
179-
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
180166
return result;
181167

182168
error_set_cluster_id:
@@ -213,18 +199,11 @@ static int hwahc_op_resume(struct usb_hcd *usb_hcd)
213199
*/
214200
static void hwahc_op_stop(struct usb_hcd *usb_hcd)
215201
{
216-
int result;
217202
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;
221203

222-
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
223204
mutex_lock(&wusbhc->mutex);
224205
wusb_cluster_id_put(wusbhc->cluster_id);
225206
mutex_unlock(&wusbhc->mutex);
226-
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
227-
return;
228207
}
229208

230209
static int hwahc_op_get_frame_number(struct usb_hcd *usb_hcd)
@@ -573,11 +552,11 @@ static int wa_fill_descr(struct wahc *wa)
573552
itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
574553
while (itr_size >= sizeof(*hdr)) {
575554
hdr = (struct usb_descriptor_header *) itr;
576-
d_printf(3, dev, "Extra device descriptor: "
577-
"type %02x/%u bytes @ %zu (%zu left)\n",
578-
hdr->bDescriptorType, hdr->bLength,
579-
(itr - usb_dev->rawdescriptors[actconfig_idx]),
580-
itr_size);
555+
dev_dbg(dev, "Extra device descriptor: "
556+
"type %02x/%u bytes @ %zu (%zu left)\n",
557+
hdr->bDescriptorType, hdr->bLength,
558+
(itr - usb_dev->rawdescriptors[actconfig_idx]),
559+
itr_size);
581560
if (hdr->bDescriptorType == USB_DT_WIRE_ADAPTER)
582561
goto found;
583562
itr += hdr->bLength;
@@ -786,7 +765,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
786765
{
787766
struct wusbhc *wusbhc = &hwahc->wusbhc;
788767

789-
d_fnstart(1, NULL, "(hwahc %p)\n", hwahc);
790768
mutex_lock(&wusbhc->mutex);
791769
__wa_destroy(&hwahc->wa);
792770
wusbhc_destroy(&hwahc->wusbhc);
@@ -796,7 +774,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
796774
usb_put_intf(hwahc->wa.usb_iface);
797775
usb_put_dev(hwahc->wa.usb_dev);
798776
mutex_unlock(&wusbhc->mutex);
799-
d_fnend(1, NULL, "(hwahc %p) = void\n", hwahc);
800777
}
801778

802779
static void hwahc_init(struct hwahc *hwahc)
@@ -813,7 +790,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
813790
struct hwahc *hwahc;
814791
struct device *dev = &usb_iface->dev;
815792

816-
d_fnstart(4, dev, "(%p, %p)\n", usb_iface, id);
817793
result = -ENOMEM;
818794
usb_hcd = usb_create_hcd(&hwahc_hc_driver, &usb_iface->dev, "wusb-hwa");
819795
if (usb_hcd == NULL) {
@@ -840,7 +816,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
840816
dev_err(dev, "Cannot setup phase B of WUSBHC: %d\n", result);
841817
goto error_wusbhc_b_create;
842818
}
843-
d_fnend(4, dev, "(%p, %p) = 0\n", usb_iface, id);
844819
return 0;
845820

846821
error_wusbhc_b_create:
@@ -850,7 +825,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
850825
error_hwahc_create:
851826
usb_put_hcd(usb_hcd);
852827
error_alloc:
853-
d_fnend(4, dev, "(%p, %p) = %d\n", usb_iface, id, result);
854828
return result;
855829
}
856830

@@ -864,16 +838,12 @@ static void hwahc_disconnect(struct usb_interface *usb_iface)
864838
wusbhc = usb_hcd_to_wusbhc(usb_hcd);
865839
hwahc = container_of(wusbhc, struct hwahc, wusbhc);
866840

867-
d_fnstart(1, NULL, "(hwahc %p [usb_iface %p])\n", hwahc, usb_iface);
868841
wusbhc_b_destroy(&hwahc->wusbhc);
869842
usb_remove_hcd(usb_hcd);
870843
hwahc_destroy(hwahc);
871844
usb_put_hcd(usb_hcd);
872-
d_fnend(1, NULL, "(hwahc %p [usb_iface %p]) = void\n", hwahc,
873-
usb_iface);
874845
}
875846

876-
/** USB device ID's that we handle */
877847
static struct usb_device_id hwahc_id_table[] = {
878848
/* FIXME: use class labels for this */
879849
{ USB_INTERFACE_INFO(0xe0, 0x02, 0x01), },
@@ -890,18 +860,7 @@ static struct usb_driver hwahc_driver = {
890860

891861
static int __init hwahc_driver_init(void)
892862
{
893-
int result;
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-
902-
error_usb_register:
903-
return result;
904-
863+
return usb_register(&hwahc_driver);
905864
}
906865
module_init(hwahc_driver_init);
907866

‎drivers/usb/wusbcore/crypto.c‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#include <linux/uwb.h>
5252
#include <linux/usb/wusb.h>
5353
#include <linux/scatterlist.h>
54-
#define D_LOCAL 0
5554
#include <linux/uwb/debug.h>
5655

5756
static int debug_crypto_verify = 0;
@@ -207,9 +206,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
207206
const u8 bzero[16] = { 0 };
208207
size_t zero_padding;
209208

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);
213209
/*
214210
* These checks should be compile time optimized out
215211
* ensure @a fills b1's mac_header and following fields
@@ -251,16 +247,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
251247
b1.la = cpu_to_be16(blen + 14);
252248
memcpy(&b1.mac_header, a, sizeof(*a));
253249

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-
264250
sg_init_table(sg, ARRAY_SIZE(sg));
265251
sg_set_buf(&sg[0], &b0, sizeof(b0));
266252
sg_set_buf(&sg[1], &b1, sizeof(b1));
@@ -277,8 +263,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
277263
result);
278264
goto error_cbc_crypt;
279265
}
280-
d_printf(4, NULL, "D: MIC tag\n");
281-
d_dump(4, NULL, iv, ivsize);
282266

283267
/* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5]
284268
* 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,
293277
ax.counter = 0;
294278
crypto_cipher_encrypt_one(tfm_aes, (void *)&ax, (void *)&ax);
295279
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);
300280
result = 8;
301281
error_cbc_crypt:
302282
kfree(dst_buf);
303283
error_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);
307284
return result;
308285
}
309286

@@ -325,10 +302,6 @@ ssize_t wusb_prf(void *out, size_t out_size,
325302
u64 sfn = 0;
326303
__le64 sfn_le;
327304

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-
332305
tfm_cbc = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
333306
if (IS_ERR(tfm_cbc)) {
334307
result = PTR_ERR(tfm_cbc);
@@ -370,9 +343,6 @@ ssize_t wusb_prf(void *out, size_t out_size,
370343
error_setkey_cbc:
371344
crypto_free_blkcipher(tfm_cbc);
372345
error_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);
376346
return result;
377347
}
378348

‎drivers/usb/wusbcore/dev-sysfs.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
#include <linux/workqueue.h>
2929
#include "wusbhc.h"
3030

31-
#undef D_LOCAL
32-
#define D_LOCAL 4
33-
#include <linux/uwb/debug.h>
34-
3531
static ssize_t wusb_disconnect_store(struct device *dev,
3632
struct device_attribute *attr,
3733
const char *buf, size_t size)

0 commit comments

Comments
 (0)