aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-02 13:21:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-02 13:21:17 -0400
commitc58d4055c054fc6dc72f1be8bc71bd6fff209e48 (patch)
tree56527e28fc65d74d6d5e8397c502ccc87a9ec99b
parentceb198bb007b84ead867e87a71ffe715c4412b15 (diff)
parent9bb0e9cb04c82d6bf0e72f3207307d621083b801 (diff)
Merge tag 'docs-4.12' of git://git.lwn.net/linux
Pull documentation update from Jonathan Corbet: "A reasonably busy cycle for documentation this time around. There is a new guide for user-space API documents, rather sparsely populated at the moment, but it's a start. Markus improved the infrastructure for converting diagrams. Mauro has converted much of the USB documentation over to RST. Plus the usual set of fixes, improvements, and tweaks. There's a bit more than the usual amount of reaching out of Documentation/ to fix comments elsewhere in the tree; I have acks for those where I could get them" * tag 'docs-4.12' of git://git.lwn.net/linux: (74 commits) docs: Fix a couple typos docs: Fix a spelling error in vfio-mediated-device.txt docs: Fix a spelling error in ioctl-number.txt MAINTAINERS: update file entry for HSI subsystem Documentation: allow installing man pages to a user defined directory Doc/PM: Sync with intel_powerclamp code behavior zr364xx.rst: usb/devices is now at /sys/kernel/debug/ usb.rst: move documentation from proc_usb_info.txt to USB ReST book convert philips.txt to ReST and add to media docs docs-rst: usb: update old usbfs-related documentation arm: Documentation: update a path name docs: process/4.Coding.rst: Fix a couple of document refs docs-rst: fix usb cross-references usb: gadget.h: be consistent at kernel doc macros usb: composite.h: fix two warnings when building docs usb: get rid of some ReST doc build errors usb.rst: get rid of some Sphinx errors usb/URB.txt: convert to ReST and update it usb/persist.txt: convert to ReST and add to driver-api book usb/hotplug.txt: convert to ReST and add to driver-api book ...
-rw-r--r--Documentation/ABI/stable/sysfs-bus-usb2
-rw-r--r--Documentation/ABI/stable/vdso3
-rw-r--r--Documentation/ABI/testing/sysfs-bus-pci2
-rw-r--r--Documentation/DocBook/Makefile22
-rw-r--r--Documentation/DocBook/gadget.tmpl793
-rw-r--r--Documentation/DocBook/genericirq.tmpl520
-rw-r--r--Documentation/DocBook/kernel-api.tmpl331
-rw-r--r--Documentation/DocBook/writing_musb_glue_layer.tmpl873
-rw-r--r--Documentation/DocBook/writing_usb_driver.tmpl412
-rw-r--r--Documentation/PCI/pci-error-recovery.txt12
-rw-r--r--Documentation/acpi/aml-debugger.txt2
-rw-r--r--Documentation/acpi/enumeration.txt6
-rw-r--r--Documentation/admin-guide/index.rst1
-rw-r--r--Documentation/admin-guide/kernel-parameters.rst4
-rw-r--r--Documentation/admin-guide/pm/cpufreq.rst700
-rw-r--r--Documentation/admin-guide/pm/index.rst15
-rw-r--r--Documentation/admin-guide/ras.rst12
-rw-r--r--Documentation/admin-guide/security-bugs.rst39
-rw-r--r--Documentation/admin-guide/sysrq.rst3
-rw-r--r--Documentation/arm/mem_alignment2
-rw-r--r--Documentation/conf.py6
-rw-r--r--Documentation/core-api/flexible-arrays.rst130
-rw-r--r--Documentation/core-api/genericirq.rst440
-rw-r--r--Documentation/core-api/index.rst3
-rw-r--r--Documentation/core-api/kernel-api.rst346
-rw-r--r--Documentation/cpu-freq/boost.txt93
-rw-r--r--Documentation/cpu-freq/cpu-drivers.txt2
-rw-r--r--Documentation/cpu-freq/governors.txt301
-rw-r--r--Documentation/cpu-freq/index.txt7
-rw-r--r--Documentation/cpu-freq/user-guide.txt228
-rw-r--r--Documentation/cputopology.txt2
-rw-r--r--Documentation/debugging-via-ohci1394.txt4
-rw-r--r--Documentation/device-mapper/cache.txt2
-rw-r--r--Documentation/doc-guide/hello.dot3
-rw-r--r--Documentation/doc-guide/sphinx.rst115
-rw-r--r--Documentation/doc-guide/svg_image.svg10
-rw-r--r--Documentation/driver-api/basics.rst6
-rw-r--r--Documentation/driver-api/firmware/index.rst1
-rw-r--r--Documentation/driver-api/firmware/other_interfaces.rst15
-rw-r--r--Documentation/driver-api/index.rst4
-rw-r--r--Documentation/driver-api/misc_devices.rst5
-rw-r--r--Documentation/driver-api/pci.rst50
-rw-r--r--Documentation/driver-api/usb/URB.rst (renamed from Documentation/usb/URB.txt)223
-rw-r--r--Documentation/driver-api/usb/anchors.rst (renamed from Documentation/usb/anchors.txt)36
-rw-r--r--Documentation/driver-api/usb/bulk-streams.rst (renamed from Documentation/usb/bulk-streams.txt)13
-rw-r--r--Documentation/driver-api/usb/callbacks.rst (renamed from Documentation/usb/callbacks.txt)65
-rw-r--r--Documentation/driver-api/usb/dma.rst (renamed from Documentation/usb/dma.txt)51
-rw-r--r--Documentation/driver-api/usb/error-codes.rst207
-rw-r--r--Documentation/driver-api/usb/gadget.rst510
-rw-r--r--Documentation/driver-api/usb/hotplug.rst (renamed from Documentation/usb/hotplug.txt)68
-rw-r--r--Documentation/driver-api/usb/index.rst26
-rw-r--r--Documentation/driver-api/usb/persist.rst (renamed from Documentation/usb/persist.txt)22
-rw-r--r--Documentation/driver-api/usb/power-management.rst (renamed from Documentation/usb/power-management.txt)404
-rw-r--r--Documentation/driver-api/usb/usb.rst (renamed from Documentation/driver-api/usb.rst)827
-rw-r--r--Documentation/driver-api/usb/writing_musb_glue_layer.rst723
-rw-r--r--Documentation/driver-api/usb/writing_usb_driver.rst326
-rw-r--r--Documentation/early-userspace/README2
-rw-r--r--Documentation/filesystems/ext4.txt2
-rw-r--r--Documentation/filesystems/nfs/nfs-rdma.txt4
-rw-r--r--Documentation/hid/hidraw.txt2
-rw-r--r--Documentation/index.rst20
-rw-r--r--Documentation/input/ff.txt6
-rw-r--r--Documentation/input/input-programming.txt4
-rw-r--r--Documentation/ioctl/ioctl-number.txt2
-rw-r--r--Documentation/leds/leds-lp55xx.txt2
-rw-r--r--Documentation/md/md-cluster.txt2
-rw-r--r--Documentation/media/Makefile47
-rw-r--r--Documentation/media/intro.rst6
-rw-r--r--Documentation/media/uapi/dvb/intro.rst6
-rw-r--r--Documentation/media/uapi/v4l/crop.rst4
-rw-r--r--Documentation/media/uapi/v4l/dev-raw-vbi.rst22
-rw-r--r--Documentation/media/uapi/v4l/dev-subdev.rst22
-rw-r--r--Documentation/media/uapi/v4l/field-order.rst11
-rw-r--r--Documentation/media/uapi/v4l/pixfmt-nv12mt.rst8
-rw-r--r--Documentation/media/uapi/v4l/selection-api-003.rst6
-rw-r--r--Documentation/media/uapi/v4l/subdev-formats.rst4
-rw-r--r--Documentation/media/v4l-drivers/index.rst1
-rw-r--r--Documentation/media/v4l-drivers/philips.rst (renamed from drivers/media/usb/pwc/philips.txt)21
-rw-r--r--Documentation/media/v4l-drivers/zr364xx.rst2
-rw-r--r--Documentation/mmc/mmc-dev-attrs.txt4
-rw-r--r--Documentation/networking/cdc_mbim.txt2
-rw-r--r--Documentation/networking/e100.txt2
-rw-r--r--Documentation/networking/e1000.txt2
-rw-r--r--Documentation/networking/e1000e.txt2
-rw-r--r--Documentation/networking/igb.txt2
-rw-r--r--Documentation/networking/igbvf.txt2
-rw-r--r--Documentation/networking/ixgb.txt2
-rw-r--r--Documentation/networking/ixgbe.txt2
-rw-r--r--Documentation/phy.txt2
-rw-r--r--Documentation/power/swsusp.txt2
-rw-r--r--Documentation/process/4.Coding.rst17
-rw-r--r--Documentation/process/applying-patches.rst12
-rw-r--r--Documentation/process/changes.rst17
-rw-r--r--Documentation/sphinx/cdomain.py2
-rw-r--r--Documentation/sphinx/kfigure.py551
-rwxr-xr-xDocumentation/sphinx/tmplcvt13
-rw-r--r--Documentation/static-keys.txt2
-rw-r--r--Documentation/sync_file.txt2
-rw-r--r--Documentation/thermal/intel_powerclamp.txt20
-rw-r--r--Documentation/translations/ja_JP/howto.rst (renamed from Documentation/translations/ja_JP/HOWTO)596
-rw-r--r--Documentation/translations/ja_JP/index.rst12
-rw-r--r--Documentation/translations/zh_CN/sparse.txt4
-rw-r--r--Documentation/usb/acm.txt2
-rw-r--r--Documentation/usb/error-codes.txt175
-rw-r--r--Documentation/usb/gadget_serial.txt4
-rw-r--r--Documentation/usb/proc_usb_info.txt390
-rw-r--r--Documentation/userspace-api/conf.py10
-rw-r--r--Documentation/userspace-api/index.rst26
-rw-r--r--Documentation/userspace-api/unshare.rst (renamed from Documentation/unshare.txt)195
-rw-r--r--Documentation/vfio-mediated-device.txt8
-rw-r--r--Documentation/zorro.txt2
-rw-r--r--MAINTAINERS2
-rw-r--r--Makefile4
-rw-r--r--block/genhd.c7
-rw-r--r--drivers/pci/irq.c2
-rw-r--r--drivers/staging/most/hdm-usb/hdm_usb.c2
-rw-r--r--drivers/usb/core/Kconfig2
-rw-r--r--drivers/usb/core/message.c1
-rw-r--r--include/linux/clk.h4
-rw-r--r--include/linux/flex_array.h67
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/gadget.h2
-rw-r--r--ipc/util.c12
-rw-r--r--lib/Kconfig.debug9
-rw-r--r--lib/bitmap.c28
-rw-r--r--lib/string.c2
-rw-r--r--lib/vsprintf.c6
-rw-r--r--mm/filemap.c18
-rw-r--r--mm/page_alloc.c3
-rw-r--r--mm/vmalloc.c2
-rwxr-xr-xscripts/kernel-doc19
-rw-r--r--security/security.c12
132 files changed, 6111 insertions, 5417 deletions
diff --git a/Documentation/ABI/stable/sysfs-bus-usb b/Documentation/ABI/stable/sysfs-bus-usb
index 831f15d9672f..b832eeff9999 100644
--- a/Documentation/ABI/stable/sysfs-bus-usb
+++ b/Documentation/ABI/stable/sysfs-bus-usb
@@ -9,7 +9,7 @@ Description:
9 hubs this facility is always enabled and their device 9 hubs this facility is always enabled and their device
10 directories will not contain this file. 10 directories will not contain this file.
11 11
12 For more information, see Documentation/usb/persist.txt. 12 For more information, see Documentation/driver-api/usb/persist.rst.
13 13
14What: /sys/bus/usb/devices/.../power/autosuspend 14What: /sys/bus/usb/devices/.../power/autosuspend
15Date: March 2007 15Date: March 2007
diff --git a/Documentation/ABI/stable/vdso b/Documentation/ABI/stable/vdso
index 7cdfc28cc2c6..55406ec8a35a 100644
--- a/Documentation/ABI/stable/vdso
+++ b/Documentation/ABI/stable/vdso
@@ -16,7 +16,8 @@ The vDSO uses symbol versioning; whenever you request a symbol from the
16vDSO, specify the version you are expecting. 16vDSO, specify the version you are expecting.
17 17
18Programs that dynamically link to glibc will use the vDSO automatically. 18Programs that dynamically link to glibc will use the vDSO automatically.
19Otherwise, you can use the reference parser in Documentation/vDSO/parse_vdso.c. 19Otherwise, you can use the reference parser in
20tools/testing/selftests/vDSO/parse_vdso.c.
20 21
21Unless otherwise noted, the set of symbols with any given version and the 22Unless otherwise noted, the set of symbols with any given version and the
22ABI of those symbols is considered stable. It may vary across architectures, 23ABI of those symbols is considered stable. It may vary across architectures,
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index 5a1732b78707..e4e90104d7c3 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -299,5 +299,5 @@ What: /sys/bus/pci/devices/.../revision
299Date: November 2016 299Date: November 2016
300Contact: Emil Velikov <emil.l.velikov@gmail.com> 300Contact: Emil Velikov <emil.l.velikov@gmail.com>
301Description: 301Description:
302 This file contains the revision field of the the PCI device. 302 This file contains the revision field of the PCI device.
303 The value comes from device config space. The file is read only. 303 The value comes from device config space. The file is read only.
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 164c1c76971f..85916f13d330 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -8,12 +8,11 @@
8 8
9DOCBOOKS := z8530book.xml \ 9DOCBOOKS := z8530book.xml \
10 kernel-hacking.xml kernel-locking.xml \ 10 kernel-hacking.xml kernel-locking.xml \
11 writing_usb_driver.xml networking.xml \ 11 networking.xml \
12 kernel-api.xml filesystems.xml lsm.xml kgdb.xml \ 12 filesystems.xml lsm.xml kgdb.xml \
13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ 13 libata.xml mtdnand.xml librs.xml rapidio.xml \
14 genericirq.xml s390-drivers.xml scsi.xml \ 14 s390-drivers.xml scsi.xml \
15 sh.xml w1.xml \ 15 sh.xml w1.xml
16 writing_musb_glue_layer.xml
17 16
18ifeq ($(DOCBOOKS),) 17ifeq ($(DOCBOOKS),)
19 18
@@ -62,11 +61,14 @@ MAN := $(patsubst %.xml, %.9, $(BOOKS))
62mandocs: $(MAN) 61mandocs: $(MAN)
63 find $(obj)/man -name '*.9' | xargs gzip -nf 62 find $(obj)/man -name '*.9' | xargs gzip -nf
64 63
64# Default location for installed man pages
65export INSTALL_MAN_PATH = $(objtree)/usr
66
65installmandocs: mandocs 67installmandocs: mandocs
66 mkdir -p /usr/local/man/man9/ 68 mkdir -p $(INSTALL_MAN_PATH)/man/man9/
67 find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \ 69 find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \
68 sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \ 70 sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \
69 xargs install -m 644 -t /usr/local/man/man9/ 71 xargs install -m 644 -t $(INSTALL_MAN_PATH)/man/man9/
70 72
71# no-op for the DocBook toolchain 73# no-op for the DocBook toolchain
72epubdocs: 74epubdocs:
@@ -238,7 +240,9 @@ dochelp:
238 @echo ' psdocs - Postscript' 240 @echo ' psdocs - Postscript'
239 @echo ' xmldocs - XML DocBook' 241 @echo ' xmldocs - XML DocBook'
240 @echo ' mandocs - man pages' 242 @echo ' mandocs - man pages'
241 @echo ' installmandocs - install man pages generated by mandocs' 243 @echo ' installmandocs - install man pages generated by mandocs to INSTALL_MAN_PATH'; \
244 echo ' (default: $(INSTALL_MAN_PATH))'; \
245 echo ''
242 @echo ' cleandocs - clean all generated DocBook files' 246 @echo ' cleandocs - clean all generated DocBook files'
243 @echo 247 @echo
244 @echo ' make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml' 248 @echo ' make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml'
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl
deleted file mode 100644
index 641629221176..000000000000
--- a/Documentation/DocBook/gadget.tmpl
+++ /dev/null
@@ -1,793 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="USB-Gadget-API">
6 <bookinfo>
7 <title>USB Gadget API for Linux</title>
8 <date>20 August 2004</date>
9 <edition>20 August 2004</edition>
10
11 <legalnotice>
12 <para>
13 This documentation is free software; you can redistribute
14 it and/or modify it under the terms of the GNU General Public
15 License as published by the Free Software Foundation; either
16 version 2 of the License, or (at your option) any later
17 version.
18 </para>
19
20 <para>
21 This program is distributed in the hope that it will be
22 useful, but WITHOUT ANY WARRANTY; without even the implied
23 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 See the GNU General Public License for more details.
25 </para>
26
27 <para>
28 You should have received a copy of the GNU General Public
29 License along with this program; if not, write to the Free
30 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 MA 02111-1307 USA
32 </para>
33
34 <para>
35 For more details see the file COPYING in the source
36 distribution of Linux.
37 </para>
38 </legalnotice>
39 <copyright>
40 <year>2003-2004</year>
41 <holder>David Brownell</holder>
42 </copyright>
43
44 <author>
45 <firstname>David</firstname>
46 <surname>Brownell</surname>
47 <affiliation>
48 <address><email>dbrownell@users.sourceforge.net</email></address>
49 </affiliation>
50 </author>
51 </bookinfo>
52
53<toc></toc>
54
55<chapter id="intro"><title>Introduction</title>
56
57<para>This document presents a Linux-USB "Gadget"
58kernel mode
59API, for use within peripherals and other USB devices
60that embed Linux.
61It provides an overview of the API structure,
62and shows how that fits into a system development project.
63This is the first such API released on Linux to address
64a number of important problems, including: </para>
65
66<itemizedlist>
67 <listitem><para>Supports USB 2.0, for high speed devices which
68 can stream data at several dozen megabytes per second.
69 </para></listitem>
70 <listitem><para>Handles devices with dozens of endpoints just as
71 well as ones with just two fixed-function ones. Gadget drivers
72 can be written so they're easy to port to new hardware.
73 </para></listitem>
74 <listitem><para>Flexible enough to expose more complex USB device
75 capabilities such as multiple configurations, multiple interfaces,
76 composite devices,
77 and alternate interface settings.
78 </para></listitem>
79 <listitem><para>USB "On-The-Go" (OTG) support, in conjunction
80 with updates to the Linux-USB host side.
81 </para></listitem>
82 <listitem><para>Sharing data structures and API models with the
83 Linux-USB host side API. This helps the OTG support, and
84 looks forward to more-symmetric frameworks (where the same
85 I/O model is used by both host and device side drivers).
86 </para></listitem>
87 <listitem><para>Minimalist, so it's easier to support new device
88 controller hardware. I/O processing doesn't imply large
89 demands for memory or CPU resources.
90 </para></listitem>
91</itemizedlist>
92
93
94<para>Most Linux developers will not be able to use this API, since they
95have USB "host" hardware in a PC, workstation, or server.
96Linux users with embedded systems are more likely to
97have USB peripheral hardware.
98To distinguish drivers running inside such hardware from the
99more familiar Linux "USB device drivers",
100which are host side proxies for the real USB devices,
101a different term is used:
102the drivers inside the peripherals are "USB gadget drivers".
103In USB protocol interactions, the device driver is the master
104(or "client driver")
105and the gadget driver is the slave (or "function driver").
106</para>
107
108<para>The gadget API resembles the host side Linux-USB API in that both
109use queues of request objects to package I/O buffers, and those requests
110may be submitted or canceled.
111They share common definitions for the standard USB
112<emphasis>Chapter 9</emphasis> messages, structures, and constants.
113Also, both APIs bind and unbind drivers to devices.
114The APIs differ in detail, since the host side's current
115URB framework exposes a number of implementation details
116and assumptions that are inappropriate for a gadget API.
117While the model for control transfers and configuration
118management is necessarily different (one side is a hardware-neutral master,
119the other is a hardware-aware slave), the endpoint I/0 API used here
120should also be usable for an overhead-reduced host side API.
121</para>
122
123</chapter>
124
125<chapter id="structure"><title>Structure of Gadget Drivers</title>
126
127<para>A system running inside a USB peripheral
128normally has at least three layers inside the kernel to handle
129USB protocol processing, and may have additional layers in
130user space code.
131The "gadget" API is used by the middle layer to interact
132with the lowest level (which directly handles hardware).
133</para>
134
135<para>In Linux, from the bottom up, these layers are:
136</para>
137
138<variablelist>
139
140 <varlistentry>
141 <term><emphasis>USB Controller Driver</emphasis></term>
142
143 <listitem>
144 <para>This is the lowest software level.
145 It is the only layer that talks to hardware,
146 through registers, fifos, dma, irqs, and the like.
147 The <filename>&lt;linux/usb/gadget.h&gt;</filename> API abstracts
148 the peripheral controller endpoint hardware.
149 That hardware is exposed through endpoint objects, which accept
150 streams of IN/OUT buffers, and through callbacks that interact
151 with gadget drivers.
152 Since normal USB devices only have one upstream
153 port, they only have one of these drivers.
154 The controller driver can support any number of different
155 gadget drivers, but only one of them can be used at a time.
156 </para>
157
158 <para>Examples of such controller hardware include
159 the PCI-based NetChip 2280 USB 2.0 high speed controller,
160 the SA-11x0 or PXA-25x UDC (found within many PDAs),
161 and a variety of other products.
162 </para>
163
164 </listitem></varlistentry>
165
166 <varlistentry>
167 <term><emphasis>Gadget Driver</emphasis></term>
168
169 <listitem>
170 <para>The lower boundary of this driver implements hardware-neutral
171 USB functions, using calls to the controller driver.
172 Because such hardware varies widely in capabilities and restrictions,
173 and is used in embedded environments where space is at a premium,
174 the gadget driver is often configured at compile time
175 to work with endpoints supported by one particular controller.
176 Gadget drivers may be portable to several different controllers,
177 using conditional compilation.
178 (Recent kernels substantially simplify the work involved in
179 supporting new hardware, by <emphasis>autoconfiguring</emphasis>
180 endpoints automatically for many bulk-oriented drivers.)
181 Gadget driver responsibilities include:
182 </para>
183 <itemizedlist>
184 <listitem><para>handling setup requests (ep0 protocol responses)
185 possibly including class-specific functionality
186 </para></listitem>
187 <listitem><para>returning configuration and string descriptors
188 </para></listitem>
189 <listitem><para>(re)setting configurations and interface
190 altsettings, including enabling and configuring endpoints
191 </para></listitem>
192 <listitem><para>handling life cycle events, such as managing
193 bindings to hardware,
194 USB suspend/resume, remote wakeup,
195 and disconnection from the USB host.
196 </para></listitem>
197 <listitem><para>managing IN and OUT transfers on all currently
198 enabled endpoints
199 </para></listitem>
200 </itemizedlist>
201
202 <para>
203 Such drivers may be modules of proprietary code, although
204 that approach is discouraged in the Linux community.
205 </para>
206 </listitem></varlistentry>
207
208 <varlistentry>
209 <term><emphasis>Upper Level</emphasis></term>
210
211 <listitem>
212 <para>Most gadget drivers have an upper boundary that connects
213 to some Linux driver or framework in Linux.
214 Through that boundary flows the data which the gadget driver
215 produces and/or consumes through protocol transfers over USB.
216 Examples include:
217 </para>
218 <itemizedlist>
219 <listitem><para>user mode code, using generic (gadgetfs)
220 or application specific files in
221 <filename>/dev</filename>
222 </para></listitem>
223 <listitem><para>networking subsystem (for network gadgets,
224 like the CDC Ethernet Model gadget driver)
225 </para></listitem>
226 <listitem><para>data capture drivers, perhaps video4Linux or
227 a scanner driver; or test and measurement hardware.
228 </para></listitem>
229 <listitem><para>input subsystem (for HID gadgets)
230 </para></listitem>
231 <listitem><para>sound subsystem (for audio gadgets)
232 </para></listitem>
233 <listitem><para>file system (for PTP gadgets)
234 </para></listitem>
235 <listitem><para>block i/o subsystem (for usb-storage gadgets)
236 </para></listitem>
237 <listitem><para>... and more </para></listitem>
238 </itemizedlist>
239 </listitem></varlistentry>
240
241 <varlistentry>
242 <term><emphasis>Additional Layers</emphasis></term>
243
244 <listitem>
245 <para>Other layers may exist.
246 These could include kernel layers, such as network protocol stacks,
247 as well as user mode applications building on standard POSIX
248 system call APIs such as
249 <emphasis>open()</emphasis>, <emphasis>close()</emphasis>,
250 <emphasis>read()</emphasis> and <emphasis>write()</emphasis>.
251 On newer systems, POSIX Async I/O calls may be an option.
252 Such user mode code will not necessarily be subject to
253 the GNU General Public License (GPL).
254 </para>
255 </listitem></varlistentry>
256
257
258</variablelist>
259
260<para>OTG-capable systems will also need to include a standard Linux-USB
261host side stack,
262with <emphasis>usbcore</emphasis>,
263one or more <emphasis>Host Controller Drivers</emphasis> (HCDs),
264<emphasis>USB Device Drivers</emphasis> to support
265the OTG "Targeted Peripheral List",
266and so forth.
267There will also be an <emphasis>OTG Controller Driver</emphasis>,
268which is visible to gadget and device driver developers only indirectly.
269That helps the host and device side USB controllers implement the
270two new OTG protocols (HNP and SRP).
271Roles switch (host to peripheral, or vice versa) using HNP
272during USB suspend processing, and SRP can be viewed as a
273more battery-friendly kind of device wakeup protocol.
274</para>
275
276<para>Over time, reusable utilities are evolving to help make some
277gadget driver tasks simpler.
278For example, building configuration descriptors from vectors of
279descriptors for the configurations interfaces and endpoints is
280now automated, and many drivers now use autoconfiguration to
281choose hardware endpoints and initialize their descriptors.
282
283A potential example of particular interest
284is code implementing standard USB-IF protocols for
285HID, networking, storage, or audio classes.
286Some developers are interested in KDB or KGDB hooks, to let
287target hardware be remotely debugged.
288Most such USB protocol code doesn't need to be hardware-specific,
289any more than network protocols like X11, HTTP, or NFS are.
290Such gadget-side interface drivers should eventually be combined,
291to implement composite devices.
292</para>
293
294</chapter>
295
296
297<chapter id="api"><title>Kernel Mode Gadget API</title>
298
299<para>Gadget drivers declare themselves through a
300<emphasis>struct usb_gadget_driver</emphasis>, which is responsible for
301most parts of enumeration for a <emphasis>struct usb_gadget</emphasis>.
302The response to a set_configuration usually involves
303enabling one or more of the <emphasis>struct usb_ep</emphasis> objects
304exposed by the gadget, and submitting one or more
305<emphasis>struct usb_request</emphasis> buffers to transfer data.
306Understand those four data types, and their operations, and
307you will understand how this API works.
308</para>
309
310<note><title>Incomplete Data Type Descriptions</title>
311
312<para>This documentation was prepared using the standard Linux
313kernel <filename>docproc</filename> tool, which turns text
314and in-code comments into SGML DocBook and then into usable
315formats such as HTML or PDF.
316Other than the "Chapter 9" data types, most of the significant
317data types and functions are described here.
318</para>
319
320<para>However, docproc does not understand all the C constructs
321that are used, so some relevant information is likely omitted from
322what you are reading.
323One example of such information is endpoint autoconfiguration.
324You'll have to read the header file, and use example source
325code (such as that for "Gadget Zero"), to fully understand the API.
326</para>
327
328<para>The part of the API implementing some basic
329driver capabilities is specific to the version of the
330Linux kernel that's in use.
331The 2.6 kernel includes a <emphasis>driver model</emphasis>
332framework that has no analogue on earlier kernels;
333so those parts of the gadget API are not fully portable.
334(They are implemented on 2.4 kernels, but in a different way.)
335The driver model state is another part of this API that is
336ignored by the kerneldoc tools.
337</para>
338</note>
339
340<para>The core API does not expose
341every possible hardware feature, only the most widely available ones.
342There are significant hardware features, such as device-to-device DMA
343(without temporary storage in a memory buffer)
344that would be added using hardware-specific APIs.
345</para>
346
347<para>This API allows drivers to use conditional compilation to handle
348endpoint capabilities of different hardware, but doesn't require that.
349Hardware tends to have arbitrary restrictions, relating to
350transfer types, addressing, packet sizes, buffering, and availability.
351As a rule, such differences only matter for "endpoint zero" logic
352that handles device configuration and management.
353The API supports limited run-time
354detection of capabilities, through naming conventions for endpoints.
355Many drivers will be able to at least partially autoconfigure
356themselves.
357In particular, driver init sections will often have endpoint
358autoconfiguration logic that scans the hardware's list of endpoints
359to find ones matching the driver requirements
360(relying on those conventions), to eliminate some of the most
361common reasons for conditional compilation.
362</para>
363
364<para>Like the Linux-USB host side API, this API exposes
365the "chunky" nature of USB messages: I/O requests are in terms
366of one or more "packets", and packet boundaries are visible to drivers.
367Compared to RS-232 serial protocols, USB resembles
368synchronous protocols like HDLC
369(N bytes per frame, multipoint addressing, host as the primary
370station and devices as secondary stations)
371more than asynchronous ones
372(tty style: 8 data bits per frame, no parity, one stop bit).
373So for example the controller drivers won't buffer
374two single byte writes into a single two-byte USB IN packet,
375although gadget drivers may do so when they implement
376protocols where packet boundaries (and "short packets")
377are not significant.
378</para>
379
380<sect1 id="lifecycle"><title>Driver Life Cycle</title>
381
382<para>Gadget drivers make endpoint I/O requests to hardware without
383needing to know many details of the hardware, but driver
384setup/configuration code needs to handle some differences.
385Use the API like this:
386</para>
387
388<orderedlist numeration='arabic'>
389
390<listitem><para>Register a driver for the particular device side
391usb controller hardware,
392such as the net2280 on PCI (USB 2.0),
393sa11x0 or pxa25x as found in Linux PDAs,
394and so on.
395At this point the device is logically in the USB ch9 initial state
396("attached"), drawing no power and not usable
397(since it does not yet support enumeration).
398Any host should not see the device, since it's not
399activated the data line pullup used by the host to
400detect a device, even if VBUS power is available.
401</para></listitem>
402
403<listitem><para>Register a gadget driver that implements some higher level
404device function. That will then bind() to a usb_gadget, which
405activates the data line pullup sometime after detecting VBUS.
406</para></listitem>
407
408<listitem><para>The hardware driver can now start enumerating.
409The steps it handles are to accept USB power and set_address requests.
410Other steps are handled by the gadget driver.
411If the gadget driver module is unloaded before the host starts to
412enumerate, steps before step 7 are skipped.
413</para></listitem>
414
415<listitem><para>The gadget driver's setup() call returns usb descriptors,
416based both on what the bus interface hardware provides and on the
417functionality being implemented.
418That can involve alternate settings or configurations,
419unless the hardware prevents such operation.
420For OTG devices, each configuration descriptor includes
421an OTG descriptor.
422</para></listitem>
423
424<listitem><para>The gadget driver handles the last step of enumeration,
425when the USB host issues a set_configuration call.
426It enables all endpoints used in that configuration,
427with all interfaces in their default settings.
428That involves using a list of the hardware's endpoints, enabling each
429endpoint according to its descriptor.
430It may also involve using <function>usb_gadget_vbus_draw</function>
431to let more power be drawn from VBUS, as allowed by that configuration.
432For OTG devices, setting a configuration may also involve reporting
433HNP capabilities through a user interface.
434</para></listitem>
435
436<listitem><para>Do real work and perform data transfers, possibly involving
437changes to interface settings or switching to new configurations, until the
438device is disconnect()ed from the host.
439Queue any number of transfer requests to each endpoint.
440It may be suspended and resumed several times before being disconnected.
441On disconnect, the drivers go back to step 3 (above).
442</para></listitem>
443
444<listitem><para>When the gadget driver module is being unloaded,
445the driver unbind() callback is issued. That lets the controller
446driver be unloaded.
447</para></listitem>
448
449</orderedlist>
450
451<para>Drivers will normally be arranged so that just loading the
452gadget driver module (or statically linking it into a Linux kernel)
453allows the peripheral device to be enumerated, but some drivers
454will defer enumeration until some higher level component (like
455a user mode daemon) enables it.
456Note that at this lowest level there are no policies about how
457ep0 configuration logic is implemented,
458except that it should obey USB specifications.
459Such issues are in the domain of gadget drivers,
460including knowing about implementation constraints
461imposed by some USB controllers
462or understanding that composite devices might happen to
463be built by integrating reusable components.
464</para>
465
466<para>Note that the lifecycle above can be slightly different
467for OTG devices.
468Other than providing an additional OTG descriptor in each
469configuration, only the HNP-related differences are particularly
470visible to driver code.
471They involve reporting requirements during the SET_CONFIGURATION
472request, and the option to invoke HNP during some suspend callbacks.
473Also, SRP changes the semantics of
474<function>usb_gadget_wakeup</function>
475slightly.
476</para>
477
478</sect1>
479
480<sect1 id="ch9"><title>USB 2.0 Chapter 9 Types and Constants</title>
481
482<para>Gadget drivers
483rely on common USB structures and constants
484defined in the
485<filename>&lt;linux/usb/ch9.h&gt;</filename>
486header file, which is standard in Linux 2.6 kernels.
487These are the same types and constants used by host
488side drivers (and usbcore).
489</para>
490
491!Iinclude/linux/usb/ch9.h
492</sect1>
493
494<sect1 id="core"><title>Core Objects and Methods</title>
495
496<para>These are declared in
497<filename>&lt;linux/usb/gadget.h&gt;</filename>,
498and are used by gadget drivers to interact with
499USB peripheral controller drivers.
500</para>
501
502 <!-- yeech, this is ugly in nsgmls PDF output.
503
504 the PDF bookmark and refentry output nesting is wrong,
505 and the member/argument documentation indents ugly.
506
507 plus something (docproc?) adds whitespace before the
508 descriptive paragraph text, so it can't line up right
509 unless the explanations are trivial.
510 -->
511
512!Iinclude/linux/usb/gadget.h
513</sect1>
514
515<sect1 id="utils"><title>Optional Utilities</title>
516
517<para>The core API is sufficient for writing a USB Gadget Driver,
518but some optional utilities are provided to simplify common tasks.
519These utilities include endpoint autoconfiguration.
520</para>
521
522!Edrivers/usb/gadget/usbstring.c
523!Edrivers/usb/gadget/config.c
524<!-- !Edrivers/usb/gadget/epautoconf.c -->
525</sect1>
526
527<sect1 id="composite"><title>Composite Device Framework</title>
528
529<para>The core API is sufficient for writing drivers for composite
530USB devices (with more than one function in a given configuration),
531and also multi-configuration devices (also more than one function,
532but not necessarily sharing a given configuration).
533There is however an optional framework which makes it easier to
534reuse and combine functions.
535</para>
536
537<para>Devices using this framework provide a <emphasis>struct
538usb_composite_driver</emphasis>, which in turn provides one or
539more <emphasis>struct usb_configuration</emphasis> instances.
540Each such configuration includes at least one
541<emphasis>struct usb_function</emphasis>, which packages a user
542visible role such as "network link" or "mass storage device".
543Management functions may also exist, such as "Device Firmware
544Upgrade".
545</para>
546
547!Iinclude/linux/usb/composite.h
548!Edrivers/usb/gadget/composite.c
549
550</sect1>
551
552<sect1 id="functions"><title>Composite Device Functions</title>
553
554<para>At this writing, a few of the current gadget drivers have
555been converted to this framework.
556Near-term plans include converting all of them, except for "gadgetfs".
557</para>
558
559!Edrivers/usb/gadget/function/f_acm.c
560!Edrivers/usb/gadget/function/f_ecm.c
561!Edrivers/usb/gadget/function/f_subset.c
562!Edrivers/usb/gadget/function/f_obex.c
563!Edrivers/usb/gadget/function/f_serial.c
564
565</sect1>
566
567
568</chapter>
569
570<chapter id="controllers"><title>Peripheral Controller Drivers</title>
571
572<para>The first hardware supporting this API was the NetChip 2280
573controller, which supports USB 2.0 high speed and is based on PCI.
574This is the <filename>net2280</filename> driver module.
575The driver supports Linux kernel versions 2.4 and 2.6;
576contact NetChip Technologies for development boards and product
577information.
578</para>
579
580<para>Other hardware working in the "gadget" framework includes:
581Intel's PXA 25x and IXP42x series processors
582(<filename>pxa2xx_udc</filename>),
583Toshiba TC86c001 "Goku-S" (<filename>goku_udc</filename>),
584Renesas SH7705/7727 (<filename>sh_udc</filename>),
585MediaQ 11xx (<filename>mq11xx_udc</filename>),
586Hynix HMS30C7202 (<filename>h7202_udc</filename>),
587National 9303/4 (<filename>n9604_udc</filename>),
588Texas Instruments OMAP (<filename>omap_udc</filename>),
589Sharp LH7A40x (<filename>lh7a40x_udc</filename>),
590and more.
591Most of those are full speed controllers.
592</para>
593
594<para>At this writing, there are people at work on drivers in
595this framework for several other USB device controllers,
596with plans to make many of them be widely available.
597</para>
598
599<!-- !Edrivers/usb/gadget/net2280.c -->
600
601<para>A partial USB simulator,
602the <filename>dummy_hcd</filename> driver, is available.
603It can act like a net2280, a pxa25x, or an sa11x0 in terms
604of available endpoints and device speeds; and it simulates
605control, bulk, and to some extent interrupt transfers.
606That lets you develop some parts of a gadget driver on a normal PC,
607without any special hardware, and perhaps with the assistance
608of tools such as GDB running with User Mode Linux.
609At least one person has expressed interest in adapting that
610approach, hooking it up to a simulator for a microcontroller.
611Such simulators can help debug subsystems where the runtime hardware
612is unfriendly to software development, or is not yet available.
613</para>
614
615<para>Support for other controllers is expected to be developed
616and contributed
617over time, as this driver framework evolves.
618</para>
619
620</chapter>
621
622<chapter id="gadget"><title>Gadget Drivers</title>
623
624<para>In addition to <emphasis>Gadget Zero</emphasis>
625(used primarily for testing and development with drivers
626for usb controller hardware), other gadget drivers exist.
627</para>
628
629<para>There's an <emphasis>ethernet</emphasis> gadget
630driver, which implements one of the most useful
631<emphasis>Communications Device Class</emphasis> (CDC) models.
632One of the standards for cable modem interoperability even
633specifies the use of this ethernet model as one of two
634mandatory options.
635Gadgets using this code look to a USB host as if they're
636an Ethernet adapter.
637It provides access to a network where the gadget's CPU is one host,
638which could easily be bridging, routing, or firewalling
639access to other networks.
640Since some hardware can't fully implement the CDC Ethernet
641requirements, this driver also implements a "good parts only"
642subset of CDC Ethernet.
643(That subset doesn't advertise itself as CDC Ethernet,
644to avoid creating problems.)
645</para>
646
647<para>Support for Microsoft's <emphasis>RNDIS</emphasis>
648protocol has been contributed by Pengutronix and Auerswald GmbH.
649This is like CDC Ethernet, but it runs on more slightly USB hardware
650(but less than the CDC subset).
651However, its main claim to fame is being able to connect directly to
652recent versions of Windows, using drivers that Microsoft bundles
653and supports, making it much simpler to network with Windows.
654</para>
655
656<para>There is also support for user mode gadget drivers,
657using <emphasis>gadgetfs</emphasis>.
658This provides a <emphasis>User Mode API</emphasis> that presents
659each endpoint as a single file descriptor. I/O is done using
660normal <emphasis>read()</emphasis> and <emphasis>read()</emphasis> calls.
661Familiar tools like GDB and pthreads can be used to
662develop and debug user mode drivers, so that once a robust
663controller driver is available many applications for it
664won't require new kernel mode software.
665Linux 2.6 <emphasis>Async I/O (AIO)</emphasis>
666support is available, so that user mode software
667can stream data with only slightly more overhead
668than a kernel driver.
669</para>
670
671<para>There's a USB Mass Storage class driver, which provides
672a different solution for interoperability with systems such
673as MS-Windows and MacOS.
674That <emphasis>Mass Storage</emphasis> driver uses a
675file or block device as backing store for a drive,
676like the <filename>loop</filename> driver.
677The USB host uses the BBB, CB, or CBI versions of the mass
678storage class specification, using transparent SCSI commands
679to access the data from the backing store.
680</para>
681
682<para>There's a "serial line" driver, useful for TTY style
683operation over USB.
684The latest version of that driver supports CDC ACM style
685operation, like a USB modem, and so on most hardware it can
686interoperate easily with MS-Windows.
687One interesting use of that driver is in boot firmware (like a BIOS),
688which can sometimes use that model with very small systems without
689real serial lines.
690</para>
691
692<para>Support for other kinds of gadget is expected to
693be developed and contributed
694over time, as this driver framework evolves.
695</para>
696
697</chapter>
698
699<chapter id="otg"><title>USB On-The-GO (OTG)</title>
700
701<para>USB OTG support on Linux 2.6 was initially developed
702by Texas Instruments for
703<ulink url="http://www.omap.com">OMAP</ulink> 16xx and 17xx
704series processors.
705Other OTG systems should work in similar ways, but the
706hardware level details could be very different.
707</para>
708
709<para>Systems need specialized hardware support to implement OTG,
710notably including a special <emphasis>Mini-AB</emphasis> jack
711and associated transceiver to support <emphasis>Dual-Role</emphasis>
712operation:
713they can act either as a host, using the standard
714Linux-USB host side driver stack,
715or as a peripheral, using this "gadget" framework.
716To do that, the system software relies on small additions
717to those programming interfaces,
718and on a new internal component (here called an "OTG Controller")
719affecting which driver stack connects to the OTG port.
720In each role, the system can re-use the existing pool of
721hardware-neutral drivers, layered on top of the controller
722driver interfaces (<emphasis>usb_bus</emphasis> or
723<emphasis>usb_gadget</emphasis>).
724Such drivers need at most minor changes, and most of the calls
725added to support OTG can also benefit non-OTG products.
726</para>
727
728<itemizedlist>
729 <listitem><para>Gadget drivers test the <emphasis>is_otg</emphasis>
730 flag, and use it to determine whether or not to include
731 an OTG descriptor in each of their configurations.
732 </para></listitem>
733 <listitem><para>Gadget drivers may need changes to support the
734 two new OTG protocols, exposed in new gadget attributes
735 such as <emphasis>b_hnp_enable</emphasis> flag.
736 HNP support should be reported through a user interface
737 (two LEDs could suffice), and is triggered in some cases
738 when the host suspends the peripheral.
739 SRP support can be user-initiated just like remote wakeup,
740 probably by pressing the same button.
741 </para></listitem>
742 <listitem><para>On the host side, USB device drivers need
743 to be taught to trigger HNP at appropriate moments, using
744 <function>usb_suspend_device()</function>.
745 That also conserves battery power, which is useful even
746 for non-OTG configurations.
747 </para></listitem>
748 <listitem><para>Also on the host side, a driver must support the
749 OTG "Targeted Peripheral List". That's just a whitelist,
750 used to reject peripherals not supported with a given
751 Linux OTG host.
752 <emphasis>This whitelist is product-specific;
753 each product must modify <filename>otg_whitelist.h</filename>
754 to match its interoperability specification.
755 </emphasis>
756 </para>
757 <para>Non-OTG Linux hosts, like PCs and workstations,
758 normally have some solution for adding drivers, so that
759 peripherals that aren't recognized can eventually be supported.
760 That approach is unreasonable for consumer products that may
761 never have their firmware upgraded, and where it's usually
762 unrealistic to expect traditional PC/workstation/server kinds
763 of support model to work.
764 For example, it's often impractical to change device firmware
765 once the product has been distributed, so driver bugs can't
766 normally be fixed if they're found after shipment.
767 </para></listitem>
768</itemizedlist>
769
770<para>
771Additional changes are needed below those hardware-neutral
772<emphasis>usb_bus</emphasis> and <emphasis>usb_gadget</emphasis>
773driver interfaces; those aren't discussed here in any detail.
774Those affect the hardware-specific code for each USB Host or Peripheral
775controller, and how the HCD initializes (since OTG can be active only
776on a single port).
777They also involve what may be called an <emphasis>OTG Controller
778Driver</emphasis>, managing the OTG transceiver and the OTG state
779machine logic as well as much of the root hub behavior for the
780OTG port.
781The OTG controller driver needs to activate and deactivate USB
782controllers depending on the relevant device role.
783Some related changes were needed inside usbcore, so that it
784can identify OTG-capable devices and respond appropriately
785to HNP or SRP protocols.
786</para>
787
788</chapter>
789
790</book>
791<!--
792 vim:syntax=sgml:sw=4
793-->
diff --git a/Documentation/DocBook/genericirq.tmpl b/Documentation/DocBook/genericirq.tmpl
deleted file mode 100644
index 59fb5c077541..000000000000
--- a/Documentation/DocBook/genericirq.tmpl
+++ /dev/null
@@ -1,520 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="Generic-IRQ-Guide">
6 <bookinfo>
7 <title>Linux generic IRQ handling</title>
8
9 <authorgroup>
10 <author>
11 <firstname>Thomas</firstname>
12 <surname>Gleixner</surname>
13 <affiliation>
14 <address>
15 <email>tglx@linutronix.de</email>
16 </address>
17 </affiliation>
18 </author>
19 <author>
20 <firstname>Ingo</firstname>
21 <surname>Molnar</surname>
22 <affiliation>
23 <address>
24 <email>mingo@elte.hu</email>
25 </address>
26 </affiliation>
27 </author>
28 </authorgroup>
29
30 <copyright>
31 <year>2005-2010</year>
32 <holder>Thomas Gleixner</holder>
33 </copyright>
34 <copyright>
35 <year>2005-2006</year>
36 <holder>Ingo Molnar</holder>
37 </copyright>
38
39 <legalnotice>
40 <para>
41 This documentation is free software; you can redistribute
42 it and/or modify it under the terms of the GNU General Public
43 License version 2 as published by the Free Software Foundation.
44 </para>
45
46 <para>
47 This program is distributed in the hope that it will be
48 useful, but WITHOUT ANY WARRANTY; without even the implied
49 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
50 See the GNU General Public License for more details.
51 </para>
52
53 <para>
54 You should have received a copy of the GNU General Public
55 License along with this program; if not, write to the Free
56 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
57 MA 02111-1307 USA
58 </para>
59
60 <para>
61 For more details see the file COPYING in the source
62 distribution of Linux.
63 </para>
64 </legalnotice>
65 </bookinfo>
66
67<toc></toc>
68
69 <chapter id="intro">
70 <title>Introduction</title>
71 <para>
72 The generic interrupt handling layer is designed to provide a
73 complete abstraction of interrupt handling for device drivers.
74 It is able to handle all the different types of interrupt controller
75 hardware. Device drivers use generic API functions to request, enable,
76 disable and free interrupts. The drivers do not have to know anything
77 about interrupt hardware details, so they can be used on different
78 platforms without code changes.
79 </para>
80 <para>
81 This documentation is provided to developers who want to implement
82 an interrupt subsystem based for their architecture, with the help
83 of the generic IRQ handling layer.
84 </para>
85 </chapter>
86
87 <chapter id="rationale">
88 <title>Rationale</title>
89 <para>
90 The original implementation of interrupt handling in Linux uses
91 the __do_IRQ() super-handler, which is able to deal with every
92 type of interrupt logic.
93 </para>
94 <para>
95 Originally, Russell King identified different types of handlers to
96 build a quite universal set for the ARM interrupt handler
97 implementation in Linux 2.5/2.6. He distinguished between:
98 <itemizedlist>
99 <listitem><para>Level type</para></listitem>
100 <listitem><para>Edge type</para></listitem>
101 <listitem><para>Simple type</para></listitem>
102 </itemizedlist>
103 During the implementation we identified another type:
104 <itemizedlist>
105 <listitem><para>Fast EOI type</para></listitem>
106 </itemizedlist>
107 In the SMP world of the __do_IRQ() super-handler another type
108 was identified:
109 <itemizedlist>
110 <listitem><para>Per CPU type</para></listitem>
111 </itemizedlist>
112 </para>
113 <para>
114 This split implementation of high-level IRQ handlers allows us to
115 optimize the flow of the interrupt handling for each specific
116 interrupt type. This reduces complexity in that particular code path
117 and allows the optimized handling of a given type.
118 </para>
119 <para>
120 The original general IRQ implementation used hw_interrupt_type
121 structures and their ->ack(), ->end() [etc.] callbacks to
122 differentiate the flow control in the super-handler. This leads to
123 a mix of flow logic and low-level hardware logic, and it also leads
124 to unnecessary code duplication: for example in i386, there is an
125 ioapic_level_irq and an ioapic_edge_irq IRQ-type which share many
126 of the low-level details but have different flow handling.
127 </para>
128 <para>
129 A more natural abstraction is the clean separation of the
130 'irq flow' and the 'chip details'.
131 </para>
132 <para>
133 Analysing a couple of architecture's IRQ subsystem implementations
134 reveals that most of them can use a generic set of 'irq flow'
135 methods and only need to add the chip-level specific code.
136 The separation is also valuable for (sub)architectures
137 which need specific quirks in the IRQ flow itself but not in the
138 chip details - and thus provides a more transparent IRQ subsystem
139 design.
140 </para>
141 <para>
142 Each interrupt descriptor is assigned its own high-level flow
143 handler, which is normally one of the generic
144 implementations. (This high-level flow handler implementation also
145 makes it simple to provide demultiplexing handlers which can be
146 found in embedded platforms on various architectures.)
147 </para>
148 <para>
149 The separation makes the generic interrupt handling layer more
150 flexible and extensible. For example, an (sub)architecture can
151 use a generic IRQ-flow implementation for 'level type' interrupts
152 and add a (sub)architecture specific 'edge type' implementation.
153 </para>
154 <para>
155 To make the transition to the new model easier and prevent the
156 breakage of existing implementations, the __do_IRQ() super-handler
157 is still available. This leads to a kind of duality for the time
158 being. Over time the new model should be used in more and more
159 architectures, as it enables smaller and cleaner IRQ subsystems.
160 It's deprecated for three years now and about to be removed.
161 </para>
162 </chapter>
163 <chapter id="bugs">
164 <title>Known Bugs And Assumptions</title>
165 <para>
166 None (knock on wood).
167 </para>
168 </chapter>
169
170 <chapter id="Abstraction">
171 <title>Abstraction layers</title>
172 <para>
173 There are three main levels of abstraction in the interrupt code:
174 <orderedlist>
175 <listitem><para>High-level driver API</para></listitem>
176 <listitem><para>High-level IRQ flow handlers</para></listitem>
177 <listitem><para>Chip-level hardware encapsulation</para></listitem>
178 </orderedlist>
179 </para>
180 <sect1 id="Interrupt_control_flow">
181 <title>Interrupt control flow</title>
182 <para>
183 Each interrupt is described by an interrupt descriptor structure
184 irq_desc. The interrupt is referenced by an 'unsigned int' numeric
185 value which selects the corresponding interrupt description structure
186 in the descriptor structures array.
187 The descriptor structure contains status information and pointers
188 to the interrupt flow method and the interrupt chip structure
189 which are assigned to this interrupt.
190 </para>
191 <para>
192 Whenever an interrupt triggers, the low-level architecture code calls
193 into the generic interrupt code by calling desc->handle_irq().
194 This high-level IRQ handling function only uses desc->irq_data.chip
195 primitives referenced by the assigned chip descriptor structure.
196 </para>
197 </sect1>
198 <sect1 id="Highlevel_Driver_API">
199 <title>High-level Driver API</title>
200 <para>
201 The high-level Driver API consists of following functions:
202 <itemizedlist>
203 <listitem><para>request_irq()</para></listitem>
204 <listitem><para>free_irq()</para></listitem>
205 <listitem><para>disable_irq()</para></listitem>
206 <listitem><para>enable_irq()</para></listitem>
207 <listitem><para>disable_irq_nosync() (SMP only)</para></listitem>
208 <listitem><para>synchronize_irq() (SMP only)</para></listitem>
209 <listitem><para>irq_set_irq_type()</para></listitem>
210 <listitem><para>irq_set_irq_wake()</para></listitem>
211 <listitem><para>irq_set_handler_data()</para></listitem>
212 <listitem><para>irq_set_chip()</para></listitem>
213 <listitem><para>irq_set_chip_data()</para></listitem>
214 </itemizedlist>
215 See the autogenerated function documentation for details.
216 </para>
217 </sect1>
218 <sect1 id="Highlevel_IRQ_flow_handlers">
219 <title>High-level IRQ flow handlers</title>
220 <para>
221 The generic layer provides a set of pre-defined irq-flow methods:
222 <itemizedlist>
223 <listitem><para>handle_level_irq</para></listitem>
224 <listitem><para>handle_edge_irq</para></listitem>
225 <listitem><para>handle_fasteoi_irq</para></listitem>
226 <listitem><para>handle_simple_irq</para></listitem>
227 <listitem><para>handle_percpu_irq</para></listitem>
228 <listitem><para>handle_edge_eoi_irq</para></listitem>
229 <listitem><para>handle_bad_irq</para></listitem>
230 </itemizedlist>
231 The interrupt flow handlers (either pre-defined or architecture
232 specific) are assigned to specific interrupts by the architecture
233 either during bootup or during device initialization.
234 </para>
235 <sect2 id="Default_flow_implementations">
236 <title>Default flow implementations</title>
237 <sect3 id="Helper_functions">
238 <title>Helper functions</title>
239 <para>
240 The helper functions call the chip primitives and
241 are used by the default flow implementations.
242 The following helper functions are implemented (simplified excerpt):
243 <programlisting>
244default_enable(struct irq_data *data)
245{
246 desc->irq_data.chip->irq_unmask(data);
247}
248
249default_disable(struct irq_data *data)
250{
251 if (!delay_disable(data))
252 desc->irq_data.chip->irq_mask(data);
253}
254
255default_ack(struct irq_data *data)
256{
257 chip->irq_ack(data);
258}
259
260default_mask_ack(struct irq_data *data)
261{
262 if (chip->irq_mask_ack) {
263 chip->irq_mask_ack(data);
264 } else {
265 chip->irq_mask(data);
266 chip->irq_ack(data);
267 }
268}
269
270noop(struct irq_data *data))
271{
272}
273
274 </programlisting>
275 </para>
276 </sect3>
277 </sect2>
278 <sect2 id="Default_flow_handler_implementations">
279 <title>Default flow handler implementations</title>
280 <sect3 id="Default_Level_IRQ_flow_handler">
281 <title>Default Level IRQ flow handler</title>
282 <para>
283 handle_level_irq provides a generic implementation
284 for level-triggered interrupts.
285 </para>
286 <para>
287 The following control flow is implemented (simplified excerpt):
288 <programlisting>
289desc->irq_data.chip->irq_mask_ack();
290handle_irq_event(desc->action);
291desc->irq_data.chip->irq_unmask();
292 </programlisting>
293 </para>
294 </sect3>
295 <sect3 id="Default_FASTEOI_IRQ_flow_handler">
296 <title>Default Fast EOI IRQ flow handler</title>
297 <para>
298 handle_fasteoi_irq provides a generic implementation
299 for interrupts, which only need an EOI at the end of
300 the handler.
301 </para>
302 <para>
303 The following control flow is implemented (simplified excerpt):
304 <programlisting>
305handle_irq_event(desc->action);
306desc->irq_data.chip->irq_eoi();
307 </programlisting>
308 </para>
309 </sect3>
310 <sect3 id="Default_Edge_IRQ_flow_handler">
311 <title>Default Edge IRQ flow handler</title>
312 <para>
313 handle_edge_irq provides a generic implementation
314 for edge-triggered interrupts.
315 </para>
316 <para>
317 The following control flow is implemented (simplified excerpt):
318 <programlisting>
319if (desc->status &amp; running) {
320 desc->irq_data.chip->irq_mask_ack();
321 desc->status |= pending | masked;
322 return;
323}
324desc->irq_data.chip->irq_ack();
325desc->status |= running;
326do {
327 if (desc->status &amp; masked)
328 desc->irq_data.chip->irq_unmask();
329 desc->status &amp;= ~pending;
330 handle_irq_event(desc->action);
331} while (status &amp; pending);
332desc->status &amp;= ~running;
333 </programlisting>
334 </para>
335 </sect3>
336 <sect3 id="Default_simple_IRQ_flow_handler">
337 <title>Default simple IRQ flow handler</title>
338 <para>
339 handle_simple_irq provides a generic implementation
340 for simple interrupts.
341 </para>
342 <para>
343 Note: The simple flow handler does not call any
344 handler/chip primitives.
345 </para>
346 <para>
347 The following control flow is implemented (simplified excerpt):
348 <programlisting>
349handle_irq_event(desc->action);
350 </programlisting>
351 </para>
352 </sect3>
353 <sect3 id="Default_per_CPU_flow_handler">
354 <title>Default per CPU flow handler</title>
355 <para>
356 handle_percpu_irq provides a generic implementation
357 for per CPU interrupts.
358 </para>
359 <para>
360 Per CPU interrupts are only available on SMP and
361 the handler provides a simplified version without
362 locking.
363 </para>
364 <para>
365 The following control flow is implemented (simplified excerpt):
366 <programlisting>
367if (desc->irq_data.chip->irq_ack)
368 desc->irq_data.chip->irq_ack();
369handle_irq_event(desc->action);
370if (desc->irq_data.chip->irq_eoi)
371 desc->irq_data.chip->irq_eoi();
372 </programlisting>
373 </para>
374 </sect3>
375 <sect3 id="EOI_Edge_IRQ_flow_handler">
376 <title>EOI Edge IRQ flow handler</title>
377 <para>
378 handle_edge_eoi_irq provides an abnomination of the edge
379 handler which is solely used to tame a badly wreckaged
380 irq controller on powerpc/cell.
381 </para>
382 </sect3>
383 <sect3 id="BAD_IRQ_flow_handler">
384 <title>Bad IRQ flow handler</title>
385 <para>
386 handle_bad_irq is used for spurious interrupts which
387 have no real handler assigned..
388 </para>
389 </sect3>
390 </sect2>
391 <sect2 id="Quirks_and_optimizations">
392 <title>Quirks and optimizations</title>
393 <para>
394 The generic functions are intended for 'clean' architectures and chips,
395 which have no platform-specific IRQ handling quirks. If an architecture
396 needs to implement quirks on the 'flow' level then it can do so by
397 overriding the high-level irq-flow handler.
398 </para>
399 </sect2>
400 <sect2 id="Delayed_interrupt_disable">
401 <title>Delayed interrupt disable</title>
402 <para>
403 This per interrupt selectable feature, which was introduced by Russell
404 King in the ARM interrupt implementation, does not mask an interrupt
405 at the hardware level when disable_irq() is called. The interrupt is
406 kept enabled and is masked in the flow handler when an interrupt event
407 happens. This prevents losing edge interrupts on hardware which does
408 not store an edge interrupt event while the interrupt is disabled at
409 the hardware level. When an interrupt arrives while the IRQ_DISABLED
410 flag is set, then the interrupt is masked at the hardware level and
411 the IRQ_PENDING bit is set. When the interrupt is re-enabled by
412 enable_irq() the pending bit is checked and if it is set, the
413 interrupt is resent either via hardware or by a software resend
414 mechanism. (It's necessary to enable CONFIG_HARDIRQS_SW_RESEND when
415 you want to use the delayed interrupt disable feature and your
416 hardware is not capable of retriggering an interrupt.)
417 The delayed interrupt disable is not configurable.
418 </para>
419 </sect2>
420 </sect1>
421 <sect1 id="Chiplevel_hardware_encapsulation">
422 <title>Chip-level hardware encapsulation</title>
423 <para>
424 The chip-level hardware descriptor structure irq_chip
425 contains all the direct chip relevant functions, which
426 can be utilized by the irq flow implementations.
427 <itemizedlist>
428 <listitem><para>irq_ack()</para></listitem>
429 <listitem><para>irq_mask_ack() - Optional, recommended for performance</para></listitem>
430 <listitem><para>irq_mask()</para></listitem>
431 <listitem><para>irq_unmask()</para></listitem>
432 <listitem><para>irq_eoi() - Optional, required for EOI flow handlers</para></listitem>
433 <listitem><para>irq_retrigger() - Optional</para></listitem>
434 <listitem><para>irq_set_type() - Optional</para></listitem>
435 <listitem><para>irq_set_wake() - Optional</para></listitem>
436 </itemizedlist>
437 These primitives are strictly intended to mean what they say: ack means
438 ACK, masking means masking of an IRQ line, etc. It is up to the flow
439 handler(s) to use these basic units of low-level functionality.
440 </para>
441 </sect1>
442 </chapter>
443
444 <chapter id="doirq">
445 <title>__do_IRQ entry point</title>
446 <para>
447 The original implementation __do_IRQ() was an alternative entry
448 point for all types of interrupts. It no longer exists.
449 </para>
450 <para>
451 This handler turned out to be not suitable for all
452 interrupt hardware and was therefore reimplemented with split
453 functionality for edge/level/simple/percpu interrupts. This is not
454 only a functional optimization. It also shortens code paths for
455 interrupts.
456 </para>
457 </chapter>
458
459 <chapter id="locking">
460 <title>Locking on SMP</title>
461 <para>
462 The locking of chip registers is up to the architecture that
463 defines the chip primitives. The per-irq structure is
464 protected via desc->lock, by the generic layer.
465 </para>
466 </chapter>
467
468 <chapter id="genericchip">
469 <title>Generic interrupt chip</title>
470 <para>
471 To avoid copies of identical implementations of IRQ chips the
472 core provides a configurable generic interrupt chip
473 implementation. Developers should check carefully whether the
474 generic chip fits their needs before implementing the same
475 functionality slightly differently themselves.
476 </para>
477!Ekernel/irq/generic-chip.c
478 </chapter>
479
480 <chapter id="structs">
481 <title>Structures</title>
482 <para>
483 This chapter contains the autogenerated documentation of the structures which are
484 used in the generic IRQ layer.
485 </para>
486!Iinclude/linux/irq.h
487!Iinclude/linux/interrupt.h
488 </chapter>
489
490 <chapter id="pubfunctions">
491 <title>Public Functions Provided</title>
492 <para>
493 This chapter contains the autogenerated documentation of the kernel API functions
494 which are exported.
495 </para>
496!Ekernel/irq/manage.c
497!Ekernel/irq/chip.c
498 </chapter>
499
500 <chapter id="intfunctions">
501 <title>Internal Functions Provided</title>
502 <para>
503 This chapter contains the autogenerated documentation of the internal functions.
504 </para>
505!Ikernel/irq/irqdesc.c
506!Ikernel/irq/handle.c
507!Ikernel/irq/chip.c
508 </chapter>
509
510 <chapter id="credits">
511 <title>Credits</title>
512 <para>
513 The following people have contributed to this document:
514 <orderedlist>
515 <listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem>
516 <listitem><para>Ingo Molnar<email>mingo@elte.hu</email></para></listitem>
517 </orderedlist>
518 </para>
519 </chapter>
520</book>
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
deleted file mode 100644
index ecfd0ea40661..000000000000
--- a/Documentation/DocBook/kernel-api.tmpl
+++ /dev/null
@@ -1,331 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="LinuxKernelAPI">
6 <bookinfo>
7 <title>The Linux Kernel API</title>
8
9 <legalnotice>
10 <para>
11 This documentation is free software; you can redistribute
12 it and/or modify it under the terms of the GNU General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later
15 version.
16 </para>
17
18 <para>
19 This program is distributed in the hope that it will be
20 useful, but WITHOUT ANY WARRANTY; without even the implied
21 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 See the GNU General Public License for more details.
23 </para>
24
25 <para>
26 You should have received a copy of the GNU General Public
27 License along with this program; if not, write to the Free
28 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 MA 02111-1307 USA
30 </para>
31
32 <para>
33 For more details see the file COPYING in the source
34 distribution of Linux.
35 </para>
36 </legalnotice>
37 </bookinfo>
38
39<toc></toc>
40
41 <chapter id="adt">
42 <title>Data Types</title>
43 <sect1><title>Doubly Linked Lists</title>
44!Iinclude/linux/list.h
45 </sect1>
46 </chapter>
47
48 <chapter id="libc">
49 <title>Basic C Library Functions</title>
50
51 <para>
52 When writing drivers, you cannot in general use routines which are
53 from the C Library. Some of the functions have been found generally
54 useful and they are listed below. The behaviour of these functions
55 may vary slightly from those defined by ANSI, and these deviations
56 are noted in the text.
57 </para>
58
59 <sect1><title>String Conversions</title>
60!Elib/vsprintf.c
61!Finclude/linux/kernel.h kstrtol
62!Finclude/linux/kernel.h kstrtoul
63!Elib/kstrtox.c
64 </sect1>
65 <sect1><title>String Manipulation</title>
66<!-- All functions are exported at now
67X!Ilib/string.c
68 -->
69!Elib/string.c
70 </sect1>
71 <sect1><title>Bit Operations</title>
72!Iarch/x86/include/asm/bitops.h
73 </sect1>
74 </chapter>
75
76 <chapter id="kernel-lib">
77 <title>Basic Kernel Library Functions</title>
78
79 <para>
80 The Linux kernel provides more basic utility functions.
81 </para>
82
83 <sect1><title>Bitmap Operations</title>
84!Elib/bitmap.c
85!Ilib/bitmap.c
86 </sect1>
87
88 <sect1><title>Command-line Parsing</title>
89!Elib/cmdline.c
90 </sect1>
91
92 <sect1 id="crc"><title>CRC Functions</title>
93!Elib/crc7.c
94!Elib/crc16.c
95!Elib/crc-itu-t.c
96!Elib/crc32.c
97!Elib/crc-ccitt.c
98 </sect1>
99
100 <sect1 id="idr"><title>idr/ida Functions</title>
101!Pinclude/linux/idr.h idr sync
102!Plib/idr.c IDA description
103!Elib/idr.c
104 </sect1>
105 </chapter>
106
107 <chapter id="mm">
108 <title>Memory Management in Linux</title>
109 <sect1><title>The Slab Cache</title>
110!Iinclude/linux/slab.h
111!Emm/slab.c
112!Emm/util.c
113 </sect1>
114 <sect1><title>User Space Memory Access</title>
115!Iarch/x86/include/asm/uaccess_32.h
116!Earch/x86/lib/usercopy_32.c
117 </sect1>
118 <sect1><title>More Memory Management Functions</title>
119!Emm/readahead.c
120!Emm/filemap.c
121!Emm/memory.c
122!Emm/vmalloc.c
123!Imm/page_alloc.c
124!Emm/mempool.c
125!Emm/dmapool.c
126!Emm/page-writeback.c
127!Emm/truncate.c
128 </sect1>
129 </chapter>
130
131
132 <chapter id="ipc">
133 <title>Kernel IPC facilities</title>
134
135 <sect1><title>IPC utilities</title>
136!Iipc/util.c
137 </sect1>
138 </chapter>
139
140 <chapter id="kfifo">
141 <title>FIFO Buffer</title>
142 <sect1><title>kfifo interface</title>
143!Iinclude/linux/kfifo.h
144 </sect1>
145 </chapter>
146
147 <chapter id="relayfs">
148 <title>relay interface support</title>
149
150 <para>
151 Relay interface support
152 is designed to provide an efficient mechanism for tools and
153 facilities to relay large amounts of data from kernel space to
154 user space.
155 </para>
156
157 <sect1><title>relay interface</title>
158!Ekernel/relay.c
159!Ikernel/relay.c
160 </sect1>
161 </chapter>
162
163 <chapter id="modload">
164 <title>Module Support</title>
165 <sect1><title>Module Loading</title>
166!Ekernel/kmod.c
167 </sect1>
168 <sect1><title>Inter Module support</title>
169 <para>
170 Refer to the file kernel/module.c for more information.
171 </para>
172<!-- FIXME: Removed for now since no structured comments in source
173X!Ekernel/module.c
174-->
175 </sect1>
176 </chapter>
177
178 <chapter id="hardware">
179 <title>Hardware Interfaces</title>
180 <sect1><title>Interrupt Handling</title>
181!Ekernel/irq/manage.c
182 </sect1>
183
184 <sect1><title>DMA Channels</title>
185!Ekernel/dma.c
186 </sect1>
187
188 <sect1><title>Resources Management</title>
189!Ikernel/resource.c
190!Ekernel/resource.c
191 </sect1>
192
193 <sect1><title>MTRR Handling</title>
194!Earch/x86/kernel/cpu/mtrr/main.c
195 </sect1>
196
197 <sect1><title>PCI Support Library</title>
198!Edrivers/pci/pci.c
199!Edrivers/pci/pci-driver.c
200!Edrivers/pci/remove.c
201!Edrivers/pci/search.c
202!Edrivers/pci/msi.c
203!Edrivers/pci/bus.c
204!Edrivers/pci/access.c
205!Edrivers/pci/irq.c
206!Edrivers/pci/htirq.c
207<!-- FIXME: Removed for now since no structured comments in source
208X!Edrivers/pci/hotplug.c
209-->
210!Edrivers/pci/probe.c
211!Edrivers/pci/slot.c
212!Edrivers/pci/rom.c
213!Edrivers/pci/iov.c
214!Idrivers/pci/pci-sysfs.c
215 </sect1>
216 <sect1><title>PCI Hotplug Support Library</title>
217!Edrivers/pci/hotplug/pci_hotplug_core.c
218 </sect1>
219 </chapter>
220
221 <chapter id="firmware">
222 <title>Firmware Interfaces</title>
223 <sect1><title>DMI Interfaces</title>
224!Edrivers/firmware/dmi_scan.c
225 </sect1>
226 <sect1><title>EDD Interfaces</title>
227!Idrivers/firmware/edd.c
228 </sect1>
229 </chapter>
230
231 <chapter id="security">
232 <title>Security Framework</title>
233!Isecurity/security.c
234!Esecurity/inode.c
235 </chapter>
236
237 <chapter id="audit">
238 <title>Audit Interfaces</title>
239!Ekernel/audit.c
240!Ikernel/auditsc.c
241!Ikernel/auditfilter.c
242 </chapter>
243
244 <chapter id="accounting">
245 <title>Accounting Framework</title>
246!Ikernel/acct.c
247 </chapter>
248
249 <chapter id="blkdev">
250 <title>Block Devices</title>
251!Eblock/blk-core.c
252!Iblock/blk-core.c
253!Eblock/blk-map.c
254!Iblock/blk-sysfs.c
255!Eblock/blk-settings.c
256!Eblock/blk-exec.c
257!Eblock/blk-flush.c
258!Eblock/blk-lib.c
259!Eblock/blk-tag.c
260!Iblock/blk-tag.c
261!Eblock/blk-integrity.c
262!Ikernel/trace/blktrace.c
263!Iblock/genhd.c
264!Eblock/genhd.c
265 </chapter>
266
267 <chapter id="chrdev">
268 <title>Char devices</title>
269!Efs/char_dev.c
270 </chapter>
271
272 <chapter id="miscdev">
273 <title>Miscellaneous Devices</title>
274!Edrivers/char/misc.c
275 </chapter>
276
277 <chapter id="clk">
278 <title>Clock Framework</title>
279
280 <para>
281 The clock framework defines programming interfaces to support
282 software management of the system clock tree.
283 This framework is widely used with System-On-Chip (SOC) platforms
284 to support power management and various devices which may need
285 custom clock rates.
286 Note that these "clocks" don't relate to timekeeping or real
287 time clocks (RTCs), each of which have separate frameworks.
288 These <structname>struct clk</structname> instances may be used
289 to manage for example a 96 MHz signal that is used to shift bits
290 into and out of peripherals or busses, or otherwise trigger
291 synchronous state machine transitions in system hardware.
292 </para>
293
294 <para>
295 Power management is supported by explicit software clock gating:
296 unused clocks are disabled, so the system doesn't waste power
297 changing the state of transistors that aren't in active use.
298 On some systems this may be backed by hardware clock gating,
299 where clocks are gated without being disabled in software.
300 Sections of chips that are powered but not clocked may be able
301 to retain their last state.
302 This low power state is often called a <emphasis>retention
303 mode</emphasis>.
304 This mode still incurs leakage currents, especially with finer
305 circuit geometries, but for CMOS circuits power is mostly used
306 by clocked state changes.
307 </para>
308
309 <para>
310 Power-aware drivers only enable their clocks when the device
311 they manage is in active use. Also, system sleep states often
312 differ according to which clock domains are active: while a
313 "standby" state may allow wakeup from several active domains, a
314 "mem" (suspend-to-RAM) state may require a more wholesale shutdown
315 of clocks derived from higher speed PLLs and oscillators, limiting
316 the number of possible wakeup event sources. A driver's suspend
317 method may need to be aware of system-specific clock constraints
318 on the target sleep state.
319 </para>
320
321 <para>
322 Some platforms support programmable clock generators. These
323 can be used by external chips of various kinds, such as other
324 CPUs, multimedia codecs, and devices with strict requirements
325 for interface clocking.
326 </para>
327
328!Iinclude/linux/clk.h
329 </chapter>
330
331</book>
diff --git a/Documentation/DocBook/writing_musb_glue_layer.tmpl b/Documentation/DocBook/writing_musb_glue_layer.tmpl
deleted file mode 100644
index 837eca77f274..000000000000
--- a/Documentation/DocBook/writing_musb_glue_layer.tmpl
+++ /dev/null
@@ -1,873 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="Writing-MUSB-Glue-Layer">
6 <bookinfo>
7 <title>Writing an MUSB Glue Layer</title>
8
9 <authorgroup>
10 <author>
11 <firstname>Apelete</firstname>
12 <surname>Seketeli</surname>
13 <affiliation>
14 <address>
15 <email>apelete at seketeli.net</email>
16 </address>
17 </affiliation>
18 </author>
19 </authorgroup>
20
21 <copyright>
22 <year>2014</year>
23 <holder>Apelete Seketeli</holder>
24 </copyright>
25
26 <legalnotice>
27 <para>
28 This documentation is free software; you can redistribute it
29 and/or modify it under the terms of the GNU General Public
30 License as published by the Free Software Foundation; either
31 version 2 of the License, or (at your option) any later version.
32 </para>
33
34 <para>
35 This documentation is distributed in the hope that it will be
36 useful, but WITHOUT ANY WARRANTY; without even the implied
37 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
38 See the GNU General Public License for more details.
39 </para>
40
41 <para>
42 You should have received a copy of the GNU General Public License
43 along with this documentation; if not, write to the Free Software
44 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
45 02111-1307 USA
46 </para>
47
48 <para>
49 For more details see the file COPYING in the Linux kernel source
50 tree.
51 </para>
52 </legalnotice>
53 </bookinfo>
54
55<toc></toc>
56
57 <chapter id="introduction">
58 <title>Introduction</title>
59 <para>
60 The Linux MUSB subsystem is part of the larger Linux USB
61 subsystem. It provides support for embedded USB Device Controllers
62 (UDC) that do not use Universal Host Controller Interface (UHCI)
63 or Open Host Controller Interface (OHCI).
64 </para>
65 <para>
66 Instead, these embedded UDC rely on the USB On-the-Go (OTG)
67 specification which they implement at least partially. The silicon
68 reference design used in most cases is the Multipoint USB
69 Highspeed Dual-Role Controller (MUSB HDRC) found in the Mentor
70 Graphics Inventraâ„¢ design.
71 </para>
72 <para>
73 As a self-taught exercise I have written an MUSB glue layer for
74 the Ingenic JZ4740 SoC, modelled after the many MUSB glue layers
75 in the kernel source tree. This layer can be found at
76 drivers/usb/musb/jz4740.c. In this documentation I will walk
77 through the basics of the jz4740.c glue layer, explaining the
78 different pieces and what needs to be done in order to write your
79 own device glue layer.
80 </para>
81 </chapter>
82
83 <chapter id="linux-musb-basics">
84 <title>Linux MUSB Basics</title>
85 <para>
86 To get started on the topic, please read USB On-the-Go Basics (see
87 Resources) which provides an introduction of USB OTG operation at
88 the hardware level. A couple of wiki pages by Texas Instruments
89 and Analog Devices also provide an overview of the Linux kernel
90 MUSB configuration, albeit focused on some specific devices
91 provided by these companies. Finally, getting acquainted with the
92 USB specification at USB home page may come in handy, with
93 practical instance provided through the Writing USB Device Drivers
94 documentation (again, see Resources).
95 </para>
96 <para>
97 Linux USB stack is a layered architecture in which the MUSB
98 controller hardware sits at the lowest. The MUSB controller driver
99 abstract the MUSB controller hardware to the Linux USB stack.
100 </para>
101 <programlisting>
102 ------------------------
103 | | &lt;------- drivers/usb/gadget
104 | Linux USB Core Stack | &lt;------- drivers/usb/host
105 | | &lt;------- drivers/usb/core
106 ------------------------
107 â¬
108 --------------------------
109 | | &lt;------ drivers/usb/musb/musb_gadget.c
110 | MUSB Controller driver | &lt;------ drivers/usb/musb/musb_host.c
111 | | &lt;------ drivers/usb/musb/musb_core.c
112 --------------------------
113 â¬
114 ---------------------------------
115 | MUSB Platform Specific Driver |
116 | | &lt;-- drivers/usb/musb/jz4740.c
117 | aka &quot;Glue Layer&quot; |
118 ---------------------------------
119 â¬
120 ---------------------------------
121 | MUSB Controller Hardware |
122 ---------------------------------
123 </programlisting>
124 <para>
125 As outlined above, the glue layer is actually the platform
126 specific code sitting in between the controller driver and the
127 controller hardware.
128 </para>
129 <para>
130 Just like a Linux USB driver needs to register itself with the
131 Linux USB subsystem, the MUSB glue layer needs first to register
132 itself with the MUSB controller driver. This will allow the
133 controller driver to know about which device the glue layer
134 supports and which functions to call when a supported device is
135 detected or released; remember we are talking about an embedded
136 controller chip here, so no insertion or removal at run-time.
137 </para>
138 <para>
139 All of this information is passed to the MUSB controller driver
140 through a platform_driver structure defined in the glue layer as:
141 </para>
142 <programlisting linenumbering="numbered">
143static struct platform_driver jz4740_driver = {
144 .probe = jz4740_probe,
145 .remove = jz4740_remove,
146 .driver = {
147 .name = "musb-jz4740",
148 },
149};
150 </programlisting>
151 <para>
152 The probe and remove function pointers are called when a matching
153 device is detected and, respectively, released. The name string
154 describes the device supported by this glue layer. In the current
155 case it matches a platform_device structure declared in
156 arch/mips/jz4740/platform.c. Note that we are not using device
157 tree bindings here.
158 </para>
159 <para>
160 In order to register itself to the controller driver, the glue
161 layer goes through a few steps, basically allocating the
162 controller hardware resources and initialising a couple of
163 circuits. To do so, it needs to keep track of the information used
164 throughout these steps. This is done by defining a private
165 jz4740_glue structure:
166 </para>
167 <programlisting linenumbering="numbered">
168struct jz4740_glue {
169 struct device *dev;
170 struct platform_device *musb;
171 struct clk *clk;
172};
173 </programlisting>
174 <para>
175 The dev and musb members are both device structure variables. The
176 first one holds generic information about the device, since it's
177 the basic device structure, and the latter holds information more
178 closely related to the subsystem the device is registered to. The
179 clk variable keeps information related to the device clock
180 operation.
181 </para>
182 <para>
183 Let's go through the steps of the probe function that leads the
184 glue layer to register itself to the controller driver.
185 </para>
186 <para>
187 N.B.: For the sake of readability each function will be split in
188 logical parts, each part being shown as if it was independent from
189 the others.
190 </para>
191 <programlisting linenumbering="numbered">
192static int jz4740_probe(struct platform_device *pdev)
193{
194 struct platform_device *musb;
195 struct jz4740_glue *glue;
196 struct clk *clk;
197 int ret;
198
199 glue = devm_kzalloc(&amp;pdev->dev, sizeof(*glue), GFP_KERNEL);
200 if (!glue)
201 return -ENOMEM;
202
203 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
204 if (!musb) {
205 dev_err(&amp;pdev->dev, "failed to allocate musb device\n");
206 return -ENOMEM;
207 }
208
209 clk = devm_clk_get(&amp;pdev->dev, "udc");
210 if (IS_ERR(clk)) {
211 dev_err(&amp;pdev->dev, "failed to get clock\n");
212 ret = PTR_ERR(clk);
213 goto err_platform_device_put;
214 }
215
216 ret = clk_prepare_enable(clk);
217 if (ret) {
218 dev_err(&amp;pdev->dev, "failed to enable clock\n");
219 goto err_platform_device_put;
220 }
221
222 musb->dev.parent = &amp;pdev->dev;
223
224 glue->dev = &amp;pdev->dev;
225 glue->musb = musb;
226 glue->clk = clk;
227
228 return 0;
229
230err_platform_device_put:
231 platform_device_put(musb);
232 return ret;
233}
234 </programlisting>
235 <para>
236 The first few lines of the probe function allocate and assign the
237 glue, musb and clk variables. The GFP_KERNEL flag (line 8) allows
238 the allocation process to sleep and wait for memory, thus being
239 usable in a blocking situation. The PLATFORM_DEVID_AUTO flag (line
240 12) allows automatic allocation and management of device IDs in
241 order to avoid device namespace collisions with explicit IDs. With
242 devm_clk_get() (line 18) the glue layer allocates the clock -- the
243 <literal>devm_</literal> prefix indicates that clk_get() is
244 managed: it automatically frees the allocated clock resource data
245 when the device is released -- and enable it.
246 </para>
247 <para>
248 Then comes the registration steps:
249 </para>
250 <programlisting linenumbering="numbered">
251static int jz4740_probe(struct platform_device *pdev)
252{
253 struct musb_hdrc_platform_data *pdata = &amp;jz4740_musb_platform_data;
254
255 pdata->platform_ops = &amp;jz4740_musb_ops;
256
257 platform_set_drvdata(pdev, glue);
258
259 ret = platform_device_add_resources(musb, pdev->resource,
260 pdev->num_resources);
261 if (ret) {
262 dev_err(&amp;pdev->dev, "failed to add resources\n");
263 goto err_clk_disable;
264 }
265
266 ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
267 if (ret) {
268 dev_err(&amp;pdev->dev, "failed to add platform_data\n");
269 goto err_clk_disable;
270 }
271
272 return 0;
273
274err_clk_disable:
275 clk_disable_unprepare(clk);
276err_platform_device_put:
277 platform_device_put(musb);
278 return ret;
279}
280 </programlisting>
281 <para>
282 The first step is to pass the device data privately held by the
283 glue layer on to the controller driver through
284 platform_set_drvdata() (line 7). Next is passing on the device
285 resources information, also privately held at that point, through
286 platform_device_add_resources() (line 9).
287 </para>
288 <para>
289 Finally comes passing on the platform specific data to the
290 controller driver (line 16). Platform data will be discussed in
291 <link linkend="device-platform-data">Chapter 4</link>, but here
292 we are looking at the platform_ops function pointer (line 5) in
293 musb_hdrc_platform_data structure (line 3). This function
294 pointer allows the MUSB controller driver to know which function
295 to call for device operation:
296 </para>
297 <programlisting linenumbering="numbered">
298static const struct musb_platform_ops jz4740_musb_ops = {
299 .init = jz4740_musb_init,
300 .exit = jz4740_musb_exit,
301};
302 </programlisting>
303 <para>
304 Here we have the minimal case where only init and exit functions
305 are called by the controller driver when needed. Fact is the
306 JZ4740 MUSB controller is a basic controller, lacking some
307 features found in other controllers, otherwise we may also have
308 pointers to a few other functions like a power management function
309 or a function to switch between OTG and non-OTG modes, for
310 instance.
311 </para>
312 <para>
313 At that point of the registration process, the controller driver
314 actually calls the init function:
315 </para>
316 <programlisting linenumbering="numbered">
317static int jz4740_musb_init(struct musb *musb)
318{
319 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
320 if (!musb->xceiv) {
321 pr_err("HS UDC: no transceiver configured\n");
322 return -ENODEV;
323 }
324
325 /* Silicon does not implement ConfigData register.
326 * Set dyn_fifo to avoid reading EP config from hardware.
327 */
328 musb->dyn_fifo = true;
329
330 musb->isr = jz4740_musb_interrupt;
331
332 return 0;
333}
334 </programlisting>
335 <para>
336 The goal of jz4740_musb_init() is to get hold of the transceiver
337 driver data of the MUSB controller hardware and pass it on to the
338 MUSB controller driver, as usual. The transceiver is the circuitry
339 inside the controller hardware responsible for sending/receiving
340 the USB data. Since it is an implementation of the physical layer
341 of the OSI model, the transceiver is also referred to as PHY.
342 </para>
343 <para>
344 Getting hold of the MUSB PHY driver data is done with
345 usb_get_phy() which returns a pointer to the structure
346 containing the driver instance data. The next couple of
347 instructions (line 12 and 14) are used as a quirk and to setup
348 IRQ handling respectively. Quirks and IRQ handling will be
349 discussed later in <link linkend="device-quirks">Chapter
350 5</link> and <link linkend="handling-irqs">Chapter 3</link>.
351 </para>
352 <programlisting linenumbering="numbered">
353static int jz4740_musb_exit(struct musb *musb)
354{
355 usb_put_phy(musb->xceiv);
356
357 return 0;
358}
359 </programlisting>
360 <para>
361 Acting as the counterpart of init, the exit function releases the
362 MUSB PHY driver when the controller hardware itself is about to be
363 released.
364 </para>
365 <para>
366 Again, note that init and exit are fairly simple in this case due
367 to the basic set of features of the JZ4740 controller hardware.
368 When writing an musb glue layer for a more complex controller
369 hardware, you might need to take care of more processing in those
370 two functions.
371 </para>
372 <para>
373 Returning from the init function, the MUSB controller driver jumps
374 back into the probe function:
375 </para>
376 <programlisting linenumbering="numbered">
377static int jz4740_probe(struct platform_device *pdev)
378{
379 ret = platform_device_add(musb);
380 if (ret) {
381 dev_err(&amp;pdev->dev, "failed to register musb device\n");
382 goto err_clk_disable;
383 }
384
385 return 0;
386
387err_clk_disable:
388 clk_disable_unprepare(clk);
389err_platform_device_put:
390 platform_device_put(musb);
391 return ret;
392}
393 </programlisting>
394 <para>
395 This is the last part of the device registration process where the
396 glue layer adds the controller hardware device to Linux kernel
397 device hierarchy: at this stage, all known information about the
398 device is passed on to the Linux USB core stack.
399 </para>
400 <programlisting linenumbering="numbered">
401static int jz4740_remove(struct platform_device *pdev)
402{
403 struct jz4740_glue *glue = platform_get_drvdata(pdev);
404
405 platform_device_unregister(glue->musb);
406 clk_disable_unprepare(glue->clk);
407
408 return 0;
409}
410 </programlisting>
411 <para>
412 Acting as the counterpart of probe, the remove function unregister
413 the MUSB controller hardware (line 5) and disable the clock (line
414 6), allowing it to be gated.
415 </para>
416 </chapter>
417
418 <chapter id="handling-irqs">
419 <title>Handling IRQs</title>
420 <para>
421 Additionally to the MUSB controller hardware basic setup and
422 registration, the glue layer is also responsible for handling the
423 IRQs:
424 </para>
425 <programlisting linenumbering="numbered">
426static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
427{
428 unsigned long flags;
429 irqreturn_t retval = IRQ_NONE;
430 struct musb *musb = __hci;
431
432 spin_lock_irqsave(&amp;musb->lock, flags);
433
434 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
435 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
436 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
437
438 /*
439 * The controller is gadget only, the state of the host mode IRQ bits is
440 * undefined. Mask them to make sure that the musb driver core will
441 * never see them set
442 */
443 musb->int_usb &amp;= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME |
444 MUSB_INTR_RESET | MUSB_INTR_SOF;
445
446 if (musb->int_usb || musb->int_tx || musb->int_rx)
447 retval = musb_interrupt(musb);
448
449 spin_unlock_irqrestore(&amp;musb->lock, flags);
450
451 return retval;
452}
453 </programlisting>
454 <para>
455 Here the glue layer mostly has to read the relevant hardware
456 registers and pass their values on to the controller driver which
457 will handle the actual event that triggered the IRQ.
458 </para>
459 <para>
460 The interrupt handler critical section is protected by the
461 spin_lock_irqsave() and counterpart spin_unlock_irqrestore()
462 functions (line 7 and 24 respectively), which prevent the
463 interrupt handler code to be run by two different threads at the
464 same time.
465 </para>
466 <para>
467 Then the relevant interrupt registers are read (line 9 to 11):
468 </para>
469 <itemizedlist>
470 <listitem>
471 <para>
472 MUSB_INTRUSB: indicates which USB interrupts are currently
473 active,
474 </para>
475 </listitem>
476 <listitem>
477 <para>
478 MUSB_INTRTX: indicates which of the interrupts for TX
479 endpoints are currently active,
480 </para>
481 </listitem>
482 <listitem>
483 <para>
484 MUSB_INTRRX: indicates which of the interrupts for TX
485 endpoints are currently active.
486 </para>
487 </listitem>
488 </itemizedlist>
489 <para>
490 Note that musb_readb() is used to read 8-bit registers at most,
491 while musb_readw() allows us to read at most 16-bit registers.
492 There are other functions that can be used depending on the size
493 of your device registers. See musb_io.h for more information.
494 </para>
495 <para>
496 Instruction on line 18 is another quirk specific to the JZ4740
497 USB device controller, which will be discussed later in <link
498 linkend="device-quirks">Chapter 5</link>.
499 </para>
500 <para>
501 The glue layer still needs to register the IRQ handler though.
502 Remember the instruction on line 14 of the init function:
503 </para>
504 <programlisting linenumbering="numbered">
505static int jz4740_musb_init(struct musb *musb)
506{
507 musb->isr = jz4740_musb_interrupt;
508
509 return 0;
510}
511 </programlisting>
512 <para>
513 This instruction sets a pointer to the glue layer IRQ handler
514 function, in order for the controller hardware to call the handler
515 back when an IRQ comes from the controller hardware. The interrupt
516 handler is now implemented and registered.
517 </para>
518 </chapter>
519
520 <chapter id="device-platform-data">
521 <title>Device Platform Data</title>
522 <para>
523 In order to write an MUSB glue layer, you need to have some data
524 describing the hardware capabilities of your controller hardware,
525 which is called the platform data.
526 </para>
527 <para>
528 Platform data is specific to your hardware, though it may cover a
529 broad range of devices, and is generally found somewhere in the
530 arch/ directory, depending on your device architecture.
531 </para>
532 <para>
533 For instance, platform data for the JZ4740 SoC is found in
534 arch/mips/jz4740/platform.c. In the platform.c file each device of
535 the JZ4740 SoC is described through a set of structures.
536 </para>
537 <para>
538 Here is the part of arch/mips/jz4740/platform.c that covers the
539 USB Device Controller (UDC):
540 </para>
541 <programlisting linenumbering="numbered">
542/* USB Device Controller */
543struct platform_device jz4740_udc_xceiv_device = {
544 .name = "usb_phy_gen_xceiv",
545 .id = 0,
546};
547
548static struct resource jz4740_udc_resources[] = {
549 [0] = {
550 .start = JZ4740_UDC_BASE_ADDR,
551 .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
552 .flags = IORESOURCE_MEM,
553 },
554 [1] = {
555 .start = JZ4740_IRQ_UDC,
556 .end = JZ4740_IRQ_UDC,
557 .flags = IORESOURCE_IRQ,
558 .name = "mc",
559 },
560};
561
562struct platform_device jz4740_udc_device = {
563 .name = "musb-jz4740",
564 .id = -1,
565 .dev = {
566 .dma_mask = &amp;jz4740_udc_device.dev.coherent_dma_mask,
567 .coherent_dma_mask = DMA_BIT_MASK(32),
568 },
569 .num_resources = ARRAY_SIZE(jz4740_udc_resources),
570 .resource = jz4740_udc_resources,
571};
572 </programlisting>
573 <para>
574 The jz4740_udc_xceiv_device platform device structure (line 2)
575 describes the UDC transceiver with a name and id number.
576 </para>
577 <para>
578 At the time of this writing, note that
579 &quot;usb_phy_gen_xceiv&quot; is the specific name to be used for
580 all transceivers that are either built-in with reference USB IP or
581 autonomous and doesn't require any PHY programming. You will need
582 to set CONFIG_NOP_USB_XCEIV=y in the kernel configuration to make
583 use of the corresponding transceiver driver. The id field could be
584 set to -1 (equivalent to PLATFORM_DEVID_NONE), -2 (equivalent to
585 PLATFORM_DEVID_AUTO) or start with 0 for the first device of this
586 kind if we want a specific id number.
587 </para>
588 <para>
589 The jz4740_udc_resources resource structure (line 7) defines the
590 UDC registers base addresses.
591 </para>
592 <para>
593 The first array (line 9 to 11) defines the UDC registers base
594 memory addresses: start points to the first register memory
595 address, end points to the last register memory address and the
596 flags member defines the type of resource we are dealing with. So
597 IORESOURCE_MEM is used to define the registers memory addresses.
598 The second array (line 14 to 17) defines the UDC IRQ registers
599 addresses. Since there is only one IRQ register available for the
600 JZ4740 UDC, start and end point at the same address. The
601 IORESOURCE_IRQ flag tells that we are dealing with IRQ resources,
602 and the name &quot;mc&quot; is in fact hard-coded in the MUSB core
603 in order for the controller driver to retrieve this IRQ resource
604 by querying it by its name.
605 </para>
606 <para>
607 Finally, the jz4740_udc_device platform device structure (line 21)
608 describes the UDC itself.
609 </para>
610 <para>
611 The &quot;musb-jz4740&quot; name (line 22) defines the MUSB
612 driver that is used for this device; remember this is in fact
613 the name that we used in the jz4740_driver platform driver
614 structure in <link linkend="linux-musb-basics">Chapter
615 2</link>. The id field (line 23) is set to -1 (equivalent to
616 PLATFORM_DEVID_NONE) since we do not need an id for the device:
617 the MUSB controller driver was already set to allocate an
618 automatic id in <link linkend="linux-musb-basics">Chapter
619 2</link>. In the dev field we care for DMA related information
620 here. The dma_mask field (line 25) defines the width of the DMA
621 mask that is going to be used, and coherent_dma_mask (line 26)
622 has the same purpose but for the alloc_coherent DMA mappings: in
623 both cases we are using a 32 bits mask. Then the resource field
624 (line 29) is simply a pointer to the resource structure defined
625 before, while the num_resources field (line 28) keeps track of
626 the number of arrays defined in the resource structure (in this
627 case there were two resource arrays defined before).
628 </para>
629 <para>
630 With this quick overview of the UDC platform data at the arch/
631 level now done, let's get back to the MUSB glue layer specific
632 platform data in drivers/usb/musb/jz4740.c:
633 </para>
634 <programlisting linenumbering="numbered">
635static struct musb_hdrc_config jz4740_musb_config = {
636 /* Silicon does not implement USB OTG. */
637 .multipoint = 0,
638 /* Max EPs scanned, driver will decide which EP can be used. */
639 .num_eps = 4,
640 /* RAMbits needed to configure EPs from table */
641 .ram_bits = 9,
642 .fifo_cfg = jz4740_musb_fifo_cfg,
643 .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg),
644};
645
646static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
647 .mode = MUSB_PERIPHERAL,
648 .config = &amp;jz4740_musb_config,
649};
650 </programlisting>
651 <para>
652 First the glue layer configures some aspects of the controller
653 driver operation related to the controller hardware specifics.
654 This is done through the jz4740_musb_config musb_hdrc_config
655 structure.
656 </para>
657 <para>
658 Defining the OTG capability of the controller hardware, the
659 multipoint member (line 3) is set to 0 (equivalent to false)
660 since the JZ4740 UDC is not OTG compatible. Then num_eps (line
661 5) defines the number of USB endpoints of the controller
662 hardware, including endpoint 0: here we have 3 endpoints +
663 endpoint 0. Next is ram_bits (line 7) which is the width of the
664 RAM address bus for the MUSB controller hardware. This
665 information is needed when the controller driver cannot
666 automatically configure endpoints by reading the relevant
667 controller hardware registers. This issue will be discussed when
668 we get to device quirks in <link linkend="device-quirks">Chapter
669 5</link>. Last two fields (line 8 and 9) are also about device
670 quirks: fifo_cfg points to the USB endpoints configuration table
671 and fifo_cfg_size keeps track of the size of the number of
672 entries in that configuration table. More on that later in <link
673 linkend="device-quirks">Chapter 5</link>.
674 </para>
675 <para>
676 Then this configuration is embedded inside
677 jz4740_musb_platform_data musb_hdrc_platform_data structure (line
678 11): config is a pointer to the configuration structure itself,
679 and mode tells the controller driver if the controller hardware
680 may be used as MUSB_HOST only, MUSB_PERIPHERAL only or MUSB_OTG
681 which is a dual mode.
682 </para>
683 <para>
684 Remember that jz4740_musb_platform_data is then used to convey
685 platform data information as we have seen in the probe function
686 in <link linkend="linux-musb-basics">Chapter 2</link>
687 </para>
688 </chapter>
689
690 <chapter id="device-quirks">
691 <title>Device Quirks</title>
692 <para>
693 Completing the platform data specific to your device, you may also
694 need to write some code in the glue layer to work around some
695 device specific limitations. These quirks may be due to some
696 hardware bugs, or simply be the result of an incomplete
697 implementation of the USB On-the-Go specification.
698 </para>
699 <para>
700 The JZ4740 UDC exhibits such quirks, some of which we will discuss
701 here for the sake of insight even though these might not be found
702 in the controller hardware you are working on.
703 </para>
704 <para>
705 Let's get back to the init function first:
706 </para>
707 <programlisting linenumbering="numbered">
708static int jz4740_musb_init(struct musb *musb)
709{
710 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
711 if (!musb->xceiv) {
712 pr_err("HS UDC: no transceiver configured\n");
713 return -ENODEV;
714 }
715
716 /* Silicon does not implement ConfigData register.
717 * Set dyn_fifo to avoid reading EP config from hardware.
718 */
719 musb->dyn_fifo = true;
720
721 musb->isr = jz4740_musb_interrupt;
722
723 return 0;
724}
725 </programlisting>
726 <para>
727 Instruction on line 12 helps the MUSB controller driver to work
728 around the fact that the controller hardware is missing registers
729 that are used for USB endpoints configuration.
730 </para>
731 <para>
732 Without these registers, the controller driver is unable to read
733 the endpoints configuration from the hardware, so we use line 12
734 instruction to bypass reading the configuration from silicon, and
735 rely on a hard-coded table that describes the endpoints
736 configuration instead:
737 </para>
738 <programlisting linenumbering="numbered">
739static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = {
740{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
741{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
742{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, },
743};
744 </programlisting>
745 <para>
746 Looking at the configuration table above, we see that each
747 endpoints is described by three fields: hw_ep_num is the endpoint
748 number, style is its direction (either FIFO_TX for the controller
749 driver to send packets in the controller hardware, or FIFO_RX to
750 receive packets from hardware), and maxpacket defines the maximum
751 size of each data packet that can be transmitted over that
752 endpoint. Reading from the table, the controller driver knows that
753 endpoint 1 can be used to send and receive USB data packets of 512
754 bytes at once (this is in fact a bulk in/out endpoint), and
755 endpoint 2 can be used to send data packets of 64 bytes at once
756 (this is in fact an interrupt endpoint).
757 </para>
758 <para>
759 Note that there is no information about endpoint 0 here: that one
760 is implemented by default in every silicon design, with a
761 predefined configuration according to the USB specification. For
762 more examples of endpoint configuration tables, see musb_core.c.
763 </para>
764 <para>
765 Let's now get back to the interrupt handler function:
766 </para>
767 <programlisting linenumbering="numbered">
768static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
769{
770 unsigned long flags;
771 irqreturn_t retval = IRQ_NONE;
772 struct musb *musb = __hci;
773
774 spin_lock_irqsave(&amp;musb->lock, flags);
775
776 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
777 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
778 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
779
780 /*
781 * The controller is gadget only, the state of the host mode IRQ bits is
782 * undefined. Mask them to make sure that the musb driver core will
783 * never see them set
784 */
785 musb->int_usb &amp;= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME |
786 MUSB_INTR_RESET | MUSB_INTR_SOF;
787
788 if (musb->int_usb || musb->int_tx || musb->int_rx)
789 retval = musb_interrupt(musb);
790
791 spin_unlock_irqrestore(&amp;musb->lock, flags);
792
793 return retval;
794}
795 </programlisting>
796 <para>
797 Instruction on line 18 above is a way for the controller driver to
798 work around the fact that some interrupt bits used for USB host
799 mode operation are missing in the MUSB_INTRUSB register, thus left
800 in an undefined hardware state, since this MUSB controller
801 hardware is used in peripheral mode only. As a consequence, the
802 glue layer masks these missing bits out to avoid parasite
803 interrupts by doing a logical AND operation between the value read
804 from MUSB_INTRUSB and the bits that are actually implemented in
805 the register.
806 </para>
807 <para>
808 These are only a couple of the quirks found in the JZ4740 USB
809 device controller. Some others were directly addressed in the MUSB
810 core since the fixes were generic enough to provide a better
811 handling of the issues for others controller hardware eventually.
812 </para>
813 </chapter>
814
815 <chapter id="conclusion">
816 <title>Conclusion</title>
817 <para>
818 Writing a Linux MUSB glue layer should be a more accessible task,
819 as this documentation tries to show the ins and outs of this
820 exercise.
821 </para>
822 <para>
823 The JZ4740 USB device controller being fairly simple, I hope its
824 glue layer serves as a good example for the curious mind. Used
825 with the current MUSB glue layers, this documentation should
826 provide enough guidance to get started; should anything gets out
827 of hand, the linux-usb mailing list archive is another helpful
828 resource to browse through.
829 </para>
830 </chapter>
831
832 <chapter id="acknowledgements">
833 <title>Acknowledgements</title>
834 <para>
835 Many thanks to Lars-Peter Clausen and Maarten ter Huurne for
836 answering my questions while I was writing the JZ4740 glue layer
837 and for helping me out getting the code in good shape.
838 </para>
839 <para>
840 I would also like to thank the Qi-Hardware community at large for
841 its cheerful guidance and support.
842 </para>
843 </chapter>
844
845 <chapter id="resources">
846 <title>Resources</title>
847 <para>
848 USB Home Page:
849 <ulink url="http://www.usb.org">http://www.usb.org</ulink>
850 </para>
851 <para>
852 linux-usb Mailing List Archives:
853 <ulink url="http://marc.info/?l=linux-usb">http://marc.info/?l=linux-usb</ulink>
854 </para>
855 <para>
856 USB On-the-Go Basics:
857 <ulink url="http://www.maximintegrated.com/app-notes/index.mvp/id/1822">http://www.maximintegrated.com/app-notes/index.mvp/id/1822</ulink>
858 </para>
859 <para>
860 Writing USB Device Drivers:
861 <ulink url="https://www.kernel.org/doc/htmldocs/writing_usb_driver/index.html">https://www.kernel.org/doc/htmldocs/writing_usb_driver/index.html</ulink>
862 </para>
863 <para>
864 Texas Instruments USB Configuration Wiki Page:
865 <ulink url="http://processors.wiki.ti.com/index.php/Usbgeneralpage">http://processors.wiki.ti.com/index.php/Usbgeneralpage</ulink>
866 </para>
867 <para>
868 Analog Devices Blackfin MUSB Configuration:
869 <ulink url="http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb">http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb</ulink>
870 </para>
871 </chapter>
872
873</book>
diff --git a/Documentation/DocBook/writing_usb_driver.tmpl b/Documentation/DocBook/writing_usb_driver.tmpl
deleted file mode 100644
index 3210dcf741c9..000000000000
--- a/Documentation/DocBook/writing_usb_driver.tmpl
+++ /dev/null
@@ -1,412 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="USBDeviceDriver">
6 <bookinfo>
7 <title>Writing USB Device Drivers</title>
8
9 <authorgroup>
10 <author>
11 <firstname>Greg</firstname>
12 <surname>Kroah-Hartman</surname>
13 <affiliation>
14 <address>
15 <email>greg@kroah.com</email>
16 </address>
17 </affiliation>
18 </author>
19 </authorgroup>
20
21 <copyright>
22 <year>2001-2002</year>
23 <holder>Greg Kroah-Hartman</holder>
24 </copyright>
25
26 <legalnotice>
27 <para>
28 This documentation is free software; you can redistribute
29 it and/or modify it under the terms of the GNU General Public
30 License as published by the Free Software Foundation; either
31 version 2 of the License, or (at your option) any later
32 version.
33 </para>
34
35 <para>
36 This program is distributed in the hope that it will be
37 useful, but WITHOUT ANY WARRANTY; without even the implied
38 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
39 See the GNU General Public License for more details.
40 </para>
41
42 <para>
43 You should have received a copy of the GNU General Public
44 License along with this program; if not, write to the Free
45 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
46 MA 02111-1307 USA
47 </para>
48
49 <para>
50 For more details see the file COPYING in the source
51 distribution of Linux.
52 </para>
53
54 <para>
55 This documentation is based on an article published in
56 Linux Journal Magazine, October 2001, Issue 90.
57 </para>
58 </legalnotice>
59 </bookinfo>
60
61<toc></toc>
62
63 <chapter id="intro">
64 <title>Introduction</title>
65 <para>
66 The Linux USB subsystem has grown from supporting only two different
67 types of devices in the 2.2.7 kernel (mice and keyboards), to over 20
68 different types of devices in the 2.4 kernel. Linux currently supports
69 almost all USB class devices (standard types of devices like keyboards,
70 mice, modems, printers and speakers) and an ever-growing number of
71 vendor-specific devices (such as USB to serial converters, digital
72 cameras, Ethernet devices and MP3 players). For a full list of the
73 different USB devices currently supported, see Resources.
74 </para>
75 <para>
76 The remaining kinds of USB devices that do not have support on Linux are
77 almost all vendor-specific devices. Each vendor decides to implement a
78 custom protocol to talk to their device, so a custom driver usually needs
79 to be created. Some vendors are open with their USB protocols and help
80 with the creation of Linux drivers, while others do not publish them, and
81 developers are forced to reverse-engineer. See Resources for some links
82 to handy reverse-engineering tools.
83 </para>
84 <para>
85 Because each different protocol causes a new driver to be created, I have
86 written a generic USB driver skeleton, modelled after the pci-skeleton.c
87 file in the kernel source tree upon which many PCI network drivers have
88 been based. This USB skeleton can be found at drivers/usb/usb-skeleton.c
89 in the kernel source tree. In this article I will walk through the basics
90 of the skeleton driver, explaining the different pieces and what needs to
91 be done to customize it to your specific device.
92 </para>
93 </chapter>
94
95 <chapter id="basics">
96 <title>Linux USB Basics</title>
97 <para>
98 If you are going to write a Linux USB driver, please become familiar with
99 the USB protocol specification. It can be found, along with many other
100 useful documents, at the USB home page (see Resources). An excellent
101 introduction to the Linux USB subsystem can be found at the USB Working
102 Devices List (see Resources). It explains how the Linux USB subsystem is
103 structured and introduces the reader to the concept of USB urbs
104 (USB Request Blocks), which are essential to USB drivers.
105 </para>
106 <para>
107 The first thing a Linux USB driver needs to do is register itself with
108 the Linux USB subsystem, giving it some information about which devices
109 the driver supports and which functions to call when a device supported
110 by the driver is inserted or removed from the system. All of this
111 information is passed to the USB subsystem in the usb_driver structure.
112 The skeleton driver declares a usb_driver as:
113 </para>
114 <programlisting>
115static struct usb_driver skel_driver = {
116 .name = "skeleton",
117 .probe = skel_probe,
118 .disconnect = skel_disconnect,
119 .fops = &amp;skel_fops,
120 .minor = USB_SKEL_MINOR_BASE,
121 .id_table = skel_table,
122};
123 </programlisting>
124 <para>
125 The variable name is a string that describes the driver. It is used in
126 informational messages printed to the system log. The probe and
127 disconnect function pointers are called when a device that matches the
128 information provided in the id_table variable is either seen or removed.
129 </para>
130 <para>
131 The fops and minor variables are optional. Most USB drivers hook into
132 another kernel subsystem, such as the SCSI, network or TTY subsystem.
133 These types of drivers register themselves with the other kernel
134 subsystem, and any user-space interactions are provided through that
135 interface. But for drivers that do not have a matching kernel subsystem,
136 such as MP3 players or scanners, a method of interacting with user space
137 is needed. The USB subsystem provides a way to register a minor device
138 number and a set of file_operations function pointers that enable this
139 user-space interaction. The skeleton driver needs this kind of interface,
140 so it provides a minor starting number and a pointer to its
141 file_operations functions.
142 </para>
143 <para>
144 The USB driver is then registered with a call to usb_register, usually in
145 the driver's init function, as shown here:
146 </para>
147 <programlisting>
148static int __init usb_skel_init(void)
149{
150 int result;
151
152 /* register this driver with the USB subsystem */
153 result = usb_register(&amp;skel_driver);
154 if (result &lt; 0) {
155 err(&quot;usb_register failed for the &quot;__FILE__ &quot;driver.&quot;
156 &quot;Error number %d&quot;, result);
157 return -1;
158 }
159
160 return 0;
161}
162module_init(usb_skel_init);
163 </programlisting>
164 <para>
165 When the driver is unloaded from the system, it needs to deregister
166 itself with the USB subsystem. This is done with the usb_deregister
167 function:
168 </para>
169 <programlisting>
170static void __exit usb_skel_exit(void)
171{
172 /* deregister this driver with the USB subsystem */
173 usb_deregister(&amp;skel_driver);
174}
175module_exit(usb_skel_exit);
176 </programlisting>
177 <para>
178 To enable the linux-hotplug system to load the driver automatically when
179 the device is plugged in, you need to create a MODULE_DEVICE_TABLE. The
180 following code tells the hotplug scripts that this module supports a
181 single device with a specific vendor and product ID:
182 </para>
183 <programlisting>
184/* table of devices that work with this driver */
185static struct usb_device_id skel_table [] = {
186 { USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
187 { } /* Terminating entry */
188};
189MODULE_DEVICE_TABLE (usb, skel_table);
190 </programlisting>
191 <para>
192 There are other macros that can be used in describing a usb_device_id for
193 drivers that support a whole class of USB drivers. See usb.h for more
194 information on this.
195 </para>
196 </chapter>
197
198 <chapter id="device">
199 <title>Device operation</title>
200 <para>
201 When a device is plugged into the USB bus that matches the device ID
202 pattern that your driver registered with the USB core, the probe function
203 is called. The usb_device structure, interface number and the interface ID
204 are passed to the function:
205 </para>
206 <programlisting>
207static int skel_probe(struct usb_interface *interface,
208 const struct usb_device_id *id)
209 </programlisting>
210 <para>
211 The driver now needs to verify that this device is actually one that it
212 can accept. If so, it returns 0.
213 If not, or if any error occurs during initialization, an errorcode
214 (such as <literal>-ENOMEM</literal> or <literal>-ENODEV</literal>)
215 is returned from the probe function.
216 </para>
217 <para>
218 In the skeleton driver, we determine what end points are marked as bulk-in
219 and bulk-out. We create buffers to hold the data that will be sent and
220 received from the device, and a USB urb to write data to the device is
221 initialized.
222 </para>
223 <para>
224 Conversely, when the device is removed from the USB bus, the disconnect
225 function is called with the device pointer. The driver needs to clean any
226 private data that has been allocated at this time and to shut down any
227 pending urbs that are in the USB system.
228 </para>
229 <para>
230 Now that the device is plugged into the system and the driver is bound to
231 the device, any of the functions in the file_operations structure that
232 were passed to the USB subsystem will be called from a user program trying
233 to talk to the device. The first function called will be open, as the
234 program tries to open the device for I/O. We increment our private usage
235 count and save a pointer to our internal structure in the file
236 structure. This is done so that future calls to file operations will
237 enable the driver to determine which device the user is addressing. All
238 of this is done with the following code:
239 </para>
240 <programlisting>
241/* increment our usage count for the module */
242++skel->open_count;
243
244/* save our object in the file's private structure */
245file->private_data = dev;
246 </programlisting>
247 <para>
248 After the open function is called, the read and write functions are called
249 to receive and send data to the device. In the skel_write function, we
250 receive a pointer to some data that the user wants to send to the device
251 and the size of the data. The function determines how much data it can
252 send to the device based on the size of the write urb it has created (this
253 size depends on the size of the bulk out end point that the device has).
254 Then it copies the data from user space to kernel space, points the urb to
255 the data and submits the urb to the USB subsystem. This can be seen in
256 the following code:
257 </para>
258 <programlisting>
259/* we can only write as much as 1 urb will hold */
260bytes_written = (count > skel->bulk_out_size) ? skel->bulk_out_size : count;
261
262/* copy the data from user space into our urb */
263copy_from_user(skel->write_urb->transfer_buffer, buffer, bytes_written);
264
265/* set up our urb */
266usb_fill_bulk_urb(skel->write_urb,
267 skel->dev,
268 usb_sndbulkpipe(skel->dev, skel->bulk_out_endpointAddr),
269 skel->write_urb->transfer_buffer,
270 bytes_written,
271 skel_write_bulk_callback,
272 skel);
273
274/* send the data out the bulk port */
275result = usb_submit_urb(skel->write_urb);
276if (result) {
277 err(&quot;Failed submitting write urb, error %d&quot;, result);
278}
279 </programlisting>
280 <para>
281 When the write urb is filled up with the proper information using the
282 usb_fill_bulk_urb function, we point the urb's completion callback to call our
283 own skel_write_bulk_callback function. This function is called when the
284 urb is finished by the USB subsystem. The callback function is called in
285 interrupt context, so caution must be taken not to do very much processing
286 at that time. Our implementation of skel_write_bulk_callback merely
287 reports if the urb was completed successfully or not and then returns.
288 </para>
289 <para>
290 The read function works a bit differently from the write function in that
291 we do not use an urb to transfer data from the device to the driver.
292 Instead we call the usb_bulk_msg function, which can be used to send or
293 receive data from a device without having to create urbs and handle
294 urb completion callback functions. We call the usb_bulk_msg function,
295 giving it a buffer into which to place any data received from the device
296 and a timeout value. If the timeout period expires without receiving any
297 data from the device, the function will fail and return an error message.
298 This can be shown with the following code:
299 </para>
300 <programlisting>
301/* do an immediate bulk read to get data from the device */
302retval = usb_bulk_msg (skel->dev,
303 usb_rcvbulkpipe (skel->dev,
304 skel->bulk_in_endpointAddr),
305 skel->bulk_in_buffer,
306 skel->bulk_in_size,
307 &amp;count, HZ*10);
308/* if the read was successful, copy the data to user space */
309if (!retval) {
310 if (copy_to_user (buffer, skel->bulk_in_buffer, count))
311 retval = -EFAULT;
312 else
313 retval = count;
314}
315 </programlisting>
316 <para>
317 The usb_bulk_msg function can be very useful for doing single reads or
318 writes to a device; however, if you need to read or write constantly to a
319 device, it is recommended to set up your own urbs and submit them to the
320 USB subsystem.
321 </para>
322 <para>
323 When the user program releases the file handle that it has been using to
324 talk to the device, the release function in the driver is called. In this
325 function we decrement our private usage count and wait for possible
326 pending writes:
327 </para>
328 <programlisting>
329/* decrement our usage count for the device */
330--skel->open_count;
331 </programlisting>
332 <para>
333 One of the more difficult problems that USB drivers must be able to handle
334 smoothly is the fact that the USB device may be removed from the system at
335 any point in time, even if a program is currently talking to it. It needs
336 to be able to shut down any current reads and writes and notify the
337 user-space programs that the device is no longer there. The following
338 code (function <function>skel_delete</function>)
339 is an example of how to do this: </para>
340 <programlisting>
341static inline void skel_delete (struct usb_skel *dev)
342{
343 kfree (dev->bulk_in_buffer);
344 if (dev->bulk_out_buffer != NULL)
345 usb_free_coherent (dev->udev, dev->bulk_out_size,
346 dev->bulk_out_buffer,
347 dev->write_urb->transfer_dma);
348 usb_free_urb (dev->write_urb);
349 kfree (dev);
350}
351 </programlisting>
352 <para>
353 If a program currently has an open handle to the device, we reset the flag
354 <literal>device_present</literal>. For
355 every read, write, release and other functions that expect a device to be
356 present, the driver first checks this flag to see if the device is
357 still present. If not, it releases that the device has disappeared, and a
358 -ENODEV error is returned to the user-space program. When the release
359 function is eventually called, it determines if there is no device
360 and if not, it does the cleanup that the skel_disconnect
361 function normally does if there are no open files on the device (see
362 Listing 5).
363 </para>
364 </chapter>
365
366 <chapter id="iso">
367 <title>Isochronous Data</title>
368 <para>
369 This usb-skeleton driver does not have any examples of interrupt or
370 isochronous data being sent to or from the device. Interrupt data is sent
371 almost exactly as bulk data is, with a few minor exceptions. Isochronous
372 data works differently with continuous streams of data being sent to or
373 from the device. The audio and video camera drivers are very good examples
374 of drivers that handle isochronous data and will be useful if you also
375 need to do this.
376 </para>
377 </chapter>
378
379 <chapter id="Conclusion">
380 <title>Conclusion</title>
381 <para>
382 Writing Linux USB device drivers is not a difficult task as the
383 usb-skeleton driver shows. This driver, combined with the other current
384 USB drivers, should provide enough examples to help a beginning author
385 create a working driver in a minimal amount of time. The linux-usb-devel
386 mailing list archives also contain a lot of helpful information.
387 </para>
388 </chapter>
389
390 <chapter id="resources">
391 <title>Resources</title>
392 <para>
393 The Linux USB Project: <ulink url="http://www.linux-usb.org">http://www.linux-usb.org/</ulink>
394 </para>
395 <para>
396 Linux Hotplug Project: <ulink url="http://linux-hotplug.sourceforge.net">http://linux-hotplug.sourceforge.net/</ulink>
397 </para>
398 <para>
399 Linux USB Working Devices List: <ulink url="http://www.qbik.ch/usb/devices">http://www.qbik.ch/usb/devices/</ulink>
400 </para>
401 <para>
402 linux-usb-devel Mailing List Archives: <ulink url="http://marc.theaimsgroup.com/?l=linux-usb-devel">http://marc.theaimsgroup.com/?l=linux-usb-devel</ulink>
403 </para>
404 <para>
405 Programming Guide for Linux USB Device Drivers: <ulink url="http://usb.cs.tum.edu/usbdoc">http://usb.cs.tum.edu/usbdoc</ulink>
406 </para>
407 <para>
408 USB Home Page: <ulink url="http://www.usb.org">http://www.usb.org</ulink>
409 </para>
410 </chapter>
411
412</book>
diff --git a/Documentation/PCI/pci-error-recovery.txt b/Documentation/PCI/pci-error-recovery.txt
index da3b2176d5da..0b6bb3ef449e 100644
--- a/Documentation/PCI/pci-error-recovery.txt
+++ b/Documentation/PCI/pci-error-recovery.txt
@@ -11,7 +11,7 @@
11 11
12Many PCI bus controllers are able to detect a variety of hardware 12Many PCI bus controllers are able to detect a variety of hardware
13PCI errors on the bus, such as parity errors on the data and address 13PCI errors on the bus, such as parity errors on the data and address
14busses, as well as SERR and PERR errors. Some of the more advanced 14buses, as well as SERR and PERR errors. Some of the more advanced
15chipsets are able to deal with these errors; these include PCI-E chipsets, 15chipsets are able to deal with these errors; these include PCI-E chipsets,
16and the PCI-host bridges found on IBM Power4, Power5 and Power6-based 16and the PCI-host bridges found on IBM Power4, Power5 and Power6-based
17pSeries boxes. A typical action taken is to disconnect the affected device, 17pSeries boxes. A typical action taken is to disconnect the affected device,
@@ -173,7 +173,7 @@ is STEP 6 (Permanent Failure).
173>>> a value of 0xff on read, and writes will be dropped. If more than 173>>> a value of 0xff on read, and writes will be dropped. If more than
174>>> EEH_MAX_FAILS I/O's are attempted to a frozen adapter, EEH 174>>> EEH_MAX_FAILS I/O's are attempted to a frozen adapter, EEH
175>>> assumes that the device driver has gone into an infinite loop 175>>> assumes that the device driver has gone into an infinite loop
176>>> and prints an error to syslog. A reboot is then required to 176>>> and prints an error to syslog. A reboot is then required to
177>>> get the device working again. 177>>> get the device working again.
178 178
179STEP 2: MMIO Enabled 179STEP 2: MMIO Enabled
@@ -231,14 +231,14 @@ proceeds to STEP 4 (Slot Reset)
231STEP 3: Link Reset 231STEP 3: Link Reset
232------------------ 232------------------
233The platform resets the link. This is a PCI-Express specific step 233The platform resets the link. This is a PCI-Express specific step
234and is done whenever a non-fatal error has been detected that can be 234and is done whenever a fatal error has been detected that can be
235"solved" by resetting the link. 235"solved" by resetting the link.
236 236
237STEP 4: Slot Reset 237STEP 4: Slot Reset
238------------------ 238------------------
239 239
240In response to a return value of PCI_ERS_RESULT_NEED_RESET, the 240In response to a return value of PCI_ERS_RESULT_NEED_RESET, the
241the platform will perform a slot reset on the requesting PCI device(s). 241the platform will perform a slot reset on the requesting PCI device(s).
242The actual steps taken by a platform to perform a slot reset 242The actual steps taken by a platform to perform a slot reset
243will be platform-dependent. Upon completion of slot reset, the 243will be platform-dependent. Upon completion of slot reset, the
244platform will call the device slot_reset() callback. 244platform will call the device slot_reset() callback.
@@ -258,7 +258,7 @@ configuration registers to initialize to their default conditions.
258 258
259For most PCI devices, a soft reset will be sufficient for recovery. 259For most PCI devices, a soft reset will be sufficient for recovery.
260Optional fundamental reset is provided to support a limited number 260Optional fundamental reset is provided to support a limited number
261of PCI Express PCI devices for which a soft reset is not sufficient 261of PCI Express devices for which a soft reset is not sufficient
262for recovery. 262for recovery.
263 263
264If the platform supports PCI hotplug, then the reset might be 264If the platform supports PCI hotplug, then the reset might be
@@ -303,7 +303,7 @@ driver performs device init only from PCI function 0:
303 Same as above. 303 Same as above.
304 304
305Drivers for PCI Express cards that require a fundamental reset must 305Drivers for PCI Express cards that require a fundamental reset must
306set the needs_freset bit in the pci_dev structure in their probe function. 306set the needs_freset bit in the pci_dev structure in their probe function.
307For example, the QLogic qla2xxx driver sets the needs_freset bit for certain 307For example, the QLogic qla2xxx driver sets the needs_freset bit for certain
308PCI card types: 308PCI card types:
309 309
diff --git a/Documentation/acpi/aml-debugger.txt b/Documentation/acpi/aml-debugger.txt
index 5f62aa4a493b..e851cc5de63f 100644
--- a/Documentation/acpi/aml-debugger.txt
+++ b/Documentation/acpi/aml-debugger.txt
@@ -15,7 +15,7 @@ kernel.
15 CONFIG_ACPI_DEBUGGER=y 15 CONFIG_ACPI_DEBUGGER=y
16 CONFIG_ACPI_DEBUGGER_USER=m 16 CONFIG_ACPI_DEBUGGER_USER=m
17 17
18 The userspace utlities can be built from the kernel source tree using 18 The userspace utilities can be built from the kernel source tree using
19 the following commands: 19 the following commands:
20 20
21 $ cd tools 21 $ cd tools
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
index 209a5eba6b87..7bcf9c3d9fbe 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -367,10 +367,10 @@ resulting child platform device.
367 367
368Device Tree namespace link device ID 368Device Tree namespace link device ID
369~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 369~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
370The Device Tree protocol uses device indentification based on the "compatible" 370The Device Tree protocol uses device identification based on the "compatible"
371property whose value is a string or an array of strings recognized as device 371property whose value is a string or an array of strings recognized as device
372identifiers by drivers and the driver core. The set of all those strings may be 372identifiers by drivers and the driver core. The set of all those strings may be
373regarded as a device indentification namespace analogous to the ACPI/PNP device 373regarded as a device identification namespace analogous to the ACPI/PNP device
374ID namespace. Consequently, in principle it should not be necessary to allocate 374ID namespace. Consequently, in principle it should not be necessary to allocate
375a new (and arguably redundant) ACPI/PNP device ID for a devices with an existing 375a new (and arguably redundant) ACPI/PNP device ID for a devices with an existing
376identification string in the Device Tree (DT) namespace, especially if that ID 376identification string in the Device Tree (DT) namespace, especially if that ID
@@ -381,7 +381,7 @@ In ACPI, the device identification object called _CID (Compatible ID) is used to
381list the IDs of devices the given one is compatible with, but those IDs must 381list the IDs of devices the given one is compatible with, but those IDs must
382belong to one of the namespaces prescribed by the ACPI specification (see 382belong to one of the namespaces prescribed by the ACPI specification (see
383Section 6.1.2 of ACPI 6.0 for details) and the DT namespace is not one of them. 383Section 6.1.2 of ACPI 6.0 for details) and the DT namespace is not one of them.
384Moreover, the specification mandates that either a _HID or an _ADR identificaion 384Moreover, the specification mandates that either a _HID or an _ADR identification
385object be present for all ACPI objects representing devices (Section 6.1 of ACPI 385object be present for all ACPI objects representing devices (Section 6.1 of ACPI
3866.0). For non-enumerable bus types that object must be _HID and its value must 3866.0). For non-enumerable bus types that object must be _HID and its value must
387be a device ID from one of the namespaces prescribed by the specification too. 387be a device ID from one of the namespaces prescribed by the specification too.
diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst
index 8ddae4e4299a..8c60a8a32a1a 100644
--- a/Documentation/admin-guide/index.rst
+++ b/Documentation/admin-guide/index.rst
@@ -60,6 +60,7 @@ configure specific aspects of kernel behavior to your liking.
60 mono 60 mono
61 java 61 java
62 ras 62 ras
63 pm/index
63 64
64.. only:: subproject and html 65.. only:: subproject and html
65 66
diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst
index c74933ccf7c9..d76ab3907e2b 100644
--- a/Documentation/admin-guide/kernel-parameters.rst
+++ b/Documentation/admin-guide/kernel-parameters.rst
@@ -1,3 +1,5 @@
1.. _kernelparameters:
2
1The kernel's command-line parameters 3The kernel's command-line parameters
2==================================== 4====================================
3 5
@@ -196,7 +198,7 @@ and is between 256 and 4096 characters. It is defined in the file
196 198
197Finally, the [KMG] suffix is commonly described after a number of kernel 199Finally, the [KMG] suffix is commonly described after a number of kernel
198parameter values. These 'K', 'M', and 'G' letters represent the _binary_ 200parameter values. These 'K', 'M', and 'G' letters represent the _binary_
199multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30 201multipliers 'Kilo', 'Mega', and 'Giga', equaling 2^10, 2^20, and 2^30
200bytes respectively. Such letter suffixes can also be entirely omitted: 202bytes respectively. Such letter suffixes can also be entirely omitted:
201 203
202.. include:: kernel-parameters.txt 204.. include:: kernel-parameters.txt
diff --git a/Documentation/admin-guide/pm/cpufreq.rst b/Documentation/admin-guide/pm/cpufreq.rst
new file mode 100644
index 000000000000..289c80f7760e
--- /dev/null
+++ b/Documentation/admin-guide/pm/cpufreq.rst
@@ -0,0 +1,700 @@
1.. |struct cpufreq_policy| replace:: :c:type:`struct cpufreq_policy <cpufreq_policy>`
2
3=======================
4CPU Performance Scaling
5=======================
6
7::
8
9 Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
10
11The Concept of CPU Performance Scaling
12======================================
13
14The majority of modern processors are capable of operating in a number of
15different clock frequency and voltage configurations, often referred to as
16Operating Performance Points or P-states (in ACPI terminology). As a rule,
17the higher the clock frequency and the higher the voltage, the more instructions
18can be retired by the CPU over a unit of time, but also the higher the clock
19frequency and the higher the voltage, the more energy is consumed over a unit of
20time (or the more power is drawn) by the CPU in the given P-state. Therefore
21there is a natural tradeoff between the CPU capacity (the number of instructions
22that can be executed over a unit of time) and the power drawn by the CPU.
23
24In some situations it is desirable or even necessary to run the program as fast
25as possible and then there is no reason to use any P-states different from the
26highest one (i.e. the highest-performance frequency/voltage configuration
27available). In some other cases, however, it may not be necessary to execute
28instructions so quickly and maintaining the highest available CPU capacity for a
29relatively long time without utilizing it entirely may be regarded as wasteful.
30It also may not be physically possible to maintain maximum CPU capacity for too
31long for thermal or power supply capacity reasons or similar. To cover those
32cases, there are hardware interfaces allowing CPUs to be switched between
33different frequency/voltage configurations or (in the ACPI terminology) to be
34put into different P-states.
35
36Typically, they are used along with algorithms to estimate the required CPU
37capacity, so as to decide which P-states to put the CPUs into. Of course, since
38the utilization of the system generally changes over time, that has to be done
39repeatedly on a regular basis. The activity by which this happens is referred
40to as CPU performance scaling or CPU frequency scaling (because it involves
41adjusting the CPU clock frequency).
42
43
44CPU Performance Scaling in Linux
45================================
46
47The Linux kernel supports CPU performance scaling by means of the ``CPUFreq``
48(CPU Frequency scaling) subsystem that consists of three layers of code: the
49core, scaling governors and scaling drivers.
50
51The ``CPUFreq`` core provides the common code infrastructure and user space
52interfaces for all platforms that support CPU performance scaling. It defines
53the basic framework in which the other components operate.
54
55Scaling governors implement algorithms to estimate the required CPU capacity.
56As a rule, each governor implements one, possibly parametrized, scaling
57algorithm.
58
59Scaling drivers talk to the hardware. They provide scaling governors with
60information on the available P-states (or P-state ranges in some cases) and
61access platform-specific hardware interfaces to change CPU P-states as requested
62by scaling governors.
63
64In principle, all available scaling governors can be used with every scaling
65driver. That design is based on the observation that the information used by
66performance scaling algorithms for P-state selection can be represented in a
67platform-independent form in the majority of cases, so it should be possible
68to use the same performance scaling algorithm implemented in exactly the same
69way regardless of which scaling driver is used. Consequently, the same set of
70scaling governors should be suitable for every supported platform.
71
72However, that observation may not hold for performance scaling algorithms
73based on information provided by the hardware itself, for example through
74feedback registers, as that information is typically specific to the hardware
75interface it comes from and may not be easily represented in an abstract,
76platform-independent way. For this reason, ``CPUFreq`` allows scaling drivers
77to bypass the governor layer and implement their own performance scaling
78algorithms. That is done by the ``intel_pstate`` scaling driver.
79
80
81``CPUFreq`` Policy Objects
82==========================
83
84In some cases the hardware interface for P-state control is shared by multiple
85CPUs. That is, for example, the same register (or set of registers) is used to
86control the P-state of multiple CPUs at the same time and writing to it affects
87all of those CPUs simultaneously.
88
89Sets of CPUs sharing hardware P-state control interfaces are represented by
90``CPUFreq`` as |struct cpufreq_policy| objects. For consistency,
91|struct cpufreq_policy| is also used when there is only one CPU in the given
92set.
93
94The ``CPUFreq`` core maintains a pointer to a |struct cpufreq_policy| object for
95every CPU in the system, including CPUs that are currently offline. If multiple
96CPUs share the same hardware P-state control interface, all of the pointers
97corresponding to them point to the same |struct cpufreq_policy| object.
98
99``CPUFreq`` uses |struct cpufreq_policy| as its basic data type and the design
100of its user space interface is based on the policy concept.
101
102
103CPU Initialization
104==================
105
106First of all, a scaling driver has to be registered for ``CPUFreq`` to work.
107It is only possible to register one scaling driver at a time, so the scaling
108driver is expected to be able to handle all CPUs in the system.
109
110The scaling driver may be registered before or after CPU registration. If
111CPUs are registered earlier, the driver core invokes the ``CPUFreq`` core to
112take a note of all of the already registered CPUs during the registration of the
113scaling driver. In turn, if any CPUs are registered after the registration of
114the scaling driver, the ``CPUFreq`` core will be invoked to take note of them
115at their registration time.
116
117In any case, the ``CPUFreq`` core is invoked to take note of any logical CPU it
118has not seen so far as soon as it is ready to handle that CPU. [Note that the
119logical CPU may be a physical single-core processor, or a single core in a
120multicore processor, or a hardware thread in a physical processor or processor
121core. In what follows "CPU" always means "logical CPU" unless explicitly stated
122otherwise and the word "processor" is used to refer to the physical part
123possibly including multiple logical CPUs.]
124
125Once invoked, the ``CPUFreq`` core checks if the policy pointer is already set
126for the given CPU and if so, it skips the policy object creation. Otherwise,
127a new policy object is created and initialized, which involves the creation of
128a new policy directory in ``sysfs``, and the policy pointer corresponding to
129the given CPU is set to the new policy object's address in memory.
130
131Next, the scaling driver's ``->init()`` callback is invoked with the policy
132pointer of the new CPU passed to it as the argument. That callback is expected
133to initialize the performance scaling hardware interface for the given CPU (or,
134more precisely, for the set of CPUs sharing the hardware interface it belongs
135to, represented by its policy object) and, if the policy object it has been
136called for is new, to set parameters of the policy, like the minimum and maximum
137frequencies supported by the hardware, the table of available frequencies (if
138the set of supported P-states is not a continuous range), and the mask of CPUs
139that belong to the same policy (including both online and offline CPUs). That
140mask is then used by the core to populate the policy pointers for all of the
141CPUs in it.
142
143The next major initialization step for a new policy object is to attach a
144scaling governor to it (to begin with, that is the default scaling governor
145determined by the kernel configuration, but it may be changed later
146via ``sysfs``). First, a pointer to the new policy object is passed to the
147governor's ``->init()`` callback which is expected to initialize all of the
148data structures necessary to handle the given policy and, possibly, to add
149a governor ``sysfs`` interface to it. Next, the governor is started by
150invoking its ``->start()`` callback.
151
152That callback it expected to register per-CPU utilization update callbacks for
153all of the online CPUs belonging to the given policy with the CPU scheduler.
154The utilization update callbacks will be invoked by the CPU scheduler on
155important events, like task enqueue and dequeue, on every iteration of the
156scheduler tick or generally whenever the CPU utilization may change (from the
157scheduler's perspective). They are expected to carry out computations needed
158to determine the P-state to use for the given policy going forward and to
159invoke the scaling driver to make changes to the hardware in accordance with
160the P-state selection. The scaling driver may be invoked directly from
161scheduler context or asynchronously, via a kernel thread or workqueue, depending
162on the configuration and capabilities of the scaling driver and the governor.
163
164Similar steps are taken for policy objects that are not new, but were "inactive"
165previously, meaning that all of the CPUs belonging to them were offline. The
166only practical difference in that case is that the ``CPUFreq`` core will attempt
167to use the scaling governor previously used with the policy that became
168"inactive" (and is re-initialized now) instead of the default governor.
169
170In turn, if a previously offline CPU is being brought back online, but some
171other CPUs sharing the policy object with it are online already, there is no
172need to re-initialize the policy object at all. In that case, it only is
173necessary to restart the scaling governor so that it can take the new online CPU
174into account. That is achieved by invoking the governor's ``->stop`` and
175``->start()`` callbacks, in this order, for the entire policy.
176
177As mentioned before, the ``intel_pstate`` scaling driver bypasses the scaling
178governor layer of ``CPUFreq`` and provides its own P-state selection algorithms.
179Consequently, if ``intel_pstate`` is used, scaling governors are not attached to
180new policy objects. Instead, the driver's ``->setpolicy()`` callback is invoked
181to register per-CPU utilization update callbacks for each policy. These
182callbacks are invoked by the CPU scheduler in the same way as for scaling
183governors, but in the ``intel_pstate`` case they both determine the P-state to
184use and change the hardware configuration accordingly in one go from scheduler
185context.
186
187The policy objects created during CPU initialization and other data structures
188associated with them are torn down when the scaling driver is unregistered
189(which happens when the kernel module containing it is unloaded, for example) or
190when the last CPU belonging to the given policy in unregistered.
191
192
193Policy Interface in ``sysfs``
194=============================
195
196During the initialization of the kernel, the ``CPUFreq`` core creates a
197``sysfs`` directory (kobject) called ``cpufreq`` under
198:file:`/sys/devices/system/cpu/`.
199
200That directory contains a ``policyX`` subdirectory (where ``X`` represents an
201integer number) for every policy object maintained by the ``CPUFreq`` core.
202Each ``policyX`` directory is pointed to by ``cpufreq`` symbolic links
203under :file:`/sys/devices/system/cpu/cpuY/` (where ``Y`` represents an integer
204that may be different from the one represented by ``X``) for all of the CPUs
205associated with (or belonging to) the given policy. The ``policyX`` directories
206in :file:`/sys/devices/system/cpu/cpufreq` each contain policy-specific
207attributes (files) to control ``CPUFreq`` behavior for the corresponding policy
208objects (that is, for all of the CPUs associated with them).
209
210Some of those attributes are generic. They are created by the ``CPUFreq`` core
211and their behavior generally does not depend on what scaling driver is in use
212and what scaling governor is attached to the given policy. Some scaling drivers
213also add driver-specific attributes to the policy directories in ``sysfs`` to
214control policy-specific aspects of driver behavior.
215
216The generic attributes under :file:`/sys/devices/system/cpu/cpufreq/policyX/`
217are the following:
218
219``affected_cpus``
220 List of online CPUs belonging to this policy (i.e. sharing the hardware
221 performance scaling interface represented by the ``policyX`` policy
222 object).
223
224``bios_limit``
225 If the platform firmware (BIOS) tells the OS to apply an upper limit to
226 CPU frequencies, that limit will be reported through this attribute (if
227 present).
228
229 The existence of the limit may be a result of some (often unintentional)
230 BIOS settings, restrictions coming from a service processor or another
231 BIOS/HW-based mechanisms.
232
233 This does not cover ACPI thermal limitations which can be discovered
234 through a generic thermal driver.
235
236 This attribute is not present if the scaling driver in use does not
237 support it.
238
239``cpuinfo_max_freq``
240 Maximum possible operating frequency the CPUs belonging to this policy
241 can run at (in kHz).
242
243``cpuinfo_min_freq``
244 Minimum possible operating frequency the CPUs belonging to this policy
245 can run at (in kHz).
246
247``cpuinfo_transition_latency``
248 The time it takes to switch the CPUs belonging to this policy from one
249 P-state to another, in nanoseconds.
250
251 If unknown or if known to be so high that the scaling driver does not
252 work with the `ondemand`_ governor, -1 (:c:macro:`CPUFREQ_ETERNAL`)
253 will be returned by reads from this attribute.
254
255``related_cpus``
256 List of all (online and offline) CPUs belonging to this policy.
257
258``scaling_available_governors``
259 List of ``CPUFreq`` scaling governors present in the kernel that can
260 be attached to this policy or (if the ``intel_pstate`` scaling driver is
261 in use) list of scaling algorithms provided by the driver that can be
262 applied to this policy.
263
264 [Note that some governors are modular and it may be necessary to load a
265 kernel module for the governor held by it to become available and be
266 listed by this attribute.]
267
268``scaling_cur_freq``
269 Current frequency of all of the CPUs belonging to this policy (in kHz).
270
271 For the majority of scaling drivers, this is the frequency of the last
272 P-state requested by the driver from the hardware using the scaling
273 interface provided by it, which may or may not reflect the frequency
274 the CPU is actually running at (due to hardware design and other
275 limitations).
276
277 Some scaling drivers (e.g. ``intel_pstate``) attempt to provide
278 information more precisely reflecting the current CPU frequency through
279 this attribute, but that still may not be the exact current CPU
280 frequency as seen by the hardware at the moment.
281
282``scaling_driver``
283 The scaling driver currently in use.
284
285``scaling_governor``
286 The scaling governor currently attached to this policy or (if the
287 ``intel_pstate`` scaling driver is in use) the scaling algorithm
288 provided by the driver that is currently applied to this policy.
289
290 This attribute is read-write and writing to it will cause a new scaling
291 governor to be attached to this policy or a new scaling algorithm
292 provided by the scaling driver to be applied to it (in the
293 ``intel_pstate`` case), as indicated by the string written to this
294 attribute (which must be one of the names listed by the
295 ``scaling_available_governors`` attribute described above).
296
297``scaling_max_freq``
298 Maximum frequency the CPUs belonging to this policy are allowed to be
299 running at (in kHz).
300
301 This attribute is read-write and writing a string representing an
302 integer to it will cause a new limit to be set (it must not be lower
303 than the value of the ``scaling_min_freq`` attribute).
304
305``scaling_min_freq``
306 Minimum frequency the CPUs belonging to this policy are allowed to be
307 running at (in kHz).
308
309 This attribute is read-write and writing a string representing a
310 non-negative integer to it will cause a new limit to be set (it must not
311 be higher than the value of the ``scaling_max_freq`` attribute).
312
313``scaling_setspeed``
314 This attribute is functional only if the `userspace`_ scaling governor
315 is attached to the given policy.
316
317 It returns the last frequency requested by the governor (in kHz) or can
318 be written to in order to set a new frequency for the policy.
319
320
321Generic Scaling Governors
322=========================
323
324``CPUFreq`` provides generic scaling governors that can be used with all
325scaling drivers. As stated before, each of them implements a single, possibly
326parametrized, performance scaling algorithm.
327
328Scaling governors are attached to policy objects and different policy objects
329can be handled by different scaling governors at the same time (although that
330may lead to suboptimal results in some cases).
331
332The scaling governor for a given policy object can be changed at any time with
333the help of the ``scaling_governor`` policy attribute in ``sysfs``.
334
335Some governors expose ``sysfs`` attributes to control or fine-tune the scaling
336algorithms implemented by them. Those attributes, referred to as governor
337tunables, can be either global (system-wide) or per-policy, depending on the
338scaling driver in use. If the driver requires governor tunables to be
339per-policy, they are located in a subdirectory of each policy directory.
340Otherwise, they are located in a subdirectory under
341:file:`/sys/devices/system/cpu/cpufreq/`. In either case the name of the
342subdirectory containing the governor tunables is the name of the governor
343providing them.
344
345``performance``
346---------------
347
348When attached to a policy object, this governor causes the highest frequency,
349within the ``scaling_max_freq`` policy limit, to be requested for that policy.
350
351The request is made once at that time the governor for the policy is set to
352``performance`` and whenever the ``scaling_max_freq`` or ``scaling_min_freq``
353policy limits change after that.
354
355``powersave``
356-------------
357
358When attached to a policy object, this governor causes the lowest frequency,
359within the ``scaling_min_freq`` policy limit, to be requested for that policy.
360
361The request is made once at that time the governor for the policy is set to
362``powersave`` and whenever the ``scaling_max_freq`` or ``scaling_min_freq``
363policy limits change after that.
364
365``userspace``
366-------------
367
368This governor does not do anything by itself. Instead, it allows user space
369to set the CPU frequency for the policy it is attached to by writing to the
370``scaling_setspeed`` attribute of that policy.
371
372``schedutil``
373-------------
374
375This governor uses CPU utilization data available from the CPU scheduler. It
376generally is regarded as a part of the CPU scheduler, so it can access the
377scheduler's internal data structures directly.
378
379It runs entirely in scheduler context, although in some cases it may need to
380invoke the scaling driver asynchronously when it decides that the CPU frequency
381should be changed for a given policy (that depends on whether or not the driver
382is capable of changing the CPU frequency from scheduler context).
383
384The actions of this governor for a particular CPU depend on the scheduling class
385invoking its utilization update callback for that CPU. If it is invoked by the
386RT or deadline scheduling classes, the governor will increase the frequency to
387the allowed maximum (that is, the ``scaling_max_freq`` policy limit). In turn,
388if it is invoked by the CFS scheduling class, the governor will use the
389Per-Entity Load Tracking (PELT) metric for the root control group of the
390given CPU as the CPU utilization estimate (see the `Per-entity load tracking`_
391LWN.net article for a description of the PELT mechanism). Then, the new
392CPU frequency to apply is computed in accordance with the formula
393
394 f = 1.25 * ``f_0`` * ``util`` / ``max``
395
396where ``util`` is the PELT number, ``max`` is the theoretical maximum of
397``util``, and ``f_0`` is either the maximum possible CPU frequency for the given
398policy (if the PELT number is frequency-invariant), or the current CPU frequency
399(otherwise).
400
401This governor also employs a mechanism allowing it to temporarily bump up the
402CPU frequency for tasks that have been waiting on I/O most recently, called
403"IO-wait boosting". That happens when the :c:macro:`SCHED_CPUFREQ_IOWAIT` flag
404is passed by the scheduler to the governor callback which causes the frequency
405to go up to the allowed maximum immediately and then draw back to the value
406returned by the above formula over time.
407
408This governor exposes only one tunable:
409
410``rate_limit_us``
411 Minimum time (in microseconds) that has to pass between two consecutive
412 runs of governor computations (default: 1000 times the scaling driver's
413 transition latency).
414
415 The purpose of this tunable is to reduce the scheduler context overhead
416 of the governor which might be excessive without it.
417
418This governor generally is regarded as a replacement for the older `ondemand`_
419and `conservative`_ governors (described below), as it is simpler and more
420tightly integrated with the CPU scheduler, its overhead in terms of CPU context
421switches and similar is less significant, and it uses the scheduler's own CPU
422utilization metric, so in principle its decisions should not contradict the
423decisions made by the other parts of the scheduler.
424
425``ondemand``
426------------
427
428This governor uses CPU load as a CPU frequency selection metric.
429
430In order to estimate the current CPU load, it measures the time elapsed between
431consecutive invocations of its worker routine and computes the fraction of that
432time in which the given CPU was not idle. The ratio of the non-idle (active)
433time to the total CPU time is taken as an estimate of the load.
434
435If this governor is attached to a policy shared by multiple CPUs, the load is
436estimated for all of them and the greatest result is taken as the load estimate
437for the entire policy.
438
439The worker routine of this governor has to run in process context, so it is
440invoked asynchronously (via a workqueue) and CPU P-states are updated from
441there if necessary. As a result, the scheduler context overhead from this
442governor is minimum, but it causes additional CPU context switches to happen
443relatively often and the CPU P-state updates triggered by it can be relatively
444irregular. Also, it affects its own CPU load metric by running code that
445reduces the CPU idle time (even though the CPU idle time is only reduced very
446slightly by it).
447
448It generally selects CPU frequencies proportional to the estimated load, so that
449the value of the ``cpuinfo_max_freq`` policy attribute corresponds to the load of
4501 (or 100%), and the value of the ``cpuinfo_min_freq`` policy attribute
451corresponds to the load of 0, unless when the load exceeds a (configurable)
452speedup threshold, in which case it will go straight for the highest frequency
453it is allowed to use (the ``scaling_max_freq`` policy limit).
454
455This governor exposes the following tunables:
456
457``sampling_rate``
458 This is how often the governor's worker routine should run, in
459 microseconds.
460
461 Typically, it is set to values of the order of 10000 (10 ms). Its
462 default value is equal to the value of ``cpuinfo_transition_latency``
463 for each policy this governor is attached to (but since the unit here
464 is greater by 1000, this means that the time represented by
465 ``sampling_rate`` is 1000 times greater than the transition latency by
466 default).
467
468 If this tunable is per-policy, the following shell command sets the time
469 represented by it to be 750 times as high as the transition latency::
470
471 # echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate
472
473
474``min_sampling_rate``
475 The minimum value of ``sampling_rate``.
476
477 Equal to 10000 (10 ms) if :c:macro:`CONFIG_NO_HZ_COMMON` and
478 :c:data:`tick_nohz_active` are both set or to 20 times the value of
479 :c:data:`jiffies` in microseconds otherwise.
480
481``up_threshold``
482 If the estimated CPU load is above this value (in percent), the governor
483 will set the frequency to the maximum value allowed for the policy.
484 Otherwise, the selected frequency will be proportional to the estimated
485 CPU load.
486
487``ignore_nice_load``
488 If set to 1 (default 0), it will cause the CPU load estimation code to
489 treat the CPU time spent on executing tasks with "nice" levels greater
490 than 0 as CPU idle time.
491
492 This may be useful if there are tasks in the system that should not be
493 taken into account when deciding what frequency to run the CPUs at.
494 Then, to make that happen it is sufficient to increase the "nice" level
495 of those tasks above 0 and set this attribute to 1.
496
497``sampling_down_factor``
498 Temporary multiplier, between 1 (default) and 100 inclusive, to apply to
499 the ``sampling_rate`` value if the CPU load goes above ``up_threshold``.
500
501 This causes the next execution of the governor's worker routine (after
502 setting the frequency to the allowed maximum) to be delayed, so the
503 frequency stays at the maximum level for a longer time.
504
505 Frequency fluctuations in some bursty workloads may be avoided this way
506 at the cost of additional energy spent on maintaining the maximum CPU
507 capacity.
508
509``powersave_bias``
510 Reduction factor to apply to the original frequency target of the
511 governor (including the maximum value used when the ``up_threshold``
512 value is exceeded by the estimated CPU load) or sensitivity threshold
513 for the AMD frequency sensitivity powersave bias driver
514 (:file:`drivers/cpufreq/amd_freq_sensitivity.c`), between 0 and 1000
515 inclusive.
516
517 If the AMD frequency sensitivity powersave bias driver is not loaded,
518 the effective frequency to apply is given by
519
520 f * (1 - ``powersave_bias`` / 1000)
521
522 where f is the governor's original frequency target. The default value
523 of this attribute is 0 in that case.
524
525 If the AMD frequency sensitivity powersave bias driver is loaded, the
526 value of this attribute is 400 by default and it is used in a different
527 way.
528
529 On Family 16h (and later) AMD processors there is a mechanism to get a
530 measured workload sensitivity, between 0 and 100% inclusive, from the
531 hardware. That value can be used to estimate how the performance of the
532 workload running on a CPU will change in response to frequency changes.
533
534 The performance of a workload with the sensitivity of 0 (memory-bound or
535 IO-bound) is not expected to increase at all as a result of increasing
536 the CPU frequency, whereas workloads with the sensitivity of 100%
537 (CPU-bound) are expected to perform much better if the CPU frequency is
538 increased.
539
540 If the workload sensitivity is less than the threshold represented by
541 the ``powersave_bias`` value, the sensitivity powersave bias driver
542 will cause the governor to select a frequency lower than its original
543 target, so as to avoid over-provisioning workloads that will not benefit
544 from running at higher CPU frequencies.
545
546``conservative``
547----------------
548
549This governor uses CPU load as a CPU frequency selection metric.
550
551It estimates the CPU load in the same way as the `ondemand`_ governor described
552above, but the CPU frequency selection algorithm implemented by it is different.
553
554Namely, it avoids changing the frequency significantly over short time intervals
555which may not be suitable for systems with limited power supply capacity (e.g.
556battery-powered). To achieve that, it changes the frequency in relatively
557small steps, one step at a time, up or down - depending on whether or not a
558(configurable) threshold has been exceeded by the estimated CPU load.
559
560This governor exposes the following tunables:
561
562``freq_step``
563 Frequency step in percent of the maximum frequency the governor is
564 allowed to set (the ``scaling_max_freq`` policy limit), between 0 and
565 100 (5 by default).
566
567 This is how much the frequency is allowed to change in one go. Setting
568 it to 0 will cause the default frequency step (5 percent) to be used
569 and setting it to 100 effectively causes the governor to periodically
570 switch the frequency between the ``scaling_min_freq`` and
571 ``scaling_max_freq`` policy limits.
572
573``down_threshold``
574 Threshold value (in percent, 20 by default) used to determine the
575 frequency change direction.
576
577 If the estimated CPU load is greater than this value, the frequency will
578 go up (by ``freq_step``). If the load is less than this value (and the
579 ``sampling_down_factor`` mechanism is not in effect), the frequency will
580 go down. Otherwise, the frequency will not be changed.
581
582``sampling_down_factor``
583 Frequency decrease deferral factor, between 1 (default) and 10
584 inclusive.
585
586 It effectively causes the frequency to go down ``sampling_down_factor``
587 times slower than it ramps up.
588
589
590Frequency Boost Support
591=======================
592
593Background
594----------
595
596Some processors support a mechanism to raise the operating frequency of some
597cores in a multicore package temporarily (and above the sustainable frequency
598threshold for the whole package) under certain conditions, for example if the
599whole chip is not fully utilized and below its intended thermal or power budget.
600
601Different names are used by different vendors to refer to this functionality.
602For Intel processors it is referred to as "Turbo Boost", AMD calls it
603"Turbo-Core" or (in technical documentation) "Core Performance Boost" and so on.
604As a rule, it also is implemented differently by different vendors. The simple
605term "frequency boost" is used here for brevity to refer to all of those
606implementations.
607
608The frequency boost mechanism may be either hardware-based or software-based.
609If it is hardware-based (e.g. on x86), the decision to trigger the boosting is
610made by the hardware (although in general it requires the hardware to be put
611into a special state in which it can control the CPU frequency within certain
612limits). If it is software-based (e.g. on ARM), the scaling driver decides
613whether or not to trigger boosting and when to do that.
614
615The ``boost`` File in ``sysfs``
616-------------------------------
617
618This file is located under :file:`/sys/devices/system/cpu/cpufreq/` and controls
619the "boost" setting for the whole system. It is not present if the underlying
620scaling driver does not support the frequency boost mechanism (or supports it,
621but provides a driver-specific interface for controlling it, like
622``intel_pstate``).
623
624If the value in this file is 1, the frequency boost mechanism is enabled. This
625means that either the hardware can be put into states in which it is able to
626trigger boosting (in the hardware-based case), or the software is allowed to
627trigger boosting (in the software-based case). It does not mean that boosting
628is actually in use at the moment on any CPUs in the system. It only means a
629permission to use the frequency boost mechanism (which still may never be used
630for other reasons).
631
632If the value in this file is 0, the frequency boost mechanism is disabled and
633cannot be used at all.
634
635The only values that can be written to this file are 0 and 1.
636
637Rationale for Boost Control Knob
638--------------------------------
639
640The frequency boost mechanism is generally intended to help to achieve optimum
641CPU performance on time scales below software resolution (e.g. below the
642scheduler tick interval) and it is demonstrably suitable for many workloads, but
643it may lead to problems in certain situations.
644
645For this reason, many systems make it possible to disable the frequency boost
646mechanism in the platform firmware (BIOS) setup, but that requires the system to
647be restarted for the setting to be adjusted as desired, which may not be
648practical at least in some cases. For example:
649
650 1. Boosting means overclocking the processor, although under controlled
651 conditions. Generally, the processor's energy consumption increases
652 as a result of increasing its frequency and voltage, even temporarily.
653 That may not be desirable on systems that switch to power sources of
654 limited capacity, such as batteries, so the ability to disable the boost
655 mechanism while the system is running may help there (but that depends on
656 the workload too).
657
658 2. In some situations deterministic behavior is more important than
659 performance or energy consumption (or both) and the ability to disable
660 boosting while the system is running may be useful then.
661
662 3. To examine the impact of the frequency boost mechanism itself, it is useful
663 to be able to run tests with and without boosting, preferably without
664 restarting the system in the meantime.
665
666 4. Reproducible results are important when running benchmarks. Since
667 the boosting functionality depends on the load of the whole package,
668 single-thread performance may vary because of it which may lead to
669 unreproducible results sometimes. That can be avoided by disabling the
670 frequency boost mechanism before running benchmarks sensitive to that
671 issue.
672
673Legacy AMD ``cpb`` Knob
674-----------------------
675
676The AMD powernow-k8 scaling driver supports a ``sysfs`` knob very similar to
677the global ``boost`` one. It is used for disabling/enabling the "Core
678Performance Boost" feature of some AMD processors.
679
680If present, that knob is located in every ``CPUFreq`` policy directory in
681``sysfs`` (:file:`/sys/devices/system/cpu/cpufreq/policyX/`) and is called
682``cpb``, which indicates a more fine grained control interface. The actual
683implementation, however, works on the system-wide basis and setting that knob
684for one policy causes the same value of it to be set for all of the other
685policies at the same time.
686
687That knob is still supported on AMD processors that support its underlying
688hardware feature, but it may be configured out of the kernel (via the
689:c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option) and the global
690``boost`` knob is present regardless. Thus it is always possible use the
691``boost`` knob instead of the ``cpb`` one which is highly recommended, as that
692is more consistent with what all of the other systems do (and the ``cpb`` knob
693may not be supported any more in the future).
694
695The ``cpb`` knob is never present for any processors without the underlying
696hardware feature (e.g. all Intel ones), even if the
697:c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option is set.
698
699
700.. _Per-entity load tracking: https://lwn.net/Articles/531853/
diff --git a/Documentation/admin-guide/pm/index.rst b/Documentation/admin-guide/pm/index.rst
new file mode 100644
index 000000000000..c80f087321fc
--- /dev/null
+++ b/Documentation/admin-guide/pm/index.rst
@@ -0,0 +1,15 @@
1================
2Power Management
3================
4
5.. toctree::
6 :maxdepth: 2
7
8 cpufreq
9
10.. only:: subproject and html
11
12 Indices
13 =======
14
15 * :ref:`genindex`
diff --git a/Documentation/admin-guide/ras.rst b/Documentation/admin-guide/ras.rst
index 1b90c6f00a92..8c7bbf2c88d2 100644
--- a/Documentation/admin-guide/ras.rst
+++ b/Documentation/admin-guide/ras.rst
@@ -8,7 +8,7 @@ RAS concepts
8************ 8************
9 9
10Reliability, Availability and Serviceability (RAS) is a concept used on 10Reliability, Availability and Serviceability (RAS) is a concept used on
11servers meant to measure their robusteness. 11servers meant to measure their robustness.
12 12
13Reliability 13Reliability
14 is the probability that a system will produce correct outputs. 14 is the probability that a system will produce correct outputs.
@@ -42,13 +42,13 @@ Among the monitoring measures, the most usual ones include:
42 42
43* CPU – detect errors at instruction execution and at L1/L2/L3 caches; 43* CPU – detect errors at instruction execution and at L1/L2/L3 caches;
44* Memory – add error correction logic (ECC) to detect and correct errors; 44* Memory – add error correction logic (ECC) to detect and correct errors;
45* I/O – add CRC checksums for tranfered data; 45* I/O – add CRC checksums for transferred data;
46* Storage – RAID, journal file systems, checksums, 46* Storage – RAID, journal file systems, checksums,
47 Self-Monitoring, Analysis and Reporting Technology (SMART). 47 Self-Monitoring, Analysis and Reporting Technology (SMART).
48 48
49By monitoring the number of occurrences of error detections, it is possible 49By monitoring the number of occurrences of error detections, it is possible
50to identify if the probability of hardware errors is increasing, and, on such 50to identify if the probability of hardware errors is increasing, and, on such
51case, do a preventive maintainance to replace a degrated component while 51case, do a preventive maintenance to replace a degraded component while
52those errors are correctable. 52those errors are correctable.
53 53
54Types of errors 54Types of errors
@@ -121,7 +121,7 @@ using the ``dmidecode`` tool. For example, on a desktop machine, it shows::
121On the above example, a DDR4 SO-DIMM memory module is located at the 121On the above example, a DDR4 SO-DIMM memory module is located at the
122system's memory labeled as "BANK 0", as given by the *bank locator* field. 122system's memory labeled as "BANK 0", as given by the *bank locator* field.
123Please notice that, on such system, the *total width* is equal to the 123Please notice that, on such system, the *total width* is equal to the
124*data witdh*. It means that such memory module doesn't have error 124*data width*. It means that such memory module doesn't have error
125detection/correction mechanisms. 125detection/correction mechanisms.
126 126
127Unfortunately, not all systems use the same field to specify the memory 127Unfortunately, not all systems use the same field to specify the memory
@@ -145,7 +145,7 @@ bank. On this example, from an older server, ``dmidecode`` shows::
145 145
146There, the DDR3 RDIMM memory module is located at the system's memory labeled 146There, the DDR3 RDIMM memory module is located at the system's memory labeled
147as "DIMM_A1", as given by the *locator* field. Please notice that this 147as "DIMM_A1", as given by the *locator* field. Please notice that this
148memory module has 64 bits of *data witdh* and 72 bits of *total width*. So, 148memory module has 64 bits of *data width* and 72 bits of *total width*. So,
149it has 8 extra bits to be used by error detection and correction mechanisms. 149it has 8 extra bits to be used by error detection and correction mechanisms.
150Such kind of memory is called Error-correcting code memory (ECC memory). 150Such kind of memory is called Error-correcting code memory (ECC memory).
151 151
@@ -186,7 +186,7 @@ Architecture (MCA)\ [#f3]_.
186.. [#f1] Please notice that several memory controllers allow operation on a 186.. [#f1] Please notice that several memory controllers allow operation on a
187 mode called "Lock-Step", where it groups two memory modules together, 187 mode called "Lock-Step", where it groups two memory modules together,
188 doing 128-bit reads/writes. That gives 16 bits for error correction, with 188 doing 128-bit reads/writes. That gives 16 bits for error correction, with
189 significatively improves the error correction mechanism, at the expense 189 significantly improves the error correction mechanism, at the expense
190 that, when an error happens, there's no way to know what memory module is 190 that, when an error happens, there's no way to know what memory module is
191 to blame. So, it has to blame both memory modules. 191 to blame. So, it has to blame both memory modules.
192 192
diff --git a/Documentation/admin-guide/security-bugs.rst b/Documentation/admin-guide/security-bugs.rst
index 4f7414cad586..47574b382d75 100644
--- a/Documentation/admin-guide/security-bugs.rst
+++ b/Documentation/admin-guide/security-bugs.rst
@@ -14,14 +14,17 @@ Contact
14The Linux kernel security team can be contacted by email at 14The Linux kernel security team can be contacted by email at
15<security@kernel.org>. This is a private list of security officers 15<security@kernel.org>. This is a private list of security officers
16who will help verify the bug report and develop and release a fix. 16who will help verify the bug report and develop and release a fix.
17It is possible that the security team will bring in extra help from 17If you already have a fix, please include it with your report, as
18area maintainers to understand and fix the security vulnerability. 18that can speed up the process considerably. It is possible that the
19security team will bring in extra help from area maintainers to
20understand and fix the security vulnerability.
19 21
20As it is with any bug, the more information provided the easier it 22As it is with any bug, the more information provided the easier it
21will be to diagnose and fix. Please review the procedure outlined in 23will be to diagnose and fix. Please review the procedure outlined in
22admin-guide/reporting-bugs.rst if you are unclear about what information is helpful. 24admin-guide/reporting-bugs.rst if you are unclear about what
23Any exploit code is very helpful and will not be released without 25information is helpful. Any exploit code is very helpful and will not
24consent from the reporter unless it has already been made public. 26be released without consent from the reporter unless it has already been
27made public.
25 28
26Disclosure 29Disclosure
27---------- 30----------
@@ -39,6 +42,32 @@ disclosure is from immediate (esp. if it's already publicly known)
39to a few weeks. As a basic default policy, we expect report date to 42to a few weeks. As a basic default policy, we expect report date to
40disclosure date to be on the order of 7 days. 43disclosure date to be on the order of 7 days.
41 44
45Coordination
46------------
47
48Fixes for sensitive bugs, such as those that might lead to privilege
49escalations, may need to be coordinated with the private
50<linux-distros@vs.openwall.org> mailing list so that distribution vendors
51are well prepared to issue a fixed kernel upon public disclosure of the
52upstream fix. Distros will need some time to test the proposed patch and
53will generally request at least a few days of embargo, and vendor update
54publication prefers to happen Tuesday through Thursday. When appropriate,
55the security team can assist with this coordination, or the reporter can
56include linux-distros from the start. In this case, remember to prefix
57the email Subject line with "[vs]" as described in the linux-distros wiki:
58<http://oss-security.openwall.org/wiki/mailing-lists/distros#how-to-use-the-lists>
59
60CVE assignment
61--------------
62
63The security team does not normally assign CVEs, nor do we require them
64for reports or fixes, as this can needlessly complicate the process and
65may delay the bug handling. If a reporter wishes to have a CVE identifier
66assigned ahead of public disclosure, they will need to contact the private
67linux-distros list, described above. When such a CVE identifier is known
68before a patch is provided, it is desirable to mention it in the commit
69message, though.
70
42Non-disclosure agreements 71Non-disclosure agreements
43------------------------- 72-------------------------
44 73
diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst
index d1712ea2d314..7b9035c01a2e 100644
--- a/Documentation/admin-guide/sysrq.rst
+++ b/Documentation/admin-guide/sysrq.rst
@@ -212,7 +212,8 @@ I hit SysRq, but nothing seems to happen, what's wrong?
212~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 212~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213 213
214There are some keyboards that produce a different keycode for SysRq than the 214There are some keyboards that produce a different keycode for SysRq than the
215pre-defined value of 99 (see ``KEY_SYSRQ`` in ``include/linux/input.h``), or 215pre-defined value of 99
216(see ``KEY_SYSRQ`` in ``include/uapi/linux/input-event-codes.h``), or
216which don't have a SysRq key at all. In these cases, run ``showkey -s`` to find 217which don't have a SysRq key at all. In these cases, run ``showkey -s`` to find
217an appropriate scancode sequence, and use ``setkeycodes <sequence> 99`` to map 218an appropriate scancode sequence, and use ``setkeycodes <sequence> 99`` to map
218this sequence to the usual SysRq code (e.g., ``setkeycodes e05b 99``). It's 219this sequence to the usual SysRq code (e.g., ``setkeycodes e05b 99``). It's
diff --git a/Documentation/arm/mem_alignment b/Documentation/arm/mem_alignment
index c7c7a114c78c..6335fcacbba9 100644
--- a/Documentation/arm/mem_alignment
+++ b/Documentation/arm/mem_alignment
@@ -48,7 +48,7 @@ Note that not all combinations are supported - only values 0 through 5.
48For example, the following will turn on the warnings, but without 48For example, the following will turn on the warnings, but without
49fixing up or sending SIGBUS signals: 49fixing up or sending SIGBUS signals:
50 50
51 echo 1 > /proc/sys/debug/alignment 51 echo 1 > /proc/cpu/alignment
52 52
53You can also read the content of the same file to get statistical 53You can also read the content of the same file to get statistical
54information on unaligned access occurrences plus the current mode of 54information on unaligned access occurrences plus the current mode of
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 7fadb3b83293..08aef4595059 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -17,7 +17,7 @@ import os
17import sphinx 17import sphinx
18 18
19# Get Sphinx version 19# Get Sphinx version
20major, minor, patch = map(int, sphinx.__version__.split(".")) 20major, minor, patch = sphinx.version_info[:3]
21 21
22 22
23# If extensions (or modules to document with autodoc) are in another directory, 23# If extensions (or modules to document with autodoc) are in another directory,
@@ -29,12 +29,12 @@ from load_config import loadConfig
29# -- General configuration ------------------------------------------------ 29# -- General configuration ------------------------------------------------
30 30
31# If your documentation needs a minimal Sphinx version, state it here. 31# If your documentation needs a minimal Sphinx version, state it here.
32#needs_sphinx = '1.0' 32needs_sphinx = '1.2'
33 33
34# Add any Sphinx extension module names here, as strings. They can be 34# Add any Sphinx extension module names here, as strings. They can be
35# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 35# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
36# ones. 36# ones.
37extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain'] 37extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure']
38 38
39# The name of the math extension changed on Sphinx 1.4 39# The name of the math extension changed on Sphinx 1.4
40if major == 1 and minor > 3: 40if major == 1 and minor > 3:
diff --git a/Documentation/core-api/flexible-arrays.rst b/Documentation/core-api/flexible-arrays.rst
new file mode 100644
index 000000000000..b6b85a1b518e
--- /dev/null
+++ b/Documentation/core-api/flexible-arrays.rst
@@ -0,0 +1,130 @@
1
2===================================
3Using flexible arrays in the kernel
4===================================
5
6Large contiguous memory allocations can be unreliable in the Linux kernel.
7Kernel programmers will sometimes respond to this problem by allocating
8pages with :c:func:`vmalloc()`. This solution not ideal, though. On 32-bit
9systems, memory from vmalloc() must be mapped into a relatively small address
10space; it's easy to run out. On SMP systems, the page table changes required
11by vmalloc() allocations can require expensive cross-processor interrupts on
12all CPUs. And, on all systems, use of space in the vmalloc() range increases
13pressure on the translation lookaside buffer (TLB), reducing the performance
14of the system.
15
16In many cases, the need for memory from vmalloc() can be eliminated by piecing
17together an array from smaller parts; the flexible array library exists to make
18this task easier.
19
20A flexible array holds an arbitrary (within limits) number of fixed-sized
21objects, accessed via an integer index. Sparse arrays are handled
22reasonably well. Only single-page allocations are made, so memory
23allocation failures should be relatively rare. The down sides are that the
24arrays cannot be indexed directly, individual object size cannot exceed the
25system page size, and putting data into a flexible array requires a copy
26operation. It's also worth noting that flexible arrays do no internal
27locking at all; if concurrent access to an array is possible, then the
28caller must arrange for appropriate mutual exclusion.
29
30The creation of a flexible array is done with :c:func:`flex_array_alloc()`::
31
32 #include <linux/flex_array.h>
33
34 struct flex_array *flex_array_alloc(int element_size,
35 unsigned int total,
36 gfp_t flags);
37
38The individual object size is provided by ``element_size``, while total is the
39maximum number of objects which can be stored in the array. The flags
40argument is passed directly to the internal memory allocation calls. With
41the current code, using flags to ask for high memory is likely to lead to
42notably unpleasant side effects.
43
44It is also possible to define flexible arrays at compile time with::
45
46 DEFINE_FLEX_ARRAY(name, element_size, total);
47
48This macro will result in a definition of an array with the given name; the
49element size and total will be checked for validity at compile time.
50
51Storing data into a flexible array is accomplished with a call to
52:c:func:`flex_array_put()`::
53
54 int flex_array_put(struct flex_array *array, unsigned int element_nr,
55 void *src, gfp_t flags);
56
57This call will copy the data from src into the array, in the position
58indicated by ``element_nr`` (which must be less than the maximum specified when
59the array was created). If any memory allocations must be performed, flags
60will be used. The return value is zero on success, a negative error code
61otherwise.
62
63There might possibly be a need to store data into a flexible array while
64running in some sort of atomic context; in this situation, sleeping in the
65memory allocator would be a bad thing. That can be avoided by using
66``GFP_ATOMIC`` for the flags value, but, often, there is a better way. The
67trick is to ensure that any needed memory allocations are done before
68entering atomic context, using :c:func:`flex_array_prealloc()`::
69
70 int flex_array_prealloc(struct flex_array *array, unsigned int start,
71 unsigned int nr_elements, gfp_t flags);
72
73This function will ensure that memory for the elements indexed in the range
74defined by ``start`` and ``nr_elements`` has been allocated. Thereafter, a
75``flex_array_put()`` call on an element in that range is guaranteed not to
76block.
77
78Getting data back out of the array is done with :c:func:`flex_array_get()`::
79
80 void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
81
82The return value is a pointer to the data element, or NULL if that
83particular element has never been allocated.
84
85Note that it is possible to get back a valid pointer for an element which
86has never been stored in the array. Memory for array elements is allocated
87one page at a time; a single allocation could provide memory for several
88adjacent elements. Flexible array elements are normally initialized to the
89value ``FLEX_ARRAY_FREE`` (defined as 0x6c in <linux/poison.h>), so errors
90involving that number probably result from use of unstored array entries.
91Note that, if array elements are allocated with ``__GFP_ZERO``, they will be
92initialized to zero and this poisoning will not happen.
93
94Individual elements in the array can be cleared with
95:c:func:`flex_array_clear()`::
96
97 int flex_array_clear(struct flex_array *array, unsigned int element_nr);
98
99This function will set the given element to ``FLEX_ARRAY_FREE`` and return
100zero. If storage for the indicated element is not allocated for the array,
101``flex_array_clear()`` will return ``-EINVAL`` instead. Note that clearing an
102element does not release the storage associated with it; to reduce the
103allocated size of an array, call :c:func:`flex_array_shrink()`::
104
105 int flex_array_shrink(struct flex_array *array);
106
107The return value will be the number of pages of memory actually freed.
108This function works by scanning the array for pages containing nothing but
109``FLEX_ARRAY_FREE`` bytes, so (1) it can be expensive, and (2) it will not work
110if the array's pages are allocated with ``__GFP_ZERO``.
111
112It is possible to remove all elements of an array with a call to
113:c:func:`flex_array_free_parts()`::
114
115 void flex_array_free_parts(struct flex_array *array);
116
117This call frees all elements, but leaves the array itself in place.
118Freeing the entire array is done with :c:func:`flex_array_free()`::
119
120 void flex_array_free(struct flex_array *array);
121
122As of this writing, there are no users of flexible arrays in the mainline
123kernel. The functions described here are also not exported to modules;
124that will probably be fixed when somebody comes up with a need for it.
125
126
127Flexible array functions
128------------------------
129
130.. kernel-doc:: include/linux/flex_array.h
diff --git a/Documentation/core-api/genericirq.rst b/Documentation/core-api/genericirq.rst
new file mode 100644
index 000000000000..0054bd48be84
--- /dev/null
+++ b/Documentation/core-api/genericirq.rst
@@ -0,0 +1,440 @@
1.. include:: <isonum.txt>
2
3==========================
4Linux generic IRQ handling
5==========================
6
7:Copyright: |copy| 2005-2010: Thomas Gleixner
8:Copyright: |copy| 2005-2006: Ingo Molnar
9
10Introduction
11============
12
13The generic interrupt handling layer is designed to provide a complete
14abstraction of interrupt handling for device drivers. It is able to
15handle all the different types of interrupt controller hardware. Device
16drivers use generic API functions to request, enable, disable and free
17interrupts. The drivers do not have to know anything about interrupt
18hardware details, so they can be used on different platforms without
19code changes.
20
21This documentation is provided to developers who want to implement an
22interrupt subsystem based for their architecture, with the help of the
23generic IRQ handling layer.
24
25Rationale
26=========
27
28The original implementation of interrupt handling in Linux uses the
29:c:func:`__do_IRQ` super-handler, which is able to deal with every type of
30interrupt logic.
31
32Originally, Russell King identified different types of handlers to build
33a quite universal set for the ARM interrupt handler implementation in
34Linux 2.5/2.6. He distinguished between:
35
36- Level type
37
38- Edge type
39
40- Simple type
41
42During the implementation we identified another type:
43
44- Fast EOI type
45
46In the SMP world of the :c:func:`__do_IRQ` super-handler another type was
47identified:
48
49- Per CPU type
50
51This split implementation of high-level IRQ handlers allows us to
52optimize the flow of the interrupt handling for each specific interrupt
53type. This reduces complexity in that particular code path and allows
54the optimized handling of a given type.
55
56The original general IRQ implementation used hw_interrupt_type
57structures and their ``->ack``, ``->end`` [etc.] callbacks to differentiate
58the flow control in the super-handler. This leads to a mix of flow logic
59and low-level hardware logic, and it also leads to unnecessary code
60duplication: for example in i386, there is an ``ioapic_level_irq`` and an
61``ioapic_edge_irq`` IRQ-type which share many of the low-level details but
62have different flow handling.
63
64A more natural abstraction is the clean separation of the 'irq flow' and
65the 'chip details'.
66
67Analysing a couple of architecture's IRQ subsystem implementations
68reveals that most of them can use a generic set of 'irq flow' methods
69and only need to add the chip-level specific code. The separation is
70also valuable for (sub)architectures which need specific quirks in the
71IRQ flow itself but not in the chip details - and thus provides a more
72transparent IRQ subsystem design.
73
74Each interrupt descriptor is assigned its own high-level flow handler,
75which is normally one of the generic implementations. (This high-level
76flow handler implementation also makes it simple to provide
77demultiplexing handlers which can be found in embedded platforms on
78various architectures.)
79
80The separation makes the generic interrupt handling layer more flexible
81and extensible. For example, an (sub)architecture can use a generic
82IRQ-flow implementation for 'level type' interrupts and add a
83(sub)architecture specific 'edge type' implementation.
84
85To make the transition to the new model easier and prevent the breakage
86of existing implementations, the :c:func:`__do_IRQ` super-handler is still
87available. This leads to a kind of duality for the time being. Over time
88the new model should be used in more and more architectures, as it
89enables smaller and cleaner IRQ subsystems. It's deprecated for three
90years now and about to be removed.
91
92Known Bugs And Assumptions
93==========================
94
95None (knock on wood).
96
97Abstraction layers
98==================
99
100There are three main levels of abstraction in the interrupt code:
101
1021. High-level driver API
103
1042. High-level IRQ flow handlers
105
1063. Chip-level hardware encapsulation
107
108Interrupt control flow
109----------------------
110
111Each interrupt is described by an interrupt descriptor structure
112irq_desc. The interrupt is referenced by an 'unsigned int' numeric
113value which selects the corresponding interrupt description structure in
114the descriptor structures array. The descriptor structure contains
115status information and pointers to the interrupt flow method and the
116interrupt chip structure which are assigned to this interrupt.
117
118Whenever an interrupt triggers, the low-level architecture code calls
119into the generic interrupt code by calling :c:func:`desc->handle_irq`. This
120high-level IRQ handling function only uses desc->irq_data.chip
121primitives referenced by the assigned chip descriptor structure.
122
123High-level Driver API
124---------------------
125
126The high-level Driver API consists of following functions:
127
128- :c:func:`request_irq`
129
130- :c:func:`free_irq`
131
132- :c:func:`disable_irq`
133
134- :c:func:`enable_irq`
135
136- :c:func:`disable_irq_nosync` (SMP only)
137
138- :c:func:`synchronize_irq` (SMP only)
139
140- :c:func:`irq_set_irq_type`
141
142- :c:func:`irq_set_irq_wake`
143
144- :c:func:`irq_set_handler_data`
145
146- :c:func:`irq_set_chip`
147
148- :c:func:`irq_set_chip_data`
149
150See the autogenerated function documentation for details.
151
152High-level IRQ flow handlers
153----------------------------
154
155The generic layer provides a set of pre-defined irq-flow methods:
156
157- :c:func:`handle_level_irq`
158
159- :c:func:`handle_edge_irq`
160
161- :c:func:`handle_fasteoi_irq`
162
163- :c:func:`handle_simple_irq`
164
165- :c:func:`handle_percpu_irq`
166
167- :c:func:`handle_edge_eoi_irq`
168
169- :c:func:`handle_bad_irq`
170
171The interrupt flow handlers (either pre-defined or architecture
172specific) are assigned to specific interrupts by the architecture either
173during bootup or during device initialization.
174
175Default flow implementations
176~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177
178Helper functions
179^^^^^^^^^^^^^^^^
180
181The helper functions call the chip primitives and are used by the
182default flow implementations. The following helper functions are
183implemented (simplified excerpt)::
184
185 default_enable(struct irq_data *data)
186 {
187 desc->irq_data.chip->irq_unmask(data);
188 }
189
190 default_disable(struct irq_data *data)
191 {
192 if (!delay_disable(data))
193 desc->irq_data.chip->irq_mask(data);
194 }
195
196 default_ack(struct irq_data *data)
197 {
198 chip->irq_ack(data);
199 }
200
201 default_mask_ack(struct irq_data *data)
202 {
203 if (chip->irq_mask_ack) {
204 chip->irq_mask_ack(data);
205 } else {
206 chip->irq_mask(data);
207 chip->irq_ack(data);
208 }
209 }
210
211 noop(struct irq_data *data))
212 {
213 }
214
215
216
217Default flow handler implementations
218~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
219
220Default Level IRQ flow handler
221^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222
223handle_level_irq provides a generic implementation for level-triggered
224interrupts.
225
226The following control flow is implemented (simplified excerpt)::
227
228 :c:func:`desc->irq_data.chip->irq_mask_ack`;
229 handle_irq_event(desc->action);
230 :c:func:`desc->irq_data.chip->irq_unmask`;
231
232
233Default Fast EOI IRQ flow handler
234^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
235
236handle_fasteoi_irq provides a generic implementation for interrupts,
237which only need an EOI at the end of the handler.
238
239The following control flow is implemented (simplified excerpt)::
240
241 handle_irq_event(desc->action);
242 :c:func:`desc->irq_data.chip->irq_eoi`;
243
244
245Default Edge IRQ flow handler
246^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
247
248handle_edge_irq provides a generic implementation for edge-triggered
249interrupts.
250
251The following control flow is implemented (simplified excerpt)::
252
253 if (desc->status & running) {
254 :c:func:`desc->irq_data.chip->irq_mask_ack`;
255 desc->status |= pending | masked;
256 return;
257 }
258 :c:func:`desc->irq_data.chip->irq_ack`;
259 desc->status |= running;
260 do {
261 if (desc->status & masked)
262 :c:func:`desc->irq_data.chip->irq_unmask`;
263 desc->status &= ~pending;
264 handle_irq_event(desc->action);
265 } while (status & pending);
266 desc->status &= ~running;
267
268
269Default simple IRQ flow handler
270^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
271
272handle_simple_irq provides a generic implementation for simple
273interrupts.
274
275.. note::
276
277 The simple flow handler does not call any handler/chip primitives.
278
279The following control flow is implemented (simplified excerpt)::
280
281 handle_irq_event(desc->action);
282
283
284Default per CPU flow handler
285^^^^^^^^^^^^^^^^^^^^^^^^^^^^
286
287handle_percpu_irq provides a generic implementation for per CPU
288interrupts.
289
290Per CPU interrupts are only available on SMP and the handler provides a
291simplified version without locking.
292
293The following control flow is implemented (simplified excerpt)::
294
295 if (desc->irq_data.chip->irq_ack)
296 :c:func:`desc->irq_data.chip->irq_ack`;
297 handle_irq_event(desc->action);
298 if (desc->irq_data.chip->irq_eoi)
299 :c:func:`desc->irq_data.chip->irq_eoi`;
300
301
302EOI Edge IRQ flow handler
303^^^^^^^^^^^^^^^^^^^^^^^^^
304
305handle_edge_eoi_irq provides an abnomination of the edge handler
306which is solely used to tame a badly wreckaged irq controller on
307powerpc/cell.
308
309Bad IRQ flow handler
310^^^^^^^^^^^^^^^^^^^^
311
312handle_bad_irq is used for spurious interrupts which have no real
313handler assigned..
314
315Quirks and optimizations
316~~~~~~~~~~~~~~~~~~~~~~~~
317
318The generic functions are intended for 'clean' architectures and chips,
319which have no platform-specific IRQ handling quirks. If an architecture
320needs to implement quirks on the 'flow' level then it can do so by
321overriding the high-level irq-flow handler.
322
323Delayed interrupt disable
324~~~~~~~~~~~~~~~~~~~~~~~~~
325
326This per interrupt selectable feature, which was introduced by Russell
327King in the ARM interrupt implementation, does not mask an interrupt at
328the hardware level when :c:func:`disable_irq` is called. The interrupt is kept
329enabled and is masked in the flow handler when an interrupt event
330happens. This prevents losing edge interrupts on hardware which does not
331store an edge interrupt event while the interrupt is disabled at the
332hardware level. When an interrupt arrives while the IRQ_DISABLED flag
333is set, then the interrupt is masked at the hardware level and the
334IRQ_PENDING bit is set. When the interrupt is re-enabled by
335:c:func:`enable_irq` the pending bit is checked and if it is set, the interrupt
336is resent either via hardware or by a software resend mechanism. (It's
337necessary to enable CONFIG_HARDIRQS_SW_RESEND when you want to use
338the delayed interrupt disable feature and your hardware is not capable
339of retriggering an interrupt.) The delayed interrupt disable is not
340configurable.
341
342Chip-level hardware encapsulation
343---------------------------------
344
345The chip-level hardware descriptor structure :c:type:`irq_chip` contains all
346the direct chip relevant functions, which can be utilized by the irq flow
347implementations.
348
349- ``irq_ack``
350
351- ``irq_mask_ack`` - Optional, recommended for performance
352
353- ``irq_mask``
354
355- ``irq_unmask``
356
357- ``irq_eoi`` - Optional, required for EOI flow handlers
358
359- ``irq_retrigger`` - Optional
360
361- ``irq_set_type`` - Optional
362
363- ``irq_set_wake`` - Optional
364
365These primitives are strictly intended to mean what they say: ack means
366ACK, masking means masking of an IRQ line, etc. It is up to the flow
367handler(s) to use these basic units of low-level functionality.
368
369__do_IRQ entry point
370====================
371
372The original implementation :c:func:`__do_IRQ` was an alternative entry point
373for all types of interrupts. It no longer exists.
374
375This handler turned out to be not suitable for all interrupt hardware
376and was therefore reimplemented with split functionality for
377edge/level/simple/percpu interrupts. This is not only a functional
378optimization. It also shortens code paths for interrupts.
379
380Locking on SMP
381==============
382
383The locking of chip registers is up to the architecture that defines the
384chip primitives. The per-irq structure is protected via desc->lock, by
385the generic layer.
386
387Generic interrupt chip
388======================
389
390To avoid copies of identical implementations of IRQ chips the core
391provides a configurable generic interrupt chip implementation.
392Developers should check carefully whether the generic chip fits their
393needs before implementing the same functionality slightly differently
394themselves.
395
396.. kernel-doc:: kernel/irq/generic-chip.c
397 :export:
398
399Structures
400==========
401
402This chapter contains the autogenerated documentation of the structures
403which are used in the generic IRQ layer.
404
405.. kernel-doc:: include/linux/irq.h
406 :internal:
407
408.. kernel-doc:: include/linux/interrupt.h
409 :internal:
410
411Public Functions Provided
412=========================
413
414This chapter contains the autogenerated documentation of the kernel API
415functions which are exported.
416
417.. kernel-doc:: kernel/irq/manage.c
418
419.. kernel-doc:: kernel/irq/chip.c
420
421Internal Functions Provided
422===========================
423
424This chapter contains the autogenerated documentation of the internal
425functions.
426
427.. kernel-doc:: kernel/irq/irqdesc.c
428
429.. kernel-doc:: kernel/irq/handle.c
430
431.. kernel-doc:: kernel/irq/chip.c
432
433Credits
434=======
435
436The following people have contributed to this document:
437
4381. Thomas Gleixner tglx@linutronix.de
439
4402. Ingo Molnar mingo@elte.hu
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index 0d93d8089136..62abd36bfffb 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -11,11 +11,14 @@ Core utilities
11.. toctree:: 11.. toctree::
12 :maxdepth: 1 12 :maxdepth: 1
13 13
14 kernel-api
14 assoc_array 15 assoc_array
15 atomic_ops 16 atomic_ops
16 cpu_hotplug 17 cpu_hotplug
17 local_ops 18 local_ops
18 workqueue 19 workqueue
20 genericirq
21 flexible-arrays
19 22
20Interfaces for kernel debugging 23Interfaces for kernel debugging
21=============================== 24===============================
diff --git a/Documentation/core-api/kernel-api.rst b/Documentation/core-api/kernel-api.rst
new file mode 100644
index 000000000000..9ec8488319dc
--- /dev/null
+++ b/Documentation/core-api/kernel-api.rst
@@ -0,0 +1,346 @@
1====================
2The Linux Kernel API
3====================
4
5Data Types
6==========
7
8Doubly Linked Lists
9-------------------
10
11.. kernel-doc:: include/linux/list.h
12 :internal:
13
14Basic C Library Functions
15=========================
16
17When writing drivers, you cannot in general use routines which are from
18the C Library. Some of the functions have been found generally useful
19and they are listed below. The behaviour of these functions may vary
20slightly from those defined by ANSI, and these deviations are noted in
21the text.
22
23String Conversions
24------------------
25
26.. kernel-doc:: lib/vsprintf.c
27 :export:
28
29.. kernel-doc:: include/linux/kernel.h
30 :functions: kstrtol
31
32.. kernel-doc:: include/linux/kernel.h
33 :functions: kstrtoul
34
35.. kernel-doc:: lib/kstrtox.c
36 :export:
37
38String Manipulation
39-------------------
40
41.. kernel-doc:: lib/string.c
42 :export:
43
44Bit Operations
45--------------
46
47.. kernel-doc:: arch/x86/include/asm/bitops.h
48 :internal:
49
50Basic Kernel Library Functions
51==============================
52
53The Linux kernel provides more basic utility functions.
54
55Bitmap Operations
56-----------------
57
58.. kernel-doc:: lib/bitmap.c
59 :export:
60
61.. kernel-doc:: lib/bitmap.c
62 :internal:
63
64Command-line Parsing
65--------------------
66
67.. kernel-doc:: lib/cmdline.c
68 :export:
69
70CRC Functions
71-------------
72
73.. kernel-doc:: lib/crc7.c
74 :export:
75
76.. kernel-doc:: lib/crc16.c
77 :export:
78
79.. kernel-doc:: lib/crc-itu-t.c
80 :export:
81
82.. kernel-doc:: lib/crc32.c
83
84.. kernel-doc:: lib/crc-ccitt.c
85 :export:
86
87idr/ida Functions
88-----------------
89
90.. kernel-doc:: include/linux/idr.h
91 :doc: idr sync
92
93.. kernel-doc:: lib/idr.c
94 :doc: IDA description
95
96.. kernel-doc:: lib/idr.c
97 :export:
98
99Memory Management in Linux
100==========================
101
102The Slab Cache
103--------------
104
105.. kernel-doc:: include/linux/slab.h
106 :internal:
107
108.. kernel-doc:: mm/slab.c
109 :export:
110
111.. kernel-doc:: mm/util.c
112 :export:
113
114User Space Memory Access
115------------------------
116
117.. kernel-doc:: arch/x86/include/asm/uaccess_32.h
118 :internal:
119
120.. kernel-doc:: arch/x86/lib/usercopy_32.c
121 :export:
122
123More Memory Management Functions
124--------------------------------
125
126.. kernel-doc:: mm/readahead.c
127 :export:
128
129.. kernel-doc:: mm/filemap.c
130 :export:
131
132.. kernel-doc:: mm/memory.c
133 :export:
134
135.. kernel-doc:: mm/vmalloc.c
136 :export:
137
138.. kernel-doc:: mm/page_alloc.c
139 :internal:
140
141.. kernel-doc:: mm/mempool.c
142 :export:
143
144.. kernel-doc:: mm/dmapool.c
145 :export:
146
147.. kernel-doc:: mm/page-writeback.c
148 :export:
149
150.. kernel-doc:: mm/truncate.c
151 :export:
152
153Kernel IPC facilities
154=====================
155
156IPC utilities
157-------------
158
159.. kernel-doc:: ipc/util.c
160 :internal:
161
162FIFO Buffer
163===========
164
165kfifo interface
166---------------
167
168.. kernel-doc:: include/linux/kfifo.h
169 :internal:
170
171relay interface support
172=======================
173
174Relay interface support is designed to provide an efficient mechanism
175for tools and facilities to relay large amounts of data from kernel
176space to user space.
177
178relay interface
179---------------
180
181.. kernel-doc:: kernel/relay.c
182 :export:
183
184.. kernel-doc:: kernel/relay.c
185 :internal:
186
187Module Support
188==============
189
190Module Loading
191--------------
192
193.. kernel-doc:: kernel/kmod.c
194 :export:
195
196Inter Module support
197--------------------
198
199Refer to the file kernel/module.c for more information.
200
201Hardware Interfaces
202===================
203
204Interrupt Handling
205------------------
206
207.. kernel-doc:: kernel/irq/manage.c
208 :export:
209
210DMA Channels
211------------
212
213.. kernel-doc:: kernel/dma.c
214 :export:
215
216Resources Management
217--------------------
218
219.. kernel-doc:: kernel/resource.c
220 :internal:
221
222.. kernel-doc:: kernel/resource.c
223 :export:
224
225MTRR Handling
226-------------
227
228.. kernel-doc:: arch/x86/kernel/cpu/mtrr/main.c
229 :export:
230
231Security Framework
232==================
233
234.. kernel-doc:: security/security.c
235 :internal:
236
237.. kernel-doc:: security/inode.c
238 :export:
239
240Audit Interfaces
241================
242
243.. kernel-doc:: kernel/audit.c
244 :export:
245
246.. kernel-doc:: kernel/auditsc.c
247 :internal:
248
249.. kernel-doc:: kernel/auditfilter.c
250 :internal:
251
252Accounting Framework
253====================
254
255.. kernel-doc:: kernel/acct.c
256 :internal:
257
258Block Devices
259=============
260
261.. kernel-doc:: block/blk-core.c
262 :export:
263
264.. kernel-doc:: block/blk-core.c
265 :internal:
266
267.. kernel-doc:: block/blk-map.c
268 :export:
269
270.. kernel-doc:: block/blk-sysfs.c
271 :internal:
272
273.. kernel-doc:: block/blk-settings.c
274 :export:
275
276.. kernel-doc:: block/blk-exec.c
277 :export:
278
279.. kernel-doc:: block/blk-flush.c
280 :export:
281
282.. kernel-doc:: block/blk-lib.c
283 :export:
284
285.. kernel-doc:: block/blk-tag.c
286 :export:
287
288.. kernel-doc:: block/blk-tag.c
289 :internal:
290
291.. kernel-doc:: block/blk-integrity.c
292 :export:
293
294.. kernel-doc:: kernel/trace/blktrace.c
295 :internal:
296
297.. kernel-doc:: block/genhd.c
298 :internal:
299
300.. kernel-doc:: block/genhd.c
301 :export:
302
303Char devices
304============
305
306.. kernel-doc:: fs/char_dev.c
307 :export:
308
309Clock Framework
310===============
311
312The clock framework defines programming interfaces to support software
313management of the system clock tree. This framework is widely used with
314System-On-Chip (SOC) platforms to support power management and various
315devices which may need custom clock rates. Note that these "clocks"
316don't relate to timekeeping or real time clocks (RTCs), each of which
317have separate frameworks. These :c:type:`struct clk <clk>`
318instances may be used to manage for example a 96 MHz signal that is used
319to shift bits into and out of peripherals or busses, or otherwise
320trigger synchronous state machine transitions in system hardware.
321
322Power management is supported by explicit software clock gating: unused
323clocks are disabled, so the system doesn't waste power changing the
324state of transistors that aren't in active use. On some systems this may
325be backed by hardware clock gating, where clocks are gated without being
326disabled in software. Sections of chips that are powered but not clocked
327may be able to retain their last state. This low power state is often
328called a *retention mode*. This mode still incurs leakage currents,
329especially with finer circuit geometries, but for CMOS circuits power is
330mostly used by clocked state changes.
331
332Power-aware drivers only enable their clocks when the device they manage
333is in active use. Also, system sleep states often differ according to
334which clock domains are active: while a "standby" state may allow wakeup
335from several active domains, a "mem" (suspend-to-RAM) state may require
336a more wholesale shutdown of clocks derived from higher speed PLLs and
337oscillators, limiting the number of possible wakeup event sources. A
338driver's suspend method may need to be aware of system-specific clock
339constraints on the target sleep state.
340
341Some platforms support programmable clock generators. These can be used
342by external chips of various kinds, such as other CPUs, multimedia
343codecs, and devices with strict requirements for interface clocking.
344
345.. kernel-doc:: include/linux/clk.h
346 :internal:
diff --git a/Documentation/cpu-freq/boost.txt b/Documentation/cpu-freq/boost.txt
deleted file mode 100644
index dd62e1334f0a..000000000000
--- a/Documentation/cpu-freq/boost.txt
+++ /dev/null
@@ -1,93 +0,0 @@
1Processor boosting control
2
3 - information for users -
4
5Quick guide for the impatient:
6--------------------
7/sys/devices/system/cpu/cpufreq/boost
8controls the boost setting for the whole system. You can read and write
9that file with either "0" (boosting disabled) or "1" (boosting allowed).
10Reading or writing 1 does not mean that the system is boosting at this
11very moment, but only that the CPU _may_ raise the frequency at it's
12discretion.
13--------------------
14
15Introduction
16-------------
17Some CPUs support a functionality to raise the operating frequency of
18some cores in a multi-core package if certain conditions apply, mostly
19if the whole chip is not fully utilized and below it's intended thermal
20budget. The decision about boost disable/enable is made either at hardware
21(e.g. x86) or software (e.g ARM).
22On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core",
23in technical documentation "Core performance boost". In Linux we use
24the term "boost" for convenience.
25
26Rationale for disable switch
27----------------------------
28
29Though the idea is to just give better performance without any user
30intervention, sometimes the need arises to disable this functionality.
31Most systems offer a switch in the (BIOS) firmware to disable the
32functionality at all, but a more fine-grained and dynamic control would
33be desirable:
341. While running benchmarks, reproducible results are important. Since
35 the boosting functionality depends on the load of the whole package,
36 single thread performance can vary. By explicitly disabling the boost
37 functionality at least for the benchmark's run-time the system will run
38 at a fixed frequency and results are reproducible again.
392. To examine the impact of the boosting functionality it is helpful
40 to do tests with and without boosting.
413. Boosting means overclocking the processor, though under controlled
42 conditions. By raising the frequency and the voltage the processor
43 will consume more power than without the boosting, which may be
44 undesirable for instance for mobile users. Disabling boosting may
45 save power here, though this depends on the workload.
46
47
48User controlled switch
49----------------------
50
51To allow the user to toggle the boosting functionality, the cpufreq core
52driver exports a sysfs knob to enable or disable it. There is a file:
53/sys/devices/system/cpu/cpufreq/boost
54which can either read "0" (boosting disabled) or "1" (boosting enabled).
55The file is exported only when cpufreq driver supports boosting.
56Explicitly changing the permissions and writing to that file anyway will
57return EINVAL.
58
59On supported CPUs one can write either a "0" or a "1" into this file.
60This will either disable the boost functionality on all cores in the
61whole system (0) or will allow the software or hardware to boost at will
62(1).
63
64Writing a "1" does not explicitly boost the system, but just allows the
65CPU to boost at their discretion. Some implementations take external
66factors like the chip's temperature into account, so boosting once does
67not necessarily mean that it will occur every time even using the exact
68same software setup.
69
70
71AMD legacy cpb switch
72---------------------
73The AMD powernow-k8 driver used to support a very similar switch to
74disable or enable the "Core Performance Boost" feature of some AMD CPUs.
75This switch was instantiated in each CPU's cpufreq directory
76(/sys/devices/system/cpu[0-9]*/cpufreq) and was called "cpb".
77Though the per CPU existence hints at a more fine grained control, the
78actual implementation only supported a system-global switch semantics,
79which was simply reflected into each CPU's file. Writing a 0 or 1 into it
80would pull the other CPUs to the same state.
81For compatibility reasons this file and its behavior is still supported
82on AMD CPUs, though it is now protected by a config switch
83(X86_ACPI_CPUFREQ_CPB). On Intel CPUs this file will never be created,
84even with the config option set.
85This functionality is considered legacy and will be removed in some future
86kernel version.
87
88More fine grained boosting control
89----------------------------------
90
91Technically it is possible to switch the boosting functionality at least
92on a per package basis, for some CPUs even per core. Currently the driver
93does not support it, but this may be implemented in the future.
diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt
index f71e6be26b83..434c49cc7330 100644
--- a/Documentation/cpu-freq/cpu-drivers.txt
+++ b/Documentation/cpu-freq/cpu-drivers.txt
@@ -231,7 +231,7 @@ the reference implementation in drivers/cpufreq/longrun.c
231Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION unset. 231Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION unset.
232 232
233get_intermediate should return a stable intermediate frequency platform wants to 233get_intermediate should return a stable intermediate frequency platform wants to
234switch to, and target_intermediate() should set CPU to to that frequency, before 234switch to, and target_intermediate() should set CPU to that frequency, before
235jumping to the frequency corresponding to 'index'. Core will take care of 235jumping to the frequency corresponding to 'index'. Core will take care of
236sending notifications and driver doesn't have to handle them in 236sending notifications and driver doesn't have to handle them in
237target_intermediate() or target_index(). 237target_intermediate() or target_index().
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt
deleted file mode 100644
index 61b3184b6c24..000000000000
--- a/Documentation/cpu-freq/governors.txt
+++ /dev/null
@@ -1,301 +0,0 @@
1 CPU frequency and voltage scaling code in the Linux(TM) kernel
2
3
4 L i n u x C P U F r e q
5
6 C P U F r e q G o v e r n o r s
7
8 - information for users and developers -
9
10
11 Dominik Brodowski <linux@brodo.de>
12 some additions and corrections by Nico Golde <nico@ngolde.de>
13 Rafael J. Wysocki <rafael.j.wysocki@intel.com>
14 Viresh Kumar <viresh.kumar@linaro.org>
15
16
17
18 Clock scaling allows you to change the clock speed of the CPUs on the
19 fly. This is a nice method to save battery power, because the lower
20 the clock speed, the less power the CPU consumes.
21
22
23Contents:
24---------
251. What is a CPUFreq Governor?
26
272. Governors In the Linux Kernel
282.1 Performance
292.2 Powersave
302.3 Userspace
312.4 Ondemand
322.5 Conservative
332.6 Schedutil
34
353. The Governor Interface in the CPUfreq Core
36
374. References
38
39
401. What Is A CPUFreq Governor?
41==============================
42
43Most cpufreq drivers (except the intel_pstate and longrun) or even most
44cpu frequency scaling algorithms only allow the CPU frequency to be set
45to predefined fixed values. In order to offer dynamic frequency
46scaling, the cpufreq core must be able to tell these drivers of a
47"target frequency". So these specific drivers will be transformed to
48offer a "->target/target_index/fast_switch()" call instead of the
49"->setpolicy()" call. For set_policy drivers, all stays the same,
50though.
51
52How to decide what frequency within the CPUfreq policy should be used?
53That's done using "cpufreq governors".
54
55Basically, it's the following flow graph:
56
57CPU can be set to switch independently | CPU can only be set
58 within specific "limits" | to specific frequencies
59
60 "CPUfreq policy"
61 consists of frequency limits (policy->{min,max})
62 and CPUfreq governor to be used
63 / \
64 / \
65 / the cpufreq governor decides
66 / (dynamically or statically)
67 / what target_freq to set within
68 / the limits of policy->{min,max}
69 / \
70 / \
71 Using the ->setpolicy call, Using the ->target/target_index/fast_switch call,
72 the limits and the the frequency closest
73 "policy" is set. to target_freq is set.
74 It is assured that it
75 is within policy->{min,max}
76
77
782. Governors In the Linux Kernel
79================================
80
812.1 Performance
82---------------
83
84The CPUfreq governor "performance" sets the CPU statically to the
85highest frequency within the borders of scaling_min_freq and
86scaling_max_freq.
87
88
892.2 Powersave
90-------------
91
92The CPUfreq governor "powersave" sets the CPU statically to the
93lowest frequency within the borders of scaling_min_freq and
94scaling_max_freq.
95
96
972.3 Userspace
98-------------
99
100The CPUfreq governor "userspace" allows the user, or any userspace
101program running with UID "root", to set the CPU to a specific frequency
102by making a sysfs file "scaling_setspeed" available in the CPU-device
103directory.
104
105
1062.4 Ondemand
107------------
108
109The CPUfreq governor "ondemand" sets the CPU frequency depending on the
110current system load. Load estimation is triggered by the scheduler
111through the update_util_data->func hook; when triggered, cpufreq checks
112the CPU-usage statistics over the last period and the governor sets the
113CPU accordingly. The CPU must have the capability to switch the
114frequency very quickly.
115
116Sysfs files:
117
118* sampling_rate:
119
120 Measured in uS (10^-6 seconds), this is how often you want the kernel
121 to look at the CPU usage and to make decisions on what to do about the
122 frequency. Typically this is set to values of around '10000' or more.
123 It's default value is (cmp. with users-guide.txt): transition_latency
124 * 1000. Be aware that transition latency is in ns and sampling_rate
125 is in us, so you get the same sysfs value by default. Sampling rate
126 should always get adjusted considering the transition latency to set
127 the sampling rate 750 times as high as the transition latency in the
128 bash (as said, 1000 is default), do:
129
130 $ echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate
131
132* sampling_rate_min:
133
134 The sampling rate is limited by the HW transition latency:
135 transition_latency * 100
136
137 Or by kernel restrictions:
138 - If CONFIG_NO_HZ_COMMON is set, the limit is 10ms fixed.
139 - If CONFIG_NO_HZ_COMMON is not set or nohz=off boot parameter is
140 used, the limits depend on the CONFIG_HZ option:
141 HZ=1000: min=20000us (20ms)
142 HZ=250: min=80000us (80ms)
143 HZ=100: min=200000us (200ms)
144
145 The highest value of kernel and HW latency restrictions is shown and
146 used as the minimum sampling rate.
147
148* up_threshold:
149
150 This defines what the average CPU usage between the samplings of
151 'sampling_rate' needs to be for the kernel to make a decision on
152 whether it should increase the frequency. For example when it is set
153 to its default value of '95' it means that between the checking
154 intervals the CPU needs to be on average more than 95% in use to then
155 decide that the CPU frequency needs to be increased.
156
157* ignore_nice_load:
158
159 This parameter takes a value of '0' or '1'. When set to '0' (its
160 default), all processes are counted towards the 'cpu utilisation'
161 value. When set to '1', the processes that are run with a 'nice'
162 value will not count (and thus be ignored) in the overall usage
163 calculation. This is useful if you are running a CPU intensive
164 calculation on your laptop that you do not care how long it takes to
165 complete as you can 'nice' it and prevent it from taking part in the
166 deciding process of whether to increase your CPU frequency.
167
168* sampling_down_factor:
169
170 This parameter controls the rate at which the kernel makes a decision
171 on when to decrease the frequency while running at top speed. When set
172 to 1 (the default) decisions to reevaluate load are made at the same
173 interval regardless of current clock speed. But when set to greater
174 than 1 (e.g. 100) it acts as a multiplier for the scheduling interval
175 for reevaluating load when the CPU is at its top speed due to high
176 load. This improves performance by reducing the overhead of load
177 evaluation and helping the CPU stay at its top speed when truly busy,
178 rather than shifting back and forth in speed. This tunable has no
179 effect on behavior at lower speeds/lower CPU loads.
180
181* powersave_bias:
182
183 This parameter takes a value between 0 to 1000. It defines the
184 percentage (times 10) value of the target frequency that will be
185 shaved off of the target. For example, when set to 100 -- 10%, when
186 ondemand governor would have targeted 1000 MHz, it will target
187 1000 MHz - (10% of 1000 MHz) = 900 MHz instead. This is set to 0
188 (disabled) by default.
189
190 When AMD frequency sensitivity powersave bias driver --
191 drivers/cpufreq/amd_freq_sensitivity.c is loaded, this parameter
192 defines the workload frequency sensitivity threshold in which a lower
193 frequency is chosen instead of ondemand governor's original target.
194 The frequency sensitivity is a hardware reported (on AMD Family 16h
195 Processors and above) value between 0 to 100% that tells software how
196 the performance of the workload running on a CPU will change when
197 frequency changes. A workload with sensitivity of 0% (memory/IO-bound)
198 will not perform any better on higher core frequency, whereas a
199 workload with sensitivity of 100% (CPU-bound) will perform better
200 higher the frequency. When the driver is loaded, this is set to 400 by
201 default -- for CPUs running workloads with sensitivity value below
202 40%, a lower frequency is chosen. Unloading the driver or writing 0
203 will disable this feature.
204
205
2062.5 Conservative
207----------------
208
209The CPUfreq governor "conservative", much like the "ondemand"
210governor, sets the CPU frequency depending on the current usage. It
211differs in behaviour in that it gracefully increases and decreases the
212CPU speed rather than jumping to max speed the moment there is any load
213on the CPU. This behaviour is more suitable in a battery powered
214environment. The governor is tweaked in the same manner as the
215"ondemand" governor through sysfs with the addition of:
216
217* freq_step:
218
219 This describes what percentage steps the cpu freq should be increased
220 and decreased smoothly by. By default the cpu frequency will increase
221 in 5% chunks of your maximum cpu frequency. You can change this value
222 to anywhere between 0 and 100 where '0' will effectively lock your CPU
223 at a speed regardless of its load whilst '100' will, in theory, make
224 it behave identically to the "ondemand" governor.
225
226* down_threshold:
227
228 Same as the 'up_threshold' found for the "ondemand" governor but for
229 the opposite direction. For example when set to its default value of
230 '20' it means that if the CPU usage needs to be below 20% between
231 samples to have the frequency decreased.
232
233* sampling_down_factor:
234
235 Similar functionality as in "ondemand" governor. But in
236 "conservative", it controls the rate at which the kernel makes a
237 decision on when to decrease the frequency while running in any speed.
238 Load for frequency increase is still evaluated every sampling rate.
239
240
2412.6 Schedutil
242-------------
243
244The "schedutil" governor aims at better integration with the Linux
245kernel scheduler. Load estimation is achieved through the scheduler's
246Per-Entity Load Tracking (PELT) mechanism, which also provides
247information about the recent load [1]. This governor currently does
248load based DVFS only for tasks managed by CFS. RT and DL scheduler tasks
249are always run at the highest frequency. Unlike all the other
250governors, the code is located under the kernel/sched/ directory.
251
252Sysfs files:
253
254* rate_limit_us:
255
256 This contains a value in microseconds. The governor waits for
257 rate_limit_us time before reevaluating the load again, after it has
258 evaluated the load once.
259
260For an in-depth comparison with the other governors refer to [2].
261
262
2633. The Governor Interface in the CPUfreq Core
264=============================================
265
266A new governor must register itself with the CPUfreq core using
267"cpufreq_register_governor". The struct cpufreq_governor, which has to
268be passed to that function, must contain the following values:
269
270governor->name - A unique name for this governor.
271governor->owner - .THIS_MODULE for the governor module (if appropriate).
272
273plus a set of hooks to the functions implementing the governor's logic.
274
275The CPUfreq governor may call the CPU processor driver using one of
276these two functions:
277
278int cpufreq_driver_target(struct cpufreq_policy *policy,
279 unsigned int target_freq,
280 unsigned int relation);
281
282int __cpufreq_driver_target(struct cpufreq_policy *policy,
283 unsigned int target_freq,
284 unsigned int relation);
285
286target_freq must be within policy->min and policy->max, of course.
287What's the difference between these two functions? When your governor is
288in a direct code path of a call to governor callbacks, like
289governor->start(), the policy->rwsem is still held in the cpufreq core,
290and there's no need to lock it again (in fact, this would cause a
291deadlock). So use __cpufreq_driver_target only in these cases. In all
292other cases (for example, when there's a "daemonized" function that
293wakes up every second), use cpufreq_driver_target to take policy->rwsem
294before the command is passed to the cpufreq driver.
295
2964. References
297=============
298
299[1] Per-entity load tracking: https://lwn.net/Articles/531853/
300[2] Improvements in CPU frequency management: https://lwn.net/Articles/682391/
301
diff --git a/Documentation/cpu-freq/index.txt b/Documentation/cpu-freq/index.txt
index ef1d39247b05..03a7cee6ac73 100644
--- a/Documentation/cpu-freq/index.txt
+++ b/Documentation/cpu-freq/index.txt
@@ -21,8 +21,6 @@ Documents in this directory:
21 21
22amd-powernow.txt - AMD powernow driver specific file. 22amd-powernow.txt - AMD powernow driver specific file.
23 23
24boost.txt - Frequency boosting support.
25
26core.txt - General description of the CPUFreq core and 24core.txt - General description of the CPUFreq core and
27 of CPUFreq notifiers. 25 of CPUFreq notifiers.
28 26
@@ -32,17 +30,12 @@ cpufreq-nforce2.txt - nVidia nForce2 platform specific file.
32 30
33cpufreq-stats.txt - General description of sysfs cpufreq stats. 31cpufreq-stats.txt - General description of sysfs cpufreq stats.
34 32
35governors.txt - What are cpufreq governors and how to
36 implement them?
37
38index.txt - File index, Mailing list and Links (this document) 33index.txt - File index, Mailing list and Links (this document)
39 34
40intel-pstate.txt - Intel pstate cpufreq driver specific file. 35intel-pstate.txt - Intel pstate cpufreq driver specific file.
41 36
42pcc-cpufreq.txt - PCC cpufreq driver specific file. 37pcc-cpufreq.txt - PCC cpufreq driver specific file.
43 38
44user-guide.txt - User Guide to CPUFreq
45
46 39
47Mailing List 40Mailing List
48------------ 41------------
diff --git a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt
deleted file mode 100644
index 391da64e9492..000000000000
--- a/Documentation/cpu-freq/user-guide.txt
+++ /dev/null
@@ -1,228 +0,0 @@
1 CPU frequency and voltage scaling code in the Linux(TM) kernel
2
3
4 L i n u x C P U F r e q
5
6 U S E R G U I D E
7
8
9 Dominik Brodowski <linux@brodo.de>
10
11
12
13 Clock scaling allows you to change the clock speed of the CPUs on the
14 fly. This is a nice method to save battery power, because the lower
15 the clock speed, the less power the CPU consumes.
16
17
18Contents:
19---------
201. Supported Architectures and Processors
211.1 ARM and ARM64
221.2 x86
231.3 sparc64
241.4 ppc
251.5 SuperH
261.6 Blackfin
27
282. "Policy" / "Governor"?
292.1 Policy
302.2 Governor
31
323. How to change the CPU cpufreq policy and/or speed
333.1 Preferred interface: sysfs
34
35
36
371. Supported Architectures and Processors
38=========================================
39
401.1 ARM and ARM64
41-----------------
42
43Almost all ARM and ARM64 platforms support CPU frequency scaling.
44
451.2 x86
46-------
47
48The following processors for the x86 architecture are supported by cpufreq:
49
50AMD Elan - SC400, SC410
51AMD mobile K6-2+
52AMD mobile K6-3+
53AMD mobile Duron
54AMD mobile Athlon
55AMD Opteron
56AMD Athlon 64
57Cyrix Media GXm
58Intel mobile PIII and Intel mobile PIII-M on certain chipsets
59Intel Pentium 4, Intel Xeon
60Intel Pentium M (Centrino)
61National Semiconductors Geode GX
62Transmeta Crusoe
63Transmeta Efficeon
64VIA Cyrix 3 / C3
65various processors on some ACPI 2.0-compatible systems [*]
66And many more
67
68[*] Only if "ACPI Processor Performance States" are available
69to the ACPI<->BIOS interface.
70
71
721.3 sparc64
73-----------
74
75The following processors for the sparc64 architecture are supported by
76cpufreq:
77
78UltraSPARC-III
79
80
811.4 ppc
82-------
83
84Several "PowerBook" and "iBook2" notebooks are supported.
85The following POWER processors are supported in powernv mode:
86POWER8
87POWER9
88
891.5 SuperH
90----------
91
92All SuperH processors supporting rate rounding through the clock
93framework are supported by cpufreq.
94
951.6 Blackfin
96------------
97
98The following Blackfin processors are supported by cpufreq:
99
100BF522, BF523, BF524, BF525, BF526, BF527, Rev 0.1 or higher
101BF531, BF532, BF533, Rev 0.3 or higher
102BF534, BF536, BF537, Rev 0.2 or higher
103BF561, Rev 0.3 or higher
104BF542, BF544, BF547, BF548, BF549, Rev 0.1 or higher
105
106
1072. "Policy" / "Governor" ?
108==========================
109
110Some CPU frequency scaling-capable processor switch between various
111frequencies and operating voltages "on the fly" without any kernel or
112user involvement. This guarantees very fast switching to a frequency
113which is high enough to serve the user's needs, but low enough to save
114power.
115
116
1172.1 Policy
118----------
119
120On these systems, all you can do is select the lower and upper
121frequency limit as well as whether you want more aggressive
122power-saving or more instantly available processing power.
123
124
1252.2 Governor
126------------
127
128On all other cpufreq implementations, these boundaries still need to
129be set. Then, a "governor" must be selected. Such a "governor" decides
130what speed the processor shall run within the boundaries. One such
131"governor" is the "userspace" governor. This one allows the user - or
132a yet-to-implement userspace program - to decide what specific speed
133the processor shall run at.
134
135
1363. How to change the CPU cpufreq policy and/or speed
137====================================================
138
1393.1 Preferred Interface: sysfs
140------------------------------
141
142The preferred interface is located in the sysfs filesystem. If you
143mounted it at /sys, the cpufreq interface is located in a subdirectory
144"cpufreq" within the cpu-device directory
145(e.g. /sys/devices/system/cpu/cpu0/cpufreq/ for the first CPU).
146
147affected_cpus : List of Online CPUs that require software
148 coordination of frequency.
149
150cpuinfo_cur_freq : Current frequency of the CPU as obtained from
151 the hardware, in KHz. This is the frequency
152 the CPU actually runs at.
153
154cpuinfo_min_freq : this file shows the minimum operating
155 frequency the processor can run at(in kHz)
156
157cpuinfo_max_freq : this file shows the maximum operating
158 frequency the processor can run at(in kHz)
159
160cpuinfo_transition_latency The time it takes on this CPU to
161 switch between two frequencies in nano
162 seconds. If unknown or known to be
163 that high that the driver does not
164 work with the ondemand governor, -1
165 (CPUFREQ_ETERNAL) will be returned.
166 Using this information can be useful
167 to choose an appropriate polling
168 frequency for a kernel governor or
169 userspace daemon. Make sure to not
170 switch the frequency too often
171 resulting in performance loss.
172
173related_cpus : List of Online + Offline CPUs that need software
174 coordination of frequency.
175
176scaling_available_frequencies : List of available frequencies, in KHz.
177
178scaling_available_governors : this file shows the CPUfreq governors
179 available in this kernel. You can see the
180 currently activated governor in
181
182scaling_cur_freq : Current frequency of the CPU as determined by
183 the governor and cpufreq core, in KHz. This is
184 the frequency the kernel thinks the CPU runs
185 at.
186
187scaling_driver : this file shows what cpufreq driver is
188 used to set the frequency on this CPU
189
190scaling_governor, and by "echoing" the name of another
191 governor you can change it. Please note
192 that some governors won't load - they only
193 work on some specific architectures or
194 processors.
195
196scaling_min_freq and
197scaling_max_freq show the current "policy limits" (in
198 kHz). By echoing new values into these
199 files, you can change these limits.
200 NOTE: when setting a policy you need to
201 first set scaling_max_freq, then
202 scaling_min_freq.
203
204scaling_setspeed This can be read to get the currently programmed
205 value by the governor. This can be written to
206 change the current frequency for a group of
207 CPUs, represented by a policy. This is supported
208 currently only by the userspace governor.
209
210bios_limit : If the BIOS tells the OS to limit a CPU to
211 lower frequencies, the user can read out the
212 maximum available frequency from this file.
213 This typically can happen through (often not
214 intended) BIOS settings, restrictions
215 triggered through a service processor or other
216 BIOS/HW based implementations.
217 This does not cover thermal ACPI limitations
218 which can be detected through the generic
219 thermal driver.
220
221If you have selected the "userspace" governor which allows you to
222set the CPU operating frequency to a specific value, you can read out
223the current frequency in
224
225scaling_setspeed. By "echoing" a new frequency into this
226 you can change the speed of the CPU,
227 but only within the limits of
228 scaling_min_freq and scaling_max_freq.
diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt
index f722f227a73b..127c9d8c2174 100644
--- a/Documentation/cputopology.txt
+++ b/Documentation/cputopology.txt
@@ -100,7 +100,7 @@ not defined by include/asm-XXX/topology.h:
100 100
101For architectures that don't support books (CONFIG_SCHED_BOOK) there are no 101For architectures that don't support books (CONFIG_SCHED_BOOK) there are no
102default definitions for topology_book_id() and topology_book_cpumask(). 102default definitions for topology_book_id() and topology_book_cpumask().
103For architectures that don't support drawes (CONFIG_SCHED_DRAWER) there are 103For architectures that don't support drawers (CONFIG_SCHED_DRAWER) there are
104no default definitions for topology_drawer_id() and topology_drawer_cpumask(). 104no default definitions for topology_drawer_id() and topology_drawer_cpumask().
105 105
106Additionally, CPU topology information is provided under 106Additionally, CPU topology information is provided under
diff --git a/Documentation/debugging-via-ohci1394.txt b/Documentation/debugging-via-ohci1394.txt
index 03703afc4d30..9ff026d22b75 100644
--- a/Documentation/debugging-via-ohci1394.txt
+++ b/Documentation/debugging-via-ohci1394.txt
@@ -100,8 +100,8 @@ Step-by-step instructions for using firescope with early OHCI initialization:
100 CardBus and even some Express cards which are fully compliant to OHCI-1394 100 CardBus and even some Express cards which are fully compliant to OHCI-1394
101 specification are available. If it requires no driver for Windows operating 101 specification are available. If it requires no driver for Windows operating
102 systems, it most likely is. Only specialized shops have cards which are not 102 systems, it most likely is. Only specialized shops have cards which are not
103 compliant, they are based on TI PCILynx chips and require drivers for Win- 103 compliant, they are based on TI PCILynx chips and require drivers for Windows
104 dows operating systems. 104 operating systems.
105 105
106 The mentioned kernel log message contains the string "physUB" if the 106 The mentioned kernel log message contains the string "physUB" if the
107 controller implements a writable Physical Upper Bound register. This is 107 controller implements a writable Physical Upper Bound register. This is
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt
index f228604ddbcd..cdfd0feb294e 100644
--- a/Documentation/device-mapper/cache.txt
+++ b/Documentation/device-mapper/cache.txt
@@ -290,7 +290,7 @@ message, which takes an arbitrary number of cblock ranges. Each cblock
290range's end value is "one past the end", meaning 5-10 expresses a range 290range's end value is "one past the end", meaning 5-10 expresses a range
291of values from 5 to 9. Each cblock must be expressed as a decimal 291of values from 5 to 9. Each cblock must be expressed as a decimal
292value, in the future a variant message that takes cblock ranges 292value, in the future a variant message that takes cblock ranges
293expressed in hexidecimal may be needed to better support efficient 293expressed in hexadecimal may be needed to better support efficient
294invalidation of larger caches. The cache must be in passthrough mode 294invalidation of larger caches. The cache must be in passthrough mode
295when invalidate_cblocks is used. 295when invalidate_cblocks is used.
296 296
diff --git a/Documentation/doc-guide/hello.dot b/Documentation/doc-guide/hello.dot
new file mode 100644
index 000000000000..504621dfc595
--- /dev/null
+++ b/Documentation/doc-guide/hello.dot
@@ -0,0 +1,3 @@
1graph G {
2 Hello -- World
3}
diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
index 96fe7ccb2c67..731334de3efd 100644
--- a/Documentation/doc-guide/sphinx.rst
+++ b/Documentation/doc-guide/sphinx.rst
@@ -34,8 +34,9 @@ format-specific subdirectories under ``Documentation/output``.
34 34
35To generate documentation, Sphinx (``sphinx-build``) must obviously be 35To generate documentation, Sphinx (``sphinx-build``) must obviously be
36installed. For prettier HTML output, the Read the Docs Sphinx theme 36installed. For prettier HTML output, the Read the Docs Sphinx theme
37(``sphinx_rtd_theme``) is used if available. For PDF output, ``rst2pdf`` is also 37(``sphinx_rtd_theme``) is used if available. For PDF output you'll also need
38needed. All of these are widely available and packaged in distributions. 38``XeLaTeX`` and ``convert(1)`` from ImageMagick (https://www.imagemagick.org).
39All of these are widely available and packaged in distributions.
39 40
40To pass extra options to Sphinx, you can use the ``SPHINXOPTS`` make 41To pass extra options to Sphinx, you can use the ``SPHINXOPTS`` make
41variable. For example, use ``make SPHINXOPTS=-v htmldocs`` to get more verbose 42variable. For example, use ``make SPHINXOPTS=-v htmldocs`` to get more verbose
@@ -73,7 +74,16 @@ Specific guidelines for the kernel documentation
73 74
74Here are some specific guidelines for the kernel documentation: 75Here are some specific guidelines for the kernel documentation:
75 76
76* Please don't go overboard with reStructuredText markup. Keep it simple. 77* Please don't go overboard with reStructuredText markup. Keep it
78 simple. For the most part the documentation should be plain text with
79 just enough consistency in formatting that it can be converted to
80 other formats.
81
82* Please keep the formatting changes minimal when converting existing
83 documentation to reStructuredText.
84
85* Also update the content, not just the formatting, when converting
86 documentation.
77 87
78* Please stick to this order of heading adornments: 88* Please stick to this order of heading adornments:
79 89
@@ -103,6 +113,12 @@ Here are some specific guidelines for the kernel documentation:
103 the order as encountered."), having the higher levels the same overall makes 113 the order as encountered."), having the higher levels the same overall makes
104 it easier to follow the documents. 114 it easier to follow the documents.
105 115
116* For inserting fixed width text blocks (for code examples, use case
117 examples, etc.), use ``::`` for anything that doesn't really benefit
118 from syntax highlighting, especially short snippets. Use
119 ``.. code-block:: <language>`` for longer code blocks that benefit
120 from highlighting.
121
106 122
107the C domain 123the C domain
108------------ 124------------
@@ -217,3 +233,96 @@ Rendered as:
217 * .. _`last row`: 233 * .. _`last row`:
218 234
219 - column 3 235 - column 3
236
237
238Figures & Images
239================
240
241If you want to add an image, you should use the ``kernel-figure`` and
242``kernel-image`` directives. E.g. to insert a figure with a scalable
243image format use SVG (:ref:`svg_image_example`)::
244
245 .. kernel-figure:: svg_image.svg
246 :alt: simple SVG image
247
248 SVG image example
249
250.. _svg_image_example:
251
252.. kernel-figure:: svg_image.svg
253 :alt: simple SVG image
254
255 SVG image example
256
257The kernel figure (and image) directive support **DOT** formated files, see
258
259* DOT: http://graphviz.org/pdf/dotguide.pdf
260* Graphviz: http://www.graphviz.org/content/dot-language
261
262A simple example (:ref:`hello_dot_file`)::
263
264 .. kernel-figure:: hello.dot
265 :alt: hello world
266
267 DOT's hello world example
268
269.. _hello_dot_file:
270
271.. kernel-figure:: hello.dot
272 :alt: hello world
273
274 DOT's hello world example
275
276Embed *render* markups (or languages) like Graphviz's **DOT** is provided by the
277``kernel-render`` directives.::
278
279 .. kernel-render:: DOT
280 :alt: foobar digraph
281 :caption: Embedded **DOT** (Graphviz) code
282
283 digraph foo {
284 "bar" -> "baz";
285 }
286
287How this will be rendered depends on the installed tools. If Graphviz is
288installed, you will see an vector image. If not the raw markup is inserted as
289*literal-block* (:ref:`hello_dot_render`).
290
291.. _hello_dot_render:
292
293.. kernel-render:: DOT
294 :alt: foobar digraph
295 :caption: Embedded **DOT** (Graphviz) code
296
297 digraph foo {
298 "bar" -> "baz";
299 }
300
301The *render* directive has all the options known from the *figure* directive,
302plus option ``caption``. If ``caption`` has a value, a *figure* node is
303inserted. If not, a *image* node is inserted. A ``caption`` is also needed, if
304you want to refer it (:ref:`hello_svg_render`).
305
306Embedded **SVG**::
307
308 .. kernel-render:: SVG
309 :caption: Embedded **SVG** markup
310 :alt: so-nw-arrow
311
312 <?xml version="1.0" encoding="UTF-8"?>
313 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" ...>
314 ...
315 </svg>
316
317.. _hello_svg_render:
318
319.. kernel-render:: SVG
320 :caption: Embedded **SVG** markup
321 :alt: so-nw-arrow
322
323 <?xml version="1.0" encoding="UTF-8"?>
324 <svg xmlns="http://www.w3.org/2000/svg"
325 version="1.1" baseProfile="full" width="70px" height="40px" viewBox="0 0 700 400">
326 <line x1="180" y1="370" x2="500" y2="50" stroke="black" stroke-width="15px"/>
327 <polygon points="585 0 525 25 585 50" transform="rotate(135 525 25)"/>
328 </svg>
diff --git a/Documentation/doc-guide/svg_image.svg b/Documentation/doc-guide/svg_image.svg
new file mode 100644
index 000000000000..5405f85b8137
--- /dev/null
+++ b/Documentation/doc-guide/svg_image.svg
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- originate: https://commons.wikimedia.org/wiki/File:Variable_Resistor.svg -->
3<svg xmlns="http://www.w3.org/2000/svg"
4 version="1.1" baseProfile="full"
5 width="70px" height="40px" viewBox="0 0 700 400">
6 <line x1="0" y1="200" x2="700" y2="200" stroke="black" stroke-width="20px"/>
7 <rect x="100" y="100" width="500" height="200" fill="white" stroke="black" stroke-width="20px"/>
8 <line x1="180" y1="370" x2="500" y2="50" stroke="black" stroke-width="15px"/>
9 <polygon points="585 0 525 25 585 50" transform="rotate(135 525 25)"/>
10</svg>
diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst
index 935b9b8d456c..472e7a664d13 100644
--- a/Documentation/driver-api/basics.rst
+++ b/Documentation/driver-api/basics.rst
@@ -7,6 +7,12 @@ Driver Entry and Exit points
7.. kernel-doc:: include/linux/init.h 7.. kernel-doc:: include/linux/init.h
8 :internal: 8 :internal:
9 9
10Driver device table
11-------------------
12
13.. kernel-doc:: include/linux/mod_devicetable.h
14 :internal:
15
10Atomic and pointer manipulation 16Atomic and pointer manipulation
11------------------------------- 17-------------------------------
12 18
diff --git a/Documentation/driver-api/firmware/index.rst b/Documentation/driver-api/firmware/index.rst
index 1abe01793031..29da39ec4b8a 100644
--- a/Documentation/driver-api/firmware/index.rst
+++ b/Documentation/driver-api/firmware/index.rst
@@ -7,6 +7,7 @@ Linux Firmware API
7 introduction 7 introduction
8 core 8 core
9 request_firmware 9 request_firmware
10 other_interfaces
10 11
11.. only:: subproject and html 12.. only:: subproject and html
12 13
diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst
new file mode 100644
index 000000000000..36c47b1e9824
--- /dev/null
+++ b/Documentation/driver-api/firmware/other_interfaces.rst
@@ -0,0 +1,15 @@
1Other Firmware Interfaces
2=========================
3
4DMI Interfaces
5--------------
6
7.. kernel-doc:: drivers/firmware/dmi_scan.c
8 :export:
9
10EDD Interfaces
11--------------
12
13.. kernel-doc:: drivers/firmware/edd.c
14 :internal:
15
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
index 60db00d1532b..8058a87c1c74 100644
--- a/Documentation/driver-api/index.rst
+++ b/Documentation/driver-api/index.rst
@@ -26,7 +26,8 @@ available subsections can be seen below.
26 regulator 26 regulator
27 iio/index 27 iio/index
28 input 28 input
29 usb 29 usb/index
30 pci
30 spi 31 spi
31 i2c 32 i2c
32 hsi 33 hsi
@@ -36,6 +37,7 @@ available subsections can be seen below.
36 80211/index 37 80211/index
37 uio-howto 38 uio-howto
38 firmware/index 39 firmware/index
40 misc_devices
39 41
40.. only:: subproject and html 42.. only:: subproject and html
41 43
diff --git a/Documentation/driver-api/misc_devices.rst b/Documentation/driver-api/misc_devices.rst
new file mode 100644
index 000000000000..c7ee7b02ba88
--- /dev/null
+++ b/Documentation/driver-api/misc_devices.rst
@@ -0,0 +1,5 @@
1Miscellaneous Devices
2=====================
3
4.. kernel-doc:: drivers/char/misc.c
5 :export:
diff --git a/Documentation/driver-api/pci.rst b/Documentation/driver-api/pci.rst
new file mode 100644
index 000000000000..01a6c8b7d3a7
--- /dev/null
+++ b/Documentation/driver-api/pci.rst
@@ -0,0 +1,50 @@
1PCI Support Library
2-------------------
3
4.. kernel-doc:: drivers/pci/pci.c
5 :export:
6
7.. kernel-doc:: drivers/pci/pci-driver.c
8 :export:
9
10.. kernel-doc:: drivers/pci/remove.c
11 :export:
12
13.. kernel-doc:: drivers/pci/search.c
14 :export:
15
16.. kernel-doc:: drivers/pci/msi.c
17 :export:
18
19.. kernel-doc:: drivers/pci/bus.c
20 :export:
21
22.. kernel-doc:: drivers/pci/access.c
23 :export:
24
25.. kernel-doc:: drivers/pci/irq.c
26 :export:
27
28.. kernel-doc:: drivers/pci/htirq.c
29 :export:
30
31.. kernel-doc:: drivers/pci/probe.c
32 :export:
33
34.. kernel-doc:: drivers/pci/slot.c
35 :export:
36
37.. kernel-doc:: drivers/pci/rom.c
38 :export:
39
40.. kernel-doc:: drivers/pci/iov.c
41 :export:
42
43.. kernel-doc:: drivers/pci/pci-sysfs.c
44 :internal:
45
46PCI Hotplug Support Library
47---------------------------
48
49.. kernel-doc:: drivers/pci/hotplug/pci_hotplug_core.c
50 :export:
diff --git a/Documentation/usb/URB.txt b/Documentation/driver-api/usb/URB.rst
index 50da0d455444..61a54da9fce9 100644
--- a/Documentation/usb/URB.txt
+++ b/Documentation/driver-api/usb/URB.rst
@@ -1,28 +1,37 @@
1Revised: 2000-Dec-05. 1.. _usb-urb:
2Again: 2002-Jul-06
3Again: 2005-Sep-19
4 2
5 NOTE: 3USB Request Block (URB)
4~~~~~~~~~~~~~~~~~~~~~~~
6 5
7 The USB subsystem now has a substantial section in "The Linux Kernel API" 6:Revised: 2000-Dec-05
8 guide (in Documentation/DocBook), generated from the current source 7:Again: 2002-Jul-06
9 code. This particular documentation file isn't particularly current or 8:Again: 2005-Sep-19
10 complete; don't rely on it except for a quick overview. 9:Again: 2017-Mar-29
11 10
12 11
131.1. Basic concept or 'What is an URB?' 12.. note::
14 13
15The basic idea of the new driver is message passing, the message itself is 14 The USB subsystem now has a substantial section at :ref:`usb-hostside-api`
16called USB Request Block, or URB for short. 15 section, generated from the current source code.
16 This particular documentation file isn't complete and may not be
17 updated to the last version; don't rely on it except for a quick
18 overview.
17 19
18- An URB consists of all relevant information to execute any USB transaction 20Basic concept or 'What is an URB?'
19 and deliver the data and status back. 21==================================
20 22
21- Execution of an URB is inherently an asynchronous operation, i.e. the 23The basic idea of the new driver is message passing, the message itself is
22 usb_submit_urb(urb) call returns immediately after it has successfully 24called USB Request Block, or URB for short.
25
26- An URB consists of all relevant information to execute any USB transaction
27 and deliver the data and status back.
28
29- Execution of an URB is inherently an asynchronous operation, i.e. the
30 :c:func:`usb_submit_urb` call returns immediately after it has successfully
23 queued the requested action. 31 queued the requested action.
24 32
25- Transfers for one URB can be canceled with usb_unlink_urb(urb) at any time. 33- Transfers for one URB can be canceled with :c:func:`usb_unlink_urb`
34 at any time.
26 35
27- Each URB has a completion handler, which is called after the action 36- Each URB has a completion handler, which is called after the action
28 has been successfully completed or canceled. The URB also contains a 37 has been successfully completed or canceled. The URB also contains a
@@ -35,53 +44,55 @@ called USB Request Block, or URB for short.
35 of data to (or from) devices when using periodic transfer modes. 44 of data to (or from) devices when using periodic transfer modes.
36 45
37 46
381.2. The URB structure 47The URB structure
48=================
39 49
40Some of the fields in an URB are: 50Some of the fields in struct :c:type:`urb` are::
41 51
42struct urb 52 struct urb
43{ 53 {
44// (IN) device and pipe specify the endpoint queue 54 // (IN) device and pipe specify the endpoint queue
45 struct usb_device *dev; // pointer to associated USB device 55 struct usb_device *dev; // pointer to associated USB device
46 unsigned int pipe; // endpoint information 56 unsigned int pipe; // endpoint information
47 57
48 unsigned int transfer_flags; // ISO_ASAP, SHORT_NOT_OK, etc. 58 unsigned int transfer_flags; // URB_ISO_ASAP, URB_SHORT_NOT_OK, etc.
49 59
50// (IN) all urbs need completion routines 60 // (IN) all urbs need completion routines
51 void *context; // context for completion routine 61 void *context; // context for completion routine
52 void (*complete)(struct urb *); // pointer to completion routine 62 usb_complete_t complete; // pointer to completion routine
53 63
54// (OUT) status after each completion 64 // (OUT) status after each completion
55 int status; // returned status 65 int status; // returned status
56 66
57// (IN) buffer used for data transfers 67 // (IN) buffer used for data transfers
58 void *transfer_buffer; // associated data buffer 68 void *transfer_buffer; // associated data buffer
59 int transfer_buffer_length; // data buffer length 69 u32 transfer_buffer_length; // data buffer length
60 int number_of_packets; // size of iso_frame_desc 70 int number_of_packets; // size of iso_frame_desc
61 71
62// (OUT) sometimes only part of CTRL/BULK/INTR transfer_buffer is used 72 // (OUT) sometimes only part of CTRL/BULK/INTR transfer_buffer is used
63 int actual_length; // actual data buffer length 73 u32 actual_length; // actual data buffer length
64 74
65// (IN) setup stage for CTRL (pass a struct usb_ctrlrequest) 75 // (IN) setup stage for CTRL (pass a struct usb_ctrlrequest)
66 unsigned char* setup_packet; // setup packet (control only) 76 unsigned char *setup_packet; // setup packet (control only)
67 77
68// Only for PERIODIC transfers (ISO, INTERRUPT) 78 // Only for PERIODIC transfers (ISO, INTERRUPT)
69 // (IN/OUT) start_frame is set unless ISO_ASAP isn't set 79 // (IN/OUT) start_frame is set unless URB_ISO_ASAP isn't set
70 int start_frame; // start frame 80 int start_frame; // start frame
71 int interval; // polling interval 81 int interval; // polling interval
72 82
73 // ISO only: packets are only "best effort"; each can have errors 83 // ISO only: packets are only "best effort"; each can have errors
74 int error_count; // number of errors 84 int error_count; // number of errors
75 struct usb_iso_packet_descriptor iso_frame_desc[0]; 85 struct usb_iso_packet_descriptor iso_frame_desc[0];
76}; 86 };
77 87
78Your driver must create the "pipe" value using values from the appropriate 88Your driver must create the "pipe" value using values from the appropriate
79endpoint descriptor in an interface that it's claimed. 89endpoint descriptor in an interface that it's claimed.
80 90
81 91
821.3. How to get an URB? 92How to get an URB?
93==================
83 94
84URBs are allocated with the following call 95URBs are allocated by calling :c:func:`usb_alloc_urb`::
85 96
86 struct urb *usb_alloc_urb(int isoframes, int mem_flags) 97 struct urb *usb_alloc_urb(int isoframes, int mem_flags)
87 98
@@ -91,7 +102,7 @@ you want to schedule. For CTRL/BULK/INT, use 0. The mem_flags parameter
91holds standard memory allocation flags, letting you control (among other 102holds standard memory allocation flags, letting you control (among other
92things) whether the underlying code may block or not. 103things) whether the underlying code may block or not.
93 104
94To free an URB, use 105To free an URB, use :c:func:`usb_free_urb`::
95 106
96 void usb_free_urb(struct urb *urb) 107 void usb_free_urb(struct urb *urb)
97 108
@@ -100,78 +111,84 @@ returned to you in a completion callback. It will automatically be
100deallocated when it is no longer in use. 111deallocated when it is no longer in use.
101 112
102 113
1031.4. What has to be filled in? 114What has to be filled in?
115=========================
104 116
105Depending on the type of transaction, there are some inline functions 117Depending on the type of transaction, there are some inline functions
106defined in <linux/usb.h> to simplify the initialization, such as 118defined in ``linux/usb.h`` to simplify the initialization, such as
107fill_control_urb() and fill_bulk_urb(). In general, they need the usb 119:c:func:`usb_fill_control_urb`, :c:func:`usb_fill_bulk_urb` and
108device pointer, the pipe (usual format from usb.h), the transfer buffer, 120:c:func:`usb_fill_int_urb`. In general, they need the usb device pointer,
109the desired transfer length, the completion handler, and its context. 121the pipe (usual format from usb.h), the transfer buffer, the desired transfer
110Take a look at the some existing drivers to see how they're used. 122length, the completion handler, and its context. Take a look at the some
123existing drivers to see how they're used.
111 124
112Flags: 125Flags:
113For ISO there are two startup behaviors: Specified start_frame or ASAP.
114For ASAP set URB_ISO_ASAP in transfer_flags.
115 126
116If short packets should NOT be tolerated, set URB_SHORT_NOT_OK in 127- For ISO there are two startup behaviors: Specified start_frame or ASAP.
128- For ASAP set ``URB_ISO_ASAP`` in transfer_flags.
129
130If short packets should NOT be tolerated, set ``URB_SHORT_NOT_OK`` in
117transfer_flags. 131transfer_flags.
118 132
119 133
1201.5. How to submit an URB? 134How to submit an URB?
135=====================
121 136
122Just call 137Just call :c:func:`usb_submit_urb`::
123 138
124 int usb_submit_urb(struct urb *urb, int mem_flags) 139 int usb_submit_urb(struct urb *urb, int mem_flags)
125 140
126The mem_flags parameter, such as SLAB_ATOMIC, controls memory allocation, 141The ``mem_flags`` parameter, such as ``GFP_ATOMIC``, controls memory
127such as whether the lower levels may block when memory is tight. 142allocation, such as whether the lower levels may block when memory is tight.
128 143
129It immediately returns, either with status 0 (request queued) or some 144It immediately returns, either with status 0 (request queued) or some
130error code, usually caused by the following: 145error code, usually caused by the following:
131 146
132- Out of memory (-ENOMEM) 147- Out of memory (``-ENOMEM``)
133- Unplugged device (-ENODEV) 148- Unplugged device (``-ENODEV``)
134- Stalled endpoint (-EPIPE) 149- Stalled endpoint (``-EPIPE``)
135- Too many queued ISO transfers (-EAGAIN) 150- Too many queued ISO transfers (``-EAGAIN``)
136- Too many requested ISO frames (-EFBIG) 151- Too many requested ISO frames (``-EFBIG``)
137- Invalid INT interval (-EINVAL) 152- Invalid INT interval (``-EINVAL``)
138- More than one packet for INT (-EINVAL) 153- More than one packet for INT (``-EINVAL``)
139 154
140After submission, urb->status is -EINPROGRESS; however, you should never 155After submission, ``urb->status`` is ``-EINPROGRESS``; however, you should
141look at that value except in your completion callback. 156never look at that value except in your completion callback.
142 157
143For isochronous endpoints, your completion handlers should (re)submit 158For isochronous endpoints, your completion handlers should (re)submit
144URBs to the same endpoint with the ISO_ASAP flag, using multi-buffering, 159URBs to the same endpoint with the ``URB_ISO_ASAP`` flag, using
145to get seamless ISO streaming. 160multi-buffering, to get seamless ISO streaming.
146 161
147 162
1481.6. How to cancel an already running URB? 163How to cancel an already running URB?
164=====================================
149 165
150There are two ways to cancel an URB you've submitted but which hasn't 166There are two ways to cancel an URB you've submitted but which hasn't
151been returned to your driver yet. For an asynchronous cancel, call 167been returned to your driver yet. For an asynchronous cancel, call
168:c:func:`usb_unlink_urb`::
152 169
153 int usb_unlink_urb(struct urb *urb) 170 int usb_unlink_urb(struct urb *urb)
154 171
155It removes the urb from the internal list and frees all allocated 172It removes the urb from the internal list and frees all allocated
156HW descriptors. The status is changed to reflect unlinking. Note 173HW descriptors. The status is changed to reflect unlinking. Note
157that the URB will not normally have finished when usb_unlink_urb() 174that the URB will not normally have finished when :c:func:`usb_unlink_urb`
158returns; you must still wait for the completion handler to be called. 175returns; you must still wait for the completion handler to be called.
159 176
160To cancel an URB synchronously, call 177To cancel an URB synchronously, call :c:func:`usb_kill_urb`::
161 178
162 void usb_kill_urb(struct urb *urb) 179 void usb_kill_urb(struct urb *urb)
163 180
164It does everything usb_unlink_urb does, and in addition it waits 181It does everything :c:func:`usb_unlink_urb` does, and in addition it waits
165until after the URB has been returned and the completion handler 182until after the URB has been returned and the completion handler
166has finished. It also marks the URB as temporarily unusable, so 183has finished. It also marks the URB as temporarily unusable, so
167that if the completion handler or anyone else tries to resubmit it 184that if the completion handler or anyone else tries to resubmit it
168they will get a -EPERM error. Thus you can be sure that when 185they will get a ``-EPERM`` error. Thus you can be sure that when
169usb_kill_urb() returns, the URB is totally idle. 186:c:func:`usb_kill_urb` returns, the URB is totally idle.
170 187
171There is a lifetime issue to consider. An URB may complete at any 188There is a lifetime issue to consider. An URB may complete at any
172time, and the completion handler may free the URB. If this happens 189time, and the completion handler may free the URB. If this happens
173while usb_unlink_urb or usb_kill_urb is running, it will cause a 190while :c:func:`usb_unlink_urb` or :c:func:`usb_kill_urb` is running, it will
174memory-access violation. The driver is responsible for avoiding this, 191cause a memory-access violation. The driver is responsible for avoiding this,
175which often means some sort of lock will be needed to prevent the URB 192which often means some sort of lock will be needed to prevent the URB
176from being deallocated while it is still in use. 193from being deallocated while it is still in use.
177 194
@@ -181,24 +198,25 @@ when usb_unlink_urb is invoked. The general solution to this problem
181is to increment the URB's reference count while holding the lock, then 198is to increment the URB's reference count while holding the lock, then
182drop the lock and call usb_unlink_urb or usb_kill_urb, and then 199drop the lock and call usb_unlink_urb or usb_kill_urb, and then
183decrement the URB's reference count. You increment the reference 200decrement the URB's reference count. You increment the reference
184count by calling 201count by calling :c:func`usb_get_urb`::
185 202
186 struct urb *usb_get_urb(struct urb *urb) 203 struct urb *usb_get_urb(struct urb *urb)
187 204
188(ignore the return value; it is the same as the argument) and 205(ignore the return value; it is the same as the argument) and
189decrement the reference count by calling usb_free_urb. Of course, 206decrement the reference count by calling :c:func:`usb_free_urb`. Of course,
190none of this is necessary if there's no danger of the URB being freed 207none of this is necessary if there's no danger of the URB being freed
191by the completion handler. 208by the completion handler.
192 209
193 210
1941.7. What about the completion handler? 211What about the completion handler?
212==================================
195 213
196The handler is of the following type: 214The handler is of the following type::
197 215
198 typedef void (*usb_complete_t)(struct urb *) 216 typedef void (*usb_complete_t)(struct urb *)
199 217
200I.e., it gets the URB that caused the completion call. In the completion 218I.e., it gets the URB that caused the completion call. In the completion
201handler, you should have a look at urb->status to detect any USB errors. 219handler, you should have a look at ``urb->status`` to detect any USB errors.
202Since the context parameter is included in the URB, you can pass 220Since the context parameter is included in the URB, you can pass
203information to the completion handler. 221information to the completion handler.
204 222
@@ -208,54 +226,65 @@ sixteen packets to transfer your 1KByte buffer, and ten of them might
208have transferred successfully before the completion was called. 226have transferred successfully before the completion was called.
209 227
210 228
211NOTE: ***** WARNING ***** 229.. warning::
212NEVER SLEEP IN A COMPLETION HANDLER. These are often called in atomic 230
213context. 231 NEVER SLEEP IN A COMPLETION HANDLER.
232
233 These are often called in atomic context.
214 234
215In the current kernel, completion handlers run with local interrupts 235In the current kernel, completion handlers run with local interrupts
216disabled, but in the future this will be changed, so don't assume that 236disabled, but in the future this will be changed, so don't assume that
217local IRQs are always disabled inside completion handlers. 237local IRQs are always disabled inside completion handlers.
218 238
2191.8. How to do isochronous (ISO) transfers? 239How to do isochronous (ISO) transfers?
240======================================
241
242Besides the fields present on a bulk transfer, for ISO, you also
243also have to set ``urb->interval`` to say how often to make transfers; it's
244often one per frame (which is once every microframe for highspeed devices).
245The actual interval used will be a power of two that's no bigger than what
246you specify. You can use the :c:func:`usb_fill_int_urb` macro to fill
247most ISO transfer fields.
220 248
221For ISO transfers you have to fill a usb_iso_packet_descriptor structure, 249For ISO transfers you also have to fill a :c:type:`usb_iso_packet_descriptor`
222allocated at the end of the URB by usb_alloc_urb(n,mem_flags), for each 250structure, allocated at the end of the URB by :c:func:`usb_alloc_urb`, for
223packet you want to schedule. You also have to set urb->interval to say 251each packet you want to schedule.
224how often to make transfers; it's often one per frame (which is once
225every microframe for highspeed devices). The actual interval used will
226be a power of two that's no bigger than what you specify.
227 252
228The usb_submit_urb() call modifies urb->interval to the implemented interval 253The :c:func:`usb_submit_urb` call modifies ``urb->interval`` to the implemented
229value that is less than or equal to the requested interval value. If 254interval value that is less than or equal to the requested interval value. If
230ISO_ASAP scheduling is used, urb->start_frame is also updated. 255``URB_ISO_ASAP`` scheduling is used, ``urb->start_frame`` is also updated.
231 256
232For each entry you have to specify the data offset for this frame (base is 257For each entry you have to specify the data offset for this frame (base is
233transfer_buffer), and the length you want to write/expect to read. 258transfer_buffer), and the length you want to write/expect to read.
234After completion, actual_length contains the actual transferred length and 259After completion, actual_length contains the actual transferred length and
235status contains the resulting status for the ISO transfer for this frame. 260status contains the resulting status for the ISO transfer for this frame.
236It is allowed to specify a varying length from frame to frame (e.g. for 261It is allowed to specify a varying length from frame to frame (e.g. for
237audio synchronisation/adaptive transfer rates). You can also use the length 262audio synchronisation/adaptive transfer rates). You can also use the length
2380 to omit one or more frames (striping). 2630 to omit one or more frames (striping).
239 264
240For scheduling you can choose your own start frame or ISO_ASAP. As explained 265For scheduling you can choose your own start frame or ``URB_ISO_ASAP``. As
241earlier, if you always keep at least one URB queued and your completion 266explained earlier, if you always keep at least one URB queued and your
242keeps (re)submitting a later URB, you'll get smooth ISO streaming (if usb 267completion keeps (re)submitting a later URB, you'll get smooth ISO streaming
243bandwidth utilization allows). 268(if usb bandwidth utilization allows).
244 269
245If you specify your own start frame, make sure it's several frames in advance 270If you specify your own start frame, make sure it's several frames in advance
246of the current frame. You might want this model if you're synchronizing 271of the current frame. You might want this model if you're synchronizing
247ISO data with some other event stream. 272ISO data with some other event stream.
248 273
249 274
2501.9. How to start interrupt (INT) transfers? 275How to start interrupt (INT) transfers?
276=======================================
251 277
252Interrupt transfers, like isochronous transfers, are periodic, and happen 278Interrupt transfers, like isochronous transfers, are periodic, and happen
253in intervals that are powers of two (1, 2, 4 etc) units. Units are frames 279in intervals that are powers of two (1, 2, 4 etc) units. Units are frames
254for full and low speed devices, and microframes for high speed ones. 280for full and low speed devices, and microframes for high speed ones.
255The usb_submit_urb() call modifies urb->interval to the implemented interval 281You can use the :c:func:`usb_fill_int_urb` macro to fill INT transfer fields.
256value that is less than or equal to the requested interval value. 282
283The :c:func:`usb_submit_urb` call modifies ``urb->interval`` to the implemented
284interval value that is less than or equal to the requested interval value.
257 285
258In Linux 2.6, unlike earlier versions, interrupt URBs are not automagically 286In Linux 2.6, unlike earlier versions, interrupt URBs are not automagically
259restarted when they complete. They end when the completion handler is 287restarted when they complete. They end when the completion handler is
260called, just like other URBs. If you want an interrupt URB to be restarted, 288called, just like other URBs. If you want an interrupt URB to be restarted,
261your completion handler must resubmit it. 289your completion handler must resubmit it.
290s
diff --git a/Documentation/usb/anchors.txt b/Documentation/driver-api/usb/anchors.rst
index fe6a99a32bbd..4b248e691bd6 100644
--- a/Documentation/usb/anchors.txt
+++ b/Documentation/driver-api/usb/anchors.rst
@@ -1,3 +1,6 @@
1USB Anchors
2~~~~~~~~~~~
3
1What is anchor? 4What is anchor?
2=============== 5===============
3 6
@@ -13,7 +16,7 @@ Allocation and Initialisation
13============================= 16=============================
14 17
15There's no API to allocate an anchor. It is simply declared 18There's no API to allocate an anchor. It is simply declared
16as struct usb_anchor. init_usb_anchor() must be called to 19as struct usb_anchor. :c:func:`init_usb_anchor` must be called to
17initialise the data structure. 20initialise the data structure.
18 21
19Deallocation 22Deallocation
@@ -26,52 +29,53 @@ Association and disassociation of URBs with anchors
26=================================================== 29===================================================
27 30
28An association of URBs to an anchor is made by an explicit 31An association of URBs to an anchor is made by an explicit
29call to usb_anchor_urb(). The association is maintained until 32call to :c:func:`usb_anchor_urb`. The association is maintained until
30an URB is finished by (successful) completion. Thus disassociation 33an URB is finished by (successful) completion. Thus disassociation
31is automatic. A function is provided to forcibly finish (kill) 34is automatic. A function is provided to forcibly finish (kill)
32all URBs associated with an anchor. 35all URBs associated with an anchor.
33Furthermore, disassociation can be made with usb_unanchor_urb() 36Furthermore, disassociation can be made with :c:func:`usb_unanchor_urb`
34 37
35Operations on multitudes of URBs 38Operations on multitudes of URBs
36================================ 39================================
37 40
38usb_kill_anchored_urbs() 41:c:func:`usb_kill_anchored_urbs`
39------------------------ 42--------------------------------
40 43
41This function kills all URBs associated with an anchor. The URBs 44This function kills all URBs associated with an anchor. The URBs
42are called in the reverse temporal order they were submitted. 45are called in the reverse temporal order they were submitted.
43This way no data can be reordered. 46This way no data can be reordered.
44 47
45usb_unlink_anchored_urbs() 48:c:func:`usb_unlink_anchored_urbs`
46-------------------------- 49----------------------------------
50
47 51
48This function unlinks all URBs associated with an anchor. The URBs 52This function unlinks all URBs associated with an anchor. The URBs
49are processed in the reverse temporal order they were submitted. 53are processed in the reverse temporal order they were submitted.
50This is similar to usb_kill_anchored_urbs(), but it will not sleep. 54This is similar to :c:func:`usb_kill_anchored_urbs`, but it will not sleep.
51Therefore no guarantee is made that the URBs have been unlinked when 55Therefore no guarantee is made that the URBs have been unlinked when
52the call returns. They may be unlinked later but will be unlinked in 56the call returns. They may be unlinked later but will be unlinked in
53finite time. 57finite time.
54 58
55usb_scuttle_anchored_urbs() 59:c:func:`usb_scuttle_anchored_urbs`
56--------------------------- 60-----------------------------------
57 61
58All URBs of an anchor are unanchored en masse. 62All URBs of an anchor are unanchored en masse.
59 63
60usb_wait_anchor_empty_timeout() 64:c:func:`usb_wait_anchor_empty_timeout`
61------------------------------- 65---------------------------------------
62 66
63This function waits for all URBs associated with an anchor to finish 67This function waits for all URBs associated with an anchor to finish
64or a timeout, whichever comes first. Its return value will tell you 68or a timeout, whichever comes first. Its return value will tell you
65whether the timeout was reached. 69whether the timeout was reached.
66 70
67usb_anchor_empty() 71:c:func:`usb_anchor_empty`
68------------------ 72--------------------------
69 73
70Returns true if no URBs are associated with an anchor. Locking 74Returns true if no URBs are associated with an anchor. Locking
71is the caller's responsibility. 75is the caller's responsibility.
72 76
73usb_get_from_anchor() 77:c:func:`usb_get_from_anchor`
74--------------------- 78-----------------------------
75 79
76Returns the oldest anchored URB of an anchor. The URB is unanchored 80Returns the oldest anchored URB of an anchor. The URB is unanchored
77and returned with a reference. As you may mix URBs to several 81and returned with a reference. As you may mix URBs to several
diff --git a/Documentation/usb/bulk-streams.txt b/Documentation/driver-api/usb/bulk-streams.rst
index ffc02021863e..99b515babdeb 100644
--- a/Documentation/usb/bulk-streams.txt
+++ b/Documentation/driver-api/usb/bulk-streams.rst
@@ -1,3 +1,6 @@
1USB bulk streams
2~~~~~~~~~~~~~~~~
3
1Background 4Background
2========== 5==========
3 6
@@ -25,7 +28,9 @@ time.
25Driver implications 28Driver implications
26=================== 29===================
27 30
28int usb_alloc_streams(struct usb_interface *interface, 31::
32
33 int usb_alloc_streams(struct usb_interface *interface,
29 struct usb_host_endpoint **eps, unsigned int num_eps, 34 struct usb_host_endpoint **eps, unsigned int num_eps,
30 unsigned int num_streams, gfp_t mem_flags); 35 unsigned int num_streams, gfp_t mem_flags);
31 36
@@ -53,7 +58,7 @@ controller driver, and may change in the future.
53 58
54 59
55Picking new Stream IDs to use 60Picking new Stream IDs to use
56============================ 61=============================
57 62
58Stream ID 0 is reserved, and should not be used to communicate with devices. If 63Stream ID 0 is reserved, and should not be used to communicate with devices. If
59usb_alloc_streams() returns with a value of N, you may use streams 1 though N. 64usb_alloc_streams() returns with a value of N, you may use streams 1 though N.
@@ -68,9 +73,9 @@ Clean up
68======== 73========
69 74
70If a driver wishes to stop using streams to communicate with the device, it 75If a driver wishes to stop using streams to communicate with the device, it
71should call 76should call::
72 77
73void usb_free_streams(struct usb_interface *interface, 78 void usb_free_streams(struct usb_interface *interface,
74 struct usb_host_endpoint **eps, unsigned int num_eps, 79 struct usb_host_endpoint **eps, unsigned int num_eps,
75 gfp_t mem_flags); 80 gfp_t mem_flags);
76 81
diff --git a/Documentation/usb/callbacks.txt b/Documentation/driver-api/usb/callbacks.rst
index 9e85846bdb98..2b80cf54bcc3 100644
--- a/Documentation/usb/callbacks.txt
+++ b/Documentation/driver-api/usb/callbacks.rst
@@ -1,3 +1,6 @@
1USB core callbacks
2~~~~~~~~~~~~~~~~~~
3
1What callbacks will usbcore do? 4What callbacks will usbcore do?
2=============================== 5===============================
3 6
@@ -5,40 +8,52 @@ Usbcore will call into a driver through callbacks defined in the driver
5structure and through the completion handler of URBs a driver submits. 8structure and through the completion handler of URBs a driver submits.
6Only the former are in the scope of this document. These two kinds of 9Only the former are in the scope of this document. These two kinds of
7callbacks are completely independent of each other. Information on the 10callbacks are completely independent of each other. Information on the
8completion callback can be found in Documentation/usb/URB.txt. 11completion callback can be found in :ref:`usb-urb`.
9 12
10The callbacks defined in the driver structure are: 13The callbacks defined in the driver structure are:
11 14
121. Hotplugging callbacks: 151. Hotplugging callbacks:
13 16
14 * @probe: Called to see if the driver is willing to manage a particular 17 - @probe:
15 * interface on a device. 18 Called to see if the driver is willing to manage a particular
16 * @disconnect: Called when the interface is no longer accessible, usually 19 interface on a device.
17 * because its device has been (or is being) disconnected or the 20
18 * driver module is being unloaded. 21 - @disconnect:
22 Called when the interface is no longer accessible, usually
23 because its device has been (or is being) disconnected or the
24 driver module is being unloaded.
19 25
202. Odd backdoor through usbfs: 262. Odd backdoor through usbfs:
21 27
22 * @ioctl: Used for drivers that want to talk to userspace through 28 - @ioctl:
23 * the "usbfs" filesystem. This lets devices provide ways to 29 Used for drivers that want to talk to userspace through
24 * expose information to user space regardless of where they 30 the "usbfs" filesystem. This lets devices provide ways to
25 * do (or don't) show up otherwise in the filesystem. 31 expose information to user space regardless of where they
32 do (or don't) show up otherwise in the filesystem.
26 33
273. Power management (PM) callbacks: 343. Power management (PM) callbacks:
28 35
29 * @suspend: Called when the device is going to be suspended. 36 - @suspend:
30 * @resume: Called when the device is being resumed. 37 Called when the device is going to be suspended.
31 * @reset_resume: Called when the suspended device has been reset instead 38
32 * of being resumed. 39 - @resume:
40 Called when the device is being resumed.
41
42 - @reset_resume:
43 Called when the suspended device has been reset instead
44 of being resumed.
33 45
344. Device level operations: 464. Device level operations:
35 47
36 * @pre_reset: Called when the device is about to be reset. 48 - @pre_reset:
37 * @post_reset: Called after the device has been reset 49 Called when the device is about to be reset.
50
51 - @post_reset:
52 Called after the device has been reset
38 53
39The ioctl interface (2) should be used only if you have a very good 54The ioctl interface (2) should be used only if you have a very good
40reason. Sysfs is preferred these days. The PM callbacks are covered 55reason. Sysfs is preferred these days. The PM callbacks are covered
41separately in Documentation/usb/power-management.txt. 56separately in :ref:`usb-power-management`.
42 57
43Calling conventions 58Calling conventions
44=================== 59===================
@@ -58,7 +73,9 @@ an interface. A driver's bond to an interface is exclusive.
58The probe() callback 73The probe() callback
59-------------------- 74--------------------
60 75
61int (*probe) (struct usb_interface *intf, 76::
77
78 int (*probe) (struct usb_interface *intf,
62 const struct usb_device_id *id); 79 const struct usb_device_id *id);
63 80
64Accept or decline an interface. If you accept the device return 0, 81Accept or decline an interface. If you accept the device return 0,
@@ -75,7 +92,9 @@ initialisation that doesn't take too long is a good idea here.
75The disconnect() callback 92The disconnect() callback
76------------------------- 93-------------------------
77 94
78void (*disconnect) (struct usb_interface *intf); 95::
96
97 void (*disconnect) (struct usb_interface *intf);
79 98
80This callback is a signal to break any connection with an interface. 99This callback is a signal to break any connection with an interface.
81You are not allowed any IO to a device after returning from this 100You are not allowed any IO to a device after returning from this
@@ -93,7 +112,9 @@ Device level callbacks
93pre_reset 112pre_reset
94--------- 113---------
95 114
96int (*pre_reset)(struct usb_interface *intf); 115::
116
117 int (*pre_reset)(struct usb_interface *intf);
97 118
98A driver or user space is triggering a reset on the device which 119A driver or user space is triggering a reset on the device which
99contains the interface passed as an argument. Cease IO, wait for all 120contains the interface passed as an argument. Cease IO, wait for all
@@ -107,7 +128,9 @@ are in atomic context.
107post_reset 128post_reset
108---------- 129----------
109 130
110int (*post_reset)(struct usb_interface *intf); 131::
132
133 int (*post_reset)(struct usb_interface *intf);
111 134
112The reset has completed. Restore any saved device state and begin 135The reset has completed. Restore any saved device state and begin
113using the device again. 136using the device again.
diff --git a/Documentation/usb/dma.txt b/Documentation/driver-api/usb/dma.rst
index 444651e70d95..59d5aee89e37 100644
--- a/Documentation/usb/dma.txt
+++ b/Documentation/driver-api/usb/dma.rst
@@ -1,16 +1,19 @@
1USB DMA
2~~~~~~~
3
1In Linux 2.5 kernels (and later), USB device drivers have additional control 4In Linux 2.5 kernels (and later), USB device drivers have additional control
2over how DMA may be used to perform I/O operations. The APIs are detailed 5over how DMA may be used to perform I/O operations. The APIs are detailed
3in the kernel usb programming guide (kerneldoc, from the source code). 6in the kernel usb programming guide (kerneldoc, from the source code).
4 7
5 8API overview
6API OVERVIEW 9============
7 10
8The big picture is that USB drivers can continue to ignore most DMA issues, 11The big picture is that USB drivers can continue to ignore most DMA issues,
9though they still must provide DMA-ready buffers (see 12though they still must provide DMA-ready buffers (see
10Documentation/DMA-API-HOWTO.txt). That's how they've worked through 13``Documentation/DMA-API-HOWTO.txt``). That's how they've worked through
11the 2.4 (and earlier) kernels. 14the 2.4 (and earlier) kernels, or they can now be DMA-aware.
12 15
13OR: they can now be DMA-aware. 16DMA-aware usb drivers:
14 17
15- New calls enable DMA-aware drivers, letting them allocate dma buffers and 18- New calls enable DMA-aware drivers, letting them allocate dma buffers and
16 manage dma mappings for existing dma-ready buffers (see below). 19 manage dma mappings for existing dma-ready buffers (see below).
@@ -20,15 +23,15 @@ OR: they can now be DMA-aware.
20 drivers must not use it.) 23 drivers must not use it.)
21 24
22- "usbcore" will map this DMA address, if a DMA-aware driver didn't do 25- "usbcore" will map this DMA address, if a DMA-aware driver didn't do
23 it first and set URB_NO_TRANSFER_DMA_MAP. HCDs 26 it first and set ``URB_NO_TRANSFER_DMA_MAP``. HCDs
24 don't manage dma mappings for URBs. 27 don't manage dma mappings for URBs.
25 28
26- There's a new "generic DMA API", parts of which are usable by USB device 29- There's a new "generic DMA API", parts of which are usable by USB device
27 drivers. Never use dma_set_mask() on any USB interface or device; that 30 drivers. Never use dma_set_mask() on any USB interface or device; that
28 would potentially break all devices sharing that bus. 31 would potentially break all devices sharing that bus.
29 32
30 33Eliminating copies
31ELIMINATING COPIES 34==================
32 35
33It's good to avoid making CPUs copy data needlessly. The costs can add up, 36It's good to avoid making CPUs copy data needlessly. The costs can add up,
34and effects like cache-trashing can impose subtle penalties. 37and effects like cache-trashing can impose subtle penalties.
@@ -41,7 +44,7 @@ and effects like cache-trashing can impose subtle penalties.
41 For those specific cases, USB has primitives to allocate less expensive 44 For those specific cases, USB has primitives to allocate less expensive
42 memory. They work like kmalloc and kfree versions that give you the right 45 memory. They work like kmalloc and kfree versions that give you the right
43 kind of addresses to store in urb->transfer_buffer and urb->transfer_dma. 46 kind of addresses to store in urb->transfer_buffer and urb->transfer_dma.
44 You'd also set URB_NO_TRANSFER_DMA_MAP in urb->transfer_flags: 47 You'd also set ``URB_NO_TRANSFER_DMA_MAP`` in urb->transfer_flags::
45 48
46 void *usb_alloc_coherent (struct usb_device *dev, size_t size, 49 void *usb_alloc_coherent (struct usb_device *dev, size_t size,
47 int mem_flags, dma_addr_t *dma); 50 int mem_flags, dma_addr_t *dma);
@@ -49,15 +52,15 @@ and effects like cache-trashing can impose subtle penalties.
49 void usb_free_coherent (struct usb_device *dev, size_t size, 52 void usb_free_coherent (struct usb_device *dev, size_t size,
50 void *addr, dma_addr_t dma); 53 void *addr, dma_addr_t dma);
51 54
52 Most drivers should *NOT* be using these primitives; they don't need 55 Most drivers should **NOT** be using these primitives; they don't need
53 to use this type of memory ("dma-coherent"), and memory returned from 56 to use this type of memory ("dma-coherent"), and memory returned from
54 kmalloc() will work just fine. 57 :c:func:`kmalloc` will work just fine.
55 58
56 The memory buffer returned is "dma-coherent"; sometimes you might need to 59 The memory buffer returned is "dma-coherent"; sometimes you might need to
57 force a consistent memory access ordering by using memory barriers. It's 60 force a consistent memory access ordering by using memory barriers. It's
58 not using a streaming DMA mapping, so it's good for small transfers on 61 not using a streaming DMA mapping, so it's good for small transfers on
59 systems where the I/O would otherwise thrash an IOMMU mapping. (See 62 systems where the I/O would otherwise thrash an IOMMU mapping. (See
60 Documentation/DMA-API-HOWTO.txt for definitions of "coherent" and 63 ``Documentation/DMA-API-HOWTO.txt`` for definitions of "coherent" and
61 "streaming" DMA mappings.) 64 "streaming" DMA mappings.)
62 65
63 Asking for 1/Nth of a page (as well as asking for N pages) is reasonably 66 Asking for 1/Nth of a page (as well as asking for N pages) is reasonably
@@ -75,15 +78,15 @@ and effects like cache-trashing can impose subtle penalties.
75 way to expose these capabilities ... and in any case, HIGHMEM is mostly a 78 way to expose these capabilities ... and in any case, HIGHMEM is mostly a
76 design wart specific to x86_32. So your best bet is to ensure you never 79 design wart specific to x86_32. So your best bet is to ensure you never
77 pass a highmem buffer into a USB driver. That's easy; it's the default 80 pass a highmem buffer into a USB driver. That's easy; it's the default
78 behavior. Just don't override it; e.g. with NETIF_F_HIGHDMA. 81 behavior. Just don't override it; e.g. with ``NETIF_F_HIGHDMA``.
79 82
80 This may force your callers to do some bounce buffering, copying from 83 This may force your callers to do some bounce buffering, copying from
81 high memory to "normal" DMA memory. If you can come up with a good way 84 high memory to "normal" DMA memory. If you can come up with a good way
82 to fix this issue (for x86_32 machines with over 1 GByte of memory), 85 to fix this issue (for x86_32 machines with over 1 GByte of memory),
83 feel free to submit patches. 86 feel free to submit patches.
84 87
85 88Working with existing buffers
86WORKING WITH EXISTING BUFFERS 89=============================
87 90
88Existing buffers aren't usable for DMA without first being mapped into the 91Existing buffers aren't usable for DMA without first being mapped into the
89DMA address space of the device. However, most buffers passed to your 92DMA address space of the device. However, most buffers passed to your
@@ -92,7 +95,7 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?")
92 95
93- When you're using scatterlists, you can map everything at once. On some 96- When you're using scatterlists, you can map everything at once. On some
94 systems, this kicks in an IOMMU and turns the scatterlists into single 97 systems, this kicks in an IOMMU and turns the scatterlists into single
95 DMA transactions: 98 DMA transactions::
96 99
97 int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, 100 int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe,
98 struct scatterlist *sg, int nents); 101 struct scatterlist *sg, int nents);
@@ -103,7 +106,7 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?")
103 void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, 106 void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
104 struct scatterlist *sg, int n_hw_ents); 107 struct scatterlist *sg, int n_hw_ents);
105 108
106 It's probably easier to use the new usb_sg_*() calls, which do the DMA 109 It's probably easier to use the new ``usb_sg_*()`` calls, which do the DMA
107 mapping and apply other tweaks to make scatterlist i/o be fast. 110 mapping and apply other tweaks to make scatterlist i/o be fast.
108 111
109- Some drivers may prefer to work with the model that they're mapping large 112- Some drivers may prefer to work with the model that they're mapping large
@@ -112,10 +115,10 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?")
112 here, since it's cheaper to just synchronize the buffer than to unmap it 115 here, since it's cheaper to just synchronize the buffer than to unmap it
113 each time an urb completes and then re-map it on during resubmission. 116 each time an urb completes and then re-map it on during resubmission.
114 117
115 These calls all work with initialized urbs: urb->dev, urb->pipe, 118 These calls all work with initialized urbs: ``urb->dev``, ``urb->pipe``,
116 urb->transfer_buffer, and urb->transfer_buffer_length must all be 119 ``urb->transfer_buffer``, and ``urb->transfer_buffer_length`` must all be
117 valid when these calls are used (urb->setup_packet must be valid too 120 valid when these calls are used (``urb->setup_packet`` must be valid too
118 if urb is a control request): 121 if urb is a control request)::
119 122
120 struct urb *usb_buffer_map (struct urb *urb); 123 struct urb *usb_buffer_map (struct urb *urb);
121 124
@@ -123,9 +126,9 @@ of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?")
123 126
124 void usb_buffer_unmap (struct urb *urb); 127 void usb_buffer_unmap (struct urb *urb);
125 128
126 The calls manage urb->transfer_dma for you, and set URB_NO_TRANSFER_DMA_MAP 129 The calls manage ``urb->transfer_dma`` for you, and set
127 so that usbcore won't map or unmap the buffer. They cannot be used for 130 ``URB_NO_TRANSFER_DMA_MAP`` so that usbcore won't map or unmap the buffer.
128 setup_packet buffers in control requests. 131 They cannot be used for setup_packet buffers in control requests.
129 132
130Note that several of those interfaces are currently commented out, since 133Note that several of those interfaces are currently commented out, since
131they don't have current users. See the source code. Other than the dmasync 134they don't have current users. See the source code. Other than the dmasync
diff --git a/Documentation/driver-api/usb/error-codes.rst b/Documentation/driver-api/usb/error-codes.rst
new file mode 100644
index 000000000000..a3e84bfac776
--- /dev/null
+++ b/Documentation/driver-api/usb/error-codes.rst
@@ -0,0 +1,207 @@
1.. _usb-error-codes:
2
3USB Error codes
4~~~~~~~~~~~~~~~
5
6:Revised: 2004-Oct-21
7
8This is the documentation of (hopefully) all possible error codes (and
9their interpretation) that can be returned from usbcore.
10
11Some of them are returned by the Host Controller Drivers (HCDs), which
12device drivers only see through usbcore. As a rule, all the HCDs should
13behave the same except for transfer speed dependent behaviors and the
14way certain faults are reported.
15
16
17Error codes returned by :c:func:`usb_submit_urb`
18================================================
19
20Non-USB-specific:
21
22
23=============== ===============================================
240 URB submission went fine
25
26``-ENOMEM`` no memory for allocation of internal structures
27=============== ===============================================
28
29USB-specific:
30
31======================= =======================================================
32``-EBUSY`` The URB is already active.
33
34``-ENODEV`` specified USB-device or bus doesn't exist
35
36``-ENOENT`` specified interface or endpoint does not exist or
37 is not enabled
38
39``-ENXIO`` host controller driver does not support queuing of
40 this type of urb. (treat as a host controller bug.)
41
42``-EINVAL`` a) Invalid transfer type specified (or not supported)
43 b) Invalid or unsupported periodic transfer interval
44 c) ISO: attempted to change transfer interval
45 d) ISO: ``number_of_packets`` is < 0
46 e) various other cases
47
48``-EXDEV`` ISO: ``URB_ISO_ASAP`` wasn't specified and all the
49 frames the URB would be scheduled in have already
50 expired.
51
52``-EFBIG`` Host controller driver can't schedule that many ISO
53 frames.
54
55``-EPIPE`` The pipe type specified in the URB doesn't match the
56 endpoint's actual type.
57
58``-EMSGSIZE`` (a) endpoint maxpacket size is zero; it is not usable
59 in the current interface altsetting.
60 (b) ISO packet is larger than the endpoint maxpacket.
61 (c) requested data transfer length is invalid: negative
62 or too large for the host controller.
63
64``-ENOSPC`` This request would overcommit the usb bandwidth reserved
65 for periodic transfers (interrupt, isochronous).
66
67``-ESHUTDOWN`` The device or host controller has been disabled due to
68 some problem that could not be worked around.
69
70``-EPERM`` Submission failed because ``urb->reject`` was set.
71
72``-EHOSTUNREACH`` URB was rejected because the device is suspended.
73
74``-ENOEXEC`` A control URB doesn't contain a Setup packet.
75======================= =======================================================
76
77Error codes returned by ``in urb->status`` or in ``iso_frame_desc[n].status`` (for ISO)
78=======================================================================================
79
80USB device drivers may only test urb status values in completion handlers.
81This is because otherwise there would be a race between HCDs updating
82these values on one CPU, and device drivers testing them on another CPU.
83
84A transfer's actual_length may be positive even when an error has been
85reported. That's because transfers often involve several packets, so that
86one or more packets could finish before an error stops further endpoint I/O.
87
88For isochronous URBs, the urb status value is non-zero only if the URB is
89unlinked, the device is removed, the host controller is disabled, or the total
90transferred length is less than the requested length and the
91``URB_SHORT_NOT_OK`` flag is set. Completion handlers for isochronous URBs
92should only see ``urb->status`` set to zero, ``-ENOENT``, ``-ECONNRESET``,
93``-ESHUTDOWN``, or ``-EREMOTEIO``. Individual frame descriptor status fields
94may report more status codes.
95
96
97=============================== ===============================================
980 Transfer completed successfully
99
100``-ENOENT`` URB was synchronously unlinked by
101 :c:func:`usb_unlink_urb`
102
103``-EINPROGRESS`` URB still pending, no results yet
104 (That is, if drivers see this it's a bug.)
105
106``-EPROTO`` [#f1]_, [#f2]_ a) bitstuff error
107 b) no response packet received within the
108 prescribed bus turn-around time
109 c) unknown USB error
110
111``-EILSEQ`` [#f1]_, [#f2]_ a) CRC mismatch
112 b) no response packet received within the
113 prescribed bus turn-around time
114 c) unknown USB error
115
116 Note that often the controller hardware does
117 not distinguish among cases a), b), and c), so
118 a driver cannot tell whether there was a
119 protocol error, a failure to respond (often
120 caused by device disconnect), or some other
121 fault.
122
123``-ETIME`` [#f2]_ No response packet received within the
124 prescribed bus turn-around time. This error
125 may instead be reported as
126 ``-EPROTO`` or ``-EILSEQ``.
127
128``-ETIMEDOUT`` Synchronous USB message functions use this code
129 to indicate timeout expired before the transfer
130 completed, and no other error was reported
131 by HC.
132
133``-EPIPE`` [#f2]_ Endpoint stalled. For non-control endpoints,
134 reset this status with
135 :c:func:`usb_clear_halt`.
136
137``-ECOMM`` During an IN transfer, the host controller
138 received data from an endpoint faster than it
139 could be written to system memory
140
141``-ENOSR`` During an OUT transfer, the host controller
142 could not retrieve data from system memory fast
143 enough to keep up with the USB data rate
144
145``-EOVERFLOW`` [#f1]_ The amount of data returned by the endpoint was
146 greater than either the max packet size of the
147 endpoint or the remaining buffer size.
148 "Babble".
149
150``-EREMOTEIO`` The data read from the endpoint did not fill
151 the specified buffer, and ``URB_SHORT_NOT_OK``
152 was set in ``urb->transfer_flags``.
153
154``-ENODEV`` Device was removed. Often preceded by a burst
155 of other errors, since the hub driver doesn't
156 detect device removal events immediately.
157
158``-EXDEV`` ISO transfer only partially completed
159 (only set in ``iso_frame_desc[n].status``,
160 not ``urb->status``)
161
162``-EINVAL`` ISO madness, if this happens: Log off and
163 go home
164
165``-ECONNRESET`` URB was asynchronously unlinked by
166 :c:func:`usb_unlink_urb`
167
168``-ESHUTDOWN`` The device or host controller has been
169 disabled due to some problem that could not
170 be worked around, such as a physical
171 disconnect.
172=============================== ===============================================
173
174
175.. [#f1]
176
177 Error codes like ``-EPROTO``, ``-EILSEQ`` and ``-EOVERFLOW`` normally
178 indicate hardware problems such as bad devices (including firmware)
179 or cables.
180
181.. [#f2]
182
183 This is also one of several codes that different kinds of host
184 controller use to indicate a transfer has failed because of device
185 disconnect. In the interval before the hub driver starts disconnect
186 processing, devices may receive such fault reports for every request.
187
188
189
190Error codes returned by usbcore-functions
191=========================================
192
193.. note:: expect also other submit and transfer status codes
194
195:c:func:`usb_register`:
196
197======================= ===================================
198``-EINVAL`` error during registering new driver
199======================= ===================================
200
201``usb_get_*/usb_set_*()``,
202:c:func:`usb_control_msg`,
203:c:func:`usb_bulk_msg()`:
204
205======================= ==============================================
206``-ETIMEDOUT`` Timeout expired before the transfer completed.
207======================= ==============================================
diff --git a/Documentation/driver-api/usb/gadget.rst b/Documentation/driver-api/usb/gadget.rst
new file mode 100644
index 000000000000..3e8a3809c0b8
--- /dev/null
+++ b/Documentation/driver-api/usb/gadget.rst
@@ -0,0 +1,510 @@
1========================
2USB Gadget API for Linux
3========================
4
5:Author: David Brownell
6:Date: 20 August 2004
7
8Introduction
9============
10
11This document presents a Linux-USB "Gadget" kernel mode API, for use
12within peripherals and other USB devices that embed Linux. It provides
13an overview of the API structure, and shows how that fits into a system
14development project. This is the first such API released on Linux to
15address a number of important problems, including:
16
17- Supports USB 2.0, for high speed devices which can stream data at
18 several dozen megabytes per second.
19
20- Handles devices with dozens of endpoints just as well as ones with
21 just two fixed-function ones. Gadget drivers can be written so
22 they're easy to port to new hardware.
23
24- Flexible enough to expose more complex USB device capabilities such
25 as multiple configurations, multiple interfaces, composite devices,
26 and alternate interface settings.
27
28- USB "On-The-Go" (OTG) support, in conjunction with updates to the
29 Linux-USB host side.
30
31- Sharing data structures and API models with the Linux-USB host side
32 API. This helps the OTG support, and looks forward to more-symmetric
33 frameworks (where the same I/O model is used by both host and device
34 side drivers).
35
36- Minimalist, so it's easier to support new device controller hardware.
37 I/O processing doesn't imply large demands for memory or CPU
38 resources.
39
40Most Linux developers will not be able to use this API, since they have
41USB ``host`` hardware in a PC, workstation, or server. Linux users with
42embedded systems are more likely to have USB peripheral hardware. To
43distinguish drivers running inside such hardware from the more familiar
44Linux "USB device drivers", which are host side proxies for the real USB
45devices, a different term is used: the drivers inside the peripherals
46are "USB gadget drivers". In USB protocol interactions, the device
47driver is the master (or "client driver") and the gadget driver is the
48slave (or "function driver").
49
50The gadget API resembles the host side Linux-USB API in that both use
51queues of request objects to package I/O buffers, and those requests may
52be submitted or canceled. They share common definitions for the standard
53USB *Chapter 9* messages, structures, and constants. Also, both APIs
54bind and unbind drivers to devices. The APIs differ in detail, since the
55host side's current URB framework exposes a number of implementation
56details and assumptions that are inappropriate for a gadget API. While
57the model for control transfers and configuration management is
58necessarily different (one side is a hardware-neutral master, the other
59is a hardware-aware slave), the endpoint I/0 API used here should also
60be usable for an overhead-reduced host side API.
61
62Structure of Gadget Drivers
63===========================
64
65A system running inside a USB peripheral normally has at least three
66layers inside the kernel to handle USB protocol processing, and may have
67additional layers in user space code. The ``gadget`` API is used by the
68middle layer to interact with the lowest level (which directly handles
69hardware).
70
71In Linux, from the bottom up, these layers are:
72
73*USB Controller Driver*
74 This is the lowest software level. It is the only layer that talks
75 to hardware, through registers, fifos, dma, irqs, and the like. The
76 ``<linux/usb/gadget.h>`` API abstracts the peripheral controller
77 endpoint hardware. That hardware is exposed through endpoint
78 objects, which accept streams of IN/OUT buffers, and through
79 callbacks that interact with gadget drivers. Since normal USB
80 devices only have one upstream port, they only have one of these
81 drivers. The controller driver can support any number of different
82 gadget drivers, but only one of them can be used at a time.
83
84 Examples of such controller hardware include the PCI-based NetChip
85 2280 USB 2.0 high speed controller, the SA-11x0 or PXA-25x UDC
86 (found within many PDAs), and a variety of other products.
87
88*Gadget Driver*
89 The lower boundary of this driver implements hardware-neutral USB
90 functions, using calls to the controller driver. Because such
91 hardware varies widely in capabilities and restrictions, and is used
92 in embedded environments where space is at a premium, the gadget
93 driver is often configured at compile time to work with endpoints
94 supported by one particular controller. Gadget drivers may be
95 portable to several different controllers, using conditional
96 compilation. (Recent kernels substantially simplify the work
97 involved in supporting new hardware, by *autoconfiguring* endpoints
98 automatically for many bulk-oriented drivers.) Gadget driver
99 responsibilities include:
100
101 - handling setup requests (ep0 protocol responses) possibly
102 including class-specific functionality
103
104 - returning configuration and string descriptors
105
106 - (re)setting configurations and interface altsettings, including
107 enabling and configuring endpoints
108
109 - handling life cycle events, such as managing bindings to
110 hardware, USB suspend/resume, remote wakeup, and disconnection
111 from the USB host.
112
113 - managing IN and OUT transfers on all currently enabled endpoints
114
115 Such drivers may be modules of proprietary code, although that
116 approach is discouraged in the Linux community.
117
118*Upper Level*
119 Most gadget drivers have an upper boundary that connects to some
120 Linux driver or framework in Linux. Through that boundary flows the
121 data which the gadget driver produces and/or consumes through
122 protocol transfers over USB. Examples include:
123
124 - user mode code, using generic (gadgetfs) or application specific
125 files in ``/dev``
126
127 - networking subsystem (for network gadgets, like the CDC Ethernet
128 Model gadget driver)
129
130 - data capture drivers, perhaps video4Linux or a scanner driver; or
131 test and measurement hardware.
132
133 - input subsystem (for HID gadgets)
134
135 - sound subsystem (for audio gadgets)
136
137 - file system (for PTP gadgets)
138
139 - block i/o subsystem (for usb-storage gadgets)
140
141 - ... and more
142
143*Additional Layers*
144 Other layers may exist. These could include kernel layers, such as
145 network protocol stacks, as well as user mode applications building
146 on standard POSIX system call APIs such as ``open()``, ``close()``,
147 ``read()`` and ``write()``. On newer systems, POSIX Async I/O calls may
148 be an option. Such user mode code will not necessarily be subject to
149 the GNU General Public License (GPL).
150
151OTG-capable systems will also need to include a standard Linux-USB host
152side stack, with ``usbcore``, one or more *Host Controller Drivers*
153(HCDs), *USB Device Drivers* to support the OTG "Targeted Peripheral
154List", and so forth. There will also be an *OTG Controller Driver*,
155which is visible to gadget and device driver developers only indirectly.
156That helps the host and device side USB controllers implement the two
157new OTG protocols (HNP and SRP). Roles switch (host to peripheral, or
158vice versa) using HNP during USB suspend processing, and SRP can be
159viewed as a more battery-friendly kind of device wakeup protocol.
160
161Over time, reusable utilities are evolving to help make some gadget
162driver tasks simpler. For example, building configuration descriptors
163from vectors of descriptors for the configurations interfaces and
164endpoints is now automated, and many drivers now use autoconfiguration
165to choose hardware endpoints and initialize their descriptors. A
166potential example of particular interest is code implementing standard
167USB-IF protocols for HID, networking, storage, or audio classes. Some
168developers are interested in KDB or KGDB hooks, to let target hardware
169be remotely debugged. Most such USB protocol code doesn't need to be
170hardware-specific, any more than network protocols like X11, HTTP, or
171NFS are. Such gadget-side interface drivers should eventually be
172combined, to implement composite devices.
173
174Kernel Mode Gadget API
175======================
176
177Gadget drivers declare themselves through a struct
178:c:type:`usb_gadget_driver`, which is responsible for most parts of enumeration
179for a struct :c:type:`usb_gadget`. The response to a set_configuration usually
180involves enabling one or more of the struct :c:type:`usb_ep` objects exposed by
181the gadget, and submitting one or more struct :c:type:`usb_request` buffers to
182transfer data. Understand those four data types, and their operations,
183and you will understand how this API works.
184
185.. Note::
186
187 Other than the "Chapter 9" data types, most of the significant data
188 types and functions are described here.
189
190 However, some relevant information is likely omitted from what you
191 are reading. One example of such information is endpoint
192 autoconfiguration. You'll have to read the header file, and use
193 example source code (such as that for "Gadget Zero"), to fully
194 understand the API.
195
196 The part of the API implementing some basic driver capabilities is
197 specific to the version of the Linux kernel that's in use. The 2.6
198 and upper kernel versions include a *driver model* framework that has
199 no analogue on earlier kernels; so those parts of the gadget API are
200 not fully portable. (They are implemented on 2.4 kernels, but in a
201 different way.) The driver model state is another part of this API that is
202 ignored by the kerneldoc tools.
203
204The core API does not expose every possible hardware feature, only the
205most widely available ones. There are significant hardware features,
206such as device-to-device DMA (without temporary storage in a memory
207buffer) that would be added using hardware-specific APIs.
208
209This API allows drivers to use conditional compilation to handle
210endpoint capabilities of different hardware, but doesn't require that.
211Hardware tends to have arbitrary restrictions, relating to transfer
212types, addressing, packet sizes, buffering, and availability. As a rule,
213such differences only matter for "endpoint zero" logic that handles
214device configuration and management. The API supports limited run-time
215detection of capabilities, through naming conventions for endpoints.
216Many drivers will be able to at least partially autoconfigure
217themselves. In particular, driver init sections will often have endpoint
218autoconfiguration logic that scans the hardware's list of endpoints to
219find ones matching the driver requirements (relying on those
220conventions), to eliminate some of the most common reasons for
221conditional compilation.
222
223Like the Linux-USB host side API, this API exposes the "chunky" nature
224of USB messages: I/O requests are in terms of one or more "packets", and
225packet boundaries are visible to drivers. Compared to RS-232 serial
226protocols, USB resembles synchronous protocols like HDLC (N bytes per
227frame, multipoint addressing, host as the primary station and devices as
228secondary stations) more than asynchronous ones (tty style: 8 data bits
229per frame, no parity, one stop bit). So for example the controller
230drivers won't buffer two single byte writes into a single two-byte USB
231IN packet, although gadget drivers may do so when they implement
232protocols where packet boundaries (and "short packets") are not
233significant.
234
235Driver Life Cycle
236-----------------
237
238Gadget drivers make endpoint I/O requests to hardware without needing to
239know many details of the hardware, but driver setup/configuration code
240needs to handle some differences. Use the API like this:
241
2421. Register a driver for the particular device side usb controller
243 hardware, such as the net2280 on PCI (USB 2.0), sa11x0 or pxa25x as
244 found in Linux PDAs, and so on. At this point the device is logically
245 in the USB ch9 initial state (``attached``), drawing no power and not
246 usable (since it does not yet support enumeration). Any host should
247 not see the device, since it's not activated the data line pullup
248 used by the host to detect a device, even if VBUS power is available.
249
2502. Register a gadget driver that implements some higher level device
251 function. That will then bind() to a :c:type:`usb_gadget`, which activates
252 the data line pullup sometime after detecting VBUS.
253
2543. The hardware driver can now start enumerating. The steps it handles
255 are to accept USB ``power`` and ``set_address`` requests. Other steps are
256 handled by the gadget driver. If the gadget driver module is unloaded
257 before the host starts to enumerate, steps before step 7 are skipped.
258
2594. The gadget driver's ``setup()`` call returns usb descriptors, based both
260 on what the bus interface hardware provides and on the functionality
261 being implemented. That can involve alternate settings or
262 configurations, unless the hardware prevents such operation. For OTG
263 devices, each configuration descriptor includes an OTG descriptor.
264
2655. The gadget driver handles the last step of enumeration, when the USB
266 host issues a ``set_configuration`` call. It enables all endpoints used
267 in that configuration, with all interfaces in their default settings.
268 That involves using a list of the hardware's endpoints, enabling each
269 endpoint according to its descriptor. It may also involve using
270 ``usb_gadget_vbus_draw`` to let more power be drawn from VBUS, as
271 allowed by that configuration. For OTG devices, setting a
272 configuration may also involve reporting HNP capabilities through a
273 user interface.
274
2756. Do real work and perform data transfers, possibly involving changes
276 to interface settings or switching to new configurations, until the
277 device is disconnect()ed from the host. Queue any number of transfer
278 requests to each endpoint. It may be suspended and resumed several
279 times before being disconnected. On disconnect, the drivers go back
280 to step 3 (above).
281
2827. When the gadget driver module is being unloaded, the driver unbind()
283 callback is issued. That lets the controller driver be unloaded.
284
285Drivers will normally be arranged so that just loading the gadget driver
286module (or statically linking it into a Linux kernel) allows the
287peripheral device to be enumerated, but some drivers will defer
288enumeration until some higher level component (like a user mode daemon)
289enables it. Note that at this lowest level there are no policies about
290how ep0 configuration logic is implemented, except that it should obey
291USB specifications. Such issues are in the domain of gadget drivers,
292including knowing about implementation constraints imposed by some USB
293controllers or understanding that composite devices might happen to be
294built by integrating reusable components.
295
296Note that the lifecycle above can be slightly different for OTG devices.
297Other than providing an additional OTG descriptor in each configuration,
298only the HNP-related differences are particularly visible to driver
299code. They involve reporting requirements during the ``SET_CONFIGURATION``
300request, and the option to invoke HNP during some suspend callbacks.
301Also, SRP changes the semantics of ``usb_gadget_wakeup`` slightly.
302
303USB 2.0 Chapter 9 Types and Constants
304-------------------------------------
305
306Gadget drivers rely on common USB structures and constants defined in
307the :ref:`linux/usb/ch9.h <usb_chapter9>` header file, which is standard in
308Linux 2.6+ kernels. These are the same types and constants used by host side
309drivers (and usbcore).
310
311Core Objects and Methods
312------------------------
313
314These are declared in ``<linux/usb/gadget.h>``, and are used by gadget
315drivers to interact with USB peripheral controller drivers.
316
317.. kernel-doc:: include/linux/usb/gadget.h
318 :internal:
319
320Optional Utilities
321------------------
322
323The core API is sufficient for writing a USB Gadget Driver, but some
324optional utilities are provided to simplify common tasks. These
325utilities include endpoint autoconfiguration.
326
327.. kernel-doc:: drivers/usb/gadget/usbstring.c
328 :export:
329
330.. kernel-doc:: drivers/usb/gadget/config.c
331 :export:
332
333Composite Device Framework
334--------------------------
335
336The core API is sufficient for writing drivers for composite USB devices
337(with more than one function in a given configuration), and also
338multi-configuration devices (also more than one function, but not
339necessarily sharing a given configuration). There is however an optional
340framework which makes it easier to reuse and combine functions.
341
342Devices using this framework provide a struct :c:type:`usb_composite_driver`,
343which in turn provides one or more struct :c:type:`usb_configuration`
344instances. Each such configuration includes at least one struct
345:c:type:`usb_function`, which packages a user visible role such as "network
346link" or "mass storage device". Management functions may also exist,
347such as "Device Firmware Upgrade".
348
349.. kernel-doc:: include/linux/usb/composite.h
350 :internal:
351
352.. kernel-doc:: drivers/usb/gadget/composite.c
353 :export:
354
355Composite Device Functions
356--------------------------
357
358At this writing, a few of the current gadget drivers have been converted
359to this framework. Near-term plans include converting all of them,
360except for ``gadgetfs``.
361
362Peripheral Controller Drivers
363=============================
364
365The first hardware supporting this API was the NetChip 2280 controller,
366which supports USB 2.0 high speed and is based on PCI. This is the
367``net2280`` driver module. The driver supports Linux kernel versions 2.4
368and 2.6; contact NetChip Technologies for development boards and product
369information.
370
371Other hardware working in the ``gadget`` framework includes: Intel's PXA
37225x and IXP42x series processors (``pxa2xx_udc``), Toshiba TC86c001
373"Goku-S" (``goku_udc``), Renesas SH7705/7727 (``sh_udc``), MediaQ 11xx
374(``mq11xx_udc``), Hynix HMS30C7202 (``h7202_udc``), National 9303/4
375(``n9604_udc``), Texas Instruments OMAP (``omap_udc``), Sharp LH7A40x
376(``lh7a40x_udc``), and more. Most of those are full speed controllers.
377
378At this writing, there are people at work on drivers in this framework
379for several other USB device controllers, with plans to make many of
380them be widely available.
381
382A partial USB simulator, the ``dummy_hcd`` driver, is available. It can
383act like a net2280, a pxa25x, or an sa11x0 in terms of available
384endpoints and device speeds; and it simulates control, bulk, and to some
385extent interrupt transfers. That lets you develop some parts of a gadget
386driver on a normal PC, without any special hardware, and perhaps with
387the assistance of tools such as GDB running with User Mode Linux. At
388least one person has expressed interest in adapting that approach,
389hooking it up to a simulator for a microcontroller. Such simulators can
390help debug subsystems where the runtime hardware is unfriendly to
391software development, or is not yet available.
392
393Support for other controllers is expected to be developed and
394contributed over time, as this driver framework evolves.
395
396Gadget Drivers
397==============
398
399In addition to *Gadget Zero* (used primarily for testing and development
400with drivers for usb controller hardware), other gadget drivers exist.
401
402There's an ``ethernet`` gadget driver, which implements one of the most
403useful *Communications Device Class* (CDC) models. One of the standards
404for cable modem interoperability even specifies the use of this ethernet
405model as one of two mandatory options. Gadgets using this code look to a
406USB host as if they're an Ethernet adapter. It provides access to a
407network where the gadget's CPU is one host, which could easily be
408bridging, routing, or firewalling access to other networks. Since some
409hardware can't fully implement the CDC Ethernet requirements, this
410driver also implements a "good parts only" subset of CDC Ethernet. (That
411subset doesn't advertise itself as CDC Ethernet, to avoid creating
412problems.)
413
414Support for Microsoft's ``RNDIS`` protocol has been contributed by
415Pengutronix and Auerswald GmbH. This is like CDC Ethernet, but it runs
416on more slightly USB hardware (but less than the CDC subset). However,
417its main claim to fame is being able to connect directly to recent
418versions of Windows, using drivers that Microsoft bundles and supports,
419making it much simpler to network with Windows.
420
421There is also support for user mode gadget drivers, using ``gadgetfs``.
422This provides a *User Mode API* that presents each endpoint as a single
423file descriptor. I/O is done using normal ``read()`` and ``read()`` calls.
424Familiar tools like GDB and pthreads can be used to develop and debug
425user mode drivers, so that once a robust controller driver is available
426many applications for it won't require new kernel mode software. Linux
4272.6 *Async I/O (AIO)* support is available, so that user mode software
428can stream data with only slightly more overhead than a kernel driver.
429
430There's a USB Mass Storage class driver, which provides a different
431solution for interoperability with systems such as MS-Windows and MacOS.
432That *Mass Storage* driver uses a file or block device as backing store
433for a drive, like the ``loop`` driver. The USB host uses the BBB, CB, or
434CBI versions of the mass storage class specification, using transparent
435SCSI commands to access the data from the backing store.
436
437There's a "serial line" driver, useful for TTY style operation over USB.
438The latest version of that driver supports CDC ACM style operation, like
439a USB modem, and so on most hardware it can interoperate easily with
440MS-Windows. One interesting use of that driver is in boot firmware (like
441a BIOS), which can sometimes use that model with very small systems
442without real serial lines.
443
444Support for other kinds of gadget is expected to be developed and
445contributed over time, as this driver framework evolves.
446
447USB On-The-GO (OTG)
448===================
449
450USB OTG support on Linux 2.6 was initially developed by Texas
451Instruments for `OMAP <http://www.omap.com>`__ 16xx and 17xx series
452processors. Other OTG systems should work in similar ways, but the
453hardware level details could be very different.
454
455Systems need specialized hardware support to implement OTG, notably
456including a special *Mini-AB* jack and associated transceiver to support
457*Dual-Role* operation: they can act either as a host, using the standard
458Linux-USB host side driver stack, or as a peripheral, using this
459``gadget`` framework. To do that, the system software relies on small
460additions to those programming interfaces, and on a new internal
461component (here called an "OTG Controller") affecting which driver stack
462connects to the OTG port. In each role, the system can re-use the
463existing pool of hardware-neutral drivers, layered on top of the
464controller driver interfaces (:c:type:`usb_bus` or :c:type:`usb_gadget`).
465Such drivers need at most minor changes, and most of the calls added to
466support OTG can also benefit non-OTG products.
467
468- Gadget drivers test the ``is_otg`` flag, and use it to determine
469 whether or not to include an OTG descriptor in each of their
470 configurations.
471
472- Gadget drivers may need changes to support the two new OTG protocols,
473 exposed in new gadget attributes such as ``b_hnp_enable`` flag. HNP
474 support should be reported through a user interface (two LEDs could
475 suffice), and is triggered in some cases when the host suspends the
476 peripheral. SRP support can be user-initiated just like remote
477 wakeup, probably by pressing the same button.
478
479- On the host side, USB device drivers need to be taught to trigger HNP
480 at appropriate moments, using ``usb_suspend_device()``. That also
481 conserves battery power, which is useful even for non-OTG
482 configurations.
483
484- Also on the host side, a driver must support the OTG "Targeted
485 Peripheral List". That's just a whitelist, used to reject peripherals
486 not supported with a given Linux OTG host. *This whitelist is
487 product-specific; each product must modify* ``otg_whitelist.h`` *to
488 match its interoperability specification.*
489
490 Non-OTG Linux hosts, like PCs and workstations, normally have some
491 solution for adding drivers, so that peripherals that aren't
492 recognized can eventually be supported. That approach is unreasonable
493 for consumer products that may never have their firmware upgraded,
494 and where it's usually unrealistic to expect traditional
495 PC/workstation/server kinds of support model to work. For example,
496 it's often impractical to change device firmware once the product has
497 been distributed, so driver bugs can't normally be fixed if they're
498 found after shipment.
499
500Additional changes are needed below those hardware-neutral :c:type:`usb_bus`
501and :c:type:`usb_gadget` driver interfaces; those aren't discussed here in any
502detail. Those affect the hardware-specific code for each USB Host or
503Peripheral controller, and how the HCD initializes (since OTG can be
504active only on a single port). They also involve what may be called an
505*OTG Controller Driver*, managing the OTG transceiver and the OTG state
506machine logic as well as much of the root hub behavior for the OTG port.
507The OTG controller driver needs to activate and deactivate USB
508controllers depending on the relevant device role. Some related changes
509were needed inside usbcore, so that it can identify OTG-capable devices
510and respond appropriately to HNP or SRP protocols.
diff --git a/Documentation/usb/hotplug.txt b/Documentation/driver-api/usb/hotplug.rst
index 5b243f315b2c..79663e653ca1 100644
--- a/Documentation/usb/hotplug.txt
+++ b/Documentation/driver-api/usb/hotplug.rst
@@ -1,4 +1,9 @@
1LINUX HOTPLUGGING 1USB hotplugging
2~~~~~~~~~~~~~~~
3
4Linux Hotplugging
5=================
6
2 7
3In hotpluggable busses like USB (and Cardbus PCI), end-users plug devices 8In hotpluggable busses like USB (and Cardbus PCI), end-users plug devices
4into the bus with power on. In most cases, users expect the devices to become 9into the bus with power on. In most cases, users expect the devices to become
@@ -30,11 +35,11 @@ Because some of those actions rely on information about drivers (metadata)
30that is currently available only when the drivers are dynamically linked, 35that is currently available only when the drivers are dynamically linked,
31you get the best hotplugging when you configure a highly modular system. 36you get the best hotplugging when you configure a highly modular system.
32 37
38Kernel Hotplug Helper (``/sbin/hotplug``)
39=========================================
33 40
34KERNEL HOTPLUG HELPER (/sbin/hotplug) 41There is a kernel parameter: ``/proc/sys/kernel/hotplug``, which normally
35 42holds the pathname ``/sbin/hotplug``. That parameter names a program
36There is a kernel parameter: /proc/sys/kernel/hotplug, which normally
37holds the pathname "/sbin/hotplug". That parameter names a program
38which the kernel may invoke at various times. 43which the kernel may invoke at various times.
39 44
40The /sbin/hotplug program can be invoked by any subsystem as part of its 45The /sbin/hotplug program can be invoked by any subsystem as part of its
@@ -51,26 +56,26 @@ Hotplug software and other resources is available at:
51Mailing list information is also available at that site. 56Mailing list information is also available at that site.
52 57
53 58
54-------------------------------------------------------------------------- 59USB Policy Agent
55 60================
56 61
57USB POLICY AGENT 62The USB subsystem currently invokes ``/sbin/hotplug`` when USB devices
58
59The USB subsystem currently invokes /sbin/hotplug when USB devices
60are added or removed from system. The invocation is done by the kernel 63are added or removed from system. The invocation is done by the kernel
61hub workqueue [hub_wq], or else as part of root hub initialization 64hub workqueue [hub_wq], or else as part of root hub initialization
62(done by init, modprobe, kapmd, etc). Its single command line parameter 65(done by init, modprobe, kapmd, etc). Its single command line parameter
63is the string "usb", and it passes these environment variables: 66is the string "usb", and it passes these environment variables:
64 67
65 ACTION ... "add", "remove" 68========== ============================================
66 PRODUCT ... USB vendor, product, and version codes (hex) 69ACTION ``add``, ``remove``
67 TYPE ... device class codes (decimal) 70PRODUCT USB vendor, product, and version codes (hex)
68 INTERFACE ... interface 0 class codes (decimal) 71TYPE device class codes (decimal)
72INTERFACE interface 0 class codes (decimal)
73========== ============================================
69 74
70If "usbdevfs" is configured, DEVICE and DEVFS are also passed. DEVICE is 75If "usbdevfs" is configured, DEVICE and DEVFS are also passed. DEVICE is
71the pathname of the device, and is useful for devices with multiple and/or 76the pathname of the device, and is useful for devices with multiple and/or
72alternate interfaces that complicate driver selection. By design, USB 77alternate interfaces that complicate driver selection. By design, USB
73hotplugging is independent of "usbdevfs": you can do most essential parts 78hotplugging is independent of ``usbdevfs``: you can do most essential parts
74of USB device setup without using that filesystem, and without running a 79of USB device setup without using that filesystem, and without running a
75user mode daemon to detect changes in system configuration. 80user mode daemon to detect changes in system configuration.
76 81
@@ -79,19 +84,20 @@ modules, and can invoke driver-specific setup scripts. The newest ones
79leverage USB module-init-tools support. Later agents might unload drivers. 84leverage USB module-init-tools support. Later agents might unload drivers.
80 85
81 86
82USB MODUTILS SUPPORT 87USB Modutils Support
88====================
83 89
84Current versions of module-init-tools will create a "modules.usbmap" file 90Current versions of module-init-tools will create a ``modules.usbmap`` file
85which contains the entries from each driver's MODULE_DEVICE_TABLE. Such 91which contains the entries from each driver's ``MODULE_DEVICE_TABLE``. Such
86files can be used by various user mode policy agents to make sure all the 92files can be used by various user mode policy agents to make sure all the
87right driver modules get loaded, either at boot time or later. 93right driver modules get loaded, either at boot time or later.
88 94
89See <linux/usb.h> for full information about such table entries; or look 95See ``linux/usb.h`` for full information about such table entries; or look
90at existing drivers. Each table entry describes one or more criteria to 96at existing drivers. Each table entry describes one or more criteria to
91be used when matching a driver to a device or class of devices. The 97be used when matching a driver to a device or class of devices. The
92specific criteria are identified by bits set in "match_flags", paired 98specific criteria are identified by bits set in "match_flags", paired
93with field values. You can construct the criteria directly, or with 99with field values. You can construct the criteria directly, or with
94macros such as these, and use driver_info to store more information. 100macros such as these, and use driver_info to store more information::
95 101
96 USB_DEVICE (vendorId, productId) 102 USB_DEVICE (vendorId, productId)
97 ... matching devices with specified vendor and product ids 103 ... matching devices with specified vendor and product ids
@@ -103,7 +109,7 @@ macros such as these, and use driver_info to store more information.
103 ... matching specified device class info 109 ... matching specified device class info
104 110
105A short example, for a driver that supports several specific USB devices 111A short example, for a driver that supports several specific USB devices
106and their quirks, might have a MODULE_DEVICE_TABLE like this: 112and their quirks, might have a MODULE_DEVICE_TABLE like this::
107 113
108 static const struct usb_device_id mydriver_id_table[] = { 114 static const struct usb_device_id mydriver_id_table[] = {
109 { USB_DEVICE (0x9999, 0xaaaa), driver_info: QUIRK_X }, 115 { USB_DEVICE (0x9999, 0xaaaa), driver_info: QUIRK_X },
@@ -116,10 +122,10 @@ and their quirks, might have a MODULE_DEVICE_TABLE like this:
116Most USB device drivers should pass these tables to the USB subsystem as 122Most USB device drivers should pass these tables to the USB subsystem as
117well as to the module management subsystem. Not all, though: some driver 123well as to the module management subsystem. Not all, though: some driver
118frameworks connect using interfaces layered over USB, and so they won't 124frameworks connect using interfaces layered over USB, and so they won't
119need such a "struct usb_driver". 125need such a struct :c:type:`usb_driver`.
120 126
121Drivers that connect directly to the USB subsystem should be declared 127Drivers that connect directly to the USB subsystem should be declared
122something like this: 128something like this::
123 129
124 static struct usb_driver mydriver = { 130 static struct usb_driver mydriver = {
125 .name = "mydriver", 131 .name = "mydriver",
@@ -138,11 +144,11 @@ something like this:
138 144
139When the USB subsystem knows about a driver's device ID table, it's used when 145When the USB subsystem knows about a driver's device ID table, it's used when
140choosing drivers to probe(). The thread doing new device processing checks 146choosing drivers to probe(). The thread doing new device processing checks
141drivers' device ID entries from the MODULE_DEVICE_TABLE against interface and 147drivers' device ID entries from the ``MODULE_DEVICE_TABLE`` against interface
142device descriptors for the device. It will only call probe() if there is a 148and device descriptors for the device. It will only call ``probe()`` if there
143match, and the third argument to probe() will be the entry that matched. 149is a match, and the third argument to ``probe()`` will be the entry that
144 150matched.
145If you don't provide an id_table for your driver, then your driver may get 151
146probed for each new device; the third parameter to probe() will be null. 152If you don't provide an ``id_table`` for your driver, then your driver may get
147 153probed for each new device; the third parameter to ``probe()`` will be
148 154``NULL``.
diff --git a/Documentation/driver-api/usb/index.rst b/Documentation/driver-api/usb/index.rst
new file mode 100644
index 000000000000..1bf64edc8c8a
--- /dev/null
+++ b/Documentation/driver-api/usb/index.rst
@@ -0,0 +1,26 @@
1=============
2Linux USB API
3=============
4
5.. toctree::
6
7 usb
8 gadget
9 anchors
10 bulk-streams
11 callbacks
12 dma
13 URB
14 power-management
15 hotplug
16 persist
17 error-codes
18 writing_usb_driver
19 writing_musb_glue_layer
20
21.. only:: subproject and html
22
23 Indices
24 =======
25
26 * :ref:`genindex`
diff --git a/Documentation/usb/persist.txt b/Documentation/driver-api/usb/persist.rst
index 35d70eda9ad6..08cafc6292c1 100644
--- a/Documentation/usb/persist.txt
+++ b/Documentation/driver-api/usb/persist.rst
@@ -1,11 +1,14 @@
1 USB device persistence during system suspend 1.. _usb-persist:
2 2
3 Alan Stern <stern@rowland.harvard.edu> 3USB device persistence during system suspend
4~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 5
5 September 2, 2006 (Updated February 25, 2008) 6:Author: Alan Stern <stern@rowland.harvard.edu>
7:Date: September 2, 2006 (Updated February 25, 2008)
6 8
7 9
8 What is the problem? 10What is the problem?
11====================
9 12
10According to the USB specification, when a USB bus is suspended the 13According to the USB specification, when a USB bus is suspended the
11bus must continue to supply suspend current (around 1-5 mA). This 14bus must continue to supply suspend current (around 1-5 mA). This
@@ -63,7 +66,8 @@ suspended -- but it will crash as soon as it wakes up, which isn't
63much better.) 66much better.)
64 67
65 68
66 What is the solution? 69What is the solution?
70=====================
67 71
68The kernel includes a feature called USB-persist. It tries to work 72The kernel includes a feature called USB-persist. It tries to work
69around these issues by allowing the core USB device data structures to 73around these issues by allowing the core USB device data structures to
@@ -99,7 +103,7 @@ now a good and happy place.
99 103
100Note that the "USB-persist" feature will be applied only to those 104Note that the "USB-persist" feature will be applied only to those
101devices for which it is enabled. You can enable the feature by doing 105devices for which it is enabled. You can enable the feature by doing
102(as root): 106(as root)::
103 107
104 echo 1 >/sys/bus/usb/devices/.../power/persist 108 echo 1 >/sys/bus/usb/devices/.../power/persist
105 109
@@ -110,7 +114,8 @@ doesn't even exist, so you only have to worry about setting it for
110devices where it really matters. 114devices where it really matters.
111 115
112 116
113 Is this the best solution? 117Is this the best solution?
118==========================
114 119
115Perhaps not. Arguably, keeping track of mounted filesystems and 120Perhaps not. Arguably, keeping track of mounted filesystems and
116memory mappings across device disconnects should be handled by a 121memory mappings across device disconnects should be handled by a
@@ -130,7 +135,8 @@ just mass-storage devices. It might turn out to be equally useful for
130other device types, such as network interfaces. 135other device types, such as network interfaces.
131 136
132 137
133 WARNING: USB-persist can be dangerous!! 138WARNING: USB-persist can be dangerous!!
139=======================================
134 140
135When recovering an interrupted power session the kernel does its best 141When recovering an interrupted power session the kernel does its best
136to make sure the USB device hasn't been changed; that is, the same 142to make sure the USB device hasn't been changed; that is, the same
diff --git a/Documentation/usb/power-management.txt b/Documentation/driver-api/usb/power-management.rst
index 00e706997130..79beb807996b 100644
--- a/Documentation/usb/power-management.txt
+++ b/Documentation/driver-api/usb/power-management.rst
@@ -1,10 +1,12 @@
1 Power Management for USB 1.. _usb-power-management:
2 2
3 Alan Stern <stern@rowland.harvard.edu> 3Power Management for USB
4 4~~~~~~~~~~~~~~~~~~~~~~~~
5 Last-updated: February 2014
6 5
6:Author: Alan Stern <stern@rowland.harvard.edu>
7:Date: Last-updated: February 2014
7 8
9..
8 Contents: 10 Contents:
9 --------- 11 ---------
10 * What is Power Management? 12 * What is Power Management?
@@ -25,14 +27,14 @@
25 * Suggested Userspace Port Power Policy 27 * Suggested Userspace Port Power Policy
26 28
27 29
28 What is Power Management? 30What is Power Management?
29 ------------------------- 31-------------------------
30 32
31Power Management (PM) is the practice of saving energy by suspending 33Power Management (PM) is the practice of saving energy by suspending
32parts of a computer system when they aren't being used. While a 34parts of a computer system when they aren't being used. While a
33component is "suspended" it is in a nonfunctional low-power state; it 35component is ``suspended`` it is in a nonfunctional low-power state; it
34might even be turned off completely. A suspended component can be 36might even be turned off completely. A suspended component can be
35"resumed" (returned to a functional full-power state) when the kernel 37``resumed`` (returned to a functional full-power state) when the kernel
36needs to use it. (There also are forms of PM in which components are 38needs to use it. (There also are forms of PM in which components are
37placed in a less functional but still usable state instead of being 39placed in a less functional but still usable state instead of being
38suspended; an example would be reducing the CPU's clock rate. This 40suspended; an example would be reducing the CPU's clock rate. This
@@ -44,22 +46,25 @@ device is turned off while the system as a whole remains running, we
44call it a "dynamic suspend" (also known as a "runtime suspend" or 46call it a "dynamic suspend" (also known as a "runtime suspend" or
45"selective suspend"). This document concentrates mostly on how 47"selective suspend"). This document concentrates mostly on how
46dynamic PM is implemented in the USB subsystem, although system PM is 48dynamic PM is implemented in the USB subsystem, although system PM is
47covered to some extent (see Documentation/power/*.txt for more 49covered to some extent (see ``Documentation/power/*.txt`` for more
48information about system PM). 50information about system PM).
49 51
50System PM support is present only if the kernel was built with CONFIG_SUSPEND 52System PM support is present only if the kernel was built with
51or CONFIG_HIBERNATION enabled. Dynamic PM support for USB is present whenever 53``CONFIG_SUSPEND`` or ``CONFIG_HIBERNATION`` enabled. Dynamic PM support
52the kernel was built with CONFIG_PM enabled. 54
55for USB is present whenever
56the kernel was built with ``CONFIG_PM`` enabled.
53 57
54[Historically, dynamic PM support for USB was present only if the 58[Historically, dynamic PM support for USB was present only if the
55kernel had been built with CONFIG_USB_SUSPEND enabled (which depended on 59kernel had been built with ``CONFIG_USB_SUSPEND`` enabled (which depended on
56CONFIG_PM_RUNTIME). Starting with the 3.10 kernel release, dynamic PM support 60``CONFIG_PM_RUNTIME``). Starting with the 3.10 kernel release, dynamic PM
57for USB was present whenever the kernel was built with CONFIG_PM_RUNTIME 61support for USB was present whenever the kernel was built with
58enabled. The CONFIG_USB_SUSPEND option had been eliminated.] 62``CONFIG_PM_RUNTIME`` enabled. The ``CONFIG_USB_SUSPEND`` option had been
63eliminated.]
59 64
60 65
61 What is Remote Wakeup? 66What is Remote Wakeup?
62 ---------------------- 67----------------------
63 68
64When a device has been suspended, it generally doesn't resume until 69When a device has been suspended, it generally doesn't resume until
65the computer tells it to. Likewise, if the entire computer has been 70the computer tells it to. Likewise, if the entire computer has been
@@ -76,8 +81,8 @@ event. Examples include a suspended keyboard resuming when a key is
76pressed, or a suspended USB hub resuming when a device is plugged in. 81pressed, or a suspended USB hub resuming when a device is plugged in.
77 82
78 83
79 When is a USB device idle? 84When is a USB device idle?
80 -------------------------- 85--------------------------
81 86
82A device is idle whenever the kernel thinks it's not busy doing 87A device is idle whenever the kernel thinks it's not busy doing
83anything important and thus is a candidate for being suspended. The 88anything important and thus is a candidate for being suspended. The
@@ -92,11 +97,11 @@ If a USB device has no driver, its usbfs file isn't open, and it isn't
92being accessed through sysfs, then it definitely is idle. 97being accessed through sysfs, then it definitely is idle.
93 98
94 99
95 Forms of dynamic PM 100Forms of dynamic PM
96 ------------------- 101-------------------
97 102
98Dynamic suspends occur when the kernel decides to suspend an idle 103Dynamic suspends occur when the kernel decides to suspend an idle
99device. This is called "autosuspend" for short. In general, a device 104device. This is called ``autosuspend`` for short. In general, a device
100won't be autosuspended unless it has been idle for some minimum period 105won't be autosuspended unless it has been idle for some minimum period
101of time, the so-called idle-delay time. 106of time, the so-called idle-delay time.
102 107
@@ -125,51 +130,51 @@ all dynamic suspend events are internal; external agents are not
125allowed to issue dynamic suspends. 130allowed to issue dynamic suspends.
126 131
127 132
128 The user interface for dynamic PM 133The user interface for dynamic PM
129 --------------------------------- 134---------------------------------
130 135
131The user interface for controlling dynamic PM is located in the power/ 136The user interface for controlling dynamic PM is located in the ``power/``
132subdirectory of each USB device's sysfs directory, that is, in 137subdirectory of each USB device's sysfs directory, that is, in
133/sys/bus/usb/devices/.../power/ where "..." is the device's ID. The 138``/sys/bus/usb/devices/.../power/`` where "..." is the device's ID. The
134relevant attribute files are: wakeup, control, and 139relevant attribute files are: wakeup, control, and
135autosuspend_delay_ms. (There may also be a file named "level"; this 140``autosuspend_delay_ms``. (There may also be a file named ``level``; this
136file was deprecated as of the 2.6.35 kernel and replaced by the 141file was deprecated as of the 2.6.35 kernel and replaced by the
137"control" file. In 2.6.38 the "autosuspend" file will be deprecated 142``control`` file. In 2.6.38 the ``autosuspend`` file will be deprecated
138and replaced by the "autosuspend_delay_ms" file. The only difference 143and replaced by the ``autosuspend_delay_ms`` file. The only difference
139is that the newer file expresses the delay in milliseconds whereas the 144is that the newer file expresses the delay in milliseconds whereas the
140older file uses seconds. Confusingly, both files are present in 2.6.37 145older file uses seconds. Confusingly, both files are present in 2.6.37
141but only "autosuspend" works.) 146but only ``autosuspend`` works.)
142 147
143 power/wakeup 148 ``power/wakeup``
144 149
145 This file is empty if the device does not support 150 This file is empty if the device does not support
146 remote wakeup. Otherwise the file contains either the 151 remote wakeup. Otherwise the file contains either the
147 word "enabled" or the word "disabled", and you can 152 word ``enabled`` or the word ``disabled``, and you can
148 write those words to the file. The setting determines 153 write those words to the file. The setting determines
149 whether or not remote wakeup will be enabled when the 154 whether or not remote wakeup will be enabled when the
150 device is next suspended. (If the setting is changed 155 device is next suspended. (If the setting is changed
151 while the device is suspended, the change won't take 156 while the device is suspended, the change won't take
152 effect until the following suspend.) 157 effect until the following suspend.)
153 158
154 power/control 159 ``power/control``
155 160
156 This file contains one of two words: "on" or "auto". 161 This file contains one of two words: ``on`` or ``auto``.
157 You can write those words to the file to change the 162 You can write those words to the file to change the
158 device's setting. 163 device's setting.
159 164
160 "on" means that the device should be resumed and 165 - ``on`` means that the device should be resumed and
161 autosuspend is not allowed. (Of course, system 166 autosuspend is not allowed. (Of course, system
162 suspends are still allowed.) 167 suspends are still allowed.)
163 168
164 "auto" is the normal state in which the kernel is 169 - ``auto`` is the normal state in which the kernel is
165 allowed to autosuspend and autoresume the device. 170 allowed to autosuspend and autoresume the device.
166 171
167 (In kernels up to 2.6.32, you could also specify 172 (In kernels up to 2.6.32, you could also specify
168 "suspend", meaning that the device should remain 173 ``suspend``, meaning that the device should remain
169 suspended and autoresume was not allowed. This 174 suspended and autoresume was not allowed. This
170 setting is no longer supported.) 175 setting is no longer supported.)
171 176
172 power/autosuspend_delay_ms 177 ``power/autosuspend_delay_ms``
173 178
174 This file contains an integer value, which is the 179 This file contains an integer value, which is the
175 number of milliseconds the device should remain idle 180 number of milliseconds the device should remain idle
@@ -180,31 +185,31 @@ but only "autosuspend" works.)
180 number to the file to change the autosuspend 185 number to the file to change the autosuspend
181 idle-delay time. 186 idle-delay time.
182 187
183Writing "-1" to power/autosuspend_delay_ms and writing "on" to 188Writing ``-1`` to ``power/autosuspend_delay_ms`` and writing ``on`` to
184power/control do essentially the same thing -- they both prevent the 189``power/control`` do essentially the same thing -- they both prevent the
185device from being autosuspended. Yes, this is a redundancy in the 190device from being autosuspended. Yes, this is a redundancy in the
186API. 191API.
187 192
188(In 2.6.21 writing "0" to power/autosuspend would prevent the device 193(In 2.6.21 writing ``0`` to ``power/autosuspend`` would prevent the device
189from being autosuspended; the behavior was changed in 2.6.22. The 194from being autosuspended; the behavior was changed in 2.6.22. The
190power/autosuspend attribute did not exist prior to 2.6.21, and the 195``power/autosuspend`` attribute did not exist prior to 2.6.21, and the
191power/level attribute did not exist prior to 2.6.22. power/control 196``power/level`` attribute did not exist prior to 2.6.22. ``power/control``
192was added in 2.6.34, and power/autosuspend_delay_ms was added in 197was added in 2.6.34, and ``power/autosuspend_delay_ms`` was added in
1932.6.37 but did not become functional until 2.6.38.) 1982.6.37 but did not become functional until 2.6.38.)
194 199
195 200
196 Changing the default idle-delay time 201Changing the default idle-delay time
197 ------------------------------------ 202------------------------------------
198 203
199The default autosuspend idle-delay time (in seconds) is controlled by 204The default autosuspend idle-delay time (in seconds) is controlled by
200a module parameter in usbcore. You can specify the value when usbcore 205a module parameter in usbcore. You can specify the value when usbcore
201is loaded. For example, to set it to 5 seconds instead of 2 you would 206is loaded. For example, to set it to 5 seconds instead of 2 you would
202do: 207do::
203 208
204 modprobe usbcore autosuspend=5 209 modprobe usbcore autosuspend=5
205 210
206Equivalently, you could add to a configuration file in /etc/modprobe.d 211Equivalently, you could add to a configuration file in /etc/modprobe.d
207a line saying: 212a line saying::
208 213
209 options usbcore autosuspend=5 214 options usbcore autosuspend=5
210 215
@@ -214,14 +219,14 @@ image. To alter the parameter value you would have to rebuild that
214image. 219image.
215 220
216If usbcore is compiled into the kernel rather than built as a loadable 221If usbcore is compiled into the kernel rather than built as a loadable
217module, you can add 222module, you can add::
218 223
219 usbcore.autosuspend=5 224 usbcore.autosuspend=5
220 225
221to the kernel's boot command line. 226to the kernel's boot command line.
222 227
223Finally, the parameter value can be changed while the system is 228Finally, the parameter value can be changed while the system is
224running. If you do: 229running. If you do::
225 230
226 echo 5 >/sys/module/usbcore/parameters/autosuspend 231 echo 5 >/sys/module/usbcore/parameters/autosuspend
227 232
@@ -234,8 +239,8 @@ autosuspend of any USB device. This has the benefit of allowing you
234then to enable autosuspend for selected devices. 239then to enable autosuspend for selected devices.
235 240
236 241
237 Warnings 242Warnings
238 -------- 243--------
239 244
240The USB specification states that all USB devices must support power 245The USB specification states that all USB devices must support power
241management. Nevertheless, the sad fact is that many devices do not 246management. Nevertheless, the sad fact is that many devices do not
@@ -246,7 +251,7 @@ among printers and scanners, but plenty of other types of device have
246the same deficiency. 251the same deficiency.
247 252
248For this reason, by default the kernel disables autosuspend (the 253For this reason, by default the kernel disables autosuspend (the
249power/control attribute is initialized to "on") for all devices other 254``power/control`` attribute is initialized to ``on``) for all devices other
250than hubs. Hubs, at least, appear to be reasonably well-behaved in 255than hubs. Hubs, at least, appear to be reasonably well-behaved in
251this regard. 256this regard.
252 257
@@ -284,30 +289,30 @@ device by suspending it at the wrong time. (Highly unlikely, but
284possible.) Take care. 289possible.) Take care.
285 290
286 291
287 The driver interface for Power Management 292The driver interface for Power Management
288 ----------------------------------------- 293-----------------------------------------
289 294
290The requirements for a USB driver to support external power management 295The requirements for a USB driver to support external power management
291are pretty modest; the driver need only define 296are pretty modest; the driver need only define::
292 297
293 .suspend 298 .suspend
294 .resume 299 .resume
295 .reset_resume 300 .reset_resume
296 301
297methods in its usb_driver structure, and the reset_resume method is 302methods in its :c:type:`usb_driver` structure, and the ``reset_resume`` method
298optional. The methods' jobs are quite simple: 303is optional. The methods' jobs are quite simple:
299 304
300 The suspend method is called to warn the driver that the 305 - The ``suspend`` method is called to warn the driver that the
301 device is going to be suspended. If the driver returns a 306 device is going to be suspended. If the driver returns a
302 negative error code, the suspend will be aborted. Normally 307 negative error code, the suspend will be aborted. Normally
303 the driver will return 0, in which case it must cancel all 308 the driver will return 0, in which case it must cancel all
304 outstanding URBs (usb_kill_urb()) and not submit any more. 309 outstanding URBs (:c:func:`usb_kill_urb`) and not submit any more.
305 310
306 The resume method is called to tell the driver that the 311 - The ``resume`` method is called to tell the driver that the
307 device has been resumed and the driver can return to normal 312 device has been resumed and the driver can return to normal
308 operation. URBs may once more be submitted. 313 operation. URBs may once more be submitted.
309 314
310 The reset_resume method is called to tell the driver that 315 - The ``reset_resume`` method is called to tell the driver that
311 the device has been resumed and it also has been reset. 316 the device has been resumed and it also has been reset.
312 The driver should redo any necessary device initialization, 317 The driver should redo any necessary device initialization,
313 since the device has probably lost most or all of its state 318 since the device has probably lost most or all of its state
@@ -315,22 +320,22 @@ optional. The methods' jobs are quite simple:
315 before the suspend). 320 before the suspend).
316 321
317If the device is disconnected or powered down while it is suspended, 322If the device is disconnected or powered down while it is suspended,
318the disconnect method will be called instead of the resume or 323the ``disconnect`` method will be called instead of the ``resume`` or
319reset_resume method. This is also quite likely to happen when 324``reset_resume`` method. This is also quite likely to happen when
320waking up from hibernation, as many systems do not maintain suspend 325waking up from hibernation, as many systems do not maintain suspend
321current to the USB host controllers during hibernation. (It's 326current to the USB host controllers during hibernation. (It's
322possible to work around the hibernation-forces-disconnect problem by 327possible to work around the hibernation-forces-disconnect problem by
323using the USB Persist facility.) 328using the USB Persist facility.)
324 329
325The reset_resume method is used by the USB Persist facility (see 330The ``reset_resume`` method is used by the USB Persist facility (see
326Documentation/usb/persist.txt) and it can also be used under certain 331:ref:`usb-persist`) and it can also be used under certain
327circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a 332circumstances when ``CONFIG_USB_PERSIST`` is not enabled. Currently, if a
328device is reset during a resume and the driver does not have a 333device is reset during a resume and the driver does not have a
329reset_resume method, the driver won't receive any notification about 334``reset_resume`` method, the driver won't receive any notification about
330the resume. Later kernels will call the driver's disconnect method; 335the resume. Later kernels will call the driver's ``disconnect`` method;
3312.6.23 doesn't do this. 3362.6.23 doesn't do this.
332 337
333USB drivers are bound to interfaces, so their suspend and resume 338USB drivers are bound to interfaces, so their ``suspend`` and ``resume``
334methods get called when the interfaces are suspended or resumed. In 339methods get called when the interfaces are suspended or resumed. In
335principle one might want to suspend some interfaces on a device (i.e., 340principle one might want to suspend some interfaces on a device (i.e.,
336force the drivers for those interface to stop all activity) without 341force the drivers for those interface to stop all activity) without
@@ -341,15 +346,15 @@ to suspend or resume some but not all of a device's interfaces. The
341closest you can come is to unbind the interfaces' drivers. 346closest you can come is to unbind the interfaces' drivers.
342 347
343 348
344 The driver interface for autosuspend and autoresume 349The driver interface for autosuspend and autoresume
345 --------------------------------------------------- 350---------------------------------------------------
346 351
347To support autosuspend and autoresume, a driver should implement all 352To support autosuspend and autoresume, a driver should implement all
348three of the methods listed above. In addition, a driver indicates 353three of the methods listed above. In addition, a driver indicates
349that it supports autosuspend by setting the .supports_autosuspend flag 354that it supports autosuspend by setting the ``.supports_autosuspend`` flag
350in its usb_driver structure. It is then responsible for informing the 355in its usb_driver structure. It is then responsible for informing the
351USB core whenever one of its interfaces becomes busy or idle. The 356USB core whenever one of its interfaces becomes busy or idle. The
352driver does so by calling these six functions: 357driver does so by calling these six functions::
353 358
354 int usb_autopm_get_interface(struct usb_interface *intf); 359 int usb_autopm_get_interface(struct usb_interface *intf);
355 void usb_autopm_put_interface(struct usb_interface *intf); 360 void usb_autopm_put_interface(struct usb_interface *intf);
@@ -368,41 +373,41 @@ autosuspend the device.
368Drivers need not be concerned about balancing changes to the usage 373Drivers need not be concerned about balancing changes to the usage
369counter; the USB core will undo any remaining "get"s when a driver 374counter; the USB core will undo any remaining "get"s when a driver
370is unbound from its interface. As a corollary, drivers must not call 375is unbound from its interface. As a corollary, drivers must not call
371any of the usb_autopm_* functions after their disconnect() routine has 376any of the ``usb_autopm_*`` functions after their ``disconnect``
372returned. 377routine has returned.
373 378
374Drivers using the async routines are responsible for their own 379Drivers using the async routines are responsible for their own
375synchronization and mutual exclusion. 380synchronization and mutual exclusion.
376 381
377 usb_autopm_get_interface() increments the usage counter and 382 :c:func:`usb_autopm_get_interface` increments the usage counter and
378 does an autoresume if the device is suspended. If the 383 does an autoresume if the device is suspended. If the
379 autoresume fails, the counter is decremented back. 384 autoresume fails, the counter is decremented back.
380 385
381 usb_autopm_put_interface() decrements the usage counter and 386 :c:func:`usb_autopm_put_interface` decrements the usage counter and
382 attempts an autosuspend if the new value is = 0. 387 attempts an autosuspend if the new value is = 0.
383 388
384 usb_autopm_get_interface_async() and 389 :c:func:`usb_autopm_get_interface_async` and
385 usb_autopm_put_interface_async() do almost the same things as 390 :c:func:`usb_autopm_put_interface_async` do almost the same things as
386 their non-async counterparts. The big difference is that they 391 their non-async counterparts. The big difference is that they
387 use a workqueue to do the resume or suspend part of their 392 use a workqueue to do the resume or suspend part of their
388 jobs. As a result they can be called in an atomic context, 393 jobs. As a result they can be called in an atomic context,
389 such as an URB's completion handler, but when they return the 394 such as an URB's completion handler, but when they return the
390 device will generally not yet be in the desired state. 395 device will generally not yet be in the desired state.
391 396
392 usb_autopm_get_interface_no_resume() and 397 :c:func:`usb_autopm_get_interface_no_resume` and
393 usb_autopm_put_interface_no_suspend() merely increment or 398 :c:func:`usb_autopm_put_interface_no_suspend` merely increment or
394 decrement the usage counter; they do not attempt to carry out 399 decrement the usage counter; they do not attempt to carry out
395 an autoresume or an autosuspend. Hence they can be called in 400 an autoresume or an autosuspend. Hence they can be called in
396 an atomic context. 401 an atomic context.
397 402
398The simplest usage pattern is that a driver calls 403The simplest usage pattern is that a driver calls
399usb_autopm_get_interface() in its open routine and 404:c:func:`usb_autopm_get_interface` in its open routine and
400usb_autopm_put_interface() in its close or release routine. But other 405:c:func:`usb_autopm_put_interface` in its close or release routine. But other
401patterns are possible. 406patterns are possible.
402 407
403The autosuspend attempts mentioned above will often fail for one 408The autosuspend attempts mentioned above will often fail for one
404reason or another. For example, the power/control attribute might be 409reason or another. For example, the ``power/control`` attribute might be
405set to "on", or another interface in the same device might not be 410set to ``on``, or another interface in the same device might not be
406idle. This is perfectly normal. If the reason for failure was that 411idle. This is perfectly normal. If the reason for failure was that
407the device hasn't been idle for long enough, a timer is scheduled to 412the device hasn't been idle for long enough, a timer is scheduled to
408carry out the operation automatically when the autosuspend idle-delay 413carry out the operation automatically when the autosuspend idle-delay
@@ -413,37 +418,37 @@ the device is no longer present or operating properly. Unlike
413autosuspend, there's no idle-delay for an autoresume. 418autosuspend, there's no idle-delay for an autoresume.
414 419
415 420
416 Other parts of the driver interface 421Other parts of the driver interface
417 ----------------------------------- 422-----------------------------------
418 423
419Drivers can enable autosuspend for their devices by calling 424Drivers can enable autosuspend for their devices by calling::
420 425
421 usb_enable_autosuspend(struct usb_device *udev); 426 usb_enable_autosuspend(struct usb_device *udev);
422 427
423in their probe() routine, if they know that the device is capable of 428in their :c:func:`probe` routine, if they know that the device is capable of
424suspending and resuming correctly. This is exactly equivalent to 429suspending and resuming correctly. This is exactly equivalent to
425writing "auto" to the device's power/control attribute. Likewise, 430writing ``auto`` to the device's ``power/control`` attribute. Likewise,
426drivers can disable autosuspend by calling 431drivers can disable autosuspend by calling::
427 432
428 usb_disable_autosuspend(struct usb_device *udev); 433 usb_disable_autosuspend(struct usb_device *udev);
429 434
430This is exactly the same as writing "on" to the power/control attribute. 435This is exactly the same as writing ``on`` to the ``power/control`` attribute.
431 436
432Sometimes a driver needs to make sure that remote wakeup is enabled 437Sometimes a driver needs to make sure that remote wakeup is enabled
433during autosuspend. For example, there's not much point 438during autosuspend. For example, there's not much point
434autosuspending a keyboard if the user can't cause the keyboard to do a 439autosuspending a keyboard if the user can't cause the keyboard to do a
435remote wakeup by typing on it. If the driver sets 440remote wakeup by typing on it. If the driver sets
436intf->needs_remote_wakeup to 1, the kernel won't autosuspend the 441``intf->needs_remote_wakeup`` to 1, the kernel won't autosuspend the
437device if remote wakeup isn't available. (If the device is already 442device if remote wakeup isn't available. (If the device is already
438autosuspended, though, setting this flag won't cause the kernel to 443autosuspended, though, setting this flag won't cause the kernel to
439autoresume it. Normally a driver would set this flag in its probe 444autoresume it. Normally a driver would set this flag in its ``probe``
440method, at which time the device is guaranteed not to be 445method, at which time the device is guaranteed not to be
441autosuspended.) 446autosuspended.)
442 447
443If a driver does its I/O asynchronously in interrupt context, it 448If a driver does its I/O asynchronously in interrupt context, it
444should call usb_autopm_get_interface_async() before starting output and 449should call :c:func:`usb_autopm_get_interface_async` before starting output and
445usb_autopm_put_interface_async() when the output queue drains. When 450:c:func:`usb_autopm_put_interface_async` when the output queue drains. When
446it receives an input event, it should call 451it receives an input event, it should call::
447 452
448 usb_mark_last_busy(struct usb_device *udev); 453 usb_mark_last_busy(struct usb_device *udev);
449 454
@@ -453,41 +458,41 @@ be pushed back. Many of the usb_autopm_* routines also make this call,
453so drivers need to worry only when interrupt-driven input arrives. 458so drivers need to worry only when interrupt-driven input arrives.
454 459
455Asynchronous operation is always subject to races. For example, a 460Asynchronous operation is always subject to races. For example, a
456driver may call the usb_autopm_get_interface_async() routine at a time 461driver may call the :c:func:`usb_autopm_get_interface_async` routine at a time
457when the core has just finished deciding the device has been idle for 462when the core has just finished deciding the device has been idle for
458long enough but not yet gotten around to calling the driver's suspend 463long enough but not yet gotten around to calling the driver's ``suspend``
459method. The suspend method must be responsible for synchronizing with 464method. The ``suspend`` method must be responsible for synchronizing with
460the I/O request routine and the URB completion handler; it should 465the I/O request routine and the URB completion handler; it should
461cause autosuspends to fail with -EBUSY if the driver needs to use the 466cause autosuspends to fail with -EBUSY if the driver needs to use the
462device. 467device.
463 468
464External suspend calls should never be allowed to fail in this way, 469External suspend calls should never be allowed to fail in this way,
465only autosuspend calls. The driver can tell them apart by applying 470only autosuspend calls. The driver can tell them apart by applying
466the PMSG_IS_AUTO() macro to the message argument to the suspend 471the :c:func:`PMSG_IS_AUTO` macro to the message argument to the ``suspend``
467method; it will return True for internal PM events (autosuspend) and 472method; it will return True for internal PM events (autosuspend) and
468False for external PM events. 473False for external PM events.
469 474
470 475
471 Mutual exclusion 476Mutual exclusion
472 ---------------- 477----------------
473 478
474For external events -- but not necessarily for autosuspend or 479For external events -- but not necessarily for autosuspend or
475autoresume -- the device semaphore (udev->dev.sem) will be held when a 480autoresume -- the device semaphore (udev->dev.sem) will be held when a
476suspend or resume method is called. This implies that external 481``suspend`` or ``resume`` method is called. This implies that external
477suspend/resume events are mutually exclusive with calls to probe, 482suspend/resume events are mutually exclusive with calls to ``probe``,
478disconnect, pre_reset, and post_reset; the USB core guarantees that 483``disconnect``, ``pre_reset``, and ``post_reset``; the USB core guarantees that
479this is true of autosuspend/autoresume events as well. 484this is true of autosuspend/autoresume events as well.
480 485
481If a driver wants to block all suspend/resume calls during some 486If a driver wants to block all suspend/resume calls during some
482critical section, the best way is to lock the device and call 487critical section, the best way is to lock the device and call
483usb_autopm_get_interface() (and do the reverse at the end of the 488:c:func:`usb_autopm_get_interface` (and do the reverse at the end of the
484critical section). Holding the device semaphore will block all 489critical section). Holding the device semaphore will block all
485external PM calls, and the usb_autopm_get_interface() will prevent any 490external PM calls, and the :c:func:`usb_autopm_get_interface` will prevent any
486internal PM calls, even if it fails. (Exercise: Why?) 491internal PM calls, even if it fails. (Exercise: Why?)
487 492
488 493
489 Interaction between dynamic PM and system PM 494Interaction between dynamic PM and system PM
490 -------------------------------------------- 495--------------------------------------------
491 496
492Dynamic power management and system power management can interact in 497Dynamic power management and system power management can interact in
493a couple of ways. 498a couple of ways.
@@ -512,8 +517,8 @@ wakeup may fail and get lost. Which outcome occurs depends on timing
512and on the hardware and firmware design. 517and on the hardware and firmware design.
513 518
514 519
515 xHCI hardware link PM 520xHCI hardware link PM
516 --------------------- 521---------------------
517 522
518xHCI host controller provides hardware link power management to usb2.0 523xHCI host controller provides hardware link power management to usb2.0
519(xHCI 1.0 feature) and usb3.0 devices which support link PM. By 524(xHCI 1.0 feature) and usb3.0 devices which support link PM. By
@@ -522,11 +527,11 @@ lower power state(L1 for usb2.0 devices, or U1/U2 for usb3.0 devices),
522which state device can enter and resume very quickly. 527which state device can enter and resume very quickly.
523 528
524The user interface for controlling hardware LPM is located in the 529The user interface for controlling hardware LPM is located in the
525power/ subdirectory of each USB device's sysfs directory, that is, in 530``power/`` subdirectory of each USB device's sysfs directory, that is, in
526/sys/bus/usb/devices/.../power/ where "..." is the device's ID. The 531``/sys/bus/usb/devices/.../power/`` where "..." is the device's ID. The
527relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm. 532relevant attribute files are ``usb2_hardware_lpm`` and ``usb3_hardware_lpm``.
528 533
529 power/usb2_hardware_lpm 534 ``power/usb2_hardware_lpm``
530 535
531 When a USB2 device which support LPM is plugged to a 536 When a USB2 device which support LPM is plugged to a
532 xHCI host root hub which support software LPM, the 537 xHCI host root hub which support software LPM, the
@@ -537,8 +542,8 @@ relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm.
537 can write y/Y/1 or n/N/0 to the file to enable/disable 542 can write y/Y/1 or n/N/0 to the file to enable/disable
538 USB2 hardware LPM manually. This is for test purpose mainly. 543 USB2 hardware LPM manually. This is for test purpose mainly.
539 544
540 power/usb3_hardware_lpm_u1 545 ``power/usb3_hardware_lpm_u1``
541 power/usb3_hardware_lpm_u2 546 ``power/usb3_hardware_lpm_u2``
542 547
543 When a USB 3.0 lpm-capable device is plugged in to a 548 When a USB 3.0 lpm-capable device is plugged in to a
544 xHCI host which supports link PM, it will check if U1 549 xHCI host which supports link PM, it will check if U1
@@ -550,29 +555,31 @@ relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm.
550 indicating whether or not USB3 hardware LPM U1 or U2 555 indicating whether or not USB3 hardware LPM U1 or U2
551 is enabled for the device. 556 is enabled for the device.
552 557
553 USB Port Power Control 558USB Port Power Control
554 ---------------------- 559----------------------
555 560
556In addition to suspending endpoint devices and enabling hardware 561In addition to suspending endpoint devices and enabling hardware
557controlled link power management, the USB subsystem also has the 562controlled link power management, the USB subsystem also has the
558capability to disable power to ports under some conditions. Power is 563capability to disable power to ports under some conditions. Power is
559controlled through Set/ClearPortFeature(PORT_POWER) requests to a hub. 564controlled through ``Set/ClearPortFeature(PORT_POWER)`` requests to a hub.
560In the case of a root or platform-internal hub the host controller 565In the case of a root or platform-internal hub the host controller
561driver translates PORT_POWER requests into platform firmware (ACPI) 566driver translates ``PORT_POWER`` requests into platform firmware (ACPI)
562method calls to set the port power state. For more background see the 567method calls to set the port power state. For more background see the
563Linux Plumbers Conference 2012 slides [1] and video [2]: 568Linux Plumbers Conference 2012 slides [#f1]_ and video [#f2]_:
564 569
565Upon receiving a ClearPortFeature(PORT_POWER) request a USB port is 570Upon receiving a ``ClearPortFeature(PORT_POWER)`` request a USB port is
566logically off, and may trigger the actual loss of VBUS to the port [3]. 571logically off, and may trigger the actual loss of VBUS to the port [#f3]_.
567VBUS may be maintained in the case where a hub gangs multiple ports into 572VBUS may be maintained in the case where a hub gangs multiple ports into
568a shared power well causing power to remain until all ports in the gang 573a shared power well causing power to remain until all ports in the gang
569are turned off. VBUS may also be maintained by hub ports configured for 574are turned off. VBUS may also be maintained by hub ports configured for
570a charging application. In any event a logically off port will lose 575a charging application. In any event a logically off port will lose
571connection with its device, not respond to hotplug events, and not 576connection with its device, not respond to hotplug events, and not
572respond to remote wakeup events*. 577respond to remote wakeup events.
578
579.. warning::
573 580
574WARNING: turning off a port may result in the inability to hot add a device. 581 turning off a port may result in the inability to hot add a device.
575Please see "User Interface for Port Power Control" for details. 582 Please see "User Interface for Port Power Control" for details.
576 583
577As far as the effect on the device itself it is similar to what a device 584As far as the effect on the device itself it is similar to what a device
578goes through during system suspend, i.e. the power session is lost. Any 585goes through during system suspend, i.e. the power session is lost. Any
@@ -581,38 +588,49 @@ similarly affected by a port power cycle event. For this reason the
581implementation shares the same device recovery path (and honors the same 588implementation shares the same device recovery path (and honors the same
582quirks) as the system resume path for the hub. 589quirks) as the system resume path for the hub.
583 590
584[1]: http://dl.dropbox.com/u/96820575/sarah-sharp-lpt-port-power-off2-mini.pdf 591.. [#f1]
585[2]: http://linuxplumbers.ubicast.tv/videos/usb-port-power-off-kerneluserspace-api/ 592
586[3]: USB 3.1 Section 10.12 593 http://dl.dropbox.com/u/96820575/sarah-sharp-lpt-port-power-off2-mini.pdf
587* wakeup note: if a device is configured to send wakeup events the port 594
595.. [#f2]
596
597 http://linuxplumbers.ubicast.tv/videos/usb-port-power-off-kerneluserspace-api/
598
599.. [#f3]
600
601 USB 3.1 Section 10.12
602
603 wakeup note: if a device is configured to send wakeup events the port
588 power control implementation will block poweroff attempts on that 604 power control implementation will block poweroff attempts on that
589 port. 605 port.
590 606
591 607
592 User Interface for Port Power Control 608User Interface for Port Power Control
593 ------------------------------------- 609-------------------------------------
594 610
595The port power control mechanism uses the PM runtime system. Poweroff is 611The port power control mechanism uses the PM runtime system. Poweroff is
596requested by clearing the power/pm_qos_no_power_off flag of the port device 612requested by clearing the ``power/pm_qos_no_power_off`` flag of the port device
597(defaults to 1). If the port is disconnected it will immediately receive a 613(defaults to 1). If the port is disconnected it will immediately receive a
598ClearPortFeature(PORT_POWER) request. Otherwise, it will honor the pm runtime 614``ClearPortFeature(PORT_POWER)`` request. Otherwise, it will honor the pm
599rules and require the attached child device and all descendants to be suspended. 615runtime rules and require the attached child device and all descendants to be
600This mechanism is dependent on the hub advertising port power switching in its 616suspended. This mechanism is dependent on the hub advertising port power
601hub descriptor (wHubCharacteristics logical power switching mode field). 617switching in its hub descriptor (wHubCharacteristics logical power switching
618mode field).
602 619
603Note, some interface devices/drivers do not support autosuspend. Userspace may 620Note, some interface devices/drivers do not support autosuspend. Userspace may
604need to unbind the interface drivers before the usb_device will suspend. An 621need to unbind the interface drivers before the :c:type:`usb_device` will
605unbound interface device is suspended by default. When unbinding, be careful 622suspend. An unbound interface device is suspended by default. When unbinding,
606to unbind interface drivers, not the driver of the parent usb device. Also, 623be careful to unbind interface drivers, not the driver of the parent usb
607leave hub interface drivers bound. If the driver for the usb device (not 624device. Also, leave hub interface drivers bound. If the driver for the usb
608interface) is unbound the kernel is no longer able to resume the device. If a 625device (not interface) is unbound the kernel is no longer able to resume the
609hub interface driver is unbound, control of its child ports is lost and all 626device. If a hub interface driver is unbound, control of its child ports is
610attached child-devices will disconnect. A good rule of thumb is that if the 627lost and all attached child-devices will disconnect. A good rule of thumb is
611'driver/module' link for a device points to /sys/module/usbcore then unbinding 628that if the 'driver/module' link for a device points to
612it will interfere with port power control. 629``/sys/module/usbcore`` then unbinding it will interfere with port power
630control.
613 631
614Example of the relevant files for port power control. Note, in this example 632Example of the relevant files for port power control. Note, in this example
615these files are relative to a usb hub device (prefix). 633these files are relative to a usb hub device (prefix)::
616 634
617 prefix=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-1 635 prefix=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-1
618 636
@@ -631,10 +649,10 @@ these files are relative to a usb hub device (prefix).
631 649
632In addition to these files some ports may have a 'peer' link to a port on 650In addition to these files some ports may have a 'peer' link to a port on
633another hub. The expectation is that all superspeed ports have a 651another hub. The expectation is that all superspeed ports have a
634hi-speed peer. 652hi-speed peer::
635 653
636$prefix/3-1:1.0/3-1-port1/peer -> ../../../../usb2/2-1/2-1:1.0/2-1-port1 654 $prefix/3-1:1.0/3-1-port1/peer -> ../../../../usb2/2-1/2-1:1.0/2-1-port1
637../../../../usb2/2-1/2-1:1.0/2-1-port1/peer -> ../../../../usb3/3-1/3-1:1.0/3-1-port1 655 ../../../../usb2/2-1/2-1:1.0/2-1-port1/peer -> ../../../../usb3/3-1/3-1:1.0/3-1-port1
638 656
639Distinct from 'companion ports', or 'ehci/xhci shared switchover ports' 657Distinct from 'companion ports', or 'ehci/xhci shared switchover ports'
640peer ports are simply the hi-speed and superspeed interface pins that 658peer ports are simply the hi-speed and superspeed interface pins that
@@ -645,24 +663,26 @@ While a superspeed port is powered off a device may downgrade its
645connection and attempt to connect to the hi-speed pins. The 663connection and attempt to connect to the hi-speed pins. The
646implementation takes steps to prevent this: 664implementation takes steps to prevent this:
647 665
6481/ Port suspend is sequenced to guarantee that hi-speed ports are powered-off 6661. Port suspend is sequenced to guarantee that hi-speed ports are powered-off
649 before their superspeed peer is permitted to power-off. The implication is 667 before their superspeed peer is permitted to power-off. The implication is
650 that the setting pm_qos_no_power_off to zero on a superspeed port may not cause 668 that the setting ``pm_qos_no_power_off`` to zero on a superspeed port may
651 the port to power-off until its highspeed peer has gone to its runtime suspend 669 not cause the port to power-off until its highspeed peer has gone to its
652 state. Userspace must take care to order the suspensions if it wants to 670 runtime suspend state. Userspace must take care to order the suspensions
653 guarantee that a superspeed port will power-off. 671 if it wants to guarantee that a superspeed port will power-off.
654 672
6552/ Port resume is sequenced to force a superspeed port to power-on prior to its 6732. Port resume is sequenced to force a superspeed port to power-on prior to its
656 highspeed peer. 674 highspeed peer.
657 675
6583/ Port resume always triggers an attached child device to resume. After a 6763. Port resume always triggers an attached child device to resume. After a
659 power session is lost the device may have been removed, or need reset. 677 power session is lost the device may have been removed, or need reset.
660 Resuming the child device when the parent port regains power resolves those 678 Resuming the child device when the parent port regains power resolves those
661 states and clamps the maximum port power cycle frequency at the rate the child 679 states and clamps the maximum port power cycle frequency at the rate the
662 device can suspend (autosuspend-delay) and resume (reset-resume latency). 680 child device can suspend (autosuspend-delay) and resume (reset-resume
681 latency).
663 682
664Sysfs files relevant for port power control: 683Sysfs files relevant for port power control:
665 <hubdev-portX>/power/pm_qos_no_power_off: 684
685 ``<hubdev-portX>/power/pm_qos_no_power_off``:
666 This writable flag controls the state of an idle port. 686 This writable flag controls the state of an idle port.
667 Once all children and descendants have suspended the 687 Once all children and descendants have suspended the
668 port may suspend/poweroff provided that 688 port may suspend/poweroff provided that
@@ -670,24 +690,24 @@ Sysfs files relevant for port power control:
670 '1' the port will remain active/powered regardless of 690 '1' the port will remain active/powered regardless of
671 the stats of descendants. Defaults to 1. 691 the stats of descendants. Defaults to 1.
672 692
673 <hubdev-portX>/power/runtime_status: 693 ``<hubdev-portX>/power/runtime_status``:
674 This file reflects whether the port is 'active' (power is on) 694 This file reflects whether the port is 'active' (power is on)
675 or 'suspended' (logically off). There is no indication to 695 or 'suspended' (logically off). There is no indication to
676 userspace whether VBUS is still supplied. 696 userspace whether VBUS is still supplied.
677 697
678 <hubdev-portX>/connect_type: 698 ``<hubdev-portX>/connect_type``:
679 An advisory read-only flag to userspace indicating the 699 An advisory read-only flag to userspace indicating the
680 location and connection type of the port. It returns 700 location and connection type of the port. It returns
681 one of four values 'hotplug', 'hardwired', 'not used', 701 one of four values 'hotplug', 'hardwired', 'not used',
682 and 'unknown'. All values, besides unknown, are set by 702 and 'unknown'. All values, besides unknown, are set by
683 platform firmware. 703 platform firmware.
684 704
685 "hotplug" indicates an externally connectable/visible 705 ``hotplug`` indicates an externally connectable/visible
686 port on the platform. Typically userspace would choose 706 port on the platform. Typically userspace would choose
687 to keep such a port powered to handle new device 707 to keep such a port powered to handle new device
688 connection events. 708 connection events.
689 709
690 "hardwired" refers to a port that is not visible but 710 ``hardwired`` refers to a port that is not visible but
691 connectable. Examples are internal ports for USB 711 connectable. Examples are internal ports for USB
692 bluetooth that can be disconnected via an external 712 bluetooth that can be disconnected via an external
693 switch or a port with a hardwired USB camera. It is 713 switch or a port with a hardwired USB camera. It is
@@ -698,48 +718,50 @@ Sysfs files relevant for port power control:
698 powering off, or to activate the port prior to enabling 718 powering off, or to activate the port prior to enabling
699 connection via a switch. 719 connection via a switch.
700 720
701 "not used" refers to an internal port that is expected 721 ``not used`` refers to an internal port that is expected
702 to never have a device connected to it. These may be 722 to never have a device connected to it. These may be
703 empty internal ports, or ports that are not physically 723 empty internal ports, or ports that are not physically
704 exposed on a platform. Considered safe to be 724 exposed on a platform. Considered safe to be
705 powered-off at all times. 725 powered-off at all times.
706 726
707 "unknown" means platform firmware does not provide 727 ``unknown`` means platform firmware does not provide
708 information for this port. Most commonly refers to 728 information for this port. Most commonly refers to
709 external hub ports which should be considered 'hotplug' 729 external hub ports which should be considered 'hotplug'
710 for policy decisions. 730 for policy decisions.
711 731
712 NOTE1: since we are relying on the BIOS to get this ACPI 732 .. note::
713 information correct, the USB port descriptions may be 733
714 missing or wrong. 734 - since we are relying on the BIOS to get this ACPI
735 information correct, the USB port descriptions may
736 be missing or wrong.
715 737
716 NOTE2: Take care in clearing pm_qos_no_power_off. Once 738 - Take care in clearing ``pm_qos_no_power_off``. Once
717 power is off this port will 739 power is off this port will
718 not respond to new connect events. 740 not respond to new connect events.
719 741
720 Once a child device is attached additional constraints are 742 Once a child device is attached additional constraints are
721 applied before the port is allowed to poweroff. 743 applied before the port is allowed to poweroff.
722 744
723 <child>/power/control: 745 ``<child>/power/control``:
724 Must be 'auto', and the port will not 746 Must be ``auto``, and the port will not
725 power down until <child>/power/runtime_status 747 power down until ``<child>/power/runtime_status``
726 reflects the 'suspended' state. Default 748 reflects the 'suspended' state. Default
727 value is controlled by child device driver. 749 value is controlled by child device driver.
728 750
729 <child>/power/persist: 751 ``<child>/power/persist``:
730 This defaults to '1' for most devices and indicates if 752 This defaults to ``1`` for most devices and indicates if
731 kernel can persist the device's configuration across a 753 kernel can persist the device's configuration across a
732 power session loss (suspend / port-power event). When 754 power session loss (suspend / port-power event). When
733 this value is '0' (quirky devices), port poweroff is 755 this value is ``0`` (quirky devices), port poweroff is
734 disabled. 756 disabled.
735 757
736 <child>/driver/unbind: 758 ``<child>/driver/unbind``:
737 Wakeup capable devices will block port poweroff. At 759 Wakeup capable devices will block port poweroff. At
738 this time the only mechanism to clear the usb-internal 760 this time the only mechanism to clear the usb-internal
739 wakeup-capability for an interface device is to unbind 761 wakeup-capability for an interface device is to unbind
740 its driver. 762 its driver.
741 763
742Summary of poweroff pre-requisite settings relative to a port device: 764Summary of poweroff pre-requisite settings relative to a port device::
743 765
744 echo 0 > power/pm_qos_no_power_off 766 echo 0 > power/pm_qos_no_power_off
745 echo 0 > peer/power/pm_qos_no_power_off # if it exists 767 echo 0 > peer/power/pm_qos_no_power_off # if it exists
@@ -747,14 +769,14 @@ Summary of poweroff pre-requisite settings relative to a port device:
747 echo auto > <child>/power/control 769 echo auto > <child>/power/control
748 echo 1 > <child>/power/persist # this is the default value 770 echo 1 > <child>/power/persist # this is the default value
749 771
750 Suggested Userspace Port Power Policy 772Suggested Userspace Port Power Policy
751 ------------------------------------- 773-------------------------------------
752 774
753As noted above userspace needs to be careful and deliberate about what 775As noted above userspace needs to be careful and deliberate about what
754ports are enabled for poweroff. 776ports are enabled for poweroff.
755 777
756The default configuration is that all ports start with 778The default configuration is that all ports start with
757power/pm_qos_no_power_off set to '1' causing ports to always remain 779``power/pm_qos_no_power_off`` set to ``1`` causing ports to always remain
758active. 780active.
759 781
760Given confidence in the platform firmware's description of the ports 782Given confidence in the platform firmware's description of the ports
@@ -764,7 +786,7 @@ done for 'hardwired' ports provided poweroff is coordinated with any
764connection switch for the port. 786connection switch for the port.
765 787
766A more aggressive userspace policy is to enable USB port power off for 788A more aggressive userspace policy is to enable USB port power off for
767all ports (set <hubdev-portX>/power/pm_qos_no_power_off to '0') when 789all ports (set ``<hubdev-portX>/power/pm_qos_no_power_off`` to ``0``) when
768some external factor indicates the user has stopped interacting with the 790some external factor indicates the user has stopped interacting with the
769system. For example, a distro may want to enable power off all USB 791system. For example, a distro may want to enable power off all USB
770ports when the screen blanks, and re-power them when the screen becomes 792ports when the screen blanks, and re-power them when the screen becomes
diff --git a/Documentation/driver-api/usb.rst b/Documentation/driver-api/usb/usb.rst
index 851cc40b66b5..dba0f876b36f 100644
--- a/Documentation/driver-api/usb.rst
+++ b/Documentation/driver-api/usb/usb.rst
@@ -1,3 +1,5 @@
1.. _usb-hostside-api:
2
1=========================== 3===========================
2The Linux-USB Host Side API 4The Linux-USB Host Side API
3=========================== 5===========================
@@ -102,16 +104,21 @@ disconnect testing (while the device is active) with each different host
102controller driver, to make sure drivers don't have bugs of their own as 104controller driver, to make sure drivers don't have bugs of their own as
103well as to make sure they aren't relying on some HCD-specific behavior. 105well as to make sure they aren't relying on some HCD-specific behavior.
104 106
107.. _usb_chapter9:
108
105USB-Standard Types 109USB-Standard Types
106================== 110==================
107 111
108In ``<linux/usb/ch9.h>`` you will find the USB data types defined in 112In ``<linux/usb/ch9.h>`` you will find the USB data types defined in
109chapter 9 of the USB specification. These data types are used throughout 113chapter 9 of the USB specification. These data types are used throughout
110USB, and in APIs including this host side API, gadget APIs, and usbfs. 114USB, and in APIs including this host side API, gadget APIs, usb character
115devices and debugfs interfaces.
111 116
112.. kernel-doc:: include/linux/usb/ch9.h 117.. kernel-doc:: include/linux/usb/ch9.h
113 :internal: 118 :internal:
114 119
120.. _usb_header:
121
115Host-Side Data Types and Macros 122Host-Side Data Types and Macros
116=============================== 123===============================
117 124
@@ -198,173 +205,110 @@ significantly reduce hcd-specific behaviors.
198.. kernel-doc:: drivers/usb/core/buffer.c 205.. kernel-doc:: drivers/usb/core/buffer.c
199 :internal: 206 :internal:
200 207
201The USB Filesystem (usbfs) 208The USB character device nodes
202========================== 209==============================
203 210
204This chapter presents the Linux *usbfs*. You may prefer to avoid writing 211This chapter presents the Linux character device nodes. You may prefer
205new kernel code for your USB driver; that's the problem that usbfs set 212to avoid writing new kernel code for your USB driver. User mode device
206out to solve. User mode device drivers are usually packaged as 213drivers are usually packaged as applications or libraries, and may use
207applications or libraries, and may use usbfs through some programming 214character devices through some programming library that wraps it.
208library that wraps it. Such libraries include 215Such libraries include:
209`libusb <http://libusb.sourceforge.net>`__ for C/C++, and
210`jUSB <http://jUSB.sourceforge.net>`__ for Java.
211 216
212 **Note** 217 - `libusb <http://libusb.sourceforge.net>`__ for C/C++, and
218 - `jUSB <http://jUSB.sourceforge.net>`__ for Java.
213 219
214 This particular documentation is incomplete, especially with respect 220Some old information about it can be seen at the "USB Device Filesystem"
215 to the asynchronous mode. As of kernel 2.5.66 the code and this 221section of the USB Guide. The latest copy of the USB Guide can be found
216 (new) documentation need to be cross-reviewed. 222at http://www.linux-usb.org/
217 223
218Configure usbfs into Linux kernels by enabling the *USB filesystem* 224.. note::
219option (CONFIG_USB_DEVICEFS), and you get basic support for user mode
220USB device drivers. Until relatively recently it was often (confusingly)
221called *usbdevfs* although it wasn't solving what *devfs* was. Every USB
222device will appear in usbfs, regardless of whether or not it has a
223kernel driver.
224 225
225What files are in "usbfs"? 226 - They were used to be implemented via *usbfs*, but this is not part of
226-------------------------- 227 the sysfs debug interface.
227 228
228Conventionally mounted at ``/proc/bus/usb``, usbfs features include: 229 - This particular documentation is incomplete, especially with respect
230 to the asynchronous mode. As of kernel 2.5.66 the code and this
231 (new) documentation need to be cross-reviewed.
229 232
230- ``/proc/bus/usb/devices`` ... a text file showing each of the USB 233What files are in "devtmpfs"?
231 devices on known to the kernel, and their configuration descriptors. 234-----------------------------
232 You can also poll() this to learn about new devices.
233 235
234- ``/proc/bus/usb/BBB/DDD`` ... magic files exposing the each device's 236Conventionally mounted at ``/dev/bus/usb/``, usbfs features include:
237
238- ``/dev/bus/usb/BBB/DDD`` ... magic files exposing the each device's
235 configuration descriptors, and supporting a series of ioctls for 239 configuration descriptors, and supporting a series of ioctls for
236 making device requests, including I/O to devices. (Purely for access 240 making device requests, including I/O to devices. (Purely for access
237 by programs.) 241 by programs.)
238 242
239Each bus is given a number (BBB) based on when it was enumerated; within 243Each bus is given a number (``BBB``) based on when it was enumerated; within
240each bus, each device is given a similar number (DDD). Those BBB/DDD 244each bus, each device is given a similar number (``DDD``). Those ``BBB/DDD``
241paths are not "stable" identifiers; expect them to change even if you 245paths are not "stable" identifiers; expect them to change even if you
242always leave the devices plugged in to the same hub port. *Don't even 246always leave the devices plugged in to the same hub port. *Don't even
243think of saving these in application configuration files.* Stable 247think of saving these in application configuration files.* Stable
244identifiers are available, for user mode applications that want to use 248identifiers are available, for user mode applications that want to use
245them. HID and networking devices expose these stable IDs, so that for 249them. HID and networking devices expose these stable IDs, so that for
246example you can be sure that you told the right UPS to power down its 250example you can be sure that you told the right UPS to power down its
247second server. "usbfs" doesn't (yet) expose those IDs. 251second server. Pleast note that it doesn't (yet) expose those IDs.
248
249Mounting and Access Control
250---------------------------
251
252There are a number of mount options for usbfs, which will be of most
253interest to you if you need to override the default access control
254policy. That policy is that only root may read or write device files
255(``/proc/bus/BBB/DDD``) although anyone may read the ``devices`` or
256``drivers`` files. I/O requests to the device also need the
257CAP_SYS_RAWIO capability,
258
259The significance of that is that by default, all user mode device
260drivers need super-user privileges. You can change modes or ownership in
261a driver setup when the device hotplugs, or maye just start the driver
262right then, as a privileged server (or some activity within one). That's
263the most secure approach for multi-user systems, but for single user
264systems ("trusted" by that user) it's more convenient just to grant
265everyone all access (using the *devmode=0666* option) so the driver can
266start whenever it's needed.
267
268The mount options for usbfs, usable in /etc/fstab or in command line
269invocations of *mount*, are:
270
271*busgid*\ =NNNNN
272 Controls the GID used for the /proc/bus/usb/BBB directories.
273 (Default: 0)
274
275*busmode*\ =MMM
276 Controls the file mode used for the /proc/bus/usb/BBB directories.
277 (Default: 0555)
278
279*busuid*\ =NNNNN
280 Controls the UID used for the /proc/bus/usb/BBB directories.
281 (Default: 0)
282
283*devgid*\ =NNNNN
284 Controls the GID used for the /proc/bus/usb/BBB/DDD files. (Default:
285 0)
286
287*devmode*\ =MMM
288 Controls the file mode used for the /proc/bus/usb/BBB/DDD files.
289 (Default: 0644)
290
291*devuid*\ =NNNNN
292 Controls the UID used for the /proc/bus/usb/BBB/DDD files. (Default:
293 0)
294
295*listgid*\ =NNNNN
296 Controls the GID used for the /proc/bus/usb/devices and drivers
297 files. (Default: 0)
298
299*listmode*\ =MMM
300 Controls the file mode used for the /proc/bus/usb/devices and
301 drivers files. (Default: 0444)
302 252
303*listuid*\ =NNNNN 253/dev/bus/usb/BBB/DDD
304 Controls the UID used for the /proc/bus/usb/devices and drivers 254--------------------
305 files. (Default: 0)
306
307Note that many Linux distributions hard-wire the mount options for usbfs
308in their init scripts, such as ``/etc/rc.d/rc.sysinit``, rather than
309making it easy to set this per-system policy in ``/etc/fstab``.
310
311/proc/bus/usb/devices
312---------------------
313
314This file is handy for status viewing tools in user mode, which can scan
315the text format and ignore most of it. More detailed device status
316(including class and vendor status) is available from device-specific
317files. For information about the current format of this file, see the
318``Documentation/usb/proc_usb_info.txt`` file in your Linux kernel
319sources.
320
321This file, in combination with the poll() system call, can also be used
322to detect when devices are added or removed:
323
324::
325
326 int fd;
327 struct pollfd pfd;
328
329 fd = open("/proc/bus/usb/devices", O_RDONLY);
330 pfd = { fd, POLLIN, 0 };
331 for (;;) {
332 /* The first time through, this call will return immediately. */
333 poll(&pfd, 1, -1);
334
335 /* To see what's changed, compare the file's previous and current
336 contents or scan the filesystem. (Scanning is more precise.) */
337 }
338
339Note that this behavior is intended to be used for informational and
340debug purposes. It would be more appropriate to use programs such as
341udev or HAL to initialize a device or start a user-mode helper program,
342for instance.
343
344/proc/bus/usb/BBB/DDD
345---------------------
346 255
347Use these files in one of these basic ways: 256Use these files in one of these basic ways:
348 257
349*They can be read,* producing first the device descriptor (18 bytes) and 258- *They can be read,* producing first the device descriptor (18 bytes) and
350then the descriptors for the current configuration. See the USB 2.0 spec 259 then the descriptors for the current configuration. See the USB 2.0 spec
351for details about those binary data formats. You'll need to convert most 260 for details about those binary data formats. You'll need to convert most
352multibyte values from little endian format to your native host byte 261 multibyte values from little endian format to your native host byte
353order, although a few of the fields in the device descriptor (both of 262 order, although a few of the fields in the device descriptor (both of
354the BCD-encoded fields, and the vendor and product IDs) will be 263 the BCD-encoded fields, and the vendor and product IDs) will be
355byteswapped for you. Note that configuration descriptors include 264 byteswapped for you. Note that configuration descriptors include
356descriptors for interfaces, altsettings, endpoints, and maybe additional 265 descriptors for interfaces, altsettings, endpoints, and maybe additional
357class descriptors. 266 class descriptors.
358 267
359*Perform USB operations* using *ioctl()* requests to make endpoint I/O 268- *Perform USB operations* using *ioctl()* requests to make endpoint I/O
360requests (synchronously or asynchronously) or manage the device. These 269 requests (synchronously or asynchronously) or manage the device. These
361requests need the CAP_SYS_RAWIO capability, as well as filesystem 270 requests need the ``CAP_SYS_RAWIO`` capability, as well as filesystem
362access permissions. Only one ioctl request can be made on one of these 271 access permissions. Only one ioctl request can be made on one of these
363device files at a time. This means that if you are synchronously reading 272 device files at a time. This means that if you are synchronously reading
364an endpoint from one thread, you won't be able to write to a different 273 an endpoint from one thread, you won't be able to write to a different
365endpoint from another thread until the read completes. This works for 274 endpoint from another thread until the read completes. This works for
366*half duplex* protocols, but otherwise you'd use asynchronous i/o 275 *half duplex* protocols, but otherwise you'd use asynchronous i/o
367requests. 276 requests.
277
278Each connected USB device has one file. The ``BBB`` indicates the bus
279number. The ``DDD`` indicates the device address on that bus. Both
280of these numbers are assigned sequentially, and can be reused, so
281you can't rely on them for stable access to devices. For example,
282it's relatively common for devices to re-enumerate while they are
283still connected (perhaps someone jostled their power supply, hub,
284or USB cable), so a device might be ``002/027`` when you first connect
285it and ``002/048`` sometime later.
286
287These files can be read as binary data. The binary data consists
288of first the device descriptor, then the descriptors for each
289configuration of the device. Multi-byte fields in the device descriptor
290are converted to host endianness by the kernel. The configuration
291descriptors are in bus endian format! The configuration descriptor
292are wTotalLength bytes apart. If a device returns less configuration
293descriptor data than indicated by wTotalLength there will be a hole in
294the file for the missing bytes. This information is also shown
295in text form by the ``/sys/kernel/debug/usb/devices`` file, described later.
296
297These files may also be used to write user-level drivers for the USB
298devices. You would open the ``/dev/bus/usb/BBB/DDD`` file read/write,
299read its descriptors to make sure it's the device you expect, and then
300bind to an interface (or perhaps several) using an ioctl call. You
301would issue more ioctls to the device to communicate to it using
302control, bulk, or other kinds of USB transfers. The IOCTLs are
303listed in the ``<linux/usbdevice_fs.h>`` file, and at this writing the
304source code (``linux/drivers/usb/core/devio.c``) is the primary reference
305for how to access devices through those files.
306
307Note that since by default these ``BBB/DDD`` files are writable only by
308root, only root can write such user mode drivers. You can selectively
309grant read/write permissions to other users by using ``chmod``. Also,
310usbfs mount options such as ``devmode=0666`` may be helpful.
311
368 312
369Life Cycle of User Mode Drivers 313Life Cycle of User Mode Drivers
370------------------------------- 314-------------------------------
@@ -372,7 +316,7 @@ Life Cycle of User Mode Drivers
372Such a driver first needs to find a device file for a device it knows 316Such a driver first needs to find a device file for a device it knows
373how to handle. Maybe it was told about it because a ``/sbin/hotplug`` 317how to handle. Maybe it was told about it because a ``/sbin/hotplug``
374event handling agent chose that driver to handle the new device. Or 318event handling agent chose that driver to handle the new device. Or
375maybe it's an application that scans all the /proc/bus/usb device files, 319maybe it's an application that scans all the ``/dev/bus/usb`` device files,
376and ignores most devices. In either case, it should :c:func:`read()` 320and ignores most devices. In either case, it should :c:func:`read()`
377all the descriptors from the device file, and check them against what it 321all the descriptors from the device file, and check them against what it
378knows how to handle. It might just reject everything except a particular 322knows how to handle. It might just reject everything except a particular
@@ -407,9 +351,7 @@ The ioctl() Requests
407-------------------- 351--------------------
408 352
409To use these ioctls, you need to include the following headers in your 353To use these ioctls, you need to include the following headers in your
410userspace program: 354userspace program::
411
412::
413 355
414 #include <linux/usb.h> 356 #include <linux/usb.h>
415 #include <linux/usbdevice_fs.h> 357 #include <linux/usbdevice_fs.h>
@@ -422,8 +364,8 @@ header.
422Unless noted otherwise, the ioctl requests described here will update 364Unless noted otherwise, the ioctl requests described here will update
423the modification time on the usbfs file to which they are applied 365the modification time on the usbfs file to which they are applied
424(unless they fail). A return of zero indicates success; otherwise, a 366(unless they fail). A return of zero indicates success; otherwise, a
425standard USB error code is returned. (These are documented in 367standard USB error code is returned (These are documented in
426``Documentation/usb/error-codes.txt`` in your kernel sources.) 368:ref:`usb-error-codes`).
427 369
428Each of these files multiplexes access to several I/O streams, one per 370Each of these files multiplexes access to several I/O streams, one per
429endpoint. Each device has one control endpoint (endpoint zero) which 371endpoint. Each device has one control endpoint (endpoint zero) which
@@ -458,14 +400,12 @@ USBDEVFS_CLAIMINTERFACE
458 400
459USBDEVFS_CONNECTINFO 401USBDEVFS_CONNECTINFO
460 Says whether the device is lowspeed. The ioctl parameter points to a 402 Says whether the device is lowspeed. The ioctl parameter points to a
461 structure like this: 403 structure like this::
462
463 ::
464 404
465 struct usbdevfs_connectinfo { 405 struct usbdevfs_connectinfo {
466 unsigned int devnum; 406 unsigned int devnum;
467 unsigned char slow; 407 unsigned char slow;
468 }; 408 };
469 409
470 File modification time is not updated by this request. 410 File modification time is not updated by this request.
471 411
@@ -477,45 +417,41 @@ USBDEVFS_CONNECTINFO
477USBDEVFS_GETDRIVER 417USBDEVFS_GETDRIVER
478 Returns the name of the kernel driver bound to a given interface (a 418 Returns the name of the kernel driver bound to a given interface (a
479 string). Parameter is a pointer to this structure, which is 419 string). Parameter is a pointer to this structure, which is
480 modified: 420 modified::
481 421
482 :: 422 struct usbdevfs_getdriver {
483 423 unsigned int interface;
484 struct usbdevfs_getdriver { 424 char driver[USBDEVFS_MAXDRIVERNAME + 1];
485 unsigned int interface; 425 };
486 char driver[USBDEVFS_MAXDRIVERNAME + 1];
487 };
488 426
489 File modification time is not updated by this request. 427 File modification time is not updated by this request.
490 428
491USBDEVFS_IOCTL 429USBDEVFS_IOCTL
492 Passes a request from userspace through to a kernel driver that has 430 Passes a request from userspace through to a kernel driver that has
493 an ioctl entry in the *struct usb_driver* it registered. 431 an ioctl entry in the *struct usb_driver* it registered::
494 432
495 :: 433 struct usbdevfs_ioctl {
496 434 int ifno;
497 struct usbdevfs_ioctl { 435 int ioctl_code;
498 int ifno; 436 void *data;
499 int ioctl_code; 437 };
500 void *data; 438
501 }; 439 /* user mode call looks like this.
502 440 * 'request' becomes the driver->ioctl() 'code' parameter.
503 /* user mode call looks like this. 441 * the size of 'param' is encoded in 'request', and that data
504 * 'request' becomes the driver->ioctl() 'code' parameter. 442 * is copied to or from the driver->ioctl() 'buf' parameter.
505 * the size of 'param' is encoded in 'request', and that data 443 */
506 * is copied to or from the driver->ioctl() 'buf' parameter. 444 static int
507 */ 445 usbdev_ioctl (int fd, int ifno, unsigned request, void *param)
508 static int 446 {
509 usbdev_ioctl (int fd, int ifno, unsigned request, void *param) 447 struct usbdevfs_ioctl wrapper;
510 { 448
511 struct usbdevfs_ioctl wrapper; 449 wrapper.ifno = ifno;
512 450 wrapper.ioctl_code = request;
513 wrapper.ifno = ifno; 451 wrapper.data = param;
514 wrapper.ioctl_code = request; 452
515 wrapper.data = param; 453 return ioctl (fd, USBDEVFS_IOCTL, &wrapper);
516 454 }
517 return ioctl (fd, USBDEVFS_IOCTL, &wrapper);
518 }
519 455
520 File modification time is not updated by this request. 456 File modification time is not updated by this request.
521 457
@@ -534,11 +470,11 @@ USBDEVFS_RELEASEINTERFACE
534 the number of the interface (bInterfaceNumber from descriptor); File 470 the number of the interface (bInterfaceNumber from descriptor); File
535 modification time is not updated by this request. 471 modification time is not updated by this request.
536 472
537 **Warning** 473 .. warning::
538 474
539 *No security check is made to ensure that the task which made 475 *No security check is made to ensure that the task which made
540 the claim is the one which is releasing it. This means that user 476 the claim is the one which is releasing it. This means that user
541 mode driver may interfere other ones.* 477 mode driver may interfere other ones.*
542 478
543USBDEVFS_RESETEP 479USBDEVFS_RESETEP
544 Resets the data toggle value for an endpoint (bulk or interrupt) to 480 Resets the data toggle value for an endpoint (bulk or interrupt) to
@@ -546,13 +482,13 @@ USBDEVFS_RESETEP
546 as identified in the endpoint descriptor), with USB_DIR_IN added 482 as identified in the endpoint descriptor), with USB_DIR_IN added
547 if the device's endpoint sends data to the host. 483 if the device's endpoint sends data to the host.
548 484
549 **Warning** 485 .. Warning::
550 486
551 *Avoid using this request. It should probably be removed.* Using 487 *Avoid using this request. It should probably be removed.* Using
552 it typically means the device and driver will lose toggle 488 it typically means the device and driver will lose toggle
553 synchronization. If you really lost synchronization, you likely 489 synchronization. If you really lost synchronization, you likely
554 need to completely handshake with the device, using a request 490 need to completely handshake with the device, using a request
555 like CLEAR_HALT or SET_INTERFACE. 491 like CLEAR_HALT or SET_INTERFACE.
556 492
557USBDEVFS_DROP_PRIVILEGES 493USBDEVFS_DROP_PRIVILEGES
558 This is used to relinquish the ability to do certain operations 494 This is used to relinquish the ability to do certain operations
@@ -574,21 +510,19 @@ a time.
574 510
575USBDEVFS_BULK 511USBDEVFS_BULK
576 Issues a bulk read or write request to the device. The ioctl 512 Issues a bulk read or write request to the device. The ioctl
577 parameter is a pointer to this structure: 513 parameter is a pointer to this structure::
578
579 ::
580 514
581 struct usbdevfs_bulktransfer { 515 struct usbdevfs_bulktransfer {
582 unsigned int ep; 516 unsigned int ep;
583 unsigned int len; 517 unsigned int len;
584 unsigned int timeout; /* in milliseconds */ 518 unsigned int timeout; /* in milliseconds */
585 void *data; 519 void *data;
586 }; 520 };
587 521
588 The "ep" value identifies a bulk endpoint number (1 to 15, as 522 The ``ep`` value identifies a bulk endpoint number (1 to 15, as
589 identified in an endpoint descriptor), masked with USB_DIR_IN when 523 identified in an endpoint descriptor), masked with USB_DIR_IN when
590 referring to an endpoint which sends data to the host from the 524 referring to an endpoint which sends data to the host from the
591 device. The length of the data buffer is identified by "len"; Recent 525 device. The length of the data buffer is identified by ``len``; Recent
592 kernels support requests up to about 128KBytes. *FIXME say how read 526 kernels support requests up to about 128KBytes. *FIXME say how read
593 length is returned, and how short reads are handled.*. 527 length is returned, and how short reads are handled.*.
594 528
@@ -600,31 +534,29 @@ USBDEVFS_CLEAR_HALT
600 which sends data to the host from the device. 534 which sends data to the host from the device.
601 535
602 Use this on bulk or interrupt endpoints which have stalled, 536 Use this on bulk or interrupt endpoints which have stalled,
603 returning *-EPIPE* status to a data transfer request. Do not issue 537 returning ``-EPIPE`` status to a data transfer request. Do not issue
604 the control request directly, since that could invalidate the host's 538 the control request directly, since that could invalidate the host's
605 record of the data toggle. 539 record of the data toggle.
606 540
607USBDEVFS_CONTROL 541USBDEVFS_CONTROL
608 Issues a control request to the device. The ioctl parameter points 542 Issues a control request to the device. The ioctl parameter points
609 to a structure like this: 543 to a structure like this::
610 544
611 :: 545 struct usbdevfs_ctrltransfer {
612 546 __u8 bRequestType;
613 struct usbdevfs_ctrltransfer { 547 __u8 bRequest;
614 __u8 bRequestType; 548 __u16 wValue;
615 __u8 bRequest; 549 __u16 wIndex;
616 __u16 wValue; 550 __u16 wLength;
617 __u16 wIndex; 551 __u32 timeout; /* in milliseconds */
618 __u16 wLength; 552 void *data;
619 __u32 timeout; /* in milliseconds */ 553 };
620 void *data;
621 };
622 554
623 The first eight bytes of this structure are the contents of the 555 The first eight bytes of this structure are the contents of the
624 SETUP packet to be sent to the device; see the USB 2.0 specification 556 SETUP packet to be sent to the device; see the USB 2.0 specification
625 for details. The bRequestType value is composed by combining a 557 for details. The bRequestType value is composed by combining a
626 USB_TYPE_\* value, a USB_DIR_\* value, and a USB_RECIP_\* 558 ``USB_TYPE_*`` value, a ``USB_DIR_*`` value, and a ``USB_RECIP_*``
627 value (from *<linux/usb.h>*). If wLength is nonzero, it describes 559 value (from ``linux/usb.h``). If wLength is nonzero, it describes
628 the length of the data buffer, which is either written to the device 560 the length of the data buffer, which is either written to the device
629 (USB_DIR_OUT) or read from the device (USB_DIR_IN). 561 (USB_DIR_OUT) or read from the device (USB_DIR_IN).
630 562
@@ -638,22 +570,20 @@ USBDEVFS_RESET
638 the reset, this rebinds all device interfaces. File modification 570 the reset, this rebinds all device interfaces. File modification
639 time is not updated by this request. 571 time is not updated by this request.
640 572
641 **Warning** 573.. warning::
642 574
643 *Avoid using this call* until some usbcore bugs get fixed, since 575 *Avoid using this call* until some usbcore bugs get fixed, since
644 it does not fully synchronize device, interface, and driver (not 576 it does not fully synchronize device, interface, and driver (not
645 just usbfs) state. 577 just usbfs) state.
646 578
647USBDEVFS_SETINTERFACE 579USBDEVFS_SETINTERFACE
648 Sets the alternate setting for an interface. The ioctl parameter is 580 Sets the alternate setting for an interface. The ioctl parameter is
649 a pointer to a structure like this: 581 a pointer to a structure like this::
650 582
651 :: 583 struct usbdevfs_setinterface {
652 584 unsigned int interface;
653 struct usbdevfs_setinterface { 585 unsigned int altsetting;
654 unsigned int interface; 586 };
655 unsigned int altsetting;
656 };
657 587
658 File modification time is not updated by this request. 588 File modification time is not updated by this request.
659 589
@@ -669,11 +599,11 @@ USBDEVFS_SETCONFIGURATION
669 configuration (bConfigurationValue from descriptor). File 599 configuration (bConfigurationValue from descriptor). File
670 modification time is not updated by this request. 600 modification time is not updated by this request.
671 601
672 **Warning** 602.. warning::
673 603
674 *Avoid using this call* until some usbcore bugs get fixed, since 604 *Avoid using this call* until some usbcore bugs get fixed, since
675 it does not fully synchronize device, interface, and driver (not 605 it does not fully synchronize device, interface, and driver (not
676 just usbfs) state. 606 just usbfs) state.
677 607
678Asynchronous I/O Support 608Asynchronous I/O Support
679~~~~~~~~~~~~~~~~~~~~~~~~ 609~~~~~~~~~~~~~~~~~~~~~~~~
@@ -688,7 +618,7 @@ the blocking is separate.
688 618
689These requests are packaged into a structure that resembles the URB used 619These requests are packaged into a structure that resembles the URB used
690by kernel device drivers. (No POSIX Async I/O support here, sorry.) It 620by kernel device drivers. (No POSIX Async I/O support here, sorry.) It
691identifies the endpoint type (USBDEVFS_URB_TYPE_\*), endpoint 621identifies the endpoint type (``USBDEVFS_URB_TYPE_*``), endpoint
692(number, masked with USB_DIR_IN as appropriate), buffer and length, 622(number, masked with USB_DIR_IN as appropriate), buffer and length,
693and a user "context" value serving to uniquely identify each request. 623and a user "context" value serving to uniquely identify each request.
694(It's usually a pointer to per-request data.) Flags can modify requests 624(It's usually a pointer to per-request data.) Flags can modify requests
@@ -702,30 +632,28 @@ When usbfs returns these urbs, the status value is updated, and the
702buffer may have been modified. Except for isochronous transfers, the 632buffer may have been modified. Except for isochronous transfers, the
703actual_length is updated to say how many bytes were transferred; if the 633actual_length is updated to say how many bytes were transferred; if the
704USBDEVFS_URB_DISABLE_SPD flag is set ("short packets are not OK"), if 634USBDEVFS_URB_DISABLE_SPD flag is set ("short packets are not OK"), if
705fewer bytes were read than were requested then you get an error report. 635fewer bytes were read than were requested then you get an error report::
706
707::
708 636
709 struct usbdevfs_iso_packet_desc { 637 struct usbdevfs_iso_packet_desc {
710 unsigned int length; 638 unsigned int length;
711 unsigned int actual_length; 639 unsigned int actual_length;
712 unsigned int status; 640 unsigned int status;
713 }; 641 };
714 642
715 struct usbdevfs_urb { 643 struct usbdevfs_urb {
716 unsigned char type; 644 unsigned char type;
717 unsigned char endpoint; 645 unsigned char endpoint;
718 int status; 646 int status;
719 unsigned int flags; 647 unsigned int flags;
720 void *buffer; 648 void *buffer;
721 int buffer_length; 649 int buffer_length;
722 int actual_length; 650 int actual_length;
723 int start_frame; 651 int start_frame;
724 int number_of_packets; 652 int number_of_packets;
725 int error_count; 653 int error_count;
726 unsigned int signr; 654 unsigned int signr;
727 void *usercontext; 655 void *usercontext;
728 struct usbdevfs_iso_packet_desc iso_frame_desc[]; 656 struct usbdevfs_iso_packet_desc iso_frame_desc[];
729 }; 657 };
730 658
731For these asynchronous requests, the file modification time reflects 659For these asynchronous requests, the file modification time reflects
@@ -746,3 +674,374 @@ USBDEVFS_REAPURBNDELAY
746 674
747USBDEVFS_SUBMITURB 675USBDEVFS_SUBMITURB
748 *TBS* 676 *TBS*
677
678The USB devices
679===============
680
681The USB devices are now exported via debugfs:
682
683- ``/sys/kernel/debug/usb/devices`` ... a text file showing each of the USB
684 devices on known to the kernel, and their configuration descriptors.
685 You can also poll() this to learn about new devices.
686
687/sys/kernel/debug/usb/devices
688-----------------------------
689
690This file is handy for status viewing tools in user mode, which can scan
691the text format and ignore most of it. More detailed device status
692(including class and vendor status) is available from device-specific
693files. For information about the current format of this file, see the
694``Documentation/usb/proc_usb_info.txt`` file in your Linux kernel
695sources.
696
697This file, in combination with the poll() system call, can also be used
698to detect when devices are added or removed::
699
700 int fd;
701 struct pollfd pfd;
702
703 fd = open("/sys/kernel/debug/usb/devices", O_RDONLY);
704 pfd = { fd, POLLIN, 0 };
705 for (;;) {
706 /* The first time through, this call will return immediately. */
707 poll(&pfd, 1, -1);
708
709 /* To see what's changed, compare the file's previous and current
710 contents or scan the filesystem. (Scanning is more precise.) */
711 }
712
713Note that this behavior is intended to be used for informational and
714debug purposes. It would be more appropriate to use programs such as
715udev or HAL to initialize a device or start a user-mode helper program,
716for instance.
717
718In this file, each device's output has multiple lines of ASCII output.
719
720I made it ASCII instead of binary on purpose, so that someone
721can obtain some useful data from it without the use of an
722auxiliary program. However, with an auxiliary program, the numbers
723in the first 4 columns of each ``T:`` line (topology info:
724Lev, Prnt, Port, Cnt) can be used to build a USB topology diagram.
725
726Each line is tagged with a one-character ID for that line::
727
728 T = Topology (etc.)
729 B = Bandwidth (applies only to USB host controllers, which are
730 virtualized as root hubs)
731 D = Device descriptor info.
732 P = Product ID info. (from Device descriptor, but they won't fit
733 together on one line)
734 S = String descriptors.
735 C = Configuration descriptor info. (* = active configuration)
736 I = Interface descriptor info.
737 E = Endpoint descriptor info.
738
739/sys/kernel/debug/usb/devices output format
740~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
741
742Legend::
743 d = decimal number (may have leading spaces or 0's)
744 x = hexadecimal number (may have leading spaces or 0's)
745 s = string
746
747
748
749Topology info
750^^^^^^^^^^^^^
751
752::
753
754 T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd
755 | | | | | | | | |__MaxChildren
756 | | | | | | | |__Device Speed in Mbps
757 | | | | | | |__DeviceNumber
758 | | | | | |__Count of devices at this level
759 | | | | |__Connector/Port on Parent for this device
760 | | | |__Parent DeviceNumber
761 | | |__Level in topology for this bus
762 | |__Bus number
763 |__Topology info tag
764
765Speed may be:
766
767 ======= ======================================================
768 1.5 Mbit/s for low speed USB
769 12 Mbit/s for full speed USB
770 480 Mbit/s for high speed USB (added for USB 2.0);
771 also used for Wireless USB, which has no fixed speed
772 5000 Mbit/s for SuperSpeed USB (added for USB 3.0)
773 ======= ======================================================
774
775For reasons lost in the mists of time, the Port number is always
776too low by 1. For example, a device plugged into port 4 will
777show up with ``Port=03``.
778
779Bandwidth info
780^^^^^^^^^^^^^^
781
782::
783
784 B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd
785 | | | |__Number of isochronous requests
786 | | |__Number of interrupt requests
787 | |__Total Bandwidth allocated to this bus
788 |__Bandwidth info tag
789
790Bandwidth allocation is an approximation of how much of one frame
791(millisecond) is in use. It reflects only periodic transfers, which
792are the only transfers that reserve bandwidth. Control and bulk
793transfers use all other bandwidth, including reserved bandwidth that
794is not used for transfers (such as for short packets).
795
796The percentage is how much of the "reserved" bandwidth is scheduled by
797those transfers. For a low or full speed bus (loosely, "USB 1.1"),
79890% of the bus bandwidth is reserved. For a high speed bus (loosely,
799"USB 2.0") 80% is reserved.
800
801
802Device descriptor info & Product ID info
803^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
804
805::
806
807 D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
808 P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
809
810where::
811
812 D: Ver=x.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
813 | | | | | | |__NumberConfigurations
814 | | | | | |__MaxPacketSize of Default Endpoint
815 | | | | |__DeviceProtocol
816 | | | |__DeviceSubClass
817 | | |__DeviceClass
818 | |__Device USB version
819 |__Device info tag #1
820
821where::
822
823 P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
824 | | | |__Product revision number
825 | | |__Product ID code
826 | |__Vendor ID code
827 |__Device info tag #2
828
829
830String descriptor info
831^^^^^^^^^^^^^^^^^^^^^^
832::
833
834 S: Manufacturer=ssss
835 | |__Manufacturer of this device as read from the device.
836 | For USB host controller drivers (virtual root hubs) this may
837 | be omitted, or (for newer drivers) will identify the kernel
838 | version and the driver which provides this hub emulation.
839 |__String info tag
840
841 S: Product=ssss
842 | |__Product description of this device as read from the device.
843 | For older USB host controller drivers (virtual root hubs) this
844 | indicates the driver; for newer ones, it's a product (and vendor)
845 | description that often comes from the kernel's PCI ID database.
846 |__String info tag
847
848 S: SerialNumber=ssss
849 | |__Serial Number of this device as read from the device.
850 | For USB host controller drivers (virtual root hubs) this is
851 | some unique ID, normally a bus ID (address or slot name) that
852 | can't be shared with any other device.
853 |__String info tag
854
855
856
857Configuration descriptor info
858^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
859::
860
861 C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA
862 | | | | | |__MaxPower in mA
863 | | | | |__Attributes
864 | | | |__ConfiguratioNumber
865 | | |__NumberOfInterfaces
866 | |__ "*" indicates the active configuration (others are " ")
867 |__Config info tag
868
869USB devices may have multiple configurations, each of which act
870rather differently. For example, a bus-powered configuration
871might be much less capable than one that is self-powered. Only
872one device configuration can be active at a time; most devices
873have only one configuration.
874
875Each configuration consists of one or more interfaces. Each
876interface serves a distinct "function", which is typically bound
877to a different USB device driver. One common example is a USB
878speaker with an audio interface for playback, and a HID interface
879for use with software volume control.
880
881Interface descriptor info (can be multiple per Config)
882^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
883::
884
885 I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss
886 | | | | | | | | |__Driver name
887 | | | | | | | | or "(none)"
888 | | | | | | | |__InterfaceProtocol
889 | | | | | | |__InterfaceSubClass
890 | | | | | |__InterfaceClass
891 | | | | |__NumberOfEndpoints
892 | | | |__AlternateSettingNumber
893 | | |__InterfaceNumber
894 | |__ "*" indicates the active altsetting (others are " ")
895 |__Interface info tag
896
897A given interface may have one or more "alternate" settings.
898For example, default settings may not use more than a small
899amount of periodic bandwidth. To use significant fractions
900of bus bandwidth, drivers must select a non-default altsetting.
901
902Only one setting for an interface may be active at a time, and
903only one driver may bind to an interface at a time. Most devices
904have only one alternate setting per interface.
905
906
907Endpoint descriptor info (can be multiple per Interface)
908^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
909
910::
911
912 E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddss
913 | | | | |__Interval (max) between transfers
914 | | | |__EndpointMaxPacketSize
915 | | |__Attributes(EndpointType)
916 | |__EndpointAddress(I=In,O=Out)
917 |__Endpoint info tag
918
919The interval is nonzero for all periodic (interrupt or isochronous)
920endpoints. For high speed endpoints the transfer interval may be
921measured in microseconds rather than milliseconds.
922
923For high speed periodic endpoints, the ``EndpointMaxPacketSize`` reflects
924the per-microframe data transfer size. For "high bandwidth"
925endpoints, that can reflect two or three packets (for up to
9263KBytes every 125 usec) per endpoint.
927
928With the Linux-USB stack, periodic bandwidth reservations use the
929transfer intervals and sizes provided by URBs, which can be less
930than those found in endpoint descriptor.
931
932Usage examples
933~~~~~~~~~~~~~~
934
935If a user or script is interested only in Topology info, for
936example, use something like ``grep ^T: /sys/kernel/debug/usb/devices``
937for only the Topology lines. A command like
938``grep -i ^[tdp]: /sys/kernel/debug/usb/devices`` can be used to list
939only the lines that begin with the characters in square brackets,
940where the valid characters are TDPCIE. With a slightly more able
941script, it can display any selected lines (for example, only T, D,
942and P lines) and change their output format. (The ``procusb``
943Perl script is the beginning of this idea. It will list only
944selected lines [selected from TBDPSCIE] or "All" lines from
945``/sys/kernel/debug/usb/devices``.)
946
947The Topology lines can be used to generate a graphic/pictorial
948of the USB devices on a system's root hub. (See more below
949on how to do this.)
950
951The Interface lines can be used to determine what driver is
952being used for each device, and which altsetting it activated.
953
954The Configuration lines could be used to list maximum power
955(in milliamps) that a system's USB devices are using.
956For example, ``grep ^C: /sys/kernel/debug/usb/devices``.
957
958
959Here's an example, from a system which has a UHCI root hub,
960an external hub connected to the root hub, and a mouse and
961a serial converter connected to the external hub.
962
963::
964
965 T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
966 B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0
967 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
968 P: Vendor=0000 ProdID=0000 Rev= 0.00
969 S: Product=USB UHCI Root Hub
970 S: SerialNumber=dce0
971 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
972 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
973 E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
974
975 T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
976 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
977 P: Vendor=0451 ProdID=1446 Rev= 1.00
978 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
979 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
980 E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms
981
982 T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
983 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
984 P: Vendor=04b4 ProdID=0001 Rev= 0.00
985 C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
986 I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
987 E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms
988
989 T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
990 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
991 P: Vendor=0565 ProdID=0001 Rev= 1.08
992 S: Manufacturer=Peracom Networks, Inc.
993 S: Product=Peracom USB to Serial Converter
994 C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
995 I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
996 E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl= 16ms
997 E: Ad=01(O) Atr=02(Bulk) MxPS= 16 Ivl= 16ms
998 E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms
999
1000
1001Selecting only the ``T:`` and ``I:`` lines from this (for example, by using
1002``procusb ti``), we have
1003
1004::
1005
1006 T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
1007 T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
1008 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
1009 T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
1010 I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
1011 T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
1012 I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
1013
1014
1015Physically this looks like (or could be converted to)::
1016
1017 +------------------+
1018 | PC/root_hub (12)| Dev# = 1
1019 +------------------+ (nn) is Mbps.
1020 Level 0 | CN.0 | CN.1 | [CN = connector/port #]
1021 +------------------+
1022 /
1023 /
1024 +-----------------------+
1025 Level 1 | Dev#2: 4-port hub (12)|
1026 +-----------------------+
1027 |CN.0 |CN.1 |CN.2 |CN.3 |
1028 +-----------------------+
1029 \ \____________________
1030 \_____ \
1031 \ \
1032 +--------------------+ +--------------------+
1033 Level 2 | Dev# 3: mouse (1.5)| | Dev# 4: serial (12)|
1034 +--------------------+ +--------------------+
1035
1036
1037
1038Or, in a more tree-like structure (ports [Connectors] without
1039connections could be omitted)::
1040
1041 PC: Dev# 1, root hub, 2 ports, 12 Mbps
1042 |_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps
1043 |_ CN.0: Dev #3, mouse, 1.5 Mbps
1044 |_ CN.1:
1045 |_ CN.2: Dev #4, serial, 12 Mbps
1046 |_ CN.3:
1047 |_ CN.1:
diff --git a/Documentation/driver-api/usb/writing_musb_glue_layer.rst b/Documentation/driver-api/usb/writing_musb_glue_layer.rst
new file mode 100644
index 000000000000..e90e8fa95600
--- /dev/null
+++ b/Documentation/driver-api/usb/writing_musb_glue_layer.rst
@@ -0,0 +1,723 @@
1=========================
2Writing a MUSB Glue Layer
3=========================
4
5:Author: Apelete Seketeli
6
7Introduction
8============
9
10The Linux MUSB subsystem is part of the larger Linux USB subsystem. It
11provides support for embedded USB Device Controllers (UDC) that do not
12use Universal Host Controller Interface (UHCI) or Open Host Controller
13Interface (OHCI).
14
15Instead, these embedded UDC rely on the USB On-the-Go (OTG)
16specification which they implement at least partially. The silicon
17reference design used in most cases is the Multipoint USB Highspeed
18Dual-Role Controller (MUSB HDRC) found in the Mentor Graphics Inventraâ„¢
19design.
20
21As a self-taught exercise I have written an MUSB glue layer for the
22Ingenic JZ4740 SoC, modelled after the many MUSB glue layers in the
23kernel source tree. This layer can be found at
24``drivers/usb/musb/jz4740.c``. In this documentation I will walk through the
25basics of the ``jz4740.c`` glue layer, explaining the different pieces and
26what needs to be done in order to write your own device glue layer.
27
28.. _musb-basics:
29
30Linux MUSB Basics
31=================
32
33To get started on the topic, please read USB On-the-Go Basics (see
34Resources) which provides an introduction of USB OTG operation at the
35hardware level. A couple of wiki pages by Texas Instruments and Analog
36Devices also provide an overview of the Linux kernel MUSB configuration,
37albeit focused on some specific devices provided by these companies.
38Finally, getting acquainted with the USB specification at USB home page
39may come in handy, with practical instance provided through the Writing
40USB Device Drivers documentation (again, see Resources).
41
42Linux USB stack is a layered architecture in which the MUSB controller
43hardware sits at the lowest. The MUSB controller driver abstract the
44MUSB controller hardware to the Linux USB stack::
45
46 ------------------------
47 | | <------- drivers/usb/gadget
48 | Linux USB Core Stack | <------- drivers/usb/host
49 | | <------- drivers/usb/core
50 ------------------------
51 â¬
52 --------------------------
53 | | <------ drivers/usb/musb/musb_gadget.c
54 | MUSB Controller driver | <------ drivers/usb/musb/musb_host.c
55 | | <------ drivers/usb/musb/musb_core.c
56 --------------------------
57 â¬
58 ---------------------------------
59 | MUSB Platform Specific Driver |
60 | | <-- drivers/usb/musb/jz4740.c
61 | aka "Glue Layer" |
62 ---------------------------------
63 â¬
64 ---------------------------------
65 | MUSB Controller Hardware |
66 ---------------------------------
67
68As outlined above, the glue layer is actually the platform specific code
69sitting in between the controller driver and the controller hardware.
70
71Just like a Linux USB driver needs to register itself with the Linux USB
72subsystem, the MUSB glue layer needs first to register itself with the
73MUSB controller driver. This will allow the controller driver to know
74about which device the glue layer supports and which functions to call
75when a supported device is detected or released; remember we are talking
76about an embedded controller chip here, so no insertion or removal at
77run-time.
78
79All of this information is passed to the MUSB controller driver through
80a :c:type:`platform_driver` structure defined in the glue layer as::
81
82 static struct platform_driver jz4740_driver = {
83 .probe = jz4740_probe,
84 .remove = jz4740_remove,
85 .driver = {
86 .name = "musb-jz4740",
87 },
88 };
89
90The probe and remove function pointers are called when a matching device
91is detected and, respectively, released. The name string describes the
92device supported by this glue layer. In the current case it matches a
93platform_device structure declared in ``arch/mips/jz4740/platform.c``. Note
94that we are not using device tree bindings here.
95
96In order to register itself to the controller driver, the glue layer
97goes through a few steps, basically allocating the controller hardware
98resources and initialising a couple of circuits. To do so, it needs to
99keep track of the information used throughout these steps. This is done
100by defining a private ``jz4740_glue`` structure::
101
102 struct jz4740_glue {
103 struct device *dev;
104 struct platform_device *musb;
105 struct clk *clk;
106 };
107
108
109The dev and musb members are both device structure variables. The first
110one holds generic information about the device, since it's the basic
111device structure, and the latter holds information more closely related
112to the subsystem the device is registered to. The clk variable keeps
113information related to the device clock operation.
114
115Let's go through the steps of the probe function that leads the glue
116layer to register itself to the controller driver.
117
118.. note::
119
120 For the sake of readability each function will be split in logical
121 parts, each part being shown as if it was independent from the others.
122
123.. code-block:: c
124 :emphasize-lines: 8,12,18
125
126 static int jz4740_probe(struct platform_device *pdev)
127 {
128 struct platform_device *musb;
129 struct jz4740_glue *glue;
130 struct clk *clk;
131 int ret;
132
133 glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
134 if (!glue)
135 return -ENOMEM;
136
137 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
138 if (!musb) {
139 dev_err(&pdev->dev, "failed to allocate musb device\n");
140 return -ENOMEM;
141 }
142
143 clk = devm_clk_get(&pdev->dev, "udc");
144 if (IS_ERR(clk)) {
145 dev_err(&pdev->dev, "failed to get clock\n");
146 ret = PTR_ERR(clk);
147 goto err_platform_device_put;
148 }
149
150 ret = clk_prepare_enable(clk);
151 if (ret) {
152 dev_err(&pdev->dev, "failed to enable clock\n");
153 goto err_platform_device_put;
154 }
155
156 musb->dev.parent = &pdev->dev;
157
158 glue->dev = &pdev->dev;
159 glue->musb = musb;
160 glue->clk = clk;
161
162 return 0;
163
164 err_platform_device_put:
165 platform_device_put(musb);
166 return ret;
167 }
168
169The first few lines of the probe function allocate and assign the glue,
170musb and clk variables. The ``GFP_KERNEL`` flag (line 8) allows the
171allocation process to sleep and wait for memory, thus being usable in a
172locking situation. The ``PLATFORM_DEVID_AUTO`` flag (line 12) allows
173automatic allocation and management of device IDs in order to avoid
174device namespace collisions with explicit IDs. With :c:func:`devm_clk_get`
175(line 18) the glue layer allocates the clock -- the ``devm_`` prefix
176indicates that :c:func:`clk_get` is managed: it automatically frees the
177allocated clock resource data when the device is released -- and enable
178it.
179
180
181
182Then comes the registration steps:
183
184.. code-block:: c
185 :emphasize-lines: 3,5,7,9,16
186
187 static int jz4740_probe(struct platform_device *pdev)
188 {
189 struct musb_hdrc_platform_data *pdata = &jz4740_musb_platform_data;
190
191 pdata->platform_ops = &jz4740_musb_ops;
192
193 platform_set_drvdata(pdev, glue);
194
195 ret = platform_device_add_resources(musb, pdev->resource,
196 pdev->num_resources);
197 if (ret) {
198 dev_err(&pdev->dev, "failed to add resources\n");
199 goto err_clk_disable;
200 }
201
202 ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
203 if (ret) {
204 dev_err(&pdev->dev, "failed to add platform_data\n");
205 goto err_clk_disable;
206 }
207
208 return 0;
209
210 err_clk_disable:
211 clk_disable_unprepare(clk);
212 err_platform_device_put:
213 platform_device_put(musb);
214 return ret;
215 }
216
217The first step is to pass the device data privately held by the glue
218layer on to the controller driver through :c:func:`platform_set_drvdata`
219(line 7). Next is passing on the device resources information, also privately
220held at that point, through :c:func:`platform_device_add_resources` (line 9).
221
222Finally comes passing on the platform specific data to the controller
223driver (line 16). Platform data will be discussed in
224:ref:`musb-dev-platform-data`, but here we are looking at the
225``platform_ops`` function pointer (line 5) in ``musb_hdrc_platform_data``
226structure (line 3). This function pointer allows the MUSB controller
227driver to know which function to call for device operation::
228
229 static const struct musb_platform_ops jz4740_musb_ops = {
230 .init = jz4740_musb_init,
231 .exit = jz4740_musb_exit,
232 };
233
234Here we have the minimal case where only init and exit functions are
235called by the controller driver when needed. Fact is the JZ4740 MUSB
236controller is a basic controller, lacking some features found in other
237controllers, otherwise we may also have pointers to a few other
238functions like a power management function or a function to switch
239between OTG and non-OTG modes, for instance.
240
241At that point of the registration process, the controller driver
242actually calls the init function:
243
244 .. code-block:: c
245 :emphasize-lines: 12,14
246
247 static int jz4740_musb_init(struct musb *musb)
248 {
249 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
250 if (!musb->xceiv) {
251 pr_err("HS UDC: no transceiver configured\n");
252 return -ENODEV;
253 }
254
255 /* Silicon does not implement ConfigData register.
256 * Set dyn_fifo to avoid reading EP config from hardware.
257 */
258 musb->dyn_fifo = true;
259
260 musb->isr = jz4740_musb_interrupt;
261
262 return 0;
263 }
264
265The goal of ``jz4740_musb_init()`` is to get hold of the transceiver
266driver data of the MUSB controller hardware and pass it on to the MUSB
267controller driver, as usual. The transceiver is the circuitry inside the
268controller hardware responsible for sending/receiving the USB data.
269Since it is an implementation of the physical layer of the OSI model,
270the transceiver is also referred to as PHY.
271
272Getting hold of the ``MUSB PHY`` driver data is done with ``usb_get_phy()``
273which returns a pointer to the structure containing the driver instance
274data. The next couple of instructions (line 12 and 14) are used as a
275quirk and to setup IRQ handling respectively. Quirks and IRQ handling
276will be discussed later in :ref:`musb-dev-quirks` and
277:ref:`musb-handling-irqs`\ ::
278
279 static int jz4740_musb_exit(struct musb *musb)
280 {
281 usb_put_phy(musb->xceiv);
282
283 return 0;
284 }
285
286Acting as the counterpart of init, the exit function releases the MUSB
287PHY driver when the controller hardware itself is about to be released.
288
289Again, note that init and exit are fairly simple in this case due to the
290basic set of features of the JZ4740 controller hardware. When writing an
291musb glue layer for a more complex controller hardware, you might need
292to take care of more processing in those two functions.
293
294Returning from the init function, the MUSB controller driver jumps back
295into the probe function::
296
297 static int jz4740_probe(struct platform_device *pdev)
298 {
299 ret = platform_device_add(musb);
300 if (ret) {
301 dev_err(&pdev->dev, "failed to register musb device\n");
302 goto err_clk_disable;
303 }
304
305 return 0;
306
307 err_clk_disable:
308 clk_disable_unprepare(clk);
309 err_platform_device_put:
310 platform_device_put(musb);
311 return ret;
312 }
313
314This is the last part of the device registration process where the glue
315layer adds the controller hardware device to Linux kernel device
316hierarchy: at this stage, all known information about the device is
317passed on to the Linux USB core stack:
318
319 .. code-block:: c
320 :emphasize-lines: 5,6
321
322 static int jz4740_remove(struct platform_device *pdev)
323 {
324 struct jz4740_glue *glue = platform_get_drvdata(pdev);
325
326 platform_device_unregister(glue->musb);
327 clk_disable_unprepare(glue->clk);
328
329 return 0;
330 }
331
332Acting as the counterpart of probe, the remove function unregister the
333MUSB controller hardware (line 5) and disable the clock (line 6),
334allowing it to be gated.
335
336.. _musb-handling-irqs:
337
338Handling IRQs
339=============
340
341Additionally to the MUSB controller hardware basic setup and
342registration, the glue layer is also responsible for handling the IRQs:
343
344 .. code-block:: c
345 :emphasize-lines: 7,9-11,14,24
346
347 static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
348 {
349 unsigned long flags;
350 irqreturn_t retval = IRQ_NONE;
351 struct musb *musb = __hci;
352
353 spin_lock_irqsave(&musb->lock, flags);
354
355 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
356 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
357 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
358
359 /*
360 * The controller is gadget only, the state of the host mode IRQ bits is
361 * undefined. Mask them to make sure that the musb driver core will
362 * never see them set
363 */
364 musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME |
365 MUSB_INTR_RESET | MUSB_INTR_SOF;
366
367 if (musb->int_usb || musb->int_tx || musb->int_rx)
368 retval = musb_interrupt(musb);
369
370 spin_unlock_irqrestore(&musb->lock, flags);
371
372 return retval;
373 }
374
375Here the glue layer mostly has to read the relevant hardware registers
376and pass their values on to the controller driver which will handle the
377actual event that triggered the IRQ.
378
379The interrupt handler critical section is protected by the
380:c:func:`spin_lock_irqsave` and counterpart :c:func:`spin_unlock_irqrestore`
381functions (line 7 and 24 respectively), which prevent the interrupt
382handler code to be run by two different threads at the same time.
383
384Then the relevant interrupt registers are read (line 9 to 11):
385
386- ``MUSB_INTRUSB``: indicates which USB interrupts are currently active,
387
388- ``MUSB_INTRTX``: indicates which of the interrupts for TX endpoints are
389 currently active,
390
391- ``MUSB_INTRRX``: indicates which of the interrupts for TX endpoints are
392 currently active.
393
394Note that :c:func:`musb_readb` is used to read 8-bit registers at most, while
395:c:func:`musb_readw` allows us to read at most 16-bit registers. There are
396other functions that can be used depending on the size of your device
397registers. See ``musb_io.h`` for more information.
398
399Instruction on line 18 is another quirk specific to the JZ4740 USB
400device controller, which will be discussed later in :ref:`musb-dev-quirks`.
401
402The glue layer still needs to register the IRQ handler though. Remember
403the instruction on line 14 of the init function::
404
405 static int jz4740_musb_init(struct musb *musb)
406 {
407 musb->isr = jz4740_musb_interrupt;
408
409 return 0;
410 }
411
412This instruction sets a pointer to the glue layer IRQ handler function,
413in order for the controller hardware to call the handler back when an
414IRQ comes from the controller hardware. The interrupt handler is now
415implemented and registered.
416
417.. _musb-dev-platform-data:
418
419Device Platform Data
420====================
421
422In order to write an MUSB glue layer, you need to have some data
423describing the hardware capabilities of your controller hardware, which
424is called the platform data.
425
426Platform data is specific to your hardware, though it may cover a broad
427range of devices, and is generally found somewhere in the ``arch/``
428directory, depending on your device architecture.
429
430For instance, platform data for the JZ4740 SoC is found in
431``arch/mips/jz4740/platform.c``. In the ``platform.c`` file each device of the
432JZ4740 SoC is described through a set of structures.
433
434Here is the part of ``arch/mips/jz4740/platform.c`` that covers the USB
435Device Controller (UDC):
436
437 .. code-block:: c
438 :emphasize-lines: 2,7,14-17,21,22,25,26,28,29
439
440 /* USB Device Controller */
441 struct platform_device jz4740_udc_xceiv_device = {
442 .name = "usb_phy_gen_xceiv",
443 .id = 0,
444 };
445
446 static struct resource jz4740_udc_resources[] = {
447 [0] = {
448 .start = JZ4740_UDC_BASE_ADDR,
449 .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
450 .flags = IORESOURCE_MEM,
451 },
452 [1] = {
453 .start = JZ4740_IRQ_UDC,
454 .end = JZ4740_IRQ_UDC,
455 .flags = IORESOURCE_IRQ,
456 .name = "mc",
457 },
458 };
459
460 struct platform_device jz4740_udc_device = {
461 .name = "musb-jz4740",
462 .id = -1,
463 .dev = {
464 .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask,
465 .coherent_dma_mask = DMA_BIT_MASK(32),
466 },
467 .num_resources = ARRAY_SIZE(jz4740_udc_resources),
468 .resource = jz4740_udc_resources,
469 };
470
471The ``jz4740_udc_xceiv_device`` platform device structure (line 2)
472describes the UDC transceiver with a name and id number.
473
474At the time of this writing, note that ``usb_phy_gen_xceiv`` is the
475specific name to be used for all transceivers that are either built-in
476with reference USB IP or autonomous and doesn't require any PHY
477programming. You will need to set ``CONFIG_NOP_USB_XCEIV=y`` in the
478kernel configuration to make use of the corresponding transceiver
479driver. The id field could be set to -1 (equivalent to
480``PLATFORM_DEVID_NONE``), -2 (equivalent to ``PLATFORM_DEVID_AUTO``) or
481start with 0 for the first device of this kind if we want a specific id
482number.
483
484The ``jz4740_udc_resources`` resource structure (line 7) defines the UDC
485registers base addresses.
486
487The first array (line 9 to 11) defines the UDC registers base memory
488addresses: start points to the first register memory address, end points
489to the last register memory address and the flags member defines the
490type of resource we are dealing with. So ``IORESOURCE_MEM`` is used to
491define the registers memory addresses. The second array (line 14 to 17)
492defines the UDC IRQ registers addresses. Since there is only one IRQ
493register available for the JZ4740 UDC, start and end point at the same
494address. The ``IORESOURCE_IRQ`` flag tells that we are dealing with IRQ
495resources, and the name ``mc`` is in fact hard-coded in the MUSB core in
496order for the controller driver to retrieve this IRQ resource by
497querying it by its name.
498
499Finally, the ``jz4740_udc_device`` platform device structure (line 21)
500describes the UDC itself.
501
502The ``musb-jz4740`` name (line 22) defines the MUSB driver that is used
503for this device; remember this is in fact the name that we used in the
504``jz4740_driver`` platform driver structure in :ref:`musb-basics`.
505The id field (line 23) is set to -1 (equivalent to ``PLATFORM_DEVID_NONE``)
506since we do not need an id for the device: the MUSB controller driver was
507already set to allocate an automatic id in :ref:`musb-basics`. In the dev field
508we care for DMA related information here. The ``dma_mask`` field (line 25)
509defines the width of the DMA mask that is going to be used, and
510``coherent_dma_mask`` (line 26) has the same purpose but for the
511``alloc_coherent`` DMA mappings: in both cases we are using a 32 bits mask.
512Then the resource field (line 29) is simply a pointer to the resource
513structure defined before, while the ``num_resources`` field (line 28) keeps
514track of the number of arrays defined in the resource structure (in this
515case there were two resource arrays defined before).
516
517With this quick overview of the UDC platform data at the ``arch/`` level now
518done, let's get back to the MUSB glue layer specific platform data in
519``drivers/usb/musb/jz4740.c``:
520
521 .. code-block:: c
522 :emphasize-lines: 3,5,7-9,11
523
524 static struct musb_hdrc_config jz4740_musb_config = {
525 /* Silicon does not implement USB OTG. */
526 .multipoint = 0,
527 /* Max EPs scanned, driver will decide which EP can be used. */
528 .num_eps = 4,
529 /* RAMbits needed to configure EPs from table */
530 .ram_bits = 9,
531 .fifo_cfg = jz4740_musb_fifo_cfg,
532 .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg),
533 };
534
535 static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
536 .mode = MUSB_PERIPHERAL,
537 .config = &jz4740_musb_config,
538 };
539
540First the glue layer configures some aspects of the controller driver
541operation related to the controller hardware specifics. This is done
542through the ``jz4740_musb_config`` :c:type:`musb_hdrc_config` structure.
543
544Defining the OTG capability of the controller hardware, the multipoint
545member (line 3) is set to 0 (equivalent to false) since the JZ4740 UDC
546is not OTG compatible. Then ``num_eps`` (line 5) defines the number of USB
547endpoints of the controller hardware, including endpoint 0: here we have
5483 endpoints + endpoint 0. Next is ``ram_bits`` (line 7) which is the width
549of the RAM address bus for the MUSB controller hardware. This
550information is needed when the controller driver cannot automatically
551configure endpoints by reading the relevant controller hardware
552registers. This issue will be discussed when we get to device quirks in
553:ref:`musb-dev-quirks`. Last two fields (line 8 and 9) are also
554about device quirks: ``fifo_cfg`` points to the USB endpoints configuration
555table and ``fifo_cfg_size`` keeps track of the size of the number of
556entries in that configuration table. More on that later in
557:ref:`musb-dev-quirks`.
558
559Then this configuration is embedded inside ``jz4740_musb_platform_data``
560:c:type:`musb_hdrc_platform_data` structure (line 11): config is a pointer to
561the configuration structure itself, and mode tells the controller driver
562if the controller hardware may be used as ``MUSB_HOST`` only,
563``MUSB_PERIPHERAL`` only or ``MUSB_OTG`` which is a dual mode.
564
565Remember that ``jz4740_musb_platform_data`` is then used to convey
566platform data information as we have seen in the probe function in
567:ref:`musb-basics`.
568
569.. _musb-dev-quirks:
570
571Device Quirks
572=============
573
574Completing the platform data specific to your device, you may also need
575to write some code in the glue layer to work around some device specific
576limitations. These quirks may be due to some hardware bugs, or simply be
577the result of an incomplete implementation of the USB On-the-Go
578specification.
579
580The JZ4740 UDC exhibits such quirks, some of which we will discuss here
581for the sake of insight even though these might not be found in the
582controller hardware you are working on.
583
584Let's get back to the init function first:
585
586 .. code-block:: c
587 :emphasize-lines: 12
588
589 static int jz4740_musb_init(struct musb *musb)
590 {
591 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
592 if (!musb->xceiv) {
593 pr_err("HS UDC: no transceiver configured\n");
594 return -ENODEV;
595 }
596
597 /* Silicon does not implement ConfigData register.
598 * Set dyn_fifo to avoid reading EP config from hardware.
599 */
600 musb->dyn_fifo = true;
601
602 musb->isr = jz4740_musb_interrupt;
603
604 return 0;
605 }
606
607Instruction on line 12 helps the MUSB controller driver to work around
608the fact that the controller hardware is missing registers that are used
609for USB endpoints configuration.
610
611Without these registers, the controller driver is unable to read the
612endpoints configuration from the hardware, so we use line 12 instruction
613to bypass reading the configuration from silicon, and rely on a
614hard-coded table that describes the endpoints configuration instead::
615
616 static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = {
617 { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
618 { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
619 { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, },
620 };
621
622Looking at the configuration table above, we see that each endpoints is
623described by three fields: ``hw_ep_num`` is the endpoint number, style is
624its direction (either ``FIFO_TX`` for the controller driver to send packets
625in the controller hardware, or ``FIFO_RX`` to receive packets from
626hardware), and maxpacket defines the maximum size of each data packet
627that can be transmitted over that endpoint. Reading from the table, the
628controller driver knows that endpoint 1 can be used to send and receive
629USB data packets of 512 bytes at once (this is in fact a bulk in/out
630endpoint), and endpoint 2 can be used to send data packets of 64 bytes
631at once (this is in fact an interrupt endpoint).
632
633Note that there is no information about endpoint 0 here: that one is
634implemented by default in every silicon design, with a predefined
635configuration according to the USB specification. For more examples of
636endpoint configuration tables, see ``musb_core.c``.
637
638Let's now get back to the interrupt handler function:
639
640 .. code-block:: c
641 :emphasize-lines: 18-19
642
643 static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
644 {
645 unsigned long flags;
646 irqreturn_t retval = IRQ_NONE;
647 struct musb *musb = __hci;
648
649 spin_lock_irqsave(&musb->lock, flags);
650
651 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
652 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
653 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
654
655 /*
656 * The controller is gadget only, the state of the host mode IRQ bits is
657 * undefined. Mask them to make sure that the musb driver core will
658 * never see them set
659 */
660 musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME |
661 MUSB_INTR_RESET | MUSB_INTR_SOF;
662
663 if (musb->int_usb || musb->int_tx || musb->int_rx)
664 retval = musb_interrupt(musb);
665
666 spin_unlock_irqrestore(&musb->lock, flags);
667
668 return retval;
669 }
670
671Instruction on line 18 above is a way for the controller driver to work
672around the fact that some interrupt bits used for USB host mode
673operation are missing in the ``MUSB_INTRUSB`` register, thus left in an
674undefined hardware state, since this MUSB controller hardware is used in
675peripheral mode only. As a consequence, the glue layer masks these
676missing bits out to avoid parasite interrupts by doing a logical AND
677operation between the value read from ``MUSB_INTRUSB`` and the bits that
678are actually implemented in the register.
679
680These are only a couple of the quirks found in the JZ4740 USB device
681controller. Some others were directly addressed in the MUSB core since
682the fixes were generic enough to provide a better handling of the issues
683for others controller hardware eventually.
684
685Conclusion
686==========
687
688Writing a Linux MUSB glue layer should be a more accessible task, as
689this documentation tries to show the ins and outs of this exercise.
690
691The JZ4740 USB device controller being fairly simple, I hope its glue
692layer serves as a good example for the curious mind. Used with the
693current MUSB glue layers, this documentation should provide enough
694guidance to get started; should anything gets out of hand, the linux-usb
695mailing list archive is another helpful resource to browse through.
696
697Acknowledgements
698================
699
700Many thanks to Lars-Peter Clausen and Maarten ter Huurne for answering
701my questions while I was writing the JZ4740 glue layer and for helping
702me out getting the code in good shape.
703
704I would also like to thank the Qi-Hardware community at large for its
705cheerful guidance and support.
706
707Resources
708=========
709
710USB Home Page: http://www.usb.org
711
712linux-usb Mailing List Archives: http://marc.info/?l=linux-usb
713
714USB On-the-Go Basics:
715http://www.maximintegrated.com/app-notes/index.mvp/id/1822
716
717:ref:`Writing USB Device Drivers <writing-usb-driver>`
718
719Texas Instruments USB Configuration Wiki Page:
720http://processors.wiki.ti.com/index.php/Usbgeneralpage
721
722Analog Devices Blackfin MUSB Configuration:
723http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb
diff --git a/Documentation/driver-api/usb/writing_usb_driver.rst b/Documentation/driver-api/usb/writing_usb_driver.rst
new file mode 100644
index 000000000000..69f077dcdb78
--- /dev/null
+++ b/Documentation/driver-api/usb/writing_usb_driver.rst
@@ -0,0 +1,326 @@
1.. _writing-usb-driver:
2
3==========================
4Writing USB Device Drivers
5==========================
6
7:Author: Greg Kroah-Hartman
8
9Introduction
10============
11
12The Linux USB subsystem has grown from supporting only two different
13types of devices in the 2.2.7 kernel (mice and keyboards), to over 20
14different types of devices in the 2.4 kernel. Linux currently supports
15almost all USB class devices (standard types of devices like keyboards,
16mice, modems, printers and speakers) and an ever-growing number of
17vendor-specific devices (such as USB to serial converters, digital
18cameras, Ethernet devices and MP3 players). For a full list of the
19different USB devices currently supported, see Resources.
20
21The remaining kinds of USB devices that do not have support on Linux are
22almost all vendor-specific devices. Each vendor decides to implement a
23custom protocol to talk to their device, so a custom driver usually
24needs to be created. Some vendors are open with their USB protocols and
25help with the creation of Linux drivers, while others do not publish
26them, and developers are forced to reverse-engineer. See Resources for
27some links to handy reverse-engineering tools.
28
29Because each different protocol causes a new driver to be created, I
30have written a generic USB driver skeleton, modelled after the
31pci-skeleton.c file in the kernel source tree upon which many PCI
32network drivers have been based. This USB skeleton can be found at
33drivers/usb/usb-skeleton.c in the kernel source tree. In this article I
34will walk through the basics of the skeleton driver, explaining the
35different pieces and what needs to be done to customize it to your
36specific device.
37
38Linux USB Basics
39================
40
41If you are going to write a Linux USB driver, please become familiar
42with the USB protocol specification. It can be found, along with many
43other useful documents, at the USB home page (see Resources). An
44excellent introduction to the Linux USB subsystem can be found at the
45USB Working Devices List (see Resources). It explains how the Linux USB
46subsystem is structured and introduces the reader to the concept of USB
47urbs (USB Request Blocks), which are essential to USB drivers.
48
49The first thing a Linux USB driver needs to do is register itself with
50the Linux USB subsystem, giving it some information about which devices
51the driver supports and which functions to call when a device supported
52by the driver is inserted or removed from the system. All of this
53information is passed to the USB subsystem in the :c:type:`usb_driver`
54structure. The skeleton driver declares a :c:type:`usb_driver` as::
55
56 static struct usb_driver skel_driver = {
57 .name = "skeleton",
58 .probe = skel_probe,
59 .disconnect = skel_disconnect,
60 .fops = &skel_fops,
61 .minor = USB_SKEL_MINOR_BASE,
62 .id_table = skel_table,
63 };
64
65
66The variable name is a string that describes the driver. It is used in
67informational messages printed to the system log. The probe and
68disconnect function pointers are called when a device that matches the
69information provided in the ``id_table`` variable is either seen or
70removed.
71
72The fops and minor variables are optional. Most USB drivers hook into
73another kernel subsystem, such as the SCSI, network or TTY subsystem.
74These types of drivers register themselves with the other kernel
75subsystem, and any user-space interactions are provided through that
76interface. But for drivers that do not have a matching kernel subsystem,
77such as MP3 players or scanners, a method of interacting with user space
78is needed. The USB subsystem provides a way to register a minor device
79number and a set of :c:type:`file_operations` function pointers that enable
80this user-space interaction. The skeleton driver needs this kind of
81interface, so it provides a minor starting number and a pointer to its
82:c:type:`file_operations` functions.
83
84The USB driver is then registered with a call to :c:func:`usb_register`,
85usually in the driver's init function, as shown here::
86
87 static int __init usb_skel_init(void)
88 {
89 int result;
90
91 /* register this driver with the USB subsystem */
92 result = usb_register(&skel_driver);
93 if (result < 0) {
94 err("usb_register failed for the "__FILE__ "driver."
95 "Error number %d", result);
96 return -1;
97 }
98
99 return 0;
100 }
101 module_init(usb_skel_init);
102
103
104When the driver is unloaded from the system, it needs to deregister
105itself with the USB subsystem. This is done with the :c:func:`usb_deregister`
106function::
107
108 static void __exit usb_skel_exit(void)
109 {
110 /* deregister this driver with the USB subsystem */
111 usb_deregister(&skel_driver);
112 }
113 module_exit(usb_skel_exit);
114
115
116To enable the linux-hotplug system to load the driver automatically when
117the device is plugged in, you need to create a ``MODULE_DEVICE_TABLE``.
118The following code tells the hotplug scripts that this module supports a
119single device with a specific vendor and product ID::
120
121 /* table of devices that work with this driver */
122 static struct usb_device_id skel_table [] = {
123 { USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
124 { } /* Terminating entry */
125 };
126 MODULE_DEVICE_TABLE (usb, skel_table);
127
128
129There are other macros that can be used in describing a struct
130:c:type:`usb_device_id` for drivers that support a whole class of USB
131drivers. See :ref:`usb.h <usb_header>` for more information on this.
132
133Device operation
134================
135
136When a device is plugged into the USB bus that matches the device ID
137pattern that your driver registered with the USB core, the probe
138function is called. The :c:type:`usb_device` structure, interface number and
139the interface ID are passed to the function::
140
141 static int skel_probe(struct usb_interface *interface,
142 const struct usb_device_id *id)
143
144
145The driver now needs to verify that this device is actually one that it
146can accept. If so, it returns 0. If not, or if any error occurs during
147initialization, an errorcode (such as ``-ENOMEM`` or ``-ENODEV``) is
148returned from the probe function.
149
150In the skeleton driver, we determine what end points are marked as
151bulk-in and bulk-out. We create buffers to hold the data that will be
152sent and received from the device, and a USB urb to write data to the
153device is initialized.
154
155Conversely, when the device is removed from the USB bus, the disconnect
156function is called with the device pointer. The driver needs to clean
157any private data that has been allocated at this time and to shut down
158any pending urbs that are in the USB system.
159
160Now that the device is plugged into the system and the driver is bound
161to the device, any of the functions in the :c:type:`file_operations` structure
162that were passed to the USB subsystem will be called from a user program
163trying to talk to the device. The first function called will be open, as
164the program tries to open the device for I/O. We increment our private
165usage count and save a pointer to our internal structure in the file
166structure. This is done so that future calls to file operations will
167enable the driver to determine which device the user is addressing. All
168of this is done with the following code::
169
170 /* increment our usage count for the module */
171 ++skel->open_count;
172
173 /* save our object in the file's private structure */
174 file->private_data = dev;
175
176
177After the open function is called, the read and write functions are
178called to receive and send data to the device. In the ``skel_write``
179function, we receive a pointer to some data that the user wants to send
180to the device and the size of the data. The function determines how much
181data it can send to the device based on the size of the write urb it has
182created (this size depends on the size of the bulk out end point that
183the device has). Then it copies the data from user space to kernel
184space, points the urb to the data and submits the urb to the USB
185subsystem. This can be seen in the following code::
186
187 /* we can only write as much as 1 urb will hold */
188 bytes_written = (count > skel->bulk_out_size) ? skel->bulk_out_size : count;
189
190 /* copy the data from user space into our urb */
191 copy_from_user(skel->write_urb->transfer_buffer, buffer, bytes_written);
192
193 /* set up our urb */
194 usb_fill_bulk_urb(skel->write_urb,
195 skel->dev,
196 usb_sndbulkpipe(skel->dev, skel->bulk_out_endpointAddr),
197 skel->write_urb->transfer_buffer,
198 bytes_written,
199 skel_write_bulk_callback,
200 skel);
201
202 /* send the data out the bulk port */
203 result = usb_submit_urb(skel->write_urb);
204 if (result) {
205 err("Failed submitting write urb, error %d", result);
206 }
207
208
209When the write urb is filled up with the proper information using the
210:c:func:`usb_fill_bulk_urb` function, we point the urb's completion callback
211to call our own ``skel_write_bulk_callback`` function. This function is
212called when the urb is finished by the USB subsystem. The callback
213function is called in interrupt context, so caution must be taken not to
214do very much processing at that time. Our implementation of
215``skel_write_bulk_callback`` merely reports if the urb was completed
216successfully or not and then returns.
217
218The read function works a bit differently from the write function in
219that we do not use an urb to transfer data from the device to the
220driver. Instead we call the :c:func:`usb_bulk_msg` function, which can be used
221to send or receive data from a device without having to create urbs and
222handle urb completion callback functions. We call the :c:func:`usb_bulk_msg`
223function, giving it a buffer into which to place any data received from
224the device and a timeout value. If the timeout period expires without
225receiving any data from the device, the function will fail and return an
226error message. This can be shown with the following code::
227
228 /* do an immediate bulk read to get data from the device */
229 retval = usb_bulk_msg (skel->dev,
230 usb_rcvbulkpipe (skel->dev,
231 skel->bulk_in_endpointAddr),
232 skel->bulk_in_buffer,
233 skel->bulk_in_size,
234 &count, HZ*10);
235 /* if the read was successful, copy the data to user space */
236 if (!retval) {
237 if (copy_to_user (buffer, skel->bulk_in_buffer, count))
238 retval = -EFAULT;
239 else
240 retval = count;
241 }
242
243
244The :c:func:`usb_bulk_msg` function can be very useful for doing single reads
245or writes to a device; however, if you need to read or write constantly to
246a device, it is recommended to set up your own urbs and submit them to
247the USB subsystem.
248
249When the user program releases the file handle that it has been using to
250talk to the device, the release function in the driver is called. In
251this function we decrement our private usage count and wait for possible
252pending writes::
253
254 /* decrement our usage count for the device */
255 --skel->open_count;
256
257
258One of the more difficult problems that USB drivers must be able to
259handle smoothly is the fact that the USB device may be removed from the
260system at any point in time, even if a program is currently talking to
261it. It needs to be able to shut down any current reads and writes and
262notify the user-space programs that the device is no longer there. The
263following code (function ``skel_delete``) is an example of how to do
264this::
265
266 static inline void skel_delete (struct usb_skel *dev)
267 {
268 kfree (dev->bulk_in_buffer);
269 if (dev->bulk_out_buffer != NULL)
270 usb_free_coherent (dev->udev, dev->bulk_out_size,
271 dev->bulk_out_buffer,
272 dev->write_urb->transfer_dma);
273 usb_free_urb (dev->write_urb);
274 kfree (dev);
275 }
276
277
278If a program currently has an open handle to the device, we reset the
279flag ``device_present``. For every read, write, release and other
280functions that expect a device to be present, the driver first checks
281this flag to see if the device is still present. If not, it releases
282that the device has disappeared, and a ``-ENODEV`` error is returned to the
283user-space program. When the release function is eventually called, it
284determines if there is no device and if not, it does the cleanup that
285the ``skel_disconnect`` function normally does if there are no open files
286on the device (see Listing 5).
287
288Isochronous Data
289================
290
291This usb-skeleton driver does not have any examples of interrupt or
292isochronous data being sent to or from the device. Interrupt data is
293sent almost exactly as bulk data is, with a few minor exceptions.
294Isochronous data works differently with continuous streams of data being
295sent to or from the device. The audio and video camera drivers are very
296good examples of drivers that handle isochronous data and will be useful
297if you also need to do this.
298
299Conclusion
300==========
301
302Writing Linux USB device drivers is not a difficult task as the
303usb-skeleton driver shows. This driver, combined with the other current
304USB drivers, should provide enough examples to help a beginning author
305create a working driver in a minimal amount of time. The linux-usb-devel
306mailing list archives also contain a lot of helpful information.
307
308Resources
309=========
310
311The Linux USB Project:
312http://www.linux-usb.org/
313
314Linux Hotplug Project:
315http://linux-hotplug.sourceforge.net/
316
317Linux USB Working Devices List:
318http://www.qbik.ch/usb/devices/
319
320linux-usb-devel Mailing List Archives:
321http://marc.theaimsgroup.com/?l=linux-usb-devel
322
323Programming Guide for Linux USB Device Drivers:
324http://usb.cs.tum.edu/usbdoc
325
326USB Home Page: http://www.usb.org
diff --git a/Documentation/early-userspace/README b/Documentation/early-userspace/README
index 93e63a9af30b..2c00b072a4c8 100644
--- a/Documentation/early-userspace/README
+++ b/Documentation/early-userspace/README
@@ -86,7 +86,7 @@ early userspace useful. The klibc distribution is currently
86maintained separately from the kernel. 86maintained separately from the kernel.
87 87
88You can obtain somewhat infrequent snapshots of klibc from 88You can obtain somewhat infrequent snapshots of klibc from
89ftp://ftp.kernel.org/pub/linux/libs/klibc/ 89https://www.kernel.org/pub/linux/libs/klibc/
90 90
91For active users, you are better off using the klibc git 91For active users, you are better off using the klibc git
92repository, at http://git.kernel.org/?p=libs/klibc/klibc.git 92repository, at http://git.kernel.org/?p=libs/klibc/klibc.git
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 3698ed3146e3..5a8f7f4d2bca 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -25,7 +25,7 @@ Note: More extensive information for getting started with ext4 can be
25 25
26 or 26 or
27 27
28 ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/ 28 https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/
29 29
30 or grab the latest git repository from: 30 or grab the latest git repository from:
31 31
diff --git a/Documentation/filesystems/nfs/nfs-rdma.txt b/Documentation/filesystems/nfs/nfs-rdma.txt
index 1e6564545edf..22dc0dd6889c 100644
--- a/Documentation/filesystems/nfs/nfs-rdma.txt
+++ b/Documentation/filesystems/nfs/nfs-rdma.txt
@@ -110,10 +110,10 @@ Installation
110 - Install a Linux kernel with NFS/RDMA 110 - Install a Linux kernel with NFS/RDMA
111 111
112 The NFS/RDMA client and server are both included in the mainline Linux 112 The NFS/RDMA client and server are both included in the mainline Linux
113 kernel version 2.6.25 and later. This and other versions of the 2.6 Linux 113 kernel version 2.6.25 and later. This and other versions of the Linux
114 kernel can be found at: 114 kernel can be found at:
115 115
116 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ 116 https://www.kernel.org/pub/linux/kernel/
117 117
118 Download the sources and place them in an appropriate location. 118 Download the sources and place them in an appropriate location.
119 119
diff --git a/Documentation/hid/hidraw.txt b/Documentation/hid/hidraw.txt
index 029e6cb9a7e8..c8436e354f44 100644
--- a/Documentation/hid/hidraw.txt
+++ b/Documentation/hid/hidraw.txt
@@ -81,7 +81,7 @@ of:
81 BUS_HIL 81 BUS_HIL
82 BUS_BLUETOOTH 82 BUS_BLUETOOTH
83 BUS_VIRTUAL 83 BUS_VIRTUAL
84which are defined in linux/input.h. 84which are defined in uapi/linux/input.h.
85 85
86HIDIOCGRAWNAME(len): Get Raw Name 86HIDIOCGRAWNAME(len): Get Raw Name
87This ioctl returns a string containing the vendor and product strings of 87This ioctl returns a string containing the vendor and product strings of
diff --git a/Documentation/index.rst b/Documentation/index.rst
index f6e641a54bbc..61306a22888d 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -24,6 +24,18 @@ trying to get it to work optimally on a given system.
24 24
25 admin-guide/index 25 admin-guide/index
26 26
27Application-developer documentation
28-----------------------------------
29
30The user-space API manual gathers together documents describing aspects of
31the kernel interface as seen by application developers.
32
33.. toctree::
34 :maxdepth: 2
35
36 userspace-api/index
37
38
27Introduction to kernel development 39Introduction to kernel development
28---------------------------------- 40----------------------------------
29 41
@@ -76,6 +88,14 @@ Chinese translations
76 88
77 translations/zh_CN/index 89 translations/zh_CN/index
78 90
91Japanese translations
92---------------------
93
94.. toctree::
95 :maxdepth: 1
96
97 translations/ja_JP/index
98
79Indices and tables 99Indices and tables
80================== 100==================
81 101
diff --git a/Documentation/input/ff.txt b/Documentation/input/ff.txt
index b3867bf49f8f..be742eec7aab 100644
--- a/Documentation/input/ff.txt
+++ b/Documentation/input/ff.txt
@@ -106,9 +106,9 @@ allocate a new effect.
106 106
107Effects are file descriptor specific. 107Effects are file descriptor specific.
108 108
109See <linux/input.h> for a description of the ff_effect struct. You should also 109See <uapi/linux/input.h> for a description of the ff_effect struct. You should
110find help in a few sketches, contained in files shape.fig and interactive.fig. 110also find help in a few sketches, contained in files shape.fig and
111You need xfig to visualize these files. 111interactive.fig. You need xfig to visualize these files.
112 112
1133.3 Removing an effect from the device 1133.3 Removing an effect from the device
114~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/Documentation/input/input-programming.txt b/Documentation/input/input-programming.txt
index 7f8b9d97bc47..c3b940baba42 100644
--- a/Documentation/input/input-programming.txt
+++ b/Documentation/input/input-programming.txt
@@ -174,8 +174,8 @@ It's reported to the input system via:
174 174
175 input_report_key(struct input_dev *dev, int code, int value) 175 input_report_key(struct input_dev *dev, int code, int value)
176 176
177See linux/input.h for the allowable values of code (from 0 to KEY_MAX). 177See uapi/linux/input-event-codes.h for the allowable values of code (from 0 to
178Value is interpreted as a truth value, ie any nonzero value means key 178KEY_MAX). Value is interpreted as a truth value, ie any nonzero value means key
179pressed, zero value means key released. The input code generates events only 179pressed, zero value means key released. The input code generates events only
180in case the value is different from before. 180in case the value is different from before.
181 181
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
index 08244bea5048..a77ead911956 100644
--- a/Documentation/ioctl/ioctl-number.txt
+++ b/Documentation/ioctl/ioctl-number.txt
@@ -212,7 +212,7 @@ Code Seq#(hex) Include File Comments
212'c' 00-1F linux/chio.h conflict! 212'c' 00-1F linux/chio.h conflict!
213'c' 80-9F arch/s390/include/asm/chsc.h conflict! 213'c' 80-9F arch/s390/include/asm/chsc.h conflict!
214'c' A0-AF arch/x86/include/asm/msr.h conflict! 214'c' A0-AF arch/x86/include/asm/msr.h conflict!
215'd' 00-FF linux/char/drm/drm/h conflict! 215'd' 00-FF linux/char/drm/drm.h conflict!
216'd' 02-40 pcmcia/ds.h conflict! 216'd' 02-40 pcmcia/ds.h conflict!
217'd' F0-FF linux/digi1.h 217'd' F0-FF linux/digi1.h
218'e' all linux/digi1.h conflict! 218'e' all linux/digi1.h conflict!
diff --git a/Documentation/leds/leds-lp55xx.txt b/Documentation/leds/leds-lp55xx.txt
index bcea12a0c584..e23fa91ea722 100644
--- a/Documentation/leds/leds-lp55xx.txt
+++ b/Documentation/leds/leds-lp55xx.txt
@@ -117,7 +117,7 @@ As soon as 'loading' is set to 0, registered callback is called.
117Inside the callback, the selected engine is loaded and memory is updated. 117Inside the callback, the selected engine is loaded and memory is updated.
118To run programmed pattern, 'run_engine' attribute should be enabled. 118To run programmed pattern, 'run_engine' attribute should be enabled.
119 119
120The pattern sqeuence of LP8501 is similar to LP5523. 120The pattern sequence of LP8501 is similar to LP5523.
121However pattern data is specific. 121However pattern data is specific.
122Ex 1) Engine 1 is used 122Ex 1) Engine 1 is used
123echo 1 > /sys/bus/i2c/devices/xxxx/select_engine 123echo 1 > /sys/bus/i2c/devices/xxxx/select_engine
diff --git a/Documentation/md/md-cluster.txt b/Documentation/md/md-cluster.txt
index 38883276d31c..d22103994aef 100644
--- a/Documentation/md/md-cluster.txt
+++ b/Documentation/md/md-cluster.txt
@@ -77,7 +77,7 @@ There are three groups of locks for managing the device:
77 3.1.2 RESYNCING: informs other nodes that a resync is initiated or 77 3.1.2 RESYNCING: informs other nodes that a resync is initiated or
78 ended so that each node may suspend or resume the region. Each 78 ended so that each node may suspend or resume the region. Each
79 RESYNCING message identifies a range of the devices that the 79 RESYNCING message identifies a range of the devices that the
80 sending node is about to resync. This over-rides any pervious 80 sending node is about to resync. This overrides any previous
81 notification from that node: only one ranged can be resynced at a 81 notification from that node: only one ranged can be resynced at a
82 time per-node. 82 time per-node.
83 83
diff --git a/Documentation/media/Makefile b/Documentation/media/Makefile
index 9b3e70b2cab2..36166952d555 100644
--- a/Documentation/media/Makefile
+++ b/Documentation/media/Makefile
@@ -1,51 +1,6 @@
1# Rules to convert DOT and SVG to Sphinx images
2
3SRC_DIR=$(srctree)/Documentation/media
4
5DOTS = \
6 uapi/v4l/pipeline.dot \
7
8IMAGES = \
9 typical_media_device.svg \
10 uapi/dvb/dvbstb.svg \
11 uapi/v4l/bayer.svg \
12 uapi/v4l/constraints.svg \
13 uapi/v4l/crop.svg \
14 uapi/v4l/fieldseq_bt.svg \
15 uapi/v4l/fieldseq_tb.svg \
16 uapi/v4l/nv12mt.svg \
17 uapi/v4l/nv12mt_example.svg \
18 uapi/v4l/pipeline.svg \
19 uapi/v4l/selection.svg \
20 uapi/v4l/subdev-image-processing-full.svg \
21 uapi/v4l/subdev-image-processing-scaling-multi-source.svg \
22 uapi/v4l/subdev-image-processing-crop.svg \
23 uapi/v4l/vbi_525.svg \
24 uapi/v4l/vbi_625.svg \
25 uapi/v4l/vbi_hsync.svg \
26
27DOTTGT := $(patsubst %.dot,%.svg,$(DOTS))
28IMGDOT := $(patsubst %,$(SRC_DIR)/%,$(DOTTGT))
29
30IMGTGT := $(patsubst %.svg,%.pdf,$(IMAGES))
31IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT))
32
33cmd = $(echo-cmd) $(cmd_$(1))
34
35quiet_cmd_genpdf = GENPDF $2
36 cmd_genpdf = convert $2 $3
37
38quiet_cmd_gendot = DOT $2
39 cmd_gendot = dot -Tsvg $2 > $3 || { rm -f $3; exit 1; }
40
41%.pdf: %.svg
42 @$(call cmd,genpdf,$<,$@)
43
44%.svg: %.dot
45 @$(call cmd,gendot,$<,$@)
46
47# Rules to convert a .h file to inline RST documentation 1# Rules to convert a .h file to inline RST documentation
48 2
3SRC_DIR=$(srctree)/Documentation/media
49PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl 4PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
50UAPI = $(srctree)/include/uapi/linux 5UAPI = $(srctree)/include/uapi/linux
51KAPI = $(srctree)/include/linux 6KAPI = $(srctree)/include/linux
diff --git a/Documentation/media/intro.rst b/Documentation/media/intro.rst
index 8f7490c9a8ef..9ce2e23a0236 100644
--- a/Documentation/media/intro.rst
+++ b/Documentation/media/intro.rst
@@ -13,9 +13,9 @@ A typical media device hardware is shown at :ref:`typical_media_device`.
13 13
14.. _typical_media_device: 14.. _typical_media_device:
15 15
16.. figure:: typical_media_device.* 16.. kernel-figure:: typical_media_device.svg
17 :alt: typical_media_device.pdf / typical_media_device.svg 17 :alt: typical_media_device.svg
18 :align: center 18 :align: center
19 19
20 Typical Media Device 20 Typical Media Device
21 21
diff --git a/Documentation/media/uapi/dvb/intro.rst b/Documentation/media/uapi/dvb/intro.rst
index 2ed5c23102b4..652c4aacd2c6 100644
--- a/Documentation/media/uapi/dvb/intro.rst
+++ b/Documentation/media/uapi/dvb/intro.rst
@@ -55,9 +55,9 @@ Overview
55 55
56.. _stb_components: 56.. _stb_components:
57 57
58.. figure:: dvbstb.* 58.. kernel-figure:: dvbstb.svg
59 :alt: dvbstb.pdf / dvbstb.svg 59 :alt: dvbstb.svg
60 :align: center 60 :align: center
61 61
62 Components of a DVB card/STB 62 Components of a DVB card/STB
63 63
diff --git a/Documentation/media/uapi/v4l/crop.rst b/Documentation/media/uapi/v4l/crop.rst
index be58894c9c89..182565b9ace4 100644
--- a/Documentation/media/uapi/v4l/crop.rst
+++ b/Documentation/media/uapi/v4l/crop.rst
@@ -53,8 +53,8 @@ Cropping Structures
53 53
54.. _crop-scale: 54.. _crop-scale:
55 55
56.. figure:: crop.* 56.. kernel-figure:: crop.svg
57 :alt: crop.pdf / crop.svg 57 :alt: crop.svg
58 :align: center 58 :align: center
59 59
60 Image Cropping, Insertion and Scaling 60 Image Cropping, Insertion and Scaling
diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst
index baf5f2483927..2e6878b624f6 100644
--- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst
+++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst
@@ -221,33 +221,29 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` does
221 221
222.. _vbi-hsync: 222.. _vbi-hsync:
223 223
224.. figure:: vbi_hsync.* 224.. kernel-figure:: vbi_hsync.svg
225 :alt: vbi_hsync.pdf / vbi_hsync.svg 225 :alt: vbi_hsync.svg
226 :align: center 226 :align: center
227 227
228 **Figure 4.1. Line synchronization** 228 **Figure 4.1. Line synchronization**
229 229
230 230
231.. _vbi-525: 231.. _vbi-525:
232 232
233.. figure:: vbi_525.* 233.. kernel-figure:: vbi_525.svg
234 :alt: vbi_525.pdf / vbi_525.svg 234 :alt: vbi_525.svg
235 :align: center 235 :align: center
236 236
237 **Figure 4.2. ITU-R 525 line numbering (M/NTSC and M/PAL)** 237 **Figure 4.2. ITU-R 525 line numbering (M/NTSC and M/PAL)**
238 238
239
240
241.. _vbi-625: 239.. _vbi-625:
242 240
243.. figure:: vbi_625.* 241.. kernel-figure:: vbi_625.svg
244 :alt: vbi_625.pdf / vbi_625.svg 242 :alt: vbi_625.svg
245 :align: center 243 :align: center
246 244
247 **Figure 4.3. ITU-R 625 line numbering** 245 **Figure 4.3. ITU-R 625 line numbering**
248 246
249
250
251Remember the VBI image format depends on the selected video standard, 247Remember the VBI image format depends on the selected video standard,
252therefore the application must choose a new standard or query the 248therefore the application must choose a new standard or query the
253current standard first. Attempts to read or write data ahead of format 249current standard first. Attempts to read or write data ahead of format
diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst b/Documentation/media/uapi/v4l/dev-subdev.rst
index cd2870180208..f0e762167730 100644
--- a/Documentation/media/uapi/v4l/dev-subdev.rst
+++ b/Documentation/media/uapi/v4l/dev-subdev.rst
@@ -99,9 +99,9 @@ the video sensor and the host image processing hardware.
99 99
100.. _pipeline-scaling: 100.. _pipeline-scaling:
101 101
102.. figure:: pipeline.* 102.. kernel-figure:: pipeline.dot
103 :alt: pipeline.pdf / pipeline.svg 103 :alt: pipeline.dot
104 :align: center 104 :align: center
105 105
106 Image Format Negotiation on Pipelines 106 Image Format Negotiation on Pipelines
107 107
@@ -404,9 +404,9 @@ selection will refer to the sink pad format dimensions instead.
404 404
405.. _subdev-image-processing-crop: 405.. _subdev-image-processing-crop:
406 406
407.. figure:: subdev-image-processing-crop.* 407.. kernel-figure:: subdev-image-processing-crop.svg
408 :alt: subdev-image-processing-crop.pdf / subdev-image-processing-crop.svg 408 :alt: subdev-image-processing-crop.svg
409 :align: center 409 :align: center
410 410
411 **Figure 4.5. Image processing in subdevs: simple crop example** 411 **Figure 4.5. Image processing in subdevs: simple crop example**
412 412
@@ -421,9 +421,9 @@ pad.
421 421
422.. _subdev-image-processing-scaling-multi-source: 422.. _subdev-image-processing-scaling-multi-source:
423 423
424.. figure:: subdev-image-processing-scaling-multi-source.* 424.. kernel-figure:: subdev-image-processing-scaling-multi-source.svg
425 :alt: subdev-image-processing-scaling-multi-source.pdf / subdev-image-processing-scaling-multi-source.svg 425 :alt: subdev-image-processing-scaling-multi-source.svg
426 :align: center 426 :align: center
427 427
428 **Figure 4.6. Image processing in subdevs: scaling with multiple sources** 428 **Figure 4.6. Image processing in subdevs: scaling with multiple sources**
429 429
@@ -437,8 +437,8 @@ an area at location specified by the source crop rectangle from it.
437 437
438.. _subdev-image-processing-full: 438.. _subdev-image-processing-full:
439 439
440.. figure:: subdev-image-processing-full.* 440.. kernel-figure:: subdev-image-processing-full.svg
441 :alt: subdev-image-processing-full.pdf / subdev-image-processing-full.svg 441 :alt: subdev-image-processing-full.svg
442 :align: center 442 :align: center
443 443
444 **Figure 4.7. Image processing in subdevs: scaling and composition with multiple sinks and sources** 444 **Figure 4.7. Image processing in subdevs: scaling and composition with multiple sinks and sources**
diff --git a/Documentation/media/uapi/v4l/field-order.rst b/Documentation/media/uapi/v4l/field-order.rst
index e05fb1041363..5f3f82cbfa34 100644
--- a/Documentation/media/uapi/v4l/field-order.rst
+++ b/Documentation/media/uapi/v4l/field-order.rst
@@ -141,17 +141,20 @@ enum v4l2_field
141Field Order, Top Field First Transmitted 141Field Order, Top Field First Transmitted
142======================================== 142========================================
143 143
144.. figure:: fieldseq_tb.* 144.. kernel-figure:: fieldseq_tb.svg
145 :alt: fieldseq_tb.pdf / fieldseq_tb.svg 145 :alt: fieldseq_tb.svg
146 :align: center 146 :align: center
147 147
148 Field Order, Top Field First Transmitted
149
148 150
149.. _fieldseq-bt: 151.. _fieldseq-bt:
150 152
151Field Order, Bottom Field First Transmitted 153Field Order, Bottom Field First Transmitted
152=========================================== 154===========================================
153 155
154.. figure:: fieldseq_bt.* 156.. kernel-figure:: fieldseq_bt.svg
155 :alt: fieldseq_bt.pdf / fieldseq_bt.svg 157 :alt: fieldseq_bt.svg
156 :align: center 158 :align: center
157 159
160 Field Order, Bottom Field First Transmitted
diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst
index 32d0c8743460..172a3825604e 100644
--- a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst
+++ b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst
@@ -33,8 +33,8 @@ Layout of macroblocks in memory is presented in the following figure.
33 33
34.. _nv12mt: 34.. _nv12mt:
35 35
36.. figure:: nv12mt.* 36.. kernel-figure:: nv12mt.svg
37 :alt: nv12mt.pdf / nv12mt.svg 37 :alt: nv12mt.svg
38 :align: center 38 :align: center
39 39
40 V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout 40 V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
@@ -50,8 +50,8 @@ interleaved. Height of the buffer is aligned to 32.
50 50
51.. _nv12mt_ex: 51.. _nv12mt_ex:
52 52
53.. figure:: nv12mt_example.* 53.. kernel-figure:: nv12mt_example.svg
54 :alt: nv12mt_example.pdf / nv12mt_example.svg 54 :alt: nv12mt_example.svg
55 :align: center 55 :align: center
56 56
57 Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks 57 Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks
diff --git a/Documentation/media/uapi/v4l/selection-api-003.rst b/Documentation/media/uapi/v4l/selection-api-003.rst
index 21686f93c38f..bf7e76dfbdf9 100644
--- a/Documentation/media/uapi/v4l/selection-api-003.rst
+++ b/Documentation/media/uapi/v4l/selection-api-003.rst
@@ -7,9 +7,9 @@ Selection targets
7 7
8.. _sel-targets-capture: 8.. _sel-targets-capture:
9 9
10.. figure:: selection.* 10.. kernel-figure:: selection.svg
11 :alt: selection.pdf / selection.svg 11 :alt: selection.svg
12 :align: center 12 :align: center
13 13
14 Cropping and composing targets 14 Cropping and composing targets
15 15
diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst
index d6152c907b8b..89a1fb959314 100644
--- a/Documentation/media/uapi/v4l/subdev-formats.rst
+++ b/Documentation/media/uapi/v4l/subdev-formats.rst
@@ -1514,8 +1514,8 @@ be named ``MEDIA_BUS_FMT_SRGGB10_2X8_PADHI_LE``.
1514 1514
1515.. _bayer-patterns: 1515.. _bayer-patterns:
1516 1516
1517.. figure:: bayer.* 1517.. kernel-figure:: bayer.svg
1518 :alt: bayer.pdf / bayer.svg 1518 :alt: bayer.svg
1519 :align: center 1519 :align: center
1520 1520
1521 **Figure 4.8 Bayer Patterns** 1521 **Figure 4.8 Bayer Patterns**
diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst
index a606d1cdac13..90fe22a6414a 100644
--- a/Documentation/media/v4l-drivers/index.rst
+++ b/Documentation/media/v4l-drivers/index.rst
@@ -45,6 +45,7 @@ For more details see the file COPYING in the source distribution of Linux.
45 meye 45 meye
46 omap3isp 46 omap3isp
47 omap4_camera 47 omap4_camera
48 philips
48 pvrusb2 49 pvrusb2
49 pxa_camera 50 pxa_camera
50 radiotrack 51 radiotrack
diff --git a/drivers/media/usb/pwc/philips.txt b/Documentation/media/v4l-drivers/philips.rst
index d38dd791511e..620bcfea7af0 100644
--- a/drivers/media/usb/pwc/philips.txt
+++ b/Documentation/media/v4l-drivers/philips.rst
@@ -1,8 +1,12 @@
1Philips webcams (pwc driver)
2============================
3
1This file contains some additional information for the Philips and OEM webcams. 4This file contains some additional information for the Philips and OEM webcams.
2E-mail: webcam@smcc.demon.nl Last updated: 2004-01-19 5E-mail: webcam@smcc.demon.nl Last updated: 2004-01-19
3Site: http://www.smcc.demon.nl/webcam/ 6Site: http://www.smcc.demon.nl/webcam/
4 7
5As of this moment, the following cameras are supported: 8As of this moment, the following cameras are supported:
9
6 * Philips PCA645 10 * Philips PCA645
7 * Philips PCA646 11 * Philips PCA646
8 * Philips PCVC675 12 * Philips PCVC675
@@ -89,7 +93,8 @@ power_save
89compression (only useful with the plugin) 93compression (only useful with the plugin)
90 With this option you can control the compression factor that the camera 94 With this option you can control the compression factor that the camera
91 uses to squeeze the image through the USB bus. You can set the 95 uses to squeeze the image through the USB bus. You can set the
92 parameter between 0 and 3: 96 parameter between 0 and 3::
97
93 0 = prefer uncompressed images; if the requested mode is not available 98 0 = prefer uncompressed images; if the requested mode is not available
94 in an uncompressed format, the driver will silently switch to low 99 in an uncompressed format, the driver will silently switch to low
95 compression. 100 compression.
@@ -109,11 +114,11 @@ compression (only useful with the plugin)
109leds 114leds
110 This settings takes 2 integers, that define the on/off time for the LED 115 This settings takes 2 integers, that define the on/off time for the LED
111 (in milliseconds). One of the interesting things that you can do with 116 (in milliseconds). One of the interesting things that you can do with
112 this is let the LED blink while the camera is in use. This: 117 this is let the LED blink while the camera is in use. This::
113 118
114 leds=500,500 119 leds=500,500
115 120
116 will blink the LED once every second. But with: 121 will blink the LED once every second. But with::
117 122
118 leds=0,0 123 leds=0,0
119 124
@@ -141,7 +146,7 @@ dev_hint
141 A camera is specified by its type (the number from the camera model, 146 A camera is specified by its type (the number from the camera model,
142 like PCA645, PCVC750VC, etc) and optionally the serial number (visible 147 like PCA645, PCVC750VC, etc) and optionally the serial number (visible
143 in /proc/bus/usb/devices). A hint consists of a string with the following 148 in /proc/bus/usb/devices). A hint consists of a string with the following
144 format: 149 format::
145 150
146 [type[.serialnumber]:]node 151 [type[.serialnumber]:]node
147 152
@@ -150,7 +155,7 @@ dev_hint
150 would be rather pointless). The serialnumber is separated from the type 155 would be rather pointless). The serialnumber is separated from the type
151 by a '.'; the node number by a ':'. 156 by a '.'; the node number by a ':'.
152 157
153 This somewhat cryptic syntax is best explained by a few examples: 158 This somewhat cryptic syntax is best explained by a few examples::
154 159
155 dev_hint=3,5 The first detected cam gets assigned 160 dev_hint=3,5 The first detected cam gets assigned
156 /dev/video3, the second /dev/video5. Any 161 /dev/video3, the second /dev/video5. Any
@@ -170,6 +175,7 @@ dev_hint
170 through /dev/video6. 175 through /dev/video6.
171 176
172 Some points worth knowing: 177 Some points worth knowing:
178
173 - Serialnumbers are case sensitive and must be written full, including 179 - Serialnumbers are case sensitive and must be written full, including
174 leading zeroes (it's treated as a string). 180 leading zeroes (it's treated as a string).
175 - If a device node is already occupied, registration will fail and 181 - If a device node is already occupied, registration will fail and
@@ -189,8 +195,10 @@ trace
189 If you want to trace something, look up the bit value(s) in the table 195 If you want to trace something, look up the bit value(s) in the table
190 below, add the values together and supply that to the trace variable. 196 below, add the values together and supply that to the trace variable.
191 197
198 ====== ======= ================================================ =======
192 Value Value Description Default 199 Value Value Description Default
193 (dec) (hex) 200 (dec) (hex)
201 ====== ======= ================================================ =======
194 1 0x1 Module initialization; this will log messages On 202 1 0x1 Module initialization; this will log messages On
195 while loading and unloading the module 203 while loading and unloading the module
196 204
@@ -208,6 +216,7 @@ trace
208 64 0x40 Show viewport and image sizes Off 216 64 0x40 Show viewport and image sizes Off
209 217
210 128 0x80 PWCX debugging Off 218 128 0x80 PWCX debugging Off
219 ====== ======= ================================================ =======
211 220
212 For example, to trace the open() & read() functions, sum 8 + 4 = 12, 221 For example, to trace the open() & read() functions, sum 8 + 4 = 12,
213 so you would supply trace=12 during insmod or modprobe. If 222 so you would supply trace=12 during insmod or modprobe. If
@@ -216,7 +225,7 @@ trace
216 225
217 226
218 227
219Example: 228Example::
220 229
221 # modprobe pwc size=cif fps=15 power_save=1 230 # modprobe pwc size=cif fps=15 power_save=1
222 231
diff --git a/Documentation/media/v4l-drivers/zr364xx.rst b/Documentation/media/v4l-drivers/zr364xx.rst
index f5280e366826..3d193f01d8bb 100644
--- a/Documentation/media/v4l-drivers/zr364xx.rst
+++ b/Documentation/media/v4l-drivers/zr364xx.rst
@@ -30,7 +30,7 @@ You can try the experience changing the vendor/product ID values (look
30at the source code). 30at the source code).
31 31
32You can get these values by looking at /var/log/messages when you plug 32You can get these values by looking at /var/log/messages when you plug
33your camera, or by typing : cat /proc/bus/usb/devices. 33your camera, or by typing : cat /sys/kernel/debug/usb/devices.
34 34
35If you manage to use your cam with this code, you can send me a mail 35If you manage to use your cam with this code, you can send me a mail
36(royale@zerezo.com) with the name of your cam and a patch if needed. 36(royale@zerezo.com) with the name of your cam and a patch if needed.
diff --git a/Documentation/mmc/mmc-dev-attrs.txt b/Documentation/mmc/mmc-dev-attrs.txt
index 404a0e9e92b0..2caff30b348c 100644
--- a/Documentation/mmc/mmc-dev-attrs.txt
+++ b/Documentation/mmc/mmc-dev-attrs.txt
@@ -13,7 +13,7 @@ SD and MMC Device Attributes
13 13
14All attributes are read-only. 14All attributes are read-only.
15 15
16 cid Card Identifaction Register 16 cid Card Identification Register
17 csd Card Specific Data Register 17 csd Card Specific Data Register
18 scr SD Card Configuration Register (SD only) 18 scr SD Card Configuration Register (SD only)
19 date Manufacturing Date (from CID Register) 19 date Manufacturing Date (from CID Register)
@@ -71,6 +71,6 @@ Note on Erase Size and Preferred Erase Size:
71 "preferred_erase_size" is in bytes. 71 "preferred_erase_size" is in bytes.
72 72
73Note on raw_rpmb_size_mult: 73Note on raw_rpmb_size_mult:
74 "raw_rpmb_size_mult" is a mutliple of 128kB block. 74 "raw_rpmb_size_mult" is a multiple of 128kB block.
75 RPMB size in byte is calculated by using the following equation: 75 RPMB size in byte is calculated by using the following equation:
76 RPMB partition size = 128kB x raw_rpmb_size_mult 76 RPMB partition size = 128kB x raw_rpmb_size_mult
diff --git a/Documentation/networking/cdc_mbim.txt b/Documentation/networking/cdc_mbim.txt
index b9482ca10254..e4c376abbdad 100644
--- a/Documentation/networking/cdc_mbim.txt
+++ b/Documentation/networking/cdc_mbim.txt
@@ -332,7 +332,7 @@ References
332[5] "MBIM (Mobile Broadband Interface Model) Registry" 332[5] "MBIM (Mobile Broadband Interface Model) Registry"
333 - http://compliance.usb.org/mbim/ 333 - http://compliance.usb.org/mbim/
334 334
335[6] "/proc/bus/usb filesystem output" 335[6] "/dev/bus/usb filesystem output"
336 - Documentation/usb/proc_usb_info.txt 336 - Documentation/usb/proc_usb_info.txt
337 337
338[7] "/sys/bus/usb/devices/.../descriptors" 338[7] "/sys/bus/usb/devices/.../descriptors"
diff --git a/Documentation/networking/e100.txt b/Documentation/networking/e100.txt
index 42ddbd4b52a9..54810b82c01a 100644
--- a/Documentation/networking/e100.txt
+++ b/Documentation/networking/e100.txt
@@ -130,7 +130,7 @@ Additional Configurations
130 version 1.6 or later is required for this functionality. 130 version 1.6 or later is required for this functionality.
131 131
132 The latest release of ethtool can be found from 132 The latest release of ethtool can be found from
133 http://ftp.kernel.org/pub/software/network/ethtool/ 133 https://www.kernel.org/pub/software/network/ethtool/
134 134
135 Enabling Wake on LAN* (WoL) 135 Enabling Wake on LAN* (WoL)
136 --------------------------- 136 ---------------------------
diff --git a/Documentation/networking/e1000.txt b/Documentation/networking/e1000.txt
index 437b2099cced..1f6ed848363d 100644
--- a/Documentation/networking/e1000.txt
+++ b/Documentation/networking/e1000.txt
@@ -435,7 +435,7 @@ Additional Configurations
435 version 1.6 or later is required for this functionality. 435 version 1.6 or later is required for this functionality.
436 436
437 The latest release of ethtool can be found from 437 The latest release of ethtool can be found from
438 http://ftp.kernel.org/pub/software/network/ethtool/ 438 https://www.kernel.org/pub/software/network/ethtool/
439 439
440 Enabling Wake on LAN* (WoL) 440 Enabling Wake on LAN* (WoL)
441 --------------------------- 441 ---------------------------
diff --git a/Documentation/networking/e1000e.txt b/Documentation/networking/e1000e.txt
index ad2d9f38ce14..12089547baed 100644
--- a/Documentation/networking/e1000e.txt
+++ b/Documentation/networking/e1000e.txt
@@ -274,7 +274,7 @@ Additional Configurations
274 diagnostics, as well as displaying statistical information. We 274 diagnostics, as well as displaying statistical information. We
275 strongly recommend downloading the latest version of ethtool at: 275 strongly recommend downloading the latest version of ethtool at:
276 276
277 http://ftp.kernel.org/pub/software/network/ethtool/ 277 https://kernel.org/pub/software/network/ethtool/
278 278
279 NOTE: When validating enable/disable tests on some parts (82578, for example) 279 NOTE: When validating enable/disable tests on some parts (82578, for example)
280 you need to add a few seconds between tests when working with ethtool. 280 you need to add a few seconds between tests when working with ethtool.
diff --git a/Documentation/networking/igb.txt b/Documentation/networking/igb.txt
index 15534fdd09a8..f90643ef39c9 100644
--- a/Documentation/networking/igb.txt
+++ b/Documentation/networking/igb.txt
@@ -63,7 +63,7 @@ Additional Configurations
63 diagnostics, as well as displaying statistical information. The latest 63 diagnostics, as well as displaying statistical information. The latest
64 version of ethtool can be found at: 64 version of ethtool can be found at:
65 65
66 http://ftp.kernel.org/pub/software/network/ethtool/ 66 https://www.kernel.org/pub/software/network/ethtool/
67 67
68 Enabling Wake on LAN* (WoL) 68 Enabling Wake on LAN* (WoL)
69 --------------------------- 69 ---------------------------
diff --git a/Documentation/networking/igbvf.txt b/Documentation/networking/igbvf.txt
index 40db17a6665b..bd404735fb46 100644
--- a/Documentation/networking/igbvf.txt
+++ b/Documentation/networking/igbvf.txt
@@ -62,7 +62,7 @@ Additional Configurations
62 version 3.0 or later is required for this functionality, although we 62 version 3.0 or later is required for this functionality, although we
63 strongly recommend downloading the latest version at: 63 strongly recommend downloading the latest version at:
64 64
65 http://ftp.kernel.org/pub/software/network/ethtool/ 65 https://www.kernel.org/pub/software/network/ethtool/
66 66
67Support 67Support
68======= 68=======
diff --git a/Documentation/networking/ixgb.txt b/Documentation/networking/ixgb.txt
index 9b4a10a1cf50..09f71d71920a 100644
--- a/Documentation/networking/ixgb.txt
+++ b/Documentation/networking/ixgb.txt
@@ -313,7 +313,7 @@ Additional Configurations
313 version 1.6 or later is required for this functionality. 313 version 1.6 or later is required for this functionality.
314 314
315 The latest release of ethtool can be found from 315 The latest release of ethtool can be found from
316 http://ftp.kernel.org/pub/software/network/ethtool/ 316 https://www.kernel.org/pub/software/network/ethtool/
317 317
318 NOTE: The ethtool version 1.6 only supports a limited set of ethtool options. 318 NOTE: The ethtool version 1.6 only supports a limited set of ethtool options.
319 Support for a more complete ethtool feature set can be enabled by 319 Support for a more complete ethtool feature set can be enabled by
diff --git a/Documentation/networking/ixgbe.txt b/Documentation/networking/ixgbe.txt
index 6f0cb57b59c6..687835415707 100644
--- a/Documentation/networking/ixgbe.txt
+++ b/Documentation/networking/ixgbe.txt
@@ -272,7 +272,7 @@ Additional Configurations
272 ethtool version is required for this functionality. 272 ethtool version is required for this functionality.
273 273
274 The latest release of ethtool can be found from 274 The latest release of ethtool can be found from
275 http://ftp.kernel.org/pub/software/network/ethtool/ 275 https://www.kernel.org/pub/software/network/ethtool/
276 276
277 FCoE 277 FCoE
278 ---- 278 ----
diff --git a/Documentation/phy.txt b/Documentation/phy.txt
index 0aa994bd9a91..383cdd863f08 100644
--- a/Documentation/phy.txt
+++ b/Documentation/phy.txt
@@ -97,7 +97,7 @@ should contain the phy name as given in the dt data and in the case of
97non-dt boot, it should contain the label of the PHY. The two 97non-dt boot, it should contain the label of the PHY. The two
98devm_phy_get associates the device with the PHY using devres on 98devm_phy_get associates the device with the PHY using devres on
99successful PHY get. On driver detach, release function is invoked on 99successful PHY get. On driver detach, release function is invoked on
100the the devres data and devres data is freed. phy_optional_get and 100the devres data and devres data is freed. phy_optional_get and
101devm_phy_optional_get should be used when the phy is optional. These 101devm_phy_optional_get should be used when the phy is optional. These
102two functions will never return -ENODEV, but instead returns NULL when 102two functions will never return -ENODEV, but instead returns NULL when
103the phy cannot be found.Some generic drivers, such as ehci, may use multiple 103the phy cannot be found.Some generic drivers, such as ehci, may use multiple
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt
index 8cc17ca71813..9f2f942a01cf 100644
--- a/Documentation/power/swsusp.txt
+++ b/Documentation/power/swsusp.txt
@@ -406,7 +406,7 @@ Firewire, CompactFlash, MMC, external SATA, or even IDE hotplug bays)
406before suspending; then remount them after resuming. 406before suspending; then remount them after resuming.
407 407
408There is a work-around for this problem. For more information, see 408There is a work-around for this problem. For more information, see
409Documentation/usb/persist.txt. 409Documentation/driver-api/usb/persist.rst.
410 410
411Q: Can I suspend-to-disk using a swap partition under LVM? 411Q: Can I suspend-to-disk using a swap partition under LVM?
412 412
diff --git a/Documentation/process/4.Coding.rst b/Documentation/process/4.Coding.rst
index 2a728d898fc5..6df19943dd4d 100644
--- a/Documentation/process/4.Coding.rst
+++ b/Documentation/process/4.Coding.rst
@@ -22,11 +22,11 @@ Coding style
22************ 22************
23 23
24The kernel has long had a standard coding style, described in 24The kernel has long had a standard coding style, described in
25Documentation/process/coding-style.rst. For much of that time, the policies described 25:ref:`Documentation/process/coding-style.rst <codingstyle>`. For much of
26in that file were taken as being, at most, advisory. As a result, there is 26that time, the policies described in that file were taken as being, at most,
27a substantial amount of code in the kernel which does not meet the coding 27advisory. As a result, there is a substantial amount of code in the kernel
28style guidelines. The presence of that code leads to two independent 28which does not meet the coding style guidelines. The presence of that code
29hazards for kernel developers. 29leads to two independent hazards for kernel developers.
30 30
31The first of these is to believe that the kernel coding standards do not 31The first of these is to believe that the kernel coding standards do not
32matter and are not enforced. The truth of the matter is that adding new 32matter and are not enforced. The truth of the matter is that adding new
@@ -343,9 +343,10 @@ user-space developers to know what they are working with. See
343Documentation/ABI/README for a description of how this documentation should 343Documentation/ABI/README for a description of how this documentation should
344be formatted and what information needs to be provided. 344be formatted and what information needs to be provided.
345 345
346The file Documentation/admin-guide/kernel-parameters.rst describes all of the kernel's 346The file :ref:`Documentation/admin-guide/kernel-parameters.rst
347boot-time parameters. Any patch which adds new parameters should add the 347<kernelparameters>` describes all of the kernel's boot-time parameters.
348appropriate entries to this file. 348Any patch which adds new parameters should add the appropriate entries to
349this file.
349 350
350Any new configuration options must be accompanied by help text which 351Any new configuration options must be accompanied by help text which
351clearly explains the options and when the user might want to select them. 352clearly explains the options and when the user might want to select them.
diff --git a/Documentation/process/applying-patches.rst b/Documentation/process/applying-patches.rst
index 87825cf96f33..a0d058cc6d25 100644
--- a/Documentation/process/applying-patches.rst
+++ b/Documentation/process/applying-patches.rst
@@ -250,17 +250,11 @@ specific homes.
250 250
251The 4.x.y (-stable) and 4.x patches live at 251The 4.x.y (-stable) and 4.x patches live at
252 252
253 ftp://ftp.kernel.org/pub/linux/kernel/v4.x/ 253 https://www.kernel.org/pub/linux/kernel/v4.x/
254 254
255The -rc patches live at 255The -rc patches live at
256 256
257 ftp://ftp.kernel.org/pub/linux/kernel/v4.x/testing/ 257 https://www.kernel.org/pub/linux/kernel/v4.x/testing/
258
259In place of ``ftp.kernel.org`` you can use ``ftp.cc.kernel.org``, where cc is a
260country code. This way you'll be downloading from a mirror site that's most
261likely geographically closer to you, resulting in faster downloads for you,
262less bandwidth used globally and less load on the main kernel.org servers --
263these are good things, so do use mirrors when possible.
264 258
265 259
266The 4.x kernels 260The 4.x kernels
@@ -317,7 +311,7 @@ the current stable kernel.
317 The -stable team usually do make incremental patches available as well 311 The -stable team usually do make incremental patches available as well
318 as patches against the latest mainline release, but I only cover the 312 as patches against the latest mainline release, but I only cover the
319 non-incremental ones below. The incremental ones can be found at 313 non-incremental ones below. The incremental ones can be found at
320 ftp://ftp.kernel.org/pub/linux/kernel/v4.x/incr/ 314 https://www.kernel.org/pub/linux/kernel/v4.x/incr/
321 315
322These patches are not incremental, meaning that for example the 4.7.3 316These patches are not incremental, meaning that for example the 4.7.3
323patch does not apply on top of the 4.7.2 kernel source, but rather on top 317patch does not apply on top of the 4.7.2 kernel source, but rather on top
diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
index 56ce66114665..01c5dbcd0f84 100644
--- a/Documentation/process/changes.rst
+++ b/Documentation/process/changes.rst
@@ -318,9 +318,10 @@ PDF outputs, it is recommended to use version 1.4.6.
318.. note:: 318.. note::
319 319
320 Please notice that, for PDF and LaTeX output, you'll also need ``XeLaTeX`` 320 Please notice that, for PDF and LaTeX output, you'll also need ``XeLaTeX``
321 version 3.14159265. Depending on the distribution, you may also need 321 version 3.14159265. Depending on the distribution, you may also need to
322 to install a series of ``texlive`` packages that provide the minimal 322 install a series of ``texlive`` packages that provide the minimal set of
323 set of functionalities required for ``XeLaTex`` to work. 323 functionalities required for ``XeLaTex`` to work. For PDF output you'll also
324 need ``convert(1)`` from ImageMagick (https://www.imagemagick.org).
324 325
325Other tools 326Other tools
326----------- 327-----------
@@ -348,7 +349,7 @@ Make
348Binutils 349Binutils
349-------- 350--------
350 351
351- <ftp://ftp.kernel.org/pub/linux/devel/binutils/> 352- <https://www.kernel.org/pub/linux/devel/binutils/>
352 353
353OpenSSL 354OpenSSL
354------- 355-------
@@ -361,17 +362,17 @@ System utilities
361Util-linux 362Util-linux
362---------- 363----------
363 364
364- <ftp://ftp.kernel.org/pub/linux/utils/util-linux/> 365- <https://www.kernel.org/pub/linux/utils/util-linux/>
365 366
366Ksymoops 367Ksymoops
367-------- 368--------
368 369
369- <ftp://ftp.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/> 370- <https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/>
370 371
371Module-Init-Tools 372Module-Init-Tools
372----------------- 373-----------------
373 374
374- <ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/> 375- <https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/>
375 376
376Mkinitrd 377Mkinitrd
377-------- 378--------
@@ -401,7 +402,7 @@ Xfsprogs
401Pcmciautils 402Pcmciautils
402----------- 403-----------
403 404
404- <ftp://ftp.kernel.org/pub/linux/utils/kernel/pcmcia/> 405- <https://www.kernel.org/pub/linux/utils/kernel/pcmcia/>
405 406
406Quota-tools 407Quota-tools
407----------- 408-----------
diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py
index df0419c62096..cf13ff3a656c 100644
--- a/Documentation/sphinx/cdomain.py
+++ b/Documentation/sphinx/cdomain.py
@@ -44,7 +44,7 @@ from sphinx.domains.c import CDomain as Base_CDomain
44__version__ = '1.0' 44__version__ = '1.0'
45 45
46# Get Sphinx version 46# Get Sphinx version
47major, minor, patch = map(int, sphinx.__version__.split(".")) 47major, minor, patch = sphinx.version_info[:3]
48 48
49def setup(app): 49def setup(app):
50 50
diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
new file mode 100644
index 000000000000..cef4ad19624c
--- /dev/null
+++ b/Documentation/sphinx/kfigure.py
@@ -0,0 +1,551 @@
1# -*- coding: utf-8; mode: python -*-
2# pylint: disable=C0103, R0903, R0912, R0915
3u"""
4 scalable figure and image handling
5 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6
7 Sphinx extension which implements scalable image handling.
8
9 :copyright: Copyright (C) 2016 Markus Heiser
10 :license: GPL Version 2, June 1991 see Linux/COPYING for details.
11
12 The build for image formats depend on image's source format and output's
13 destination format. This extension implement methods to simplify image
14 handling from the author's POV. Directives like ``kernel-figure`` implement
15 methods *to* always get the best output-format even if some tools are not
16 installed. For more details take a look at ``convert_image(...)`` which is
17 the core of all conversions.
18
19 * ``.. kernel-image``: for image handling / a ``.. image::`` replacement
20
21 * ``.. kernel-figure``: for figure handling / a ``.. figure::`` replacement
22
23 * ``.. kernel-render``: for render markup / a concept to embed *render*
24 markups (or languages). Supported markups (see ``RENDER_MARKUP_EXT``)
25
26 - ``DOT``: render embedded Graphviz's **DOC**
27 - ``SVG``: render embedded Scalable Vector Graphics (**SVG**)
28 - ... *developable*
29
30 Used tools:
31
32 * ``dot(1)``: Graphviz (http://www.graphviz.org). If Graphviz is not
33 available, the DOT language is inserted as literal-block.
34
35 * SVG to PDF: To generate PDF, you need at least one of this tools:
36
37 - ``convert(1)``: ImageMagick (https://www.imagemagick.org)
38
39 List of customizations:
40
41 * generate PDF from SVG / used by PDF (LaTeX) builder
42
43 * generate SVG (html-builder) and PDF (latex-builder) from DOT files.
44 DOT: see http://www.graphviz.org/content/dot-language
45
46 """
47
48import os
49from os import path
50import subprocess
51from hashlib import sha1
52import sys
53
54from docutils import nodes
55from docutils.statemachine import ViewList
56from docutils.parsers.rst import directives
57from docutils.parsers.rst.directives import images
58import sphinx
59
60from sphinx.util.nodes import clean_astext
61from six import iteritems
62
63PY3 = sys.version_info[0] == 3
64
65if PY3:
66 _unicode = str
67else:
68 _unicode = unicode
69
70# Get Sphinx version
71major, minor, patch = sphinx.version_info[:3]
72if major == 1 and minor > 3:
73 # patches.Figure only landed in Sphinx 1.4
74 from sphinx.directives.patches import Figure # pylint: disable=C0413
75else:
76 Figure = images.Figure
77
78__version__ = '1.0.0'
79
80# simple helper
81# -------------
82
83def which(cmd):
84 """Searches the ``cmd`` in the ``PATH`` enviroment.
85
86 This *which* searches the PATH for executable ``cmd`` . First match is
87 returned, if nothing is found, ``None` is returned.
88 """
89 envpath = os.environ.get('PATH', None) or os.defpath
90 for folder in envpath.split(os.pathsep):
91 fname = folder + os.sep + cmd
92 if path.isfile(fname):
93 return fname
94
95def mkdir(folder, mode=0o775):
96 if not path.isdir(folder):
97 os.makedirs(folder, mode)
98
99def file2literal(fname):
100 with open(fname, "r") as src:
101 data = src.read()
102 node = nodes.literal_block(data, data)
103 return node
104
105def isNewer(path1, path2):
106 """Returns True if ``path1`` is newer than ``path2``
107
108 If ``path1`` exists and is newer than ``path2`` the function returns
109 ``True`` is returned otherwise ``False``
110 """
111 return (path.exists(path1)
112 and os.stat(path1).st_ctime > os.stat(path2).st_ctime)
113
114def pass_handle(self, node): # pylint: disable=W0613
115 pass
116
117# setup conversion tools and sphinx extension
118# -------------------------------------------
119
120# Graphviz's dot(1) support
121dot_cmd = None
122
123# ImageMagick' convert(1) support
124convert_cmd = None
125
126
127def setup(app):
128 # check toolchain first
129 app.connect('builder-inited', setupTools)
130
131 # image handling
132 app.add_directive("kernel-image", KernelImage)
133 app.add_node(kernel_image,
134 html = (visit_kernel_image, pass_handle),
135 latex = (visit_kernel_image, pass_handle),
136 texinfo = (visit_kernel_image, pass_handle),
137 text = (visit_kernel_image, pass_handle),
138 man = (visit_kernel_image, pass_handle), )
139
140 # figure handling
141 app.add_directive("kernel-figure", KernelFigure)
142 app.add_node(kernel_figure,
143 html = (visit_kernel_figure, pass_handle),
144 latex = (visit_kernel_figure, pass_handle),
145 texinfo = (visit_kernel_figure, pass_handle),
146 text = (visit_kernel_figure, pass_handle),
147 man = (visit_kernel_figure, pass_handle), )
148
149 # render handling
150 app.add_directive('kernel-render', KernelRender)
151 app.add_node(kernel_render,
152 html = (visit_kernel_render, pass_handle),
153 latex = (visit_kernel_render, pass_handle),
154 texinfo = (visit_kernel_render, pass_handle),
155 text = (visit_kernel_render, pass_handle),
156 man = (visit_kernel_render, pass_handle), )
157
158 app.connect('doctree-read', add_kernel_figure_to_std_domain)
159
160 return dict(
161 version = __version__,
162 parallel_read_safe = True,
163 parallel_write_safe = True
164 )
165
166
167def setupTools(app):
168 u"""
169 Check available build tools and log some *verbose* messages.
170
171 This function is called once, when the builder is initiated.
172 """
173 global dot_cmd, convert_cmd # pylint: disable=W0603
174 app.verbose("kfigure: check installed tools ...")
175
176 dot_cmd = which('dot')
177 convert_cmd = which('convert')
178
179 if dot_cmd:
180 app.verbose("use dot(1) from: " + dot_cmd)
181 else:
182 app.warn("dot(1) not found, for better output quality install "
183 "graphviz from http://www.graphviz.org")
184 if convert_cmd:
185 app.verbose("use convert(1) from: " + convert_cmd)
186 else:
187 app.warn(
188 "convert(1) not found, for SVG to PDF conversion install "
189 "ImageMagick (https://www.imagemagick.org)")
190
191
192# integrate conversion tools
193# --------------------------
194
195RENDER_MARKUP_EXT = {
196 # The '.ext' must be handled by convert_image(..) function's *in_ext* input.
197 # <name> : <.ext>
198 'DOT' : '.dot',
199 'SVG' : '.svg'
200}
201
202def convert_image(img_node, translator, src_fname=None):
203 """Convert a image node for the builder.
204
205 Different builder prefer different image formats, e.g. *latex* builder
206 prefer PDF while *html* builder prefer SVG format for images.
207
208 This function handles output image formats in dependence of source the
209 format (of the image) and the translator's output format.
210 """
211 app = translator.builder.app
212
213 fname, in_ext = path.splitext(path.basename(img_node['uri']))
214 if src_fname is None:
215 src_fname = path.join(translator.builder.srcdir, img_node['uri'])
216 if not path.exists(src_fname):
217 src_fname = path.join(translator.builder.outdir, img_node['uri'])
218
219 dst_fname = None
220
221 # in kernel builds, use 'make SPHINXOPTS=-v' to see verbose messages
222
223 app.verbose('assert best format for: ' + img_node['uri'])
224
225 if in_ext == '.dot':
226
227 if not dot_cmd:
228 app.verbose("dot from graphviz not available / include DOT raw.")
229 img_node.replace_self(file2literal(src_fname))
230
231 elif translator.builder.format == 'latex':
232 dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
233 img_node['uri'] = fname + '.pdf'
234 img_node['candidates'] = {'*': fname + '.pdf'}
235
236
237 elif translator.builder.format == 'html':
238 dst_fname = path.join(
239 translator.builder.outdir,
240 translator.builder.imagedir,
241 fname + '.svg')
242 img_node['uri'] = path.join(
243 translator.builder.imgpath, fname + '.svg')
244 img_node['candidates'] = {
245 '*': path.join(translator.builder.imgpath, fname + '.svg')}
246
247 else:
248 # all other builder formats will include DOT as raw
249 img_node.replace_self(file2literal(src_fname))
250
251 elif in_ext == '.svg':
252
253 if translator.builder.format == 'latex':
254 if convert_cmd is None:
255 app.verbose("no SVG to PDF conversion available / include SVG raw.")
256 img_node.replace_self(file2literal(src_fname))
257 else:
258 dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
259 img_node['uri'] = fname + '.pdf'
260 img_node['candidates'] = {'*': fname + '.pdf'}
261
262 if dst_fname:
263 # the builder needs not to copy one more time, so pop it if exists.
264 translator.builder.images.pop(img_node['uri'], None)
265 _name = dst_fname[len(translator.builder.outdir) + 1:]
266
267 if isNewer(dst_fname, src_fname):
268 app.verbose("convert: {out}/%s already exists and is newer" % _name)
269
270 else:
271 ok = False
272 mkdir(path.dirname(dst_fname))
273
274 if in_ext == '.dot':
275 app.verbose('convert DOT to: {out}/' + _name)
276 ok = dot2format(app, src_fname, dst_fname)
277
278 elif in_ext == '.svg':
279 app.verbose('convert SVG to: {out}/' + _name)
280 ok = svg2pdf(app, src_fname, dst_fname)
281
282 if not ok:
283 img_node.replace_self(file2literal(src_fname))
284
285
286def dot2format(app, dot_fname, out_fname):
287 """Converts DOT file to ``out_fname`` using ``dot(1)``.
288
289 * ``dot_fname`` pathname of the input DOT file, including extension ``.dot``
290 * ``out_fname`` pathname of the output file, including format extension
291
292 The *format extension* depends on the ``dot`` command (see ``man dot``
293 option ``-Txxx``). Normally you will use one of the following extensions:
294
295 - ``.ps`` for PostScript,
296 - ``.svg`` or ``svgz`` for Structured Vector Graphics,
297 - ``.fig`` for XFIG graphics and
298 - ``.png`` or ``gif`` for common bitmap graphics.
299
300 """
301 out_format = path.splitext(out_fname)[1][1:]
302 cmd = [dot_cmd, '-T%s' % out_format, dot_fname]
303 exit_code = 42
304
305 with open(out_fname, "w") as out:
306 exit_code = subprocess.call(cmd, stdout = out)
307 if exit_code != 0:
308 app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
309 return bool(exit_code == 0)
310
311def svg2pdf(app, svg_fname, pdf_fname):
312 """Converts SVG to PDF with ``convert(1)`` command.
313
314 Uses ``convert(1)`` from ImageMagick (https://www.imagemagick.org) for
315 conversion. Returns ``True`` on success and ``False`` if an error occurred.
316
317 * ``svg_fname`` pathname of the input SVG file with extension (``.svg``)
318 * ``pdf_name`` pathname of the output PDF file with extension (``.pdf``)
319
320 """
321 cmd = [convert_cmd, svg_fname, pdf_fname]
322 # use stdout and stderr from parent
323 exit_code = subprocess.call(cmd)
324 if exit_code != 0:
325 app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
326 return bool(exit_code == 0)
327
328
329# image handling
330# ---------------------
331
332def visit_kernel_image(self, node): # pylint: disable=W0613
333 """Visitor of the ``kernel_image`` Node.
334
335 Handles the ``image`` child-node with the ``convert_image(...)``.
336 """
337 img_node = node[0]
338 convert_image(img_node, self)
339
340class kernel_image(nodes.image):
341 """Node for ``kernel-image`` directive."""
342 pass
343
344class KernelImage(images.Image):
345 u"""KernelImage directive
346
347 Earns everything from ``.. image::`` directive, except *remote URI* and
348 *glob* pattern. The KernelImage wraps a image node into a
349 kernel_image node. See ``visit_kernel_image``.
350 """
351
352 def run(self):
353 uri = self.arguments[0]
354 if uri.endswith('.*') or uri.find('://') != -1:
355 raise self.severe(
356 'Error in "%s: %s": glob pattern and remote images are not allowed'
357 % (self.name, uri))
358 result = images.Image.run(self)
359 if len(result) == 2 or isinstance(result[0], nodes.system_message):
360 return result
361 (image_node,) = result
362 # wrap image node into a kernel_image node / see visitors
363 node = kernel_image('', image_node)
364 return [node]
365
366# figure handling
367# ---------------------
368
369def visit_kernel_figure(self, node): # pylint: disable=W0613
370 """Visitor of the ``kernel_figure`` Node.
371
372 Handles the ``image`` child-node with the ``convert_image(...)``.
373 """
374 img_node = node[0][0]
375 convert_image(img_node, self)
376
377class kernel_figure(nodes.figure):
378 """Node for ``kernel-figure`` directive."""
379
380class KernelFigure(Figure):
381 u"""KernelImage directive
382
383 Earns everything from ``.. figure::`` directive, except *remote URI* and
384 *glob* pattern. The KernelFigure wraps a figure node into a kernel_figure
385 node. See ``visit_kernel_figure``.
386 """
387
388 def run(self):
389 uri = self.arguments[0]
390 if uri.endswith('.*') or uri.find('://') != -1:
391 raise self.severe(
392 'Error in "%s: %s":'
393 ' glob pattern and remote images are not allowed'
394 % (self.name, uri))
395 result = Figure.run(self)
396 if len(result) == 2 or isinstance(result[0], nodes.system_message):
397 return result
398 (figure_node,) = result
399 # wrap figure node into a kernel_figure node / see visitors
400 node = kernel_figure('', figure_node)
401 return [node]
402
403
404# render handling
405# ---------------------
406
407def visit_kernel_render(self, node):
408 """Visitor of the ``kernel_render`` Node.
409
410 If rendering tools available, save the markup of the ``literal_block`` child
411 node into a file and replace the ``literal_block`` node with a new created
412 ``image`` node, pointing to the saved markup file. Afterwards, handle the
413 image child-node with the ``convert_image(...)``.
414 """
415 app = self.builder.app
416 srclang = node.get('srclang')
417
418 app.verbose('visit kernel-render node lang: "%s"' % (srclang))
419
420 tmp_ext = RENDER_MARKUP_EXT.get(srclang, None)
421 if tmp_ext is None:
422 app.warn('kernel-render: "%s" unknow / include raw.' % (srclang))
423 return
424
425 if not dot_cmd and tmp_ext == '.dot':
426 app.verbose("dot from graphviz not available / include raw.")
427 return
428
429 literal_block = node[0]
430
431 code = literal_block.astext()
432 hashobj = code.encode('utf-8') # str(node.attributes)
433 fname = path.join('%s-%s' % (srclang, sha1(hashobj).hexdigest()))
434
435 tmp_fname = path.join(
436 self.builder.outdir, self.builder.imagedir, fname + tmp_ext)
437
438 if not path.isfile(tmp_fname):
439 mkdir(path.dirname(tmp_fname))
440 with open(tmp_fname, "w") as out:
441 out.write(code)
442
443 img_node = nodes.image(node.rawsource, **node.attributes)
444 img_node['uri'] = path.join(self.builder.imgpath, fname + tmp_ext)
445 img_node['candidates'] = {
446 '*': path.join(self.builder.imgpath, fname + tmp_ext)}
447
448 literal_block.replace_self(img_node)
449 convert_image(img_node, self, tmp_fname)
450
451
452class kernel_render(nodes.General, nodes.Inline, nodes.Element):
453 """Node for ``kernel-render`` directive."""
454 pass
455
456class KernelRender(Figure):
457 u"""KernelRender directive
458
459 Render content by external tool. Has all the options known from the
460 *figure* directive, plus option ``caption``. If ``caption`` has a
461 value, a figure node with the *caption* is inserted. If not, a image node is
462 inserted.
463
464 The KernelRender directive wraps the text of the directive into a
465 literal_block node and wraps it into a kernel_render node. See
466 ``visit_kernel_render``.
467 """
468 has_content = True
469 required_arguments = 1
470 optional_arguments = 0
471 final_argument_whitespace = False
472
473 # earn options from 'figure'
474 option_spec = Figure.option_spec.copy()
475 option_spec['caption'] = directives.unchanged
476
477 def run(self):
478 return [self.build_node()]
479
480 def build_node(self):
481
482 srclang = self.arguments[0].strip()
483 if srclang not in RENDER_MARKUP_EXT.keys():
484 return [self.state_machine.reporter.warning(
485 'Unknow source language "%s", use one of: %s.' % (
486 srclang, ",".join(RENDER_MARKUP_EXT.keys())),
487 line=self.lineno)]
488
489 code = '\n'.join(self.content)
490 if not code.strip():
491 return [self.state_machine.reporter.warning(
492 'Ignoring "%s" directive without content.' % (
493 self.name),
494 line=self.lineno)]
495
496 node = kernel_render()
497 node['alt'] = self.options.get('alt','')
498 node['srclang'] = srclang
499 literal_node = nodes.literal_block(code, code)
500 node += literal_node
501
502 caption = self.options.get('caption')
503 if caption:
504 # parse caption's content
505 parsed = nodes.Element()
506 self.state.nested_parse(
507 ViewList([caption], source=''), self.content_offset, parsed)
508 caption_node = nodes.caption(
509 parsed[0].rawsource, '', *parsed[0].children)
510 caption_node.source = parsed[0].source
511 caption_node.line = parsed[0].line
512
513 figure_node = nodes.figure('', node)
514 for k,v in self.options.items():
515 figure_node[k] = v
516 figure_node += caption_node
517
518 node = figure_node
519
520 return node
521
522def add_kernel_figure_to_std_domain(app, doctree):
523 """Add kernel-figure anchors to 'std' domain.
524
525 The ``StandardDomain.process_doc(..)`` method does not know how to resolve
526 the caption (label) of ``kernel-figure`` directive (it only knows about
527 standard nodes, e.g. table, figure etc.). Without any additional handling
528 this will result in a 'undefined label' for kernel-figures.
529
530 This handle adds labels of kernel-figure to the 'std' domain labels.
531 """
532
533 std = app.env.domains["std"]
534 docname = app.env.docname
535 labels = std.data["labels"]
536
537 for name, explicit in iteritems(doctree.nametypes):
538 if not explicit:
539 continue
540 labelid = doctree.nameids[name]
541 if labelid is None:
542 continue
543 node = doctree.ids[labelid]
544
545 if node.tagname == 'kernel_figure':
546 for n in node.next_node():
547 if n.tagname == 'caption':
548 sectname = clean_astext(n)
549 # add label to std domain
550 labels[name] = docname, labelid, sectname
551 break
diff --git a/Documentation/sphinx/tmplcvt b/Documentation/sphinx/tmplcvt
index 909a73065e0a..6848f0a26fa5 100755
--- a/Documentation/sphinx/tmplcvt
+++ b/Documentation/sphinx/tmplcvt
@@ -7,13 +7,22 @@
7# fix \_ 7# fix \_
8# title line? 8# title line?
9# 9#
10set -eu
11
12if [ "$#" != "2" ]; then
13 echo "$0 <docbook file> <rst file>"
14 exit
15fi
16
17DIR=$(dirname $0)
10 18
11in=$1 19in=$1
12rst=$2 20rst=$2
13tmp=$rst.tmp 21tmp=$rst.tmp
14 22
15cp $in $tmp 23cp $in $tmp
16sed --in-place -f convert_template.sed $tmp 24sed --in-place -f $DIR/convert_template.sed $tmp
17pandoc -s -S -f docbook -t rst -o $rst $tmp 25pandoc -s -S -f docbook -t rst -o $rst $tmp
18sed --in-place -f post_convert.sed $rst 26sed --in-place -f $DIR/post_convert.sed $rst
19rm $tmp 27rm $tmp
28echo "book writen to $rst"
diff --git a/Documentation/static-keys.txt b/Documentation/static-keys.txt
index 32a25fad0c1b..ef419fd0897f 100644
--- a/Documentation/static-keys.txt
+++ b/Documentation/static-keys.txt
@@ -118,7 +118,7 @@ Or:
118 118
119Keys defined via DEFINE_STATIC_KEY_TRUE(), or DEFINE_STATIC_KEY_FALSE, may 119Keys defined via DEFINE_STATIC_KEY_TRUE(), or DEFINE_STATIC_KEY_FALSE, may
120be used in either static_branch_likely() or static_branch_unlikely() 120be used in either static_branch_likely() or static_branch_unlikely()
121statemnts. 121statements.
122 122
123Branch(es) can be set true via: 123Branch(es) can be set true via:
124 124
diff --git a/Documentation/sync_file.txt b/Documentation/sync_file.txt
index 269681a6faec..c3d033a06e8d 100644
--- a/Documentation/sync_file.txt
+++ b/Documentation/sync_file.txt
@@ -37,7 +37,7 @@ dma_fence_signal(), when it has finished using (or processing) that buffer.
37Out-fences are fences that the driver creates. 37Out-fences are fences that the driver creates.
38 38
39On the other hand if the driver receives fence(s) through a sync_file from 39On the other hand if the driver receives fence(s) through a sync_file from
40userspace we call these fence(s) 'in-fences'. Receiveing in-fences means that 40userspace we call these fence(s) 'in-fences'. Receiving in-fences means that
41we need to wait for the fence(s) to signal before using any buffer related to 41we need to wait for the fence(s) to signal before using any buffer related to
42the in-fences. 42the in-fences.
43 43
diff --git a/Documentation/thermal/intel_powerclamp.txt b/Documentation/thermal/intel_powerclamp.txt
index 60073dc9f748..b5df21168fbc 100644
--- a/Documentation/thermal/intel_powerclamp.txt
+++ b/Documentation/thermal/intel_powerclamp.txt
@@ -268,6 +268,15 @@ cur_state:0
268max_state:50 268max_state:50
269type:intel_powerclamp 269type:intel_powerclamp
270 270
271cur_state allows user to set the desired idle percentage. Writing 0 to
272cur_state will stop idle injection. Writing a value between 1 and
273max_state will start the idle injection. Reading cur_state returns the
274actual and current idle percentage. This may not be the same value
275set by the user in that current idle percentage depends on workload
276and includes natural idle. When idle injection is disabled, reading
277cur_state returns value -1 instead of 0 which is to avoid confusing
278100% busy state with the disabled state.
279
271Example usage: 280Example usage:
272- To inject 25% idle time 281- To inject 25% idle time
273$ sudo sh -c "echo 25 > /sys/class/thermal/cooling_device80/cur_state 282$ sudo sh -c "echo 25 > /sys/class/thermal/cooling_device80/cur_state
@@ -278,11 +287,12 @@ then the powerclamp driver will not start idle injection. Using Top
278will not show idle injection kernel threads. 287will not show idle injection kernel threads.
279 288
280If the system is busy (spin test below) and has less than 25% natural 289If the system is busy (spin test below) and has less than 25% natural
281idle time, powerclamp kernel threads will do idle injection, which 290idle time, powerclamp kernel threads will do idle injection. Forced
282appear running to the scheduler. But the overall system idle is still 291idle time is accounted as normal idle in that common code path is
283reflected. In this example, 24.1% idle is shown. This helps the 292taken as the idle task.
284system admin or user determine the cause of slowdown, when a 293
285powerclamp driver is in action. 294In this example, 24.1% idle is shown. This helps the system admin or
295user determine the cause of slowdown, when a powerclamp driver is in action.
286 296
287 297
288Tasks: 197 total, 1 running, 196 sleeping, 0 stopped, 0 zombie 298Tasks: 197 total, 1 running, 196 sleeping, 0 stopped, 0 zombie
diff --git a/Documentation/translations/ja_JP/HOWTO b/Documentation/translations/ja_JP/howto.rst
index 4ebd20750ef1..4511eed0fabb 100644
--- a/Documentation/translations/ja_JP/HOWTO
+++ b/Documentation/translations/ja_JP/howto.rst
@@ -1,95 +1,81 @@
1NOTE: 1NOTE:
2This is a version of Documentation/HOWTO translated into Japanese. 2This is a version of Documentation/HOWTO translated into Japanese.
3This document is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> 3This document is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com>
4and the JF Project team <www.linux.or.jp/JF>. 4If you find any difference between this document and the original file or
5If you find any difference between this document and the original file 5a problem with the translation, please contact the maintainer of this file.
6or a problem with the translation, 6
7please contact the maintainer of this file or JF project. 7Please also note that the purpose of this file is to be easier to
8 8read for non English (read: Japanese) speakers and is not intended as
9Please also note that the purpose of this file is to be easier to read 9a fork. So if you have any comments or updates for this file, please
10for non English (read: Japanese) speakers and is not intended as a 10try to update the original English file first.
11fork. So if you have any comments or updates for this file, please try 11
12to update the original English file first. 12----------------------------------
13 13
14Last Updated: 2013/07/19 14ã“ã®æ–‡æ›¸ã¯ã€
15================================== 15Documentation/process/howto.rst
16ã“れã¯ã€
17linux-3.10/Documentation/HOWTO
18ã®å’Œè¨³ã§ã™ã€‚ 16ã®å’Œè¨³ã§ã™ã€‚
19 17
20翻訳団体: JF プロジェクト < http://linuxjf.sourceforge.jp/ > 18翻訳者: Tsugikazu Shibata <tshibata@ab.jp.nec.com>
21翻訳日: 2013/7/19 19
22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 20----------------------------------
23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com>
24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
25 武井伸光ã•ã‚“ã€<takei at webmasters dot gr dot jp>
26 ã‹ã­ã“ã•ã‚“ (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp>
27 野å£ã•ã‚“ (Kenji Noguchi) <tokyo246 at gmail dot com>
28 河内ã•ã‚“ (Takayoshi Kochi) <t-kochi at bq dot jp dot nec dot com>
29 岩本ã•ã‚“ (iwamoto) <iwamoto.kn at ncos dot nec dot co dot jp>
30 内田ã•ã‚“ (Satoshi Uchida) <s-uchida at ap dot jp dot nec dot com>
31==================================
32 21
33Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方 22Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方
34------------------------------- 23==========================
35 24
36ã“れã¯ä¸Šã®ãƒˆãƒ”ック( Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方)ã®é‡è¦ãªäº‹æŸ„を網羅ã—㟠25ã“れã¯ä¸Šã®ãƒˆãƒ”ック( Linux カーãƒãƒ«é–‹ç™ºã®ã‚„り方)ã®é‡è¦ãªäº‹æŸ„を網羅ã—ãŸ
37ドキュメントã§ã™ã€‚ã“ã“ã«ã¯ Linux カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ãŸã‚ã®æ–¹æ³•㨠26ドキュメントã§ã™ã€‚ã“ã“ã«ã¯ Linux カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ãŸã‚ã®æ–¹æ³•ã¨Linux
38Linux カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«æ´»å‹•ã™ã‚‹ã‚„ã‚Šæ–¹ã‚’å­¦ã¶æ–¹æ³•ãŒå«ã¾ã‚Œã¦ 27カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«æ´»å‹•ã™ã‚‹ã‚„ã‚Šæ–¹ã‚’å­¦ã¶æ–¹æ³•ãŒå«ã¾ã‚Œã¦ã„ã¾ã™ã€‚
39ã„ã¾ã™ã€ã‚«ãƒ¼ãƒãƒ«ãƒ—ログラミングã«é–¢ã™ã‚‹æŠ€è¡“çš„ãªé …ç›®ã«é–¢ã™ã‚‹ã“ã¨ã¯ä½•ã‚‚å« 28カーãƒãƒ«ãƒ—ログラミングã«é–¢ã™ã‚‹æŠ€è¡“çš„ãªé …ç›®ã«é–¢ã™ã‚‹ã“ã¨ã¯ä½•ã‚‚å«ã‚ãªã„よ
40ããªã„よã†ã«ã—ã¦ã„ã¾ã™ãŒã€ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã¨ãªã‚‹ãŸã‚ã®æ­£ã—ã„æ–¹å‘ã«å‘ã‹ã† 29ã†ã«ã—ã¦ã„ã¾ã™ãŒã€ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã¨ãªã‚‹ãŸã‚ã®æ­£ã—ã„æ–¹å‘ã«å‘ã‹ã†æ‰‹åŠ©ã‘ã«
41手助ã‘ã«ãªã‚Šã¾ã™ã€‚ 30ãªã‚Šã¾ã™ã€‚
42 31
43ã‚‚ã—ã€ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®ã©ã“ã‹ãŒå¤ããªã£ã¦ã„ãŸå ´åˆã«ã¯ã€ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ 32ã‚‚ã—ã€ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®ã©ã“ã‹ãŒå¤ããªã£ã¦ã„ãŸå ´åˆã«ã¯ã€ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆ
44ãƒˆã®æœ€å¾Œã«ãƒªã‚¹ãƒˆã—ãŸãƒ¡ãƒ³ãƒ†ãƒŠã«ãƒ‘ッãƒã‚’é€ã£ã¦ãã ã•ã„。 33ã®æœ€å¾Œã«ãƒªã‚¹ãƒˆã—ãŸãƒ¡ãƒ³ãƒ†ãƒŠã«ãƒ‘ッãƒã‚’é€ã£ã¦ãã ã•ã„。
45 34
46ã¯ã˜ã‚ã« 35ã¯ã˜ã‚ã«
47--------- 36---------
48 37
49ã‚ãªãŸã¯ã€€Linux カーãƒãƒ«ã®é–‹ç™ºè€…ã«ãªã‚‹æ–¹æ³•ã‚’å­¦ã³ãŸã„ã®ã§ã—ょã†ã‹ï¼Ÿã€€ã 38ã‚ãªãŸã¯ Linux カーãƒãƒ«ã®é–‹ç™ºè€…ã«ãªã‚‹æ–¹æ³•ã‚’å­¦ã³ãŸã„ã®ã§ã—ょã†ã‹ï¼Ÿã€€ã
50れã¨ã‚‚ã‚ãªãŸã¯ä¸Šå¸ã‹ã‚‰ã€Œã“ã®ãƒ‡ãƒã‚¤ã‚¹ã® Linux ドライãƒã‚’書ãよã†ã«ã€ã¨ 39れã¨ã‚‚上å¸ã‹ã‚‰ã€Œã“ã®ãƒ‡ãƒã‚¤ã‚¹ã® Linux ドライãƒã‚’書ãよã†ã«ã€ã¨è¨€ã‚れãŸ
51言ã‚れã¦ã„ã‚‹ã®ã§ã—ょã†ã‹ï¼Ÿã€€ 40ã®ã‹ã‚‚ã—れã¾ã›ã‚“。ã“ã®æ–‡æ›¸ã®ç›®çš„ã¯ã€ã‚ãªãŸãŒè¸ã‚€ã¹ã手順ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£
52ã“ã®æ–‡æ›¸ã®ç›®çš„ã¯ã€ã‚ãªãŸãŒè¸ã‚€ã¹ã手順ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¸€ç·’ã«ã†ã¾ãåƒ 41ã¨ä¸€ç·’ã«ã†ã¾ãåƒãヒントを書ã下ã™ã“ã¨ã§ã€ã‚ãªãŸãŒçŸ¥ã‚‹ã¹ãå…¨ã¦ã®ã“ã¨ã‚’
53ãヒントを書ã下ã™ã“ã¨ã§ã€ã‚ãªãŸãŒçŸ¥ã‚‹ã¹ãå…¨ã¦ã®ã“ã¨ã‚’æ•™ãˆã‚‹ã“ã¨ã§ã™ã€‚ 42æ•™ãˆã‚‹ã“ã¨ã§ã™ã€‚ã¾ãŸã€ã“ã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒãªãœä»Šã†ã¾ãã¾ã‚ã£ã¦ã„ã‚‹ã®ã‹ã¨
54ã¾ãŸã€ã“ã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒãªãœä»Šã†ã¾ãã¾ã‚ã£ã¦ã„ã‚‹ã®ã‹ã¨ã„ã†ç†ç”±ã®ä¸€éƒ¨ã‚‚ 43ã„ã†ç†ç”±ã‚‚説明ã—よã†ã¨è©¦ã¿ã¦ã„ã¾ã™ã€‚
55説明ã—よã†ã¨è©¦ã¿ã¦ã„ã¾ã™ã€‚ 44
56 45カーãƒãƒ«ã¯å°‘é‡ã®ã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ä¾å­˜éƒ¨åˆ†ãŒã‚¢ã‚»ãƒ³ãƒ–ãƒªè¨€èªžã§æ›¸ã‹ã‚Œã¦ã„る以
57 46外ã®å¤§éƒ¨åˆ†ã¯ C è¨€èªžã§æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚C言語をよãç†è§£ã—ã¦ã„ã‚‹ã“ã¨ã¯ã‚«ãƒ¼
58カーãƒãƒ«ã¯ å°‘é‡ã®ã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ä¾å­˜éƒ¨åˆ†ãŒã‚¢ã‚»ãƒ³ãƒ–ãƒªè¨€èªžã§æ›¸ã‹ã‚Œã¦ã„ã‚‹ 47ãƒãƒ«é–‹ç™ºã«å¿…è¦ã§ã™ã€‚低レベルã®ã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£é–‹ç™ºã‚’ã™ã‚‹ã®ã§ãªã‘れã°ã€
59以外ã¯å¤§éƒ¨åˆ†ã¯ C è¨€èªžã§æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚C言語をよãç†è§£ã—ã¦ã„ã‚‹ã“ã¨ã¯ã‚«ãƒ¼ 48(ã©ã‚“ãªã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ã§ã‚‚)アセンブリ(訳注: 言語)ã¯å¿…è¦ã‚りã¾ã›ã‚“。以下
60ãƒãƒ«é–‹ç™ºè€…ã«ã¯å¿…è¦ã§ã™ã€‚アーキテクãƒãƒ£å‘ã‘ã®ä½Žãƒ¬ãƒ™ãƒ«éƒ¨åˆ†ã®é–‹ç™ºã‚’ã™ã‚‹ã® 49ã®æœ¬ã¯ã€C 言語ã®å分ãªçŸ¥è­˜ã‚„何年もã®çµŒé¨“ã«å–ã£ã¦ä»£ã‚ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›
61ã§ãªã‘れã°ã€(ã©ã‚“ãªã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ã§ã‚‚)アセンブリ(訳注: 言語)ã¯å¿…è¦ã‚り 50ã‚“ãŒã€å°‘ãªãã¨ã‚‚リファレンスã¨ã—ã¦ã¯è‰¯ã„本ã§ã™ã€‚
62ã¾ã›ã‚“ã€‚ä»¥ä¸‹ã®æœ¬ã¯ã€C 言語ã®å分ãªçŸ¥è­˜ã‚„何年もã®çµŒé¨“ã«å–ã£ã¦ä»£ã‚ã‚‹ã‚‚ã® 51
63ã§ã¯ã‚りã¾ã›ã‚“ãŒã€å°‘ãªãã¨ã‚‚リファレンスã¨ã—ã¦ã¯è‰¯ã„本ã§ã™ã€‚
64 - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] 52 - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
65 -『プログラミング言語C第2版ã€(B.W. カーニãƒãƒ³/D.M. リッãƒãƒ¼è‘— 石田晴久訳) [共立出版] 53 - 『プログラミング言語C第2版ã€(B.W. カーニãƒãƒ³/D.M. リッãƒãƒ¼è‘— 石田晴久訳) [共立出版]
66 - "Practical C Programming" by Steve Oualline [O'Reilly] 54 - "Practical C Programming" by Steve Oualline [O'Reilly]
67 - 『C実践プログラミング第3版ã€(Steve Ouallineè‘— 望月康å¸ç›£è¨³ è°·å£åŠŸè¨³) [オライリージャパン] 55 - 『C実践プログラミング第3版ã€(Steve Ouallineè‘— 望月康å¸ç›£è¨³ è°·å£åŠŸè¨³) [オライリージャパン]
68 - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] 56 - "C: A Reference Manual" by Harbison and Steele [Prentice Hall]
69 - 『新・詳説 C 言語 H&S リファレンス〠57 - 『新・詳説 C 言語 H&S リファレンス〠(サミュエル P ãƒãƒ¼ãƒ“ソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトãƒãƒ³ã‚¯]
70 (サミュエル P ãƒãƒ¼ãƒ“ソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトãƒãƒ³ã‚¯]
71 58
72カーãƒãƒ«ã¯ GNU C 㨠GNU ツールãƒã‚§ã‚¤ãƒ³ã‚’使ã£ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚カーãƒãƒ« 59カーãƒãƒ«ã¯ GNU C 㨠GNU ツールãƒã‚§ã‚¤ãƒ³ã‚’使ã£ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚カーãƒãƒ«
73㯠ISO C89 ä»•æ§˜ã«æº–æ‹ ã—ã¦æ›¸ã一方ã§ã€æ¨™æº–ã«ã¯ç„¡ã„言語拡張を多ã使ã£ã¦ 60㯠ISO C89 ä»•æ§˜ã«æº–æ‹ ã—ã¦æ›¸ã一方ã§ã€æ¨™æº–ã«ã¯ç„¡ã„言語拡張を多ã使ã£ã¦
74ã„ã¾ã™ã€‚カーãƒãƒ«ã¯æ¨™æº– C ライブラリã¨ã¯é–¢ä¿‚ãŒãªã„ã¨ã„ã£ãŸã€C 言語フリー 61ã„ã¾ã™ã€‚カーãƒãƒ«ã¯æ¨™æº– C ライブラリã«ä¾å­˜ã—ãªã„ã€C 言語éžä¾å­˜ç’°å¢ƒã§ã™ã€‚
75スタンディング環境ã§ã™ã€‚ãã®ãŸã‚ã€C ã®æ¨™æº–ã§ä½¿ãˆãªã„ã‚‚ã®ã‚‚ã‚りã¾ã™ã€‚ä»» 62ãã®ãŸã‚ã€C ã®æ¨™æº–ã®ä¸­ã§ä½¿ãˆãªã„ã‚‚ã®ã‚‚ã‚りã¾ã™ã€‚特ã«ä»»æ„ã® long long
76æ„ã® long long ã®é™¤ç®—ã‚„æµ®å‹•å°æ•°ç‚¹ã¯ä½¿ãˆã¾ã›ã‚“。 63ã®é™¤ç®—ã‚„æµ®å‹•å°æ•°ç‚¹ã¯ä½¿ãˆã¾ã›ã‚“。カーãƒãƒ«ãŒãƒ„ールãƒã‚§ã‚¤ãƒ³ã‚„ C 言語拡張
77ã¨ãã©ãã€ã‚«ãƒ¼ãƒãƒ«ãŒãƒ„ールãƒã‚§ã‚¤ãƒ³ã‚„ C 言語拡張ã«ç½®ã„ã¦ã„ã‚‹å‰æãŒã©ã† 64ã«ç½®ã„ã¦ã„ã‚‹å‰æãŒã©ã†ãªã£ã¦ã„ã‚‹ã®ã‹ã‚ã‹ã‚Šã«ãã„ã“ã¨ãŒæ™‚々ã‚りã€ã¾ãŸã€
78ãªã£ã¦ã„ã‚‹ã®ã‹ã‚ã‹ã‚Šã«ãã„ã“ã¨ãŒã‚りã€ã¾ãŸã€æ®‹å¿µãªã“ã¨ã«æ±ºå®šçš„ãªãƒªãƒ•ã‚¡ 65残念ãªã“ã¨ã«æ±ºå®šçš„ãªãƒªãƒ•ァレンスã¯å­˜åœ¨ã—ã¾ã›ã‚“。情報を得るã«ã¯ã€gcc ã®
79レンスã¯å­˜åœ¨ã—ã¾ã›ã‚“。情報を得るã«ã¯ã€gcc ã® info ページ( info gcc )ã‚’ 66info ページ( info gcc )を見ã¦ãã ã•ã„。
80見ã¦ãã ã•ã„。
81 67
82ã‚ãªãŸã¯æ—¢å­˜ã®é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¸€ç·’ã«ä½œæ¥­ã™ã‚‹æ–¹æ³•ã‚’å­¦ã¼ã†ã¨ã—ã¦ã„ã‚‹ã“ 68ã‚ãªãŸã¯æ—¢å­˜ã®é–‹ç™ºã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¸€ç·’ã«ä½œæ¥­ã™ã‚‹æ–¹æ³•ã‚’å­¦ã¼ã†ã¨ã—ã¦ã„ã‚‹ã“
83ã¨ã«ç•™æ„ã—ã¦ãã ã•ã„。ãã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã€ã‚¹ã‚¿ã‚¤ãƒ«ã€ 69ã¨ã«æ€ã出ã—ã¦ãã ã•ã„。ãã®ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã€ã‚¹ã‚¿ã‚¤ãƒ«ã€é–‹
84開発手順ã«ã¤ã„ã¦é«˜åº¦ãªæ¨™æº–ã‚’æŒã¤ã€å¤šæ§˜ãªäººã®é›†ã¾ã‚Šã§ã™ã€‚ 70発手順ã«ã¤ã„ã¦é«˜åº¦ãªæ¨™æº–ã‚’æŒã¤ã€å¤šæ§˜ãªäººã®é›†ã¾ã‚Šã§ã™ã€‚地ç†çš„ã«åˆ†æ•£ã—ãŸ
85地ç†çš„ã«åˆ†æ•£ã—ãŸå¤§è¦æ¨¡ãªãƒãƒ¼ãƒ ã«å¯¾ã—ã¦ã‚‚ã£ã¨ã‚‚ã†ã¾ãã„ãã¨ã‚ã‹ã£ãŸã“㨠71å¤§è¦æ¨¡ãªãƒãƒ¼ãƒ ã«å¯¾ã—ã¦ã‚‚ã£ã¨ã‚‚ã†ã¾ãã„ãã¨ã‚ã‹ã£ãŸã“ã¨ã‚’ベースã«ã—ãªãŒ
86をベースã«ã—ãªãŒã‚‰ã€ã“ã‚Œã‚‰ã®æ¨™æº–ã¯é•·ã„時間をã‹ã‘ã¦ç¯‰ã‹ã‚Œã¦ãã¾ã—ãŸã€‚ 72らã€ã“ã‚Œã‚‰ã®æ¨™æº–ã¯é•·ã„時間をã‹ã‘ã¦ç¯‰ã‹ã‚Œã¦ãã¾ã—ãŸã€‚ã“れらã¯ãã¡ã‚“ã¨æ–‡
87ã“れらã¯ãã¡ã‚“ã¨æ–‡æ›¸åŒ–ã•れã¦ã„ã¾ã™ã‹ã‚‰ã€äº‹å‰ã«ã“ã‚Œã‚‰ã®æ¨™æº–ã«ã¤ã„ã¦ã§ã 73書化ã•れã¦ã„ã¾ã™ã‹ã‚‰ã€äº‹å‰ã«ã“ã‚Œã‚‰ã®æ¨™æº–ã«ã¤ã„ã¦äº‹å‰ã«ã§ãã‚‹ã ã‘ãŸãã•
88ã‚‹ã ã‘ãŸãã•ん学んã§ãã ã•ã„。ã¾ãŸçš†ãŒã‚ãªãŸã‚„ã‚ãªãŸã®ä¼šç¤¾ã®ã‚„り方ã«åˆã‚ 74ん学んã§ãã ã•ã„。ã¾ãŸçš†ãŒã‚ãªãŸã‚„ã‚ãªãŸã®ä¼šç¤¾ã®ã‚„り方ã«åˆã‚ã›ã¦ãれる
89ã›ã¦ãã‚Œã‚‹ã¨æ€ã‚ãªã„ã§ãã ã•ã„。 75ã¨æ€ã‚ãªã„ã§ãã ã•ã„。
90 76
91法的å•題 77法的å•題
92------------ 78--------
93 79
94Linux カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã¯ GPL ライセンスã®ä¸‹ã§ãƒªãƒªãƒ¼ã‚¹ã•れã¦ã„ã¾ 80Linux カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã¯ GPL ライセンスã®ä¸‹ã§ãƒªãƒªãƒ¼ã‚¹ã•れã¦ã„ã¾
95ã™ã€‚ライセンスã®è©³ç´°ã«ã¤ã„ã¦ã¯ã€ã‚½ãƒ¼ã‚¹ãƒ„リーã®ãƒ¡ã‚¤ãƒ³ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«å­˜åœ¨ 81ã™ã€‚ライセンスã®è©³ç´°ã«ã¤ã„ã¦ã¯ã€ã‚½ãƒ¼ã‚¹ãƒ„リーã®ãƒ¡ã‚¤ãƒ³ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«å­˜åœ¨
@@ -98,8 +84,9 @@ Linux カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã¯ GPL ライセンスã®ä¸‹ã§ãƒªãƒªãƒ¼
98法律家ã«ç›¸è«‡ã—ã¦ãã ã•ã„。メーリングリストã®äººé”ã¯æ³•律家ã§ã¯ãªãã€æ³•çš„ 84法律家ã«ç›¸è«‡ã—ã¦ãã ã•ã„。メーリングリストã®äººé”ã¯æ³•律家ã§ã¯ãªãã€æ³•çš„
99å•題ã«ã¤ã„ã¦ã¯å½¼ã‚‰ã®å£°æ˜Žã¯ã‚ã¦ã«ã™ã‚‹ã¹ãã§ã¯ã‚りã¾ã›ã‚“。 85å•題ã«ã¤ã„ã¦ã¯å½¼ã‚‰ã®å£°æ˜Žã¯ã‚ã¦ã«ã™ã‚‹ã¹ãã§ã¯ã‚りã¾ã›ã‚“。
100 86
101GPL ã«é–¢ã™ã‚‹å…±é€šã®è³ªå•や回答ã«ã¤ã„ã¦ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„。 87GPL ã«é–¢ã™ã‚‹å…±é€šã®è³ªå•や回答ã«ã¤ã„ã¦ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„-
102 http://www.gnu.org/licenses/gpl-faq.html 88
89 https://www.gnu.org/licenses/gpl-faq.html
103 90
104ドキュメント 91ドキュメント
105------------ 92------------
@@ -119,111 +106,129 @@ linux-api@vger.kernel.org ã«é€ã‚‹ã“ã¨ã‚’å‹§ã‚ã¾ã™ã€‚
119 README 106 README
120 ã“ã®ãƒ•ァイル㯠Linuxカーãƒãƒ«ã®ç°¡å˜ãªèƒŒæ™¯ã¨ã‚«ãƒ¼ãƒãƒ«ã‚’設定(訳注 107 ã“ã®ãƒ•ァイル㯠Linuxカーãƒãƒ«ã®ç°¡å˜ãªèƒŒæ™¯ã¨ã‚«ãƒ¼ãƒãƒ«ã‚’設定(訳注
121 configure )ã—ã€ç”Ÿæˆ(訳注 build )ã™ã‚‹ãŸã‚ã«å¿…è¦ãªã“ã¨ã¯ä½•ã‹ãŒæ›¸ã‹ã‚Œ 108 configure )ã—ã€ç”Ÿæˆ(訳注 build )ã™ã‚‹ãŸã‚ã«å¿…è¦ãªã“ã¨ã¯ä½•ã‹ãŒæ›¸ã‹ã‚Œ
122 ã¦ã„ã¾ã™ã€‚カーãƒãƒ«ã«é–¢ã—ã¦åˆã‚ã¦ã®äººã¯ã“ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã™ã‚‹ã¨è‰¯ã„ã§ 109 ã¦ã„ã¾ã™ã€‚ カーãƒãƒ«ã«é–¢ã—ã¦åˆã‚ã¦ã®äººã¯ã“ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã™ã‚‹ã¨è‰¯ã„
123 ã—ょã†ã€‚ 110 ã§ã—ょã†ã€‚
124 111
125 Documentation/Changes 112 :ref:`Documentation/Process/changes.rst <changes>`
126 ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã‚’ã†ã¾ã生æˆ(訳注 build )ã—ã€èµ°ã‚‰ã›ã‚‹ã®ã«æœ€ 113 ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã‚’ã†ã¾ã生æˆ(訳注 build )ã—ã€èµ°ã‚‰ã›ã‚‹ã®ã«æœ€
127 å°é™ã®ãƒ¬ãƒ™ãƒ«ã§å¿…è¦ãªæ•°ã€…ã®ã‚½ãƒ•トウェアパッケージã®ä¸€è¦§ã‚’示ã—ã¦ã„ 114 å°é™ã®ãƒ¬ãƒ™ãƒ«ã§å¿…è¦ãªæ•°ã€…ã®ã‚½ãƒ•トウェアパッケージã®ä¸€è¦§ã‚’示ã—ã¦ã„
128 ã¾ã™ã€‚ 115 ã¾ã™ã€‚
129 116
130 Documentation/process/coding-style.rst 117 :ref:`Documentation/process/coding-style.rst <codingstyle>`
131 ã“れ㯠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚¹ã‚¿ã‚¤ãƒ«ã¨èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã‚’記述 118 ã“れ㯠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚¹ã‚¿ã‚¤ãƒ«ã¨èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã‚’記述
132 ã—ã¦ã„ã¾ã™ã€‚å…¨ã¦ã®æ–°ã—ã„コードã¯ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã«ã‚るガイドライン 119 ã—ã¦ã„ã¾ã™ã€‚å…¨ã¦ã®æ–°ã—ã„コードã¯ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã«ã‚るガイドライン
133 ã«å¾“ã£ã¦ã„ã‚‹ã“ã¨ã‚’期待ã•れã¦ã„ã¾ã™ã€‚大部分ã®ãƒ¡ãƒ³ãƒ†ãƒŠã¯ã“れらã®ãƒ«ãƒ¼ 120 ã«å¾“ã£ã¦ã„ã‚‹ã“ã¨ã‚’期待ã•れã¦ã„ã¾ã™ã€‚大部分ã®ãƒ¡ãƒ³ãƒ†ãƒŠã¯ã“れらã®ãƒ«ãƒ¼
134 ルã«å¾“ã£ã¦ã„ã‚‹ã‚‚ã®ã ã‘ã‚’å—ã‘付ã‘ã€å¤šãã®äººã¯æ­£ã—ã„スタイルã®ã‚³ãƒ¼ãƒ‰ 121 ルã«å¾“ã£ã¦ã„ã‚‹ã‚‚ã®ã ã‘ã‚’å—ã‘付ã‘ã€å¤šãã®äººã¯æ­£ã—ã„スタイルã®ã‚³ãƒ¼ãƒ‰
135 ã ã‘をレビューã—ã¾ã™ã€‚ 122 ã ã‘をレビューã—ã¾ã™ã€‚
136 123
137 Documentation/process/submitting-patches.rst 124 :ref:`Documentation/process/submitting-patches.rst <codingstyle>` 㨠:ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>`
138 Documentation/process/submitting-drivers.rst 125 ã“れらã®ãƒ•ァイルã«ã¯ã€ã©ã†ã‚„ã£ã¦ã†ã¾ãパッãƒã‚’作ã£ã¦æŠ•稿ã™ã‚‹ã‹ã«ã¤
139 ã“れらã®ãƒ•ァイルã«ã¯ã€ã©ã†ã‚„ã£ã¦ã†ã¾ãパッãƒã‚’作ã£ã¦æŠ•稿ã™ã‚‹ã‹ã« 126 ã„ã¦éžå¸¸ã«è©³ã—ãæ›¸ã‹ã‚Œã¦ãŠã‚Šã€ä»¥ä¸‹ã‚’å«ã¿ã¾ã™ (ã“れã ã‘ã«é™ã‚‰ãªã„
140 ã¤ã„ã¦éžå¸¸ã«è©³ã—ãæ›¸ã‹ã‚Œã¦ãŠã‚Šã€ä»¥ä¸‹ã‚’å«ã¿ã¾ã™(ã“れã ã‘ã«é™ã‚‰ãªã„ 127 ã‘れã©ã‚‚)
141 ã‘れã©ã‚‚) 128
142 - Email ã«å«ã‚€ã“㨠129 - Email ã«å«ã‚€ã“ã¨
143 - Email ã®å½¢å¼ 130 - Email ã®å½¢å¼
144 - ã ã‚Œã«é€ã‚‹ã‹ 131 - ã ã‚Œã«é€ã‚‹ã‹
145 ã“れらã®ãƒ«ãƒ¼ãƒ«ã«å¾“ãˆã°ã†ã¾ãã„ãã“ã¨ã‚’ä¿è¨¼ã™ã‚‹ã“ã¨ã§ã¯ã‚りã¾ã›ã‚“ 132
146 ㌠(ã™ã¹ã¦ã®ãƒ‘ッãƒã¯å†…容ã¨ã‚¹ã‚¿ã‚¤ãƒ«ã«ã¤ã„ã¦ç²¾æŸ»ã‚’å—ã‘ã‚‹ã®ã§)〠133 ã“れらã®ãƒ«ãƒ¼ãƒ«ã«å¾“ãˆã°ã†ã¾ãã„ãã“ã¨ã‚’ä¿è¨¼ã™ã‚‹ã“ã¨ã§ã¯ã‚りã¾ã›ã‚“
147 ルールã«å¾“ã‚ãªã‘れã°é–“é•ã„ãªãã†ã¾ãã„ã‹ãªã„ã§ã—ょã†ã€‚ 134 ㌠(ã™ã¹ã¦ã®ãƒ‘ッãƒã¯å†…容ã¨ã‚¹ã‚¿ã‚¤ãƒ«ã«ã¤ã„ã¦ç²¾æŸ»ã‚’å—ã‘ã‚‹ã®ã§)ã€
148 135 ルールã«å¾“ã‚ãªã‘れã°é–“é•ã„ãªãã†ã¾ãã„ã‹ãªã„ã§ã—ょã†ã€‚
149 ã“ã®ä»–ã«ãƒ‘ッãƒã‚’作る方法ã«ã¤ã„ã¦ã®ã‚ˆãã§ããŸè¨˜è¿°ã¯- 136
150 137 ã“ã®ä»–ã«ãƒ‘ッãƒã‚’作る方法ã«ã¤ã„ã¦ã®ã‚ˆãã§ããŸè¨˜è¿°ã¯-
151 "The Perfect Patch" 138
139 "The Perfect Patch"
152 http://www.ozlabs.org/~akpm/stuff/tpp.txt 140 http://www.ozlabs.org/~akpm/stuff/tpp.txt
153 "Linux kernel patch submission format" 141 "Linux kernel patch submission format"
154 http://linux.yyz.us/patch-format.html 142 http://linux.yyz.us/patch-format.html
155 143
156 Documentation/process/stable-api-nonsense.rst 144 :ref:`Documentation/process/stable-api-nonsense.rst <stable_api_nonsense>`
157 ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã®ä¸­ã«ä¸å¤‰ã®APIã‚’æŒãŸãªã„ã“ã¨ã«ã—ãŸæ„識的㪠145 ã“ã®ãƒ•ァイルã¯ã‚«ãƒ¼ãƒãƒ«ã®ä¸­ã«ä¸å¤‰ã® API ã‚’æŒãŸãªã„ã“ã¨ã«ã—ãŸæ„識的
158 決断ã®èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã«ã¤ã„ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚以下ã®ã‚ˆã†ãªã“ã¨ã‚’å« 146 ãªæ±ºæ–­ã®èƒŒæ™¯ã«ã‚ã‚‹ç†ç”±ã«ã¤ã„ã¦æ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚以下ã®ã‚ˆã†ãªã“ã¨ã‚’å«
159 ã‚“ã§ã„ã¾ã™- 147 ã‚“ã§ã„ã¾ã™-
160 - サブシステムã¨ã®é–“ã«å±¤ã‚’作るã“ã¨(コンパãƒãƒ“リティã®ãŸã‚?) 148
161 - オペレーティングシステム間ã®ãƒ‰ãƒ©ã‚¤ãƒã®ç§»æ¤æ€§ 149 - サブシステムã¨ã®é–“ã«å±¤ã‚’作るã“ã¨(コンパãƒãƒ“リティã®ãŸã‚?)
162 - カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ç´ æ—©ã„変更をé…らã›ã‚‹(ã‚‚ã—ãã¯ç´ æ—©ã„変更 150 - オペレーティングシステム間ã®ãƒ‰ãƒ©ã‚¤ãƒã®ç§»æ¤æ€§
163 を妨ã’ã‚‹) 151 - カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ç´ æ—©ã„変更をé…らã›ã‚‹(ã‚‚ã—ãã¯ç´ æ—©ã„変更を妨ã’ã‚‹)
164 ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ Linux é–‹ç™ºã®æ€æƒ³ã‚’ç†è§£ã™ã‚‹ã®ã«éžå¸¸ã«é‡è¦ã§ã™ã€‚ 152
165 ãã—ã¦ã€ä»–ã®OSã§ã®é–‹ç™ºè€…㌠Linux ã«ç§»ã‚‹æ™‚ã«ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚ 153 ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ Linux é–‹ç™ºã®æ€æƒ³ã‚’ç†è§£ã™ã‚‹ã®ã«éžå¸¸ã«é‡è¦ã§ã™ã€‚
166 154 ãã—ã¦ã€ä»–ã®OSã§ã®é–‹ç™ºè€…㌠Linux ã«ç§»ã‚‹æ™‚ã«ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚
167 Documentation/admin-guide/security-bugs.rst 155
156 :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>`
168 ã‚‚ã— Linux カーãƒãƒ«ã§ã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•題を発見ã—ãŸã‚ˆã†ã«æ€ã£ãŸã‚‰ã€ã“ 157 ã‚‚ã— Linux カーãƒãƒ«ã§ã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•題を発見ã—ãŸã‚ˆã†ã«æ€ã£ãŸã‚‰ã€ã“
169 ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®ã‚¹ãƒ†ãƒƒãƒ—ã«å¾“ã£ã¦ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«é€£çµ¡ã—ã€å•題解決を 158 ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®ã‚¹ãƒ†ãƒƒãƒ—ã«å¾“ã£ã¦ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«é€£çµ¡ã—ã€å•題解決を
170 支æ´ã—ã¦ãã ã•ã„。 159 支æ´ã—ã¦ãã ã•ã„。
171 160
172 Documentation/process/management-style.rst 161 :ref:`Documentation/process/management-style.rst <managementstyle>`
173 ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ Linux カーãƒãƒ«ã®ãƒ¡ãƒ³ãƒ†ãƒŠé”ãŒã©ã†è¡Œå‹•ã™ã‚‹ã‹ã€ 162 ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ Linux カーãƒãƒ«ã®ãƒ¡ãƒ³ãƒ†ãƒŠé”ãŒã©ã†è¡Œå‹•ã™ã‚‹ã‹ã€
174 å½¼ã‚‰ã®æ‰‹æ³•ã®èƒŒæ™¯ã«ã‚る共有ã•れã¦ã„る精神ã«ã¤ã„ã¦è¨˜è¿°ã—ã¦ã„ã¾ã™ã€‚ã“ 163 å½¼ã‚‰ã®æ‰‹æ³•ã®èƒŒæ™¯ã«ã‚る共有ã•れã¦ã„る精神ã«ã¤ã„ã¦è¨˜è¿°ã—ã¦ã„ã¾ã™ã€‚ã“
175 れã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã®åˆå¿ƒè€…ãªã‚‰ï¼ˆã‚‚ã—ãã¯ã€å˜ã«èˆˆå‘³ãŒã‚ã‚‹ã ã‘ã®äººã§ã‚‚) 164 れã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã®åˆå¿ƒè€…ãªã‚‰ï¼ˆã‚‚ã—ãã¯ã€å˜ã«èˆˆå‘³ãŒã‚ã‚‹ã ã‘ã®äººã§ã‚‚)
176 é‡è¦ã§ã™ã€‚ãªãœãªã‚‰ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ã€ã‚«ãƒ¼ãƒãƒ«ãƒ¡ãƒ³ãƒ†ãƒŠé”ã®ç‹¬ç‰¹ãª 165 é‡è¦ã§ã™ã€‚ãªãœãªã‚‰ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ã€ã‚«ãƒ¼ãƒãƒ«ãƒ¡ãƒ³ãƒ†ãƒŠé”ã®ç‹¬ç‰¹ãª
177 行動ã«ã¤ã„ã¦ã®å¤šãã®èª¤è§£ã‚„混乱を解消ã™ã‚‹ã‹ã‚‰ã§ã™ã€‚ 166 行動ã«ã¤ã„ã¦ã®å¤šãã®èª¤è§£ã‚„混乱を解消ã™ã‚‹ã‹ã‚‰ã§ã™ã€‚
178 167
179 Documentation/process/stable-kernel-rules.rst 168 :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
180 ã“ã®ãƒ•ァイルã¯ã©ã®ã‚ˆã†ã« stable カーãƒãƒ«ã®ãƒªãƒªãƒ¼ã‚¹ãŒè¡Œã‚れるã‹ã®ãƒ«ãƒ¼ 169 ã“ã®ãƒ•ァイルã¯ã©ã®ã‚ˆã†ã« stable カーãƒãƒ«ã®ãƒªãƒªãƒ¼ã‚¹ãŒè¡Œã‚れるã‹ã®ãƒ«ãƒ¼
181 ルãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ãã—ã¦ã“れらã®ãƒªãƒªãƒ¼ã‚¹ã®ä¸­ã®ã©ã“ã‹ã§å¤‰æ›´ã‚’å– 170 ルãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ãã—ã¦ã“れらã®ãƒªãƒªãƒ¼ã‚¹ã®ä¸­ã®ã©ã“ã‹ã§å¤‰æ›´ã‚’å–
182 り入れã¦ã‚‚らã„ãŸã„å ´åˆã«ä½•ã‚’ã™ã‚Œã°è‰¯ã„ã‹ãŒç¤ºã•れã¦ã„ã¾ã™ã€‚ 171 り入れã¦ã‚‚らã„ãŸã„å ´åˆã«ä½•ã‚’ã™ã‚Œã°è‰¯ã„ã‹ãŒç¤ºã•れã¦ã„ã¾ã™ã€‚
183 172
184 Documentation/process/kernel-docs.rst 173 :Ref:`Documentation/process/kernel-docs.rst <kernel_docs>`
185  カーãƒãƒ«é–‹ç™ºã«ä»˜éšã™ã‚‹å¤–部ドキュメントã®ãƒªã‚¹ãƒˆã§ã™ã€‚ã‚‚ã—ã‚ãªãŸãŒ 174 カーãƒãƒ«é–‹ç™ºã«ä»˜éšã™ã‚‹å¤–部ドキュメントã®ãƒªã‚¹ãƒˆã§ã™ã€‚ã‚‚ã—ã‚ãªãŸãŒæŽ¢
186 探ã—ã¦ã„ã‚‹ã‚‚ã®ãŒã‚«ãƒ¼ãƒãƒ«å†…ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã§ã¿ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆã€ 175 ã—ã¦ã„ã‚‹ã‚‚ã®ãŒã‚«ãƒ¼ãƒãƒ«å†…ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã§ã¿ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆã€ã“ã®
187 ã“ã®ãƒªã‚¹ãƒˆã‚’ã‚ãŸã£ã¦ã¿ã¦ãã ã•ã„。 176 リストをã‚ãŸã£ã¦ã¿ã¦ãã ã•ã„。
188 177
189 Documentation/process/applying-patches.rst 178 :ref:`Documentation/process/applying-patches.rst <applying_patches>`
190 パッãƒã¨ã¯ãªã«ã‹ã€ãƒ‘ッãƒã‚’ã©ã†ã‚„ã£ã¦æ§˜ã€…ãªã‚«ãƒ¼ãƒãƒ«ã®é–‹ç™ºãƒ–ランãƒã« 179 パッãƒã¨ã¯ãªã«ã‹ã€ãƒ‘ッãƒã‚’ã©ã†ã‚„ã£ã¦æ§˜ã€…ãªã‚«ãƒ¼ãƒãƒ«ã®é–‹ç™ºãƒ–ランãƒã«
191 é©ç”¨ã™ã‚‹ã®ã‹ã«ã¤ã„ã¦æ­£ç¢ºã«è¨˜è¿°ã—ãŸè‰¯ã„入門書ã§ã™ã€‚ 180 é©ç”¨ã™ã‚‹ã®ã‹ã«ã¤ã„ã¦æ­£ç¢ºã«è¨˜è¿°ã—ãŸè‰¯ã„入門書ã§ã™ã€‚
192 181
193カーãƒãƒ«ã¯ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã‹ã‚‰è‡ªå‹•çš„ã«ç”Ÿæˆå¯èƒ½ãªå¤šæ•°ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’自分自 182カーãƒãƒ«ã¯ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ãã®ã‚‚ã®ã‚„ã€ã“ã®ãƒ•ァイルã®ã‚ˆã†ãªãƒªã‚¹ãƒˆãƒ©ã‚¯ãƒãƒ£ãƒ¼
194身ã§ã‚‚ã£ã¦ã„ã¾ã™ã€‚ã“れã«ã¯ã‚«ãƒ¼ãƒãƒ«å†… API ã®ã™ã¹ã¦ã®è¨˜è¿°ã‚„ã€ã©ã†æ­£ã—ã 183ドテキストマークアップ(ReST)ã‹ã‚‰è‡ªå‹•çš„ã«ç”Ÿæˆå¯èƒ½ãªå¤šæ•°ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’
195ロックをã‹ã‘ã‚‹ã‹ã®è¦å‰‡ãŒå«ã¾ã‚Œã¾ã™ã€‚ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ 184ã‚‚ã£ã¦ã„ã¾ã™ã€‚ã“れã«ã¯ã‚«ãƒ¼ãƒãƒ«å†…APIã®å®Œå…¨ãªè¨˜è¿°ã‚„ã€æ­£ã—ãロックをã‹ã‘
196Documentation/DocBook/ ディレクトリã«ä½œã‚‰ã‚Œã€ä»¥ä¸‹ã®ã‚ˆã†ã« 185ã‚‹ãŸã‚ã®è¦å‰‡ãªã©ãŒå«ã¾ã‚Œã¾ã™ã€‚
197 make pdfdocs 186
198 make psdocs 187ã“れら全ã¦ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’ PDF ã‚„ HTML ã§ç”Ÿæˆã™ã‚‹ã«ã¯ä»¥ä¸‹ã‚’実行ã—ã¾ã™ - ::
199 make htmldocs 188
200 make mandocs 189 make pdfdocs
201コマンドを実行ã™ã‚‹ã¨ãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‹ã‚‰ 190 make htmldocs
202ãれãžã‚Œã€PDF, Postscript, HTML, man page ã®å½¢å¼ã§ç”Ÿæˆã•れã¾ã™ã€‚ 191
192ãれãžã‚Œãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‹ã‚‰å®Ÿè¡Œã—ã¾ã™ã€‚
193
194ReSTマークアップを使ã£ãŸãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ Documentation/outputã«ç”Ÿæˆã•れ
195ã¾ã™ã€‚Latex ã¨ePub å½¢å¼ã§ç”Ÿæˆã™ã‚‹ã«ã¯ - ::
196
197 make latexdocs
198 make epubdocs
199
200ç¾åœ¨ã€å¹¾ã¤ã‹ã® DocBookå½¢å¼ã§æ›¸ã‹ã‚ŒãŸãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ ReSTå½¢å¼ã«è»¢æ›ä¸­ã§
201ã™ã€‚ãれらã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯Documentation/DocBook ディレクトリã«ç”Ÿæˆã•れã€
202Postscript ã¾ãŸã¯ man ページã®å½¢å¼ã‚’生æˆã™ã‚‹ã«ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ã—ã¾ã™ - ::
203
204 make psdocs
205 make mandocs
203 206
204カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ã«ã¯ 207カーãƒãƒ«é–‹ç™ºè€…ã«ãªã‚‹ã«ã¯
205--------------------------- 208------------------------
206 209
207ã‚‚ã—ã‚ãªãŸãŒã€Linux カーãƒãƒ«é–‹ç™ºã«ã¤ã„ã¦ä½•も知らãªã„ãªã‚‰ã°ã€ 210ã‚‚ã—ã‚ãªãŸãŒã€Linux カーãƒãƒ«é–‹ç™ºã«ã¤ã„ã¦ä½•も知らãªã„ã®ãªã‚‰ã°ã€
208KernelNewbies プロジェクトを見るã¹ãã§ã™ 211KernelNewbies プロジェクトを見るã¹ãã§ã™
209 http://kernelnewbies.org 212
213 https://kernelnewbies.org
210 214
211ã“ã®ã‚µã‚¤ãƒˆã«ã¯å½¹ã«ç«‹ã¤ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€åŸºæœ¬çš„ãªã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã«é–¢ 215ã“ã®ã‚µã‚¤ãƒˆã«ã¯å½¹ã«ç«‹ã¤ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€åŸºæœ¬çš„ãªã‚«ãƒ¼ãƒãƒ«é–‹ç™ºã«é–¢
212ã™ã‚‹ã»ã¨ã‚“ã©ã©ã‚“ãªç¨®é¡žã®è³ªå•ã‚‚ã§ãã¾ã™ (æ—¢ã«å›žç­”ã•れã¦ã„るよã†ãªã“ã¨ã‚’ 216ã™ã‚‹ã»ã¨ã‚“ã©ã©ã‚“ãªç¨®é¡žã®è³ªå•ã‚‚ã§ãã¾ã™ (æ—¢ã«å›žç­”ã•れã¦ã„るよã†ãªã“ã¨ã‚’
213èžãå‰ã«ã¾ãšã¯ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を調ã¹ã¦ãã ã•ã„)。 217èžãå‰ã«ã¾ãšã¯ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を調ã¹ã¦ãã ã•ã„)。ã¾ãŸã“ã“ã«ã¯ã€ãƒªã‚¢ãƒ«ã‚¿ã‚¤ãƒ 
214ã¾ãŸã“ã“ã«ã¯ã€ãƒªã‚¢ãƒ«ã‚¿ã‚¤ãƒ ã§è³ªå•ã‚’èžãã“ã¨ãŒã§ãã‚‹ IRC ãƒãƒ£ãƒãƒ«ã‚„ã€Linux 218ã§è³ªå•ã‚’èžãã“ã¨ãŒã§ãã‚‹ IRC ãƒãƒ£ãƒãƒ«ã‚„ã€Linuxカーãƒãƒ«ã®é–‹ç™ºã«é–¢ã—ã¦å­¦
215カーãƒãƒ«ã®é–‹ç™ºã«é–¢ã—ã¦å­¦ã¶ã®ã«ä¾¿åˆ©ãªãŸãã•ã‚“ã®å½¹ã«ç«‹ã¤ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆãŒã‚ 219ã¶ã®ã«ä¾¿åˆ©ãªãŸãã•ã‚“ã®å½¹ã«ç«‹ã¤ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆãŒã‚りã¾ã™ã€‚
216りã¾ã™ã€‚
217 220
218web サイトã«ã¯ã€ã‚³ãƒ¼ãƒ‰ã®æ§‹æˆã€ã‚µãƒ–システムã€ç¾åœ¨å­˜åœ¨ã™ã‚‹ãƒ—ロジェクト(ツ 221Web サイトã«ã¯ã€ã‚³ãƒ¼ãƒ‰ã®æ§‹æˆã€ã‚µãƒ–システムã€ç¾åœ¨å­˜åœ¨ã™ã‚‹ãƒ—ロジェクト
219リーã«ã‚ã‚‹ã‚‚ã®ç„¡ã„ã‚‚ã®ã®ä¸¡æ–¹)ã®åŸºæœ¬çš„ãªç®¡ç†æƒ…å ±ãŒã‚りã¾ã™ã€‚ 222(ツリーã«ã‚ã‚‹ã‚‚ã®ç„¡ã„ã‚‚ã®ã®ä¸¡æ–¹)ã®åŸºæœ¬çš„ãªç®¡ç†æƒ…å ±ãŒã‚りã¾ã™ã€‚ã“ã“ã«ã¯ã€
220ã“ã“ã«ã¯ã€ã¾ãŸã€ã‚«ãƒ¼ãƒãƒ«ã®ã‚³ãƒ³ãƒ‘イルã®ã‚„り方やパッãƒã®å½“ã¦æ–¹ãªã©ã®é–“接 223ã¾ãŸã€ã‚«ãƒ¼ãƒãƒ«ã®ã‚³ãƒ³ãƒ‘イルã®ã‚„り方やパッãƒã®å½“ã¦æ–¹ãªã©ã®é–“接的ãªåŸºæœ¬æƒ…
221çš„ãªåŸºæœ¬æƒ…報も記述ã•れã¦ã„ã¾ã™ã€‚ 224報も記述ã•れã¦ã„ã¾ã™ã€‚
222 225
223ã‚ãªãŸãŒã©ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã—ã¦è‰¯ã„ã‹ã‚ã‹ã‚‰ãªã„ãŒã€Linux カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥ 226ã‚ãªãŸãŒã©ã“ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã—ã¦è‰¯ã„ã‹ã‚ã‹ã‚‰ãªã„ãŒã€Linux カーãƒãƒ«é–‹ç™ºã‚³ãƒŸãƒ¥
224ニティã«å‚加ã—ã¦ä½•ã‹ã™ã‚‹ã“ã¨ã‚’ã•ãŒã—ã¦ã„ã‚‹å ´åˆã«ã¯ã€Linux kernel 227ニティã«å‚加ã—ã¦ä½•ã‹ã™ã‚‹ã“ã¨ã‚’ã•ãŒã—ã¦ã„ã‚‹ã®ã§ã‚れã°ã€Linux kernel
225Janitor's プロジェクトã«ã„ã‘ã°è‰¯ã„ã§ã—ょㆠ- 228Janitor's プロジェクトã«ã„ã‘ã°è‰¯ã„ã§ã—ょㆠ-
226 http://kernelnewbies.org/KernelJanitors 229
230 https://kernelnewbies.org/KernelJanitors
231
227ã“ã“ã¯ãã®ã‚ˆã†ãªã‚¹ã‚¿ãƒ¼ãƒˆã‚’ã™ã‚‹ã®ã«ã†ã£ã¦ã¤ã‘ã®å ´æ‰€ã§ã™ã€‚ã“ã“ã«ã¯ã€ 232ã“ã“ã¯ãã®ã‚ˆã†ãªã‚¹ã‚¿ãƒ¼ãƒˆã‚’ã™ã‚‹ã®ã«ã†ã£ã¦ã¤ã‘ã®å ´æ‰€ã§ã™ã€‚ã“ã“ã«ã¯ã€
228Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸­ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿®æ­£ã—ãªã‘れã°ãª 233Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸­ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿®æ­£ã—ãªã‘れã°ãª
229らãªã„ã€å˜ç´”ãªå•題ã®ãƒªã‚¹ãƒˆãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ã“ã®ãƒ—ロジェクトã«é–¢ã‚ã‚‹ 234らãªã„ã€å˜ç´”ãªå•題ã®ãƒªã‚¹ãƒˆãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ã“ã®ãƒ—ロジェクトã«é–¢ã‚ã‚‹
@@ -232,10 +237,11 @@ Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸­ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿
232ã¦ã„ãªã„å ´åˆã«ã¯ã€æ¬¡ã«ã‚„ã‚‹ä»•äº‹ã®æ–¹å‘性ãŒè¦‹ãˆã¦ãã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。 237ã¦ã„ãªã„å ´åˆã«ã¯ã€æ¬¡ã«ã‚„ã‚‹ä»•äº‹ã®æ–¹å‘性ãŒè¦‹ãˆã¦ãã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。
233 238
234ã‚‚ã—ã‚ãªãŸãŒã€ã™ã§ã«ã²ã¨ã¾ã¨ã¾ã‚Šã‚³ãƒ¼ãƒ‰ã‚’書ã„ã¦ã„ã¦ã€ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã«å…¥ 239ã‚‚ã—ã‚ãªãŸãŒã€ã™ã§ã«ã²ã¨ã¾ã¨ã¾ã‚Šã‚³ãƒ¼ãƒ‰ã‚’書ã„ã¦ã„ã¦ã€ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã«å…¥
235れãŸã„ã¨æ€ã£ã¦ã„ãŸã‚Šã€ãれã«é–¢ã™ã‚‹é©åˆ‡ãªæ”¯æ´ã‚’求ã‚ãŸã„å ´åˆã€ã‚«ãƒ¼ãƒãƒ« 240れãŸã„ã¨æ€ã£ã¦ã„ãŸã‚Šã€ãれã«é–¢ã™ã‚‹é©åˆ‡ãªæ”¯æ´ã‚’求ã‚ãŸã„å ´åˆã€ã‚«ãƒ¼ãƒãƒ«ãƒ¡
236メンターズプロジェクトã¯ãã®ã‚ˆã†ãªçš†ã•んを助ã‘ã‚‹ãŸã‚ã«ã§ãã¾ã—ãŸã€‚ 241ンターズプロジェクトã¯ãã®ã‚ˆã†ãªçš†ã•んを助ã‘ã‚‹ãŸã‚ã«ã§ãã¾ã—ãŸã€‚ã“ã“ã«
237ã“ã“ã«ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€ä»¥ä¸‹ã‹ã‚‰å‚ç…§ã§ãã¾ã™ 242ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆãŒã‚りã€ä»¥ä¸‹ã‹ã‚‰å‚ç…§ã§ãã¾ã™ -
238 http://selenic.com/mailman/listinfo/kernel-mentors 243
244 https://selenic.com/mailman/listinfo/kernel-mentors
239 245
240実際㫠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‰ã«ã¤ã„ã¦ä¿®æ­£ã‚’加ãˆã‚‹å‰ã«ã€ã©ã†ã‚„ã£ã¦ãã® 246実際㫠Linux カーãƒãƒ«ã®ã‚³ãƒ¼ãƒ‰ã«ã¤ã„ã¦ä¿®æ­£ã‚’加ãˆã‚‹å‰ã«ã€ã©ã†ã‚„ã£ã¦ãã®
241コードãŒå‹•作ã™ã‚‹ã®ã‹ã‚’ç†è§£ã™ã‚‹ã“ã¨ãŒå¿…è¦ã§ã™ã€‚ãã®ãŸã‚ã«ã¯ã€ç‰¹åˆ¥ãªãƒ„ー 247コードãŒå‹•作ã™ã‚‹ã®ã‹ã‚’ç†è§£ã™ã‚‹ã“ã¨ãŒå¿…è¦ã§ã™ã€‚ãã®ãŸã‚ã«ã¯ã€ç‰¹åˆ¥ãªãƒ„ー
@@ -244,27 +250,29 @@ Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã®ä¸­ã«å«ã¾ã‚Œã‚‹ã€ãれã„ã«ã—ã€ä¿
244特ã«ãŠã™ã™ã‚ãªã®ã¯ã€Linux クロスリファレンスプロジェクトã§ã™ã€‚ã“れã¯ã€ 250特ã«ãŠã™ã™ã‚ãªã®ã¯ã€Linux クロスリファレンスプロジェクトã§ã™ã€‚ã“れã¯ã€
245自己å‚ç…§æ–¹å¼ã§ã€ç´¢å¼•ãŒã¤ã„㟠web å½¢å¼ã§ã€ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã‚’å‚ç…§ã™ã‚‹ã“ã¨ãŒ 251自己å‚ç…§æ–¹å¼ã§ã€ç´¢å¼•ãŒã¤ã„㟠web å½¢å¼ã§ã€ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã‚’å‚ç…§ã™ã‚‹ã“ã¨ãŒ
246ã§ãã¾ã™ã€‚ã“ã®æœ€æ–°ã®ç´ æ™´ã—ã„カーãƒãƒ«ã‚³ãƒ¼ãƒ‰ã®ãƒªãƒã‚¸ãƒˆãƒªã¯ä»¥ä¸‹ã§è¦‹ã¤ã‹ã‚Š 252ã§ãã¾ã™ã€‚ã“ã®æœ€æ–°ã®ç´ æ™´ã—ã„カーãƒãƒ«ã‚³ãƒ¼ãƒ‰ã®ãƒªãƒã‚¸ãƒˆãƒªã¯ä»¥ä¸‹ã§è¦‹ã¤ã‹ã‚Š
247ã¾ã™- 253ã¾ã™ -
254
248 http://lxr.free-electrons.com/ 255 http://lxr.free-electrons.com/
249 256
250開発プロセス 257開発プロセス
251----------------------- 258------------
252 259
253Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ロセスã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã€Œãƒ–ラン 260Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ロセスã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚«ãƒ¼ãƒãƒ«ã€Œãƒ–ラン
254ãƒã€ã¨å¤šæ•°ã®ã‚µãƒ–システム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã‹ã‚‰æ§‹æˆã•れã¾ã™ã€‚ 261ãƒã€ã¨å¤šæ•°ã®ã‚µãƒ–システム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã‹ã‚‰æ§‹æˆã•れã¾ã™ã€‚ã“れらã®
255ã“れらã®ãƒ–ランãƒã¨ã¯- 262ブランãƒã¨ã¯ -
256 - メイン㮠3.x カーãƒãƒ«ãƒ„リー 263
257 - 3.x.y -stable カーãƒãƒ«ãƒ„リー 264 - メイン㮠4.x カーãƒãƒ«ãƒ„リー
258 - 3.x -git カーãƒãƒ«ãƒ‘ッム265 - 4.x.y -stable カーãƒãƒ«ãƒ„リー
266 - 4.x -git カーãƒãƒ«ãƒ‘ッãƒ
259 - サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッム267 - サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッãƒ
260 - çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 3.x -next カーãƒãƒ«ãƒ„リー 268 - çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 4.x -next カーãƒãƒ«ãƒ„リー
261 269
2623.x カーãƒãƒ«ãƒ„リー 2704.x カーãƒãƒ«ãƒ„リー
263----------------- 271~~~~~~~~~~~~~~~~~~
264 272
2653.x カーãƒãƒ«ã¯ Linus Torvalds ã«ã‚ˆã£ã¦ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ã•れã€kernel.org 2734.x カーãƒãƒ«ã¯ Linus Torvalds ã«ã‚ˆã£ã¦ãƒ¡ãƒ³ãƒ†ãƒŠãƒ³ã‚¹ã•れã€
266ã® pub/linux/kernel/v3.x/ ディレクトリã«å­˜åœ¨ã—ã¾ã™ã€‚ã“ã®é–‹ç™ºãƒ—ロセス㯠274https://kernel.org ã® pub/linux/kernel/v4.x/ ディレクトリã«å­˜åœ¨ã—ã¾ã™ã€‚
267以下ã®ã¨ãŠã‚Š- 275ã“ã®é–‹ç™ºãƒ—ロセスã¯ä»¥ä¸‹ã®ã¨ãŠã‚Š -
268 276
269 - æ–°ã—ã„カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れãŸç›´å¾Œã«ã€2週間ã®ç‰¹åˆ¥æœŸé–“ãŒè¨­ã‘られ〠277 - æ–°ã—ã„カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れãŸç›´å¾Œã«ã€2週間ã®ç‰¹åˆ¥æœŸé–“ãŒè¨­ã‘られã€
270 ã“ã®æœŸé–“中ã«ã€ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠Linus ã«å¤§ããªå·®åˆ†ã‚’é€ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ 278 ã“ã®æœŸé–“中ã«ã€ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠Linus ã«å¤§ããªå·®åˆ†ã‚’é€ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
@@ -272,7 +280,6 @@ Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ロセスã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚
272 大ããªå¤‰æ›´ã¯ git(カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ç®¡ç†ãƒ„ールã€è©³ç´°ã¯ 280 大ããªå¤‰æ›´ã¯ git(カーãƒãƒ«ã®ã‚½ãƒ¼ã‚¹ç®¡ç†ãƒ„ールã€è©³ç´°ã¯
273 http://git-scm.com/ å‚ç…§) を使ã£ã¦é€ã‚‹ã®ãŒå¥½ã¾ã—ã„やり方ã§ã™ãŒã€ãƒ‘ッ 281 http://git-scm.com/ å‚ç…§) を使ã£ã¦é€ã‚‹ã®ãŒå¥½ã¾ã—ã„やり方ã§ã™ãŒã€ãƒ‘ッ
274 ãƒãƒ•ァイルã®å½¢å¼ã®ã¾ã¾é€ã‚‹ã®ã§ã‚‚å分ã§ã™ã€‚ 282 ãƒãƒ•ァイルã®å½¢å¼ã®ã¾ã¾é€ã‚‹ã®ã§ã‚‚å分ã§ã™ã€‚
275
276 - 2週間後ã€-rc1 カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れã€ã“ã®å¾Œã«ã¯ã‚«ãƒ¼ãƒãƒ«å…¨ä½“ã®å®‰å®š 283 - 2週間後ã€-rc1 カーãƒãƒ«ãŒãƒªãƒªãƒ¼ã‚¹ã•れã€ã“ã®å¾Œã«ã¯ã‚«ãƒ¼ãƒãƒ«å…¨ä½“ã®å®‰å®š
277 性ã«å½±éŸ¿ã‚’ã‚ãŸãˆã‚‹ã‚ˆã†ãªæ–°æ©Ÿèƒ½ã¯å«ã¾ãªã„類ã®ãƒ‘ッãƒã—ã‹å–り込むã“㨠284 性ã«å½±éŸ¿ã‚’ã‚ãŸãˆã‚‹ã‚ˆã†ãªæ–°æ©Ÿèƒ½ã¯å«ã¾ãªã„類ã®ãƒ‘ッãƒã—ã‹å–り込むã“ã¨
278 ã¯ã§ãã¾ã›ã‚“。新ã—ã„ドライãƒ(ã‚‚ã—ãã¯ãƒ•ァイルシステム)ã®ãƒ‘ッãƒã¯ 285 ã¯ã§ãã¾ã›ã‚“。新ã—ã„ドライãƒ(ã‚‚ã—ãã¯ãƒ•ァイルシステム)ã®ãƒ‘ッãƒã¯
@@ -282,44 +289,45 @@ Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ロセスã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚
282 Linus ã¸ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹ã®ã« git を使ã†ã“ã¨ã‚‚ã§ãã¾ã™ãŒã€ãƒ‘ッãƒã¯ 289 Linus ã¸ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹ã®ã« git を使ã†ã“ã¨ã‚‚ã§ãã¾ã™ãŒã€ãƒ‘ッãƒã¯
283 レビューã®ãŸã‚ã«ã€ãƒ‘ブリックãªãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã¸ã‚‚åŒæ™‚ã«é€ã‚‹å¿…è¦ãŒ 290 レビューã®ãŸã‚ã«ã€ãƒ‘ブリックãªãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã¸ã‚‚åŒæ™‚ã«é€ã‚‹å¿…è¦ãŒ
284 ã‚りã¾ã™ã€‚ 291 ã‚りã¾ã™ã€‚
285
286 - æ–°ã—ã„ -rc 㯠Linus ãŒã€æœ€æ–°ã® git ツリーãŒãƒ†ã‚¹ãƒˆç›®çš„ã§ã‚れã°å分 292 - æ–°ã—ã„ -rc 㯠Linus ãŒã€æœ€æ–°ã® git ツリーãŒãƒ†ã‚¹ãƒˆç›®çš„ã§ã‚れã°å分
287 ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–­ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚ç›®æ¨™ã¯æ¯Žé€±æ–° 293 ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–­ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚ç›®æ¨™ã¯æ¯Žé€±æ–°
288 ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚ 294 ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚
289
290 - ã“ã®ãƒ—ロセスã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾ 295 - ã“ã®ãƒ—ロセスã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾
291 ã™ã€‚ã“ã®ãƒ—ロセスã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚ 296 ã™ã€‚ã“ã®ãƒ—ロセスã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚
292 297
293Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„ 298Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„
294ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚りã¾ã™- 299ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚りã¾ã™ -
295 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•れるã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“れã¯ç¾ 300
296 実ã«èªè­˜ã•れãŸãƒã‚°ã®çжæ³ã«ã‚ˆã‚Šãƒªãƒªãƒ¼ã‚¹ã•れるã®ã§ã‚りã€å‰ã‚‚ã£ã¦æ±ºã‚ら 301 *「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•れるã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€
297 れãŸè¨ˆç”»ã«ã‚ˆã£ã¦ãƒªãƒªãƒ¼ã‚¹ã•れるもã®ã§ã¯ãªã„ã‹ã‚‰ã§ã™ã€‚〠302 ã“れã¯ç¾å®Ÿã«èªè­˜ã•れãŸãƒã‚°ã®çжæ³ã«ã‚ˆã‚Šãƒªãƒªãƒ¼ã‚¹ã•れるã®ã§ã‚りã€
303 å‰ã‚‚ã£ã¦æ±ºã‚られãŸè¨ˆç”»ã«ã‚ˆã£ã¦ãƒªãƒªãƒ¼ã‚¹ã•れるもã®ã§ã¯ãªã„ã‹ã‚‰
304 ã§ã™ã€‚ã€*
298 305
2993.x.y -stable カーãƒãƒ«ãƒ„リー 3064.x.y -stable カーãƒãƒ«ãƒ„リー
300--------------------------- 307~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301 308
302ãƒãƒ¼ã‚¸ãƒ§ãƒ³ç•ªå·ãŒ3ã¤ã®æ•°å­—ã«åˆ†ã‹ã‚Œã¦ã„るカーãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚ 309ãƒãƒ¼ã‚¸ãƒ§ãƒ³ç•ªå·ãŒ3ã¤ã®æ•°å­—ã«åˆ†ã‹ã‚Œã¦ã„るカーãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚
303ã“れã«ã¯ã€3.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•題やé‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ 310ã“れã«ã¯ã€4.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•題やé‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ã™
304ã™ã‚‹æ¯”較的å°ã•ã„é‡è¦ãªä¿®æ­£ãŒå«ã¾ã‚Œã¾ã™ã€‚ 311る比較的å°ã•ã„é‡è¦ãªä¿®æ­£ãŒå«ã¾ã‚Œã¾ã™ã€‚
305 312
306ã“れã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ã〠313ã“れã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ãã€æœ€æ–°
307最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ãƒ¦ãƒ¼ã‚¶ã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚ 314ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ãƒ¦ãƒ¼ã‚¶ã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚
308 315
309ã‚‚ã—ã€3.x.y カーãƒãƒ«ãŒå­˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 3.x ㌠316ã‚‚ã—ã€4.x.y カーãƒãƒ«ãŒå­˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 4.x ãŒæœ€æ–°
310最新ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ 317ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚
311 318
3123.x.y 㯠"stable" ãƒãƒ¼ãƒ  <stable@vger.kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•れã¦ãŠã‚Šã€å¿… 3194.x.y 㯠"stable" ãƒãƒ¼ãƒ  <stable@vger.kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•れã¦ãŠã‚Šã€
313è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®ã—迫㣠320å¿…è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®
314ãŸå•題ãŒãªã‘れã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚セキュリティ関連ã®å•題 321ã—è¿«ã£ãŸå•題ãŒãªã‘れã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚セキュリティ関
315ã®å ´åˆã¯ã“れã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•れã¾ã™ã€‚ 322連ã®å•題ã®å ´åˆã¯ã“れã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•れã¾ã™ã€‚
316 323
317カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/process/stable-kernel-rules.rst ファ 324カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€
318イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª 325Documentation/process/stable-kernel-rules.rst ファイルã«ã¯ã©ã®ã‚ˆã†ãªç¨®
319リースプロセスãŒã©ã†å‹•ãã‹ãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚ 326類ã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒªãƒªãƒ¼ã‚¹ãƒ—ロセスãŒã©ã†
327å‹•ãã‹ãŒè¨˜è¿°ã•れã¦ã„ã¾ã™ã€‚
320 328
3213.x -git パッム3294.x -git パッãƒ
322------------------ 330~~~~~~~~~~~~~~~
323 331
324git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ—¥ã®ã‚¹ãƒŠãƒƒãƒ— 332git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ—¥ã®ã‚¹ãƒŠãƒƒãƒ—
325ショットãŒã‚りã¾ã™ã€‚(ã ã‹ã‚‰ -git ã¨ã„ã†åå‰ãŒã¤ã„ã¦ã„ã¾ã™)。ã“れらã®ãƒ‘ッ 333ショットãŒã‚りã¾ã™ã€‚(ã ã‹ã‚‰ -git ã¨ã„ã†åå‰ãŒã¤ã„ã¦ã„ã¾ã™)。ã“れらã®ãƒ‘ッ
@@ -328,7 +336,7 @@ git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ
328ã«ç”Ÿæˆã•れるã®ã§ã€ã‚ˆã‚Šå®Ÿé¨“çš„ã§ã™ã€‚ 336ã«ç”Ÿæˆã•れるã®ã§ã€ã‚ˆã‚Šå®Ÿé¨“çš„ã§ã™ã€‚
329 337
330サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッム338サブシステム毎ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リーã¨ãƒ‘ッãƒ
331------------------------------------------- 339~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332 340
333ãれãžã‚Œã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã®ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠--- ãã—ã¦å¤šãã®ã‚«ãƒ¼ãƒãƒ« 341ãれãžã‚Œã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã®ãƒ¡ãƒ³ãƒ†ãƒŠé”㯠--- ãã—ã¦å¤šãã®ã‚«ãƒ¼ãƒãƒ«
334サブシステムã®é–‹ç™ºè€…é”ã‚‚ --- å„è‡ªã®æœ€æ–°ã®é–‹ç™ºçжæ³ã‚’ソースリãƒã‚¸ãƒˆãƒªã« 342サブシステムã®é–‹ç™ºè€…é”ã‚‚ --- å„è‡ªã®æœ€æ–°ã®é–‹ç™ºçжæ³ã‚’ソースリãƒã‚¸ãƒˆãƒªã«
@@ -340,42 +348,45 @@ git リãƒã‚¸ãƒˆãƒªã§ç®¡ç†ã•れã¦ã„ã‚‹Linus ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„ãƒªãƒ¼ã®æ¯Žæ
340大部分ã®ã“れらã®ãƒªãƒã‚¸ãƒˆãƒªã¯ git ツリーã§ã™ã€‚ã—ã‹ã—ãã®ä»–ã® SCM ã‚„ 348大部分ã®ã“れらã®ãƒªãƒã‚¸ãƒˆãƒªã¯ git ツリーã§ã™ã€‚ã—ã‹ã—ãã®ä»–ã® SCM ã‚„
341quilt シリーズã¨ã—ã¦å…¬é–‹ã•れã¦ã„るパッãƒã‚­ãƒ¥ãƒ¼ã‚‚使ã‚れã¦ã„ã¾ã™ã€‚ã“れら 349quilt シリーズã¨ã—ã¦å…¬é–‹ã•れã¦ã„るパッãƒã‚­ãƒ¥ãƒ¼ã‚‚使ã‚れã¦ã„ã¾ã™ã€‚ã“れら
342ã®ã‚µãƒ–システムリãƒã‚¸ãƒˆãƒªã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã¯ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆã•れ 350ã®ã‚µãƒ–システムリãƒã‚¸ãƒˆãƒªã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã¯ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆã•れ
343ã¦ã„ã¾ã™ã€‚ã“れらã®å¤šã㯠http://git.kernel.org/ ã§å‚ç…§ã™ã‚‹ã“ã¨ãŒã§ãã¾ 351ã¦ã„ã¾ã™ã€‚ã“れらã®å¤šã㯠https://git.kernel.org/ ã§å‚ç…§ã™ã‚‹ã“ã¨ãŒã§ãã¾
344ã™ã€‚ 352ã™ã€‚
345 353
346ææ¡ˆã•れãŸãƒ‘ッãƒãŒã“ã®ã‚ˆã†ãªã‚µãƒ–システムツリーã«ã‚³ãƒŸãƒƒãƒˆã•れるå‰ã«ã€ãƒ¡ãƒ¼ 354ææ¡ˆã•れãŸãƒ‘ッãƒãŒã“ã®ã‚ˆã†ãªã‚µãƒ–システムツリーã«ã‚³ãƒŸãƒƒãƒˆã•れるå‰ã«ã€ãƒ¡ãƒ¼
347リングリストã§äº‹å‰ã«ãƒ¬ãƒ“ューã«ã‹ã‘られã¾ã™ï¼ˆä»¥ä¸‹ã®å¯¾å¿œã™ã‚‹ã‚»ã‚¯ã‚·ãƒ§ãƒ³ã‚’ 355リングリストã§äº‹å‰ã«ãƒ¬ãƒ“ューã«ã‹ã‘られã¾ã™ï¼ˆä»¥ä¸‹ã®å¯¾å¿œã™ã‚‹ã‚»ã‚¯ã‚·ãƒ§ãƒ³ã‚’
348å‚照)。ã„ãã¤ã‹ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã§ã¯ã€ã“ã®ãƒ¬ãƒ“ュー㯠patchwork 356å‚照)。ã„ãã¤ã‹ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムã§ã¯ã€ã“ã®ãƒ¬ãƒ“ュー㯠patchworkã¨
349ã¨ã„ã†ãƒ„ールã«ã‚ˆã£ã¦è¿½è·¡ã•れã¾ã™ã€‚Patchwork 㯠web インターフェイス㫠357ã„ã†ãƒ„ールã«ã‚ˆã£ã¦è¿½è·¡ã•れã¾ã™ã€‚Patchwork 㯠web インターフェイスã«ã‚ˆã£
350よã£ã¦ãƒ‘ãƒƒãƒæŠ•ç¨¿ã®è¡¨ç¤ºã€ãƒ‘ッãƒã¸ã®ã‚³ãƒ¡ãƒ³ãƒˆä»˜ã‘や改訂ãªã©ãŒã§ãã€ãã—㦠358ã¦ãƒ‘ãƒƒãƒæŠ•ç¨¿ã®è¡¨ç¤ºã€ãƒ‘ッãƒã¸ã®ã‚³ãƒ¡ãƒ³ãƒˆä»˜ã‘や改訂ãªã©ãŒã§ãã€ãã—ã¦ãƒ¡ãƒ³
351メンテナã¯ãƒ‘ッãƒã«å¯¾ã—ã¦ã€ãƒ¬ãƒ“ュー中ã€å—付済ã¿ã€æ‹’å¦ã¨ã„ã†ã‚ˆã†ãªãƒžãƒ¼ã‚¯ 359テナã¯ãƒ‘ッãƒã«å¯¾ã—ã¦ã€ãƒ¬ãƒ“ュー中ã€å—付済ã¿ã€æ‹’å¦ã¨ã„ã†ã‚ˆã†ãªãƒžãƒ¼ã‚¯ã‚’ã¤
352ã‚’ã¤ã‘ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚大部分ã®ã“れら㮠patchwork ã®ã‚µã‚¤ãƒˆã¯ 360ã‘ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚大部分ã®ã“れら㮠patchwork ã®ã‚µã‚¤ãƒˆã¯
353http://patchwork.kernel.org/ ã§ãƒªã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚ 361https://patchwork.kernel.org/ ã§ãƒªã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚
354 362
355çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 3.x -next カーãƒãƒ«ãƒ„リー 363çµ±åˆãƒ†ã‚¹ãƒˆã®ãŸã‚ã® 4.x -next カーãƒãƒ«ãƒ„リー
356--------------------------------------------- 364~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357 365
358ã‚µãƒ–ã‚·ã‚¹ãƒ†ãƒ ãƒ„ãƒªãƒ¼ã®æ›´æ–°å†…容ãŒãƒ¡ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã® 3.x ツリーã«ãƒžãƒ¼ã‚¸ã•れ 366ã‚µãƒ–ã‚·ã‚¹ãƒ†ãƒ ãƒ„ãƒªãƒ¼ã®æ›´æ–°å†…容ãŒãƒ¡ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã® 4.x ツリーã«ãƒžãƒ¼ã‚¸ã•れる
359ã‚‹å‰ã«ã€ãれらã¯çµ±åˆãƒ†ã‚¹ãƒˆã•れる必è¦ãŒã‚りã¾ã™ã€‚ã“ã®ç›®çš„ã®ãŸã‚ã€å®Ÿè³ªçš„ 367å‰ã«ã€ãれらã¯çµ±åˆãƒ†ã‚¹ãƒˆã•れる必è¦ãŒã‚りã¾ã™ã€‚ã“ã®ç›®çš„ã®ãŸã‚ã€å®Ÿè³ªçš„ã«
360ã«å…¨ã‚µãƒ–システムツリーã‹ã‚‰ã»ã¼æ¯Žæ—¥ãƒ—ルã•れã¦ã§ãる特別ãªãƒ†ã‚¹ãƒˆç”¨ã®ãƒª 368全サブシステムツリーã‹ã‚‰ã»ã¼æ¯Žæ—¥ãƒ—ルã•れã¦ã§ãる特別ãªãƒ†ã‚¹ãƒˆç”¨ã®ãƒªãƒã‚¸
361ãƒã‚¸ãƒˆãƒªãŒå­˜åœ¨ã—ã¾ã™- 369トリãŒå­˜åœ¨ã—ã¾ã™-
362 http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git 370
371 https://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
363 372
364ã“ã®ã‚„り方ã«ã‚ˆã£ã¦ã€-next カーãƒãƒ«ã¯æ¬¡ã®ãƒžãƒ¼ã‚¸æ©Ÿä¼šã§ã©ã‚“ãªã‚‚ã®ãŒãƒ¡ã‚¤ãƒ³ 373ã“ã®ã‚„り方ã«ã‚ˆã£ã¦ã€-next カーãƒãƒ«ã¯æ¬¡ã®ãƒžãƒ¼ã‚¸æ©Ÿä¼šã§ã©ã‚“ãªã‚‚ã®ãŒãƒ¡ã‚¤ãƒ³
365ラインカーãƒãƒ«ã«ãƒžãƒ¼ã‚¸ã•れるã‹ã€ãŠãŠã¾ã‹ãªã®å±•望をæä¾›ã—ã¾ã™ã€‚-next 374ラインカーãƒãƒ«ã«ãƒžãƒ¼ã‚¸ã•れるã‹ã€ãŠãŠã¾ã‹ãªã®å±•望をæä¾›ã—ã¾ã™ã€‚-next カー
366カーãƒãƒ«ã®å®Ÿè¡Œãƒ†ã‚¹ãƒˆã‚’行ã†å†’険好ããªãƒ†ã‚¹ã‚¿ãƒ¼ã¯å¤§ã„ã«æ­“迎ã•れã¾ã™ 375ãƒãƒ«ã®å®Ÿè¡Œãƒ†ã‚¹ãƒˆã‚’行ã†å†’険好ããªãƒ†ã‚¹ã‚¿ãƒ¼ã¯å¤§ã„ã«æ­“迎ã•れã¾ã™ã€‚
367 376
368ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆ 377ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆ
369------------- 378-------------
370 379
371bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹ 380https://bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹
372場所ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ 381場所ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ã©ã†
373ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- 382kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„ -
374 http://bugzilla.kernel.org/page.cgi?id=faq.html 383
375メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル admin-guide/reporting-bugs.rst ã¯ã‚«ãƒ¼ãƒ 384 https://bugzilla.kernel.org/page.cgi?id=faq.html
376ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚りã€å• 385
377題ã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ 386メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル
378ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚ 387admin-guide/reporting-bugs.rstã¯ã‚«ãƒ¼ãƒãƒ«ãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼
388トã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚りã€å•題ã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™º
389者ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚
379 390
380ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã®ç®¡ç† 391ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã®ç®¡ç†
381------------------- 392-------------------
@@ -383,74 +394,78 @@ bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’è¿
383ã‚ãªãŸã®ãƒãƒƒã‚­ãƒ³ã‚°ã®ã‚¹ã‚­ãƒ«ã‚’訓練ã™ã‚‹æœ€é«˜ã®æ–¹æ³•ã®ã²ã¨ã¤ã«ã€ä»–人ãŒãƒ¬ãƒãƒ¼ 394ã‚ãªãŸã®ãƒãƒƒã‚­ãƒ³ã‚°ã®ã‚¹ã‚­ãƒ«ã‚’訓練ã™ã‚‹æœ€é«˜ã®æ–¹æ³•ã®ã²ã¨ã¤ã«ã€ä»–人ãŒãƒ¬ãƒãƒ¼
384トã—ãŸãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ãŒã‚りã¾ã™ã€‚ã‚ãªãŸãŒã‚«ãƒ¼ãƒãƒ«ã‚’より安定化ã•ã›ã‚‹ 395トã—ãŸãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ãŒã‚りã¾ã™ã€‚ã‚ãªãŸãŒã‚«ãƒ¼ãƒãƒ«ã‚’より安定化ã•ã›ã‚‹
385ã“ã«å¯„与ã™ã‚‹ã¨ã„ã†ã“ã¨ã ã‘ã§ãªãã€ã‚ãªãŸã¯ ç¾å®Ÿã®å•題を修正ã™ã‚‹ã“ã¨ã‚’ 396ã“ã«å¯„与ã™ã‚‹ã¨ã„ã†ã“ã¨ã ã‘ã§ãªãã€ã‚ãªãŸã¯ ç¾å®Ÿã®å•題を修正ã™ã‚‹ã“ã¨ã‚’
386å­¦ã³ã€è‡ªåˆ†ã®ã‚¹ã‚­ãƒ«ã‚‚強化ã§ãã€ã¾ãŸä»–ã®é–‹ç™ºè€…ãŒã‚ãªãŸã®å­˜åœ¨ã«æ°—ãŒã¤ã 397å­¦ã³ã€è‡ªåˆ†ã®ã‚¹ã‚­ãƒ«ã‚‚強化ã§ãã€ã¾ãŸä»–ã®é–‹ç™ºè€…ãŒã‚ãªãŸã®å­˜åœ¨ã«æ°—ãŒã¤ãã¾
387ã¾ã™ã€‚ãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ã¯ã€å¤šãã®é–‹ç™ºè€…ã®ä¸­ã‹ã‚‰è‡ªåˆ†ãŒåŠŸç¸¾ã‚’ã‚ã’る最善 398ã™ã€‚ãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ã¯ã€å¤šãã®é–‹ç™ºè€…ã®ä¸­ã‹ã‚‰è‡ªåˆ†ãŒåŠŸç¸¾ã‚’ã‚ã’る最善ã®
388ã®é“ã§ã™ã€ãªãœãªã‚‰å¤šãã®äººã¯ä»–人ã®ãƒã‚°ã®ä¿®æ­£ã«æ™‚間を浪費ã™ã‚‹ã“ã¨ã‚’好㾠399é“ã§ã™ã€ãªãœãªã‚‰å¤šãã®äººã¯ä»–人ã®ãƒã‚°ã®ä¿®æ­£ã«æ™‚間を浪費ã™ã‚‹ã“ã¨ã‚’好ã¾ãª
389ãªã„ã‹ã‚‰ã§ã™ã€‚ 400ã„ã‹ã‚‰ã§ã™ã€‚
390 401
391ã™ã§ã«ãƒ¬ãƒãƒ¼ãƒˆã•れãŸãƒã‚°ã®ãŸã‚ã«ä»•事をã™ã‚‹ãŸã‚ã«ã¯ã€ 402ã™ã§ã«ãƒ¬ãƒãƒ¼ãƒˆã•れãŸãƒã‚°ã®ãŸã‚ã«ä»•事をã™ã‚‹ãŸã‚ã«ã¯ã€
392http://bugzilla.kernel.org ã«è¡Œã£ã¦ãã ã•ã„。もã—今後ã®ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã« 403https://bugzilla.kernel.org ã«è¡Œã£ã¦ãã ã•ã„。もã—今後ã®ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã«
393ã¤ã„ã¦ã‚¢ãƒ‰ãƒã‚¤ã‚¹ã‚’å—ã‘ãŸã„ã®ã§ã‚れã°ã€bugme-new メーリングリスト(æ–°ã— 404ã¤ã„ã¦ã‚¢ãƒ‰ãƒã‚¤ã‚¹ã‚’å—ã‘ãŸã„ã®ã§ã‚れã°ã€bugme-new メーリングリスト(æ–°ã—
394ã„ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã ã‘ãŒã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる) ã¾ãŸã¯ bugme-janitor メーリン 405ã„ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã ã‘ãŒã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる) ã¾ãŸã¯ bugme-janitor メーリン
395グリスト(bugzilla ã®å¤‰æ›´æ¯Žã«ã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる)を購読ã§ãã¾ã™ã€‚ 406グリスト(bugzilla ã®å¤‰æ›´æ¯Žã«ã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•れる)を購読ã§ãã¾ã™ã€‚
396 407
397 http://lists.linux-foundation.org/mailman/listinfo/bugme-new 408 https://lists.linux-foundation.org/mailman/listinfo/bugme-new
398 http://lists.linux-foundation.org/mailman/listinfo/bugme-janitors 409
410 https://lists.linux-foundation.org/mailman/listinfo/bugme-janitors
399 411
400メーリングリスト 412メーリングリスト
401------------- 413----------------
402 414
403上ã®ã„ãã¤ã‹ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã§è¿°ã¹ã¦ã„ã¾ã™ãŒã€ã‚³ã‚¢ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã®å¤§éƒ¨åˆ† 415上ã®ã„ãã¤ã‹ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã§è¿°ã¹ã¦ã„ã¾ã™ãŒã€ã‚³ã‚¢ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã®å¤§éƒ¨åˆ†
404㯠Linux kernel メーリングリストã«å‚加ã—ã¦ã„ã¾ã™ã€‚ã“ã®ãƒªã‚¹ãƒˆã®ç™»éŒ²/脱 416㯠Linux kernel メーリングリストã«å‚加ã—ã¦ã„ã¾ã™ã€‚ã“ã®ãƒªã‚¹ãƒˆã®ç™»éŒ²/脱
405é€€ã®æ–¹æ³•ã«ã¤ã„ã¦ã¯ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- 417é€€ã®æ–¹æ³•ã«ã¤ã„ã¦ã¯ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„-
418
406 http://vger.kernel.org/vger-lists.html#linux-kernel 419 http://vger.kernel.org/vger-lists.html#linux-kernel
407 420
408ã“ã®ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–㯠web 上ã®å¤šæ•°ã®å ´æ‰€ã«å­˜åœ¨ã—ã¾ã™ã€‚ã“ 421ã“ã®ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–㯠web 上ã®å¤šæ•°ã®å ´æ‰€ã«å­˜åœ¨ã—ã¾ã™ã€‚ã“
409れらã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を探ã™ã«ã¯ã‚µãƒ¼ãƒã‚¨ãƒ³ã‚¸ãƒ³ã‚’使ã„ã¾ã—ょã†ã€‚例ãˆã°- 422れらã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–を探ã™ã«ã¯ã‚µãƒ¼ãƒã‚¨ãƒ³ã‚¸ãƒ³ã‚’使ã„ã¾ã—ょã†ã€‚例ãˆã°-
423
410 http://dir.gmane.org/gmane.linux.kernel 424 http://dir.gmane.org/gmane.linux.kernel
411 425
412ãƒªã‚¹ãƒˆã«æŠ•ç¨¿ã™ã‚‹å‰ã«ã™ã§ã«ãã®è©±é¡ŒãŒã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«å­˜åœ¨ã™ã‚‹ã‹ã©ã†ã‹ã‚’検索 426ãƒªã‚¹ãƒˆã«æŠ•ç¨¿ã™ã‚‹å‰ã«ã™ã§ã«ãã®è©±é¡ŒãŒã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«å­˜åœ¨ã™ã‚‹ã‹ã©ã†ã‹ã‚’検索
413ã™ã‚‹ã“ã¨ã‚’是éžã‚„ã£ã¦ãã ã•ã„。多数ã®äº‹ãŒã™ã§ã«è©³ç´°ã«æ¸¡ã£ã¦è­°è«–ã•れ㦠427ã™ã‚‹ã“ã¨ã‚’是éžã‚„ã£ã¦ãã ã•ã„。多数ã®äº‹ãŒã™ã§ã«è©³ç´°ã«æ¸¡ã£ã¦è­°è«–ã•れã¦ãŠ
414ãŠã‚Šã€ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«ã®ã¿è¨˜éŒ²ã•れã¦ã„ã¾ã™ã€‚ 428りã€ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã«ã®ã¿è¨˜éŒ²ã•れã¦ã„ã¾ã™ã€‚
415 429
416大部分ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムも自分ã®å€‹åˆ¥ã®é–‹ç™ºã‚’実施ã™ã‚‹ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ 430大部分ã®ã‚«ãƒ¼ãƒãƒ«ã‚µãƒ–システムも自分ã®å€‹åˆ¥ã®é–‹ç™ºã‚’実施ã™ã‚‹ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹
417トをæŒã£ã¦ã„ã¾ã™ã€‚個々ã®ã‚°ãƒ«ãƒ¼ãƒ—ãŒã©ã‚“ãªãƒªã‚¹ãƒˆã‚’æŒã£ã¦ã„ã‚‹ã‹ã¯ã€ 431トをæŒã£ã¦ã„ã¾ã™ã€‚個々ã®ã‚°ãƒ«ãƒ¼ãƒ—ãŒã©ã‚“ãªãƒªã‚¹ãƒˆã‚’æŒã£ã¦ã„ã‚‹ã‹ã¯ã€
418MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã„。 432MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã„。
419 433
420多ãã®ãƒªã‚¹ãƒˆã¯ kernel.org ã§ãƒ›ã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚ã“ã‚Œã‚‰ã®æƒ…å ±ã¯ä»¥ä¸‹ã«ã‚ 434多ãã®ãƒªã‚¹ãƒˆã¯ kernel.org ã§ãƒ›ã‚¹ãƒˆã•れã¦ã„ã¾ã™ã€‚ã“ã‚Œã‚‰ã®æƒ…å ±ã¯ä»¥ä¸‹ã«ã‚
421りã¾ã™- 435りã¾ã™ -
436
422 http://vger.kernel.org/vger-lists.html 437 http://vger.kernel.org/vger-lists.html
423 438
424メーリングリストを使ã†å ´åˆã€è‰¯ã„行動習慣ã«å¾“ã†ã‚ˆã†ã«ã—ã¾ã—ょã†ã€‚ 439メーリングリストを使ã†å ´åˆã€è‰¯ã„行動習慣ã«å¾“ã†ã‚ˆã†ã«ã—ã¾ã—ょã†ã€‚å°‘ã—安ã£
425å°‘ã—安ã£ã½ã„ãŒã€ä»¥ä¸‹ã® URL ã¯ä¸Šã®ãƒªã‚¹ãƒˆ(ã‚„ä»–ã®ãƒªã‚¹ãƒˆ)ã§ä¼šè©±ã™ã‚‹å ´åˆã® 440ã½ã„ãŒã€ä»¥ä¸‹ã® URL ã¯ä¸Šã®ãƒªã‚¹ãƒˆ(ã‚„ä»–ã®ãƒªã‚¹ãƒˆ)ã§ä¼šè©±ã™ã‚‹å ´åˆã®ã‚·ãƒ³ãƒ—ル
426シンプルãªã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ã‚’示ã—ã¦ã„ã¾ã™- 441ãªã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ã‚’示ã—ã¦ã„ã¾ã™ -
442
427 http://www.albion.com/netiquette/ 443 http://www.albion.com/netiquette/
428 444
429ã‚‚ã—複数ã®äººãŒã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ã«è¿”事をã—ãŸå ´åˆã€CC: ã§å—ã‘る人ã®ãƒªã‚¹ãƒˆã¯ 445ã‚‚ã—複数ã®äººãŒã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ã«è¿”事をã—ãŸå ´åˆã€CC: ã§å—ã‘る人ã®ãƒªã‚¹ãƒˆã¯
430ã ã„ã¶å¤šããªã‚‹ã§ã—ょã†ã€‚良ã„ç†ç”±ãŒãªã„å ´åˆã€CC: リストã‹ã‚‰èª°ã‹ã‚’削除を 446ã ã„ã¶å¤šããªã‚‹ã§ã—ょã†ã€‚正当ãªç†ç”±ãŒãªã„é™ã‚Šã€CC: リストã‹ã‚‰èª°ã‹ã‚’削除
431ã—ãªã„よã†ã«ã€ã¾ãŸã€ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã ã‘ã«ãƒªãƒ—ライã™ã‚‹ã“ã¨ã® 447ã‚’ã—ãªã„よã†ã«ã€ã¾ãŸã€ãƒ¡ãƒ¼ãƒªãƒ³ã‚°ãƒªã‚¹ãƒˆã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã ã‘ã«ãƒªãƒ—ライã™ã‚‹ã“ã¨
432ãªã„よã†ã«ã—ã¾ã—ょã†ã€‚1ã¤ã¯é€ä¿¡è€…ã‹ã‚‰ã€ã‚‚ã†1ã¤ã¯ãƒªã‚¹ãƒˆã‹ã‚‰ã®ã‚ˆã†ã«ã€ãƒ¡ãƒ¼ 448ã®ãªã„よã†ã«ã—ã¾ã—ょã†ã€‚1ã¤ã¯é€ä¿¡è€…ã‹ã‚‰ã€ã‚‚ã†1ã¤ã¯ãƒªã‚¹ãƒˆã‹ã‚‰ã®ã‚ˆã†ã«ã€
433ルを2回å—ã‘ã‚‹ã“ã¨ã«ãªã£ã¦ã‚‚ãã‚Œã«æ…£ã‚Œã€ã—ゃれãŸãƒ¡ãƒ¼ãƒ«ãƒ˜ãƒƒãƒ€ãƒ¼ã‚’追加㗠449メールを2回å—ã‘ã‚‹ã“ã¨ã«ãªã£ã¦ã‚‚ãã‚Œã«æ…£ã‚Œã€ã—ゃれãŸãƒ¡ãƒ¼ãƒ«ãƒ˜ãƒƒãƒ€ãƒ¼ã‚’追
434ã¦ã“ã®çŠ¶æ…‹ã‚’å¤‰ãˆã‚ˆã†ã¨ã—ãªã„よã†ã«ã€‚人々ã¯ãã®ã‚ˆã†ãªã“ã¨ã¯å¥½ã¿ã¾ã›ã‚“。 450加ã—ã¦ã“ã®çŠ¶æ…‹ã‚’å¤‰ãˆã‚ˆã†ã¨ã—ãªã„よã†ã«ã€‚人々ã¯ãã®ã‚ˆã†ãªã“ã¨ã¯å¥½ã¿ã¾ã›
451ん。
435 452
436今ã¾ã§ã®ãƒ¡ãƒ¼ãƒ«ã§ã®ã‚„りã¨ã‚Šã¨ãã®é–“ã®ã‚ãªãŸã®ç™ºè¨€ã¯ãã®ã¾ã¾æ®‹ã—〠453今ã¾ã§ã®ãƒ¡ãƒ¼ãƒ«ã§ã®ã‚„りã¨ã‚Šã¨ãã®é–“ã®ã‚ãªãŸã®ç™ºè¨€ã¯ãã®ã¾ã¾æ®‹ã—ã€
437"John Kernelhacker wrote ...:" ã®è¡Œã‚’ã‚ãªãŸã®ãƒªãƒ—ライã®å…ˆé ­è¡Œã«ã—ã¦ã€ 454"John Kernelhacker wrote ...:" ã®è¡Œã‚’ã‚ãªãŸã®ãƒªãƒ—ライã®å…ˆé ­è¡Œã«ã—ã¦ã€
438メールã®å…ˆé ­ã§ãªãã€å„引用行ã®é–“ã«ã‚ãªãŸã®è¨€ã„ãŸã„ã“ã¨ã‚’追加ã™ã‚‹ã¹ãã§ 455メールã®å…ˆé ­ã§ãªãã€å„引用行ã®é–“ã«ã‚ãªãŸã®è¨€ã„ãŸã„ã“ã¨ã‚’追加ã™ã‚‹ã¹ãã§
439ã™ã€‚ 456ã™ã€‚
440 457
441ã‚‚ã—パッãƒã‚’メールã«ä»˜ã‘ã‚‹å ´åˆã¯ã€Documentation/process/submitting-patches.rst ã«æ 458ã‚‚ã—パッãƒã‚’メールã«ä»˜ã‘ã‚‹å ´åˆã¯ã€
442示ã•れã¦ã„るよã†ã«ã€ãれ㯠プレーンãªå¯èª­ãƒ†ã‚­ã‚¹ãƒˆã«ã™ã‚‹ã“ã¨ã‚’忘れãªã„ 459Documentation/process/submitting-patches.rst ã«æç¤ºã•れã¦ã„るよã†ã«ã€ã
443よã†ã«ã—ã¾ã—ょã†ã€‚カーãƒãƒ«é–‹ç™ºè€…㯠添付や圧縮ã—ãŸãƒ‘ッãƒã‚’扱ã„ãŸãŒã‚Šã¾ 460れ㯠プレーンãªå¯èª­ãƒ†ã‚­ã‚¹ãƒˆã«ã™ã‚‹ã“ã¨ã‚’忘れãªã„よã†ã«ã—ã¾ã—ょã†ã€‚カー
444ã›ã‚“- 461ãƒãƒ«é–‹ç™ºè€…㯠添付や圧縮ã—ãŸãƒ‘ッãƒã‚’扱ã„ãŸãŒã‚Šã¾ã›ã‚“。彼らã¯ã‚ãªãŸã®ãƒ‘ッ
445彼らã¯ã‚ãªãŸã®ãƒ‘ッãƒã®è¡Œæ¯Žã«ã‚³ãƒ¡ãƒ³ãƒˆã‚’入れãŸã„ã®ã§ã€ãã®ãŸã‚ã«ã¯ãã†ã™ 462ãƒã®è¡Œæ¯Žã«ã‚³ãƒ¡ãƒ³ãƒˆã‚’入れãŸã„ã®ã§ã€ãã†ã™ã‚‹ã—ã‹ã‚りã¾ã›ã‚“。ã‚ãªãŸã®ãƒ¡ãƒ¼
446ã‚‹ã—ã‹ã‚りã¾ã›ã‚“。ã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ãƒ—ログラムãŒç©ºç™½ã‚„タブを圧縮ã—ãªã„よㆠ463ルプログラムãŒç©ºç™½ã‚„タブを圧縮ã—ãªã„よã†ã«ç¢ºèªã—ã¾ã—ょã†ã€‚最åˆã®è‰¯ã„テ
447ã«ç¢ºèªã—ãŸæ–¹ãŒè‰¯ã„ã§ã™ã€‚最åˆã®è‰¯ã„テストã¨ã—ã¦ã¯ã€è‡ªåˆ†ã«ãƒ¡ãƒ¼ãƒ«ã‚’é€ã£ã¦ 464ストã¨ã—ã¦ã¯ã€è‡ªåˆ†ã«ãƒ¡ãƒ¼ãƒ«ã‚’é€ã£ã¦ã¿ã¦ã€ãã®ãƒ‘ッãƒã‚’自分ã§å½“ã¦ã¦ã¿ã‚‹ã“
448ã¿ã¦ã€ãã®ãƒ‘ッãƒã‚’自分ã§å½“ã¦ã¦ã¿ã‚‹ã“ã¨ã§ã™ã€‚ã‚‚ã—ãれãŒã†ã¾ã行ã‹ãªã„㪠465ã¨ã§ã™ã€‚ã‚‚ã—ãれãŒã†ã¾ã行ã‹ãªã„ãªã‚‰ã€ã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ãƒ—ログラムを直ã—ã¦
449らã€ã‚ãªãŸã®ãƒ¡ãƒ¼ãƒ«ãƒ—ログラムを直ã—ã¦ã‚‚らã†ã‹ã€æ­£ã—ãå‹•ãよã†ã«å¤‰ãˆã‚‹ã¹ 466もらã†ã‹ã€æ­£ã—ãå‹•ãよã†ã«å¤‰ãˆã‚‹ã¹ãã§ã™ã€‚
450ãã§ã™ã€‚
451 467
452ã¨ã‚Šã‚ã‘ã€ä»–ã®ç™»éŒ²è€…ã«å¯¾ã™ã‚‹å°Šæ•¬ã‚’表ã™ã‚ˆã†ã«ã™ã‚‹ã“ã¨ã‚’覚ãˆã¦ãŠã„ã¦ãã  468何をãŠã„ã¦ã‚‚ã€ä»–ã®è³¼èª­è€…ã«å¯¾ã™ã‚‹æ•¬æ„を表ã™ã“ã¨ã‚’忘れãªã„ã§ãã ã•ã„。
453ã•ã„。
454 469
455コミュニティã¨å…±ã«åƒãã“㨠470コミュニティã¨å…±ã«åƒãã“ã¨
456-------------------------- 471--------------------------
@@ -459,21 +474,22 @@ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã
459ã§ã™ã€‚ã‚ãªãŸãŒãƒ‘ッãƒã‚’å—ã‘入れã¦ã‚‚らã†ãŸã‚ã«æŠ•ç¨¿ã—ãŸå ´åˆã€ãれã¯ã€æŠ€è¡“ 474ã§ã™ã€‚ã‚ãªãŸãŒãƒ‘ッãƒã‚’å—ã‘入れã¦ã‚‚らã†ãŸã‚ã«æŠ•ç¨¿ã—ãŸå ´åˆã€ãれã¯ã€æŠ€è¡“
460的メリットã ã‘ãŒãƒ¬ãƒ“ューã•れã¾ã™ã€‚ãã®éš›ã€ã‚ãªãŸã¯ä½•を予想ã™ã¹ãã§ã—ょ 475的メリットã ã‘ãŒãƒ¬ãƒ“ューã•れã¾ã™ã€‚ãã®éš›ã€ã‚ãªãŸã¯ä½•を予想ã™ã¹ãã§ã—ょ
461ã†ã‹? 476ã†ã‹?
477
462 - 批判 478 - 批判
463 - コメント 479 - コメント
464 - 変更ã®è¦æ±‚ 480 - 変更ã®è¦æ±‚
465 - パッãƒã®æ­£å½“性ã®è¨¼æ˜Žè¦æ±‚ 481 - パッãƒã®æ­£å½“性ã®è¨¼æ˜Žè¦æ±‚
466 - 沈黙 482 - 沈黙
467 483
468æ€ã„出ã—ã¦ãã ã•ã„ã€ã“ã“ã¯ã‚ãªãŸã®ãƒ‘ッãƒã‚’カーãƒãƒ«ã«å…¥ã‚Œã‚‹è©±ã§ã™ã€‚ã‚ 484æ€ã„出ã—ã¦ãã ã•ã„ã€ã“れã¯ã‚ãªãŸã®ãƒ‘ッãƒã‚’カーãƒãƒ«ã«å…¥ã‚Œã‚‹è©±ã§ã™ã€‚ã‚ãª
469ãªãŸã¯ã€ã‚ãªãŸã®ãƒ‘ッãƒã«å¯¾ã™ã‚‹æ‰¹åˆ¤ã¨ã‚³ãƒ¡ãƒ³ãƒˆã‚’å—ã‘入れるã¹ãã§ã€ãれら 485ãŸã¯ã€ã‚ãªãŸã®ãƒ‘ッãƒã«å¯¾ã™ã‚‹æ‰¹åˆ¤ã¨ã‚³ãƒ¡ãƒ³ãƒˆã‚’å—ã‘入れるã¹ãã§ã€ãれらを
470を技術的レベルã§è©•価ã—ã¦ã€ãƒ‘ッãƒã‚’å†ä½œæˆã™ã‚‹ã‹ã€ãªãœãれらã®å¤‰æ›´ã‚’ã™ã¹ 486技術的レベルã§è©•価ã—ã¦ã€ãƒ‘ッãƒã‚’å†ä½œæˆã™ã‚‹ã‹ã€ãªãœãれらã®å¤‰æ›´ã‚’ã™ã¹ã
471ãã§ãªã„ã‹ã‚’明確ã§ç°¡æ½”ãªç†ç”±ã®èª¬æ˜Žã‚’æä¾›ã—ã¦ãã ã•ã„。 487ã§ãªã„ã‹ã‚’明確ã§ç°¡æ½”ãªç†ç”±ã®èª¬æ˜Žã‚’æä¾›ã—ã¦ãã ã•ã„。もã—ã€ã‚ãªãŸã®ãƒ‘ッ
472ã‚‚ã—ã€ã‚ãªãŸã®ãƒ‘ッãƒã«ä½•ã‚‚å応ãŒãªã„å ´åˆã€ãŸã¾ã«ã¯ãƒ¡ãƒ¼ãƒ«ã®å±±ã«åŸ‹ã‚‚れ㦠488ãƒã«ä½•ã‚‚å応ãŒãªã„å ´åˆã€ãŸã¾ã«ã¯ãƒ¡ãƒ¼ãƒ«ã®å±±ã«åŸ‹ã‚‚れã¦è¦‹é€ƒã•れã€ã‚ãªãŸã®
473見逃ã•れã€ã‚ãªãŸã®æŠ•稿ãŒå¿˜ã‚Œã‚‰ã‚Œã¦ã—ã¾ã†ã“ã¨ã‚‚ã‚ã‚‹ã®ã§ã€æ•°æ—¥å¾…ã£ã¦å†åº¦ 489投稿ãŒå¿˜ã‚Œã‚‰ã‚Œã¦ã—ã¾ã†ã“ã¨ã‚‚ã‚ã‚‹ã®ã§ã€æ•°æ—¥å¾…ã£ã¦å†åº¦æŠ•稿ã—ã¦ãã ã•ã„。
474投稿ã—ã¦ãã ã•ã„。 490
491ã‚ãªãŸãŒã‚„ã‚‹ã¹ãã§ãªã„ã“ã¨ã¯?
475 492
476ã‚ãªãŸãŒã‚„ã‚‹ã¹ãã§ãªã„ã‚‚ã®ã¯?
477 - 質å•ãªã—ã«ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘å…¥ã‚Œã‚‰ã‚Œã‚‹ã¨æƒ³åƒã™ã‚‹ã“㨠493 - 質å•ãªã—ã«ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘å…¥ã‚Œã‚‰ã‚Œã‚‹ã¨æƒ³åƒã™ã‚‹ã“ã¨
478 - 守りã«å…¥ã‚‹ã“㨠494 - 守りã«å…¥ã‚‹ã“ã¨
479 - コメントを無視ã™ã‚‹ã“㨠495 - コメントを無視ã™ã‚‹ã“ã¨
@@ -489,37 +505,37 @@ MAINTAINERS ファイルã«ãƒªã‚¹ãƒˆãŒã‚りã¾ã™ã®ã§å‚ç…§ã—ã¦ãã ã•ã
489 505
490ã‚ãªãŸã®æœ€åˆã®ãƒ‘ッãƒã«å˜ã« 1ダースもã®ä¿®æ­£ã‚’求ã‚るリストã®è¿”ç­”ã«ãªã‚‹ã“ 506ã‚ãªãŸã®æœ€åˆã®ãƒ‘ッãƒã«å˜ã« 1ダースもã®ä¿®æ­£ã‚’求ã‚るリストã®è¿”ç­”ã«ãªã‚‹ã“
491ã¨ã‚‚普通ã®ã“ã¨ã§ã™ã€‚ã“れã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘入れられãªã„ã¨ã„ã†ã“ã¨ã§ 507ã¨ã‚‚普通ã®ã“ã¨ã§ã™ã€‚ã“れã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒå—ã‘入れられãªã„ã¨ã„ã†ã“ã¨ã§
492㯠*ã‚りã¾ã›ã‚“*ã€ãã—ã¦ã‚ãªãŸè‡ªèº«ã«å対ã™ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ã®ã§ã‚‚ *ã‚り㾠508㯠**ã‚りã¾ã›ã‚“**ã€ãã—ã¦ã‚ãªãŸè‡ªèº«ã«å対ã™ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ã®ã§ã‚‚ **ã‚
493ã›ã‚“*。å˜ã«è‡ªåˆ†ã®ãƒ‘ッãƒã«å¯¾ã—ã¦æŒ‡æ‘˜ã•れãŸå•題を全ã¦ä¿®æ­£ã—ã¦å†é€ã™ã‚Œã° 509りã¾ã›ã‚“**。å˜ã«è‡ªåˆ†ã®ãƒ‘ッãƒã«å¯¾ã—ã¦æŒ‡æ‘˜ã•れãŸå•題を全ã¦ä¿®æ­£ã—ã¦å†é€ã™
494良ã„ã®ã§ã™ã€‚ 510れã°è‰¯ã„ã®ã§ã™ã€‚
495 511
496 512
497カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¼æ¥­çµ„ç¹”ã®ã¡ãŒã„ 513カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨ä¼æ¥­çµ„ç¹”ã®ã¡ãŒã„
498----------------------------------------------------------------- 514-----------------------------------------------------------------
499 515
500カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯å¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªä¼šç¤¾ã®é–‹ç™ºç’°å¢ƒã¨ã¯ç•°ã£ãŸã‚„り方㧠516カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯å¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªä¼šç¤¾ã®é–‹ç™ºç’°å¢ƒã¨ã¯ç•°ã£ãŸã‚„り方ã§
501å‹•ã„ã¦ã„ã¾ã™ã€‚以下ã¯å•題をé¿ã‘ã‚‹ãŸã‚ã«ã§ãã‚‹ã¨è‰¯ã„ã“ã¨ã®ãƒªã‚¹ãƒˆã§ã™- 517å‹•ã„ã¦ã„ã¾ã™ã€‚以下ã¯å•題をé¿ã‘ã‚‹ãŸã‚ã«ã§ãã‚‹ã¨è‰¯ã„ã“ã¨ã®ãƒªã‚¹ãƒˆã§ã™ã€‚
502 518
503 ã‚ãªãŸã®ææ¡ˆã™ã‚‹å¤‰æ›´ã«ã¤ã„ã¦è¨€ã†ã¨ãã®ã†ã¾ã„è¨€ã„æ–¹ï¼š 519 ã‚ãªãŸã®ææ¡ˆã™ã‚‹å¤‰æ›´ã«ã¤ã„ã¦è¨€ã†ã¨ãã®ã†ã¾ã„è¨€ã„æ–¹ -
504 520
505 - "ã“れã¯è¤‡æ•°ã®å•題を解決ã—ã¾ã™" 521 - "ã“れã¯è¤‡æ•°ã®å•題を解決ã—ã¾ã™"
506 - "ã“れã¯2000行ã®ã‚³ãƒ¼ãƒ‰ã‚’削除ã—ã¾ã™" 522 - "ã“れã¯2000行ã®ã‚³ãƒ¼ãƒ‰ã‚’削除ã—ã¾ã™"
507 - "以下ã®ãƒ‘ッãƒã¯ã€ç§ãŒè¨€ãŠã†ã¨ã—ã¦ã„ã‚‹ã“ã¨ã‚’説明ã™ã‚‹ã‚‚ã®ã§ã™" 523 - "以下ã®ãƒ‘ッãƒã¯ã€ç§ãŒè¨€ãŠã†ã¨ã—ã¦ã„ã‚‹ã“ã¨ã‚’説明ã™ã‚‹ã‚‚ã®ã§ã™"
508 - "ç§ã¯ã“れを5ã¤ã®ç•°ãªã‚‹ã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ã§ãƒ†ã‚¹ãƒˆã—ãŸã®ã§ã™ãŒ..." 524 - "ç§ã¯ã“れを5ã¤ã®ç•°ãªã‚‹ã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ã§ãƒ†ã‚¹ãƒˆã—ãŸã®ã§ã™ãŒ..."
509 - "以下ã¯ä¸€é€£ã®å°ã•ãªãƒ‘ッãƒç¾¤ã§ã™ãŒ..." 525 - "以下ã¯ä¸€é€£ã®å°ã•ãªãƒ‘ッãƒç¾¤ã§ã™ãŒ..."
510 - "ã“れã¯å…¸åž‹çš„ãªãƒžã‚·ãƒ³ã§ã®æ€§èƒ½ã‚’å‘上ã•ã›ã¾ã™.." 526 - "ã“れã¯å…¸åž‹çš„ãªãƒžã‚·ãƒ³ã§ã®æ€§èƒ½ã‚’å‘上ã•ã›ã¾ã™..."
511 527
512 ã‚„ã‚ãŸæ–¹ãŒè‰¯ã„悪ã„è¨€ã„æ–¹ï¼š 528 ã‚„ã‚ãŸæ–¹ãŒè‰¯ã„悪ã„è¨€ã„æ–¹ -
513 529
514 - ã“ã®ã‚„り方㧠AIX/ptx/Solaris ã§ã¯ã§ããŸã®ã§ã€ã§ãã‚‹ã¯ãšã  530 - "ã“ã®ã‚„り方㧠AIX/ptx/Solaris ã§ã¯ã§ããŸã®ã§ã€ã§ãã‚‹ã¯ãšã ..."
515 - ç§ã¯ã“れを20å¹´ã‚‚ã®é–“ã‚„ã£ã¦ããŸã€ã ã‹ã‚‰ 531 - "ç§ã¯ã“れを20å¹´ã‚‚ã®é–“ã‚„ã£ã¦ããŸã€ã ã‹ã‚‰..."
516 - ã“れã¯ã€ç§ã®ä¼šç¤¾ãŒé‡‘儲ã‘ã‚’ã™ã‚‹ãŸã‚ã«å¿…è¦ã  532 - "ã“れã¯ç§ã®ä¼šç¤¾ãŒé‡‘儲ã‘ã‚’ã™ã‚‹ãŸã‚ã«å¿…è¦ã "
517 - ã“ã‚Œã¯æˆ‘々ã®ã‚¨ãƒ³ã‚¿ãƒ¼ãƒ—ライズå‘ã‘商å“ラインã®ãŸã‚ã§ã‚ã‚‹ 533 - "ã“ã‚Œã¯æˆ‘々ã®ã‚¨ãƒ³ã‚¿ãƒ¼ãƒ—ライズå‘ã‘商å“ラインã®ãŸã‚ã§ã‚ã‚‹"
518 - ã“れ㯠ç§ãŒè‡ªåˆ†ã®ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’記述ã—ãŸã€1000ページã®è¨­è¨ˆè³‡æ–™ã§ã‚ã‚‹ 534 - "ã“れã¯ç§ãŒè‡ªåˆ†ã®ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’記述ã—ãŸã€1000ページã®è¨­è¨ˆè³‡æ–™ã§ã‚ã‚‹"
519 - ç§ã¯ã“れã«ã¤ã„ã¦ã€6ケ月作業ã—ã¦ã„る。 535 - "ç§ã¯ã“れã«ã¤ã„ã¦ã€6ケ月作業ã—ã¦ã„ã‚‹..."
520 - 以下㯠... ã«é–¢ã™ã‚‹5000行ã®ãƒ‘ッãƒã§ã™ 536 - "以下㯠... ã«é–¢ã™ã‚‹5000行ã®ãƒ‘ッãƒã§ã™"
521 - ç§ã¯ç¾åœ¨ã®ãã¡ã‚ƒãã¡ã‚ƒã‚’全部書ãç›´ã—ãŸã€ãれãŒä»¥ä¸‹ã§ã™... 537 - "ç§ã¯ç¾åœ¨ã®ãã¡ã‚ƒãã¡ã‚ƒã‚’全部書ãç›´ã—ãŸã€ãれãŒä»¥ä¸‹ã§ã™..."
522 - ç§ã¯ã€†åˆ‡ãŒã‚ã‚‹ã€ãã®ãŸã‚ã“ã®ãƒ‘ッãƒã¯ä»Šã™ãé©ç”¨ã•れる必è¦ãŒã‚ã‚‹ 538 - "ç§ã¯ã€†åˆ‡ãŒã‚ã‚‹ã€ãã®ãŸã‚ã“ã®ãƒ‘ッãƒã¯ä»Šã™ãé©ç”¨ã•れる必è¦ãŒã‚ã‚‹"
523 539
524カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒå¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªã‚½ãƒ•トウェアエンジニアリングã®åŠ´ 540カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ãŒå¤§éƒ¨åˆ†ã®ä¼çµ±çš„ãªã‚½ãƒ•トウェアエンジニアリングã®åŠ´
525åƒç’°å¢ƒã¨ç•°ãªã‚‹ã‚‚ã†ä¸€ã¤ã®ç‚¹ã¯ã€ã‚„りã¨ã‚Šã«é¡”ã‚’åˆã‚ã›ãªã„ã¨ã„ã†ã“ã¨ã§ã™ã€‚ 541åƒç’°å¢ƒã¨ç•°ãªã‚‹ã‚‚ã†ä¸€ã¤ã®ç‚¹ã¯ã€ã‚„りã¨ã‚Šã«é¡”ã‚’åˆã‚ã›ãªã„ã¨ã„ã†ã“ã¨ã§ã™ã€‚
@@ -535,13 +551,13 @@ Patricia (主ã«å¥³æ€§å)ã‚„ Patrick (主ã«ç”·æ€§å)ã®ç•¥ç§°)。
535Linux カーãƒãƒ«ã®æ´»å‹•ã‚’ã—ã¦ã€æ„見を表明ã—ãŸã“ã¨ãŒã‚る大部分ã®å¥³æ€§ã¯ã€å‰ 551Linux カーãƒãƒ«ã®æ´»å‹•ã‚’ã—ã¦ã€æ„見を表明ã—ãŸã“ã¨ãŒã‚る大部分ã®å¥³æ€§ã¯ã€å‰
536å‘ããªçµŒé¨“ã‚’ã‚‚ã£ã¦ã„ã¾ã™ã€‚ 552å‘ããªçµŒé¨“ã‚’ã‚‚ã£ã¦ã„ã¾ã™ã€‚
537 553
538言葉ã®å£ã¯è‹±èªžãŒå¾—æ„ã§ãªã„一部ã®äººã«ã¯å•題ã«ãªã‚Šã¾ã™ã€‚ 554言葉ã®å£ã¯è‹±èªžãŒå¾—æ„ã§ãªã„一部ã®äººã«ã¯å•題ã«ãªã‚Šã¾ã™ã€‚メーリングリスト
539メーリングリストã®ä¸­ã§ãã¡ã‚“ã¨ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’交æ›ã™ã‚‹ã«ã¯ã€ç›¸å½“ã†ã¾ã英語 555ã®ä¸­ã§ããã¡ã‚“ã¨ã‚¢ã‚¤ãƒ‡ã‚£ã‚¢ã‚’交æ›ã™ã‚‹ã«ã¯ã€ç›¸å½“ã†ã¾ã英語をæ“れる必è¦ãŒ
540ã‚’æ“れる必è¦ãŒã‚ã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ãã®ãŸã‚ã€ã‚ãªãŸã¯è‡ªåˆ†ã®ãƒ¡ãƒ¼ãƒ« 556ã‚ã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ãã®ãŸã‚ã€è‡ªåˆ†ã®ãƒ¡ãƒ¼ãƒ«ã‚’é€ã‚‹å‰ã«è‹±èªžã§æ„味ãŒé€šã˜ã¦
541ã‚’é€ã‚‹å‰ã«è‹±èªžã§æå‘³ãŒé€šã˜ã¦ã„ã‚‹ã‹ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ã“ã¨ã‚’ãŠè–¦ã‚ã—ã¾ã™ã€‚ 557ã„ã‚‹ã‹ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ã“ã¨ã‚’ãŠè–¦ã‚ã—ã¾ã™ã€‚
542 558
543変更を分割ã™ã‚‹ 559変更を分割ã™ã‚‹
544--------------------- 560--------------
545 561
546Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’喜んã§å—容ã™ã‚‹ã“ 562Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’喜んã§å—容ã™ã‚‹ã“
547ã¨ã¯ã‚りã¾ã›ã‚“ã€‚å¤‰æ›´ã¯æ­£ç¢ºã«èª¬æ˜Žã•れる必è¦ãŒã‚りã€è­°è«–ã•れã€å°ã•ã„ã€å€‹ 563ã¨ã¯ã‚りã¾ã›ã‚“ã€‚å¤‰æ›´ã¯æ­£ç¢ºã«èª¬æ˜Žã•れる必è¦ãŒã‚りã€è­°è«–ã•れã€å°ã•ã„ã€å€‹
@@ -555,7 +571,7 @@ Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’å–
555ã‚„ã£ã¦ã¯ã„ã‘ã¾ã›ã‚“ã€ã‚ãªãŸã®ãƒ‘ッãƒç¾¤ã¯ã„ã¤ã‚‚ã©ã‚“ãªæ™‚ã§ã‚‚ãれよりã¯å°ã• 571ã‚„ã£ã¦ã¯ã„ã‘ã¾ã›ã‚“ã€ã‚ãªãŸã®ãƒ‘ッãƒç¾¤ã¯ã„ã¤ã‚‚ã©ã‚“ãªæ™‚ã§ã‚‚ãれよりã¯å°ã•
556ããªã‘れã°ãªã‚Šã¾ã›ã‚“。 572ããªã‘れã°ãªã‚Šã¾ã›ã‚“。
557 573
558パッãƒã‚’分割ã™ã‚‹ç†ç”±ã¯ä»¥ä¸‹ã§ã™- 574パッãƒã‚’分割ã™ã‚‹ç†ç”±ã¯ä»¥ä¸‹ -
559 575
5601) å°ã•ã„パッãƒã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒé©ç”¨ã•れる見込ã¿ã‚’大ããã—ã¾ã™ã€ã‚«ãƒ¼ 5761) å°ã•ã„パッãƒã¯ã‚ãªãŸã®ãƒ‘ッãƒãŒé©ç”¨ã•れる見込ã¿ã‚’大ããã—ã¾ã™ã€ã‚«ãƒ¼
561 ãƒãƒ«ã®äººé”ã¯ãƒ‘ッãƒãŒæ­£ã—ã„ã‹ã©ã†ã‹ã‚’確èªã™ã‚‹æ™‚間や労力をã‹ã‘ãªã„ã‹ 577 ãƒãƒ«ã®äººé”ã¯ãƒ‘ッãƒãŒæ­£ã—ã„ã‹ã©ã†ã‹ã‚’確èªã™ã‚‹æ™‚間や労力をã‹ã‘ãªã„ã‹
@@ -571,41 +587,41 @@ Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’å–
5712) å°ã•ã„パッãƒã‚’é€ã‚‹ã ã‘ã§ãªãã€é€ã‚‹ã¾ãˆã«ã€æ›¸ãç›´ã—ã¦ã€ã‚·ãƒ³ãƒ—ルã«ã™ 5872) å°ã•ã„パッãƒã‚’é€ã‚‹ã ã‘ã§ãªãã€é€ã‚‹ã¾ãˆã«ã€æ›¸ãç›´ã—ã¦ã€ã‚·ãƒ³ãƒ—ルã«ã™
572 ã‚‹(ã‚‚ã—ãã¯ã€å˜ã«é †ç•ªã‚’変ãˆã‚‹ã ã‘ã§ã‚‚)ã“ã¨ã‚‚ã€ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚ 588 ã‚‹(ã‚‚ã—ãã¯ã€å˜ã«é †ç•ªã‚’変ãˆã‚‹ã ã‘ã§ã‚‚)ã“ã¨ã‚‚ã€ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚
573 589
574以下ã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã® Al Viro ã®ãŸã¨ãˆè©±ã§ã™ï¼š 590以下ã¯ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã® Al Viro ã®ãŸã¨ãˆè©±ã§ã™ -
575 591
576 "ç”Ÿå¾’ã®æ•°å­¦ã®å®¿é¡Œã‚’採点ã™ã‚‹å…ˆç”Ÿã®ã“ã¨ã‚’考ãˆã¦ã¿ã¦ãã ã•ã„ã€å…ˆ 592 *"ç”Ÿå¾’ã®æ•°å­¦ã®å®¿é¡Œã‚’採点ã™ã‚‹å…ˆç”Ÿã®ã“ã¨ã‚’考ãˆã¦ã¿ã¦ãã ã•ã„ã€
577 生ã¯ç”Ÿå¾’ãŒè§£ã«åˆ°é”ã™ã‚‹ã¾ã§ã®è©¦è¡ŒéŒ¯èª¤ã‚’見ãŸã„ã¨ã¯æ€ã‚ãªã„ã§ã—ょ 593 先生ã¯ç”Ÿå¾’ãŒè§£ã«åˆ°é”ã™ã‚‹ã¾ã§ã®è©¦è¡ŒéŒ¯èª¤ã‚’見ãŸã„ã¨ã¯æ€ã‚ãªã„ã§ã—
578 ã†ã€‚先生ã¯ç°¡æ½”ãªæœ€é«˜ã®è§£ã‚’見ãŸã„ã®ã§ã™ã€‚良ã„生徒ã¯ã“れを知ã£ã¦ 594 ょã†ã€‚先生ã¯ç°¡æ½”ãªæœ€é«˜ã®è§£ã‚’見ãŸã„ã®ã§ã™ã€‚良ã„生徒ã¯ã“れを知ã£
579 ãŠã‚Šã€ãã—ã¦æœ€çµ‚è§£ã®å‰ã®ä¸­é–“作業をæå‡ºã™ã‚‹ã“ã¨ã¯æ±ºã—ã¦ãªã„ã®ã§ 595 ã¦ãŠã‚Šã€ãã—ã¦æœ€çµ‚è§£ã®å‰ã®ä¸­é–“作業をæå‡ºã™ã‚‹ã“ã¨ã¯æ±ºã—ã¦ãªã„ã®
580 ã™" 596 ã§ã*
581 597
582 カーãƒãƒ«é–‹ç™ºã§ã‚‚ã“れã¯åŒã˜ã§ã™ã€‚メンテナé”ã¨ãƒ¬ãƒ“ューアé”ã¯ã€ 598 *カーãƒãƒ«é–‹ç™ºã§ã‚‚ã“れã¯åŒã˜ã§ã™ã€‚メンテナé”ã¨ãƒ¬ãƒ“ューアé”ã¯ã€
583 å•題を解決ã™ã‚‹è§£ã®èƒŒå¾Œã«ãªã‚‹æ€è€ƒãƒ—ロセスを見ãŸã„ã¨ã¯æ€ã„ã¾ã›ã‚“。 599 å•題を解決ã™ã‚‹è§£ã®èƒŒå¾Œã«ãªã‚‹æ€è€ƒãƒ—ロセスを見ãŸã„ã¨ã¯æ€ã„ã¾ã›ã‚“。
584 彼らã¯å˜ç´”ã§ã‚ã–ã‚„ã‹ãªè§£æ±ºæ–¹æ³•を見ãŸã„ã®ã§ã™ã€‚ 600 彼らã¯å˜ç´”ã§ã‚ã–ã‚„ã‹ãªè§£æ±ºæ–¹æ³•を見ãŸã„ã®ã§ã™ã€‚"*
585 601
586ã‚ã–ã‚„ã‹ãªè§£ã‚’説明ã™ã‚‹ã®ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«ä»•事をã—ã€æœªè§£æ±ºã®ä»•事を 602ã‚ã–ã‚„ã‹ãªè§£ã‚’説明ã™ã‚‹ã®ã¨ã€ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¨å…±ã«ä»•事をã—ã€æœªè§£æ±ºã®ä»•事を
587è­°è«–ã™ã‚‹ã“ã¨ã®ãƒãƒ©ãƒ³ã‚¹ã‚’キープã™ã‚‹ã®ã¯é›£ã—ã„ã‹ã‚‚ã—れã¾ã›ã‚“。 603è­°è«–ã™ã‚‹ã“ã¨ã®ãƒãƒ©ãƒ³ã‚¹ã‚’キープã™ã‚‹ã®ã¯é›£ã—ã„ã‹ã‚‚ã—れã¾ã›ã‚“。ã§ã™ã‹ã‚‰ã€
588ã§ã™ã‹ã‚‰ã€é–‹ç™ºãƒ—ãƒ­ã‚»ã‚¹ã®æ—©æœŸæ®µéšŽã§æ”¹å–„ã®ãŸã‚ã®ãƒ•ィードãƒãƒƒã‚¯ã‚’もらã†ã‚ˆ 604é–‹ç™ºãƒ—ãƒ­ã‚»ã‚¹ã®æ—©æœŸæ®µéšŽã§æ”¹å–„ã®ãŸã‚ã®ãƒ•ィードãƒãƒƒã‚¯ã‚’もらã†ã‚ˆã†ã«ã™ã‚‹ã®
589ã†ã«ã™ã‹ã®ã良ã„ã§ã™ãŒã€å¤‰æ›´ç‚¹ã‚’å°ã•ã„部分ã«åˆ†å‰²ã—ã¦å…¨ä½“ã§ã¯ã¾ã å®Œæˆã— 605も良ã„ã§ã™ãŒã€å¤‰æ›´ç‚¹ã‚’å°ã•ã„部分ã«åˆ†å‰²ã—ã¦å…¨ä½“ã§ã¯ã¾ã å®Œæˆã—ã¦ã„ãªã„仕
590ã¦ã„ãªã„仕事を(部分的ã«)å–り込んã§ã‚‚らãˆã‚‹ã‚ˆã†ã«ã™ã‚‹ã“ã¨ã‚‚良ã„ã“ã¨ã§ã™ã€‚ 606事を(部分的ã«)å–り込んã§ã‚‚らãˆã‚‹ã‚ˆã†ã«ã™ã‚‹ã“ã¨ã‚‚良ã„ã“ã¨ã§ã™ã€‚
591 607
592ã¾ãŸã€ã§ã上ãŒã£ã¦ã„ãªã„ã‚‚ã®ã‚„ã€"å°†æ¥ç›´ã™" よã†ãªãƒ‘ッãƒã‚’ã€æœ¬æµã«å«ã‚ 608ã¾ãŸã€ã§ã上ãŒã£ã¦ã„ãªã„ã‚‚ã®ã‚„ã€"å°†æ¥ç›´ã™" よã†ãªãƒ‘ッãƒã‚’ã€æœ¬æµã«å«ã‚
593ã¦ã‚‚らã†ã‚ˆã†ã«é€ã£ã¦ã‚‚ã€ãれã¯å—ã‘付ã‘られãªã„ã“ã¨ã‚’ç†è§£ã—ã¦ãã ã•ã„。 609ã¦ã‚‚らã†ã‚ˆã†ã«é€ã£ã¦ã‚‚ã€ãれã¯å—ã‘付ã‘られãªã„ã“ã¨ã‚’ç†è§£ã—ã¦ãã ã•ã„。
594 610
595ã‚ãªãŸã®å¤‰æ›´ã‚’正当化ã™ã‚‹ 611ã‚ãªãŸã®å¤‰æ›´ã‚’正当化ã™ã‚‹
596------------------- 612------------------------
597 613
598ã‚ãªãŸã®ãƒ‘ッãƒã‚’分割ã™ã‚‹ã®ã¨åŒæ™‚ã«ã€ãªãœãã®å¤‰æ›´ã‚’追加ã—ãªã‘れã°ãªã‚‰ãª 614ã‚ãªãŸã®ãƒ‘ッãƒã‚’分割ã™ã‚‹ã®ã¨åŒæ™‚ã«ã€ãªãœãã®å¤‰æ›´ã‚’追加ã—ãªã‘れã°ãªã‚‰ãª
599ã„ã‹ã‚’ Linux コミュニティã«çŸ¥ã‚‰ã›ã‚‹ã“ã¨ã¯ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚新機能ã¯å¿…è¦ 615ã„ã‹ã‚’ Linux コミュニティã«çŸ¥ã‚‰ã›ã‚‹ã“ã¨ã¯ã¨ã¦ã‚‚é‡è¦ã§ã™ã€‚新機能ã¯å¿…è¦
600æ€§ã¨æœ‰ç”¨æ€§ã§æ­£å½“化ã•れãªã‘れã°ãªã‚Šã¾ã›ã‚“。 616æ€§ã¨æœ‰ç”¨æ€§ã§æ­£å½“化ã•れãªã‘れã°ãªã‚Šã¾ã›ã‚“。
601 617
602ã‚ãªãŸã®å¤‰æ›´ã®èª¬æ˜Ž 618ã‚ãªãŸã®å¤‰æ›´ã‚’説明ã™ã‚‹
603-------------------- 619----------------------
604 620
605ã‚ãªãŸã®ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹å ´åˆã«ã¯ã€ãƒ¡ãƒ¼ãƒ«ã®ä¸­ã®ãƒ†ã‚­ã‚¹ãƒˆã§ä½•を言ã†ã‹ã«ã¤ 621ã‚ãªãŸã®ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹å ´åˆã«ã¯ã€ãƒ¡ãƒ¼ãƒ«ã®ä¸­ã®ãƒ†ã‚­ã‚¹ãƒˆã§ä½•を言ã†ã‹ã«ã¤
606ã„ã¦ã€ç‰¹åˆ¥ã«æ³¨æ„を払ã£ã¦ãã ã•ã„。ã“ã®æƒ…å ±ã¯ãƒ‘ッãƒã® ChangeLog ã«ä½¿ã‚ 622ã„ã¦ã€ç‰¹åˆ¥ã«æ³¨æ„を払ã£ã¦ãã ã•ã„。ã“ã®æƒ…å ±ã¯ãƒ‘ッãƒã® ChangeLog ã«ä½¿ã‚
607れã€ã„ã¤ã‚‚皆ãŒã¿ã‚‰ã‚Œã‚‹ã‚ˆã†ã«ä¿ç®¡ã•れã¾ã™ã€‚ã“ã‚Œã¯æ¬¡ã®ã‚ˆã†ãªé …目をå«ã‚〠623れã€ã„ã¤ã‚‚皆ãŒã¿ã‚‰ã‚Œã‚‹ã‚ˆã†ã«ä¿ç®¡ã•れã¾ã™ã€‚ã“ã‚Œã¯æ¬¡ã®ã‚ˆã†ãªé …目をå«ã‚ã€
608パッãƒã‚’完全ã«è¨˜è¿°ã™ã‚‹ã¹ãã§ã™- 624パッãƒã‚’完全ã«è¨˜è¿°ã™ã‚‹ã¹ãã§ã™ -
609 625
610 - ãªãœå¤‰æ›´ãŒå¿…è¦ã‹ 626 - ãªãœå¤‰æ›´ãŒå¿…è¦ã‹
611 - パッãƒå…¨ä½“ã®è¨­è¨ˆã‚¢ãƒ—ローム627 - パッãƒå…¨ä½“ã®è¨­è¨ˆã‚¢ãƒ—ローãƒ
@@ -613,18 +629,24 @@ Linux カーãƒãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£ã¯ã€ä¸€åº¦ã«å¤§é‡ã®ã‚³ãƒ¼ãƒ‰ã®å¡Šã‚’å–
613 - ãƒ†ã‚¹ãƒˆçµæžœ 629 - ãƒ†ã‚¹ãƒˆçµæžœ
614 630
615ã“れã«ã¤ã„ã¦å…¨ã¦ãŒã©ã®ã‚ˆã†ã«ã‚ã‚‹ã¹ãã‹ã«ã¤ã„ã¦ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ 631ã“れã«ã¤ã„ã¦å…¨ã¦ãŒã©ã®ã‚ˆã†ã«ã‚ã‚‹ã¹ãã‹ã«ã¤ã„ã¦ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã®ãƒ‰ã‚­ãƒ¥ãƒ¡
616ント㮠ChangeLog セクションを見ã¦ãã ã•ã„- 632ント㮠ChangeLog セクションを見ã¦ãã ã•ã„ -
633
617 "The Perfect Patch" 634 "The Perfect Patch"
618 http://www.ozlabs.org/~akpm/stuff/tpp.txt 635 http://www.ozlabs.org/~akpm/stuff/tpp.txt
619 636
620ã“れらã®ã©ã‚Œã‚‚ãŒã€æ™‚ã«ã¯ã¨ã¦ã‚‚困難ã§ã™ã€‚ã“ã‚Œã‚‰ã®æ…£ä¾‹ã‚’完璧ã«å®Ÿæ–½ã™ã‚‹ã« 637ã“れらã¯ã©ã‚Œã‚‚ã€å®Ÿè¡Œã™ã‚‹ã“ã¨ãŒæ™‚ã«ã¯ã¨ã¦ã‚‚困難ã§ã™ã€‚ã“れらã®ä¾‹ã‚’完璧ã«
621ã¯æ•°å¹´ã‹ã‹ã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。ã“れã¯ç¶™ç¶šçš„ãªæ”¹å–„ã®ãƒ—ロセスã§ã‚りã€ãã®ãŸ 638実施ã™ã‚‹ã«ã¯æ•°å¹´ã‹ã‹ã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。ã“れã¯ç¶™ç¶šçš„ãªæ”¹å–„ã®ãƒ—ロセスã§ã‚
622ã‚ã«ã¯å¤šæ•°ã®å¿è€ã¨æ±ºæ„ã‚’å¿…è¦ã¨ã™ã‚‹ã‚‚ã®ã§ã™ã€‚ã§ã‚‚ã€è«¦ã‚ãªã„ã§ã€ã“れã¯å¯ 639りã€å¤šãã®å¿è€ã¨æ±ºæ„ã‚’å¿…è¦ã¨ã™ã‚‹ã‚‚ã®ã§ã™ã€‚ã§ã‚‚諦ã‚ãªã„ã§ã€å®Ÿç¾ã¯å¯èƒ½ã§
623能ãªã“ã¨ã§ã™ã€‚多数ã®äººãŒã™ã§ã«ã§ãã¦ã„ã¾ã™ã—ã€å½¼ã‚‰ã‚‚皆最åˆã¯ã‚ãªãŸã¨åŒ 640ã™ã€‚多数ã®äººãŒã™ã§ã«ã§ãã¦ã„ã¾ã™ã—ã€å½¼ã‚‰ã‚‚最åˆã¯ã‚ãªãŸã¨åŒã˜ã¨ã“ã‚ã‹ã‚‰
624ã˜ã¨ã“ã‚ã‹ã‚‰ã‚¹ã‚¿ãƒ¼ãƒˆã—ãŸã®ã§ã™ã‹ã‚‰ã€‚ 641スタートã—ãŸã®ã§ã™ã‹ã‚‰ã€‚
642
643
644
645
646----------
625 647
626Paolo Ciarrocchi ã«æ„Ÿè¬ã€å½¼ã¯å½¼ã®æ›¸ã„㟠"Development Process" 648Paolo Ciarrocchi ã«æ„Ÿè¬ã€å½¼ã¯å½¼ã®æ›¸ã„㟠"Development Process"
627(http://lwn.net/Articles/94386/) セクションをã“ã®ãƒ†ã‚­ã‚¹ãƒˆã®åŽŸåž‹ã«ã™ã‚‹ 649(https://lwn.net/Articles/94386/) セクションをã“ã®ãƒ†ã‚­ã‚¹ãƒˆã®åŽŸåž‹ã«ã™ã‚‹
628ã“ã¨ã‚’許å¯ã—ã¦ãれã¾ã—ãŸã€‚Rundy Dunlap 㨠Gerrit Huizenga ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚° 650ã“ã¨ã‚’許å¯ã—ã¦ãれã¾ã—ãŸã€‚Rundy Dunlap 㨠Gerrit Huizenga ã¯ãƒ¡ãƒ¼ãƒªãƒ³ã‚°
629リストã§ã‚„ã‚‹ã¹ãã“ã¨ã¨ã‚„ã£ã¦ã¯ã„ã‘ãªã„ã“ã¨ã®ãƒªã‚¹ãƒˆã‚’æä¾›ã—ã¦ãれã¾ã—ãŸã€‚ 651リストã§ã‚„ã‚‹ã¹ãã“ã¨ã¨ã‚„ã£ã¦ã¯ã„ã‘ãªã„ã“ã¨ã®ãƒªã‚¹ãƒˆã‚’æä¾›ã—ã¦ãれã¾ã—ãŸã€‚
630以下ã®äººã€…ã®ãƒ¬ãƒ“ューã€ã‚³ãƒ¡ãƒ³ãƒˆã€è²¢çŒ®ã«æ„Ÿè¬ã€‚ 652以下ã®äººã€…ã®ãƒ¬ãƒ“ューã€ã‚³ãƒ¡ãƒ³ãƒˆã€è²¢çŒ®ã«æ„Ÿè¬ã€‚
@@ -634,4 +656,6 @@ Kleen, Vadim Lobanov, Jesper Juhl, Adrian Bunk, Keri Harris, Frans Pop,
634David A. Wheeler, Junio Hamano, Michael Kerrisk, 㨠Alex Shepard 656David A. Wheeler, Junio Hamano, Michael Kerrisk, 㨠Alex Shepard
635å½¼ã‚‰ã®æ”¯æ´ãªã—ã§ã¯ã€ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ã§ããªã‹ã£ãŸã§ã—ょã†ã€‚ 657å½¼ã‚‰ã®æ”¯æ´ãªã—ã§ã¯ã€ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ã§ããªã‹ã£ãŸã§ã—ょã†ã€‚
636 658
659
660
637Maintainer: Greg Kroah-Hartman <greg@kroah.com> 661Maintainer: Greg Kroah-Hartman <greg@kroah.com>
diff --git a/Documentation/translations/ja_JP/index.rst b/Documentation/translations/ja_JP/index.rst
new file mode 100644
index 000000000000..2f91b895e3c2
--- /dev/null
+++ b/Documentation/translations/ja_JP/index.rst
@@ -0,0 +1,12 @@
1.. raw:: latex
2
3 \renewcommand\thesection*
4 \renewcommand\thesubsection*
5
6Japanese translations
7=====================
8
9.. toctree::
10 :maxdepth: 1
11
12 howto
diff --git a/Documentation/translations/zh_CN/sparse.txt b/Documentation/translations/zh_CN/sparse.txt
index e41dc940e162..2f728962a8e2 100644
--- a/Documentation/translations/zh_CN/sparse.txt
+++ b/Documentation/translations/zh_CN/sparse.txt
@@ -1,4 +1,4 @@
1Chinese translated version of Documentation/sparse.txt 1Chinese translated version of Documentation/dev-tools/sparse.rst
2 2
3If you have any comment or update to the content, please contact the 3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem 4original document maintainer directly. However, if you have a problem
@@ -8,7 +8,7 @@ or if there is a problem with the translation.
8 8
9Chinese maintainer: Li Yang <leo@zh-kernel.org> 9Chinese maintainer: Li Yang <leo@zh-kernel.org>
10--------------------------------------------------------------------- 10---------------------------------------------------------------------
11Documentation/sparse.txt 的中文翻译 11Documentation/dev-tools/sparse.rst 的中文翻译
12 12
13如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文 13如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文
14äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 14äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻
diff --git a/Documentation/usb/acm.txt b/Documentation/usb/acm.txt
index 17f5c2e1a570..903abca10517 100644
--- a/Documentation/usb/acm.txt
+++ b/Documentation/usb/acm.txt
@@ -64,7 +64,7 @@ minicom, ppp and mgetty with them.
64 64
652. Verifying that it works 652. Verifying that it works
66~~~~~~~~~~~~~~~~~~~~~~~~~~ 66~~~~~~~~~~~~~~~~~~~~~~~~~~
67 The first step would be to check /proc/bus/usb/devices, it should look 67 The first step would be to check /sys/kernel/debug/usb/devices, it should look
68like this: 68like this:
69 69
70T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 70T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
diff --git a/Documentation/usb/error-codes.txt b/Documentation/usb/error-codes.txt
deleted file mode 100644
index 9c3eb845ebe5..000000000000
--- a/Documentation/usb/error-codes.txt
+++ /dev/null
@@ -1,175 +0,0 @@
1Revised: 2004-Oct-21
2
3This is the documentation of (hopefully) all possible error codes (and
4their interpretation) that can be returned from usbcore.
5
6Some of them are returned by the Host Controller Drivers (HCDs), which
7device drivers only see through usbcore. As a rule, all the HCDs should
8behave the same except for transfer speed dependent behaviors and the
9way certain faults are reported.
10
11
12**************************************************************************
13* Error codes returned by usb_submit_urb *
14**************************************************************************
15
16Non-USB-specific:
17
180 URB submission went fine
19
20-ENOMEM no memory for allocation of internal structures
21
22USB-specific:
23
24-EBUSY The URB is already active.
25
26-ENODEV specified USB-device or bus doesn't exist
27
28-ENOENT specified interface or endpoint does not exist or
29 is not enabled
30
31-ENXIO host controller driver does not support queuing of this type
32 of urb. (treat as a host controller bug.)
33
34-EINVAL a) Invalid transfer type specified (or not supported)
35 b) Invalid or unsupported periodic transfer interval
36 c) ISO: attempted to change transfer interval
37 d) ISO: number_of_packets is < 0
38 e) various other cases
39
40-EXDEV ISO: URB_ISO_ASAP wasn't specified and all the frames
41 the URB would be scheduled in have already expired.
42
43-EFBIG Host controller driver can't schedule that many ISO frames.
44
45-EPIPE The pipe type specified in the URB doesn't match the
46 endpoint's actual type.
47
48-EMSGSIZE (a) endpoint maxpacket size is zero; it is not usable
49 in the current interface altsetting.
50 (b) ISO packet is larger than the endpoint maxpacket.
51 (c) requested data transfer length is invalid: negative
52 or too large for the host controller.
53
54-ENOSPC This request would overcommit the usb bandwidth reserved
55 for periodic transfers (interrupt, isochronous).
56
57-ESHUTDOWN The device or host controller has been disabled due to some
58 problem that could not be worked around.
59
60-EPERM Submission failed because urb->reject was set.
61
62-EHOSTUNREACH URB was rejected because the device is suspended.
63
64-ENOEXEC A control URB doesn't contain a Setup packet.
65
66
67**************************************************************************
68* Error codes returned by in urb->status *
69* or in iso_frame_desc[n].status (for ISO) *
70**************************************************************************
71
72USB device drivers may only test urb status values in completion handlers.
73This is because otherwise there would be a race between HCDs updating
74these values on one CPU, and device drivers testing them on another CPU.
75
76A transfer's actual_length may be positive even when an error has been
77reported. That's because transfers often involve several packets, so that
78one or more packets could finish before an error stops further endpoint I/O.
79
80For isochronous URBs, the urb status value is non-zero only if the URB is
81unlinked, the device is removed, the host controller is disabled, or the total
82transferred length is less than the requested length and the URB_SHORT_NOT_OK
83flag is set. Completion handlers for isochronous URBs should only see
84urb->status set to zero, -ENOENT, -ECONNRESET, -ESHUTDOWN, or -EREMOTEIO.
85Individual frame descriptor status fields may report more status codes.
86
87
880 Transfer completed successfully
89
90-ENOENT URB was synchronously unlinked by usb_unlink_urb
91
92-EINPROGRESS URB still pending, no results yet
93 (That is, if drivers see this it's a bug.)
94
95-EPROTO (*, **) a) bitstuff error
96 b) no response packet received within the
97 prescribed bus turn-around time
98 c) unknown USB error
99
100-EILSEQ (*, **) a) CRC mismatch
101 b) no response packet received within the
102 prescribed bus turn-around time
103 c) unknown USB error
104
105 Note that often the controller hardware does not
106 distinguish among cases a), b), and c), so a
107 driver cannot tell whether there was a protocol
108 error, a failure to respond (often caused by
109 device disconnect), or some other fault.
110
111-ETIME (**) No response packet received within the prescribed
112 bus turn-around time. This error may instead be
113 reported as -EPROTO or -EILSEQ.
114
115-ETIMEDOUT Synchronous USB message functions use this code
116 to indicate timeout expired before the transfer
117 completed, and no other error was reported by HC.
118
119-EPIPE (**) Endpoint stalled. For non-control endpoints,
120 reset this status with usb_clear_halt().
121
122-ECOMM During an IN transfer, the host controller
123 received data from an endpoint faster than it
124 could be written to system memory
125
126-ENOSR During an OUT transfer, the host controller
127 could not retrieve data from system memory fast
128 enough to keep up with the USB data rate
129
130-EOVERFLOW (*) The amount of data returned by the endpoint was
131 greater than either the max packet size of the
132 endpoint or the remaining buffer size. "Babble".
133
134-EREMOTEIO The data read from the endpoint did not fill the
135 specified buffer, and URB_SHORT_NOT_OK was set in
136 urb->transfer_flags.
137
138-ENODEV Device was removed. Often preceded by a burst of
139 other errors, since the hub driver doesn't detect
140 device removal events immediately.
141
142-EXDEV ISO transfer only partially completed
143 (only set in iso_frame_desc[n].status, not urb->status)
144
145-EINVAL ISO madness, if this happens: Log off and go home
146
147-ECONNRESET URB was asynchronously unlinked by usb_unlink_urb
148
149-ESHUTDOWN The device or host controller has been disabled due
150 to some problem that could not be worked around,
151 such as a physical disconnect.
152
153
154(*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate
155hardware problems such as bad devices (including firmware) or cables.
156
157(**) This is also one of several codes that different kinds of host
158controller use to indicate a transfer has failed because of device
159disconnect. In the interval before the hub driver starts disconnect
160processing, devices may receive such fault reports for every request.
161
162
163
164**************************************************************************
165* Error codes returned by usbcore-functions *
166* (expect also other submit and transfer status codes) *
167**************************************************************************
168
169usb_register():
170-EINVAL error during registering new driver
171
172usb_get_*/usb_set_*():
173usb_control_msg():
174usb_bulk_msg():
175-ETIMEDOUT Timeout expired before the transfer completed.
diff --git a/Documentation/usb/gadget_serial.txt b/Documentation/usb/gadget_serial.txt
index 6b4a88a8c8e3..d1def3186782 100644
--- a/Documentation/usb/gadget_serial.txt
+++ b/Documentation/usb/gadget_serial.txt
@@ -189,7 +189,7 @@ Once the gadget serial driver is loaded and the USB device connected
189to the Linux host with a USB cable, the host system should recognize 189to the Linux host with a USB cable, the host system should recognize
190the gadget serial device. For example, the command 190the gadget serial device. For example, the command
191 191
192 cat /proc/bus/usb/devices 192 cat /sys/kernel/debug/usb/devices
193 193
194should show something like this: 194should show something like this:
195 195
@@ -221,7 +221,7 @@ Once the gadget serial driver is loaded and the USB device connected
221to the Linux host with a USB cable, the host system should recognize 221to the Linux host with a USB cable, the host system should recognize
222the gadget serial device. For example, the command 222the gadget serial device. For example, the command
223 223
224 cat /proc/bus/usb/devices 224 cat /sys/kernel/debug/usb/devices
225 225
226should show something like this: 226should show something like this:
227 227
diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt
deleted file mode 100644
index 98be91982677..000000000000
--- a/Documentation/usb/proc_usb_info.txt
+++ /dev/null
@@ -1,390 +0,0 @@
1/proc/bus/usb filesystem output
2===============================
3(version 2010.09.13)
4
5
6The usbfs filesystem for USB devices is traditionally mounted at
7/proc/bus/usb. It provides the /proc/bus/usb/devices file, as well as
8the /proc/bus/usb/BBB/DDD files.
9
10In many modern systems the usbfs filesystem isn't used at all. Instead
11USB device nodes are created under /dev/usb/ or someplace similar. The
12"devices" file is available in debugfs, typically as
13/sys/kernel/debug/usb/devices.
14
15
16**NOTE**: If /proc/bus/usb appears empty, and a host controller
17 driver has been linked, then you need to mount the
18 filesystem. Issue the command (as root):
19
20 mount -t usbfs none /proc/bus/usb
21
22 An alternative and more permanent method would be to add
23
24 none /proc/bus/usb usbfs defaults 0 0
25
26 to /etc/fstab. This will mount usbfs at each reboot.
27 You can then issue `cat /proc/bus/usb/devices` to extract
28 USB device information, and user mode drivers can use usbfs
29 to interact with USB devices.
30
31 There are a number of mount options supported by usbfs.
32 Consult the source code (linux/drivers/usb/core/inode.c) for
33 information about those options.
34
35**NOTE**: The filesystem has been renamed from "usbdevfs" to
36 "usbfs", to reduce confusion with "devfs". You may
37 still see references to the older "usbdevfs" name.
38
39For more information on mounting the usbfs file system, see the
40"USB Device Filesystem" section of the USB Guide. The latest copy
41of the USB Guide can be found at http://www.linux-usb.org/
42
43
44THE /proc/bus/usb/BBB/DDD FILES:
45--------------------------------
46Each connected USB device has one file. The BBB indicates the bus
47number. The DDD indicates the device address on that bus. Both
48of these numbers are assigned sequentially, and can be reused, so
49you can't rely on them for stable access to devices. For example,
50it's relatively common for devices to re-enumerate while they are
51still connected (perhaps someone jostled their power supply, hub,
52or USB cable), so a device might be 002/027 when you first connect
53it and 002/048 sometime later.
54
55These files can be read as binary data. The binary data consists
56of first the device descriptor, then the descriptors for each
57configuration of the device. Multi-byte fields in the device descriptor
58are converted to host endianness by the kernel. The configuration
59descriptors are in bus endian format! The configuration descriptor
60are wTotalLength bytes apart. If a device returns less configuration
61descriptor data than indicated by wTotalLength there will be a hole in
62the file for the missing bytes. This information is also shown
63in text form by the /proc/bus/usb/devices file, described later.
64
65These files may also be used to write user-level drivers for the USB
66devices. You would open the /proc/bus/usb/BBB/DDD file read/write,
67read its descriptors to make sure it's the device you expect, and then
68bind to an interface (or perhaps several) using an ioctl call. You
69would issue more ioctls to the device to communicate to it using
70control, bulk, or other kinds of USB transfers. The IOCTLs are
71listed in the <linux/usbdevice_fs.h> file, and at this writing the
72source code (linux/drivers/usb/core/devio.c) is the primary reference
73for how to access devices through those files.
74
75Note that since by default these BBB/DDD files are writable only by
76root, only root can write such user mode drivers. You can selectively
77grant read/write permissions to other users by using "chmod". Also,
78usbfs mount options such as "devmode=0666" may be helpful.
79
80
81
82THE /proc/bus/usb/devices FILE:
83-------------------------------
84In /proc/bus/usb/devices, each device's output has multiple
85lines of ASCII output.
86I made it ASCII instead of binary on purpose, so that someone
87can obtain some useful data from it without the use of an
88auxiliary program. However, with an auxiliary program, the numbers
89in the first 4 columns of each "T:" line (topology info:
90Lev, Prnt, Port, Cnt) can be used to build a USB topology diagram.
91
92Each line is tagged with a one-character ID for that line:
93
94T = Topology (etc.)
95B = Bandwidth (applies only to USB host controllers, which are
96 virtualized as root hubs)
97D = Device descriptor info.
98P = Product ID info. (from Device descriptor, but they won't fit
99 together on one line)
100S = String descriptors.
101C = Configuration descriptor info. (* = active configuration)
102I = Interface descriptor info.
103E = Endpoint descriptor info.
104
105=======================================================================
106
107/proc/bus/usb/devices output format:
108
109Legend:
110 d = decimal number (may have leading spaces or 0's)
111 x = hexadecimal number (may have leading spaces or 0's)
112 s = string
113
114
115Topology info:
116
117T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd
118| | | | | | | | |__MaxChildren
119| | | | | | | |__Device Speed in Mbps
120| | | | | | |__DeviceNumber
121| | | | | |__Count of devices at this level
122| | | | |__Connector/Port on Parent for this device
123| | | |__Parent DeviceNumber
124| | |__Level in topology for this bus
125| |__Bus number
126|__Topology info tag
127
128 Speed may be:
129 1.5 Mbit/s for low speed USB
130 12 Mbit/s for full speed USB
131 480 Mbit/s for high speed USB (added for USB 2.0);
132 also used for Wireless USB, which has no fixed speed
133 5000 Mbit/s for SuperSpeed USB (added for USB 3.0)
134
135 For reasons lost in the mists of time, the Port number is always
136 too low by 1. For example, a device plugged into port 4 will
137 show up with "Port=03".
138
139Bandwidth info:
140B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd
141| | | |__Number of isochronous requests
142| | |__Number of interrupt requests
143| |__Total Bandwidth allocated to this bus
144|__Bandwidth info tag
145
146 Bandwidth allocation is an approximation of how much of one frame
147 (millisecond) is in use. It reflects only periodic transfers, which
148 are the only transfers that reserve bandwidth. Control and bulk
149 transfers use all other bandwidth, including reserved bandwidth that
150 is not used for transfers (such as for short packets).
151
152 The percentage is how much of the "reserved" bandwidth is scheduled by
153 those transfers. For a low or full speed bus (loosely, "USB 1.1"),
154 90% of the bus bandwidth is reserved. For a high speed bus (loosely,
155 "USB 2.0") 80% is reserved.
156
157
158Device descriptor info & Product ID info:
159
160D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
161P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
162
163where
164D: Ver=x.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
165| | | | | | |__NumberConfigurations
166| | | | | |__MaxPacketSize of Default Endpoint
167| | | | |__DeviceProtocol
168| | | |__DeviceSubClass
169| | |__DeviceClass
170| |__Device USB version
171|__Device info tag #1
172
173where
174P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
175| | | |__Product revision number
176| | |__Product ID code
177| |__Vendor ID code
178|__Device info tag #2
179
180
181String descriptor info:
182
183S: Manufacturer=ssss
184| |__Manufacturer of this device as read from the device.
185| For USB host controller drivers (virtual root hubs) this may
186| be omitted, or (for newer drivers) will identify the kernel
187| version and the driver which provides this hub emulation.
188|__String info tag
189
190S: Product=ssss
191| |__Product description of this device as read from the device.
192| For older USB host controller drivers (virtual root hubs) this
193| indicates the driver; for newer ones, it's a product (and vendor)
194| description that often comes from the kernel's PCI ID database.
195|__String info tag
196
197S: SerialNumber=ssss
198| |__Serial Number of this device as read from the device.
199| For USB host controller drivers (virtual root hubs) this is
200| some unique ID, normally a bus ID (address or slot name) that
201| can't be shared with any other device.
202|__String info tag
203
204
205
206Configuration descriptor info:
207
208C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA
209| | | | | |__MaxPower in mA
210| | | | |__Attributes
211| | | |__ConfiguratioNumber
212| | |__NumberOfInterfaces
213| |__ "*" indicates the active configuration (others are " ")
214|__Config info tag
215
216 USB devices may have multiple configurations, each of which act
217 rather differently. For example, a bus-powered configuration
218 might be much less capable than one that is self-powered. Only
219 one device configuration can be active at a time; most devices
220 have only one configuration.
221
222 Each configuration consists of one or more interfaces. Each
223 interface serves a distinct "function", which is typically bound
224 to a different USB device driver. One common example is a USB
225 speaker with an audio interface for playback, and a HID interface
226 for use with software volume control.
227
228
229Interface descriptor info (can be multiple per Config):
230
231I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss
232| | | | | | | | |__Driver name
233| | | | | | | | or "(none)"
234| | | | | | | |__InterfaceProtocol
235| | | | | | |__InterfaceSubClass
236| | | | | |__InterfaceClass
237| | | | |__NumberOfEndpoints
238| | | |__AlternateSettingNumber
239| | |__InterfaceNumber
240| |__ "*" indicates the active altsetting (others are " ")
241|__Interface info tag
242
243 A given interface may have one or more "alternate" settings.
244 For example, default settings may not use more than a small
245 amount of periodic bandwidth. To use significant fractions
246 of bus bandwidth, drivers must select a non-default altsetting.
247
248 Only one setting for an interface may be active at a time, and
249 only one driver may bind to an interface at a time. Most devices
250 have only one alternate setting per interface.
251
252
253Endpoint descriptor info (can be multiple per Interface):
254
255E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddss
256| | | | |__Interval (max) between transfers
257| | | |__EndpointMaxPacketSize
258| | |__Attributes(EndpointType)
259| |__EndpointAddress(I=In,O=Out)
260|__Endpoint info tag
261
262 The interval is nonzero for all periodic (interrupt or isochronous)
263 endpoints. For high speed endpoints the transfer interval may be
264 measured in microseconds rather than milliseconds.
265
266 For high speed periodic endpoints, the "MaxPacketSize" reflects
267 the per-microframe data transfer size. For "high bandwidth"
268 endpoints, that can reflect two or three packets (for up to
269 3KBytes every 125 usec) per endpoint.
270
271 With the Linux-USB stack, periodic bandwidth reservations use the
272 transfer intervals and sizes provided by URBs, which can be less
273 than those found in endpoint descriptor.
274
275
276=======================================================================
277
278
279If a user or script is interested only in Topology info, for
280example, use something like "grep ^T: /proc/bus/usb/devices"
281for only the Topology lines. A command like
282"grep -i ^[tdp]: /proc/bus/usb/devices" can be used to list
283only the lines that begin with the characters in square brackets,
284where the valid characters are TDPCIE. With a slightly more able
285script, it can display any selected lines (for example, only T, D,
286and P lines) and change their output format. (The "procusb"
287Perl script is the beginning of this idea. It will list only
288selected lines [selected from TBDPSCIE] or "All" lines from
289/proc/bus/usb/devices.)
290
291The Topology lines can be used to generate a graphic/pictorial
292of the USB devices on a system's root hub. (See more below
293on how to do this.)
294
295The Interface lines can be used to determine what driver is
296being used for each device, and which altsetting it activated.
297
298The Configuration lines could be used to list maximum power
299(in milliamps) that a system's USB devices are using.
300For example, "grep ^C: /proc/bus/usb/devices".
301
302
303Here's an example, from a system which has a UHCI root hub,
304an external hub connected to the root hub, and a mouse and
305a serial converter connected to the external hub.
306
307T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
308B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0
309D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
310P: Vendor=0000 ProdID=0000 Rev= 0.00
311S: Product=USB UHCI Root Hub
312S: SerialNumber=dce0
313C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
314I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
315E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
316
317T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
318D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
319P: Vendor=0451 ProdID=1446 Rev= 1.00
320C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
321I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
322E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms
323
324T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
325D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
326P: Vendor=04b4 ProdID=0001 Rev= 0.00
327C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
328I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
329E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms
330
331T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
332D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
333P: Vendor=0565 ProdID=0001 Rev= 1.08
334S: Manufacturer=Peracom Networks, Inc.
335S: Product=Peracom USB to Serial Converter
336C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
337I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
338E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl= 16ms
339E: Ad=01(O) Atr=02(Bulk) MxPS= 16 Ivl= 16ms
340E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms
341
342
343Selecting only the "T:" and "I:" lines from this (for example, by using
344"procusb ti"), we have:
345
346T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
347T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
348I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
349T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
350I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
351T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
352I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
353
354
355Physically this looks like (or could be converted to):
356
357 +------------------+
358 | PC/root_hub (12)| Dev# = 1
359 +------------------+ (nn) is Mbps.
360 Level 0 | CN.0 | CN.1 | [CN = connector/port #]
361 +------------------+
362 /
363 /
364 +-----------------------+
365 Level 1 | Dev#2: 4-port hub (12)|
366 +-----------------------+
367 |CN.0 |CN.1 |CN.2 |CN.3 |
368 +-----------------------+
369 \ \____________________
370 \_____ \
371 \ \
372 +--------------------+ +--------------------+
373 Level 2 | Dev# 3: mouse (1.5)| | Dev# 4: serial (12)|
374 +--------------------+ +--------------------+
375
376
377
378Or, in a more tree-like structure (ports [Connectors] without
379connections could be omitted):
380
381PC: Dev# 1, root hub, 2 ports, 12 Mbps
382|_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps
383 |_ CN.0: Dev #3, mouse, 1.5 Mbps
384 |_ CN.1:
385 |_ CN.2: Dev #4, serial, 12 Mbps
386 |_ CN.3:
387|_ CN.1:
388
389
390 ### END ###
diff --git a/Documentation/userspace-api/conf.py b/Documentation/userspace-api/conf.py
new file mode 100644
index 000000000000..2eaf59f844e5
--- /dev/null
+++ b/Documentation/userspace-api/conf.py
@@ -0,0 +1,10 @@
1# -*- coding: utf-8; mode: python -*-
2
3project = "The Linux kernel user-space API guide"
4
5tags.add("subproject")
6
7latex_documents = [
8 ('index', 'userspace-api.tex', project,
9 'The kernel development community', 'manual'),
10]
diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
new file mode 100644
index 000000000000..a9d01b44a659
--- /dev/null
+++ b/Documentation/userspace-api/index.rst
@@ -0,0 +1,26 @@
1=====================================
2The Linux kernel user-space API guide
3=====================================
4
5.. _man-pages: https://www.kernel.org/doc/man-pages/
6
7While much of the kernel's user-space API is documented elsewhere
8(particularly in the man-pages_ project), some user-space information can
9also be found in the kernel tree itself. This manual is intended to be the
10place where this information is gathered.
11
12.. class:: toc-title
13
14 Table of contents
15
16.. toctree::
17 :maxdepth: 2
18
19 unshare
20
21.. only:: subproject and html
22
23 Indices
24 =======
25
26 * :ref:`genindex`
diff --git a/Documentation/unshare.txt b/Documentation/userspace-api/unshare.rst
index a8643513a5f6..737c192cf4e7 100644
--- a/Documentation/unshare.txt
+++ b/Documentation/userspace-api/unshare.rst
@@ -1,17 +1,17 @@
1unshare system call
2===================
1 3
2unshare system call: 4This document describes the new system call, unshare(). The document
3--------------------
4This document describes the new system call, unshare. The document
5provides an overview of the feature, why it is needed, how it can 5provides an overview of the feature, why it is needed, how it can
6be used, its interface specification, design, implementation and 6be used, its interface specification, design, implementation and
7how it can be tested. 7how it can be tested.
8 8
9Change Log: 9Change Log
10----------- 10----------
11version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006 11version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006
12 12
13Contents: 13Contents
14--------- 14--------
15 1) Overview 15 1) Overview
16 2) Benefits 16 2) Benefits
17 3) Cost 17 3) Cost
@@ -24,6 +24,7 @@ Contents:
24 24
251) Overview 251) Overview
26----------- 26-----------
27
27Most legacy operating system kernels support an abstraction of threads 28Most legacy operating system kernels support an abstraction of threads
28as multiple execution contexts within a process. These kernels provide 29as multiple execution contexts within a process. These kernels provide
29special resources and mechanisms to maintain these "threads". The Linux 30special resources and mechanisms to maintain these "threads". The Linux
@@ -38,33 +39,35 @@ threads. On Linux, at the time of thread creation using the clone system
38call, applications can selectively choose which resources to share 39call, applications can selectively choose which resources to share
39between threads. 40between threads.
40 41
41unshare system call adds a primitive to the Linux thread model that 42unshare() system call adds a primitive to the Linux thread model that
42allows threads to selectively 'unshare' any resources that were being 43allows threads to selectively 'unshare' any resources that were being
43shared at the time of their creation. unshare was conceptualized by 44shared at the time of their creation. unshare() was conceptualized by
44Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part 45Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part
45of the discussion on POSIX threads on Linux. unshare augments the 46of the discussion on POSIX threads on Linux. unshare() augments the
46usefulness of Linux threads for applications that would like to control 47usefulness of Linux threads for applications that would like to control
47shared resources without creating a new process. unshare is a natural 48shared resources without creating a new process. unshare() is a natural
48addition to the set of available primitives on Linux that implement 49addition to the set of available primitives on Linux that implement
49the concept of process/thread as a virtual machine. 50the concept of process/thread as a virtual machine.
50 51
512) Benefits 522) Benefits
52----------- 53-----------
53unshare would be useful to large application frameworks such as PAM 54
55unshare() would be useful to large application frameworks such as PAM
54where creating a new process to control sharing/unsharing of process 56where creating a new process to control sharing/unsharing of process
55resources is not possible. Since namespaces are shared by default 57resources is not possible. Since namespaces are shared by default
56when creating a new process using fork or clone, unshare can benefit 58when creating a new process using fork or clone, unshare() can benefit
57even non-threaded applications if they have a need to disassociate 59even non-threaded applications if they have a need to disassociate
58from default shared namespace. The following lists two use-cases 60from default shared namespace. The following lists two use-cases
59where unshare can be used. 61where unshare() can be used.
60 62
612.1 Per-security context namespaces 632.1 Per-security context namespaces
62----------------------------------- 64~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63unshare can be used to implement polyinstantiated directories using 65
66unshare() can be used to implement polyinstantiated directories using
64the kernel's per-process namespace mechanism. Polyinstantiated directories, 67the kernel's per-process namespace mechanism. Polyinstantiated directories,
65such as per-user and/or per-security context instance of /tmp, /var/tmp or 68such as per-user and/or per-security context instance of /tmp, /var/tmp or
66per-security context instance of a user's home directory, isolate user 69per-security context instance of a user's home directory, isolate user
67processes when working with these directories. Using unshare, a PAM 70processes when working with these directories. Using unshare(), a PAM
68module can easily setup a private namespace for a user at login. 71module can easily setup a private namespace for a user at login.
69Polyinstantiated directories are required for Common Criteria certification 72Polyinstantiated directories are required for Common Criteria certification
70with Labeled System Protection Profile, however, with the availability 73with Labeled System Protection Profile, however, with the availability
@@ -74,33 +77,36 @@ polyinstantiating /tmp, /var/tmp and other directories deemed
74appropriate by system administrators. 77appropriate by system administrators.
75 78
762.2 unsharing of virtual memory and/or open files 792.2 unsharing of virtual memory and/or open files
77------------------------------------------------- 80~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
78Consider a client/server application where the server is processing 82Consider a client/server application where the server is processing
79client requests by creating processes that share resources such as 83client requests by creating processes that share resources such as
80virtual memory and open files. Without unshare, the server has to 84virtual memory and open files. Without unshare(), the server has to
81decide what needs to be shared at the time of creating the process 85decide what needs to be shared at the time of creating the process
82which services the request. unshare allows the server an ability to 86which services the request. unshare() allows the server an ability to
83disassociate parts of the context during the servicing of the 87disassociate parts of the context during the servicing of the
84request. For large and complex middleware application frameworks, this 88request. For large and complex middleware application frameworks, this
85ability to unshare after the process was created can be very 89ability to unshare() after the process was created can be very
86useful. 90useful.
87 91
883) Cost 923) Cost
89------- 93-------
90In order to not duplicate code and to handle the fact that unshare 94
95In order to not duplicate code and to handle the fact that unshare()
91works on an active task (as opposed to clone/fork working on a newly 96works on an active task (as opposed to clone/fork working on a newly
92allocated inactive task) unshare had to make minor reorganizational 97allocated inactive task) unshare() had to make minor reorganizational
93changes to copy_* functions utilized by clone/fork system call. 98changes to copy_* functions utilized by clone/fork system call.
94There is a cost associated with altering existing, well tested and 99There is a cost associated with altering existing, well tested and
95stable code to implement a new feature that may not get exercised 100stable code to implement a new feature that may not get exercised
96extensively in the beginning. However, with proper design and code 101extensively in the beginning. However, with proper design and code
97review of the changes and creation of an unshare test for the LTP 102review of the changes and creation of an unshare() test for the LTP
98the benefits of this new feature can exceed its cost. 103the benefits of this new feature can exceed its cost.
99 104
1004) Requirements 1054) Requirements
101--------------- 106---------------
102unshare reverses sharing that was done using clone(2) system call, 107
103so unshare should have a similar interface as clone(2). That is, 108unshare() reverses sharing that was done using clone(2) system call,
109so unshare() should have a similar interface as clone(2). That is,
104since flags in clone(int flags, void *stack) specifies what should 110since flags in clone(int flags, void *stack) specifies what should
105be shared, similar flags in unshare(int flags) should specify 111be shared, similar flags in unshare(int flags) should specify
106what should be unshared. Unfortunately, this may appear to invert 112what should be unshared. Unfortunately, this may appear to invert
@@ -108,13 +114,14 @@ the meaning of the flags from the way they are used in clone(2).
108However, there was no easy solution that was less confusing and that 114However, there was no easy solution that was less confusing and that
109allowed incremental context unsharing in future without an ABI change. 115allowed incremental context unsharing in future without an ABI change.
110 116
111unshare interface should accommodate possible future addition of 117unshare() interface should accommodate possible future addition of
112new context flags without requiring a rebuild of old applications. 118new context flags without requiring a rebuild of old applications.
113If and when new context flags are added, unshare design should allow 119If and when new context flags are added, unshare() design should allow
114incremental unsharing of those resources on an as needed basis. 120incremental unsharing of those resources on an as needed basis.
115 121
1165) Functional Specification 1225) Functional Specification
117--------------------------- 123---------------------------
124
118NAME 125NAME
119 unshare - disassociate parts of the process execution context 126 unshare - disassociate parts of the process execution context
120 127
@@ -124,7 +131,7 @@ SYNOPSIS
124 int unshare(int flags); 131 int unshare(int flags);
125 132
126DESCRIPTION 133DESCRIPTION
127 unshare allows a process to disassociate parts of its execution 134 unshare() allows a process to disassociate parts of its execution
128 context that are currently being shared with other processes. Part 135 context that are currently being shared with other processes. Part
129 of execution context, such as the namespace, is shared by default 136 of execution context, such as the namespace, is shared by default
130 when a new process is created using fork(2), while other parts, 137 when a new process is created using fork(2), while other parts,
@@ -132,7 +139,7 @@ DESCRIPTION
132 shared by explicit request to share them when creating a process 139 shared by explicit request to share them when creating a process
133 using clone(2). 140 using clone(2).
134 141
135 The main use of unshare is to allow a process to control its 142 The main use of unshare() is to allow a process to control its
136 shared execution context without creating a new process. 143 shared execution context without creating a new process.
137 144
138 The flags argument specifies one or bitwise-or'ed of several of 145 The flags argument specifies one or bitwise-or'ed of several of
@@ -176,17 +183,20 @@ SEE ALSO
176 183
1776) High Level Design 1846) High Level Design
178-------------------- 185--------------------
179Depending on the flags argument, the unshare system call allocates 186
187Depending on the flags argument, the unshare() system call allocates
180appropriate process context structures, populates it with values from 188appropriate process context structures, populates it with values from
181the current shared version, associates newly duplicated structures 189the current shared version, associates newly duplicated structures
182with the current task structure and releases corresponding shared 190with the current task structure and releases corresponding shared
183versions. Helper functions of clone (copy_*) could not be used 191versions. Helper functions of clone (copy_*) could not be used
184directly by unshare because of the following two reasons. 192directly by unshare() because of the following two reasons.
193
185 1) clone operates on a newly allocated not-yet-active task 194 1) clone operates on a newly allocated not-yet-active task
186 structure, where as unshare operates on the current active 195 structure, where as unshare() operates on the current active
187 task. Therefore unshare has to take appropriate task_lock() 196 task. Therefore unshare() has to take appropriate task_lock()
188 before associating newly duplicated context structures 197 before associating newly duplicated context structures
189 2) unshare has to allocate and duplicate all context structures 198
199 2) unshare() has to allocate and duplicate all context structures
190 that are being unshared, before associating them with the 200 that are being unshared, before associating them with the
191 current task and releasing older shared structures. Failure 201 current task and releasing older shared structures. Failure
192 do so will create race conditions and/or oops when trying 202 do so will create race conditions and/or oops when trying
@@ -202,94 +212,121 @@ Therefore code from copy_* functions that allocated and duplicated
202current context structure was moved into new dup_* functions. Now, 212current context structure was moved into new dup_* functions. Now,
203copy_* functions call dup_* functions to allocate and duplicate 213copy_* functions call dup_* functions to allocate and duplicate
204appropriate context structures and then associate them with the 214appropriate context structures and then associate them with the
205task structure that is being constructed. unshare system call on 215task structure that is being constructed. unshare() system call on
206the other hand performs the following: 216the other hand performs the following:
217
207 1) Check flags to force missing, but implied, flags 218 1) Check flags to force missing, but implied, flags
208 2) For each context structure, call the corresponding unshare 219
220 2) For each context structure, call the corresponding unshare()
209 helper function to allocate and duplicate a new context 221 helper function to allocate and duplicate a new context
210 structure, if the appropriate bit is set in the flags argument. 222 structure, if the appropriate bit is set in the flags argument.
223
211 3) If there is no error in allocation and duplication and there 224 3) If there is no error in allocation and duplication and there
212 are new context structures then lock the current task structure, 225 are new context structures then lock the current task structure,
213 associate new context structures with the current task structure, 226 associate new context structures with the current task structure,
214 and release the lock on the current task structure. 227 and release the lock on the current task structure.
228
215 4) Appropriately release older, shared, context structures. 229 4) Appropriately release older, shared, context structures.
216 230
2177) Low Level Design 2317) Low Level Design
218------------------- 232-------------------
219Implementation of unshare can be grouped in the following 4 different 233
234Implementation of unshare() can be grouped in the following 4 different
220items: 235items:
236
221 a) Reorganization of existing copy_* functions 237 a) Reorganization of existing copy_* functions
222 b) unshare system call service function 238
223 c) unshare helper functions for each different process context 239 b) unshare() system call service function
240
241 c) unshare() helper functions for each different process context
242
224 d) Registration of system call number for different architectures 243 d) Registration of system call number for different architectures
225 244
226 7.1) Reorganization of copy_* functions 2457.1) Reorganization of copy_* functions
227 Each copy function such as copy_mm, copy_namespace, copy_files, 246~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228 etc, had roughly two components. The first component allocated 247
229 and duplicated the appropriate structure and the second component 248Each copy function such as copy_mm, copy_namespace, copy_files,
230 linked it to the task structure passed in as an argument to the copy 249etc, had roughly two components. The first component allocated
231 function. The first component was split into its own function. 250and duplicated the appropriate structure and the second component
232 These dup_* functions allocated and duplicated the appropriate 251linked it to the task structure passed in as an argument to the copy
233 context structure. The reorganized copy_* functions invoked 252function. The first component was split into its own function.
234 their corresponding dup_* functions and then linked the newly 253These dup_* functions allocated and duplicated the appropriate
235 duplicated structures to the task structure with which the 254context structure. The reorganized copy_* functions invoked
236 copy function was called. 255their corresponding dup_* functions and then linked the newly
237 256duplicated structures to the task structure with which the
238 7.2) unshare system call service function 257copy function was called.
258
2597.2) unshare() system call service function
260~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
261
239 * Check flags 262 * Check flags
240 Force implied flags. If CLONE_THREAD is set force CLONE_VM. 263 Force implied flags. If CLONE_THREAD is set force CLONE_VM.
241 If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is 264 If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is
242 set and signals are also being shared, force CLONE_THREAD. If 265 set and signals are also being shared, force CLONE_THREAD. If
243 CLONE_NEWNS is set, force CLONE_FS. 266 CLONE_NEWNS is set, force CLONE_FS.
267
244 * For each context flag, invoke the corresponding unshare_* 268 * For each context flag, invoke the corresponding unshare_*
245 helper routine with flags passed into the system call and a 269 helper routine with flags passed into the system call and a
246 reference to pointer pointing the new unshared structure 270 reference to pointer pointing the new unshared structure
271
247 * If any new structures are created by unshare_* helper 272 * If any new structures are created by unshare_* helper
248 functions, take the task_lock() on the current task, 273 functions, take the task_lock() on the current task,
249 modify appropriate context pointers, and release the 274 modify appropriate context pointers, and release the
250 task lock. 275 task lock.
276
251 * For all newly unshared structures, release the corresponding 277 * For all newly unshared structures, release the corresponding
252 older, shared, structures. 278 older, shared, structures.
253 279
254 7.3) unshare_* helper functions 2807.3) unshare_* helper functions
255 For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND, 281~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
256 and CLONE_THREAD, return -EINVAL since they are not implemented yet.
257 For others, check the flag value to see if the unsharing is
258 required for that structure. If it is, invoke the corresponding
259 dup_* function to allocate and duplicate the structure and return
260 a pointer to it.
261 282
262 7.4) Appropriately modify architecture specific code to register the 283For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND,
263 new system call. 284and CLONE_THREAD, return -EINVAL since they are not implemented yet.
285For others, check the flag value to see if the unsharing is
286required for that structure. If it is, invoke the corresponding
287dup_* function to allocate and duplicate the structure and return
288a pointer to it.
289
2907.4) Finally
291~~~~~~~~~~~~
292
293Appropriately modify architecture specific code to register the
294new system call.
264 295
2658) Test Specification 2968) Test Specification
266--------------------- 297---------------------
267The test for unshare should test the following: 298
299The test for unshare() should test the following:
300
268 1) Valid flags: Test to check that clone flags for signal and 301 1) Valid flags: Test to check that clone flags for signal and
269 signal handlers, for which unsharing is not implemented 302 signal handlers, for which unsharing is not implemented
270 yet, return -EINVAL. 303 yet, return -EINVAL.
304
271 2) Missing/implied flags: Test to make sure that if unsharing 305 2) Missing/implied flags: Test to make sure that if unsharing
272 namespace without specifying unsharing of filesystem, correctly 306 namespace without specifying unsharing of filesystem, correctly
273 unshares both namespace and filesystem information. 307 unshares both namespace and filesystem information.
308
274 3) For each of the four (namespace, filesystem, files and vm) 309 3) For each of the four (namespace, filesystem, files and vm)
275 supported unsharing, verify that the system call correctly 310 supported unsharing, verify that the system call correctly
276 unshares the appropriate structure. Verify that unsharing 311 unshares the appropriate structure. Verify that unsharing
277 them individually as well as in combination with each 312 them individually as well as in combination with each
278 other works as expected. 313 other works as expected.
314
279 4) Concurrent execution: Use shared memory segments and futex on 315 4) Concurrent execution: Use shared memory segments and futex on
280 an address in the shm segment to synchronize execution of 316 an address in the shm segment to synchronize execution of
281 about 10 threads. Have a couple of threads execute execve, 317 about 10 threads. Have a couple of threads execute execve,
282 a couple _exit and the rest unshare with different combination 318 a couple _exit and the rest unshare with different combination
283 of flags. Verify that unsharing is performed as expected and 319 of flags. Verify that unsharing is performed as expected and
284 that there are no oops or hangs. 320 that there are no oops or hangs.
285 321
2869) Future Work 3229) Future Work
287-------------- 323--------------
288The current implementation of unshare does not allow unsharing of 324
325The current implementation of unshare() does not allow unsharing of
289signals and signal handlers. Signals are complex to begin with and 326signals and signal handlers. Signals are complex to begin with and
290to unshare signals and/or signal handlers of a currently running 327to unshare signals and/or signal handlers of a currently running
291process is even more complex. If in the future there is a specific 328process is even more complex. If in the future there is a specific
292need to allow unsharing of signals and/or signal handlers, it can 329need to allow unsharing of signals and/or signal handlers, it can
293be incrementally added to unshare without affecting legacy 330be incrementally added to unshare() without affecting legacy
294applications using unshare. 331applications using unshare().
295 332
diff --git a/Documentation/vfio-mediated-device.txt b/Documentation/vfio-mediated-device.txt
index d226c7a5ba8b..e5e57b40f8af 100644
--- a/Documentation/vfio-mediated-device.txt
+++ b/Documentation/vfio-mediated-device.txt
@@ -217,9 +217,9 @@ Directories and files under the sysfs for Each Physical Device
217 217
218* [<type-id>] 218* [<type-id>]
219 219
220 The [<type-id>] name is created by adding the the device driver string as a 220 The [<type-id>] name is created by adding the device driver string as a prefix
221 prefix to the string provided by the vendor driver. This format of this name 221 to the string provided by the vendor driver. This format of this name is as
222 is as follows: 222 follows:
223 223
224 sprintf(buf, "%s-%s", dev_driver_string(parent->dev), group->name); 224 sprintf(buf, "%s-%s", dev_driver_string(parent->dev), group->name);
225 225
@@ -380,7 +380,7 @@ card.
380 /dev/ttyS1, UART: 16550A, Port: 0xc150, IRQ: 10 380 /dev/ttyS1, UART: 16550A, Port: 0xc150, IRQ: 10
381 /dev/ttyS2, UART: 16550A, Port: 0xc158, IRQ: 10 381 /dev/ttyS2, UART: 16550A, Port: 0xc158, IRQ: 10
382 382
3836. Using a minicom or any terminal enulation program, open port /dev/ttyS1 or 3836. Using minicom or any terminal emulation program, open port /dev/ttyS1 or
384 /dev/ttyS2 with hardware flow control disabled. 384 /dev/ttyS2 with hardware flow control disabled.
385 385
3867. Type data on the minicom terminal or send data to the terminal emulation 3867. Type data on the minicom terminal or send data to the terminal emulation
diff --git a/Documentation/zorro.txt b/Documentation/zorro.txt
index 90a64d52bea2..d530971beb00 100644
--- a/Documentation/zorro.txt
+++ b/Documentation/zorro.txt
@@ -11,7 +11,7 @@ Last revised: September 5, 2003
11The Zorro bus is the bus used in the Amiga family of computers. Thanks to 11The Zorro bus is the bus used in the Amiga family of computers. Thanks to
12AutoConfig(tm), it's 100% Plug-and-Play. 12AutoConfig(tm), it's 100% Plug-and-Play.
13 13
14There are two types of Zorro busses, Zorro II and Zorro III: 14There are two types of Zorro buses, Zorro II and Zorro III:
15 15
16 - The Zorro II address space is 24-bit and lies within the first 16 MB of the 16 - The Zorro II address space is 24-bit and lies within the first 16 MB of the
17 Amiga's address map. 17 Amiga's address map.
diff --git a/MAINTAINERS b/MAINTAINERS
index 5f91365ebc0d..24f894eb2a7f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6036,7 +6036,7 @@ M: Sebastian Reichel <sre@kernel.org>
6036T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git 6036T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git
6037S: Maintained 6037S: Maintained
6038F: Documentation/ABI/testing/sysfs-bus-hsi 6038F: Documentation/ABI/testing/sysfs-bus-hsi
6039F: Documentation/device-drivers/serial-interfaces.rst 6039F: Documentation/driver-api/hsi.rst
6040F: drivers/hsi/ 6040F: drivers/hsi/
6041F: include/linux/hsi/ 6041F: include/linux/hsi/
6042F: include/uapi/linux/hsi/ 6042F: include/uapi/linux/hsi/
diff --git a/Makefile b/Makefile
index 4b074a904106..43534cca1de9 100644
--- a/Makefile
+++ b/Makefile
@@ -172,8 +172,8 @@ MAKEFLAGS += --no-print-directory
172# Use 'make C=2' to enable checking of *all* source files, regardless 172# Use 'make C=2' to enable checking of *all* source files, regardless
173# of whether they are re-compiled or not. 173# of whether they are re-compiled or not.
174# 174#
175# See the file "Documentation/sparse.txt" for more details, including 175# See the file "Documentation/dev-tools/sparse.rst" for more details,
176# where to get the "sparse" utility. 176# including where to get the "sparse" utility.
177 177
178ifeq ("$(origin C)", "command line") 178ifeq ("$(origin C)", "command line")
179 KBUILD_CHECKSRC = $(C) 179 KBUILD_CHECKSRC = $(C)
diff --git a/block/genhd.c b/block/genhd.c
index 9a2d01abfa3b..d252d29fe837 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -271,16 +271,17 @@ void blkdev_show(struct seq_file *seqf, off_t offset)
271/** 271/**
272 * register_blkdev - register a new block device 272 * register_blkdev - register a new block device
273 * 273 *
274 * @major: the requested major device number [1..255]. If @major=0, try to 274 * @major: the requested major device number [1..255]. If @major = 0, try to
275 * allocate any unused major number. 275 * allocate any unused major number.
276 * @name: the name of the new block device as a zero terminated string 276 * @name: the name of the new block device as a zero terminated string
277 * 277 *
278 * The @name must be unique within the system. 278 * The @name must be unique within the system.
279 * 279 *
280 * The return value depends on the @major input parameter. 280 * The return value depends on the @major input parameter:
281 *
281 * - if a major device number was requested in range [1..255] then the 282 * - if a major device number was requested in range [1..255] then the
282 * function returns zero on success, or a negative error code 283 * function returns zero on success, or a negative error code
283 * - if any unused major number was requested with @major=0 parameter 284 * - if any unused major number was requested with @major = 0 parameter
284 * then the return value is the allocated major number in range 285 * then the return value is the allocated major number in range
285 * [1..255] or a negative error code otherwise 286 * [1..255] or a negative error code otherwise
286 */ 287 */
diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c
index 6684f153ab57..f9f2a0324ecc 100644
--- a/drivers/pci/irq.c
+++ b/drivers/pci/irq.c
@@ -31,7 +31,7 @@ static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason)
31 * driver). 31 * driver).
32 * 32 *
33 * Returns: 33 * Returns:
34 * a suggestion for fixing it (although the driver is not required to 34 * a suggestion for fixing it (although the driver is not required to
35 * act on this). 35 * act on this).
36 */ 36 */
37enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev) 37enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
index 65211d1824b7..2bfea9b48366 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -490,7 +490,7 @@ static void hdm_write_completion(struct urb *urb)
490 * disconnect. In the interval before the hub driver starts disconnect 490 * disconnect. In the interval before the hub driver starts disconnect
491 * processing, devices may receive such fault reports for every request. 491 * processing, devices may receive such fault reports for every request.
492 * 492 *
493 * See <https://www.kernel.org/doc/Documentation/usb/error-codes.txt> 493 * See <https://www.kernel.org/doc/Documentation/driver-api/usb/error-codes.rst>
494 */ 494 */
495static void hdm_read_completion(struct urb *urb) 495static void hdm_read_completion(struct urb *urb)
496{ 496{
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 0e5a889742b3..4d75d9a80001 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -26,7 +26,7 @@ config USB_DEFAULT_PERSIST
26 unplugged, causing any mounted filesystems to be lost. The 26 unplugged, causing any mounted filesystems to be lost. The
27 persist feature can still be enabled for individual devices 27 persist feature can still be enabled for individual devices
28 through the power/persist sysfs node. See 28 through the power/persist sysfs node. See
29 Documentation/usb/persist.txt for more info. 29 Documentation/driver-api/usb/persist.rst for more info.
30 30
31 If you have any questions about this, say Y here, only say N 31 If you have any questions about this, say Y here, only say N
32 if you know exactly what you are doing. 32 if you know exactly what you are doing.
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 2184ef40a82a..4c38ea41ae96 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -474,6 +474,7 @@ EXPORT_SYMBOL_GPL(usb_sg_init);
474 * significantly improve USB throughput. 474 * significantly improve USB throughput.
475 * 475 *
476 * There are three kinds of completion for this function. 476 * There are three kinds of completion for this function.
477 *
477 * (1) success, where io->status is zero. The number of io->bytes 478 * (1) success, where io->status is zero. The number of io->bytes
478 * transferred is as requested. 479 * transferred is as requested.
479 * (2) error, where io->status is a negative errno value. The number 480 * (2) error, where io->status is a negative errno value. The number
diff --git a/include/linux/clk.h b/include/linux/clk.h
index e9d36b3e49de..024cd07870d0 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -132,8 +132,8 @@ int clk_get_phase(struct clk *clk);
132 * @q: clk compared against p 132 * @q: clk compared against p
133 * 133 *
134 * Returns true if the two struct clk pointers both point to the same hardware 134 * Returns true if the two struct clk pointers both point to the same hardware
135 * clock node. Put differently, returns true if struct clk *p and struct clk *q 135 * clock node. Put differently, returns true if @p and @q
136 * share the same struct clk_core object. 136 * share the same &struct clk_core object.
137 * 137 *
138 * Returns false otherwise. Note that two NULL clks are treated as matching. 138 * Returns false otherwise. Note that two NULL clks are treated as matching.
139 */ 139 */
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index b6efb0c64408..11366b3ff0b4 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -61,16 +61,83 @@ struct flex_array {
61 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \ 61 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \
62 } 62 }
63 63
64/**
65 * flex_array_alloc() - Creates a flexible array.
66 * @element_size: individual object size.
67 * @total: maximum number of objects which can be stored.
68 * @flags: GFP flags
69 *
70 * Return: Returns an object of structure flex_array.
71 */
64struct flex_array *flex_array_alloc(int element_size, unsigned int total, 72struct flex_array *flex_array_alloc(int element_size, unsigned int total,
65 gfp_t flags); 73 gfp_t flags);
74
75/**
76 * flex_array_prealloc() - Ensures that memory for the elements indexed in the
77 * range defined by start and nr_elements has been allocated.
78 * @fa: array to allocate memory to.
79 * @start: start address
80 * @nr_elements: number of elements to be allocated.
81 * @flags: GFP flags
82 *
83 */
66int flex_array_prealloc(struct flex_array *fa, unsigned int start, 84int flex_array_prealloc(struct flex_array *fa, unsigned int start,
67 unsigned int nr_elements, gfp_t flags); 85 unsigned int nr_elements, gfp_t flags);
86
87/**
88 * flex_array_free() - Removes all elements of a flexible array.
89 * @fa: array to be freed.
90 */
68void flex_array_free(struct flex_array *fa); 91void flex_array_free(struct flex_array *fa);
92
93/**
94 * flex_array_free_parts() - Removes all elements of a flexible array, but
95 * leaves the array itself in place.
96 * @fa: array to be emptied.
97 */
69void flex_array_free_parts(struct flex_array *fa); 98void flex_array_free_parts(struct flex_array *fa);
99
100/**
101 * flex_array_put() - Stores data into a flexible array.
102 * @fa: array where element is to be stored.
103 * @element_nr: position to copy, must be less than the maximum specified when
104 * the array was created.
105 * @src: data source to be copied into the array.
106 * @flags: GFP flags
107 *
108 * Return: Returns zero on success, a negative error code otherwise.
109 */
70int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, 110int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
71 gfp_t flags); 111 gfp_t flags);
112
113/**
114 * flex_array_clear() - Clears an individual element in the array, sets the
115 * given element to FLEX_ARRAY_FREE.
116 * @element_nr: element position to clear.
117 * @fa: array to which element to be cleared belongs.
118 *
119 * Return: Returns zero on success, -EINVAL otherwise.
120 */
72int flex_array_clear(struct flex_array *fa, unsigned int element_nr); 121int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
122
123/**
124 * flex_array_get() - Retrieves data into a flexible array.
125 *
126 * @element_nr: Element position to retrieve data from.
127 * @fa: array from which data is to be retrieved.
128 *
129 * Return: Returns a pointer to the data element, or NULL if that
130 * particular element has never been allocated.
131 */
73void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 132void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
133
134/**
135 * flex_array_shrink() - Reduces the allocated size of an array.
136 * @fa: array to shrink.
137 *
138 * Return: Returns number of pages of memory actually freed.
139 *
140 */
74int flex_array_shrink(struct flex_array *fa); 141int flex_array_shrink(struct flex_array *fa);
75 142
76#define flex_array_put_ptr(fa, nr, src, gfp) \ 143#define flex_array_put_ptr(fa, nr, src, gfp) \
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 4616a49a1c2e..f665d2ceac20 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -451,6 +451,7 @@ static inline struct usb_composite_driver *to_cdriver(
451 * sure doing that won't hurt too much. 451 * sure doing that won't hurt too much.
452 * 452 *
453 * One notion for how to handle Wireless USB devices involves: 453 * One notion for how to handle Wireless USB devices involves:
454 *
454 * (a) a second gadget here, discovery mechanism TBD, but likely 455 * (a) a second gadget here, discovery mechanism TBD, but likely
455 * needing separate "register/unregister WUSB gadget" calls; 456 * needing separate "register/unregister WUSB gadget" calls;
456 * (b) updates to usb_gadget to include flags "is it wireless", 457 * (b) updates to usb_gadget to include flags "is it wireless",
@@ -503,8 +504,9 @@ struct usb_composite_dev {
503 /* protects deactivations and delayed_status counts*/ 504 /* protects deactivations and delayed_status counts*/
504 spinlock_t lock; 505 spinlock_t lock;
505 506
506 unsigned setup_pending:1; 507 /* public: */
507 unsigned os_desc_pending:1; 508 unsigned int setup_pending:1;
509 unsigned int os_desc_pending:1;
508}; 510};
509 511
510extern int usb_string_id(struct usb_composite_dev *c); 512extern int usb_string_id(struct usb_composite_dev *c);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e4516e9ded0f..fbc22a39e7bc 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -188,7 +188,7 @@ struct usb_ep_caps {
188 * @caps:The structure describing types and directions supported by endoint. 188 * @caps:The structure describing types and directions supported by endoint.
189 * @maxpacket:The maximum packet size used on this endpoint. The initial 189 * @maxpacket:The maximum packet size used on this endpoint. The initial
190 * value can sometimes be reduced (hardware allowing), according to 190 * value can sometimes be reduced (hardware allowing), according to
191 * the endpoint descriptor used to configure the endpoint. 191 * the endpoint descriptor used to configure the endpoint.
192 * @maxpacket_limit:The maximum packet size value which can be handled by this 192 * @maxpacket_limit:The maximum packet size value which can be handled by this
193 * endpoint. It's set once by UDC driver when endpoint is initialized, and 193 * endpoint. It's set once by UDC driver when endpoint is initialized, and
194 * should not be changed. Should not be confused with maxpacket. 194 * should not be changed. Should not be confused with maxpacket.
diff --git a/ipc/util.c b/ipc/util.c
index 798cad18dd87..3459a16a9df9 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -474,7 +474,7 @@ void ipc_rcu_free(struct rcu_head *head)
474 * Check user, group, other permissions for access 474 * Check user, group, other permissions for access
475 * to ipc resources. return 0 if allowed 475 * to ipc resources. return 0 if allowed
476 * 476 *
477 * @flag will most probably be 0 or S_...UGO from <linux/stat.h> 477 * @flag will most probably be 0 or ``S_...UGO`` from <linux/stat.h>
478 */ 478 */
479int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flag) 479int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flag)
480{ 480{
@@ -672,10 +672,12 @@ int ipc_update_perm(struct ipc64_perm *in, struct kern_ipc_perm *out)
672 * 672 *
673 * This function does some common audit and permissions check for some IPC_XXX 673 * This function does some common audit and permissions check for some IPC_XXX
674 * cmd and is called from semctl_down, shmctl_down and msgctl_down. 674 * cmd and is called from semctl_down, shmctl_down and msgctl_down.
675 * It must be called without any lock held and 675 * It must be called without any lock held and:
676 * - retrieves the ipc with the given id in the given table. 676 *
677 * - performs some audit and permission check, depending on the given cmd 677 * - retrieves the ipc with the given id in the given table.
678 * - returns a pointer to the ipc object or otherwise, the corresponding error. 678 * - performs some audit and permission check, depending on the given cmd
679 * - returns a pointer to the ipc object or otherwise, the corresponding
680 * error.
679 * 681 *
680 * Call holding the both the rwsem and the rcu read lock. 682 * Call holding the both the rwsem and the rcu read lock.
681 */ 683 */
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 2598a32d2db1..e2a617e09ab7 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -130,7 +130,8 @@ config DYNAMIC_DEBUG
130 nullarbor:~ # echo -n 'func svc_process -p' > 130 nullarbor:~ # echo -n 'func svc_process -p' >
131 <debugfs>/dynamic_debug/control 131 <debugfs>/dynamic_debug/control
132 132
133 See Documentation/dynamic-debug-howto.txt for additional information. 133 See Documentation/admin-guide/dynamic-debug-howto.rst for additional
134 information.
134 135
135endmenu # "printk and dmesg options" 136endmenu # "printk and dmesg options"
136 137
@@ -404,8 +405,8 @@ config MAGIC_SYSRQ
404 by pressing various keys while holding SysRq (Alt+PrintScreen). It 405 by pressing various keys while holding SysRq (Alt+PrintScreen). It
405 also works on a serial console (on PC hardware at least), if you 406 also works on a serial console (on PC hardware at least), if you
406 send a BREAK and then within 5 seconds a command keypress. The 407 send a BREAK and then within 5 seconds a command keypress. The
407 keys are documented in <file:Documentation/sysrq.txt>. Don't say Y 408 keys are documented in <file:Documentation/admin-guide/sysrq.rst>.
408 unless you really know what this hack does. 409 Don't say Y unless you really know what this hack does.
409 410
410config MAGIC_SYSRQ_DEFAULT_ENABLE 411config MAGIC_SYSRQ_DEFAULT_ENABLE
411 hex "Enable magic SysRq key functions by default" 412 hex "Enable magic SysRq key functions by default"
@@ -414,7 +415,7 @@ config MAGIC_SYSRQ_DEFAULT_ENABLE
414 help 415 help
415 Specifies which SysRq key functions are enabled by default. 416 Specifies which SysRq key functions are enabled by default.
416 This may be set to 1 or 0 to enable or disable them all, or 417 This may be set to 1 or 0 to enable or disable them all, or
417 to a bitmask as described in Documentation/sysrq.txt. 418 to a bitmask as described in Documentation/admin-guide/sysrq.rst.
418 419
419config MAGIC_SYSRQ_SERIAL 420config MAGIC_SYSRQ_SERIAL
420 bool "Enable magic SysRq key over serial" 421 bool "Enable magic SysRq key over serial"
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 0b66f0e5eb6b..08c6ef3a2b6f 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -502,11 +502,11 @@ EXPORT_SYMBOL(bitmap_print_to_pagebuf);
502 * Syntax: range:used_size/group_size 502 * Syntax: range:used_size/group_size
503 * Example: 0-1023:2/256 ==> 0,1,256,257,512,513,768,769 503 * Example: 0-1023:2/256 ==> 0,1,256,257,512,513,768,769
504 * 504 *
505 * Returns 0 on success, -errno on invalid input strings. 505 * Returns: 0 on success, -errno on invalid input strings. Error values:
506 * Error values: 506 *
507 * %-EINVAL: second number in range smaller than first 507 * - ``-EINVAL``: second number in range smaller than first
508 * %-EINVAL: invalid character in string 508 * - ``-EINVAL``: invalid character in string
509 * %-ERANGE: bit number specified too large for mask 509 * - ``-ERANGE``: bit number specified too large for mask
510 */ 510 */
511static int __bitmap_parselist(const char *buf, unsigned int buflen, 511static int __bitmap_parselist(const char *buf, unsigned int buflen,
512 int is_user, unsigned long *maskp, 512 int is_user, unsigned long *maskp,
@@ -864,14 +864,16 @@ EXPORT_SYMBOL(bitmap_bitremap);
864 * 11 was set in @orig had no affect on @dst. 864 * 11 was set in @orig had no affect on @dst.
865 * 865 *
866 * Example [2] for bitmap_fold() + bitmap_onto(): 866 * Example [2] for bitmap_fold() + bitmap_onto():
867 * Let's say @relmap has these ten bits set: 867 * Let's say @relmap has these ten bits set::
868 *
868 * 40 41 42 43 45 48 53 61 74 95 869 * 40 41 42 43 45 48 53 61 74 95
870 *
869 * (for the curious, that's 40 plus the first ten terms of the 871 * (for the curious, that's 40 plus the first ten terms of the
870 * Fibonacci sequence.) 872 * Fibonacci sequence.)
871 * 873 *
872 * Further lets say we use the following code, invoking 874 * Further lets say we use the following code, invoking
873 * bitmap_fold() then bitmap_onto, as suggested above to 875 * bitmap_fold() then bitmap_onto, as suggested above to
874 * avoid the possibility of an empty @dst result: 876 * avoid the possibility of an empty @dst result::
875 * 877 *
876 * unsigned long *tmp; // a temporary bitmap's bits 878 * unsigned long *tmp; // a temporary bitmap's bits
877 * 879 *
@@ -882,22 +884,26 @@ EXPORT_SYMBOL(bitmap_bitremap);
882 * various @orig's. I list the zero-based positions of each set bit. 884 * various @orig's. I list the zero-based positions of each set bit.
883 * The tmp column shows the intermediate result, as computed by 885 * The tmp column shows the intermediate result, as computed by
884 * using bitmap_fold() to fold the @orig bitmap modulo ten 886 * using bitmap_fold() to fold the @orig bitmap modulo ten
885 * (the weight of @relmap). 887 * (the weight of @relmap):
886 * 888 *
889 * =============== ============== =================
887 * @orig tmp @dst 890 * @orig tmp @dst
888 * 0 0 40 891 * 0 0 40
889 * 1 1 41 892 * 1 1 41
890 * 9 9 95 893 * 9 9 95
891 * 10 0 40 (*) 894 * 10 0 40 [#f1]_
892 * 1 3 5 7 1 3 5 7 41 43 48 61 895 * 1 3 5 7 1 3 5 7 41 43 48 61
893 * 0 1 2 3 4 0 1 2 3 4 40 41 42 43 45 896 * 0 1 2 3 4 0 1 2 3 4 40 41 42 43 45
894 * 0 9 18 27 0 9 8 7 40 61 74 95 897 * 0 9 18 27 0 9 8 7 40 61 74 95
895 * 0 10 20 30 0 40 898 * 0 10 20 30 0 40
896 * 0 11 22 33 0 1 2 3 40 41 42 43 899 * 0 11 22 33 0 1 2 3 40 41 42 43
897 * 0 12 24 36 0 2 4 6 40 42 45 53 900 * 0 12 24 36 0 2 4 6 40 42 45 53
898 * 78 102 211 1 2 8 41 42 74 (*) 901 * 78 102 211 1 2 8 41 42 74 [#f1]_
902 * =============== ============== =================
903 *
904 * .. [#f1]
899 * 905 *
900 * (*) For these marked lines, if we hadn't first done bitmap_fold() 906 * For these marked lines, if we hadn't first done bitmap_fold()
901 * into tmp, then the @dst result would have been empty. 907 * into tmp, then the @dst result would have been empty.
902 * 908 *
903 * If either of @orig or @relmap is empty (no set bits), then @dst 909 * If either of @orig or @relmap is empty (no set bits), then @dst
diff --git a/lib/string.c b/lib/string.c
index ed83562a53ae..b5c9a1168d3a 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -131,7 +131,7 @@ EXPORT_SYMBOL(strncpy);
131 * @src: Where to copy the string from 131 * @src: Where to copy the string from
132 * @size: size of destination buffer 132 * @size: size of destination buffer
133 * 133 *
134 * Compatible with *BSD: the result is always a valid 134 * Compatible with ``*BSD``: the result is always a valid
135 * NUL-terminated string that fits in the buffer (unless, 135 * NUL-terminated string that fits in the buffer (unless,
136 * of course, the buffer size is zero). It does not pad 136 * of course, the buffer size is zero). It does not pad
137 * out the result like strncpy() does. 137 * out the result like strncpy() does.
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index e3bf4e0f10b5..176641cc549d 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1954,13 +1954,13 @@ set_precision(struct printf_spec *spec, int prec)
1954 * This function generally follows C99 vsnprintf, but has some 1954 * This function generally follows C99 vsnprintf, but has some
1955 * extensions and a few limitations: 1955 * extensions and a few limitations:
1956 * 1956 *
1957 * %n is unsupported 1957 * - ``%n`` is unsupported
1958 * %p* is handled by pointer() 1958 * - ``%p*`` is handled by pointer()
1959 * 1959 *
1960 * See pointer() or Documentation/printk-formats.txt for more 1960 * See pointer() or Documentation/printk-formats.txt for more
1961 * extensive description. 1961 * extensive description.
1962 * 1962 *
1963 * ** Please update the documentation in both places when making changes ** 1963 * **Please update the documentation in both places when making changes**
1964 * 1964 *
1965 * The return value is the number of characters which would 1965 * The return value is the number of characters which would
1966 * be generated for the given input, excluding the trailing 1966 * be generated for the given input, excluding the trailing
diff --git a/mm/filemap.c b/mm/filemap.c
index 1694623a6289..c5808b7a5fb1 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -519,7 +519,7 @@ EXPORT_SYMBOL(filemap_write_and_wait);
519 * 519 *
520 * Write out and wait upon file offsets lstart->lend, inclusive. 520 * Write out and wait upon file offsets lstart->lend, inclusive.
521 * 521 *
522 * Note that `lend' is inclusive (describes the last byte to be written) so 522 * Note that @lend is inclusive (describes the last byte to be written) so
523 * that this function can be used to write to the very end-of-file (end = -1). 523 * that this function can be used to write to the very end-of-file (end = -1).
524 */ 524 */
525int filemap_write_and_wait_range(struct address_space *mapping, 525int filemap_write_and_wait_range(struct address_space *mapping,
@@ -1277,12 +1277,14 @@ EXPORT_SYMBOL(find_lock_entry);
1277 * 1277 *
1278 * PCG flags modify how the page is returned. 1278 * PCG flags modify how the page is returned.
1279 * 1279 *
1280 * FGP_ACCESSED: the page will be marked accessed 1280 * @fgp_flags can be:
1281 * FGP_LOCK: Page is return locked 1281 *
1282 * FGP_CREAT: If page is not present then a new page is allocated using 1282 * - FGP_ACCESSED: the page will be marked accessed
1283 * @gfp_mask and added to the page cache and the VM's LRU 1283 * - FGP_LOCK: Page is return locked
1284 * list. The page is returned locked and with an increased 1284 * - FGP_CREAT: If page is not present then a new page is allocated using
1285 * refcount. Otherwise, %NULL is returned. 1285 * @gfp_mask and added to the page cache and the VM's LRU
1286 * list. The page is returned locked and with an increased
1287 * refcount. Otherwise, NULL is returned.
1286 * 1288 *
1287 * If FGP_LOCK or FGP_CREAT are specified then the function may sleep even 1289 * If FGP_LOCK or FGP_CREAT are specified then the function may sleep even
1288 * if the GFP flags specified for FGP_CREAT are atomic. 1290 * if the GFP flags specified for FGP_CREAT are atomic.
@@ -3001,7 +3003,7 @@ EXPORT_SYMBOL(generic_file_write_iter);
3001 * @gfp_mask: memory allocation flags (and I/O mode) 3003 * @gfp_mask: memory allocation flags (and I/O mode)
3002 * 3004 *
3003 * The address_space is to try to release any data against the page 3005 * The address_space is to try to release any data against the page
3004 * (presumably at page->private). If the release was successful, return `1'. 3006 * (presumably at page->private). If the release was successful, return '1'.
3005 * Otherwise return zero. 3007 * Otherwise return zero.
3006 * 3008 *
3007 * This may also be called if PG_fscache is set on a page, indicating that the 3009 * This may also be called if PG_fscache is set on a page, indicating that the
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 07efbc3a8656..bd01501efab9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4247,7 +4247,8 @@ EXPORT_SYMBOL(free_pages_exact);
4247 * nr_free_zone_pages() counts the number of counts pages which are beyond the 4247 * nr_free_zone_pages() counts the number of counts pages which are beyond the
4248 * high watermark within all zones at or below a given zone index. For each 4248 * high watermark within all zones at or below a given zone index. For each
4249 * zone, the number of pages is calculated as: 4249 * zone, the number of pages is calculated as:
4250 * managed_pages - high_pages 4250 *
4251 * nr_free_zone_pages = managed_pages - high_pages
4251 */ 4252 */
4252static unsigned long nr_free_zone_pages(int offset) 4253static unsigned long nr_free_zone_pages(int offset)
4253{ 4254{
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 0b057628a7ba..b52aeed3f58e 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1579,7 +1579,7 @@ void vfree_atomic(const void *addr)
1579 * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling 1579 * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling
1580 * conventions for vfree() arch-depenedent would be a really bad idea) 1580 * conventions for vfree() arch-depenedent would be a really bad idea)
1581 * 1581 *
1582 * NOTE: assumes that the object at *addr has a size >= sizeof(llist_node) 1582 * NOTE: assumes that the object at @addr has a size >= sizeof(llist_node)
1583 */ 1583 */
1584void vfree(const void *addr) 1584void vfree(const void *addr)
1585{ 1585{
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 33c85dfdfce9..a26a5f2dce39 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -202,6 +202,7 @@ EOF
202# '&struct_name.member' - name of a structure member 202# '&struct_name.member' - name of a structure member
203# '@parameter' - name of a parameter 203# '@parameter' - name of a parameter
204# '%CONST' - name of a constant. 204# '%CONST' - name of a constant.
205# '``LITERAL``' - literal string without any spaces on it.
205 206
206## init lots of data 207## init lots of data
207 208
@@ -210,7 +211,8 @@ my $warnings = 0;
210my $anon_struct_union = 0; 211my $anon_struct_union = 0;
211 212
212# match expressions used to find embedded type information 213# match expressions used to find embedded type information
213my $type_constant = '\%([-_\w]+)'; 214my $type_constant = '\b``([^\`]+)``\b';
215my $type_constant2 = '\%([-_\w]+)';
214my $type_func = '(\w+)\(\)'; 216my $type_func = '(\w+)\(\)';
215my $type_param = '\@(\w+(\.\.\.)?)'; 217my $type_param = '\@(\w+(\.\.\.)?)';
216my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params 218my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
@@ -235,6 +237,7 @@ my $type_member_func = $type_member . '\(\)';
235# these work fairly well 237# these work fairly well
236my @highlights_html = ( 238my @highlights_html = (
237 [$type_constant, "<i>\$1</i>"], 239 [$type_constant, "<i>\$1</i>"],
240 [$type_constant2, "<i>\$1</i>"],
238 [$type_func, "<b>\$1</b>"], 241 [$type_func, "<b>\$1</b>"],
239 [$type_enum_xml, "<i>\$1</i>"], 242 [$type_enum_xml, "<i>\$1</i>"],
240 [$type_struct_xml, "<i>\$1</i>"], 243 [$type_struct_xml, "<i>\$1</i>"],
@@ -252,6 +255,7 @@ my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
252# html version 5 255# html version 5
253my @highlights_html5 = ( 256my @highlights_html5 = (
254 [$type_constant, "<span class=\"const\">\$1</span>"], 257 [$type_constant, "<span class=\"const\">\$1</span>"],
258 [$type_constant2, "<span class=\"const\">\$1</span>"],
255 [$type_func, "<span class=\"func\">\$1</span>"], 259 [$type_func, "<span class=\"func\">\$1</span>"],
256 [$type_enum_xml, "<span class=\"enum\">\$1</span>"], 260 [$type_enum_xml, "<span class=\"enum\">\$1</span>"],
257 [$type_struct_xml, "<span class=\"struct\">\$1</span>"], 261 [$type_struct_xml, "<span class=\"struct\">\$1</span>"],
@@ -268,6 +272,7 @@ my $blankline_html5 = $local_lt . "br /" . $local_gt;
268my @highlights_xml = ( 272my @highlights_xml = (
269 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"], 273 ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"],
270 [$type_constant, "<constant>\$1</constant>"], 274 [$type_constant, "<constant>\$1</constant>"],
275 [$type_constant2, "<constant>\$1</constant>"],
271 [$type_enum_xml, "<type>\$1</type>"], 276 [$type_enum_xml, "<type>\$1</type>"],
272 [$type_struct_xml, "<structname>\$1</structname>"], 277 [$type_struct_xml, "<structname>\$1</structname>"],
273 [$type_typedef_xml, "<type>\$1</type>"], 278 [$type_typedef_xml, "<type>\$1</type>"],
@@ -283,6 +288,7 @@ my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $loca
283# gnome, docbook format 288# gnome, docbook format
284my @highlights_gnome = ( 289my @highlights_gnome = (
285 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"], 290 [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"],
291 [$type_constant2, "<replaceable class=\"option\">\$1</replaceable>"],
286 [$type_func, "<function>\$1</function>"], 292 [$type_func, "<function>\$1</function>"],
287 [$type_enum, "<type>\$1</type>"], 293 [$type_enum, "<type>\$1</type>"],
288 [$type_struct, "<structname>\$1</structname>"], 294 [$type_struct, "<structname>\$1</structname>"],
@@ -298,6 +304,7 @@ my $blankline_gnome = "</para><para>\n";
298# these are pretty rough 304# these are pretty rough
299my @highlights_man = ( 305my @highlights_man = (
300 [$type_constant, "\$1"], 306 [$type_constant, "\$1"],
307 [$type_constant2, "\$1"],
301 [$type_func, "\\\\fB\$1\\\\fP"], 308 [$type_func, "\\\\fB\$1\\\\fP"],
302 [$type_enum, "\\\\fI\$1\\\\fP"], 309 [$type_enum, "\\\\fI\$1\\\\fP"],
303 [$type_struct, "\\\\fI\$1\\\\fP"], 310 [$type_struct, "\\\\fI\$1\\\\fP"],
@@ -312,6 +319,7 @@ my $blankline_man = "";
312# text-mode 319# text-mode
313my @highlights_text = ( 320my @highlights_text = (
314 [$type_constant, "\$1"], 321 [$type_constant, "\$1"],
322 [$type_constant2, "\$1"],
315 [$type_func, "\$1"], 323 [$type_func, "\$1"],
316 [$type_enum, "\$1"], 324 [$type_enum, "\$1"],
317 [$type_struct, "\$1"], 325 [$type_struct, "\$1"],
@@ -326,6 +334,7 @@ my $blankline_text = "";
326# rst-mode 334# rst-mode
327my @highlights_rst = ( 335my @highlights_rst = (
328 [$type_constant, "``\$1``"], 336 [$type_constant, "``\$1``"],
337 [$type_constant2, "``\$1``"],
329 # Note: need to escape () to avoid func matching later 338 # Note: need to escape () to avoid func matching later
330 [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], 339 [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
331 [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], 340 [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
@@ -344,6 +353,7 @@ my $blankline_rst = "\n";
344# list mode 353# list mode
345my @highlights_list = ( 354my @highlights_list = (
346 [$type_constant, "\$1"], 355 [$type_constant, "\$1"],
356 [$type_constant2, "\$1"],
347 [$type_func, "\$1"], 357 [$type_func, "\$1"],
348 [$type_enum, "\$1"], 358 [$type_enum, "\$1"],
349 [$type_struct, "\$1"], 359 [$type_struct, "\$1"],
@@ -2392,8 +2402,7 @@ sub push_parameter($$$) {
2392 } 2402 }
2393 2403
2394 $anon_struct_union = 0; 2404 $anon_struct_union = 0;
2395 my $param_name = $param; 2405 $param =~ s/[\[\)].*//;
2396 $param_name =~ s/\[.*//;
2397 2406
2398 if ($type eq "" && $param =~ /\.\.\.$/) 2407 if ($type eq "" && $param =~ /\.\.\.$/)
2399 { 2408 {
@@ -2424,9 +2433,9 @@ sub push_parameter($$$) {
2424 # but inline preprocessor statements); 2433 # but inline preprocessor statements);
2425 # also ignore unnamed structs/unions; 2434 # also ignore unnamed structs/unions;
2426 if (!$anon_struct_union) { 2435 if (!$anon_struct_union) {
2427 if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) { 2436 if (!defined $parameterdescs{$param} && $param !~ /^#/) {
2428 2437
2429 $parameterdescs{$param_name} = $undescribed; 2438 $parameterdescs{$param} = $undescribed;
2430 2439
2431 if (($type eq 'function') || ($type eq 'enum')) { 2440 if (($type eq 'function') || ($type eq 'enum')) {
2432 print STDERR "${file}:$.: warning: Function parameter ". 2441 print STDERR "${file}:$.: warning: Function parameter ".
diff --git a/security/security.c b/security/security.c
index d0e07f269b2d..23555c5504f6 100644
--- a/security/security.c
+++ b/security/security.c
@@ -103,10 +103,14 @@ static int lsm_append(char *new, char **result)
103 * to avoid security registration races. This method may also be used 103 * to avoid security registration races. This method may also be used
104 * to check if your LSM is currently loaded during kernel initialization. 104 * to check if your LSM is currently loaded during kernel initialization.
105 * 105 *
106 * Return true if: 106 * Returns:
107 * -The passed LSM is the one chosen by user at boot time, 107 *
108 * -or the passed LSM is configured as the default and the user did not 108 * true if:
109 * choose an alternate LSM at boot time. 109 *
110 * - The passed LSM is the one chosen by user at boot time,
111 * - or the passed LSM is configured as the default and the user did not
112 * choose an alternate LSM at boot time.
113 *
110 * Otherwise, return false. 114 * Otherwise, return false.
111 */ 115 */
112int __init security_module_enable(const char *module) 116int __init security_module_enable(const char *module)