diff options
Diffstat (limited to 'Documentation/CodingStyle')
| -rw-r--r-- | Documentation/CodingStyle | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 8bb37237ebd2..fa6e25b94a54 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
| @@ -168,6 +168,13 @@ Do not unnecessarily use braces where a single statement will do. | |||
| 168 | if (condition) | 168 | if (condition) |
| 169 | action(); | 169 | action(); |
| 170 | 170 | ||
| 171 | and | ||
| 172 | |||
| 173 | if (condition) | ||
| 174 | do_this(); | ||
| 175 | else | ||
| 176 | do_that(); | ||
| 177 | |||
| 171 | This does not apply if one branch of a conditional statement is a single | 178 | This does not apply if one branch of a conditional statement is a single |
| 172 | statement. Use braces in both branches. | 179 | statement. Use braces in both branches. |
| 173 | 180 | ||
| @@ -659,7 +666,7 @@ There are a number of driver model diagnostic macros in <linux/device.h> | |||
| 659 | which you should use to make sure messages are matched to the right device | 666 | which you should use to make sure messages are matched to the right device |
| 660 | and driver, and are tagged with the right level: dev_err(), dev_warn(), | 667 | and driver, and are tagged with the right level: dev_err(), dev_warn(), |
| 661 | dev_info(), and so forth. For messages that aren't associated with a | 668 | dev_info(), and so forth. For messages that aren't associated with a |
| 662 | particular device, <linux/kernel.h> defines pr_debug() and pr_info(). | 669 | particular device, <linux/printk.h> defines pr_debug() and pr_info(). |
| 663 | 670 | ||
| 664 | Coming up with good debugging messages can be quite a challenge; and once | 671 | Coming up with good debugging messages can be quite a challenge; and once |
| 665 | you have them, they can be a huge help for remote troubleshooting. Such | 672 | you have them, they can be a huge help for remote troubleshooting. Such |
| @@ -673,8 +680,8 @@ ones already enabled by DEBUG. | |||
| 673 | Chapter 14: Allocating memory | 680 | Chapter 14: Allocating memory |
| 674 | 681 | ||
| 675 | The kernel provides the following general purpose memory allocators: | 682 | The kernel provides the following general purpose memory allocators: |
| 676 | kmalloc(), kzalloc(), kcalloc(), and vmalloc(). Please refer to the API | 683 | kmalloc(), kzalloc(), kcalloc(), vmalloc(), and vzalloc(). Please refer to |
| 677 | documentation for further information about them. | 684 | the API documentation for further information about them. |
| 678 | 685 | ||
| 679 | The preferred form for passing a size of a struct is the following: | 686 | The preferred form for passing a size of a struct is the following: |
| 680 | 687 | ||
| @@ -819,6 +826,3 @@ language C, URL: http://www.open-std.org/JTC1/SC22/WG14/ | |||
| 819 | Kernel CodingStyle, by greg@kroah.com at OLS 2002: | 826 | Kernel CodingStyle, by greg@kroah.com at OLS 2002: |
| 820 | http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/ | 827 | http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/ |
| 821 | 828 | ||
| 822 | -- | ||
| 823 | Last updated on 2007-July-13. | ||
| 824 | |||
