diff mbox series

[v2,4/5] scsi: ufs: tc-dwc-pci: Allow for MSI interrupt type

Message ID 05ba98b7a98520e3ac3884037ee481da460d0dcc.1587735561.git.Jose.Abreu@synopsys.com (mailing list archive)
State Changes Requested
Headers show
Series scsi: ufs: Misc improvements for DesignWare drivers and UFS | expand

Commit Message

Jose Abreu April 24, 2020, 1:44 p.m. UTC
Newer Test Chips boards have MSI support. It does no harm to try to
request it as the function will fallback to legacy interrupts if MSI is
not supported.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---

Changes from v1:
- Do not try to request MSIX vectors (Tomas)
- Add missing call to pci_free_irq_vectors() (Tomas)

Cc: "Winkler, Tomas" <tomas.winkler@intel.com>
Cc: Joao Lima <Joao.Lima@synopsys.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/scsi/ufs/tc-dwc-pci.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/tc-dwc-pci.c b/drivers/scsi/ufs/tc-dwc-pci.c
index 74a2d80d32bd..78dc6c484e84 100644
--- a/drivers/scsi/ufs/tc-dwc-pci.c
+++ b/drivers/scsi/ufs/tc-dwc-pci.c
@@ -88,6 +88,7 @@  static void tc_dwc_pci_remove(struct pci_dev *pdev)
 	pm_runtime_forbid(&pdev->dev);
 	pm_runtime_get_noresume(&pdev->dev);
 	ufshcd_remove(hba);
+	pci_free_irq_vectors(pdev);
 }
 
 /**
@@ -136,11 +137,18 @@  tc_dwc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		return -ENOENT;
 	}
 
+	err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_LEGACY | PCI_IRQ_MSI);
+	if (err < 0) {
+		dev_err(&pdev->dev, "Allocation failed\n");
+		return err;
+	}
+
 	hba->vops = &data->ops;
 
-	err = ufshcd_init(hba, mmio_base, pdev->irq);
+	err = ufshcd_init(hba, mmio_base, pci_irq_vector(pdev, 0));
 	if (err) {
 		dev_err(&pdev->dev, "Initialization failed\n");
+		pci_free_irq_vectors(pdev);
 		return err;
 	}