Messages in this thread Patch in this message | | | From | David Brownell <> | Subject | Re: [PATCH] usb: don't spit out too much errors with suspended devices | Date | Wed, 27 Oct 2004 16:13:56 -0700 |
| |
On Wednesday 27 October 2004 00:19, Colin Leroy wrote: > 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.
The "message.c" part is fine, but the usbfs/devio change only tests one of several paths for device access. (My first whack at this only covered a different one!) Can you verify this one instead?
- Dave
--- 1.67/drivers/usb/core/message.c Tue Oct 26 09:42:33 2004 +++ edited/drivers/usb/core/message.c Wed Oct 27 16:02:03 2004 @@ -704,6 +704,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; --- 1.67/drivers/usb/core/devio.c Wed Oct 20 11:45:30 2004 +++ edited/drivers/usb/core/devio.c Wed Oct 27 16:07:40 2004 @@ -411,6 +411,8 @@ static int checkintf(struct dev_state *ps, unsigned int ifnum) { + if (ps->dev->state != USB_STATE_CONFIGURED) + return -EHOSTUNREACH; if (ifnum >= 8*sizeof(ps->ifclaimed)) return -EINVAL; if (test_bit(ifnum, &ps->ifclaimed)) @@ -450,6 +452,8 @@ { int ret = 0; + if (ps->dev->state != USB_STATE_CONFIGURED) + return -EHOSTUNREACH; if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype)) return 0; @@ -1131,7 +1135,7 @@ } if (ps->dev->state != USB_STATE_CONFIGURED) - retval = -ENODEV; + retval = -EHOSTUNREACH; else if (!(intf = usb_ifnum_to_if (ps->dev, ctrl.ifno))) retval = -EINVAL; else switch (ctrl.ioctl_code) { | |