Subject: USB usblp: rate-limit printer status error messages

From: "Randy.Dunlap" <[email-masked]>
Date: Sun, 31 Jul 2005 20:41:19 -0700

From: Randy Dunlap <[email-masked]>

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 <[email-masked]>
Signed-off-by: Greg Kroah-Hartman <[email-masked]>

---
 drivers/usb/class/usblp.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

--- gregkh-2.6.orig/drivers/usb/class/usblp.c	2005-08-08 09:58:27.000000000 -0700
+++ gregkh-2.6/drivers/usb/class/usblp.c	2005-08-08 15:53:40.000000000 -0700
@@ -310,8 +310,9 @@
 
 	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 @@
 
 			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;
 				}