diff mbox

[1/3] core/pci: Make the conditions for device type quirk obvious

Message ID 1495763586-27238-1-git-send-email-gwshan@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Gavin Shan May 26, 2017, 1:53 a.m. UTC
The device type should be fixed to downstream port when it seats
behinds behind a upstream port, which is connected to root port
directly and its VDID is 0x874810b5.

This reorders the conditions to make it a bit obvious: parent,
parent's device type, device's VDID and device type in sequence.
No logicial changes.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 core/pci.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Benjamin Herrenschmidt June 15, 2017, 5:41 a.m. UTC | #1
On Fri, 2017-05-26 at 11:53 +1000, Gavin Shan wrote:
> The device type should be fixed to downstream port when it seats
> behinds behind a upstream port, which is connected to root port
> directly and its VDID is 0x874810b5.
> 
> This reorders the conditions to make it a bit obvious: parent,
> parent's device type, device's VDID and device type in sequence.
> No logicial changes.
> 
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  core/pci.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/core/pci.c b/core/pci.c
> index d69eb28..7ec8409 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -171,9 +171,8 @@ static void pci_init_pcie_cap(struct phb *phb, struct pci_device *pd)
>  	 */
>  	pci_cfg_read16(phb, pd->bdfn, ecap + PCICAP_EXP_CAPABILITY_REG, &reg);
>  	pd->dev_type = GETFIELD(PCICAP_EXP_CAP_TYPE, reg);
> -	if (pd->parent && pd->dev_type == PCIE_TYPE_SWITCH_UPPORT &&
> -	    pd->parent->dev_type == PCIE_TYPE_SWITCH_UPPORT &&
> -	    pd->vdid == 0x874810b5) {
> +	if (pd->parent && pd->parent->dev_type == PCIE_TYPE_SWITCH_UPPORT &&
> +	    pd->vdid == 0x874810b5 && pd->dev_type == PCIE_TYPE_SWITCH_UPPORT) {
>  		PCIDBG(phb, pd->bdfn, "Fixing up bad PLX downstream port !\n");
>  		pd->dev_type = PCIE_TYPE_SWITCH_DNPORT;
>  	}
Stewart Smith June 16, 2017, 5:15 a.m. UTC | #2
Gavin Shan <gwshan@linux.vnet.ibm.com> writes:
> The device type should be fixed to downstream port when it seats
> behinds behind a upstream port, which is connected to root port
> directly and its VDID is 0x874810b5.
>
> This reorders the conditions to make it a bit obvious: parent,
> parent's device type, device's VDID and device type in sequence.
> No logicial changes.
>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  core/pci.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)

Thanks, I picked up this patch (1/3) as of b1065edb66652ba682e8b4c3064c52ab2e4f7822
diff mbox

Patch

diff --git a/core/pci.c b/core/pci.c
index d69eb28..7ec8409 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -171,9 +171,8 @@  static void pci_init_pcie_cap(struct phb *phb, struct pci_device *pd)
 	 */
 	pci_cfg_read16(phb, pd->bdfn, ecap + PCICAP_EXP_CAPABILITY_REG, &reg);
 	pd->dev_type = GETFIELD(PCICAP_EXP_CAP_TYPE, reg);
-	if (pd->parent && pd->dev_type == PCIE_TYPE_SWITCH_UPPORT &&
-	    pd->parent->dev_type == PCIE_TYPE_SWITCH_UPPORT &&
-	    pd->vdid == 0x874810b5) {
+	if (pd->parent && pd->parent->dev_type == PCIE_TYPE_SWITCH_UPPORT &&
+	    pd->vdid == 0x874810b5 && pd->dev_type == PCIE_TYPE_SWITCH_UPPORT) {
 		PCIDBG(phb, pd->bdfn, "Fixing up bad PLX downstream port !\n");
 		pd->dev_type = PCIE_TYPE_SWITCH_DNPORT;
 	}