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 2/3] cxgb3: Use FIELD_GET() for PCI register fields
Date: Tue, 10 Jun 2025 13:32:04 +0300 [thread overview]
Message-ID: <20250610103205.6750-2-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20250610103205.6750-1-ilpo.jarvinen@linux.intel.com>
Instead of literals and open-coding shifts and masks, use FIELD_GET()
and the correct field define from pci_regs.h.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
index 4e917a578c77..171bf6cf1abf 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
@@ -29,6 +29,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+#include <linux/bitfield.h>
#include <linux/etherdevice.h>
#include <linux/pci.h>
@@ -3262,7 +3263,7 @@ static void config_pcie(struct adapter *adap)
unsigned int fst_trn_rx, fst_trn_tx, acklat, rpllmt;
pcie_capability_read_word(adap->pdev, PCI_EXP_DEVCTL, &val);
- pldsize = (val & PCI_EXP_DEVCTL_PAYLOAD) >> 5;
+ pldsize = FIELD_GET(PCI_EXP_DEVCTL_PAYLOAD, val);
pci_read_config_word(adap->pdev, PCI_DEVICE_ID, &devid);
if (devid == 0x37) {
@@ -3400,7 +3401,7 @@ static void get_pci_mode(struct adapter *adapter, struct pci_params *p)
p->variant = PCI_VARIANT_PCIE;
pcie_capability_read_word(adapter->pdev, PCI_EXP_LNKSTA, &val);
- p->width = (val >> 4) & 0x3f;
+ p->width = FIELD_GET(PCI_EXP_LNKSTA_NLW, val);
return;
}
--
2.39.5
next prev parent 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 [PATCH 1/3] cxgb3: Replace PCI related literals with defines & correct variable Ilpo Järvinen
2025-06-10 10:32 ` Ilpo Järvinen [this message]
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-2-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).