platform_de...d_alloc_irqs(9)
π platform_device_msi_init_and_alloc_irqs β the glow-up your platform device deserves
okay so bestie, this page is from the Kernel API Manual, and the function name is a whole mouthful β platform_device_msi_init_and_alloc_irqs β but honestly? It's giving "set up my device's interrupts so it can actually slay". Let's get into it. β¨
π SYNOPSIS π
int platform_device_msi_init_and_alloc_irqs (struct device *dev ,
unsigned int nvec , irq_write_msi_msg_t write_msi_msg );
three args, one int coming back at you. no cap, that's the whole vibe. π
πΈ ARGUMENTS πΈ
devβ the device you're doing all this for π«Ά literally the main character here, the one getting interrupts allocated to it.nvecβ the number of interrupts to allocate. yes, nvec like "n vectors" β she's numeric and she's ready. π₯write_msi_msgβ a callback (typeirq_write_msi_msg_t) that writes an interrupt message fordev. you bring the function, she does the writing. π
β RETURN β
- Zero for success π (the good ending)
- or an error code in case of failure π (the not-so-good ending)
π¦ DESCRIPTION π¦
so here's the tea β: this creates a MSI domain on dev, and that new domain has dev->msi.domain as its parent. The parent domain is the one that sets up the new domain β she's the mentor, the new one is the mentee. π§
The domain has a fixed size of nvec β it is not adjustable, it's set, periodt. π
And the best part? The domain is managed by devres β¨ which means it gets removed automatically when the device is removed. no manual cleanup, no leftover mess, we love a self-cleaning situation. π
π SEE ALSO π
- Kernel file
./drivers/base/platform-msi.c platform_device_msi_free_irqs_all(9)β the one that frees them all again, iykyk π₯
lowkey reminder: the domain's size is fixed at nvec, so don't come back later expecting to resize her. she is as she is. π«Ά
anyway that's the whole page, bestie π β big kisses from ./drivers/base, this drop is from October 2026, and it lives in the Kernel API Manual. go forth and allocate those interrupts, you iconic legend πβ¨π
π¦ 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