Re: [PATCH v2 1/5] PCI: Recognize Thunderbolt devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 10, 2017 at 02:47:04PM -0600, Bjorn Helgaas wrote:
> 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.

It does say "usually". :-)  Seriously though, for someone coming from one
of the callers of pci_is_thunderbolt_attached() and trying to understand
its meaning, it may not be helpful if I had left it at "Reaching the host
bridge means @pdev is not Thunderbolt-attached."

What is the *consequence* of that?  Most Thunderbolt-equipped products
have no other PCI expansion options, so indeed if the device is not on
a Thunderbolt daisy chain it must be soldered to the mainboard.  If one
wants to be pedantic, one could add that it may alternatively be
soldered to a *daughter*board.  (Which is the case on the MacPro6,1,
the black trashcan.)  I was just trying to strike a balance between
technical correctness, didactic quality and brevity.

Best regards,

Lukas

> 
> > + */
> > +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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux