Skip to content

Commit 8092d7c

Browse files
author
David Vrabel
committed
uwb: don't use printk_ratelimit() so often
Avoid using printk_ratelimit() in many places because: - many were error messages reporting broken hardware (it's useful to get all of these). - the message itself wasn't useful so the message has been removed. Signed-off-by: David Vrabel <david.vrabel@csr.com>
1 parent 92c4d9b commit 8092d7c

8 files changed

Lines changed: 34 additions & 97 deletions

File tree

‎drivers/usb/wusbcore/devconnect.c‎

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -200,21 +200,15 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
200200
u8 dev_addr;
201201
int result;
202202

203-
d_fnstart(3, dev, "(wusbhc %p port_idx %d)\n", wusbhc, port_idx);
204203
/* Is it registered already? */
205204
list_for_each_entry(wusb_dev, &wusbhc->cack_list, cack_node)
206205
if (!memcmp(&wusb_dev->cdid, &dnc->CDID,
207206
sizeof(wusb_dev->cdid)))
208207
return wusb_dev;
209208
/* We don't have it, create an entry, register it */
210209
wusb_dev = wusb_dev_alloc(wusbhc);
211-
if (wusb_dev == NULL) {
212-
if (printk_ratelimit())
213-
dev_err(dev, "DN CONNECT: no memory to process %s's %s "
214-
"request\n", pr_cdid,
215-
new_connection ? "connect" : "reconnect");
210+
if (wusb_dev == NULL)
216211
return NULL;
217-
}
218212
wusb_dev_init(wusb_dev);
219213
wusb_dev->cdid = dnc->CDID;
220214
wusb_dev->port_idx = port_idx;
@@ -246,7 +240,6 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
246240
list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list);
247241
wusbhc->cack_count++;
248242
wusbhc_fill_cack_ie(wusbhc);
249-
d_fnend(3, dev, "(wusbhc %p port_idx %d)\n", wusbhc, port_idx);
250243
return wusb_dev;
251244
}
252245

