component_match_add_release(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 will
  • matchptr β€” pointer to the list of component matches. the whole list, not just one entry, okurrr πŸ“‹
  • release β€” release function for compare_data 🧹 this is the one that cleans up after the party
  • compare β€” compare function to match against all components πŸ” it does the vibe check on every single one
  • compare_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 by matchptr must be initialized to NULL before 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 🌈

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