Skip to content

Commit 0a6ad06

Browse files
rtg-canonicaldtor
authored andcommitted
Input: cm109 - convert high volume dev_err() to dev_err_ratelimited()
BugLink: http://bugs.launchpad.net/bugs/1222850 This input device can get into a state that produces a high volume of device status errors. Attempt to throttle these error messages such that the kernel log is not flooded. Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent a60a71b commit 0a6ad06

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎drivers/input/misc/cm109.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ static void cm109_urb_irq_callback(struct urb *urb)
351351
if (status) {
352352
if (status == -ESHUTDOWN)
353353
return;
354-
dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status);
354+
dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
355+
__func__, status);
356+
goto out;
355357
}
356358

357359
/* Special keys */
@@ -418,16 +420,20 @@ static void cm109_urb_ctl_callback(struct urb *urb)
418420
dev->ctl_data->byte[2],
419421
dev->ctl_data->byte[3]);
420422

421-
if (status)
422-
dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status);
423+
if (status) {
424+
if (status == -ESHUTDOWN)
425+
return;
426+
dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
427+
__func__, status);
428+
}
423429

424430
spin_lock(&dev->ctl_submit_lock);
425431

426432
dev->ctl_urb_pending = 0;
427433

428434
if (likely(!dev->shutdown)) {
429435

430-
if (dev->buzzer_pending) {
436+
if (dev->buzzer_pending || status) {
431437
dev->buzzer_pending = 0;
432438
dev->ctl_urb_pending = 1;
433439
cm109_submit_buzz_toggle(dev);

0 commit comments

Comments
 (0)