[PATCH] usb: don't spit out too much errors with suspended devices

From: Colin Leroy
Date: Wed Oct 27 2004 - 02:22:14 EST


On 26 Oct 2004 at 09h10, David Brownell wrote:

Hi,

> What's wrong there is emitting voluminous diagnostics for
> something that's not an error ... the root hub is suspended,
> and as with any suspended device, you can't talk to it.
> The descriptor read logic can skip retries in that case, and
> usbfs should refuse up front to talk to suspended devices.
> (Silently!)

Here's a patch that does it. Hope it's fine.

Signed-off-by: Colin Leroy <colin@xxxxxxxxxx>

--- a/drivers/usb/core/message.c 2004-10-27 09:09:34.332120419 +0200
+++ b/drivers/usb/core/message.c 2004-10-27 09:15:05.323320163 +0200
@@ -703,6 +705,8 @@
int err;
unsigned int u, idx;

+ if (dev->state == USB_STATE_SUSPENDED)
+ return -EHOSTUNREACH;
if (size <= 0 || !buf || !index)
return -EINVAL;
buf[0] = 0;
--- a/drivers/usb/core/devio.c 2004-10-27 09:08:45.401856241 +0200
+++ b/drivers/usb/core/devio.c 2004-10-27 09:16:09.079846340 +0200
@@ -541,6 +541,8 @@
unsigned char *tbuf;
int i, j, ret;

+ if (dev->state == USB_STATE_SUSPENDED)
+ return -EHOSTUNREACH;
if (copy_from_user(&ctrl, arg, sizeof(ctrl)))
return -EFAULT;
if ((ret = check_ctrlrecip(ps, ctrl.bRequestType, ctrl.wIndex)))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/