Skip to contentSkip to conversation

powerpc/pci: use pci_is_pcie() to simplify code

PATCH Superseded Yijing Wang 1 participant 2 messages Oct 11, 2013

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/pci: use pci_is_pcie() to simplify code

Use pci_is_pcie() to simplify code.

---

v1->v2: use dev->pcie_cap instead of "cap" in eeh_ops->read_config()
"cap" is stale after remove PCIe Cap find code. Point out by Benjamin Herrenschmidt.

---
 arch/powerpc/kernel/eeh.c     |    5 ++---
 arch/powerpc/sysdev/fsl_pci.c |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/kernel/eeh.c +2 -3
index 55593ee..db86f97 100644
@@ -189,14 +189,13 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
 	}
 
 	/* If PCI-E capable, dump PCI-E cap 10, and the AER */
-	cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
-	if (cap) {
+	if (pci_is_pcie(dev)) {
 		n += scnprintf(buf+n, len-n, "pci-e cap10:\n");
 		printk(KERN_WARNING
 		       "EEH: PCI-E capabilities and status follow:\n");
 
 		for (i=0; i<=8; i++) {
-			eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
+			eeh_ops->read_config(dn, dev->pcie_cap+4*i, 4, &cfg);
 			n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
 			printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg);
 		}
arch/powerpc/sysdev/fsl_pci.c +1 -1
index ccfb50d..92e7258 100644
@@ -45,7 +45,7 @@ static void quirk_fsl_pcie_header(struct pci_dev *dev)
 	u8 hdr_type;
 
 	/* if we aren't a PCIe don't bother */
-	if (!pci_find_capability(dev, PCI_CAP_ID_EXP))
+	if (!pci_is_pcie(dev))
 		return;
 
 	/* if we aren't in host mode don't bother */
Signature · 1 line
1.7.1
#1 lore raw

Sorry, this patch should v3 not v2, please ignore, and v3 patch will resend.

Thanks!

Quoted 56 lines · Yijing Wang

Use pci_is_pcie() to simplify code.

---

v1->v2: use dev->pcie_cap instead of "cap" in eeh_ops->read_config()
"cap" is stale after remove PCIe Cap find code. Point out by Benjamin Herrenschmidt.

---
 arch/powerpc/kernel/eeh.c     |    5 ++---
 arch/powerpc/sysdev/fsl_pci.c |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/kernel/eeh.c +2 -3
index 55593ee..db86f97 100644
@@ -189,14 +189,13 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
 	}
 
 	/* If PCI-E capable, dump PCI-E cap 10, and the AER */
-	cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
-	if (cap) {
+	if (pci_is_pcie(dev)) {
 		n += scnprintf(buf+n, len-n, "pci-e cap10:\n");
 		printk(KERN_WARNING
 		       "EEH: PCI-E capabilities and status follow:\n");
 
 		for (i=0; i<=8; i++) {
-			eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
+			eeh_ops->read_config(dn, dev->pcie_cap+4*i, 4, &cfg);
 			n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
 			printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg);
 		}
arch/powerpc/sysdev/fsl_pci.c +1 -1
index ccfb50d..92e7258 100644
@@ -45,7 +45,7 @@ static void quirk_fsl_pcie_header(struct pci_dev *dev)
 	u8 hdr_type;
 
 	/* if we aren't a PCIe don't bother */
-	if (!pci_find_capability(dev, PCI_CAP_ID_EXP))
+	if (!pci_is_pcie(dev))
 		return;
 
 	/* if we aren't in host mode don't bother */
Signature · 2 lines
Thanks!
Yijing