serdev_controller_alloc(9)
β¨ serdev_controller_alloc β¨
okay bestie, welcome to the Kernel API Manual π
and honestly? today's episode is a glow-up in progress: serdev_controller_alloc β the lil function that allocates a brand new serdev controller π like it's literally bringing a new main character into the kernel universe.
πΈ SYNOPSIS πΈ
struct serdev_controller * serdev_controller_alloc (struct device *host , struct device *parent , size_t size );
three args, one icon, no cap π
π¦ ARGUMENTS π¦
hostβ the serial port hardware controller device, aka the actual physical tech that's out here doing the serial port thing π«Άparentβ the parent device, its whole authority figure situation, iykyksizeβ size of private data β¨ the amount of room you're reserving for your own lil secrets
π DESCRIPTION π
so here's the vibe check: this function hands you a freshly allocated controller, and then it just... hands it to you. it does not raise it for you. the caller is responsible, and that responsibility is giving very much chores, not gifts π
you have exactly two paths, bestie, and you gotta pick one:
- call
serdev_controller_addto add the newly allocated controller (slay, it's official now π) - or call
serdev_controller_putto discard it (it's giving breakup arc π)
not me leaving a controller un-added and un-put β do NOT be that girl, that is a leak fr fr π
also, that private data region you just allocated? it's not lost to the void. you can get to it through serdev_controller_get_drvdata β literally the friendliest little access point, obsessed π
π§ SEE ALSO π§
kernel file ./drivers/tty/serdev/core.c plus the whole friend group, in the exact order they appear in the syllabus π
serdev_device_add(9)serdev_device_remove(9)serdev_device_write_buf(9)serdev_device_write(9)serdev_device_alloc(9)of_find_serdev_controller_by_node(9)serdev_acpi_get_uart_resource(9)serdev_controller_add(9)serdev_controller_remove(9)__serdev_device_driver_register(9)
and that's the tea π« this page lives in ./drivers/tty/serdev, it's stamped October 2026, and it came to you courtesy of the Kernel API Manual β go read the whole thing bestie, it's iconic βππ
π¦ 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