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