PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk
[platform/kernel/linux-starfive.git] / drivers / pci / pci-sysfs.c
index d9eede2..5a62410 100644 (file)
@@ -12,7 +12,7 @@
  * Modeled after usb's driverfs.c
  */
 
-
+#include <linux/bitfield.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/pci.h>
@@ -230,8 +230,7 @@ static ssize_t current_link_width_show(struct device *dev,
        if (err)
                return -EINVAL;
 
-       return sysfs_emit(buf, "%u\n",
-               (linkstat & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT);
+       return sysfs_emit(buf, "%u\n", FIELD_GET(PCI_EXP_LNKSTA_NLW, linkstat));
 }
 static DEVICE_ATTR_RO(current_link_width);