platform_get_irq_optional(9)
π platform_get_irq_optional(9) β the Kernel API Manual, bestie edition π
okay so you're in the kernel API manual, section 9, and the star of the show is platform_get_irq_optional. buckle up, this one's a softie π
β¨ NAME β¨
platform_get_irq_optional β grab an optional interrupt for a device, no drama, no yelling π
π¦ SYNOPSIS π¦
int platform_get_irq_optional (struct platform_device *dev , unsigned
int num );
yes that's the whole signature, she's short and she knows it π
πΈ ARGUMENTS πΈ
devβ the platform device in question. the main character, if you will πnumβ the interrupt number index. like, which irq, bestie π’
π DESCRIPTION π
so this function gets an interrupt for a platform device. that's it, that's the vibe π«Ά
but listen β device drivers should check the return value for errors so as to not pass a negative integer value to the request_irq APIs. like, please do the vibe check on your return value, i'm begging π
this is the same as platform_get_irq, except that it does not print an error message if an interrupt can not be obtained. she's quiet about it. graceful. unbothered. no cap π€«
for example:
int irq = platform_get_irq_optional(pdev, 0);
if (irq < 0)
return irq;
see how we check? that's the whole point. look at us being responsible β¨
π₯ RETURN π₯
- non-zero interrupt number on success π
- negative error number on failure π
that's literally it. she either slays or she hands you a negative number and you deal with it π
π SEE ALSO π
kernel file ./drivers/base/platform.c, plus the whole 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(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)
like, go read them, they're all icons too π
mwah π β this page lives in ./drivers/base, it's dated October 2026, and it's filed under platform_get_irq_optional(9). that's the whole manual page, periodt. go get that irq, bestie π§π
π¦ 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