Skip to contentSkip to conversation

staging: media: atomisp: Replace depracated MSI APIs

PATCH In review Suraj Upadhyay 2 participants 3 messages Jul 19, 2020 – Jul 20, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: media: atomisp: Replace depracated MSI APIs

Replace depracated MSI IRQ enabler and disabler
with pci_alloc_irq_vectors and pci_free_irq_vectors respectively. And as a result handle the returned error as appropriate. Compile tested.

---
Change:
v2: Replace the MSI IRQ disabler too.

---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +3 -3
index d36809a0182c..a5dea5521b36 100644
@@ -1735,8 +1735,8 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	pci_set_master(dev);
 	pci_set_drvdata(dev, isp);
 
-	err = pci_enable_msi(dev);
-	if (err) {
+	err = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSI);
+	if (err < 0) {
 		dev_err(&dev->dev, "Failed to enable msi (%d)\n", err);
 		goto enable_msi_fail;
 	}
@@ -1857,7 +1857,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 initialize_modules_fail:
 	cpu_latency_qos_remove_request(&isp->pm_qos);
 	atomisp_msi_irq_uninit(isp, dev);
-	pci_disable_msi(dev);
+	pci_free_irq_vectors(dev);
 enable_msi_fail:
 fw_validation_fail:
 	release_firmware(isp->firmware);
Signature · 1 line
2.17.1
#1 lore raw

Sorry, this is still not correct. See comments on other thread. There are other msi related code which needs to be updated.

regards,
dan carpenter

#2 lore raw
In reply to Suraj Upadhyay
Quoted 29 lines · Suraj Upadhyay

Replace depracated MSI IRQ enabler and disabler
with pci_alloc_irq_vectors and pci_free_irq_vectors respectively. And as a result handle the returned error as appropriate. Compile tested.

---
Change:
v2: Replace the MSI IRQ disabler too.

---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +2 -2
index d36809a0182c..a5dea5521b36 100644
@@ -1735,8 +1735,8 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	pci_set_master(dev);
 	pci_set_drvdata(dev, isp);
 
-	err = pci_enable_msi(dev);
-	if (err) {
+	err = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSI);
+	if (err < 0) {
 		dev_err(&dev->dev, "Failed to enable msi (%d)\n", err);
 		goto enable_msi_fail;
 	}

drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_pci_probe(struct pci_dev *dev, · line 1860

Quoted 5 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1 -1
@@ -1857,7 +1857,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 initialize_modules_fail:
 	cpu_latency_qos_remove_request(&isp->pm_qos);
 	atomisp_msi_irq_uninit(isp, dev);
-	pci_disable_msi(dev);
+	pci_free_irq_vectors(dev);

Actually, my initial complaint was that I was just looking for to see if the remove function was updated... It turns out the remove function never freed the IRQs to begin with so it was buggy from square one.

Anyway, the remove function should call pci_free_irq_vectors(). We may as well fix it now that we have seen the bug.

regards,
dan carpenter