Skip to content

Commit

Permalink
[PATCH] USB usblp: rate-limit printer status error messages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Randy Dunlap authored and Greg Kroah-Hartman committed Sep 8, 2005
1 parent a1cf96e commit 0bc8e00
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/usb/class/usblp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0bc8e00

Please sign in to comment.