platform_de...ister_simple(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… platform_device_register_simple ✨

okay so welcome to the Kernel API Manual bestie, this is platform_device_register_simple(9) and it's literally the shortcut for adding a platform-level device and its resources at the same time πŸŽ€


🌸 NAME 🌸

platform_device_register_simple β€” add a platform-level device and its resources 🫢


✨ SYNOPSIS ✨

struct platform_device * platform_device_register_simple (const char
*name , int id , const struct resource *res , unsigned int num );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • name β€” the base name of the device we're adding πŸ’–
  • id β€” the instance id, like which one of these cuties this is πŸ”₯
  • res β€” the set of resources that needs to be allocated for the device, iconic
  • num β€” number of resources, yes bestie you have to count them 🌈

πŸ‘‘ DESCRIPTION πŸ‘‘

So this function creates a simple platform device that requires minimal resource and memory management, which is the whole appeal honestly πŸ’… It comes with a canned release function that frees the memory allocated for the device, and that means drivers using such devices can be unloaded without waiting for the last reference to the device to be dropped 🧚 no cap, that's the good part.

This interface is primarily intended for use with legacy drivers which probe hardware directly ⭐ Like, that's its whole lane. And here's why: because such drivers create sysfs device nodes themselves, rather than letting system infrastructure handle such device enumeration tasks, they don't fully conform to the Linux driver model πŸ™ˆ In particular β€” and this is the part you need to remember β€” when such drivers are built as modules, they can't be "hotplugged" πŸ’€

Returns struct platform_device pointer on success, or ERR_PTR on error πŸ“

ngl that ERR_PTR bit matters, bestie β€” check your return value, don't just vibe forward πŸ’œ

🫢 SEE ALSO 🫢


okay that's the whole page, you ate that πŸ’– this little beauty lives in ./include/linux, dated October 2026, and it's platform_de...ister_simple(9) in the Kernel API Manual forever and always πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from