[PATCH] USB usblp: rate-limit printer status error messages
authorRandy Dunlap <rdunlap@xenotime.net>
Mon, 1 Aug 2005 03:41:19 +0000 (20:41 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 8 Sep 2005 23:22:40 +0000 (16:22 -0700)
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 <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/class/usblp.c

index 7ce43fb8118a3b79e969711606390bdaafee96e5..e195709c9c7fabe8b2019032ab872cc69d45d81a 100644 (file)
@@ -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;
                                }