summaryrefslogtreecommitdiff
path: root/Documentation/process
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2025-11-26 22:46:07 +0100
committerJonathan Corbet <corbet@lwn.net>2025-12-22 14:59:18 -0700
commit197bbebd25810c5218e3347d61641be8e49c5404 (patch)
treefd77720ca2eadf265d9770b6496811fab84704ac /Documentation/process
parent5188f6bd408f937d81c0c37eb59ddc1035cd912c (diff)
docs: Update documentation to avoid mentioning of kernel.h
For several years, and still ongoing, the kernel.h is being split to smaller and narrow headers to avoid "including everything" approach which is bad in many ways. Since that, documentation missed a few required updates to align with that work. Do it here. Note, language translations are left untouched and if anybody willing to help, please provide path(es) based on the updated English variant. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20251126214709.2322314-1-andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'Documentation/process')
-rw-r--r--Documentation/process/coding-style.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index 2969ca378dbb..258158637f65 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -1070,7 +1070,7 @@ readability.
18) Don't re-invent the kernel macros
-------------------------------------
-The header file include/linux/kernel.h contains a number of macros that
+There are many header files in include/linux/ that contain a number of macros that
you should use, rather than explicitly coding some variant of them yourself.
For example, if you need to calculate the length of an array, take advantage
of the macro
@@ -1079,14 +1079,18 @@ of the macro
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+which is defined in array_size.h.
+
Similarly, if you need to calculate the size of some structure member, use
.. code-block:: c
#define sizeof_field(t, f) (sizeof(((t*)0)->f))
-There are also min() and max() macros that do strict type checking if you
-need them. Feel free to peruse that header file to see what else is already
+which is defined in stddef.h.
+
+There are also min() and max() macros defined in minmax.h that do strict type checking
+if you need them. Feel free to peruse the header files to see what else is already
defined that you shouldn't reproduce in your code.