component_match_add(9)
π component_match_add β add a component match entry
okay so this is a page from the Kernel API Manual, and the star of the show is component_match_add(9). yes it's a 9, yes that's the kernel section, we move π
β¨ NAME β¨
component_match_add β add a component match entry. that's it, that's the whole vibe, one job, iconic behavior π
πΈ SYNOPSIS πΈ
void component_match_add (struct device *parent , struct component_match
**matchptr , int (*compare)(struct device *, void *) , void
*compare_data );
look at her. four arguments. no return value. she just does it. main character energy fr fr β¨
π¦ ARGUMENTS π¦
parentβ the device that has the aggregate driver. like, this is the one who's gonna need all these components later π«Άmatchptrβ pointer to the list of component matches. the glow-up list πcompareβ the compare function to match against all components. it gets called on everything, she's thorough πcompare_dataβ an opaque pointer that gets passed to the compare function. mystery box, but like, a useful mystery box π
π₯ DESCRIPTION π₯
so what she does is: she adds a new component match to the list stored in matchptr β that's the list the parent aggregate driver needs in order to function at all. no matches, no function. lowkey dramatic but true π
β οΈ bestie listen: the list of component matches pointed to bymatchptrmust be initialized toNULLbefore adding the first match. do not skip this. this is not optional. the list has to beNULLfirst, periodt π
also important: this only matches against components added with component_add. like, don't expect it to match anything else, she's picky in a very specific way β¨
the allocated match list in matchptr is automatically released using devm actions β so yes, you get cleanup for free, no manual free() era, we love a resource-managed queen π
see also component_match_add_release and component_match_add_typed β her two besties, different vibes, same energy π
β SEE ALSO β
- Kernel file
./include/linux/component.h struct component_ops(9)struct component_master_ops(9)
okay that's the whole page bestie, go forth and add those matches πβ¨π¦
signed off with love from the source path ./include/linux, dated October 2026, page component_match_add(9) β ngl that date is giving future, but slay, we're manifesting ππ
π
π¦ 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