From: Jani Nikula <jani.nikula@linux.intel.com>
To: Randy Dunlap <rdunlap@infradead.org>, linux-kernel@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
linux-pm@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v4] kernel.h: add comments for system_states
Date: Fri, 05 Sep 2025 12:02:37 +0300 [thread overview]
Message-ID: <6089e22ddfdc135040cdeb69329d817846026728@intel.com> (raw)
In-Reply-To: <20250904063631.2364995-1-rdunlap@infradead.org>
On Wed, 03 Sep 2025, Randy Dunlap <rdunlap@infradead.org> wrote:
> Provide some basic comments about the system_states and what they imply.
> Also convert the comments to kernel-doc format.
>
> However, kernel-doc does not support kernel-doc notation on extern
> struct/union/typedef/enum/etc. So I made this a DOC: block so that
> I can use (insert) it into a Documentation (.rst) file and have it
> look decent.
The simple workaround is to separate the enum type and the variable:
/**
* kernel-doc for the enum
*/
enum system_states {
...
};
/**
* kernel-doc for the variable
*/
extern enum system_states system_state;
BR,
Jani.
>
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Acked-by: Rafael J. Wysocki <rafael@kernel.org> # v1
> ---
> v2: add Rafael's Ack.
> v3: add Andrew
> v4: add DOC: so that this DOC: block can be used in Documentation/
> add Greg K-H
> add Jon Corbet, Mauro Chehab, & linux-doc
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: linux-pm@vger.kernel.org
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: linux-doc@vger.kernel.org
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> ---
> Documentation/driver-api/pm/devices.rst | 8 ++++++++
> include/linux/kernel.h | 18 ++++++++++++++++--
> 2 files changed, 24 insertions(+), 2 deletions(-)
>
> --- linux-next-20250819.orig/include/linux/kernel.h
> +++ linux-next-20250819/include/linux/kernel.h
> @@ -164,8 +164,22 @@ extern int root_mountflags;
>
> extern bool early_boot_irqs_disabled;
>
> -/*
> - * Values used for system_state. Ordering of the states must not be changed
> +/**
> + * DOC: General system_states available for drivers
> + *
> + * enum system_states - Values used for system_state.
> + *
> + * * @SYSTEM_BOOTING: %0, no init needed
> + * * @SYSTEM_SCHEDULING: system is ready for scheduling; OK to use RCU
> + * * @SYSTEM_FREEING_INITMEM: system is freeing all of initmem; almost running
> + * * @SYSTEM_RUNNING: system is up and running
> + * * @SYSTEM_HALT: system entered clean system halt state
> + * * @SYSTEM_POWER_OFF: system entered shutdown/clean power off state
> + * * @SYSTEM_RESTART: system entered emergency power off or normal restart
> + * * @SYSTEM_SUSPEND: system entered suspend or hibernate state
> + *
> + * Note:
> + * Ordering of the states must not be changed
> * as code checks for <, <=, >, >= STATE.
> */
> extern enum system_states {
> --- linux-next-20250819.orig/Documentation/driver-api/pm/devices.rst
> +++ linux-next-20250819/Documentation/driver-api/pm/devices.rst
> @@ -241,6 +241,14 @@ before reactivating its class I/O queues
> More power-aware drivers might prepare the devices for triggering system wakeup
> events.
>
> +System states available for drivers
> +-----------------------------------
> +
> +These system states are available for drivers to help them determine how to
> +handle state transitions.
> +
> +.. kernel-doc:: include/linux/kernel.h
> + :doc: General system_states available for drivers
>
> Call Sequence Guarantees
> ------------------------
>
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-09-05 9:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-04 6:36 [PATCH v4] kernel.h: add comments for system_states Randy Dunlap
2025-09-05 9:02 ` Jani Nikula [this message]
2025-09-05 12:11 ` Mauro Carvalho Chehab
2025-09-05 13:06 ` Jani Nikula
2025-09-05 13:38 ` Mauro Carvalho Chehab
2025-09-05 22:07 ` Randy Dunlap
2025-09-06 8:56 ` Mauro Carvalho Chehab
2025-09-06 17:13 ` Randy Dunlap
2025-09-06 21:30 ` Mauro Carvalho Chehab
2025-09-07 13:35 ` Mauro Carvalho Chehab
2025-09-07 16:17 ` Mauro Carvalho Chehab
2025-09-08 9:22 ` Jani Nikula
2025-09-08 11:08 ` Mauro Carvalho Chehab
2025-09-07 21:46 ` Mauro Carvalho Chehab
2025-09-06 12:13 ` James Bottomley
2025-09-08 9:36 ` Jani Nikula
2025-09-05 22:00 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6089e22ddfdc135040cdeb69329d817846026728@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox