lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250610103205.6750-2-ilpo.jarvinen@linux.intel.com>
Date: Tue, 10 Jun 2025 13:32:04 +0300
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: linux-pci@...r.kernel.org,
	Potnuri Bharat Teja <bharat@...lsio.com>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Subject: [PATCH 2/3] cxgb3: Use FIELD_GET() for PCI register fields

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@...ux.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