@@ -334,13 +327,8 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
334327
for (idx = 0; idx < wusbhc->ports_max; idx++) {
335328
port = wusb_port_by_idx(wusbhc, idx);
336329
if (port->wusb_dev
337-
&& !memcmp(&dnc->CDID, &port->wusb_dev->cdid,
338-
sizeof(dnc->CDID))) {
339-
if (printk_ratelimit())
340-
dev_err(dev, "Already handling dev %s "
341-
" (it might be slow)\n", pr_cdid);
330+
&& memcmp(&dnc->CDID, &port->wusb_dev->cdid, sizeof(dnc->CDID)) == 0)
342331
goto error_unlock;
343-
}
344332
}
345333
/* Look up those fake ports we have for a free one */
346334
for (idx = 0; idx < wusbhc->ports_max; idx++) {
@@ -494,15 +482,13 @@ int wusbhc_devconnect_auth(struct wusbhc *wusbhc, u8 port_idx)
494482
*/
495483
static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
496484
{
497-
int result;
498485
struct device *dev = wusbhc->dev;
499486
unsigned cnt;
500487
struct wusb_dev *wusb_dev;
501488
struct wusb_port *wusb_port;
502489
struct wuie_keep_alive *ie = &wusbhc->keep_alive_ie;
503490
unsigned keep_alives, old_keep_alives;
504491

505-
d_fnstart(5, dev, "(wusbhc %p)\n", wusbhc);
506492
old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr);
507493
keep_alives = 0;
508494
for (cnt = 0;
@@ -531,13 +517,10 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
531517
ie->bDeviceAddress[keep_alives++] = 0x7f;
532518
ie->hdr.bLength = sizeof(ie->hdr) +
533519
keep_alives*sizeof(ie->bDeviceAddress[0]);
534-
if (keep_alives > 0) {
535-
result = wusbhc_mmcie_set(wusbhc, 10, 5, &ie->hdr);
536-
if (result < 0 && printk_ratelimit())
537-
dev_err(dev, "KEEPALIVE: can't set MMC: %d\n", result);
538-
} else if (old_keep_alives != 0)
520+
if (keep_alives > 0)
521+
wusbhc_mmcie_set(wusbhc, 10, 5, &ie->hdr);
522+
else if (old_keep_alives != 0)
539523
wusbhc_mmcie_rm(wusbhc, &ie->hdr);
540-
d_fnend(5, dev, "(wusbhc %p) = void\n", wusbhc);
541524
}
542525

543526
/*

‎drivers/usb/wusbcore/mmc.c‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ int wusbhc_mmcie_set(struct wusbhc *wusbhc, u8 interval, u8 repeat_cnt,
9393
struct wuie_hdr *wuie)
9494
{
9595
int result = -ENOBUFS;
96-
struct device *dev = wusbhc->dev;
9796
unsigned handle, itr;
9897

9998
/* Search a handle, taking into account the ordering */
@@ -119,11 +118,8 @@ int wusbhc_mmcie_set(struct wusbhc *wusbhc, u8 interval, u8 repeat_cnt,
119118
if (wusbhc->mmcie[itr] == NULL)
120119
handle = itr;
121120
}
122-
if (handle == ~0) {
123-
if (printk_ratelimit())
124-
dev_err(dev, "MMC handle space exhausted\n");
121+
if (handle == ~0)
125122
goto error_unlock;
126-
}
127123
}
128124
result = (wusbhc->mmcie_add)(wusbhc, interval, repeat_cnt, handle,
129125
wuie);
@@ -143,27 +139,23 @@ EXPORT_SYMBOL_GPL(wusbhc_mmcie_set);
143139
void wusbhc_mmcie_rm(struct wusbhc *wusbhc, struct wuie_hdr *wuie)
144140
{
145141
int result;
146-
struct device *dev = wusbhc->dev;
147142
unsigned handle, itr;
148143

149144
mutex_lock(&wusbhc->mmcie_mutex);
150-
for (itr = 0; itr < wusbhc->mmcies_max; itr++)
145+
for (itr = 0; itr < wusbhc->mmcies_max; itr++) {
151146
if (wusbhc->mmcie[itr] == wuie) {
152147
handle = itr;
153148
goto found;
154149
}
150+
}
155151
mutex_unlock(&wusbhc->mmcie_mutex);
156152
return;
157153

158154
found:
159155
result = (wusbhc->mmcie_rm)(wusbhc, handle);
160156
if (result == 0)
161157
wusbhc->mmcie[itr] = NULL;
162-
else if (printk_ratelimit())
163-
dev_err(dev, "MMC: Failed to remove IE %p (0x%02x)\n",
164-
wuie, wuie->bIEIdentifier);
165158
mutex_unlock(&wusbhc->mmcie_mutex);
166-
return;
167159
}
168160
EXPORT_SYMBOL_GPL(wusbhc_mmcie_rm);
169161

‎drivers/uwb/beacon.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ int uwbd_evt_handle_rc_beacon(struct uwb_event *evt)
410410
struct uwb_rc_evt_beacon *be;
411411
struct uwb_beacon_frame *bf;
412412
struct uwb_beca_e *bce;
413-
struct device *dev = &evt->rc->uwb_dev.dev;
414413
unsigned long last_ts;
415414

416415
rc = evt->rc;
@@ -419,14 +418,12 @@ int uwbd_evt_handle_rc_beacon(struct uwb_event *evt)
419418
if (result < 0)
420419
return result;
421420

422-
/* Ignore beacon if it is from an alien. */
421+
/* FIXME: handle alien beacons. */
423422
if (be->bBeaconType == UWB_RC_BEACON_TYPE_OL_ALIEN ||
424423
be->bBeaconType == UWB_RC_BEACON_TYPE_NOL_ALIEN) {
425-
if (printk_ratelimit())
426-
dev_err(dev, "BEACON received from ALIEN. Action? \n");
427-
result = -ENOSYS;
428-
return 0;
424+
return -ENOSYS;
429425
}
426+
430427
bf = (struct uwb_beacon_frame *) be->BeaconInfo;
431428

432429
/*

‎drivers/uwb/est.c‎

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -363,22 +363,17 @@ ssize_t uwb_est_get_size(struct uwb_rc *uwb_rc, struct uwb_est *est,
363363

364364
size = -ENOENT;
365365
if (event_low >= est->entries) { /* in range? */
366-
if (printk_ratelimit())
367-
dev_err(dev, "EST %p 0x%04x/%04x/%04x[%u]: "
368-
"event %u out of range\n",
369-
est, est->type_event_high, est->vendor,
370-
est->product, est->entries,
371-
event_low);
366+
dev_err(dev, "EST %p 0x%04x/%04x/%04x[%u]: event %u out of range\n",
367+
est, est->type_event_high, est->vendor, est->product,
368+
est->entries, event_low);
372369
goto out;
373370
}
374371
size = -ENOENT;
375372
entry = &est->entry[event_low];
376373
if (entry->size == 0 && entry->offset == 0) { /* unknown? */
377-
if (printk_ratelimit())
378-
dev_err(dev, "EST %p 0x%04x/%04x/%04x[%u]: "
379-
"event %u unknown\n",
380-
est, est->type_event_high, est->vendor,
381-
est->product, est->entries, event_low);
374+
dev_err(dev, "EST %p 0x%04x/%04x/%04x[%u]: event %u unknown\n",
375+
est, est->type_event_high, est->vendor, est->product,
376+
est->entries, event_low);
382377
goto out;
383378
}
384379
offset = entry->offset; /* extra fries with that? */
@@ -396,11 +391,10 @@ ssize_t uwb_est_get_size(struct uwb_rc *uwb_rc, struct uwb_est *est,
396391
default: BUG();
397392
}
398393
if (offset + type_size > rceb_size) {
399-
if (printk_ratelimit())
400-
dev_err(dev, "EST %p 0x%04x/%04x/%04x[%u]: "
401-
"not enough data to read extra size\n",
402-
est, est->type_event_high, est->vendor,
403-
est->product, est->entries);
394+
dev_err(dev, "EST %p 0x%04x/%04x/%04x[%u]: "
395+
"not enough data to read extra size\n",
396+
est, est->type_event_high, est->vendor,
397+
est->product, est->entries);
404398
goto out;
405399
}
406400
size = entry->size;
@@ -469,14 +463,12 @@ ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb,
469463
if (size != -ENOENT)
470464
goto out;
471465
}
472-
/* FIXME: downgrade to _dbg() */
473-
if (printk_ratelimit())
474-
dev_err(dev, "event 0x%02x/%04x/%02x: no handlers available; "
466+
dev_dbg(dev, "event 0x%02x/%04x/%02x: no handlers available; "
475467
"RCEB %02x %02x %02x %02x\n",
476-
(unsigned) rceb->bEventType,
477-
(unsigned) le16_to_cpu(rceb->wEvent),
478-
(unsigned) rceb->bEventContext,
479-
ptr[0], ptr[1], ptr[2], ptr[3]);
468+
(unsigned) rceb->bEventType,
469+
(unsigned) le16_to_cpu(rceb->wEvent),
470+
(unsigned) rceb->bEventContext,
471+
ptr[0], ptr[1], ptr[2], ptr[3]);
480472
size = -ENOENT;
481473
out:
482474
read_unlock_irqrestore(&uwb_est_lock, flags);

‎drivers/uwb/i1480/dfu/mac.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ int i1480_cmd_reset(struct i1480 *i1480)
425425
}
426426

427427

428-
/** Wait for the MAC FW to start running */
428+
/* Wait for the MAC FW to start running */
429429
static
430430
int i1480_fw_is_running_q(struct i1480 *i1480)
431431
{
@@ -443,8 +443,6 @@ int i1480_fw_is_running_q(struct i1480 *i1480)
443443
}
444444
if (*val == 0x55555555UL) /* fw running? cool */
445445
goto out;
446-
if (printk_ratelimit())
447-
d_printf(5, i1480->dev, "read #%d: 0x%08x\n", cnt, *val);
448446
}
449447
dev_err(i1480->dev, "Timed out waiting for fw to start\n");
450448
result = -ETIMEDOUT;

