Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andy Shevchenko and committed by
Jonathan Corbet
197bbebd 5188f6bd

+32 -10
+1 -1
Documentation/core-api/kobject.rst
··· 78 78 often have the opposite problem, however: given a struct kobject pointer, 79 79 what is the pointer to the containing structure? You must avoid tricks 80 80 (such as assuming that the kobject is at the beginning of the structure) 81 - and, instead, use the container_of() macro, found in ``<linux/kernel.h>``:: 81 + and, instead, use the container_of() macro, found in ``<linux/container_of.h>``:: 82 82 83 83 container_of(ptr, type, member) 84 84
+1 -1
Documentation/dev-tools/checkpatch.rst
··· 753 753 sizeof(foo)/sizeof(foo[0]) for finding number of elements in an 754 754 array. 755 755 756 - The macro is defined in include/linux/kernel.h:: 756 + The macro is defined in include/linux/array_size.h:: 757 757 758 758 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 759 759
+16 -1
Documentation/driver-api/basics.rst
··· 114 114 Kernel utility functions 115 115 ------------------------ 116 116 117 - .. kernel-doc:: include/linux/kernel.h 117 + .. kernel-doc:: include/linux/array_size.h 118 + :internal: 119 + 120 + .. kernel-doc:: include/linux/container_of.h 121 + :internal: 122 + 123 + .. kernel-doc:: include/linux/kstrtox.h 118 124 :internal: 119 125 :no-identifiers: kstrtol kstrtoul 126 + 127 + .. kernel-doc:: include/linux/stddef.h 128 + :internal: 129 + 130 + .. kernel-doc:: include/linux/util_macros.h 131 + :internal: 132 + 133 + .. kernel-doc:: include/linux/wordpart.h 134 + :internal: 120 135 121 136 .. kernel-doc:: kernel/printk/printk.c 122 137 :export:
+1 -1
Documentation/driver-api/driver-model/design-patterns.rst
··· 103 103 return a single argument which is a pointer to a struct member in the 104 104 callback. 105 105 106 - container_of() is a macro defined in <linux/kernel.h> 106 + container_of() is a macro defined in <linux/container_of.h> 107 107 108 108 What container_of() does is to obtain a pointer to the containing struct from 109 109 a pointer to a member by a simple subtraction using the offsetof() macro from
+7 -3
Documentation/process/coding-style.rst
··· 1070 1070 18) Don't re-invent the kernel macros 1071 1071 ------------------------------------- 1072 1072 1073 - The header file include/linux/kernel.h contains a number of macros that 1073 + There are many header files in include/linux/ that contain a number of macros that 1074 1074 you should use, rather than explicitly coding some variant of them yourself. 1075 1075 For example, if you need to calculate the length of an array, take advantage 1076 1076 of the macro ··· 1079 1079 1080 1080 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 1081 1081 1082 + which is defined in array_size.h. 1083 + 1082 1084 Similarly, if you need to calculate the size of some structure member, use 1083 1085 1084 1086 .. code-block:: c 1085 1087 1086 1088 #define sizeof_field(t, f) (sizeof(((t*)0)->f)) 1087 1089 1088 - There are also min() and max() macros that do strict type checking if you 1089 - need them. Feel free to peruse that header file to see what else is already 1090 + which is defined in stddef.h. 1091 + 1092 + There are also min() and max() macros defined in minmax.h that do strict type checking 1093 + if you need them. Feel free to peruse the header files to see what else is already 1090 1094 defined that you shouldn't reproduce in your code. 1091 1095 1092 1096
+5 -2
Documentation/staging/rpmsg.rst
··· 224 224 225 225 :: 226 226 227 - #include <linux/kernel.h> 227 + #include <linux/dev_printk.h> 228 + #include <linux/mod_devicetable.h> 228 229 #include <linux/module.h> 230 + #include <linux/printk.h> 229 231 #include <linux/rpmsg.h> 232 + #include <linux/types.h> 230 233 231 234 static void rpmsg_sample_cb(struct rpmsg_channel *rpdev, void *data, int len, 232 235 void *priv, u32 src) ··· 247 244 /* send a message on our channel */ 248 245 err = rpmsg_send(rpdev->ept, "hello!", 6); 249 246 if (err) { 250 - pr_err("rpmsg_send failed: %d\n", err); 247 + dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", err); 251 248 return err; 252 249 } 253 250
+1 -1
include/linux/util_macros.h
··· 119 119 * a fuss about it. This makes the programmer responsible for tagging 120 120 * the functions that can be garbage-collected. 121 121 * 122 - * With the macro it is possible to write the following: 122 + * With the macro it is possible to write the following:: 123 123 * 124 124 * static int foo_suspend(struct device *dev) 125 125 * {