提交 0bc8e009 编写于 作者: R Randy Dunlap 提交者: Greg Kroah-Hartman

[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: NRandy Dunlap <rdunlap@xenotime.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 a1cf96ef
...@@ -310,8 +310,9 @@ static int usblp_check_status(struct usblp *usblp, int err) ...@@ -310,8 +310,9 @@ static int usblp_check_status(struct usblp *usblp, int err)
error = usblp_read_status (usblp, usblp->statusbuf); error = usblp_read_status (usblp, usblp->statusbuf);
if (error < 0) { if (error < 0) {
err("usblp%d: error %d reading printer status", if (printk_ratelimit())
usblp->minor, error); err("usblp%d: error %d reading printer status",
usblp->minor, error);
return 0; return 0;
} }
...@@ -604,7 +605,9 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -604,7 +605,9 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case LPGETSTATUS: case LPGETSTATUS:
if (usblp_read_status(usblp, usblp->statusbuf)) { 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; retval = -EIO;
goto done; goto done;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册