]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: Move PCI_FIND_CAP_TTL to pci.h and use it in quirks
authorWei Yang <weiyang@linux.vnet.ibm.com>
Tue, 30 Jun 2015 01:16:41 +0000 (09:16 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 15 Jul 2015 04:35:36 +0000 (23:35 -0500)
Some quirks search for a HyperTransport capability and use a hard-coded TTL
value of 48 to avoid an infinite loop.

Move the definition of PCI_FIND_CAP_TTL to pci.h and use it instead of the
hard-coded TTL values.

[bhelgaas: changelog]
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/quirks.c

index 0008c950452c31e71f8f591354449980893e58f6..66bd80e7ec127d96952b56067a22782f4a1356a8 100644 (file)
@@ -140,7 +140,6 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
 EXPORT_SYMBOL_GPL(pci_ioremap_bar);
 #endif
 
-#define PCI_FIND_CAP_TTL       48
 
 static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn,
                                   u8 pos, int cap, int *ttl)
index 4ff0ff1c4088ff68f8ca7bb515e54ad382e74680..24ba9dc8910a2ccf7c8735d7c8601e147ad13cb1 100644 (file)
@@ -4,6 +4,8 @@
 #define PCI_CFG_SPACE_SIZE     256
 #define PCI_CFG_SPACE_EXP_SIZE 4096
 
+#define PCI_FIND_CAP_TTL       48
+
 extern const unsigned char pcie_link_speed[];
 
 bool pcie_cap_has_lnkctl(const struct pci_dev *dev);
index 32cc9c802b4740d1df273458c4f7902d4248ad88..683393710bef6edae19ce9f6d1b3498476168e90 100644 (file)
@@ -2247,7 +2247,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x9601, quirk_amd_780_apc_msi);
  * return 1 if a HT MSI capability is found and enabled */
 static int msi_ht_cap_enabled(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
 
        pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
        while (pos && ttl--) {
@@ -2306,7 +2306,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
 /* Force enable MSI mapping capability on HT bridges */
 static void ht_enable_msi_mapping(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
 
        pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
        while (pos && ttl--) {
@@ -2385,7 +2385,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA,
 
 static int ht_check_msi_mapping(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
        int found = 0;
 
        /* check if there is HT MSI cap or enabled on this device */
@@ -2510,7 +2510,7 @@ out:
 
 static void ht_disable_msi_mapping(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
 
        pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
        while (pos && ttl--) {