From: Randy Dunlap Date: Mon, 1 Aug 2005 03:41:19 +0000 (-0700) Subject: [PATCH] USB usblp: rate-limit printer status error messages X-Git-Tag: v2.6.14-rc1~492^2~18^2~42 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bc8e009a2d5106183ea31a2b83035e790778cab;p=linux-2.6 [PATCH] USB usblp: rate-limit printer status error messages Rate-limit usblp printer error status messages. I unplugged my USB printer and almost instantly got several hundred of these in my kernel message log: drivers/usb/class/usblp.c: usblp0: error -19 reading printer status Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 7ce43fb811..e195709c9c 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -310,8 +310,9 @@ static int usblp_check_status(struct usblp *usblp, int err) error = usblp_read_status (usblp, usblp->statusbuf); if (error < 0) { - err("usblp%d: error %d reading printer status", - usblp->minor, error); + if (printk_ratelimit()) + err("usblp%d: error %d reading printer status", + usblp->minor, error); return 0; } @@ -604,7 +605,9 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case LPGETSTATUS: if (usblp_read_status(usblp, usblp->statusbuf)) { - err("usblp%d: failed reading printer status", usblp->minor); + if (printk_ratelimit()) + err("usblp%d: failed reading printer status", + usblp->minor); retval = -EIO; goto done; }