aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2018-08-09 16:45:47 -0500
committerBjorn Helgaas <bhelgaas@google.com>2018-08-09 17:47:44 -0500
commit3b269185c19268027ac79388b03c9d7322518e4c (patch)
tree9951c50750fb38742ea3cb63985b4a9bbc30138e /drivers/pci
parentPCI: Add "pci=disable_acs_redir=" parameter for peer-to-peer support (diff)
downloadlinux-dev-3b269185c19268027ac79388b03c9d7322518e4c.tar.xz
linux-dev-3b269185c19268027ac79388b03c9d7322518e4c.zip
PCI: Convert device-specific ACS quirks from NULL termination to ARRAY_SIZE
Convert the search for device-specific ACS enable quirks from searching a NULL-terminated array to iterating through the array, which is always fixed-size anyway. No functional change intended. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> [bhelgaas: changelog, split to separate patch for reviewability] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/quirks.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index f439de848658..823d8e4b4b37 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4560,20 +4560,20 @@ static const struct pci_dev_enable_acs {
} pci_dev_enable_acs[] = {
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_enable_intel_pch_acs },
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_enable_intel_spt_pch_acs },
- { 0 }
};
int pci_dev_specific_enable_acs(struct pci_dev *dev)
{
- const struct pci_dev_enable_acs *i;
- int ret;
+ const struct pci_dev_enable_acs *p;
+ int i, ret;
- for (i = pci_dev_enable_acs; i->enable_acs; i++) {
- if ((i->vendor == dev->vendor ||
- i->vendor == (u16)PCI_ANY_ID) &&
- (i->device == dev->device ||
- i->device == (u16)PCI_ANY_ID)) {
- ret = i->enable_acs(dev);
+ for (i = 0; i < ARRAY_SIZE(pci_dev_enable_acs); i++) {
+ p = &pci_dev_enable_acs[i];
+ if ((p->vendor == dev->vendor ||
+ p->vendor == (u16)PCI_ANY_ID) &&
+ (p->device == dev->device ||
+ p->device == (u16)PCI_ANY_ID)) {
+ ret = p->enable_acs(dev);
if (ret >= 0)
return ret;
}