of_cpu_device_node_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 🌈

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