devm_platfor...map_resource(9)
π NAME π
devm_platform_get_and_ioremap_resource β bestie, this one literally calls devm_ioremap_resource() for a platform device and hands you back the resource. two-for-one, no cap β¨
This page lives in the Kernel API Manual, and it's giving "small function, big job" energy. π«Ά
πΈ SYNOPSIS πΈ
void __iomem * devm_platform_get_and_ioremap_resource (struct
platform_device *pdev , unsigned int index , struct resource **res );
ok so it returns a void __iomem *, takes three things, and yes the formatting is exactly like that. don't come for me, I don't make the rules π
π ARGUMENTS π
pdevβ the platform device. it's the main character here: used both for looking up the memory resource and for the resource management. one struct, two jobs, she's booked and busy πindexβ the resource index. which one you want. the number, the vibe check, the iykyk. π’resβ optional output parameter, and it stores a pointer to the obtained resource. optional!! so if you don't care, you can absolutely pass nothing and mind your business π
β RETURN β
you get back a pointer to the remapped memory π β or, if things go sideways, an ERR_PTR encoded error code. so like, check it. fr fr. don't just start dereferencing and hope π
π¦ SEE ALSO π¦
the Kernel file is ./drivers/base/platform.c β that's where the magic lives. and here's the whole friend group, everyone invited to the group chat π:
platform_get_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_register(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)
β¨ that's the whole page, bestie β¨ straight from ./drivers/base, dated October 2026, and the title up top is still devm_platfor...map_resource(9) because the truncation is iconic and we respect it π
ππ
π¦ 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