Skip to content

Commit 132da01

Browse files
committed
Merge tag 'thunderbolt-for-v5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus
Mika writes: thunderbolt: Fixes for v5.12-rc4 This includes a fix to initialize HopID IDAs earlier to make sure tb_switch_release() always works, and another fix that increases runtime PM reference count on DisplayPort tunnel discovery. * tag 'thunderbolt-for-v5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Increase runtime PM reference count on DP tunnel discovery thunderbolt: Initialize HopID IDAs in tb_switch_alloc()
2 parents 1e28eed + c94732b commit 132da01

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

drivers/thunderbolt/switch.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -768,12 +768,6 @@ static int tb_init_port(struct tb_port *port)
768768

769769
tb_dump_port(port->sw->tb, &port->config);
770770

771-
/* Control port does not need HopID allocation */
772-
if (port->port) {
773-
ida_init(&port->in_hopids);
774-
ida_init(&port->out_hopids);
775-
}
776-
777771
INIT_LIST_HEAD(&port->list);
778772
return 0;
779773

@@ -1842,10 +1836,8 @@ static void tb_switch_release(struct device *dev)
18421836
dma_port_free(sw->dma_port);
18431837

18441838
tb_switch_for_each_port(sw, port) {
1845-
if (!port->disabled) {
1846-
ida_destroy(&port->in_hopids);
1847-
ida_destroy(&port->out_hopids);
1848-
}
1839+
ida_destroy(&port->in_hopids);
1840+
ida_destroy(&port->out_hopids);
18491841
}
18501842

18511843
kfree(sw->uuid);
@@ -2025,6 +2017,12 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent,
20252017
/* minimum setup for tb_find_cap and tb_drom_read to work */
20262018
sw->ports[i].sw = sw;
20272019
sw->ports[i].port = i;
2020+
2021+
/* Control port does not need HopID allocation */
2022+
if (i) {
2023+
ida_init(&sw->ports[i].in_hopids);
2024+
ida_init(&sw->ports[i].out_hopids);
2025+
}
20282026
}
20292027

20302028
ret = tb_switch_find_vse_cap(sw, TB_VSE_CAP_PLUG_EVENTS);

drivers/thunderbolt/tb.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ static void tb_discover_tunnels(struct tb_switch *sw)
138138
parent->boot = true;
139139
parent = tb_switch_parent(parent);
140140
}
141+
} else if (tb_tunnel_is_dp(tunnel)) {
142+
/* Keep the domain from powering down */
143+
pm_runtime_get_sync(&tunnel->src_port->sw->dev);
144+
pm_runtime_get_sync(&tunnel->dst_port->sw->dev);
141145
}
142146

143147
list_add_tail(&tunnel->list, &tcm->tunnel_list);

0 commit comments

Comments
 (0)