aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/imon.c
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2011-07-14 13:20:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-08-06 09:46:45 -0400
commit47a09b082f70502195ee800bb0cd6f311b125c8f (patch)
tree8666be9f9e4bf1b8b1ecf7c7c3d280755aa0ed88 /drivers/media/rc/imon.c
parentd59a7b1dbce8b972ec2dc9fcaaae0bfa23687423 (diff)
[media] imon: rate-limit send_packet spew
There are folks with flaky imon hardware out there that doesn't always respond to requests to write to their displays for some reason, which can flood logs quickly when something like lcdproc is trying to constantly update the display, so lets rate-limit all that error spew. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/imon.c')
-rw-r--r--drivers/media/rc/imon.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 6bc35eeb653b..caa3e3ac41cb 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -34,6 +34,7 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/uaccess.h> 36#include <linux/uaccess.h>
37#include <linux/ratelimit.h>
37 38
38#include <linux/input.h> 39#include <linux/input.h>
39#include <linux/usb.h> 40#include <linux/usb.h>
@@ -516,19 +517,19 @@ static int send_packet(struct imon_context *ictx)
516 if (retval) { 517 if (retval) {
517 ictx->tx.busy = false; 518 ictx->tx.busy = false;
518 smp_rmb(); /* ensure later readers know we're not busy */ 519 smp_rmb(); /* ensure later readers know we're not busy */
519 pr_err("error submitting urb(%d)\n", retval); 520 pr_err_ratelimited("error submitting urb(%d)\n", retval);
520 } else { 521 } else {
521 /* Wait for transmission to complete (or abort) */ 522 /* Wait for transmission to complete (or abort) */
522 mutex_unlock(&ictx->lock); 523 mutex_unlock(&ictx->lock);
523 retval = wait_for_completion_interruptible( 524 retval = wait_for_completion_interruptible(
524 &ictx->tx.finished); 525 &ictx->tx.finished);
525 if (retval) 526 if (retval)
526 pr_err("task interrupted\n"); 527 pr_err_ratelimited("task interrupted\n");
527 mutex_lock(&ictx->lock); 528 mutex_lock(&ictx->lock);
528 529
529 retval = ictx->tx.status; 530 retval = ictx->tx.status;
530 if (retval) 531 if (retval)
531 pr_err("packet tx failed (%d)\n", retval); 532 pr_err_ratelimited("packet tx failed (%d)\n", retval);
532 } 533 }
533 534
534 kfree(control_req); 535 kfree(control_req);
@@ -830,20 +831,20 @@ static ssize_t vfd_write(struct file *file, const char *buf,
830 831
831 ictx = file->private_data; 832 ictx = file->private_data;
832 if (!ictx) { 833 if (!ictx) {
833 pr_err("no context for device\n"); 834 pr_err_ratelimited("no context for device\n");
834 return -ENODEV; 835 return -ENODEV;
835 } 836 }
836 837
837 mutex_lock(&ictx->lock); 838 mutex_lock(&ictx->lock);
838 839
839 if (!ictx->dev_present_intf0) { 840 if (!ictx->dev_present_intf0) {
840 pr_err("no iMON device present\n"); 841 pr_err_ratelimited("no iMON device present\n");
841 retval = -ENODEV; 842 retval = -ENODEV;
842 goto exit; 843 goto exit;
843 } 844 }
844 845
845 if (n_bytes <= 0 || n_bytes > 32) { 846 if (n_bytes <= 0 || n_bytes > 32) {
846 pr_err("invalid payload size\n"); 847 pr_err_ratelimited("invalid payload size\n");
847 retval = -EINVAL; 848 retval = -EINVAL;
848 goto exit; 849 goto exit;
849 } 850 }
@@ -869,7 +870,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
869 870
870 retval = send_packet(ictx); 871 retval = send_packet(ictx);
871 if (retval) { 872 if (retval) {
872 pr_err("send packet failed for packet #%d\n", seq / 2); 873 pr_err_ratelimited("send packet #%d failed\n", seq / 2);
873 goto exit; 874 goto exit;
874 } else { 875 } else {
875 seq += 2; 876 seq += 2;
@@ -883,7 +884,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
883 ictx->usb_tx_buf[7] = (unsigned char) seq; 884 ictx->usb_tx_buf[7] = (unsigned char) seq;
884 retval = send_packet(ictx); 885 retval = send_packet(ictx);
885 if (retval) 886 if (retval)
886 pr_err("send packet failed for packet #%d\n", seq / 2); 887 pr_err_ratelimited("send packet #%d failed\n", seq / 2);
887 888
888exit: 889exit:
889 mutex_unlock(&ictx->lock); 890 mutex_unlock(&ictx->lock);
@@ -912,20 +913,21 @@ static ssize_t lcd_write(struct file *file, const char *buf,
912 913
913 ictx = file->private_data; 914 ictx = file->private_data;
914 if (!ictx) { 915 if (!ictx) {
915 pr_err("no context for device\n"); 916 pr_err_ratelimited("no context for device\n");
916 return -ENODEV; 917 return -ENODEV;
917 } 918 }
918 919
919 mutex_lock(&ictx->lock); 920 mutex_lock(&ictx->lock);
920 921
921 if (!ictx->display_supported) { 922 if (!ictx->display_supported) {
922 pr_err("no iMON display present\n"); 923 pr_err_ratelimited("no iMON display present\n");
923 retval = -ENODEV; 924 retval = -ENODEV;
924 goto exit; 925 goto exit;
925 } 926 }
926 927
927 if (n_bytes != 8) { 928 if (n_bytes != 8) {
928 pr_err("invalid payload size: %d (expected 8)\n", (int)n_bytes); 929 pr_err_ratelimited("invalid payload size: %d (expected 8)\n",
930 (int)n_bytes);
929 retval = -EINVAL; 931 retval = -EINVAL;
930 goto exit; 932 goto exit;
931 } 933 }
@@ -937,7 +939,7 @@ static ssize_t lcd_write(struct file *file, const char *buf,
937 939
938 retval = send_packet(ictx); 940 retval = send_packet(ictx);
939 if (retval) { 941 if (retval) {
940 pr_err("send packet failed!\n"); 942 pr_err_ratelimited("send packet failed!\n");
941 goto exit; 943 goto exit;
942 } else { 944 } else {
943 dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n", 945 dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n",