diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2020-12-04 15:14:07 -0600 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2020-12-04 15:14:07 -0600 |
commit | ee8b1c478a9fbce9c64151ee561c124c4dcd66be (patch) | |
tree | 8334858dc67e42594063c7fa9b97887277a5a4eb /drivers/pci/pci.c | |
parent | f646c2a0a6685a8a30a150509b112c911b8feff3 (diff) | |
download | lwn-ee8b1c478a9fbce9c64151ee561c124c4dcd66be.tar.gz lwn-ee8b1c478a9fbce9c64151ee561c124c4dcd66be.zip |
PCI: Return u16 from pci_find_ext_capability() and similar
PCI Express Extended Capabilities are in config space between offsets 256
and 4K. These offsets all fit in 16 bits.
Change the return type of pci_find_ext_capability() and supporting
functions from int to u16 to match the specification. Many callers use
"int", which is fine, but there's no need to store more than a u16.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b3761e98377b..85cb873266d3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -527,11 +527,11 @@ EXPORT_SYMBOL(pci_bus_find_capability); * not support it. Some capabilities can occur several times, e.g., the * vendor-specific capability, and this provides a way to find them all. */ -int pci_find_next_ext_capability(struct pci_dev *dev, int start, int cap) +u16 pci_find_next_ext_capability(struct pci_dev *dev, u16 start, int cap) { u32 header; int ttl; - int pos = PCI_CFG_SPACE_SIZE; + u16 pos = PCI_CFG_SPACE_SIZE; /* minimum 8 bytes per capability */ ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8; @@ -582,7 +582,7 @@ EXPORT_SYMBOL_GPL(pci_find_next_ext_capability); * %PCI_EXT_CAP_ID_DSN Device Serial Number * %PCI_EXT_CAP_ID_PWR Power Budgeting */ -int pci_find_ext_capability(struct pci_dev *dev, int cap) +u16 pci_find_ext_capability(struct pci_dev *dev, int cap) { return pci_find_next_ext_capability(dev, 0, cap); } |