summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci
diff options
context:
space:
mode:
authorDaniel Scheller <d.scheller@gmx.net>2018-04-09 18:47:38 +0200
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-05-04 16:31:46 +0200
commit95c2ab9e21df95ed5830f1de561301609df1c20a (patch)
treea5a806aab942988758d67230c617d8c6b3829005 /drivers/media/pci
parentmedia: ddbridge: move ddb_wq and the wq+class initialisation to -core (diff)
downloadlinux-95c2ab9e21df95ed5830f1de561301609df1c20a.tar.xz
linux-95c2ab9e21df95ed5830f1de561301609df1c20a.zip
media: ddbridge: move MSI IRQ cleanup to a helper function
Introduce the ddb_msi_exit() helper to be used for cleaning up previously allocated MSI IRQ vectors. Deduplicates code and makes things look cleaner as for all cleanup work the CONFIG_PCI_MSI ifdeffery is only needed in the helper now. Also, replace the call to the deprecated pci_disable_msi() function with pci_free_irq_vectors(). 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')
-rw-r--r--drivers/media/pci/ddbridge/ddbridge-main.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c
index 7088162af9d3..77089081db1f 100644
--- a/drivers/media/pci/ddbridge/ddbridge-main.c
+++ b/drivers/media/pci/ddbridge/ddbridge-main.c
@@ -65,16 +65,20 @@ static void ddb_irq_disable(struct ddb *dev)
ddbwritel(dev, 0, MSI1_ENABLE);
}
+static void ddb_msi_exit(struct ddb *dev)
+{
+#ifdef CONFIG_PCI_MSI
+ if (dev->msi)
+ pci_free_irq_vectors(dev->pdev);
+#endif
+}
+
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);
-#ifdef CONFIG_PCI_MSI
- if (dev->msi)
- pci_disable_msi(dev->pdev);
-#endif
}
static void ddb_remove(struct pci_dev *pdev)
@@ -86,6 +90,7 @@ static void ddb_remove(struct pci_dev *pdev)
ddb_i2c_release(dev);
ddb_irq_exit(dev);
+ ddb_msi_exit(dev);
ddb_ports_release(dev);
ddb_buffers_free(dev);
@@ -230,8 +235,7 @@ static int ddb_probe(struct pci_dev *pdev,
ddb_irq_exit(dev);
fail0:
dev_err(&pdev->dev, "fail0\n");
- if (dev->msi)
- pci_disable_msi(dev->pdev);
+ ddb_msi_exit(dev);
fail:
dev_err(&pdev->dev, "fail\n");