On Fri, Mar 10, 2017 at 2:23 PM, Lukas Wunner <lukas@xxxxxxxxx> wrote: > +/** > + * pci_is_thunderbolt_attached - whether device is on a Thunderbolt daisy chain > + * @pdev: PCI device to check > + * > + * Walk upwards from @pdev and check for each encountered bridge if it's part > + * of a Thunderbolt controller. Reaching the host bridge means @pdev is not > + * Thunderbolt-attached. (But rather soldered to the mainboard usually.) The "soldered to the mainboard" comment is misleading. We'll reach the host bridge and return "false" for any non-Thunderbolt-attached device, including all plug-in PCI and PCIe devices. > + */ > +static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev) > +{ > + struct pci_dev *parent = pdev; > + > + if (pdev->is_thunderbolt) > + return true; > + > + while ((parent = pci_upstream_bridge(parent))) > + if (parent->is_thunderbolt) > + return true; > + > + return false; > +} > + > /* provide the legacy pci_dma_* API */ > #include <linux/pci-dma-compat.h> > > -- > 2.11.0 > _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel