[PATCH 06/16] mpt2sas: clean up unnecessary MSI/MSI-X capability find

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PCI core will initialize device MSI/MSI-X capability in
pci_msi_init_pci_dev(). So device driver should use
pci_dev->msi_cap/msix_cap to determine whether the device
support MSI/MSI-X instead of using
pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
Access to PCIe device config space again will consume more time.

Signed-off-by: Yijing Wang <wangyijing@xxxxxxxxxx>
Cc: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@xxxxxxx>
Cc: Sreekanth Reddy <Sreekanth.Reddy@xxxxxxx>
Cc: support@xxxxxxx
Cc: "James E.J. Bottomley" <JBottomley@xxxxxxxxxxxxx>
Cc: DL-MPTFusionLinux@xxxxxxx
Cc: linux-scsi@xxxxxxxxxxxxxxx
---
 drivers/scsi/mpt2sas/mpt2sas_base.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index ccd6d5a..35c3676 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1217,7 +1217,6 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev)
 static int
 _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
 {
-	int base;
 	u16 message_control;
 
 
@@ -1228,8 +1227,7 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
 		return -EINVAL;
 	}
 
-	base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
-	if (!base) {
+	if (!ioc->pdev->msix_cap) {
 		dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "msix not "
 		    "supported\n", ioc->name));
 		return -EINVAL;
@@ -1246,7 +1244,8 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
 	    ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2116_2)
 		ioc->msix_vector_count = 1;
 	else {
-		pci_read_config_word(ioc->pdev, base + 2, &message_control);
+		pci_read_config_word(ioc->pdev, ioc->pdev->msix_cap + 2,
+				&message_control);
 		ioc->msix_vector_count = (message_control & 0x3FF) + 1;
 	}
 	dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux