diff mbox series

[Very,RFC,20/46] powernv/eeh: Look up device info from pci_dev

Message ID 20191120012859.23300-21-oohall@gmail.com (mailing list archive)
State RFC
Headers show
Series [Very,RFC,01/46] powerpc/eeh: Don't attempt to restore VF config space after reset | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (784eee1cc44801366d4f197e0ade7739ee8e1e83)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (0695f8bca93ea0c57f0e8e21b4b4db70183b3d1c)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (c74386d50fbaf4a54fd3fe560f1abc709c0cff4b)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (7d6475051fb3d9339c5c760ed9883bc0a9048b21)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (5d1131b4d61e52e5702e0fa4bcbec81ac7d6ef52)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Oliver O'Halloran Nov. 20, 2019, 1:28 a.m. UTC
Most of what we fetch from the pci_dn is also in the pci_dev structure. Convert
the pnv_eeh_probe_pdev() to use the pdev fields rather than the pci_dn so we can
get rid of pci_dn eventually.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 arch/powerpc/platforms/powernv/eeh-powernv.c | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)

Comments

Alexey Kardashevskiy Nov. 25, 2019, 1:26 a.m. UTC | #1
On 20/11/2019 12:28, Oliver O'Halloran wrote:
> Most of what we fetch from the pci_dn is also in the pci_dev structure. Convert
> the pnv_eeh_probe_pdev() to use the pdev fields rather than the pci_dn so we can
> get rid of pci_dn eventually.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  arch/powerpc/platforms/powernv/eeh-powernv.c | 26 ++++++++++----------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
> index b79aca8368c6..6ba74836a9f8 100644
> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
> @@ -372,7 +372,7 @@ static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
>  	struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
>  	uint32_t pcie_flags;
>  	int ret;
> -	int config_addr = (pdn->busno << 8) | (pdn->devfn);
> +	int config_addr = (pdev->bus->number << 8) | (pdev->devfn);
>  
>  	/*
>  	 * When probing the root bridge, which doesn't have any
> @@ -392,18 +392,18 @@ static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
>  	}
>  
>  	/* Skip for PCI-ISA bridge */
> -	if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_ISA)
> +	if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
>  		return NULL;
>  
>  	eeh_edev_dbg(edev, "Probing device\n");
>  
>  	/* Initialize eeh device */
> -	edev->class_code = pdn->class_code;
> +	edev->class_code = pdev->class;
>  	edev->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
>  	edev->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
>  	edev->af_cap   = pci_find_capability(pdev, PCI_CAP_ID_AF);
>  	edev->aer_cap  = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
> -	if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
> +	if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
>  		edev->mode |= EEH_DEV_BRIDGE;
>  		if (edev->pcie_cap) {
>  			pnv_eeh_read_config(edev, edev->pcie_cap + PCI_EXP_FLAGS,
> @@ -443,14 +443,14 @@ static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
>  	 * Broadcom Shiner 4-ports 1G NICs (14e4:168a)
>  	 * Broadcom Shiner 2-ports 10G NICs (14e4:168e)
>  	 */
> -	if ((pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&


This very much looks like you can get rid of
pci_dn::vendor_id/device_id/class now.


Anyway

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>




> -	     pdn->device_id == 0x1656) ||
> -	    (pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&
> -	     pdn->device_id == 0x1657) ||
> -	    (pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&
> -	     pdn->device_id == 0x168a) ||
> -	    (pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&
> -	     pdn->device_id == 0x168e))
> +	if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
> +	     pdev->device == 0x1656) ||
> +	    (pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
> +	     pdev->device == 0x1657) ||
> +	    (pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
> +	     pdev->device == 0x168a) ||
> +	    (pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
> +	     pdev->device == 0x168e))
>  		edev->pe->state |= EEH_PE_CFG_RESTRICTED;
>  
>  	/*
> @@ -461,7 +461,7 @@ static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
>  	 */
>  	if (!(edev->pe->state & EEH_PE_PRI_BUS)) {
>  		edev->pe->bus = pci_find_bus(hose->global_number,
> -					     pdn->busno);
> +					     pdev->bus->number);
>  		if (edev->pe->bus)
>  			edev->pe->state |= EEH_PE_PRI_BUS;
>  	}
>
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index b79aca8368c6..6ba74836a9f8 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -372,7 +372,7 @@  static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
 	struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
 	uint32_t pcie_flags;
 	int ret;
-	int config_addr = (pdn->busno << 8) | (pdn->devfn);
+	int config_addr = (pdev->bus->number << 8) | (pdev->devfn);
 
 	/*
 	 * When probing the root bridge, which doesn't have any
@@ -392,18 +392,18 @@  static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
 	}
 
 	/* Skip for PCI-ISA bridge */
-	if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_ISA)
+	if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
 		return NULL;
 
 	eeh_edev_dbg(edev, "Probing device\n");
 
 	/* Initialize eeh device */
-	edev->class_code = pdn->class_code;
+	edev->class_code = pdev->class;
 	edev->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
 	edev->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
 	edev->af_cap   = pci_find_capability(pdev, PCI_CAP_ID_AF);
 	edev->aer_cap  = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
-	if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
+	if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
 		edev->mode |= EEH_DEV_BRIDGE;
 		if (edev->pcie_cap) {
 			pnv_eeh_read_config(edev, edev->pcie_cap + PCI_EXP_FLAGS,
@@ -443,14 +443,14 @@  static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
 	 * Broadcom Shiner 4-ports 1G NICs (14e4:168a)
 	 * Broadcom Shiner 2-ports 10G NICs (14e4:168e)
 	 */
-	if ((pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&
-	     pdn->device_id == 0x1656) ||
-	    (pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&
-	     pdn->device_id == 0x1657) ||
-	    (pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&
-	     pdn->device_id == 0x168a) ||
-	    (pdn->vendor_id == PCI_VENDOR_ID_BROADCOM &&
-	     pdn->device_id == 0x168e))
+	if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
+	     pdev->device == 0x1656) ||
+	    (pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
+	     pdev->device == 0x1657) ||
+	    (pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
+	     pdev->device == 0x168a) ||
+	    (pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
+	     pdev->device == 0x168e))
 		edev->pe->state |= EEH_PE_CFG_RESTRICTED;
 
 	/*
@@ -461,7 +461,7 @@  static struct eeh_dev *pnv_eeh_probe_pdev(struct pci_dev *pdev)
 	 */
 	if (!(edev->pe->state & EEH_PE_PRI_BUS)) {
 		edev->pe->bus = pci_find_bus(hose->global_number,
-					     pdn->busno);
+					     pdev->bus->number);
 		if (edev->pe->bus)
 			edev->pe->state |= EEH_PE_PRI_BUS;
 	}