mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
fa55b7dcdc
commit
d2c64f98c3
1 changed files with 5 additions and 13 deletions
|
@ -1579,20 +1579,12 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
|
||||||
|
|
||||||
static void set_pcie_thunderbolt(struct pci_dev *dev)
|
static void set_pcie_thunderbolt(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
int vsec = 0;
|
u16 vsec;
|
||||||
u32 header;
|
|
||||||
|
|
||||||
while ((vsec = pci_find_next_ext_capability(dev, vsec,
|
/* Is the device part of a Thunderbolt controller? */
|
||||||
PCI_EXT_CAP_ID_VNDR))) {
|
vsec = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, PCI_VSEC_ID_INTEL_TBT);
|
||||||
pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER, &header);
|
if (vsec)
|
||||||
|
dev->is_thunderbolt = 1;
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_pcie_untrusted(struct pci_dev *dev)
|
static void set_pcie_untrusted(struct pci_dev *dev)
|
||||||
|
|
Loading…
Add table
Reference in a new issue