uart_port_set_cons(9)
π 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:
struct uart_ops(9)uart_port_lock(9)uart_port_lock_irq(9)uart_port_lock_irqsave(9)uart_port_trylock(9)uart_port_trylock_irqsave(9)uart_port_unlock(9)uart_port_unlock_irq(9)uart_port_unlock_irqrestore(9)enum uart_pm_state(9)uart_xmit_advance(9)enum UART_TX_FLAGS(9)uart_port_tx_limited(9)uart_port_tx_limited_flags(9)uart_port_tx(9)uart_port_tx_flags(9)
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
- 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