platform_get_irq_optional(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ 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:

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