Skip to content

Commit 8a03955

Browse files
committed
PCI/portdrv: Use FIELD_GET()
Use FIELD_GET() to remove dependences on the field position, i.e., the shift value. No functional change intended. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]>
1 parent cf17770 commit 8a03955

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/pci/pcie/portdrv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Copyright (C) Tom Long Nguyen ([email protected])
77
*/
88

9+
#include <linux/bitfield.h>
910
#include <linux/dmi.h>
1011
#include <linux/init.h>
1112
#include <linux/module.h>
@@ -69,7 +70,7 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
6970
if (mask & (PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP |
7071
PCIE_PORT_SERVICE_BWNOTIF)) {
7172
pcie_capability_read_word(dev, PCI_EXP_FLAGS, &reg16);
72-
*pme = (reg16 & PCI_EXP_FLAGS_IRQ) >> 9;
73+
*pme = FIELD_GET(PCI_EXP_FLAGS_IRQ, reg16);
7374
nvec = *pme + 1;
7475
}
7576

@@ -81,7 +82,7 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
8182
if (pos) {
8283
pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS,
8384
&reg32);
84-
*aer = (reg32 & PCI_ERR_ROOT_AER_IRQ) >> 27;
85+
*aer = FIELD_GET(PCI_ERR_ROOT_AER_IRQ, reg32);
8586
nvec = max(nvec, *aer + 1);
8687
}
8788
}
@@ -92,7 +93,7 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
9293
if (pos) {
9394
pci_read_config_word(dev, pos + PCI_EXP_DPC_CAP,
9495
&reg16);
95-
*dpc = reg16 & PCI_EXP_DPC_IRQ;
96+
*dpc = FIELD_GET(PCI_EXP_DPC_IRQ, reg16);
9697
nvec = max(nvec, *dpc + 1);
9798
}
9899
}

0 commit comments

Comments
 (0)