component_match_add(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 by matchptr must be initialized to NULL before adding the first match. do not skip this. this is not optional. the list has to be NULL first, 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