]> git.itanic.dy.fi Git - linux-stable/commitdiff
scsi: qla2xxx: Use FIELD_GET() to extract PCIe capability fields
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 13 Sep 2023 12:27:46 +0000 (15:27 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 14 Sep 2023 01:01:59 +0000 (21:01 -0400)
Use FIELD_GET() to extract PCIe capability registers field instead of
custom masking and shifting.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230913122748.29530-9-ilpo.jarvinen@linux.intel.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_os.c

index 50db08265c51fdf373bb7d9afb8ce251c000bd2d..7e103d7118253739cc1fad2298b522d46bddb5d6 100644 (file)
@@ -5,6 +5,7 @@
  */
 #include "qla_def.h"
 
+#include <linux/bitfield.h>
 #include <linux/moduleparam.h>
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
@@ -633,8 +634,8 @@ qla24xx_pci_info_str(struct scsi_qla_host *vha, char *str, size_t str_len)
                const char *speed_str;
 
                pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat);
-               lspeed = lstat & PCI_EXP_LNKCAP_SLS;
-               lwidth = (lstat & PCI_EXP_LNKCAP_MLW) >> 4;
+               lspeed = FIELD_GET(PCI_EXP_LNKCAP_SLS, lstat);
+               lwidth = FIELD_GET(PCI_EXP_LNKCAP_MLW, lstat);
 
                switch (lspeed) {
                case 1: