acpi_dev_get_resources(9)
β¨ 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:
- it executes the
preprocroutine you (the caller) provided β passing the resource pointer andpreproc_datato it as arguments β for each ACPI resource that comes back, and - it converts all of the returned ACPI resources into
struct resourceobjects 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:
acpi_dev_resource_memory(9)acpi_dev_resource_io(9)acpi_dev_resource_address_space(9)acpi_dev_resource_ext_address_space(9)acpi_dev_irq_flags(9)acpi_dev_get_irq_type(9)acpi_dev_resource_interrupt(9)acpi_dev_free_resource_list(9)acpi_dev_get_dma_resources(9)acpi_dev_get_memory_resources(9)acpi_dev_filter_resource_type(9)acpi_resource_consumer(9)
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
- 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