[PATCH v4 02/14] thunderbolt: Prefix NHI core symbols with tb_ and tb_ring_

From: Chunfeng Yun

Date: Sat Dec 05 2026 - 03:34:30 EST


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() 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).

Rename these functions and symbols to conform to Thunderbolt subsystem
naming conventions before exporting them:

- ring_msix -> tb_ring_msix
- nhi_probe -> tb_nhi_probe
- nhi_pm_ops -> tb_nhi_pm_ops

Signed-off-by: Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx>
---
v4: Dropped renaming of nhi_msi and nhi_shutdown

v3: no changes
v2: new patch
---
drivers/thunderbolt/nhi.c | 8 ++++----
drivers/thunderbolt/nhi.h | 6 +++---
drivers/thunderbolt/pci.c | 6 +++---
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index d998d3caad75..01311ad1f693 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -535,7 +535,7 @@ static void ring_clear_msix(const struct tb_ring *ring)
4 * (ring->nhi->hop_count / 32));
}

-irqreturn_t ring_msix(int irq, void *data)
+irqreturn_t tb_ring_msix(int irq, void *data)
{
struct tb_ring *ring = data;

@@ -935,7 +935,7 @@ void tb_ring_free(struct tb_ring *ring)

/*
* ring->work can no longer be scheduled (it is scheduled only
- * by nhi_interrupt_work, ring_stop and ring_msix). Wait for it
+ * by nhi_interrupt_work, ring_stop and tb_ring_msix). Wait for it
* to finish before freeing the ring.
*/
flush_work(&ring->work);
@@ -1306,7 +1306,7 @@ static struct tb *nhi_select_cm(struct tb_nhi *nhi)
return tb;
}

-int nhi_probe(struct tb_nhi *nhi)
+int tb_nhi_probe(struct tb_nhi *nhi)
{
struct device *dev = nhi->dev;
struct tb *tb;
@@ -1399,7 +1399,7 @@ int nhi_probe(struct tb_nhi *nhi)
* the tunnels asap. A corresponding pci quirk blocks the downstream bridges
* resume_noirq until we are done.
*/
-const struct dev_pm_ops nhi_pm_ops = {
+const struct dev_pm_ops tb_nhi_pm_ops = {
.suspend_noirq = nhi_suspend_noirq,
.resume_noirq = nhi_resume_noirq,
.freeze_noirq = nhi_freeze_noirq, /*
diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
index 88af9ab9fde7..594a38b4225d 100644
--- a/drivers/thunderbolt/nhi.h
+++ b/drivers/thunderbolt/nhi.h
@@ -33,10 +33,10 @@ void nhi_enable_int_throttling(struct tb_nhi *nhi);
void nhi_disable_interrupts(struct tb_nhi *nhi);
void nhi_interrupt_work(struct work_struct *work);
irqreturn_t nhi_msi(int irq, void *data);
-irqreturn_t ring_msix(int irq, void *data);
-int nhi_probe(struct tb_nhi *nhi);
+irqreturn_t tb_ring_msix(int irq, void *data);
+int tb_nhi_probe(struct tb_nhi *nhi);
void nhi_shutdown(struct tb_nhi *nhi);
-extern const struct dev_pm_ops nhi_pm_ops;
+extern const struct dev_pm_ops tb_nhi_pm_ops;

/**
* struct tb_nhi_ops - NHI specific optional operations
diff --git a/drivers/thunderbolt/pci.c b/drivers/thunderbolt/pci.c
index 4408229d8ac7..9cdfadf8b1b7 100644
--- a/drivers/thunderbolt/pci.c
+++ b/drivers/thunderbolt/pci.c
@@ -281,7 +281,7 @@ static int nhi_pci_ring_request_msix(struct tb_ring *ring, bool no_suspend)
ring->irq = ret;

irqflags = no_suspend ? IRQF_NO_SUSPEND : 0;
- ret = request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
+ ret = request_irq(ring->irq, tb_ring_msix, irqflags, "thunderbolt", ring);
if (ret)
goto err_ida_remove;

@@ -588,7 +588,7 @@ static int nhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)

pci_set_master(pdev);

- return nhi_probe(&nhi_pci->nhi);
+ return tb_nhi_probe(&nhi_pci->nhi);
}

static void nhi_pci_do_remove(struct pci_dev *pdev, bool reset)
@@ -724,7 +724,7 @@ static struct pci_driver nhi_driver = {
.probe = nhi_pci_probe,
.remove = nhi_pci_remove,
.shutdown = nhi_pci_shutdown,
- .driver.pm = &nhi_pm_ops,
+ .driver.pm = &tb_nhi_pm_ops,
};

static int __init nhi_init(void)
--
2.45.2