of_genpd_parse_idle_states(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_genpd_parse_idle_states β€” Kernel API Manual, section 9 ✨

okay so bestie, welcome to the group chat where we learn about the kernel's power-domain idle-state parser. this one lives in the 9 section of the Kernel API Manual and honestly? it's giving "quiet little helper that does a LOT." let's get into it 🫢


🌸 NAME 🌸

of_genpd_parse_idle_states β€” literally just: return an array of idle states for the genpd. that's the whole vibe. no cap. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

int of_genpd_parse_idle_states (struct device_node *dn , struct
       genpd_power_state **states , int *n );

yes it's all on one line and yes the wrapping is doing the most, but that's the exact signature so we're keeping it, periodt. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • dn β€” the genpd device node. this is the main character of the operation, the node we're reading all the tea from 🌈
  • states β€” the pointer to which the state array will be saved. so you hand it a pointer-to-pointer and it fills it in for you. iconic behaviour tbh πŸ‘‘
  • n β€” the count of elements in the array returned from this function. so it tells you how many states you actually got back, which is extremely helpful of it ngl πŸ“

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea β˜• β€” this function returns the device states parsed from the OF node. it goes and reads the node, does its parsing thing, and hands you back the idle states.

important money moment: the memory for the states is allocated by this function, and it is the responsibility of the caller to free the memory after use. so like… you asked for it, you clean it up. no leaving your allocation mess in the group chat, bestie πŸ§ΉπŸ’€

and here's the return-value lore:

  • if any or zero compatible domain idle states is found β†’ it returns 0. yes, zero states still counts as a success. it's not a bug, it's a vibe check passing βœ…
  • in case of errors β†’ a negative error code is returned. so if you see a negative number, something went sideways, and you should go look at it with concern 😭
⚠️ lowkey really don't forget the free. the kernel will not send you a cute reminder. it will just be sad and leaky. you've been warned 🫢

🌟 SEE ALSO 🌟

the kernel file for all of this goodness lives at ./drivers/pmdomain/core.c β€” that's the source, that's where the magic is 🧚

and because genpd has a huge friend group, here's the entire crew, no one left out, fr fr:

like, that is a whole squad. iykyk πŸ’œ


okay that's the whole page bestie, go forth and free your allocations 🌈

this one came from ./drivers/pmdomain and it's dated October 2026 β€” mwah, sending you love, don't leak memory, bye!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from