dt_init_idle_driver(9)
π¦ 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 ofof_device_idmatch structures to search through for compatible idle state nodes. and listen, this part matters so read it twice: the data pointer for each validstruct of_device_identry in thematchesarray 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
- 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