linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usbfs: Remove extraneous disconnection checks
@ 2004-12-16 23:38 Greg KH
  2004-12-16 23:39 ` [PATCH 2/2] USB: avoid OHCI autosuspend on some boxes Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Greg KH @ 2004-12-16 23:38 UTC (permalink / raw)
  To: torvalds, Andrew Morton; +Cc: stern, linux-kernel, linux-usb-devel

[2 USB patches to be applied to the latest -bk tree, both fixing real
bugs. I figured it's easier than creating a whole bk tree for them]



This patch fixes a bug in the usbfs code.  The driver is too zealous about
checking for disconnected devices before doing things.  In particular, it
is necessary to reap all outstanding asynchronous URBs and unbind from
interfaces when the device file is closed, even if the device is no longer
connected.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c	2004-12-16 15:35:55 -08:00
+++ b/drivers/usb/core/devio.c	2004-12-16 15:35:55 -08:00
@@ -523,13 +523,12 @@
 
 	usb_lock_device(dev);
 	list_del_init(&ps->list);
-
-	if (connected(dev)) {
-		for (ifnum = 0; ps->ifclaimed && ifnum < 8*sizeof(ps->ifclaimed); ifnum++)
-			if (test_bit(ifnum, &ps->ifclaimed))
-				releaseintf(ps, ifnum);
-		destroy_all_async(ps);
+	for (ifnum = 0; ps->ifclaimed && ifnum < 8*sizeof(ps->ifclaimed);
+			ifnum++) {
+		if (test_bit(ifnum, &ps->ifclaimed))
+			releaseintf(ps, ifnum);
 	}
+	destroy_all_async(ps);
 	usb_unlock_device(dev);
 	usb_put_dev(dev);
 	ps->dev = NULL;
@@ -1034,7 +1033,7 @@
 	int ret;
 
 	add_wait_queue(&ps->wait, &wait);
-	while (connected(dev)) {
+	for (;;) {
 		__set_current_state(TASK_INTERRUPTIBLE);
 		if ((as = async_getcompleted(ps)))
 			break;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] USB: avoid OHCI autosuspend on some boxes
  2004-12-16 23:38 [PATCH 1/2] usbfs: Remove extraneous disconnection checks Greg KH
@ 2004-12-16 23:39 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-12-16 23:39 UTC (permalink / raw)
  To: torvalds, Andrew Morton; +Cc: david-b, linux-kernel, linux-usb-devel

Don't try autosuspend if we think the hardware won't resume correctly
from the OHCI suspend state.  This makes the RWC bit serve double duty,
but that appears to work OK, and the only penalty is increased power
consumption (from OHCI clocks) on boards/chips that don't work right.

For example, the amd756 erratum 4 workaround needs this logic; and at
least one ServerWorks box issues spurious resume IRQs (~3x/second!)
in the suspend state.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

diff -Nru a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
--- a/drivers/usb/host/ohci-hub.c	2004-12-16 15:36:00 -08:00
+++ b/drivers/usb/host/ohci-hub.c	2004-12-16 15:36:00 -08:00
@@ -305,7 +305,7 @@
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	int		ports, i, changed = 0, length = 1;
-	int		can_suspend = 1;
+	int		can_suspend = hcd->can_wakeup;
 	unsigned long	flags;
 
 	spin_lock_irqsave (&ohci->lock, flags);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-16 23:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-16 23:38 [PATCH 1/2] usbfs: Remove extraneous disconnection checks Greg KH
2004-12-16 23:39 ` [PATCH 2/2] USB: avoid OHCI autosuspend on some boxes Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).