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

Merge tag 'docs-for-linus' of git://git.lwn.net/linux-2.6

Pull documentation update from Jonathan Corbet:
"Here's my set of accumulated documentation changes for 3.19.

It includes a couple of additions to the coding style document, some
fixes for minor build problems within the documentation tree, the
relocation of the kselftest docs, and various tweaks and additions.

A couple of changes reach outside of Documentation/; they only make
trivial comment changes and I did my best to get the required acks.

Complete with a shiny signed tag this time around"

* tag 'docs-for-linus' of git://git.lwn.net/linux-2.6:
kobject: grammar fix
Input: xpad - update docs to reflect current state
Documentation: Build mic/mpssd only for x86_64
cgroups: Documentation: fix wrong cgroupfs paths
Documentation/email-clients.txt: add info about Claws Mail
CodingStyle: add some more error handling guidelines
kselftest: Move the docs to the Documentation dir
Documentation: fix formatting to make 's' happy
Documentation: power: Fix typo in Documentation/power
Documentation: vm: Add 1GB large page support information
ipv4: add kernel parameter tcpmhash_entries
Documentation: Fix a typo in mailbox.txt
treewide: Fix typo in Documentation/DocBook/device-drivers
CodingStyle: Add a chapter on conditional compilation

+202 -73
+65 -5
Documentation/CodingStyle
··· 392 392 locations and some common work such as cleanup has to be done. If there is no 393 393 cleanup needed then just return directly. 394 394 395 - The rationale is: 395 + Choose label names which say what the goto does or why the goto exists. An 396 + example of a good name could be "out_buffer:" if the goto frees "buffer". Avoid 397 + using GW-BASIC names like "err1:" and "err2:". Also don't name them after the 398 + goto location like "err_kmalloc_failed:" 399 + 400 + The rationale for using gotos is: 396 401 397 402 - unconditional statements are easier to understand and follow 398 403 - nesting is reduced ··· 408 403 int fun(int a) 409 404 { 410 405 int result = 0; 411 - char *buffer = kmalloc(SIZE); 406 + char *buffer; 412 407 413 - if (buffer == NULL) 408 + buffer = kmalloc(SIZE, GFP_KERNEL); 409 + if (!buffer) 414 410 return -ENOMEM; 415 411 416 412 if (condition1) { ··· 419 413 ... 420 414 } 421 415 result = 1; 422 - goto out; 416 + goto out_buffer; 423 417 } 424 418 ... 425 - out: 419 + out_buffer: 426 420 kfree(buffer); 427 421 return result; 428 422 } 423 + 424 + A common type of bug to be aware of it "one err bugs" which look like this: 425 + 426 + err: 427 + kfree(foo->bar); 428 + kfree(foo); 429 + return ret; 430 + 431 + The bug in this code is that on some exit paths "foo" is NULL. Normally the 432 + fix for this is to split it up into two error labels "err_bar:" and "err_foo:". 433 + 429 434 430 435 Chapter 8: Commenting 431 436 ··· 861 844 "more_magic %reg2, %reg3" 862 845 : /* outputs */ : /* inputs */ : /* clobbers */); 863 846 847 + 848 + Chapter 20: Conditional Compilation 849 + 850 + Wherever possible, don't use preprocessor conditionals (#if, #ifdef) in .c 851 + files; doing so makes code harder to read and logic harder to follow. Instead, 852 + use such conditionals in a header file defining functions for use in those .c 853 + files, providing no-op stub versions in the #else case, and then call those 854 + functions unconditionally from .c files. The compiler will avoid generating 855 + any code for the stub calls, producing identical results, but the logic will 856 + remain easy to follow. 857 + 858 + Prefer to compile out entire functions, rather than portions of functions or 859 + portions of expressions. Rather than putting an ifdef in an expression, factor 860 + out part or all of the expression into a separate helper function and apply the 861 + conditional to that function. 862 + 863 + If you have a function or variable which may potentially go unused in a 864 + particular configuration, and the compiler would warn about its definition 865 + going unused, mark the definition as __maybe_unused rather than wrapping it in 866 + a preprocessor conditional. (However, if a function or variable *always* goes 867 + unused, delete it.) 868 + 869 + Within code, where possible, use the IS_ENABLED macro to convert a Kconfig 870 + symbol into a C boolean expression, and use it in a normal C conditional: 871 + 872 + if (IS_ENABLED(CONFIG_SOMETHING)) { 873 + ... 874 + } 875 + 876 + The compiler will constant-fold the conditional away, and include or exclude 877 + the block of code just as with an #ifdef, so this will not add any runtime 878 + overhead. However, this approach still allows the C compiler to see the code 879 + inside the block, and check it for correctness (syntax, types, symbol 880 + references, etc). Thus, you still have to use an #ifdef if the code inside the 881 + block references symbols that will not exist if the condition is not met. 882 + 883 + At the end of any non-trivial #if or #ifdef block (more than a few lines), 884 + place a comment after the #endif on the same line, noting the conditional 885 + expression used. For instance: 886 + 887 + #ifdef CONFIG_SOMETHING 888 + ... 889 + #endif /* CONFIG_SOMETHING */ 864 890 865 891 866 892 Appendix I: References
+2 -2
Documentation/cgroups/cgroups.txt
··· 312 312 2) mkdir /sys/fs/cgroup/cpuset 313 313 3) mount -t cgroup -ocpuset cpuset /sys/fs/cgroup/cpuset 314 314 4) Create the new cgroup by doing mkdir's and write's (or echo's) in 315 - the /sys/fs/cgroup virtual file system. 315 + the /sys/fs/cgroup/cpuset virtual file system. 316 316 5) Start a task that will be the "founding father" of the new job. 317 317 6) Attach that task to the new cgroup by writing its PID to the 318 - /sys/fs/cgroup/cpuset/tasks file for that cgroup. 318 + /sys/fs/cgroup/cpuset tasks file for that cgroup. 319 319 7) fork, exec or clone the job tasks from this founding father task. 320 320 321 321 For example, the following sequence of commands will setup a cgroup
+11
Documentation/email-clients.txt
··· 77 77 to insert into the message. 78 78 79 79 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 + Claws Mail (GUI) 81 + 82 + Works. Some people use this successfully for patches. 83 + 84 + To insert a patch use Message->Insert File (CTRL+i) or an external editor. 85 + 86 + If the inserted patch has to be edited in the Claws composition window 87 + "Auto wrapping" in Configuration->Preferences->Compose->Wrapping should be 88 + disabled. 89 + 90 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 91 Evolution (GUI) 81 92 82 93 Some people use this successfully for patches.
+1 -1
Documentation/filesystems/proc.txt
··· 1272 1272 1273 1273 1274 1274 1.9 Ext4 file system parameters 1275 - ------------------------------ 1275 + ------------------------------- 1276 1276 1277 1277 Information about mounted ext4 file systems can be found in 1278 1278 /proc/fs/ext4. Each mounted filesystem will have a directory in
+83 -40
Documentation/input/xpad.txt
··· 1 - xpad - Linux USB driver for X-Box gamepads 1 + xpad - Linux USB driver for Xbox compatible controllers 2 2 3 - This is the very first release of a driver for X-Box gamepads. 4 - Basically, this was hacked away in just a few hours, so don't expect 5 - miracles. 3 + This driver exposes all first-party and third-party Xbox compatible 4 + controllers. It has a long history and has enjoyed considerable usage 5 + as Window's xinput library caused most PC games to focus on Xbox 6 + controller compatibility. 6 7 7 - In particular, there is currently NO support for the rumble pack. 8 - You won't find many ff-aware linux applications anyway. 8 + Due to backwards compatibility all buttons are reported as digital. 9 + This only effects Original Xbox controllers. All later controller models 10 + have only digital face buttons. 11 + 12 + Rumble is supported on some models of Xbox 360 controllers but not of 13 + Original Xbox controllers nor on Xbox One controllers. As of writing 14 + the Xbox One's rumble protocol has not been reverse engineered but in 15 + the future could be supported. 9 16 10 17 11 18 0. Notes 12 19 -------- 13 - 14 - Driver updated for kernel 2.6.17.11. (Based on a patch for 2.6.11.4.) 15 - 16 20 The number of buttons/axes reported varies based on 3 things: 17 21 - if you are using a known controller 18 22 - if you are using a known dance pad ··· 24 20 module configuration for "Map D-PAD to buttons rather than axes for unknown 25 21 pads" (module option dpad_to_buttons) 26 22 27 - If you set dpad_to_buttons to 0 and you are using an unknown device (one 28 - not listed below), the driver will map the directional pad to axes (X/Y), 29 - if you said N it will map the d-pad to buttons, which is needed for dance 30 - style games to function correctly. The default is Y. 23 + If you set dpad_to_buttons to N and you are using an unknown device 24 + the driver will map the directional pad to axes (X/Y). 25 + If you said Y it will map the d-pad to buttons, which is needed for dance 26 + style games to function correctly. The default is Y. 31 27 32 - dpad_to_buttons has no effect for known pads. 28 + dpad_to_buttons has no effect for known pads. A erroneous commit message 29 + claimed dpad_to_buttons could be used to force behavior on known devices. 30 + This is not true. Both dpad_to_buttons and triggers_to_buttons only affect 31 + unknown controllers. 32 + 33 33 34 34 0.1 Normal Controllers 35 35 ---------------------- ··· 88 80 box in the future. 89 81 90 82 91 - 1. USB adapter 83 + 1. USB adapters 92 84 -------------- 85 + All generations of Xbox controllers speak USB over the wire. 86 + - Original Xbox controllers use a proprietary connector and require adapters. 87 + - Wireless Xbox 360 controllers require a 'Xbox 360 Wireless Gaming Receiver 88 + for Windows' 89 + - Wired Xbox 360 controllers use standard USB connectors. 90 + - Xbox One controllers can be wireless but speak Wi-Fi Direct and are not 91 + yet supported. 92 + - Xbox One controllers can be wired and use standard Micro-USB connectors. 93 93 94 - Before you can actually use the driver, you need to get yourself an 95 - adapter cable to connect the X-Box controller to your Linux-Box. You 96 - can buy these online fairly cheap, or build your own. 94 + 95 + 96 + 1.1 Original Xbox USB adapters 97 + -------------- 98 + Using this driver with an Original Xbox controller requires an 99 + adapter cable to break out the proprietary connector's pins to USB. 100 + You can buy these online fairly cheap, or build your own. 97 101 98 102 Such a cable is pretty easy to build. The Controller itself is a USB 99 103 compound device (a hub with three ports for two expansion slots and 100 104 the controller device) with the only difference in a nonstandard connector 101 - (5 pins vs. 4 on standard USB connector). 105 + (5 pins vs. 4 on standard USB 1.0 connectors). 102 106 103 107 You just need to solder a USB connector onto the cable and keep the 104 108 yellow wire unconnected. The other pins have the same order on both ··· 122 102 you can still use the controller with your X-Box, if you have one ;) 123 103 124 104 105 + 125 106 2. Driver Installation 126 107 ---------------------- 127 108 128 - Once you have the adapter cable and the controller is connected, you need 129 - to load your USB subsystem and should cat /proc/bus/usb/devices. 130 - There should be an entry like the one at the end [4]. 109 + Once you have the adapter cable, if needed, and the controller connected 110 + the xpad module should be auto loaded. To confirm you can cat 111 + /proc/bus/usb/devices. There should be an entry like the one at the end [4]. 131 112 132 - Currently (as of version 0.0.6), the following devices are included: 133 - original Microsoft XBOX controller (US), vendor=0x045e, product=0x0202 134 - smaller Microsoft XBOX controller (US), vendor=0x045e, product=0x0289 113 + 114 + 115 + 3. Supported Controllers 116 + ------------------------ 117 + For a full list of supported controllers and associated vendor and product 118 + IDs see the xpad_device[] array[6]. 119 + 120 + As of the historic version 0.0.6 (2006-10-10) the following devices 121 + were supported: 122 + original Microsoft XBOX controller (US), vendor=0x045e, product=0x0202 123 + smaller Microsoft XBOX controller (US), vendor=0x045e, product=0x0289 135 124 original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285 136 - InterAct PowerPad Pro (Germany), vendor=0x05fd, product=0x107a 137 - RedOctane Xbox Dance Pad (US), vendor=0x0c12, product=0x8809 125 + InterAct PowerPad Pro (Germany), vendor=0x05fd, product=0x107a 126 + RedOctane Xbox Dance Pad (US), vendor=0x0c12, product=0x8809 138 127 139 - The driver should work with xbox pads not listed above as well, however 140 - you will need to do something extra for dance pads to work. 128 + Unrecognized models of Xbox controllers should function as Generic 129 + Xbox controllers. Unrecognized Dance Pad controllers require setting 130 + the module option 'dpad_to_buttons'. 141 131 142 - If you have a controller not listed above, see 0.3 - Unknown Controllers 132 + If you have an unrecognized controller please see 0.3 - Unknown Controllers 143 133 144 - If you compiled and installed the driver, test the functionality: 134 + 135 + 4. Manual Testing 136 + ----------------- 137 + To test this driver's functionality you may use 'jstest'. 138 + 139 + For example: 145 140 > modprobe xpad 146 141 > modprobe joydev 147 142 > jstest /dev/js0 ··· 169 134 It works? Voila, you're done ;) 170 135 171 136 172 - 3. Thanks 137 + 138 + 5. Thanks 173 139 --------- 174 140 175 141 I have to thank ITO Takayuki for the detailed info on his site ··· 181 145 the basic functionality. 182 146 183 147 184 - 4. References 148 + 149 + 6. References 185 150 ------------- 186 151 187 - 1. http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki) 188 - 2. http://xpad.xbox-scene.com/ 189 - 3. http://www.markosweb.com/www/xboxhackz.com/ 190 - 191 - 4. /proc/bus/usb/devices - dump from InterAct PowerPad Pro (Germany): 152 + [1]: http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki) 153 + [2]: http://xpad.xbox-scene.com/ 154 + [3]: http://www.markosweb.com/www/xboxhackz.com/ 155 + [4]: /proc/bus/usb/devices - dump from InterAct PowerPad Pro (Germany): 192 156 193 157 T: Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0 194 158 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs= 1 ··· 198 162 E: Ad=81(I) Atr=03(Int.) MxPS= 32 Ivl= 10ms 199 163 E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl= 10ms 200 164 201 - 5. /proc/bus/usb/devices - dump from Redoctane Xbox Dance Pad (US): 165 + [5]: /proc/bus/usb/devices - dump from Redoctane Xbox Dance Pad (US): 202 166 203 167 T: Bus=01 Lev=02 Prnt=09 Port=00 Cnt=01 Dev#= 10 Spd=12 MxCh= 0 204 168 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 ··· 209 173 E: Ad=82(I) Atr=03(Int.) MxPS= 32 Ivl=4ms 210 174 E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl=4ms 211 175 212 - -- 176 + [6]: http://lxr.free-electrons.com/ident?i=xpad_device 177 + 178 + 179 + 180 + 7. Historic Edits 181 + ----------------- 213 182 Marko Friedemann <mfr@bmx-chemnitz.de> 214 183 2002-07-16 215 184 - original doc ··· 222 181 Dominic Cerquetti <binary1230@yahoo.com> 223 182 2005-03-19 224 183 - added stuff for dance pads, new d-pad->axes mappings 184 + 185 + Later changes may be viewed with 'git log Documentation/input/xpad.txt'
+7
Documentation/kernel-parameters.txt
··· 3434 3434 neutralize any effect of /proc/sys/kernel/sysrq. 3435 3435 Useful for debugging. 3436 3436 3437 + tcpmhash_entries= [KNL,NET] 3438 + Set the number of tcp_metrics_hash slots. 3439 + Default value is 8192 or 16384 depending on total 3440 + ram pages. This is used to specify the TCP metrics 3441 + cache size. See Documentation/networking/ip-sysctl.txt 3442 + "tcp_no_metrics_save" section for more details. 3443 + 3437 3444 tdfx= [HW,DRM] 3438 3445 3439 3446 test_suspend= [SUSPEND][,N]
+1 -1
Documentation/kobject.txt
··· 173 173 have been initialized properly, as userspace will instantly start to look 174 174 for them when this call happens. 175 175 176 - When the kobject is removed from the kernel (details on how to do that is 176 + When the kobject is removed from the kernel (details on how to do that are 177 177 below), the uevent for KOBJ_REMOVE will be automatically created by the 178 178 kobject core, so the caller does not have to worry about doing that by 179 179 hand.
+1 -1
Documentation/mailbox.txt
··· 53 53 { 54 54 struct demo_client *dc = container_of(mbox_client, 55 55 struct demo_client, cl); 56 - if (dc->aysnc) { 56 + if (dc->async) { 57 57 if (is_an_ack(mssg)) { 58 58 /* An ACK to our last sample sent */ 59 59 return; /* Or do something else here */
+1 -1
Documentation/mic/mpssd/Makefile
··· 1 1 # List of programs to build 2 - hostprogs-y := mpssd 2 + hostprogs-$(CONFIG_X86_64) := mpssd 3 3 4 4 mpssd-objs := mpssd.o sysfs.o 5 5
+3 -3
Documentation/power/runtime_pm.txt
··· 229 229 - if set, the value of child_count is ignored (but still updated) 230 230 231 231 unsigned int disable_depth; 232 - - used for disabling the helper funcions (they work normally if this is 232 + - used for disabling the helper functions (they work normally if this is 233 233 equal to zero); the initial value of it is 1 (i.e. runtime PM is 234 234 initially disabled for all devices) 235 235 236 236 int runtime_error; 237 237 - if set, there was a fatal error (one of the callbacks returned error code 238 - as described in Section 2), so the helper funtions will not work until 238 + as described in Section 2), so the helper functions will not work until 239 239 this flag is cleared; this is the error code returned by the failing 240 240 callback 241 241 ··· 524 524 5. Runtime PM Initialization, Device Probing and Removal 525 525 526 526 Initially, the runtime PM is disabled for all devices, which means that the 527 - majority of the runtime PM helper funtions described in Section 4 will return 527 + majority of the runtime PM helper functions described in Section 4 will return 528 528 -EAGAIN until pm_runtime_enable() is called for the device. 529 529 530 530 In addition to that, the initial runtime PM status of all devices is
+1 -1
Documentation/power/suspend-and-interrupts.txt
··· 77 77 in a special way. Namely, the IRQ remains enabled, by on the first interrupt 78 78 it will be disabled, marked as pending and "suspended" so that it will be 79 79 re-enabled by resume_device_irqs() during the subsequent system resume. Also 80 - the PM core is notified about the event which casues the system suspend in 80 + the PM core is notified about the event which causes the system suspend in 81 81 progress to be aborted (that doesn't have to happen immediately, but at one 82 82 of the points where the suspend thread looks for pending wakeup events). 83 83
+1 -1
Documentation/power/userland-swsusp.txt
··· 99 99 The device's read() operation can be used to transfer the snapshot image from 100 100 the kernel. It has the following limitations: 101 101 - you cannot read() more than one virtual memory page at a time 102 - - read()s across page boundaries are impossible (ie. if ypu read() 1/2 of 102 + - read()s across page boundaries are impossible (ie. if you read() 1/2 of 103 103 a page in the previous call, you will only be able to read() 104 104 _at_ _most_ 1/2 of the page in the next call) 105 105
+2 -2
Documentation/vm/hugetlbpage.txt
··· 1 1 2 2 The intent of this file is to give a brief summary of hugetlbpage support in 3 3 the Linux kernel. This support is built on top of multiple page size support 4 - that is provided by most modern architectures. For example, i386 5 - architecture supports 4K and 4M (2M in PAE mode) page sizes, ia64 4 + that is provided by most modern architectures. For example, x86 CPUs normally 5 + support 4K and 2M (1G if architecturally supported) page sizes, ia64 6 6 architecture supports multiple page sizes 4K, 8K, 64K, 256K, 1M, 4M, 16M, 7 7 256M and ppc64 supports 4K and 16M. A TLB is a cache of virtual-to-physical 8 8 translations. Typically this is a very scarce resource on processor.
+1 -1
drivers/dma-buf/fence.c
··· 283 283 * @cb: [in] the callback to remove 284 284 * 285 285 * Remove a previously queued callback from the fence. This function returns 286 - * true if the callback is succesfully removed, or false if the fence has 286 + * true if the callback is successfully removed, or false if the fence has 287 287 * already been signaled. 288 288 * 289 289 * *WARNING*:
+2 -2
include/linux/fence.h
··· 128 128 * from irq context, so normal spinlocks can be used. 129 129 * 130 130 * A return value of false indicates the fence already passed, 131 - * or some failure occured that made it impossible to enable 132 - * signaling. True indicates succesful enabling. 131 + * or some failure occurred that made it impossible to enable 132 + * signaling. True indicates successful enabling. 133 133 * 134 134 * fence->status may be set in enable_signaling, but only when false is 135 135 * returned.
+1 -1
include/linux/i2c.h
··· 359 359 * to name two of the most common. 360 360 * 361 361 * The return codes from the @master_xfer field should indicate the type of 362 - * error code that occured during the transfer, as documented in the kernel 362 + * error code that occurred during the transfer, as documented in the kernel 363 363 * Documentation file Documentation/i2c/fault-codes. 364 364 */ 365 365 struct i2c_algorithm {
+19 -11
tools/testing/selftests/README.txt Documentation/kselftest.txt
··· 15 15 ============================================================= 16 16 17 17 To build the tests: 18 - 19 18 $ make -C tools/testing/selftests 20 19 21 20 22 21 To run the tests: 23 - 24 22 $ make -C tools/testing/selftests run_tests 23 + 24 + To build and run the tests with a single command, use: 25 + $ make kselftest 25 26 26 27 - note that some tests will require root privileges. 27 28 28 - To run only tests targeted for a single subsystem: (including 29 - hotplug targets in limited mode) 30 29 31 - $ make -C tools/testing/selftests TARGETS=cpu-hotplug run_tests 30 + Running a subset of selftests 31 + ======================================== 32 + You can use the "TARGETS" variable on the make command line to specify 33 + single test to run, or a list of tests to run. 32 34 33 - See the top-level tools/testing/selftests/Makefile for the list of all possible 34 - targets. 35 + To run only tests targeted for a single subsystem: 36 + $ make -C tools/testing/selftests TARGETS=ptrace run_tests 37 + 38 + You can specify multiple tests to build and run: 39 + $ make TARGETS="size timers" kselftest 40 + 41 + See the top-level tools/testing/selftests/Makefile for the list of all 42 + possible targets. 43 + 35 44 36 45 Running the full range hotplug selftests 37 46 ======================================== 38 47 39 - To build the tests: 40 - 48 + To build the hotplug tests: 41 49 $ make -C tools/testing/selftests hotplug 42 50 43 - To run the tests: 44 - 51 + To run the hotplug tests: 45 52 $ make -C tools/testing/selftests run_hotplug 46 53 47 54 - note that some tests will require root privileges. 55 + 48 56 49 57 Contributing new tests 50 58 ======================