device_prepare(9)
π device_prepare β it's giving "prepare your device for a power transition" π
okay so real talk, bestie: this page is device_prepare(9) from the Kernel API Manual, and she is shorter than my attention span but she's important, so let's get into it π«Ά
β¨ NAME β¨
device_prepare β Prepare a device for system power transition.
that's it. that's the whole name section. short queen energy π
πΈ SYNOPSIS πΈ
int device_prepare (struct device *dev , pm_message_t state );
look at her, all typed out and pretty β¨ returns an int, takes a struct device * and a pm_message_t, we love a tidy signature π
π ARGUMENTS π
devβ Device to handle. like, the actual device you're doing this whole thing for π§stateβ PM transition of the system being carried out. i.e. which power-management transition we're currently living through π«
π¦ DESCRIPTION π¦
okay so what she does: Execute the ->prepare callback(s) for given device. plural, note that β the callback(s), because the kernel is gonna go do its thing on them π
and here's the part you literally cannot skip, bestie:
No new children of the device may be registered after this function has returned.
no cap. once device_prepare hands control back, that device can't be getting any new kids. so if your code was thinking about registering a child device after this returns β nope, not the vibe, don't do it π
π SEE ALSO π
the friend group π (and also the kernel file they all live in: ./drivers/base/power/main.c)
pm_hibernate_is_recovering(9)device_pm_sleep_init(9)device_pm_lock(9)device_pm_unlock(9)device_pm_add(9)device_pm_remove(9)device_pm_move_before(9)device_pm_move_after(9)device_pm_move_last(9)dpm_wait(9)pm_op(9)pm_late_early_op(9)pm_noirq_op(9)dpm_watchdog_handler(9)dpm_watchdog_set(9)dpm_watchdog_clear(9)dev_pm_skip_resume(9)device_resume_noirq(9)dpm_resume_noirq(9)device_resume_early(9)dpm_resume_early(9)dpm_resume_start(9)device_resume(9)dpm_resume(9)device_complete(9)dpm_complete(9)dpm_resume_end(9)resume_event(9)device_suspend_noirq(9)dpm_suspend_noirq(9)device_suspend_late(9)dpm_suspend_late(9)dpm_suspend_end(9)legacy_suspend(9)device_suspend(9)dpm_suspend(9)dpm_prepare(9)dpm_suspend_start(9)device_pm_wait_for_dev(9)dpm_for_each_dev(9)
all forty-one of them, accounted for, not a single one dropped πβ¨ go read them if you want the full lore, iykyk π₯
okay that's the page!! mwah π this gem lives over in ./drivers/base/power and the docs are dated October 2026 β so yeah, she's from the future, main character energy fr fr βπΈ go prepare some devices bestie, and remember: no new children after it returns π
π¦ 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