Merge branch 'linux-4.12' of git://github.com/skeggsb/linux into drm-next
[sfrench/cifs-2.6.git] / Documentation / core-api / kernel-api.rst
1 ====================
2 The Linux Kernel API
3 ====================
4
5 Data Types
6 ==========
7
8 Doubly Linked Lists
9 -------------------
10
11 .. kernel-doc:: include/linux/list.h
12    :internal:
13
14 Basic C Library Functions
15 =========================
16
17 When writing drivers, you cannot in general use routines which are from
18 the C Library. Some of the functions have been found generally useful
19 and they are listed below. The behaviour of these functions may vary
20 slightly from those defined by ANSI, and these deviations are noted in
21 the text.
22
23 String 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
38 String Manipulation
39 -------------------
40
41 .. kernel-doc:: lib/string.c
42    :export:
43
44 Bit Operations
45 --------------
46
47 .. kernel-doc:: arch/x86/include/asm/bitops.h
48    :internal:
49
50 Basic Kernel Library Functions
51 ==============================
52
53 The Linux kernel provides more basic utility functions.
54
55 Bitmap Operations
56 -----------------
57
58 .. kernel-doc:: lib/bitmap.c
59    :export:
60
61 .. kernel-doc:: lib/bitmap.c
62    :internal:
63
64 Command-line Parsing
65 --------------------
66
67 .. kernel-doc:: lib/cmdline.c
68    :export:
69
70 CRC 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
87 idr/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
99 Memory Management in Linux
100 ==========================
101
102 The 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
114 User 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
123 More 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
153 Kernel IPC facilities
154 =====================
155
156 IPC utilities
157 -------------
158
159 .. kernel-doc:: ipc/util.c
160    :internal:
161
162 FIFO Buffer
163 ===========
164
165 kfifo interface
166 ---------------
167
168 .. kernel-doc:: include/linux/kfifo.h
169    :internal:
170
171 relay interface support
172 =======================
173
174 Relay interface support is designed to provide an efficient mechanism
175 for tools and facilities to relay large amounts of data from kernel
176 space to user space.
177
178 relay interface
179 ---------------
180
181 .. kernel-doc:: kernel/relay.c
182    :export:
183
184 .. kernel-doc:: kernel/relay.c
185    :internal:
186
187 Module Support
188 ==============
189
190 Module Loading
191 --------------
192
193 .. kernel-doc:: kernel/kmod.c
194    :export:
195
196 Inter Module support
197 --------------------
198
199 Refer to the file kernel/module.c for more information.
200
201 Hardware Interfaces
202 ===================
203
204 Interrupt Handling
205 ------------------
206
207 .. kernel-doc:: kernel/irq/manage.c
208    :export:
209
210 DMA Channels
211 ------------
212
213 .. kernel-doc:: kernel/dma.c
214    :export:
215
216 Resources Management
217 --------------------
218
219 .. kernel-doc:: kernel/resource.c
220    :internal:
221
222 .. kernel-doc:: kernel/resource.c
223    :export:
224
225 MTRR Handling
226 -------------
227
228 .. kernel-doc:: arch/x86/kernel/cpu/mtrr/main.c
229    :export:
230
231 Security Framework
232 ==================
233
234 .. kernel-doc:: security/security.c
235    :internal:
236
237 .. kernel-doc:: security/inode.c
238    :export:
239
240 Audit 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
252 Accounting Framework
253 ====================
254
255 .. kernel-doc:: kernel/acct.c
256    :internal:
257
258 Block 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
303 Char devices
304 ============
305
306 .. kernel-doc:: fs/char_dev.c
307    :export:
308
309 Clock Framework
310 ===============
311
312 The clock framework defines programming interfaces to support software
313 management of the system clock tree. This framework is widely used with
314 System-On-Chip (SOC) platforms to support power management and various
315 devices which may need custom clock rates. Note that these "clocks"
316 don't relate to timekeeping or real time clocks (RTCs), each of which
317 have separate frameworks. These :c:type:`struct clk <clk>`
318 instances may be used to manage for example a 96 MHz signal that is used
319 to shift bits into and out of peripherals or busses, or otherwise
320 trigger synchronous state machine transitions in system hardware.
321
322 Power management is supported by explicit software clock gating: unused
323 clocks are disabled, so the system doesn't waste power changing the
324 state of transistors that aren't in active use. On some systems this may
325 be backed by hardware clock gating, where clocks are gated without being
326 disabled in software. Sections of chips that are powered but not clocked
327 may be able to retain their last state. This low power state is often
328 called a *retention mode*. This mode still incurs leakage currents,
329 especially with finer circuit geometries, but for CMOS circuits power is
330 mostly used by clocked state changes.
331
332 Power-aware drivers only enable their clocks when the device they manage
333 is in active use. Also, system sleep states often differ according to
334 which clock domains are active: while a "standby" state may allow wakeup
335 from several active domains, a "mem" (suspend-to-RAM) state may require
336 a more wholesale shutdown of clocks derived from higher speed PLLs and
337 oscillators, limiting the number of possible wakeup event sources. A
338 driver's suspend method may need to be aware of system-specific clock
339 constraints on the target sleep state.
340
341 Some platforms support programmable clock generators. These can be used
342 by external chips of various kinds, such as other CPUs, multimedia
343 codecs, and devices with strict requirements for interface clocking.
344
345 .. kernel-doc:: include/linux/clk.h
346    :internal: