Thread (13 messages) 13 messages, 6 authors, 2025-02-04

Re: [PATCH net] docs: netdev: Document guidance on inline functions

From: Jonathan Corbet <corbet@lwn.net>
Date: 2025-02-03 15:01:03
Also in: linux-doc, workflows

Simon Horman [off-list ref] writes:
quoted hunk ↗ jump to hunk
Document preference for non inline functions in .c files.
This has been the preference for as long as I can recall
and I was recently surprised to discover that it is undocumented.

Reported-by: Alexandre Ferrieux <redacted>
Closes: https://lore.kernel.org/all/9662e6fe-cc91-4258-aba1-ab5b016a041a@orange.com/ (local)
Signed-off-by: Simon Horman <horms@kernel.org>
---
 Documentation/process/maintainer-netdev.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff --git a/Documentation/process/maintainer-netdev.rst b/Documentation/process/maintainer-netdev.rst
index e497729525d5..1fbb8178b8cd 100644
--- a/Documentation/process/maintainer-netdev.rst
+++ b/Documentation/process/maintainer-netdev.rst
@@ -408,6 +408,17 @@ at a greater cost than the value of such clean-ups.
 
 Conversely, spelling and grammar fixes are not discouraged.
 
+Inline functions
+----------------
+
+The use of static inline functions in .c file is strongly discouraged
+unless there is a demonstrable reason for them, usually performance
+related. Rather, it is preferred to omit the inline keyword and allow the
+compiler to inline them as it sees fit.
+
+This is a stricter requirement than that of the general Linux Kernel
+:ref:`Coding Style<codingstyle>`
I have no objection to this change, but I do wonder if it does indeed
belong in the central coding-style document.  I don't think anybody
encourages use of "inline" these days...?

jon
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help