STRUCT PLATFORM_HIBERNATION_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ STRUCT PLATFORM_HIBERNATION_OPS(9) πŸ¦‹

okay so this is the struct platform_hibernation_ops page from the Kernel API Manual, and bestie, it's literally the blueprint for how a platform gets to do its own special little rituals during hibernation. think of it as the platform's backstage pass for the whole sleep-and-wakeup tour πŸ’–


✨ NAME ✨

struct platform_hibernation_ops β€” hibernation platform support. that's it, that's the vibe. it's the struct that hands a platform its moment to shine during a hibernation transition 🫢


🌈 SYNOPSIS 🌈

struct platform_hibernation_ops {
    int (*begin)(pm_message_t stage);
    void (*end)(void);
    int (*pre_snapshot)(void);
    void (*finish)(void);
    int (*prepare)(void);
    int (*enter)(void);
    void (*leave)(void);
    int (*pre_restore)(void);
    void (*restore_cleanup)(void);
    void (*recover)(void);
 };

πŸ‘‘ Members πŸ‘‘

ten function pointers, ten little moments, and every single one of them is doing the most. let's go down the list πŸ’…

  • begin β€” tells the platform driver that we're starting hibernation. called right after shrinking memory and before freezing devices. it's the "hey bestie, we're doing the thing" of callbacks ✨
  • end β€” called by the PM core right after resuming devices, to indicate to the platform that the system has returned to the working state. welcome back, icon πŸŽ€
  • pre_snapshot β€” prepares the platform for creating the hibernation image. called right after devices have been frozen and before the nonboot CPUs are disabled (runs with IRQs on). picture day prep, but for an image 🌸
  • finish β€” restores the previous state of the platform after the hibernation image has been created or puts the platform into the normal operation mode after the hibernation (the same method is executed in both cases). called right after the nonboot CPUs have been enabled and before thawing devices (runs with IRQs on). yes, one method, two jobs β€” she contains multitudes πŸ’€
  • prepare β€” prepares the platform for entering the low power state. called right after the hibernation image has been saved and before devices are prepared for entering the low power state. lowkey the "we're about to nap for real" heads-up 😴
  • enter β€” puts the system into the low power state after the hibernation image has been saved to disk. called after the nonboot CPUs have been disabled and all of the low level devices have been shut down (runs with IRQs off). no going back from here, fr fr πŸ”₯
  • leave β€” performs the first stage of the cleanup after the system sleep state indicated by set_target has been left. called right after the control has been passed from the boot kernel to the image kernel, before the nonboot CPUs are enabled and before devices are resumed. executed with interrupts disabled. πŸ‘€
  • pre_restore β€” prepares system for the restoration from a hibernation image. called right after devices have been frozen and before the nonboot CPUs are disabled (runs with IRQs on). the glow-up back to full power starts here πŸ’œ
  • restore_cleanup β€” cleans up after a failing image restoration. called right after the nonboot CPUs have been enabled and before thawing devices (runs with IRQs on). not me tidying up after things went sideways πŸ™ˆ
  • recover β€” recovers the platform from a failure to suspend devices. called by the PM core if the suspending of devices during hibernation fails. this callback is optional and should only be implemented by platforms which require special recovery actions in that situation. she's the one optional member of the group chat, and honestly? respect 🫢

πŸ’– Description πŸ’–

the methods in this structure allow a platform to carry out special operations required by it during a hibernation transition. so basically: the platform has extra needs, and this struct is where it says them out loud 🌟

all the methods below, except for recover, must be implemented. like, no skips. recover is the only one allowed to be absent β€” the rest are mandatory, no cap 🌈

πŸ” SEE ALSO πŸ”


and that's the whole page, bestie! this lil masterpiece lives at ./include/linux, dated October 2026, and it's giving ✨essential kernel reading✨. go forth and hibernate responsibly β€” periodt πŸ’…πŸ”₯πŸ’–

πŸ“¦ where this page comes from