Re: [PATCH RFC/RFT 1/3] thunderbolt: Move pci_device out of tb_nhi
From: Mika Westerberg
Date: Mon Mar 09 2026 - 07:50:36 EST
On Mon, Mar 09, 2026 at 11:32:59AM +0100, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>
> Not all USB4/TB implementations are based on a PCIe-attached
> controller. In order to make way for these, start off with moving the
> pci_device reference out of the main tb_nhi structure.
>
> Encapsulate the existing struct in a new tb_nhi_pci, that shall also
> house all properties that relate to the parent bus. Similarly, any
> other type of controller will be expected to contain tb_nhi as a
> member.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> ---
> drivers/thunderbolt/acpi.c | 14 +--
> drivers/thunderbolt/ctl.c | 14 +--
> drivers/thunderbolt/domain.c | 2 +-
> drivers/thunderbolt/eeprom.c | 2 +-
> drivers/thunderbolt/icm.c | 25 ++--
> drivers/thunderbolt/nhi.c | 247 ++++++++++++++++++++++++++++++----------
> drivers/thunderbolt/nhi.h | 11 ++
> drivers/thunderbolt/nhi_ops.c | 29 +++--
> drivers/thunderbolt/nhi_pci.h | 20 ++++
I think this patch should just make the nhi->pdev to be nhi->dev.
If there is a header needed it should be called pci.h and the corresponding
implementation pci.c (ditto for the non-PCI: platform.c).
Further more there is no need to keep the struct pci_dev anywhere we can
get that with to_pci_dev() and that allows both implementations share the
same struct nhi (no need a separate structs).