dt_init_idle_driver(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ dt_init_idle_driver(9) β€” the Kernel API Manual, bestie edition πŸ¦‹

okay so this is from the Kernel API Manual, section 9 (that's the kernel-internals girlies πŸ’…), and it's all about dt_init_idle_driver. yes it's a mouthful, no we're not renaming it, the kernel does not take suggestions πŸ’€


✨ NAME ✨

dt_init_idle_driver β€” parse the DT idle states and initialize the idle driver states array. that's it, that's the whole vibe πŸŽ€


🌸 SYNOPSIS 🌸

int dt_init_idle_driver (struct cpuidle_driver *drv , const struct
of_device_id *matches , unsigned int start_idx );

literally three things go in. that's the whole function. slay.


πŸ’– ARGUMENTS πŸ’–

  • drv β€” pointer to the CPU idle driver that's getting initialized. she's the main character here, everything happens to her 🫢
  • matches β€” the array of of_device_id match structures to search through for compatible idle state nodes. and listen, this part matters so read it twice: the data pointer for each valid struct of_device_id entry in the matches array must point to a function with this signature, the one that lines up with the CPUidle state enter function signature:
int (*)(struct cpuidle_device *dev, struct cpuidle_driver *drv, int
index);

like, that's not optional. that's the contract. no cap. πŸ”₯

  • start_idx β€” the first idle state index that's gonna be initialized. your starting point, your opening act ✨

🧚 DESCRIPTION 🧚

so here's the function signature again, living its best life:

int (*)(struct cpuidle_device *dev, struct cpuidle_driver *drv, int
index);

and now the actual plot: if DT idle states are detected and they're valid, then the state count and the states array entries in the cpuidle driver get initialized accordingly β€” starting from index start_idx. πŸ“

that's the tea. detected + valid = initialized, from start_idx onward. not from zero, not from wherever, from start_idx. respect the offset bestie πŸ’…


πŸ‘‘ RETURN πŸ‘‘

the number of valid DT idle states parsed πŸŽ‰ and if it goes wrong? <0 on failure. so basically negative means the vibe check failed 😭


🌈 SEE ALSO 🌈

  • Kernel file ./drivers/cpuidle/dt_idle_states.c β€” go read it, it's giving source-of-truth energy πŸ“–

mwah πŸ’œ that's the whole page β€” brought to you by the ./drivers/cpuidle girlies, October 2026 edition, from the Kernel API Manual. go forth and initialize your idle states, i believe in you πŸ“βœ¨

πŸ“¦ where this page comes from