diff options
author | Daniel Scheller <d.scheller@gmx.net> | 2018-04-09 18:47:39 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-05-04 16:32:52 +0200 |
commit | 6bf0f0512a85c0a28c2e879fc0f6f7f44008d588 (patch) | |
tree | 44c67634421a49507becd267e9530b67ea64777c /drivers/media/pci/ddbridge/ddbridge-main.c | |
parent | media: ddbridge: move MSI IRQ cleanup to a helper function (diff) | |
download | linux-6bf0f0512a85c0a28c2e879fc0f6f7f44008d588.tar.xz linux-6bf0f0512a85c0a28c2e879fc0f6f7f44008d588.zip |
media: ddbridge: request/free_irq using pci_irq_vector, enable MSI-X
Instead of trying to manage IRQ numbers on itself, utilise the
pci_irq_vector() function to do this, which will take care of correct IRQ
numbering for MSI and non-MSI IRQs. While at it, request and enable MSI-X
interrupts for hardware (boards and cards) that support this.
Picked up from the upstream dddvb-0.9.33 release.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci/ddbridge/ddbridge-main.c')
-rw-r--r-- | drivers/media/pci/ddbridge/ddbridge-main.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c index 77089081db1f..008be9066814 100644 --- a/drivers/media/pci/ddbridge/ddbridge-main.c +++ b/drivers/media/pci/ddbridge/ddbridge-main.c @@ -77,8 +77,8 @@ static void ddb_irq_exit(struct ddb *dev) { ddb_irq_disable(dev); if (dev->msi == 2) - free_irq(dev->pdev->irq + 1, dev); - free_irq(dev->pdev->irq, dev); + free_irq(pci_irq_vector(dev->pdev, 1), dev); + free_irq(pci_irq_vector(dev->pdev, 0), dev); } static void ddb_remove(struct pci_dev *pdev) @@ -105,7 +105,8 @@ static void ddb_irq_msi(struct ddb *dev, int nr) int stat; if (msi && pci_msi_enabled()) { - stat = pci_alloc_irq_vectors(dev->pdev, 1, nr, PCI_IRQ_MSI); + stat = pci_alloc_irq_vectors(dev->pdev, 1, nr, + PCI_IRQ_MSI | PCI_IRQ_MSIX); if (stat >= 1) { dev->msi = stat; dev_info(dev->dev, "using %d MSI interrupt(s)\n", @@ -137,21 +138,24 @@ static int ddb_irq_init(struct ddb *dev) if (dev->msi) irq_flag = 0; if (dev->msi == 2) { - stat = request_irq(dev->pdev->irq, ddb_irq_handler0, - irq_flag, "ddbridge", (void *)dev); + stat = request_irq(pci_irq_vector(dev->pdev, 0), + ddb_irq_handler0, irq_flag, "ddbridge", + (void *)dev); if (stat < 0) return stat; - stat = request_irq(dev->pdev->irq + 1, ddb_irq_handler1, - irq_flag, "ddbridge", (void *)dev); + stat = request_irq(pci_irq_vector(dev->pdev, 1), + ddb_irq_handler1, irq_flag, "ddbridge", + (void *)dev); if (stat < 0) { - free_irq(dev->pdev->irq, dev); + free_irq(pci_irq_vector(dev->pdev, 0), dev); return stat; } } else #endif { - stat = request_irq(dev->pdev->irq, ddb_irq_handler, - irq_flag, "ddbridge", (void *)dev); + stat = request_irq(pci_irq_vector(dev->pdev, 0), + ddb_irq_handler, irq_flag, "ddbridge", + (void *)dev); if (stat < 0) return stat; } |