serdev_controller_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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, iykyk
  • size β€” 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_add to add the newly allocated controller (slay, it's official now πŸ‘‘)
  • or call serdev_controller_put to 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 πŸ“


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