Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tim Gardner and committed by
Dmitry Torokhov
0a6ad06c a60a71b0

+10 -4
+10 -4
drivers/input/misc/cm109.c
··· 351 351 if (status) { 352 352 if (status == -ESHUTDOWN) 353 353 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; 355 357 } 356 358 357 359 /* Special keys */ ··· 420 418 dev->ctl_data->byte[2], 421 419 dev->ctl_data->byte[3]); 422 420 423 - if (status) 424 - dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); 421 + if (status) { 422 + if (status == -ESHUTDOWN) 423 + return; 424 + dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n", 425 + __func__, status); 426 + } 425 427 426 428 spin_lock(&dev->ctl_submit_lock); 427 429 ··· 433 427 434 428 if (likely(!dev->shutdown)) { 435 429 436 - if (dev->buzzer_pending) { 430 + if (dev->buzzer_pending || status) { 437 431 dev->buzzer_pending = 0; 438 432 dev->ctl_urb_pending = 1; 439 433 cm109_submit_buzz_toggle(dev);