summaryrefslogtreecommitdiff
path: root/drivers/pci/ats.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2023-10-10 15:44:31 -0500
committerBjorn Helgaas <bhelgaas@google.com>2023-10-24 16:55:45 -0500
commite0701bd0e6669e4c4b0d11254f5948ebf8d0b732 (patch)
treed950d0a938ed95052d4d19aa6a7fa081caccdf37 /drivers/pci/ats.c
parentd30fea25845ff65ea1fb255d7b615cd02b65095b (diff)
PCI/ATS: 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/20231010204436.1000644-6-helgaas@kernel.org Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Diffstat (limited to 'drivers/pci/ats.c')
-rw-r--r--drivers/pci/ats.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index f9cc2e10b676..c570892b2090 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -9,6 +9,7 @@
* Copyright (C) 2011 Advanced Micro Devices,
*/
+#include <linux/bitfield.h>
#include <linux/export.h>
#include <linux/pci-ats.h>
#include <linux/pci.h>
@@ -480,8 +481,6 @@ int pci_pasid_features(struct pci_dev *pdev)
}
EXPORT_SYMBOL_GPL(pci_pasid_features);
-#define PASID_NUMBER_SHIFT 8
-#define PASID_NUMBER_MASK (0x1f << PASID_NUMBER_SHIFT)
/**
* pci_max_pasids - Get maximum number of PASIDs supported by device
* @pdev: PCI device structure
@@ -503,9 +502,7 @@ int pci_max_pasids(struct pci_dev *pdev)
pci_read_config_word(pdev, pasid + PCI_PASID_CAP, &supported);
- supported = (supported & PASID_NUMBER_MASK) >> PASID_NUMBER_SHIFT;
-
- return (1 << supported);
+ return (1 << FIELD_GET(PCI_PASID_CAP_WIDTH, supported));
}
EXPORT_SYMBOL_GPL(pci_max_pasids);
#endif /* CONFIG_PCI_PASID */