于 2012/12/18 4:06, Alan Stern 写道:
On Mon, 17 Dec 2012, Octavio Alvarez wrote:

On Thu, 13 Dec 2012 00:45:05 -0800, Lan Tianyu <tianyu....@intel.com>
wrote:

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index f034716..9335f1b 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2509,7 +2509,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
         * they only forward requests from the root hub.  Therefore
         * controllers should always be enabled for remote wakeup.
         */
-       device_wakeup_enable(hcd->self.controller);
+       if (!usb_hcd_wakeup_quirks(hcd->self.controller))
+               device_wakeup_enable(hcd->self.controller);
        return retval;

  error_create_attr_group:
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index fdefd9c..ba847d3 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -12,6 +12,7 @@
   */

  #include <linux/usb.h>
+#include <linux/pci.h>
  #include <linux/usb/quirks.h>
  #include "usb.h"

@@ -226,3 +227,33 @@ void usb_detect_interface_quirks(struct usb_device
*udev)
                quirks);
        udev->quirks |= quirks;
  }
+
+struct pci_hcd {
+       u32 vendor;
+       u32 device;
+};
+
+static struct pci_hcd hcd_wakeup_qrk[] = {
+       {PCI_VENDOR_ID_NVIDIA, 0x026d}, /* MCP51 OHCI */
+       {PCI_VENDOR_ID_NVIDIA, 0x0aa5}, /* MCP79 OHCI */
+       {PCI_VENDOR_ID_NVIDIA, 0x0aa7}, /* MCP79 OHCI */
+       { }
+};
+
+int usb_hcd_wakeup_quirks(struct device *dev)
+{
+       struct pci_dev *pdev;
+       int i;
+
+       if (dev->bus != (struct bus_type *)&pci_bus_type)
+               return 0;
+
+       pdev = to_pci_dev(dev);
+       for (i = 0; hcd_wakeup_qrk[i].vendor || hcd_wakeup_qrk[i].device; i++)
+               if ((hcd_wakeup_qrk[i].vendor == pdev->vendor) &&
+                       (hcd_wakeup_qrk[i].device == pdev->device)) {
+                       return 1;
+               }
+
+       return 0;
+}

I would informing the user via dmesg output about the applied quirk
and a point him to relevant documentation. Something like this:

"Detected OHCI controller ID xxxx:yyyy, which requires no-wakeup quirk.
See Documentation/quirks/ohci-no-wakeup.txt"

Incidentally, this patch should be written differently.  Instead of a
quirks routine, there should simply be a bad_wakeup bitflag added to
the usb_hcd structure.  The flag should be set in ohci-pci.c by
matching against nVidia's PCI vendor ID.
Oh. I forget to mention the issue also takes place on the uhci.
https://bugzilla.kernel.org/show_bug.cgi?id=42721
So we also should make such a patch for uhci.

Alan Stern



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to