diff mbox

[4/4] core/pci: Use macro as vendor ID register offset

Message ID 1491524180-12644-5-git-send-email-gwshan@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Gavin Shan April 7, 2017, 12:16 a.m. UTC
This uses macro as PCI config register (vendor ID) offset because
it's more indicative.

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

Comments

Benjamin Herrenschmidt June 15, 2017, 5:39 a.m. UTC | #1
On Fri, 2017-04-07 at 10:16 +1000, Gavin Shan wrote:
> This uses macro as PCI config register (vendor ID) offset because
> it's more indicative.
> 
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

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

> ---
>  core/pci.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/core/pci.c b/core/pci.c
> index 7742454..13768a0 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -219,7 +219,7 @@ static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren
>  	bool had_crs = false;
>  
>  	for (retries = 0; retries < 40; retries++) {
> -		rc = pci_cfg_read32(phb, bdfn, 0, &vdid);
> +		rc = pci_cfg_read32(phb, bdfn, PCI_CFG_VENDOR_ID, &vdid);
>  		if (rc)
>  			return NULL;
>  		if (vdid == 0xffffffff || vdid == 0x00000000)
> @@ -240,7 +240,7 @@ static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren
>  	 * capture it's own bus number, so any subsequent error
>  	 * messages will be properly tagged
>  	 */
> -	pci_cfg_write32(phb, bdfn, 0, vdid);
> +	pci_cfg_write32(phb, bdfn, PCI_CFG_VENDOR_ID, vdid);
>  
>  	pd = zalloc(sizeof(struct pci_device));
>  	if (!pd) {
> @@ -1715,8 +1715,8 @@ static int __pci_restore_bridge_buses(struct phb *phb,
>  		uint32_t vdid;
>  
>  		/* Make all devices below a bridge "re-capture" the bdfn */
> -		if (pci_cfg_read32(phb, pd->bdfn, 0, &vdid) == 0)
> -			pci_cfg_write32(phb, pd->bdfn, 0, vdid);
> +		if (pci_cfg_read32(phb, pd->bdfn, PCI_CFG_VENDOR_ID, &vdid) == 0)
> +			pci_cfg_write32(phb, pd->bdfn, PCI_CFG_VENDOR_ID, vdid);
>  		return 0;
>  	}
>
diff mbox

Patch

diff --git a/core/pci.c b/core/pci.c
index 7742454..13768a0 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -219,7 +219,7 @@  static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren
 	bool had_crs = false;
 
 	for (retries = 0; retries < 40; retries++) {
-		rc = pci_cfg_read32(phb, bdfn, 0, &vdid);
+		rc = pci_cfg_read32(phb, bdfn, PCI_CFG_VENDOR_ID, &vdid);
 		if (rc)
 			return NULL;
 		if (vdid == 0xffffffff || vdid == 0x00000000)
@@ -240,7 +240,7 @@  static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren
 	 * capture it's own bus number, so any subsequent error
 	 * messages will be properly tagged
 	 */
-	pci_cfg_write32(phb, bdfn, 0, vdid);
+	pci_cfg_write32(phb, bdfn, PCI_CFG_VENDOR_ID, vdid);
 
 	pd = zalloc(sizeof(struct pci_device));
 	if (!pd) {
@@ -1715,8 +1715,8 @@  static int __pci_restore_bridge_buses(struct phb *phb,
 		uint32_t vdid;
 
 		/* Make all devices below a bridge "re-capture" the bdfn */
-		if (pci_cfg_read32(phb, pd->bdfn, 0, &vdid) == 0)
-			pci_cfg_write32(phb, pd->bdfn, 0, vdid);
+		if (pci_cfg_read32(phb, pd->bdfn, PCI_CFG_VENDOR_ID, &vdid) == 0)
+			pci_cfg_write32(phb, pd->bdfn, PCI_CFG_VENDOR_ID, vdid);
 		return 0;
 	}