netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-pci@vger.kernel.org,
	Potnuri Bharat Teja <bharat@chelsio.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 1/3] cxgb3: Replace PCI related literals with defines & correct variable
Date: Tue, 10 Jun 2025 13:32:03 +0300	[thread overview]
Message-ID: <20250610103205.6750-1-ilpo.jarvinen@linux.intel.com> (raw)

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


             reply	other threads:[~2025-06-10 10:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 10:32 Ilpo Järvinen [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250610103205.6750-1-ilpo.jarvinen@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bharat@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).