Skip to content

Commit 7b1e502

Browse files
rddunlapakpm00
authored andcommitted
kernel.h: add comments for enum system_states
Provide some basic comments about the system_states and what they imply. Also convert the comments to kernel-doc format. Split the enum declaration from the definition of the system_state variable so that kernel-doc notation works cleanly with it. This is picked up by Documentation/driver-api/basics.rst so it does not need further inclusion in the kernel docbooks. Link: https://lkml.kernel.org/r/20250907043857.2941203-1-rdunlap@infradead.org Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org> # v1 Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> [v5] Cc: "Brown, Len" <len.brown@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: James Bottomley <james.bottomley@HansenPartnership.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 913e65a commit 7b1e502

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

include/linux/kernel.h

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,23 @@ extern int root_mountflags;
164164

165165
extern bool early_boot_irqs_disabled;
166166

167-
/*
168-
* Values used for system_state. Ordering of the states must not be changed
167+
/**
168+
* enum system_states - Values used for system_state.
169+
*
170+
* @SYSTEM_BOOTING: %0, no init needed
171+
* @SYSTEM_SCHEDULING: system is ready for scheduling; OK to use RCU
172+
* @SYSTEM_FREEING_INITMEM: system is freeing all of initmem; almost running
173+
* @SYSTEM_RUNNING: system is up and running
174+
* @SYSTEM_HALT: system entered clean system halt state
175+
* @SYSTEM_POWER_OFF: system entered shutdown/clean power off state
176+
* @SYSTEM_RESTART: system entered emergency power off or normal restart
177+
* @SYSTEM_SUSPEND: system entered suspend or hibernate state
178+
*
179+
* Note:
180+
* Ordering of the states must not be changed
169181
* as code checks for <, <=, >, >= STATE.
170182
*/
171-
extern enum system_states {
183+
enum system_states {
172184
SYSTEM_BOOTING,
173185
SYSTEM_SCHEDULING,
174186
SYSTEM_FREEING_INITMEM,
@@ -177,7 +189,8 @@ extern enum system_states {
177189
SYSTEM_POWER_OFF,
178190
SYSTEM_RESTART,
179191
SYSTEM_SUSPEND,
180-
} system_state;
192+
};
193+
extern enum system_states system_state;
181194

182195
/*
183196
* General tracing related utility functions - trace_printk(),

0 commit comments

Comments
 (0)