diff options
Diffstat (limited to 'kernel/arch/x86/pci/common.c')
-rw-r--r-- | kernel/arch/x86/pci/common.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/kernel/arch/x86/pci/common.c b/kernel/arch/x86/pci/common.c index 8fd6f44ae..eccd4d99e 100644 --- a/kernel/arch/x86/pci/common.c +++ b/kernel/arch/x86/pci/common.c @@ -673,24 +673,30 @@ int pcibios_add_device(struct pci_dev *dev) return 0; } -int pcibios_enable_device(struct pci_dev *dev, int mask) +int pcibios_alloc_irq(struct pci_dev *dev) { - int err; - - if ((err = pci_enable_resources(dev, mask)) < 0) - return err; + /* + * If the PCI device was already claimed by core code and has + * MSI enabled, probing of the pcibios IRQ will overwrite + * dev->irq. So bail out if MSI is already enabled. + */ + if (pci_dev_msi_enabled(dev)) + return -EBUSY; - if (!pci_dev_msi_enabled(dev)) - return pcibios_enable_irq(dev); - return 0; + return pcibios_enable_irq(dev); } -void pcibios_disable_device (struct pci_dev *dev) +void pcibios_free_irq(struct pci_dev *dev) { - if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq) + if (pcibios_disable_irq) pcibios_disable_irq(dev); } +int pcibios_enable_device(struct pci_dev *dev, int mask) +{ + return pci_enable_resources(dev, mask); +} + int pci_ext_cfg_avail(void) { if (raw_pci_ext_ops) |