diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2022-12-27 10:17:48 +0300 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2023-08-08 08:13:11 +0300 |
commit | 408e1d965a1d5ff37d08cf7c1017516418912931 (patch) | |
tree | 9cb266307efb78b19c72a7a19ff299dd994857f7 /drivers/thunderbolt/tb.c | |
parent | 6dacc6db4628af3fdc0627dca6dd6104ec9138ed (diff) | |
download | linux-408e1d965a1d5ff37d08cf7c1017516418912931.tar.xz |
thunderbolt: Log a warning if device links are not found
The software connection manager needs the device links in order to
establish the tunnels before the native protocols so log a warning if
they are not found.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tb.c')
-rw-r--r-- | drivers/thunderbolt/tb.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 62b26b7998fd..ffbae134589b 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -2366,12 +2366,13 @@ static const struct tb_cm_ops tb_cm_ops = { * downstream ports and the NHI so that the device core will make sure * NHI is resumed first before the rest. */ -static void tb_apple_add_links(struct tb_nhi *nhi) +static bool tb_apple_add_links(struct tb_nhi *nhi) { struct pci_dev *upstream, *pdev; + bool ret; if (!x86_apple_machine) - return; + return false; switch (nhi->pdev->device) { case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE: @@ -2380,26 +2381,27 @@ static void tb_apple_add_links(struct tb_nhi *nhi) case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: break; default: - return; + return false; } upstream = pci_upstream_bridge(nhi->pdev); while (upstream) { if (!pci_is_pcie(upstream)) - return; + return false; if (pci_pcie_type(upstream) == PCI_EXP_TYPE_UPSTREAM) break; upstream = pci_upstream_bridge(upstream); } if (!upstream) - return; + return false; /* * For each hotplug downstream port, create add device link * back to NHI so that PCIe tunnels can be re-established after * sleep. */ + ret = false; for_each_pci_bridge(pdev, upstream->subordinate) { const struct device_link *link; @@ -2415,11 +2417,14 @@ static void tb_apple_add_links(struct tb_nhi *nhi) if (link) { dev_dbg(&nhi->pdev->dev, "created link from %s\n", dev_name(&pdev->dev)); + ret = true; } else { dev_warn(&nhi->pdev->dev, "device link creation from %s failed\n", dev_name(&pdev->dev)); } } + + return ret; } struct tb *tb_probe(struct tb_nhi *nhi) @@ -2446,8 +2451,13 @@ struct tb *tb_probe(struct tb_nhi *nhi) tb_dbg(tb, "using software connection manager\n"); - tb_apple_add_links(nhi); - tb_acpi_add_links(nhi); + /* + * Device links are needed to make sure we establish tunnels + * before the PCIe/USB stack is resumed so complain here if we + * found them missing. + */ + if (!tb_apple_add_links(nhi) && !tb_acpi_add_links(nhi)) + tb_warn(tb, "device links to tunneled native ports are missing!\n"); return tb; } |