tb_switch_fi...y_link_depth(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so this is a page from the Kernel API Manual (Linux kernel docs, we love her πŸ’…) and it's all about tb_switch_find_by_link_depth, which is literally the little function that goes "hey, which Thunderbolt switch lives at this link and this depth?" πŸŽ€


✨ NAME ✨

tb_switch_find_by_link_depth β€” find a switch by link and depth 🫢


🌸 SYNOPSIS 🌸

struct tb_switch * tb_switch_find_by_link_depth (struct tb *tb , u8 link
, u8 depth );

that's it. three args. slay.


πŸ’– ARGUMENTS πŸ’–

  • tb β€” the domain the switch belongs to πŸ‘‘ (like, the whole Thunderbolt neighbourhood)
  • link β€” the link number the switch is connected on πŸ”—
  • depth β€” how deep the switch sits in that link, i.e. its depth in the hierarchy πŸͺœ

🧚 DESCRIPTION 🧚

so here's the tea: the switch you get back has its reference count increased 😭 which means the caller legit has to call tb_switch_put when they're done with the switch. no cap, don't forget or you'll be leaking refs and that's not the vibe. 🚩


⭐ RETURN ⭐

a pointer to struct tb_switch πŸ’« β€” or NULL if it's not found πŸ™ˆ (sorry bestie, no switch at that link/depth combo).


πŸ”₯ SEE ALSO πŸ”₯

the kernel file ./drivers/thunderbolt/switch.c and honestly the whole friend group πŸ’€:


πŸ’€ reminder bestie: refcount goes up, tb_switch_put goes in your cleanup path. that's the whole assignment.

okay that's the page!! this one's from the source ./drivers/thunderbolt, dated October 2026, and the header/name up top was tb_switch_fi...y_link_depth(9) β€” yes it's truncated like that, she's mysterious πŸ’œ mwah, go read the kernel file, ily πŸ«ΆπŸŽ€βœ¨

πŸ“¦ where this page comes from