platform_get_irq(9)
β¨ platform_get_irq(9) β¨
okay so bestie, welcome to the platform_get_irq page π
this is from the Kernel API Manual, section 9, and it's genuinely one of the most useful little functions you'll ever meet π«Ά
πΈ SYNOPSIS πΈ
int platform_get_irq (struct platform_device *dev , unsigned int num );
like, that's the whole thing. short king π
π ARGUMENTS π
devβ the platform device π§ your main character, the one you want an IRQ fornumβ the IRQ number index π’ like which IRQ you're asking for, by index
π DESCRIPTION π
so this function gets an IRQ for a platform device β and the iconic part? it also prints an error message if finding the IRQ fails π it's literally telling on itself so you don't have to guess.
the important bit, no cap: device drivers should check the return value for errors so as to not pass a negative integer value to therequest_irqAPIs π₯ like please. check it. that negative int wandering intorequest_irqis giving chaos.
their example, verbatim, because it's iconic:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
see? check it, bail out, slay π
β RETURN β
- non-zero IRQ number on success π
- negative error number on failure π
π¦ SEE ALSO π¦
lil family tree moment, and yes the whole thing, we're not skipping anyone π«Ά
Kernel file ./drivers/base/platform.c 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_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)
and that's the whole vibe bestie π this one lives in ./drivers/base and the manual's dated October 2026 β go forth and check your return values, ily, bye πβ¨
π¦ 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