device_prepare(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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

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