aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-driver.c
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2015-06-10 04:54:58 -0400
committerBjorn Helgaas <bhelgaas@google.com>2015-07-30 14:59:47 -0400
commit890e4847587fcff5eb0438e90992ad7d2a261f33 (patch)
treefef98a9dd0c0cf4c328f55996733b822690e9de0 /drivers/pci/pci-driver.c
parentbc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff)
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: Jiang Liu <jiang.liu@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r--drivers/pci/pci-driver.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 3cb2210de553..52a880ca1768 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -388,18 +388,31 @@ static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
388 return error; 388 return error;
389} 389}
390 390
391int __weak pcibios_alloc_irq(struct pci_dev *dev)
392{
393 return 0;
394}
395
396void __weak pcibios_free_irq(struct pci_dev *dev)
397{
398}
399
391static int pci_device_probe(struct device *dev) 400static int pci_device_probe(struct device *dev)
392{ 401{
393 int error = 0; 402 int error;
394 struct pci_driver *drv; 403 struct pci_dev *pci_dev = to_pci_dev(dev);
395 struct pci_dev *pci_dev; 404 struct pci_driver *drv = to_pci_driver(dev->driver);
405
406 error = pcibios_alloc_irq(pci_dev);
407 if (error < 0)
408 return error;
396 409
397 drv = to_pci_driver(dev->driver);
398 pci_dev = to_pci_dev(dev);
399 pci_dev_get(pci_dev); 410 pci_dev_get(pci_dev);
400 error = __pci_device_probe(drv, pci_dev); 411 error = __pci_device_probe(drv, pci_dev);
401 if (error) 412 if (error) {
413 pcibios_free_irq(pci_dev);
402 pci_dev_put(pci_dev); 414 pci_dev_put(pci_dev);
415 }
403 416
404 return error; 417 return error;
405} 418}
@@ -415,6 +428,7 @@ static int pci_device_remove(struct device *dev)
415 drv->remove(pci_dev); 428 drv->remove(pci_dev);
416 pm_runtime_put_noidle(dev); 429 pm_runtime_put_noidle(dev);
417 } 430 }
431 pcibios_free_irq(pci_dev);
418 pci_dev->driver = NULL; 432 pci_dev->driver = NULL;
419 } 433 }
420 434