Commit 890e4847 authored by Jiang Liu's avatar Jiang Liu Committed by Bjorn Helgaas

PCI: Add pcibios_alloc_irq() and pcibios_free_irq()

Add pcibios_alloc_irq() and pcibios_free_irq(), which are called when
binding/unbinding PCI device drivers.

PCI arch code may implement these to manage IRQ resources for hotplugged
devices.

[bhelgaas: changelog]
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent bc0195aa
...@@ -388,18 +388,31 @@ static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) ...@@ -388,18 +388,31 @@ static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
return error; return error;
} }
int __weak pcibios_alloc_irq(struct pci_dev *dev)
{
return 0;
}
void __weak pcibios_free_irq(struct pci_dev *dev)
{
}
static int pci_device_probe(struct device *dev) static int pci_device_probe(struct device *dev)
{ {
int error = 0; int error;
struct pci_driver *drv; struct pci_dev *pci_dev = to_pci_dev(dev);
struct pci_dev *pci_dev; struct pci_driver *drv = to_pci_driver(dev->driver);
error = pcibios_alloc_irq(pci_dev);
if (error < 0)
return error;
drv = to_pci_driver(dev->driver);
pci_dev = to_pci_dev(dev);
pci_dev_get(pci_dev); pci_dev_get(pci_dev);
error = __pci_device_probe(drv, pci_dev); error = __pci_device_probe(drv, pci_dev);
if (error) if (error) {
pcibios_free_irq(pci_dev);
pci_dev_put(pci_dev); pci_dev_put(pci_dev);
}
return error; return error;
} }
...@@ -415,6 +428,7 @@ static int pci_device_remove(struct device *dev) ...@@ -415,6 +428,7 @@ static int pci_device_remove(struct device *dev)
drv->remove(pci_dev); drv->remove(pci_dev);
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
} }
pcibios_free_irq(pci_dev);
pci_dev->driver = NULL; pci_dev->driver = NULL;
} }
......
...@@ -1645,6 +1645,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, ...@@ -1645,6 +1645,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
int pcibios_add_device(struct pci_dev *dev); int pcibios_add_device(struct pci_dev *dev);
void pcibios_release_device(struct pci_dev *dev); void pcibios_release_device(struct pci_dev *dev);
void pcibios_penalize_isa_irq(int irq, int active); void pcibios_penalize_isa_irq(int irq, int active);
int pcibios_alloc_irq(struct pci_dev *dev);
void pcibios_free_irq(struct pci_dev *dev);
#ifdef CONFIG_HIBERNATE_CALLBACKS #ifdef CONFIG_HIBERNATE_CALLBACKS
extern struct dev_pm_ops pcibios_pm_ops; extern struct dev_pm_ops pcibios_pm_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment