提交 3b269185 编写于 作者: L Logan Gunthorpe 提交者: Bjorn Helgaas

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: NLogan Gunthorpe <logang@deltatee.com>
[bhelgaas: changelog, split to separate patch for reviewability]
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NAlex Williamson <alex.williamson@redhat.com>
上级 aaca43fd
...@@ -4560,20 +4560,20 @@ static const struct pci_dev_enable_acs { ...@@ -4560,20 +4560,20 @@ static const struct pci_dev_enable_acs {
} 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_pch_acs },
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_enable_intel_spt_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) int pci_dev_specific_enable_acs(struct pci_dev *dev)
{ {
const struct pci_dev_enable_acs *i; const struct pci_dev_enable_acs *p;
int ret; int i, ret;
for (i = pci_dev_enable_acs; i->enable_acs; i++) { for (i = 0; i < ARRAY_SIZE(pci_dev_enable_acs); i++) {
if ((i->vendor == dev->vendor || p = &pci_dev_enable_acs[i];
i->vendor == (u16)PCI_ANY_ID) && if ((p->vendor == dev->vendor ||
(i->device == dev->device || p->vendor == (u16)PCI_ANY_ID) &&
i->device == (u16)PCI_ANY_ID)) { (p->device == dev->device ||
ret = i->enable_acs(dev); p->device == (u16)PCI_ANY_ID)) {
ret = p->enable_acs(dev);
if (ret >= 0) if (ret >= 0)
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册