acpi_dev_get_resources(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ acpi_dev_get_resources ✨

okay bestie, so this is a page from the Kernel API Manual (yes, the acpi_dev_get_resources(9) one, we're getting fancy today πŸ‘‘) and it's literally all about pulling the current resources of a device. no cap, it's giving "let me see what you're working with" energy πŸ’…


🌸 SYNOPSIS 🌸

int acpi_dev_get_resources (struct acpi_device *adev , struct list_head
*list , int (*preproc)(struct acpi_resource *, void *) , void
*preproc_data );

like, that's the whole vibe of the call. four args, one int coming back at you, slay ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • adev β€” the ACPI device node we're getting the resources for. the main character of this whole operation 🫢
  • list β€” head of the resultant list of resources. heads up: this has to be empty already, it's not optional, don't come at it with a full list πŸ™ˆ
  • preproc β€” the caller's preprocessing routine. your little callback bestie.
  • preproc_data β€” a pointer that gets passed along to your preprocessing routine. like a little gift basket you hand over 🎁

πŸ’– DESCRIPTION πŸ’–

so here's what actually goes down: it evaluates the _CRS method for the given device node, then processes that output in two steps:

  1. it executes the preproc routine you (the caller) provided β€” passing the resource pointer and preproc_data to it as arguments β€” for each ACPI resource that comes back, and
  2. it converts all of the returned ACPI resources into struct resource objects if possible.

and here's the part you gotta pay attention to πŸ‘€ β€” if the return value of preproc in step (1) is different from 0, then step (2) is not applied to that given ACPI resource. and if that value is negative, the whole processing is aborted and that value is returned as the final error code. like, everything stops. dead. πŸ’€ so keep your preproc returns clean, bestie.

the resultant struct resource objects are put on the list pointed to by list β€” and again, that list must be empty initially β€” as members of struct resource_entry objects. if you're calling this routine, you should use acpi_dev_free_resource_list to free that list. don't forget. seriously. free your list, love yourself 🧚

on success you get back the number of resources in the output list. otherwise you get an error code reflecting the error condition. that's it, that's the whole deal ⭐


πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./drivers/acpi/resource.c β€” and the whole friend group:


lowkey the whole squad is in that list. go read them. iykyk πŸ’œ

k bye bestie, this page came from ./drivers/acpi, dated October 2026, and it's the acpi_dev_get_resources(9) entry in the Kernel API Manual. go forth and get those resources πŸ”₯πŸ’–

πŸ“¦ where this page comes from