tty_port_open(9)
π tty_port_open(9) π
okay so bestie, welcome to the Kernel API Manual β this is the page for tty_port_open(9), and honestly? it's kind of the main character of tty opening. let's get into it β¨
πΈ NAME πΈ
tty_port_open β the generic tty->ops->open handler π
β¨ SYNOPSIS β¨
int tty_port_open (struct tty_port *port , struct tty_struct *tty ,
struct file *filp );
π¦ ARGUMENTS π¦
portβ thetty_portof the device, like its lil home base πttyβ thettythat's getting opened, the one we're here for πfilpβ the file pointer that got passed in π«Ά
π DESCRIPTION π
so this is a generic helper β the whole point is that you drop it into your driver's tty->ops->open and it handles the vibe check for you. it activates the devices using port->ops->activate (only if they're not already active, no double-dipping π), and then it waits for the device to be ready using tty_port_block_til_ready β which is the part where it, like, raises DTR/CTS and waits for carrier. very "are you there bestie?" energy π
β οΈ heads up:port->ops->shutdownis not called whenport->ops->activatereturns an error. on the contrary,tty->ops->closeis called. so don't get it twisted π
Locking: the caller holds the tty lock. no cap, that's the rule π
β NOTE β
it may drop and reacquire the tty lock (this happens in tty_port_block_til_ready), which means tty and port may have changed state while you weren't looking β like, they may be hung up now π so don't assume everything's the same as when you left it, fr fr
π SEE ALSO π
Kernel file ./drivers/tty/tty_port.c
and the whole friend group π:
tty_port_init(9)tty_port_link_wq(9)tty_port_link_device(9)tty_port_register_device(9)tty_port_register_device_attr(9)tty_port_register_device_attr_serdev(9)tty_port_unregister_device(9)tty_port_destroy(9)tty_port_put(9)tty_port_tty_get(9)tty_port_tty_set(9)tty_port_shutdown(9)tty_port_hangup(9)tty_port_tty_hangup(9)tty_port_tty_vhangup(9)tty_port_tty_wakeup(9)tty_port_carrier_raised(9)tty_port_raise_dtr_rts(9)tty_port_lower_dtr_rts(9)tty_port_block_til_ready(9)tty_port_close_start(9)tty_port_close_end(9)tty_port_close(9)tty_port_install(9)
anyway that's the page bestie π«Ά this one lives in ./drivers/tty and it's dated October 2026 β so yeah, slightly future-coded of it, iconic honestly π
β¨ bye!! π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms