linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] cxgb3: Replace PCI related literals with defines & correct variable
@ 2025-06-10 10:32 Ilpo Järvinen
  2025-06-10 10:32 ` [PATCH 2/3] cxgb3: Use FIELD_GET() for PCI register fields Ilpo Järvinen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2025-06-10 10:32 UTC (permalink / raw)
  To: linux-pci, Potnuri Bharat Teja, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: Ilpo Järvinen

Replace literals 0, 2, 0x1425 with PCI_VENDOR_ID, PCI_DEVICE_ID,
PCI_VENDOR_ID_CHELSIO, respectively. Rename devid variable to vendor_id
to remove confusion.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
index a06003bfa04b..4e917a578c77 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
@@ -30,6 +30,8 @@
  * SOFTWARE.
  */
 #include <linux/etherdevice.h>
+#include <linux/pci.h>
+
 #include "common.h"
 #include "regs.h"
 #include "sge_defs.h"
@@ -3262,7 +3264,7 @@ static void config_pcie(struct adapter *adap)
 	pcie_capability_read_word(adap->pdev, PCI_EXP_DEVCTL, &val);
 	pldsize = (val & PCI_EXP_DEVCTL_PAYLOAD) >> 5;
 
-	pci_read_config_word(adap->pdev, 0x2, &devid);
+	pci_read_config_word(adap->pdev, PCI_DEVICE_ID, &devid);
 	if (devid == 0x37) {
 		pcie_capability_write_word(adap->pdev, PCI_EXP_DEVCTL,
 					   val & ~PCI_EXP_DEVCTL_READRQ &
@@ -3477,7 +3479,7 @@ static void mac_prep(struct cmac *mac, struct adapter *adapter, int index)
 	u16 devid;
 
 	mac->adapter = adapter;
-	pci_read_config_word(adapter->pdev, 0x2, &devid);
+	pci_read_config_word(adapter->pdev, PCI_DEVICE_ID, &devid);
 
 	if (devid == 0x37 && !adapter->params.vpd.xauicfg[1])
 		index = 0;
@@ -3528,7 +3530,7 @@ int t3_reset_adapter(struct adapter *adapter)
 {
 	int i, save_and_restore_pcie =
 	    adapter->params.rev < T3_REV_B2 && is_pcie(adapter);
-	uint16_t devid = 0;
+	u16 vendor_id = 0;
 
 	if (save_and_restore_pcie)
 		pci_save_state(adapter->pdev);
@@ -3540,12 +3542,12 @@ int t3_reset_adapter(struct adapter *adapter)
 	 */
 	for (i = 0; i < 10; i++) {
 		msleep(50);
-		pci_read_config_word(adapter->pdev, 0x00, &devid);
-		if (devid == 0x1425)
+		pci_read_config_word(adapter->pdev, PCI_VENDOR_ID, &vendor_id);
+		if (vendor_id == PCI_VENDOR_ID_CHELSIO)
 			break;
 	}
 
-	if (devid != 0x1425)
+	if (vendor_id != PCI_VENDOR_ID_CHELSIO)
 		return -1;
 
 	if (save_and_restore_pcie)

base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-11  7:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 10:32 [PATCH 1/3] cxgb3: Replace PCI related literals with defines & correct variable Ilpo Järvinen
2025-06-10 10:32 ` [PATCH 2/3] cxgb3: Use FIELD_GET() for PCI register fields Ilpo Järvinen
2025-06-10 10:32 ` [PATCH 3/3] cxgb3: Split complex PCI write statement into logic + write Ilpo Järvinen
2025-06-10 20:53 ` [PATCH 1/3] cxgb3: Replace PCI related literals with defines & correct variable Jakub Kicinski
2025-06-11  7:22   ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).