tb_switch_add(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… tb_switch_add(9) β€” Kernel API Manual ✨

okay so bestie, this one's a kernel API page for tb_switch_add, straight out of the Thunderbolt corner of the kernel. it's giving "final boss of switch setup" energy and honestly? iconic. let's get into it 🫢


🌸 NAME 🌸

tb_switch_add β€” add a switch to the domain πŸ’–


✨ SYNOPSIS ✨

int tb_switch_add (struct tb_switch *sw );

πŸŽ€ ARGUMENTS πŸŽ€

  • sw β€” the switch you're adding. like, the actual switch. that one. πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

so this is the last step in adding a switch to the domain β€” the main character moment, the finale, the "and finally…" of the whole operation. 🌈

what it does: it reads identification information from DROM (yes, DROM, not drama β€” though there is a little of that) and initializes ports so they can be used to connect other switches. so basically it's setting up the ports' whole social life so they can network with other switches. no cap. πŸ”₯

once this function successfully returns, the switch gets exposed to the userspace β€” it's out there, living its best life, visible to everyone. πŸ’…

heads up bestie: when you're done and you wanna remove and release the switch, you call tb_switch_remove. don't just ghost it, okay? 😭

⭐ RETURN ⭐

  • 0 on success πŸŽ‰
  • a negative errno otherwise πŸ’€

that's it. zero is the slay outcome, negative means something went sideways, fr fr.


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/thunderbolt/switch.c, plus literally the entire extended friend group of Thunderbolt functions β€” every single one, no skips, because we don't do that here:


and that's the whole page, bestie 🧚 this lil drop came from the kernel source at ./drivers/thunderbolt, dated October 2026, and it's tb_switch_add(9) all the way down. go forth and add your switches πŸ’œ

πŸ“¦ where this page comes from