component_match_add_release(9)
π component_match_add_release(9) β¨
okay bestie, so this one is from the Kernel API Manual and it's literally called component_match_add_release. yes that's a mouthful, no we're not changing it. let's get into it π«Ά
πΈ NAME πΈ
component_match_add_release β adds a component match entry, but make it with a release callback π
β¨ SYNOPSIS β¨
void component_match_add_release (struct device *parent , struct component_match **matchptr , void (*release)(struct device *, void *) , int (*compare)(struct device *, void *) , void *compare_data );
like, yes, that's a lot of arguments. deep breaths. we'll go through them one by one π
π¦ ARGUMENTS π¦
parentβ the parent device of the aggregate driver π the main character, if you willmatchptrβ pointer to the list of component matches. the whole list, not just one entry, okurrr πreleaseβ release function forcompare_dataπ§Ή this is the one that cleans up after the partycompareβ compare function to match against all components π it does the vibe check on every single onecompare_dataβ opaque pointer that gets passed to the compare function π opaque means we don't look inside, we just hand it over, iykyk
π DESCRIPTION π
So what it does: it adds a new component match to the list stored in matchptr, which the aggregate driver needs to function β¨
β οΈ ok important: the list of component matches pointed to bymatchptrmust be initialized toNULLbefore adding the first match. like, do that first. fr fr. no cap.
Also, this only matches against components added with component_add π β not the typed ones, bestie, keep that straight.
The allocated match list in matchptr is automatically released using devm actions πͺ and upon release, release gets called to free any references held by compare_data. the example: when compare_data is a device_node that must be released with of_node_put π
And if you want to see the cousins of this function, they're component_match_add and component_match_add_typed β the whole family is iconic honestly π
π SEE ALSO π
- Kernel file
./drivers/base/component.coverview(9) component_compare_of(9)component_release_of(9)component_compare_dev(9)component_compare_dev_name(9)component_match_add_typed(9)component_master_add_with_match(9)component_master_del(9)component_unbind_all(9)component_bind_all(9)component_add_typed(9)component_add(9)component_del(9)
like, the whole friend group, slay π₯
and that's the page!! πβ¨π this little gem lives in ./drivers/base, it's dated October 2026, and it's filed under component_match_add_release(9) β go forth and match some components, bestie, you're gonna eat π¦π
π
π¦ 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