dtpm_create_hierarchy(9)
πΈ dtpm_create_hierarchy(9) πΈ
okay so bestie, welcome to the kernel API manual β this is a section 9 page (that's the kernel internals girlies π
), and today's main character is dtpm_create_hierarchy. buckle up π
β¨ NAME β¨
dtpm_create_hierarchy β Create the dtpm hierarchy π¦
β¨ SYNOPSIS β¨
int dtpm_create_hierarchy (struct of_device_id *dtpm_match_table );
β¨ ARGUMENTS β¨
dtpm_match_tableβ Pointer to the array of device ID structures. that's it, that's the whole argument, she's lowkey simple π«Ά
β¨ DESCRIPTION β¨
so the platform specific code calls this function and hands it the description of the different node in the hierarchy. and what does she do with it? she creates the tree in the sysfs filesystem, under the powercap dtpm entry. iconic behaviour honestly π
the expected tree has the format:
struct dtpm_node hierarchy[] = {
[0] { .name = "topmost", .type = DTPM_NODE_VIRTUAL },
[1] { .name = "package", .type = DTPM_NODE_VIRTUAL, .parent = hierarchy[0] },
[2] { .name = "/cpus/cpu0", .type = DTPM_NODE_DT, .parent = hierarchy[1] },
[3] { .name = "/cpus/cpu1", .type = DTPM_NODE_DT, .parent = hierarchy[1] },
[4] { .name = "/cpus/cpu2", .type = DTPM_NODE_DT, .parent = hierarchy[1] },
[5] { .name = "/cpus/cpu3", .type = DTPM_NODE_DT, .parent = hierarchy[1] },
[6] { }
};
and the last element is always an empty one β that's the little "we're done here" marker that tells everyone the array has ended. do not forget her, fr fr π
β¨ RETURN β¨
- zero on success π
- a negative value in case of error π β and those errors are reported back from the underlying functions, so like, not her fault, she's just the messenger π
β¨ SEE ALSO β¨
- Kernel file
./drivers/powercap/dtpm.c dtpm_update_power(9)dtpm_release_zone(9)dtpm_init(9)dtpm_unregister(9)dtpm_register(9)
go read those too, iykyk π
ngl this one's short and sweet β but the tree structure is the whole vibe, so get those .parent pointers right or the whole hierarchy is gonna be a mess π§
mwah π thanks for reading bestie β this page lives under ./drivers/powercap and it's dated October 2026, so like, she's from the future and she ate βππ
π¦ 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