Add callbacks to the hc_driver structure to allow drivers that use hcd-pci to manage enabling of MSI interrupts. The IRQF_DISABLED flag got dropped because it is an obsolete NOOP. Signed-off-by: Clemens Ladisch <clemens@xxxxxxxxxx> --- drivers/usb/core/hcd-pci.c | 20 ++++++++++++++++++-- include/linux/usb/hcd.h | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -173,6 +173,7 @@ int usb_hcd_pci_probe(struct pci_dev *de { struct hc_driver *driver; struct usb_hcd *hcd; + unsigned long irqflags; int retval; if (usb_disabled()) @@ -243,15 +244,28 @@ int usb_hcd_pci_probe(struct pci_dev *de pci_set_master(dev); - retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); + if (driver->pci_prepare_irq) { + retval = driver->pci_prepare_irq(hcd); + if (retval < 0) + goto err4; + } + + if (pci_dev_msi_enabled(dev)) + irqflags = 0; + else + irqflags = IRQF_SHARED; + retval = usb_add_hcd(hcd, dev->irq, irqflags); if (retval != 0) - goto err4; + goto err5; set_hs_companion(dev, hcd); if (pci_dev_run_wake(dev)) pm_runtime_put_noidle(&dev->dev); return retval; + err5: + if (driver->pci_cleanup_irq) + driver->pci_cleanup_irq(hcd); err4: if (driver->flags & HCD_MEMORY) { iounmap(hcd->regs); @@ -304,6 +318,8 @@ void usb_hcd_pci_remove(struct pci_dev * local_irq_enable(); usb_remove_hcd(hcd); + if (hcd->driver->pci_cleanup_irq) + hcd->driver->pci_cleanup_irq(hcd); if (hcd->driver->flags & HCD_MEMORY) { iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -205,6 +205,10 @@ struct hc_driver { #define HCD_USB3 0x0040 /* USB 3.0 */ #define HCD_MASK 0x0070 + /* used to enable MSI, if desired */ + int (*pci_prepare_irq)(struct usb_hcd *hcd); + void (*pci_cleanup_irq)(struct usb_hcd *hcd); + /* called to init HCD and root hub */ int (*reset) (struct usb_hcd *hcd); int (*start) (struct usb_hcd *hcd); -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html