‎drivers/uwb/neh.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
440440
neh = uwb_rc_neh_lookup(rc, rceb);
441441
if (neh)
442442
uwb_rc_neh_cb(neh, rceb, size);
443-
else if (printk_ratelimit())
443+
else
444444
dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n",
445445
rceb->bEventType, le16_to_cpu(rceb->wEvent),
446446
rceb->bEventContext, size);

‎drivers/uwb/uwbd.c‎

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ static DEFINE_MUTEX(uwbd_event_mutex);
188188
static
189189
int uwbd_event_handle_urc(struct uwb_event *evt)
190190
{
191-
int result;
192191
struct uwbd_evt_type_handler *type_table;
193192
uwbd_evt_handler_f handler;
194193
u8 type, context;
@@ -199,41 +198,25 @@ int uwbd_event_handle_urc(struct uwb_event *evt)
199198
context = evt->notif.rceb->bEventContext;
200199

201200
if (type > uwbd_evt_type_handlers_len) {
202-
if (printk_ratelimit())
203-
printk(KERN_ERR "UWBD: event type %u: unknown "
204-
"(too high)\n", type);
201+
printk(KERN_ERR "UWBD: event type %u: unknown (too high)\n", type);
205202
return -EINVAL;
206203
}
207204
type_table = &uwbd_evt_type_handlers[type];
208205
if (type_table->uwbd_events == NULL) {
209-
if (printk_ratelimit())
210-
printk(KERN_ERR "UWBD: event type %u: unknown\n", type);
206+
printk(KERN_ERR "UWBD: event type %u: unknown\n", type);
211207
return -EINVAL;
212208
}
213209
if (event > type_table->size) {
214-
if (printk_ratelimit())
215-
printk(KERN_ERR "UWBD: event %s[%u]: "
216-
"unknown (too high)\n", type_table->name, event);
210+
printk(KERN_ERR "UWBD: event %s[%u]: unknown (too high)\n",
211+
type_table->name, event);
217212
return -EINVAL;
218213
}
219214
handler = type_table->uwbd_events[event].handler;
220215
if (handler == NULL) {
221-
if (printk_ratelimit())
222-
printk(KERN_ERR "UWBD: event %s[%u]: unknown\n",
223-
type_table->name, event);
216+
printk(KERN_ERR "UWBD: event %s[%u]: unknown\n", type_table->name, event);
224217
return -EINVAL;
225218
}
226-
d_printf(3, NULL, "processing 0x%02x/%04x/%02x, %zu bytes\n",
227-
type, event, context, evt->notif.size);
228-
result = (*handler)(evt);
229-
if (result < 0) {
230-
if (printk_ratelimit())
231-
printk(KERN_ERR "UWBD: event 0x%02x/%04x/%02x, "
232-
"table %s[%u]: handling failed: %d\n",
233-
type, event, context, type_table->name,
234-
event, result);
235-
}
236-
return result;
219+
return (*handler)(evt);
237220
}
238221

239222
static void uwbd_event_handle_message(struct uwb_event *evt)

‎drivers/uwb/whc-rc.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ irqreturn_t whcrc_irq_cb(int irq, void *_whcrc)
212212
struct device *dev = &whcrc->umc_dev->dev;
213213
u32 urcsts;
214214

215-
d_fnstart(4, dev, "irq %d _whcrc %p)\n", irq, _whcrc);
216215
urcsts = le_readl(whcrc->rc_base + URCSTS);
217216
if (!(urcsts & URCSTS_INT_MASK))
218217
return IRQ_NONE;
@@ -221,13 +220,6 @@ irqreturn_t whcrc_irq_cb(int irq, void *_whcrc)
221220
d_printf(4, dev, "acked 0x%08x, urcsts 0x%08x\n",
222221
le_readl(whcrc->rc_base + URCSTS), urcsts);
223222

224-
if (whcrc->uwb_rc == NULL) {
225-
if (printk_ratelimit())
226-
dev_dbg(dev, "Received interrupt when not yet "
227-
"ready!\n");
228-
goto out;
229-
}
230-
231223
if (urcsts & URCSTS_HSE) {
232224
dev_err(dev, "host system error -- hardware halted\n");
233225
/* FIXME: do something sensible here */

0 commit comments

Comments
 (0)