On Tue, 21 May 2013, Heikki Krogerus wrote: > From: "Chew, Chiau Ee" <chiau.ee.chew@xxxxxxxxx> > > Like the xHCI controller on Intel Panther Point and Lynx Point > chipsets, the xHCI controller on Intel BayTrail has also ports that > can be switched between the EHCI host controller. > > This patch should be backported to stable kernels as old as 3.0, > that contain commit 69e848c2090aebba5698a1620604c7dccb448684 > "Intel xhci: Support EHCI/xHCI port switching. > > Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@xxxxxxxxx> > Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> > Cc: stable@xxxxxxxxxxxxxxx > --- > drivers/usb/host/ehci-pci.c | 3 ++- > drivers/usb/host/pci-quirks.c | 12 +++++++++++- > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c > index 595d210..a5708d9 100644 > --- a/drivers/usb/host/ehci-pci.c > +++ b/drivers/usb/host/ehci-pci.c > @@ -322,7 +322,8 @@ static bool usb_is_intel_switchable_ehci(struct pci_dev *pdev) > (pdev->device == 0x1E26 || > pdev->device == 0x8C2D || > pdev->device == 0x8C26 || > - pdev->device == 0x9C26); > + pdev->device == 0x9C26 || > + pdev->device == 0x0F34); The entries should be kept sorted in numerical order. In fact, you might even interchange the 0x8C2D and 0x8C26 entries. > } > > static void ehci_enable_xhci_companion(void) > diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c > index 4c338ec..6062822 100644 > --- a/drivers/usb/host/pci-quirks.c > +++ b/drivers/usb/host/pci-quirks.c > @@ -724,6 +724,7 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, > > #define PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI 0x8C31 > #define PCI_DEVICE_ID_INTEL_LYNX_POINT_LP_XHCI 0x9C31 > +#define PCI_DEVICE_ID_INTEL_BYT_XHCI 0x0F35 > > bool usb_is_intel_ppt_switchable_xhci(struct pci_dev *pdev) > { > @@ -741,10 +742,19 @@ bool usb_is_intel_lpt_switchable_xhci(struct pci_dev *pdev) > pdev->device == PCI_DEVICE_ID_INTEL_LYNX_POINT_LP_XHCI); > } > > +/* And so does the Intel BayTrail. */ > +bool usb_is_intel_byt_switchable_xhci(struct pci_dev *pdev) > +{ > + return pdev->class == PCI_CLASS_SERIAL_USB_XHCI && > + pdev->vendor == PCI_VENDOR_ID_INTEL && > + pdev->device == PCI_DEVICE_ID_INTEL_BYT_XHCI; > +} > + > bool usb_is_intel_switchable_xhci(struct pci_dev *pdev) > { > return usb_is_intel_ppt_switchable_xhci(pdev) || > - usb_is_intel_lpt_switchable_xhci(pdev); > + usb_is_intel_lpt_switchable_xhci(pdev) || > + usb_is_intel_byt_switchable_xhci(pdev); > } > EXPORT_SYMBOL_GPL(usb_is_intel_switchable_xhci); This code cries out for refactoring. Why test pdev->class and pdev->vendor in the same way in three different places? Those two tests should be moved directly into usb_is_intel_switchable_xhci(). The other helper functions then become simple comparisons. As far as I'm concerned, they also could be moved inline into usb_is_intel_switchable_xhci(). Sarah may disagree, however. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html