devres_open_group(9)
π devres_open_group(9) β from the Kernel API Manual, bestie π
Okay so we're deep in the kernel docs today, specifically the devres_open_group(9) page, and honestly? It's giving "small function, big responsibilities." Let's get into it β¨
πΈ NAME πΈ
devres_open_group β literally just "Open a new devres group." Short king. We stan a concise icon π
π SYNOPSIS π
void * devres_open_group (struct device *dev , void *id , gfp_t gfp );
Three args, one pointer back. No cap, that's the whole signature π«Ά
π¦ ARGUMENTS π¦
devβ the Device you're opening a devres group for. Like, the whole reason we're here πidβ the Separator ID. Yes bestie, it's called that. It separates. It IDs. It's iconic πgfpβ Allocation flags. You know the drill, the flags that tell the allocator how to behave π
β DESCRIPTION β
So what does it actually do? It opens a new devres group for dev with id. Simple. Clean. Periodt.
Now, about that id β the docs have an actual recommendation and I need you to hear it: using a pointer to an object which won't be used for another group is recommended. Translation? Don't be messy with your IDs, bestie π Give each group its own little identity so nothing gets confused.
And if id is NULL? Not a problem, not a crisis β an address-wise unique ID is created. The kernel's got you, it'll make one for you π§β¨
π₯ RETURN π₯
- Returns the ID of the new group π
- Returns
NULLon failure π
So like, always check it. Fr fr.
π SEE ALSO π
Okay this list is long and I'm obsessed with the commitment β here's the whole squad, no one left behind:
- The kernel file
./drivers/base/devres.c __devres_alloc_node(9)devres_for_each_res(9)devres_free(9)devres_add(9)devres_find(9)devres_get(9)devres_remove(9)devres_destroy(9)devres_release(9)devres_release_all(9)devres_close_group(9)devres_remove_group(9)devres_release_group(9)__devm_add_action(9)devm_remove_action_nowarn(9)devm_release_action(9)devm_kmalloc(9)devm_krealloc(9)devm_kstrdup(9)devm_kstrdup_const(9)devm_kvasprintf(9)devm_kasprintf(9)devm_kfree(9)devm_kmemdup(9)devm_kmemdup_const(9)devm_get_free_pages(9)devm_free_pages(9)__devm_alloc_percpu(9)
Read them all, iykyk ππ
Quick vibe check: you did remember that id should be a pointer to something not reused for another group, right? Because that's the one thing the docs went out of their way to recommend. Don't make it weird π
And that's the page, bestie! Brought to you by the fine folks over at ./drivers/base, dated October 2026, and honestly? They ate with this one πβ¨ π
π¦ 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