[PATCH 07/16] mpt3sas: 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/mpt3sas/mpt3sas_base.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 5dc280c..e756191 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1520,11 +1520,9 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
 static int
 _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
 {
-	int base;
 	u16 message_control;
 
-	base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
-	if (!base) {
+	if (!ioc->pdev->msix_cap) {
 		dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n",
 			ioc->name));
 		return -EINVAL;
@@ -1532,7 +1530,8 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
 
 	/* get msix vector count */
 
-	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;
 	if (ioc->msix_vector_count > 8)
 		ioc->msix_vector_count = 8;
-- 
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