include/linux/suspend.h
Source file repositories/reference/linux-study-clean/include/linux/suspend.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/suspend.h- Extension
.h- Size
- 21820 bytes
- Lines
- 608
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/swap.hlinux/notifier.hlinux/init.hlinux/pm.hlinux/mm.hlinux/freezer.hasm/errno.hlinux/printk.h
Detected Declarations
struct platform_suspend_opsstruct platform_s2idle_opsstruct pbestruct platform_hibernation_opsenum s2idle_statesenum suspend_stat_stepfunction pm_set_vt_switchfunction pm_prepare_consolefunction pm_suspend_clear_flagsfunction pm_set_suspend_via_firmwarefunction pm_set_resume_via_firmwarefunction pm_set_suspend_no_platformfunction lastfunction pm_resume_via_firmwarefunction pm_suspend_no_platformfunction idle_should_enter_s2idlefunction pm_suspend_clear_flagsfunction pm_resume_via_firmwarefunction pm_suspend_no_platformfunction pm_suspend_default_s2idlefunction suspend_set_opsfunction sync_on_suspend_enabledfunction idle_should_enter_s2idlefunction pm_states_initfunction register_nosave_regionfunction swsusp_set_page_freefunction system_entering_hibernationfunction hibernation_availablefunction hibernate_quiet_execfunction pm_hibernation_mode_is_suspendfunction is_hibernate_resume_devfunction pm_suspended_storagefunction register_pm_notifierfunction unregister_pm_notifierfunction pm_report_hw_sleep_timefunction pm_report_max_hw_sleepfunction pm_restrict_gfp_maskfunction pm_suspended_storagefunction pm_wakeup_pendingfunction pm_system_wakeupfunction unlock_system_sleepfunction pm_hibernate_is_recoveringfunction pm_dyn_debug_messages_onfunction queue_up_suspend_work
Annotated Snippet
struct platform_suspend_ops {
int (*valid)(suspend_state_t state);
int (*begin)(suspend_state_t state);
int (*prepare)(void);
int (*prepare_late)(void);
int (*enter)(suspend_state_t state);
void (*wake)(void);
void (*finish)(void);
bool (*suspend_again)(void);
void (*end)(void);
void (*recover)(void);
};
struct platform_s2idle_ops {
int (*begin)(void);
int (*prepare)(void);
int (*prepare_late)(void);
void (*check)(void);
bool (*wake)(void);
void (*restore_early)(void);
void (*restore)(void);
void (*end)(void);
};
#ifdef CONFIG_SUSPEND
extern suspend_state_t pm_suspend_target_state;
extern suspend_state_t mem_sleep_current;
extern suspend_state_t mem_sleep_default;
/**
* suspend_set_ops - set platform dependent suspend operations
* @ops: The new suspend operations to set.
*/
extern void suspend_set_ops(const struct platform_suspend_ops *ops);
extern int suspend_valid_only_mem(suspend_state_t state);
extern unsigned int pm_suspend_global_flags;
#define PM_SUSPEND_FLAG_FW_SUSPEND BIT(0)
#define PM_SUSPEND_FLAG_FW_RESUME BIT(1)
#define PM_SUSPEND_FLAG_NO_PLATFORM BIT(2)
static inline void pm_suspend_clear_flags(void)
{
pm_suspend_global_flags = 0;
}
static inline void pm_set_suspend_via_firmware(void)
{
pm_suspend_global_flags |= PM_SUSPEND_FLAG_FW_SUSPEND;
}
static inline void pm_set_resume_via_firmware(void)
{
pm_suspend_global_flags |= PM_SUSPEND_FLAG_FW_RESUME;
}
static inline void pm_set_suspend_no_platform(void)
{
pm_suspend_global_flags |= PM_SUSPEND_FLAG_NO_PLATFORM;
}
/**
* pm_suspend_via_firmware - Check if platform firmware will suspend the system.
*
* To be called during system-wide power management transitions to sleep states
* or during the subsequent system-wide transitions back to the working state.
*
* Return 'true' if the platform firmware is going to be invoked at the end of
* the system-wide power management transition (to a sleep state) in progress in
* order to complete it, or if the platform firmware has been invoked in order
* to complete the last (or preceding) transition of the system to a sleep
* state.
*
* This matters if the caller needs or wants to carry out some special actions
* depending on whether or not control will be passed to the platform firmware
* subsequently (for example, the device may need to be reset before letting the
* platform firmware manipulate it, which is not necessary when the platform
* firmware is not going to be invoked) or when such special actions may have
* been carried out during the preceding transition of the system to a sleep
* state (as they may need to be taken into account).
*/
static inline bool pm_suspend_via_firmware(void)
{
return !!(pm_suspend_global_flags & PM_SUSPEND_FLAG_FW_SUSPEND);
}
/**
* pm_resume_via_firmware - Check if platform firmware has woken up the system.
*
Annotation
- Immediate include surface: `linux/swap.h`, `linux/notifier.h`, `linux/init.h`, `linux/pm.h`, `linux/mm.h`, `linux/freezer.h`, `asm/errno.h`, `linux/printk.h`.
- Detected declarations: `struct platform_suspend_ops`, `struct platform_s2idle_ops`, `struct pbe`, `struct platform_hibernation_ops`, `enum s2idle_states`, `enum suspend_stat_step`, `function pm_set_vt_switch`, `function pm_prepare_console`, `function pm_suspend_clear_flags`, `function pm_set_suspend_via_firmware`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.