platform_device_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… platform_device_register β€” Kernel API Manual ✨

okay so bestie, buckle in, because this one is a <hotpink>Kernel API Manual</hotpink> classic and it's literally about adding a platform-level device to the kernel. yes we're doing that today. no cap.


🌸 NAME 🌸

platform_device_register β€” add a platform-level device ✨


πŸŽ€ SYNOPSIS πŸŽ€

int platform_device_register (struct platform_device *pdev );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • pdev β€” the platform device we're adding 🫢 like, this is the actual device you're putting out into the world. main character energy fr.

πŸ’€ NOTE πŸ’€ (read this one, i'm begging)

Never β€” and i mean Never with the dramatic italics β€” directly free pdev after calling this function, even if it returned an error! 😭 Like even the error path, okay? Yes. Even then.

Always use platform_device_put to give up the reference that got initialised in this function instead. That's the whole vibe check. platform_device_put. Not kfree. Not vibes. platform_device_put. periodt πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/base/platform.c β€” the source, the origin, the mothership ✨

And like, the entire extended friend group 🫢:


okay that's the whole page bestie, you ate that πŸ’–

little sign-off moment πŸŽ€ β€” this one lives over in ./drivers/base, dated October 2026, and it's page platform_device_register(9). slay, go register a device responsibly πŸ¦‹βœ¨

πŸ“¦ where this page comes from