uart_port_set_cons(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… uart_port_set_cons β€” the Kernel API Manual, section 9, bestie ✨

Okay so picture this: you're deep in kernel land, section 9 of the manual, and you need to touch the console field of a uart port without everything exploding. That's this function. Welcome. 🫢


✨ NAME ✨

uart_port_set_cons β€” Safely set the @cons field for a uart 🌸

✨ SYNOPSIS ✨

void uart_port_set_cons (struct uart_port *up , struct console *con );

✨ ARGUMENTS ✨

  • up β€” The uart port to set πŸŽ€
  • con β€” The new console to set to πŸ¦‹

✨ DESCRIPTION ✨

Okay so listen, this one's important: this function must be used to set up->cons. Like, not "should", not "ideally" β€” must. πŸ’…

The way it works is it uses the port lock to synchronize with the port lock wrappers, and that's the whole point: it makes sure the console can't change or disappear while another context is holding the port lock. Iconic behavior, honestly. No cap. πŸ”₯

Bestie, fr fr β€” don't go poking up->cons directly. Use this. The lock is doing serious main character work here and you do not want to skip it. 😭

✨ SEE ALSO ✨

Kernel file ./include/linux/serial_core.h:


And that's the whole vibe check, bestie! πŸ’– This little gem lives over in ./include/linux, dated October 2026, and it's filed under uart_port_set_cons(9). Go forth and set your console fields safely β€” slay. πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from