uart_get_divisor(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ uart_get_divisor(9) ✨

okay so real quick β€” this is a page from the Kernel API Manual, and it's all about uart_get_divisor, bestie. it's a tiny little function with one job and honestly it ate πŸ’…


🌸 NAME 🌸

uart_get_divisor β€” returns the uart clock divisor, that's it, that's the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned int uart_get_divisor (struct uart_port *port , unsigned int baud );

like look at her, so compact, so iconic πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • port β€” the uart_port structure that describes the port. she's the main character here, she holds all the info about which port we're talking about 🫢
  • baud β€” the baud rate you actually want. the dream rate. the goal 🌈

⭐ DESCRIPTION ⭐

so what it does: it calculates the divisor for the baud rate you passed in, using baud_base / baud, and it rounds it appropriately. ngl that's the whole thing πŸ’€

and then there's this one little special case, okay, pay attention:

if it's 38400 baud and a custom divisor is selected, it returns the custom divisor instead. not the calculated one. the custom one. periodt πŸ’…

Locking: caller dependent. and yes that means exactly what it sounds like β€” whether any locking happens is on whoever's calling it. no cap, that's your problem, not hers πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

kernel file ./drivers/tty/serial/serial_core.c β€” and honestly the whole friend group is here, so let me introduce everyone:

every single one, no skips, we don't do that here 🧚


and that's the page!! lived in ./drivers/tty/serial, dated October 2026 β€” mwah, sending you off with a kiss, go divide some clocks bestie πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from