Re: [PATCH v3 1/8] thunderbolt: Prefix NHI core functions with tb_ and tb_ring_

From: Chunfeng Yun (云春峰)

Date: Thu Nov 26 2026 - 02:58:50 EST


On 三, 2026-11-25 at 13:03 +0100, mika.westerberg@xxxxxxxxxxxxxxx wrote:
> On Wed, Nov 25, 2026 at 08:13:00AM +0100,
> mika.westerberg@xxxxxxxxxxxxxxx wrote:
> > On Wed, Nov 25, 2026 at 06:43:38AM +0000, Chunfeng Yun (云春峰) wrote:
> > > On 二, 2026-11-24 at 17:11 +0100, Mika Westerberg wrote:
> > > > On Mon, Nov 23, 2026 at 07:36:48PM +0800, Chunfeng Yun wrote:
> > > > > In preparation for modularizing PCIe NHI support and allowing
> > > > > PCIe
> > > > > and platform NHI drivers to be built as separate modules atop
> > > > > the
> > > > > Thunderbolt core framework, several NHI functions and
> > > > > structures
> > > > > will
> > > > > need to be exported.
> > > > >
> > > > > Currently, several of these functions lack standard subsystem
> > > > > prefixes,
> > > > > risking namespace pollution or collisions across the flat
> > > > > kernel
> > > > > symbol
> > > > > namespace:
> > > > >
> > > > > - ring_msix() lacks any subsystem prefix and diverges from
> > > > > all
> > > > > other
> > > > >   exported ring functions in the driver, which use the
> > > > > "tb_ring_"
> > > > > prefix.
> > > > > - nhi_probe(), nhi_shutdown(), and nhi_pm_ops lack the
> > > > > standard
> > > > > "tb_"
> > > > >   prefix used across the Thunderbolt public interface (such
> > > > > as
> > > > > struct
> > > > >   tb_nhi and struct tb_nhi_ops).
> > > > > - nhi_msi() is named after PCI MSI, even though the ISR
> > > > > simply
> > > > > schedules
> > > > >   the interrupt work and can serve as a generic ISR for non-
> > > > > PCIe
> > > > > platform
> > > > >   controllers as well.
> > > > >
> > > > > Rename these functions and symbols to conform to Thunderbolt
> > > > > subsystem
> > > > > naming conventions before exporting them:
> > > > >
> > > > > - ring_msix       -> tb_ring_msix
> > > >
> > > > I think we can move MSI-X completely to pci.c. As far as I can
> > > > tell
> > > > ARM
> > > > stuff is not going to need that. While there we can drop MSI,
> > > > that
> > > > has been
> > > > never used (MSI-X was supported from day 0 by the HW).
> > > If move MSI-X completely to pci.c, then will rename and export
> > > another
> > > two functions:
> > > __ring_interrupt()
> > > ring_interrupt_index()
> > >
> > > is it fine for you?
> >
> > No that's even worse :( But I was thinking that we can do the same
> > for MSIX
> > as for regular interrupt in nhi.c:
> >
> >   nhi->irq set -> request_irq() for that
> >   ring->irq set -> request_irq() for that
> >
> > This would hopefully limit the number of functions we need to
> > export. Maybe
> > it allows us to get rid of the .request_ring_irq and the like in
> > the
> > tb_nhi_ops?
>
> I realized we cannot do this for MSIX because we allocate them on-
> demand so
> the callbacks need to stay. 
Yes, tb_ring_alloc() may use it

> However, we can avoid exporting ring_msix if we
> make ->ring_request_msix() return the interrupt number.
Sure, will do it for single interrupt

Thanks