acpi_dev_get_next_match_dev(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… acpi_dev_get_next_match_dev(9) β€” like, the next ACPI device match, bestie

okay so this is a page from the Kernel API Manual (section 9, the kernel-api girlies) and the function we're obsessing over is acpi_dev_get_next_match_dev ✨ β€” aka "Return the next match of ACPI device." that's the whole NAME vibe, short and iconic.


✨ SYNOPSIS ✨

struct acpi_device * acpi_dev_get_next_match_dev (struct acpi_device
*adev , const char *hid , const char *uid , s64 hrv );

like yes, that's the whole signature, four args, one struct acpi_device * coming back at you 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • adev β€” Pointer to the previous ACPI device matching this hid, uid and hrv. it's literally "the one before," bestie, you gotta hand her the last match so she can find the next one πŸ’«
  • hid β€” Hardware ID of the device. no notes. πŸ¦‹
  • uid β€” Unique ID of the device β€” pass NULL to not check _UID πŸ™ˆ (opt out, queen)
  • hrv β€” Hardware Revision of the device β€” pass -1 to not check _HRV πŸ’€ (same energy, just don't check it)

🌸 DESCRIPTION 🌸

so here's the teaaaa: she returns the next match of an ACPI device if another matching device was present at the moment of invocation, or NULL otherwise. that's it, that's the function. no cap. ⭐

now the part you actually need to remember, and I'm saying this with love 🫢:

the caller is responsible for invoking acpi_dev_put on the returned device. meanwhile, the function itself invokes acpi_dev_put on the given adev, assuming that its reference counter had been increased beforehand. 🧚

so like, refcount bookkeeping is your job, main character β€” she's just doing her part on adev and trusting you did yours πŸ’…

and fr fr, go read acpi_dev_present for additional information as well β€” there's more lore there πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/acpi/utils.c and, like, the whole friend group:


ngl, if you made it this far you're lowkey a kernel dev now. slay. πŸ‘‘

and that's a wrap, bestie πŸ’– this one ships from ./drivers/acpi, dated October 2026, and the page answers to the name acpi_dev_get_next_match_dev(9) β€” k bye, mwah πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from