platform_device_register(9)
π 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 π«Ά:
platform_get_resource(9)devm_platform_get_and_ioremap_resource(9)devm_platform_ioremap_resource(9)devm_platform_ioremap_resource_byname(9)platform_get_irq_affinity(9)platform_get_irq_optional(9)platform_get_irq(9)platform_irq_count(9)devm_platform_get_irqs_affinity(9)platform_get_resource_byname(9)platform_get_irq_byname(9)platform_get_irq_byname_optional(9)platform_add_devices(9)platform_device_put(9)platform_device_alloc(9)platform_device_add_resources(9)platform_device_add_data(9)platform_device_set_of_node(9)platform_device_set_fwnode(9)platform_device_set_of_node_from_dev(9)platform_device_add(9)platform_device_del(9)platform_device_unregister(9)platform_device_register_full(9)__platform_driver_register(9)platform_driver_unregister(9)__platform_driver_probe(9)__platform_create_bundle(9)__platform_register_drivers(9)platform_unregister_drivers(9)platform_match(9)platform_find_device_by_driver(9)
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
- 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