[PATCH 2/2] PCIe PME: use pci_pcie_cap()

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

 



Use pci_pcie_cap() instead of pci_find_capability() to get PCIe
capability offset. This reduces redundant search in PCI configuration
space.

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

---
 drivers/pci/pcie/pme/pcie_pme.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: 20100218/drivers/pci/pcie/pme/pcie_pme.c
===================================================================
--- 20100218.orig/drivers/pci/pcie/pme/pcie_pme.c
+++ 20100218/drivers/pci/pcie/pme/pcie_pme.c
@@ -105,7 +105,7 @@ static void pcie_pme_interrupt_enable(st
 	int rtctl_pos;
 	u16 rtctl;
 
-	rtctl_pos = pci_find_capability(dev, PCI_CAP_ID_EXP) + PCI_EXP_RTCTL;
+	rtctl_pos = pci_pcie_cap(dev) + PCI_EXP_RTCTL;
 
 	pci_read_config_word(dev, rtctl_pos, &rtctl);
 	if (enable)
@@ -124,7 +124,7 @@ static void pcie_pme_clear_status(struct
 	int rtsta_pos;
 	u32 rtsta;
 
-	rtsta_pos = pci_find_capability(dev, PCI_CAP_ID_EXP) + PCI_EXP_RTSTA;
+	rtsta_pos = pci_pcie_cap(dev) + PCI_EXP_RTSTA;
 
 	pci_read_config_dword(dev, rtsta_pos, &rtsta);
 	rtsta |= PCI_EXP_RTSTA_PME;
@@ -278,7 +278,7 @@ static void pcie_pme_work_fn(struct work
 	int rtsta_pos;
 	u32 rtsta;
 
-	rtsta_pos = pci_find_capability(port, PCI_CAP_ID_EXP) + PCI_EXP_RTSTA;
+	rtsta_pos = pci_pcie_cap(port) + PCI_EXP_RTSTA;
 
 	spin_lock_irq(&data->lock);
 
@@ -332,7 +332,7 @@ static irqreturn_t pcie_pme_irq(int irq,
 	port = ((struct pcie_device *)context)->port;
 	data = get_service_data((struct pcie_device *)context);
 
-	rtsta_pos = pci_find_capability(port, PCI_CAP_ID_EXP) + PCI_EXP_RTSTA;
+	rtsta_pos = pci_pcie_cap(port) + PCI_EXP_RTSTA;
 
 	spin_lock_irqsave(&data->lock, flags);
 	pci_read_config_dword(port, rtsta_pos, &rtsta);

--
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