USB: don't enable wakeup by default for PCI host controllers
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 13 Jan 2009 16:35:54 +0000 (11:35 -0500)
committerGreg Kroah-Hartman <gregkh@kvm.kroah.org>
Wed, 28 Jan 2009 00:15:32 +0000 (16:15 -0800)
This patch (as1199) changes the initial wakeup settings for PCI USB
host controllers.  The controllers are marked as capable of waking the
system, but wakeup is not enabled by default.

It turns out that enabling wakeup for USB host controllers has a lot
of bad consequences.  As the simplest example, if a USB mouse or
keyboard is unplugged immediately after the computer is put to sleep,
the unplug will cause the system to wake back up again!  We are better
off marking them as wakeup-capable and leaving wakeup disabled.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Rafael J. Wysocki <rjw@sisk.pl>
CC: David Brownell <david-b@pacbell.net>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd-pci.c
drivers/usb/host/ehci-pci.c
drivers/usb/host/ohci-hcd.c

index 507741ed448271e8dcd50782e16034e0360ef7a4..99432785f438bd34e0670fd1fb644949d1b0750b 100644 (file)
@@ -128,7 +128,6 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        }
 
        pci_set_master(dev);
-       device_set_wakeup_enable(&dev->dev, 1);
 
        retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
        if (retval != 0)
index bdc6e86e1f8b0aed2a6d505f618ed1bdd0a43b50..9faa5c8fe025cffc57e072a02c0ac0fc6e0caf0e 100644 (file)
@@ -230,7 +230,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
                pci_read_config_word(pdev, 0x62, &port_wake);
                if (port_wake & 0x0001) {
                        dev_warn(&pdev->dev, "Enabling legacy PCI PM\n");
-                       device_init_wakeup(&pdev->dev, 1);
+                       device_set_wakeup_capable(&pdev->dev, 1);
                }
        }
 
index 65a9609f4ad667f9a287c1b5a47f4420a674eb0e..5cf5f1eca4f40d4288d1127647723eb11a6c7781 100644 (file)
@@ -593,12 +593,10 @@ static int ohci_run (struct ohci_hcd *ohci)
         * to be checked in case boot firmware (BIOS/SMM/...) has set up
         * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM).
         * If the bus glue detected wakeup capability then it should
-        * already be enabled.  Either way, if wakeup should be enabled
-        * but isn't, we'll enable it now.
+        * already be enabled; if so we'll just enable it again.
         */
-       if ((ohci->hc_control & OHCI_CTRL_RWC) != 0
-                       && !device_can_wakeup(hcd->self.controller))
-               device_init_wakeup(hcd->self.controller, 1);
+       if ((ohci->hc_control & OHCI_CTRL_RWC) != 0)
+               device_set_wakeup_capable(hcd->self.controller, 1);
 
        switch (ohci->hc_control & OHCI_CTRL_HCFS) {
        case OHCI_USB_OPER: