Re: [PATCH v1 1/1] PCI: probe: Use pci_find_vsec_capability() when looking for TBT devices

From: Lukas Wunner
Date: Sun Nov 14 2021 - 01:22:36 EST


On Tue, Nov 09, 2021 at 05:16:04PM +0200, Andy Shevchenko wrote:
> - 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? */

Could you preserve that code comment please so that an uninitiated
reader knows what the is_thunderbolt flag is about?

Thanks!

Lukas

> - if (dev->vendor == PCI_VENDOR_ID_INTEL &&
> - PCI_VNDR_HEADER_ID(header) == PCI_VSEC_ID_INTEL_TBT) {
> - dev->is_thunderbolt = 1;
> - return;
> - }
> - }
> + vsec = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, PCI_VSEC_ID_INTEL_TBT);
> + if (vsec)
> + dev->is_thunderbolt = 1;