diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-11-15 13:29:02 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2021-11-15 14:01:11 -0600 |
commit | d2c64f98c3878b25e987b6b8f5100732c6426640 (patch) | |
tree | 3b84cde4fe930424e0a6d826384f2310bd016e54 | |
parent | fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf (diff) | |
download | linux-d2c64f98c3878b25e987b6b8f5100732c6426640.tar.bz2 |
PCI: Use pci_find_vsec_capability() when looking for TBT devices
Currently set_pcie_thunderbolt() open-codes pci_find_vsec_capability().
Refactor the former to use the latter. No functional change intended.
Link: https://lore.kernel.org/r/20211115112902.24033-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Krzysztof WilczyĆski <kw@linux.com>
-rw-r--r-- | drivers/pci/probe.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 087d3658f75c..496c8b8d903c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1579,20 +1579,12 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev) static void set_pcie_thunderbolt(struct pci_dev *dev) { - int vsec = 0; - u32 header; + u16 vsec; - while ((vsec = pci_find_next_ext_capability(dev, vsec, - PCI_EXT_CAP_ID_VNDR))) { - pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER, &header); - - /* Is the device part of a Thunderbolt controller? */ - if (dev->vendor == PCI_VENDOR_ID_INTEL && - PCI_VNDR_HEADER_ID(header) == PCI_VSEC_ID_INTEL_TBT) { - dev->is_thunderbolt = 1; - return; - } - } + /* Is the device part of a Thunderbolt controller? */ + vsec = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, PCI_VSEC_ID_INTEL_TBT); + if (vsec) + dev->is_thunderbolt = 1; } static void set_pcie_untrusted(struct pci_dev *dev) |