of_cpu_device_node_get(9)
π of_cpu_device_node_get β bestie edition π
okay so real talk, this one lives in the Kernel API Manual and it's called of_cpu_device_node_get (say that five times fast, I dare you π« ). It's the little function that goes "hey, which device_node belongs to this logical CPU?" and hands it to you with the refcount already bumped. iconic behaviour, honestly.
β¨ SYNOPSIS β¨
struct device_node * of_cpu_device_node_get (int cpu );
that's it. that's the whole vibe check. π
πΈ ARGUMENTS πΈ
cpuβ the logical CPU number. like, the actual number of the CPU you're asking about. that's the whole thing you pass in. no cap. π
π¦ RETURN π¦
You get back a pointer to the device_node for the CPU β and bestie, listen β its reference count is already incremented for the given logical CPU number. so it's yours, it's counted, handle it accordingly π«Ά.
And if the CPU's device_node isn't found? You get NULL. not found, not your problem, no nodes today π.
fr fr, the increment is the whole point β the return value comes with its reference count incremented, so don't sleep on that.
π SEE ALSO π
- the Kernel file
./drivers/of/cpu.c(yes, that's where the magic lives, go read it π) of_get_cpu_hwid(9)of_get_cpu_node(9)of_cpu_node_to_id(9)of_get_cpu_state_node(9)
like, the whole CPU-nodes friend group. they all hang out together, iykyk π
okay that's the page!! she's giving kernel energy, she's giving refcount realness β
as for the receipts: this gem comes from ./drivers/of, and it's dated October 2026 β yes, the future. main character energy only ππ. and the page you're reading is of_cpu_device_node_get(9), so you can cite her properly at parties πβ¨
mwah, go forth and get those nodes π
π¦ 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