tty_port_put(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ tty_port_put(9) β€” the kernel API manual, but make it a group chat πŸŽ€

okay so bestie, we're in the kernel API manual (section 9, the fun one) and today's main character is tty_port_put πŸ’…


🌸 NAME 🌸

tty_port_put β€” drop a reference to tty_port


πŸ¦‹ SYNOPSIS πŸ¦‹

void tty_port_put (struct tty_port *port );

πŸ’– ARGUMENTS πŸ’–

  • port β€” the port you're dropping a reference of (and yes bestie, it can be NULL 🫢)

✨ DESCRIPTION ✨

So here's the tea πŸ“: that final put is the one that actually destroys and frees up the port. Not me being dramatic, that's just literally what it does 😭

And how does it do the freeing? Two paths, iykyk:

  • it uses the port->ops->destruct hook, or
  • it just uses kfree if that hook isn't provided.

Either way, the last reference walking out the door is the one that cleans up. Iconic behavior honestly πŸ‘‘


🌈 SEE ALSO 🌈

Kernel file ./drivers/tty/tty_port.c and the whole tty_port squad, all linked up:


ngl, when that final put lands you better not be holding any other references, because this is the one that actually frees the port πŸ’€ the port->ops->destruct hook is your moment to shine, otherwise it's plain old kfree doing the honors πŸ™ˆ

and that's a wrap bestie 🧚 this page lives in ./drivers/tty, dated October 2026, and it's part of the kernel API manual β€” slay, go free some ports responsibly πŸ’œπŸŽ€

πŸ“¦ where this page comes from