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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmBPSJ0gHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBTXA//dmuM9rntxaAm
 fx/cNgoWSnMDC/CBkiDwJULEN4V3aYtPbmTTcqkrHupdhsuHIA++IPExz2ouoGKp
 LQpnN/ELAPlBL4cLrjOw7ywif5UfrBpw8/K6ID6Xeh+Agw6/DfGnSDqCfDIFQHfX
 SKlIANv2q3GtNcqRa8OHkCSNZ2QJUBWaNacxG1Tad9k0rkOta8e86gTAdkyrAkT1
 Pgbac/q/5o4xOFFEjbzTe92CM/3THFDk8gMfjlH47yyJpo08WNttyYmDJB+j+c3w
 CLOIJvs6ObipJEhGq93PJ8nnvUhQ80+5sZmKWU6K+ZCxfFfMAS7PTe8D9lajwtEG
 +AOq0u80X417CNfGH/FbRGuqfN8qBDiFLPZimlSlmOwD5px0l258idmu7JDCIA6b
 G17F5jtfmkEN6tCOtGWvjkq0x+3pK7AysY+8vFrDbTNG0kFT1+s6I+RJJoPxTdh8
 kaxq0uzXwZdAVl3Ddv1zvOICIFy6HVEIyxui5OzHdbWBjTed1wTmpHckLovwZyjq
 yo5udEOjWLAhb8KQ6MP9kSr/H/Il1PzM6lavYhLHHeqFF/tf+hPkCpjxsTZfvd1g
 CM7WFxQNC62ZlslWEpiXUt/7gt0rCg0uN9FtIsTth34TmezMDQLMUN375gs4n8IK
 RLTXJ+8oPuNm0FK8XSFbBSPC4/1g0Rg=
 =1pIT
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Greg Kroah-Hartman 2021-03-15 14:01:52 +01:00
commit 132da018fa
2 changed files with 12 additions and 10 deletions

View File

@ -768,12 +768,6 @@ static int tb_init_port(struct tb_port *port)
tb_dump_port(port->sw->tb, &port->config);
/* Control port does not need HopID allocation */
if (port->port) {
ida_init(&port->in_hopids);
ida_init(&port->out_hopids);
}
INIT_LIST_HEAD(&port->list);
return 0;
@ -1842,10 +1836,8 @@ static void tb_switch_release(struct device *dev)
dma_port_free(sw->dma_port);
tb_switch_for_each_port(sw, port) {
if (!port->disabled) {
ida_destroy(&port->in_hopids);
ida_destroy(&port->out_hopids);
}
ida_destroy(&port->in_hopids);
ida_destroy(&port->out_hopids);
}
kfree(sw->uuid);
@ -2025,6 +2017,12 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent,
/* minimum setup for tb_find_cap and tb_drom_read to work */
sw->ports[i].sw = sw;
sw->ports[i].port = i;
/* Control port does not need HopID allocation */
if (i) {
ida_init(&sw->ports[i].in_hopids);
ida_init(&sw->ports[i].out_hopids);
}
}
ret = tb_switch_find_vse_cap(sw, TB_VSE_CAP_PLUG_EVENTS);

View File

@ -138,6 +138,10 @@ static void tb_discover_tunnels(struct tb_switch *sw)
parent->boot = true;
parent = tb_switch_parent(parent);
}
} else if (tb_tunnel_is_dp(tunnel)) {
/* Keep the domain from powering down */
pm_runtime_get_sync(&tunnel->src_port->sw->dev);
pm_runtime_get_sync(&tunnel->dst_port->sw->dev);
}
list_add_tail(&tunnel->list, &tcm->tunnel_list);