mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Colin Leroy <colin@colino.net>
Cc: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: don't spit out too much errors with suspended devices
Date: Wed, 27 Oct 2004 16:13:56 -0700	[thread overview]
Message-ID: <200410271613.56201.david-b@pacbell.net> (raw)
In-Reply-To: <20041027091925.56d31d91.colin@colino.net>

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

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



[-- Attachment #2: Diff --]
[-- Type: text/x-diff, Size: 1123 bytes --]

--- 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) {

  reply	other threads:[~2004-10-27 23:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-26 15:28 2.6.10-rc1 OHCI usb error messages Colin Leroy
2004-10-26 16:05 ` [linux-usb-devel] " David Brownell
2004-10-27  7:19   ` [PATCH] usb: don't spit out too much errors with suspended devices Colin Leroy
2004-10-27 23:13     ` David Brownell [this message]
2004-10-28  6:37       ` Colin Leroy
2004-10-27  9:07   ` [linux-usb-devel] 2.6.10-rc1 OHCI usb error messages Colin Leroy
2004-10-27 22:59     ` David Brownell
2004-10-28  9:07       ` Colin Leroy
2004-10-28 14:10         ` David Brownell
2004-10-28 14:46       ` Alan Stern
2004-10-28 16:51         ` David Brownell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200410271613.56201.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=colin@colino.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome