From patchwork Thu Jul 14 17:20:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 7440 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Thu, 14 Jul 2011 17:20:53 +0000 Received: from casper.infradead.org [85.118.1.10] by localhost.localdomain with IMAP (fetchmail-6.3.17) for (single-drop); Thu, 14 Jul 2011 14:21:20 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QhPam-0004hO-Qd; Thu, 14 Jul 2011 17:20:53 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932189Ab1GNRUu (ORCPT + 1 other); Thu, 14 Jul 2011 13:20:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19627 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932134Ab1GNRUt (ORCPT ); Thu, 14 Jul 2011 13:20:49 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6EHKnCI023444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Jul 2011 13:20:49 -0400 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6EHKnLP019066; Thu, 14 Jul 2011 13:20:49 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: Jarod Wilson Subject: [PATCH v2] [media] imon: rate-limit send_packet spew Date: Thu, 14 Jul 2011 13:20:46 -0400 Message-Id: <1310664046-29073-1-git-send-email-jarod@redhat.com> In-Reply-To: <1310594321-12921-1-git-send-email-jarod@redhat.com> References: <1310594321-12921-1-git-send-email-jarod@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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. v2: add missing ratelimit.h include Signed-off-by: Jarod Wilson --- drivers/media/rc/imon.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 6bc35ee..caa3e3a 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -516,19 +517,19 @@ static int send_packet(struct imon_context *ictx) if (retval) { ictx->tx.busy = false; smp_rmb(); /* ensure later readers know we're not busy */ - pr_err("error submitting urb(%d)\n", retval); + pr_err_ratelimited("error submitting urb(%d)\n", retval); } else { /* Wait for transmission to complete (or abort) */ mutex_unlock(&ictx->lock); retval = wait_for_completion_interruptible( &ictx->tx.finished); if (retval) - pr_err("task interrupted\n"); + pr_err_ratelimited("task interrupted\n"); mutex_lock(&ictx->lock); retval = ictx->tx.status; if (retval) - pr_err("packet tx failed (%d)\n", retval); + pr_err_ratelimited("packet tx failed (%d)\n", retval); } kfree(control_req); @@ -830,20 +831,20 @@ static ssize_t vfd_write(struct file *file, const char *buf, ictx = file->private_data; if (!ictx) { - pr_err("no context for device\n"); + pr_err_ratelimited("no context for device\n"); return -ENODEV; } mutex_lock(&ictx->lock); if (!ictx->dev_present_intf0) { - pr_err("no iMON device present\n"); + pr_err_ratelimited("no iMON device present\n"); retval = -ENODEV; goto exit; } if (n_bytes <= 0 || n_bytes > 32) { - pr_err("invalid payload size\n"); + pr_err_ratelimited("invalid payload size\n"); retval = -EINVAL; goto exit; } @@ -869,7 +870,7 @@ static ssize_t vfd_write(struct file *file, const char *buf, retval = send_packet(ictx); if (retval) { - pr_err("send packet failed for packet #%d\n", seq / 2); + pr_err_ratelimited("send packet #%d failed\n", seq / 2); goto exit; } else { seq += 2; @@ -883,7 +884,7 @@ static ssize_t vfd_write(struct file *file, const char *buf, ictx->usb_tx_buf[7] = (unsigned char) seq; retval = send_packet(ictx); if (retval) - pr_err("send packet failed for packet #%d\n", seq / 2); + pr_err_ratelimited("send packet #%d failed\n", seq / 2); exit: mutex_unlock(&ictx->lock); @@ -912,20 +913,21 @@ static ssize_t lcd_write(struct file *file, const char *buf, ictx = file->private_data; if (!ictx) { - pr_err("no context for device\n"); + pr_err_ratelimited("no context for device\n"); return -ENODEV; } mutex_lock(&ictx->lock); if (!ictx->display_supported) { - pr_err("no iMON display present\n"); + pr_err_ratelimited("no iMON display present\n"); retval = -ENODEV; goto exit; } if (n_bytes != 8) { - pr_err("invalid payload size: %d (expected 8)\n", (int)n_bytes); + pr_err_ratelimited("invalid payload size: %d (expected 8)\n", + (int)n_bytes); retval = -EINVAL; goto exit; } @@ -937,7 +939,7 @@ static ssize_t lcd_write(struct file *file, const char *buf, retval = send_packet(ictx); if (retval) { - pr_err("send packet failed!\n"); + pr_err_ratelimited("send packet failed!\n"); goto exit; } else { dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n",