Skip to contentSkip to conversation

CodingStyle: clarify variable naming rules

PATCH New Alexey Dobriyan 1 participant 1 message Jul 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CodingStyle: clarify variable naming rules

* sysctl stuff better have "sysctl" in its name to remind developers to use READ_ONCE() and that their values can change at any time,

* variable holding physical time should append unit of time to the name, to make life easier for developers and static checkers.

Jiffies aren't included because I'd be crucified for "_ji".

---
 Documentation/process/coding-style.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/process/coding-style.rst +5 -0
index a8336582f60b..d97ed5be4eab 100644
@@ -356,6 +356,11 @@ specification that mandates those terms. For new specifications
 translate specification usage of the terminology to the kernel coding
 standard where possible.
 
+Variable holding sysctl value should have ``sysctl`` in its name.
+
+Variable measuring time should be suffixed with the unit of time it is measured in:
+``_s`` for seconds, ``_ms`` for milliseconds, ``_us`` for microseconds, ``_ns`` for nanoseconds.
+
 5) Typedefs
 -----------
 
Signature · 1 line
2.54.0