find_next_res(9)
π find_next_res(9)
okay so bestie, this one lives in the Kernel API Manual and it's literally the resource-tree scavenger hunt function. let's get into it π«Ά
β¨ NAME β¨
find_next_res β finds the lowest resource that covers part of [@start..@end]. yes, the lowest, it's giving "first one in line gets it" energy π
π SYNOPSIS π
int find_next_res (struct resource *parent , resource_size_t start ,
resource_size_t end , unsigned long flags , unsigned long desc , struct
resource *res );
πΈ ARGUMENTS πΈ
parentβ the root of the resource tree you're snooping around in π³startβ start address of the resource you're searching forendβ end address of that exact same resourceflagsβ the flags the resource must have (non-negotiable, sorry π)descβ the descriptor the resource must haveresβ return ptr, if a resource gets found π
π¦ DESCRIPTION π¦
so here's the tea, bestie π β if a resource is found, it returns 0 and *res gets overwritten with the part of the resource that's within [start..end]. if none is found? returns -ENODEV. and if your parameters are invalid? -EINVAL, no cap.
the caller must specify start, end, flags, and desc β and yes, desc may be IORES_DESC_NONE, so don't stress about that one π
π SEE ALSO π
kernel file ./kernel/resource.c β and like, the whole resource.c friend group:
request_resource_conflict(9)request_resource(9)release_resource(9)walk_iomem_res_desc(9)region_intersects(9)find_resource_space(9)reallocate_resource(9)allocate_resource(9)lookup_resource(9)insert_resource_conflict(9)insert_resource(9)insert_resource_expand_to_fit(9)remove_resource(9)adjust_resource(9)resource_alignment(9)__request_region(9)__release_region(9)release_mem_region_adjustable(9)merge_system_ram_resource(9)devm_request_resource(9)devm_release_resource(9)devm_request_free_mem_region(9)alloc_free_mem_region(9)
ngl bestie, read the whole squad before you go poking at parent β the resource tree does not play π
and that's the whole page, mwah π this one's from ./kernel, October 2026 β catch you in the next manpage, bestie π§β¨
π¦ 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