[PATCH 4/4] Documentation: core-api/cpuhotplug: Add naming convention for callbacks

From: Srivatsa S. Bhat (Microsoft)

Date: Fri Nov 27 2026 - 02:27:58 EST


Add a naming convention for the startup and teardown callbacks
registered for CPU hotplug states. Follow the common pattern of
subsys_cpu_mode(), where subsys is the subsystem or driver that is
registering the callback, and mode reflects the state that the
callback is associated with (ex: prepare, starting/dying,
online/offline).

Signed-off-by: Srivatsa S. Bhat (Microsoft) <srivatsa@xxxxxxxxxxxxx>
---
Documentation/core-api/cpu_hotplug.rst | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/Documentation/core-api/cpu_hotplug.rst b/Documentation/core-api/cpu_hotplug.rst
index fe5385a8bd8e..ea00859154be 100644
--- a/Documentation/core-api/cpu_hotplug.rst
+++ b/Documentation/core-api/cpu_hotplug.rst
@@ -444,6 +444,16 @@ The @teardown argument is a function pointer to the callback which should
be invoked during a CPU offline operation. If the usage site does not
require a teardown callback, set the pointer to NULL.

+The naming convention for the @startup and @teardown callback
+functions is "subsys_cpu_mode()". For example: vmstat_cpu_online(),
+trace_rb_cpu_prepare() etc. As with the @name argument outlined above,
+other descriptive function names can also be used instead, if they
+describe the nature of the action performed by that callback better in
+the context of that subsystem (ex: free_vm_stack_cache()). However, if
+you choose to embed the mode in the function's name (i.e., prepare,
+online/offline, starting/dying etc.) as recommended, make sure that it
+aligns with the state that the callback is actually associated with.
+
The functions differ in the way how the installed callbacks are treated:

* cpuhp_setup_state_nocalls(), cpuhp_setup_state_nocalls_cpuslocked()

--
2.43.0