[PATCH 3/12] PCIe AER: use pci_pcie_cap()

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

 



Use pcie_cap() instead of pci_find_capability() to get PCIe capability
offset in PCIe AER driver. This avoids unnecessary search in PCI
configuration space.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>

---
 drivers/pci/pcie/aer/aerdrv.c      |    2 +-
 drivers/pci/pcie/aer/aerdrv_core.c |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Index: 20091110/drivers/pci/pcie/aer/aerdrv.c
===================================================================
--- 20091110.orig/drivers/pci/pcie/aer/aerdrv.c
+++ 20091110/drivers/pci/pcie/aer/aerdrv.c
@@ -295,7 +295,7 @@ static void aer_error_resume(struct pci_
 	u16 reg16;
 
 	/* Clean up Root device status */
-	pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+	pos = pci_pcie_cap(dev);
 	pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &reg16);
 	pci_write_config_word(dev, pos + PCI_EXP_DEVSTA, reg16);
 
Index: 20091110/drivers/pci/pcie/aer/aerdrv_core.c
===================================================================
--- 20091110.orig/drivers/pci/pcie/aer/aerdrv_core.c
+++ 20091110/drivers/pci/pcie/aer/aerdrv_core.c
@@ -42,7 +42,7 @@ int pci_enable_pcie_error_reporting(stru
 	if (!pos)
 		return -EIO;
 
-	pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+	pos = pci_pcie_cap(dev);
 	if (!pos)
 		return -EIO;
 
@@ -66,7 +66,7 @@ int pci_disable_pcie_error_reporting(str
 	if (dev->aer_firmware_first)
 		return -EIO;
 
-	pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+	pos = pci_pcie_cap(dev);
 	if (!pos)
 		return -EIO;
 
@@ -224,7 +224,7 @@ static int find_device_iter(struct pci_d
 	 */
 	if (atomic_read(&dev->enable_cnt) == 0)
 		return 0;
-	pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+	pos = pci_pcie_cap(dev);
 	if (!pos)
 		return 0;
 	/* Check if AER is enabled */
@@ -618,7 +618,7 @@ void aer_enable_rootport(struct aer_rpc 
 	u16 reg16;
 	u32 reg32;
 
-	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
+	pos = pci_pcie_cap(pdev);
 	/* Clear PCIE Capability's Device Status */
 	pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, &reg16);
 	pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16);

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

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux