From 342a437ef625953e8bdeee3bc1605ccd27a38863 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 29 May 2009 22:13:58 -0700 Subject: [PATCH] usbnet: ratelimit warning messages invoked from callback handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Warning messages coming from rtl8150 driver can flood the console and make a DTV/set-top-box unable to decode video/audio frames. 'Pegasus' driver handles this situation similarly, preventing this from happening there. It happens with a low cost BCM MIPS embedded platform, whenever timeout errors were coming from usbnet device, making platform unusable for viewer watching. Signed-off-by: André Goddard Rosa Signed-off-by: David S. Miller --- drivers/net/usb/rtl8150.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index f9fb454ffa8..fcc6fa0905d 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c @@ -221,7 +221,8 @@ static void ctrl_callback(struct urb *urb) case -ENOENT: break; default: - dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status); + if (printk_ratelimit()) + dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status); } dev = urb->context; clear_bit(RX_REG_SET, &dev->flags); @@ -442,10 +443,12 @@ static void read_bulk_callback(struct urb *urb) case -ENOENT: return; /* the urb is in unlink state */ case -ETIME: - dev_warn(&urb->dev->dev, "may be reset is needed?..\n"); + if (printk_ratelimit()) + dev_warn(&urb->dev->dev, "may be reset is needed?..\n"); goto goon; default: - dev_warn(&urb->dev->dev, "Rx status %d\n", status); + if (printk_ratelimit()) + dev_warn(&urb->dev->dev, "Rx status %d\n", status); goto goon; } -- 2.20.1