aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/development-process/4.Coding
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/development-process/4.Coding')
-rw-r--r--Documentation/development-process/4.Coding21
1 files changed, 18 insertions, 3 deletions
diff --git a/Documentation/development-process/4.Coding b/Documentation/development-process/4.Coding
index 2278693c8ffa..f3f1a469443c 100644
--- a/Documentation/development-process/4.Coding
+++ b/Documentation/development-process/4.Coding
@@ -131,6 +131,11 @@ classic time/space tradeoff taught in beginning data structures classes
131often does not apply to contemporary hardware. Space *is* time, in that a 131often does not apply to contemporary hardware. Space *is* time, in that a
132larger program will run slower than one which is more compact. 132larger program will run slower than one which is more compact.
133 133
134More recent compilers take an increasingly active role in deciding whether
135a given function should actually be inlined or not. So the liberal
136placement of "inline" keywords may not just be excessive; it could also be
137irrelevant.
138
134 139
135* Locking 140* Locking
136 141
@@ -285,6 +290,13 @@ be found at https://sparse.wiki.kernel.org/index.php/Main_Page if your
285distributor does not package it); it can then be run on the code by adding 290distributor does not package it); it can then be run on the code by adding
286"C=1" to your make command. 291"C=1" to your make command.
287 292
293The "Coccinelle" tool (http://coccinelle.lip6.fr/) is able to find a wide
294variety of potential coding problems; it can also propose fixes for those
295problems. Quite a few "semantic patches" for the kernel have been packaged
296under the scripts/coccinelle directory; running "make coccicheck" will run
297through those semantic patches and report on any problems found. See
298Documentation/coccinelle.txt for more information.
299
288Other kinds of portability errors are best found by compiling your code for 300Other kinds of portability errors are best found by compiling your code for
289other architectures. If you do not happen to have an S/390 system or a 301other architectures. If you do not happen to have an S/390 system or a
290Blackfin development board handy, you can still perform the compilation 302Blackfin development board handy, you can still perform the compilation
@@ -308,7 +320,9 @@ The first piece of documentation for any patch is its associated
308changelog. Log entries should describe the problem being solved, the form 320changelog. Log entries should describe the problem being solved, the form
309of the solution, the people who worked on the patch, any relevant 321of the solution, the people who worked on the patch, any relevant
310effects on performance, and anything else that might be needed to 322effects on performance, and anything else that might be needed to
311understand the patch. 323understand the patch. Be sure that the changelog says *why* the patch is
324worth applying; a surprising number of developers fail to provide that
325information.
312 326
313Any code which adds a new user-space interface - including new sysfs or 327Any code which adds a new user-space interface - including new sysfs or
314/proc files - should include documentation of that interface which enables 328/proc files - should include documentation of that interface which enables
@@ -321,7 +335,7 @@ boot-time parameters. Any patch which adds new parameters should add the
321appropriate entries to this file. 335appropriate entries to this file.
322 336
323Any new configuration options must be accompanied by help text which 337Any new configuration options must be accompanied by help text which
324clearly explains the options and when the user might want to select them. 338clearly explains the options and when the user might want to select them.
325 339
326Internal API information for many subsystems is documented by way of 340Internal API information for many subsystems is documented by way of
327specially-formatted comments; these comments can be extracted and formatted 341specially-formatted comments; these comments can be extracted and formatted
@@ -372,7 +386,8 @@ which is broken by the change. For a widely-used function, this duty can
372lead to literally hundreds or thousands of changes - many of which are 386lead to literally hundreds or thousands of changes - many of which are
373likely to conflict with work being done by other developers. Needless to 387likely to conflict with work being done by other developers. Needless to
374say, this can be a large job, so it is best to be sure that the 388say, this can be a large job, so it is best to be sure that the
375justification is solid. 389justification is solid. Note that the Coccinelle tool can help with
390wide-ranging API changes.
376 391
377When making an incompatible API change, one should, whenever possible, 392When making an incompatible API change, one should, whenever possible,
378ensure that code which has not been updated is caught by the compiler. 393ensure that code which has not been updated is caught by the compiler.