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="LinuxDriversAPI">
6 <bookinfo>
7  <title>Linux Device Drivers</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="Basics">
42     <title>Driver Basics</title>
43     <sect1><title>Driver Entry and Exit points</title>
44<!-- include/linux/init.h -->
45<refentry id="API-module-init">
46<refentryinfo>
47 <title>LINUX</title>
48 <productname>Kernel Hackers Manual</productname>
49 <date>July 2017</date>
50</refentryinfo>
51<refmeta>
52 <refentrytitle><phrase>module_init</phrase></refentrytitle>
53 <manvolnum>9</manvolnum>
54 <refmiscinfo class="version">4.1.27</refmiscinfo>
55</refmeta>
56<refnamediv>
57 <refname>module_init</refname>
58 <refpurpose>
59  driver initialization entry point
60 </refpurpose>
61</refnamediv>
62<refsynopsisdiv>
63 <title>Synopsis</title>
64  <funcsynopsis><funcprototype>
65   <funcdef> <function>module_init </function></funcdef>
66   <paramdef> <parameter>x</parameter></paramdef>
67  </funcprototype></funcsynopsis>
68</refsynopsisdiv>
69<refsect1>
70 <title>Arguments</title>
71 <variablelist>
72  <varlistentry>
73   <term><parameter>x</parameter></term>
74   <listitem>
75    <para>
76     function to be run at kernel boot time or module insertion
77    </para>
78   </listitem>
79  </varlistentry>
80 </variablelist>
81</refsect1>
82<refsect1>
83<title>Description</title>
84<para>
85   <function>module_init</function> will either be called during <function>do_initcalls</function> (if
86   builtin) or at module insertion time (if a module).  There can only
87   be one per module.
88</para>
89</refsect1>
90</refentry>
91
92<refentry id="API-module-exit">
93<refentryinfo>
94 <title>LINUX</title>
95 <productname>Kernel Hackers Manual</productname>
96 <date>July 2017</date>
97</refentryinfo>
98<refmeta>
99 <refentrytitle><phrase>module_exit</phrase></refentrytitle>
100 <manvolnum>9</manvolnum>
101 <refmiscinfo class="version">4.1.27</refmiscinfo>
102</refmeta>
103<refnamediv>
104 <refname>module_exit</refname>
105 <refpurpose>
106     driver exit entry point
107 </refpurpose>
108</refnamediv>
109<refsynopsisdiv>
110 <title>Synopsis</title>
111  <funcsynopsis><funcprototype>
112   <funcdef> <function>module_exit </function></funcdef>
113   <paramdef> <parameter>x</parameter></paramdef>
114  </funcprototype></funcsynopsis>
115</refsynopsisdiv>
116<refsect1>
117 <title>Arguments</title>
118 <variablelist>
119  <varlistentry>
120   <term><parameter>x</parameter></term>
121   <listitem>
122    <para>
123     function to be run when driver is removed
124    </para>
125   </listitem>
126  </varlistentry>
127 </variablelist>
128</refsect1>
129<refsect1>
130<title>Description</title>
131<para>
132   <function>module_exit</function> will wrap the driver clean-up code
133   with <function>cleanup_module</function> when used with rmmod when
134   the driver is a module.  If the driver is statically
135   compiled into the kernel, <function>module_exit</function> has no effect.
136   There can only be one per module.
137</para>
138</refsect1>
139</refentry>
140
141     </sect1>
142
143     <sect1><title>Atomic and pointer manipulation</title>
144<!-- arch/x86/include/asm/atomic.h -->
145<refentry id="API-atomic-read">
146<refentryinfo>
147 <title>LINUX</title>
148 <productname>Kernel Hackers Manual</productname>
149 <date>July 2017</date>
150</refentryinfo>
151<refmeta>
152 <refentrytitle><phrase>atomic_read</phrase></refentrytitle>
153 <manvolnum>9</manvolnum>
154 <refmiscinfo class="version">4.1.27</refmiscinfo>
155</refmeta>
156<refnamediv>
157 <refname>atomic_read</refname>
158 <refpurpose>
159  read atomic variable
160 </refpurpose>
161</refnamediv>
162<refsynopsisdiv>
163 <title>Synopsis</title>
164  <funcsynopsis><funcprototype>
165   <funcdef>int <function>atomic_read </function></funcdef>
166   <paramdef>const atomic_t * <parameter>v</parameter></paramdef>
167  </funcprototype></funcsynopsis>
168</refsynopsisdiv>
169<refsect1>
170 <title>Arguments</title>
171 <variablelist>
172  <varlistentry>
173   <term><parameter>v</parameter></term>
174   <listitem>
175    <para>
176     pointer of type atomic_t
177    </para>
178   </listitem>
179  </varlistentry>
180 </variablelist>
181</refsect1>
182<refsect1>
183<title>Description</title>
184<para>
185   Atomically reads the value of <parameter>v</parameter>.
186</para>
187</refsect1>
188</refentry>
189
190<refentry id="API-atomic-set">
191<refentryinfo>
192 <title>LINUX</title>
193 <productname>Kernel Hackers Manual</productname>
194 <date>July 2017</date>
195</refentryinfo>
196<refmeta>
197 <refentrytitle><phrase>atomic_set</phrase></refentrytitle>
198 <manvolnum>9</manvolnum>
199 <refmiscinfo class="version">4.1.27</refmiscinfo>
200</refmeta>
201<refnamediv>
202 <refname>atomic_set</refname>
203 <refpurpose>
204     set atomic variable
205 </refpurpose>
206</refnamediv>
207<refsynopsisdiv>
208 <title>Synopsis</title>
209  <funcsynopsis><funcprototype>
210   <funcdef>void <function>atomic_set </function></funcdef>
211   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
212   <paramdef>int <parameter>i</parameter></paramdef>
213  </funcprototype></funcsynopsis>
214</refsynopsisdiv>
215<refsect1>
216 <title>Arguments</title>
217 <variablelist>
218  <varlistentry>
219   <term><parameter>v</parameter></term>
220   <listitem>
221    <para>
222     pointer of type atomic_t
223    </para>
224   </listitem>
225  </varlistentry>
226  <varlistentry>
227   <term><parameter>i</parameter></term>
228   <listitem>
229    <para>
230     required value
231    </para>
232   </listitem>
233  </varlistentry>
234 </variablelist>
235</refsect1>
236<refsect1>
237<title>Description</title>
238<para>
239   Atomically sets the value of <parameter>v</parameter> to <parameter>i</parameter>.
240</para>
241</refsect1>
242</refentry>
243
244<refentry id="API-atomic-add">
245<refentryinfo>
246 <title>LINUX</title>
247 <productname>Kernel Hackers Manual</productname>
248 <date>July 2017</date>
249</refentryinfo>
250<refmeta>
251 <refentrytitle><phrase>atomic_add</phrase></refentrytitle>
252 <manvolnum>9</manvolnum>
253 <refmiscinfo class="version">4.1.27</refmiscinfo>
254</refmeta>
255<refnamediv>
256 <refname>atomic_add</refname>
257 <refpurpose>
258     add integer to atomic variable
259 </refpurpose>
260</refnamediv>
261<refsynopsisdiv>
262 <title>Synopsis</title>
263  <funcsynopsis><funcprototype>
264   <funcdef>void <function>atomic_add </function></funcdef>
265   <paramdef>int <parameter>i</parameter></paramdef>
266   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
267  </funcprototype></funcsynopsis>
268</refsynopsisdiv>
269<refsect1>
270 <title>Arguments</title>
271 <variablelist>
272  <varlistentry>
273   <term><parameter>i</parameter></term>
274   <listitem>
275    <para>
276     integer value to add
277    </para>
278   </listitem>
279  </varlistentry>
280  <varlistentry>
281   <term><parameter>v</parameter></term>
282   <listitem>
283    <para>
284     pointer of type atomic_t
285    </para>
286   </listitem>
287  </varlistentry>
288 </variablelist>
289</refsect1>
290<refsect1>
291<title>Description</title>
292<para>
293   Atomically adds <parameter>i</parameter> to <parameter>v</parameter>.
294</para>
295</refsect1>
296</refentry>
297
298<refentry id="API-atomic-sub">
299<refentryinfo>
300 <title>LINUX</title>
301 <productname>Kernel Hackers Manual</productname>
302 <date>July 2017</date>
303</refentryinfo>
304<refmeta>
305 <refentrytitle><phrase>atomic_sub</phrase></refentrytitle>
306 <manvolnum>9</manvolnum>
307 <refmiscinfo class="version">4.1.27</refmiscinfo>
308</refmeta>
309<refnamediv>
310 <refname>atomic_sub</refname>
311 <refpurpose>
312     subtract integer from atomic variable
313 </refpurpose>
314</refnamediv>
315<refsynopsisdiv>
316 <title>Synopsis</title>
317  <funcsynopsis><funcprototype>
318   <funcdef>void <function>atomic_sub </function></funcdef>
319   <paramdef>int <parameter>i</parameter></paramdef>
320   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
321  </funcprototype></funcsynopsis>
322</refsynopsisdiv>
323<refsect1>
324 <title>Arguments</title>
325 <variablelist>
326  <varlistentry>
327   <term><parameter>i</parameter></term>
328   <listitem>
329    <para>
330     integer value to subtract
331    </para>
332   </listitem>
333  </varlistentry>
334  <varlistentry>
335   <term><parameter>v</parameter></term>
336   <listitem>
337    <para>
338     pointer of type atomic_t
339    </para>
340   </listitem>
341  </varlistentry>
342 </variablelist>
343</refsect1>
344<refsect1>
345<title>Description</title>
346<para>
347   Atomically subtracts <parameter>i</parameter> from <parameter>v</parameter>.
348</para>
349</refsect1>
350</refentry>
351
352<refentry id="API-atomic-sub-and-test">
353<refentryinfo>
354 <title>LINUX</title>
355 <productname>Kernel Hackers Manual</productname>
356 <date>July 2017</date>
357</refentryinfo>
358<refmeta>
359 <refentrytitle><phrase>atomic_sub_and_test</phrase></refentrytitle>
360 <manvolnum>9</manvolnum>
361 <refmiscinfo class="version">4.1.27</refmiscinfo>
362</refmeta>
363<refnamediv>
364 <refname>atomic_sub_and_test</refname>
365 <refpurpose>
366     subtract value from variable and test result
367 </refpurpose>
368</refnamediv>
369<refsynopsisdiv>
370 <title>Synopsis</title>
371  <funcsynopsis><funcprototype>
372   <funcdef>int <function>atomic_sub_and_test </function></funcdef>
373   <paramdef>int <parameter>i</parameter></paramdef>
374   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
375  </funcprototype></funcsynopsis>
376</refsynopsisdiv>
377<refsect1>
378 <title>Arguments</title>
379 <variablelist>
380  <varlistentry>
381   <term><parameter>i</parameter></term>
382   <listitem>
383    <para>
384     integer value to subtract
385    </para>
386   </listitem>
387  </varlistentry>
388  <varlistentry>
389   <term><parameter>v</parameter></term>
390   <listitem>
391    <para>
392     pointer of type atomic_t
393    </para>
394   </listitem>
395  </varlistentry>
396 </variablelist>
397</refsect1>
398<refsect1>
399<title>Description</title>
400<para>
401   Atomically subtracts <parameter>i</parameter> from <parameter>v</parameter> and returns
402   true if the result is zero, or false for all
403   other cases.
404</para>
405</refsect1>
406</refentry>
407
408<refentry id="API-atomic-inc">
409<refentryinfo>
410 <title>LINUX</title>
411 <productname>Kernel Hackers Manual</productname>
412 <date>July 2017</date>
413</refentryinfo>
414<refmeta>
415 <refentrytitle><phrase>atomic_inc</phrase></refentrytitle>
416 <manvolnum>9</manvolnum>
417 <refmiscinfo class="version">4.1.27</refmiscinfo>
418</refmeta>
419<refnamediv>
420 <refname>atomic_inc</refname>
421 <refpurpose>
422     increment atomic variable
423 </refpurpose>
424</refnamediv>
425<refsynopsisdiv>
426 <title>Synopsis</title>
427  <funcsynopsis><funcprototype>
428   <funcdef>void <function>atomic_inc </function></funcdef>
429   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
430  </funcprototype></funcsynopsis>
431</refsynopsisdiv>
432<refsect1>
433 <title>Arguments</title>
434 <variablelist>
435  <varlistentry>
436   <term><parameter>v</parameter></term>
437   <listitem>
438    <para>
439     pointer of type atomic_t
440    </para>
441   </listitem>
442  </varlistentry>
443 </variablelist>
444</refsect1>
445<refsect1>
446<title>Description</title>
447<para>
448   Atomically increments <parameter>v</parameter> by 1.
449</para>
450</refsect1>
451</refentry>
452
453<refentry id="API-atomic-dec">
454<refentryinfo>
455 <title>LINUX</title>
456 <productname>Kernel Hackers Manual</productname>
457 <date>July 2017</date>
458</refentryinfo>
459<refmeta>
460 <refentrytitle><phrase>atomic_dec</phrase></refentrytitle>
461 <manvolnum>9</manvolnum>
462 <refmiscinfo class="version">4.1.27</refmiscinfo>
463</refmeta>
464<refnamediv>
465 <refname>atomic_dec</refname>
466 <refpurpose>
467     decrement atomic variable
468 </refpurpose>
469</refnamediv>
470<refsynopsisdiv>
471 <title>Synopsis</title>
472  <funcsynopsis><funcprototype>
473   <funcdef>void <function>atomic_dec </function></funcdef>
474   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
475  </funcprototype></funcsynopsis>
476</refsynopsisdiv>
477<refsect1>
478 <title>Arguments</title>
479 <variablelist>
480  <varlistentry>
481   <term><parameter>v</parameter></term>
482   <listitem>
483    <para>
484     pointer of type atomic_t
485    </para>
486   </listitem>
487  </varlistentry>
488 </variablelist>
489</refsect1>
490<refsect1>
491<title>Description</title>
492<para>
493   Atomically decrements <parameter>v</parameter> by 1.
494</para>
495</refsect1>
496</refentry>
497
498<refentry id="API-atomic-dec-and-test">
499<refentryinfo>
500 <title>LINUX</title>
501 <productname>Kernel Hackers Manual</productname>
502 <date>July 2017</date>
503</refentryinfo>
504<refmeta>
505 <refentrytitle><phrase>atomic_dec_and_test</phrase></refentrytitle>
506 <manvolnum>9</manvolnum>
507 <refmiscinfo class="version">4.1.27</refmiscinfo>
508</refmeta>
509<refnamediv>
510 <refname>atomic_dec_and_test</refname>
511 <refpurpose>
512     decrement and test
513 </refpurpose>
514</refnamediv>
515<refsynopsisdiv>
516 <title>Synopsis</title>
517  <funcsynopsis><funcprototype>
518   <funcdef>int <function>atomic_dec_and_test </function></funcdef>
519   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
520  </funcprototype></funcsynopsis>
521</refsynopsisdiv>
522<refsect1>
523 <title>Arguments</title>
524 <variablelist>
525  <varlistentry>
526   <term><parameter>v</parameter></term>
527   <listitem>
528    <para>
529     pointer of type atomic_t
530    </para>
531   </listitem>
532  </varlistentry>
533 </variablelist>
534</refsect1>
535<refsect1>
536<title>Description</title>
537<para>
538   Atomically decrements <parameter>v</parameter> by 1 and
539   returns true if the result is 0, or false for all other
540   cases.
541</para>
542</refsect1>
543</refentry>
544
545<refentry id="API-atomic-inc-and-test">
546<refentryinfo>
547 <title>LINUX</title>
548 <productname>Kernel Hackers Manual</productname>
549 <date>July 2017</date>
550</refentryinfo>
551<refmeta>
552 <refentrytitle><phrase>atomic_inc_and_test</phrase></refentrytitle>
553 <manvolnum>9</manvolnum>
554 <refmiscinfo class="version">4.1.27</refmiscinfo>
555</refmeta>
556<refnamediv>
557 <refname>atomic_inc_and_test</refname>
558 <refpurpose>
559     increment and test
560 </refpurpose>
561</refnamediv>
562<refsynopsisdiv>
563 <title>Synopsis</title>
564  <funcsynopsis><funcprototype>
565   <funcdef>int <function>atomic_inc_and_test </function></funcdef>
566   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
567  </funcprototype></funcsynopsis>
568</refsynopsisdiv>
569<refsect1>
570 <title>Arguments</title>
571 <variablelist>
572  <varlistentry>
573   <term><parameter>v</parameter></term>
574   <listitem>
575    <para>
576     pointer of type atomic_t
577    </para>
578   </listitem>
579  </varlistentry>
580 </variablelist>
581</refsect1>
582<refsect1>
583<title>Description</title>
584<para>
585   Atomically increments <parameter>v</parameter> by 1
586   and returns true if the result is zero, or false for all
587   other cases.
588</para>
589</refsect1>
590</refentry>
591
592<refentry id="API-atomic-add-negative">
593<refentryinfo>
594 <title>LINUX</title>
595 <productname>Kernel Hackers Manual</productname>
596 <date>July 2017</date>
597</refentryinfo>
598<refmeta>
599 <refentrytitle><phrase>atomic_add_negative</phrase></refentrytitle>
600 <manvolnum>9</manvolnum>
601 <refmiscinfo class="version">4.1.27</refmiscinfo>
602</refmeta>
603<refnamediv>
604 <refname>atomic_add_negative</refname>
605 <refpurpose>
606     add and test if negative
607 </refpurpose>
608</refnamediv>
609<refsynopsisdiv>
610 <title>Synopsis</title>
611  <funcsynopsis><funcprototype>
612   <funcdef>int <function>atomic_add_negative </function></funcdef>
613   <paramdef>int <parameter>i</parameter></paramdef>
614   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
615  </funcprototype></funcsynopsis>
616</refsynopsisdiv>
617<refsect1>
618 <title>Arguments</title>
619 <variablelist>
620  <varlistentry>
621   <term><parameter>i</parameter></term>
622   <listitem>
623    <para>
624     integer value to add
625    </para>
626   </listitem>
627  </varlistentry>
628  <varlistentry>
629   <term><parameter>v</parameter></term>
630   <listitem>
631    <para>
632     pointer of type atomic_t
633    </para>
634   </listitem>
635  </varlistentry>
636 </variablelist>
637</refsect1>
638<refsect1>
639<title>Description</title>
640<para>
641   Atomically adds <parameter>i</parameter> to <parameter>v</parameter> and returns true
642   if the result is negative, or false when
643   result is greater than or equal to zero.
644</para>
645</refsect1>
646</refentry>
647
648<refentry id="API-atomic-add-return">
649<refentryinfo>
650 <title>LINUX</title>
651 <productname>Kernel Hackers Manual</productname>
652 <date>July 2017</date>
653</refentryinfo>
654<refmeta>
655 <refentrytitle><phrase>atomic_add_return</phrase></refentrytitle>
656 <manvolnum>9</manvolnum>
657 <refmiscinfo class="version">4.1.27</refmiscinfo>
658</refmeta>
659<refnamediv>
660 <refname>atomic_add_return</refname>
661 <refpurpose>
662     add integer and return
663 </refpurpose>
664</refnamediv>
665<refsynopsisdiv>
666 <title>Synopsis</title>
667  <funcsynopsis><funcprototype>
668   <funcdef>int <function>atomic_add_return </function></funcdef>
669   <paramdef>int <parameter>i</parameter></paramdef>
670   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
671  </funcprototype></funcsynopsis>
672</refsynopsisdiv>
673<refsect1>
674 <title>Arguments</title>
675 <variablelist>
676  <varlistentry>
677   <term><parameter>i</parameter></term>
678   <listitem>
679    <para>
680     integer value to add
681    </para>
682   </listitem>
683  </varlistentry>
684  <varlistentry>
685   <term><parameter>v</parameter></term>
686   <listitem>
687    <para>
688     pointer of type atomic_t
689    </para>
690   </listitem>
691  </varlistentry>
692 </variablelist>
693</refsect1>
694<refsect1>
695<title>Description</title>
696<para>
697   Atomically adds <parameter>i</parameter> to <parameter>v</parameter> and returns <parameter>i</parameter> + <parameter>v</parameter>
698</para>
699</refsect1>
700</refentry>
701
702<refentry id="API-atomic-sub-return">
703<refentryinfo>
704 <title>LINUX</title>
705 <productname>Kernel Hackers Manual</productname>
706 <date>July 2017</date>
707</refentryinfo>
708<refmeta>
709 <refentrytitle><phrase>atomic_sub_return</phrase></refentrytitle>
710 <manvolnum>9</manvolnum>
711 <refmiscinfo class="version">4.1.27</refmiscinfo>
712</refmeta>
713<refnamediv>
714 <refname>atomic_sub_return</refname>
715 <refpurpose>
716     subtract integer and return
717 </refpurpose>
718</refnamediv>
719<refsynopsisdiv>
720 <title>Synopsis</title>
721  <funcsynopsis><funcprototype>
722   <funcdef>int <function>atomic_sub_return </function></funcdef>
723   <paramdef>int <parameter>i</parameter></paramdef>
724   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
725  </funcprototype></funcsynopsis>
726</refsynopsisdiv>
727<refsect1>
728 <title>Arguments</title>
729 <variablelist>
730  <varlistentry>
731   <term><parameter>i</parameter></term>
732   <listitem>
733    <para>
734     integer value to subtract
735    </para>
736   </listitem>
737  </varlistentry>
738  <varlistentry>
739   <term><parameter>v</parameter></term>
740   <listitem>
741    <para>
742     pointer of type atomic_t
743    </para>
744   </listitem>
745  </varlistentry>
746 </variablelist>
747</refsect1>
748<refsect1>
749<title>Description</title>
750<para>
751   Atomically subtracts <parameter>i</parameter> from <parameter>v</parameter> and returns <parameter>v</parameter> - <parameter>i</parameter>
752</para>
753</refsect1>
754</refentry>
755
756<refentry id="API---atomic-add-unless">
757<refentryinfo>
758 <title>LINUX</title>
759 <productname>Kernel Hackers Manual</productname>
760 <date>July 2017</date>
761</refentryinfo>
762<refmeta>
763 <refentrytitle><phrase>__atomic_add_unless</phrase></refentrytitle>
764 <manvolnum>9</manvolnum>
765 <refmiscinfo class="version">4.1.27</refmiscinfo>
766</refmeta>
767<refnamediv>
768 <refname>__atomic_add_unless</refname>
769 <refpurpose>
770     add unless the number is already a given value
771 </refpurpose>
772</refnamediv>
773<refsynopsisdiv>
774 <title>Synopsis</title>
775  <funcsynopsis><funcprototype>
776   <funcdef>int <function>__atomic_add_unless </function></funcdef>
777   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
778   <paramdef>int <parameter>a</parameter></paramdef>
779   <paramdef>int <parameter>u</parameter></paramdef>
780  </funcprototype></funcsynopsis>
781</refsynopsisdiv>
782<refsect1>
783 <title>Arguments</title>
784 <variablelist>
785  <varlistentry>
786   <term><parameter>v</parameter></term>
787   <listitem>
788    <para>
789     pointer of type atomic_t
790    </para>
791   </listitem>
792  </varlistentry>
793  <varlistentry>
794   <term><parameter>a</parameter></term>
795   <listitem>
796    <para>
797     the amount to add to v...
798    </para>
799   </listitem>
800  </varlistentry>
801  <varlistentry>
802   <term><parameter>u</parameter></term>
803   <listitem>
804    <para>
805     ...unless v is equal to u.
806    </para>
807   </listitem>
808  </varlistentry>
809 </variablelist>
810</refsect1>
811<refsect1>
812<title>Description</title>
813<para>
814   Atomically adds <parameter>a</parameter> to <parameter>v</parameter>, so long as <parameter>v</parameter> was not already <parameter>u</parameter>.
815   Returns the old value of <parameter>v</parameter>.
816</para>
817</refsect1>
818</refentry>
819
820<refentry id="API-atomic-inc-short">
821<refentryinfo>
822 <title>LINUX</title>
823 <productname>Kernel Hackers Manual</productname>
824 <date>July 2017</date>
825</refentryinfo>
826<refmeta>
827 <refentrytitle><phrase>atomic_inc_short</phrase></refentrytitle>
828 <manvolnum>9</manvolnum>
829 <refmiscinfo class="version">4.1.27</refmiscinfo>
830</refmeta>
831<refnamediv>
832 <refname>atomic_inc_short</refname>
833 <refpurpose>
834     increment of a short integer
835 </refpurpose>
836</refnamediv>
837<refsynopsisdiv>
838 <title>Synopsis</title>
839  <funcsynopsis><funcprototype>
840   <funcdef>short int <function>atomic_inc_short </function></funcdef>
841   <paramdef>short int * <parameter>v</parameter></paramdef>
842  </funcprototype></funcsynopsis>
843</refsynopsisdiv>
844<refsect1>
845 <title>Arguments</title>
846 <variablelist>
847  <varlistentry>
848   <term><parameter>v</parameter></term>
849   <listitem>
850    <para>
851     pointer to type int
852    </para>
853   </listitem>
854  </varlistentry>
855 </variablelist>
856</refsect1>
857<refsect1>
858<title>Description</title>
859<para>
860   Atomically adds 1 to <parameter>v</parameter>
861   Returns the new value of <parameter>u</parameter>
862</para>
863</refsect1>
864</refentry>
865
866     </sect1>
867
868     <sect1><title>Delaying, scheduling, and timer routines</title>
869<!-- include/linux/sched.h -->
870<refentry id="API-struct-cputime">
871<refentryinfo>
872 <title>LINUX</title>
873 <productname>Kernel Hackers Manual</productname>
874 <date>July 2017</date>
875</refentryinfo>
876<refmeta>
877 <refentrytitle><phrase>struct cputime</phrase></refentrytitle>
878 <manvolnum>9</manvolnum>
879 <refmiscinfo class="version">4.1.27</refmiscinfo>
880</refmeta>
881<refnamediv>
882 <refname>struct cputime</refname>
883 <refpurpose>
884  snaphsot of system and user cputime
885 </refpurpose>
886</refnamediv>
887<refsynopsisdiv>
888 <title>Synopsis</title>
889  <programlisting>
890struct cputime {
891  cputime_t utime;
892  cputime_t stime;
893};  </programlisting>
894</refsynopsisdiv>
895 <refsect1>
896  <title>Members</title>
897  <variablelist>
898    <varlistentry>      <term>utime</term>
899      <listitem><para>
900time spent in user mode
901      </para></listitem>
902    </varlistentry>
903    <varlistentry>      <term>stime</term>
904      <listitem><para>
905time spent in system mode
906      </para></listitem>
907    </varlistentry>
908  </variablelist>
909 </refsect1>
910<refsect1>
911<title>Description</title>
912<para>
913   Gathers a generic snapshot of user and system time.
914</para>
915</refsect1>
916</refentry>
917
918<refentry id="API-struct-task-cputime">
919<refentryinfo>
920 <title>LINUX</title>
921 <productname>Kernel Hackers Manual</productname>
922 <date>July 2017</date>
923</refentryinfo>
924<refmeta>
925 <refentrytitle><phrase>struct task_cputime</phrase></refentrytitle>
926 <manvolnum>9</manvolnum>
927 <refmiscinfo class="version">4.1.27</refmiscinfo>
928</refmeta>
929<refnamediv>
930 <refname>struct task_cputime</refname>
931 <refpurpose>
932     collected CPU time counts
933 </refpurpose>
934</refnamediv>
935<refsynopsisdiv>
936 <title>Synopsis</title>
937  <programlisting>
938struct task_cputime {
939  cputime_t utime;
940  cputime_t stime;
941  unsigned long long sum_exec_runtime;
942};  </programlisting>
943</refsynopsisdiv>
944 <refsect1>
945  <title>Members</title>
946  <variablelist>
947    <varlistentry>      <term>utime</term>
948      <listitem><para>
949   time spent in user mode, in <structname>cputime_t</structname> units
950      </para></listitem>
951    </varlistentry>
952    <varlistentry>      <term>stime</term>
953      <listitem><para>
954   time spent in kernel mode, in <structname>cputime_t</structname> units
955      </para></listitem>
956    </varlistentry>
957    <varlistentry>      <term>sum_exec_runtime</term>
958      <listitem><para>
959   total time spent on the CPU, in nanoseconds
960      </para></listitem>
961    </varlistentry>
962  </variablelist>
963 </refsect1>
964<refsect1>
965<title>Description</title>
966<para>
967   This is an extension of struct cputime that includes the total runtime
968   spent by the task from the scheduler point of view.
969   </para><para>
970
971   As a result, this structure groups together three kinds of CPU time
972   that are tracked for threads and thread groups.  Most things considering
973   CPU time want to group these counts together and treat all three
974   of them in parallel.
975</para>
976</refsect1>
977</refentry>
978
979<refentry id="API-struct-thread-group-cputimer">
980<refentryinfo>
981 <title>LINUX</title>
982 <productname>Kernel Hackers Manual</productname>
983 <date>July 2017</date>
984</refentryinfo>
985<refmeta>
986 <refentrytitle><phrase>struct thread_group_cputimer</phrase></refentrytitle>
987 <manvolnum>9</manvolnum>
988 <refmiscinfo class="version">4.1.27</refmiscinfo>
989</refmeta>
990<refnamediv>
991 <refname>struct thread_group_cputimer</refname>
992 <refpurpose>
993     thread group interval timer counts
994 </refpurpose>
995</refnamediv>
996<refsynopsisdiv>
997 <title>Synopsis</title>
998  <programlisting>
999struct thread_group_cputimer {
1000  struct task_cputime cputime;
1001  int running;
1002  raw_spinlock_t lock;
1003};  </programlisting>
1004</refsynopsisdiv>
1005 <refsect1>
1006  <title>Members</title>
1007  <variablelist>
1008    <varlistentry>      <term>cputime</term>
1009      <listitem><para>
1010   thread group interval timers.
1011      </para></listitem>
1012    </varlistentry>
1013    <varlistentry>      <term>running</term>
1014      <listitem><para>
1015   non-zero when there are timers running and
1016   <parameter>cputime</parameter> receives updates.
1017      </para></listitem>
1018    </varlistentry>
1019    <varlistentry>      <term>lock</term>
1020      <listitem><para>
1021   lock for fields in this struct.
1022      </para></listitem>
1023    </varlistentry>
1024  </variablelist>
1025 </refsect1>
1026<refsect1>
1027<title>Description</title>
1028<para>
1029   This structure contains the version of task_cputime, above, that is
1030   used for thread group CPU timer calculations.
1031</para>
1032</refsect1>
1033</refentry>
1034
1035<refentry id="API-pid-alive">
1036<refentryinfo>
1037 <title>LINUX</title>
1038 <productname>Kernel Hackers Manual</productname>
1039 <date>July 2017</date>
1040</refentryinfo>
1041<refmeta>
1042 <refentrytitle><phrase>pid_alive</phrase></refentrytitle>
1043 <manvolnum>9</manvolnum>
1044 <refmiscinfo class="version">4.1.27</refmiscinfo>
1045</refmeta>
1046<refnamediv>
1047 <refname>pid_alive</refname>
1048 <refpurpose>
1049     check that a task structure is not stale
1050 </refpurpose>
1051</refnamediv>
1052<refsynopsisdiv>
1053 <title>Synopsis</title>
1054  <funcsynopsis><funcprototype>
1055   <funcdef>int <function>pid_alive </function></funcdef>
1056   <paramdef>const struct task_struct * <parameter>p</parameter></paramdef>
1057  </funcprototype></funcsynopsis>
1058</refsynopsisdiv>
1059<refsect1>
1060 <title>Arguments</title>
1061 <variablelist>
1062  <varlistentry>
1063   <term><parameter>p</parameter></term>
1064   <listitem>
1065    <para>
1066     Task structure to be checked.
1067    </para>
1068   </listitem>
1069  </varlistentry>
1070 </variablelist>
1071</refsect1>
1072<refsect1>
1073<title>Description</title>
1074<para>
1075   Test if a process is not yet dead (at most zombie state)
1076   If pid_alive fails, then pointers within the task structure
1077   can be stale and must not be dereferenced.
1078</para>
1079</refsect1>
1080<refsect1>
1081<title>Return</title>
1082<para>
1083   1 if the process is alive. 0 otherwise.
1084</para>
1085</refsect1>
1086</refentry>
1087
1088<refentry id="API-is-global-init">
1089<refentryinfo>
1090 <title>LINUX</title>
1091 <productname>Kernel Hackers Manual</productname>
1092 <date>July 2017</date>
1093</refentryinfo>
1094<refmeta>
1095 <refentrytitle><phrase>is_global_init</phrase></refentrytitle>
1096 <manvolnum>9</manvolnum>
1097 <refmiscinfo class="version">4.1.27</refmiscinfo>
1098</refmeta>
1099<refnamediv>
1100 <refname>is_global_init</refname>
1101 <refpurpose>
1102     check if a task structure is init
1103 </refpurpose>
1104</refnamediv>
1105<refsynopsisdiv>
1106 <title>Synopsis</title>
1107  <funcsynopsis><funcprototype>
1108   <funcdef>int <function>is_global_init </function></funcdef>
1109   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
1110  </funcprototype></funcsynopsis>
1111</refsynopsisdiv>
1112<refsect1>
1113 <title>Arguments</title>
1114 <variablelist>
1115  <varlistentry>
1116   <term><parameter>tsk</parameter></term>
1117   <listitem>
1118    <para>
1119     Task structure to be checked.
1120    </para>
1121   </listitem>
1122  </varlistentry>
1123 </variablelist>
1124</refsect1>
1125<refsect1>
1126<title>Description</title>
1127<para>
1128   Check if a task structure is the first user space task the kernel created.
1129</para>
1130</refsect1>
1131<refsect1>
1132<title>Return</title>
1133<para>
1134   1 if the task structure is init. 0 otherwise.
1135</para>
1136</refsect1>
1137</refentry>
1138
1139<refentry id="API-task-nice">
1140<refentryinfo>
1141 <title>LINUX</title>
1142 <productname>Kernel Hackers Manual</productname>
1143 <date>July 2017</date>
1144</refentryinfo>
1145<refmeta>
1146 <refentrytitle><phrase>task_nice</phrase></refentrytitle>
1147 <manvolnum>9</manvolnum>
1148 <refmiscinfo class="version">4.1.27</refmiscinfo>
1149</refmeta>
1150<refnamediv>
1151 <refname>task_nice</refname>
1152 <refpurpose>
1153     return the nice value of a given task.
1154 </refpurpose>
1155</refnamediv>
1156<refsynopsisdiv>
1157 <title>Synopsis</title>
1158  <funcsynopsis><funcprototype>
1159   <funcdef>int <function>task_nice </function></funcdef>
1160   <paramdef>const struct task_struct * <parameter>p</parameter></paramdef>
1161  </funcprototype></funcsynopsis>
1162</refsynopsisdiv>
1163<refsect1>
1164 <title>Arguments</title>
1165 <variablelist>
1166  <varlistentry>
1167   <term><parameter>p</parameter></term>
1168   <listitem>
1169    <para>
1170     the task in question.
1171    </para>
1172   </listitem>
1173  </varlistentry>
1174 </variablelist>
1175</refsect1>
1176<refsect1>
1177<title>Return</title>
1178<para>
1179   The nice value [ -20 ... 0 ... 19 ].
1180</para>
1181</refsect1>
1182</refentry>
1183
1184<refentry id="API-is-idle-task">
1185<refentryinfo>
1186 <title>LINUX</title>
1187 <productname>Kernel Hackers Manual</productname>
1188 <date>July 2017</date>
1189</refentryinfo>
1190<refmeta>
1191 <refentrytitle><phrase>is_idle_task</phrase></refentrytitle>
1192 <manvolnum>9</manvolnum>
1193 <refmiscinfo class="version">4.1.27</refmiscinfo>
1194</refmeta>
1195<refnamediv>
1196 <refname>is_idle_task</refname>
1197 <refpurpose>
1198     is the specified task an idle task?
1199 </refpurpose>
1200</refnamediv>
1201<refsynopsisdiv>
1202 <title>Synopsis</title>
1203  <funcsynopsis><funcprototype>
1204   <funcdef>bool <function>is_idle_task </function></funcdef>
1205   <paramdef>const struct task_struct * <parameter>p</parameter></paramdef>
1206  </funcprototype></funcsynopsis>
1207</refsynopsisdiv>
1208<refsect1>
1209 <title>Arguments</title>
1210 <variablelist>
1211  <varlistentry>
1212   <term><parameter>p</parameter></term>
1213   <listitem>
1214    <para>
1215     the task in question.
1216    </para>
1217   </listitem>
1218  </varlistentry>
1219 </variablelist>
1220</refsect1>
1221<refsect1>
1222<title>Return</title>
1223<para>
1224   1 if <parameter>p</parameter> is an idle task. 0 otherwise.
1225</para>
1226</refsect1>
1227</refentry>
1228
1229<refentry id="API-threadgroup-lock">
1230<refentryinfo>
1231 <title>LINUX</title>
1232 <productname>Kernel Hackers Manual</productname>
1233 <date>July 2017</date>
1234</refentryinfo>
1235<refmeta>
1236 <refentrytitle><phrase>threadgroup_lock</phrase></refentrytitle>
1237 <manvolnum>9</manvolnum>
1238 <refmiscinfo class="version">4.1.27</refmiscinfo>
1239</refmeta>
1240<refnamediv>
1241 <refname>threadgroup_lock</refname>
1242 <refpurpose>
1243     lock threadgroup
1244 </refpurpose>
1245</refnamediv>
1246<refsynopsisdiv>
1247 <title>Synopsis</title>
1248  <funcsynopsis><funcprototype>
1249   <funcdef>void <function>threadgroup_lock </function></funcdef>
1250   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
1251  </funcprototype></funcsynopsis>
1252</refsynopsisdiv>
1253<refsect1>
1254 <title>Arguments</title>
1255 <variablelist>
1256  <varlistentry>
1257   <term><parameter>tsk</parameter></term>
1258   <listitem>
1259    <para>
1260     member task of the threadgroup to lock
1261    </para>
1262   </listitem>
1263  </varlistentry>
1264 </variablelist>
1265</refsect1>
1266<refsect1>
1267<title>Description</title>
1268<para>
1269   Lock the threadgroup <parameter>tsk</parameter> belongs to.  No new task is allowed to enter
1270   and member tasks aren't allowed to exit (as indicated by PF_EXITING) or
1271   change -&gt;group_leader/pid.  This is useful for cases where the threadgroup
1272   needs to stay stable across blockable operations.
1273   </para><para>
1274
1275   fork and exit paths explicitly call threadgroup_change_{begin|end}() for
1276   synchronization.  While held, no new task will be added to threadgroup
1277   and no existing live task will have its PF_EXITING set.
1278   </para><para>
1279
1280   <function>de_thread</function> does threadgroup_change_{begin|end}() when a non-leader
1281   sub-thread becomes a new leader.
1282</para>
1283</refsect1>
1284</refentry>
1285
1286<refentry id="API-threadgroup-unlock">
1287<refentryinfo>
1288 <title>LINUX</title>
1289 <productname>Kernel Hackers Manual</productname>
1290 <date>July 2017</date>
1291</refentryinfo>
1292<refmeta>
1293 <refentrytitle><phrase>threadgroup_unlock</phrase></refentrytitle>
1294 <manvolnum>9</manvolnum>
1295 <refmiscinfo class="version">4.1.27</refmiscinfo>
1296</refmeta>
1297<refnamediv>
1298 <refname>threadgroup_unlock</refname>
1299 <refpurpose>
1300     unlock threadgroup
1301 </refpurpose>
1302</refnamediv>
1303<refsynopsisdiv>
1304 <title>Synopsis</title>
1305  <funcsynopsis><funcprototype>
1306   <funcdef>void <function>threadgroup_unlock </function></funcdef>
1307   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
1308  </funcprototype></funcsynopsis>
1309</refsynopsisdiv>
1310<refsect1>
1311 <title>Arguments</title>
1312 <variablelist>
1313  <varlistentry>
1314   <term><parameter>tsk</parameter></term>
1315   <listitem>
1316    <para>
1317     member task of the threadgroup to unlock
1318    </para>
1319   </listitem>
1320  </varlistentry>
1321 </variablelist>
1322</refsect1>
1323<refsect1>
1324<title>Description</title>
1325<para>
1326   Reverse <function>threadgroup_lock</function>.
1327</para>
1328</refsect1>
1329</refentry>
1330
1331<!-- kernel/sched/core.c -->
1332<refentry id="API-wake-up-process">
1333<refentryinfo>
1334 <title>LINUX</title>
1335 <productname>Kernel Hackers Manual</productname>
1336 <date>July 2017</date>
1337</refentryinfo>
1338<refmeta>
1339 <refentrytitle><phrase>wake_up_process</phrase></refentrytitle>
1340 <manvolnum>9</manvolnum>
1341 <refmiscinfo class="version">4.1.27</refmiscinfo>
1342</refmeta>
1343<refnamediv>
1344 <refname>wake_up_process</refname>
1345 <refpurpose>
1346  Wake up a specific process
1347 </refpurpose>
1348</refnamediv>
1349<refsynopsisdiv>
1350 <title>Synopsis</title>
1351  <funcsynopsis><funcprototype>
1352   <funcdef>int <function>wake_up_process </function></funcdef>
1353   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1354  </funcprototype></funcsynopsis>
1355</refsynopsisdiv>
1356<refsect1>
1357 <title>Arguments</title>
1358 <variablelist>
1359  <varlistentry>
1360   <term><parameter>p</parameter></term>
1361   <listitem>
1362    <para>
1363     The process to be woken up.
1364    </para>
1365   </listitem>
1366  </varlistentry>
1367 </variablelist>
1368</refsect1>
1369<refsect1>
1370<title>Description</title>
1371<para>
1372   Attempt to wake up the nominated process and move it to the set of runnable
1373   processes.
1374</para>
1375</refsect1>
1376<refsect1>
1377<title>Return</title>
1378<para>
1379   1 if the process was woken up, 0 if it was already running.
1380   </para><para>
1381
1382   It may be assumed that this function implies a write memory barrier before
1383   changing the task state if and only if any tasks are woken up.
1384</para>
1385</refsect1>
1386</refentry>
1387
1388<refentry id="API-preempt-notifier-register">
1389<refentryinfo>
1390 <title>LINUX</title>
1391 <productname>Kernel Hackers Manual</productname>
1392 <date>July 2017</date>
1393</refentryinfo>
1394<refmeta>
1395 <refentrytitle><phrase>preempt_notifier_register</phrase></refentrytitle>
1396 <manvolnum>9</manvolnum>
1397 <refmiscinfo class="version">4.1.27</refmiscinfo>
1398</refmeta>
1399<refnamediv>
1400 <refname>preempt_notifier_register</refname>
1401 <refpurpose>
1402     tell me when current is being preempted &amp; rescheduled
1403 </refpurpose>
1404</refnamediv>
1405<refsynopsisdiv>
1406 <title>Synopsis</title>
1407  <funcsynopsis><funcprototype>
1408   <funcdef>void <function>preempt_notifier_register </function></funcdef>
1409   <paramdef>struct preempt_notifier * <parameter>notifier</parameter></paramdef>
1410  </funcprototype></funcsynopsis>
1411</refsynopsisdiv>
1412<refsect1>
1413 <title>Arguments</title>
1414 <variablelist>
1415  <varlistentry>
1416   <term><parameter>notifier</parameter></term>
1417   <listitem>
1418    <para>
1419     notifier struct to register
1420    </para>
1421   </listitem>
1422  </varlistentry>
1423 </variablelist>
1424</refsect1>
1425</refentry>
1426
1427<refentry id="API-preempt-notifier-unregister">
1428<refentryinfo>
1429 <title>LINUX</title>
1430 <productname>Kernel Hackers Manual</productname>
1431 <date>July 2017</date>
1432</refentryinfo>
1433<refmeta>
1434 <refentrytitle><phrase>preempt_notifier_unregister</phrase></refentrytitle>
1435 <manvolnum>9</manvolnum>
1436 <refmiscinfo class="version">4.1.27</refmiscinfo>
1437</refmeta>
1438<refnamediv>
1439 <refname>preempt_notifier_unregister</refname>
1440 <refpurpose>
1441     no longer interested in preemption notifications
1442 </refpurpose>
1443</refnamediv>
1444<refsynopsisdiv>
1445 <title>Synopsis</title>
1446  <funcsynopsis><funcprototype>
1447   <funcdef>void <function>preempt_notifier_unregister </function></funcdef>
1448   <paramdef>struct preempt_notifier * <parameter>notifier</parameter></paramdef>
1449  </funcprototype></funcsynopsis>
1450</refsynopsisdiv>
1451<refsect1>
1452 <title>Arguments</title>
1453 <variablelist>
1454  <varlistentry>
1455   <term><parameter>notifier</parameter></term>
1456   <listitem>
1457    <para>
1458     notifier struct to unregister
1459    </para>
1460   </listitem>
1461  </varlistentry>
1462 </variablelist>
1463</refsect1>
1464<refsect1>
1465<title>Description</title>
1466<para>
1467   This is safe to call from within a preemption notifier.
1468</para>
1469</refsect1>
1470</refentry>
1471
1472<refentry id="API-preempt-schedule-context">
1473<refentryinfo>
1474 <title>LINUX</title>
1475 <productname>Kernel Hackers Manual</productname>
1476 <date>July 2017</date>
1477</refentryinfo>
1478<refmeta>
1479 <refentrytitle><phrase>preempt_schedule_context</phrase></refentrytitle>
1480 <manvolnum>9</manvolnum>
1481 <refmiscinfo class="version">4.1.27</refmiscinfo>
1482</refmeta>
1483<refnamediv>
1484 <refname>preempt_schedule_context</refname>
1485 <refpurpose>
1486     preempt_schedule called by tracing
1487 </refpurpose>
1488</refnamediv>
1489<refsynopsisdiv>
1490 <title>Synopsis</title>
1491  <funcsynopsis><funcprototype>
1492   <funcdef>__visible void __sched notrace <function>preempt_schedule_context </function></funcdef>
1493   <paramdef> <parameter>void</parameter></paramdef>
1494  </funcprototype></funcsynopsis>
1495</refsynopsisdiv>
1496<refsect1>
1497 <title>Arguments</title>
1498 <variablelist>
1499  <varlistentry>
1500   <term><parameter>void</parameter></term>
1501   <listitem>
1502    <para>
1503     no arguments
1504    </para>
1505   </listitem>
1506  </varlistentry>
1507 </variablelist>
1508</refsect1>
1509<refsect1>
1510<title>Description</title>
1511<para>
1512   </para><para>
1513
1514   The tracing infrastructure uses preempt_enable_notrace to prevent
1515   recursion and tracing preempt enabling caused by the tracing
1516   infrastructure itself. But as tracing can happen in areas coming
1517   from userspace or just about to enter userspace, a preempt enable
1518   can occur before <function>user_exit</function> is called. This will cause the scheduler
1519   to be called when the system is still in usermode.
1520   </para><para>
1521
1522   To prevent this, the preempt_enable_notrace will use this function
1523   instead of <function>preempt_schedule</function> to exit user context if needed before
1524   calling the scheduler.
1525</para>
1526</refsect1>
1527</refentry>
1528
1529<refentry id="API-sched-setscheduler">
1530<refentryinfo>
1531 <title>LINUX</title>
1532 <productname>Kernel Hackers Manual</productname>
1533 <date>July 2017</date>
1534</refentryinfo>
1535<refmeta>
1536 <refentrytitle><phrase>sched_setscheduler</phrase></refentrytitle>
1537 <manvolnum>9</manvolnum>
1538 <refmiscinfo class="version">4.1.27</refmiscinfo>
1539</refmeta>
1540<refnamediv>
1541 <refname>sched_setscheduler</refname>
1542 <refpurpose>
1543     change the scheduling policy and/or RT priority of a thread.
1544 </refpurpose>
1545</refnamediv>
1546<refsynopsisdiv>
1547 <title>Synopsis</title>
1548  <funcsynopsis><funcprototype>
1549   <funcdef>int <function>sched_setscheduler </function></funcdef>
1550   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1551   <paramdef>int <parameter>policy</parameter></paramdef>
1552   <paramdef>const struct sched_param * <parameter>param</parameter></paramdef>
1553  </funcprototype></funcsynopsis>
1554</refsynopsisdiv>
1555<refsect1>
1556 <title>Arguments</title>
1557 <variablelist>
1558  <varlistentry>
1559   <term><parameter>p</parameter></term>
1560   <listitem>
1561    <para>
1562     the task in question.
1563    </para>
1564   </listitem>
1565  </varlistentry>
1566  <varlistentry>
1567   <term><parameter>policy</parameter></term>
1568   <listitem>
1569    <para>
1570     new policy.
1571    </para>
1572   </listitem>
1573  </varlistentry>
1574  <varlistentry>
1575   <term><parameter>param</parameter></term>
1576   <listitem>
1577    <para>
1578     structure containing the new RT priority.
1579    </para>
1580   </listitem>
1581  </varlistentry>
1582 </variablelist>
1583</refsect1>
1584<refsect1>
1585<title>Return</title>
1586<para>
1587   0 on success. An error code otherwise.
1588   </para><para>
1589
1590   NOTE that the task may be already dead.
1591</para>
1592</refsect1>
1593</refentry>
1594
1595<refentry id="API-yield">
1596<refentryinfo>
1597 <title>LINUX</title>
1598 <productname>Kernel Hackers Manual</productname>
1599 <date>July 2017</date>
1600</refentryinfo>
1601<refmeta>
1602 <refentrytitle><phrase>yield</phrase></refentrytitle>
1603 <manvolnum>9</manvolnum>
1604 <refmiscinfo class="version">4.1.27</refmiscinfo>
1605</refmeta>
1606<refnamediv>
1607 <refname>yield</refname>
1608 <refpurpose>
1609     yield the current processor to other threads.
1610 </refpurpose>
1611</refnamediv>
1612<refsynopsisdiv>
1613 <title>Synopsis</title>
1614  <funcsynopsis><funcprototype>
1615   <funcdef>void __sched <function>yield </function></funcdef>
1616   <paramdef> <parameter>void</parameter></paramdef>
1617  </funcprototype></funcsynopsis>
1618</refsynopsisdiv>
1619<refsect1>
1620 <title>Arguments</title>
1621 <variablelist>
1622  <varlistentry>
1623   <term><parameter>void</parameter></term>
1624   <listitem>
1625    <para>
1626     no arguments
1627    </para>
1628   </listitem>
1629  </varlistentry>
1630 </variablelist>
1631</refsect1>
1632<refsect1>
1633<title>Description</title>
1634<para>
1635   </para><para>
1636
1637   Do not ever use this function, there's a 99% chance you're doing it wrong.
1638   </para><para>
1639
1640   The scheduler is at all times free to pick the calling task as the most
1641   eligible task to run, if removing the <function>yield</function> call from your code breaks
1642   it, its already broken.
1643</para>
1644</refsect1>
1645<refsect1>
1646<title>Typical broken usage is</title>
1647<para>
1648   </para><para>
1649
1650   while (!event)
1651   <function>yield</function>;
1652   </para><para>
1653
1654   where one assumes that <function>yield</function> will let 'the other' process run that will
1655   make event true. If the current task is a SCHED_FIFO task that will never
1656   happen. Never use <function>yield</function> as a progress guarantee!!
1657   </para><para>
1658
1659   If you want to use <function>yield</function> to wait for something, use <function>wait_event</function>.
1660   If you want to use <function>yield</function> to be 'nice' for others, use <function>cond_resched</function>.
1661   If you still want to use <function>yield</function>, do not!
1662</para>
1663</refsect1>
1664</refentry>
1665
1666<refentry id="API-yield-to">
1667<refentryinfo>
1668 <title>LINUX</title>
1669 <productname>Kernel Hackers Manual</productname>
1670 <date>July 2017</date>
1671</refentryinfo>
1672<refmeta>
1673 <refentrytitle><phrase>yield_to</phrase></refentrytitle>
1674 <manvolnum>9</manvolnum>
1675 <refmiscinfo class="version">4.1.27</refmiscinfo>
1676</refmeta>
1677<refnamediv>
1678 <refname>yield_to</refname>
1679 <refpurpose>
1680     yield the current processor to another thread in your thread group, or accelerate that thread toward the processor it's on.
1681 </refpurpose>
1682</refnamediv>
1683<refsynopsisdiv>
1684 <title>Synopsis</title>
1685  <funcsynopsis><funcprototype>
1686   <funcdef>int __sched <function>yield_to </function></funcdef>
1687   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1688   <paramdef>bool <parameter>preempt</parameter></paramdef>
1689  </funcprototype></funcsynopsis>
1690</refsynopsisdiv>
1691<refsect1>
1692 <title>Arguments</title>
1693 <variablelist>
1694  <varlistentry>
1695   <term><parameter>p</parameter></term>
1696   <listitem>
1697    <para>
1698     target task
1699    </para>
1700   </listitem>
1701  </varlistentry>
1702  <varlistentry>
1703   <term><parameter>preempt</parameter></term>
1704   <listitem>
1705    <para>
1706     whether task preemption is allowed or not
1707    </para>
1708   </listitem>
1709  </varlistentry>
1710 </variablelist>
1711</refsect1>
1712<refsect1>
1713<title>Description</title>
1714<para>
1715   It's the caller's job to ensure that the target task struct
1716   can't go away on us before we can do any checks.
1717</para>
1718</refsect1>
1719<refsect1>
1720<title>Return</title>
1721<para>
1722   true (&gt;0) if we indeed boosted the target task.
1723   false (0) if we failed to boost the target.
1724   -ESRCH if there's no task to yield to.
1725</para>
1726</refsect1>
1727</refentry>
1728
1729<!-- kernel/sched/cpupri.c -->
1730<refentry id="API-cpupri-find">
1731<refentryinfo>
1732 <title>LINUX</title>
1733 <productname>Kernel Hackers Manual</productname>
1734 <date>July 2017</date>
1735</refentryinfo>
1736<refmeta>
1737 <refentrytitle><phrase>cpupri_find</phrase></refentrytitle>
1738 <manvolnum>9</manvolnum>
1739 <refmiscinfo class="version">4.1.27</refmiscinfo>
1740</refmeta>
1741<refnamediv>
1742 <refname>cpupri_find</refname>
1743 <refpurpose>
1744  find the best (lowest-pri) CPU in the system
1745 </refpurpose>
1746</refnamediv>
1747<refsynopsisdiv>
1748 <title>Synopsis</title>
1749  <funcsynopsis><funcprototype>
1750   <funcdef>int <function>cpupri_find </function></funcdef>
1751   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1752   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1753   <paramdef>struct cpumask * <parameter>lowest_mask</parameter></paramdef>
1754  </funcprototype></funcsynopsis>
1755</refsynopsisdiv>
1756<refsect1>
1757 <title>Arguments</title>
1758 <variablelist>
1759  <varlistentry>
1760   <term><parameter>cp</parameter></term>
1761   <listitem>
1762    <para>
1763     The cpupri context
1764    </para>
1765   </listitem>
1766  </varlistentry>
1767  <varlistentry>
1768   <term><parameter>p</parameter></term>
1769   <listitem>
1770    <para>
1771     The task
1772    </para>
1773   </listitem>
1774  </varlistentry>
1775  <varlistentry>
1776   <term><parameter>lowest_mask</parameter></term>
1777   <listitem>
1778    <para>
1779     A mask to fill in with selected CPUs (or NULL)
1780    </para>
1781   </listitem>
1782  </varlistentry>
1783 </variablelist>
1784</refsect1>
1785<refsect1>
1786<title>Note</title>
1787<para>
1788   This function returns the recommended CPUs as calculated during the
1789   current invocation.  By the time the call returns, the CPUs may have in
1790   fact changed priorities any number of times.  While not ideal, it is not
1791   an issue of correctness since the normal rebalancer logic will correct
1792   any discrepancies created by racing against the uncertainty of the current
1793   priority configuration.
1794</para>
1795</refsect1>
1796<refsect1>
1797<title>Return</title>
1798<para>
1799   (int)bool - CPUs were found
1800</para>
1801</refsect1>
1802</refentry>
1803
1804<refentry id="API-cpupri-set">
1805<refentryinfo>
1806 <title>LINUX</title>
1807 <productname>Kernel Hackers Manual</productname>
1808 <date>July 2017</date>
1809</refentryinfo>
1810<refmeta>
1811 <refentrytitle><phrase>cpupri_set</phrase></refentrytitle>
1812 <manvolnum>9</manvolnum>
1813 <refmiscinfo class="version">4.1.27</refmiscinfo>
1814</refmeta>
1815<refnamediv>
1816 <refname>cpupri_set</refname>
1817 <refpurpose>
1818     update the cpu priority setting
1819 </refpurpose>
1820</refnamediv>
1821<refsynopsisdiv>
1822 <title>Synopsis</title>
1823  <funcsynopsis><funcprototype>
1824   <funcdef>void <function>cpupri_set </function></funcdef>
1825   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1826   <paramdef>int <parameter>cpu</parameter></paramdef>
1827   <paramdef>int <parameter>newpri</parameter></paramdef>
1828  </funcprototype></funcsynopsis>
1829</refsynopsisdiv>
1830<refsect1>
1831 <title>Arguments</title>
1832 <variablelist>
1833  <varlistentry>
1834   <term><parameter>cp</parameter></term>
1835   <listitem>
1836    <para>
1837     The cpupri context
1838    </para>
1839   </listitem>
1840  </varlistentry>
1841  <varlistentry>
1842   <term><parameter>cpu</parameter></term>
1843   <listitem>
1844    <para>
1845     The target cpu
1846    </para>
1847   </listitem>
1848  </varlistentry>
1849  <varlistentry>
1850   <term><parameter>newpri</parameter></term>
1851   <listitem>
1852    <para>
1853     The priority (INVALID-RT99) to assign to this CPU
1854    </para>
1855   </listitem>
1856  </varlistentry>
1857 </variablelist>
1858</refsect1>
1859<refsect1>
1860<title>Note</title>
1861<para>
1862   Assumes cpu_rq(cpu)-&gt;lock is locked
1863</para>
1864</refsect1>
1865<refsect1>
1866<title>Returns</title>
1867<para>
1868   (void)
1869</para>
1870</refsect1>
1871</refentry>
1872
1873<refentry id="API-cpupri-init">
1874<refentryinfo>
1875 <title>LINUX</title>
1876 <productname>Kernel Hackers Manual</productname>
1877 <date>July 2017</date>
1878</refentryinfo>
1879<refmeta>
1880 <refentrytitle><phrase>cpupri_init</phrase></refentrytitle>
1881 <manvolnum>9</manvolnum>
1882 <refmiscinfo class="version">4.1.27</refmiscinfo>
1883</refmeta>
1884<refnamediv>
1885 <refname>cpupri_init</refname>
1886 <refpurpose>
1887     initialize the cpupri structure
1888 </refpurpose>
1889</refnamediv>
1890<refsynopsisdiv>
1891 <title>Synopsis</title>
1892  <funcsynopsis><funcprototype>
1893   <funcdef>int <function>cpupri_init </function></funcdef>
1894   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1895  </funcprototype></funcsynopsis>
1896</refsynopsisdiv>
1897<refsect1>
1898 <title>Arguments</title>
1899 <variablelist>
1900  <varlistentry>
1901   <term><parameter>cp</parameter></term>
1902   <listitem>
1903    <para>
1904     The cpupri context
1905    </para>
1906   </listitem>
1907  </varlistentry>
1908 </variablelist>
1909</refsect1>
1910<refsect1>
1911<title>Return</title>
1912<para>
1913   -ENOMEM on memory allocation failure.
1914</para>
1915</refsect1>
1916</refentry>
1917
1918<refentry id="API-cpupri-cleanup">
1919<refentryinfo>
1920 <title>LINUX</title>
1921 <productname>Kernel Hackers Manual</productname>
1922 <date>July 2017</date>
1923</refentryinfo>
1924<refmeta>
1925 <refentrytitle><phrase>cpupri_cleanup</phrase></refentrytitle>
1926 <manvolnum>9</manvolnum>
1927 <refmiscinfo class="version">4.1.27</refmiscinfo>
1928</refmeta>
1929<refnamediv>
1930 <refname>cpupri_cleanup</refname>
1931 <refpurpose>
1932     clean up the cpupri structure
1933 </refpurpose>
1934</refnamediv>
1935<refsynopsisdiv>
1936 <title>Synopsis</title>
1937  <funcsynopsis><funcprototype>
1938   <funcdef>void <function>cpupri_cleanup </function></funcdef>
1939   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1940  </funcprototype></funcsynopsis>
1941</refsynopsisdiv>
1942<refsect1>
1943 <title>Arguments</title>
1944 <variablelist>
1945  <varlistentry>
1946   <term><parameter>cp</parameter></term>
1947   <listitem>
1948    <para>
1949     The cpupri context
1950    </para>
1951   </listitem>
1952  </varlistentry>
1953 </variablelist>
1954</refsect1>
1955</refentry>
1956
1957<!-- kernel/sched/fair.c -->
1958<refentry id="API-get-sd-load-idx">
1959<refentryinfo>
1960 <title>LINUX</title>
1961 <productname>Kernel Hackers Manual</productname>
1962 <date>July 2017</date>
1963</refentryinfo>
1964<refmeta>
1965 <refentrytitle><phrase>get_sd_load_idx</phrase></refentrytitle>
1966 <manvolnum>9</manvolnum>
1967 <refmiscinfo class="version">4.1.27</refmiscinfo>
1968</refmeta>
1969<refnamediv>
1970 <refname>get_sd_load_idx</refname>
1971 <refpurpose>
1972  Obtain the load index for a given sched domain.
1973 </refpurpose>
1974</refnamediv>
1975<refsynopsisdiv>
1976 <title>Synopsis</title>
1977  <funcsynopsis><funcprototype>
1978   <funcdef>int <function>get_sd_load_idx </function></funcdef>
1979   <paramdef>struct sched_domain * <parameter>sd</parameter></paramdef>
1980   <paramdef>enum cpu_idle_type <parameter>idle</parameter></paramdef>
1981  </funcprototype></funcsynopsis>
1982</refsynopsisdiv>
1983<refsect1>
1984 <title>Arguments</title>
1985 <variablelist>
1986  <varlistentry>
1987   <term><parameter>sd</parameter></term>
1988   <listitem>
1989    <para>
1990     The sched_domain whose load_idx is to be obtained.
1991    </para>
1992   </listitem>
1993  </varlistentry>
1994  <varlistentry>
1995   <term><parameter>idle</parameter></term>
1996   <listitem>
1997    <para>
1998     The idle status of the CPU for whose sd load_idx is obtained.
1999    </para>
2000   </listitem>
2001  </varlistentry>
2002 </variablelist>
2003</refsect1>
2004<refsect1>
2005<title>Return</title>
2006<para>
2007   The load index.
2008</para>
2009</refsect1>
2010</refentry>
2011
2012<refentry id="API-update-sg-lb-stats">
2013<refentryinfo>
2014 <title>LINUX</title>
2015 <productname>Kernel Hackers Manual</productname>
2016 <date>July 2017</date>
2017</refentryinfo>
2018<refmeta>
2019 <refentrytitle><phrase>update_sg_lb_stats</phrase></refentrytitle>
2020 <manvolnum>9</manvolnum>
2021 <refmiscinfo class="version">4.1.27</refmiscinfo>
2022</refmeta>
2023<refnamediv>
2024 <refname>update_sg_lb_stats</refname>
2025 <refpurpose>
2026     Update sched_group's statistics for load balancing.
2027 </refpurpose>
2028</refnamediv>
2029<refsynopsisdiv>
2030 <title>Synopsis</title>
2031  <funcsynopsis><funcprototype>
2032   <funcdef>void <function>update_sg_lb_stats </function></funcdef>
2033   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2034   <paramdef>struct sched_group * <parameter>group</parameter></paramdef>
2035   <paramdef>int <parameter>load_idx</parameter></paramdef>
2036   <paramdef>int <parameter>local_group</parameter></paramdef>
2037   <paramdef>struct sg_lb_stats * <parameter>sgs</parameter></paramdef>
2038   <paramdef>bool * <parameter>overload</parameter></paramdef>
2039  </funcprototype></funcsynopsis>
2040</refsynopsisdiv>
2041<refsect1>
2042 <title>Arguments</title>
2043 <variablelist>
2044  <varlistentry>
2045   <term><parameter>env</parameter></term>
2046   <listitem>
2047    <para>
2048     The load balancing environment.
2049    </para>
2050   </listitem>
2051  </varlistentry>
2052  <varlistentry>
2053   <term><parameter>group</parameter></term>
2054   <listitem>
2055    <para>
2056     sched_group whose statistics are to be updated.
2057    </para>
2058   </listitem>
2059  </varlistentry>
2060  <varlistentry>
2061   <term><parameter>load_idx</parameter></term>
2062   <listitem>
2063    <para>
2064     Load index of sched_domain of this_cpu for load calc.
2065    </para>
2066   </listitem>
2067  </varlistentry>
2068  <varlistentry>
2069   <term><parameter>local_group</parameter></term>
2070   <listitem>
2071    <para>
2072     Does group contain this_cpu.
2073    </para>
2074   </listitem>
2075  </varlistentry>
2076  <varlistentry>
2077   <term><parameter>sgs</parameter></term>
2078   <listitem>
2079    <para>
2080     variable to hold the statistics for this group.
2081    </para>
2082   </listitem>
2083  </varlistentry>
2084  <varlistentry>
2085   <term><parameter>overload</parameter></term>
2086   <listitem>
2087    <para>
2088     Indicate more than one runnable task for any CPU.
2089    </para>
2090   </listitem>
2091  </varlistentry>
2092 </variablelist>
2093</refsect1>
2094</refentry>
2095
2096<refentry id="API-update-sd-pick-busiest">
2097<refentryinfo>
2098 <title>LINUX</title>
2099 <productname>Kernel Hackers Manual</productname>
2100 <date>July 2017</date>
2101</refentryinfo>
2102<refmeta>
2103 <refentrytitle><phrase>update_sd_pick_busiest</phrase></refentrytitle>
2104 <manvolnum>9</manvolnum>
2105 <refmiscinfo class="version">4.1.27</refmiscinfo>
2106</refmeta>
2107<refnamediv>
2108 <refname>update_sd_pick_busiest</refname>
2109 <refpurpose>
2110     return 1 on busiest group
2111 </refpurpose>
2112</refnamediv>
2113<refsynopsisdiv>
2114 <title>Synopsis</title>
2115  <funcsynopsis><funcprototype>
2116   <funcdef>bool <function>update_sd_pick_busiest </function></funcdef>
2117   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2118   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2119   <paramdef>struct sched_group * <parameter>sg</parameter></paramdef>
2120   <paramdef>struct sg_lb_stats * <parameter>sgs</parameter></paramdef>
2121  </funcprototype></funcsynopsis>
2122</refsynopsisdiv>
2123<refsect1>
2124 <title>Arguments</title>
2125 <variablelist>
2126  <varlistentry>
2127   <term><parameter>env</parameter></term>
2128   <listitem>
2129    <para>
2130     The load balancing environment.
2131    </para>
2132   </listitem>
2133  </varlistentry>
2134  <varlistentry>
2135   <term><parameter>sds</parameter></term>
2136   <listitem>
2137    <para>
2138     sched_domain statistics
2139    </para>
2140   </listitem>
2141  </varlistentry>
2142  <varlistentry>
2143   <term><parameter>sg</parameter></term>
2144   <listitem>
2145    <para>
2146     sched_group candidate to be checked for being the busiest
2147    </para>
2148   </listitem>
2149  </varlistentry>
2150  <varlistentry>
2151   <term><parameter>sgs</parameter></term>
2152   <listitem>
2153    <para>
2154     sched_group statistics
2155    </para>
2156   </listitem>
2157  </varlistentry>
2158 </variablelist>
2159</refsect1>
2160<refsect1>
2161<title>Description</title>
2162<para>
2163   Determine if <parameter>sg</parameter> is a busier group than the previously selected
2164   busiest group.
2165</para>
2166</refsect1>
2167<refsect1>
2168<title>Return</title>
2169<para>
2170   <constant>true</constant> if <parameter>sg</parameter> is a busier group than the previously selected
2171   busiest group. <constant>false</constant> otherwise.
2172</para>
2173</refsect1>
2174</refentry>
2175
2176<refentry id="API-update-sd-lb-stats">
2177<refentryinfo>
2178 <title>LINUX</title>
2179 <productname>Kernel Hackers Manual</productname>
2180 <date>July 2017</date>
2181</refentryinfo>
2182<refmeta>
2183 <refentrytitle><phrase>update_sd_lb_stats</phrase></refentrytitle>
2184 <manvolnum>9</manvolnum>
2185 <refmiscinfo class="version">4.1.27</refmiscinfo>
2186</refmeta>
2187<refnamediv>
2188 <refname>update_sd_lb_stats</refname>
2189 <refpurpose>
2190     Update sched_domain's statistics for load balancing.
2191 </refpurpose>
2192</refnamediv>
2193<refsynopsisdiv>
2194 <title>Synopsis</title>
2195  <funcsynopsis><funcprototype>
2196   <funcdef>void <function>update_sd_lb_stats </function></funcdef>
2197   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2198   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2199  </funcprototype></funcsynopsis>
2200</refsynopsisdiv>
2201<refsect1>
2202 <title>Arguments</title>
2203 <variablelist>
2204  <varlistentry>
2205   <term><parameter>env</parameter></term>
2206   <listitem>
2207    <para>
2208     The load balancing environment.
2209    </para>
2210   </listitem>
2211  </varlistentry>
2212  <varlistentry>
2213   <term><parameter>sds</parameter></term>
2214   <listitem>
2215    <para>
2216     variable to hold the statistics for this sched_domain.
2217    </para>
2218   </listitem>
2219  </varlistentry>
2220 </variablelist>
2221</refsect1>
2222</refentry>
2223
2224<refentry id="API-check-asym-packing">
2225<refentryinfo>
2226 <title>LINUX</title>
2227 <productname>Kernel Hackers Manual</productname>
2228 <date>July 2017</date>
2229</refentryinfo>
2230<refmeta>
2231 <refentrytitle><phrase>check_asym_packing</phrase></refentrytitle>
2232 <manvolnum>9</manvolnum>
2233 <refmiscinfo class="version">4.1.27</refmiscinfo>
2234</refmeta>
2235<refnamediv>
2236 <refname>check_asym_packing</refname>
2237 <refpurpose>
2238     Check to see if the group is packed into the sched doman.
2239 </refpurpose>
2240</refnamediv>
2241<refsynopsisdiv>
2242 <title>Synopsis</title>
2243  <funcsynopsis><funcprototype>
2244   <funcdef>int <function>check_asym_packing </function></funcdef>
2245   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2246   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2247  </funcprototype></funcsynopsis>
2248</refsynopsisdiv>
2249<refsect1>
2250 <title>Arguments</title>
2251 <variablelist>
2252  <varlistentry>
2253   <term><parameter>env</parameter></term>
2254   <listitem>
2255    <para>
2256     The load balancing environment.
2257    </para>
2258   </listitem>
2259  </varlistentry>
2260  <varlistentry>
2261   <term><parameter>sds</parameter></term>
2262   <listitem>
2263    <para>
2264     Statistics of the sched_domain which is to be packed
2265    </para>
2266   </listitem>
2267  </varlistentry>
2268 </variablelist>
2269</refsect1>
2270<refsect1>
2271<title>Description</title>
2272<para>
2273   </para><para>
2274
2275   This is primarily intended to used at the sibling level.  Some
2276   cores like POWER7 prefer to use lower numbered SMT threads.  In the
2277   case of POWER7, it can move to lower SMT modes only when higher
2278   threads are idle.  When in lower SMT modes, the threads will
2279   perform better since they share less core resources.  Hence when we
2280   have idle threads, we want them to be the higher ones.
2281   </para><para>
2282
2283   This packing function is run on idle threads.  It checks to see if
2284   the busiest CPU in this domain (core in the P7 case) has a higher
2285   CPU number than the packing function is being run on.  Here we are
2286   assuming lower CPU number will be equivalent to lower a SMT thread
2287   number.
2288</para>
2289</refsect1>
2290<refsect1>
2291<title>Return</title>
2292<para>
2293   1 when packing is required and a task should be moved to
2294   this CPU.  The amount of the imbalance is returned in *imbalance.
2295</para>
2296</refsect1>
2297</refentry>
2298
2299<refentry id="API-fix-small-imbalance">
2300<refentryinfo>
2301 <title>LINUX</title>
2302 <productname>Kernel Hackers Manual</productname>
2303 <date>July 2017</date>
2304</refentryinfo>
2305<refmeta>
2306 <refentrytitle><phrase>fix_small_imbalance</phrase></refentrytitle>
2307 <manvolnum>9</manvolnum>
2308 <refmiscinfo class="version">4.1.27</refmiscinfo>
2309</refmeta>
2310<refnamediv>
2311 <refname>fix_small_imbalance</refname>
2312 <refpurpose>
2313     Calculate the minor imbalance that exists amongst the groups of a sched_domain, during load balancing.
2314 </refpurpose>
2315</refnamediv>
2316<refsynopsisdiv>
2317 <title>Synopsis</title>
2318  <funcsynopsis><funcprototype>
2319   <funcdef>void <function>fix_small_imbalance </function></funcdef>
2320   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2321   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2322  </funcprototype></funcsynopsis>
2323</refsynopsisdiv>
2324<refsect1>
2325 <title>Arguments</title>
2326 <variablelist>
2327  <varlistentry>
2328   <term><parameter>env</parameter></term>
2329   <listitem>
2330    <para>
2331     The load balancing environment.
2332    </para>
2333   </listitem>
2334  </varlistentry>
2335  <varlistentry>
2336   <term><parameter>sds</parameter></term>
2337   <listitem>
2338    <para>
2339     Statistics of the sched_domain whose imbalance is to be calculated.
2340    </para>
2341   </listitem>
2342  </varlistentry>
2343 </variablelist>
2344</refsect1>
2345</refentry>
2346
2347<refentry id="API-calculate-imbalance">
2348<refentryinfo>
2349 <title>LINUX</title>
2350 <productname>Kernel Hackers Manual</productname>
2351 <date>July 2017</date>
2352</refentryinfo>
2353<refmeta>
2354 <refentrytitle><phrase>calculate_imbalance</phrase></refentrytitle>
2355 <manvolnum>9</manvolnum>
2356 <refmiscinfo class="version">4.1.27</refmiscinfo>
2357</refmeta>
2358<refnamediv>
2359 <refname>calculate_imbalance</refname>
2360 <refpurpose>
2361     Calculate the amount of imbalance present within the groups of a given sched_domain during load balance.
2362 </refpurpose>
2363</refnamediv>
2364<refsynopsisdiv>
2365 <title>Synopsis</title>
2366  <funcsynopsis><funcprototype>
2367   <funcdef>void <function>calculate_imbalance </function></funcdef>
2368   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2369   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2370  </funcprototype></funcsynopsis>
2371</refsynopsisdiv>
2372<refsect1>
2373 <title>Arguments</title>
2374 <variablelist>
2375  <varlistentry>
2376   <term><parameter>env</parameter></term>
2377   <listitem>
2378    <para>
2379     load balance environment
2380    </para>
2381   </listitem>
2382  </varlistentry>
2383  <varlistentry>
2384   <term><parameter>sds</parameter></term>
2385   <listitem>
2386    <para>
2387     statistics of the sched_domain whose imbalance is to be calculated.
2388    </para>
2389   </listitem>
2390  </varlistentry>
2391 </variablelist>
2392</refsect1>
2393</refentry>
2394
2395<refentry id="API-find-busiest-group">
2396<refentryinfo>
2397 <title>LINUX</title>
2398 <productname>Kernel Hackers Manual</productname>
2399 <date>July 2017</date>
2400</refentryinfo>
2401<refmeta>
2402 <refentrytitle><phrase>find_busiest_group</phrase></refentrytitle>
2403 <manvolnum>9</manvolnum>
2404 <refmiscinfo class="version">4.1.27</refmiscinfo>
2405</refmeta>
2406<refnamediv>
2407 <refname>find_busiest_group</refname>
2408 <refpurpose>
2409     Returns the busiest group within the sched_domain if there is an imbalance. If there isn't an imbalance, and the user has opted for power-savings, it returns a group whose CPUs can be put to idle by rebalancing those tasks elsewhere, if such a group exists.
2410 </refpurpose>
2411</refnamediv>
2412<refsynopsisdiv>
2413 <title>Synopsis</title>
2414  <funcsynopsis><funcprototype>
2415   <funcdef>struct sched_group * <function>find_busiest_group </function></funcdef>
2416   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2417  </funcprototype></funcsynopsis>
2418</refsynopsisdiv>
2419<refsect1>
2420 <title>Arguments</title>
2421 <variablelist>
2422  <varlistentry>
2423   <term><parameter>env</parameter></term>
2424   <listitem>
2425    <para>
2426     The load balancing environment.
2427    </para>
2428   </listitem>
2429  </varlistentry>
2430 </variablelist>
2431</refsect1>
2432<refsect1>
2433<title>Description</title>
2434<para>
2435   </para><para>
2436
2437   Also calculates the amount of weighted load which should be moved
2438   to restore balance.
2439</para>
2440</refsect1>
2441<refsect1>
2442<title>Return</title>
2443<para>
2444   - The busiest group if imbalance exists.
2445   - If no imbalance and user has opted for power-savings balance,
2446   return the least loaded group whose CPUs can be
2447   put to idle by rebalancing its tasks onto our group.
2448</para>
2449</refsect1>
2450</refentry>
2451
2452<!-- include/linux/completion.h -->
2453<refentry id="API-DECLARE-COMPLETION">
2454<refentryinfo>
2455 <title>LINUX</title>
2456 <productname>Kernel Hackers Manual</productname>
2457 <date>July 2017</date>
2458</refentryinfo>
2459<refmeta>
2460 <refentrytitle><phrase>DECLARE_COMPLETION</phrase></refentrytitle>
2461 <manvolnum>9</manvolnum>
2462 <refmiscinfo class="version">4.1.27</refmiscinfo>
2463</refmeta>
2464<refnamediv>
2465 <refname>DECLARE_COMPLETION</refname>
2466 <refpurpose>
2467  declare and initialize a completion structure
2468 </refpurpose>
2469</refnamediv>
2470<refsynopsisdiv>
2471 <title>Synopsis</title>
2472  <funcsynopsis><funcprototype>
2473   <funcdef> <function>DECLARE_COMPLETION </function></funcdef>
2474   <paramdef> <parameter>work</parameter></paramdef>
2475  </funcprototype></funcsynopsis>
2476</refsynopsisdiv>
2477<refsect1>
2478 <title>Arguments</title>
2479 <variablelist>
2480  <varlistentry>
2481   <term><parameter>work</parameter></term>
2482   <listitem>
2483    <para>
2484     identifier for the completion structure
2485    </para>
2486   </listitem>
2487  </varlistentry>
2488 </variablelist>
2489</refsect1>
2490<refsect1>
2491<title>Description</title>
2492<para>
2493   This macro declares and initializes a completion structure. Generally used
2494   for static declarations. You should use the _ONSTACK variant for automatic
2495   variables.
2496</para>
2497</refsect1>
2498</refentry>
2499
2500<refentry id="API-DECLARE-COMPLETION-ONSTACK">
2501<refentryinfo>
2502 <title>LINUX</title>
2503 <productname>Kernel Hackers Manual</productname>
2504 <date>July 2017</date>
2505</refentryinfo>
2506<refmeta>
2507 <refentrytitle><phrase>DECLARE_COMPLETION_ONSTACK</phrase></refentrytitle>
2508 <manvolnum>9</manvolnum>
2509 <refmiscinfo class="version">4.1.27</refmiscinfo>
2510</refmeta>
2511<refnamediv>
2512 <refname>DECLARE_COMPLETION_ONSTACK</refname>
2513 <refpurpose>
2514     declare and initialize a completion structure
2515 </refpurpose>
2516</refnamediv>
2517<refsynopsisdiv>
2518 <title>Synopsis</title>
2519  <funcsynopsis><funcprototype>
2520   <funcdef> <function>DECLARE_COMPLETION_ONSTACK </function></funcdef>
2521   <paramdef> <parameter>work</parameter></paramdef>
2522  </funcprototype></funcsynopsis>
2523</refsynopsisdiv>
2524<refsect1>
2525 <title>Arguments</title>
2526 <variablelist>
2527  <varlistentry>
2528   <term><parameter>work</parameter></term>
2529   <listitem>
2530    <para>
2531     identifier for the completion structure
2532    </para>
2533   </listitem>
2534  </varlistentry>
2535 </variablelist>
2536</refsect1>
2537<refsect1>
2538<title>Description</title>
2539<para>
2540   This macro declares and initializes a completion structure on the kernel
2541   stack.
2542</para>
2543</refsect1>
2544</refentry>
2545
2546<refentry id="API-init-completion">
2547<refentryinfo>
2548 <title>LINUX</title>
2549 <productname>Kernel Hackers Manual</productname>
2550 <date>July 2017</date>
2551</refentryinfo>
2552<refmeta>
2553 <refentrytitle><phrase>init_completion</phrase></refentrytitle>
2554 <manvolnum>9</manvolnum>
2555 <refmiscinfo class="version">4.1.27</refmiscinfo>
2556</refmeta>
2557<refnamediv>
2558 <refname>init_completion</refname>
2559 <refpurpose>
2560     Initialize a dynamically allocated completion
2561 </refpurpose>
2562</refnamediv>
2563<refsynopsisdiv>
2564 <title>Synopsis</title>
2565  <funcsynopsis><funcprototype>
2566   <funcdef>void <function>init_completion </function></funcdef>
2567   <paramdef>struct completion * <parameter>x</parameter></paramdef>
2568  </funcprototype></funcsynopsis>
2569</refsynopsisdiv>
2570<refsect1>
2571 <title>Arguments</title>
2572 <variablelist>
2573  <varlistentry>
2574   <term><parameter>x</parameter></term>
2575   <listitem>
2576    <para>
2577     pointer to completion structure that is to be initialized
2578    </para>
2579   </listitem>
2580  </varlistentry>
2581 </variablelist>
2582</refsect1>
2583<refsect1>
2584<title>Description</title>
2585<para>
2586   This inline function will initialize a dynamically created completion
2587   structure.
2588</para>
2589</refsect1>
2590</refentry>
2591
2592<refentry id="API-reinit-completion">
2593<refentryinfo>
2594 <title>LINUX</title>
2595 <productname>Kernel Hackers Manual</productname>
2596 <date>July 2017</date>
2597</refentryinfo>
2598<refmeta>
2599 <refentrytitle><phrase>reinit_completion</phrase></refentrytitle>
2600 <manvolnum>9</manvolnum>
2601 <refmiscinfo class="version">4.1.27</refmiscinfo>
2602</refmeta>
2603<refnamediv>
2604 <refname>reinit_completion</refname>
2605 <refpurpose>
2606     reinitialize a completion structure
2607 </refpurpose>
2608</refnamediv>
2609<refsynopsisdiv>
2610 <title>Synopsis</title>
2611  <funcsynopsis><funcprototype>
2612   <funcdef>void <function>reinit_completion </function></funcdef>
2613   <paramdef>struct completion * <parameter>x</parameter></paramdef>
2614  </funcprototype></funcsynopsis>
2615</refsynopsisdiv>
2616<refsect1>
2617 <title>Arguments</title>
2618 <variablelist>
2619  <varlistentry>
2620   <term><parameter>x</parameter></term>
2621   <listitem>
2622    <para>
2623     pointer to completion structure that is to be reinitialized
2624    </para>
2625   </listitem>
2626  </varlistentry>
2627 </variablelist>
2628</refsect1>
2629<refsect1>
2630<title>Description</title>
2631<para>
2632   This inline function should be used to reinitialize a completion structure so it can
2633   be reused. This is especially important after <function>complete_all</function> is used.
2634</para>
2635</refsect1>
2636</refentry>
2637
2638<!-- kernel/time/timer.c -->
2639<refentry id="API---round-jiffies">
2640<refentryinfo>
2641 <title>LINUX</title>
2642 <productname>Kernel Hackers Manual</productname>
2643 <date>July 2017</date>
2644</refentryinfo>
2645<refmeta>
2646 <refentrytitle><phrase>__round_jiffies</phrase></refentrytitle>
2647 <manvolnum>9</manvolnum>
2648 <refmiscinfo class="version">4.1.27</refmiscinfo>
2649</refmeta>
2650<refnamediv>
2651 <refname>__round_jiffies</refname>
2652 <refpurpose>
2653  function to round jiffies to a full second
2654 </refpurpose>
2655</refnamediv>
2656<refsynopsisdiv>
2657 <title>Synopsis</title>
2658  <funcsynopsis><funcprototype>
2659   <funcdef>unsigned long <function>__round_jiffies </function></funcdef>
2660   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2661   <paramdef>int <parameter>cpu</parameter></paramdef>
2662  </funcprototype></funcsynopsis>
2663</refsynopsisdiv>
2664<refsect1>
2665 <title>Arguments</title>
2666 <variablelist>
2667  <varlistentry>
2668   <term><parameter>j</parameter></term>
2669   <listitem>
2670    <para>
2671     the time in (absolute) jiffies that should be rounded
2672    </para>
2673   </listitem>
2674  </varlistentry>
2675  <varlistentry>
2676   <term><parameter>cpu</parameter></term>
2677   <listitem>
2678    <para>
2679     the processor number on which the timeout will happen
2680    </para>
2681   </listitem>
2682  </varlistentry>
2683 </variablelist>
2684</refsect1>
2685<refsect1>
2686<title>Description</title>
2687<para>
2688   <function>__round_jiffies</function> rounds an absolute time in the future (in jiffies)
2689   up or down to (approximately) full seconds. This is useful for timers
2690   for which the exact time they fire does not matter too much, as long as
2691   they fire approximately every X seconds.
2692   </para><para>
2693
2694   By rounding these timers to whole seconds, all such timers will fire
2695   at the same time, rather than at various times spread out. The goal
2696   of this is to have the CPU wake up less, which saves power.
2697   </para><para>
2698
2699   The exact rounding is skewed for each processor to avoid all
2700   processors firing at the exact same time, which could lead
2701   to lock contention or spurious cache line bouncing.
2702   </para><para>
2703
2704   The return value is the rounded version of the <parameter>j</parameter> parameter.
2705</para>
2706</refsect1>
2707</refentry>
2708
2709<refentry id="API---round-jiffies-relative">
2710<refentryinfo>
2711 <title>LINUX</title>
2712 <productname>Kernel Hackers Manual</productname>
2713 <date>July 2017</date>
2714</refentryinfo>
2715<refmeta>
2716 <refentrytitle><phrase>__round_jiffies_relative</phrase></refentrytitle>
2717 <manvolnum>9</manvolnum>
2718 <refmiscinfo class="version">4.1.27</refmiscinfo>
2719</refmeta>
2720<refnamediv>
2721 <refname>__round_jiffies_relative</refname>
2722 <refpurpose>
2723     function to round jiffies to a full second
2724 </refpurpose>
2725</refnamediv>
2726<refsynopsisdiv>
2727 <title>Synopsis</title>
2728  <funcsynopsis><funcprototype>
2729   <funcdef>unsigned long <function>__round_jiffies_relative </function></funcdef>
2730   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2731   <paramdef>int <parameter>cpu</parameter></paramdef>
2732  </funcprototype></funcsynopsis>
2733</refsynopsisdiv>
2734<refsect1>
2735 <title>Arguments</title>
2736 <variablelist>
2737  <varlistentry>
2738   <term><parameter>j</parameter></term>
2739   <listitem>
2740    <para>
2741     the time in (relative) jiffies that should be rounded
2742    </para>
2743   </listitem>
2744  </varlistentry>
2745  <varlistentry>
2746   <term><parameter>cpu</parameter></term>
2747   <listitem>
2748    <para>
2749     the processor number on which the timeout will happen
2750    </para>
2751   </listitem>
2752  </varlistentry>
2753 </variablelist>
2754</refsect1>
2755<refsect1>
2756<title>Description</title>
2757<para>
2758   <function>__round_jiffies_relative</function> rounds a time delta  in the future (in jiffies)
2759   up or down to (approximately) full seconds. This is useful for timers
2760   for which the exact time they fire does not matter too much, as long as
2761   they fire approximately every X seconds.
2762   </para><para>
2763
2764   By rounding these timers to whole seconds, all such timers will fire
2765   at the same time, rather than at various times spread out. The goal
2766   of this is to have the CPU wake up less, which saves power.
2767   </para><para>
2768
2769   The exact rounding is skewed for each processor to avoid all
2770   processors firing at the exact same time, which could lead
2771   to lock contention or spurious cache line bouncing.
2772   </para><para>
2773
2774   The return value is the rounded version of the <parameter>j</parameter> parameter.
2775</para>
2776</refsect1>
2777</refentry>
2778
2779<refentry id="API-round-jiffies">
2780<refentryinfo>
2781 <title>LINUX</title>
2782 <productname>Kernel Hackers Manual</productname>
2783 <date>July 2017</date>
2784</refentryinfo>
2785<refmeta>
2786 <refentrytitle><phrase>round_jiffies</phrase></refentrytitle>
2787 <manvolnum>9</manvolnum>
2788 <refmiscinfo class="version">4.1.27</refmiscinfo>
2789</refmeta>
2790<refnamediv>
2791 <refname>round_jiffies</refname>
2792 <refpurpose>
2793     function to round jiffies to a full second
2794 </refpurpose>
2795</refnamediv>
2796<refsynopsisdiv>
2797 <title>Synopsis</title>
2798  <funcsynopsis><funcprototype>
2799   <funcdef>unsigned long <function>round_jiffies </function></funcdef>
2800   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2801  </funcprototype></funcsynopsis>
2802</refsynopsisdiv>
2803<refsect1>
2804 <title>Arguments</title>
2805 <variablelist>
2806  <varlistentry>
2807   <term><parameter>j</parameter></term>
2808   <listitem>
2809    <para>
2810     the time in (absolute) jiffies that should be rounded
2811    </para>
2812   </listitem>
2813  </varlistentry>
2814 </variablelist>
2815</refsect1>
2816<refsect1>
2817<title>Description</title>
2818<para>
2819   <function>round_jiffies</function> rounds an absolute time in the future (in jiffies)
2820   up or down to (approximately) full seconds. This is useful for timers
2821   for which the exact time they fire does not matter too much, as long as
2822   they fire approximately every X seconds.
2823   </para><para>
2824
2825   By rounding these timers to whole seconds, all such timers will fire
2826   at the same time, rather than at various times spread out. The goal
2827   of this is to have the CPU wake up less, which saves power.
2828   </para><para>
2829
2830   The return value is the rounded version of the <parameter>j</parameter> parameter.
2831</para>
2832</refsect1>
2833</refentry>
2834
2835<refentry id="API-round-jiffies-relative">
2836<refentryinfo>
2837 <title>LINUX</title>
2838 <productname>Kernel Hackers Manual</productname>
2839 <date>July 2017</date>
2840</refentryinfo>
2841<refmeta>
2842 <refentrytitle><phrase>round_jiffies_relative</phrase></refentrytitle>
2843 <manvolnum>9</manvolnum>
2844 <refmiscinfo class="version">4.1.27</refmiscinfo>
2845</refmeta>
2846<refnamediv>
2847 <refname>round_jiffies_relative</refname>
2848 <refpurpose>
2849     function to round jiffies to a full second
2850 </refpurpose>
2851</refnamediv>
2852<refsynopsisdiv>
2853 <title>Synopsis</title>
2854  <funcsynopsis><funcprototype>
2855   <funcdef>unsigned long <function>round_jiffies_relative </function></funcdef>
2856   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2857  </funcprototype></funcsynopsis>
2858</refsynopsisdiv>
2859<refsect1>
2860 <title>Arguments</title>
2861 <variablelist>
2862  <varlistentry>
2863   <term><parameter>j</parameter></term>
2864   <listitem>
2865    <para>
2866     the time in (relative) jiffies that should be rounded
2867    </para>
2868   </listitem>
2869  </varlistentry>
2870 </variablelist>
2871</refsect1>
2872<refsect1>
2873<title>Description</title>
2874<para>
2875   <function>round_jiffies_relative</function> rounds a time delta  in the future (in jiffies)
2876   up or down to (approximately) full seconds. This is useful for timers
2877   for which the exact time they fire does not matter too much, as long as
2878   they fire approximately every X seconds.
2879   </para><para>
2880
2881   By rounding these timers to whole seconds, all such timers will fire
2882   at the same time, rather than at various times spread out. The goal
2883   of this is to have the CPU wake up less, which saves power.
2884   </para><para>
2885
2886   The return value is the rounded version of the <parameter>j</parameter> parameter.
2887</para>
2888</refsect1>
2889</refentry>
2890
2891<refentry id="API---round-jiffies-up">
2892<refentryinfo>
2893 <title>LINUX</title>
2894 <productname>Kernel Hackers Manual</productname>
2895 <date>July 2017</date>
2896</refentryinfo>
2897<refmeta>
2898 <refentrytitle><phrase>__round_jiffies_up</phrase></refentrytitle>
2899 <manvolnum>9</manvolnum>
2900 <refmiscinfo class="version">4.1.27</refmiscinfo>
2901</refmeta>
2902<refnamediv>
2903 <refname>__round_jiffies_up</refname>
2904 <refpurpose>
2905     function to round jiffies up to a full second
2906 </refpurpose>
2907</refnamediv>
2908<refsynopsisdiv>
2909 <title>Synopsis</title>
2910  <funcsynopsis><funcprototype>
2911   <funcdef>unsigned long <function>__round_jiffies_up </function></funcdef>
2912   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2913   <paramdef>int <parameter>cpu</parameter></paramdef>
2914  </funcprototype></funcsynopsis>
2915</refsynopsisdiv>
2916<refsect1>
2917 <title>Arguments</title>
2918 <variablelist>
2919  <varlistentry>
2920   <term><parameter>j</parameter></term>
2921   <listitem>
2922    <para>
2923     the time in (absolute) jiffies that should be rounded
2924    </para>
2925   </listitem>
2926  </varlistentry>
2927  <varlistentry>
2928   <term><parameter>cpu</parameter></term>
2929   <listitem>
2930    <para>
2931     the processor number on which the timeout will happen
2932    </para>
2933   </listitem>
2934  </varlistentry>
2935 </variablelist>
2936</refsect1>
2937<refsect1>
2938<title>Description</title>
2939<para>
2940   This is the same as <function>__round_jiffies</function> except that it will never
2941   round down.  This is useful for timeouts for which the exact time
2942   of firing does not matter too much, as long as they don't fire too
2943   early.
2944</para>
2945</refsect1>
2946</refentry>
2947
2948<refentry id="API---round-jiffies-up-relative">
2949<refentryinfo>
2950 <title>LINUX</title>
2951 <productname>Kernel Hackers Manual</productname>
2952 <date>July 2017</date>
2953</refentryinfo>
2954<refmeta>
2955 <refentrytitle><phrase>__round_jiffies_up_relative</phrase></refentrytitle>
2956 <manvolnum>9</manvolnum>
2957 <refmiscinfo class="version">4.1.27</refmiscinfo>
2958</refmeta>
2959<refnamediv>
2960 <refname>__round_jiffies_up_relative</refname>
2961 <refpurpose>
2962     function to round jiffies up to a full second
2963 </refpurpose>
2964</refnamediv>
2965<refsynopsisdiv>
2966 <title>Synopsis</title>
2967  <funcsynopsis><funcprototype>
2968   <funcdef>unsigned long <function>__round_jiffies_up_relative </function></funcdef>
2969   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2970   <paramdef>int <parameter>cpu</parameter></paramdef>
2971  </funcprototype></funcsynopsis>
2972</refsynopsisdiv>
2973<refsect1>
2974 <title>Arguments</title>
2975 <variablelist>
2976  <varlistentry>
2977   <term><parameter>j</parameter></term>
2978   <listitem>
2979    <para>
2980     the time in (relative) jiffies that should be rounded
2981    </para>
2982   </listitem>
2983  </varlistentry>
2984  <varlistentry>
2985   <term><parameter>cpu</parameter></term>
2986   <listitem>
2987    <para>
2988     the processor number on which the timeout will happen
2989    </para>
2990   </listitem>
2991  </varlistentry>
2992 </variablelist>
2993</refsect1>
2994<refsect1>
2995<title>Description</title>
2996<para>
2997   This is the same as <function>__round_jiffies_relative</function> except that it will never
2998   round down.  This is useful for timeouts for which the exact time
2999   of firing does not matter too much, as long as they don't fire too
3000   early.
3001</para>
3002</refsect1>
3003</refentry>
3004
3005<refentry id="API-round-jiffies-up">
3006<refentryinfo>
3007 <title>LINUX</title>
3008 <productname>Kernel Hackers Manual</productname>
3009 <date>July 2017</date>
3010</refentryinfo>
3011<refmeta>
3012 <refentrytitle><phrase>round_jiffies_up</phrase></refentrytitle>
3013 <manvolnum>9</manvolnum>
3014 <refmiscinfo class="version">4.1.27</refmiscinfo>
3015</refmeta>
3016<refnamediv>
3017 <refname>round_jiffies_up</refname>
3018 <refpurpose>
3019     function to round jiffies up to a full second
3020 </refpurpose>
3021</refnamediv>
3022<refsynopsisdiv>
3023 <title>Synopsis</title>
3024  <funcsynopsis><funcprototype>
3025   <funcdef>unsigned long <function>round_jiffies_up </function></funcdef>
3026   <paramdef>unsigned long <parameter>j</parameter></paramdef>
3027  </funcprototype></funcsynopsis>
3028</refsynopsisdiv>
3029<refsect1>
3030 <title>Arguments</title>
3031 <variablelist>
3032  <varlistentry>
3033   <term><parameter>j</parameter></term>
3034   <listitem>
3035    <para>
3036     the time in (absolute) jiffies that should be rounded
3037    </para>
3038   </listitem>
3039  </varlistentry>
3040 </variablelist>
3041</refsect1>
3042<refsect1>
3043<title>Description</title>
3044<para>
3045   This is the same as <function>round_jiffies</function> except that it will never
3046   round down.  This is useful for timeouts for which the exact time
3047   of firing does not matter too much, as long as they don't fire too
3048   early.
3049</para>
3050</refsect1>
3051</refentry>
3052
3053<refentry id="API-round-jiffies-up-relative">
3054<refentryinfo>
3055 <title>LINUX</title>
3056 <productname>Kernel Hackers Manual</productname>
3057 <date>July 2017</date>
3058</refentryinfo>
3059<refmeta>
3060 <refentrytitle><phrase>round_jiffies_up_relative</phrase></refentrytitle>
3061 <manvolnum>9</manvolnum>
3062 <refmiscinfo class="version">4.1.27</refmiscinfo>
3063</refmeta>
3064<refnamediv>
3065 <refname>round_jiffies_up_relative</refname>
3066 <refpurpose>
3067     function to round jiffies up to a full second
3068 </refpurpose>
3069</refnamediv>
3070<refsynopsisdiv>
3071 <title>Synopsis</title>
3072  <funcsynopsis><funcprototype>
3073   <funcdef>unsigned long <function>round_jiffies_up_relative </function></funcdef>
3074   <paramdef>unsigned long <parameter>j</parameter></paramdef>
3075  </funcprototype></funcsynopsis>
3076</refsynopsisdiv>
3077<refsect1>
3078 <title>Arguments</title>
3079 <variablelist>
3080  <varlistentry>
3081   <term><parameter>j</parameter></term>
3082   <listitem>
3083    <para>
3084     the time in (relative) jiffies that should be rounded
3085    </para>
3086   </listitem>
3087  </varlistentry>
3088 </variablelist>
3089</refsect1>
3090<refsect1>
3091<title>Description</title>
3092<para>
3093   This is the same as <function>round_jiffies_relative</function> except that it will never
3094   round down.  This is useful for timeouts for which the exact time
3095   of firing does not matter too much, as long as they don't fire too
3096   early.
3097</para>
3098</refsect1>
3099</refentry>
3100
3101<refentry id="API-set-timer-slack">
3102<refentryinfo>
3103 <title>LINUX</title>
3104 <productname>Kernel Hackers Manual</productname>
3105 <date>July 2017</date>
3106</refentryinfo>
3107<refmeta>
3108 <refentrytitle><phrase>set_timer_slack</phrase></refentrytitle>
3109 <manvolnum>9</manvolnum>
3110 <refmiscinfo class="version">4.1.27</refmiscinfo>
3111</refmeta>
3112<refnamediv>
3113 <refname>set_timer_slack</refname>
3114 <refpurpose>
3115     set the allowed slack for a timer
3116 </refpurpose>
3117</refnamediv>
3118<refsynopsisdiv>
3119 <title>Synopsis</title>
3120  <funcsynopsis><funcprototype>
3121   <funcdef>void <function>set_timer_slack </function></funcdef>
3122   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3123   <paramdef>int <parameter>slack_hz</parameter></paramdef>
3124  </funcprototype></funcsynopsis>
3125</refsynopsisdiv>
3126<refsect1>
3127 <title>Arguments</title>
3128 <variablelist>
3129  <varlistentry>
3130   <term><parameter>timer</parameter></term>
3131   <listitem>
3132    <para>
3133     the timer to be modified
3134    </para>
3135   </listitem>
3136  </varlistentry>
3137  <varlistentry>
3138   <term><parameter>slack_hz</parameter></term>
3139   <listitem>
3140    <para>
3141     the amount of time (in jiffies) allowed for rounding
3142    </para>
3143   </listitem>
3144  </varlistentry>
3145 </variablelist>
3146</refsect1>
3147<refsect1>
3148<title>Description</title>
3149<para>
3150   Set the amount of time, in jiffies, that a certain timer has
3151   in terms of slack. By setting this value, the timer subsystem
3152   will schedule the actual timer somewhere between
3153   the time <function>mod_timer</function> asks for, and that time plus the slack.
3154   </para><para>
3155
3156   By setting the slack to -1, a percentage of the delay is used
3157   instead.
3158</para>
3159</refsect1>
3160</refentry>
3161
3162<refentry id="API-init-timer-key">
3163<refentryinfo>
3164 <title>LINUX</title>
3165 <productname>Kernel Hackers Manual</productname>
3166 <date>July 2017</date>
3167</refentryinfo>
3168<refmeta>
3169 <refentrytitle><phrase>init_timer_key</phrase></refentrytitle>
3170 <manvolnum>9</manvolnum>
3171 <refmiscinfo class="version">4.1.27</refmiscinfo>
3172</refmeta>
3173<refnamediv>
3174 <refname>init_timer_key</refname>
3175 <refpurpose>
3176     initialize a timer
3177 </refpurpose>
3178</refnamediv>
3179<refsynopsisdiv>
3180 <title>Synopsis</title>
3181  <funcsynopsis><funcprototype>
3182   <funcdef>void <function>init_timer_key </function></funcdef>
3183   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3184   <paramdef>unsigned int <parameter>flags</parameter></paramdef>
3185   <paramdef>const char * <parameter>name</parameter></paramdef>
3186   <paramdef>struct lock_class_key * <parameter>key</parameter></paramdef>
3187  </funcprototype></funcsynopsis>
3188</refsynopsisdiv>
3189<refsect1>
3190 <title>Arguments</title>
3191 <variablelist>
3192  <varlistentry>
3193   <term><parameter>timer</parameter></term>
3194   <listitem>
3195    <para>
3196     the timer to be initialized
3197    </para>
3198   </listitem>
3199  </varlistentry>
3200  <varlistentry>
3201   <term><parameter>flags</parameter></term>
3202   <listitem>
3203    <para>
3204     timer flags
3205    </para>
3206   </listitem>
3207  </varlistentry>
3208  <varlistentry>
3209   <term><parameter>name</parameter></term>
3210   <listitem>
3211    <para>
3212     name of the timer
3213    </para>
3214   </listitem>
3215  </varlistentry>
3216  <varlistentry>
3217   <term><parameter>key</parameter></term>
3218   <listitem>
3219    <para>
3220     lockdep class key of the fake lock used for tracking timer
3221     sync lock dependencies
3222    </para>
3223   </listitem>
3224  </varlistentry>
3225 </variablelist>
3226</refsect1>
3227<refsect1>
3228<title>Description</title>
3229<para>
3230   <function>init_timer_key</function> must be done to a timer prior calling *any* of the
3231   other timer functions.
3232</para>
3233</refsect1>
3234</refentry>
3235
3236<refentry id="API-mod-timer-pending">
3237<refentryinfo>
3238 <title>LINUX</title>
3239 <productname>Kernel Hackers Manual</productname>
3240 <date>July 2017</date>
3241</refentryinfo>
3242<refmeta>
3243 <refentrytitle><phrase>mod_timer_pending</phrase></refentrytitle>
3244 <manvolnum>9</manvolnum>
3245 <refmiscinfo class="version">4.1.27</refmiscinfo>
3246</refmeta>
3247<refnamediv>
3248 <refname>mod_timer_pending</refname>
3249 <refpurpose>
3250     modify a pending timer's timeout
3251 </refpurpose>
3252</refnamediv>
3253<refsynopsisdiv>
3254 <title>Synopsis</title>
3255  <funcsynopsis><funcprototype>
3256   <funcdef>int <function>mod_timer_pending </function></funcdef>
3257   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3258   <paramdef>unsigned long <parameter>expires</parameter></paramdef>
3259  </funcprototype></funcsynopsis>
3260</refsynopsisdiv>
3261<refsect1>
3262 <title>Arguments</title>
3263 <variablelist>
3264  <varlistentry>
3265   <term><parameter>timer</parameter></term>
3266   <listitem>
3267    <para>
3268     the pending timer to be modified
3269    </para>
3270   </listitem>
3271  </varlistentry>
3272  <varlistentry>
3273   <term><parameter>expires</parameter></term>
3274   <listitem>
3275    <para>
3276     new timeout in jiffies
3277    </para>
3278   </listitem>
3279  </varlistentry>
3280 </variablelist>
3281</refsect1>
3282<refsect1>
3283<title>Description</title>
3284<para>
3285   <function>mod_timer_pending</function> is the same for pending timers as <function>mod_timer</function>,
3286   but will not re-activate and modify already deleted timers.
3287   </para><para>
3288
3289   It is useful for unserialized use of timers.
3290</para>
3291</refsect1>
3292</refentry>
3293
3294<refentry id="API-mod-timer">
3295<refentryinfo>
3296 <title>LINUX</title>
3297 <productname>Kernel Hackers Manual</productname>
3298 <date>July 2017</date>
3299</refentryinfo>
3300<refmeta>
3301 <refentrytitle><phrase>mod_timer</phrase></refentrytitle>
3302 <manvolnum>9</manvolnum>
3303 <refmiscinfo class="version">4.1.27</refmiscinfo>
3304</refmeta>
3305<refnamediv>
3306 <refname>mod_timer</refname>
3307 <refpurpose>
3308     modify a timer's timeout
3309 </refpurpose>
3310</refnamediv>
3311<refsynopsisdiv>
3312 <title>Synopsis</title>
3313  <funcsynopsis><funcprototype>
3314   <funcdef>int <function>mod_timer </function></funcdef>
3315   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3316   <paramdef>unsigned long <parameter>expires</parameter></paramdef>
3317  </funcprototype></funcsynopsis>
3318</refsynopsisdiv>
3319<refsect1>
3320 <title>Arguments</title>
3321 <variablelist>
3322  <varlistentry>
3323   <term><parameter>timer</parameter></term>
3324   <listitem>
3325    <para>
3326     the timer to be modified
3327    </para>
3328   </listitem>
3329  </varlistentry>
3330  <varlistentry>
3331   <term><parameter>expires</parameter></term>
3332   <listitem>
3333    <para>
3334     new timeout in jiffies
3335    </para>
3336   </listitem>
3337  </varlistentry>
3338 </variablelist>
3339</refsect1>
3340<refsect1>
3341<title>Description</title>
3342<para>
3343   <function>mod_timer</function> is a more efficient way to update the expire field of an
3344   active timer (if the timer is inactive it will be activated)
3345   </para><para>
3346
3347   mod_timer(timer, expires) is equivalent to:
3348   </para><para>
3349
3350   del_timer(timer); timer-&gt;expires = expires; add_timer(timer);
3351   </para><para>
3352
3353   Note that if there are multiple unserialized concurrent users of the
3354   same timer, then <function>mod_timer</function> is the only safe way to modify the timeout,
3355   since <function>add_timer</function> cannot modify an already running timer.
3356   </para><para>
3357
3358   The function returns whether it has modified a pending timer or not.
3359   (ie. <function>mod_timer</function> of an inactive timer returns 0, <function>mod_timer</function> of an
3360   active timer returns 1.)
3361</para>
3362</refsect1>
3363</refentry>
3364
3365<refentry id="API-mod-timer-pinned">
3366<refentryinfo>
3367 <title>LINUX</title>
3368 <productname>Kernel Hackers Manual</productname>
3369 <date>July 2017</date>
3370</refentryinfo>
3371<refmeta>
3372 <refentrytitle><phrase>mod_timer_pinned</phrase></refentrytitle>
3373 <manvolnum>9</manvolnum>
3374 <refmiscinfo class="version">4.1.27</refmiscinfo>
3375</refmeta>
3376<refnamediv>
3377 <refname>mod_timer_pinned</refname>
3378 <refpurpose>
3379     modify a timer's timeout
3380 </refpurpose>
3381</refnamediv>
3382<refsynopsisdiv>
3383 <title>Synopsis</title>
3384  <funcsynopsis><funcprototype>
3385   <funcdef>int <function>mod_timer_pinned </function></funcdef>
3386   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3387   <paramdef>unsigned long <parameter>expires</parameter></paramdef>
3388  </funcprototype></funcsynopsis>
3389</refsynopsisdiv>
3390<refsect1>
3391 <title>Arguments</title>
3392 <variablelist>
3393  <varlistentry>
3394   <term><parameter>timer</parameter></term>
3395   <listitem>
3396    <para>
3397     the timer to be modified
3398    </para>
3399   </listitem>
3400  </varlistentry>
3401  <varlistentry>
3402   <term><parameter>expires</parameter></term>
3403   <listitem>
3404    <para>
3405     new timeout in jiffies
3406    </para>
3407   </listitem>
3408  </varlistentry>
3409 </variablelist>
3410</refsect1>
3411<refsect1>
3412<title>Description</title>
3413<para>
3414   <function>mod_timer_pinned</function> is a way to update the expire field of an
3415   active timer (if the timer is inactive it will be activated)
3416   and to ensure that the timer is scheduled on the current CPU.
3417   </para><para>
3418
3419   Note that this does not prevent the timer from being migrated
3420   when the current CPU goes offline.  If this is a problem for
3421   you, use CPU-hotplug notifiers to handle it correctly, for
3422   example, cancelling the timer when the corresponding CPU goes
3423   offline.
3424   </para><para>
3425
3426   mod_timer_pinned(timer, expires) is equivalent to:
3427   </para><para>
3428
3429   del_timer(timer); timer-&gt;expires = expires; add_timer(timer);
3430</para>
3431</refsect1>
3432</refentry>
3433
3434<refentry id="API-add-timer">
3435<refentryinfo>
3436 <title>LINUX</title>
3437 <productname>Kernel Hackers Manual</productname>
3438 <date>July 2017</date>
3439</refentryinfo>
3440<refmeta>
3441 <refentrytitle><phrase>add_timer</phrase></refentrytitle>
3442 <manvolnum>9</manvolnum>
3443 <refmiscinfo class="version">4.1.27</refmiscinfo>
3444</refmeta>
3445<refnamediv>
3446 <refname>add_timer</refname>
3447 <refpurpose>
3448     start a timer
3449 </refpurpose>
3450</refnamediv>
3451<refsynopsisdiv>
3452 <title>Synopsis</title>
3453  <funcsynopsis><funcprototype>
3454   <funcdef>void <function>add_timer </function></funcdef>
3455   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3456  </funcprototype></funcsynopsis>
3457</refsynopsisdiv>
3458<refsect1>
3459 <title>Arguments</title>
3460 <variablelist>
3461  <varlistentry>
3462   <term><parameter>timer</parameter></term>
3463   <listitem>
3464    <para>
3465     the timer to be added
3466    </para>
3467   </listitem>
3468  </varlistentry>
3469 </variablelist>
3470</refsect1>
3471<refsect1>
3472<title>Description</title>
3473<para>
3474   The kernel will do a -&gt;function(-&gt;data) callback from the
3475   timer interrupt at the -&gt;expires point in the future. The
3476   current time is 'jiffies'.
3477   </para><para>
3478
3479   The timer's -&gt;expires, -&gt;function (and if the handler uses it, -&gt;data)
3480   fields must be set prior calling this function.
3481   </para><para>
3482
3483   Timers with an -&gt;expires field in the past will be executed in the next
3484   timer tick.
3485</para>
3486</refsect1>
3487</refentry>
3488
3489<refentry id="API-add-timer-on">
3490<refentryinfo>
3491 <title>LINUX</title>
3492 <productname>Kernel Hackers Manual</productname>
3493 <date>July 2017</date>
3494</refentryinfo>
3495<refmeta>
3496 <refentrytitle><phrase>add_timer_on</phrase></refentrytitle>
3497 <manvolnum>9</manvolnum>
3498 <refmiscinfo class="version">4.1.27</refmiscinfo>
3499</refmeta>
3500<refnamediv>
3501 <refname>add_timer_on</refname>
3502 <refpurpose>
3503     start a timer on a particular CPU
3504 </refpurpose>
3505</refnamediv>
3506<refsynopsisdiv>
3507 <title>Synopsis</title>
3508  <funcsynopsis><funcprototype>
3509   <funcdef>void <function>add_timer_on </function></funcdef>
3510   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3511   <paramdef>int <parameter>cpu</parameter></paramdef>
3512  </funcprototype></funcsynopsis>
3513</refsynopsisdiv>
3514<refsect1>
3515 <title>Arguments</title>
3516 <variablelist>
3517  <varlistentry>
3518   <term><parameter>timer</parameter></term>
3519   <listitem>
3520    <para>
3521     the timer to be added
3522    </para>
3523   </listitem>
3524  </varlistentry>
3525  <varlistentry>
3526   <term><parameter>cpu</parameter></term>
3527   <listitem>
3528    <para>
3529     the CPU to start it on
3530    </para>
3531   </listitem>
3532  </varlistentry>
3533 </variablelist>
3534</refsect1>
3535<refsect1>
3536<title>Description</title>
3537<para>
3538   This is not very scalable on SMP. Double adds are not possible.
3539</para>
3540</refsect1>
3541</refentry>
3542
3543<refentry id="API-del-timer">
3544<refentryinfo>
3545 <title>LINUX</title>
3546 <productname>Kernel Hackers Manual</productname>
3547 <date>July 2017</date>
3548</refentryinfo>
3549<refmeta>
3550 <refentrytitle><phrase>del_timer</phrase></refentrytitle>
3551 <manvolnum>9</manvolnum>
3552 <refmiscinfo class="version">4.1.27</refmiscinfo>
3553</refmeta>
3554<refnamediv>
3555 <refname>del_timer</refname>
3556 <refpurpose>
3557     deactive a timer.
3558 </refpurpose>
3559</refnamediv>
3560<refsynopsisdiv>
3561 <title>Synopsis</title>
3562  <funcsynopsis><funcprototype>
3563   <funcdef>int <function>del_timer </function></funcdef>
3564   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3565  </funcprototype></funcsynopsis>
3566</refsynopsisdiv>
3567<refsect1>
3568 <title>Arguments</title>
3569 <variablelist>
3570  <varlistentry>
3571   <term><parameter>timer</parameter></term>
3572   <listitem>
3573    <para>
3574     the timer to be deactivated
3575    </para>
3576   </listitem>
3577  </varlistentry>
3578 </variablelist>
3579</refsect1>
3580<refsect1>
3581<title>Description</title>
3582<para>
3583   <function>del_timer</function> deactivates a timer - this works on both active and inactive
3584   timers.
3585   </para><para>
3586
3587   The function returns whether it has deactivated a pending timer or not.
3588   (ie. <function>del_timer</function> of an inactive timer returns 0, <function>del_timer</function> of an
3589   active timer returns 1.)
3590</para>
3591</refsect1>
3592</refentry>
3593
3594<refentry id="API-try-to-del-timer-sync">
3595<refentryinfo>
3596 <title>LINUX</title>
3597 <productname>Kernel Hackers Manual</productname>
3598 <date>July 2017</date>
3599</refentryinfo>
3600<refmeta>
3601 <refentrytitle><phrase>try_to_del_timer_sync</phrase></refentrytitle>
3602 <manvolnum>9</manvolnum>
3603 <refmiscinfo class="version">4.1.27</refmiscinfo>
3604</refmeta>
3605<refnamediv>
3606 <refname>try_to_del_timer_sync</refname>
3607 <refpurpose>
3608     Try to deactivate a timer
3609 </refpurpose>
3610</refnamediv>
3611<refsynopsisdiv>
3612 <title>Synopsis</title>
3613  <funcsynopsis><funcprototype>
3614   <funcdef>int <function>try_to_del_timer_sync </function></funcdef>
3615   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3616  </funcprototype></funcsynopsis>
3617</refsynopsisdiv>
3618<refsect1>
3619 <title>Arguments</title>
3620 <variablelist>
3621  <varlistentry>
3622   <term><parameter>timer</parameter></term>
3623   <listitem>
3624    <para>
3625     timer do del
3626    </para>
3627   </listitem>
3628  </varlistentry>
3629 </variablelist>
3630</refsect1>
3631<refsect1>
3632<title>Description</title>
3633<para>
3634   This function tries to deactivate a timer. Upon successful (ret &gt;= 0)
3635   exit the timer is not queued and the handler is not running on any CPU.
3636</para>
3637</refsect1>
3638</refentry>
3639
3640<refentry id="API-del-timer-sync">
3641<refentryinfo>
3642 <title>LINUX</title>
3643 <productname>Kernel Hackers Manual</productname>
3644 <date>July 2017</date>
3645</refentryinfo>
3646<refmeta>
3647 <refentrytitle><phrase>del_timer_sync</phrase></refentrytitle>
3648 <manvolnum>9</manvolnum>
3649 <refmiscinfo class="version">4.1.27</refmiscinfo>
3650</refmeta>
3651<refnamediv>
3652 <refname>del_timer_sync</refname>
3653 <refpurpose>
3654     deactivate a timer and wait for the handler to finish.
3655 </refpurpose>
3656</refnamediv>
3657<refsynopsisdiv>
3658 <title>Synopsis</title>
3659  <funcsynopsis><funcprototype>
3660   <funcdef>int <function>del_timer_sync </function></funcdef>
3661   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3662  </funcprototype></funcsynopsis>
3663</refsynopsisdiv>
3664<refsect1>
3665 <title>Arguments</title>
3666 <variablelist>
3667  <varlistentry>
3668   <term><parameter>timer</parameter></term>
3669   <listitem>
3670    <para>
3671     the timer to be deactivated
3672    </para>
3673   </listitem>
3674  </varlistentry>
3675 </variablelist>
3676</refsect1>
3677<refsect1>
3678<title>Description</title>
3679<para>
3680   This function only differs from <function>del_timer</function> on SMP: besides deactivating
3681   the timer it also makes sure the handler has finished executing on other
3682   CPUs.
3683</para>
3684</refsect1>
3685<refsect1>
3686<title>Synchronization rules</title>
3687<para>
3688   Callers must prevent restarting of the timer,
3689   otherwise this function is meaningless. It must not be called from
3690   interrupt contexts unless the timer is an irqsafe one. The caller must
3691   not hold locks which would prevent completion of the timer's
3692   handler. The timer's handler must not call <function>add_timer_on</function>. Upon exit the
3693   timer is not queued and the handler is not running on any CPU.
3694</para>
3695</refsect1>
3696<refsect1>
3697<title>Note</title>
3698<para>
3699   For !irqsafe timers, you must not hold locks that are held in
3700   interrupt context while calling this function. Even if the lock has
3701   nothing to do with the timer in question.  Here's why:
3702   </para><para>
3703
3704   CPU0                             CPU1
3705   ----                             ----
3706   &lt;SOFTIRQ&gt;
3707   <function>call_timer_fn</function>;
3708   base-&gt;running_timer = mytimer;
3709   spin_lock_irq(somelock);
3710   &lt;IRQ&gt;
3711   spin_lock(somelock);
3712   del_timer_sync(mytimer);
3713   while (base-&gt;running_timer == mytimer);
3714   </para><para>
3715
3716   Now <function>del_timer_sync</function> will never return and never release somelock.
3717   The interrupt on the other CPU is waiting to grab somelock but
3718   it has interrupted the softirq that CPU0 is waiting to finish.
3719   </para><para>
3720
3721   The function returns whether it has deactivated a pending timer or not.
3722</para>
3723</refsect1>
3724</refentry>
3725
3726<refentry id="API-schedule-timeout">
3727<refentryinfo>
3728 <title>LINUX</title>
3729 <productname>Kernel Hackers Manual</productname>
3730 <date>July 2017</date>
3731</refentryinfo>
3732<refmeta>
3733 <refentrytitle><phrase>schedule_timeout</phrase></refentrytitle>
3734 <manvolnum>9</manvolnum>
3735 <refmiscinfo class="version">4.1.27</refmiscinfo>
3736</refmeta>
3737<refnamediv>
3738 <refname>schedule_timeout</refname>
3739 <refpurpose>
3740     sleep until timeout
3741 </refpurpose>
3742</refnamediv>
3743<refsynopsisdiv>
3744 <title>Synopsis</title>
3745  <funcsynopsis><funcprototype>
3746   <funcdef>signed long __sched <function>schedule_timeout </function></funcdef>
3747   <paramdef>signed long <parameter>timeout</parameter></paramdef>
3748  </funcprototype></funcsynopsis>
3749</refsynopsisdiv>
3750<refsect1>
3751 <title>Arguments</title>
3752 <variablelist>
3753  <varlistentry>
3754   <term><parameter>timeout</parameter></term>
3755   <listitem>
3756    <para>
3757     timeout value in jiffies
3758    </para>
3759   </listitem>
3760  </varlistentry>
3761 </variablelist>
3762</refsect1>
3763<refsect1>
3764<title>Description</title>
3765<para>
3766   Make the current task sleep until <parameter>timeout</parameter> jiffies have
3767   elapsed. The routine will return immediately unless
3768   the current task state has been set (see <function>set_current_state</function>).
3769   </para><para>
3770
3771   You can set the task state as follows -
3772   </para><para>
3773
3774   <constant>TASK_UNINTERRUPTIBLE</constant> - at least <parameter>timeout</parameter> jiffies are guaranteed to
3775   pass before the routine returns. The routine will return 0
3776   </para><para>
3777
3778   <constant>TASK_INTERRUPTIBLE</constant> - the routine may return early if a signal is
3779   delivered to the current task. In this case the remaining time
3780   in jiffies will be returned, or 0 if the timer expired in time
3781   </para><para>
3782
3783   The current task state is guaranteed to be TASK_RUNNING when this
3784   routine returns.
3785   </para><para>
3786
3787   Specifying a <parameter>timeout</parameter> value of <constant>MAX_SCHEDULE_TIMEOUT</constant> will schedule
3788   the CPU away without a bound on the timeout. In this case the return
3789   value will be <constant>MAX_SCHEDULE_TIMEOUT</constant>.
3790   </para><para>
3791
3792   In all cases the return value is guaranteed to be non-negative.
3793</para>
3794</refsect1>
3795</refentry>
3796
3797<refentry id="API-msleep">
3798<refentryinfo>
3799 <title>LINUX</title>
3800 <productname>Kernel Hackers Manual</productname>
3801 <date>July 2017</date>
3802</refentryinfo>
3803<refmeta>
3804 <refentrytitle><phrase>msleep</phrase></refentrytitle>
3805 <manvolnum>9</manvolnum>
3806 <refmiscinfo class="version">4.1.27</refmiscinfo>
3807</refmeta>
3808<refnamediv>
3809 <refname>msleep</refname>
3810 <refpurpose>
3811     sleep safely even with waitqueue interruptions
3812 </refpurpose>
3813</refnamediv>
3814<refsynopsisdiv>
3815 <title>Synopsis</title>
3816  <funcsynopsis><funcprototype>
3817   <funcdef>void <function>msleep </function></funcdef>
3818   <paramdef>unsigned int <parameter>msecs</parameter></paramdef>
3819  </funcprototype></funcsynopsis>
3820</refsynopsisdiv>
3821<refsect1>
3822 <title>Arguments</title>
3823 <variablelist>
3824  <varlistentry>
3825   <term><parameter>msecs</parameter></term>
3826   <listitem>
3827    <para>
3828     Time in milliseconds to sleep for
3829    </para>
3830   </listitem>
3831  </varlistentry>
3832 </variablelist>
3833</refsect1>
3834</refentry>
3835
3836<refentry id="API-msleep-interruptible">
3837<refentryinfo>
3838 <title>LINUX</title>
3839 <productname>Kernel Hackers Manual</productname>
3840 <date>July 2017</date>
3841</refentryinfo>
3842<refmeta>
3843 <refentrytitle><phrase>msleep_interruptible</phrase></refentrytitle>
3844 <manvolnum>9</manvolnum>
3845 <refmiscinfo class="version">4.1.27</refmiscinfo>
3846</refmeta>
3847<refnamediv>
3848 <refname>msleep_interruptible</refname>
3849 <refpurpose>
3850     sleep waiting for signals
3851 </refpurpose>
3852</refnamediv>
3853<refsynopsisdiv>
3854 <title>Synopsis</title>
3855  <funcsynopsis><funcprototype>
3856   <funcdef>unsigned long <function>msleep_interruptible </function></funcdef>
3857   <paramdef>unsigned int <parameter>msecs</parameter></paramdef>
3858  </funcprototype></funcsynopsis>
3859</refsynopsisdiv>
3860<refsect1>
3861 <title>Arguments</title>
3862 <variablelist>
3863  <varlistentry>
3864   <term><parameter>msecs</parameter></term>
3865   <listitem>
3866    <para>
3867     Time in milliseconds to sleep for
3868    </para>
3869   </listitem>
3870  </varlistentry>
3871 </variablelist>
3872</refsect1>
3873</refentry>
3874
3875<refentry id="API-usleep-range">
3876<refentryinfo>
3877 <title>LINUX</title>
3878 <productname>Kernel Hackers Manual</productname>
3879 <date>July 2017</date>
3880</refentryinfo>
3881<refmeta>
3882 <refentrytitle><phrase>usleep_range</phrase></refentrytitle>
3883 <manvolnum>9</manvolnum>
3884 <refmiscinfo class="version">4.1.27</refmiscinfo>
3885</refmeta>
3886<refnamediv>
3887 <refname>usleep_range</refname>
3888 <refpurpose>
3889     Drop in replacement for udelay where wakeup is flexible
3890 </refpurpose>
3891</refnamediv>
3892<refsynopsisdiv>
3893 <title>Synopsis</title>
3894  <funcsynopsis><funcprototype>
3895   <funcdef>void <function>usleep_range </function></funcdef>
3896   <paramdef>unsigned long <parameter>min</parameter></paramdef>
3897   <paramdef>unsigned long <parameter>max</parameter></paramdef>
3898  </funcprototype></funcsynopsis>
3899</refsynopsisdiv>
3900<refsect1>
3901 <title>Arguments</title>
3902 <variablelist>
3903  <varlistentry>
3904   <term><parameter>min</parameter></term>
3905   <listitem>
3906    <para>
3907     Minimum time in usecs to sleep
3908    </para>
3909   </listitem>
3910  </varlistentry>
3911  <varlistentry>
3912   <term><parameter>max</parameter></term>
3913   <listitem>
3914    <para>
3915     Maximum time in usecs to sleep
3916    </para>
3917   </listitem>
3918  </varlistentry>
3919 </variablelist>
3920</refsect1>
3921</refentry>
3922
3923     </sect1>
3924     <sect1><title>Wait queues and Wake events</title>
3925<!-- include/linux/wait.h -->
3926<refentry id="API-wait-event">
3927<refentryinfo>
3928 <title>LINUX</title>
3929 <productname>Kernel Hackers Manual</productname>
3930 <date>July 2017</date>
3931</refentryinfo>
3932<refmeta>
3933 <refentrytitle><phrase>wait_event</phrase></refentrytitle>
3934 <manvolnum>9</manvolnum>
3935 <refmiscinfo class="version">4.1.27</refmiscinfo>
3936</refmeta>
3937<refnamediv>
3938 <refname>wait_event</refname>
3939 <refpurpose>
3940  sleep until a condition gets true
3941 </refpurpose>
3942</refnamediv>
3943<refsynopsisdiv>
3944 <title>Synopsis</title>
3945  <funcsynopsis><funcprototype>
3946   <funcdef> <function>wait_event </function></funcdef>
3947   <paramdef> <parameter>wq</parameter></paramdef>
3948   <paramdef> <parameter>condition</parameter></paramdef>
3949  </funcprototype></funcsynopsis>
3950</refsynopsisdiv>
3951<refsect1>
3952 <title>Arguments</title>
3953 <variablelist>
3954  <varlistentry>
3955   <term><parameter>wq</parameter></term>
3956   <listitem>
3957    <para>
3958     the waitqueue to wait on
3959    </para>
3960   </listitem>
3961  </varlistentry>
3962  <varlistentry>
3963   <term><parameter>condition</parameter></term>
3964   <listitem>
3965    <para>
3966     a C expression for the event to wait for
3967    </para>
3968   </listitem>
3969  </varlistentry>
3970 </variablelist>
3971</refsect1>
3972<refsect1>
3973<title>Description</title>
3974<para>
3975   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
3976   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
3977   the waitqueue <parameter>wq</parameter> is woken up.
3978   </para><para>
3979
3980   <function>wake_up</function> has to be called after changing any variable that could
3981   change the result of the wait condition.
3982</para>
3983</refsect1>
3984</refentry>
3985
3986<refentry id="API-wait-event-freezable">
3987<refentryinfo>
3988 <title>LINUX</title>
3989 <productname>Kernel Hackers Manual</productname>
3990 <date>July 2017</date>
3991</refentryinfo>
3992<refmeta>
3993 <refentrytitle><phrase>wait_event_freezable</phrase></refentrytitle>
3994 <manvolnum>9</manvolnum>
3995 <refmiscinfo class="version">4.1.27</refmiscinfo>
3996</refmeta>
3997<refnamediv>
3998 <refname>wait_event_freezable</refname>
3999 <refpurpose>
4000     sleep (or freeze) until a condition gets true
4001 </refpurpose>
4002</refnamediv>
4003<refsynopsisdiv>
4004 <title>Synopsis</title>
4005  <funcsynopsis><funcprototype>
4006   <funcdef> <function>wait_event_freezable </function></funcdef>
4007   <paramdef> <parameter>wq</parameter></paramdef>
4008   <paramdef> <parameter>condition</parameter></paramdef>
4009  </funcprototype></funcsynopsis>
4010</refsynopsisdiv>
4011<refsect1>
4012 <title>Arguments</title>
4013 <variablelist>
4014  <varlistentry>
4015   <term><parameter>wq</parameter></term>
4016   <listitem>
4017    <para>
4018     the waitqueue to wait on
4019    </para>
4020   </listitem>
4021  </varlistentry>
4022  <varlistentry>
4023   <term><parameter>condition</parameter></term>
4024   <listitem>
4025    <para>
4026     a C expression for the event to wait for
4027    </para>
4028   </listitem>
4029  </varlistentry>
4030 </variablelist>
4031</refsect1>
4032<refsect1>
4033<title>Description</title>
4034<para>
4035   The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
4036   to system load) until the <parameter>condition</parameter> evaluates to true. The
4037   <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4038   </para><para>
4039
4040   <function>wake_up</function> has to be called after changing any variable that could
4041   change the result of the wait condition.
4042</para>
4043</refsect1>
4044</refentry>
4045
4046<refentry id="API-wait-event-timeout">
4047<refentryinfo>
4048 <title>LINUX</title>
4049 <productname>Kernel Hackers Manual</productname>
4050 <date>July 2017</date>
4051</refentryinfo>
4052<refmeta>
4053 <refentrytitle><phrase>wait_event_timeout</phrase></refentrytitle>
4054 <manvolnum>9</manvolnum>
4055 <refmiscinfo class="version">4.1.27</refmiscinfo>
4056</refmeta>
4057<refnamediv>
4058 <refname>wait_event_timeout</refname>
4059 <refpurpose>
4060     sleep until a condition gets true or a timeout elapses
4061 </refpurpose>
4062</refnamediv>
4063<refsynopsisdiv>
4064 <title>Synopsis</title>
4065  <funcsynopsis><funcprototype>
4066   <funcdef> <function>wait_event_timeout </function></funcdef>
4067   <paramdef> <parameter>wq</parameter></paramdef>
4068   <paramdef> <parameter>condition</parameter></paramdef>
4069   <paramdef> <parameter>timeout</parameter></paramdef>
4070  </funcprototype></funcsynopsis>
4071</refsynopsisdiv>
4072<refsect1>
4073 <title>Arguments</title>
4074 <variablelist>
4075  <varlistentry>
4076   <term><parameter>wq</parameter></term>
4077   <listitem>
4078    <para>
4079     the waitqueue to wait on
4080    </para>
4081   </listitem>
4082  </varlistentry>
4083  <varlistentry>
4084   <term><parameter>condition</parameter></term>
4085   <listitem>
4086    <para>
4087     a C expression for the event to wait for
4088    </para>
4089   </listitem>
4090  </varlistentry>
4091  <varlistentry>
4092   <term><parameter>timeout</parameter></term>
4093   <listitem>
4094    <para>
4095     timeout, in jiffies
4096    </para>
4097   </listitem>
4098  </varlistentry>
4099 </variablelist>
4100</refsect1>
4101<refsect1>
4102<title>Description</title>
4103<para>
4104   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4105   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
4106   the waitqueue <parameter>wq</parameter> is woken up.
4107   </para><para>
4108
4109   <function>wake_up</function> has to be called after changing any variable that could
4110   change the result of the wait condition.
4111</para>
4112</refsect1>
4113<refsect1>
4114<title>Returns</title>
4115<para>
4116   0 if the <parameter>condition</parameter> evaluated to <constant>false</constant> after the <parameter>timeout</parameter> elapsed,
4117   1 if the <parameter>condition</parameter> evaluated to <constant>true</constant> after the <parameter>timeout</parameter> elapsed,
4118   or the remaining jiffies (at least 1) if the <parameter>condition</parameter> evaluated
4119   to <constant>true</constant> before the <parameter>timeout</parameter> elapsed.
4120</para>
4121</refsect1>
4122</refentry>
4123
4124<refentry id="API-wait-event-cmd">
4125<refentryinfo>
4126 <title>LINUX</title>
4127 <productname>Kernel Hackers Manual</productname>
4128 <date>July 2017</date>
4129</refentryinfo>
4130<refmeta>
4131 <refentrytitle><phrase>wait_event_cmd</phrase></refentrytitle>
4132 <manvolnum>9</manvolnum>
4133 <refmiscinfo class="version">4.1.27</refmiscinfo>
4134</refmeta>
4135<refnamediv>
4136 <refname>wait_event_cmd</refname>
4137 <refpurpose>
4138     sleep until a condition gets true
4139 </refpurpose>
4140</refnamediv>
4141<refsynopsisdiv>
4142 <title>Synopsis</title>
4143  <funcsynopsis><funcprototype>
4144   <funcdef> <function>wait_event_cmd </function></funcdef>
4145   <paramdef> <parameter>wq</parameter></paramdef>
4146   <paramdef> <parameter>condition</parameter></paramdef>
4147   <paramdef> <parameter>cmd1</parameter></paramdef>
4148   <paramdef> <parameter>cmd2</parameter></paramdef>
4149  </funcprototype></funcsynopsis>
4150</refsynopsisdiv>
4151<refsect1>
4152 <title>Arguments</title>
4153 <variablelist>
4154  <varlistentry>
4155   <term><parameter>wq</parameter></term>
4156   <listitem>
4157    <para>
4158     the waitqueue to wait on
4159    </para>
4160   </listitem>
4161  </varlistentry>
4162  <varlistentry>
4163   <term><parameter>condition</parameter></term>
4164   <listitem>
4165    <para>
4166     a C expression for the event to wait for
4167    </para>
4168   </listitem>
4169  </varlistentry>
4170  <varlistentry>
4171   <term><parameter>cmd1</parameter></term>
4172   <listitem>
4173    <para>
4174     the command will be executed before sleep
4175    </para>
4176   </listitem>
4177  </varlistentry>
4178  <varlistentry>
4179   <term><parameter>cmd2</parameter></term>
4180   <listitem>
4181    <para>
4182     the command will be executed after sleep
4183    </para>
4184   </listitem>
4185  </varlistentry>
4186 </variablelist>
4187</refsect1>
4188<refsect1>
4189<title>Description</title>
4190<para>
4191   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4192   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
4193   the waitqueue <parameter>wq</parameter> is woken up.
4194   </para><para>
4195
4196   <function>wake_up</function> has to be called after changing any variable that could
4197   change the result of the wait condition.
4198</para>
4199</refsect1>
4200</refentry>
4201
4202<refentry id="API-wait-event-interruptible">
4203<refentryinfo>
4204 <title>LINUX</title>
4205 <productname>Kernel Hackers Manual</productname>
4206 <date>July 2017</date>
4207</refentryinfo>
4208<refmeta>
4209 <refentrytitle><phrase>wait_event_interruptible</phrase></refentrytitle>
4210 <manvolnum>9</manvolnum>
4211 <refmiscinfo class="version">4.1.27</refmiscinfo>
4212</refmeta>
4213<refnamediv>
4214 <refname>wait_event_interruptible</refname>
4215 <refpurpose>
4216     sleep until a condition gets true
4217 </refpurpose>
4218</refnamediv>
4219<refsynopsisdiv>
4220 <title>Synopsis</title>
4221  <funcsynopsis><funcprototype>
4222   <funcdef> <function>wait_event_interruptible </function></funcdef>
4223   <paramdef> <parameter>wq</parameter></paramdef>
4224   <paramdef> <parameter>condition</parameter></paramdef>
4225  </funcprototype></funcsynopsis>
4226</refsynopsisdiv>
4227<refsect1>
4228 <title>Arguments</title>
4229 <variablelist>
4230  <varlistentry>
4231   <term><parameter>wq</parameter></term>
4232   <listitem>
4233    <para>
4234     the waitqueue to wait on
4235    </para>
4236   </listitem>
4237  </varlistentry>
4238  <varlistentry>
4239   <term><parameter>condition</parameter></term>
4240   <listitem>
4241    <para>
4242     a C expression for the event to wait for
4243    </para>
4244   </listitem>
4245  </varlistentry>
4246 </variablelist>
4247</refsect1>
4248<refsect1>
4249<title>Description</title>
4250<para>
4251   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4252   <parameter>condition</parameter> evaluates to true or a signal is received.
4253   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4254   </para><para>
4255
4256   <function>wake_up</function> has to be called after changing any variable that could
4257   change the result of the wait condition.
4258   </para><para>
4259
4260   The function will return -ERESTARTSYS if it was interrupted by a
4261   signal and 0 if <parameter>condition</parameter> evaluated to true.
4262</para>
4263</refsect1>
4264</refentry>
4265
4266<refentry id="API-wait-event-interruptible-timeout">
4267<refentryinfo>
4268 <title>LINUX</title>
4269 <productname>Kernel Hackers Manual</productname>
4270 <date>July 2017</date>
4271</refentryinfo>
4272<refmeta>
4273 <refentrytitle><phrase>wait_event_interruptible_timeout</phrase></refentrytitle>
4274 <manvolnum>9</manvolnum>
4275 <refmiscinfo class="version">4.1.27</refmiscinfo>
4276</refmeta>
4277<refnamediv>
4278 <refname>wait_event_interruptible_timeout</refname>
4279 <refpurpose>
4280     sleep until a condition gets true or a timeout elapses
4281 </refpurpose>
4282</refnamediv>
4283<refsynopsisdiv>
4284 <title>Synopsis</title>
4285  <funcsynopsis><funcprototype>
4286   <funcdef> <function>wait_event_interruptible_timeout </function></funcdef>
4287   <paramdef> <parameter>wq</parameter></paramdef>
4288   <paramdef> <parameter>condition</parameter></paramdef>
4289   <paramdef> <parameter>timeout</parameter></paramdef>
4290  </funcprototype></funcsynopsis>
4291</refsynopsisdiv>
4292<refsect1>
4293 <title>Arguments</title>
4294 <variablelist>
4295  <varlistentry>
4296   <term><parameter>wq</parameter></term>
4297   <listitem>
4298    <para>
4299     the waitqueue to wait on
4300    </para>
4301   </listitem>
4302  </varlistentry>
4303  <varlistentry>
4304   <term><parameter>condition</parameter></term>
4305   <listitem>
4306    <para>
4307     a C expression for the event to wait for
4308    </para>
4309   </listitem>
4310  </varlistentry>
4311  <varlistentry>
4312   <term><parameter>timeout</parameter></term>
4313   <listitem>
4314    <para>
4315     timeout, in jiffies
4316    </para>
4317   </listitem>
4318  </varlistentry>
4319 </variablelist>
4320</refsect1>
4321<refsect1>
4322<title>Description</title>
4323<para>
4324   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4325   <parameter>condition</parameter> evaluates to true or a signal is received.
4326   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4327   </para><para>
4328
4329   <function>wake_up</function> has to be called after changing any variable that could
4330   change the result of the wait condition.
4331</para>
4332</refsect1>
4333<refsect1>
4334<title>Returns</title>
4335<para>
4336   0 if the <parameter>condition</parameter> evaluated to <constant>false</constant> after the <parameter>timeout</parameter> elapsed,
4337   1 if the <parameter>condition</parameter> evaluated to <constant>true</constant> after the <parameter>timeout</parameter> elapsed,
4338   the remaining jiffies (at least 1) if the <parameter>condition</parameter> evaluated
4339   to <constant>true</constant> before the <parameter>timeout</parameter> elapsed, or -<constant>ERESTARTSYS</constant> if it was
4340   interrupted by a signal.
4341</para>
4342</refsect1>
4343</refentry>
4344
4345<refentry id="API-wait-event-hrtimeout">
4346<refentryinfo>
4347 <title>LINUX</title>
4348 <productname>Kernel Hackers Manual</productname>
4349 <date>July 2017</date>
4350</refentryinfo>
4351<refmeta>
4352 <refentrytitle><phrase>wait_event_hrtimeout</phrase></refentrytitle>
4353 <manvolnum>9</manvolnum>
4354 <refmiscinfo class="version">4.1.27</refmiscinfo>
4355</refmeta>
4356<refnamediv>
4357 <refname>wait_event_hrtimeout</refname>
4358 <refpurpose>
4359     sleep until a condition gets true or a timeout elapses
4360 </refpurpose>
4361</refnamediv>
4362<refsynopsisdiv>
4363 <title>Synopsis</title>
4364  <funcsynopsis><funcprototype>
4365   <funcdef> <function>wait_event_hrtimeout </function></funcdef>
4366   <paramdef> <parameter>wq</parameter></paramdef>
4367   <paramdef> <parameter>condition</parameter></paramdef>
4368   <paramdef> <parameter>timeout</parameter></paramdef>
4369  </funcprototype></funcsynopsis>
4370</refsynopsisdiv>
4371<refsect1>
4372 <title>Arguments</title>
4373 <variablelist>
4374  <varlistentry>
4375   <term><parameter>wq</parameter></term>
4376   <listitem>
4377    <para>
4378     the waitqueue to wait on
4379    </para>
4380   </listitem>
4381  </varlistentry>
4382  <varlistentry>
4383   <term><parameter>condition</parameter></term>
4384   <listitem>
4385    <para>
4386     a C expression for the event to wait for
4387    </para>
4388   </listitem>
4389  </varlistentry>
4390  <varlistentry>
4391   <term><parameter>timeout</parameter></term>
4392   <listitem>
4393    <para>
4394     timeout, as a ktime_t
4395    </para>
4396   </listitem>
4397  </varlistentry>
4398 </variablelist>
4399</refsect1>
4400<refsect1>
4401<title>Description</title>
4402<para>
4403   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4404   <parameter>condition</parameter> evaluates to true or a signal is received.
4405   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4406   </para><para>
4407
4408   <function>wake_up</function> has to be called after changing any variable that could
4409   change the result of the wait condition.
4410   </para><para>
4411
4412   The function returns 0 if <parameter>condition</parameter> became true, or -ETIME if the timeout
4413   elapsed.
4414</para>
4415</refsect1>
4416</refentry>
4417
4418<refentry id="API-wait-event-interruptible-hrtimeout">
4419<refentryinfo>
4420 <title>LINUX</title>
4421 <productname>Kernel Hackers Manual</productname>
4422 <date>July 2017</date>
4423</refentryinfo>
4424<refmeta>
4425 <refentrytitle><phrase>wait_event_interruptible_hrtimeout</phrase></refentrytitle>
4426 <manvolnum>9</manvolnum>
4427 <refmiscinfo class="version">4.1.27</refmiscinfo>
4428</refmeta>
4429<refnamediv>
4430 <refname>wait_event_interruptible_hrtimeout</refname>
4431 <refpurpose>
4432     sleep until a condition gets true or a timeout elapses
4433 </refpurpose>
4434</refnamediv>
4435<refsynopsisdiv>
4436 <title>Synopsis</title>
4437  <funcsynopsis><funcprototype>
4438   <funcdef> <function>wait_event_interruptible_hrtimeout </function></funcdef>
4439   <paramdef> <parameter>wq</parameter></paramdef>
4440   <paramdef> <parameter>condition</parameter></paramdef>
4441   <paramdef> <parameter>timeout</parameter></paramdef>
4442  </funcprototype></funcsynopsis>
4443</refsynopsisdiv>
4444<refsect1>
4445 <title>Arguments</title>
4446 <variablelist>
4447  <varlistentry>
4448   <term><parameter>wq</parameter></term>
4449   <listitem>
4450    <para>
4451     the waitqueue to wait on
4452    </para>
4453   </listitem>
4454  </varlistentry>
4455  <varlistentry>
4456   <term><parameter>condition</parameter></term>
4457   <listitem>
4458    <para>
4459     a C expression for the event to wait for
4460    </para>
4461   </listitem>
4462  </varlistentry>
4463  <varlistentry>
4464   <term><parameter>timeout</parameter></term>
4465   <listitem>
4466    <para>
4467     timeout, as a ktime_t
4468    </para>
4469   </listitem>
4470  </varlistentry>
4471 </variablelist>
4472</refsect1>
4473<refsect1>
4474<title>Description</title>
4475<para>
4476   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4477   <parameter>condition</parameter> evaluates to true or a signal is received.
4478   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4479   </para><para>
4480
4481   <function>wake_up</function> has to be called after changing any variable that could
4482   change the result of the wait condition.
4483   </para><para>
4484
4485   The function returns 0 if <parameter>condition</parameter> became true, -ERESTARTSYS if it was
4486   interrupted by a signal, or -ETIME if the timeout elapsed.
4487</para>
4488</refsect1>
4489</refentry>
4490
4491<refentry id="API-wait-event-interruptible-locked">
4492<refentryinfo>
4493 <title>LINUX</title>
4494 <productname>Kernel Hackers Manual</productname>
4495 <date>July 2017</date>
4496</refentryinfo>
4497<refmeta>
4498 <refentrytitle><phrase>wait_event_interruptible_locked</phrase></refentrytitle>
4499 <manvolnum>9</manvolnum>
4500 <refmiscinfo class="version">4.1.27</refmiscinfo>
4501</refmeta>
4502<refnamediv>
4503 <refname>wait_event_interruptible_locked</refname>
4504 <refpurpose>
4505     sleep until a condition gets true
4506 </refpurpose>
4507</refnamediv>
4508<refsynopsisdiv>
4509 <title>Synopsis</title>
4510  <funcsynopsis><funcprototype>
4511   <funcdef> <function>wait_event_interruptible_locked </function></funcdef>
4512   <paramdef> <parameter>wq</parameter></paramdef>
4513   <paramdef> <parameter>condition</parameter></paramdef>
4514  </funcprototype></funcsynopsis>
4515</refsynopsisdiv>
4516<refsect1>
4517 <title>Arguments</title>
4518 <variablelist>
4519  <varlistentry>
4520   <term><parameter>wq</parameter></term>
4521   <listitem>
4522    <para>
4523     the waitqueue to wait on
4524    </para>
4525   </listitem>
4526  </varlistentry>
4527  <varlistentry>
4528   <term><parameter>condition</parameter></term>
4529   <listitem>
4530    <para>
4531     a C expression for the event to wait for
4532    </para>
4533   </listitem>
4534  </varlistentry>
4535 </variablelist>
4536</refsect1>
4537<refsect1>
4538<title>Description</title>
4539<para>
4540   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4541   <parameter>condition</parameter> evaluates to true or a signal is received.
4542   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4543   </para><para>
4544
4545   It must be called with wq.lock being held.  This spinlock is
4546   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4547   is held and when this macro exits the lock is held.
4548   </para><para>
4549
4550   The lock is locked/unlocked using <function>spin_lock</function>/<function>spin_unlock</function>
4551   functions which must match the way they are locked/unlocked outside
4552   of this macro.
4553   </para><para>
4554
4555   <function>wake_up_locked</function> has to be called after changing any variable that could
4556   change the result of the wait condition.
4557   </para><para>
4558
4559   The function will return -ERESTARTSYS if it was interrupted by a
4560   signal and 0 if <parameter>condition</parameter> evaluated to true.
4561</para>
4562</refsect1>
4563</refentry>
4564
4565<refentry id="API-wait-event-interruptible-locked-irq">
4566<refentryinfo>
4567 <title>LINUX</title>
4568 <productname>Kernel Hackers Manual</productname>
4569 <date>July 2017</date>
4570</refentryinfo>
4571<refmeta>
4572 <refentrytitle><phrase>wait_event_interruptible_locked_irq</phrase></refentrytitle>
4573 <manvolnum>9</manvolnum>
4574 <refmiscinfo class="version">4.1.27</refmiscinfo>
4575</refmeta>
4576<refnamediv>
4577 <refname>wait_event_interruptible_locked_irq</refname>
4578 <refpurpose>
4579     sleep until a condition gets true
4580 </refpurpose>
4581</refnamediv>
4582<refsynopsisdiv>
4583 <title>Synopsis</title>
4584  <funcsynopsis><funcprototype>
4585   <funcdef> <function>wait_event_interruptible_locked_irq </function></funcdef>
4586   <paramdef> <parameter>wq</parameter></paramdef>
4587   <paramdef> <parameter>condition</parameter></paramdef>
4588  </funcprototype></funcsynopsis>
4589</refsynopsisdiv>
4590<refsect1>
4591 <title>Arguments</title>
4592 <variablelist>
4593  <varlistentry>
4594   <term><parameter>wq</parameter></term>
4595   <listitem>
4596    <para>
4597     the waitqueue to wait on
4598    </para>
4599   </listitem>
4600  </varlistentry>
4601  <varlistentry>
4602   <term><parameter>condition</parameter></term>
4603   <listitem>
4604    <para>
4605     a C expression for the event to wait for
4606    </para>
4607   </listitem>
4608  </varlistentry>
4609 </variablelist>
4610</refsect1>
4611<refsect1>
4612<title>Description</title>
4613<para>
4614   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4615   <parameter>condition</parameter> evaluates to true or a signal is received.
4616   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4617   </para><para>
4618
4619   It must be called with wq.lock being held.  This spinlock is
4620   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4621   is held and when this macro exits the lock is held.
4622   </para><para>
4623
4624   The lock is locked/unlocked using <function>spin_lock_irq</function>/<function>spin_unlock_irq</function>
4625   functions which must match the way they are locked/unlocked outside
4626   of this macro.
4627   </para><para>
4628
4629   <function>wake_up_locked</function> has to be called after changing any variable that could
4630   change the result of the wait condition.
4631   </para><para>
4632
4633   The function will return -ERESTARTSYS if it was interrupted by a
4634   signal and 0 if <parameter>condition</parameter> evaluated to true.
4635</para>
4636</refsect1>
4637</refentry>
4638
4639<refentry id="API-wait-event-interruptible-exclusive-locked">
4640<refentryinfo>
4641 <title>LINUX</title>
4642 <productname>Kernel Hackers Manual</productname>
4643 <date>July 2017</date>
4644</refentryinfo>
4645<refmeta>
4646 <refentrytitle><phrase>wait_event_interruptible_exclusive_locked</phrase></refentrytitle>
4647 <manvolnum>9</manvolnum>
4648 <refmiscinfo class="version">4.1.27</refmiscinfo>
4649</refmeta>
4650<refnamediv>
4651 <refname>wait_event_interruptible_exclusive_locked</refname>
4652 <refpurpose>
4653     sleep exclusively until a condition gets true
4654 </refpurpose>
4655</refnamediv>
4656<refsynopsisdiv>
4657 <title>Synopsis</title>
4658  <funcsynopsis><funcprototype>
4659   <funcdef> <function>wait_event_interruptible_exclusive_locked </function></funcdef>
4660   <paramdef> <parameter>wq</parameter></paramdef>
4661   <paramdef> <parameter>condition</parameter></paramdef>
4662  </funcprototype></funcsynopsis>
4663</refsynopsisdiv>
4664<refsect1>
4665 <title>Arguments</title>
4666 <variablelist>
4667  <varlistentry>
4668   <term><parameter>wq</parameter></term>
4669   <listitem>
4670    <para>
4671     the waitqueue to wait on
4672    </para>
4673   </listitem>
4674  </varlistentry>
4675  <varlistentry>
4676   <term><parameter>condition</parameter></term>
4677   <listitem>
4678    <para>
4679     a C expression for the event to wait for
4680    </para>
4681   </listitem>
4682  </varlistentry>
4683 </variablelist>
4684</refsect1>
4685<refsect1>
4686<title>Description</title>
4687<para>
4688   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4689   <parameter>condition</parameter> evaluates to true or a signal is received.
4690   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4691   </para><para>
4692
4693   It must be called with wq.lock being held.  This spinlock is
4694   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4695   is held and when this macro exits the lock is held.
4696   </para><para>
4697
4698   The lock is locked/unlocked using <function>spin_lock</function>/<function>spin_unlock</function>
4699   functions which must match the way they are locked/unlocked outside
4700   of this macro.
4701   </para><para>
4702
4703   The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
4704   set thus when other process waits process on the list if this
4705   process is awaken further processes are not considered.
4706   </para><para>
4707
4708   <function>wake_up_locked</function> has to be called after changing any variable that could
4709   change the result of the wait condition.
4710   </para><para>
4711
4712   The function will return -ERESTARTSYS if it was interrupted by a
4713   signal and 0 if <parameter>condition</parameter> evaluated to true.
4714</para>
4715</refsect1>
4716</refentry>
4717
4718<refentry id="API-wait-event-interruptible-exclusive-locked-irq">
4719<refentryinfo>
4720 <title>LINUX</title>
4721 <productname>Kernel Hackers Manual</productname>
4722 <date>July 2017</date>
4723</refentryinfo>
4724<refmeta>
4725 <refentrytitle><phrase>wait_event_interruptible_exclusive_locked_irq</phrase></refentrytitle>
4726 <manvolnum>9</manvolnum>
4727 <refmiscinfo class="version">4.1.27</refmiscinfo>
4728</refmeta>
4729<refnamediv>
4730 <refname>wait_event_interruptible_exclusive_locked_irq</refname>
4731 <refpurpose>
4732     sleep until a condition gets true
4733 </refpurpose>
4734</refnamediv>
4735<refsynopsisdiv>
4736 <title>Synopsis</title>
4737  <funcsynopsis><funcprototype>
4738   <funcdef> <function>wait_event_interruptible_exclusive_locked_irq </function></funcdef>
4739   <paramdef> <parameter>wq</parameter></paramdef>
4740   <paramdef> <parameter>condition</parameter></paramdef>
4741  </funcprototype></funcsynopsis>
4742</refsynopsisdiv>
4743<refsect1>
4744 <title>Arguments</title>
4745 <variablelist>
4746  <varlistentry>
4747   <term><parameter>wq</parameter></term>
4748   <listitem>
4749    <para>
4750     the waitqueue to wait on
4751    </para>
4752   </listitem>
4753  </varlistentry>
4754  <varlistentry>
4755   <term><parameter>condition</parameter></term>
4756   <listitem>
4757    <para>
4758     a C expression for the event to wait for
4759    </para>
4760   </listitem>
4761  </varlistentry>
4762 </variablelist>
4763</refsect1>
4764<refsect1>
4765<title>Description</title>
4766<para>
4767   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4768   <parameter>condition</parameter> evaluates to true or a signal is received.
4769   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4770   </para><para>
4771
4772   It must be called with wq.lock being held.  This spinlock is
4773   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4774   is held and when this macro exits the lock is held.
4775   </para><para>
4776
4777   The lock is locked/unlocked using <function>spin_lock_irq</function>/<function>spin_unlock_irq</function>
4778   functions which must match the way they are locked/unlocked outside
4779   of this macro.
4780   </para><para>
4781
4782   The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
4783   set thus when other process waits process on the list if this
4784   process is awaken further processes are not considered.
4785   </para><para>
4786
4787   <function>wake_up_locked</function> has to be called after changing any variable that could
4788   change the result of the wait condition.
4789   </para><para>
4790
4791   The function will return -ERESTARTSYS if it was interrupted by a
4792   signal and 0 if <parameter>condition</parameter> evaluated to true.
4793</para>
4794</refsect1>
4795</refentry>
4796
4797<refentry id="API-wait-event-killable">
4798<refentryinfo>
4799 <title>LINUX</title>
4800 <productname>Kernel Hackers Manual</productname>
4801 <date>July 2017</date>
4802</refentryinfo>
4803<refmeta>
4804 <refentrytitle><phrase>wait_event_killable</phrase></refentrytitle>
4805 <manvolnum>9</manvolnum>
4806 <refmiscinfo class="version">4.1.27</refmiscinfo>
4807</refmeta>
4808<refnamediv>
4809 <refname>wait_event_killable</refname>
4810 <refpurpose>
4811     sleep until a condition gets true
4812 </refpurpose>
4813</refnamediv>
4814<refsynopsisdiv>
4815 <title>Synopsis</title>
4816  <funcsynopsis><funcprototype>
4817   <funcdef> <function>wait_event_killable </function></funcdef>
4818   <paramdef> <parameter>wq</parameter></paramdef>
4819   <paramdef> <parameter>condition</parameter></paramdef>
4820  </funcprototype></funcsynopsis>
4821</refsynopsisdiv>
4822<refsect1>
4823 <title>Arguments</title>
4824 <variablelist>
4825  <varlistentry>
4826   <term><parameter>wq</parameter></term>
4827   <listitem>
4828    <para>
4829     the waitqueue to wait on
4830    </para>
4831   </listitem>
4832  </varlistentry>
4833  <varlistentry>
4834   <term><parameter>condition</parameter></term>
4835   <listitem>
4836    <para>
4837     a C expression for the event to wait for
4838    </para>
4839   </listitem>
4840  </varlistentry>
4841 </variablelist>
4842</refsect1>
4843<refsect1>
4844<title>Description</title>
4845<para>
4846   The process is put to sleep (TASK_KILLABLE) until the
4847   <parameter>condition</parameter> evaluates to true or a signal is received.
4848   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4849   </para><para>
4850
4851   <function>wake_up</function> has to be called after changing any variable that could
4852   change the result of the wait condition.
4853   </para><para>
4854
4855   The function will return -ERESTARTSYS if it was interrupted by a
4856   signal and 0 if <parameter>condition</parameter> evaluated to true.
4857</para>
4858</refsect1>
4859</refentry>
4860
4861<refentry id="API-wait-event-lock-irq-cmd">
4862<refentryinfo>
4863 <title>LINUX</title>
4864 <productname>Kernel Hackers Manual</productname>
4865 <date>July 2017</date>
4866</refentryinfo>
4867<refmeta>
4868 <refentrytitle><phrase>wait_event_lock_irq_cmd</phrase></refentrytitle>
4869 <manvolnum>9</manvolnum>
4870 <refmiscinfo class="version">4.1.27</refmiscinfo>
4871</refmeta>
4872<refnamediv>
4873 <refname>wait_event_lock_irq_cmd</refname>
4874 <refpurpose>
4875     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
4876 </refpurpose>
4877</refnamediv>
4878<refsynopsisdiv>
4879 <title>Synopsis</title>
4880  <funcsynopsis><funcprototype>
4881   <funcdef> <function>wait_event_lock_irq_cmd </function></funcdef>
4882   <paramdef> <parameter>wq</parameter></paramdef>
4883   <paramdef> <parameter>condition</parameter></paramdef>
4884   <paramdef> <parameter>lock</parameter></paramdef>
4885   <paramdef> <parameter>cmd</parameter></paramdef>
4886  </funcprototype></funcsynopsis>
4887</refsynopsisdiv>
4888<refsect1>
4889 <title>Arguments</title>
4890 <variablelist>
4891  <varlistentry>
4892   <term><parameter>wq</parameter></term>
4893   <listitem>
4894    <para>
4895     the waitqueue to wait on
4896    </para>
4897   </listitem>
4898  </varlistentry>
4899  <varlistentry>
4900   <term><parameter>condition</parameter></term>
4901   <listitem>
4902    <para>
4903     a C expression for the event to wait for
4904    </para>
4905   </listitem>
4906  </varlistentry>
4907  <varlistentry>
4908   <term><parameter>lock</parameter></term>
4909   <listitem>
4910    <para>
4911     a locked spinlock_t, which will be released before cmd
4912     and <function>schedule</function> and reacquired afterwards.
4913    </para>
4914   </listitem>
4915  </varlistentry>
4916  <varlistentry>
4917   <term><parameter>cmd</parameter></term>
4918   <listitem>
4919    <para>
4920     a command which is invoked outside the critical section before
4921     sleep
4922    </para>
4923   </listitem>
4924  </varlistentry>
4925 </variablelist>
4926</refsect1>
4927<refsect1>
4928<title>Description</title>
4929<para>
4930   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4931   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
4932   the waitqueue <parameter>wq</parameter> is woken up.
4933   </para><para>
4934
4935   <function>wake_up</function> has to be called after changing any variable that could
4936   change the result of the wait condition.
4937   </para><para>
4938
4939   This is supposed to be called while holding the lock. The lock is
4940   dropped before invoking the cmd and going to sleep and is reacquired
4941   afterwards.
4942</para>
4943</refsect1>
4944</refentry>
4945
4946<refentry id="API-wait-event-lock-irq">
4947<refentryinfo>
4948 <title>LINUX</title>
4949 <productname>Kernel Hackers Manual</productname>
4950 <date>July 2017</date>
4951</refentryinfo>
4952<refmeta>
4953 <refentrytitle><phrase>wait_event_lock_irq</phrase></refentrytitle>
4954 <manvolnum>9</manvolnum>
4955 <refmiscinfo class="version">4.1.27</refmiscinfo>
4956</refmeta>
4957<refnamediv>
4958 <refname>wait_event_lock_irq</refname>
4959 <refpurpose>
4960     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
4961 </refpurpose>
4962</refnamediv>
4963<refsynopsisdiv>
4964 <title>Synopsis</title>
4965  <funcsynopsis><funcprototype>
4966   <funcdef> <function>wait_event_lock_irq </function></funcdef>
4967   <paramdef> <parameter>wq</parameter></paramdef>
4968   <paramdef> <parameter>condition</parameter></paramdef>
4969   <paramdef> <parameter>lock</parameter></paramdef>
4970  </funcprototype></funcsynopsis>
4971</refsynopsisdiv>
4972<refsect1>
4973 <title>Arguments</title>
4974 <variablelist>
4975  <varlistentry>
4976   <term><parameter>wq</parameter></term>
4977   <listitem>
4978    <para>
4979     the waitqueue to wait on
4980    </para>
4981   </listitem>
4982  </varlistentry>
4983  <varlistentry>
4984   <term><parameter>condition</parameter></term>
4985   <listitem>
4986    <para>
4987     a C expression for the event to wait for
4988    </para>
4989   </listitem>
4990  </varlistentry>
4991  <varlistentry>
4992   <term><parameter>lock</parameter></term>
4993   <listitem>
4994    <para>
4995     a locked spinlock_t, which will be released before <function>schedule</function>
4996     and reacquired afterwards.
4997    </para>
4998   </listitem>
4999  </varlistentry>
5000 </variablelist>
5001</refsect1>
5002<refsect1>
5003<title>Description</title>
5004<para>
5005   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
5006   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
5007   the waitqueue <parameter>wq</parameter> is woken up.
5008   </para><para>
5009
5010   <function>wake_up</function> has to be called after changing any variable that could
5011   change the result of the wait condition.
5012   </para><para>
5013
5014   This is supposed to be called while holding the lock. The lock is
5015   dropped before going to sleep and is reacquired afterwards.
5016</para>
5017</refsect1>
5018</refentry>
5019
5020<refentry id="API-wait-event-interruptible-lock-irq-cmd">
5021<refentryinfo>
5022 <title>LINUX</title>
5023 <productname>Kernel Hackers Manual</productname>
5024 <date>July 2017</date>
5025</refentryinfo>
5026<refmeta>
5027 <refentrytitle><phrase>wait_event_interruptible_lock_irq_cmd</phrase></refentrytitle>
5028 <manvolnum>9</manvolnum>
5029 <refmiscinfo class="version">4.1.27</refmiscinfo>
5030</refmeta>
5031<refnamediv>
5032 <refname>wait_event_interruptible_lock_irq_cmd</refname>
5033 <refpurpose>
5034     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
5035 </refpurpose>
5036</refnamediv>
5037<refsynopsisdiv>
5038 <title>Synopsis</title>
5039  <funcsynopsis><funcprototype>
5040   <funcdef> <function>wait_event_interruptible_lock_irq_cmd </function></funcdef>
5041   <paramdef> <parameter>wq</parameter></paramdef>
5042   <paramdef> <parameter>condition</parameter></paramdef>
5043   <paramdef> <parameter>lock</parameter></paramdef>
5044   <paramdef> <parameter>cmd</parameter></paramdef>
5045  </funcprototype></funcsynopsis>
5046</refsynopsisdiv>
5047<refsect1>
5048 <title>Arguments</title>
5049 <variablelist>
5050  <varlistentry>
5051   <term><parameter>wq</parameter></term>
5052   <listitem>
5053    <para>
5054     the waitqueue to wait on
5055    </para>
5056   </listitem>
5057  </varlistentry>
5058  <varlistentry>
5059   <term><parameter>condition</parameter></term>
5060   <listitem>
5061    <para>
5062     a C expression for the event to wait for
5063    </para>
5064   </listitem>
5065  </varlistentry>
5066  <varlistentry>
5067   <term><parameter>lock</parameter></term>
5068   <listitem>
5069    <para>
5070     a locked spinlock_t, which will be released before cmd and
5071     <function>schedule</function> and reacquired afterwards.
5072    </para>
5073   </listitem>
5074  </varlistentry>
5075  <varlistentry>
5076   <term><parameter>cmd</parameter></term>
5077   <listitem>
5078    <para>
5079     a command which is invoked outside the critical section before
5080     sleep
5081    </para>
5082   </listitem>
5083  </varlistentry>
5084 </variablelist>
5085</refsect1>
5086<refsect1>
5087<title>Description</title>
5088<para>
5089   The process is put to sleep (TASK_INTERRUPTIBLE) until the
5090   <parameter>condition</parameter> evaluates to true or a signal is received. The <parameter>condition</parameter> is
5091   checked each time the waitqueue <parameter>wq</parameter> is woken up.
5092   </para><para>
5093
5094   <function>wake_up</function> has to be called after changing any variable that could
5095   change the result of the wait condition.
5096   </para><para>
5097
5098   This is supposed to be called while holding the lock. The lock is
5099   dropped before invoking the cmd and going to sleep and is reacquired
5100   afterwards.
5101   </para><para>
5102
5103   The macro will return -ERESTARTSYS if it was interrupted by a signal
5104   and 0 if <parameter>condition</parameter> evaluated to true.
5105</para>
5106</refsect1>
5107</refentry>
5108
5109<refentry id="API-wait-event-interruptible-lock-irq">
5110<refentryinfo>
5111 <title>LINUX</title>
5112 <productname>Kernel Hackers Manual</productname>
5113 <date>July 2017</date>
5114</refentryinfo>
5115<refmeta>
5116 <refentrytitle><phrase>wait_event_interruptible_lock_irq</phrase></refentrytitle>
5117 <manvolnum>9</manvolnum>
5118 <refmiscinfo class="version">4.1.27</refmiscinfo>
5119</refmeta>
5120<refnamediv>
5121 <refname>wait_event_interruptible_lock_irq</refname>
5122 <refpurpose>
5123     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
5124 </refpurpose>
5125</refnamediv>
5126<refsynopsisdiv>
5127 <title>Synopsis</title>
5128  <funcsynopsis><funcprototype>
5129   <funcdef> <function>wait_event_interruptible_lock_irq </function></funcdef>
5130   <paramdef> <parameter>wq</parameter></paramdef>
5131   <paramdef> <parameter>condition</parameter></paramdef>
5132   <paramdef> <parameter>lock</parameter></paramdef>
5133  </funcprototype></funcsynopsis>
5134</refsynopsisdiv>
5135<refsect1>
5136 <title>Arguments</title>
5137 <variablelist>
5138  <varlistentry>
5139   <term><parameter>wq</parameter></term>
5140   <listitem>
5141    <para>
5142     the waitqueue to wait on
5143    </para>
5144   </listitem>
5145  </varlistentry>
5146  <varlistentry>
5147   <term><parameter>condition</parameter></term>
5148   <listitem>
5149    <para>
5150     a C expression for the event to wait for
5151    </para>
5152   </listitem>
5153  </varlistentry>
5154  <varlistentry>
5155   <term><parameter>lock</parameter></term>
5156   <listitem>
5157    <para>
5158     a locked spinlock_t, which will be released before <function>schedule</function>
5159     and reacquired afterwards.
5160    </para>
5161   </listitem>
5162  </varlistentry>
5163 </variablelist>
5164</refsect1>
5165<refsect1>
5166<title>Description</title>
5167<para>
5168   The process is put to sleep (TASK_INTERRUPTIBLE) until the
5169   <parameter>condition</parameter> evaluates to true or signal is received. The <parameter>condition</parameter> is
5170   checked each time the waitqueue <parameter>wq</parameter> is woken up.
5171   </para><para>
5172
5173   <function>wake_up</function> has to be called after changing any variable that could
5174   change the result of the wait condition.
5175   </para><para>
5176
5177   This is supposed to be called while holding the lock. The lock is
5178   dropped before going to sleep and is reacquired afterwards.
5179   </para><para>
5180
5181   The macro will return -ERESTARTSYS if it was interrupted by a signal
5182   and 0 if <parameter>condition</parameter> evaluated to true.
5183</para>
5184</refsect1>
5185</refentry>
5186
5187<refentry id="API-wait-event-interruptible-lock-irq-timeout">
5188<refentryinfo>
5189 <title>LINUX</title>
5190 <productname>Kernel Hackers Manual</productname>
5191 <date>July 2017</date>
5192</refentryinfo>
5193<refmeta>
5194 <refentrytitle><phrase>wait_event_interruptible_lock_irq_timeout</phrase></refentrytitle>
5195 <manvolnum>9</manvolnum>
5196 <refmiscinfo class="version">4.1.27</refmiscinfo>
5197</refmeta>
5198<refnamediv>
5199 <refname>wait_event_interruptible_lock_irq_timeout</refname>
5200 <refpurpose>
5201     sleep until a condition gets true or a timeout elapses. The condition is checked under the lock. This is expected to be called with the lock taken.
5202 </refpurpose>
5203</refnamediv>
5204<refsynopsisdiv>
5205 <title>Synopsis</title>
5206  <funcsynopsis><funcprototype>
5207   <funcdef> <function>wait_event_interruptible_lock_irq_timeout </function></funcdef>
5208   <paramdef> <parameter>wq</parameter></paramdef>
5209   <paramdef> <parameter>condition</parameter></paramdef>
5210   <paramdef> <parameter>lock</parameter></paramdef>
5211   <paramdef> <parameter>timeout</parameter></paramdef>
5212  </funcprototype></funcsynopsis>
5213</refsynopsisdiv>
5214<refsect1>
5215 <title>Arguments</title>
5216 <variablelist>
5217  <varlistentry>
5218   <term><parameter>wq</parameter></term>
5219   <listitem>
5220    <para>
5221     the waitqueue to wait on
5222    </para>
5223   </listitem>
5224  </varlistentry>
5225  <varlistentry>
5226   <term><parameter>condition</parameter></term>
5227   <listitem>
5228    <para>
5229     a C expression for the event to wait for
5230    </para>
5231   </listitem>
5232  </varlistentry>
5233  <varlistentry>
5234   <term><parameter>lock</parameter></term>
5235   <listitem>
5236    <para>
5237     a locked spinlock_t, which will be released before <function>schedule</function>
5238     and reacquired afterwards.
5239    </para>
5240   </listitem>
5241  </varlistentry>
5242  <varlistentry>
5243   <term><parameter>timeout</parameter></term>
5244   <listitem>
5245    <para>
5246     timeout, in jiffies
5247    </para>
5248   </listitem>
5249  </varlistentry>
5250 </variablelist>
5251</refsect1>
5252<refsect1>
5253<title>Description</title>
5254<para>
5255   The process is put to sleep (TASK_INTERRUPTIBLE) until the
5256   <parameter>condition</parameter> evaluates to true or signal is received. The <parameter>condition</parameter> is
5257   checked each time the waitqueue <parameter>wq</parameter> is woken up.
5258   </para><para>
5259
5260   <function>wake_up</function> has to be called after changing any variable that could
5261   change the result of the wait condition.
5262   </para><para>
5263
5264   This is supposed to be called while holding the lock. The lock is
5265   dropped before going to sleep and is reacquired afterwards.
5266   </para><para>
5267
5268   The function returns 0 if the <parameter>timeout</parameter> elapsed, -ERESTARTSYS if it
5269   was interrupted by a signal, and the remaining jiffies otherwise
5270   if the condition evaluated to true before the timeout elapsed.
5271</para>
5272</refsect1>
5273</refentry>
5274
5275<refentry id="API-wait-on-bit">
5276<refentryinfo>
5277 <title>LINUX</title>
5278 <productname>Kernel Hackers Manual</productname>
5279 <date>July 2017</date>
5280</refentryinfo>
5281<refmeta>
5282 <refentrytitle><phrase>wait_on_bit</phrase></refentrytitle>
5283 <manvolnum>9</manvolnum>
5284 <refmiscinfo class="version">4.1.27</refmiscinfo>
5285</refmeta>
5286<refnamediv>
5287 <refname>wait_on_bit</refname>
5288 <refpurpose>
5289     wait for a bit to be cleared
5290 </refpurpose>
5291</refnamediv>
5292<refsynopsisdiv>
5293 <title>Synopsis</title>
5294  <funcsynopsis><funcprototype>
5295   <funcdef>int <function>wait_on_bit </function></funcdef>
5296   <paramdef>void * <parameter>word</parameter></paramdef>
5297   <paramdef>int <parameter>bit</parameter></paramdef>
5298   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5299  </funcprototype></funcsynopsis>
5300</refsynopsisdiv>
5301<refsect1>
5302 <title>Arguments</title>
5303 <variablelist>
5304  <varlistentry>
5305   <term><parameter>word</parameter></term>
5306   <listitem>
5307    <para>
5308     the word being waited on, a kernel virtual address
5309    </para>
5310   </listitem>
5311  </varlistentry>
5312  <varlistentry>
5313   <term><parameter>bit</parameter></term>
5314   <listitem>
5315    <para>
5316     the bit of the word being waited on
5317    </para>
5318   </listitem>
5319  </varlistentry>
5320  <varlistentry>
5321   <term><parameter>mode</parameter></term>
5322   <listitem>
5323    <para>
5324     the task state to sleep in
5325    </para>
5326   </listitem>
5327  </varlistentry>
5328 </variablelist>
5329</refsect1>
5330<refsect1>
5331<title>Description</title>
5332<para>
5333   There is a standard hashed waitqueue table for generic use. This
5334   is the part of the hashtable's accessor API that waits on a bit.
5335   For instance, if one were to have waiters on a bitflag, one would
5336   call <function>wait_on_bit</function> in threads waiting for the bit to clear.
5337   One uses <function>wait_on_bit</function> where one is waiting for the bit to clear,
5338   but has no intention of setting it.
5339   Returned value will be zero if the bit was cleared, or non-zero
5340   if the process received a signal and the mode permitted wakeup
5341   on that signal.
5342</para>
5343</refsect1>
5344</refentry>
5345
5346<refentry id="API-wait-on-bit-io">
5347<refentryinfo>
5348 <title>LINUX</title>
5349 <productname>Kernel Hackers Manual</productname>
5350 <date>July 2017</date>
5351</refentryinfo>
5352<refmeta>
5353 <refentrytitle><phrase>wait_on_bit_io</phrase></refentrytitle>
5354 <manvolnum>9</manvolnum>
5355 <refmiscinfo class="version">4.1.27</refmiscinfo>
5356</refmeta>
5357<refnamediv>
5358 <refname>wait_on_bit_io</refname>
5359 <refpurpose>
5360     wait for a bit to be cleared
5361 </refpurpose>
5362</refnamediv>
5363<refsynopsisdiv>
5364 <title>Synopsis</title>
5365  <funcsynopsis><funcprototype>
5366   <funcdef>int <function>wait_on_bit_io </function></funcdef>
5367   <paramdef>void * <parameter>word</parameter></paramdef>
5368   <paramdef>int <parameter>bit</parameter></paramdef>
5369   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5370  </funcprototype></funcsynopsis>
5371</refsynopsisdiv>
5372<refsect1>
5373 <title>Arguments</title>
5374 <variablelist>
5375  <varlistentry>
5376   <term><parameter>word</parameter></term>
5377   <listitem>
5378    <para>
5379     the word being waited on, a kernel virtual address
5380    </para>
5381   </listitem>
5382  </varlistentry>
5383  <varlistentry>
5384   <term><parameter>bit</parameter></term>
5385   <listitem>
5386    <para>
5387     the bit of the word being waited on
5388    </para>
5389   </listitem>
5390  </varlistentry>
5391  <varlistentry>
5392   <term><parameter>mode</parameter></term>
5393   <listitem>
5394    <para>
5395     the task state to sleep in
5396    </para>
5397   </listitem>
5398  </varlistentry>
5399 </variablelist>
5400</refsect1>
5401<refsect1>
5402<title>Description</title>
5403<para>
5404   Use the standard hashed waitqueue table to wait for a bit
5405   to be cleared.  This is similar to <function>wait_on_bit</function>, but calls
5406   <function>io_schedule</function> instead of <function>schedule</function> for the actual waiting.
5407   </para><para>
5408
5409   Returned value will be zero if the bit was cleared, or non-zero
5410   if the process received a signal and the mode permitted wakeup
5411   on that signal.
5412</para>
5413</refsect1>
5414</refentry>
5415
5416<refentry id="API-wait-on-bit-timeout">
5417<refentryinfo>
5418 <title>LINUX</title>
5419 <productname>Kernel Hackers Manual</productname>
5420 <date>July 2017</date>
5421</refentryinfo>
5422<refmeta>
5423 <refentrytitle><phrase>wait_on_bit_timeout</phrase></refentrytitle>
5424 <manvolnum>9</manvolnum>
5425 <refmiscinfo class="version">4.1.27</refmiscinfo>
5426</refmeta>
5427<refnamediv>
5428 <refname>wait_on_bit_timeout</refname>
5429 <refpurpose>
5430     wait for a bit to be cleared or a timeout elapses
5431 </refpurpose>
5432</refnamediv>
5433<refsynopsisdiv>
5434 <title>Synopsis</title>
5435  <funcsynopsis><funcprototype>
5436   <funcdef>int <function>wait_on_bit_timeout </function></funcdef>
5437   <paramdef>void * <parameter>word</parameter></paramdef>
5438   <paramdef>int <parameter>bit</parameter></paramdef>
5439   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5440   <paramdef>unsigned long <parameter>timeout</parameter></paramdef>
5441  </funcprototype></funcsynopsis>
5442</refsynopsisdiv>
5443<refsect1>
5444 <title>Arguments</title>
5445 <variablelist>
5446  <varlistentry>
5447   <term><parameter>word</parameter></term>
5448   <listitem>
5449    <para>
5450     the word being waited on, a kernel virtual address
5451    </para>
5452   </listitem>
5453  </varlistentry>
5454  <varlistentry>
5455   <term><parameter>bit</parameter></term>
5456   <listitem>
5457    <para>
5458     the bit of the word being waited on
5459    </para>
5460   </listitem>
5461  </varlistentry>
5462  <varlistentry>
5463   <term><parameter>mode</parameter></term>
5464   <listitem>
5465    <para>
5466     the task state to sleep in
5467    </para>
5468   </listitem>
5469  </varlistentry>
5470  <varlistentry>
5471   <term><parameter>timeout</parameter></term>
5472   <listitem>
5473    <para>
5474     timeout, in jiffies
5475    </para>
5476   </listitem>
5477  </varlistentry>
5478 </variablelist>
5479</refsect1>
5480<refsect1>
5481<title>Description</title>
5482<para>
5483   Use the standard hashed waitqueue table to wait for a bit
5484   to be cleared. This is similar to <function>wait_on_bit</function>, except also takes a
5485   timeout parameter.
5486   </para><para>
5487
5488   Returned value will be zero if the bit was cleared before the
5489   <parameter>timeout</parameter> elapsed, or non-zero if the <parameter>timeout</parameter> elapsed or process
5490   received a signal and the mode permitted wakeup on that signal.
5491</para>
5492</refsect1>
5493</refentry>
5494
5495<refentry id="API-wait-on-bit-action">
5496<refentryinfo>
5497 <title>LINUX</title>
5498 <productname>Kernel Hackers Manual</productname>
5499 <date>July 2017</date>
5500</refentryinfo>
5501<refmeta>
5502 <refentrytitle><phrase>wait_on_bit_action</phrase></refentrytitle>
5503 <manvolnum>9</manvolnum>
5504 <refmiscinfo class="version">4.1.27</refmiscinfo>
5505</refmeta>
5506<refnamediv>
5507 <refname>wait_on_bit_action</refname>
5508 <refpurpose>
5509     wait for a bit to be cleared
5510 </refpurpose>
5511</refnamediv>
5512<refsynopsisdiv>
5513 <title>Synopsis</title>
5514  <funcsynopsis><funcprototype>
5515   <funcdef>int <function>wait_on_bit_action </function></funcdef>
5516   <paramdef>void * <parameter>word</parameter></paramdef>
5517   <paramdef>int <parameter>bit</parameter></paramdef>
5518   <paramdef>wait_bit_action_f * <parameter>action</parameter></paramdef>
5519   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5520  </funcprototype></funcsynopsis>
5521</refsynopsisdiv>
5522<refsect1>
5523 <title>Arguments</title>
5524 <variablelist>
5525  <varlistentry>
5526   <term><parameter>word</parameter></term>
5527   <listitem>
5528    <para>
5529     the word being waited on, a kernel virtual address
5530    </para>
5531   </listitem>
5532  </varlistentry>
5533  <varlistentry>
5534   <term><parameter>bit</parameter></term>
5535   <listitem>
5536    <para>
5537     the bit of the word being waited on
5538    </para>
5539   </listitem>
5540  </varlistentry>
5541  <varlistentry>
5542   <term><parameter>action</parameter></term>
5543   <listitem>
5544    <para>
5545     the function used to sleep, which may take special actions
5546    </para>
5547   </listitem>
5548  </varlistentry>
5549  <varlistentry>
5550   <term><parameter>mode</parameter></term>
5551   <listitem>
5552    <para>
5553     the task state to sleep in
5554    </para>
5555   </listitem>
5556  </varlistentry>
5557 </variablelist>
5558</refsect1>
5559<refsect1>
5560<title>Description</title>
5561<para>
5562   Use the standard hashed waitqueue table to wait for a bit
5563   to be cleared, and allow the waiting action to be specified.
5564   This is like <function>wait_on_bit</function> but allows fine control of how the waiting
5565   is done.
5566   </para><para>
5567
5568   Returned value will be zero if the bit was cleared, or non-zero
5569   if the process received a signal and the mode permitted wakeup
5570   on that signal.
5571</para>
5572</refsect1>
5573</refentry>
5574
5575<refentry id="API-wait-on-bit-lock">
5576<refentryinfo>
5577 <title>LINUX</title>
5578 <productname>Kernel Hackers Manual</productname>
5579 <date>July 2017</date>
5580</refentryinfo>
5581<refmeta>
5582 <refentrytitle><phrase>wait_on_bit_lock</phrase></refentrytitle>
5583 <manvolnum>9</manvolnum>
5584 <refmiscinfo class="version">4.1.27</refmiscinfo>
5585</refmeta>
5586<refnamediv>
5587 <refname>wait_on_bit_lock</refname>
5588 <refpurpose>
5589     wait for a bit to be cleared, when wanting to set it
5590 </refpurpose>
5591</refnamediv>
5592<refsynopsisdiv>
5593 <title>Synopsis</title>
5594  <funcsynopsis><funcprototype>
5595   <funcdef>int <function>wait_on_bit_lock </function></funcdef>
5596   <paramdef>void * <parameter>word</parameter></paramdef>
5597   <paramdef>int <parameter>bit</parameter></paramdef>
5598   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5599  </funcprototype></funcsynopsis>
5600</refsynopsisdiv>
5601<refsect1>
5602 <title>Arguments</title>
5603 <variablelist>
5604  <varlistentry>
5605   <term><parameter>word</parameter></term>
5606   <listitem>
5607    <para>
5608     the word being waited on, a kernel virtual address
5609    </para>
5610   </listitem>
5611  </varlistentry>
5612  <varlistentry>
5613   <term><parameter>bit</parameter></term>
5614   <listitem>
5615    <para>
5616     the bit of the word being waited on
5617    </para>
5618   </listitem>
5619  </varlistentry>
5620  <varlistentry>
5621   <term><parameter>mode</parameter></term>
5622   <listitem>
5623    <para>
5624     the task state to sleep in
5625    </para>
5626   </listitem>
5627  </varlistentry>
5628 </variablelist>
5629</refsect1>
5630<refsect1>
5631<title>Description</title>
5632<para>
5633   There is a standard hashed waitqueue table for generic use. This
5634   is the part of the hashtable's accessor API that waits on a bit
5635   when one intends to set it, for instance, trying to lock bitflags.
5636   For instance, if one were to have waiters trying to set bitflag
5637   and waiting for it to clear before setting it, one would call
5638   <function>wait_on_bit</function> in threads waiting to be able to set the bit.
5639   One uses <function>wait_on_bit_lock</function> where one is waiting for the bit to
5640   clear with the intention of setting it, and when done, clearing it.
5641   </para><para>
5642
5643   Returns zero if the bit was (eventually) found to be clear and was
5644   set.  Returns non-zero if a signal was delivered to the process and
5645   the <parameter>mode</parameter> allows that signal to wake the process.
5646</para>
5647</refsect1>
5648</refentry>
5649
5650<refentry id="API-wait-on-bit-lock-io">
5651<refentryinfo>
5652 <title>LINUX</title>
5653 <productname>Kernel Hackers Manual</productname>
5654 <date>July 2017</date>
5655</refentryinfo>
5656<refmeta>
5657 <refentrytitle><phrase>wait_on_bit_lock_io</phrase></refentrytitle>
5658 <manvolnum>9</manvolnum>
5659 <refmiscinfo class="version">4.1.27</refmiscinfo>
5660</refmeta>
5661<refnamediv>
5662 <refname>wait_on_bit_lock_io</refname>
5663 <refpurpose>
5664     wait for a bit to be cleared, when wanting to set it
5665 </refpurpose>
5666</refnamediv>
5667<refsynopsisdiv>
5668 <title>Synopsis</title>
5669  <funcsynopsis><funcprototype>
5670   <funcdef>int <function>wait_on_bit_lock_io </function></funcdef>
5671   <paramdef>void * <parameter>word</parameter></paramdef>
5672   <paramdef>int <parameter>bit</parameter></paramdef>
5673   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5674  </funcprototype></funcsynopsis>
5675</refsynopsisdiv>
5676<refsect1>
5677 <title>Arguments</title>
5678 <variablelist>
5679  <varlistentry>
5680   <term><parameter>word</parameter></term>
5681   <listitem>
5682    <para>
5683     the word being waited on, a kernel virtual address
5684    </para>
5685   </listitem>
5686  </varlistentry>
5687  <varlistentry>
5688   <term><parameter>bit</parameter></term>
5689   <listitem>
5690    <para>
5691     the bit of the word being waited on
5692    </para>
5693   </listitem>
5694  </varlistentry>
5695  <varlistentry>
5696   <term><parameter>mode</parameter></term>
5697   <listitem>
5698    <para>
5699     the task state to sleep in
5700    </para>
5701   </listitem>
5702  </varlistentry>
5703 </variablelist>
5704</refsect1>
5705<refsect1>
5706<title>Description</title>
5707<para>
5708   Use the standard hashed waitqueue table to wait for a bit
5709   to be cleared and then to atomically set it.  This is similar
5710   to <function>wait_on_bit</function>, but calls <function>io_schedule</function> instead of <function>schedule</function>
5711   for the actual waiting.
5712   </para><para>
5713
5714   Returns zero if the bit was (eventually) found to be clear and was
5715   set.  Returns non-zero if a signal was delivered to the process and
5716   the <parameter>mode</parameter> allows that signal to wake the process.
5717</para>
5718</refsect1>
5719</refentry>
5720
5721<refentry id="API-wait-on-bit-lock-action">
5722<refentryinfo>
5723 <title>LINUX</title>
5724 <productname>Kernel Hackers Manual</productname>
5725 <date>July 2017</date>
5726</refentryinfo>
5727<refmeta>
5728 <refentrytitle><phrase>wait_on_bit_lock_action</phrase></refentrytitle>
5729 <manvolnum>9</manvolnum>
5730 <refmiscinfo class="version">4.1.27</refmiscinfo>
5731</refmeta>
5732<refnamediv>
5733 <refname>wait_on_bit_lock_action</refname>
5734 <refpurpose>
5735     wait for a bit to be cleared, when wanting to set it
5736 </refpurpose>
5737</refnamediv>
5738<refsynopsisdiv>
5739 <title>Synopsis</title>
5740  <funcsynopsis><funcprototype>
5741   <funcdef>int <function>wait_on_bit_lock_action </function></funcdef>
5742   <paramdef>void * <parameter>word</parameter></paramdef>
5743   <paramdef>int <parameter>bit</parameter></paramdef>
5744   <paramdef>wait_bit_action_f * <parameter>action</parameter></paramdef>
5745   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5746  </funcprototype></funcsynopsis>
5747</refsynopsisdiv>
5748<refsect1>
5749 <title>Arguments</title>
5750 <variablelist>
5751  <varlistentry>
5752   <term><parameter>word</parameter></term>
5753   <listitem>
5754    <para>
5755     the word being waited on, a kernel virtual address
5756    </para>
5757   </listitem>
5758  </varlistentry>
5759  <varlistentry>
5760   <term><parameter>bit</parameter></term>
5761   <listitem>
5762    <para>
5763     the bit of the word being waited on
5764    </para>
5765   </listitem>
5766  </varlistentry>
5767  <varlistentry>
5768   <term><parameter>action</parameter></term>
5769   <listitem>
5770    <para>
5771     the function used to sleep, which may take special actions
5772    </para>
5773   </listitem>
5774  </varlistentry>
5775  <varlistentry>
5776   <term><parameter>mode</parameter></term>
5777   <listitem>
5778    <para>
5779     the task state to sleep in
5780    </para>
5781   </listitem>
5782  </varlistentry>
5783 </variablelist>
5784</refsect1>
5785<refsect1>
5786<title>Description</title>
5787<para>
5788   Use the standard hashed waitqueue table to wait for a bit
5789   to be cleared and then to set it, and allow the waiting action
5790   to be specified.
5791   This is like <function>wait_on_bit</function> but allows fine control of how the waiting
5792   is done.
5793   </para><para>
5794
5795   Returns zero if the bit was (eventually) found to be clear and was
5796   set.  Returns non-zero if a signal was delivered to the process and
5797   the <parameter>mode</parameter> allows that signal to wake the process.
5798</para>
5799</refsect1>
5800</refentry>
5801
5802<refentry id="API-wait-on-atomic-t">
5803<refentryinfo>
5804 <title>LINUX</title>
5805 <productname>Kernel Hackers Manual</productname>
5806 <date>July 2017</date>
5807</refentryinfo>
5808<refmeta>
5809 <refentrytitle><phrase>wait_on_atomic_t</phrase></refentrytitle>
5810 <manvolnum>9</manvolnum>
5811 <refmiscinfo class="version">4.1.27</refmiscinfo>
5812</refmeta>
5813<refnamediv>
5814 <refname>wait_on_atomic_t</refname>
5815 <refpurpose>
5816     Wait for an atomic_t to become 0
5817 </refpurpose>
5818</refnamediv>
5819<refsynopsisdiv>
5820 <title>Synopsis</title>
5821  <funcsynopsis><funcprototype>
5822   <funcdef>int <function>wait_on_atomic_t </function></funcdef>
5823   <paramdef>atomic_t * <parameter>val</parameter></paramdef>
5824   <paramdef>int (*<parameter>action</parameter>)
5825     <funcparams>atomic_t *</funcparams></paramdef>
5826   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5827  </funcprototype></funcsynopsis>
5828</refsynopsisdiv>
5829<refsect1>
5830 <title>Arguments</title>
5831 <variablelist>
5832  <varlistentry>
5833   <term><parameter>val</parameter></term>
5834   <listitem>
5835    <para>
5836     The atomic value being waited on, a kernel virtual address
5837    </para>
5838   </listitem>
5839  </varlistentry>
5840  <varlistentry>
5841   <term><parameter>action</parameter></term>
5842   <listitem>
5843    <para>
5844     the function used to sleep, which may take special actions
5845    </para>
5846   </listitem>
5847  </varlistentry>
5848  <varlistentry>
5849   <term><parameter>mode</parameter></term>
5850   <listitem>
5851    <para>
5852     the task state to sleep in
5853    </para>
5854   </listitem>
5855  </varlistentry>
5856 </variablelist>
5857</refsect1>
5858<refsect1>
5859<title>Description</title>
5860<para>
5861   Wait for an atomic_t to become 0.  We abuse the bit-wait waitqueue table for
5862   the purpose of getting a waitqueue, but we set the key to a bit number
5863   outside of the target 'word'.
5864</para>
5865</refsect1>
5866</refentry>
5867
5868<!-- kernel/sched/wait.c -->
5869<refentry id="API---wake-up">
5870<refentryinfo>
5871 <title>LINUX</title>
5872 <productname>Kernel Hackers Manual</productname>
5873 <date>July 2017</date>
5874</refentryinfo>
5875<refmeta>
5876 <refentrytitle><phrase>__wake_up</phrase></refentrytitle>
5877 <manvolnum>9</manvolnum>
5878 <refmiscinfo class="version">4.1.27</refmiscinfo>
5879</refmeta>
5880<refnamediv>
5881 <refname>__wake_up</refname>
5882 <refpurpose>
5883  wake up threads blocked on a waitqueue.
5884 </refpurpose>
5885</refnamediv>
5886<refsynopsisdiv>
5887 <title>Synopsis</title>
5888  <funcsynopsis><funcprototype>
5889   <funcdef>void <function>__wake_up </function></funcdef>
5890   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
5891   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
5892   <paramdef>int <parameter>nr_exclusive</parameter></paramdef>
5893   <paramdef>void * <parameter>key</parameter></paramdef>
5894  </funcprototype></funcsynopsis>
5895</refsynopsisdiv>
5896<refsect1>
5897 <title>Arguments</title>
5898 <variablelist>
5899  <varlistentry>
5900   <term><parameter>q</parameter></term>
5901   <listitem>
5902    <para>
5903     the waitqueue
5904    </para>
5905   </listitem>
5906  </varlistentry>
5907  <varlistentry>
5908   <term><parameter>mode</parameter></term>
5909   <listitem>
5910    <para>
5911     which threads
5912    </para>
5913   </listitem>
5914  </varlistentry>
5915  <varlistentry>
5916   <term><parameter>nr_exclusive</parameter></term>
5917   <listitem>
5918    <para>
5919     how many wake-one or wake-many threads to wake up
5920    </para>
5921   </listitem>
5922  </varlistentry>
5923  <varlistentry>
5924   <term><parameter>key</parameter></term>
5925   <listitem>
5926    <para>
5927     is directly passed to the wakeup function
5928    </para>
5929   </listitem>
5930  </varlistentry>
5931 </variablelist>
5932</refsect1>
5933<refsect1>
5934<title>Description</title>
5935<para>
5936   It may be assumed that this function implies a write memory barrier before
5937   changing the task state if and only if any tasks are woken up.
5938</para>
5939</refsect1>
5940</refentry>
5941
5942<refentry id="API---wake-up-sync-key">
5943<refentryinfo>
5944 <title>LINUX</title>
5945 <productname>Kernel Hackers Manual</productname>
5946 <date>July 2017</date>
5947</refentryinfo>
5948<refmeta>
5949 <refentrytitle><phrase>__wake_up_sync_key</phrase></refentrytitle>
5950 <manvolnum>9</manvolnum>
5951 <refmiscinfo class="version">4.1.27</refmiscinfo>
5952</refmeta>
5953<refnamediv>
5954 <refname>__wake_up_sync_key</refname>
5955 <refpurpose>
5956     wake up threads blocked on a waitqueue.
5957 </refpurpose>
5958</refnamediv>
5959<refsynopsisdiv>
5960 <title>Synopsis</title>
5961  <funcsynopsis><funcprototype>
5962   <funcdef>void <function>__wake_up_sync_key </function></funcdef>
5963   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
5964   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
5965   <paramdef>int <parameter>nr_exclusive</parameter></paramdef>
5966   <paramdef>void * <parameter>key</parameter></paramdef>
5967  </funcprototype></funcsynopsis>
5968</refsynopsisdiv>
5969<refsect1>
5970 <title>Arguments</title>
5971 <variablelist>
5972  <varlistentry>
5973   <term><parameter>q</parameter></term>
5974   <listitem>
5975    <para>
5976     the waitqueue
5977    </para>
5978   </listitem>
5979  </varlistentry>
5980  <varlistentry>
5981   <term><parameter>mode</parameter></term>
5982   <listitem>
5983    <para>
5984     which threads
5985    </para>
5986   </listitem>
5987  </varlistentry>
5988  <varlistentry>
5989   <term><parameter>nr_exclusive</parameter></term>
5990   <listitem>
5991    <para>
5992     how many wake-one or wake-many threads to wake up
5993    </para>
5994   </listitem>
5995  </varlistentry>
5996  <varlistentry>
5997   <term><parameter>key</parameter></term>
5998   <listitem>
5999    <para>
6000     opaque value to be passed to wakeup targets
6001    </para>
6002   </listitem>
6003  </varlistentry>
6004 </variablelist>
6005</refsect1>
6006<refsect1>
6007<title>Description</title>
6008<para>
6009   The sync wakeup differs that the waker knows that it will schedule
6010   away soon, so while the target thread will be woken up, it will not
6011   be migrated to another CPU - ie. the two threads are 'synchronized'
6012   with each other. This can prevent needless bouncing between CPUs.
6013   </para><para>
6014
6015   On UP it can prevent extra preemption.
6016   </para><para>
6017
6018   It may be assumed that this function implies a write memory barrier before
6019   changing the task state if and only if any tasks are woken up.
6020</para>
6021</refsect1>
6022</refentry>
6023
6024<refentry id="API-finish-wait">
6025<refentryinfo>
6026 <title>LINUX</title>
6027 <productname>Kernel Hackers Manual</productname>
6028 <date>July 2017</date>
6029</refentryinfo>
6030<refmeta>
6031 <refentrytitle><phrase>finish_wait</phrase></refentrytitle>
6032 <manvolnum>9</manvolnum>
6033 <refmiscinfo class="version">4.1.27</refmiscinfo>
6034</refmeta>
6035<refnamediv>
6036 <refname>finish_wait</refname>
6037 <refpurpose>
6038     clean up after waiting in a queue
6039 </refpurpose>
6040</refnamediv>
6041<refsynopsisdiv>
6042 <title>Synopsis</title>
6043  <funcsynopsis><funcprototype>
6044   <funcdef>void <function>finish_wait </function></funcdef>
6045   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
6046   <paramdef>wait_queue_t * <parameter>wait</parameter></paramdef>
6047  </funcprototype></funcsynopsis>
6048</refsynopsisdiv>
6049<refsect1>
6050 <title>Arguments</title>
6051 <variablelist>
6052  <varlistentry>
6053   <term><parameter>q</parameter></term>
6054   <listitem>
6055    <para>
6056     waitqueue waited on
6057    </para>
6058   </listitem>
6059  </varlistentry>
6060  <varlistentry>
6061   <term><parameter>wait</parameter></term>
6062   <listitem>
6063    <para>
6064     wait descriptor
6065    </para>
6066   </listitem>
6067  </varlistentry>
6068 </variablelist>
6069</refsect1>
6070<refsect1>
6071<title>Description</title>
6072<para>
6073   Sets current thread back to running state and removes
6074   the wait descriptor from the given waitqueue if still
6075   queued.
6076</para>
6077</refsect1>
6078</refentry>
6079
6080<refentry id="API-abort-exclusive-wait">
6081<refentryinfo>
6082 <title>LINUX</title>
6083 <productname>Kernel Hackers Manual</productname>
6084 <date>July 2017</date>
6085</refentryinfo>
6086<refmeta>
6087 <refentrytitle><phrase>abort_exclusive_wait</phrase></refentrytitle>
6088 <manvolnum>9</manvolnum>
6089 <refmiscinfo class="version">4.1.27</refmiscinfo>
6090</refmeta>
6091<refnamediv>
6092 <refname>abort_exclusive_wait</refname>
6093 <refpurpose>
6094     abort exclusive waiting in a queue
6095 </refpurpose>
6096</refnamediv>
6097<refsynopsisdiv>
6098 <title>Synopsis</title>
6099  <funcsynopsis><funcprototype>
6100   <funcdef>void <function>abort_exclusive_wait </function></funcdef>
6101   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
6102   <paramdef>wait_queue_t * <parameter>wait</parameter></paramdef>
6103   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
6104   <paramdef>void * <parameter>key</parameter></paramdef>
6105  </funcprototype></funcsynopsis>
6106</refsynopsisdiv>
6107<refsect1>
6108 <title>Arguments</title>
6109 <variablelist>
6110  <varlistentry>
6111   <term><parameter>q</parameter></term>
6112   <listitem>
6113    <para>
6114     waitqueue waited on
6115    </para>
6116   </listitem>
6117  </varlistentry>
6118  <varlistentry>
6119   <term><parameter>wait</parameter></term>
6120   <listitem>
6121    <para>
6122     wait descriptor
6123    </para>
6124   </listitem>
6125  </varlistentry>
6126  <varlistentry>
6127   <term><parameter>mode</parameter></term>
6128   <listitem>
6129    <para>
6130     runstate of the waiter to be woken
6131    </para>
6132   </listitem>
6133  </varlistentry>
6134  <varlistentry>
6135   <term><parameter>key</parameter></term>
6136   <listitem>
6137    <para>
6138     key to identify a wait bit queue or <constant>NULL</constant>
6139    </para>
6140   </listitem>
6141  </varlistentry>
6142 </variablelist>
6143</refsect1>
6144<refsect1>
6145<title>Description</title>
6146<para>
6147   Sets current thread back to running state and removes
6148   the wait descriptor from the given waitqueue if still
6149   queued.
6150   </para><para>
6151
6152   Wakes up the next waiter if the caller is concurrently
6153   woken up through the queue.
6154   </para><para>
6155
6156   This prevents waiter starvation where an exclusive waiter
6157   aborts and is woken up concurrently and no one wakes up
6158   the next waiter.
6159</para>
6160</refsect1>
6161</refentry>
6162
6163<refentry id="API-wake-up-bit">
6164<refentryinfo>
6165 <title>LINUX</title>
6166 <productname>Kernel Hackers Manual</productname>
6167 <date>July 2017</date>
6168</refentryinfo>
6169<refmeta>
6170 <refentrytitle><phrase>wake_up_bit</phrase></refentrytitle>
6171 <manvolnum>9</manvolnum>
6172 <refmiscinfo class="version">4.1.27</refmiscinfo>
6173</refmeta>
6174<refnamediv>
6175 <refname>wake_up_bit</refname>
6176 <refpurpose>
6177     wake up a waiter on a bit
6178 </refpurpose>
6179</refnamediv>
6180<refsynopsisdiv>
6181 <title>Synopsis</title>
6182  <funcsynopsis><funcprototype>
6183   <funcdef>void <function>wake_up_bit </function></funcdef>
6184   <paramdef>void * <parameter>word</parameter></paramdef>
6185   <paramdef>int <parameter>bit</parameter></paramdef>
6186  </funcprototype></funcsynopsis>
6187</refsynopsisdiv>
6188<refsect1>
6189 <title>Arguments</title>
6190 <variablelist>
6191  <varlistentry>
6192   <term><parameter>word</parameter></term>
6193   <listitem>
6194    <para>
6195     the word being waited on, a kernel virtual address
6196    </para>
6197   </listitem>
6198  </varlistentry>
6199  <varlistentry>
6200   <term><parameter>bit</parameter></term>
6201   <listitem>
6202    <para>
6203     the bit of the word being waited on
6204    </para>
6205   </listitem>
6206  </varlistentry>
6207 </variablelist>
6208</refsect1>
6209<refsect1>
6210<title>Description</title>
6211<para>
6212   There is a standard hashed waitqueue table for generic use. This
6213   is the part of the hashtable's accessor API that wakes up waiters
6214   on a bit. For instance, if one were to have waiters on a bitflag,
6215   one would call <function>wake_up_bit</function> after clearing the bit.
6216   </para><para>
6217
6218   In order for this to function properly, as it uses <function>waitqueue_active</function>
6219   internally, some kind of memory barrier must be done prior to calling
6220   this. Typically, this will be <function>smp_mb__after_atomic</function>, but in some
6221   cases where bitflags are manipulated non-atomically under a lock, one
6222   may need to use a less regular barrier, such fs/inode.c's <function>smp_mb</function>,
6223   because <function>spin_unlock</function> does not guarantee a memory barrier.
6224</para>
6225</refsect1>
6226</refentry>
6227
6228<refentry id="API-wake-up-atomic-t">
6229<refentryinfo>
6230 <title>LINUX</title>
6231 <productname>Kernel Hackers Manual</productname>
6232 <date>July 2017</date>
6233</refentryinfo>
6234<refmeta>
6235 <refentrytitle><phrase>wake_up_atomic_t</phrase></refentrytitle>
6236 <manvolnum>9</manvolnum>
6237 <refmiscinfo class="version">4.1.27</refmiscinfo>
6238</refmeta>
6239<refnamediv>
6240 <refname>wake_up_atomic_t</refname>
6241 <refpurpose>
6242     Wake up a waiter on a atomic_t
6243 </refpurpose>
6244</refnamediv>
6245<refsynopsisdiv>
6246 <title>Synopsis</title>
6247  <funcsynopsis><funcprototype>
6248   <funcdef>void <function>wake_up_atomic_t </function></funcdef>
6249   <paramdef>atomic_t * <parameter>p</parameter></paramdef>
6250  </funcprototype></funcsynopsis>
6251</refsynopsisdiv>
6252<refsect1>
6253 <title>Arguments</title>
6254 <variablelist>
6255  <varlistentry>
6256   <term><parameter>p</parameter></term>
6257   <listitem>
6258    <para>
6259     The atomic_t being waited on, a kernel virtual address
6260    </para>
6261   </listitem>
6262  </varlistentry>
6263 </variablelist>
6264</refsect1>
6265<refsect1>
6266<title>Description</title>
6267<para>
6268   Wake up anyone waiting for the atomic_t to go to zero.
6269   </para><para>
6270
6271   Abuse the bit-waker function and its waitqueue hash table set (the atomic_t
6272   check is done by the waiter's wake function, not the by the waker itself).
6273</para>
6274</refsect1>
6275</refentry>
6276
6277     </sect1>
6278     <sect1><title>High-resolution timers</title>
6279<!-- include/linux/ktime.h -->
6280<refentry id="API-ktime-set">
6281<refentryinfo>
6282 <title>LINUX</title>
6283 <productname>Kernel Hackers Manual</productname>
6284 <date>July 2017</date>
6285</refentryinfo>
6286<refmeta>
6287 <refentrytitle><phrase>ktime_set</phrase></refentrytitle>
6288 <manvolnum>9</manvolnum>
6289 <refmiscinfo class="version">4.1.27</refmiscinfo>
6290</refmeta>
6291<refnamediv>
6292 <refname>ktime_set</refname>
6293 <refpurpose>
6294  Set a ktime_t variable from a seconds/nanoseconds value
6295 </refpurpose>
6296</refnamediv>
6297<refsynopsisdiv>
6298 <title>Synopsis</title>
6299  <funcsynopsis><funcprototype>
6300   <funcdef>ktime_t <function>ktime_set </function></funcdef>
6301   <paramdef>const s64 <parameter>secs</parameter></paramdef>
6302   <paramdef>const unsigned long <parameter>nsecs</parameter></paramdef>
6303  </funcprototype></funcsynopsis>
6304</refsynopsisdiv>
6305<refsect1>
6306 <title>Arguments</title>
6307 <variablelist>
6308  <varlistentry>
6309   <term><parameter>secs</parameter></term>
6310   <listitem>
6311    <para>
6312     seconds to set
6313    </para>
6314   </listitem>
6315  </varlistentry>
6316  <varlistentry>
6317   <term><parameter>nsecs</parameter></term>
6318   <listitem>
6319    <para>
6320     nanoseconds to set
6321    </para>
6322   </listitem>
6323  </varlistentry>
6324 </variablelist>
6325</refsect1>
6326<refsect1>
6327<title>Return</title>
6328<para>
6329   The ktime_t representation of the value.
6330</para>
6331</refsect1>
6332</refentry>
6333
6334<refentry id="API-ktime-equal">
6335<refentryinfo>
6336 <title>LINUX</title>
6337 <productname>Kernel Hackers Manual</productname>
6338 <date>July 2017</date>
6339</refentryinfo>
6340<refmeta>
6341 <refentrytitle><phrase>ktime_equal</phrase></refentrytitle>
6342 <manvolnum>9</manvolnum>
6343 <refmiscinfo class="version">4.1.27</refmiscinfo>
6344</refmeta>
6345<refnamediv>
6346 <refname>ktime_equal</refname>
6347 <refpurpose>
6348     Compares two ktime_t variables to see if they are equal
6349 </refpurpose>
6350</refnamediv>
6351<refsynopsisdiv>
6352 <title>Synopsis</title>
6353  <funcsynopsis><funcprototype>
6354   <funcdef>int <function>ktime_equal </function></funcdef>
6355   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6356   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6357  </funcprototype></funcsynopsis>
6358</refsynopsisdiv>
6359<refsect1>
6360 <title>Arguments</title>
6361 <variablelist>
6362  <varlistentry>
6363   <term><parameter>cmp1</parameter></term>
6364   <listitem>
6365    <para>
6366     comparable1
6367    </para>
6368   </listitem>
6369  </varlistentry>
6370  <varlistentry>
6371   <term><parameter>cmp2</parameter></term>
6372   <listitem>
6373    <para>
6374     comparable2
6375    </para>
6376   </listitem>
6377  </varlistentry>
6378 </variablelist>
6379</refsect1>
6380<refsect1>
6381<title>Description</title>
6382<para>
6383   Compare two ktime_t variables.
6384</para>
6385</refsect1>
6386<refsect1>
6387<title>Return</title>
6388<para>
6389   1 if equal.
6390</para>
6391</refsect1>
6392</refentry>
6393
6394<refentry id="API-ktime-compare">
6395<refentryinfo>
6396 <title>LINUX</title>
6397 <productname>Kernel Hackers Manual</productname>
6398 <date>July 2017</date>
6399</refentryinfo>
6400<refmeta>
6401 <refentrytitle><phrase>ktime_compare</phrase></refentrytitle>
6402 <manvolnum>9</manvolnum>
6403 <refmiscinfo class="version">4.1.27</refmiscinfo>
6404</refmeta>
6405<refnamediv>
6406 <refname>ktime_compare</refname>
6407 <refpurpose>
6408     Compares two ktime_t variables for less, greater or equal
6409 </refpurpose>
6410</refnamediv>
6411<refsynopsisdiv>
6412 <title>Synopsis</title>
6413  <funcsynopsis><funcprototype>
6414   <funcdef>int <function>ktime_compare </function></funcdef>
6415   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6416   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6417  </funcprototype></funcsynopsis>
6418</refsynopsisdiv>
6419<refsect1>
6420 <title>Arguments</title>
6421 <variablelist>
6422  <varlistentry>
6423   <term><parameter>cmp1</parameter></term>
6424   <listitem>
6425    <para>
6426     comparable1
6427    </para>
6428   </listitem>
6429  </varlistentry>
6430  <varlistentry>
6431   <term><parameter>cmp2</parameter></term>
6432   <listitem>
6433    <para>
6434     comparable2
6435    </para>
6436   </listitem>
6437  </varlistentry>
6438 </variablelist>
6439</refsect1>
6440<refsect1>
6441<title>Return</title>
6442<para>
6443   ...
6444   cmp1  &lt; cmp2: return &lt;0
6445   cmp1 == cmp2: return 0
6446   cmp1  &gt; cmp2: return &gt;0
6447</para>
6448</refsect1>
6449</refentry>
6450
6451<refentry id="API-ktime-after">
6452<refentryinfo>
6453 <title>LINUX</title>
6454 <productname>Kernel Hackers Manual</productname>
6455 <date>July 2017</date>
6456</refentryinfo>
6457<refmeta>
6458 <refentrytitle><phrase>ktime_after</phrase></refentrytitle>
6459 <manvolnum>9</manvolnum>
6460 <refmiscinfo class="version">4.1.27</refmiscinfo>
6461</refmeta>
6462<refnamediv>
6463 <refname>ktime_after</refname>
6464 <refpurpose>
6465     Compare if a ktime_t value is bigger than another one.
6466 </refpurpose>
6467</refnamediv>
6468<refsynopsisdiv>
6469 <title>Synopsis</title>
6470  <funcsynopsis><funcprototype>
6471   <funcdef>bool <function>ktime_after </function></funcdef>
6472   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6473   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6474  </funcprototype></funcsynopsis>
6475</refsynopsisdiv>
6476<refsect1>
6477 <title>Arguments</title>
6478 <variablelist>
6479  <varlistentry>
6480   <term><parameter>cmp1</parameter></term>
6481   <listitem>
6482    <para>
6483     comparable1
6484    </para>
6485   </listitem>
6486  </varlistentry>
6487  <varlistentry>
6488   <term><parameter>cmp2</parameter></term>
6489   <listitem>
6490    <para>
6491     comparable2
6492    </para>
6493   </listitem>
6494  </varlistentry>
6495 </variablelist>
6496</refsect1>
6497<refsect1>
6498<title>Return</title>
6499<para>
6500   true if cmp1 happened after cmp2.
6501</para>
6502</refsect1>
6503</refentry>
6504
6505<refentry id="API-ktime-before">
6506<refentryinfo>
6507 <title>LINUX</title>
6508 <productname>Kernel Hackers Manual</productname>
6509 <date>July 2017</date>
6510</refentryinfo>
6511<refmeta>
6512 <refentrytitle><phrase>ktime_before</phrase></refentrytitle>
6513 <manvolnum>9</manvolnum>
6514 <refmiscinfo class="version">4.1.27</refmiscinfo>
6515</refmeta>
6516<refnamediv>
6517 <refname>ktime_before</refname>
6518 <refpurpose>
6519     Compare if a ktime_t value is smaller than another one.
6520 </refpurpose>
6521</refnamediv>
6522<refsynopsisdiv>
6523 <title>Synopsis</title>
6524  <funcsynopsis><funcprototype>
6525   <funcdef>bool <function>ktime_before </function></funcdef>
6526   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6527   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6528  </funcprototype></funcsynopsis>
6529</refsynopsisdiv>
6530<refsect1>
6531 <title>Arguments</title>
6532 <variablelist>
6533  <varlistentry>
6534   <term><parameter>cmp1</parameter></term>
6535   <listitem>
6536    <para>
6537     comparable1
6538    </para>
6539   </listitem>
6540  </varlistentry>
6541  <varlistentry>
6542   <term><parameter>cmp2</parameter></term>
6543   <listitem>
6544    <para>
6545     comparable2
6546    </para>
6547   </listitem>
6548  </varlistentry>
6549 </variablelist>
6550</refsect1>
6551<refsect1>
6552<title>Return</title>
6553<para>
6554   true if cmp1 happened before cmp2.
6555</para>
6556</refsect1>
6557</refentry>
6558
6559<refentry id="API-ktime-to-timespec-cond">
6560<refentryinfo>
6561 <title>LINUX</title>
6562 <productname>Kernel Hackers Manual</productname>
6563 <date>July 2017</date>
6564</refentryinfo>
6565<refmeta>
6566 <refentrytitle><phrase>ktime_to_timespec_cond</phrase></refentrytitle>
6567 <manvolnum>9</manvolnum>
6568 <refmiscinfo class="version">4.1.27</refmiscinfo>
6569</refmeta>
6570<refnamediv>
6571 <refname>ktime_to_timespec_cond</refname>
6572 <refpurpose>
6573     convert a ktime_t variable to timespec format only if the variable contains data
6574 </refpurpose>
6575</refnamediv>
6576<refsynopsisdiv>
6577 <title>Synopsis</title>
6578  <funcsynopsis><funcprototype>
6579   <funcdef>bool <function>ktime_to_timespec_cond </function></funcdef>
6580   <paramdef>const ktime_t <parameter>kt</parameter></paramdef>
6581   <paramdef>struct timespec * <parameter>ts</parameter></paramdef>
6582  </funcprototype></funcsynopsis>
6583</refsynopsisdiv>
6584<refsect1>
6585 <title>Arguments</title>
6586 <variablelist>
6587  <varlistentry>
6588   <term><parameter>kt</parameter></term>
6589   <listitem>
6590    <para>
6591     the ktime_t variable to convert
6592    </para>
6593   </listitem>
6594  </varlistentry>
6595  <varlistentry>
6596   <term><parameter>ts</parameter></term>
6597   <listitem>
6598    <para>
6599     the timespec variable to store the result in
6600    </para>
6601   </listitem>
6602  </varlistentry>
6603 </variablelist>
6604</refsect1>
6605<refsect1>
6606<title>Return</title>
6607<para>
6608   <constant>true</constant> if there was a successful conversion, <constant>false</constant> if kt was 0.
6609</para>
6610</refsect1>
6611</refentry>
6612
6613<refentry id="API-ktime-to-timespec64-cond">
6614<refentryinfo>
6615 <title>LINUX</title>
6616 <productname>Kernel Hackers Manual</productname>
6617 <date>July 2017</date>
6618</refentryinfo>
6619<refmeta>
6620 <refentrytitle><phrase>ktime_to_timespec64_cond</phrase></refentrytitle>
6621 <manvolnum>9</manvolnum>
6622 <refmiscinfo class="version">4.1.27</refmiscinfo>
6623</refmeta>
6624<refnamediv>
6625 <refname>ktime_to_timespec64_cond</refname>
6626 <refpurpose>
6627     convert a ktime_t variable to timespec64 format only if the variable contains data
6628 </refpurpose>
6629</refnamediv>
6630<refsynopsisdiv>
6631 <title>Synopsis</title>
6632  <funcsynopsis><funcprototype>
6633   <funcdef>bool <function>ktime_to_timespec64_cond </function></funcdef>
6634   <paramdef>const ktime_t <parameter>kt</parameter></paramdef>
6635   <paramdef>struct timespec64 * <parameter>ts</parameter></paramdef>
6636  </funcprototype></funcsynopsis>
6637</refsynopsisdiv>
6638<refsect1>
6639 <title>Arguments</title>
6640 <variablelist>
6641  <varlistentry>
6642   <term><parameter>kt</parameter></term>
6643   <listitem>
6644    <para>
6645     the ktime_t variable to convert
6646    </para>
6647   </listitem>
6648  </varlistentry>
6649  <varlistentry>
6650   <term><parameter>ts</parameter></term>
6651   <listitem>
6652    <para>
6653     the timespec variable to store the result in
6654    </para>
6655   </listitem>
6656  </varlistentry>
6657 </variablelist>
6658</refsect1>
6659<refsect1>
6660<title>Return</title>
6661<para>
6662   <constant>true</constant> if there was a successful conversion, <constant>false</constant> if kt was 0.
6663</para>
6664</refsect1>
6665</refentry>
6666
6667<!-- include/linux/hrtimer.h -->
6668<refentry id="API-struct-hrtimer">
6669<refentryinfo>
6670 <title>LINUX</title>
6671 <productname>Kernel Hackers Manual</productname>
6672 <date>July 2017</date>
6673</refentryinfo>
6674<refmeta>
6675 <refentrytitle><phrase>struct hrtimer</phrase></refentrytitle>
6676 <manvolnum>9</manvolnum>
6677 <refmiscinfo class="version">4.1.27</refmiscinfo>
6678</refmeta>
6679<refnamediv>
6680 <refname>struct hrtimer</refname>
6681 <refpurpose>
6682  the basic hrtimer structure
6683 </refpurpose>
6684</refnamediv>
6685<refsynopsisdiv>
6686 <title>Synopsis</title>
6687  <programlisting>
6688struct hrtimer {
6689  struct timerqueue_node node;
6690  ktime_t _softexpires;
6691  enum hrtimer_restart		(* function) (struct hrtimer *);
6692  struct hrtimer_clock_base * base;
6693  unsigned long state;
6694#ifdef CONFIG_TIMER_STATS
6695  int start_pid;
6696  void * start_site;
6697  char start_comm[16];
6698#endif
6699};  </programlisting>
6700</refsynopsisdiv>
6701 <refsect1>
6702  <title>Members</title>
6703  <variablelist>
6704    <varlistentry>      <term>node</term>
6705      <listitem><para>
6706timerqueue node, which also manages node.expires,
6707the absolute expiry time in the hrtimers internal
6708representation. The time is related to the clock on
6709which the timer is based. Is setup by adding
6710slack to the _softexpires value. For non range timers
6711identical to _softexpires.
6712      </para></listitem>
6713    </varlistentry>
6714    <varlistentry>      <term>_softexpires</term>
6715      <listitem><para>
6716the absolute earliest expiry time of the hrtimer.
6717The time which was given as expiry time when the timer
6718was armed.
6719      </para></listitem>
6720    </varlistentry>
6721    <varlistentry>      <term>function</term>
6722      <listitem><para>
6723timer expiry callback function
6724      </para></listitem>
6725    </varlistentry>
6726    <varlistentry>      <term>base</term>
6727      <listitem><para>
6728pointer to the timer base (per cpu and per clock)
6729      </para></listitem>
6730    </varlistentry>
6731    <varlistentry>      <term>state</term>
6732      <listitem><para>
6733state information (See bit values above)
6734      </para></listitem>
6735    </varlistentry>
6736    <varlistentry>      <term>start_pid</term>
6737      <listitem><para>
6738timer statistics field to store the pid of the task which
6739started the timer
6740      </para></listitem>
6741    </varlistentry>
6742    <varlistentry>      <term>start_site</term>
6743      <listitem><para>
6744timer statistics field to store the site where the timer
6745was started
6746      </para></listitem>
6747    </varlistentry>
6748    <varlistentry>      <term>start_comm[16]</term>
6749      <listitem><para>
6750timer statistics field to store the name of the process which
6751started the timer
6752      </para></listitem>
6753    </varlistentry>
6754  </variablelist>
6755 </refsect1>
6756<refsect1>
6757<title>Description</title>
6758<para>
6759   The hrtimer structure must be initialized by <function>hrtimer_init</function>
6760</para>
6761</refsect1>
6762</refentry>
6763
6764<refentry id="API-struct-hrtimer-sleeper">
6765<refentryinfo>
6766 <title>LINUX</title>
6767 <productname>Kernel Hackers Manual</productname>
6768 <date>July 2017</date>
6769</refentryinfo>
6770<refmeta>
6771 <refentrytitle><phrase>struct hrtimer_sleeper</phrase></refentrytitle>
6772 <manvolnum>9</manvolnum>
6773 <refmiscinfo class="version">4.1.27</refmiscinfo>
6774</refmeta>
6775<refnamediv>
6776 <refname>struct hrtimer_sleeper</refname>
6777 <refpurpose>
6778     simple sleeper structure
6779 </refpurpose>
6780</refnamediv>
6781<refsynopsisdiv>
6782 <title>Synopsis</title>
6783  <programlisting>
6784struct hrtimer_sleeper {
6785  struct hrtimer timer;
6786  struct task_struct * task;
6787};  </programlisting>
6788</refsynopsisdiv>
6789 <refsect1>
6790  <title>Members</title>
6791  <variablelist>
6792    <varlistentry>      <term>timer</term>
6793      <listitem><para>
6794   embedded timer structure
6795      </para></listitem>
6796    </varlistentry>
6797    <varlistentry>      <term>task</term>
6798      <listitem><para>
6799   task to wake up
6800      </para></listitem>
6801    </varlistentry>
6802  </variablelist>
6803 </refsect1>
6804<refsect1>
6805<title>Description</title>
6806<para>
6807   task is set to NULL, when the timer expires.
6808</para>
6809</refsect1>
6810</refentry>
6811
6812<refentry id="API-struct-hrtimer-clock-base">
6813<refentryinfo>
6814 <title>LINUX</title>
6815 <productname>Kernel Hackers Manual</productname>
6816 <date>July 2017</date>
6817</refentryinfo>
6818<refmeta>
6819 <refentrytitle><phrase>struct hrtimer_clock_base</phrase></refentrytitle>
6820 <manvolnum>9</manvolnum>
6821 <refmiscinfo class="version">4.1.27</refmiscinfo>
6822</refmeta>
6823<refnamediv>
6824 <refname>struct hrtimer_clock_base</refname>
6825 <refpurpose>
6826     the timer base for a specific clock
6827 </refpurpose>
6828</refnamediv>
6829<refsynopsisdiv>
6830 <title>Synopsis</title>
6831  <programlisting>
6832struct hrtimer_clock_base {
6833  struct hrtimer_cpu_base * cpu_base;
6834  int index;
6835  clockid_t clockid;
6836  struct timerqueue_head active;
6837  ktime_t resolution;
6838  ktime_t (* get_time) (void);
6839  ktime_t softirq_time;
6840  ktime_t offset;
6841};  </programlisting>
6842</refsynopsisdiv>
6843 <refsect1>
6844  <title>Members</title>
6845  <variablelist>
6846    <varlistentry>      <term>cpu_base</term>
6847      <listitem><para>
6848   per cpu clock base
6849      </para></listitem>
6850    </varlistentry>
6851    <varlistentry>      <term>index</term>
6852      <listitem><para>
6853   clock type index for per_cpu support when moving a
6854   timer to a base on another cpu.
6855      </para></listitem>
6856    </varlistentry>
6857    <varlistentry>      <term>clockid</term>
6858      <listitem><para>
6859   clock id for per_cpu support
6860      </para></listitem>
6861    </varlistentry>
6862    <varlistentry>      <term>active</term>
6863      <listitem><para>
6864   red black tree root node for the active timers
6865      </para></listitem>
6866    </varlistentry>
6867    <varlistentry>      <term>resolution</term>
6868      <listitem><para>
6869   the resolution of the clock, in nanoseconds
6870      </para></listitem>
6871    </varlistentry>
6872    <varlistentry>      <term>get_time</term>
6873      <listitem><para>
6874   function to retrieve the current time of the clock
6875      </para></listitem>
6876    </varlistentry>
6877    <varlistentry>      <term>softirq_time</term>
6878      <listitem><para>
6879   the time when running the hrtimer queue in the softirq
6880      </para></listitem>
6881    </varlistentry>
6882    <varlistentry>      <term>offset</term>
6883      <listitem><para>
6884   offset of this clock to the monotonic base
6885      </para></listitem>
6886    </varlistentry>
6887  </variablelist>
6888 </refsect1>
6889</refentry>
6890
6891<!-- kernel/time/hrtimer.c -->
6892<refentry id="API-hrtimer-forward">
6893<refentryinfo>
6894 <title>LINUX</title>
6895 <productname>Kernel Hackers Manual</productname>
6896 <date>July 2017</date>
6897</refentryinfo>
6898<refmeta>
6899 <refentrytitle><phrase>hrtimer_forward</phrase></refentrytitle>
6900 <manvolnum>9</manvolnum>
6901 <refmiscinfo class="version">4.1.27</refmiscinfo>
6902</refmeta>
6903<refnamediv>
6904 <refname>hrtimer_forward</refname>
6905 <refpurpose>
6906  forward the timer expiry
6907 </refpurpose>
6908</refnamediv>
6909<refsynopsisdiv>
6910 <title>Synopsis</title>
6911  <funcsynopsis><funcprototype>
6912   <funcdef>u64 <function>hrtimer_forward </function></funcdef>
6913   <paramdef>struct hrtimer * <parameter>timer</parameter></paramdef>
6914   <paramdef>ktime_t <parameter>now</parameter></paramdef>
6915   <paramdef>ktime_t <parameter>interval</parameter></paramdef>
6916  </funcprototype></funcsynopsis>
6917</refsynopsisdiv>
6918<refsect1>
6919 <title>Arguments</title>
6920 <variablelist>
6921  <varlistentry>
6922   <term><parameter>timer</parameter></term>
6923   <listitem>
6924    <para>
6925     hrtimer to forward
6926    </para>
6927   </listitem>
6928  </varlistentry>
6929  <varlistentry>
6930   <term><parameter>now</parameter></term>
6931   <listitem>
6932    <para>
6933     forward past this time
6934    </para>
6935   </listitem>
6936  </varlistentry>
6937  <varlistentry>
6938   <term><parameter>interval</parameter></term>
6939   <listitem>
6940    <para>
6941     the interval to forward
6942    </para>
6943   </listitem>
6944  </varlistentry>
6945 </variablelist>
6946</refsect1>
6947<refsect1>
6948<title>Description</title>
6949<para>
6950   Forward the timer expiry so it will expire in the future.
6951   Returns the number of overruns.
6952</para>
6953</refsect1>
6954</refentry>
6955
6956<refentry id="API-hrtimer-start-range-ns">
6957<refentryinfo>
6958 <title>LINUX</title>
6959 <productname>Kernel Hackers Manual</productname>
6960 <date>July 2017</date>
6961</refentryinfo>
6962<refmeta>
6963 <refentrytitle><phrase>hrtimer_start_range_ns</phrase></refentrytitle>
6964 <manvolnum>9</manvolnum>
6965 <refmiscinfo class="version">4.1.27</refmiscinfo>
6966</refmeta>
6967<refnamediv>
6968 <refname>hrtimer_start_range_ns</refname>
6969 <refpurpose>
6970     (re)start an hrtimer on the current CPU
6971 </refpurpose>
6972</refnamediv>
6973<refsynopsisdiv>
6974 <title>Synopsis</title>
6975  <funcsynopsis><funcprototype>
6976   <funcdef>int <function>hrtimer_start_range_ns </function></funcdef>
6977   <paramdef>struct hrtimer * <parameter>timer</parameter></paramdef>
6978   <paramdef>ktime_t <parameter>tim</parameter></paramdef>
6979   <paramdef>unsigned long <parameter>delta_ns</parameter></paramdef>
6980   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
6981  </funcprototype></funcsynopsis>
6982</refsynopsisdiv>
6983<refsect1>
6984 <title>Arguments</title>
6985 <variablelist>
6986  <varlistentry>
6987   <term><parameter>timer</parameter></term>
6988   <listitem>
6989    <para>
6990     the timer to be added
6991    </para>
6992   </listitem>
6993  </varlistentry>
6994  <varlistentry>
6995   <term><parameter>tim</parameter></term>
6996   <listitem>
6997    <para>
6998     expiry time
6999    </para>
7000   </listitem>
7001  </varlistentry>
7002  <varlistentry>
7003   <term><parameter>delta_ns</parameter></term>
7004   <listitem>
7005    <para>
7006     "slack" range for the timer
7007    </para>
7008   </listitem>
7009  </varlistentry>
7010  <varlistentry>
7011   <term><parameter>mode</parameter></term>
7012   <listitem>
7013    <para>
7014     expiry mode: absolute (HRTIMER_MODE_ABS) or
7015     relative (HRTIMER_MODE_REL)
7016    </para>
7017   </listitem>
7018  </varlistentry>
7019 </variablelist>
7020</refsect1>
7021<refsect1>
7022<title>Returns</title>
7023<para>
7024   0 on success
7025   1 when the timer was active
7026</para>
7027</refsect1>
7028</refentry>
7029
7030<refentry id="API-hrtimer-start">
7031<refentryinfo>
7032 <title>LINUX</title>
7033 <productname>Kernel Hackers Manual</productname>
7034 <date>July 2017</date>
7035</refentryinfo>
7036<refmeta>
7037 <refentrytitle><phrase>hrtimer_start</phrase></refentrytitle>
7038 <manvolnum>9</manvolnum>
7039 <refmiscinfo class="version">4.1.27</refmiscinfo>
7040</refmeta>
7041<refnamediv>
7042 <refname>hrtimer_start</refname>
7043 <refpurpose>
7044     (re)start an hrtimer on the current CPU
7045 </refpurpose>
7046</refnamediv>
7047<refsynopsisdiv>
7048 <title>Synopsis</title>
7049  <funcsynopsis><funcprototype>
7050   <funcdef>int <function>hrtimer_start </function></funcdef>
7051   <paramdef>struct hrtimer * <parameter>timer</parameter></paramdef>
7052   <paramdef>ktime_t <parameter>tim</parameter></paramdef>
7053   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
7054  </funcprototype></funcsynopsis>
7055</refsynopsisdiv>
7056<refsect1>
7057 <title>Arguments</title>
7058 <variablelist>
7059  <varlistentry>
7060   <term><parameter>timer</parameter></term>
7061   <listitem>
7062    <para>
7063     the timer to be added
7064    </para>
7065   </listitem>
7066  </varlistentry>
7067  <varlistentry>
7068   <term><parameter>tim</parameter></term>
7069   <listitem>
7070    <para>
7071     expiry time
7072    </para>
7073   </listitem>
7074  </varlistentry>
7075  <varlistentry>
7076   <term><parameter>mode</parameter></term>
7077   <listitem>
7078    <para>
7079     expiry mode: absolute (HRTIMER_MODE_ABS) or
7080     relative (HRTIMER_MODE_REL)
7081    </para>
7082   </listitem>
7083  </varlistentry>
7084 </variablelist>
7085</refsect1>
7086<refsect1>
7087<title>Returns</title>
7088<para>
7089   0 on success
7090   1 when the timer was active
7091</para>
7092</refsect1>
7093</refentry>
7094
7095<refentry id="API-hrtimer-try-to-cancel">
7096<refentryinfo>
7097 <title>LINUX</title>
7098 <productname>Kernel Hackers Manual</productname>
7099 <date>July 2017</date>
7100</refentryinfo>
7101<refmeta>
7102 <refentrytitle><phrase>hrtimer_try_to_cancel</phrase></refentrytitle>
7103 <manvolnum>9</manvolnum>
7104 <refmiscinfo class="version">4.1.27</refmiscinfo>
7105</refmeta>
7106<refnamediv>
7107 <refname>hrtimer_try_to_cancel</refname>
7108 <refpurpose>
7109     try to deactivate a timer
7110 </refpurpose>
7111</refnamediv>
7112<refsynopsisdiv>
7113 <title>Synopsis</title>
7114  <funcsynopsis><funcprototype>
7115   <funcdef>int <function>hrtimer_try_to_cancel </function></funcdef>
7116   <paramdef>struct hrtimer * <parameter>timer</parameter></paramdef>
7117  </funcprototype></funcsynopsis>
7118</refsynopsisdiv>
7119<refsect1>
7120 <title>Arguments</title>
7121 <variablelist>
7122  <varlistentry>
7123   <term><parameter>timer</parameter></term>
7124   <listitem>
7125    <para>
7126     hrtimer to stop
7127    </para>
7128   </listitem>
7129  </varlistentry>
7130 </variablelist>
7131</refsect1>
7132<refsect1>
7133<title>Returns</title>
7134<para>
7135   0 when the timer was not active
7136   1 when the timer was active
7137   -1 when the timer is currently excuting the callback function and
7138   cannot be stopped
7139</para>
7140</refsect1>
7141</refentry>
7142
7143<refentry id="API-hrtimer-cancel">
7144<refentryinfo>
7145 <title>LINUX</title>
7146 <productname>Kernel Hackers Manual</productname>
7147 <date>July 2017</date>
7148</refentryinfo>
7149<refmeta>
7150 <refentrytitle><phrase>hrtimer_cancel</phrase></refentrytitle>
7151 <manvolnum>9</manvolnum>
7152 <refmiscinfo class="version">4.1.27</refmiscinfo>
7153</refmeta>
7154<refnamediv>
7155 <refname>hrtimer_cancel</refname>
7156 <refpurpose>
7157     cancel a timer and wait for the handler to finish.
7158 </refpurpose>
7159</refnamediv>
7160<refsynopsisdiv>
7161 <title>Synopsis</title>
7162  <funcsynopsis><funcprototype>
7163   <funcdef>int <function>hrtimer_cancel </function></funcdef>
7164   <paramdef>struct hrtimer * <parameter>timer</parameter></paramdef>
7165  </funcprototype></funcsynopsis>
7166</refsynopsisdiv>
7167<refsect1>
7168 <title>Arguments</title>
7169 <variablelist>
7170  <varlistentry>
7171   <term><parameter>timer</parameter></term>
7172   <listitem>
7173    <para>
7174     the timer to be cancelled
7175    </para>
7176   </listitem>
7177  </varlistentry>
7178 </variablelist>
7179</refsect1>
7180<refsect1>
7181<title>Returns</title>
7182<para>
7183   0 when the timer was not active
7184   1 when the timer was active
7185</para>
7186</refsect1>
7187</refentry>
7188
7189<refentry id="API-hrtimer-get-remaining">
7190<refentryinfo>
7191 <title>LINUX</title>
7192 <productname>Kernel Hackers Manual</productname>
7193 <date>July 2017</date>
7194</refentryinfo>
7195<refmeta>
7196 <refentrytitle><phrase>hrtimer_get_remaining</phrase></refentrytitle>
7197 <manvolnum>9</manvolnum>
7198 <refmiscinfo class="version">4.1.27</refmiscinfo>
7199</refmeta>
7200<refnamediv>
7201 <refname>hrtimer_get_remaining</refname>
7202 <refpurpose>
7203     get remaining time for the timer
7204 </refpurpose>
7205</refnamediv>
7206<refsynopsisdiv>
7207 <title>Synopsis</title>
7208  <funcsynopsis><funcprototype>
7209   <funcdef>ktime_t <function>hrtimer_get_remaining </function></funcdef>
7210   <paramdef>const struct hrtimer * <parameter>timer</parameter></paramdef>
7211  </funcprototype></funcsynopsis>
7212</refsynopsisdiv>
7213<refsect1>
7214 <title>Arguments</title>
7215 <variablelist>
7216  <varlistentry>
7217   <term><parameter>timer</parameter></term>
7218   <listitem>
7219    <para>
7220     the timer to read
7221    </para>
7222   </listitem>
7223  </varlistentry>
7224 </variablelist>
7225</refsect1>
7226</refentry>
7227
7228<refentry id="API-hrtimer-init">
7229<refentryinfo>
7230 <title>LINUX</title>
7231 <productname>Kernel Hackers Manual</productname>
7232 <date>July 2017</date>
7233</refentryinfo>
7234<refmeta>
7235 <refentrytitle><phrase>hrtimer_init</phrase></refentrytitle>
7236 <manvolnum>9</manvolnum>
7237 <refmiscinfo class="version">4.1.27</refmiscinfo>
7238</refmeta>
7239<refnamediv>
7240 <refname>hrtimer_init</refname>
7241 <refpurpose>
7242     initialize a timer to the given clock
7243 </refpurpose>
7244</refnamediv>
7245<refsynopsisdiv>
7246 <title>Synopsis</title>
7247  <funcsynopsis><funcprototype>
7248   <funcdef>void <function>hrtimer_init </function></funcdef>
7249   <paramdef>struct hrtimer * <parameter>timer</parameter></paramdef>
7250   <paramdef>clockid_t <parameter>clock_id</parameter></paramdef>
7251   <paramdef>enum hrtimer_mode <parameter>mode</parameter></paramdef>
7252  </funcprototype></funcsynopsis>
7253</refsynopsisdiv>
7254<refsect1>
7255 <title>Arguments</title>
7256 <variablelist>
7257  <varlistentry>
7258   <term><parameter>timer</parameter></term>
7259   <listitem>
7260    <para>
7261     the timer to be initialized
7262    </para>
7263   </listitem>
7264  </varlistentry>
7265  <varlistentry>
7266   <term><parameter>clock_id</parameter></term>
7267   <listitem>
7268    <para>
7269     the clock to be used
7270    </para>
7271   </listitem>
7272  </varlistentry>
7273  <varlistentry>
7274   <term><parameter>mode</parameter></term>
7275   <listitem>
7276    <para>
7277     timer mode abs/rel
7278    </para>
7279   </listitem>
7280  </varlistentry>
7281 </variablelist>
7282</refsect1>
7283</refentry>
7284
7285<refentry id="API-hrtimer-get-res">
7286<refentryinfo>
7287 <title>LINUX</title>
7288 <productname>Kernel Hackers Manual</productname>
7289 <date>July 2017</date>
7290</refentryinfo>
7291<refmeta>
7292 <refentrytitle><phrase>hrtimer_get_res</phrase></refentrytitle>
7293 <manvolnum>9</manvolnum>
7294 <refmiscinfo class="version">4.1.27</refmiscinfo>
7295</refmeta>
7296<refnamediv>
7297 <refname>hrtimer_get_res</refname>
7298 <refpurpose>
7299     get the timer resolution for a clock
7300 </refpurpose>
7301</refnamediv>
7302<refsynopsisdiv>
7303 <title>Synopsis</title>
7304  <funcsynopsis><funcprototype>
7305   <funcdef>int <function>hrtimer_get_res </function></funcdef>
7306   <paramdef>const clockid_t <parameter>which_clock</parameter></paramdef>
7307   <paramdef>struct timespec * <parameter>tp</parameter></paramdef>
7308  </funcprototype></funcsynopsis>
7309</refsynopsisdiv>
7310<refsect1>
7311 <title>Arguments</title>
7312 <variablelist>
7313  <varlistentry>
7314   <term><parameter>which_clock</parameter></term>
7315   <listitem>
7316    <para>
7317     which clock to query
7318    </para>
7319   </listitem>
7320  </varlistentry>
7321  <varlistentry>
7322   <term><parameter>tp</parameter></term>
7323   <listitem>
7324    <para>
7325     pointer to timespec variable to store the resolution
7326    </para>
7327   </listitem>
7328  </varlistentry>
7329 </variablelist>
7330</refsect1>
7331<refsect1>
7332<title>Description</title>
7333<para>
7334   Store the resolution of the clock selected by <parameter>which_clock</parameter> in the
7335   variable pointed to by <parameter>tp</parameter>.
7336</para>
7337</refsect1>
7338</refentry>
7339
7340<refentry id="API-schedule-hrtimeout-range">
7341<refentryinfo>
7342 <title>LINUX</title>
7343 <productname>Kernel Hackers Manual</productname>
7344 <date>July 2017</date>
7345</refentryinfo>
7346<refmeta>
7347 <refentrytitle><phrase>schedule_hrtimeout_range</phrase></refentrytitle>
7348 <manvolnum>9</manvolnum>
7349 <refmiscinfo class="version">4.1.27</refmiscinfo>
7350</refmeta>
7351<refnamediv>
7352 <refname>schedule_hrtimeout_range</refname>
7353 <refpurpose>
7354     sleep until timeout
7355 </refpurpose>
7356</refnamediv>
7357<refsynopsisdiv>
7358 <title>Synopsis</title>
7359  <funcsynopsis><funcprototype>
7360   <funcdef>int __sched <function>schedule_hrtimeout_range </function></funcdef>
7361   <paramdef>ktime_t * <parameter>expires</parameter></paramdef>
7362   <paramdef>unsigned long <parameter>delta</parameter></paramdef>
7363   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
7364  </funcprototype></funcsynopsis>
7365</refsynopsisdiv>
7366<refsect1>
7367 <title>Arguments</title>
7368 <variablelist>
7369  <varlistentry>
7370   <term><parameter>expires</parameter></term>
7371   <listitem>
7372    <para>
7373     timeout value (ktime_t)
7374    </para>
7375   </listitem>
7376  </varlistentry>
7377  <varlistentry>
7378   <term><parameter>delta</parameter></term>
7379   <listitem>
7380    <para>
7381     slack in expires timeout (ktime_t)
7382    </para>
7383   </listitem>
7384  </varlistentry>
7385  <varlistentry>
7386   <term><parameter>mode</parameter></term>
7387   <listitem>
7388    <para>
7389     timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL
7390    </para>
7391   </listitem>
7392  </varlistentry>
7393 </variablelist>
7394</refsect1>
7395<refsect1>
7396<title>Description</title>
7397<para>
7398   Make the current task sleep until the given expiry time has
7399   elapsed. The routine will return immediately unless
7400   the current task state has been set (see <function>set_current_state</function>).
7401   </para><para>
7402
7403   The <parameter>delta</parameter> argument gives the kernel the freedom to schedule the
7404   actual wakeup to a time that is both power and performance friendly.
7405   The kernel give the normal best effort behavior for "<parameter>expires</parameter>+<parameter>delta</parameter>",
7406   but may decide to fire the timer earlier, but no earlier than <parameter>expires</parameter>.
7407   </para><para>
7408
7409   You can set the task state as follows -
7410   </para><para>
7411
7412   <constant>TASK_UNINTERRUPTIBLE</constant> - at least <parameter>timeout</parameter> time is guaranteed to
7413   pass before the routine returns.
7414   </para><para>
7415
7416   <constant>TASK_INTERRUPTIBLE</constant> - the routine may return early if a signal is
7417   delivered to the current task.
7418   </para><para>
7419
7420   The current task state is guaranteed to be TASK_RUNNING when this
7421   routine returns.
7422   </para><para>
7423
7424   Returns 0 when the timer has expired otherwise -EINTR
7425</para>
7426</refsect1>
7427</refentry>
7428
7429<refentry id="API-schedule-hrtimeout">
7430<refentryinfo>
7431 <title>LINUX</title>
7432 <productname>Kernel Hackers Manual</productname>
7433 <date>July 2017</date>
7434</refentryinfo>
7435<refmeta>
7436 <refentrytitle><phrase>schedule_hrtimeout</phrase></refentrytitle>
7437 <manvolnum>9</manvolnum>
7438 <refmiscinfo class="version">4.1.27</refmiscinfo>
7439</refmeta>
7440<refnamediv>
7441 <refname>schedule_hrtimeout</refname>
7442 <refpurpose>
7443     sleep until timeout
7444 </refpurpose>
7445</refnamediv>
7446<refsynopsisdiv>
7447 <title>Synopsis</title>
7448  <funcsynopsis><funcprototype>
7449   <funcdef>int __sched <function>schedule_hrtimeout </function></funcdef>
7450   <paramdef>ktime_t * <parameter>expires</parameter></paramdef>
7451   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
7452  </funcprototype></funcsynopsis>
7453</refsynopsisdiv>
7454<refsect1>
7455 <title>Arguments</title>
7456 <variablelist>
7457  <varlistentry>
7458   <term><parameter>expires</parameter></term>
7459   <listitem>
7460    <para>
7461     timeout value (ktime_t)
7462    </para>
7463   </listitem>
7464  </varlistentry>
7465  <varlistentry>
7466   <term><parameter>mode</parameter></term>
7467   <listitem>
7468    <para>
7469     timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL
7470    </para>
7471   </listitem>
7472  </varlistentry>
7473 </variablelist>
7474</refsect1>
7475<refsect1>
7476<title>Description</title>
7477<para>
7478   Make the current task sleep until the given expiry time has
7479   elapsed. The routine will return immediately unless
7480   the current task state has been set (see <function>set_current_state</function>).
7481   </para><para>
7482
7483   You can set the task state as follows -
7484   </para><para>
7485
7486   <constant>TASK_UNINTERRUPTIBLE</constant> - at least <parameter>timeout</parameter> time is guaranteed to
7487   pass before the routine returns.
7488   </para><para>
7489
7490   <constant>TASK_INTERRUPTIBLE</constant> - the routine may return early if a signal is
7491   delivered to the current task.
7492   </para><para>
7493
7494   The current task state is guaranteed to be TASK_RUNNING when this
7495   routine returns.
7496   </para><para>
7497
7498   Returns 0 when the timer has expired otherwise -EINTR
7499</para>
7500</refsect1>
7501</refentry>
7502
7503     </sect1>
7504     <sect1><title>Workqueues and Kevents</title>
7505<!-- kernel/workqueue.c -->
7506<refentry id="API-queue-work-on">
7507<refentryinfo>
7508 <title>LINUX</title>
7509 <productname>Kernel Hackers Manual</productname>
7510 <date>July 2017</date>
7511</refentryinfo>
7512<refmeta>
7513 <refentrytitle><phrase>queue_work_on</phrase></refentrytitle>
7514 <manvolnum>9</manvolnum>
7515 <refmiscinfo class="version">4.1.27</refmiscinfo>
7516</refmeta>
7517<refnamediv>
7518 <refname>queue_work_on</refname>
7519 <refpurpose>
7520  queue work on specific cpu
7521 </refpurpose>
7522</refnamediv>
7523<refsynopsisdiv>
7524 <title>Synopsis</title>
7525  <funcsynopsis><funcprototype>
7526   <funcdef>bool <function>queue_work_on </function></funcdef>
7527   <paramdef>int <parameter>cpu</parameter></paramdef>
7528   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7529   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
7530  </funcprototype></funcsynopsis>
7531</refsynopsisdiv>
7532<refsect1>
7533 <title>Arguments</title>
7534 <variablelist>
7535  <varlistentry>
7536   <term><parameter>cpu</parameter></term>
7537   <listitem>
7538    <para>
7539     CPU number to execute work on
7540    </para>
7541   </listitem>
7542  </varlistentry>
7543  <varlistentry>
7544   <term><parameter>wq</parameter></term>
7545   <listitem>
7546    <para>
7547     workqueue to use
7548    </para>
7549   </listitem>
7550  </varlistentry>
7551  <varlistentry>
7552   <term><parameter>work</parameter></term>
7553   <listitem>
7554    <para>
7555     work to queue
7556    </para>
7557   </listitem>
7558  </varlistentry>
7559 </variablelist>
7560</refsect1>
7561<refsect1>
7562<title>Description</title>
7563<para>
7564   We queue the work to a specific CPU, the caller must ensure it
7565   can't go away.
7566</para>
7567</refsect1>
7568<refsect1>
7569<title>Return</title>
7570<para>
7571   <constant>false</constant> if <parameter>work</parameter> was already on a queue, <constant>true</constant> otherwise.
7572</para>
7573</refsect1>
7574</refentry>
7575
7576<refentry id="API-queue-delayed-work-on">
7577<refentryinfo>
7578 <title>LINUX</title>
7579 <productname>Kernel Hackers Manual</productname>
7580 <date>July 2017</date>
7581</refentryinfo>
7582<refmeta>
7583 <refentrytitle><phrase>queue_delayed_work_on</phrase></refentrytitle>
7584 <manvolnum>9</manvolnum>
7585 <refmiscinfo class="version">4.1.27</refmiscinfo>
7586</refmeta>
7587<refnamediv>
7588 <refname>queue_delayed_work_on</refname>
7589 <refpurpose>
7590     queue work on specific CPU after delay
7591 </refpurpose>
7592</refnamediv>
7593<refsynopsisdiv>
7594 <title>Synopsis</title>
7595  <funcsynopsis><funcprototype>
7596   <funcdef>bool <function>queue_delayed_work_on </function></funcdef>
7597   <paramdef>int <parameter>cpu</parameter></paramdef>
7598   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7599   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
7600   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
7601  </funcprototype></funcsynopsis>
7602</refsynopsisdiv>
7603<refsect1>
7604 <title>Arguments</title>
7605 <variablelist>
7606  <varlistentry>
7607   <term><parameter>cpu</parameter></term>
7608   <listitem>
7609    <para>
7610     CPU number to execute work on
7611    </para>
7612   </listitem>
7613  </varlistentry>
7614  <varlistentry>
7615   <term><parameter>wq</parameter></term>
7616   <listitem>
7617    <para>
7618     workqueue to use
7619    </para>
7620   </listitem>
7621  </varlistentry>
7622  <varlistentry>
7623   <term><parameter>dwork</parameter></term>
7624   <listitem>
7625    <para>
7626     work to queue
7627    </para>
7628   </listitem>
7629  </varlistentry>
7630  <varlistentry>
7631   <term><parameter>delay</parameter></term>
7632   <listitem>
7633    <para>
7634     number of jiffies to wait before queueing
7635    </para>
7636   </listitem>
7637  </varlistentry>
7638 </variablelist>
7639</refsect1>
7640<refsect1>
7641<title>Return</title>
7642<para>
7643   <constant>false</constant> if <parameter>work</parameter> was already on a queue, <constant>true</constant> otherwise.  If
7644   <parameter>delay</parameter> is zero and <parameter>dwork</parameter> is idle, it will be scheduled for immediate
7645   execution.
7646</para>
7647</refsect1>
7648</refentry>
7649
7650<refentry id="API-mod-delayed-work-on">
7651<refentryinfo>
7652 <title>LINUX</title>
7653 <productname>Kernel Hackers Manual</productname>
7654 <date>July 2017</date>
7655</refentryinfo>
7656<refmeta>
7657 <refentrytitle><phrase>mod_delayed_work_on</phrase></refentrytitle>
7658 <manvolnum>9</manvolnum>
7659 <refmiscinfo class="version">4.1.27</refmiscinfo>
7660</refmeta>
7661<refnamediv>
7662 <refname>mod_delayed_work_on</refname>
7663 <refpurpose>
7664     modify delay of or queue a delayed work on specific CPU
7665 </refpurpose>
7666</refnamediv>
7667<refsynopsisdiv>
7668 <title>Synopsis</title>
7669  <funcsynopsis><funcprototype>
7670   <funcdef>bool <function>mod_delayed_work_on </function></funcdef>
7671   <paramdef>int <parameter>cpu</parameter></paramdef>
7672   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7673   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
7674   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
7675  </funcprototype></funcsynopsis>
7676</refsynopsisdiv>
7677<refsect1>
7678 <title>Arguments</title>
7679 <variablelist>
7680  <varlistentry>
7681   <term><parameter>cpu</parameter></term>
7682   <listitem>
7683    <para>
7684     CPU number to execute work on
7685    </para>
7686   </listitem>
7687  </varlistentry>
7688  <varlistentry>
7689   <term><parameter>wq</parameter></term>
7690   <listitem>
7691    <para>
7692     workqueue to use
7693    </para>
7694   </listitem>
7695  </varlistentry>
7696  <varlistentry>
7697   <term><parameter>dwork</parameter></term>
7698   <listitem>
7699    <para>
7700     work to queue
7701    </para>
7702   </listitem>
7703  </varlistentry>
7704  <varlistentry>
7705   <term><parameter>delay</parameter></term>
7706   <listitem>
7707    <para>
7708     number of jiffies to wait before queueing
7709    </para>
7710   </listitem>
7711  </varlistentry>
7712 </variablelist>
7713</refsect1>
7714<refsect1>
7715<title>Description</title>
7716<para>
7717   If <parameter>dwork</parameter> is idle, equivalent to <function>queue_delayed_work_on</function>; otherwise,
7718   modify <parameter>dwork</parameter>'s timer so that it expires after <parameter>delay</parameter>.  If <parameter>delay</parameter> is
7719   zero, <parameter>work</parameter> is guaranteed to be scheduled immediately regardless of its
7720   current state.
7721</para>
7722</refsect1>
7723<refsect1>
7724<title>Return</title>
7725<para>
7726   <constant>false</constant> if <parameter>dwork</parameter> was idle and queued, <constant>true</constant> if <parameter>dwork</parameter> was
7727   pending and its timer was modified.
7728   </para><para>
7729
7730   This function is safe to call from any context including IRQ handler.
7731   See <function>try_to_grab_pending</function> for details.
7732</para>
7733</refsect1>
7734</refentry>
7735
7736<refentry id="API-flush-workqueue">
7737<refentryinfo>
7738 <title>LINUX</title>
7739 <productname>Kernel Hackers Manual</productname>
7740 <date>July 2017</date>
7741</refentryinfo>
7742<refmeta>
7743 <refentrytitle><phrase>flush_workqueue</phrase></refentrytitle>
7744 <manvolnum>9</manvolnum>
7745 <refmiscinfo class="version">4.1.27</refmiscinfo>
7746</refmeta>
7747<refnamediv>
7748 <refname>flush_workqueue</refname>
7749 <refpurpose>
7750     ensure that any scheduled work has run to completion.
7751 </refpurpose>
7752</refnamediv>
7753<refsynopsisdiv>
7754 <title>Synopsis</title>
7755  <funcsynopsis><funcprototype>
7756   <funcdef>void <function>flush_workqueue </function></funcdef>
7757   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7758  </funcprototype></funcsynopsis>
7759</refsynopsisdiv>
7760<refsect1>
7761 <title>Arguments</title>
7762 <variablelist>
7763  <varlistentry>
7764   <term><parameter>wq</parameter></term>
7765   <listitem>
7766    <para>
7767     workqueue to flush
7768    </para>
7769   </listitem>
7770  </varlistentry>
7771 </variablelist>
7772</refsect1>
7773<refsect1>
7774<title>Description</title>
7775<para>
7776   This function sleeps until all work items which were queued on entry
7777   have finished execution, but it is not livelocked by new incoming ones.
7778</para>
7779</refsect1>
7780</refentry>
7781
7782<refentry id="API-drain-workqueue">
7783<refentryinfo>
7784 <title>LINUX</title>
7785 <productname>Kernel Hackers Manual</productname>
7786 <date>July 2017</date>
7787</refentryinfo>
7788<refmeta>
7789 <refentrytitle><phrase>drain_workqueue</phrase></refentrytitle>
7790 <manvolnum>9</manvolnum>
7791 <refmiscinfo class="version">4.1.27</refmiscinfo>
7792</refmeta>
7793<refnamediv>
7794 <refname>drain_workqueue</refname>
7795 <refpurpose>
7796     drain a workqueue
7797 </refpurpose>
7798</refnamediv>
7799<refsynopsisdiv>
7800 <title>Synopsis</title>
7801  <funcsynopsis><funcprototype>
7802   <funcdef>void <function>drain_workqueue </function></funcdef>
7803   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7804  </funcprototype></funcsynopsis>
7805</refsynopsisdiv>
7806<refsect1>
7807 <title>Arguments</title>
7808 <variablelist>
7809  <varlistentry>
7810   <term><parameter>wq</parameter></term>
7811   <listitem>
7812    <para>
7813     workqueue to drain
7814    </para>
7815   </listitem>
7816  </varlistentry>
7817 </variablelist>
7818</refsect1>
7819<refsect1>
7820<title>Description</title>
7821<para>
7822   Wait until the workqueue becomes empty.  While draining is in progress,
7823   only chain queueing is allowed.  IOW, only currently pending or running
7824   work items on <parameter>wq</parameter> can queue further work items on it.  <parameter>wq</parameter> is flushed
7825   repeatedly until it becomes empty.  The number of flushing is detemined
7826   by the depth of chaining and should be relatively short.  Whine if it
7827   takes too long.
7828</para>
7829</refsect1>
7830</refentry>
7831
7832<refentry id="API-flush-work">
7833<refentryinfo>
7834 <title>LINUX</title>
7835 <productname>Kernel Hackers Manual</productname>
7836 <date>July 2017</date>
7837</refentryinfo>
7838<refmeta>
7839 <refentrytitle><phrase>flush_work</phrase></refentrytitle>
7840 <manvolnum>9</manvolnum>
7841 <refmiscinfo class="version">4.1.27</refmiscinfo>
7842</refmeta>
7843<refnamediv>
7844 <refname>flush_work</refname>
7845 <refpurpose>
7846     wait for a work to finish executing the last queueing instance
7847 </refpurpose>
7848</refnamediv>
7849<refsynopsisdiv>
7850 <title>Synopsis</title>
7851  <funcsynopsis><funcprototype>
7852   <funcdef>bool <function>flush_work </function></funcdef>
7853   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
7854  </funcprototype></funcsynopsis>
7855</refsynopsisdiv>
7856<refsect1>
7857 <title>Arguments</title>
7858 <variablelist>
7859  <varlistentry>
7860   <term><parameter>work</parameter></term>
7861   <listitem>
7862    <para>
7863     the work to flush
7864    </para>
7865   </listitem>
7866  </varlistentry>
7867 </variablelist>
7868</refsect1>
7869<refsect1>
7870<title>Description</title>
7871<para>
7872   Wait until <parameter>work</parameter> has finished execution.  <parameter>work</parameter> is guaranteed to be idle
7873   on return if it hasn't been requeued since flush started.
7874</para>
7875</refsect1>
7876<refsect1>
7877<title>Return</title>
7878<para>
7879   <constant>true</constant> if <function>flush_work</function> waited for the work to finish execution,
7880   <constant>false</constant> if it was already idle.
7881</para>
7882</refsect1>
7883</refentry>
7884
7885<refentry id="API-cancel-work-sync">
7886<refentryinfo>
7887 <title>LINUX</title>
7888 <productname>Kernel Hackers Manual</productname>
7889 <date>July 2017</date>
7890</refentryinfo>
7891<refmeta>
7892 <refentrytitle><phrase>cancel_work_sync</phrase></refentrytitle>
7893 <manvolnum>9</manvolnum>
7894 <refmiscinfo class="version">4.1.27</refmiscinfo>
7895</refmeta>
7896<refnamediv>
7897 <refname>cancel_work_sync</refname>
7898 <refpurpose>
7899     cancel a work and wait for it to finish
7900 </refpurpose>
7901</refnamediv>
7902<refsynopsisdiv>
7903 <title>Synopsis</title>
7904  <funcsynopsis><funcprototype>
7905   <funcdef>bool <function>cancel_work_sync </function></funcdef>
7906   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
7907  </funcprototype></funcsynopsis>
7908</refsynopsisdiv>
7909<refsect1>
7910 <title>Arguments</title>
7911 <variablelist>
7912  <varlistentry>
7913   <term><parameter>work</parameter></term>
7914   <listitem>
7915    <para>
7916     the work to cancel
7917    </para>
7918   </listitem>
7919  </varlistentry>
7920 </variablelist>
7921</refsect1>
7922<refsect1>
7923<title>Description</title>
7924<para>
7925   Cancel <parameter>work</parameter> and wait for its execution to finish.  This function
7926   can be used even if the work re-queues itself or migrates to
7927   another workqueue.  On return from this function, <parameter>work</parameter> is
7928   guaranteed to be not pending or executing on any CPU.
7929   </para><para>
7930
7931   cancel_work_sync(<structname>delayed_work</structname>-&gt;work) must not be used for
7932   delayed_work's.  Use <function>cancel_delayed_work_sync</function> instead.
7933   </para><para>
7934
7935   The caller must ensure that the workqueue on which <parameter>work</parameter> was last
7936   queued can't be destroyed before this function returns.
7937</para>
7938</refsect1>
7939<refsect1>
7940<title>Return</title>
7941<para>
7942   <constant>true</constant> if <parameter>work</parameter> was pending, <constant>false</constant> otherwise.
7943</para>
7944</refsect1>
7945</refentry>
7946
7947<refentry id="API-flush-delayed-work">
7948<refentryinfo>
7949 <title>LINUX</title>
7950 <productname>Kernel Hackers Manual</productname>
7951 <date>July 2017</date>
7952</refentryinfo>
7953<refmeta>
7954 <refentrytitle><phrase>flush_delayed_work</phrase></refentrytitle>
7955 <manvolnum>9</manvolnum>
7956 <refmiscinfo class="version">4.1.27</refmiscinfo>
7957</refmeta>
7958<refnamediv>
7959 <refname>flush_delayed_work</refname>
7960 <refpurpose>
7961     wait for a dwork to finish executing the last queueing
7962 </refpurpose>
7963</refnamediv>
7964<refsynopsisdiv>
7965 <title>Synopsis</title>
7966  <funcsynopsis><funcprototype>
7967   <funcdef>bool <function>flush_delayed_work </function></funcdef>
7968   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
7969  </funcprototype></funcsynopsis>
7970</refsynopsisdiv>
7971<refsect1>
7972 <title>Arguments</title>
7973 <variablelist>
7974  <varlistentry>
7975   <term><parameter>dwork</parameter></term>
7976   <listitem>
7977    <para>
7978     the delayed work to flush
7979    </para>
7980   </listitem>
7981  </varlistentry>
7982 </variablelist>
7983</refsect1>
7984<refsect1>
7985<title>Description</title>
7986<para>
7987   Delayed timer is cancelled and the pending work is queued for
7988   immediate execution.  Like <function>flush_work</function>, this function only
7989   considers the last queueing instance of <parameter>dwork</parameter>.
7990</para>
7991</refsect1>
7992<refsect1>
7993<title>Return</title>
7994<para>
7995   <constant>true</constant> if <function>flush_work</function> waited for the work to finish execution,
7996   <constant>false</constant> if it was already idle.
7997</para>
7998</refsect1>
7999</refentry>
8000
8001<refentry id="API-cancel-delayed-work">
8002<refentryinfo>
8003 <title>LINUX</title>
8004 <productname>Kernel Hackers Manual</productname>
8005 <date>July 2017</date>
8006</refentryinfo>
8007<refmeta>
8008 <refentrytitle><phrase>cancel_delayed_work</phrase></refentrytitle>
8009 <manvolnum>9</manvolnum>
8010 <refmiscinfo class="version">4.1.27</refmiscinfo>
8011</refmeta>
8012<refnamediv>
8013 <refname>cancel_delayed_work</refname>
8014 <refpurpose>
8015     cancel a delayed work
8016 </refpurpose>
8017</refnamediv>
8018<refsynopsisdiv>
8019 <title>Synopsis</title>
8020  <funcsynopsis><funcprototype>
8021   <funcdef>bool <function>cancel_delayed_work </function></funcdef>
8022   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8023  </funcprototype></funcsynopsis>
8024</refsynopsisdiv>
8025<refsect1>
8026 <title>Arguments</title>
8027 <variablelist>
8028  <varlistentry>
8029   <term><parameter>dwork</parameter></term>
8030   <listitem>
8031    <para>
8032     delayed_work to cancel
8033    </para>
8034   </listitem>
8035  </varlistentry>
8036 </variablelist>
8037</refsect1>
8038<refsect1>
8039<title>Description</title>
8040<para>
8041   Kill off a pending delayed_work.
8042</para>
8043</refsect1>
8044<refsect1>
8045<title>Return</title>
8046<para>
8047   <constant>true</constant> if <parameter>dwork</parameter> was pending and canceled; <constant>false</constant> if it wasn't
8048   pending.
8049</para>
8050</refsect1>
8051<refsect1>
8052<title>Note</title>
8053<para>
8054   The work callback function may still be running on return, unless
8055   it returns <constant>true</constant> and the work doesn't re-arm itself.  Explicitly flush or
8056   use <function>cancel_delayed_work_sync</function> to wait on it.
8057   </para><para>
8058
8059   This function is safe to call from any context including IRQ handler.
8060</para>
8061</refsect1>
8062</refentry>
8063
8064<refentry id="API-cancel-delayed-work-sync">
8065<refentryinfo>
8066 <title>LINUX</title>
8067 <productname>Kernel Hackers Manual</productname>
8068 <date>July 2017</date>
8069</refentryinfo>
8070<refmeta>
8071 <refentrytitle><phrase>cancel_delayed_work_sync</phrase></refentrytitle>
8072 <manvolnum>9</manvolnum>
8073 <refmiscinfo class="version">4.1.27</refmiscinfo>
8074</refmeta>
8075<refnamediv>
8076 <refname>cancel_delayed_work_sync</refname>
8077 <refpurpose>
8078     cancel a delayed work and wait for it to finish
8079 </refpurpose>
8080</refnamediv>
8081<refsynopsisdiv>
8082 <title>Synopsis</title>
8083  <funcsynopsis><funcprototype>
8084   <funcdef>bool <function>cancel_delayed_work_sync </function></funcdef>
8085   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8086  </funcprototype></funcsynopsis>
8087</refsynopsisdiv>
8088<refsect1>
8089 <title>Arguments</title>
8090 <variablelist>
8091  <varlistentry>
8092   <term><parameter>dwork</parameter></term>
8093   <listitem>
8094    <para>
8095     the delayed work cancel
8096    </para>
8097   </listitem>
8098  </varlistentry>
8099 </variablelist>
8100</refsect1>
8101<refsect1>
8102<title>Description</title>
8103<para>
8104   This is <function>cancel_work_sync</function> for delayed works.
8105</para>
8106</refsect1>
8107<refsect1>
8108<title>Return</title>
8109<para>
8110   <constant>true</constant> if <parameter>dwork</parameter> was pending, <constant>false</constant> otherwise.
8111</para>
8112</refsect1>
8113</refentry>
8114
8115<refentry id="API-flush-scheduled-work">
8116<refentryinfo>
8117 <title>LINUX</title>
8118 <productname>Kernel Hackers Manual</productname>
8119 <date>July 2017</date>
8120</refentryinfo>
8121<refmeta>
8122 <refentrytitle><phrase>flush_scheduled_work</phrase></refentrytitle>
8123 <manvolnum>9</manvolnum>
8124 <refmiscinfo class="version">4.1.27</refmiscinfo>
8125</refmeta>
8126<refnamediv>
8127 <refname>flush_scheduled_work</refname>
8128 <refpurpose>
8129     ensure that any scheduled work has run to completion.
8130 </refpurpose>
8131</refnamediv>
8132<refsynopsisdiv>
8133 <title>Synopsis</title>
8134  <funcsynopsis><funcprototype>
8135   <funcdef>void <function>flush_scheduled_work </function></funcdef>
8136   <paramdef> <parameter>void</parameter></paramdef>
8137  </funcprototype></funcsynopsis>
8138</refsynopsisdiv>
8139<refsect1>
8140 <title>Arguments</title>
8141 <variablelist>
8142  <varlistentry>
8143   <term><parameter>void</parameter></term>
8144   <listitem>
8145    <para>
8146     no arguments
8147    </para>
8148   </listitem>
8149  </varlistentry>
8150 </variablelist>
8151</refsect1>
8152<refsect1>
8153<title>Description</title>
8154<para>
8155   </para><para>
8156
8157   Forces execution of the kernel-global workqueue and blocks until its
8158   completion.
8159   </para><para>
8160
8161   Think twice before calling this function!  It's very easy to get into
8162   trouble if you don't take great care.  Either of the following situations
8163</para>
8164</refsect1>
8165<refsect1>
8166<title>will lead to deadlock</title>
8167<para>
8168   </para><para>
8169
8170   One of the work items currently on the workqueue needs to acquire
8171   a lock held by your code or its caller.
8172   </para><para>
8173
8174   Your code is running in the context of a work routine.
8175   </para><para>
8176
8177   They will be detected by lockdep when they occur, but the first might not
8178   occur very often.  It depends on what work items are on the workqueue and
8179   what locks they need, which you have no control over.
8180   </para><para>
8181
8182   In most situations flushing the entire workqueue is overkill; you merely
8183   need to know that a particular work item isn't queued and isn't running.
8184   In such cases you should use <function>cancel_delayed_work_sync</function> or
8185   <function>cancel_work_sync</function> instead.
8186</para>
8187</refsect1>
8188</refentry>
8189
8190<refentry id="API-execute-in-process-context">
8191<refentryinfo>
8192 <title>LINUX</title>
8193 <productname>Kernel Hackers Manual</productname>
8194 <date>July 2017</date>
8195</refentryinfo>
8196<refmeta>
8197 <refentrytitle><phrase>execute_in_process_context</phrase></refentrytitle>
8198 <manvolnum>9</manvolnum>
8199 <refmiscinfo class="version">4.1.27</refmiscinfo>
8200</refmeta>
8201<refnamediv>
8202 <refname>execute_in_process_context</refname>
8203 <refpurpose>
8204     reliably execute the routine with user context
8205 </refpurpose>
8206</refnamediv>
8207<refsynopsisdiv>
8208 <title>Synopsis</title>
8209  <funcsynopsis><funcprototype>
8210   <funcdef>int <function>execute_in_process_context </function></funcdef>
8211   <paramdef>work_func_t <parameter>fn</parameter></paramdef>
8212   <paramdef>struct execute_work * <parameter>ew</parameter></paramdef>
8213  </funcprototype></funcsynopsis>
8214</refsynopsisdiv>
8215<refsect1>
8216 <title>Arguments</title>
8217 <variablelist>
8218  <varlistentry>
8219   <term><parameter>fn</parameter></term>
8220   <listitem>
8221    <para>
8222     the function to execute
8223    </para>
8224   </listitem>
8225  </varlistentry>
8226  <varlistentry>
8227   <term><parameter>ew</parameter></term>
8228   <listitem>
8229    <para>
8230     guaranteed storage for the execute work structure (must
8231     be available when the work executes)
8232    </para>
8233   </listitem>
8234  </varlistentry>
8235 </variablelist>
8236</refsect1>
8237<refsect1>
8238<title>Description</title>
8239<para>
8240   Executes the function immediately if process context is available,
8241   otherwise schedules the function for delayed execution.
8242</para>
8243</refsect1>
8244<refsect1>
8245<title>Return</title>
8246<para>
8247   0 - function was executed
8248   1 - function was scheduled for execution
8249</para>
8250</refsect1>
8251</refentry>
8252
8253<refentry id="API-destroy-workqueue">
8254<refentryinfo>
8255 <title>LINUX</title>
8256 <productname>Kernel Hackers Manual</productname>
8257 <date>July 2017</date>
8258</refentryinfo>
8259<refmeta>
8260 <refentrytitle><phrase>destroy_workqueue</phrase></refentrytitle>
8261 <manvolnum>9</manvolnum>
8262 <refmiscinfo class="version">4.1.27</refmiscinfo>
8263</refmeta>
8264<refnamediv>
8265 <refname>destroy_workqueue</refname>
8266 <refpurpose>
8267     safely terminate a workqueue
8268 </refpurpose>
8269</refnamediv>
8270<refsynopsisdiv>
8271 <title>Synopsis</title>
8272  <funcsynopsis><funcprototype>
8273   <funcdef>void <function>destroy_workqueue </function></funcdef>
8274   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8275  </funcprototype></funcsynopsis>
8276</refsynopsisdiv>
8277<refsect1>
8278 <title>Arguments</title>
8279 <variablelist>
8280  <varlistentry>
8281   <term><parameter>wq</parameter></term>
8282   <listitem>
8283    <para>
8284     target workqueue
8285    </para>
8286   </listitem>
8287  </varlistentry>
8288 </variablelist>
8289</refsect1>
8290<refsect1>
8291<title>Description</title>
8292<para>
8293   Safely destroy a workqueue. All work currently pending will be done first.
8294</para>
8295</refsect1>
8296</refentry>
8297
8298<refentry id="API-workqueue-set-max-active">
8299<refentryinfo>
8300 <title>LINUX</title>
8301 <productname>Kernel Hackers Manual</productname>
8302 <date>July 2017</date>
8303</refentryinfo>
8304<refmeta>
8305 <refentrytitle><phrase>workqueue_set_max_active</phrase></refentrytitle>
8306 <manvolnum>9</manvolnum>
8307 <refmiscinfo class="version">4.1.27</refmiscinfo>
8308</refmeta>
8309<refnamediv>
8310 <refname>workqueue_set_max_active</refname>
8311 <refpurpose>
8312     adjust max_active of a workqueue
8313 </refpurpose>
8314</refnamediv>
8315<refsynopsisdiv>
8316 <title>Synopsis</title>
8317  <funcsynopsis><funcprototype>
8318   <funcdef>void <function>workqueue_set_max_active </function></funcdef>
8319   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8320   <paramdef>int <parameter>max_active</parameter></paramdef>
8321  </funcprototype></funcsynopsis>
8322</refsynopsisdiv>
8323<refsect1>
8324 <title>Arguments</title>
8325 <variablelist>
8326  <varlistentry>
8327   <term><parameter>wq</parameter></term>
8328   <listitem>
8329    <para>
8330     target workqueue
8331    </para>
8332   </listitem>
8333  </varlistentry>
8334  <varlistentry>
8335   <term><parameter>max_active</parameter></term>
8336   <listitem>
8337    <para>
8338     new max_active value.
8339    </para>
8340   </listitem>
8341  </varlistentry>
8342 </variablelist>
8343</refsect1>
8344<refsect1>
8345<title>Description</title>
8346<para>
8347   Set max_active of <parameter>wq</parameter> to <parameter>max_active</parameter>.
8348</para>
8349</refsect1>
8350<refsect1>
8351<title>CONTEXT</title>
8352<para>
8353   Don't call from IRQ context.
8354</para>
8355</refsect1>
8356</refentry>
8357
8358<refentry id="API-workqueue-congested">
8359<refentryinfo>
8360 <title>LINUX</title>
8361 <productname>Kernel Hackers Manual</productname>
8362 <date>July 2017</date>
8363</refentryinfo>
8364<refmeta>
8365 <refentrytitle><phrase>workqueue_congested</phrase></refentrytitle>
8366 <manvolnum>9</manvolnum>
8367 <refmiscinfo class="version">4.1.27</refmiscinfo>
8368</refmeta>
8369<refnamediv>
8370 <refname>workqueue_congested</refname>
8371 <refpurpose>
8372     test whether a workqueue is congested
8373 </refpurpose>
8374</refnamediv>
8375<refsynopsisdiv>
8376 <title>Synopsis</title>
8377  <funcsynopsis><funcprototype>
8378   <funcdef>bool <function>workqueue_congested </function></funcdef>
8379   <paramdef>int <parameter>cpu</parameter></paramdef>
8380   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8381  </funcprototype></funcsynopsis>
8382</refsynopsisdiv>
8383<refsect1>
8384 <title>Arguments</title>
8385 <variablelist>
8386  <varlistentry>
8387   <term><parameter>cpu</parameter></term>
8388   <listitem>
8389    <para>
8390     CPU in question
8391    </para>
8392   </listitem>
8393  </varlistentry>
8394  <varlistentry>
8395   <term><parameter>wq</parameter></term>
8396   <listitem>
8397    <para>
8398     target workqueue
8399    </para>
8400   </listitem>
8401  </varlistentry>
8402 </variablelist>
8403</refsect1>
8404<refsect1>
8405<title>Description</title>
8406<para>
8407   Test whether <parameter>wq</parameter>'s cpu workqueue for <parameter>cpu</parameter> is congested.  There is
8408   no synchronization around this function and the test result is
8409   unreliable and only useful as advisory hints or for debugging.
8410   </para><para>
8411
8412   If <parameter>cpu</parameter> is WORK_CPU_UNBOUND, the test is performed on the local CPU.
8413   Note that both per-cpu and unbound workqueues may be associated with
8414   multiple pool_workqueues which have separate congested states.  A
8415   workqueue being congested on one CPU doesn't mean the workqueue is also
8416   contested on other CPUs / NUMA nodes.
8417</para>
8418</refsect1>
8419<refsect1>
8420<title>Return</title>
8421<para>
8422   <constant>true</constant> if congested, <constant>false</constant> otherwise.
8423</para>
8424</refsect1>
8425</refentry>
8426
8427<refentry id="API-work-busy">
8428<refentryinfo>
8429 <title>LINUX</title>
8430 <productname>Kernel Hackers Manual</productname>
8431 <date>July 2017</date>
8432</refentryinfo>
8433<refmeta>
8434 <refentrytitle><phrase>work_busy</phrase></refentrytitle>
8435 <manvolnum>9</manvolnum>
8436 <refmiscinfo class="version">4.1.27</refmiscinfo>
8437</refmeta>
8438<refnamediv>
8439 <refname>work_busy</refname>
8440 <refpurpose>
8441     test whether a work is currently pending or running
8442 </refpurpose>
8443</refnamediv>
8444<refsynopsisdiv>
8445 <title>Synopsis</title>
8446  <funcsynopsis><funcprototype>
8447   <funcdef>unsigned int <function>work_busy </function></funcdef>
8448   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
8449  </funcprototype></funcsynopsis>
8450</refsynopsisdiv>
8451<refsect1>
8452 <title>Arguments</title>
8453 <variablelist>
8454  <varlistentry>
8455   <term><parameter>work</parameter></term>
8456   <listitem>
8457    <para>
8458     the work to be tested
8459    </para>
8460   </listitem>
8461  </varlistentry>
8462 </variablelist>
8463</refsect1>
8464<refsect1>
8465<title>Description</title>
8466<para>
8467   Test whether <parameter>work</parameter> is currently pending or running.  There is no
8468   synchronization around this function and the test result is
8469   unreliable and only useful as advisory hints or for debugging.
8470</para>
8471</refsect1>
8472<refsect1>
8473<title>Return</title>
8474<para>
8475   OR'd bitmask of WORK_BUSY_* bits.
8476</para>
8477</refsect1>
8478</refentry>
8479
8480<refentry id="API-work-on-cpu">
8481<refentryinfo>
8482 <title>LINUX</title>
8483 <productname>Kernel Hackers Manual</productname>
8484 <date>July 2017</date>
8485</refentryinfo>
8486<refmeta>
8487 <refentrytitle><phrase>work_on_cpu</phrase></refentrytitle>
8488 <manvolnum>9</manvolnum>
8489 <refmiscinfo class="version">4.1.27</refmiscinfo>
8490</refmeta>
8491<refnamediv>
8492 <refname>work_on_cpu</refname>
8493 <refpurpose>
8494     run a function in user context on a particular cpu
8495 </refpurpose>
8496</refnamediv>
8497<refsynopsisdiv>
8498 <title>Synopsis</title>
8499  <funcsynopsis><funcprototype>
8500   <funcdef>long <function>work_on_cpu </function></funcdef>
8501   <paramdef>int <parameter>cpu</parameter></paramdef>
8502   <paramdef>long (*<parameter>fn</parameter>)
8503     <funcparams>void *</funcparams></paramdef>
8504   <paramdef>void * <parameter>arg</parameter></paramdef>
8505  </funcprototype></funcsynopsis>
8506</refsynopsisdiv>
8507<refsect1>
8508 <title>Arguments</title>
8509 <variablelist>
8510  <varlistentry>
8511   <term><parameter>cpu</parameter></term>
8512   <listitem>
8513    <para>
8514     the cpu to run on
8515    </para>
8516   </listitem>
8517  </varlistentry>
8518  <varlistentry>
8519   <term><parameter>fn</parameter></term>
8520   <listitem>
8521    <para>
8522     the function to run
8523    </para>
8524   </listitem>
8525  </varlistentry>
8526  <varlistentry>
8527   <term><parameter>arg</parameter></term>
8528   <listitem>
8529    <para>
8530     the function arg
8531    </para>
8532   </listitem>
8533  </varlistentry>
8534 </variablelist>
8535</refsect1>
8536<refsect1>
8537<title>Description</title>
8538<para>
8539   It is up to the caller to ensure that the cpu doesn't go offline.
8540   The caller must not hold any locks which would prevent <parameter>fn</parameter> from completing.
8541</para>
8542</refsect1>
8543<refsect1>
8544<title>Return</title>
8545<para>
8546   The value <parameter>fn</parameter> returns.
8547</para>
8548</refsect1>
8549</refentry>
8550
8551     </sect1>
8552     <sect1><title>Internal Functions</title>
8553<!-- kernel/exit.c -->
8554<refentry id="API-wait-task-stopped">
8555<refentryinfo>
8556 <title>LINUX</title>
8557 <productname>Kernel Hackers Manual</productname>
8558 <date>July 2017</date>
8559</refentryinfo>
8560<refmeta>
8561 <refentrytitle><phrase>wait_task_stopped</phrase></refentrytitle>
8562 <manvolnum>9</manvolnum>
8563 <refmiscinfo class="version">4.1.27</refmiscinfo>
8564</refmeta>
8565<refnamediv>
8566 <refname>wait_task_stopped</refname>
8567 <refpurpose>
8568  Wait for <constant>TASK_STOPPED</constant> or <constant>TASK_TRACED</constant>
8569 </refpurpose>
8570</refnamediv>
8571<refsynopsisdiv>
8572 <title>Synopsis</title>
8573  <funcsynopsis><funcprototype>
8574   <funcdef>int <function>wait_task_stopped </function></funcdef>
8575   <paramdef>struct wait_opts * <parameter>wo</parameter></paramdef>
8576   <paramdef>int <parameter>ptrace</parameter></paramdef>
8577   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
8578  </funcprototype></funcsynopsis>
8579</refsynopsisdiv>
8580<refsect1>
8581 <title>Arguments</title>
8582 <variablelist>
8583  <varlistentry>
8584   <term><parameter>wo</parameter></term>
8585   <listitem>
8586    <para>
8587     wait options
8588    </para>
8589   </listitem>
8590  </varlistentry>
8591  <varlistentry>
8592   <term><parameter>ptrace</parameter></term>
8593   <listitem>
8594    <para>
8595     is the wait for ptrace
8596    </para>
8597   </listitem>
8598  </varlistentry>
8599  <varlistentry>
8600   <term><parameter>p</parameter></term>
8601   <listitem>
8602    <para>
8603     task to wait for
8604    </para>
8605   </listitem>
8606  </varlistentry>
8607 </variablelist>
8608</refsect1>
8609<refsect1>
8610<title>Description</title>
8611<para>
8612   Handle <function>sys_wait4</function> work for <constant>p</constant> in state <constant>TASK_STOPPED</constant> or <constant>TASK_TRACED</constant>.
8613</para>
8614</refsect1>
8615<refsect1>
8616<title>CONTEXT</title>
8617<para>
8618   read_lock(<structname>tasklist_lock</structname>), which is released if return value is
8619   non-zero.  Also, grabs and releases <parameter>p</parameter>-&gt;sighand-&gt;siglock.
8620</para>
8621</refsect1>
8622<refsect1>
8623<title>RETURNS</title>
8624<para>
8625   0 if wait condition didn't exist and search for other wait conditions
8626   should continue.  Non-zero return, -errno on failure and <parameter>p</parameter>'s pid on
8627   success, implies that tasklist_lock is released and wait condition
8628   search should terminate.
8629</para>
8630</refsect1>
8631</refentry>
8632
8633<!-- kernel/signal.c -->
8634<refentry id="API-task-set-jobctl-pending">
8635<refentryinfo>
8636 <title>LINUX</title>
8637 <productname>Kernel Hackers Manual</productname>
8638 <date>July 2017</date>
8639</refentryinfo>
8640<refmeta>
8641 <refentrytitle><phrase>task_set_jobctl_pending</phrase></refentrytitle>
8642 <manvolnum>9</manvolnum>
8643 <refmiscinfo class="version">4.1.27</refmiscinfo>
8644</refmeta>
8645<refnamediv>
8646 <refname>task_set_jobctl_pending</refname>
8647 <refpurpose>
8648  set jobctl pending bits
8649 </refpurpose>
8650</refnamediv>
8651<refsynopsisdiv>
8652 <title>Synopsis</title>
8653  <funcsynopsis><funcprototype>
8654   <funcdef>bool <function>task_set_jobctl_pending </function></funcdef>
8655   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
8656   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
8657  </funcprototype></funcsynopsis>
8658</refsynopsisdiv>
8659<refsect1>
8660 <title>Arguments</title>
8661 <variablelist>
8662  <varlistentry>
8663   <term><parameter>task</parameter></term>
8664   <listitem>
8665    <para>
8666     target task
8667    </para>
8668   </listitem>
8669  </varlistentry>
8670  <varlistentry>
8671   <term><parameter>mask</parameter></term>
8672   <listitem>
8673    <para>
8674     pending bits to set
8675    </para>
8676   </listitem>
8677  </varlistentry>
8678 </variablelist>
8679</refsect1>
8680<refsect1>
8681<title>Description</title>
8682<para>
8683   Clear <parameter>mask</parameter> from <parameter>task</parameter>-&gt;jobctl.  <parameter>mask</parameter> must be subset of
8684   <constant>JOBCTL_PENDING_MASK</constant> | <constant>JOBCTL_STOP_CONSUME</constant> | <constant>JOBCTL_STOP_SIGMASK</constant> |
8685   <constant>JOBCTL_TRAPPING</constant>.  If stop signo is being set, the existing signo is
8686   cleared.  If <parameter>task</parameter> is already being killed or exiting, this function
8687   becomes noop.
8688</para>
8689</refsect1>
8690<refsect1>
8691<title>CONTEXT</title>
8692<para>
8693   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
8694</para>
8695</refsect1>
8696<refsect1>
8697<title>RETURNS</title>
8698<para>
8699   <constant>true</constant> if <parameter>mask</parameter> is set, <constant>false</constant> if made noop because <parameter>task</parameter> was dying.
8700</para>
8701</refsect1>
8702</refentry>
8703
8704<refentry id="API-task-clear-jobctl-trapping">
8705<refentryinfo>
8706 <title>LINUX</title>
8707 <productname>Kernel Hackers Manual</productname>
8708 <date>July 2017</date>
8709</refentryinfo>
8710<refmeta>
8711 <refentrytitle><phrase>task_clear_jobctl_trapping</phrase></refentrytitle>
8712 <manvolnum>9</manvolnum>
8713 <refmiscinfo class="version">4.1.27</refmiscinfo>
8714</refmeta>
8715<refnamediv>
8716 <refname>task_clear_jobctl_trapping</refname>
8717 <refpurpose>
8718     clear jobctl trapping bit
8719 </refpurpose>
8720</refnamediv>
8721<refsynopsisdiv>
8722 <title>Synopsis</title>
8723  <funcsynopsis><funcprototype>
8724   <funcdef>void <function>task_clear_jobctl_trapping </function></funcdef>
8725   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
8726  </funcprototype></funcsynopsis>
8727</refsynopsisdiv>
8728<refsect1>
8729 <title>Arguments</title>
8730 <variablelist>
8731  <varlistentry>
8732   <term><parameter>task</parameter></term>
8733   <listitem>
8734    <para>
8735     target task
8736    </para>
8737   </listitem>
8738  </varlistentry>
8739 </variablelist>
8740</refsect1>
8741<refsect1>
8742<title>Description</title>
8743<para>
8744   If JOBCTL_TRAPPING is set, a ptracer is waiting for us to enter TRACED.
8745   Clear it and wake up the ptracer.  Note that we don't need any further
8746   locking.  <parameter>task</parameter>-&gt;siglock guarantees that <parameter>task</parameter>-&gt;parent points to the
8747   ptracer.
8748</para>
8749</refsect1>
8750<refsect1>
8751<title>CONTEXT</title>
8752<para>
8753   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
8754</para>
8755</refsect1>
8756</refentry>
8757
8758<refentry id="API-task-clear-jobctl-pending">
8759<refentryinfo>
8760 <title>LINUX</title>
8761 <productname>Kernel Hackers Manual</productname>
8762 <date>July 2017</date>
8763</refentryinfo>
8764<refmeta>
8765 <refentrytitle><phrase>task_clear_jobctl_pending</phrase></refentrytitle>
8766 <manvolnum>9</manvolnum>
8767 <refmiscinfo class="version">4.1.27</refmiscinfo>
8768</refmeta>
8769<refnamediv>
8770 <refname>task_clear_jobctl_pending</refname>
8771 <refpurpose>
8772     clear jobctl pending bits
8773 </refpurpose>
8774</refnamediv>
8775<refsynopsisdiv>
8776 <title>Synopsis</title>
8777  <funcsynopsis><funcprototype>
8778   <funcdef>void <function>task_clear_jobctl_pending </function></funcdef>
8779   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
8780   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
8781  </funcprototype></funcsynopsis>
8782</refsynopsisdiv>
8783<refsect1>
8784 <title>Arguments</title>
8785 <variablelist>
8786  <varlistentry>
8787   <term><parameter>task</parameter></term>
8788   <listitem>
8789    <para>
8790     target task
8791    </para>
8792   </listitem>
8793  </varlistentry>
8794  <varlistentry>
8795   <term><parameter>mask</parameter></term>
8796   <listitem>
8797    <para>
8798     pending bits to clear
8799    </para>
8800   </listitem>
8801  </varlistentry>
8802 </variablelist>
8803</refsect1>
8804<refsect1>
8805<title>Description</title>
8806<para>
8807   Clear <parameter>mask</parameter> from <parameter>task</parameter>-&gt;jobctl.  <parameter>mask</parameter> must be subset of
8808   <constant>JOBCTL_PENDING_MASK</constant>.  If <constant>JOBCTL_STOP_PENDING</constant> is being cleared, other
8809   STOP bits are cleared together.
8810   </para><para>
8811
8812   If clearing of <parameter>mask</parameter> leaves no stop or trap pending, this function calls
8813   <function>task_clear_jobctl_trapping</function>.
8814</para>
8815</refsect1>
8816<refsect1>
8817<title>CONTEXT</title>
8818<para>
8819   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
8820</para>
8821</refsect1>
8822</refentry>
8823
8824<refentry id="API-task-participate-group-stop">
8825<refentryinfo>
8826 <title>LINUX</title>
8827 <productname>Kernel Hackers Manual</productname>
8828 <date>July 2017</date>
8829</refentryinfo>
8830<refmeta>
8831 <refentrytitle><phrase>task_participate_group_stop</phrase></refentrytitle>
8832 <manvolnum>9</manvolnum>
8833 <refmiscinfo class="version">4.1.27</refmiscinfo>
8834</refmeta>
8835<refnamediv>
8836 <refname>task_participate_group_stop</refname>
8837 <refpurpose>
8838     participate in a group stop
8839 </refpurpose>
8840</refnamediv>
8841<refsynopsisdiv>
8842 <title>Synopsis</title>
8843  <funcsynopsis><funcprototype>
8844   <funcdef>bool <function>task_participate_group_stop </function></funcdef>
8845   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
8846  </funcprototype></funcsynopsis>
8847</refsynopsisdiv>
8848<refsect1>
8849 <title>Arguments</title>
8850 <variablelist>
8851  <varlistentry>
8852   <term><parameter>task</parameter></term>
8853   <listitem>
8854    <para>
8855     task participating in a group stop
8856    </para>
8857   </listitem>
8858  </varlistentry>
8859 </variablelist>
8860</refsect1>
8861<refsect1>
8862<title>Description</title>
8863<para>
8864   <parameter>task</parameter> has <constant>JOBCTL_STOP_PENDING</constant> set and is participating in a group stop.
8865   Group stop states are cleared and the group stop count is consumed if
8866   <constant>JOBCTL_STOP_CONSUME</constant> was set.  If the consumption completes the group
8867   stop, the appropriate <constant>SIGNAL_</constant>* flags are set.
8868</para>
8869</refsect1>
8870<refsect1>
8871<title>CONTEXT</title>
8872<para>
8873   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
8874</para>
8875</refsect1>
8876<refsect1>
8877<title>RETURNS</title>
8878<para>
8879   <constant>true</constant> if group stop completion should be notified to the parent, <constant>false</constant>
8880   otherwise.
8881</para>
8882</refsect1>
8883</refentry>
8884
8885<refentry id="API-ptrace-trap-notify">
8886<refentryinfo>
8887 <title>LINUX</title>
8888 <productname>Kernel Hackers Manual</productname>
8889 <date>July 2017</date>
8890</refentryinfo>
8891<refmeta>
8892 <refentrytitle><phrase>ptrace_trap_notify</phrase></refentrytitle>
8893 <manvolnum>9</manvolnum>
8894 <refmiscinfo class="version">4.1.27</refmiscinfo>
8895</refmeta>
8896<refnamediv>
8897 <refname>ptrace_trap_notify</refname>
8898 <refpurpose>
8899     schedule trap to notify ptracer
8900 </refpurpose>
8901</refnamediv>
8902<refsynopsisdiv>
8903 <title>Synopsis</title>
8904  <funcsynopsis><funcprototype>
8905   <funcdef>void <function>ptrace_trap_notify </function></funcdef>
8906   <paramdef>struct task_struct * <parameter>t</parameter></paramdef>
8907  </funcprototype></funcsynopsis>
8908</refsynopsisdiv>
8909<refsect1>
8910 <title>Arguments</title>
8911 <variablelist>
8912  <varlistentry>
8913   <term><parameter>t</parameter></term>
8914   <listitem>
8915    <para>
8916     tracee wanting to notify tracer
8917    </para>
8918   </listitem>
8919  </varlistentry>
8920 </variablelist>
8921</refsect1>
8922<refsect1>
8923<title>Description</title>
8924<para>
8925   This function schedules sticky ptrace trap which is cleared on the next
8926   TRAP_STOP to notify ptracer of an event.  <parameter>t</parameter> must have been seized by
8927   ptracer.
8928   </para><para>
8929
8930   If <parameter>t</parameter> is running, STOP trap will be taken.  If trapped for STOP and
8931   ptracer is listening for events, tracee is woken up so that it can
8932   re-trap for the new event.  If trapped otherwise, STOP trap will be
8933   eventually taken without returning to userland after the existing traps
8934   are finished by PTRACE_CONT.
8935</para>
8936</refsect1>
8937<refsect1>
8938<title>CONTEXT</title>
8939<para>
8940   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
8941</para>
8942</refsect1>
8943</refentry>
8944
8945<refentry id="API-do-notify-parent-cldstop">
8946<refentryinfo>
8947 <title>LINUX</title>
8948 <productname>Kernel Hackers Manual</productname>
8949 <date>July 2017</date>
8950</refentryinfo>
8951<refmeta>
8952 <refentrytitle><phrase>do_notify_parent_cldstop</phrase></refentrytitle>
8953 <manvolnum>9</manvolnum>
8954 <refmiscinfo class="version">4.1.27</refmiscinfo>
8955</refmeta>
8956<refnamediv>
8957 <refname>do_notify_parent_cldstop</refname>
8958 <refpurpose>
8959     notify parent of stopped/continued state change
8960 </refpurpose>
8961</refnamediv>
8962<refsynopsisdiv>
8963 <title>Synopsis</title>
8964  <funcsynopsis><funcprototype>
8965   <funcdef>void <function>do_notify_parent_cldstop </function></funcdef>
8966   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
8967   <paramdef>bool <parameter>for_ptracer</parameter></paramdef>
8968   <paramdef>int <parameter>why</parameter></paramdef>
8969  </funcprototype></funcsynopsis>
8970</refsynopsisdiv>
8971<refsect1>
8972 <title>Arguments</title>
8973 <variablelist>
8974  <varlistentry>
8975   <term><parameter>tsk</parameter></term>
8976   <listitem>
8977    <para>
8978     task reporting the state change
8979    </para>
8980   </listitem>
8981  </varlistentry>
8982  <varlistentry>
8983   <term><parameter>for_ptracer</parameter></term>
8984   <listitem>
8985    <para>
8986     the notification is for ptracer
8987    </para>
8988   </listitem>
8989  </varlistentry>
8990  <varlistentry>
8991   <term><parameter>why</parameter></term>
8992   <listitem>
8993    <para>
8994     CLD_{CONTINUED|STOPPED|TRAPPED} to report
8995    </para>
8996   </listitem>
8997  </varlistentry>
8998 </variablelist>
8999</refsect1>
9000<refsect1>
9001<title>Description</title>
9002<para>
9003   Notify <parameter>tsk</parameter>'s parent that the stopped/continued state has changed.  If
9004   <parameter>for_ptracer</parameter> is <constant>false</constant>, <parameter>tsk</parameter>'s group leader notifies to its real parent.
9005   If <constant>true</constant>, <parameter>tsk</parameter> reports to <parameter>tsk</parameter>-&gt;parent which should be the ptracer.
9006</para>
9007</refsect1>
9008<refsect1>
9009<title>CONTEXT</title>
9010<para>
9011   Must be called with tasklist_lock at least read locked.
9012</para>
9013</refsect1>
9014</refentry>
9015
9016<refentry id="API-do-signal-stop">
9017<refentryinfo>
9018 <title>LINUX</title>
9019 <productname>Kernel Hackers Manual</productname>
9020 <date>July 2017</date>
9021</refentryinfo>
9022<refmeta>
9023 <refentrytitle><phrase>do_signal_stop</phrase></refentrytitle>
9024 <manvolnum>9</manvolnum>
9025 <refmiscinfo class="version">4.1.27</refmiscinfo>
9026</refmeta>
9027<refnamediv>
9028 <refname>do_signal_stop</refname>
9029 <refpurpose>
9030     handle group stop for SIGSTOP and other stop signals
9031 </refpurpose>
9032</refnamediv>
9033<refsynopsisdiv>
9034 <title>Synopsis</title>
9035  <funcsynopsis><funcprototype>
9036   <funcdef>bool <function>do_signal_stop </function></funcdef>
9037   <paramdef>int <parameter>signr</parameter></paramdef>
9038  </funcprototype></funcsynopsis>
9039</refsynopsisdiv>
9040<refsect1>
9041 <title>Arguments</title>
9042 <variablelist>
9043  <varlistentry>
9044   <term><parameter>signr</parameter></term>
9045   <listitem>
9046    <para>
9047     signr causing group stop if initiating
9048    </para>
9049   </listitem>
9050  </varlistentry>
9051 </variablelist>
9052</refsect1>
9053<refsect1>
9054<title>Description</title>
9055<para>
9056   If <constant>JOBCTL_STOP_PENDING</constant> is not set yet, initiate group stop with <parameter>signr</parameter>
9057   and participate in it.  If already set, participate in the existing
9058   group stop.  If participated in a group stop (and thus slept), <constant>true</constant> is
9059   returned with siglock released.
9060   </para><para>
9061
9062   If ptraced, this function doesn't handle stop itself.  Instead,
9063   <constant>JOBCTL_TRAP_STOP</constant> is scheduled and <constant>false</constant> is returned with siglock
9064   untouched.  The caller must ensure that INTERRUPT trap handling takes
9065   places afterwards.
9066</para>
9067</refsect1>
9068<refsect1>
9069<title>CONTEXT</title>
9070<para>
9071   Must be called with <parameter>current</parameter>-&gt;sighand-&gt;siglock held, which is released
9072   on <constant>true</constant> return.
9073</para>
9074</refsect1>
9075<refsect1>
9076<title>RETURNS</title>
9077<para>
9078   <constant>false</constant> if group stop is already cancelled or ptrace trap is scheduled.
9079   <constant>true</constant> if participated in group stop.
9080</para>
9081</refsect1>
9082</refentry>
9083
9084<refentry id="API-do-jobctl-trap">
9085<refentryinfo>
9086 <title>LINUX</title>
9087 <productname>Kernel Hackers Manual</productname>
9088 <date>July 2017</date>
9089</refentryinfo>
9090<refmeta>
9091 <refentrytitle><phrase>do_jobctl_trap</phrase></refentrytitle>
9092 <manvolnum>9</manvolnum>
9093 <refmiscinfo class="version">4.1.27</refmiscinfo>
9094</refmeta>
9095<refnamediv>
9096 <refname>do_jobctl_trap</refname>
9097 <refpurpose>
9098     take care of ptrace jobctl traps
9099 </refpurpose>
9100</refnamediv>
9101<refsynopsisdiv>
9102 <title>Synopsis</title>
9103  <funcsynopsis><funcprototype>
9104   <funcdef>void <function>do_jobctl_trap </function></funcdef>
9105   <paramdef> <parameter>void</parameter></paramdef>
9106  </funcprototype></funcsynopsis>
9107</refsynopsisdiv>
9108<refsect1>
9109 <title>Arguments</title>
9110 <variablelist>
9111  <varlistentry>
9112   <term><parameter>void</parameter></term>
9113   <listitem>
9114    <para>
9115     no arguments
9116    </para>
9117   </listitem>
9118  </varlistentry>
9119 </variablelist>
9120</refsect1>
9121<refsect1>
9122<title>Description</title>
9123<para>
9124   </para><para>
9125
9126   When PT_SEIZED, it's used for both group stop and explicit
9127   SEIZE/INTERRUPT traps.  Both generate PTRACE_EVENT_STOP trap with
9128   accompanying siginfo.  If stopped, lower eight bits of exit_code contain
9129   the stop signal; otherwise, <constant>SIGTRAP</constant>.
9130   </para><para>
9131
9132   When !PT_SEIZED, it's used only for group stop trap with stop signal
9133   number as exit_code and no siginfo.
9134</para>
9135</refsect1>
9136<refsect1>
9137<title>CONTEXT</title>
9138<para>
9139   Must be called with <parameter>current</parameter>-&gt;sighand-&gt;siglock held, which may be
9140   released and re-acquired before returning with intervening sleep.
9141</para>
9142</refsect1>
9143</refentry>
9144
9145<refentry id="API-signal-delivered">
9146<refentryinfo>
9147 <title>LINUX</title>
9148 <productname>Kernel Hackers Manual</productname>
9149 <date>July 2017</date>
9150</refentryinfo>
9151<refmeta>
9152 <refentrytitle><phrase>signal_delivered</phrase></refentrytitle>
9153 <manvolnum>9</manvolnum>
9154 <refmiscinfo class="version">4.1.27</refmiscinfo>
9155</refmeta>
9156<refnamediv>
9157 <refname>signal_delivered</refname>
9158 <refpurpose>
9159   </refpurpose>
9160</refnamediv>
9161<refsynopsisdiv>
9162 <title>Synopsis</title>
9163  <funcsynopsis><funcprototype>
9164   <funcdef>void <function>signal_delivered </function></funcdef>
9165   <paramdef>struct ksignal * <parameter>ksig</parameter></paramdef>
9166   <paramdef>int <parameter>stepping</parameter></paramdef>
9167  </funcprototype></funcsynopsis>
9168</refsynopsisdiv>
9169<refsect1>
9170 <title>Arguments</title>
9171 <variablelist>
9172  <varlistentry>
9173   <term><parameter>ksig</parameter></term>
9174   <listitem>
9175    <para>
9176     kernel signal struct
9177    </para>
9178   </listitem>
9179  </varlistentry>
9180  <varlistentry>
9181   <term><parameter>stepping</parameter></term>
9182   <listitem>
9183    <para>
9184     nonzero if debugger single-step or block-step in use
9185    </para>
9186   </listitem>
9187  </varlistentry>
9188 </variablelist>
9189</refsect1>
9190<refsect1>
9191<title>Description</title>
9192<para>
9193   This function should be called when a signal has successfully been
9194   delivered. It updates the blocked signals accordingly (<parameter>ksig</parameter>-&gt;ka.sa.sa_mask
9195   is always blocked, and the signal itself is blocked unless <constant>SA_NODEFER</constant>
9196   is set in <parameter>ksig</parameter>-&gt;ka.sa.sa_flags.  Tracing is notified.
9197</para>
9198</refsect1>
9199</refentry>
9200
9201<refentry id="API-sys-restart-syscall">
9202<refentryinfo>
9203 <title>LINUX</title>
9204 <productname>Kernel Hackers Manual</productname>
9205 <date>July 2017</date>
9206</refentryinfo>
9207<refmeta>
9208 <refentrytitle><phrase>sys_restart_syscall</phrase></refentrytitle>
9209 <manvolnum>9</manvolnum>
9210 <refmiscinfo class="version">4.1.27</refmiscinfo>
9211</refmeta>
9212<refnamediv>
9213 <refname>sys_restart_syscall</refname>
9214 <refpurpose>
9215     restart a system call
9216 </refpurpose>
9217</refnamediv>
9218<refsynopsisdiv>
9219 <title>Synopsis</title>
9220  <funcsynopsis><funcprototype>
9221   <funcdef>long <function>sys_restart_syscall </function></funcdef>
9222   <paramdef> <parameter>void</parameter></paramdef>
9223  </funcprototype></funcsynopsis>
9224</refsynopsisdiv>
9225<refsect1>
9226 <title>Arguments</title>
9227 <variablelist>
9228  <varlistentry>
9229   <term><parameter>void</parameter></term>
9230   <listitem>
9231    <para>
9232     no arguments
9233    </para>
9234   </listitem>
9235  </varlistentry>
9236 </variablelist>
9237</refsect1>
9238</refentry>
9239
9240<refentry id="API-set-current-blocked">
9241<refentryinfo>
9242 <title>LINUX</title>
9243 <productname>Kernel Hackers Manual</productname>
9244 <date>July 2017</date>
9245</refentryinfo>
9246<refmeta>
9247 <refentrytitle><phrase>set_current_blocked</phrase></refentrytitle>
9248 <manvolnum>9</manvolnum>
9249 <refmiscinfo class="version">4.1.27</refmiscinfo>
9250</refmeta>
9251<refnamediv>
9252 <refname>set_current_blocked</refname>
9253 <refpurpose>
9254     change current-&gt;blocked mask
9255 </refpurpose>
9256</refnamediv>
9257<refsynopsisdiv>
9258 <title>Synopsis</title>
9259  <funcsynopsis><funcprototype>
9260   <funcdef>void <function>set_current_blocked </function></funcdef>
9261   <paramdef>sigset_t * <parameter>newset</parameter></paramdef>
9262  </funcprototype></funcsynopsis>
9263</refsynopsisdiv>
9264<refsect1>
9265 <title>Arguments</title>
9266 <variablelist>
9267  <varlistentry>
9268   <term><parameter>newset</parameter></term>
9269   <listitem>
9270    <para>
9271     new mask
9272    </para>
9273   </listitem>
9274  </varlistentry>
9275 </variablelist>
9276</refsect1>
9277<refsect1>
9278<title>Description</title>
9279<para>
9280   It is wrong to change -&gt;blocked directly, this helper should be used
9281   to ensure the process can't miss a shared signal we are going to block.
9282</para>
9283</refsect1>
9284</refentry>
9285
9286<refentry id="API-sys-rt-sigprocmask">
9287<refentryinfo>
9288 <title>LINUX</title>
9289 <productname>Kernel Hackers Manual</productname>
9290 <date>July 2017</date>
9291</refentryinfo>
9292<refmeta>
9293 <refentrytitle><phrase>sys_rt_sigprocmask</phrase></refentrytitle>
9294 <manvolnum>9</manvolnum>
9295 <refmiscinfo class="version">4.1.27</refmiscinfo>
9296</refmeta>
9297<refnamediv>
9298 <refname>sys_rt_sigprocmask</refname>
9299 <refpurpose>
9300     change the list of currently blocked signals
9301 </refpurpose>
9302</refnamediv>
9303<refsynopsisdiv>
9304 <title>Synopsis</title>
9305  <funcsynopsis><funcprototype>
9306   <funcdef>long <function>sys_rt_sigprocmask </function></funcdef>
9307   <paramdef>int <parameter>how</parameter></paramdef>
9308   <paramdef>sigset_t __user * <parameter>nset</parameter></paramdef>
9309   <paramdef>sigset_t __user * <parameter>oset</parameter></paramdef>
9310   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
9311  </funcprototype></funcsynopsis>
9312</refsynopsisdiv>
9313<refsect1>
9314 <title>Arguments</title>
9315 <variablelist>
9316  <varlistentry>
9317   <term><parameter>how</parameter></term>
9318   <listitem>
9319    <para>
9320     whether to add, remove, or set signals
9321    </para>
9322   </listitem>
9323  </varlistentry>
9324  <varlistentry>
9325   <term><parameter>nset</parameter></term>
9326   <listitem>
9327    <para>
9328     stores pending signals
9329    </para>
9330   </listitem>
9331  </varlistentry>
9332  <varlistentry>
9333   <term><parameter>oset</parameter></term>
9334   <listitem>
9335    <para>
9336     previous value of signal mask if non-null
9337    </para>
9338   </listitem>
9339  </varlistentry>
9340  <varlistentry>
9341   <term><parameter>sigsetsize</parameter></term>
9342   <listitem>
9343    <para>
9344     size of sigset_t type
9345    </para>
9346   </listitem>
9347  </varlistentry>
9348 </variablelist>
9349</refsect1>
9350</refentry>
9351
9352<refentry id="API-sys-rt-sigpending">
9353<refentryinfo>
9354 <title>LINUX</title>
9355 <productname>Kernel Hackers Manual</productname>
9356 <date>July 2017</date>
9357</refentryinfo>
9358<refmeta>
9359 <refentrytitle><phrase>sys_rt_sigpending</phrase></refentrytitle>
9360 <manvolnum>9</manvolnum>
9361 <refmiscinfo class="version">4.1.27</refmiscinfo>
9362</refmeta>
9363<refnamediv>
9364 <refname>sys_rt_sigpending</refname>
9365 <refpurpose>
9366     examine a pending signal that has been raised while blocked
9367 </refpurpose>
9368</refnamediv>
9369<refsynopsisdiv>
9370 <title>Synopsis</title>
9371  <funcsynopsis><funcprototype>
9372   <funcdef>long <function>sys_rt_sigpending </function></funcdef>
9373   <paramdef>sigset_t __user * <parameter>uset</parameter></paramdef>
9374   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
9375  </funcprototype></funcsynopsis>
9376</refsynopsisdiv>
9377<refsect1>
9378 <title>Arguments</title>
9379 <variablelist>
9380  <varlistentry>
9381   <term><parameter>uset</parameter></term>
9382   <listitem>
9383    <para>
9384     stores pending signals
9385    </para>
9386   </listitem>
9387  </varlistentry>
9388  <varlistentry>
9389   <term><parameter>sigsetsize</parameter></term>
9390   <listitem>
9391    <para>
9392     size of sigset_t type or larger
9393    </para>
9394   </listitem>
9395  </varlistentry>
9396 </variablelist>
9397</refsect1>
9398</refentry>
9399
9400<refentry id="API-do-sigtimedwait">
9401<refentryinfo>
9402 <title>LINUX</title>
9403 <productname>Kernel Hackers Manual</productname>
9404 <date>July 2017</date>
9405</refentryinfo>
9406<refmeta>
9407 <refentrytitle><phrase>do_sigtimedwait</phrase></refentrytitle>
9408 <manvolnum>9</manvolnum>
9409 <refmiscinfo class="version">4.1.27</refmiscinfo>
9410</refmeta>
9411<refnamediv>
9412 <refname>do_sigtimedwait</refname>
9413 <refpurpose>
9414     wait for queued signals specified in <parameter>which</parameter>
9415 </refpurpose>
9416</refnamediv>
9417<refsynopsisdiv>
9418 <title>Synopsis</title>
9419  <funcsynopsis><funcprototype>
9420   <funcdef>int <function>do_sigtimedwait </function></funcdef>
9421   <paramdef>const sigset_t * <parameter>which</parameter></paramdef>
9422   <paramdef>siginfo_t * <parameter>info</parameter></paramdef>
9423   <paramdef>const struct timespec * <parameter>ts</parameter></paramdef>
9424  </funcprototype></funcsynopsis>
9425</refsynopsisdiv>
9426<refsect1>
9427 <title>Arguments</title>
9428 <variablelist>
9429  <varlistentry>
9430   <term><parameter>which</parameter></term>
9431   <listitem>
9432    <para>
9433     queued signals to wait for
9434    </para>
9435   </listitem>
9436  </varlistentry>
9437  <varlistentry>
9438   <term><parameter>info</parameter></term>
9439   <listitem>
9440    <para>
9441     if non-null, the signal's siginfo is returned here
9442    </para>
9443   </listitem>
9444  </varlistentry>
9445  <varlistentry>
9446   <term><parameter>ts</parameter></term>
9447   <listitem>
9448    <para>
9449     upper bound on process time suspension
9450    </para>
9451   </listitem>
9452  </varlistentry>
9453 </variablelist>
9454</refsect1>
9455</refentry>
9456
9457<refentry id="API-sys-rt-sigtimedwait">
9458<refentryinfo>
9459 <title>LINUX</title>
9460 <productname>Kernel Hackers Manual</productname>
9461 <date>July 2017</date>
9462</refentryinfo>
9463<refmeta>
9464 <refentrytitle><phrase>sys_rt_sigtimedwait</phrase></refentrytitle>
9465 <manvolnum>9</manvolnum>
9466 <refmiscinfo class="version">4.1.27</refmiscinfo>
9467</refmeta>
9468<refnamediv>
9469 <refname>sys_rt_sigtimedwait</refname>
9470 <refpurpose>
9471     synchronously wait for queued signals specified in <parameter>uthese</parameter>
9472 </refpurpose>
9473</refnamediv>
9474<refsynopsisdiv>
9475 <title>Synopsis</title>
9476  <funcsynopsis><funcprototype>
9477   <funcdef>long <function>sys_rt_sigtimedwait </function></funcdef>
9478   <paramdef>const sigset_t __user * <parameter>uthese</parameter></paramdef>
9479   <paramdef>siginfo_t __user * <parameter>uinfo</parameter></paramdef>
9480   <paramdef>const struct timespec __user * <parameter>uts</parameter></paramdef>
9481   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
9482  </funcprototype></funcsynopsis>
9483</refsynopsisdiv>
9484<refsect1>
9485 <title>Arguments</title>
9486 <variablelist>
9487  <varlistentry>
9488   <term><parameter>uthese</parameter></term>
9489   <listitem>
9490    <para>
9491     queued signals to wait for
9492    </para>
9493   </listitem>
9494  </varlistentry>
9495  <varlistentry>
9496   <term><parameter>uinfo</parameter></term>
9497   <listitem>
9498    <para>
9499     if non-null, the signal's siginfo is returned here
9500    </para>
9501   </listitem>
9502  </varlistentry>
9503  <varlistentry>
9504   <term><parameter>uts</parameter></term>
9505   <listitem>
9506    <para>
9507     upper bound on process time suspension
9508    </para>
9509   </listitem>
9510  </varlistentry>
9511  <varlistentry>
9512   <term><parameter>sigsetsize</parameter></term>
9513   <listitem>
9514    <para>
9515     size of sigset_t type
9516    </para>
9517   </listitem>
9518  </varlistentry>
9519 </variablelist>
9520</refsect1>
9521</refentry>
9522
9523<refentry id="API-sys-kill">
9524<refentryinfo>
9525 <title>LINUX</title>
9526 <productname>Kernel Hackers Manual</productname>
9527 <date>July 2017</date>
9528</refentryinfo>
9529<refmeta>
9530 <refentrytitle><phrase>sys_kill</phrase></refentrytitle>
9531 <manvolnum>9</manvolnum>
9532 <refmiscinfo class="version">4.1.27</refmiscinfo>
9533</refmeta>
9534<refnamediv>
9535 <refname>sys_kill</refname>
9536 <refpurpose>
9537     send a signal to a process
9538 </refpurpose>
9539</refnamediv>
9540<refsynopsisdiv>
9541 <title>Synopsis</title>
9542  <funcsynopsis><funcprototype>
9543   <funcdef>long <function>sys_kill </function></funcdef>
9544   <paramdef>pid_t <parameter>pid</parameter></paramdef>
9545   <paramdef>int <parameter>sig</parameter></paramdef>
9546  </funcprototype></funcsynopsis>
9547</refsynopsisdiv>
9548<refsect1>
9549 <title>Arguments</title>
9550 <variablelist>
9551  <varlistentry>
9552   <term><parameter>pid</parameter></term>
9553   <listitem>
9554    <para>
9555     the PID of the process
9556    </para>
9557   </listitem>
9558  </varlistentry>
9559  <varlistentry>
9560   <term><parameter>sig</parameter></term>
9561   <listitem>
9562    <para>
9563     signal to be sent
9564    </para>
9565   </listitem>
9566  </varlistentry>
9567 </variablelist>
9568</refsect1>
9569</refentry>
9570
9571<refentry id="API-sys-tgkill">
9572<refentryinfo>
9573 <title>LINUX</title>
9574 <productname>Kernel Hackers Manual</productname>
9575 <date>July 2017</date>
9576</refentryinfo>
9577<refmeta>
9578 <refentrytitle><phrase>sys_tgkill</phrase></refentrytitle>
9579 <manvolnum>9</manvolnum>
9580 <refmiscinfo class="version">4.1.27</refmiscinfo>
9581</refmeta>
9582<refnamediv>
9583 <refname>sys_tgkill</refname>
9584 <refpurpose>
9585     send signal to one specific thread
9586 </refpurpose>
9587</refnamediv>
9588<refsynopsisdiv>
9589 <title>Synopsis</title>
9590  <funcsynopsis><funcprototype>
9591   <funcdef>long <function>sys_tgkill </function></funcdef>
9592   <paramdef>pid_t <parameter>tgid</parameter></paramdef>
9593   <paramdef>pid_t <parameter>pid</parameter></paramdef>
9594   <paramdef>int <parameter>sig</parameter></paramdef>
9595  </funcprototype></funcsynopsis>
9596</refsynopsisdiv>
9597<refsect1>
9598 <title>Arguments</title>
9599 <variablelist>
9600  <varlistentry>
9601   <term><parameter>tgid</parameter></term>
9602   <listitem>
9603    <para>
9604     the thread group ID of the thread
9605    </para>
9606   </listitem>
9607  </varlistentry>
9608  <varlistentry>
9609   <term><parameter>pid</parameter></term>
9610   <listitem>
9611    <para>
9612     the PID of the thread
9613    </para>
9614   </listitem>
9615  </varlistentry>
9616  <varlistentry>
9617   <term><parameter>sig</parameter></term>
9618   <listitem>
9619    <para>
9620     signal to be sent
9621    </para>
9622   </listitem>
9623  </varlistentry>
9624 </variablelist>
9625</refsect1>
9626<refsect1>
9627<title>Description</title>
9628<para>
9629   This syscall also checks the <parameter>tgid</parameter> and returns -ESRCH even if the PID
9630   exists but it's not belonging to the target process anymore. This
9631   method solves the problem of threads exiting and PIDs getting reused.
9632</para>
9633</refsect1>
9634</refentry>
9635
9636<refentry id="API-sys-tkill">
9637<refentryinfo>
9638 <title>LINUX</title>
9639 <productname>Kernel Hackers Manual</productname>
9640 <date>July 2017</date>
9641</refentryinfo>
9642<refmeta>
9643 <refentrytitle><phrase>sys_tkill</phrase></refentrytitle>
9644 <manvolnum>9</manvolnum>
9645 <refmiscinfo class="version">4.1.27</refmiscinfo>
9646</refmeta>
9647<refnamediv>
9648 <refname>sys_tkill</refname>
9649 <refpurpose>
9650     send signal to one specific task
9651 </refpurpose>
9652</refnamediv>
9653<refsynopsisdiv>
9654 <title>Synopsis</title>
9655  <funcsynopsis><funcprototype>
9656   <funcdef>long <function>sys_tkill </function></funcdef>
9657   <paramdef>pid_t <parameter>pid</parameter></paramdef>
9658   <paramdef>int <parameter>sig</parameter></paramdef>
9659  </funcprototype></funcsynopsis>
9660</refsynopsisdiv>
9661<refsect1>
9662 <title>Arguments</title>
9663 <variablelist>
9664  <varlistentry>
9665   <term><parameter>pid</parameter></term>
9666   <listitem>
9667    <para>
9668     the PID of the task
9669    </para>
9670   </listitem>
9671  </varlistentry>
9672  <varlistentry>
9673   <term><parameter>sig</parameter></term>
9674   <listitem>
9675    <para>
9676     signal to be sent
9677    </para>
9678   </listitem>
9679  </varlistentry>
9680 </variablelist>
9681</refsect1>
9682<refsect1>
9683<title>Description</title>
9684<para>
9685   Send a signal to only one task, even if it's a CLONE_THREAD task.
9686</para>
9687</refsect1>
9688</refentry>
9689
9690<refentry id="API-sys-rt-sigqueueinfo">
9691<refentryinfo>
9692 <title>LINUX</title>
9693 <productname>Kernel Hackers Manual</productname>
9694 <date>July 2017</date>
9695</refentryinfo>
9696<refmeta>
9697 <refentrytitle><phrase>sys_rt_sigqueueinfo</phrase></refentrytitle>
9698 <manvolnum>9</manvolnum>
9699 <refmiscinfo class="version">4.1.27</refmiscinfo>
9700</refmeta>
9701<refnamediv>
9702 <refname>sys_rt_sigqueueinfo</refname>
9703 <refpurpose>
9704     send signal information to a signal
9705 </refpurpose>
9706</refnamediv>
9707<refsynopsisdiv>
9708 <title>Synopsis</title>
9709  <funcsynopsis><funcprototype>
9710   <funcdef>long <function>sys_rt_sigqueueinfo </function></funcdef>
9711   <paramdef>pid_t <parameter>pid</parameter></paramdef>
9712   <paramdef>int <parameter>sig</parameter></paramdef>
9713   <paramdef>siginfo_t __user * <parameter>uinfo</parameter></paramdef>
9714  </funcprototype></funcsynopsis>
9715</refsynopsisdiv>
9716<refsect1>
9717 <title>Arguments</title>
9718 <variablelist>
9719  <varlistentry>
9720   <term><parameter>pid</parameter></term>
9721   <listitem>
9722    <para>
9723     the PID of the thread
9724    </para>
9725   </listitem>
9726  </varlistentry>
9727  <varlistentry>
9728   <term><parameter>sig</parameter></term>
9729   <listitem>
9730    <para>
9731     signal to be sent
9732    </para>
9733   </listitem>
9734  </varlistentry>
9735  <varlistentry>
9736   <term><parameter>uinfo</parameter></term>
9737   <listitem>
9738    <para>
9739     signal info to be sent
9740    </para>
9741   </listitem>
9742  </varlistentry>
9743 </variablelist>
9744</refsect1>
9745</refentry>
9746
9747<refentry id="API-sys-sigpending">
9748<refentryinfo>
9749 <title>LINUX</title>
9750 <productname>Kernel Hackers Manual</productname>
9751 <date>July 2017</date>
9752</refentryinfo>
9753<refmeta>
9754 <refentrytitle><phrase>sys_sigpending</phrase></refentrytitle>
9755 <manvolnum>9</manvolnum>
9756 <refmiscinfo class="version">4.1.27</refmiscinfo>
9757</refmeta>
9758<refnamediv>
9759 <refname>sys_sigpending</refname>
9760 <refpurpose>
9761     examine pending signals
9762 </refpurpose>
9763</refnamediv>
9764<refsynopsisdiv>
9765 <title>Synopsis</title>
9766  <funcsynopsis><funcprototype>
9767   <funcdef>long <function>sys_sigpending </function></funcdef>
9768   <paramdef>old_sigset_t __user * <parameter>set</parameter></paramdef>
9769  </funcprototype></funcsynopsis>
9770</refsynopsisdiv>
9771<refsect1>
9772 <title>Arguments</title>
9773 <variablelist>
9774  <varlistentry>
9775   <term><parameter>set</parameter></term>
9776   <listitem>
9777    <para>
9778     where mask of pending signal is returned
9779    </para>
9780   </listitem>
9781  </varlistentry>
9782 </variablelist>
9783</refsect1>
9784</refentry>
9785
9786<refentry id="API-sys-sigprocmask">
9787<refentryinfo>
9788 <title>LINUX</title>
9789 <productname>Kernel Hackers Manual</productname>
9790 <date>July 2017</date>
9791</refentryinfo>
9792<refmeta>
9793 <refentrytitle><phrase>sys_sigprocmask</phrase></refentrytitle>
9794 <manvolnum>9</manvolnum>
9795 <refmiscinfo class="version">4.1.27</refmiscinfo>
9796</refmeta>
9797<refnamediv>
9798 <refname>sys_sigprocmask</refname>
9799 <refpurpose>
9800     examine and change blocked signals
9801 </refpurpose>
9802</refnamediv>
9803<refsynopsisdiv>
9804 <title>Synopsis</title>
9805  <funcsynopsis><funcprototype>
9806   <funcdef>long <function>sys_sigprocmask </function></funcdef>
9807   <paramdef>int <parameter>how</parameter></paramdef>
9808   <paramdef>old_sigset_t __user * <parameter>nset</parameter></paramdef>
9809   <paramdef>old_sigset_t __user * <parameter>oset</parameter></paramdef>
9810  </funcprototype></funcsynopsis>
9811</refsynopsisdiv>
9812<refsect1>
9813 <title>Arguments</title>
9814 <variablelist>
9815  <varlistentry>
9816   <term><parameter>how</parameter></term>
9817   <listitem>
9818    <para>
9819     whether to add, remove, or set signals
9820    </para>
9821   </listitem>
9822  </varlistentry>
9823  <varlistentry>
9824   <term><parameter>nset</parameter></term>
9825   <listitem>
9826    <para>
9827     signals to add or remove (if non-null)
9828    </para>
9829   </listitem>
9830  </varlistentry>
9831  <varlistentry>
9832   <term><parameter>oset</parameter></term>
9833   <listitem>
9834    <para>
9835     previous value of signal mask if non-null
9836    </para>
9837   </listitem>
9838  </varlistentry>
9839 </variablelist>
9840</refsect1>
9841<refsect1>
9842<title>Description</title>
9843<para>
9844   Some platforms have their own version with special arguments;
9845   others support only sys_rt_sigprocmask.
9846</para>
9847</refsect1>
9848</refentry>
9849
9850<refentry id="API-sys-rt-sigaction">
9851<refentryinfo>
9852 <title>LINUX</title>
9853 <productname>Kernel Hackers Manual</productname>
9854 <date>July 2017</date>
9855</refentryinfo>
9856<refmeta>
9857 <refentrytitle><phrase>sys_rt_sigaction</phrase></refentrytitle>
9858 <manvolnum>9</manvolnum>
9859 <refmiscinfo class="version">4.1.27</refmiscinfo>
9860</refmeta>
9861<refnamediv>
9862 <refname>sys_rt_sigaction</refname>
9863 <refpurpose>
9864     alter an action taken by a process
9865 </refpurpose>
9866</refnamediv>
9867<refsynopsisdiv>
9868 <title>Synopsis</title>
9869  <funcsynopsis><funcprototype>
9870   <funcdef>long <function>sys_rt_sigaction </function></funcdef>
9871   <paramdef>int <parameter>sig</parameter></paramdef>
9872   <paramdef>const struct sigaction __user * <parameter>act</parameter></paramdef>
9873   <paramdef>struct sigaction __user * <parameter>oact</parameter></paramdef>
9874   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
9875  </funcprototype></funcsynopsis>
9876</refsynopsisdiv>
9877<refsect1>
9878 <title>Arguments</title>
9879 <variablelist>
9880  <varlistentry>
9881   <term><parameter>sig</parameter></term>
9882   <listitem>
9883    <para>
9884     signal to be sent
9885    </para>
9886   </listitem>
9887  </varlistentry>
9888  <varlistentry>
9889   <term><parameter>act</parameter></term>
9890   <listitem>
9891    <para>
9892     new sigaction
9893    </para>
9894   </listitem>
9895  </varlistentry>
9896  <varlistentry>
9897   <term><parameter>oact</parameter></term>
9898   <listitem>
9899    <para>
9900     used to save the previous sigaction
9901    </para>
9902   </listitem>
9903  </varlistentry>
9904  <varlistentry>
9905   <term><parameter>sigsetsize</parameter></term>
9906   <listitem>
9907    <para>
9908     size of sigset_t type
9909    </para>
9910   </listitem>
9911  </varlistentry>
9912 </variablelist>
9913</refsect1>
9914</refentry>
9915
9916<refentry id="API-sys-rt-sigsuspend">
9917<refentryinfo>
9918 <title>LINUX</title>
9919 <productname>Kernel Hackers Manual</productname>
9920 <date>July 2017</date>
9921</refentryinfo>
9922<refmeta>
9923 <refentrytitle><phrase>sys_rt_sigsuspend</phrase></refentrytitle>
9924 <manvolnum>9</manvolnum>
9925 <refmiscinfo class="version">4.1.27</refmiscinfo>
9926</refmeta>
9927<refnamediv>
9928 <refname>sys_rt_sigsuspend</refname>
9929 <refpurpose>
9930     replace the signal mask for a value with the <parameter>unewset</parameter> value until a signal is received
9931 </refpurpose>
9932</refnamediv>
9933<refsynopsisdiv>
9934 <title>Synopsis</title>
9935  <funcsynopsis><funcprototype>
9936   <funcdef>long <function>sys_rt_sigsuspend </function></funcdef>
9937   <paramdef>sigset_t __user * <parameter>unewset</parameter></paramdef>
9938   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
9939  </funcprototype></funcsynopsis>
9940</refsynopsisdiv>
9941<refsect1>
9942 <title>Arguments</title>
9943 <variablelist>
9944  <varlistentry>
9945   <term><parameter>unewset</parameter></term>
9946   <listitem>
9947    <para>
9948     new signal mask value
9949    </para>
9950   </listitem>
9951  </varlistentry>
9952  <varlistentry>
9953   <term><parameter>sigsetsize</parameter></term>
9954   <listitem>
9955    <para>
9956     size of sigset_t type
9957    </para>
9958   </listitem>
9959  </varlistentry>
9960 </variablelist>
9961</refsect1>
9962</refentry>
9963
9964<!-- include/linux/kthread.h -->
9965<refentry id="API-kthread-run">
9966<refentryinfo>
9967 <title>LINUX</title>
9968 <productname>Kernel Hackers Manual</productname>
9969 <date>July 2017</date>
9970</refentryinfo>
9971<refmeta>
9972 <refentrytitle><phrase>kthread_run</phrase></refentrytitle>
9973 <manvolnum>9</manvolnum>
9974 <refmiscinfo class="version">4.1.27</refmiscinfo>
9975</refmeta>
9976<refnamediv>
9977 <refname>kthread_run</refname>
9978 <refpurpose>
9979  create and wake a thread.
9980 </refpurpose>
9981</refnamediv>
9982<refsynopsisdiv>
9983 <title>Synopsis</title>
9984  <funcsynopsis><funcprototype>
9985   <funcdef> <function>kthread_run </function></funcdef>
9986   <paramdef> <parameter>threadfn</parameter></paramdef>
9987   <paramdef> <parameter>data</parameter></paramdef>
9988   <paramdef> <parameter>namefmt</parameter></paramdef>
9989   <paramdef> <parameter>...</parameter></paramdef>
9990  </funcprototype></funcsynopsis>
9991</refsynopsisdiv>
9992<refsect1>
9993 <title>Arguments</title>
9994 <variablelist>
9995  <varlistentry>
9996   <term><parameter>threadfn</parameter></term>
9997   <listitem>
9998    <para>
9999     the function to run until signal_pending(current).
10000    </para>
10001   </listitem>
10002  </varlistentry>
10003  <varlistentry>
10004   <term><parameter>data</parameter></term>
10005   <listitem>
10006    <para>
10007     data ptr for <parameter>threadfn</parameter>.
10008    </para>
10009   </listitem>
10010  </varlistentry>
10011  <varlistentry>
10012   <term><parameter>namefmt</parameter></term>
10013   <listitem>
10014    <para>
10015     printf-style name for the thread.
10016    </para>
10017   </listitem>
10018  </varlistentry>
10019  <varlistentry>
10020   <term><parameter>...</parameter></term>
10021   <listitem>
10022    <para>
10023     variable arguments
10024    </para>
10025   </listitem>
10026  </varlistentry>
10027 </variablelist>
10028</refsect1>
10029<refsect1>
10030<title>Description</title>
10031<para>
10032   Convenient wrapper for <function>kthread_create</function> followed by
10033   <function>wake_up_process</function>.  Returns the kthread or ERR_PTR(-ENOMEM).
10034</para>
10035</refsect1>
10036</refentry>
10037
10038<!-- kernel/kthread.c -->
10039<refentry id="API-kthread-should-stop">
10040<refentryinfo>
10041 <title>LINUX</title>
10042 <productname>Kernel Hackers Manual</productname>
10043 <date>July 2017</date>
10044</refentryinfo>
10045<refmeta>
10046 <refentrytitle><phrase>kthread_should_stop</phrase></refentrytitle>
10047 <manvolnum>9</manvolnum>
10048 <refmiscinfo class="version">4.1.27</refmiscinfo>
10049</refmeta>
10050<refnamediv>
10051 <refname>kthread_should_stop</refname>
10052 <refpurpose>
10053  should this kthread return now?
10054 </refpurpose>
10055</refnamediv>
10056<refsynopsisdiv>
10057 <title>Synopsis</title>
10058  <funcsynopsis><funcprototype>
10059   <funcdef>bool <function>kthread_should_stop </function></funcdef>
10060   <paramdef> <parameter>void</parameter></paramdef>
10061  </funcprototype></funcsynopsis>
10062</refsynopsisdiv>
10063<refsect1>
10064 <title>Arguments</title>
10065 <variablelist>
10066  <varlistentry>
10067   <term><parameter>void</parameter></term>
10068   <listitem>
10069    <para>
10070     no arguments
10071    </para>
10072   </listitem>
10073  </varlistentry>
10074 </variablelist>
10075</refsect1>
10076<refsect1>
10077<title>Description</title>
10078<para>
10079   </para><para>
10080
10081   When someone calls <function>kthread_stop</function> on your kthread, it will be woken
10082   and this will return true.  You should then return, and your return
10083   value will be passed through to <function>kthread_stop</function>.
10084</para>
10085</refsect1>
10086</refentry>
10087
10088<refentry id="API-kthread-freezable-should-stop">
10089<refentryinfo>
10090 <title>LINUX</title>
10091 <productname>Kernel Hackers Manual</productname>
10092 <date>July 2017</date>
10093</refentryinfo>
10094<refmeta>
10095 <refentrytitle><phrase>kthread_freezable_should_stop</phrase></refentrytitle>
10096 <manvolnum>9</manvolnum>
10097 <refmiscinfo class="version">4.1.27</refmiscinfo>
10098</refmeta>
10099<refnamediv>
10100 <refname>kthread_freezable_should_stop</refname>
10101 <refpurpose>
10102     should this freezable kthread return now?
10103 </refpurpose>
10104</refnamediv>
10105<refsynopsisdiv>
10106 <title>Synopsis</title>
10107  <funcsynopsis><funcprototype>
10108   <funcdef>bool <function>kthread_freezable_should_stop </function></funcdef>
10109   <paramdef>bool * <parameter>was_frozen</parameter></paramdef>
10110  </funcprototype></funcsynopsis>
10111</refsynopsisdiv>
10112<refsect1>
10113 <title>Arguments</title>
10114 <variablelist>
10115  <varlistentry>
10116   <term><parameter>was_frozen</parameter></term>
10117   <listitem>
10118    <para>
10119     optional out parameter, indicates whether <constant>current</constant> was frozen
10120    </para>
10121   </listitem>
10122  </varlistentry>
10123 </variablelist>
10124</refsect1>
10125<refsect1>
10126<title>Description</title>
10127<para>
10128   <function>kthread_should_stop</function> for freezable kthreads, which will enter
10129   refrigerator if necessary.  This function is safe from <function>kthread_stop</function> /
10130   freezer deadlock and freezable kthreads should use this function instead
10131   of calling <function>try_to_freeze</function> directly.
10132</para>
10133</refsect1>
10134</refentry>
10135
10136<refentry id="API-kthread-create-on-node">
10137<refentryinfo>
10138 <title>LINUX</title>
10139 <productname>Kernel Hackers Manual</productname>
10140 <date>July 2017</date>
10141</refentryinfo>
10142<refmeta>
10143 <refentrytitle><phrase>kthread_create_on_node</phrase></refentrytitle>
10144 <manvolnum>9</manvolnum>
10145 <refmiscinfo class="version">4.1.27</refmiscinfo>
10146</refmeta>
10147<refnamediv>
10148 <refname>kthread_create_on_node</refname>
10149 <refpurpose>
10150     create a kthread.
10151 </refpurpose>
10152</refnamediv>
10153<refsynopsisdiv>
10154 <title>Synopsis</title>
10155  <funcsynopsis><funcprototype>
10156   <funcdef>struct task_struct * <function>kthread_create_on_node </function></funcdef>
10157   <paramdef>int (*<parameter>threadfn</parameter>)
10158     <funcparams>void *data</funcparams></paramdef>
10159   <paramdef>void * <parameter>data</parameter></paramdef>
10160   <paramdef>int <parameter>node</parameter></paramdef>
10161   <paramdef>const char <parameter>namefmt[]</parameter></paramdef>
10162   <paramdef> <parameter>...</parameter></paramdef>
10163  </funcprototype></funcsynopsis>
10164</refsynopsisdiv>
10165<refsect1>
10166 <title>Arguments</title>
10167 <variablelist>
10168  <varlistentry>
10169   <term><parameter>threadfn</parameter></term>
10170   <listitem>
10171    <para>
10172     the function to run until signal_pending(current).
10173    </para>
10174   </listitem>
10175  </varlistentry>
10176  <varlistentry>
10177   <term><parameter>data</parameter></term>
10178   <listitem>
10179    <para>
10180     data ptr for <parameter>threadfn</parameter>.
10181    </para>
10182   </listitem>
10183  </varlistentry>
10184  <varlistentry>
10185   <term><parameter>node</parameter></term>
10186   <listitem>
10187    <para>
10188     memory node number.
10189    </para>
10190   </listitem>
10191  </varlistentry>
10192  <varlistentry>
10193   <term><parameter>namefmt[]</parameter></term>
10194   <listitem>
10195    <para>
10196     printf-style name for the thread.
10197    </para>
10198   </listitem>
10199  </varlistentry>
10200  <varlistentry>
10201   <term><parameter>...</parameter></term>
10202   <listitem>
10203    <para>
10204     variable arguments
10205    </para>
10206   </listitem>
10207  </varlistentry>
10208 </variablelist>
10209</refsect1>
10210<refsect1>
10211<title>Description</title>
10212<para>
10213   This helper function creates and names a kernel
10214   thread.  The thread will be stopped: use <function>wake_up_process</function> to start
10215   it.  See also <function>kthread_run</function>.
10216   </para><para>
10217
10218   If thread is going to be bound on a particular cpu, give its node
10219   in <parameter>node</parameter>, to get NUMA affinity for kthread stack, or else give -1.
10220   When woken, the thread will run @<function>threadfn</function> with <parameter>data</parameter> as its
10221   argument. @<function>threadfn</function> can either call <function>do_exit</function> directly if it is a
10222   standalone thread for which no one will call <function>kthread_stop</function>, or
10223   return when '<function>kthread_should_stop</function>' is true (which means
10224   <function>kthread_stop</function> has been called).  The return value should be zero
10225   or a negative error number; it will be passed to <function>kthread_stop</function>.
10226   </para><para>
10227
10228   Returns a task_struct or ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR).
10229</para>
10230</refsect1>
10231</refentry>
10232
10233<refentry id="API-kthread-bind">
10234<refentryinfo>
10235 <title>LINUX</title>
10236 <productname>Kernel Hackers Manual</productname>
10237 <date>July 2017</date>
10238</refentryinfo>
10239<refmeta>
10240 <refentrytitle><phrase>kthread_bind</phrase></refentrytitle>
10241 <manvolnum>9</manvolnum>
10242 <refmiscinfo class="version">4.1.27</refmiscinfo>
10243</refmeta>
10244<refnamediv>
10245 <refname>kthread_bind</refname>
10246 <refpurpose>
10247     bind a just-created kthread to a cpu.
10248 </refpurpose>
10249</refnamediv>
10250<refsynopsisdiv>
10251 <title>Synopsis</title>
10252  <funcsynopsis><funcprototype>
10253   <funcdef>void <function>kthread_bind </function></funcdef>
10254   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
10255   <paramdef>unsigned int <parameter>cpu</parameter></paramdef>
10256  </funcprototype></funcsynopsis>
10257</refsynopsisdiv>
10258<refsect1>
10259 <title>Arguments</title>
10260 <variablelist>
10261  <varlistentry>
10262   <term><parameter>p</parameter></term>
10263   <listitem>
10264    <para>
10265     thread created by <function>kthread_create</function>.
10266    </para>
10267   </listitem>
10268  </varlistentry>
10269  <varlistentry>
10270   <term><parameter>cpu</parameter></term>
10271   <listitem>
10272    <para>
10273     cpu (might not be online, must be possible) for <parameter>k</parameter> to run on.
10274    </para>
10275   </listitem>
10276  </varlistentry>
10277 </variablelist>
10278</refsect1>
10279<refsect1>
10280<title>Description</title>
10281<para>
10282   This function is equivalent to <function>set_cpus_allowed</function>,
10283   except that <parameter>cpu</parameter> doesn't need to be online, and the thread must be
10284   stopped (i.e., just returned from <function>kthread_create</function>).
10285</para>
10286</refsect1>
10287</refentry>
10288
10289<refentry id="API-kthread-stop">
10290<refentryinfo>
10291 <title>LINUX</title>
10292 <productname>Kernel Hackers Manual</productname>
10293 <date>July 2017</date>
10294</refentryinfo>
10295<refmeta>
10296 <refentrytitle><phrase>kthread_stop</phrase></refentrytitle>
10297 <manvolnum>9</manvolnum>
10298 <refmiscinfo class="version">4.1.27</refmiscinfo>
10299</refmeta>
10300<refnamediv>
10301 <refname>kthread_stop</refname>
10302 <refpurpose>
10303     stop a thread created by <function>kthread_create</function>.
10304 </refpurpose>
10305</refnamediv>
10306<refsynopsisdiv>
10307 <title>Synopsis</title>
10308  <funcsynopsis><funcprototype>
10309   <funcdef>int <function>kthread_stop </function></funcdef>
10310   <paramdef>struct task_struct * <parameter>k</parameter></paramdef>
10311  </funcprototype></funcsynopsis>
10312</refsynopsisdiv>
10313<refsect1>
10314 <title>Arguments</title>
10315 <variablelist>
10316  <varlistentry>
10317   <term><parameter>k</parameter></term>
10318   <listitem>
10319    <para>
10320     thread created by <function>kthread_create</function>.
10321    </para>
10322   </listitem>
10323  </varlistentry>
10324 </variablelist>
10325</refsect1>
10326<refsect1>
10327<title>Description</title>
10328<para>
10329   Sets <function>kthread_should_stop</function> for <parameter>k</parameter> to return true, wakes it, and
10330   waits for it to exit. This can also be called after <function>kthread_create</function>
10331   instead of calling <function>wake_up_process</function>: the thread will exit without
10332   calling <function>threadfn</function>.
10333   </para><para>
10334
10335   If <function>threadfn</function> may call <function>do_exit</function> itself, the caller must ensure
10336   task_struct can't go away.
10337   </para><para>
10338
10339   Returns the result of <function>threadfn</function>, or <constant>-EINTR</constant> if <function>wake_up_process</function>
10340   was never called.
10341</para>
10342</refsect1>
10343</refentry>
10344
10345<refentry id="API-kthread-worker-fn">
10346<refentryinfo>
10347 <title>LINUX</title>
10348 <productname>Kernel Hackers Manual</productname>
10349 <date>July 2017</date>
10350</refentryinfo>
10351<refmeta>
10352 <refentrytitle><phrase>kthread_worker_fn</phrase></refentrytitle>
10353 <manvolnum>9</manvolnum>
10354 <refmiscinfo class="version">4.1.27</refmiscinfo>
10355</refmeta>
10356<refnamediv>
10357 <refname>kthread_worker_fn</refname>
10358 <refpurpose>
10359     kthread function to process kthread_worker
10360 </refpurpose>
10361</refnamediv>
10362<refsynopsisdiv>
10363 <title>Synopsis</title>
10364  <funcsynopsis><funcprototype>
10365   <funcdef>int <function>kthread_worker_fn </function></funcdef>
10366   <paramdef>void * <parameter>worker_ptr</parameter></paramdef>
10367  </funcprototype></funcsynopsis>
10368</refsynopsisdiv>
10369<refsect1>
10370 <title>Arguments</title>
10371 <variablelist>
10372  <varlistentry>
10373   <term><parameter>worker_ptr</parameter></term>
10374   <listitem>
10375    <para>
10376     pointer to initialized kthread_worker
10377    </para>
10378   </listitem>
10379  </varlistentry>
10380 </variablelist>
10381</refsect1>
10382<refsect1>
10383<title>Description</title>
10384<para>
10385   This function can be used as <parameter>threadfn</parameter> to <function>kthread_create</function> or
10386   <function>kthread_run</function> with <parameter>worker_ptr</parameter> argument pointing to an initialized
10387   kthread_worker.  The started kthread will process work_list until
10388   the it is stopped with <function>kthread_stop</function>.  A kthread can also call
10389   this function directly after extra initialization.
10390   </para><para>
10391
10392   Different kthreads can be used for the same kthread_worker as long
10393   as there's only one kthread attached to it at any given time.  A
10394   kthread_worker without an attached kthread simply collects queued
10395   kthread_works.
10396</para>
10397</refsect1>
10398</refentry>
10399
10400<refentry id="API-queue-kthread-work">
10401<refentryinfo>
10402 <title>LINUX</title>
10403 <productname>Kernel Hackers Manual</productname>
10404 <date>July 2017</date>
10405</refentryinfo>
10406<refmeta>
10407 <refentrytitle><phrase>queue_kthread_work</phrase></refentrytitle>
10408 <manvolnum>9</manvolnum>
10409 <refmiscinfo class="version">4.1.27</refmiscinfo>
10410</refmeta>
10411<refnamediv>
10412 <refname>queue_kthread_work</refname>
10413 <refpurpose>
10414     queue a kthread_work
10415 </refpurpose>
10416</refnamediv>
10417<refsynopsisdiv>
10418 <title>Synopsis</title>
10419  <funcsynopsis><funcprototype>
10420   <funcdef>bool <function>queue_kthread_work </function></funcdef>
10421   <paramdef>struct kthread_worker * <parameter>worker</parameter></paramdef>
10422   <paramdef>struct kthread_work * <parameter>work</parameter></paramdef>
10423  </funcprototype></funcsynopsis>
10424</refsynopsisdiv>
10425<refsect1>
10426 <title>Arguments</title>
10427 <variablelist>
10428  <varlistentry>
10429   <term><parameter>worker</parameter></term>
10430   <listitem>
10431    <para>
10432     target kthread_worker
10433    </para>
10434   </listitem>
10435  </varlistentry>
10436  <varlistentry>
10437   <term><parameter>work</parameter></term>
10438   <listitem>
10439    <para>
10440     kthread_work to queue
10441    </para>
10442   </listitem>
10443  </varlistentry>
10444 </variablelist>
10445</refsect1>
10446<refsect1>
10447<title>Description</title>
10448<para>
10449   Queue <parameter>work</parameter> to work processor <parameter>task</parameter> for async execution.  <parameter>task</parameter>
10450   must have been created with <function>kthread_worker_create</function>.  Returns <constant>true</constant>
10451   if <parameter>work</parameter> was successfully queued, <constant>false</constant> if it was already pending.
10452</para>
10453</refsect1>
10454</refentry>
10455
10456<refentry id="API-flush-kthread-work">
10457<refentryinfo>
10458 <title>LINUX</title>
10459 <productname>Kernel Hackers Manual</productname>
10460 <date>July 2017</date>
10461</refentryinfo>
10462<refmeta>
10463 <refentrytitle><phrase>flush_kthread_work</phrase></refentrytitle>
10464 <manvolnum>9</manvolnum>
10465 <refmiscinfo class="version">4.1.27</refmiscinfo>
10466</refmeta>
10467<refnamediv>
10468 <refname>flush_kthread_work</refname>
10469 <refpurpose>
10470     flush a kthread_work
10471 </refpurpose>
10472</refnamediv>
10473<refsynopsisdiv>
10474 <title>Synopsis</title>
10475  <funcsynopsis><funcprototype>
10476   <funcdef>void <function>flush_kthread_work </function></funcdef>
10477   <paramdef>struct kthread_work * <parameter>work</parameter></paramdef>
10478  </funcprototype></funcsynopsis>
10479</refsynopsisdiv>
10480<refsect1>
10481 <title>Arguments</title>
10482 <variablelist>
10483  <varlistentry>
10484   <term><parameter>work</parameter></term>
10485   <listitem>
10486    <para>
10487     work to flush
10488    </para>
10489   </listitem>
10490  </varlistentry>
10491 </variablelist>
10492</refsect1>
10493<refsect1>
10494<title>Description</title>
10495<para>
10496   If <parameter>work</parameter> is queued or executing, wait for it to finish execution.
10497</para>
10498</refsect1>
10499</refentry>
10500
10501<refentry id="API-flush-kthread-worker">
10502<refentryinfo>
10503 <title>LINUX</title>
10504 <productname>Kernel Hackers Manual</productname>
10505 <date>July 2017</date>
10506</refentryinfo>
10507<refmeta>
10508 <refentrytitle><phrase>flush_kthread_worker</phrase></refentrytitle>
10509 <manvolnum>9</manvolnum>
10510 <refmiscinfo class="version">4.1.27</refmiscinfo>
10511</refmeta>
10512<refnamediv>
10513 <refname>flush_kthread_worker</refname>
10514 <refpurpose>
10515     flush all current works on a kthread_worker
10516 </refpurpose>
10517</refnamediv>
10518<refsynopsisdiv>
10519 <title>Synopsis</title>
10520  <funcsynopsis><funcprototype>
10521   <funcdef>void <function>flush_kthread_worker </function></funcdef>
10522   <paramdef>struct kthread_worker * <parameter>worker</parameter></paramdef>
10523  </funcprototype></funcsynopsis>
10524</refsynopsisdiv>
10525<refsect1>
10526 <title>Arguments</title>
10527 <variablelist>
10528  <varlistentry>
10529   <term><parameter>worker</parameter></term>
10530   <listitem>
10531    <para>
10532     worker to flush
10533    </para>
10534   </listitem>
10535  </varlistentry>
10536 </variablelist>
10537</refsect1>
10538<refsect1>
10539<title>Description</title>
10540<para>
10541   Wait until all currently executing or pending works on <parameter>worker</parameter> are
10542   finished.
10543</para>
10544</refsect1>
10545</refentry>
10546
10547     </sect1>
10548
10549     <sect1><title>Kernel objects manipulation</title>
10550<!--
10551X!Iinclude/linux/kobject.h
10552-->
10553<!-- lib/kobject.c -->
10554<refentry id="API-kobject-get-path">
10555<refentryinfo>
10556 <title>LINUX</title>
10557 <productname>Kernel Hackers Manual</productname>
10558 <date>July 2017</date>
10559</refentryinfo>
10560<refmeta>
10561 <refentrytitle><phrase>kobject_get_path</phrase></refentrytitle>
10562 <manvolnum>9</manvolnum>
10563 <refmiscinfo class="version">4.1.27</refmiscinfo>
10564</refmeta>
10565<refnamediv>
10566 <refname>kobject_get_path</refname>
10567 <refpurpose>
10568  generate and return the path associated with a given kobj and kset pair.
10569 </refpurpose>
10570</refnamediv>
10571<refsynopsisdiv>
10572 <title>Synopsis</title>
10573  <funcsynopsis><funcprototype>
10574   <funcdef>char * <function>kobject_get_path </function></funcdef>
10575   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
10576   <paramdef>gfp_t <parameter>gfp_mask</parameter></paramdef>
10577  </funcprototype></funcsynopsis>
10578</refsynopsisdiv>
10579<refsect1>
10580 <title>Arguments</title>
10581 <variablelist>
10582  <varlistentry>
10583   <term><parameter>kobj</parameter></term>
10584   <listitem>
10585    <para>
10586     kobject in question, with which to build the path
10587    </para>
10588   </listitem>
10589  </varlistentry>
10590  <varlistentry>
10591   <term><parameter>gfp_mask</parameter></term>
10592   <listitem>
10593    <para>
10594     the allocation type used to allocate the path
10595    </para>
10596   </listitem>
10597  </varlistentry>
10598 </variablelist>
10599</refsect1>
10600<refsect1>
10601<title>Description</title>
10602<para>
10603   The result must be freed by the caller with <function>kfree</function>.
10604</para>
10605</refsect1>
10606</refentry>
10607
10608<refentry id="API-kobject-set-name">
10609<refentryinfo>
10610 <title>LINUX</title>
10611 <productname>Kernel Hackers Manual</productname>
10612 <date>July 2017</date>
10613</refentryinfo>
10614<refmeta>
10615 <refentrytitle><phrase>kobject_set_name</phrase></refentrytitle>
10616 <manvolnum>9</manvolnum>
10617 <refmiscinfo class="version">4.1.27</refmiscinfo>
10618</refmeta>
10619<refnamediv>
10620 <refname>kobject_set_name</refname>
10621 <refpurpose>
10622     Set the name of a kobject
10623 </refpurpose>
10624</refnamediv>
10625<refsynopsisdiv>
10626 <title>Synopsis</title>
10627  <funcsynopsis><funcprototype>
10628   <funcdef>int <function>kobject_set_name </function></funcdef>
10629   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
10630   <paramdef>const char * <parameter>fmt</parameter></paramdef>
10631   <paramdef> <parameter>...</parameter></paramdef>
10632  </funcprototype></funcsynopsis>
10633</refsynopsisdiv>
10634<refsect1>
10635 <title>Arguments</title>
10636 <variablelist>
10637  <varlistentry>
10638   <term><parameter>kobj</parameter></term>
10639   <listitem>
10640    <para>
10641     struct kobject to set the name of
10642    </para>
10643   </listitem>
10644  </varlistentry>
10645  <varlistentry>
10646   <term><parameter>fmt</parameter></term>
10647   <listitem>
10648    <para>
10649     format string used to build the name
10650    </para>
10651   </listitem>
10652  </varlistentry>
10653  <varlistentry>
10654   <term><parameter>...</parameter></term>
10655   <listitem>
10656    <para>
10657     variable arguments
10658    </para>
10659   </listitem>
10660  </varlistentry>
10661 </variablelist>
10662</refsect1>
10663<refsect1>
10664<title>Description</title>
10665<para>
10666   This sets the name of the kobject.  If you have already added the
10667   kobject to the system, you must call <function>kobject_rename</function> in order to
10668   change the name of the kobject.
10669</para>
10670</refsect1>
10671</refentry>
10672
10673<refentry id="API-kobject-init">
10674<refentryinfo>
10675 <title>LINUX</title>
10676 <productname>Kernel Hackers Manual</productname>
10677 <date>July 2017</date>
10678</refentryinfo>
10679<refmeta>
10680 <refentrytitle><phrase>kobject_init</phrase></refentrytitle>
10681 <manvolnum>9</manvolnum>
10682 <refmiscinfo class="version">4.1.27</refmiscinfo>
10683</refmeta>
10684<refnamediv>
10685 <refname>kobject_init</refname>
10686 <refpurpose>
10687     initialize a kobject structure
10688 </refpurpose>
10689</refnamediv>
10690<refsynopsisdiv>
10691 <title>Synopsis</title>
10692  <funcsynopsis><funcprototype>
10693   <funcdef>void <function>kobject_init </function></funcdef>
10694   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
10695   <paramdef>struct kobj_type * <parameter>ktype</parameter></paramdef>
10696  </funcprototype></funcsynopsis>
10697</refsynopsisdiv>
10698<refsect1>
10699 <title>Arguments</title>
10700 <variablelist>
10701  <varlistentry>
10702   <term><parameter>kobj</parameter></term>
10703   <listitem>
10704    <para>
10705     pointer to the kobject to initialize
10706    </para>
10707   </listitem>
10708  </varlistentry>
10709  <varlistentry>
10710   <term><parameter>ktype</parameter></term>
10711   <listitem>
10712    <para>
10713     pointer to the ktype for this kobject.
10714    </para>
10715   </listitem>
10716  </varlistentry>
10717 </variablelist>
10718</refsect1>
10719<refsect1>
10720<title>Description</title>
10721<para>
10722   This function will properly initialize a kobject such that it can then
10723   be passed to the <function>kobject_add</function> call.
10724   </para><para>
10725
10726   After this function is called, the kobject MUST be cleaned up by a call
10727   to <function>kobject_put</function>, not by a call to kfree directly to ensure that all of
10728   the memory is cleaned up properly.
10729</para>
10730</refsect1>
10731</refentry>
10732
10733<refentry id="API-kobject-add">
10734<refentryinfo>
10735 <title>LINUX</title>
10736 <productname>Kernel Hackers Manual</productname>
10737 <date>July 2017</date>
10738</refentryinfo>
10739<refmeta>
10740 <refentrytitle><phrase>kobject_add</phrase></refentrytitle>
10741 <manvolnum>9</manvolnum>
10742 <refmiscinfo class="version">4.1.27</refmiscinfo>
10743</refmeta>
10744<refnamediv>
10745 <refname>kobject_add</refname>
10746 <refpurpose>
10747     the main kobject add function
10748 </refpurpose>
10749</refnamediv>
10750<refsynopsisdiv>
10751 <title>Synopsis</title>
10752  <funcsynopsis><funcprototype>
10753   <funcdef>int <function>kobject_add </function></funcdef>
10754   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
10755   <paramdef>struct kobject * <parameter>parent</parameter></paramdef>
10756   <paramdef>const char * <parameter>fmt</parameter></paramdef>
10757   <paramdef> <parameter>...</parameter></paramdef>
10758  </funcprototype></funcsynopsis>
10759</refsynopsisdiv>
10760<refsect1>
10761 <title>Arguments</title>
10762 <variablelist>
10763  <varlistentry>
10764   <term><parameter>kobj</parameter></term>
10765   <listitem>
10766    <para>
10767     the kobject to add
10768    </para>
10769   </listitem>
10770  </varlistentry>
10771  <varlistentry>
10772   <term><parameter>parent</parameter></term>
10773   <listitem>
10774    <para>
10775     pointer to the parent of the kobject.
10776    </para>
10777   </listitem>
10778  </varlistentry>
10779  <varlistentry>
10780   <term><parameter>fmt</parameter></term>
10781   <listitem>
10782    <para>
10783     format to name the kobject with.
10784    </para>
10785   </listitem>
10786  </varlistentry>
10787  <varlistentry>
10788   <term><parameter>...</parameter></term>
10789   <listitem>
10790    <para>
10791     variable arguments
10792    </para>
10793   </listitem>
10794  </varlistentry>
10795 </variablelist>
10796</refsect1>
10797<refsect1>
10798<title>Description</title>
10799<para>
10800   The kobject name is set and added to the kobject hierarchy in this
10801   function.
10802   </para><para>
10803
10804   If <parameter>parent</parameter> is set, then the parent of the <parameter>kobj</parameter> will be set to it.
10805   If <parameter>parent</parameter> is NULL, then the parent of the <parameter>kobj</parameter> will be set to the
10806   kobject associated with the kset assigned to this kobject.  If no kset
10807   is assigned to the kobject, then the kobject will be located in the
10808   root of the sysfs tree.
10809   </para><para>
10810
10811   If this function returns an error, <function>kobject_put</function> must be called to
10812   properly clean up the memory associated with the object.
10813   Under no instance should the kobject that is passed to this function
10814   be directly freed with a call to <function>kfree</function>, that can leak memory.
10815   </para><para>
10816
10817   Note, no <quote>add</quote> uevent will be created with this call, the caller should set
10818   up all of the necessary sysfs files for the object and then call
10819   <function>kobject_uevent</function> with the UEVENT_ADD parameter to ensure that
10820   userspace is properly notified of this kobject's creation.
10821</para>
10822</refsect1>
10823</refentry>
10824
10825<refentry id="API-kobject-init-and-add">
10826<refentryinfo>
10827 <title>LINUX</title>
10828 <productname>Kernel Hackers Manual</productname>
10829 <date>July 2017</date>
10830</refentryinfo>
10831<refmeta>
10832 <refentrytitle><phrase>kobject_init_and_add</phrase></refentrytitle>
10833 <manvolnum>9</manvolnum>
10834 <refmiscinfo class="version">4.1.27</refmiscinfo>
10835</refmeta>
10836<refnamediv>
10837 <refname>kobject_init_and_add</refname>
10838 <refpurpose>
10839     initialize a kobject structure and add it to the kobject hierarchy
10840 </refpurpose>
10841</refnamediv>
10842<refsynopsisdiv>
10843 <title>Synopsis</title>
10844  <funcsynopsis><funcprototype>
10845   <funcdef>int <function>kobject_init_and_add </function></funcdef>
10846   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
10847   <paramdef>struct kobj_type * <parameter>ktype</parameter></paramdef>
10848   <paramdef>struct kobject * <parameter>parent</parameter></paramdef>
10849   <paramdef>const char * <parameter>fmt</parameter></paramdef>
10850   <paramdef> <parameter>...</parameter></paramdef>
10851  </funcprototype></funcsynopsis>
10852</refsynopsisdiv>
10853<refsect1>
10854 <title>Arguments</title>
10855 <variablelist>
10856  <varlistentry>
10857   <term><parameter>kobj</parameter></term>
10858   <listitem>
10859    <para>
10860     pointer to the kobject to initialize
10861    </para>
10862   </listitem>
10863  </varlistentry>
10864  <varlistentry>
10865   <term><parameter>ktype</parameter></term>
10866   <listitem>
10867    <para>
10868     pointer to the ktype for this kobject.
10869    </para>
10870   </listitem>
10871  </varlistentry>
10872  <varlistentry>
10873   <term><parameter>parent</parameter></term>
10874   <listitem>
10875    <para>
10876     pointer to the parent of this kobject.
10877    </para>
10878   </listitem>
10879  </varlistentry>
10880  <varlistentry>
10881   <term><parameter>fmt</parameter></term>
10882   <listitem>
10883    <para>
10884     the name of the kobject.
10885    </para>
10886   </listitem>
10887  </varlistentry>
10888  <varlistentry>
10889   <term><parameter>...</parameter></term>
10890   <listitem>
10891    <para>
10892     variable arguments
10893    </para>
10894   </listitem>
10895  </varlistentry>
10896 </variablelist>
10897</refsect1>
10898<refsect1>
10899<title>Description</title>
10900<para>
10901   This function combines the call to <function>kobject_init</function> and
10902   <function>kobject_add</function>.  The same type of error handling after a call to
10903   <function>kobject_add</function> and kobject lifetime rules are the same here.
10904</para>
10905</refsect1>
10906</refentry>
10907
10908<refentry id="API-kobject-rename">
10909<refentryinfo>
10910 <title>LINUX</title>
10911 <productname>Kernel Hackers Manual</productname>
10912 <date>July 2017</date>
10913</refentryinfo>
10914<refmeta>
10915 <refentrytitle><phrase>kobject_rename</phrase></refentrytitle>
10916 <manvolnum>9</manvolnum>
10917 <refmiscinfo class="version">4.1.27</refmiscinfo>
10918</refmeta>
10919<refnamediv>
10920 <refname>kobject_rename</refname>
10921 <refpurpose>
10922     change the name of an object
10923 </refpurpose>
10924</refnamediv>
10925<refsynopsisdiv>
10926 <title>Synopsis</title>
10927  <funcsynopsis><funcprototype>
10928   <funcdef>int <function>kobject_rename </function></funcdef>
10929   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
10930   <paramdef>const char * <parameter>new_name</parameter></paramdef>
10931  </funcprototype></funcsynopsis>
10932</refsynopsisdiv>
10933<refsect1>
10934 <title>Arguments</title>
10935 <variablelist>
10936  <varlistentry>
10937   <term><parameter>kobj</parameter></term>
10938   <listitem>
10939    <para>
10940     object in question.
10941    </para>
10942   </listitem>
10943  </varlistentry>
10944  <varlistentry>
10945   <term><parameter>new_name</parameter></term>
10946   <listitem>
10947    <para>
10948     object's new name
10949    </para>
10950   </listitem>
10951  </varlistentry>
10952 </variablelist>
10953</refsect1>
10954<refsect1>
10955<title>Description</title>
10956<para>
10957   It is the responsibility of the caller to provide mutual
10958   exclusion between two different calls of kobject_rename
10959   on the same kobject and to ensure that new_name is valid and
10960   won't conflict with other kobjects.
10961</para>
10962</refsect1>
10963</refentry>
10964
10965<refentry id="API-kobject-del">
10966<refentryinfo>
10967 <title>LINUX</title>
10968 <productname>Kernel Hackers Manual</productname>
10969 <date>July 2017</date>
10970</refentryinfo>
10971<refmeta>
10972 <refentrytitle><phrase>kobject_del</phrase></refentrytitle>
10973 <manvolnum>9</manvolnum>
10974 <refmiscinfo class="version">4.1.27</refmiscinfo>
10975</refmeta>
10976<refnamediv>
10977 <refname>kobject_del</refname>
10978 <refpurpose>
10979     unlink kobject from hierarchy.
10980 </refpurpose>
10981</refnamediv>
10982<refsynopsisdiv>
10983 <title>Synopsis</title>
10984  <funcsynopsis><funcprototype>
10985   <funcdef>void <function>kobject_del </function></funcdef>
10986   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
10987  </funcprototype></funcsynopsis>
10988</refsynopsisdiv>
10989<refsect1>
10990 <title>Arguments</title>
10991 <variablelist>
10992  <varlistentry>
10993   <term><parameter>kobj</parameter></term>
10994   <listitem>
10995    <para>
10996     object.
10997    </para>
10998   </listitem>
10999  </varlistentry>
11000 </variablelist>
11001</refsect1>
11002</refentry>
11003
11004<refentry id="API-kobject-get">
11005<refentryinfo>
11006 <title>LINUX</title>
11007 <productname>Kernel Hackers Manual</productname>
11008 <date>July 2017</date>
11009</refentryinfo>
11010<refmeta>
11011 <refentrytitle><phrase>kobject_get</phrase></refentrytitle>
11012 <manvolnum>9</manvolnum>
11013 <refmiscinfo class="version">4.1.27</refmiscinfo>
11014</refmeta>
11015<refnamediv>
11016 <refname>kobject_get</refname>
11017 <refpurpose>
11018     increment refcount for object.
11019 </refpurpose>
11020</refnamediv>
11021<refsynopsisdiv>
11022 <title>Synopsis</title>
11023  <funcsynopsis><funcprototype>
11024   <funcdef>struct kobject * <function>kobject_get </function></funcdef>
11025   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11026  </funcprototype></funcsynopsis>
11027</refsynopsisdiv>
11028<refsect1>
11029 <title>Arguments</title>
11030 <variablelist>
11031  <varlistentry>
11032   <term><parameter>kobj</parameter></term>
11033   <listitem>
11034    <para>
11035     object.
11036    </para>
11037   </listitem>
11038  </varlistentry>
11039 </variablelist>
11040</refsect1>
11041</refentry>
11042
11043<refentry id="API-kobject-put">
11044<refentryinfo>
11045 <title>LINUX</title>
11046 <productname>Kernel Hackers Manual</productname>
11047 <date>July 2017</date>
11048</refentryinfo>
11049<refmeta>
11050 <refentrytitle><phrase>kobject_put</phrase></refentrytitle>
11051 <manvolnum>9</manvolnum>
11052 <refmiscinfo class="version">4.1.27</refmiscinfo>
11053</refmeta>
11054<refnamediv>
11055 <refname>kobject_put</refname>
11056 <refpurpose>
11057     decrement refcount for object.
11058 </refpurpose>
11059</refnamediv>
11060<refsynopsisdiv>
11061 <title>Synopsis</title>
11062  <funcsynopsis><funcprototype>
11063   <funcdef>void <function>kobject_put </function></funcdef>
11064   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11065  </funcprototype></funcsynopsis>
11066</refsynopsisdiv>
11067<refsect1>
11068 <title>Arguments</title>
11069 <variablelist>
11070  <varlistentry>
11071   <term><parameter>kobj</parameter></term>
11072   <listitem>
11073    <para>
11074     object.
11075    </para>
11076   </listitem>
11077  </varlistentry>
11078 </variablelist>
11079</refsect1>
11080<refsect1>
11081<title>Description</title>
11082<para>
11083   Decrement the refcount, and if 0, call <function>kobject_cleanup</function>.
11084</para>
11085</refsect1>
11086</refentry>
11087
11088<refentry id="API-kobject-create-and-add">
11089<refentryinfo>
11090 <title>LINUX</title>
11091 <productname>Kernel Hackers Manual</productname>
11092 <date>July 2017</date>
11093</refentryinfo>
11094<refmeta>
11095 <refentrytitle><phrase>kobject_create_and_add</phrase></refentrytitle>
11096 <manvolnum>9</manvolnum>
11097 <refmiscinfo class="version">4.1.27</refmiscinfo>
11098</refmeta>
11099<refnamediv>
11100 <refname>kobject_create_and_add</refname>
11101 <refpurpose>
11102     create a struct kobject dynamically and register it with sysfs
11103 </refpurpose>
11104</refnamediv>
11105<refsynopsisdiv>
11106 <title>Synopsis</title>
11107  <funcsynopsis><funcprototype>
11108   <funcdef>struct kobject * <function>kobject_create_and_add </function></funcdef>
11109   <paramdef>const char * <parameter>name</parameter></paramdef>
11110   <paramdef>struct kobject * <parameter>parent</parameter></paramdef>
11111  </funcprototype></funcsynopsis>
11112</refsynopsisdiv>
11113<refsect1>
11114 <title>Arguments</title>
11115 <variablelist>
11116  <varlistentry>
11117   <term><parameter>name</parameter></term>
11118   <listitem>
11119    <para>
11120     the name for the kobject
11121    </para>
11122   </listitem>
11123  </varlistentry>
11124  <varlistentry>
11125   <term><parameter>parent</parameter></term>
11126   <listitem>
11127    <para>
11128     the parent kobject of this kobject, if any.
11129    </para>
11130   </listitem>
11131  </varlistentry>
11132 </variablelist>
11133</refsect1>
11134<refsect1>
11135<title>Description</title>
11136<para>
11137   This function creates a kobject structure dynamically and registers it
11138   with sysfs.  When you are finished with this structure, call
11139   <function>kobject_put</function> and the structure will be dynamically freed when
11140   it is no longer being used.
11141   </para><para>
11142
11143   If the kobject was not able to be created, NULL will be returned.
11144</para>
11145</refsect1>
11146</refentry>
11147
11148<refentry id="API-kset-register">
11149<refentryinfo>
11150 <title>LINUX</title>
11151 <productname>Kernel Hackers Manual</productname>
11152 <date>July 2017</date>
11153</refentryinfo>
11154<refmeta>
11155 <refentrytitle><phrase>kset_register</phrase></refentrytitle>
11156 <manvolnum>9</manvolnum>
11157 <refmiscinfo class="version">4.1.27</refmiscinfo>
11158</refmeta>
11159<refnamediv>
11160 <refname>kset_register</refname>
11161 <refpurpose>
11162     initialize and add a kset.
11163 </refpurpose>
11164</refnamediv>
11165<refsynopsisdiv>
11166 <title>Synopsis</title>
11167  <funcsynopsis><funcprototype>
11168   <funcdef>int <function>kset_register </function></funcdef>
11169   <paramdef>struct kset * <parameter>k</parameter></paramdef>
11170  </funcprototype></funcsynopsis>
11171</refsynopsisdiv>
11172<refsect1>
11173 <title>Arguments</title>
11174 <variablelist>
11175  <varlistentry>
11176   <term><parameter>k</parameter></term>
11177   <listitem>
11178    <para>
11179     kset.
11180    </para>
11181   </listitem>
11182  </varlistentry>
11183 </variablelist>
11184</refsect1>
11185</refentry>
11186
11187<refentry id="API-kset-unregister">
11188<refentryinfo>
11189 <title>LINUX</title>
11190 <productname>Kernel Hackers Manual</productname>
11191 <date>July 2017</date>
11192</refentryinfo>
11193<refmeta>
11194 <refentrytitle><phrase>kset_unregister</phrase></refentrytitle>
11195 <manvolnum>9</manvolnum>
11196 <refmiscinfo class="version">4.1.27</refmiscinfo>
11197</refmeta>
11198<refnamediv>
11199 <refname>kset_unregister</refname>
11200 <refpurpose>
11201     remove a kset.
11202 </refpurpose>
11203</refnamediv>
11204<refsynopsisdiv>
11205 <title>Synopsis</title>
11206  <funcsynopsis><funcprototype>
11207   <funcdef>void <function>kset_unregister </function></funcdef>
11208   <paramdef>struct kset * <parameter>k</parameter></paramdef>
11209  </funcprototype></funcsynopsis>
11210</refsynopsisdiv>
11211<refsect1>
11212 <title>Arguments</title>
11213 <variablelist>
11214  <varlistentry>
11215   <term><parameter>k</parameter></term>
11216   <listitem>
11217    <para>
11218     kset.
11219    </para>
11220   </listitem>
11221  </varlistentry>
11222 </variablelist>
11223</refsect1>
11224</refentry>
11225
11226<refentry id="API-kset-create-and-add">
11227<refentryinfo>
11228 <title>LINUX</title>
11229 <productname>Kernel Hackers Manual</productname>
11230 <date>July 2017</date>
11231</refentryinfo>
11232<refmeta>
11233 <refentrytitle><phrase>kset_create_and_add</phrase></refentrytitle>
11234 <manvolnum>9</manvolnum>
11235 <refmiscinfo class="version">4.1.27</refmiscinfo>
11236</refmeta>
11237<refnamediv>
11238 <refname>kset_create_and_add</refname>
11239 <refpurpose>
11240     create a struct kset dynamically and add it to sysfs
11241 </refpurpose>
11242</refnamediv>
11243<refsynopsisdiv>
11244 <title>Synopsis</title>
11245  <funcsynopsis><funcprototype>
11246   <funcdef>struct kset * <function>kset_create_and_add </function></funcdef>
11247   <paramdef>const char * <parameter>name</parameter></paramdef>
11248   <paramdef>const struct kset_uevent_ops * <parameter>uevent_ops</parameter></paramdef>
11249   <paramdef>struct kobject * <parameter>parent_kobj</parameter></paramdef>
11250  </funcprototype></funcsynopsis>
11251</refsynopsisdiv>
11252<refsect1>
11253 <title>Arguments</title>
11254 <variablelist>
11255  <varlistentry>
11256   <term><parameter>name</parameter></term>
11257   <listitem>
11258    <para>
11259     the name for the kset
11260    </para>
11261   </listitem>
11262  </varlistentry>
11263  <varlistentry>
11264   <term><parameter>uevent_ops</parameter></term>
11265   <listitem>
11266    <para>
11267     a struct kset_uevent_ops for the kset
11268    </para>
11269   </listitem>
11270  </varlistentry>
11271  <varlistentry>
11272   <term><parameter>parent_kobj</parameter></term>
11273   <listitem>
11274    <para>
11275     the parent kobject of this kset, if any.
11276    </para>
11277   </listitem>
11278  </varlistentry>
11279 </variablelist>
11280</refsect1>
11281<refsect1>
11282<title>Description</title>
11283<para>
11284   This function creates a kset structure dynamically and registers it
11285   with sysfs.  When you are finished with this structure, call
11286   <function>kset_unregister</function> and the structure will be dynamically freed when it
11287   is no longer being used.
11288   </para><para>
11289
11290   If the kset was not able to be created, NULL will be returned.
11291</para>
11292</refsect1>
11293</refentry>
11294
11295     </sect1>
11296
11297     <sect1><title>Kernel utility functions</title>
11298<!-- include/linux/kernel.h -->
11299<refentry id="API-upper-32-bits">
11300<refentryinfo>
11301 <title>LINUX</title>
11302 <productname>Kernel Hackers Manual</productname>
11303 <date>July 2017</date>
11304</refentryinfo>
11305<refmeta>
11306 <refentrytitle><phrase>upper_32_bits</phrase></refentrytitle>
11307 <manvolnum>9</manvolnum>
11308 <refmiscinfo class="version">4.1.27</refmiscinfo>
11309</refmeta>
11310<refnamediv>
11311 <refname>upper_32_bits</refname>
11312 <refpurpose>
11313  return bits 32-63 of a number
11314 </refpurpose>
11315</refnamediv>
11316<refsynopsisdiv>
11317 <title>Synopsis</title>
11318  <funcsynopsis><funcprototype>
11319   <funcdef> <function>upper_32_bits </function></funcdef>
11320   <paramdef> <parameter>n</parameter></paramdef>
11321  </funcprototype></funcsynopsis>
11322</refsynopsisdiv>
11323<refsect1>
11324 <title>Arguments</title>
11325 <variablelist>
11326  <varlistentry>
11327   <term><parameter>n</parameter></term>
11328   <listitem>
11329    <para>
11330     the number we're accessing
11331    </para>
11332   </listitem>
11333  </varlistentry>
11334 </variablelist>
11335</refsect1>
11336<refsect1>
11337<title>Description</title>
11338<para>
11339   A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
11340   the <quote>right shift count &gt;= width of type</quote> warning when that quantity is
11341   32-bits.
11342</para>
11343</refsect1>
11344</refentry>
11345
11346<refentry id="API-lower-32-bits">
11347<refentryinfo>
11348 <title>LINUX</title>
11349 <productname>Kernel Hackers Manual</productname>
11350 <date>July 2017</date>
11351</refentryinfo>
11352<refmeta>
11353 <refentrytitle><phrase>lower_32_bits</phrase></refentrytitle>
11354 <manvolnum>9</manvolnum>
11355 <refmiscinfo class="version">4.1.27</refmiscinfo>
11356</refmeta>
11357<refnamediv>
11358 <refname>lower_32_bits</refname>
11359 <refpurpose>
11360     return bits 0-31 of a number
11361 </refpurpose>
11362</refnamediv>
11363<refsynopsisdiv>
11364 <title>Synopsis</title>
11365  <funcsynopsis><funcprototype>
11366   <funcdef> <function>lower_32_bits </function></funcdef>
11367   <paramdef> <parameter>n</parameter></paramdef>
11368  </funcprototype></funcsynopsis>
11369</refsynopsisdiv>
11370<refsect1>
11371 <title>Arguments</title>
11372 <variablelist>
11373  <varlistentry>
11374   <term><parameter>n</parameter></term>
11375   <listitem>
11376    <para>
11377     the number we're accessing
11378    </para>
11379   </listitem>
11380  </varlistentry>
11381 </variablelist>
11382</refsect1>
11383</refentry>
11384
11385<refentry id="API-might-sleep">
11386<refentryinfo>
11387 <title>LINUX</title>
11388 <productname>Kernel Hackers Manual</productname>
11389 <date>July 2017</date>
11390</refentryinfo>
11391<refmeta>
11392 <refentrytitle><phrase>might_sleep</phrase></refentrytitle>
11393 <manvolnum>9</manvolnum>
11394 <refmiscinfo class="version">4.1.27</refmiscinfo>
11395</refmeta>
11396<refnamediv>
11397 <refname>might_sleep</refname>
11398 <refpurpose>
11399     annotation for functions that can sleep
11400 </refpurpose>
11401</refnamediv>
11402<refsynopsisdiv>
11403 <title>Synopsis</title>
11404  <funcsynopsis><funcprototype>
11405   <funcdef> <function>might_sleep </function></funcdef>
11406  <void/>
11407  </funcprototype></funcsynopsis>
11408</refsynopsisdiv>
11409<refsect1>
11410 <title>Arguments</title>
11411 <para>
11412  None
11413 </para>
11414</refsect1>
11415<refsect1>
11416<title>Description</title>
11417<para>
11418   </para><para>
11419
11420   this macro will print a stack trace if it is executed in an atomic
11421   context (spinlock, irq-handler, ...).
11422   </para><para>
11423
11424   This is a useful debugging help to be able to catch problems early and not
11425   be bitten later when the calling function happens to sleep when it is not
11426   supposed to.
11427</para>
11428</refsect1>
11429</refentry>
11430
11431<refentry id="API-reciprocal-scale">
11432<refentryinfo>
11433 <title>LINUX</title>
11434 <productname>Kernel Hackers Manual</productname>
11435 <date>July 2017</date>
11436</refentryinfo>
11437<refmeta>
11438 <refentrytitle><phrase>reciprocal_scale</phrase></refentrytitle>
11439 <manvolnum>9</manvolnum>
11440 <refmiscinfo class="version">4.1.27</refmiscinfo>
11441</refmeta>
11442<refnamediv>
11443 <refname>reciprocal_scale</refname>
11444 <refpurpose>
11445     "scale" a value into range [0, ep_ro)
11446 </refpurpose>
11447</refnamediv>
11448<refsynopsisdiv>
11449 <title>Synopsis</title>
11450  <funcsynopsis><funcprototype>
11451   <funcdef>u32 <function>reciprocal_scale </function></funcdef>
11452   <paramdef>u32 <parameter>val</parameter></paramdef>
11453   <paramdef>u32 <parameter>ep_ro</parameter></paramdef>
11454  </funcprototype></funcsynopsis>
11455</refsynopsisdiv>
11456<refsect1>
11457 <title>Arguments</title>
11458 <variablelist>
11459  <varlistentry>
11460   <term><parameter>val</parameter></term>
11461   <listitem>
11462    <para>
11463     value
11464    </para>
11465   </listitem>
11466  </varlistentry>
11467  <varlistentry>
11468   <term><parameter>ep_ro</parameter></term>
11469   <listitem>
11470    <para>
11471     right open interval endpoint
11472    </para>
11473   </listitem>
11474  </varlistentry>
11475 </variablelist>
11476</refsect1>
11477<refsect1>
11478<title>Description</title>
11479<para>
11480   Perform a <quote>reciprocal multiplication</quote> in order to <quote>scale</quote> a value into
11481   range [0, ep_ro), where the upper interval endpoint is right-open.
11482   This is useful, e.g. for accessing a index of an array containing
11483   ep_ro elements, for example. Think of it as sort of modulus, only that
11484   the result isn't that of modulo. ;) Note that if initial input is a
11485   small value, then result will return 0.
11486</para>
11487</refsect1>
11488<refsect1>
11489<title>Return</title>
11490<para>
11491   a result based on val in interval [0, ep_ro).
11492</para>
11493</refsect1>
11494</refentry>
11495
11496<refentry id="API-kstrtoul">
11497<refentryinfo>
11498 <title>LINUX</title>
11499 <productname>Kernel Hackers Manual</productname>
11500 <date>July 2017</date>
11501</refentryinfo>
11502<refmeta>
11503 <refentrytitle><phrase>kstrtoul</phrase></refentrytitle>
11504 <manvolnum>9</manvolnum>
11505 <refmiscinfo class="version">4.1.27</refmiscinfo>
11506</refmeta>
11507<refnamediv>
11508 <refname>kstrtoul</refname>
11509 <refpurpose>
11510     convert a string to an unsigned long
11511 </refpurpose>
11512</refnamediv>
11513<refsynopsisdiv>
11514 <title>Synopsis</title>
11515  <funcsynopsis><funcprototype>
11516   <funcdef>int <function>kstrtoul </function></funcdef>
11517   <paramdef>const char * <parameter>s</parameter></paramdef>
11518   <paramdef>unsigned int <parameter>base</parameter></paramdef>
11519   <paramdef>unsigned long * <parameter>res</parameter></paramdef>
11520  </funcprototype></funcsynopsis>
11521</refsynopsisdiv>
11522<refsect1>
11523 <title>Arguments</title>
11524 <variablelist>
11525  <varlistentry>
11526   <term><parameter>s</parameter></term>
11527   <listitem>
11528    <para>
11529     The start of the string. The string must be null-terminated, and may also
11530     include a single newline before its terminating null. The first character
11531     may also be a plus sign, but not a minus sign.
11532    </para>
11533   </listitem>
11534  </varlistentry>
11535  <varlistentry>
11536   <term><parameter>base</parameter></term>
11537   <listitem>
11538    <para>
11539     The number base to use. The maximum supported base is 16. If base is
11540     given as 0, then the base of the string is automatically detected with the
11541     conventional semantics - If it begins with 0x the number will be parsed as a
11542     hexadecimal (case insensitive), if it otherwise begins with 0, it will be
11543     parsed as an octal number. Otherwise it will be parsed as a decimal.
11544    </para>
11545   </listitem>
11546  </varlistentry>
11547  <varlistentry>
11548   <term><parameter>res</parameter></term>
11549   <listitem>
11550    <para>
11551     Where to write the result of the conversion on success.
11552    </para>
11553   </listitem>
11554  </varlistentry>
11555 </variablelist>
11556</refsect1>
11557<refsect1>
11558<title>Description</title>
11559<para>
11560   Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
11561   Used as a replacement for the obsolete simple_strtoull. Return code must
11562   be checked.
11563</para>
11564</refsect1>
11565</refentry>
11566
11567<refentry id="API-kstrtol">
11568<refentryinfo>
11569 <title>LINUX</title>
11570 <productname>Kernel Hackers Manual</productname>
11571 <date>July 2017</date>
11572</refentryinfo>
11573<refmeta>
11574 <refentrytitle><phrase>kstrtol</phrase></refentrytitle>
11575 <manvolnum>9</manvolnum>
11576 <refmiscinfo class="version">4.1.27</refmiscinfo>
11577</refmeta>
11578<refnamediv>
11579 <refname>kstrtol</refname>
11580 <refpurpose>
11581     convert a string to a long
11582 </refpurpose>
11583</refnamediv>
11584<refsynopsisdiv>
11585 <title>Synopsis</title>
11586  <funcsynopsis><funcprototype>
11587   <funcdef>int <function>kstrtol </function></funcdef>
11588   <paramdef>const char * <parameter>s</parameter></paramdef>
11589   <paramdef>unsigned int <parameter>base</parameter></paramdef>
11590   <paramdef>long * <parameter>res</parameter></paramdef>
11591  </funcprototype></funcsynopsis>
11592</refsynopsisdiv>
11593<refsect1>
11594 <title>Arguments</title>
11595 <variablelist>
11596  <varlistentry>
11597   <term><parameter>s</parameter></term>
11598   <listitem>
11599    <para>
11600     The start of the string. The string must be null-terminated, and may also
11601     include a single newline before its terminating null. The first character
11602     may also be a plus sign or a minus sign.
11603    </para>
11604   </listitem>
11605  </varlistentry>
11606  <varlistentry>
11607   <term><parameter>base</parameter></term>
11608   <listitem>
11609    <para>
11610     The number base to use. The maximum supported base is 16. If base is
11611     given as 0, then the base of the string is automatically detected with the
11612     conventional semantics - If it begins with 0x the number will be parsed as a
11613     hexadecimal (case insensitive), if it otherwise begins with 0, it will be
11614     parsed as an octal number. Otherwise it will be parsed as a decimal.
11615    </para>
11616   </listitem>
11617  </varlistentry>
11618  <varlistentry>
11619   <term><parameter>res</parameter></term>
11620   <listitem>
11621    <para>
11622     Where to write the result of the conversion on success.
11623    </para>
11624   </listitem>
11625  </varlistentry>
11626 </variablelist>
11627</refsect1>
11628<refsect1>
11629<title>Description</title>
11630<para>
11631   Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
11632   Used as a replacement for the obsolete simple_strtoull. Return code must
11633   be checked.
11634</para>
11635</refsect1>
11636</refentry>
11637
11638<refentry id="API-trace-printk">
11639<refentryinfo>
11640 <title>LINUX</title>
11641 <productname>Kernel Hackers Manual</productname>
11642 <date>July 2017</date>
11643</refentryinfo>
11644<refmeta>
11645 <refentrytitle><phrase>trace_printk</phrase></refentrytitle>
11646 <manvolnum>9</manvolnum>
11647 <refmiscinfo class="version">4.1.27</refmiscinfo>
11648</refmeta>
11649<refnamediv>
11650 <refname>trace_printk</refname>
11651 <refpurpose>
11652     printf formatting in the ftrace buffer
11653 </refpurpose>
11654</refnamediv>
11655<refsynopsisdiv>
11656 <title>Synopsis</title>
11657  <funcsynopsis><funcprototype>
11658   <funcdef> <function>trace_printk </function></funcdef>
11659   <paramdef> <parameter>fmt</parameter></paramdef>
11660   <paramdef> <parameter>...</parameter></paramdef>
11661  </funcprototype></funcsynopsis>
11662</refsynopsisdiv>
11663<refsect1>
11664 <title>Arguments</title>
11665 <variablelist>
11666  <varlistentry>
11667   <term><parameter>fmt</parameter></term>
11668   <listitem>
11669    <para>
11670     the printf format for printing
11671    </para>
11672   </listitem>
11673  </varlistentry>
11674  <varlistentry>
11675   <term><parameter>...</parameter></term>
11676   <listitem>
11677    <para>
11678     variable arguments
11679    </para>
11680   </listitem>
11681  </varlistentry>
11682 </variablelist>
11683</refsect1>
11684<refsect1>
11685<title>Note</title>
11686<para>
11687   __trace_printk is an internal function for trace_printk and
11688   the <parameter>ip</parameter> is passed in via the trace_printk macro.
11689   </para><para>
11690
11691   This function allows a kernel developer to debug fast path sections
11692   that printk is not appropriate for. By scattering in various
11693   printk like tracing in the code, a developer can quickly see
11694   where problems are occurring.
11695   </para><para>
11696
11697   This is intended as a debugging tool for the developer only.
11698   Please refrain from leaving trace_printks scattered around in
11699   your code. (Extra memory is used for special buffers that are
11700   allocated when <function>trace_printk</function> is used)
11701   </para><para>
11702
11703   A little optization trick is done here. If there's only one
11704   argument, there's no need to scan the string for printf formats.
11705   The <function>trace_puts</function> will suffice. But how can we take advantage of
11706   using <function>trace_puts</function> when <function>trace_printk</function> has only one argument?
11707   By stringifying the args and checking the size we can tell
11708   whether or not there are args. __stringify((__VA_ARGS__)) will
11709   turn into <quote>()\0</quote> with a size of 3 when there are no args, anything
11710   else will be bigger. All we need to do is define a string to this,
11711   and then take its size and compare to 3. If it's bigger, use
11712   <function>do_trace_printk</function> otherwise, optimize it to <function>trace_puts</function>. Then just
11713   let gcc optimize the rest.
11714</para>
11715</refsect1>
11716</refentry>
11717
11718<refentry id="API-trace-puts">
11719<refentryinfo>
11720 <title>LINUX</title>
11721 <productname>Kernel Hackers Manual</productname>
11722 <date>July 2017</date>
11723</refentryinfo>
11724<refmeta>
11725 <refentrytitle><phrase>trace_puts</phrase></refentrytitle>
11726 <manvolnum>9</manvolnum>
11727 <refmiscinfo class="version">4.1.27</refmiscinfo>
11728</refmeta>
11729<refnamediv>
11730 <refname>trace_puts</refname>
11731 <refpurpose>
11732     write a string into the ftrace buffer
11733 </refpurpose>
11734</refnamediv>
11735<refsynopsisdiv>
11736 <title>Synopsis</title>
11737  <funcsynopsis><funcprototype>
11738   <funcdef> <function>trace_puts </function></funcdef>
11739   <paramdef> <parameter>str</parameter></paramdef>
11740  </funcprototype></funcsynopsis>
11741</refsynopsisdiv>
11742<refsect1>
11743 <title>Arguments</title>
11744 <variablelist>
11745  <varlistentry>
11746   <term><parameter>str</parameter></term>
11747   <listitem>
11748    <para>
11749     the string to record
11750    </para>
11751   </listitem>
11752  </varlistentry>
11753 </variablelist>
11754</refsect1>
11755<refsect1>
11756<title>Note</title>
11757<para>
11758   __trace_bputs is an internal function for trace_puts and
11759   the <parameter>ip</parameter> is passed in via the trace_puts macro.
11760   </para><para>
11761
11762   This is similar to <function>trace_printk</function> but is made for those really fast
11763   paths that a developer wants the least amount of <quote>Heisenbug</quote> affects,
11764   where the processing of the print format is still too much.
11765   </para><para>
11766
11767   This function allows a kernel developer to debug fast path sections
11768   that printk is not appropriate for. By scattering in various
11769   printk like tracing in the code, a developer can quickly see
11770   where problems are occurring.
11771   </para><para>
11772
11773   This is intended as a debugging tool for the developer only.
11774   Please refrain from leaving trace_puts scattered around in
11775   your code. (Extra memory is used for special buffers that are
11776   allocated when <function>trace_puts</function> is used)
11777</para>
11778</refsect1>
11779<refsect1>
11780<title>Returns</title>
11781<para>
11782   0 if nothing was written, positive # if string was.
11783   (1 when __trace_bputs is used, strlen(str) when __trace_puts is used)
11784</para>
11785</refsect1>
11786</refentry>
11787
11788<refentry id="API-min-not-zero">
11789<refentryinfo>
11790 <title>LINUX</title>
11791 <productname>Kernel Hackers Manual</productname>
11792 <date>July 2017</date>
11793</refentryinfo>
11794<refmeta>
11795 <refentrytitle><phrase>min_not_zero</phrase></refentrytitle>
11796 <manvolnum>9</manvolnum>
11797 <refmiscinfo class="version">4.1.27</refmiscinfo>
11798</refmeta>
11799<refnamediv>
11800 <refname>min_not_zero</refname>
11801 <refpurpose>
11802     return the minimum that is _not_ zero, unless both are zero
11803 </refpurpose>
11804</refnamediv>
11805<refsynopsisdiv>
11806 <title>Synopsis</title>
11807  <funcsynopsis><funcprototype>
11808   <funcdef> <function>min_not_zero </function></funcdef>
11809   <paramdef> <parameter>x</parameter></paramdef>
11810   <paramdef> <parameter>y</parameter></paramdef>
11811  </funcprototype></funcsynopsis>
11812</refsynopsisdiv>
11813<refsect1>
11814 <title>Arguments</title>
11815 <variablelist>
11816  <varlistentry>
11817   <term><parameter>x</parameter></term>
11818   <listitem>
11819    <para>
11820     value1
11821    </para>
11822   </listitem>
11823  </varlistentry>
11824  <varlistentry>
11825   <term><parameter>y</parameter></term>
11826   <listitem>
11827    <para>
11828     value2
11829    </para>
11830   </listitem>
11831  </varlistentry>
11832 </variablelist>
11833</refsect1>
11834</refentry>
11835
11836<refentry id="API-clamp">
11837<refentryinfo>
11838 <title>LINUX</title>
11839 <productname>Kernel Hackers Manual</productname>
11840 <date>July 2017</date>
11841</refentryinfo>
11842<refmeta>
11843 <refentrytitle><phrase>clamp</phrase></refentrytitle>
11844 <manvolnum>9</manvolnum>
11845 <refmiscinfo class="version">4.1.27</refmiscinfo>
11846</refmeta>
11847<refnamediv>
11848 <refname>clamp</refname>
11849 <refpurpose>
11850     return a value clamped to a given range with strict typechecking
11851 </refpurpose>
11852</refnamediv>
11853<refsynopsisdiv>
11854 <title>Synopsis</title>
11855  <funcsynopsis><funcprototype>
11856   <funcdef> <function>clamp </function></funcdef>
11857   <paramdef> <parameter>val</parameter></paramdef>
11858   <paramdef> <parameter>lo</parameter></paramdef>
11859   <paramdef> <parameter>hi</parameter></paramdef>
11860  </funcprototype></funcsynopsis>
11861</refsynopsisdiv>
11862<refsect1>
11863 <title>Arguments</title>
11864 <variablelist>
11865  <varlistentry>
11866   <term><parameter>val</parameter></term>
11867   <listitem>
11868    <para>
11869     current value
11870    </para>
11871   </listitem>
11872  </varlistentry>
11873  <varlistentry>
11874   <term><parameter>lo</parameter></term>
11875   <listitem>
11876    <para>
11877     lowest allowable value
11878    </para>
11879   </listitem>
11880  </varlistentry>
11881  <varlistentry>
11882   <term><parameter>hi</parameter></term>
11883   <listitem>
11884    <para>
11885     highest allowable value
11886    </para>
11887   </listitem>
11888  </varlistentry>
11889 </variablelist>
11890</refsect1>
11891<refsect1>
11892<title>Description</title>
11893<para>
11894   This macro does strict typechecking of lo/hi to make sure they are of the
11895   same type as val.  See the unnecessary pointer comparisons.
11896</para>
11897</refsect1>
11898</refentry>
11899
11900<refentry id="API-clamp-t">
11901<refentryinfo>
11902 <title>LINUX</title>
11903 <productname>Kernel Hackers Manual</productname>
11904 <date>July 2017</date>
11905</refentryinfo>
11906<refmeta>
11907 <refentrytitle><phrase>clamp_t</phrase></refentrytitle>
11908 <manvolnum>9</manvolnum>
11909 <refmiscinfo class="version">4.1.27</refmiscinfo>
11910</refmeta>
11911<refnamediv>
11912 <refname>clamp_t</refname>
11913 <refpurpose>
11914     return a value clamped to a given range using a given type
11915 </refpurpose>
11916</refnamediv>
11917<refsynopsisdiv>
11918 <title>Synopsis</title>
11919  <funcsynopsis><funcprototype>
11920   <funcdef> <function>clamp_t </function></funcdef>
11921   <paramdef> <parameter>type</parameter></paramdef>
11922   <paramdef> <parameter>val</parameter></paramdef>
11923   <paramdef> <parameter>lo</parameter></paramdef>
11924   <paramdef> <parameter>hi</parameter></paramdef>
11925  </funcprototype></funcsynopsis>
11926</refsynopsisdiv>
11927<refsect1>
11928 <title>Arguments</title>
11929 <variablelist>
11930  <varlistentry>
11931   <term><parameter>type</parameter></term>
11932   <listitem>
11933    <para>
11934     the type of variable to use
11935    </para>
11936   </listitem>
11937  </varlistentry>
11938  <varlistentry>
11939   <term><parameter>val</parameter></term>
11940   <listitem>
11941    <para>
11942     current value
11943    </para>
11944   </listitem>
11945  </varlistentry>
11946  <varlistentry>
11947   <term><parameter>lo</parameter></term>
11948   <listitem>
11949    <para>
11950     minimum allowable value
11951    </para>
11952   </listitem>
11953  </varlistentry>
11954  <varlistentry>
11955   <term><parameter>hi</parameter></term>
11956   <listitem>
11957    <para>
11958     maximum allowable value
11959    </para>
11960   </listitem>
11961  </varlistentry>
11962 </variablelist>
11963</refsect1>
11964<refsect1>
11965<title>Description</title>
11966<para>
11967   This macro does no typechecking and uses temporary variables of type
11968   'type' to make all the comparisons.
11969</para>
11970</refsect1>
11971</refentry>
11972
11973<refentry id="API-clamp-val">
11974<refentryinfo>
11975 <title>LINUX</title>
11976 <productname>Kernel Hackers Manual</productname>
11977 <date>July 2017</date>
11978</refentryinfo>
11979<refmeta>
11980 <refentrytitle><phrase>clamp_val</phrase></refentrytitle>
11981 <manvolnum>9</manvolnum>
11982 <refmiscinfo class="version">4.1.27</refmiscinfo>
11983</refmeta>
11984<refnamediv>
11985 <refname>clamp_val</refname>
11986 <refpurpose>
11987     return a value clamped to a given range using val's type
11988 </refpurpose>
11989</refnamediv>
11990<refsynopsisdiv>
11991 <title>Synopsis</title>
11992  <funcsynopsis><funcprototype>
11993   <funcdef> <function>clamp_val </function></funcdef>
11994   <paramdef> <parameter>val</parameter></paramdef>
11995   <paramdef> <parameter>lo</parameter></paramdef>
11996   <paramdef> <parameter>hi</parameter></paramdef>
11997  </funcprototype></funcsynopsis>
11998</refsynopsisdiv>
11999<refsect1>
12000 <title>Arguments</title>
12001 <variablelist>
12002  <varlistentry>
12003   <term><parameter>val</parameter></term>
12004   <listitem>
12005    <para>
12006     current value
12007    </para>
12008   </listitem>
12009  </varlistentry>
12010  <varlistentry>
12011   <term><parameter>lo</parameter></term>
12012   <listitem>
12013    <para>
12014     minimum allowable value
12015    </para>
12016   </listitem>
12017  </varlistentry>
12018  <varlistentry>
12019   <term><parameter>hi</parameter></term>
12020   <listitem>
12021    <para>
12022     maximum allowable value
12023    </para>
12024   </listitem>
12025  </varlistentry>
12026 </variablelist>
12027</refsect1>
12028<refsect1>
12029<title>Description</title>
12030<para>
12031   This macro does no typechecking and uses temporary variables of whatever
12032   type the input argument 'val' is.  This is useful when val is an unsigned
12033   type and min and max are literals that will otherwise be assigned a signed
12034   integer type.
12035</para>
12036</refsect1>
12037</refentry>
12038
12039<refentry id="API-container-of">
12040<refentryinfo>
12041 <title>LINUX</title>
12042 <productname>Kernel Hackers Manual</productname>
12043 <date>July 2017</date>
12044</refentryinfo>
12045<refmeta>
12046 <refentrytitle><phrase>container_of</phrase></refentrytitle>
12047 <manvolnum>9</manvolnum>
12048 <refmiscinfo class="version">4.1.27</refmiscinfo>
12049</refmeta>
12050<refnamediv>
12051 <refname>container_of</refname>
12052 <refpurpose>
12053     cast a member of a structure out to the containing structure
12054 </refpurpose>
12055</refnamediv>
12056<refsynopsisdiv>
12057 <title>Synopsis</title>
12058  <funcsynopsis><funcprototype>
12059   <funcdef> <function>container_of </function></funcdef>
12060   <paramdef> <parameter>ptr</parameter></paramdef>
12061   <paramdef> <parameter>type</parameter></paramdef>
12062   <paramdef> <parameter>member</parameter></paramdef>
12063  </funcprototype></funcsynopsis>
12064</refsynopsisdiv>
12065<refsect1>
12066 <title>Arguments</title>
12067 <variablelist>
12068  <varlistentry>
12069   <term><parameter>ptr</parameter></term>
12070   <listitem>
12071    <para>
12072     the pointer to the member.
12073    </para>
12074   </listitem>
12075  </varlistentry>
12076  <varlistentry>
12077   <term><parameter>type</parameter></term>
12078   <listitem>
12079    <para>
12080     the type of the container struct this is embedded in.
12081    </para>
12082   </listitem>
12083  </varlistentry>
12084  <varlistentry>
12085   <term><parameter>member</parameter></term>
12086   <listitem>
12087    <para>
12088     the name of the member within the struct.
12089    </para>
12090   </listitem>
12091  </varlistentry>
12092 </variablelist>
12093</refsect1>
12094</refentry>
12095
12096<!-- kernel/printk/printk.c -->
12097<refentry id="API-printk">
12098<refentryinfo>
12099 <title>LINUX</title>
12100 <productname>Kernel Hackers Manual</productname>
12101 <date>July 2017</date>
12102</refentryinfo>
12103<refmeta>
12104 <refentrytitle><phrase>printk</phrase></refentrytitle>
12105 <manvolnum>9</manvolnum>
12106 <refmiscinfo class="version">4.1.27</refmiscinfo>
12107</refmeta>
12108<refnamediv>
12109 <refname>printk</refname>
12110 <refpurpose>
12111  print a kernel message
12112 </refpurpose>
12113</refnamediv>
12114<refsynopsisdiv>
12115 <title>Synopsis</title>
12116  <funcsynopsis><funcprototype>
12117   <funcdef>__visible int <function>printk </function></funcdef>
12118   <paramdef>const char * <parameter>fmt</parameter></paramdef>
12119   <paramdef> <parameter>...</parameter></paramdef>
12120  </funcprototype></funcsynopsis>
12121</refsynopsisdiv>
12122<refsect1>
12123 <title>Arguments</title>
12124 <variablelist>
12125  <varlistentry>
12126   <term><parameter>fmt</parameter></term>
12127   <listitem>
12128    <para>
12129     format string
12130    </para>
12131   </listitem>
12132  </varlistentry>
12133  <varlistentry>
12134   <term><parameter>...</parameter></term>
12135   <listitem>
12136    <para>
12137     variable arguments
12138    </para>
12139   </listitem>
12140  </varlistentry>
12141 </variablelist>
12142</refsect1>
12143<refsect1>
12144<title>Description</title>
12145<para>
12146   This is <function>printk</function>. It can be called from any context. We want it to work.
12147   </para><para>
12148
12149   We try to grab the console_lock. If we succeed, it's easy - we log the
12150   output and call the console drivers.  If we fail to get the semaphore, we
12151   place the output into the log buffer and return. The current holder of
12152   the console_sem will notice the new output in <function>console_unlock</function>; and will
12153   send it to the consoles before releasing the lock.
12154   </para><para>
12155
12156   One effect of this deferred printing is that code which calls <function>printk</function> and
12157   then changes console_loglevel may break. This is because console_loglevel
12158   is inspected when the actual printing occurs.
12159</para>
12160</refsect1>
12161<refsect1>
12162<title>See also</title>
12163<para>
12164   printf(3)
12165   </para><para>
12166
12167   See the <function>vsnprintf</function> documentation for format string extensions over C99.
12168</para>
12169</refsect1>
12170</refentry>
12171
12172<refentry id="API-console-lock">
12173<refentryinfo>
12174 <title>LINUX</title>
12175 <productname>Kernel Hackers Manual</productname>
12176 <date>July 2017</date>
12177</refentryinfo>
12178<refmeta>
12179 <refentrytitle><phrase>console_lock</phrase></refentrytitle>
12180 <manvolnum>9</manvolnum>
12181 <refmiscinfo class="version">4.1.27</refmiscinfo>
12182</refmeta>
12183<refnamediv>
12184 <refname>console_lock</refname>
12185 <refpurpose>
12186     lock the console system for exclusive use.
12187 </refpurpose>
12188</refnamediv>
12189<refsynopsisdiv>
12190 <title>Synopsis</title>
12191  <funcsynopsis><funcprototype>
12192   <funcdef>void <function>console_lock </function></funcdef>
12193   <paramdef> <parameter>void</parameter></paramdef>
12194  </funcprototype></funcsynopsis>
12195</refsynopsisdiv>
12196<refsect1>
12197 <title>Arguments</title>
12198 <variablelist>
12199  <varlistentry>
12200   <term><parameter>void</parameter></term>
12201   <listitem>
12202    <para>
12203     no arguments
12204    </para>
12205   </listitem>
12206  </varlistentry>
12207 </variablelist>
12208</refsect1>
12209<refsect1>
12210<title>Description</title>
12211<para>
12212   </para><para>
12213
12214   Acquires a lock which guarantees that the caller has
12215   exclusive access to the console system and the console_drivers list.
12216   </para><para>
12217
12218   Can sleep, returns nothing.
12219</para>
12220</refsect1>
12221</refentry>
12222
12223<refentry id="API-console-trylock">
12224<refentryinfo>
12225 <title>LINUX</title>
12226 <productname>Kernel Hackers Manual</productname>
12227 <date>July 2017</date>
12228</refentryinfo>
12229<refmeta>
12230 <refentrytitle><phrase>console_trylock</phrase></refentrytitle>
12231 <manvolnum>9</manvolnum>
12232 <refmiscinfo class="version">4.1.27</refmiscinfo>
12233</refmeta>
12234<refnamediv>
12235 <refname>console_trylock</refname>
12236 <refpurpose>
12237     try to lock the console system for exclusive use.
12238 </refpurpose>
12239</refnamediv>
12240<refsynopsisdiv>
12241 <title>Synopsis</title>
12242  <funcsynopsis><funcprototype>
12243   <funcdef>int <function>console_trylock </function></funcdef>
12244   <paramdef> <parameter>void</parameter></paramdef>
12245  </funcprototype></funcsynopsis>
12246</refsynopsisdiv>
12247<refsect1>
12248 <title>Arguments</title>
12249 <variablelist>
12250  <varlistentry>
12251   <term><parameter>void</parameter></term>
12252   <listitem>
12253    <para>
12254     no arguments
12255    </para>
12256   </listitem>
12257  </varlistentry>
12258 </variablelist>
12259</refsect1>
12260<refsect1>
12261<title>Description</title>
12262<para>
12263   </para><para>
12264
12265   Try to acquire a lock which guarantees that the caller has exclusive
12266   access to the console system and the console_drivers list.
12267   </para><para>
12268
12269   returns 1 on success, and 0 on failure to acquire the lock.
12270</para>
12271</refsect1>
12272</refentry>
12273
12274<refentry id="API-console-unlock">
12275<refentryinfo>
12276 <title>LINUX</title>
12277 <productname>Kernel Hackers Manual</productname>
12278 <date>July 2017</date>
12279</refentryinfo>
12280<refmeta>
12281 <refentrytitle><phrase>console_unlock</phrase></refentrytitle>
12282 <manvolnum>9</manvolnum>
12283 <refmiscinfo class="version">4.1.27</refmiscinfo>
12284</refmeta>
12285<refnamediv>
12286 <refname>console_unlock</refname>
12287 <refpurpose>
12288     unlock the console system
12289 </refpurpose>
12290</refnamediv>
12291<refsynopsisdiv>
12292 <title>Synopsis</title>
12293  <funcsynopsis><funcprototype>
12294   <funcdef>void <function>console_unlock </function></funcdef>
12295   <paramdef> <parameter>void</parameter></paramdef>
12296  </funcprototype></funcsynopsis>
12297</refsynopsisdiv>
12298<refsect1>
12299 <title>Arguments</title>
12300 <variablelist>
12301  <varlistentry>
12302   <term><parameter>void</parameter></term>
12303   <listitem>
12304    <para>
12305     no arguments
12306    </para>
12307   </listitem>
12308  </varlistentry>
12309 </variablelist>
12310</refsect1>
12311<refsect1>
12312<title>Description</title>
12313<para>
12314   </para><para>
12315
12316   Releases the console_lock which the caller holds on the console system
12317   and the console driver list.
12318   </para><para>
12319
12320   While the console_lock was held, console output may have been buffered
12321   by <function>printk</function>.  If this is the case, <function>console_unlock</function>; emits
12322   the output prior to releasing the lock.
12323   </para><para>
12324
12325   If there is output waiting, we wake /dev/kmsg and <function>syslog</function> users.
12326   </para><para>
12327
12328   <function>console_unlock</function>; may be called from any context.
12329</para>
12330</refsect1>
12331</refentry>
12332
12333<refentry id="API-console-conditional-schedule">
12334<refentryinfo>
12335 <title>LINUX</title>
12336 <productname>Kernel Hackers Manual</productname>
12337 <date>July 2017</date>
12338</refentryinfo>
12339<refmeta>
12340 <refentrytitle><phrase>console_conditional_schedule</phrase></refentrytitle>
12341 <manvolnum>9</manvolnum>
12342 <refmiscinfo class="version">4.1.27</refmiscinfo>
12343</refmeta>
12344<refnamediv>
12345 <refname>console_conditional_schedule</refname>
12346 <refpurpose>
12347     yield the CPU if required
12348 </refpurpose>
12349</refnamediv>
12350<refsynopsisdiv>
12351 <title>Synopsis</title>
12352  <funcsynopsis><funcprototype>
12353   <funcdef>void __sched <function>console_conditional_schedule </function></funcdef>
12354   <paramdef> <parameter>void</parameter></paramdef>
12355  </funcprototype></funcsynopsis>
12356</refsynopsisdiv>
12357<refsect1>
12358 <title>Arguments</title>
12359 <variablelist>
12360  <varlistentry>
12361   <term><parameter>void</parameter></term>
12362   <listitem>
12363    <para>
12364     no arguments
12365    </para>
12366   </listitem>
12367  </varlistentry>
12368 </variablelist>
12369</refsect1>
12370<refsect1>
12371<title>Description</title>
12372<para>
12373   </para><para>
12374
12375   If the console code is currently allowed to sleep, and
12376   if this CPU should yield the CPU to another task, do
12377   so here.
12378   </para><para>
12379
12380   Must be called within <function>console_lock</function>;.
12381</para>
12382</refsect1>
12383</refentry>
12384
12385<refentry id="API-printk-timed-ratelimit">
12386<refentryinfo>
12387 <title>LINUX</title>
12388 <productname>Kernel Hackers Manual</productname>
12389 <date>July 2017</date>
12390</refentryinfo>
12391<refmeta>
12392 <refentrytitle><phrase>printk_timed_ratelimit</phrase></refentrytitle>
12393 <manvolnum>9</manvolnum>
12394 <refmiscinfo class="version">4.1.27</refmiscinfo>
12395</refmeta>
12396<refnamediv>
12397 <refname>printk_timed_ratelimit</refname>
12398 <refpurpose>
12399     caller-controlled printk ratelimiting
12400 </refpurpose>
12401</refnamediv>
12402<refsynopsisdiv>
12403 <title>Synopsis</title>
12404  <funcsynopsis><funcprototype>
12405   <funcdef>bool <function>printk_timed_ratelimit </function></funcdef>
12406   <paramdef>unsigned long * <parameter>caller_jiffies</parameter></paramdef>
12407   <paramdef>unsigned int <parameter>interval_msecs</parameter></paramdef>
12408  </funcprototype></funcsynopsis>
12409</refsynopsisdiv>
12410<refsect1>
12411 <title>Arguments</title>
12412 <variablelist>
12413  <varlistentry>
12414   <term><parameter>caller_jiffies</parameter></term>
12415   <listitem>
12416    <para>
12417     pointer to caller's state
12418    </para>
12419   </listitem>
12420  </varlistentry>
12421  <varlistentry>
12422   <term><parameter>interval_msecs</parameter></term>
12423   <listitem>
12424    <para>
12425     minimum interval between prints
12426    </para>
12427   </listitem>
12428  </varlistentry>
12429 </variablelist>
12430</refsect1>
12431<refsect1>
12432<title>Description</title>
12433<para>
12434   <function>printk_timed_ratelimit</function> returns true if more than <parameter>interval_msecs</parameter>
12435   milliseconds have elapsed since the last time <function>printk_timed_ratelimit</function>
12436   returned true.
12437</para>
12438</refsect1>
12439</refentry>
12440
12441<refentry id="API-kmsg-dump-register">
12442<refentryinfo>
12443 <title>LINUX</title>
12444 <productname>Kernel Hackers Manual</productname>
12445 <date>July 2017</date>
12446</refentryinfo>
12447<refmeta>
12448 <refentrytitle><phrase>kmsg_dump_register</phrase></refentrytitle>
12449 <manvolnum>9</manvolnum>
12450 <refmiscinfo class="version">4.1.27</refmiscinfo>
12451</refmeta>
12452<refnamediv>
12453 <refname>kmsg_dump_register</refname>
12454 <refpurpose>
12455     register a kernel log dumper.
12456 </refpurpose>
12457</refnamediv>
12458<refsynopsisdiv>
12459 <title>Synopsis</title>
12460  <funcsynopsis><funcprototype>
12461   <funcdef>int <function>kmsg_dump_register </function></funcdef>
12462   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
12463  </funcprototype></funcsynopsis>
12464</refsynopsisdiv>
12465<refsect1>
12466 <title>Arguments</title>
12467 <variablelist>
12468  <varlistentry>
12469   <term><parameter>dumper</parameter></term>
12470   <listitem>
12471    <para>
12472     pointer to the kmsg_dumper structure
12473    </para>
12474   </listitem>
12475  </varlistentry>
12476 </variablelist>
12477</refsect1>
12478<refsect1>
12479<title>Description</title>
12480<para>
12481   Adds a kernel log dumper to the system. The dump callback in the
12482   structure will be called when the kernel oopses or panics and must be
12483   set. Returns zero on success and <constant>-EINVAL</constant> or <constant>-EBUSY</constant> otherwise.
12484</para>
12485</refsect1>
12486</refentry>
12487
12488<refentry id="API-kmsg-dump-unregister">
12489<refentryinfo>
12490 <title>LINUX</title>
12491 <productname>Kernel Hackers Manual</productname>
12492 <date>July 2017</date>
12493</refentryinfo>
12494<refmeta>
12495 <refentrytitle><phrase>kmsg_dump_unregister</phrase></refentrytitle>
12496 <manvolnum>9</manvolnum>
12497 <refmiscinfo class="version">4.1.27</refmiscinfo>
12498</refmeta>
12499<refnamediv>
12500 <refname>kmsg_dump_unregister</refname>
12501 <refpurpose>
12502     unregister a kmsg dumper.
12503 </refpurpose>
12504</refnamediv>
12505<refsynopsisdiv>
12506 <title>Synopsis</title>
12507  <funcsynopsis><funcprototype>
12508   <funcdef>int <function>kmsg_dump_unregister </function></funcdef>
12509   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
12510  </funcprototype></funcsynopsis>
12511</refsynopsisdiv>
12512<refsect1>
12513 <title>Arguments</title>
12514 <variablelist>
12515  <varlistentry>
12516   <term><parameter>dumper</parameter></term>
12517   <listitem>
12518    <para>
12519     pointer to the kmsg_dumper structure
12520    </para>
12521   </listitem>
12522  </varlistentry>
12523 </variablelist>
12524</refsect1>
12525<refsect1>
12526<title>Description</title>
12527<para>
12528   Removes a dump device from the system. Returns zero on success and
12529   <constant>-EINVAL</constant> otherwise.
12530</para>
12531</refsect1>
12532</refentry>
12533
12534<refentry id="API-kmsg-dump-get-line">
12535<refentryinfo>
12536 <title>LINUX</title>
12537 <productname>Kernel Hackers Manual</productname>
12538 <date>July 2017</date>
12539</refentryinfo>
12540<refmeta>
12541 <refentrytitle><phrase>kmsg_dump_get_line</phrase></refentrytitle>
12542 <manvolnum>9</manvolnum>
12543 <refmiscinfo class="version">4.1.27</refmiscinfo>
12544</refmeta>
12545<refnamediv>
12546 <refname>kmsg_dump_get_line</refname>
12547 <refpurpose>
12548     retrieve one kmsg log line
12549 </refpurpose>
12550</refnamediv>
12551<refsynopsisdiv>
12552 <title>Synopsis</title>
12553  <funcsynopsis><funcprototype>
12554   <funcdef>bool <function>kmsg_dump_get_line </function></funcdef>
12555   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
12556   <paramdef>bool <parameter>syslog</parameter></paramdef>
12557   <paramdef>char * <parameter>line</parameter></paramdef>
12558   <paramdef>size_t <parameter>size</parameter></paramdef>
12559   <paramdef>size_t * <parameter>len</parameter></paramdef>
12560  </funcprototype></funcsynopsis>
12561</refsynopsisdiv>
12562<refsect1>
12563 <title>Arguments</title>
12564 <variablelist>
12565  <varlistentry>
12566   <term><parameter>dumper</parameter></term>
12567   <listitem>
12568    <para>
12569     registered kmsg dumper
12570    </para>
12571   </listitem>
12572  </varlistentry>
12573  <varlistentry>
12574   <term><parameter>syslog</parameter></term>
12575   <listitem>
12576    <para>
12577     include the <quote>&lt;4&gt;</quote> prefixes
12578    </para>
12579   </listitem>
12580  </varlistentry>
12581  <varlistentry>
12582   <term><parameter>line</parameter></term>
12583   <listitem>
12584    <para>
12585     buffer to copy the line to
12586    </para>
12587   </listitem>
12588  </varlistentry>
12589  <varlistentry>
12590   <term><parameter>size</parameter></term>
12591   <listitem>
12592    <para>
12593     maximum size of the buffer
12594    </para>
12595   </listitem>
12596  </varlistentry>
12597  <varlistentry>
12598   <term><parameter>len</parameter></term>
12599   <listitem>
12600    <para>
12601     length of line placed into buffer
12602    </para>
12603   </listitem>
12604  </varlistentry>
12605 </variablelist>
12606</refsect1>
12607<refsect1>
12608<title>Description</title>
12609<para>
12610   Start at the beginning of the kmsg buffer, with the oldest kmsg
12611   record, and copy one record into the provided buffer.
12612   </para><para>
12613
12614   Consecutive calls will return the next available record moving
12615   towards the end of the buffer with the youngest messages.
12616   </para><para>
12617
12618   A return value of FALSE indicates that there are no more records to
12619   read.
12620</para>
12621</refsect1>
12622</refentry>
12623
12624<refentry id="API-kmsg-dump-get-buffer">
12625<refentryinfo>
12626 <title>LINUX</title>
12627 <productname>Kernel Hackers Manual</productname>
12628 <date>July 2017</date>
12629</refentryinfo>
12630<refmeta>
12631 <refentrytitle><phrase>kmsg_dump_get_buffer</phrase></refentrytitle>
12632 <manvolnum>9</manvolnum>
12633 <refmiscinfo class="version">4.1.27</refmiscinfo>
12634</refmeta>
12635<refnamediv>
12636 <refname>kmsg_dump_get_buffer</refname>
12637 <refpurpose>
12638     copy kmsg log lines
12639 </refpurpose>
12640</refnamediv>
12641<refsynopsisdiv>
12642 <title>Synopsis</title>
12643  <funcsynopsis><funcprototype>
12644   <funcdef>bool <function>kmsg_dump_get_buffer </function></funcdef>
12645   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
12646   <paramdef>bool <parameter>syslog</parameter></paramdef>
12647   <paramdef>char * <parameter>buf</parameter></paramdef>
12648   <paramdef>size_t <parameter>size</parameter></paramdef>
12649   <paramdef>size_t * <parameter>len</parameter></paramdef>
12650  </funcprototype></funcsynopsis>
12651</refsynopsisdiv>
12652<refsect1>
12653 <title>Arguments</title>
12654 <variablelist>
12655  <varlistentry>
12656   <term><parameter>dumper</parameter></term>
12657   <listitem>
12658    <para>
12659     registered kmsg dumper
12660    </para>
12661   </listitem>
12662  </varlistentry>
12663  <varlistentry>
12664   <term><parameter>syslog</parameter></term>
12665   <listitem>
12666    <para>
12667     include the <quote>&lt;4&gt;</quote> prefixes
12668    </para>
12669   </listitem>
12670  </varlistentry>
12671  <varlistentry>
12672   <term><parameter>buf</parameter></term>
12673   <listitem>
12674    <para>
12675     buffer to copy the line to
12676    </para>
12677   </listitem>
12678  </varlistentry>
12679  <varlistentry>
12680   <term><parameter>size</parameter></term>
12681   <listitem>
12682    <para>
12683     maximum size of the buffer
12684    </para>
12685   </listitem>
12686  </varlistentry>
12687  <varlistentry>
12688   <term><parameter>len</parameter></term>
12689   <listitem>
12690    <para>
12691     length of line placed into buffer
12692    </para>
12693   </listitem>
12694  </varlistentry>
12695 </variablelist>
12696</refsect1>
12697<refsect1>
12698<title>Description</title>
12699<para>
12700   Start at the end of the kmsg buffer and fill the provided buffer
12701   with as many of the the *youngest* kmsg records that fit into it.
12702   If the buffer is large enough, all available kmsg records will be
12703   copied with a single call.
12704   </para><para>
12705
12706   Consecutive calls will fill the buffer with the next block of
12707   available older records, not including the earlier retrieved ones.
12708   </para><para>
12709
12710   A return value of FALSE indicates that there are no more records to
12711   read.
12712</para>
12713</refsect1>
12714</refentry>
12715
12716<refentry id="API-kmsg-dump-rewind">
12717<refentryinfo>
12718 <title>LINUX</title>
12719 <productname>Kernel Hackers Manual</productname>
12720 <date>July 2017</date>
12721</refentryinfo>
12722<refmeta>
12723 <refentrytitle><phrase>kmsg_dump_rewind</phrase></refentrytitle>
12724 <manvolnum>9</manvolnum>
12725 <refmiscinfo class="version">4.1.27</refmiscinfo>
12726</refmeta>
12727<refnamediv>
12728 <refname>kmsg_dump_rewind</refname>
12729 <refpurpose>
12730     reset the interator
12731 </refpurpose>
12732</refnamediv>
12733<refsynopsisdiv>
12734 <title>Synopsis</title>
12735  <funcsynopsis><funcprototype>
12736   <funcdef>void <function>kmsg_dump_rewind </function></funcdef>
12737   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
12738  </funcprototype></funcsynopsis>
12739</refsynopsisdiv>
12740<refsect1>
12741 <title>Arguments</title>
12742 <variablelist>
12743  <varlistentry>
12744   <term><parameter>dumper</parameter></term>
12745   <listitem>
12746    <para>
12747     registered kmsg dumper
12748    </para>
12749   </listitem>
12750  </varlistentry>
12751 </variablelist>
12752</refsect1>
12753<refsect1>
12754<title>Description</title>
12755<para>
12756   Reset the dumper's iterator so that <function>kmsg_dump_get_line</function> and
12757   <function>kmsg_dump_get_buffer</function> can be called again and used multiple
12758   times within the same dumper.<function>dump</function> callback.
12759</para>
12760</refsect1>
12761</refentry>
12762
12763<!-- kernel/panic.c -->
12764<refentry id="API-panic">
12765<refentryinfo>
12766 <title>LINUX</title>
12767 <productname>Kernel Hackers Manual</productname>
12768 <date>July 2017</date>
12769</refentryinfo>
12770<refmeta>
12771 <refentrytitle><phrase>panic</phrase></refentrytitle>
12772 <manvolnum>9</manvolnum>
12773 <refmiscinfo class="version">4.1.27</refmiscinfo>
12774</refmeta>
12775<refnamediv>
12776 <refname>panic</refname>
12777 <refpurpose>
12778  halt the system
12779 </refpurpose>
12780</refnamediv>
12781<refsynopsisdiv>
12782 <title>Synopsis</title>
12783  <funcsynopsis><funcprototype>
12784   <funcdef>void <function>panic </function></funcdef>
12785   <paramdef>const char * <parameter>fmt</parameter></paramdef>
12786   <paramdef> <parameter>...</parameter></paramdef>
12787  </funcprototype></funcsynopsis>
12788</refsynopsisdiv>
12789<refsect1>
12790 <title>Arguments</title>
12791 <variablelist>
12792  <varlistentry>
12793   <term><parameter>fmt</parameter></term>
12794   <listitem>
12795    <para>
12796     The text string to print
12797    </para>
12798   </listitem>
12799  </varlistentry>
12800  <varlistentry>
12801   <term><parameter>...</parameter></term>
12802   <listitem>
12803    <para>
12804     variable arguments
12805    </para>
12806   </listitem>
12807  </varlistentry>
12808 </variablelist>
12809</refsect1>
12810<refsect1>
12811<title>Description</title>
12812<para>
12813   Display a message, then perform cleanups.
12814   </para><para>
12815
12816   This function never returns.
12817</para>
12818</refsect1>
12819</refentry>
12820
12821<refentry id="API-add-taint">
12822<refentryinfo>
12823 <title>LINUX</title>
12824 <productname>Kernel Hackers Manual</productname>
12825 <date>July 2017</date>
12826</refentryinfo>
12827<refmeta>
12828 <refentrytitle><phrase>add_taint</phrase></refentrytitle>
12829 <manvolnum>9</manvolnum>
12830 <refmiscinfo class="version">4.1.27</refmiscinfo>
12831</refmeta>
12832<refnamediv>
12833 <refname>add_taint</refname>
12834 <refpurpose>
12835   </refpurpose>
12836</refnamediv>
12837<refsynopsisdiv>
12838 <title>Synopsis</title>
12839  <funcsynopsis><funcprototype>
12840   <funcdef>void <function>add_taint </function></funcdef>
12841   <paramdef>unsigned <parameter>flag</parameter></paramdef>
12842   <paramdef>enum lockdep_ok <parameter>lockdep_ok</parameter></paramdef>
12843  </funcprototype></funcsynopsis>
12844</refsynopsisdiv>
12845<refsect1>
12846 <title>Arguments</title>
12847 <variablelist>
12848  <varlistentry>
12849   <term><parameter>flag</parameter></term>
12850   <listitem>
12851    <para>
12852     one of the TAINT_* constants.
12853    </para>
12854   </listitem>
12855  </varlistentry>
12856  <varlistentry>
12857   <term><parameter>lockdep_ok</parameter></term>
12858   <listitem>
12859    <para>
12860     whether lock debugging is still OK.
12861    </para>
12862   </listitem>
12863  </varlistentry>
12864 </variablelist>
12865</refsect1>
12866<refsect1>
12867<title>Description</title>
12868<para>
12869   If something bad has gone wrong, you'll want <parameter>lockdebug_ok</parameter> = false, but for
12870   some notewortht-but-not-corrupting cases, it can be set to true.
12871</para>
12872</refsect1>
12873</refentry>
12874
12875<!-- kernel/sys.c -->
12876<refentry>
12877 <refnamediv>
12878  <refname>
12879   .//kernel/sys.c
12880  </refname>
12881  <refpurpose>
12882   Document generation inconsistency
12883  </refpurpose>
12884 </refnamediv>
12885 <refsect1>
12886  <title>
12887   Oops
12888  </title>
12889  <warning>
12890   <para>
12891    The template for this document tried to insert
12892    the structured comment from the file
12893    <filename>.//kernel/sys.c</filename> at this point,
12894    but none was found.
12895    This dummy section is inserted to allow
12896    generation to continue.
12897   </para>
12898  </warning>
12899 </refsect1>
12900</refentry>
12901<!-- kernel/rcu/srcu.c -->
12902<refentry id="API-init-srcu-struct">
12903<refentryinfo>
12904 <title>LINUX</title>
12905 <productname>Kernel Hackers Manual</productname>
12906 <date>July 2017</date>
12907</refentryinfo>
12908<refmeta>
12909 <refentrytitle><phrase>init_srcu_struct</phrase></refentrytitle>
12910 <manvolnum>9</manvolnum>
12911 <refmiscinfo class="version">4.1.27</refmiscinfo>
12912</refmeta>
12913<refnamediv>
12914 <refname>init_srcu_struct</refname>
12915 <refpurpose>
12916  initialize a sleep-RCU structure
12917 </refpurpose>
12918</refnamediv>
12919<refsynopsisdiv>
12920 <title>Synopsis</title>
12921  <funcsynopsis><funcprototype>
12922   <funcdef>int <function>init_srcu_struct </function></funcdef>
12923   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
12924  </funcprototype></funcsynopsis>
12925</refsynopsisdiv>
12926<refsect1>
12927 <title>Arguments</title>
12928 <variablelist>
12929  <varlistentry>
12930   <term><parameter>sp</parameter></term>
12931   <listitem>
12932    <para>
12933     structure to initialize.
12934    </para>
12935   </listitem>
12936  </varlistentry>
12937 </variablelist>
12938</refsect1>
12939<refsect1>
12940<title>Description</title>
12941<para>
12942   Must invoke this on a given srcu_struct before passing that srcu_struct
12943   to any other function.  Each srcu_struct represents a separate domain
12944   of SRCU protection.
12945</para>
12946</refsect1>
12947</refentry>
12948
12949<refentry id="API-cleanup-srcu-struct">
12950<refentryinfo>
12951 <title>LINUX</title>
12952 <productname>Kernel Hackers Manual</productname>
12953 <date>July 2017</date>
12954</refentryinfo>
12955<refmeta>
12956 <refentrytitle><phrase>cleanup_srcu_struct</phrase></refentrytitle>
12957 <manvolnum>9</manvolnum>
12958 <refmiscinfo class="version">4.1.27</refmiscinfo>
12959</refmeta>
12960<refnamediv>
12961 <refname>cleanup_srcu_struct</refname>
12962 <refpurpose>
12963     deconstruct a sleep-RCU structure
12964 </refpurpose>
12965</refnamediv>
12966<refsynopsisdiv>
12967 <title>Synopsis</title>
12968  <funcsynopsis><funcprototype>
12969   <funcdef>void <function>cleanup_srcu_struct </function></funcdef>
12970   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
12971  </funcprototype></funcsynopsis>
12972</refsynopsisdiv>
12973<refsect1>
12974 <title>Arguments</title>
12975 <variablelist>
12976  <varlistentry>
12977   <term><parameter>sp</parameter></term>
12978   <listitem>
12979    <para>
12980     structure to clean up.
12981    </para>
12982   </listitem>
12983  </varlistentry>
12984 </variablelist>
12985</refsect1>
12986<refsect1>
12987<title>Description</title>
12988<para>
12989   Must invoke this after you are finished using a given srcu_struct that
12990   was initialized via <function>init_srcu_struct</function>, else you leak memory.
12991</para>
12992</refsect1>
12993</refentry>
12994
12995<refentry id="API-synchronize-srcu">
12996<refentryinfo>
12997 <title>LINUX</title>
12998 <productname>Kernel Hackers Manual</productname>
12999 <date>July 2017</date>
13000</refentryinfo>
13001<refmeta>
13002 <refentrytitle><phrase>synchronize_srcu</phrase></refentrytitle>
13003 <manvolnum>9</manvolnum>
13004 <refmiscinfo class="version">4.1.27</refmiscinfo>
13005</refmeta>
13006<refnamediv>
13007 <refname>synchronize_srcu</refname>
13008 <refpurpose>
13009     wait for prior SRCU read-side critical-section completion
13010 </refpurpose>
13011</refnamediv>
13012<refsynopsisdiv>
13013 <title>Synopsis</title>
13014  <funcsynopsis><funcprototype>
13015   <funcdef>void <function>synchronize_srcu </function></funcdef>
13016   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
13017  </funcprototype></funcsynopsis>
13018</refsynopsisdiv>
13019<refsect1>
13020 <title>Arguments</title>
13021 <variablelist>
13022  <varlistentry>
13023   <term><parameter>sp</parameter></term>
13024   <listitem>
13025    <para>
13026     srcu_struct with which to synchronize.
13027    </para>
13028   </listitem>
13029  </varlistentry>
13030 </variablelist>
13031</refsect1>
13032<refsect1>
13033<title>Description</title>
13034<para>
13035   Wait for the count to drain to zero of both indexes. To avoid the
13036   possible starvation of <function>synchronize_srcu</function>, it waits for the count of
13037   the index=((-&gt;completed &amp; 1) ^ 1) to drain to zero at first,
13038   and then flip the completed and wait for the count of the other index.
13039   </para><para>
13040
13041   Can block; must be called from process context.
13042   </para><para>
13043
13044   Note that it is illegal to call <function>synchronize_srcu</function> from the corresponding
13045   SRCU read-side critical section; doing so will result in deadlock.
13046   However, it is perfectly legal to call <function>synchronize_srcu</function> on one
13047   srcu_struct from some other srcu_struct's read-side critical section,
13048   as long as the resulting graph of srcu_structs is acyclic.
13049   </para><para>
13050
13051   There are memory-ordering constraints implied by <function>synchronize_srcu</function>.
13052   On systems with more than one CPU, when <function>synchronize_srcu</function> returns,
13053   each CPU is guaranteed to have executed a full memory barrier since
13054   the end of its last corresponding SRCU-sched read-side critical section
13055   whose beginning preceded the call to <function>synchronize_srcu</function>.  In addition,
13056   each CPU having an SRCU read-side critical section that extends beyond
13057   the return from <function>synchronize_srcu</function> is guaranteed to have executed a
13058   full memory barrier after the beginning of <function>synchronize_srcu</function> and before
13059   the beginning of that SRCU read-side critical section.  Note that these
13060   guarantees include CPUs that are offline, idle, or executing in user mode,
13061   as well as CPUs that are executing in the kernel.
13062   </para><para>
13063
13064   Furthermore, if CPU A invoked <function>synchronize_srcu</function>, which returned
13065   to its caller on CPU B, then both CPU A and CPU B are guaranteed
13066   to have executed a full memory barrier during the execution of
13067   <function>synchronize_srcu</function>.  This guarantee applies even if CPU A and CPU B
13068   are the same CPU, but again only if the system has more than one CPU.
13069   </para><para>
13070
13071   Of course, these memory-ordering guarantees apply only when
13072   <function>synchronize_srcu</function>, <function>srcu_read_lock</function>, and <function>srcu_read_unlock</function> are
13073   passed the same srcu_struct structure.
13074</para>
13075</refsect1>
13076</refentry>
13077
13078<refentry id="API-synchronize-srcu-expedited">
13079<refentryinfo>
13080 <title>LINUX</title>
13081 <productname>Kernel Hackers Manual</productname>
13082 <date>July 2017</date>
13083</refentryinfo>
13084<refmeta>
13085 <refentrytitle><phrase>synchronize_srcu_expedited</phrase></refentrytitle>
13086 <manvolnum>9</manvolnum>
13087 <refmiscinfo class="version">4.1.27</refmiscinfo>
13088</refmeta>
13089<refnamediv>
13090 <refname>synchronize_srcu_expedited</refname>
13091 <refpurpose>
13092     Brute-force SRCU grace period
13093 </refpurpose>
13094</refnamediv>
13095<refsynopsisdiv>
13096 <title>Synopsis</title>
13097  <funcsynopsis><funcprototype>
13098   <funcdef>void <function>synchronize_srcu_expedited </function></funcdef>
13099   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
13100  </funcprototype></funcsynopsis>
13101</refsynopsisdiv>
13102<refsect1>
13103 <title>Arguments</title>
13104 <variablelist>
13105  <varlistentry>
13106   <term><parameter>sp</parameter></term>
13107   <listitem>
13108    <para>
13109     srcu_struct with which to synchronize.
13110    </para>
13111   </listitem>
13112  </varlistentry>
13113 </variablelist>
13114</refsect1>
13115<refsect1>
13116<title>Description</title>
13117<para>
13118   Wait for an SRCU grace period to elapse, but be more aggressive about
13119   spinning rather than blocking when waiting.
13120   </para><para>
13121
13122   Note that <function>synchronize_srcu_expedited</function> has the same deadlock and
13123   memory-ordering properties as does <function>synchronize_srcu</function>.
13124</para>
13125</refsect1>
13126</refentry>
13127
13128<refentry id="API-srcu-barrier">
13129<refentryinfo>
13130 <title>LINUX</title>
13131 <productname>Kernel Hackers Manual</productname>
13132 <date>July 2017</date>
13133</refentryinfo>
13134<refmeta>
13135 <refentrytitle><phrase>srcu_barrier</phrase></refentrytitle>
13136 <manvolnum>9</manvolnum>
13137 <refmiscinfo class="version">4.1.27</refmiscinfo>
13138</refmeta>
13139<refnamediv>
13140 <refname>srcu_barrier</refname>
13141 <refpurpose>
13142     Wait until all in-flight <function>call_srcu</function> callbacks complete.
13143 </refpurpose>
13144</refnamediv>
13145<refsynopsisdiv>
13146 <title>Synopsis</title>
13147  <funcsynopsis><funcprototype>
13148   <funcdef>void <function>srcu_barrier </function></funcdef>
13149   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
13150  </funcprototype></funcsynopsis>
13151</refsynopsisdiv>
13152<refsect1>
13153 <title>Arguments</title>
13154 <variablelist>
13155  <varlistentry>
13156   <term><parameter>sp</parameter></term>
13157   <listitem>
13158    <para>
13159     srcu_struct on which to wait for in-flight callbacks.
13160    </para>
13161   </listitem>
13162  </varlistentry>
13163 </variablelist>
13164</refsect1>
13165</refentry>
13166
13167<refentry id="API-srcu-batches-completed">
13168<refentryinfo>
13169 <title>LINUX</title>
13170 <productname>Kernel Hackers Manual</productname>
13171 <date>July 2017</date>
13172</refentryinfo>
13173<refmeta>
13174 <refentrytitle><phrase>srcu_batches_completed</phrase></refentrytitle>
13175 <manvolnum>9</manvolnum>
13176 <refmiscinfo class="version">4.1.27</refmiscinfo>
13177</refmeta>
13178<refnamediv>
13179 <refname>srcu_batches_completed</refname>
13180 <refpurpose>
13181     return batches completed.
13182 </refpurpose>
13183</refnamediv>
13184<refsynopsisdiv>
13185 <title>Synopsis</title>
13186  <funcsynopsis><funcprototype>
13187   <funcdef>unsigned long <function>srcu_batches_completed </function></funcdef>
13188   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
13189  </funcprototype></funcsynopsis>
13190</refsynopsisdiv>
13191<refsect1>
13192 <title>Arguments</title>
13193 <variablelist>
13194  <varlistentry>
13195   <term><parameter>sp</parameter></term>
13196   <listitem>
13197    <para>
13198     srcu_struct on which to report batch completion.
13199    </para>
13200   </listitem>
13201  </varlistentry>
13202 </variablelist>
13203</refsect1>
13204<refsect1>
13205<title>Description</title>
13206<para>
13207   Report the number of batches, correlated with, but not necessarily
13208   precisely the same as, the number of grace periods that have elapsed.
13209</para>
13210</refsect1>
13211</refentry>
13212
13213<!-- kernel/rcu/tree.c -->
13214<refentry id="API-rcu-idle-enter">
13215<refentryinfo>
13216 <title>LINUX</title>
13217 <productname>Kernel Hackers Manual</productname>
13218 <date>July 2017</date>
13219</refentryinfo>
13220<refmeta>
13221 <refentrytitle><phrase>rcu_idle_enter</phrase></refentrytitle>
13222 <manvolnum>9</manvolnum>
13223 <refmiscinfo class="version">4.1.27</refmiscinfo>
13224</refmeta>
13225<refnamediv>
13226 <refname>rcu_idle_enter</refname>
13227 <refpurpose>
13228  inform RCU that current CPU is entering idle
13229 </refpurpose>
13230</refnamediv>
13231<refsynopsisdiv>
13232 <title>Synopsis</title>
13233  <funcsynopsis><funcprototype>
13234   <funcdef>void <function>rcu_idle_enter </function></funcdef>
13235   <paramdef> <parameter>void</parameter></paramdef>
13236  </funcprototype></funcsynopsis>
13237</refsynopsisdiv>
13238<refsect1>
13239 <title>Arguments</title>
13240 <variablelist>
13241  <varlistentry>
13242   <term><parameter>void</parameter></term>
13243   <listitem>
13244    <para>
13245     no arguments
13246    </para>
13247   </listitem>
13248  </varlistentry>
13249 </variablelist>
13250</refsect1>
13251<refsect1>
13252<title>Description</title>
13253<para>
13254   </para><para>
13255
13256   Enter idle mode, in other words, -leave- the mode in which RCU
13257   read-side critical sections can occur.  (Though RCU read-side
13258   critical sections can occur in irq handlers in idle, a possibility
13259   handled by <function>irq_enter</function> and <function>irq_exit</function>.)
13260   </para><para>
13261
13262   We crowbar the -&gt;dynticks_nesting field to zero to allow for
13263   the possibility of usermode upcalls having messed up our count
13264   of interrupt nesting level during the prior busy period.
13265</para>
13266</refsect1>
13267</refentry>
13268
13269<refentry id="API-rcu-idle-exit">
13270<refentryinfo>
13271 <title>LINUX</title>
13272 <productname>Kernel Hackers Manual</productname>
13273 <date>July 2017</date>
13274</refentryinfo>
13275<refmeta>
13276 <refentrytitle><phrase>rcu_idle_exit</phrase></refentrytitle>
13277 <manvolnum>9</manvolnum>
13278 <refmiscinfo class="version">4.1.27</refmiscinfo>
13279</refmeta>
13280<refnamediv>
13281 <refname>rcu_idle_exit</refname>
13282 <refpurpose>
13283     inform RCU that current CPU is leaving idle
13284 </refpurpose>
13285</refnamediv>
13286<refsynopsisdiv>
13287 <title>Synopsis</title>
13288  <funcsynopsis><funcprototype>
13289   <funcdef>void <function>rcu_idle_exit </function></funcdef>
13290   <paramdef> <parameter>void</parameter></paramdef>
13291  </funcprototype></funcsynopsis>
13292</refsynopsisdiv>
13293<refsect1>
13294 <title>Arguments</title>
13295 <variablelist>
13296  <varlistentry>
13297   <term><parameter>void</parameter></term>
13298   <listitem>
13299    <para>
13300     no arguments
13301    </para>
13302   </listitem>
13303  </varlistentry>
13304 </variablelist>
13305</refsect1>
13306<refsect1>
13307<title>Description</title>
13308<para>
13309   </para><para>
13310
13311   Exit idle mode, in other words, -enter- the mode in which RCU
13312   read-side critical sections can occur.
13313   </para><para>
13314
13315   We crowbar the -&gt;dynticks_nesting field to DYNTICK_TASK_NEST to
13316   allow for the possibility of usermode upcalls messing up our count
13317   of interrupt nesting level during the busy period that is just
13318   now starting.
13319</para>
13320</refsect1>
13321</refentry>
13322
13323<refentry id="API-rcu-is-watching">
13324<refentryinfo>
13325 <title>LINUX</title>
13326 <productname>Kernel Hackers Manual</productname>
13327 <date>July 2017</date>
13328</refentryinfo>
13329<refmeta>
13330 <refentrytitle><phrase>rcu_is_watching</phrase></refentrytitle>
13331 <manvolnum>9</manvolnum>
13332 <refmiscinfo class="version">4.1.27</refmiscinfo>
13333</refmeta>
13334<refnamediv>
13335 <refname>rcu_is_watching</refname>
13336 <refpurpose>
13337     see if RCU thinks that the current CPU is idle
13338 </refpurpose>
13339</refnamediv>
13340<refsynopsisdiv>
13341 <title>Synopsis</title>
13342  <funcsynopsis><funcprototype>
13343   <funcdef>bool notrace <function>rcu_is_watching </function></funcdef>
13344   <paramdef> <parameter>void</parameter></paramdef>
13345  </funcprototype></funcsynopsis>
13346</refsynopsisdiv>
13347<refsect1>
13348 <title>Arguments</title>
13349 <variablelist>
13350  <varlistentry>
13351   <term><parameter>void</parameter></term>
13352   <listitem>
13353    <para>
13354     no arguments
13355    </para>
13356   </listitem>
13357  </varlistentry>
13358 </variablelist>
13359</refsect1>
13360<refsect1>
13361<title>Description</title>
13362<para>
13363   </para><para>
13364
13365   If the current CPU is in its idle loop and is neither in an interrupt
13366   or NMI handler, return true.
13367</para>
13368</refsect1>
13369</refentry>
13370
13371<refentry id="API-synchronize-sched">
13372<refentryinfo>
13373 <title>LINUX</title>
13374 <productname>Kernel Hackers Manual</productname>
13375 <date>July 2017</date>
13376</refentryinfo>
13377<refmeta>
13378 <refentrytitle><phrase>synchronize_sched</phrase></refentrytitle>
13379 <manvolnum>9</manvolnum>
13380 <refmiscinfo class="version">4.1.27</refmiscinfo>
13381</refmeta>
13382<refnamediv>
13383 <refname>synchronize_sched</refname>
13384 <refpurpose>
13385     wait until an rcu-sched grace period has elapsed.
13386 </refpurpose>
13387</refnamediv>
13388<refsynopsisdiv>
13389 <title>Synopsis</title>
13390  <funcsynopsis><funcprototype>
13391   <funcdef>void <function>synchronize_sched </function></funcdef>
13392   <paramdef> <parameter>void</parameter></paramdef>
13393  </funcprototype></funcsynopsis>
13394</refsynopsisdiv>
13395<refsect1>
13396 <title>Arguments</title>
13397 <variablelist>
13398  <varlistentry>
13399   <term><parameter>void</parameter></term>
13400   <listitem>
13401    <para>
13402     no arguments
13403    </para>
13404   </listitem>
13405  </varlistentry>
13406 </variablelist>
13407</refsect1>
13408<refsect1>
13409<title>Description</title>
13410<para>
13411   </para><para>
13412
13413   Control will return to the caller some time after a full rcu-sched
13414   grace period has elapsed, in other words after all currently executing
13415   rcu-sched read-side critical sections have completed.   These read-side
13416   critical sections are delimited by <function>rcu_read_lock_sched</function> and
13417   <function>rcu_read_unlock_sched</function>, and may be nested.  Note that <function>preempt_disable</function>,
13418   <function>local_irq_disable</function>, and so on may be used in place of
13419   <function>rcu_read_lock_sched</function>.
13420   </para><para>
13421
13422   This means that all preempt_disable code sequences, including NMI and
13423   non-threaded hardware-interrupt handlers, in progress on entry will
13424   have completed before this primitive returns.  However, this does not
13425   guarantee that softirq handlers will have completed, since in some
13426   kernels, these handlers can run in process context, and can block.
13427   </para><para>
13428
13429   Note that this guarantee implies further memory-ordering guarantees.
13430   On systems with more than one CPU, when <function>synchronize_sched</function> returns,
13431   each CPU is guaranteed to have executed a full memory barrier since the
13432   end of its last RCU-sched read-side critical section whose beginning
13433   preceded the call to <function>synchronize_sched</function>.  In addition, each CPU having
13434   an RCU read-side critical section that extends beyond the return from
13435   <function>synchronize_sched</function> is guaranteed to have executed a full memory barrier
13436   after the beginning of <function>synchronize_sched</function> and before the beginning of
13437   that RCU read-side critical section.  Note that these guarantees include
13438   CPUs that are offline, idle, or executing in user mode, as well as CPUs
13439   that are executing in the kernel.
13440   </para><para>
13441
13442   Furthermore, if CPU A invoked <function>synchronize_sched</function>, which returned
13443   to its caller on CPU B, then both CPU A and CPU B are guaranteed
13444   to have executed a full memory barrier during the execution of
13445   <function>synchronize_sched</function> -- even if CPU A and CPU B are the same CPU (but
13446   again only if the system has more than one CPU).
13447   </para><para>
13448
13449   This primitive provides the guarantees made by the (now removed)
13450   <function>synchronize_kernel</function> API.  In contrast, <function>synchronize_rcu</function> only
13451   guarantees that <function>rcu_read_lock</function> sections will have completed.
13452   In <quote>classic RCU</quote>, these two guarantees happen to be one and
13453   the same, but can differ in realtime RCU implementations.
13454</para>
13455</refsect1>
13456</refentry>
13457
13458<refentry id="API-synchronize-rcu-bh">
13459<refentryinfo>
13460 <title>LINUX</title>
13461 <productname>Kernel Hackers Manual</productname>
13462 <date>July 2017</date>
13463</refentryinfo>
13464<refmeta>
13465 <refentrytitle><phrase>synchronize_rcu_bh</phrase></refentrytitle>
13466 <manvolnum>9</manvolnum>
13467 <refmiscinfo class="version">4.1.27</refmiscinfo>
13468</refmeta>
13469<refnamediv>
13470 <refname>synchronize_rcu_bh</refname>
13471 <refpurpose>
13472     wait until an rcu_bh grace period has elapsed.
13473 </refpurpose>
13474</refnamediv>
13475<refsynopsisdiv>
13476 <title>Synopsis</title>
13477  <funcsynopsis><funcprototype>
13478   <funcdef>void <function>synchronize_rcu_bh </function></funcdef>
13479   <paramdef> <parameter>void</parameter></paramdef>
13480  </funcprototype></funcsynopsis>
13481</refsynopsisdiv>
13482<refsect1>
13483 <title>Arguments</title>
13484 <variablelist>
13485  <varlistentry>
13486   <term><parameter>void</parameter></term>
13487   <listitem>
13488    <para>
13489     no arguments
13490    </para>
13491   </listitem>
13492  </varlistentry>
13493 </variablelist>
13494</refsect1>
13495<refsect1>
13496<title>Description</title>
13497<para>
13498   </para><para>
13499
13500   Control will return to the caller some time after a full rcu_bh grace
13501   period has elapsed, in other words after all currently executing rcu_bh
13502   read-side critical sections have completed.  RCU read-side critical
13503   sections are delimited by <function>rcu_read_lock_bh</function> and <function>rcu_read_unlock_bh</function>,
13504   and may be nested.
13505   </para><para>
13506
13507   See the description of <function>synchronize_sched</function> for more detailed information
13508   on memory ordering guarantees.
13509</para>
13510</refsect1>
13511</refentry>
13512
13513<refentry id="API-get-state-synchronize-rcu">
13514<refentryinfo>
13515 <title>LINUX</title>
13516 <productname>Kernel Hackers Manual</productname>
13517 <date>July 2017</date>
13518</refentryinfo>
13519<refmeta>
13520 <refentrytitle><phrase>get_state_synchronize_rcu</phrase></refentrytitle>
13521 <manvolnum>9</manvolnum>
13522 <refmiscinfo class="version">4.1.27</refmiscinfo>
13523</refmeta>
13524<refnamediv>
13525 <refname>get_state_synchronize_rcu</refname>
13526 <refpurpose>
13527     Snapshot current RCU state
13528 </refpurpose>
13529</refnamediv>
13530<refsynopsisdiv>
13531 <title>Synopsis</title>
13532  <funcsynopsis><funcprototype>
13533   <funcdef>unsigned long <function>get_state_synchronize_rcu </function></funcdef>
13534   <paramdef> <parameter>void</parameter></paramdef>
13535  </funcprototype></funcsynopsis>
13536</refsynopsisdiv>
13537<refsect1>
13538 <title>Arguments</title>
13539 <variablelist>
13540  <varlistentry>
13541   <term><parameter>void</parameter></term>
13542   <listitem>
13543    <para>
13544     no arguments
13545    </para>
13546   </listitem>
13547  </varlistentry>
13548 </variablelist>
13549</refsect1>
13550<refsect1>
13551<title>Description</title>
13552<para>
13553   </para><para>
13554
13555   Returns a cookie that is used by a later call to <function>cond_synchronize_rcu</function>
13556   to determine whether or not a full grace period has elapsed in the
13557   meantime.
13558</para>
13559</refsect1>
13560</refentry>
13561
13562<refentry id="API-cond-synchronize-rcu">
13563<refentryinfo>
13564 <title>LINUX</title>
13565 <productname>Kernel Hackers Manual</productname>
13566 <date>July 2017</date>
13567</refentryinfo>
13568<refmeta>
13569 <refentrytitle><phrase>cond_synchronize_rcu</phrase></refentrytitle>
13570 <manvolnum>9</manvolnum>
13571 <refmiscinfo class="version">4.1.27</refmiscinfo>
13572</refmeta>
13573<refnamediv>
13574 <refname>cond_synchronize_rcu</refname>
13575 <refpurpose>
13576     Conditionally wait for an RCU grace period
13577 </refpurpose>
13578</refnamediv>
13579<refsynopsisdiv>
13580 <title>Synopsis</title>
13581  <funcsynopsis><funcprototype>
13582   <funcdef>void <function>cond_synchronize_rcu </function></funcdef>
13583   <paramdef>unsigned long <parameter>oldstate</parameter></paramdef>
13584  </funcprototype></funcsynopsis>
13585</refsynopsisdiv>
13586<refsect1>
13587 <title>Arguments</title>
13588 <variablelist>
13589  <varlistentry>
13590   <term><parameter>oldstate</parameter></term>
13591   <listitem>
13592    <para>
13593     return value from earlier call to <function>get_state_synchronize_rcu</function>
13594    </para>
13595   </listitem>
13596  </varlistentry>
13597 </variablelist>
13598</refsect1>
13599<refsect1>
13600<title>Description</title>
13601<para>
13602   If a full RCU grace period has elapsed since the earlier call to
13603   <function>get_state_synchronize_rcu</function>, just return.  Otherwise, invoke
13604   <function>synchronize_rcu</function> to wait for a full grace period.
13605   </para><para>
13606
13607   Yes, this function does not take counter wrap into account.  But
13608   counter wrap is harmless.  If the counter wraps, we have waited for
13609   more than 2 billion grace periods (and way more on a 64-bit system!),
13610   so waiting for one additional grace period should be just fine.
13611</para>
13612</refsect1>
13613</refentry>
13614
13615<refentry id="API-synchronize-sched-expedited">
13616<refentryinfo>
13617 <title>LINUX</title>
13618 <productname>Kernel Hackers Manual</productname>
13619 <date>July 2017</date>
13620</refentryinfo>
13621<refmeta>
13622 <refentrytitle><phrase>synchronize_sched_expedited</phrase></refentrytitle>
13623 <manvolnum>9</manvolnum>
13624 <refmiscinfo class="version">4.1.27</refmiscinfo>
13625</refmeta>
13626<refnamediv>
13627 <refname>synchronize_sched_expedited</refname>
13628 <refpurpose>
13629     Brute-force RCU-sched grace period
13630 </refpurpose>
13631</refnamediv>
13632<refsynopsisdiv>
13633 <title>Synopsis</title>
13634  <funcsynopsis><funcprototype>
13635   <funcdef>void <function>synchronize_sched_expedited </function></funcdef>
13636   <paramdef> <parameter>void</parameter></paramdef>
13637  </funcprototype></funcsynopsis>
13638</refsynopsisdiv>
13639<refsect1>
13640 <title>Arguments</title>
13641 <variablelist>
13642  <varlistentry>
13643   <term><parameter>void</parameter></term>
13644   <listitem>
13645    <para>
13646     no arguments
13647    </para>
13648   </listitem>
13649  </varlistentry>
13650 </variablelist>
13651</refsect1>
13652<refsect1>
13653<title>Description</title>
13654<para>
13655   </para><para>
13656
13657   Wait for an RCU-sched grace period to elapse, but use a <quote>big hammer</quote>
13658   approach to force the grace period to end quickly.  This consumes
13659   significant time on all CPUs and is unfriendly to real-time workloads,
13660   so is thus not recommended for any sort of common-case code.  In fact,
13661   if you are using <function>synchronize_sched_expedited</function> in a loop, please
13662   restructure your code to batch your updates, and then use a single
13663   <function>synchronize_sched</function> instead.
13664   </para><para>
13665
13666   This implementation can be thought of as an application of ticket
13667   locking to RCU, with sync_sched_expedited_started and
13668   sync_sched_expedited_done taking on the roles of the halves
13669   of the ticket-lock word.  Each task atomically increments
13670   sync_sched_expedited_started upon entry, snapshotting the old value,
13671   then attempts to stop all the CPUs.  If this succeeds, then each
13672   CPU will have executed a context switch, resulting in an RCU-sched
13673   grace period.  We are then done, so we use <function>atomic_cmpxchg</function> to
13674   update sync_sched_expedited_done to match our snapshot -- but
13675   only if someone else has not already advanced past our snapshot.
13676   </para><para>
13677
13678   On the other hand, if <function>try_stop_cpus</function> fails, we check the value
13679   of sync_sched_expedited_done.  If it has advanced past our
13680   initial snapshot, then someone else must have forced a grace period
13681   some time after we took our snapshot.  In this case, our work is
13682   done for us, and we can simply return.  Otherwise, we try again,
13683   but keep our initial snapshot for purposes of checking for someone
13684   doing our work for us.
13685   </para><para>
13686
13687   If we fail too many times in a row, we fall back to <function>synchronize_sched</function>.
13688</para>
13689</refsect1>
13690</refentry>
13691
13692<refentry id="API-rcu-barrier-bh">
13693<refentryinfo>
13694 <title>LINUX</title>
13695 <productname>Kernel Hackers Manual</productname>
13696 <date>July 2017</date>
13697</refentryinfo>
13698<refmeta>
13699 <refentrytitle><phrase>rcu_barrier_bh</phrase></refentrytitle>
13700 <manvolnum>9</manvolnum>
13701 <refmiscinfo class="version">4.1.27</refmiscinfo>
13702</refmeta>
13703<refnamediv>
13704 <refname>rcu_barrier_bh</refname>
13705 <refpurpose>
13706     Wait until all in-flight <function>call_rcu_bh</function> callbacks complete.
13707 </refpurpose>
13708</refnamediv>
13709<refsynopsisdiv>
13710 <title>Synopsis</title>
13711  <funcsynopsis><funcprototype>
13712   <funcdef>void <function>rcu_barrier_bh </function></funcdef>
13713   <paramdef> <parameter>void</parameter></paramdef>
13714  </funcprototype></funcsynopsis>
13715</refsynopsisdiv>
13716<refsect1>
13717 <title>Arguments</title>
13718 <variablelist>
13719  <varlistentry>
13720   <term><parameter>void</parameter></term>
13721   <listitem>
13722    <para>
13723     no arguments
13724    </para>
13725   </listitem>
13726  </varlistentry>
13727 </variablelist>
13728</refsect1>
13729</refentry>
13730
13731<refentry id="API-rcu-barrier-sched">
13732<refentryinfo>
13733 <title>LINUX</title>
13734 <productname>Kernel Hackers Manual</productname>
13735 <date>July 2017</date>
13736</refentryinfo>
13737<refmeta>
13738 <refentrytitle><phrase>rcu_barrier_sched</phrase></refentrytitle>
13739 <manvolnum>9</manvolnum>
13740 <refmiscinfo class="version">4.1.27</refmiscinfo>
13741</refmeta>
13742<refnamediv>
13743 <refname>rcu_barrier_sched</refname>
13744 <refpurpose>
13745     Wait for in-flight <function>call_rcu_sched</function> callbacks.
13746 </refpurpose>
13747</refnamediv>
13748<refsynopsisdiv>
13749 <title>Synopsis</title>
13750  <funcsynopsis><funcprototype>
13751   <funcdef>void <function>rcu_barrier_sched </function></funcdef>
13752   <paramdef> <parameter>void</parameter></paramdef>
13753  </funcprototype></funcsynopsis>
13754</refsynopsisdiv>
13755<refsect1>
13756 <title>Arguments</title>
13757 <variablelist>
13758  <varlistentry>
13759   <term><parameter>void</parameter></term>
13760   <listitem>
13761    <para>
13762     no arguments
13763    </para>
13764   </listitem>
13765  </varlistentry>
13766 </variablelist>
13767</refsect1>
13768</refentry>
13769
13770<!-- kernel/rcu/tree_plugin.h -->
13771<refentry id="API-synchronize-rcu">
13772<refentryinfo>
13773 <title>LINUX</title>
13774 <productname>Kernel Hackers Manual</productname>
13775 <date>July 2017</date>
13776</refentryinfo>
13777<refmeta>
13778 <refentrytitle><phrase>synchronize_rcu</phrase></refentrytitle>
13779 <manvolnum>9</manvolnum>
13780 <refmiscinfo class="version">4.1.27</refmiscinfo>
13781</refmeta>
13782<refnamediv>
13783 <refname>synchronize_rcu</refname>
13784 <refpurpose>
13785  wait until a grace period has elapsed.
13786 </refpurpose>
13787</refnamediv>
13788<refsynopsisdiv>
13789 <title>Synopsis</title>
13790  <funcsynopsis><funcprototype>
13791   <funcdef>void <function>synchronize_rcu </function></funcdef>
13792   <paramdef> <parameter>void</parameter></paramdef>
13793  </funcprototype></funcsynopsis>
13794</refsynopsisdiv>
13795<refsect1>
13796 <title>Arguments</title>
13797 <variablelist>
13798  <varlistentry>
13799   <term><parameter>void</parameter></term>
13800   <listitem>
13801    <para>
13802     no arguments
13803    </para>
13804   </listitem>
13805  </varlistentry>
13806 </variablelist>
13807</refsect1>
13808<refsect1>
13809<title>Description</title>
13810<para>
13811   </para><para>
13812
13813   Control will return to the caller some time after a full grace
13814   period has elapsed, in other words after all currently executing RCU
13815   read-side critical sections have completed.  Note, however, that
13816   upon return from <function>synchronize_rcu</function>, the caller might well be executing
13817   concurrently with new RCU read-side critical sections that began while
13818   <function>synchronize_rcu</function> was waiting.  RCU read-side critical sections are
13819   delimited by <function>rcu_read_lock</function> and <function>rcu_read_unlock</function>, and may be nested.
13820   </para><para>
13821
13822   See the description of <function>synchronize_sched</function> for more detailed information
13823   on memory ordering guarantees.
13824</para>
13825</refsect1>
13826</refentry>
13827
13828<refentry id="API-synchronize-rcu-expedited">
13829<refentryinfo>
13830 <title>LINUX</title>
13831 <productname>Kernel Hackers Manual</productname>
13832 <date>July 2017</date>
13833</refentryinfo>
13834<refmeta>
13835 <refentrytitle><phrase>synchronize_rcu_expedited</phrase></refentrytitle>
13836 <manvolnum>9</manvolnum>
13837 <refmiscinfo class="version">4.1.27</refmiscinfo>
13838</refmeta>
13839<refnamediv>
13840 <refname>synchronize_rcu_expedited</refname>
13841 <refpurpose>
13842     Brute-force RCU grace period
13843 </refpurpose>
13844</refnamediv>
13845<refsynopsisdiv>
13846 <title>Synopsis</title>
13847  <funcsynopsis><funcprototype>
13848   <funcdef>void <function>synchronize_rcu_expedited </function></funcdef>
13849   <paramdef> <parameter>void</parameter></paramdef>
13850  </funcprototype></funcsynopsis>
13851</refsynopsisdiv>
13852<refsect1>
13853 <title>Arguments</title>
13854 <variablelist>
13855  <varlistentry>
13856   <term><parameter>void</parameter></term>
13857   <listitem>
13858    <para>
13859     no arguments
13860    </para>
13861   </listitem>
13862  </varlistentry>
13863 </variablelist>
13864</refsect1>
13865<refsect1>
13866<title>Description</title>
13867<para>
13868   </para><para>
13869
13870   Wait for an RCU-preempt grace period, but expedite it.  The basic
13871   idea is to invoke <function>synchronize_sched_expedited</function> to push all the tasks to
13872   the -&gt;blkd_tasks lists and wait for this list to drain.  This consumes
13873   significant time on all CPUs and is unfriendly to real-time workloads,
13874   so is thus not recommended for any sort of common-case code.
13875   In fact, if you are using <function>synchronize_rcu_expedited</function> in a loop,
13876   please restructure your code to batch your updates, and then Use a
13877   single <function>synchronize_rcu</function> instead.
13878</para>
13879</refsect1>
13880</refentry>
13881
13882<refentry id="API-rcu-barrier">
13883<refentryinfo>
13884 <title>LINUX</title>
13885 <productname>Kernel Hackers Manual</productname>
13886 <date>July 2017</date>
13887</refentryinfo>
13888<refmeta>
13889 <refentrytitle><phrase>rcu_barrier</phrase></refentrytitle>
13890 <manvolnum>9</manvolnum>
13891 <refmiscinfo class="version">4.1.27</refmiscinfo>
13892</refmeta>
13893<refnamediv>
13894 <refname>rcu_barrier</refname>
13895 <refpurpose>
13896     Wait until all in-flight <function>call_rcu</function> callbacks complete.
13897 </refpurpose>
13898</refnamediv>
13899<refsynopsisdiv>
13900 <title>Synopsis</title>
13901  <funcsynopsis><funcprototype>
13902   <funcdef>void <function>rcu_barrier </function></funcdef>
13903   <paramdef> <parameter>void</parameter></paramdef>
13904  </funcprototype></funcsynopsis>
13905</refsynopsisdiv>
13906<refsect1>
13907 <title>Arguments</title>
13908 <variablelist>
13909  <varlistentry>
13910   <term><parameter>void</parameter></term>
13911   <listitem>
13912    <para>
13913     no arguments
13914    </para>
13915   </listitem>
13916  </varlistentry>
13917 </variablelist>
13918</refsect1>
13919<refsect1>
13920<title>Description</title>
13921<para>
13922   </para><para>
13923
13924   Note that this primitive does not necessarily wait for an RCU grace period
13925   to complete.  For example, if there are no RCU callbacks queued anywhere
13926   in the system, then <function>rcu_barrier</function> is within its rights to return
13927   immediately, without waiting for anything, much less an RCU grace period.
13928</para>
13929</refsect1>
13930</refentry>
13931
13932<!-- kernel/rcu/update.c -->
13933<refentry id="API-rcu-expedite-gp">
13934<refentryinfo>
13935 <title>LINUX</title>
13936 <productname>Kernel Hackers Manual</productname>
13937 <date>July 2017</date>
13938</refentryinfo>
13939<refmeta>
13940 <refentrytitle><phrase>rcu_expedite_gp</phrase></refentrytitle>
13941 <manvolnum>9</manvolnum>
13942 <refmiscinfo class="version">4.1.27</refmiscinfo>
13943</refmeta>
13944<refnamediv>
13945 <refname>rcu_expedite_gp</refname>
13946 <refpurpose>
13947  Expedite future RCU grace periods
13948 </refpurpose>
13949</refnamediv>
13950<refsynopsisdiv>
13951 <title>Synopsis</title>
13952  <funcsynopsis><funcprototype>
13953   <funcdef>void <function>rcu_expedite_gp </function></funcdef>
13954   <paramdef> <parameter>void</parameter></paramdef>
13955  </funcprototype></funcsynopsis>
13956</refsynopsisdiv>
13957<refsect1>
13958 <title>Arguments</title>
13959 <variablelist>
13960  <varlistentry>
13961   <term><parameter>void</parameter></term>
13962   <listitem>
13963    <para>
13964     no arguments
13965    </para>
13966   </listitem>
13967  </varlistentry>
13968 </variablelist>
13969</refsect1>
13970<refsect1>
13971<title>Description</title>
13972<para>
13973   </para><para>
13974
13975   After a call to this function, future calls to <function>synchronize_rcu</function> and
13976   friends act as the corresponding <function>synchronize_rcu_expedited</function> function
13977   had instead been called.
13978</para>
13979</refsect1>
13980</refentry>
13981
13982<refentry id="API-rcu-unexpedite-gp">
13983<refentryinfo>
13984 <title>LINUX</title>
13985 <productname>Kernel Hackers Manual</productname>
13986 <date>July 2017</date>
13987</refentryinfo>
13988<refmeta>
13989 <refentrytitle><phrase>rcu_unexpedite_gp</phrase></refentrytitle>
13990 <manvolnum>9</manvolnum>
13991 <refmiscinfo class="version">4.1.27</refmiscinfo>
13992</refmeta>
13993<refnamediv>
13994 <refname>rcu_unexpedite_gp</refname>
13995 <refpurpose>
13996     Cancel prior <function>rcu_expedite_gp</function> invocation
13997 </refpurpose>
13998</refnamediv>
13999<refsynopsisdiv>
14000 <title>Synopsis</title>
14001  <funcsynopsis><funcprototype>
14002   <funcdef>void <function>rcu_unexpedite_gp </function></funcdef>
14003   <paramdef> <parameter>void</parameter></paramdef>
14004  </funcprototype></funcsynopsis>
14005</refsynopsisdiv>
14006<refsect1>
14007 <title>Arguments</title>
14008 <variablelist>
14009  <varlistentry>
14010   <term><parameter>void</parameter></term>
14011   <listitem>
14012    <para>
14013     no arguments
14014    </para>
14015   </listitem>
14016  </varlistentry>
14017 </variablelist>
14018</refsect1>
14019<refsect1>
14020<title>Description</title>
14021<para>
14022   </para><para>
14023
14024   Undo a prior call to <function>rcu_expedite_gp</function>.  If all prior calls to
14025   <function>rcu_expedite_gp</function> are undone by a subsequent call to <function>rcu_unexpedite_gp</function>,
14026   and if the rcu_expedited sysfs/boot parameter is not set, then all
14027   subsequent calls to <function>synchronize_rcu</function> and friends will return to
14028   their normal non-expedited behavior.
14029</para>
14030</refsect1>
14031</refentry>
14032
14033<refentry id="API-rcu-read-lock-held">
14034<refentryinfo>
14035 <title>LINUX</title>
14036 <productname>Kernel Hackers Manual</productname>
14037 <date>July 2017</date>
14038</refentryinfo>
14039<refmeta>
14040 <refentrytitle><phrase>rcu_read_lock_held</phrase></refentrytitle>
14041 <manvolnum>9</manvolnum>
14042 <refmiscinfo class="version">4.1.27</refmiscinfo>
14043</refmeta>
14044<refnamediv>
14045 <refname>rcu_read_lock_held</refname>
14046 <refpurpose>
14047     might we be in RCU read-side critical section?
14048 </refpurpose>
14049</refnamediv>
14050<refsynopsisdiv>
14051 <title>Synopsis</title>
14052  <funcsynopsis><funcprototype>
14053   <funcdef>int <function>rcu_read_lock_held </function></funcdef>
14054   <paramdef> <parameter>void</parameter></paramdef>
14055  </funcprototype></funcsynopsis>
14056</refsynopsisdiv>
14057<refsect1>
14058 <title>Arguments</title>
14059 <variablelist>
14060  <varlistentry>
14061   <term><parameter>void</parameter></term>
14062   <listitem>
14063    <para>
14064     no arguments
14065    </para>
14066   </listitem>
14067  </varlistentry>
14068 </variablelist>
14069</refsect1>
14070<refsect1>
14071<title>Description</title>
14072<para>
14073   </para><para>
14074
14075   If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
14076   read-side critical section.  In absence of CONFIG_DEBUG_LOCK_ALLOC,
14077   this assumes we are in an RCU read-side critical section unless it can
14078   prove otherwise.  This is useful for debug checks in functions that
14079   require that they be called within an RCU read-side critical section.
14080   </para><para>
14081
14082   Checks <function>debug_lockdep_rcu_enabled</function> to prevent false positives during boot
14083   and while lockdep is disabled.
14084   </para><para>
14085
14086   Note that <function>rcu_read_lock</function> and the matching <function>rcu_read_unlock</function> must
14087   occur in the same context, for example, it is illegal to invoke
14088   <function>rcu_read_unlock</function> in process context if the matching <function>rcu_read_lock</function>
14089   was invoked from within an irq handler.
14090   </para><para>
14091
14092   Note that <function>rcu_read_lock</function> is disallowed if the CPU is either idle or
14093   offline from an RCU perspective, so check for those as well.
14094</para>
14095</refsect1>
14096</refentry>
14097
14098<refentry id="API-rcu-read-lock-bh-held">
14099<refentryinfo>
14100 <title>LINUX</title>
14101 <productname>Kernel Hackers Manual</productname>
14102 <date>July 2017</date>
14103</refentryinfo>
14104<refmeta>
14105 <refentrytitle><phrase>rcu_read_lock_bh_held</phrase></refentrytitle>
14106 <manvolnum>9</manvolnum>
14107 <refmiscinfo class="version">4.1.27</refmiscinfo>
14108</refmeta>
14109<refnamediv>
14110 <refname>rcu_read_lock_bh_held</refname>
14111 <refpurpose>
14112     might we be in RCU-bh read-side critical section?
14113 </refpurpose>
14114</refnamediv>
14115<refsynopsisdiv>
14116 <title>Synopsis</title>
14117  <funcsynopsis><funcprototype>
14118   <funcdef>int <function>rcu_read_lock_bh_held </function></funcdef>
14119   <paramdef> <parameter>void</parameter></paramdef>
14120  </funcprototype></funcsynopsis>
14121</refsynopsisdiv>
14122<refsect1>
14123 <title>Arguments</title>
14124 <variablelist>
14125  <varlistentry>
14126   <term><parameter>void</parameter></term>
14127   <listitem>
14128    <para>
14129     no arguments
14130    </para>
14131   </listitem>
14132  </varlistentry>
14133 </variablelist>
14134</refsect1>
14135<refsect1>
14136<title>Description</title>
14137<para>
14138   </para><para>
14139
14140   Check for bottom half being disabled, which covers both the
14141   CONFIG_PROVE_RCU and not cases.  Note that if someone uses
14142   <function>rcu_read_lock_bh</function>, but then later enables BH, lockdep (if enabled)
14143   will show the situation.  This is useful for debug checks in functions
14144   that require that they be called within an RCU read-side critical
14145   section.
14146   </para><para>
14147
14148   Check <function>debug_lockdep_rcu_enabled</function> to prevent false positives during boot.
14149   </para><para>
14150
14151   Note that <function>rcu_read_lock</function> is disallowed if the CPU is either idle or
14152   offline from an RCU perspective, so check for those as well.
14153</para>
14154</refsect1>
14155</refentry>
14156
14157<refentry id="API-init-rcu-head-on-stack">
14158<refentryinfo>
14159 <title>LINUX</title>
14160 <productname>Kernel Hackers Manual</productname>
14161 <date>July 2017</date>
14162</refentryinfo>
14163<refmeta>
14164 <refentrytitle><phrase>init_rcu_head_on_stack</phrase></refentrytitle>
14165 <manvolnum>9</manvolnum>
14166 <refmiscinfo class="version">4.1.27</refmiscinfo>
14167</refmeta>
14168<refnamediv>
14169 <refname>init_rcu_head_on_stack</refname>
14170 <refpurpose>
14171     initialize on-stack rcu_head for debugobjects
14172 </refpurpose>
14173</refnamediv>
14174<refsynopsisdiv>
14175 <title>Synopsis</title>
14176  <funcsynopsis><funcprototype>
14177   <funcdef>void <function>init_rcu_head_on_stack </function></funcdef>
14178   <paramdef>struct rcu_head * <parameter>head</parameter></paramdef>
14179  </funcprototype></funcsynopsis>
14180</refsynopsisdiv>
14181<refsect1>
14182 <title>Arguments</title>
14183 <variablelist>
14184  <varlistentry>
14185   <term><parameter>head</parameter></term>
14186   <listitem>
14187    <para>
14188     pointer to rcu_head structure to be initialized
14189    </para>
14190   </listitem>
14191  </varlistentry>
14192 </variablelist>
14193</refsect1>
14194<refsect1>
14195<title>Description</title>
14196<para>
14197   This function informs debugobjects of a new rcu_head structure that
14198   has been allocated as an auto variable on the stack.  This function
14199   is not required for rcu_head structures that are statically defined or
14200   that are dynamically allocated on the heap.  This function has no
14201   effect for !CONFIG_DEBUG_OBJECTS_RCU_HEAD kernel builds.
14202</para>
14203</refsect1>
14204</refentry>
14205
14206<refentry id="API-destroy-rcu-head-on-stack">
14207<refentryinfo>
14208 <title>LINUX</title>
14209 <productname>Kernel Hackers Manual</productname>
14210 <date>July 2017</date>
14211</refentryinfo>
14212<refmeta>
14213 <refentrytitle><phrase>destroy_rcu_head_on_stack</phrase></refentrytitle>
14214 <manvolnum>9</manvolnum>
14215 <refmiscinfo class="version">4.1.27</refmiscinfo>
14216</refmeta>
14217<refnamediv>
14218 <refname>destroy_rcu_head_on_stack</refname>
14219 <refpurpose>
14220     destroy on-stack rcu_head for debugobjects
14221 </refpurpose>
14222</refnamediv>
14223<refsynopsisdiv>
14224 <title>Synopsis</title>
14225  <funcsynopsis><funcprototype>
14226   <funcdef>void <function>destroy_rcu_head_on_stack </function></funcdef>
14227   <paramdef>struct rcu_head * <parameter>head</parameter></paramdef>
14228  </funcprototype></funcsynopsis>
14229</refsynopsisdiv>
14230<refsect1>
14231 <title>Arguments</title>
14232 <variablelist>
14233  <varlistentry>
14234   <term><parameter>head</parameter></term>
14235   <listitem>
14236    <para>
14237     pointer to rcu_head structure to be initialized
14238    </para>
14239   </listitem>
14240  </varlistentry>
14241 </variablelist>
14242</refsect1>
14243<refsect1>
14244<title>Description</title>
14245<para>
14246   This function informs debugobjects that an on-stack rcu_head structure
14247   is about to go out of scope.  As with <function>init_rcu_head_on_stack</function>, this
14248   function is not required for rcu_head structures that are statically
14249   defined or that are dynamically allocated on the heap.  Also as with
14250   <function>init_rcu_head_on_stack</function>, this function has no effect for
14251   !CONFIG_DEBUG_OBJECTS_RCU_HEAD kernel builds.
14252</para>
14253</refsect1>
14254</refentry>
14255
14256<refentry id="API-synchronize-rcu-tasks">
14257<refentryinfo>
14258 <title>LINUX</title>
14259 <productname>Kernel Hackers Manual</productname>
14260 <date>July 2017</date>
14261</refentryinfo>
14262<refmeta>
14263 <refentrytitle><phrase>synchronize_rcu_tasks</phrase></refentrytitle>
14264 <manvolnum>9</manvolnum>
14265 <refmiscinfo class="version">4.1.27</refmiscinfo>
14266</refmeta>
14267<refnamediv>
14268 <refname>synchronize_rcu_tasks</refname>
14269 <refpurpose>
14270     wait until an rcu-tasks grace period has elapsed.
14271 </refpurpose>
14272</refnamediv>
14273<refsynopsisdiv>
14274 <title>Synopsis</title>
14275  <funcsynopsis><funcprototype>
14276   <funcdef>void <function>synchronize_rcu_tasks </function></funcdef>
14277   <paramdef> <parameter>void</parameter></paramdef>
14278  </funcprototype></funcsynopsis>
14279</refsynopsisdiv>
14280<refsect1>
14281 <title>Arguments</title>
14282 <variablelist>
14283  <varlistentry>
14284   <term><parameter>void</parameter></term>
14285   <listitem>
14286    <para>
14287     no arguments
14288    </para>
14289   </listitem>
14290  </varlistentry>
14291 </variablelist>
14292</refsect1>
14293<refsect1>
14294<title>Description</title>
14295<para>
14296   </para><para>
14297
14298   Control will return to the caller some time after a full rcu-tasks
14299   grace period has elapsed, in other words after all currently
14300   executing rcu-tasks read-side critical sections have elapsed.  These
14301   read-side critical sections are delimited by calls to <function>schedule</function>,
14302   <function>cond_resched_rcu_qs</function>, idle execution, userspace execution, calls
14303   to <function>synchronize_rcu_tasks</function>, and (in theory, anyway) <function>cond_resched</function>.
14304   </para><para>
14305
14306   This is a very specialized primitive, intended only for a few uses in
14307   tracing and other situations requiring manipulation of function
14308   preambles and profiling hooks.  The <function>synchronize_rcu_tasks</function> function
14309   is not (yet) intended for heavy use from multiple CPUs.
14310   </para><para>
14311
14312   Note that this guarantee implies further memory-ordering guarantees.
14313   On systems with more than one CPU, when <function>synchronize_rcu_tasks</function> returns,
14314   each CPU is guaranteed to have executed a full memory barrier since the
14315   end of its last RCU-tasks read-side critical section whose beginning
14316   preceded the call to <function>synchronize_rcu_tasks</function>.  In addition, each CPU
14317   having an RCU-tasks read-side critical section that extends beyond
14318   the return from <function>synchronize_rcu_tasks</function> is guaranteed to have executed
14319   a full memory barrier after the beginning of <function>synchronize_rcu_tasks</function>
14320   and before the beginning of that RCU-tasks read-side critical section.
14321   Note that these guarantees include CPUs that are offline, idle, or
14322   executing in user mode, as well as CPUs that are executing in the kernel.
14323   </para><para>
14324
14325   Furthermore, if CPU A invoked <function>synchronize_rcu_tasks</function>, which returned
14326   to its caller on CPU B, then both CPU A and CPU B are guaranteed
14327   to have executed a full memory barrier during the execution of
14328   <function>synchronize_rcu_tasks</function> -- even if CPU A and CPU B are the same CPU
14329   (but again only if the system has more than one CPU).
14330</para>
14331</refsect1>
14332</refentry>
14333
14334<refentry id="API-rcu-barrier-tasks">
14335<refentryinfo>
14336 <title>LINUX</title>
14337 <productname>Kernel Hackers Manual</productname>
14338 <date>July 2017</date>
14339</refentryinfo>
14340<refmeta>
14341 <refentrytitle><phrase>rcu_barrier_tasks</phrase></refentrytitle>
14342 <manvolnum>9</manvolnum>
14343 <refmiscinfo class="version">4.1.27</refmiscinfo>
14344</refmeta>
14345<refnamediv>
14346 <refname>rcu_barrier_tasks</refname>
14347 <refpurpose>
14348     Wait for in-flight <function>call_rcu_tasks</function> callbacks.
14349 </refpurpose>
14350</refnamediv>
14351<refsynopsisdiv>
14352 <title>Synopsis</title>
14353  <funcsynopsis><funcprototype>
14354   <funcdef>void <function>rcu_barrier_tasks </function></funcdef>
14355   <paramdef> <parameter>void</parameter></paramdef>
14356  </funcprototype></funcsynopsis>
14357</refsynopsisdiv>
14358<refsect1>
14359 <title>Arguments</title>
14360 <variablelist>
14361  <varlistentry>
14362   <term><parameter>void</parameter></term>
14363   <listitem>
14364    <para>
14365     no arguments
14366    </para>
14367   </listitem>
14368  </varlistentry>
14369 </variablelist>
14370</refsect1>
14371<refsect1>
14372<title>Description</title>
14373<para>
14374   </para><para>
14375
14376   Although the current implementation is guaranteed to wait, it is not
14377   obligated to, for example, if there are no pending callbacks.
14378</para>
14379</refsect1>
14380</refentry>
14381
14382     </sect1>
14383
14384     <sect1><title>Device Resource Management</title>
14385<!-- drivers/base/devres.c -->
14386<refentry id="API-devres-alloc">
14387<refentryinfo>
14388 <title>LINUX</title>
14389 <productname>Kernel Hackers Manual</productname>
14390 <date>July 2017</date>
14391</refentryinfo>
14392<refmeta>
14393 <refentrytitle><phrase>devres_alloc</phrase></refentrytitle>
14394 <manvolnum>9</manvolnum>
14395 <refmiscinfo class="version">4.1.27</refmiscinfo>
14396</refmeta>
14397<refnamediv>
14398 <refname>devres_alloc</refname>
14399 <refpurpose>
14400  Allocate device resource data
14401 </refpurpose>
14402</refnamediv>
14403<refsynopsisdiv>
14404 <title>Synopsis</title>
14405  <funcsynopsis><funcprototype>
14406   <funcdef>void * <function>devres_alloc </function></funcdef>
14407   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
14408   <paramdef>size_t <parameter>size</parameter></paramdef>
14409   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
14410  </funcprototype></funcsynopsis>
14411</refsynopsisdiv>
14412<refsect1>
14413 <title>Arguments</title>
14414 <variablelist>
14415  <varlistentry>
14416   <term><parameter>release</parameter></term>
14417   <listitem>
14418    <para>
14419     Release function devres will be associated with
14420    </para>
14421   </listitem>
14422  </varlistentry>
14423  <varlistentry>
14424   <term><parameter>size</parameter></term>
14425   <listitem>
14426    <para>
14427     Allocation size
14428    </para>
14429   </listitem>
14430  </varlistentry>
14431  <varlistentry>
14432   <term><parameter>gfp</parameter></term>
14433   <listitem>
14434    <para>
14435     Allocation flags
14436    </para>
14437   </listitem>
14438  </varlistentry>
14439 </variablelist>
14440</refsect1>
14441<refsect1>
14442<title>Description</title>
14443<para>
14444   Allocate devres of <parameter>size</parameter> bytes.  The allocated area is zeroed, then
14445   associated with <parameter>release</parameter>.  The returned pointer can be passed to
14446   other devres_*() functions.
14447</para>
14448</refsect1>
14449<refsect1>
14450<title>RETURNS</title>
14451<para>
14452   Pointer to allocated devres on success, NULL on failure.
14453</para>
14454</refsect1>
14455</refentry>
14456
14457<refentry id="API-devres-for-each-res">
14458<refentryinfo>
14459 <title>LINUX</title>
14460 <productname>Kernel Hackers Manual</productname>
14461 <date>July 2017</date>
14462</refentryinfo>
14463<refmeta>
14464 <refentrytitle><phrase>devres_for_each_res</phrase></refentrytitle>
14465 <manvolnum>9</manvolnum>
14466 <refmiscinfo class="version">4.1.27</refmiscinfo>
14467</refmeta>
14468<refnamediv>
14469 <refname>devres_for_each_res</refname>
14470 <refpurpose>
14471     Resource iterator
14472 </refpurpose>
14473</refnamediv>
14474<refsynopsisdiv>
14475 <title>Synopsis</title>
14476  <funcsynopsis><funcprototype>
14477   <funcdef>void <function>devres_for_each_res </function></funcdef>
14478   <paramdef>struct device * <parameter>dev</parameter></paramdef>
14479   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
14480   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
14481   <paramdef>void * <parameter>match_data</parameter></paramdef>
14482   <paramdef>void (*<parameter>fn</parameter>)
14483     <funcparams>struct device *, void *, void *</funcparams></paramdef>
14484   <paramdef>void * <parameter>data</parameter></paramdef>
14485  </funcprototype></funcsynopsis>
14486</refsynopsisdiv>
14487<refsect1>
14488 <title>Arguments</title>
14489 <variablelist>
14490  <varlistentry>
14491   <term><parameter>dev</parameter></term>
14492   <listitem>
14493    <para>
14494     Device to iterate resource from
14495    </para>
14496   </listitem>
14497  </varlistentry>
14498  <varlistentry>
14499   <term><parameter>release</parameter></term>
14500   <listitem>
14501    <para>
14502     Look for resources associated with this release function
14503    </para>
14504   </listitem>
14505  </varlistentry>
14506  <varlistentry>
14507   <term><parameter>match</parameter></term>
14508   <listitem>
14509    <para>
14510     Match function (optional)
14511    </para>
14512   </listitem>
14513  </varlistentry>
14514  <varlistentry>
14515   <term><parameter>match_data</parameter></term>
14516   <listitem>
14517    <para>
14518     Data for the match function
14519    </para>
14520   </listitem>
14521  </varlistentry>
14522  <varlistentry>
14523   <term><parameter>fn</parameter></term>
14524   <listitem>
14525    <para>
14526     Function to be called for each matched resource.
14527    </para>
14528   </listitem>
14529  </varlistentry>
14530  <varlistentry>
14531   <term><parameter>data</parameter></term>
14532   <listitem>
14533    <para>
14534     Data for <parameter>fn</parameter>, the 3rd parameter of <parameter>fn</parameter>
14535    </para>
14536   </listitem>
14537  </varlistentry>
14538 </variablelist>
14539</refsect1>
14540<refsect1>
14541<title>Description</title>
14542<para>
14543   Call <parameter>fn</parameter> for each devres of <parameter>dev</parameter> which is associated with <parameter>release</parameter>
14544   and for which <parameter>match</parameter> returns 1.
14545</para>
14546</refsect1>
14547<refsect1>
14548<title>RETURNS</title>
14549<para>
14550   void
14551</para>
14552</refsect1>
14553</refentry>
14554
14555<refentry id="API-devres-free">
14556<refentryinfo>
14557 <title>LINUX</title>
14558 <productname>Kernel Hackers Manual</productname>
14559 <date>July 2017</date>
14560</refentryinfo>
14561<refmeta>
14562 <refentrytitle><phrase>devres_free</phrase></refentrytitle>
14563 <manvolnum>9</manvolnum>
14564 <refmiscinfo class="version">4.1.27</refmiscinfo>
14565</refmeta>
14566<refnamediv>
14567 <refname>devres_free</refname>
14568 <refpurpose>
14569     Free device resource data
14570 </refpurpose>
14571</refnamediv>
14572<refsynopsisdiv>
14573 <title>Synopsis</title>
14574  <funcsynopsis><funcprototype>
14575   <funcdef>void <function>devres_free </function></funcdef>
14576   <paramdef>void * <parameter>res</parameter></paramdef>
14577  </funcprototype></funcsynopsis>
14578</refsynopsisdiv>
14579<refsect1>
14580 <title>Arguments</title>
14581 <variablelist>
14582  <varlistentry>
14583   <term><parameter>res</parameter></term>
14584   <listitem>
14585    <para>
14586     Pointer to devres data to free
14587    </para>
14588   </listitem>
14589  </varlistentry>
14590 </variablelist>
14591</refsect1>
14592<refsect1>
14593<title>Description</title>
14594<para>
14595   Free devres created with <function>devres_alloc</function>.
14596</para>
14597</refsect1>
14598</refentry>
14599
14600<refentry id="API-devres-add">
14601<refentryinfo>
14602 <title>LINUX</title>
14603 <productname>Kernel Hackers Manual</productname>
14604 <date>July 2017</date>
14605</refentryinfo>
14606<refmeta>
14607 <refentrytitle><phrase>devres_add</phrase></refentrytitle>
14608 <manvolnum>9</manvolnum>
14609 <refmiscinfo class="version">4.1.27</refmiscinfo>
14610</refmeta>
14611<refnamediv>
14612 <refname>devres_add</refname>
14613 <refpurpose>
14614     Register device resource
14615 </refpurpose>
14616</refnamediv>
14617<refsynopsisdiv>
14618 <title>Synopsis</title>
14619  <funcsynopsis><funcprototype>
14620   <funcdef>void <function>devres_add </function></funcdef>
14621   <paramdef>struct device * <parameter>dev</parameter></paramdef>
14622   <paramdef>void * <parameter>res</parameter></paramdef>
14623  </funcprototype></funcsynopsis>
14624</refsynopsisdiv>
14625<refsect1>
14626 <title>Arguments</title>
14627 <variablelist>
14628  <varlistentry>
14629   <term><parameter>dev</parameter></term>
14630   <listitem>
14631    <para>
14632     Device to add resource to
14633    </para>
14634   </listitem>
14635  </varlistentry>
14636  <varlistentry>
14637   <term><parameter>res</parameter></term>
14638   <listitem>
14639    <para>
14640     Resource to register
14641    </para>
14642   </listitem>
14643  </varlistentry>
14644 </variablelist>
14645</refsect1>
14646<refsect1>
14647<title>Description</title>
14648<para>
14649   Register devres <parameter>res</parameter> to <parameter>dev</parameter>.  <parameter>res</parameter> should have been allocated
14650   using <function>devres_alloc</function>.  On driver detach, the associated release
14651   function will be invoked and devres will be freed automatically.
14652</para>
14653</refsect1>
14654</refentry>
14655
14656<refentry id="API-devres-find">
14657<refentryinfo>
14658 <title>LINUX</title>
14659 <productname>Kernel Hackers Manual</productname>
14660 <date>July 2017</date>
14661</refentryinfo>
14662<refmeta>
14663 <refentrytitle><phrase>devres_find</phrase></refentrytitle>
14664 <manvolnum>9</manvolnum>
14665 <refmiscinfo class="version">4.1.27</refmiscinfo>
14666</refmeta>
14667<refnamediv>
14668 <refname>devres_find</refname>
14669 <refpurpose>
14670     Find device resource
14671 </refpurpose>
14672</refnamediv>
14673<refsynopsisdiv>
14674 <title>Synopsis</title>
14675  <funcsynopsis><funcprototype>
14676   <funcdef>void * <function>devres_find </function></funcdef>
14677   <paramdef>struct device * <parameter>dev</parameter></paramdef>
14678   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
14679   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
14680   <paramdef>void * <parameter>match_data</parameter></paramdef>
14681  </funcprototype></funcsynopsis>
14682</refsynopsisdiv>
14683<refsect1>
14684 <title>Arguments</title>
14685 <variablelist>
14686  <varlistentry>
14687   <term><parameter>dev</parameter></term>
14688   <listitem>
14689    <para>
14690     Device to lookup resource from
14691    </para>
14692   </listitem>
14693  </varlistentry>
14694  <varlistentry>
14695   <term><parameter>release</parameter></term>
14696   <listitem>
14697    <para>
14698     Look for resources associated with this release function
14699    </para>
14700   </listitem>
14701  </varlistentry>
14702  <varlistentry>
14703   <term><parameter>match</parameter></term>
14704   <listitem>
14705    <para>
14706     Match function (optional)
14707    </para>
14708   </listitem>
14709  </varlistentry>
14710  <varlistentry>
14711   <term><parameter>match_data</parameter></term>
14712   <listitem>
14713    <para>
14714     Data for the match function
14715    </para>
14716   </listitem>
14717  </varlistentry>
14718 </variablelist>
14719</refsect1>
14720<refsect1>
14721<title>Description</title>
14722<para>
14723   Find the latest devres of <parameter>dev</parameter> which is associated with <parameter>release</parameter>
14724   and for which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered
14725   to match all.
14726</para>
14727</refsect1>
14728<refsect1>
14729<title>RETURNS</title>
14730<para>
14731   Pointer to found devres, NULL if not found.
14732</para>
14733</refsect1>
14734</refentry>
14735
14736<refentry id="API-devres-get">
14737<refentryinfo>
14738 <title>LINUX</title>
14739 <productname>Kernel Hackers Manual</productname>
14740 <date>July 2017</date>
14741</refentryinfo>
14742<refmeta>
14743 <refentrytitle><phrase>devres_get</phrase></refentrytitle>
14744 <manvolnum>9</manvolnum>
14745 <refmiscinfo class="version">4.1.27</refmiscinfo>
14746</refmeta>
14747<refnamediv>
14748 <refname>devres_get</refname>
14749 <refpurpose>
14750     Find devres, if non-existent, add one atomically
14751 </refpurpose>
14752</refnamediv>
14753<refsynopsisdiv>
14754 <title>Synopsis</title>
14755  <funcsynopsis><funcprototype>
14756   <funcdef>void * <function>devres_get </function></funcdef>
14757   <paramdef>struct device * <parameter>dev</parameter></paramdef>
14758   <paramdef>void * <parameter>new_res</parameter></paramdef>
14759   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
14760   <paramdef>void * <parameter>match_data</parameter></paramdef>
14761  </funcprototype></funcsynopsis>
14762</refsynopsisdiv>
14763<refsect1>
14764 <title>Arguments</title>
14765 <variablelist>
14766  <varlistentry>
14767   <term><parameter>dev</parameter></term>
14768   <listitem>
14769    <para>
14770     Device to lookup or add devres for
14771    </para>
14772   </listitem>
14773  </varlistentry>
14774  <varlistentry>
14775   <term><parameter>new_res</parameter></term>
14776   <listitem>
14777    <para>
14778     Pointer to new initialized devres to add if not found
14779    </para>
14780   </listitem>
14781  </varlistentry>
14782  <varlistentry>
14783   <term><parameter>match</parameter></term>
14784   <listitem>
14785    <para>
14786     Match function (optional)
14787    </para>
14788   </listitem>
14789  </varlistentry>
14790  <varlistentry>
14791   <term><parameter>match_data</parameter></term>
14792   <listitem>
14793    <para>
14794     Data for the match function
14795    </para>
14796   </listitem>
14797  </varlistentry>
14798 </variablelist>
14799</refsect1>
14800<refsect1>
14801<title>Description</title>
14802<para>
14803   Find the latest devres of <parameter>dev</parameter> which has the same release function
14804   as <parameter>new_res</parameter> and for which <parameter>match</parameter> return 1.  If found, <parameter>new_res</parameter> is
14805   freed; otherwise, <parameter>new_res</parameter> is added atomically.
14806</para>
14807</refsect1>
14808<refsect1>
14809<title>RETURNS</title>
14810<para>
14811   Pointer to found or added devres.
14812</para>
14813</refsect1>
14814</refentry>
14815
14816<refentry id="API-devres-remove">
14817<refentryinfo>
14818 <title>LINUX</title>
14819 <productname>Kernel Hackers Manual</productname>
14820 <date>July 2017</date>
14821</refentryinfo>
14822<refmeta>
14823 <refentrytitle><phrase>devres_remove</phrase></refentrytitle>
14824 <manvolnum>9</manvolnum>
14825 <refmiscinfo class="version">4.1.27</refmiscinfo>
14826</refmeta>
14827<refnamediv>
14828 <refname>devres_remove</refname>
14829 <refpurpose>
14830     Find a device resource and remove it
14831 </refpurpose>
14832</refnamediv>
14833<refsynopsisdiv>
14834 <title>Synopsis</title>
14835  <funcsynopsis><funcprototype>
14836   <funcdef>void * <function>devres_remove </function></funcdef>
14837   <paramdef>struct device * <parameter>dev</parameter></paramdef>
14838   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
14839   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
14840   <paramdef>void * <parameter>match_data</parameter></paramdef>
14841  </funcprototype></funcsynopsis>
14842</refsynopsisdiv>
14843<refsect1>
14844 <title>Arguments</title>
14845 <variablelist>
14846  <varlistentry>
14847   <term><parameter>dev</parameter></term>
14848   <listitem>
14849    <para>
14850     Device to find resource from
14851    </para>
14852   </listitem>
14853  </varlistentry>
14854  <varlistentry>
14855   <term><parameter>release</parameter></term>
14856   <listitem>
14857    <para>
14858     Look for resources associated with this release function
14859    </para>
14860   </listitem>
14861  </varlistentry>
14862  <varlistentry>
14863   <term><parameter>match</parameter></term>
14864   <listitem>
14865    <para>
14866     Match function (optional)
14867    </para>
14868   </listitem>
14869  </varlistentry>
14870  <varlistentry>
14871   <term><parameter>match_data</parameter></term>
14872   <listitem>
14873    <para>
14874     Data for the match function
14875    </para>
14876   </listitem>
14877  </varlistentry>
14878 </variablelist>
14879</refsect1>
14880<refsect1>
14881<title>Description</title>
14882<para>
14883   Find the latest devres of <parameter>dev</parameter> associated with <parameter>release</parameter> and for
14884   which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered to
14885   match all.  If found, the resource is removed atomically and
14886   returned.
14887</para>
14888</refsect1>
14889<refsect1>
14890<title>RETURNS</title>
14891<para>
14892   Pointer to removed devres on success, NULL if not found.
14893</para>
14894</refsect1>
14895</refentry>
14896
14897<refentry id="API-devres-destroy">
14898<refentryinfo>
14899 <title>LINUX</title>
14900 <productname>Kernel Hackers Manual</productname>
14901 <date>July 2017</date>
14902</refentryinfo>
14903<refmeta>
14904 <refentrytitle><phrase>devres_destroy</phrase></refentrytitle>
14905 <manvolnum>9</manvolnum>
14906 <refmiscinfo class="version">4.1.27</refmiscinfo>
14907</refmeta>
14908<refnamediv>
14909 <refname>devres_destroy</refname>
14910 <refpurpose>
14911     Find a device resource and destroy it
14912 </refpurpose>
14913</refnamediv>
14914<refsynopsisdiv>
14915 <title>Synopsis</title>
14916  <funcsynopsis><funcprototype>
14917   <funcdef>int <function>devres_destroy </function></funcdef>
14918   <paramdef>struct device * <parameter>dev</parameter></paramdef>
14919   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
14920   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
14921   <paramdef>void * <parameter>match_data</parameter></paramdef>
14922  </funcprototype></funcsynopsis>
14923</refsynopsisdiv>
14924<refsect1>
14925 <title>Arguments</title>
14926 <variablelist>
14927  <varlistentry>
14928   <term><parameter>dev</parameter></term>
14929   <listitem>
14930    <para>
14931     Device to find resource from
14932    </para>
14933   </listitem>
14934  </varlistentry>
14935  <varlistentry>
14936   <term><parameter>release</parameter></term>
14937   <listitem>
14938    <para>
14939     Look for resources associated with this release function
14940    </para>
14941   </listitem>
14942  </varlistentry>
14943  <varlistentry>
14944   <term><parameter>match</parameter></term>
14945   <listitem>
14946    <para>
14947     Match function (optional)
14948    </para>
14949   </listitem>
14950  </varlistentry>
14951  <varlistentry>
14952   <term><parameter>match_data</parameter></term>
14953   <listitem>
14954    <para>
14955     Data for the match function
14956    </para>
14957   </listitem>
14958  </varlistentry>
14959 </variablelist>
14960</refsect1>
14961<refsect1>
14962<title>Description</title>
14963<para>
14964   Find the latest devres of <parameter>dev</parameter> associated with <parameter>release</parameter> and for
14965   which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered to
14966   match all.  If found, the resource is removed atomically and freed.
14967   </para><para>
14968
14969   Note that the release function for the resource will not be called,
14970   only the devres-allocated data will be freed.  The caller becomes
14971   responsible for freeing any other data.
14972</para>
14973</refsect1>
14974<refsect1>
14975<title>RETURNS</title>
14976<para>
14977   0 if devres is found and freed, -ENOENT if not found.
14978</para>
14979</refsect1>
14980</refentry>
14981
14982<refentry id="API-devres-release">
14983<refentryinfo>
14984 <title>LINUX</title>
14985 <productname>Kernel Hackers Manual</productname>
14986 <date>July 2017</date>
14987</refentryinfo>
14988<refmeta>
14989 <refentrytitle><phrase>devres_release</phrase></refentrytitle>
14990 <manvolnum>9</manvolnum>
14991 <refmiscinfo class="version">4.1.27</refmiscinfo>
14992</refmeta>
14993<refnamediv>
14994 <refname>devres_release</refname>
14995 <refpurpose>
14996     Find a device resource and destroy it, calling release
14997 </refpurpose>
14998</refnamediv>
14999<refsynopsisdiv>
15000 <title>Synopsis</title>
15001  <funcsynopsis><funcprototype>
15002   <funcdef>int <function>devres_release </function></funcdef>
15003   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15004   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
15005   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
15006   <paramdef>void * <parameter>match_data</parameter></paramdef>
15007  </funcprototype></funcsynopsis>
15008</refsynopsisdiv>
15009<refsect1>
15010 <title>Arguments</title>
15011 <variablelist>
15012  <varlistentry>
15013   <term><parameter>dev</parameter></term>
15014   <listitem>
15015    <para>
15016     Device to find resource from
15017    </para>
15018   </listitem>
15019  </varlistentry>
15020  <varlistentry>
15021   <term><parameter>release</parameter></term>
15022   <listitem>
15023    <para>
15024     Look for resources associated with this release function
15025    </para>
15026   </listitem>
15027  </varlistentry>
15028  <varlistentry>
15029   <term><parameter>match</parameter></term>
15030   <listitem>
15031    <para>
15032     Match function (optional)
15033    </para>
15034   </listitem>
15035  </varlistentry>
15036  <varlistentry>
15037   <term><parameter>match_data</parameter></term>
15038   <listitem>
15039    <para>
15040     Data for the match function
15041    </para>
15042   </listitem>
15043  </varlistentry>
15044 </variablelist>
15045</refsect1>
15046<refsect1>
15047<title>Description</title>
15048<para>
15049   Find the latest devres of <parameter>dev</parameter> associated with <parameter>release</parameter> and for
15050   which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered to
15051   match all.  If found, the resource is removed atomically, the
15052   release function called and the resource freed.
15053</para>
15054</refsect1>
15055<refsect1>
15056<title>RETURNS</title>
15057<para>
15058   0 if devres is found and freed, -ENOENT if not found.
15059</para>
15060</refsect1>
15061</refentry>
15062
15063<refentry id="API-devres-open-group">
15064<refentryinfo>
15065 <title>LINUX</title>
15066 <productname>Kernel Hackers Manual</productname>
15067 <date>July 2017</date>
15068</refentryinfo>
15069<refmeta>
15070 <refentrytitle><phrase>devres_open_group</phrase></refentrytitle>
15071 <manvolnum>9</manvolnum>
15072 <refmiscinfo class="version">4.1.27</refmiscinfo>
15073</refmeta>
15074<refnamediv>
15075 <refname>devres_open_group</refname>
15076 <refpurpose>
15077     Open a new devres group
15078 </refpurpose>
15079</refnamediv>
15080<refsynopsisdiv>
15081 <title>Synopsis</title>
15082  <funcsynopsis><funcprototype>
15083   <funcdef>void * <function>devres_open_group </function></funcdef>
15084   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15085   <paramdef>void * <parameter>id</parameter></paramdef>
15086   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
15087  </funcprototype></funcsynopsis>
15088</refsynopsisdiv>
15089<refsect1>
15090 <title>Arguments</title>
15091 <variablelist>
15092  <varlistentry>
15093   <term><parameter>dev</parameter></term>
15094   <listitem>
15095    <para>
15096     Device to open devres group for
15097    </para>
15098   </listitem>
15099  </varlistentry>
15100  <varlistentry>
15101   <term><parameter>id</parameter></term>
15102   <listitem>
15103    <para>
15104     Separator ID
15105    </para>
15106   </listitem>
15107  </varlistentry>
15108  <varlistentry>
15109   <term><parameter>gfp</parameter></term>
15110   <listitem>
15111    <para>
15112     Allocation flags
15113    </para>
15114   </listitem>
15115  </varlistentry>
15116 </variablelist>
15117</refsect1>
15118<refsect1>
15119<title>Description</title>
15120<para>
15121   Open a new devres group for <parameter>dev</parameter> with <parameter>id</parameter>.  For <parameter>id</parameter>, using a
15122   pointer to an object which won't be used for another group is
15123   recommended.  If <parameter>id</parameter> is NULL, address-wise unique ID is created.
15124</para>
15125</refsect1>
15126<refsect1>
15127<title>RETURNS</title>
15128<para>
15129   ID of the new group, NULL on failure.
15130</para>
15131</refsect1>
15132</refentry>
15133
15134<refentry id="API-devres-close-group">
15135<refentryinfo>
15136 <title>LINUX</title>
15137 <productname>Kernel Hackers Manual</productname>
15138 <date>July 2017</date>
15139</refentryinfo>
15140<refmeta>
15141 <refentrytitle><phrase>devres_close_group</phrase></refentrytitle>
15142 <manvolnum>9</manvolnum>
15143 <refmiscinfo class="version">4.1.27</refmiscinfo>
15144</refmeta>
15145<refnamediv>
15146 <refname>devres_close_group</refname>
15147 <refpurpose>
15148     Close a devres group
15149 </refpurpose>
15150</refnamediv>
15151<refsynopsisdiv>
15152 <title>Synopsis</title>
15153  <funcsynopsis><funcprototype>
15154   <funcdef>void <function>devres_close_group </function></funcdef>
15155   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15156   <paramdef>void * <parameter>id</parameter></paramdef>
15157  </funcprototype></funcsynopsis>
15158</refsynopsisdiv>
15159<refsect1>
15160 <title>Arguments</title>
15161 <variablelist>
15162  <varlistentry>
15163   <term><parameter>dev</parameter></term>
15164   <listitem>
15165    <para>
15166     Device to close devres group for
15167    </para>
15168   </listitem>
15169  </varlistentry>
15170  <varlistentry>
15171   <term><parameter>id</parameter></term>
15172   <listitem>
15173    <para>
15174     ID of target group, can be NULL
15175    </para>
15176   </listitem>
15177  </varlistentry>
15178 </variablelist>
15179</refsect1>
15180<refsect1>
15181<title>Description</title>
15182<para>
15183   Close the group identified by <parameter>id</parameter>.  If <parameter>id</parameter> is NULL, the latest open
15184   group is selected.
15185</para>
15186</refsect1>
15187</refentry>
15188
15189<refentry id="API-devres-remove-group">
15190<refentryinfo>
15191 <title>LINUX</title>
15192 <productname>Kernel Hackers Manual</productname>
15193 <date>July 2017</date>
15194</refentryinfo>
15195<refmeta>
15196 <refentrytitle><phrase>devres_remove_group</phrase></refentrytitle>
15197 <manvolnum>9</manvolnum>
15198 <refmiscinfo class="version">4.1.27</refmiscinfo>
15199</refmeta>
15200<refnamediv>
15201 <refname>devres_remove_group</refname>
15202 <refpurpose>
15203     Remove a devres group
15204 </refpurpose>
15205</refnamediv>
15206<refsynopsisdiv>
15207 <title>Synopsis</title>
15208  <funcsynopsis><funcprototype>
15209   <funcdef>void <function>devres_remove_group </function></funcdef>
15210   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15211   <paramdef>void * <parameter>id</parameter></paramdef>
15212  </funcprototype></funcsynopsis>
15213</refsynopsisdiv>
15214<refsect1>
15215 <title>Arguments</title>
15216 <variablelist>
15217  <varlistentry>
15218   <term><parameter>dev</parameter></term>
15219   <listitem>
15220    <para>
15221     Device to remove group for
15222    </para>
15223   </listitem>
15224  </varlistentry>
15225  <varlistentry>
15226   <term><parameter>id</parameter></term>
15227   <listitem>
15228    <para>
15229     ID of target group, can be NULL
15230    </para>
15231   </listitem>
15232  </varlistentry>
15233 </variablelist>
15234</refsect1>
15235<refsect1>
15236<title>Description</title>
15237<para>
15238   Remove the group identified by <parameter>id</parameter>.  If <parameter>id</parameter> is NULL, the latest
15239   open group is selected.  Note that removing a group doesn't affect
15240   any other resources.
15241</para>
15242</refsect1>
15243</refentry>
15244
15245<refentry id="API-devres-release-group">
15246<refentryinfo>
15247 <title>LINUX</title>
15248 <productname>Kernel Hackers Manual</productname>
15249 <date>July 2017</date>
15250</refentryinfo>
15251<refmeta>
15252 <refentrytitle><phrase>devres_release_group</phrase></refentrytitle>
15253 <manvolnum>9</manvolnum>
15254 <refmiscinfo class="version">4.1.27</refmiscinfo>
15255</refmeta>
15256<refnamediv>
15257 <refname>devres_release_group</refname>
15258 <refpurpose>
15259     Release resources in a devres group
15260 </refpurpose>
15261</refnamediv>
15262<refsynopsisdiv>
15263 <title>Synopsis</title>
15264  <funcsynopsis><funcprototype>
15265   <funcdef>int <function>devres_release_group </function></funcdef>
15266   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15267   <paramdef>void * <parameter>id</parameter></paramdef>
15268  </funcprototype></funcsynopsis>
15269</refsynopsisdiv>
15270<refsect1>
15271 <title>Arguments</title>
15272 <variablelist>
15273  <varlistentry>
15274   <term><parameter>dev</parameter></term>
15275   <listitem>
15276    <para>
15277     Device to release group for
15278    </para>
15279   </listitem>
15280  </varlistentry>
15281  <varlistentry>
15282   <term><parameter>id</parameter></term>
15283   <listitem>
15284    <para>
15285     ID of target group, can be NULL
15286    </para>
15287   </listitem>
15288  </varlistentry>
15289 </variablelist>
15290</refsect1>
15291<refsect1>
15292<title>Description</title>
15293<para>
15294   Release all resources in the group identified by <parameter>id</parameter>.  If <parameter>id</parameter> is
15295   NULL, the latest open group is selected.  The selected group and
15296   groups properly nested inside the selected group are removed.
15297</para>
15298</refsect1>
15299<refsect1>
15300<title>RETURNS</title>
15301<para>
15302   The number of released non-group resources.
15303</para>
15304</refsect1>
15305</refentry>
15306
15307<refentry id="API-devm-add-action">
15308<refentryinfo>
15309 <title>LINUX</title>
15310 <productname>Kernel Hackers Manual</productname>
15311 <date>July 2017</date>
15312</refentryinfo>
15313<refmeta>
15314 <refentrytitle><phrase>devm_add_action</phrase></refentrytitle>
15315 <manvolnum>9</manvolnum>
15316 <refmiscinfo class="version">4.1.27</refmiscinfo>
15317</refmeta>
15318<refnamediv>
15319 <refname>devm_add_action</refname>
15320 <refpurpose>
15321     add a custom action to list of managed resources
15322 </refpurpose>
15323</refnamediv>
15324<refsynopsisdiv>
15325 <title>Synopsis</title>
15326  <funcsynopsis><funcprototype>
15327   <funcdef>int <function>devm_add_action </function></funcdef>
15328   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15329   <paramdef>void (*<parameter>action</parameter>)
15330     <funcparams>void *</funcparams></paramdef>
15331   <paramdef>void * <parameter>data</parameter></paramdef>
15332  </funcprototype></funcsynopsis>
15333</refsynopsisdiv>
15334<refsect1>
15335 <title>Arguments</title>
15336 <variablelist>
15337  <varlistentry>
15338   <term><parameter>dev</parameter></term>
15339   <listitem>
15340    <para>
15341     Device that owns the action
15342    </para>
15343   </listitem>
15344  </varlistentry>
15345  <varlistentry>
15346   <term><parameter>action</parameter></term>
15347   <listitem>
15348    <para>
15349     Function that should be called
15350    </para>
15351   </listitem>
15352  </varlistentry>
15353  <varlistentry>
15354   <term><parameter>data</parameter></term>
15355   <listitem>
15356    <para>
15357     Pointer to data passed to <parameter>action</parameter> implementation
15358    </para>
15359   </listitem>
15360  </varlistentry>
15361 </variablelist>
15362</refsect1>
15363<refsect1>
15364<title>Description</title>
15365<para>
15366   This adds a custom action to the list of managed resources so that
15367   it gets executed as part of standard resource unwinding.
15368</para>
15369</refsect1>
15370</refentry>
15371
15372<refentry id="API-devm-remove-action">
15373<refentryinfo>
15374 <title>LINUX</title>
15375 <productname>Kernel Hackers Manual</productname>
15376 <date>July 2017</date>
15377</refentryinfo>
15378<refmeta>
15379 <refentrytitle><phrase>devm_remove_action</phrase></refentrytitle>
15380 <manvolnum>9</manvolnum>
15381 <refmiscinfo class="version">4.1.27</refmiscinfo>
15382</refmeta>
15383<refnamediv>
15384 <refname>devm_remove_action</refname>
15385 <refpurpose>
15386     removes previously added custom action
15387 </refpurpose>
15388</refnamediv>
15389<refsynopsisdiv>
15390 <title>Synopsis</title>
15391  <funcsynopsis><funcprototype>
15392   <funcdef>void <function>devm_remove_action </function></funcdef>
15393   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15394   <paramdef>void (*<parameter>action</parameter>)
15395     <funcparams>void *</funcparams></paramdef>
15396   <paramdef>void * <parameter>data</parameter></paramdef>
15397  </funcprototype></funcsynopsis>
15398</refsynopsisdiv>
15399<refsect1>
15400 <title>Arguments</title>
15401 <variablelist>
15402  <varlistentry>
15403   <term><parameter>dev</parameter></term>
15404   <listitem>
15405    <para>
15406     Device that owns the action
15407    </para>
15408   </listitem>
15409  </varlistentry>
15410  <varlistentry>
15411   <term><parameter>action</parameter></term>
15412   <listitem>
15413    <para>
15414     Function implementing the action
15415    </para>
15416   </listitem>
15417  </varlistentry>
15418  <varlistentry>
15419   <term><parameter>data</parameter></term>
15420   <listitem>
15421    <para>
15422     Pointer to data passed to <parameter>action</parameter> implementation
15423    </para>
15424   </listitem>
15425  </varlistentry>
15426 </variablelist>
15427</refsect1>
15428<refsect1>
15429<title>Description</title>
15430<para>
15431   Removes instance of <parameter>action</parameter> previously added by <function>devm_add_action</function>.
15432   Both action and data should match one of the existing entries.
15433</para>
15434</refsect1>
15435</refentry>
15436
15437<refentry id="API-devm-kmalloc">
15438<refentryinfo>
15439 <title>LINUX</title>
15440 <productname>Kernel Hackers Manual</productname>
15441 <date>July 2017</date>
15442</refentryinfo>
15443<refmeta>
15444 <refentrytitle><phrase>devm_kmalloc</phrase></refentrytitle>
15445 <manvolnum>9</manvolnum>
15446 <refmiscinfo class="version">4.1.27</refmiscinfo>
15447</refmeta>
15448<refnamediv>
15449 <refname>devm_kmalloc</refname>
15450 <refpurpose>
15451     Resource-managed kmalloc
15452 </refpurpose>
15453</refnamediv>
15454<refsynopsisdiv>
15455 <title>Synopsis</title>
15456  <funcsynopsis><funcprototype>
15457   <funcdef>void * <function>devm_kmalloc </function></funcdef>
15458   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15459   <paramdef>size_t <parameter>size</parameter></paramdef>
15460   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
15461  </funcprototype></funcsynopsis>
15462</refsynopsisdiv>
15463<refsect1>
15464 <title>Arguments</title>
15465 <variablelist>
15466  <varlistentry>
15467   <term><parameter>dev</parameter></term>
15468   <listitem>
15469    <para>
15470     Device to allocate memory for
15471    </para>
15472   </listitem>
15473  </varlistentry>
15474  <varlistentry>
15475   <term><parameter>size</parameter></term>
15476   <listitem>
15477    <para>
15478     Allocation size
15479    </para>
15480   </listitem>
15481  </varlistentry>
15482  <varlistentry>
15483   <term><parameter>gfp</parameter></term>
15484   <listitem>
15485    <para>
15486     Allocation gfp flags
15487    </para>
15488   </listitem>
15489  </varlistentry>
15490 </variablelist>
15491</refsect1>
15492<refsect1>
15493<title>Description</title>
15494<para>
15495   Managed kmalloc.  Memory allocated with this function is
15496   automatically freed on driver detach.  Like all other devres
15497   resources, guaranteed alignment is unsigned long long.
15498</para>
15499</refsect1>
15500<refsect1>
15501<title>RETURNS</title>
15502<para>
15503   Pointer to allocated memory on success, NULL on failure.
15504</para>
15505</refsect1>
15506</refentry>
15507
15508<refentry id="API-devm-kstrdup">
15509<refentryinfo>
15510 <title>LINUX</title>
15511 <productname>Kernel Hackers Manual</productname>
15512 <date>July 2017</date>
15513</refentryinfo>
15514<refmeta>
15515 <refentrytitle><phrase>devm_kstrdup</phrase></refentrytitle>
15516 <manvolnum>9</manvolnum>
15517 <refmiscinfo class="version">4.1.27</refmiscinfo>
15518</refmeta>
15519<refnamediv>
15520 <refname>devm_kstrdup</refname>
15521 <refpurpose>
15522     Allocate resource managed space and copy an existing string into that.
15523 </refpurpose>
15524</refnamediv>
15525<refsynopsisdiv>
15526 <title>Synopsis</title>
15527  <funcsynopsis><funcprototype>
15528   <funcdef>char * <function>devm_kstrdup </function></funcdef>
15529   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15530   <paramdef>const char * <parameter>s</parameter></paramdef>
15531   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
15532  </funcprototype></funcsynopsis>
15533</refsynopsisdiv>
15534<refsect1>
15535 <title>Arguments</title>
15536 <variablelist>
15537  <varlistentry>
15538   <term><parameter>dev</parameter></term>
15539   <listitem>
15540    <para>
15541     Device to allocate memory for
15542    </para>
15543   </listitem>
15544  </varlistentry>
15545  <varlistentry>
15546   <term><parameter>s</parameter></term>
15547   <listitem>
15548    <para>
15549     the string to duplicate
15550    </para>
15551   </listitem>
15552  </varlistentry>
15553  <varlistentry>
15554   <term><parameter>gfp</parameter></term>
15555   <listitem>
15556    <para>
15557     the GFP mask used in the <function>devm_kmalloc</function> call when
15558     allocating memory
15559    </para>
15560   </listitem>
15561  </varlistentry>
15562 </variablelist>
15563</refsect1>
15564<refsect1>
15565<title>RETURNS</title>
15566<para>
15567   Pointer to allocated string on success, NULL on failure.
15568</para>
15569</refsect1>
15570</refentry>
15571
15572<refentry id="API-devm-kvasprintf">
15573<refentryinfo>
15574 <title>LINUX</title>
15575 <productname>Kernel Hackers Manual</productname>
15576 <date>July 2017</date>
15577</refentryinfo>
15578<refmeta>
15579 <refentrytitle><phrase>devm_kvasprintf</phrase></refentrytitle>
15580 <manvolnum>9</manvolnum>
15581 <refmiscinfo class="version">4.1.27</refmiscinfo>
15582</refmeta>
15583<refnamediv>
15584 <refname>devm_kvasprintf</refname>
15585 <refpurpose>
15586     Allocate resource managed space and format a string into that.
15587 </refpurpose>
15588</refnamediv>
15589<refsynopsisdiv>
15590 <title>Synopsis</title>
15591  <funcsynopsis><funcprototype>
15592   <funcdef>char * <function>devm_kvasprintf </function></funcdef>
15593   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15594   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
15595   <paramdef>const char * <parameter>fmt</parameter></paramdef>
15596   <paramdef>va_list <parameter>ap</parameter></paramdef>
15597  </funcprototype></funcsynopsis>
15598</refsynopsisdiv>
15599<refsect1>
15600 <title>Arguments</title>
15601 <variablelist>
15602  <varlistentry>
15603   <term><parameter>dev</parameter></term>
15604   <listitem>
15605    <para>
15606     Device to allocate memory for
15607    </para>
15608   </listitem>
15609  </varlistentry>
15610  <varlistentry>
15611   <term><parameter>gfp</parameter></term>
15612   <listitem>
15613    <para>
15614     the GFP mask used in the <function>devm_kmalloc</function> call when
15615     allocating memory
15616    </para>
15617   </listitem>
15618  </varlistentry>
15619  <varlistentry>
15620   <term><parameter>fmt</parameter></term>
15621   <listitem>
15622    <para>
15623     The <function>printf</function>-style format string
15624    </para>
15625   </listitem>
15626  </varlistentry>
15627  <varlistentry>
15628   <term><parameter>ap</parameter></term>
15629   <listitem>
15630    <para>
15631     Arguments for the format string
15632    </para>
15633   </listitem>
15634  </varlistentry>
15635 </variablelist>
15636</refsect1>
15637<refsect1>
15638<title>RETURNS</title>
15639<para>
15640   Pointer to allocated string on success, NULL on failure.
15641</para>
15642</refsect1>
15643</refentry>
15644
15645<refentry id="API-devm-kasprintf">
15646<refentryinfo>
15647 <title>LINUX</title>
15648 <productname>Kernel Hackers Manual</productname>
15649 <date>July 2017</date>
15650</refentryinfo>
15651<refmeta>
15652 <refentrytitle><phrase>devm_kasprintf</phrase></refentrytitle>
15653 <manvolnum>9</manvolnum>
15654 <refmiscinfo class="version">4.1.27</refmiscinfo>
15655</refmeta>
15656<refnamediv>
15657 <refname>devm_kasprintf</refname>
15658 <refpurpose>
15659     Allocate resource managed space and format a string into that.
15660 </refpurpose>
15661</refnamediv>
15662<refsynopsisdiv>
15663 <title>Synopsis</title>
15664  <funcsynopsis><funcprototype>
15665   <funcdef>char * <function>devm_kasprintf </function></funcdef>
15666   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15667   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
15668   <paramdef>const char * <parameter>fmt</parameter></paramdef>
15669   <paramdef> <parameter>...</parameter></paramdef>
15670  </funcprototype></funcsynopsis>
15671</refsynopsisdiv>
15672<refsect1>
15673 <title>Arguments</title>
15674 <variablelist>
15675  <varlistentry>
15676   <term><parameter>dev</parameter></term>
15677   <listitem>
15678    <para>
15679     Device to allocate memory for
15680    </para>
15681   </listitem>
15682  </varlistentry>
15683  <varlistentry>
15684   <term><parameter>gfp</parameter></term>
15685   <listitem>
15686    <para>
15687     the GFP mask used in the <function>devm_kmalloc</function> call when
15688     allocating memory
15689    </para>
15690   </listitem>
15691  </varlistentry>
15692  <varlistentry>
15693   <term><parameter>fmt</parameter></term>
15694   <listitem>
15695    <para>
15696     The <function>printf</function>-style format string
15697     @...: Arguments for the format string
15698    </para>
15699   </listitem>
15700  </varlistentry>
15701  <varlistentry>
15702   <term><parameter>...</parameter></term>
15703   <listitem>
15704    <para>
15705     variable arguments
15706    </para>
15707   </listitem>
15708  </varlistentry>
15709 </variablelist>
15710</refsect1>
15711<refsect1>
15712<title>RETURNS</title>
15713<para>
15714   Pointer to allocated string on success, NULL on failure.
15715</para>
15716</refsect1>
15717</refentry>
15718
15719<refentry id="API-devm-kfree">
15720<refentryinfo>
15721 <title>LINUX</title>
15722 <productname>Kernel Hackers Manual</productname>
15723 <date>July 2017</date>
15724</refentryinfo>
15725<refmeta>
15726 <refentrytitle><phrase>devm_kfree</phrase></refentrytitle>
15727 <manvolnum>9</manvolnum>
15728 <refmiscinfo class="version">4.1.27</refmiscinfo>
15729</refmeta>
15730<refnamediv>
15731 <refname>devm_kfree</refname>
15732 <refpurpose>
15733     Resource-managed kfree
15734 </refpurpose>
15735</refnamediv>
15736<refsynopsisdiv>
15737 <title>Synopsis</title>
15738  <funcsynopsis><funcprototype>
15739   <funcdef>void <function>devm_kfree </function></funcdef>
15740   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15741   <paramdef>void * <parameter>p</parameter></paramdef>
15742  </funcprototype></funcsynopsis>
15743</refsynopsisdiv>
15744<refsect1>
15745 <title>Arguments</title>
15746 <variablelist>
15747  <varlistentry>
15748   <term><parameter>dev</parameter></term>
15749   <listitem>
15750    <para>
15751     Device this memory belongs to
15752    </para>
15753   </listitem>
15754  </varlistentry>
15755  <varlistentry>
15756   <term><parameter>p</parameter></term>
15757   <listitem>
15758    <para>
15759     Memory to free
15760    </para>
15761   </listitem>
15762  </varlistentry>
15763 </variablelist>
15764</refsect1>
15765<refsect1>
15766<title>Description</title>
15767<para>
15768   Free memory allocated with <function>devm_kmalloc</function>.
15769</para>
15770</refsect1>
15771</refentry>
15772
15773<refentry id="API-devm-kmemdup">
15774<refentryinfo>
15775 <title>LINUX</title>
15776 <productname>Kernel Hackers Manual</productname>
15777 <date>July 2017</date>
15778</refentryinfo>
15779<refmeta>
15780 <refentrytitle><phrase>devm_kmemdup</phrase></refentrytitle>
15781 <manvolnum>9</manvolnum>
15782 <refmiscinfo class="version">4.1.27</refmiscinfo>
15783</refmeta>
15784<refnamediv>
15785 <refname>devm_kmemdup</refname>
15786 <refpurpose>
15787     Resource-managed kmemdup
15788 </refpurpose>
15789</refnamediv>
15790<refsynopsisdiv>
15791 <title>Synopsis</title>
15792  <funcsynopsis><funcprototype>
15793   <funcdef>void * <function>devm_kmemdup </function></funcdef>
15794   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15795   <paramdef>const void * <parameter>src</parameter></paramdef>
15796   <paramdef>size_t <parameter>len</parameter></paramdef>
15797   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
15798  </funcprototype></funcsynopsis>
15799</refsynopsisdiv>
15800<refsect1>
15801 <title>Arguments</title>
15802 <variablelist>
15803  <varlistentry>
15804   <term><parameter>dev</parameter></term>
15805   <listitem>
15806    <para>
15807     Device this memory belongs to
15808    </para>
15809   </listitem>
15810  </varlistentry>
15811  <varlistentry>
15812   <term><parameter>src</parameter></term>
15813   <listitem>
15814    <para>
15815     Memory region to duplicate
15816    </para>
15817   </listitem>
15818  </varlistentry>
15819  <varlistentry>
15820   <term><parameter>len</parameter></term>
15821   <listitem>
15822    <para>
15823     Memory region length
15824    </para>
15825   </listitem>
15826  </varlistentry>
15827  <varlistentry>
15828   <term><parameter>gfp</parameter></term>
15829   <listitem>
15830    <para>
15831     GFP mask to use
15832    </para>
15833   </listitem>
15834  </varlistentry>
15835 </variablelist>
15836</refsect1>
15837<refsect1>
15838<title>Description</title>
15839<para>
15840   Duplicate region of a memory using resource managed kmalloc
15841</para>
15842</refsect1>
15843</refentry>
15844
15845<refentry id="API-devm-get-free-pages">
15846<refentryinfo>
15847 <title>LINUX</title>
15848 <productname>Kernel Hackers Manual</productname>
15849 <date>July 2017</date>
15850</refentryinfo>
15851<refmeta>
15852 <refentrytitle><phrase>devm_get_free_pages</phrase></refentrytitle>
15853 <manvolnum>9</manvolnum>
15854 <refmiscinfo class="version">4.1.27</refmiscinfo>
15855</refmeta>
15856<refnamediv>
15857 <refname>devm_get_free_pages</refname>
15858 <refpurpose>
15859     Resource-managed __get_free_pages
15860 </refpurpose>
15861</refnamediv>
15862<refsynopsisdiv>
15863 <title>Synopsis</title>
15864  <funcsynopsis><funcprototype>
15865   <funcdef>unsigned long <function>devm_get_free_pages </function></funcdef>
15866   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15867   <paramdef>gfp_t <parameter>gfp_mask</parameter></paramdef>
15868   <paramdef>unsigned int <parameter>order</parameter></paramdef>
15869  </funcprototype></funcsynopsis>
15870</refsynopsisdiv>
15871<refsect1>
15872 <title>Arguments</title>
15873 <variablelist>
15874  <varlistentry>
15875   <term><parameter>dev</parameter></term>
15876   <listitem>
15877    <para>
15878     Device to allocate memory for
15879    </para>
15880   </listitem>
15881  </varlistentry>
15882  <varlistentry>
15883   <term><parameter>gfp_mask</parameter></term>
15884   <listitem>
15885    <para>
15886     Allocation gfp flags
15887    </para>
15888   </listitem>
15889  </varlistentry>
15890  <varlistentry>
15891   <term><parameter>order</parameter></term>
15892   <listitem>
15893    <para>
15894     Allocation size is (1 &lt;&lt; order) pages
15895    </para>
15896   </listitem>
15897  </varlistentry>
15898 </variablelist>
15899</refsect1>
15900<refsect1>
15901<title>Description</title>
15902<para>
15903   Managed get_free_pages.  Memory allocated with this function is
15904   automatically freed on driver detach.
15905</para>
15906</refsect1>
15907<refsect1>
15908<title>RETURNS</title>
15909<para>
15910   Address of allocated memory on success, 0 on failure.
15911</para>
15912</refsect1>
15913</refentry>
15914
15915<refentry id="API-devm-free-pages">
15916<refentryinfo>
15917 <title>LINUX</title>
15918 <productname>Kernel Hackers Manual</productname>
15919 <date>July 2017</date>
15920</refentryinfo>
15921<refmeta>
15922 <refentrytitle><phrase>devm_free_pages</phrase></refentrytitle>
15923 <manvolnum>9</manvolnum>
15924 <refmiscinfo class="version">4.1.27</refmiscinfo>
15925</refmeta>
15926<refnamediv>
15927 <refname>devm_free_pages</refname>
15928 <refpurpose>
15929     Resource-managed free_pages
15930 </refpurpose>
15931</refnamediv>
15932<refsynopsisdiv>
15933 <title>Synopsis</title>
15934  <funcsynopsis><funcprototype>
15935   <funcdef>void <function>devm_free_pages </function></funcdef>
15936   <paramdef>struct device * <parameter>dev</parameter></paramdef>
15937   <paramdef>unsigned long <parameter>addr</parameter></paramdef>
15938  </funcprototype></funcsynopsis>
15939</refsynopsisdiv>
15940<refsect1>
15941 <title>Arguments</title>
15942 <variablelist>
15943  <varlistentry>
15944   <term><parameter>dev</parameter></term>
15945   <listitem>
15946    <para>
15947     Device this memory belongs to
15948    </para>
15949   </listitem>
15950  </varlistentry>
15951  <varlistentry>
15952   <term><parameter>addr</parameter></term>
15953   <listitem>
15954    <para>
15955     Memory to free
15956    </para>
15957   </listitem>
15958  </varlistentry>
15959 </variablelist>
15960</refsect1>
15961<refsect1>
15962<title>Description</title>
15963<para>
15964   Free memory allocated with <function>devm_get_free_pages</function>. Unlike free_pages,
15965   there is no need to supply the <parameter>order</parameter>.
15966</para>
15967</refsect1>
15968</refentry>
15969
15970     </sect1>
15971
15972  </chapter>
15973
15974  <chapter id="devdrivers">
15975     <title>Device drivers infrastructure</title>
15976     <sect1><title>The Basic Device Driver-Model Structures </title>
15977<!-- include/linux/device.h -->
15978<refentry id="API-struct-bus-type">
15979<refentryinfo>
15980 <title>LINUX</title>
15981 <productname>Kernel Hackers Manual</productname>
15982 <date>July 2017</date>
15983</refentryinfo>
15984<refmeta>
15985 <refentrytitle><phrase>struct bus_type</phrase></refentrytitle>
15986 <manvolnum>9</manvolnum>
15987 <refmiscinfo class="version">4.1.27</refmiscinfo>
15988</refmeta>
15989<refnamediv>
15990 <refname>struct bus_type</refname>
15991 <refpurpose>
15992  The bus type of the device
15993 </refpurpose>
15994</refnamediv>
15995<refsynopsisdiv>
15996 <title>Synopsis</title>
15997  <programlisting>
15998struct bus_type {
15999  const char * name;
16000  const char * dev_name;
16001  struct device * dev_root;
16002  struct device_attribute * dev_attrs;
16003  const struct attribute_group ** bus_groups;
16004  const struct attribute_group ** dev_groups;
16005  const struct attribute_group ** drv_groups;
16006  int (* match) (struct device *dev, struct device_driver *drv);
16007  int (* uevent) (struct device *dev, struct kobj_uevent_env *env);
16008  int (* probe) (struct device *dev);
16009  int (* remove) (struct device *dev);
16010  void (* shutdown) (struct device *dev);
16011  int (* online) (struct device *dev);
16012  int (* offline) (struct device *dev);
16013  int (* suspend) (struct device *dev, pm_message_t state);
16014  int (* resume) (struct device *dev);
16015  const struct dev_pm_ops * pm;
16016  const struct iommu_ops * iommu_ops;
16017  struct subsys_private * p;
16018  struct lock_class_key lock_key;
16019};  </programlisting>
16020</refsynopsisdiv>
16021 <refsect1>
16022  <title>Members</title>
16023  <variablelist>
16024    <varlistentry>      <term>name</term>
16025      <listitem><para>
16026The name of the bus.
16027      </para></listitem>
16028    </varlistentry>
16029    <varlistentry>      <term>dev_name</term>
16030      <listitem><para>
16031Used for subsystems to enumerate devices like ("foo<constant>u</constant>", dev-&gt;id).
16032      </para></listitem>
16033    </varlistentry>
16034    <varlistentry>      <term>dev_root</term>
16035      <listitem><para>
16036Default device to use as the parent.
16037      </para></listitem>
16038    </varlistentry>
16039    <varlistentry>      <term>dev_attrs</term>
16040      <listitem><para>
16041Default attributes of the devices on the bus.
16042      </para></listitem>
16043    </varlistentry>
16044    <varlistentry>      <term>bus_groups</term>
16045      <listitem><para>
16046Default attributes of the bus.
16047      </para></listitem>
16048    </varlistentry>
16049    <varlistentry>      <term>dev_groups</term>
16050      <listitem><para>
16051Default attributes of the devices on the bus.
16052      </para></listitem>
16053    </varlistentry>
16054    <varlistentry>      <term>drv_groups</term>
16055      <listitem><para>
16056Default attributes of the device drivers on the bus.
16057      </para></listitem>
16058    </varlistentry>
16059    <varlistentry>      <term>match</term>
16060      <listitem><para>
16061Called, perhaps multiple times, whenever a new device or driver
16062is added for this bus. It should return a nonzero value if the
16063given device can be handled by the given driver.
16064      </para></listitem>
16065    </varlistentry>
16066    <varlistentry>      <term>uevent</term>
16067      <listitem><para>
16068Called when a device is added, removed, or a few other things
16069that generate uevents to add the environment variables.
16070      </para></listitem>
16071    </varlistentry>
16072    <varlistentry>      <term>probe</term>
16073      <listitem><para>
16074Called when a new device or driver add to this bus, and callback
16075the specific driver's probe to initial the matched device.
16076      </para></listitem>
16077    </varlistentry>
16078    <varlistentry>      <term>remove</term>
16079      <listitem><para>
16080Called when a device removed from this bus.
16081      </para></listitem>
16082    </varlistentry>
16083    <varlistentry>      <term>shutdown</term>
16084      <listitem><para>
16085Called at shut-down time to quiesce the device.
16086      </para></listitem>
16087    </varlistentry>
16088    <varlistentry>      <term>online</term>
16089      <listitem><para>
16090Called to put the device back online (after offlining it).
16091      </para></listitem>
16092    </varlistentry>
16093    <varlistentry>      <term>offline</term>
16094      <listitem><para>
16095Called to put the device offline for hot-removal. May fail.
16096      </para></listitem>
16097    </varlistentry>
16098    <varlistentry>      <term>suspend</term>
16099      <listitem><para>
16100Called when a device on this bus wants to go to sleep mode.
16101      </para></listitem>
16102    </varlistentry>
16103    <varlistentry>      <term>resume</term>
16104      <listitem><para>
16105Called to bring a device on this bus out of sleep mode.
16106      </para></listitem>
16107    </varlistentry>
16108    <varlistentry>      <term>pm</term>
16109      <listitem><para>
16110Power management operations of this bus, callback the specific
16111device driver's pm-ops.
16112      </para></listitem>
16113    </varlistentry>
16114    <varlistentry>      <term>iommu_ops</term>
16115      <listitem><para>
16116IOMMU specific operations for this bus, used to attach IOMMU
16117driver implementations to a bus and allow the driver to do
16118bus-specific setup
16119      </para></listitem>
16120    </varlistentry>
16121    <varlistentry>      <term>p</term>
16122      <listitem><para>
16123The private data of the driver core, only the driver core can
16124touch this.
16125      </para></listitem>
16126    </varlistentry>
16127    <varlistentry>      <term>lock_key</term>
16128      <listitem><para>
16129Lock class key for use by the lock validator
16130      </para></listitem>
16131    </varlistentry>
16132  </variablelist>
16133 </refsect1>
16134<refsect1>
16135<title>Description</title>
16136<para>
16137   A bus is a channel between the processor and one or more devices. For the
16138   purposes of the device model, all devices are connected via a bus, even if
16139   it is an internal, virtual, <quote>platform</quote> bus. Buses can plug into each other.
16140   A USB controller is usually a PCI device, for example. The device model
16141   represents the actual connections between buses and the devices they control.
16142   A bus is represented by the bus_type structure. It contains the name, the
16143   default attributes, the bus' methods, PM operations, and the driver core's
16144   private data.
16145</para>
16146</refsect1>
16147</refentry>
16148
16149<refentry id="API-struct-device-driver">
16150<refentryinfo>
16151 <title>LINUX</title>
16152 <productname>Kernel Hackers Manual</productname>
16153 <date>July 2017</date>
16154</refentryinfo>
16155<refmeta>
16156 <refentrytitle><phrase>struct device_driver</phrase></refentrytitle>
16157 <manvolnum>9</manvolnum>
16158 <refmiscinfo class="version">4.1.27</refmiscinfo>
16159</refmeta>
16160<refnamediv>
16161 <refname>struct device_driver</refname>
16162 <refpurpose>
16163     The basic device driver structure
16164 </refpurpose>
16165</refnamediv>
16166<refsynopsisdiv>
16167 <title>Synopsis</title>
16168  <programlisting>
16169struct device_driver {
16170  const char * name;
16171  struct bus_type * bus;
16172  struct module * owner;
16173  const char * mod_name;
16174  bool suppress_bind_attrs;
16175  const struct of_device_id * of_match_table;
16176  const struct acpi_device_id * acpi_match_table;
16177  int (* probe) (struct device *dev);
16178  int (* remove) (struct device *dev);
16179  void (* shutdown) (struct device *dev);
16180  int (* suspend) (struct device *dev, pm_message_t state);
16181  int (* resume) (struct device *dev);
16182  const struct attribute_group ** groups;
16183  const struct dev_pm_ops * pm;
16184  struct driver_private * p;
16185};  </programlisting>
16186</refsynopsisdiv>
16187 <refsect1>
16188  <title>Members</title>
16189  <variablelist>
16190    <varlistentry>      <term>name</term>
16191      <listitem><para>
16192   Name of the device driver.
16193      </para></listitem>
16194    </varlistentry>
16195    <varlistentry>      <term>bus</term>
16196      <listitem><para>
16197   The bus which the device of this driver belongs to.
16198      </para></listitem>
16199    </varlistentry>
16200    <varlistentry>      <term>owner</term>
16201      <listitem><para>
16202   The module owner.
16203      </para></listitem>
16204    </varlistentry>
16205    <varlistentry>      <term>mod_name</term>
16206      <listitem><para>
16207   Used for built-in modules.
16208      </para></listitem>
16209    </varlistentry>
16210    <varlistentry>      <term>suppress_bind_attrs</term>
16211      <listitem><para>
16212   Disables bind/unbind via sysfs.
16213      </para></listitem>
16214    </varlistentry>
16215    <varlistentry>      <term>of_match_table</term>
16216      <listitem><para>
16217   The open firmware table.
16218      </para></listitem>
16219    </varlistentry>
16220    <varlistentry>      <term>acpi_match_table</term>
16221      <listitem><para>
16222   The ACPI match table.
16223      </para></listitem>
16224    </varlistentry>
16225    <varlistentry>      <term>probe</term>
16226      <listitem><para>
16227   Called to query the existence of a specific device,
16228   whether this driver can work with it, and bind the driver
16229   to a specific device.
16230      </para></listitem>
16231    </varlistentry>
16232    <varlistentry>      <term>remove</term>
16233      <listitem><para>
16234   Called when the device is removed from the system to
16235   unbind a device from this driver.
16236      </para></listitem>
16237    </varlistentry>
16238    <varlistentry>      <term>shutdown</term>
16239      <listitem><para>
16240   Called at shut-down time to quiesce the device.
16241      </para></listitem>
16242    </varlistentry>
16243    <varlistentry>      <term>suspend</term>
16244      <listitem><para>
16245   Called to put the device to sleep mode. Usually to a
16246   low power state.
16247      </para></listitem>
16248    </varlistentry>
16249    <varlistentry>      <term>resume</term>
16250      <listitem><para>
16251   Called to bring a device from sleep mode.
16252      </para></listitem>
16253    </varlistentry>
16254    <varlistentry>      <term>groups</term>
16255      <listitem><para>
16256   Default attributes that get created by the driver core
16257   automatically.
16258      </para></listitem>
16259    </varlistentry>
16260    <varlistentry>      <term>pm</term>
16261      <listitem><para>
16262   Power management operations of the device which matched
16263   this driver.
16264      </para></listitem>
16265    </varlistentry>
16266    <varlistentry>      <term>p</term>
16267      <listitem><para>
16268   Driver core's private data, no one other than the driver
16269   core can touch this.
16270      </para></listitem>
16271    </varlistentry>
16272  </variablelist>
16273 </refsect1>
16274<refsect1>
16275<title>Description</title>
16276<para>
16277   The device driver-model tracks all of the drivers known to the system.
16278   The main reason for this tracking is to enable the driver core to match
16279   up drivers with new devices. Once drivers are known objects within the
16280   system, however, a number of other things become possible. Device drivers
16281   can export information and configuration variables that are independent
16282   of any specific device.
16283</para>
16284</refsect1>
16285</refentry>
16286
16287<refentry id="API-struct-subsys-interface">
16288<refentryinfo>
16289 <title>LINUX</title>
16290 <productname>Kernel Hackers Manual</productname>
16291 <date>July 2017</date>
16292</refentryinfo>
16293<refmeta>
16294 <refentrytitle><phrase>struct subsys_interface</phrase></refentrytitle>
16295 <manvolnum>9</manvolnum>
16296 <refmiscinfo class="version">4.1.27</refmiscinfo>
16297</refmeta>
16298<refnamediv>
16299 <refname>struct subsys_interface</refname>
16300 <refpurpose>
16301     interfaces to device functions
16302 </refpurpose>
16303</refnamediv>
16304<refsynopsisdiv>
16305 <title>Synopsis</title>
16306  <programlisting>
16307struct subsys_interface {
16308  const char * name;
16309  struct bus_type * subsys;
16310  struct list_head node;
16311  int (* add_dev) (struct device *dev, struct subsys_interface *sif);
16312  int (* remove_dev) (struct device *dev, struct subsys_interface *sif);
16313};  </programlisting>
16314</refsynopsisdiv>
16315 <refsect1>
16316  <title>Members</title>
16317  <variablelist>
16318    <varlistentry>      <term>name</term>
16319      <listitem><para>
16320   name of the device function
16321      </para></listitem>
16322    </varlistentry>
16323    <varlistentry>      <term>subsys</term>
16324      <listitem><para>
16325   subsytem of the devices to attach to
16326      </para></listitem>
16327    </varlistentry>
16328    <varlistentry>      <term>node</term>
16329      <listitem><para>
16330   the list of functions registered at the subsystem
16331      </para></listitem>
16332    </varlistentry>
16333    <varlistentry>      <term>add_dev</term>
16334      <listitem><para>
16335   device hookup to device function handler
16336      </para></listitem>
16337    </varlistentry>
16338    <varlistentry>      <term>remove_dev</term>
16339      <listitem><para>
16340   device hookup to device function handler
16341      </para></listitem>
16342    </varlistentry>
16343  </variablelist>
16344 </refsect1>
16345<refsect1>
16346<title>Description</title>
16347<para>
16348   Simple interfaces attached to a subsystem. Multiple interfaces can
16349   attach to a subsystem and its devices. Unlike drivers, they do not
16350   exclusively claim or control devices. Interfaces usually represent
16351   a specific functionality of a subsystem/class of devices.
16352</para>
16353</refsect1>
16354</refentry>
16355
16356<refentry id="API-struct-class">
16357<refentryinfo>
16358 <title>LINUX</title>
16359 <productname>Kernel Hackers Manual</productname>
16360 <date>July 2017</date>
16361</refentryinfo>
16362<refmeta>
16363 <refentrytitle><phrase>struct class</phrase></refentrytitle>
16364 <manvolnum>9</manvolnum>
16365 <refmiscinfo class="version">4.1.27</refmiscinfo>
16366</refmeta>
16367<refnamediv>
16368 <refname>struct class</refname>
16369 <refpurpose>
16370     device classes
16371 </refpurpose>
16372</refnamediv>
16373<refsynopsisdiv>
16374 <title>Synopsis</title>
16375  <programlisting>
16376struct class {
16377  const char * name;
16378  struct module * owner;
16379  struct class_attribute * class_attrs;
16380  const struct attribute_group ** dev_groups;
16381  struct kobject * dev_kobj;
16382  int (* dev_uevent) (struct device *dev, struct kobj_uevent_env *env);
16383  char *(* devnode) (struct device *dev, umode_t *mode);
16384  void (* class_release) (struct class *class);
16385  void (* dev_release) (struct device *dev);
16386  int (* suspend) (struct device *dev, pm_message_t state);
16387  int (* resume) (struct device *dev);
16388  const struct kobj_ns_type_operations * ns_type;
16389  const void *(* namespace) (struct device *dev);
16390  const struct dev_pm_ops * pm;
16391  struct subsys_private * p;
16392};  </programlisting>
16393</refsynopsisdiv>
16394 <refsect1>
16395  <title>Members</title>
16396  <variablelist>
16397    <varlistentry>      <term>name</term>
16398      <listitem><para>
16399   Name of the class.
16400      </para></listitem>
16401    </varlistentry>
16402    <varlistentry>      <term>owner</term>
16403      <listitem><para>
16404   The module owner.
16405      </para></listitem>
16406    </varlistentry>
16407    <varlistentry>      <term>class_attrs</term>
16408      <listitem><para>
16409   Default attributes of this class.
16410      </para></listitem>
16411    </varlistentry>
16412    <varlistentry>      <term>dev_groups</term>
16413      <listitem><para>
16414   Default attributes of the devices that belong to the class.
16415      </para></listitem>
16416    </varlistentry>
16417    <varlistentry>      <term>dev_kobj</term>
16418      <listitem><para>
16419   The kobject that represents this class and links it into the hierarchy.
16420      </para></listitem>
16421    </varlistentry>
16422    <varlistentry>      <term>dev_uevent</term>
16423      <listitem><para>
16424   Called when a device is added, removed from this class, or a
16425   few other things that generate uevents to add the environment
16426   variables.
16427      </para></listitem>
16428    </varlistentry>
16429    <varlistentry>      <term>devnode</term>
16430      <listitem><para>
16431   Callback to provide the devtmpfs.
16432      </para></listitem>
16433    </varlistentry>
16434    <varlistentry>      <term>class_release</term>
16435      <listitem><para>
16436   Called to release this class.
16437      </para></listitem>
16438    </varlistentry>
16439    <varlistentry>      <term>dev_release</term>
16440      <listitem><para>
16441   Called to release the device.
16442      </para></listitem>
16443    </varlistentry>
16444    <varlistentry>      <term>suspend</term>
16445      <listitem><para>
16446   Used to put the device to sleep mode, usually to a low power
16447   state.
16448      </para></listitem>
16449    </varlistentry>
16450    <varlistentry>      <term>resume</term>
16451      <listitem><para>
16452   Used to bring the device from the sleep mode.
16453      </para></listitem>
16454    </varlistentry>
16455    <varlistentry>      <term>ns_type</term>
16456      <listitem><para>
16457   Callbacks so sysfs can detemine namespaces.
16458      </para></listitem>
16459    </varlistentry>
16460    <varlistentry>      <term>namespace</term>
16461      <listitem><para>
16462   Namespace of the device belongs to this class.
16463      </para></listitem>
16464    </varlistentry>
16465    <varlistentry>      <term>pm</term>
16466      <listitem><para>
16467   The default device power management operations of this class.
16468      </para></listitem>
16469    </varlistentry>
16470    <varlistentry>      <term>p</term>
16471      <listitem><para>
16472   The private data of the driver core, no one other than the
16473   driver core can touch this.
16474      </para></listitem>
16475    </varlistentry>
16476  </variablelist>
16477 </refsect1>
16478<refsect1>
16479<title>Description</title>
16480<para>
16481   A class is a higher-level view of a device that abstracts out low-level
16482   implementation details. Drivers may see a SCSI disk or an ATA disk, but,
16483   at the class level, they are all simply disks. Classes allow user space
16484   to work with devices based on what they do, rather than how they are
16485   connected or how they work.
16486</para>
16487</refsect1>
16488</refentry>
16489
16490<refentry id="API-struct-device">
16491<refentryinfo>
16492 <title>LINUX</title>
16493 <productname>Kernel Hackers Manual</productname>
16494 <date>July 2017</date>
16495</refentryinfo>
16496<refmeta>
16497 <refentrytitle><phrase>struct device</phrase></refentrytitle>
16498 <manvolnum>9</manvolnum>
16499 <refmiscinfo class="version">4.1.27</refmiscinfo>
16500</refmeta>
16501<refnamediv>
16502 <refname>struct device</refname>
16503 <refpurpose>
16504     The basic device structure
16505 </refpurpose>
16506</refnamediv>
16507<refsynopsisdiv>
16508 <title>Synopsis</title>
16509  <programlisting>
16510struct device {
16511  struct device * parent;
16512  struct device_private * p;
16513  struct kobject kobj;
16514  const char * init_name;
16515  const struct device_type * type;
16516  struct mutex mutex;
16517  struct bus_type * bus;
16518  struct device_driver * driver;
16519  void * platform_data;
16520  void * driver_data;
16521  struct dev_pm_info power;
16522  struct dev_pm_domain * pm_domain;
16523#ifdef CONFIG_PINCTRL
16524  struct dev_pin_info * pins;
16525#endif
16526#ifdef CONFIG_NUMA
16527  int numa_node;
16528#endif
16529  u64 * dma_mask;
16530  u64 coherent_dma_mask;
16531  unsigned long dma_pfn_offset;
16532  struct device_dma_parameters * dma_parms;
16533  struct list_head dma_pools;
16534  struct dma_coherent_mem * dma_mem;
16535#ifdef CONFIG_DMA_CMA
16536  struct cma * cma_area;
16537#endif
16538  struct dev_archdata archdata;
16539  struct device_node * of_node;
16540  struct fwnode_handle * fwnode;
16541  dev_t devt;
16542  u32 id;
16543  spinlock_t devres_lock;
16544  struct list_head devres_head;
16545  struct klist_node knode_class;
16546  struct class * class;
16547  const struct attribute_group ** groups;
16548  void (* release) (struct device *dev);
16549  struct iommu_group * iommu_group;
16550  bool offline_disabled:1;
16551  bool offline:1;
16552};  </programlisting>
16553</refsynopsisdiv>
16554 <refsect1>
16555  <title>Members</title>
16556  <variablelist>
16557    <varlistentry>      <term>parent</term>
16558      <listitem><para>
16559   The device's <quote>parent</quote> device, the device to which it is attached.
16560   In most cases, a parent device is some sort of bus or host
16561   controller. If parent is NULL, the device, is a top-level device,
16562   which is not usually what you want.
16563      </para></listitem>
16564    </varlistentry>
16565    <varlistentry>      <term>p</term>
16566      <listitem><para>
16567   Holds the private data of the driver core portions of the device.
16568   See the comment of the struct device_private for detail.
16569      </para></listitem>
16570    </varlistentry>
16571    <varlistentry>      <term>kobj</term>
16572      <listitem><para>
16573   A top-level, abstract class from which other classes are derived.
16574      </para></listitem>
16575    </varlistentry>
16576    <varlistentry>      <term>init_name</term>
16577      <listitem><para>
16578   Initial name of the device.
16579      </para></listitem>
16580    </varlistentry>
16581    <varlistentry>      <term>type</term>
16582      <listitem><para>
16583   The type of device.
16584   This identifies the device type and carries type-specific
16585   information.
16586      </para></listitem>
16587    </varlistentry>
16588    <varlistentry>      <term>mutex</term>
16589      <listitem><para>
16590   Mutex to synchronize calls to its driver.
16591      </para></listitem>
16592    </varlistentry>
16593    <varlistentry>      <term>bus</term>
16594      <listitem><para>
16595   Type of bus device is on.
16596      </para></listitem>
16597    </varlistentry>
16598    <varlistentry>      <term>driver</term>
16599      <listitem><para>
16600   Which driver has allocated this
16601      </para></listitem>
16602    </varlistentry>
16603    <varlistentry>      <term>platform_data</term>
16604      <listitem><para>
16605   Platform data specific to the device.
16606      </para></listitem>
16607    </varlistentry>
16608    <varlistentry>      <term>driver_data</term>
16609      <listitem><para>
16610   Private pointer for driver specific info.
16611      </para></listitem>
16612    </varlistentry>
16613    <varlistentry>      <term>power</term>
16614      <listitem><para>
16615   For device power management.
16616   See Documentation/power/devices.txt for details.
16617      </para></listitem>
16618    </varlistentry>
16619    <varlistentry>      <term>pm_domain</term>
16620      <listitem><para>
16621   Provide callbacks that are executed during system suspend,
16622   hibernation, system resume and during runtime PM transitions
16623   along with subsystem-level and driver-level callbacks.
16624      </para></listitem>
16625    </varlistentry>
16626    <varlistentry>      <term>pins</term>
16627      <listitem><para>
16628   For device pin management.
16629   See Documentation/pinctrl.txt for details.
16630      </para></listitem>
16631    </varlistentry>
16632    <varlistentry>      <term>numa_node</term>
16633      <listitem><para>
16634   NUMA node this device is close to.
16635      </para></listitem>
16636    </varlistentry>
16637    <varlistentry>      <term>dma_mask</term>
16638      <listitem><para>
16639   Dma mask (if dma'ble device).
16640      </para></listitem>
16641    </varlistentry>
16642    <varlistentry>      <term>coherent_dma_mask</term>
16643      <listitem><para>
16644   Like dma_mask, but for alloc_coherent mapping as not all
16645   hardware supports 64-bit addresses for consistent allocations
16646   such descriptors.
16647      </para></listitem>
16648    </varlistentry>
16649    <varlistentry>      <term>dma_pfn_offset</term>
16650      <listitem><para>
16651   offset of DMA memory range relatively of RAM
16652      </para></listitem>
16653    </varlistentry>
16654    <varlistentry>      <term>dma_parms</term>
16655      <listitem><para>
16656   A low level driver may set these to teach IOMMU code about
16657   segment limitations.
16658      </para></listitem>
16659    </varlistentry>
16660    <varlistentry>      <term>dma_pools</term>
16661      <listitem><para>
16662   Dma pools (if dma'ble device).
16663      </para></listitem>
16664    </varlistentry>
16665    <varlistentry>      <term>dma_mem</term>
16666      <listitem><para>
16667   Internal for coherent mem override.
16668      </para></listitem>
16669    </varlistentry>
16670    <varlistentry>      <term>cma_area</term>
16671      <listitem><para>
16672   Contiguous memory area for dma allocations
16673      </para></listitem>
16674    </varlistentry>
16675    <varlistentry>      <term>archdata</term>
16676      <listitem><para>
16677   For arch-specific additions.
16678      </para></listitem>
16679    </varlistentry>
16680    <varlistentry>      <term>of_node</term>
16681      <listitem><para>
16682   Associated device tree node.
16683      </para></listitem>
16684    </varlistentry>
16685    <varlistentry>      <term>fwnode</term>
16686      <listitem><para>
16687   Associated device node supplied by platform firmware.
16688      </para></listitem>
16689    </varlistentry>
16690    <varlistentry>      <term>devt</term>
16691      <listitem><para>
16692   For creating the sysfs <quote>dev</quote>.
16693      </para></listitem>
16694    </varlistentry>
16695    <varlistentry>      <term>id</term>
16696      <listitem><para>
16697   device instance
16698      </para></listitem>
16699    </varlistentry>
16700    <varlistentry>      <term>devres_lock</term>
16701      <listitem><para>
16702   Spinlock to protect the resource of the device.
16703      </para></listitem>
16704    </varlistentry>
16705    <varlistentry>      <term>devres_head</term>
16706      <listitem><para>
16707   The resources list of the device.
16708      </para></listitem>
16709    </varlistentry>
16710    <varlistentry>      <term>knode_class</term>
16711      <listitem><para>
16712   The node used to add the device to the class list.
16713      </para></listitem>
16714    </varlistentry>
16715    <varlistentry>      <term>class</term>
16716      <listitem><para>
16717   The class of the device.
16718      </para></listitem>
16719    </varlistentry>
16720    <varlistentry>      <term>groups</term>
16721      <listitem><para>
16722   Optional attribute groups.
16723      </para></listitem>
16724    </varlistentry>
16725    <varlistentry>      <term>release</term>
16726      <listitem><para>
16727   Callback to free the device after all references have
16728   gone away. This should be set by the allocator of the
16729   device (i.e. the bus driver that discovered the device).
16730      </para></listitem>
16731    </varlistentry>
16732    <varlistentry>      <term>iommu_group</term>
16733      <listitem><para>
16734   IOMMU group the device belongs to.
16735      </para></listitem>
16736    </varlistentry>
16737    <varlistentry>      <term>offline_disabled</term>
16738      <listitem><para>
16739   If set, the device is permanently online.
16740      </para></listitem>
16741    </varlistentry>
16742    <varlistentry>      <term>offline</term>
16743      <listitem><para>
16744   Set after successful invocation of bus type's .<function>offline</function>.
16745      </para></listitem>
16746    </varlistentry>
16747  </variablelist>
16748 </refsect1>
16749<refsect1>
16750<title>Example</title>
16751<informalexample><programlisting>
16752   For devices on custom boards, as typical of embedded
16753   		and SOC based hardware, Linux often uses platform_data to point
16754   		to board-specific structures describing devices and how they
16755   		are wired.  That can include what ports are available, chip
16756   		variants, which GPIO pins act in what additional roles, and so
16757   		on.  This shrinks the <quote>Board Support Packages</quote> (BSPs) and
16758   		minimizes board-specific #ifdefs in drivers.
16759</programlisting></informalexample>
16760</refsect1>
16761<refsect1>
16762<title>Description</title>
16763<para>
16764   At the lowest level, every device in a Linux system is represented by an
16765   instance of struct device. The device structure contains the information
16766   that the device model core needs to model the system. Most subsystems,
16767   however, track additional information about the devices they host. As a
16768   result, it is rare for devices to be represented by bare device structures;
16769   instead, that structure, like kobject structures, is usually embedded within
16770   a higher-level representation of the device.
16771</para>
16772</refsect1>
16773</refentry>
16774
16775<refentry id="API-module-driver">
16776<refentryinfo>
16777 <title>LINUX</title>
16778 <productname>Kernel Hackers Manual</productname>
16779 <date>July 2017</date>
16780</refentryinfo>
16781<refmeta>
16782 <refentrytitle><phrase>module_driver</phrase></refentrytitle>
16783 <manvolnum>9</manvolnum>
16784 <refmiscinfo class="version">4.1.27</refmiscinfo>
16785</refmeta>
16786<refnamediv>
16787 <refname>module_driver</refname>
16788 <refpurpose>
16789     Helper macro for drivers that don't do anything special in module init/exit. This eliminates a lot of boilerplate. Each module may only use this macro once, and calling it replaces <function>module_init</function> and <function>module_exit</function>.
16790 </refpurpose>
16791</refnamediv>
16792<refsynopsisdiv>
16793 <title>Synopsis</title>
16794  <funcsynopsis><funcprototype>
16795   <funcdef> <function>module_driver </function></funcdef>
16796   <paramdef> <parameter>__driver</parameter></paramdef>
16797   <paramdef> <parameter>__register</parameter></paramdef>
16798   <paramdef> <parameter>__unregister</parameter></paramdef>
16799   <paramdef> <parameter>...</parameter></paramdef>
16800  </funcprototype></funcsynopsis>
16801</refsynopsisdiv>
16802<refsect1>
16803 <title>Arguments</title>
16804 <variablelist>
16805  <varlistentry>
16806   <term><parameter>__driver</parameter></term>
16807   <listitem>
16808    <para>
16809     driver name
16810    </para>
16811   </listitem>
16812  </varlistentry>
16813  <varlistentry>
16814   <term><parameter>__register</parameter></term>
16815   <listitem>
16816    <para>
16817     register function for this driver type
16818    </para>
16819   </listitem>
16820  </varlistentry>
16821  <varlistentry>
16822   <term><parameter>__unregister</parameter></term>
16823   <listitem>
16824    <para>
16825     unregister function for this driver type
16826     @...: Additional arguments to be passed to __register and __unregister.
16827    </para>
16828   </listitem>
16829  </varlistentry>
16830  <varlistentry>
16831   <term><parameter>...</parameter></term>
16832   <listitem>
16833    <para>
16834     variable arguments
16835    </para>
16836   </listitem>
16837  </varlistentry>
16838 </variablelist>
16839</refsect1>
16840<refsect1>
16841<title>Description</title>
16842<para>
16843   Use this macro to construct bus specific macros for registering
16844   drivers, and do not use it on its own.
16845</para>
16846</refsect1>
16847</refentry>
16848
16849     </sect1>
16850     <sect1><title>Device Drivers Base</title>
16851<!-- drivers/base/init.c -->
16852<refentry id="API-driver-init">
16853<refentryinfo>
16854 <title>LINUX</title>
16855 <productname>Kernel Hackers Manual</productname>
16856 <date>July 2017</date>
16857</refentryinfo>
16858<refmeta>
16859 <refentrytitle><phrase>driver_init</phrase></refentrytitle>
16860 <manvolnum>9</manvolnum>
16861 <refmiscinfo class="version">4.1.27</refmiscinfo>
16862</refmeta>
16863<refnamediv>
16864 <refname>driver_init</refname>
16865 <refpurpose>
16866  initialize driver model.
16867 </refpurpose>
16868</refnamediv>
16869<refsynopsisdiv>
16870 <title>Synopsis</title>
16871  <funcsynopsis><funcprototype>
16872   <funcdef>void <function>driver_init </function></funcdef>
16873   <paramdef> <parameter>void</parameter></paramdef>
16874  </funcprototype></funcsynopsis>
16875</refsynopsisdiv>
16876<refsect1>
16877 <title>Arguments</title>
16878 <variablelist>
16879  <varlistentry>
16880   <term><parameter>void</parameter></term>
16881   <listitem>
16882    <para>
16883     no arguments
16884    </para>
16885   </listitem>
16886  </varlistentry>
16887 </variablelist>
16888</refsect1>
16889<refsect1>
16890<title>Description</title>
16891<para>
16892   </para><para>
16893
16894   Call the driver model init functions to initialize their
16895   subsystems. Called early from init/main.c.
16896</para>
16897</refsect1>
16898</refentry>
16899
16900<!-- drivers/base/driver.c -->
16901<refentry id="API-driver-for-each-device">
16902<refentryinfo>
16903 <title>LINUX</title>
16904 <productname>Kernel Hackers Manual</productname>
16905 <date>July 2017</date>
16906</refentryinfo>
16907<refmeta>
16908 <refentrytitle><phrase>driver_for_each_device</phrase></refentrytitle>
16909 <manvolnum>9</manvolnum>
16910 <refmiscinfo class="version">4.1.27</refmiscinfo>
16911</refmeta>
16912<refnamediv>
16913 <refname>driver_for_each_device</refname>
16914 <refpurpose>
16915  Iterator for devices bound to a driver.
16916 </refpurpose>
16917</refnamediv>
16918<refsynopsisdiv>
16919 <title>Synopsis</title>
16920  <funcsynopsis><funcprototype>
16921   <funcdef>int <function>driver_for_each_device </function></funcdef>
16922   <paramdef>struct device_driver * <parameter>drv</parameter></paramdef>
16923   <paramdef>struct device * <parameter>start</parameter></paramdef>
16924   <paramdef>void * <parameter>data</parameter></paramdef>
16925   <paramdef>int (*<parameter>fn</parameter>)
16926     <funcparams>struct device *, void *</funcparams></paramdef>
16927  </funcprototype></funcsynopsis>
16928</refsynopsisdiv>
16929<refsect1>
16930 <title>Arguments</title>
16931 <variablelist>
16932  <varlistentry>
16933   <term><parameter>drv</parameter></term>
16934   <listitem>
16935    <para>
16936     Driver we're iterating.
16937    </para>
16938   </listitem>
16939  </varlistentry>
16940  <varlistentry>
16941   <term><parameter>start</parameter></term>
16942   <listitem>
16943    <para>
16944     Device to begin with
16945    </para>
16946   </listitem>
16947  </varlistentry>
16948  <varlistentry>
16949   <term><parameter>data</parameter></term>
16950   <listitem>
16951    <para>
16952     Data to pass to the callback.
16953    </para>
16954   </listitem>
16955  </varlistentry>
16956  <varlistentry>
16957   <term><parameter>fn</parameter></term>
16958   <listitem>
16959    <para>
16960     Function to call for each device.
16961    </para>
16962   </listitem>
16963  </varlistentry>
16964 </variablelist>
16965</refsect1>
16966<refsect1>
16967<title>Description</title>
16968<para>
16969   Iterate over the <parameter>drv</parameter>'s list of devices calling <parameter>fn</parameter> for each one.
16970</para>
16971</refsect1>
16972</refentry>
16973
16974<refentry id="API-driver-find-device">
16975<refentryinfo>
16976 <title>LINUX</title>
16977 <productname>Kernel Hackers Manual</productname>
16978 <date>July 2017</date>
16979</refentryinfo>
16980<refmeta>
16981 <refentrytitle><phrase>driver_find_device</phrase></refentrytitle>
16982 <manvolnum>9</manvolnum>
16983 <refmiscinfo class="version">4.1.27</refmiscinfo>
16984</refmeta>
16985<refnamediv>
16986 <refname>driver_find_device</refname>
16987 <refpurpose>
16988     device iterator for locating a particular device.
16989 </refpurpose>
16990</refnamediv>
16991<refsynopsisdiv>
16992 <title>Synopsis</title>
16993  <funcsynopsis><funcprototype>
16994   <funcdef>struct device * <function>driver_find_device </function></funcdef>
16995   <paramdef>struct device_driver * <parameter>drv</parameter></paramdef>
16996   <paramdef>struct device * <parameter>start</parameter></paramdef>
16997   <paramdef>void * <parameter>data</parameter></paramdef>
16998   <paramdef>int (*<parameter>match</parameter>)
16999     <funcparams>struct device *dev, void *data</funcparams></paramdef>
17000  </funcprototype></funcsynopsis>
17001</refsynopsisdiv>
17002<refsect1>
17003 <title>Arguments</title>
17004 <variablelist>
17005  <varlistentry>
17006   <term><parameter>drv</parameter></term>
17007   <listitem>
17008    <para>
17009     The device's driver
17010    </para>
17011   </listitem>
17012  </varlistentry>
17013  <varlistentry>
17014   <term><parameter>start</parameter></term>
17015   <listitem>
17016    <para>
17017     Device to begin with
17018    </para>
17019   </listitem>
17020  </varlistentry>
17021  <varlistentry>
17022   <term><parameter>data</parameter></term>
17023   <listitem>
17024    <para>
17025     Data to pass to match function
17026    </para>
17027   </listitem>
17028  </varlistentry>
17029  <varlistentry>
17030   <term><parameter>match</parameter></term>
17031   <listitem>
17032    <para>
17033     Callback function to check device
17034    </para>
17035   </listitem>
17036  </varlistentry>
17037 </variablelist>
17038</refsect1>
17039<refsect1>
17040<title>Description</title>
17041<para>
17042   This is similar to the <function>driver_for_each_device</function> function above, but
17043   it returns a reference to a device that is 'found' for later use, as
17044   determined by the <parameter>match</parameter> callback.
17045   </para><para>
17046
17047   The callback should return 0 if the device doesn't match and non-zero
17048   if it does.  If the callback returns non-zero, this function will
17049   return to the caller and not iterate over any more devices.
17050</para>
17051</refsect1>
17052</refentry>
17053
17054<refentry id="API-driver-create-file">
17055<refentryinfo>
17056 <title>LINUX</title>
17057 <productname>Kernel Hackers Manual</productname>
17058 <date>July 2017</date>
17059</refentryinfo>
17060<refmeta>
17061 <refentrytitle><phrase>driver_create_file</phrase></refentrytitle>
17062 <manvolnum>9</manvolnum>
17063 <refmiscinfo class="version">4.1.27</refmiscinfo>
17064</refmeta>
17065<refnamediv>
17066 <refname>driver_create_file</refname>
17067 <refpurpose>
17068     create sysfs file for driver.
17069 </refpurpose>
17070</refnamediv>
17071<refsynopsisdiv>
17072 <title>Synopsis</title>
17073  <funcsynopsis><funcprototype>
17074   <funcdef>int <function>driver_create_file </function></funcdef>
17075   <paramdef>struct device_driver * <parameter>drv</parameter></paramdef>
17076   <paramdef>const struct driver_attribute * <parameter>attr</parameter></paramdef>
17077  </funcprototype></funcsynopsis>
17078</refsynopsisdiv>
17079<refsect1>
17080 <title>Arguments</title>
17081 <variablelist>
17082  <varlistentry>
17083   <term><parameter>drv</parameter></term>
17084   <listitem>
17085    <para>
17086     driver.
17087    </para>
17088   </listitem>
17089  </varlistentry>
17090  <varlistentry>
17091   <term><parameter>attr</parameter></term>
17092   <listitem>
17093    <para>
17094     driver attribute descriptor.
17095    </para>
17096   </listitem>
17097  </varlistentry>
17098 </variablelist>
17099</refsect1>
17100</refentry>
17101
17102<refentry id="API-driver-remove-file">
17103<refentryinfo>
17104 <title>LINUX</title>
17105 <productname>Kernel Hackers Manual</productname>
17106 <date>July 2017</date>
17107</refentryinfo>
17108<refmeta>
17109 <refentrytitle><phrase>driver_remove_file</phrase></refentrytitle>
17110 <manvolnum>9</manvolnum>
17111 <refmiscinfo class="version">4.1.27</refmiscinfo>
17112</refmeta>
17113<refnamediv>
17114 <refname>driver_remove_file</refname>
17115 <refpurpose>
17116     remove sysfs file for driver.
17117 </refpurpose>
17118</refnamediv>
17119<refsynopsisdiv>
17120 <title>Synopsis</title>
17121  <funcsynopsis><funcprototype>
17122   <funcdef>void <function>driver_remove_file </function></funcdef>
17123   <paramdef>struct device_driver * <parameter>drv</parameter></paramdef>
17124   <paramdef>const struct driver_attribute * <parameter>attr</parameter></paramdef>
17125  </funcprototype></funcsynopsis>
17126</refsynopsisdiv>
17127<refsect1>
17128 <title>Arguments</title>
17129 <variablelist>
17130  <varlistentry>
17131   <term><parameter>drv</parameter></term>
17132   <listitem>
17133    <para>
17134     driver.
17135    </para>
17136   </listitem>
17137  </varlistentry>
17138  <varlistentry>
17139   <term><parameter>attr</parameter></term>
17140   <listitem>
17141    <para>
17142     driver attribute descriptor.
17143    </para>
17144   </listitem>
17145  </varlistentry>
17146 </variablelist>
17147</refsect1>
17148</refentry>
17149
17150<refentry id="API-driver-register">
17151<refentryinfo>
17152 <title>LINUX</title>
17153 <productname>Kernel Hackers Manual</productname>
17154 <date>July 2017</date>
17155</refentryinfo>
17156<refmeta>
17157 <refentrytitle><phrase>driver_register</phrase></refentrytitle>
17158 <manvolnum>9</manvolnum>
17159 <refmiscinfo class="version">4.1.27</refmiscinfo>
17160</refmeta>
17161<refnamediv>
17162 <refname>driver_register</refname>
17163 <refpurpose>
17164     register driver with bus
17165 </refpurpose>
17166</refnamediv>
17167<refsynopsisdiv>
17168 <title>Synopsis</title>
17169  <funcsynopsis><funcprototype>
17170   <funcdef>int <function>driver_register </function></funcdef>
17171   <paramdef>struct device_driver * <parameter>drv</parameter></paramdef>
17172  </funcprototype></funcsynopsis>
17173</refsynopsisdiv>
17174<refsect1>
17175 <title>Arguments</title>
17176 <variablelist>
17177  <varlistentry>
17178   <term><parameter>drv</parameter></term>
17179   <listitem>
17180    <para>
17181     driver to register
17182    </para>
17183   </listitem>
17184  </varlistentry>
17185 </variablelist>
17186</refsect1>
17187<refsect1>
17188<title>Description</title>
17189<para>
17190   We pass off most of the work to the <function>bus_add_driver</function> call,
17191   since most of the things we have to do deal with the bus
17192   structures.
17193</para>
17194</refsect1>
17195</refentry>
17196
17197<refentry id="API-driver-unregister">
17198<refentryinfo>
17199 <title>LINUX</title>
17200 <productname>Kernel Hackers Manual</productname>
17201 <date>July 2017</date>
17202</refentryinfo>
17203<refmeta>
17204 <refentrytitle><phrase>driver_unregister</phrase></refentrytitle>
17205 <manvolnum>9</manvolnum>
17206 <refmiscinfo class="version">4.1.27</refmiscinfo>
17207</refmeta>
17208<refnamediv>
17209 <refname>driver_unregister</refname>
17210 <refpurpose>
17211     remove driver from system.
17212 </refpurpose>
17213</refnamediv>
17214<refsynopsisdiv>
17215 <title>Synopsis</title>
17216  <funcsynopsis><funcprototype>
17217   <funcdef>void <function>driver_unregister </function></funcdef>
17218   <paramdef>struct device_driver * <parameter>drv</parameter></paramdef>
17219  </funcprototype></funcsynopsis>
17220</refsynopsisdiv>
17221<refsect1>
17222 <title>Arguments</title>
17223 <variablelist>
17224  <varlistentry>
17225   <term><parameter>drv</parameter></term>
17226   <listitem>
17227    <para>
17228     driver.
17229    </para>
17230   </listitem>
17231  </varlistentry>
17232 </variablelist>
17233</refsect1>
17234<refsect1>
17235<title>Description</title>
17236<para>
17237   Again, we pass off most of the work to the bus-level call.
17238</para>
17239</refsect1>
17240</refentry>
17241
17242<refentry id="API-driver-find">
17243<refentryinfo>
17244 <title>LINUX</title>
17245 <productname>Kernel Hackers Manual</productname>
17246 <date>July 2017</date>
17247</refentryinfo>
17248<refmeta>
17249 <refentrytitle><phrase>driver_find</phrase></refentrytitle>
17250 <manvolnum>9</manvolnum>
17251 <refmiscinfo class="version">4.1.27</refmiscinfo>
17252</refmeta>
17253<refnamediv>
17254 <refname>driver_find</refname>
17255 <refpurpose>
17256     locate driver on a bus by its name.
17257 </refpurpose>
17258</refnamediv>
17259<refsynopsisdiv>
17260 <title>Synopsis</title>
17261  <funcsynopsis><funcprototype>
17262   <funcdef>struct device_driver * <function>driver_find </function></funcdef>
17263   <paramdef>const char * <parameter>name</parameter></paramdef>
17264   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
17265  </funcprototype></funcsynopsis>
17266</refsynopsisdiv>
17267<refsect1>
17268 <title>Arguments</title>
17269 <variablelist>
17270  <varlistentry>
17271   <term><parameter>name</parameter></term>
17272   <listitem>
17273    <para>
17274     name of the driver.
17275    </para>
17276   </listitem>
17277  </varlistentry>
17278  <varlistentry>
17279   <term><parameter>bus</parameter></term>
17280   <listitem>
17281    <para>
17282     bus to scan for the driver.
17283    </para>
17284   </listitem>
17285  </varlistentry>
17286 </variablelist>
17287</refsect1>
17288<refsect1>
17289<title>Description</title>
17290<para>
17291   Call <function>kset_find_obj</function> to iterate over list of drivers on
17292   a bus to find driver by name. Return driver if found.
17293   </para><para>
17294
17295   This routine provides no locking to prevent the driver it returns
17296   from being unregistered or unloaded while the caller is using it.
17297   The caller is responsible for preventing this.
17298</para>
17299</refsect1>
17300</refentry>
17301
17302<!-- drivers/base/core.c -->
17303<refentry id="API-dev-driver-string">
17304<refentryinfo>
17305 <title>LINUX</title>
17306 <productname>Kernel Hackers Manual</productname>
17307 <date>July 2017</date>
17308</refentryinfo>
17309<refmeta>
17310 <refentrytitle><phrase>dev_driver_string</phrase></refentrytitle>
17311 <manvolnum>9</manvolnum>
17312 <refmiscinfo class="version">4.1.27</refmiscinfo>
17313</refmeta>
17314<refnamediv>
17315 <refname>dev_driver_string</refname>
17316 <refpurpose>
17317  Return a device's driver name, if at all possible
17318 </refpurpose>
17319</refnamediv>
17320<refsynopsisdiv>
17321 <title>Synopsis</title>
17322  <funcsynopsis><funcprototype>
17323   <funcdef>const char * <function>dev_driver_string </function></funcdef>
17324   <paramdef>const struct device * <parameter>dev</parameter></paramdef>
17325  </funcprototype></funcsynopsis>
17326</refsynopsisdiv>
17327<refsect1>
17328 <title>Arguments</title>
17329 <variablelist>
17330  <varlistentry>
17331   <term><parameter>dev</parameter></term>
17332   <listitem>
17333    <para>
17334     struct device to get the name of
17335    </para>
17336   </listitem>
17337  </varlistentry>
17338 </variablelist>
17339</refsect1>
17340<refsect1>
17341<title>Description</title>
17342<para>
17343   Will return the device's driver's name if it is bound to a device.  If
17344   the device is not bound to a driver, it will return the name of the bus
17345   it is attached to.  If it is not attached to a bus either, an empty
17346   string will be returned.
17347</para>
17348</refsect1>
17349</refentry>
17350
17351<refentry id="API-device-create-file">
17352<refentryinfo>
17353 <title>LINUX</title>
17354 <productname>Kernel Hackers Manual</productname>
17355 <date>July 2017</date>
17356</refentryinfo>
17357<refmeta>
17358 <refentrytitle><phrase>device_create_file</phrase></refentrytitle>
17359 <manvolnum>9</manvolnum>
17360 <refmiscinfo class="version">4.1.27</refmiscinfo>
17361</refmeta>
17362<refnamediv>
17363 <refname>device_create_file</refname>
17364 <refpurpose>
17365     create sysfs attribute file for device.
17366 </refpurpose>
17367</refnamediv>
17368<refsynopsisdiv>
17369 <title>Synopsis</title>
17370  <funcsynopsis><funcprototype>
17371   <funcdef>int <function>device_create_file </function></funcdef>
17372   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17373   <paramdef>const struct device_attribute * <parameter>attr</parameter></paramdef>
17374  </funcprototype></funcsynopsis>
17375</refsynopsisdiv>
17376<refsect1>
17377 <title>Arguments</title>
17378 <variablelist>
17379  <varlistentry>
17380   <term><parameter>dev</parameter></term>
17381   <listitem>
17382    <para>
17383     device.
17384    </para>
17385   </listitem>
17386  </varlistentry>
17387  <varlistentry>
17388   <term><parameter>attr</parameter></term>
17389   <listitem>
17390    <para>
17391     device attribute descriptor.
17392    </para>
17393   </listitem>
17394  </varlistentry>
17395 </variablelist>
17396</refsect1>
17397</refentry>
17398
17399<refentry id="API-device-remove-file">
17400<refentryinfo>
17401 <title>LINUX</title>
17402 <productname>Kernel Hackers Manual</productname>
17403 <date>July 2017</date>
17404</refentryinfo>
17405<refmeta>
17406 <refentrytitle><phrase>device_remove_file</phrase></refentrytitle>
17407 <manvolnum>9</manvolnum>
17408 <refmiscinfo class="version">4.1.27</refmiscinfo>
17409</refmeta>
17410<refnamediv>
17411 <refname>device_remove_file</refname>
17412 <refpurpose>
17413     remove sysfs attribute file.
17414 </refpurpose>
17415</refnamediv>
17416<refsynopsisdiv>
17417 <title>Synopsis</title>
17418  <funcsynopsis><funcprototype>
17419   <funcdef>void <function>device_remove_file </function></funcdef>
17420   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17421   <paramdef>const struct device_attribute * <parameter>attr</parameter></paramdef>
17422  </funcprototype></funcsynopsis>
17423</refsynopsisdiv>
17424<refsect1>
17425 <title>Arguments</title>
17426 <variablelist>
17427  <varlistentry>
17428   <term><parameter>dev</parameter></term>
17429   <listitem>
17430    <para>
17431     device.
17432    </para>
17433   </listitem>
17434  </varlistentry>
17435  <varlistentry>
17436   <term><parameter>attr</parameter></term>
17437   <listitem>
17438    <para>
17439     device attribute descriptor.
17440    </para>
17441   </listitem>
17442  </varlistentry>
17443 </variablelist>
17444</refsect1>
17445</refentry>
17446
17447<refentry id="API-device-remove-file-self">
17448<refentryinfo>
17449 <title>LINUX</title>
17450 <productname>Kernel Hackers Manual</productname>
17451 <date>July 2017</date>
17452</refentryinfo>
17453<refmeta>
17454 <refentrytitle><phrase>device_remove_file_self</phrase></refentrytitle>
17455 <manvolnum>9</manvolnum>
17456 <refmiscinfo class="version">4.1.27</refmiscinfo>
17457</refmeta>
17458<refnamediv>
17459 <refname>device_remove_file_self</refname>
17460 <refpurpose>
17461     remove sysfs attribute file from its own method.
17462 </refpurpose>
17463</refnamediv>
17464<refsynopsisdiv>
17465 <title>Synopsis</title>
17466  <funcsynopsis><funcprototype>
17467   <funcdef>bool <function>device_remove_file_self </function></funcdef>
17468   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17469   <paramdef>const struct device_attribute * <parameter>attr</parameter></paramdef>
17470  </funcprototype></funcsynopsis>
17471</refsynopsisdiv>
17472<refsect1>
17473 <title>Arguments</title>
17474 <variablelist>
17475  <varlistentry>
17476   <term><parameter>dev</parameter></term>
17477   <listitem>
17478    <para>
17479     device.
17480    </para>
17481   </listitem>
17482  </varlistentry>
17483  <varlistentry>
17484   <term><parameter>attr</parameter></term>
17485   <listitem>
17486    <para>
17487     device attribute descriptor.
17488    </para>
17489   </listitem>
17490  </varlistentry>
17491 </variablelist>
17492</refsect1>
17493<refsect1>
17494<title>Description</title>
17495<para>
17496   See <function>kernfs_remove_self</function> for details.
17497</para>
17498</refsect1>
17499</refentry>
17500
17501<refentry id="API-device-create-bin-file">
17502<refentryinfo>
17503 <title>LINUX</title>
17504 <productname>Kernel Hackers Manual</productname>
17505 <date>July 2017</date>
17506</refentryinfo>
17507<refmeta>
17508 <refentrytitle><phrase>device_create_bin_file</phrase></refentrytitle>
17509 <manvolnum>9</manvolnum>
17510 <refmiscinfo class="version">4.1.27</refmiscinfo>
17511</refmeta>
17512<refnamediv>
17513 <refname>device_create_bin_file</refname>
17514 <refpurpose>
17515     create sysfs binary attribute file for device.
17516 </refpurpose>
17517</refnamediv>
17518<refsynopsisdiv>
17519 <title>Synopsis</title>
17520  <funcsynopsis><funcprototype>
17521   <funcdef>int <function>device_create_bin_file </function></funcdef>
17522   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17523   <paramdef>const struct bin_attribute * <parameter>attr</parameter></paramdef>
17524  </funcprototype></funcsynopsis>
17525</refsynopsisdiv>
17526<refsect1>
17527 <title>Arguments</title>
17528 <variablelist>
17529  <varlistentry>
17530   <term><parameter>dev</parameter></term>
17531   <listitem>
17532    <para>
17533     device.
17534    </para>
17535   </listitem>
17536  </varlistentry>
17537  <varlistentry>
17538   <term><parameter>attr</parameter></term>
17539   <listitem>
17540    <para>
17541     device binary attribute descriptor.
17542    </para>
17543   </listitem>
17544  </varlistentry>
17545 </variablelist>
17546</refsect1>
17547</refentry>
17548
17549<refentry id="API-device-remove-bin-file">
17550<refentryinfo>
17551 <title>LINUX</title>
17552 <productname>Kernel Hackers Manual</productname>
17553 <date>July 2017</date>
17554</refentryinfo>
17555<refmeta>
17556 <refentrytitle><phrase>device_remove_bin_file</phrase></refentrytitle>
17557 <manvolnum>9</manvolnum>
17558 <refmiscinfo class="version">4.1.27</refmiscinfo>
17559</refmeta>
17560<refnamediv>
17561 <refname>device_remove_bin_file</refname>
17562 <refpurpose>
17563     remove sysfs binary attribute file
17564 </refpurpose>
17565</refnamediv>
17566<refsynopsisdiv>
17567 <title>Synopsis</title>
17568  <funcsynopsis><funcprototype>
17569   <funcdef>void <function>device_remove_bin_file </function></funcdef>
17570   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17571   <paramdef>const struct bin_attribute * <parameter>attr</parameter></paramdef>
17572  </funcprototype></funcsynopsis>
17573</refsynopsisdiv>
17574<refsect1>
17575 <title>Arguments</title>
17576 <variablelist>
17577  <varlistentry>
17578   <term><parameter>dev</parameter></term>
17579   <listitem>
17580    <para>
17581     device.
17582    </para>
17583   </listitem>
17584  </varlistentry>
17585  <varlistentry>
17586   <term><parameter>attr</parameter></term>
17587   <listitem>
17588    <para>
17589     device binary attribute descriptor.
17590    </para>
17591   </listitem>
17592  </varlistentry>
17593 </variablelist>
17594</refsect1>
17595</refentry>
17596
17597<refentry id="API-device-initialize">
17598<refentryinfo>
17599 <title>LINUX</title>
17600 <productname>Kernel Hackers Manual</productname>
17601 <date>July 2017</date>
17602</refentryinfo>
17603<refmeta>
17604 <refentrytitle><phrase>device_initialize</phrase></refentrytitle>
17605 <manvolnum>9</manvolnum>
17606 <refmiscinfo class="version">4.1.27</refmiscinfo>
17607</refmeta>
17608<refnamediv>
17609 <refname>device_initialize</refname>
17610 <refpurpose>
17611     init device structure.
17612 </refpurpose>
17613</refnamediv>
17614<refsynopsisdiv>
17615 <title>Synopsis</title>
17616  <funcsynopsis><funcprototype>
17617   <funcdef>void <function>device_initialize </function></funcdef>
17618   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17619  </funcprototype></funcsynopsis>
17620</refsynopsisdiv>
17621<refsect1>
17622 <title>Arguments</title>
17623 <variablelist>
17624  <varlistentry>
17625   <term><parameter>dev</parameter></term>
17626   <listitem>
17627    <para>
17628     device.
17629    </para>
17630   </listitem>
17631  </varlistentry>
17632 </variablelist>
17633</refsect1>
17634<refsect1>
17635<title>Description</title>
17636<para>
17637   This prepares the device for use by other layers by initializing
17638   its fields.
17639   It is the first half of <function>device_register</function>, if called by
17640   that function, though it can also be called separately, so one
17641   may use <parameter>dev</parameter>'s fields. In particular, <function>get_device</function>/<function>put_device</function>
17642   may be used for reference counting of <parameter>dev</parameter> after calling this
17643   function.
17644   </para><para>
17645
17646   All fields in <parameter>dev</parameter> must be initialized by the caller to 0, except
17647   for those explicitly set to some other value.  The simplest
17648   approach is to use <function>kzalloc</function> to allocate the structure containing
17649   <parameter>dev</parameter>.
17650</para>
17651</refsect1>
17652<refsect1>
17653<title>NOTE</title>
17654<para>
17655   Use <function>put_device</function> to give up your reference instead of freeing
17656   <parameter>dev</parameter> directly once you have called this function.
17657</para>
17658</refsect1>
17659</refentry>
17660
17661<refentry id="API-dev-set-name">
17662<refentryinfo>
17663 <title>LINUX</title>
17664 <productname>Kernel Hackers Manual</productname>
17665 <date>July 2017</date>
17666</refentryinfo>
17667<refmeta>
17668 <refentrytitle><phrase>dev_set_name</phrase></refentrytitle>
17669 <manvolnum>9</manvolnum>
17670 <refmiscinfo class="version">4.1.27</refmiscinfo>
17671</refmeta>
17672<refnamediv>
17673 <refname>dev_set_name</refname>
17674 <refpurpose>
17675     set a device name
17676 </refpurpose>
17677</refnamediv>
17678<refsynopsisdiv>
17679 <title>Synopsis</title>
17680  <funcsynopsis><funcprototype>
17681   <funcdef>int <function>dev_set_name </function></funcdef>
17682   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17683   <paramdef>const char * <parameter>fmt</parameter></paramdef>
17684   <paramdef> <parameter>...</parameter></paramdef>
17685  </funcprototype></funcsynopsis>
17686</refsynopsisdiv>
17687<refsect1>
17688 <title>Arguments</title>
17689 <variablelist>
17690  <varlistentry>
17691   <term><parameter>dev</parameter></term>
17692   <listitem>
17693    <para>
17694     device
17695    </para>
17696   </listitem>
17697  </varlistentry>
17698  <varlistentry>
17699   <term><parameter>fmt</parameter></term>
17700   <listitem>
17701    <para>
17702     format string for the device's name
17703    </para>
17704   </listitem>
17705  </varlistentry>
17706  <varlistentry>
17707   <term><parameter>...</parameter></term>
17708   <listitem>
17709    <para>
17710     variable arguments
17711    </para>
17712   </listitem>
17713  </varlistentry>
17714 </variablelist>
17715</refsect1>
17716</refentry>
17717
17718<refentry id="API-device-add">
17719<refentryinfo>
17720 <title>LINUX</title>
17721 <productname>Kernel Hackers Manual</productname>
17722 <date>July 2017</date>
17723</refentryinfo>
17724<refmeta>
17725 <refentrytitle><phrase>device_add</phrase></refentrytitle>
17726 <manvolnum>9</manvolnum>
17727 <refmiscinfo class="version">4.1.27</refmiscinfo>
17728</refmeta>
17729<refnamediv>
17730 <refname>device_add</refname>
17731 <refpurpose>
17732     add device to device hierarchy.
17733 </refpurpose>
17734</refnamediv>
17735<refsynopsisdiv>
17736 <title>Synopsis</title>
17737  <funcsynopsis><funcprototype>
17738   <funcdef>int <function>device_add </function></funcdef>
17739   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17740  </funcprototype></funcsynopsis>
17741</refsynopsisdiv>
17742<refsect1>
17743 <title>Arguments</title>
17744 <variablelist>
17745  <varlistentry>
17746   <term><parameter>dev</parameter></term>
17747   <listitem>
17748    <para>
17749     device.
17750    </para>
17751   </listitem>
17752  </varlistentry>
17753 </variablelist>
17754</refsect1>
17755<refsect1>
17756<title>Description</title>
17757<para>
17758   This is part 2 of <function>device_register</function>, though may be called
17759   separately _iff_ <function>device_initialize</function> has been called separately.
17760   </para><para>
17761
17762   This adds <parameter>dev</parameter> to the kobject hierarchy via <function>kobject_add</function>, adds it
17763   to the global and sibling lists for the device, then
17764   adds it to the other relevant subsystems of the driver model.
17765   </para><para>
17766
17767   Do not call this routine or <function>device_register</function> more than once for
17768   any device structure.  The driver model core is not designed to work
17769   with devices that get unregistered and then spring back to life.
17770   (Among other things, it's very hard to guarantee that all references
17771   to the previous incarnation of <parameter>dev</parameter> have been dropped.)  Allocate
17772   and register a fresh new struct device instead.
17773</para>
17774</refsect1>
17775<refsect1>
17776<title>NOTE</title>
17777<para>
17778   _Never_ directly free <parameter>dev</parameter> after calling this function, even
17779   if it returned an error! Always use <function>put_device</function> to give up your
17780   reference instead.
17781</para>
17782</refsect1>
17783</refentry>
17784
17785<refentry id="API-device-register">
17786<refentryinfo>
17787 <title>LINUX</title>
17788 <productname>Kernel Hackers Manual</productname>
17789 <date>July 2017</date>
17790</refentryinfo>
17791<refmeta>
17792 <refentrytitle><phrase>device_register</phrase></refentrytitle>
17793 <manvolnum>9</manvolnum>
17794 <refmiscinfo class="version">4.1.27</refmiscinfo>
17795</refmeta>
17796<refnamediv>
17797 <refname>device_register</refname>
17798 <refpurpose>
17799     register a device with the system.
17800 </refpurpose>
17801</refnamediv>
17802<refsynopsisdiv>
17803 <title>Synopsis</title>
17804  <funcsynopsis><funcprototype>
17805   <funcdef>int <function>device_register </function></funcdef>
17806   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17807  </funcprototype></funcsynopsis>
17808</refsynopsisdiv>
17809<refsect1>
17810 <title>Arguments</title>
17811 <variablelist>
17812  <varlistentry>
17813   <term><parameter>dev</parameter></term>
17814   <listitem>
17815    <para>
17816     pointer to the device structure
17817    </para>
17818   </listitem>
17819  </varlistentry>
17820 </variablelist>
17821</refsect1>
17822<refsect1>
17823<title>Description</title>
17824<para>
17825   This happens in two clean steps - initialize the device
17826   and add it to the system. The two steps can be called
17827   separately, but this is the easiest and most common.
17828   I.e. you should only call the two helpers separately if
17829   have a clearly defined need to use and refcount the device
17830   before it is added to the hierarchy.
17831   </para><para>
17832
17833   For more information, see the kerneldoc for <function>device_initialize</function>
17834   and <function>device_add</function>.
17835</para>
17836</refsect1>
17837<refsect1>
17838<title>NOTE</title>
17839<para>
17840   _Never_ directly free <parameter>dev</parameter> after calling this function, even
17841   if it returned an error! Always use <function>put_device</function> to give up the
17842   reference initialized in this function instead.
17843</para>
17844</refsect1>
17845</refentry>
17846
17847<refentry id="API-get-device">
17848<refentryinfo>
17849 <title>LINUX</title>
17850 <productname>Kernel Hackers Manual</productname>
17851 <date>July 2017</date>
17852</refentryinfo>
17853<refmeta>
17854 <refentrytitle><phrase>get_device</phrase></refentrytitle>
17855 <manvolnum>9</manvolnum>
17856 <refmiscinfo class="version">4.1.27</refmiscinfo>
17857</refmeta>
17858<refnamediv>
17859 <refname>get_device</refname>
17860 <refpurpose>
17861     increment reference count for device.
17862 </refpurpose>
17863</refnamediv>
17864<refsynopsisdiv>
17865 <title>Synopsis</title>
17866  <funcsynopsis><funcprototype>
17867   <funcdef>struct device * <function>get_device </function></funcdef>
17868   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17869  </funcprototype></funcsynopsis>
17870</refsynopsisdiv>
17871<refsect1>
17872 <title>Arguments</title>
17873 <variablelist>
17874  <varlistentry>
17875   <term><parameter>dev</parameter></term>
17876   <listitem>
17877    <para>
17878     device.
17879    </para>
17880   </listitem>
17881  </varlistentry>
17882 </variablelist>
17883</refsect1>
17884<refsect1>
17885<title>Description</title>
17886<para>
17887   This simply forwards the call to <function>kobject_get</function>, though
17888   we do take care to provide for the case that we get a NULL
17889   pointer passed in.
17890</para>
17891</refsect1>
17892</refentry>
17893
17894<refentry id="API-put-device">
17895<refentryinfo>
17896 <title>LINUX</title>
17897 <productname>Kernel Hackers Manual</productname>
17898 <date>July 2017</date>
17899</refentryinfo>
17900<refmeta>
17901 <refentrytitle><phrase>put_device</phrase></refentrytitle>
17902 <manvolnum>9</manvolnum>
17903 <refmiscinfo class="version">4.1.27</refmiscinfo>
17904</refmeta>
17905<refnamediv>
17906 <refname>put_device</refname>
17907 <refpurpose>
17908     decrement reference count.
17909 </refpurpose>
17910</refnamediv>
17911<refsynopsisdiv>
17912 <title>Synopsis</title>
17913  <funcsynopsis><funcprototype>
17914   <funcdef>void <function>put_device </function></funcdef>
17915   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17916  </funcprototype></funcsynopsis>
17917</refsynopsisdiv>
17918<refsect1>
17919 <title>Arguments</title>
17920 <variablelist>
17921  <varlistentry>
17922   <term><parameter>dev</parameter></term>
17923   <listitem>
17924    <para>
17925     device in question.
17926    </para>
17927   </listitem>
17928  </varlistentry>
17929 </variablelist>
17930</refsect1>
17931</refentry>
17932
17933<refentry id="API-device-del">
17934<refentryinfo>
17935 <title>LINUX</title>
17936 <productname>Kernel Hackers Manual</productname>
17937 <date>July 2017</date>
17938</refentryinfo>
17939<refmeta>
17940 <refentrytitle><phrase>device_del</phrase></refentrytitle>
17941 <manvolnum>9</manvolnum>
17942 <refmiscinfo class="version">4.1.27</refmiscinfo>
17943</refmeta>
17944<refnamediv>
17945 <refname>device_del</refname>
17946 <refpurpose>
17947     delete device from system.
17948 </refpurpose>
17949</refnamediv>
17950<refsynopsisdiv>
17951 <title>Synopsis</title>
17952  <funcsynopsis><funcprototype>
17953   <funcdef>void <function>device_del </function></funcdef>
17954   <paramdef>struct device * <parameter>dev</parameter></paramdef>
17955  </funcprototype></funcsynopsis>
17956</refsynopsisdiv>
17957<refsect1>
17958 <title>Arguments</title>
17959 <variablelist>
17960  <varlistentry>
17961   <term><parameter>dev</parameter></term>
17962   <listitem>
17963    <para>
17964     device.
17965    </para>
17966   </listitem>
17967  </varlistentry>
17968 </variablelist>
17969</refsect1>
17970<refsect1>
17971<title>Description</title>
17972<para>
17973   This is the first part of the device unregistration
17974   sequence. This removes the device from the lists we control
17975   from here, has it removed from the other driver model
17976   subsystems it was added to in <function>device_add</function>, and removes it
17977   from the kobject hierarchy.
17978</para>
17979</refsect1>
17980<refsect1>
17981<title>NOTE</title>
17982<para>
17983   this should be called manually _iff_ <function>device_add</function> was
17984   also called manually.
17985</para>
17986</refsect1>
17987</refentry>
17988
17989<refentry id="API-device-unregister">
17990<refentryinfo>
17991 <title>LINUX</title>
17992 <productname>Kernel Hackers Manual</productname>
17993 <date>July 2017</date>
17994</refentryinfo>
17995<refmeta>
17996 <refentrytitle><phrase>device_unregister</phrase></refentrytitle>
17997 <manvolnum>9</manvolnum>
17998 <refmiscinfo class="version">4.1.27</refmiscinfo>
17999</refmeta>
18000<refnamediv>
18001 <refname>device_unregister</refname>
18002 <refpurpose>
18003     unregister device from system.
18004 </refpurpose>
18005</refnamediv>
18006<refsynopsisdiv>
18007 <title>Synopsis</title>
18008  <funcsynopsis><funcprototype>
18009   <funcdef>void <function>device_unregister </function></funcdef>
18010   <paramdef>struct device * <parameter>dev</parameter></paramdef>
18011  </funcprototype></funcsynopsis>
18012</refsynopsisdiv>
18013<refsect1>
18014 <title>Arguments</title>
18015 <variablelist>
18016  <varlistentry>
18017   <term><parameter>dev</parameter></term>
18018   <listitem>
18019    <para>
18020     device going away.
18021    </para>
18022   </listitem>
18023  </varlistentry>
18024 </variablelist>
18025</refsect1>
18026<refsect1>
18027<title>Description</title>
18028<para>
18029   We do this in two parts, like we do <function>device_register</function>. First,
18030   we remove it from all the subsystems with <function>device_del</function>, then
18031   we decrement the reference count via <function>put_device</function>. If that
18032   is the final reference count, the device will be cleaned up
18033   via <function>device_release</function> above. Otherwise, the structure will
18034   stick around until the final reference to the device is dropped.
18035</para>
18036</refsect1>
18037</refentry>
18038
18039<refentry id="API-device-for-each-child">
18040<refentryinfo>
18041 <title>LINUX</title>
18042 <productname>Kernel Hackers Manual</productname>
18043 <date>July 2017</date>
18044</refentryinfo>
18045<refmeta>
18046 <refentrytitle><phrase>device_for_each_child</phrase></refentrytitle>
18047 <manvolnum>9</manvolnum>
18048 <refmiscinfo class="version">4.1.27</refmiscinfo>
18049</refmeta>
18050<refnamediv>
18051 <refname>device_for_each_child</refname>
18052 <refpurpose>
18053     device child iterator.
18054 </refpurpose>
18055</refnamediv>
18056<refsynopsisdiv>
18057 <title>Synopsis</title>
18058  <funcsynopsis><funcprototype>
18059   <funcdef>int <function>device_for_each_child </function></funcdef>
18060   <paramdef>struct device * <parameter>parent</parameter></paramdef>
18061   <paramdef>void * <parameter>data</parameter></paramdef>
18062   <paramdef>int (*<parameter>fn</parameter>)
18063     <funcparams>struct device *dev, void *data</funcparams></paramdef>
18064  </funcprototype></funcsynopsis>
18065</refsynopsisdiv>
18066<refsect1>
18067 <title>Arguments</title>
18068 <variablelist>
18069  <varlistentry>
18070   <term><parameter>parent</parameter></term>
18071   <listitem>
18072    <para>
18073     parent struct device.
18074    </para>
18075   </listitem>
18076  </varlistentry>
18077  <varlistentry>
18078   <term><parameter>data</parameter></term>
18079   <listitem>
18080    <para>
18081     data for the callback.
18082    </para>
18083   </listitem>
18084  </varlistentry>
18085  <varlistentry>
18086   <term><parameter>fn</parameter></term>
18087   <listitem>
18088    <para>
18089     function to be called for each device.
18090    </para>
18091   </listitem>
18092  </varlistentry>
18093 </variablelist>
18094</refsect1>
18095<refsect1>
18096<title>Description</title>
18097<para>
18098   Iterate over <parameter>parent</parameter>'s child devices, and call <parameter>fn</parameter> for each,
18099   passing it <parameter>data</parameter>.
18100   </para><para>
18101
18102   We check the return of <parameter>fn</parameter> each time. If it returns anything
18103   other than 0, we break out and return that value.
18104</para>
18105</refsect1>
18106</refentry>
18107
18108<refentry id="API-device-find-child">
18109<refentryinfo>
18110 <title>LINUX</title>
18111 <productname>Kernel Hackers Manual</productname>
18112 <date>July 2017</date>
18113</refentryinfo>
18114<refmeta>
18115 <refentrytitle><phrase>device_find_child</phrase></refentrytitle>
18116 <manvolnum>9</manvolnum>
18117 <refmiscinfo class="version">4.1.27</refmiscinfo>
18118</refmeta>
18119<refnamediv>
18120 <refname>device_find_child</refname>
18121 <refpurpose>
18122     device iterator for locating a particular device.
18123 </refpurpose>
18124</refnamediv>
18125<refsynopsisdiv>
18126 <title>Synopsis</title>
18127  <funcsynopsis><funcprototype>
18128   <funcdef>struct device * <function>device_find_child </function></funcdef>
18129   <paramdef>struct device * <parameter>parent</parameter></paramdef>
18130   <paramdef>void * <parameter>data</parameter></paramdef>
18131   <paramdef>int (*<parameter>match</parameter>)
18132     <funcparams>struct device *dev, void *data</funcparams></paramdef>
18133  </funcprototype></funcsynopsis>
18134</refsynopsisdiv>
18135<refsect1>
18136 <title>Arguments</title>
18137 <variablelist>
18138  <varlistentry>
18139   <term><parameter>parent</parameter></term>
18140   <listitem>
18141    <para>
18142     parent struct device
18143    </para>
18144   </listitem>
18145  </varlistentry>
18146  <varlistentry>
18147   <term><parameter>data</parameter></term>
18148   <listitem>
18149    <para>
18150     Data to pass to match function
18151    </para>
18152   </listitem>
18153  </varlistentry>
18154  <varlistentry>
18155   <term><parameter>match</parameter></term>
18156   <listitem>
18157    <para>
18158     Callback function to check device
18159    </para>
18160   </listitem>
18161  </varlistentry>
18162 </variablelist>
18163</refsect1>
18164<refsect1>
18165<title>Description</title>
18166<para>
18167   This is similar to the <function>device_for_each_child</function> function above, but it
18168   returns a reference to a device that is 'found' for later use, as
18169   determined by the <parameter>match</parameter> callback.
18170   </para><para>
18171
18172   The callback should return 0 if the device doesn't match and non-zero
18173   if it does.  If the callback returns non-zero and a reference to the
18174   current device can be obtained, this function will return to the caller
18175   and not iterate over any more devices.
18176</para>
18177</refsect1>
18178<refsect1>
18179<title>NOTE</title>
18180<para>
18181   you will need to drop the reference with <function>put_device</function> after use.
18182</para>
18183</refsect1>
18184</refentry>
18185
18186<refentry id="API---root-device-register">
18187<refentryinfo>
18188 <title>LINUX</title>
18189 <productname>Kernel Hackers Manual</productname>
18190 <date>July 2017</date>
18191</refentryinfo>
18192<refmeta>
18193 <refentrytitle><phrase>__root_device_register</phrase></refentrytitle>
18194 <manvolnum>9</manvolnum>
18195 <refmiscinfo class="version">4.1.27</refmiscinfo>
18196</refmeta>
18197<refnamediv>
18198 <refname>__root_device_register</refname>
18199 <refpurpose>
18200     allocate and register a root device
18201 </refpurpose>
18202</refnamediv>
18203<refsynopsisdiv>
18204 <title>Synopsis</title>
18205  <funcsynopsis><funcprototype>
18206   <funcdef>struct device * <function>__root_device_register </function></funcdef>
18207   <paramdef>const char * <parameter>name</parameter></paramdef>
18208   <paramdef>struct module * <parameter>owner</parameter></paramdef>
18209  </funcprototype></funcsynopsis>
18210</refsynopsisdiv>
18211<refsect1>
18212 <title>Arguments</title>
18213 <variablelist>
18214  <varlistentry>
18215   <term><parameter>name</parameter></term>
18216   <listitem>
18217    <para>
18218     root device name
18219    </para>
18220   </listitem>
18221  </varlistentry>
18222  <varlistentry>
18223   <term><parameter>owner</parameter></term>
18224   <listitem>
18225    <para>
18226     owner module of the root device, usually THIS_MODULE
18227    </para>
18228   </listitem>
18229  </varlistentry>
18230 </variablelist>
18231</refsect1>
18232<refsect1>
18233<title>Description</title>
18234<para>
18235   This function allocates a root device and registers it
18236   using <function>device_register</function>. In order to free the returned
18237   device, use <function>root_device_unregister</function>.
18238   </para><para>
18239
18240   Root devices are dummy devices which allow other devices
18241   to be grouped under /sys/devices. Use this function to
18242   allocate a root device and then use it as the parent of
18243   any device which should appear under /sys/devices/{name}
18244   </para><para>
18245
18246   The /sys/devices/{name} directory will also contain a
18247   'module' symlink which points to the <parameter>owner</parameter> directory
18248   in sysfs.
18249   </para><para>
18250
18251   Returns <structname>struct device</structname> pointer on success, or <function>ERR_PTR</function> on error.
18252</para>
18253</refsect1>
18254<refsect1>
18255<title>Note</title>
18256<para>
18257   You probably want to use <function>root_device_register</function>.
18258</para>
18259</refsect1>
18260</refentry>
18261
18262<refentry id="API-root-device-unregister">
18263<refentryinfo>
18264 <title>LINUX</title>
18265 <productname>Kernel Hackers Manual</productname>
18266 <date>July 2017</date>
18267</refentryinfo>
18268<refmeta>
18269 <refentrytitle><phrase>root_device_unregister</phrase></refentrytitle>
18270 <manvolnum>9</manvolnum>
18271 <refmiscinfo class="version">4.1.27</refmiscinfo>
18272</refmeta>
18273<refnamediv>
18274 <refname>root_device_unregister</refname>
18275 <refpurpose>
18276     unregister and free a root device
18277 </refpurpose>
18278</refnamediv>
18279<refsynopsisdiv>
18280 <title>Synopsis</title>
18281  <funcsynopsis><funcprototype>
18282   <funcdef>void <function>root_device_unregister </function></funcdef>
18283   <paramdef>struct device * <parameter>dev</parameter></paramdef>
18284  </funcprototype></funcsynopsis>
18285</refsynopsisdiv>
18286<refsect1>
18287 <title>Arguments</title>
18288 <variablelist>
18289  <varlistentry>
18290   <term><parameter>dev</parameter></term>
18291   <listitem>
18292    <para>
18293     device going away
18294    </para>
18295   </listitem>
18296  </varlistentry>
18297 </variablelist>
18298</refsect1>
18299<refsect1>
18300<title>Description</title>
18301<para>
18302   This function unregisters and cleans up a device that was created by
18303   <function>root_device_register</function>.
18304</para>
18305</refsect1>
18306</refentry>
18307
18308<refentry id="API-device-create-vargs">
18309<refentryinfo>
18310 <title>LINUX</title>
18311 <productname>Kernel Hackers Manual</productname>
18312 <date>July 2017</date>
18313</refentryinfo>
18314<refmeta>
18315 <refentrytitle><phrase>device_create_vargs</phrase></refentrytitle>
18316 <manvolnum>9</manvolnum>
18317 <refmiscinfo class="version">4.1.27</refmiscinfo>
18318</refmeta>
18319<refnamediv>
18320 <refname>device_create_vargs</refname>
18321 <refpurpose>
18322     creates a device and registers it with sysfs
18323 </refpurpose>
18324</refnamediv>
18325<refsynopsisdiv>
18326 <title>Synopsis</title>
18327  <funcsynopsis><funcprototype>
18328   <funcdef>struct device * <function>device_create_vargs </function></funcdef>
18329   <paramdef>struct class * <parameter>class</parameter></paramdef>
18330   <paramdef>struct device * <parameter>parent</parameter></paramdef>
18331   <paramdef>dev_t <parameter>devt</parameter></paramdef>
18332   <paramdef>void * <parameter>drvdata</parameter></paramdef>
18333   <paramdef>const char * <parameter>fmt</parameter></paramdef>
18334   <paramdef>va_list <parameter>args</parameter></paramdef>
18335  </funcprototype></funcsynopsis>
18336</refsynopsisdiv>
18337<refsect1>
18338 <title>Arguments</title>
18339 <variablelist>
18340  <varlistentry>
18341   <term><parameter>class</parameter></term>
18342   <listitem>
18343    <para>
18344     pointer to the struct class that this device should be registered to
18345    </para>
18346   </listitem>
18347  </varlistentry>
18348  <varlistentry>
18349   <term><parameter>parent</parameter></term>
18350   <listitem>
18351    <para>
18352     pointer to the parent struct device of this new device, if any
18353    </para>
18354   </listitem>
18355  </varlistentry>
18356  <varlistentry>
18357   <term><parameter>devt</parameter></term>
18358   <listitem>
18359    <para>
18360     the dev_t for the char device to be added
18361    </para>
18362   </listitem>
18363  </varlistentry>
18364  <varlistentry>
18365   <term><parameter>drvdata</parameter></term>
18366   <listitem>
18367    <para>
18368     the data to be added to the device for callbacks
18369    </para>
18370   </listitem>
18371  </varlistentry>
18372  <varlistentry>
18373   <term><parameter>fmt</parameter></term>
18374   <listitem>
18375    <para>
18376     string for the device's name
18377    </para>
18378   </listitem>
18379  </varlistentry>
18380  <varlistentry>
18381   <term><parameter>args</parameter></term>
18382   <listitem>
18383    <para>
18384     va_list for the device's name
18385    </para>
18386   </listitem>
18387  </varlistentry>
18388 </variablelist>
18389</refsect1>
18390<refsect1>
18391<title>Description</title>
18392<para>
18393   This function can be used by char device classes.  A struct device
18394   will be created in sysfs, registered to the specified class.
18395   </para><para>
18396
18397   A <quote>dev</quote> file will be created, showing the dev_t for the device, if
18398   the dev_t is not 0,0.
18399   If a pointer to a parent struct device is passed in, the newly created
18400   struct device will be a child of that device in sysfs.
18401   The pointer to the struct device will be returned from the call.
18402   Any further sysfs files that might be required can be created using this
18403   pointer.
18404   </para><para>
18405
18406   Returns <structname>struct device</structname> pointer on success, or <function>ERR_PTR</function> on error.
18407</para>
18408</refsect1>
18409<refsect1>
18410<title>Note</title>
18411<para>
18412   the struct class passed to this function must have previously
18413   been created with a call to <function>class_create</function>.
18414</para>
18415</refsect1>
18416</refentry>
18417
18418<refentry id="API-device-create">
18419<refentryinfo>
18420 <title>LINUX</title>
18421 <productname>Kernel Hackers Manual</productname>
18422 <date>July 2017</date>
18423</refentryinfo>
18424<refmeta>
18425 <refentrytitle><phrase>device_create</phrase></refentrytitle>
18426 <manvolnum>9</manvolnum>
18427 <refmiscinfo class="version">4.1.27</refmiscinfo>
18428</refmeta>
18429<refnamediv>
18430 <refname>device_create</refname>
18431 <refpurpose>
18432     creates a device and registers it with sysfs
18433 </refpurpose>
18434</refnamediv>
18435<refsynopsisdiv>
18436 <title>Synopsis</title>
18437  <funcsynopsis><funcprototype>
18438   <funcdef>struct device * <function>device_create </function></funcdef>
18439   <paramdef>struct class * <parameter>class</parameter></paramdef>
18440   <paramdef>struct device * <parameter>parent</parameter></paramdef>
18441   <paramdef>dev_t <parameter>devt</parameter></paramdef>
18442   <paramdef>void * <parameter>drvdata</parameter></paramdef>
18443   <paramdef>const char * <parameter>fmt</parameter></paramdef>
18444   <paramdef> <parameter>...</parameter></paramdef>
18445  </funcprototype></funcsynopsis>
18446</refsynopsisdiv>
18447<refsect1>
18448 <title>Arguments</title>
18449 <variablelist>
18450  <varlistentry>
18451   <term><parameter>class</parameter></term>
18452   <listitem>
18453    <para>
18454     pointer to the struct class that this device should be registered to
18455    </para>
18456   </listitem>
18457  </varlistentry>
18458  <varlistentry>
18459   <term><parameter>parent</parameter></term>
18460   <listitem>
18461    <para>
18462     pointer to the parent struct device of this new device, if any
18463    </para>
18464   </listitem>
18465  </varlistentry>
18466  <varlistentry>
18467   <term><parameter>devt</parameter></term>
18468   <listitem>
18469    <para>
18470     the dev_t for the char device to be added
18471    </para>
18472   </listitem>
18473  </varlistentry>
18474  <varlistentry>
18475   <term><parameter>drvdata</parameter></term>
18476   <listitem>
18477    <para>
18478     the data to be added to the device for callbacks
18479    </para>
18480   </listitem>
18481  </varlistentry>
18482  <varlistentry>
18483   <term><parameter>fmt</parameter></term>
18484   <listitem>
18485    <para>
18486     string for the device's name
18487    </para>
18488   </listitem>
18489  </varlistentry>
18490  <varlistentry>
18491   <term><parameter>...</parameter></term>
18492   <listitem>
18493    <para>
18494     variable arguments
18495    </para>
18496   </listitem>
18497  </varlistentry>
18498 </variablelist>
18499</refsect1>
18500<refsect1>
18501<title>Description</title>
18502<para>
18503   This function can be used by char device classes.  A struct device
18504   will be created in sysfs, registered to the specified class.
18505   </para><para>
18506
18507   A <quote>dev</quote> file will be created, showing the dev_t for the device, if
18508   the dev_t is not 0,0.
18509   If a pointer to a parent struct device is passed in, the newly created
18510   struct device will be a child of that device in sysfs.
18511   The pointer to the struct device will be returned from the call.
18512   Any further sysfs files that might be required can be created using this
18513   pointer.
18514   </para><para>
18515
18516   Returns <structname>struct device</structname> pointer on success, or <function>ERR_PTR</function> on error.
18517</para>
18518</refsect1>
18519<refsect1>
18520<title>Note</title>
18521<para>
18522   the struct class passed to this function must have previously
18523   been created with a call to <function>class_create</function>.
18524</para>
18525</refsect1>
18526</refentry>
18527
18528<refentry id="API-device-create-with-groups">
18529<refentryinfo>
18530 <title>LINUX</title>
18531 <productname>Kernel Hackers Manual</productname>
18532 <date>July 2017</date>
18533</refentryinfo>
18534<refmeta>
18535 <refentrytitle><phrase>device_create_with_groups</phrase></refentrytitle>
18536 <manvolnum>9</manvolnum>
18537 <refmiscinfo class="version">4.1.27</refmiscinfo>
18538</refmeta>
18539<refnamediv>
18540 <refname>device_create_with_groups</refname>
18541 <refpurpose>
18542     creates a device and registers it with sysfs
18543 </refpurpose>
18544</refnamediv>
18545<refsynopsisdiv>
18546 <title>Synopsis</title>
18547  <funcsynopsis><funcprototype>
18548   <funcdef>struct device * <function>device_create_with_groups </function></funcdef>
18549   <paramdef>struct class * <parameter>class</parameter></paramdef>
18550   <paramdef>struct device * <parameter>parent</parameter></paramdef>
18551   <paramdef>dev_t <parameter>devt</parameter></paramdef>
18552   <paramdef>void * <parameter>drvdata</parameter></paramdef>
18553   <paramdef>const struct attribute_group ** <parameter>groups</parameter></paramdef>
18554   <paramdef>const char * <parameter>fmt</parameter></paramdef>
18555   <paramdef> <parameter>...</parameter></paramdef>
18556  </funcprototype></funcsynopsis>
18557</refsynopsisdiv>
18558<refsect1>
18559 <title>Arguments</title>
18560 <variablelist>
18561  <varlistentry>
18562   <term><parameter>class</parameter></term>
18563   <listitem>
18564    <para>
18565     pointer to the struct class that this device should be registered to
18566    </para>
18567   </listitem>
18568  </varlistentry>
18569  <varlistentry>
18570   <term><parameter>parent</parameter></term>
18571   <listitem>
18572    <para>
18573     pointer to the parent struct device of this new device, if any
18574    </para>
18575   </listitem>
18576  </varlistentry>
18577  <varlistentry>
18578   <term><parameter>devt</parameter></term>
18579   <listitem>
18580    <para>
18581     the dev_t for the char device to be added
18582    </para>
18583   </listitem>
18584  </varlistentry>
18585  <varlistentry>
18586   <term><parameter>drvdata</parameter></term>
18587   <listitem>
18588    <para>
18589     the data to be added to the device for callbacks
18590    </para>
18591   </listitem>
18592  </varlistentry>
18593  <varlistentry>
18594   <term><parameter>groups</parameter></term>
18595   <listitem>
18596    <para>
18597     NULL-terminated list of attribute groups to be created
18598    </para>
18599   </listitem>
18600  </varlistentry>
18601  <varlistentry>
18602   <term><parameter>fmt</parameter></term>
18603   <listitem>
18604    <para>
18605     string for the device's name
18606    </para>
18607   </listitem>
18608  </varlistentry>
18609  <varlistentry>
18610   <term><parameter>...</parameter></term>
18611   <listitem>
18612    <para>
18613     variable arguments
18614    </para>
18615   </listitem>
18616  </varlistentry>
18617 </variablelist>
18618</refsect1>
18619<refsect1>
18620<title>Description</title>
18621<para>
18622   This function can be used by char device classes.  A struct device
18623   will be created in sysfs, registered to the specified class.
18624   Additional attributes specified in the groups parameter will also
18625   be created automatically.
18626   </para><para>
18627
18628   A <quote>dev</quote> file will be created, showing the dev_t for the device, if
18629   the dev_t is not 0,0.
18630   If a pointer to a parent struct device is passed in, the newly created
18631   struct device will be a child of that device in sysfs.
18632   The pointer to the struct device will be returned from the call.
18633   Any further sysfs files that might be required can be created using this
18634   pointer.
18635   </para><para>
18636
18637   Returns <structname>struct device</structname> pointer on success, or <function>ERR_PTR</function> on error.
18638</para>
18639</refsect1>
18640<refsect1>
18641<title>Note</title>
18642<para>
18643   the struct class passed to this function must have previously
18644   been created with a call to <function>class_create</function>.
18645</para>
18646</refsect1>
18647</refentry>
18648
18649<refentry id="API-device-destroy">
18650<refentryinfo>
18651 <title>LINUX</title>
18652 <productname>Kernel Hackers Manual</productname>
18653 <date>July 2017</date>
18654</refentryinfo>
18655<refmeta>
18656 <refentrytitle><phrase>device_destroy</phrase></refentrytitle>
18657 <manvolnum>9</manvolnum>
18658 <refmiscinfo class="version">4.1.27</refmiscinfo>
18659</refmeta>
18660<refnamediv>
18661 <refname>device_destroy</refname>
18662 <refpurpose>
18663     removes a device that was created with <function>device_create</function>
18664 </refpurpose>
18665</refnamediv>
18666<refsynopsisdiv>
18667 <title>Synopsis</title>
18668  <funcsynopsis><funcprototype>
18669   <funcdef>void <function>device_destroy </function></funcdef>
18670   <paramdef>struct class * <parameter>class</parameter></paramdef>
18671   <paramdef>dev_t <parameter>devt</parameter></paramdef>
18672  </funcprototype></funcsynopsis>
18673</refsynopsisdiv>
18674<refsect1>
18675 <title>Arguments</title>
18676 <variablelist>
18677  <varlistentry>
18678   <term><parameter>class</parameter></term>
18679   <listitem>
18680    <para>
18681     pointer to the struct class that this device was registered with
18682    </para>
18683   </listitem>
18684  </varlistentry>
18685  <varlistentry>
18686   <term><parameter>devt</parameter></term>
18687   <listitem>
18688    <para>
18689     the dev_t of the device that was previously registered
18690    </para>
18691   </listitem>
18692  </varlistentry>
18693 </variablelist>
18694</refsect1>
18695<refsect1>
18696<title>Description</title>
18697<para>
18698   This call unregisters and cleans up a device that was created with a
18699   call to <function>device_create</function>.
18700</para>
18701</refsect1>
18702</refentry>
18703
18704<refentry id="API-device-rename">
18705<refentryinfo>
18706 <title>LINUX</title>
18707 <productname>Kernel Hackers Manual</productname>
18708 <date>July 2017</date>
18709</refentryinfo>
18710<refmeta>
18711 <refentrytitle><phrase>device_rename</phrase></refentrytitle>
18712 <manvolnum>9</manvolnum>
18713 <refmiscinfo class="version">4.1.27</refmiscinfo>
18714</refmeta>
18715<refnamediv>
18716 <refname>device_rename</refname>
18717 <refpurpose>
18718     renames a device
18719 </refpurpose>
18720</refnamediv>
18721<refsynopsisdiv>
18722 <title>Synopsis</title>
18723  <funcsynopsis><funcprototype>
18724   <funcdef>int <function>device_rename </function></funcdef>
18725   <paramdef>struct device * <parameter>dev</parameter></paramdef>
18726   <paramdef>const char * <parameter>new_name</parameter></paramdef>
18727  </funcprototype></funcsynopsis>
18728</refsynopsisdiv>
18729<refsect1>
18730 <title>Arguments</title>
18731 <variablelist>
18732  <varlistentry>
18733   <term><parameter>dev</parameter></term>
18734   <listitem>
18735    <para>
18736     the pointer to the struct device to be renamed
18737    </para>
18738   </listitem>
18739  </varlistentry>
18740  <varlistentry>
18741   <term><parameter>new_name</parameter></term>
18742   <listitem>
18743    <para>
18744     the new name of the device
18745    </para>
18746   </listitem>
18747  </varlistentry>
18748 </variablelist>
18749</refsect1>
18750<refsect1>
18751<title>Description</title>
18752<para>
18753   It is the responsibility of the caller to provide mutual
18754   exclusion between two different calls of device_rename
18755   on the same device to ensure that new_name is valid and
18756   won't conflict with other devices.
18757</para>
18758</refsect1>
18759<refsect1>
18760<title>Note</title>
18761<para>
18762   Don't call this function.  Currently, the networking layer calls this
18763   function, but that will change.  The following text from Kay Sievers offers
18764</para>
18765</refsect1>
18766<refsect1>
18767<title>some insight</title>
18768<para>
18769   </para><para>
18770
18771   Renaming devices is racy at many levels, symlinks and other stuff are not
18772   replaced atomically, and you get a <quote>move</quote> uevent, but it's not easy to
18773   connect the event to the old and new device. Device nodes are not renamed at
18774   all, there isn't even support for that in the kernel now.
18775   </para><para>
18776
18777   In the meantime, during renaming, your target name might be taken by another
18778   driver, creating conflicts. Or the old name is taken directly after you
18779   renamed it -- then you get events for the same DEVPATH, before you even see
18780   the <quote>move</quote> event. It's just a mess, and nothing new should ever rely on
18781   kernel device renaming. Besides that, it's not even implemented now for
18782   other things than (driver-core wise very simple) network devices.
18783   </para><para>
18784
18785   We are currently about to change network renaming in udev to completely
18786   disallow renaming of devices in the same namespace as the kernel uses,
18787   because we can't solve the problems properly, that arise with swapping names
18788   of multiple interfaces without races. Means, renaming of eth[0-9]* will only
18789   be allowed to some other name than eth[0-9]*, for the aforementioned
18790   reasons.
18791   </para><para>
18792
18793   Make up a <quote>real</quote> name in the driver before you register anything, or add
18794   some other attributes for userspace to find the device, or use udev to add
18795   symlinks -- but never rename kernel devices later, it's a complete mess. We
18796   don't even want to get into that and try to implement the missing pieces in
18797   the core. We really have other pieces to fix in the driver core mess. :)
18798</para>
18799</refsect1>
18800</refentry>
18801
18802<refentry id="API-device-move">
18803<refentryinfo>
18804 <title>LINUX</title>
18805 <productname>Kernel Hackers Manual</productname>
18806 <date>July 2017</date>
18807</refentryinfo>
18808<refmeta>
18809 <refentrytitle><phrase>device_move</phrase></refentrytitle>
18810 <manvolnum>9</manvolnum>
18811 <refmiscinfo class="version">4.1.27</refmiscinfo>
18812</refmeta>
18813<refnamediv>
18814 <refname>device_move</refname>
18815 <refpurpose>
18816     moves a device to a new parent
18817 </refpurpose>
18818</refnamediv>
18819<refsynopsisdiv>
18820 <title>Synopsis</title>
18821  <funcsynopsis><funcprototype>
18822   <funcdef>int <function>device_move </function></funcdef>
18823   <paramdef>struct device * <parameter>dev</parameter></paramdef>
18824   <paramdef>struct device * <parameter>new_parent</parameter></paramdef>
18825   <paramdef>enum dpm_order <parameter>dpm_order</parameter></paramdef>
18826  </funcprototype></funcsynopsis>
18827</refsynopsisdiv>
18828<refsect1>
18829 <title>Arguments</title>
18830 <variablelist>
18831  <varlistentry>
18832   <term><parameter>dev</parameter></term>
18833   <listitem>
18834    <para>
18835     the pointer to the struct device to be moved
18836    </para>
18837   </listitem>
18838  </varlistentry>
18839  <varlistentry>
18840   <term><parameter>new_parent</parameter></term>
18841   <listitem>
18842    <para>
18843     the new parent of the device (can by NULL)
18844    </para>
18845   </listitem>
18846  </varlistentry>
18847  <varlistentry>
18848   <term><parameter>dpm_order</parameter></term>
18849   <listitem>
18850    <para>
18851     how to reorder the dpm_list
18852    </para>
18853   </listitem>
18854  </varlistentry>
18855 </variablelist>
18856</refsect1>
18857</refentry>
18858
18859<refentry id="API-set-primary-fwnode">
18860<refentryinfo>
18861 <title>LINUX</title>
18862 <productname>Kernel Hackers Manual</productname>
18863 <date>July 2017</date>
18864</refentryinfo>
18865<refmeta>
18866 <refentrytitle><phrase>set_primary_fwnode</phrase></refentrytitle>
18867 <manvolnum>9</manvolnum>
18868 <refmiscinfo class="version">4.1.27</refmiscinfo>
18869</refmeta>
18870<refnamediv>
18871 <refname>set_primary_fwnode</refname>
18872 <refpurpose>
18873     Change the primary firmware node of a given device.
18874 </refpurpose>
18875</refnamediv>
18876<refsynopsisdiv>
18877 <title>Synopsis</title>
18878  <funcsynopsis><funcprototype>
18879   <funcdef>void <function>set_primary_fwnode </function></funcdef>
18880   <paramdef>struct device * <parameter>dev</parameter></paramdef>
18881   <paramdef>struct fwnode_handle * <parameter>fwnode</parameter></paramdef>
18882  </funcprototype></funcsynopsis>
18883</refsynopsisdiv>
18884<refsect1>
18885 <title>Arguments</title>
18886 <variablelist>
18887  <varlistentry>
18888   <term><parameter>dev</parameter></term>
18889   <listitem>
18890    <para>
18891     Device to handle.
18892    </para>
18893   </listitem>
18894  </varlistentry>
18895  <varlistentry>
18896   <term><parameter>fwnode</parameter></term>
18897   <listitem>
18898    <para>
18899     New primary firmware node of the device.
18900    </para>
18901   </listitem>
18902  </varlistentry>
18903 </variablelist>
18904</refsect1>
18905<refsect1>
18906<title>Description</title>
18907<para>
18908   Set the device's firmware node pointer to <parameter>fwnode</parameter>, but if a secondary
18909   firmware node of the device is present, preserve it.
18910</para>
18911</refsect1>
18912</refentry>
18913
18914<!-- drivers/base/syscore.c -->
18915<refentry id="API-register-syscore-ops">
18916<refentryinfo>
18917 <title>LINUX</title>
18918 <productname>Kernel Hackers Manual</productname>
18919 <date>July 2017</date>
18920</refentryinfo>
18921<refmeta>
18922 <refentrytitle><phrase>register_syscore_ops</phrase></refentrytitle>
18923 <manvolnum>9</manvolnum>
18924 <refmiscinfo class="version">4.1.27</refmiscinfo>
18925</refmeta>
18926<refnamediv>
18927 <refname>register_syscore_ops</refname>
18928 <refpurpose>
18929  Register a set of system core operations.
18930 </refpurpose>
18931</refnamediv>
18932<refsynopsisdiv>
18933 <title>Synopsis</title>
18934  <funcsynopsis><funcprototype>
18935   <funcdef>void <function>register_syscore_ops </function></funcdef>
18936   <paramdef>struct syscore_ops * <parameter>ops</parameter></paramdef>
18937  </funcprototype></funcsynopsis>
18938</refsynopsisdiv>
18939<refsect1>
18940 <title>Arguments</title>
18941 <variablelist>
18942  <varlistentry>
18943   <term><parameter>ops</parameter></term>
18944   <listitem>
18945    <para>
18946     System core operations to register.
18947    </para>
18948   </listitem>
18949  </varlistentry>
18950 </variablelist>
18951</refsect1>
18952</refentry>
18953
18954<refentry id="API-unregister-syscore-ops">
18955<refentryinfo>
18956 <title>LINUX</title>
18957 <productname>Kernel Hackers Manual</productname>
18958 <date>July 2017</date>
18959</refentryinfo>
18960<refmeta>
18961 <refentrytitle><phrase>unregister_syscore_ops</phrase></refentrytitle>
18962 <manvolnum>9</manvolnum>
18963 <refmiscinfo class="version">4.1.27</refmiscinfo>
18964</refmeta>
18965<refnamediv>
18966 <refname>unregister_syscore_ops</refname>
18967 <refpurpose>
18968     Unregister a set of system core operations.
18969 </refpurpose>
18970</refnamediv>
18971<refsynopsisdiv>
18972 <title>Synopsis</title>
18973  <funcsynopsis><funcprototype>
18974   <funcdef>void <function>unregister_syscore_ops </function></funcdef>
18975   <paramdef>struct syscore_ops * <parameter>ops</parameter></paramdef>
18976  </funcprototype></funcsynopsis>
18977</refsynopsisdiv>
18978<refsect1>
18979 <title>Arguments</title>
18980 <variablelist>
18981  <varlistentry>
18982   <term><parameter>ops</parameter></term>
18983   <listitem>
18984    <para>
18985     System core operations to unregister.
18986    </para>
18987   </listitem>
18988  </varlistentry>
18989 </variablelist>
18990</refsect1>
18991</refentry>
18992
18993<refentry id="API-syscore-suspend">
18994<refentryinfo>
18995 <title>LINUX</title>
18996 <productname>Kernel Hackers Manual</productname>
18997 <date>July 2017</date>
18998</refentryinfo>
18999<refmeta>
19000 <refentrytitle><phrase>syscore_suspend</phrase></refentrytitle>
19001 <manvolnum>9</manvolnum>
19002 <refmiscinfo class="version">4.1.27</refmiscinfo>
19003</refmeta>
19004<refnamediv>
19005 <refname>syscore_suspend</refname>
19006 <refpurpose>
19007     Execute all the registered system core suspend callbacks.
19008 </refpurpose>
19009</refnamediv>
19010<refsynopsisdiv>
19011 <title>Synopsis</title>
19012  <funcsynopsis><funcprototype>
19013   <funcdef>int <function>syscore_suspend </function></funcdef>
19014   <paramdef> <parameter>void</parameter></paramdef>
19015  </funcprototype></funcsynopsis>
19016</refsynopsisdiv>
19017<refsect1>
19018 <title>Arguments</title>
19019 <variablelist>
19020  <varlistentry>
19021   <term><parameter>void</parameter></term>
19022   <listitem>
19023    <para>
19024     no arguments
19025    </para>
19026   </listitem>
19027  </varlistentry>
19028 </variablelist>
19029</refsect1>
19030<refsect1>
19031<title>Description</title>
19032<para>
19033   </para><para>
19034
19035   This function is executed with one CPU on-line and disabled interrupts.
19036</para>
19037</refsect1>
19038</refentry>
19039
19040<refentry id="API-syscore-resume">
19041<refentryinfo>
19042 <title>LINUX</title>
19043 <productname>Kernel Hackers Manual</productname>
19044 <date>July 2017</date>
19045</refentryinfo>
19046<refmeta>
19047 <refentrytitle><phrase>syscore_resume</phrase></refentrytitle>
19048 <manvolnum>9</manvolnum>
19049 <refmiscinfo class="version">4.1.27</refmiscinfo>
19050</refmeta>
19051<refnamediv>
19052 <refname>syscore_resume</refname>
19053 <refpurpose>
19054     Execute all the registered system core resume callbacks.
19055 </refpurpose>
19056</refnamediv>
19057<refsynopsisdiv>
19058 <title>Synopsis</title>
19059  <funcsynopsis><funcprototype>
19060   <funcdef>void <function>syscore_resume </function></funcdef>
19061   <paramdef> <parameter>void</parameter></paramdef>
19062  </funcprototype></funcsynopsis>
19063</refsynopsisdiv>
19064<refsect1>
19065 <title>Arguments</title>
19066 <variablelist>
19067  <varlistentry>
19068   <term><parameter>void</parameter></term>
19069   <listitem>
19070    <para>
19071     no arguments
19072    </para>
19073   </listitem>
19074  </varlistentry>
19075 </variablelist>
19076</refsect1>
19077<refsect1>
19078<title>Description</title>
19079<para>
19080   </para><para>
19081
19082   This function is executed with one CPU on-line and disabled interrupts.
19083</para>
19084</refsect1>
19085</refentry>
19086
19087<!-- drivers/base/class.c -->
19088<refentry id="API---class-create">
19089<refentryinfo>
19090 <title>LINUX</title>
19091 <productname>Kernel Hackers Manual</productname>
19092 <date>July 2017</date>
19093</refentryinfo>
19094<refmeta>
19095 <refentrytitle><phrase>__class_create</phrase></refentrytitle>
19096 <manvolnum>9</manvolnum>
19097 <refmiscinfo class="version">4.1.27</refmiscinfo>
19098</refmeta>
19099<refnamediv>
19100 <refname>__class_create</refname>
19101 <refpurpose>
19102  create a struct class structure
19103 </refpurpose>
19104</refnamediv>
19105<refsynopsisdiv>
19106 <title>Synopsis</title>
19107  <funcsynopsis><funcprototype>
19108   <funcdef>struct class * <function>__class_create </function></funcdef>
19109   <paramdef>struct module * <parameter>owner</parameter></paramdef>
19110   <paramdef>const char * <parameter>name</parameter></paramdef>
19111   <paramdef>struct lock_class_key * <parameter>key</parameter></paramdef>
19112  </funcprototype></funcsynopsis>
19113</refsynopsisdiv>
19114<refsect1>
19115 <title>Arguments</title>
19116 <variablelist>
19117  <varlistentry>
19118   <term><parameter>owner</parameter></term>
19119   <listitem>
19120    <para>
19121     pointer to the module that is to <quote>own</quote> this struct class
19122    </para>
19123   </listitem>
19124  </varlistentry>
19125  <varlistentry>
19126   <term><parameter>name</parameter></term>
19127   <listitem>
19128    <para>
19129     pointer to a string for the name of this class.
19130    </para>
19131   </listitem>
19132  </varlistentry>
19133  <varlistentry>
19134   <term><parameter>key</parameter></term>
19135   <listitem>
19136    <para>
19137     the lock_class_key for this class; used by mutex lock debugging
19138    </para>
19139   </listitem>
19140  </varlistentry>
19141 </variablelist>
19142</refsect1>
19143<refsect1>
19144<title>Description</title>
19145<para>
19146   This is used to create a struct class pointer that can then be used
19147   in calls to <function>device_create</function>.
19148   </para><para>
19149
19150   Returns <structname>struct class</structname> pointer on success, or <function>ERR_PTR</function> on error.
19151   </para><para>
19152
19153   Note, the pointer created here is to be destroyed when finished by
19154   making a call to <function>class_destroy</function>.
19155</para>
19156</refsect1>
19157</refentry>
19158
19159<refentry id="API-class-destroy">
19160<refentryinfo>
19161 <title>LINUX</title>
19162 <productname>Kernel Hackers Manual</productname>
19163 <date>July 2017</date>
19164</refentryinfo>
19165<refmeta>
19166 <refentrytitle><phrase>class_destroy</phrase></refentrytitle>
19167 <manvolnum>9</manvolnum>
19168 <refmiscinfo class="version">4.1.27</refmiscinfo>
19169</refmeta>
19170<refnamediv>
19171 <refname>class_destroy</refname>
19172 <refpurpose>
19173     destroys a struct class structure
19174 </refpurpose>
19175</refnamediv>
19176<refsynopsisdiv>
19177 <title>Synopsis</title>
19178  <funcsynopsis><funcprototype>
19179   <funcdef>void <function>class_destroy </function></funcdef>
19180   <paramdef>struct class * <parameter>cls</parameter></paramdef>
19181  </funcprototype></funcsynopsis>
19182</refsynopsisdiv>
19183<refsect1>
19184 <title>Arguments</title>
19185 <variablelist>
19186  <varlistentry>
19187   <term><parameter>cls</parameter></term>
19188   <listitem>
19189    <para>
19190     pointer to the struct class that is to be destroyed
19191    </para>
19192   </listitem>
19193  </varlistentry>
19194 </variablelist>
19195</refsect1>
19196<refsect1>
19197<title>Description</title>
19198<para>
19199   Note, the pointer to be destroyed must have been created with a call
19200   to <function>class_create</function>.
19201</para>
19202</refsect1>
19203</refentry>
19204
19205<refentry id="API-class-dev-iter-init">
19206<refentryinfo>
19207 <title>LINUX</title>
19208 <productname>Kernel Hackers Manual</productname>
19209 <date>July 2017</date>
19210</refentryinfo>
19211<refmeta>
19212 <refentrytitle><phrase>class_dev_iter_init</phrase></refentrytitle>
19213 <manvolnum>9</manvolnum>
19214 <refmiscinfo class="version">4.1.27</refmiscinfo>
19215</refmeta>
19216<refnamediv>
19217 <refname>class_dev_iter_init</refname>
19218 <refpurpose>
19219     initialize class device iterator
19220 </refpurpose>
19221</refnamediv>
19222<refsynopsisdiv>
19223 <title>Synopsis</title>
19224  <funcsynopsis><funcprototype>
19225   <funcdef>void <function>class_dev_iter_init </function></funcdef>
19226   <paramdef>struct class_dev_iter * <parameter>iter</parameter></paramdef>
19227   <paramdef>struct class * <parameter>class</parameter></paramdef>
19228   <paramdef>struct device * <parameter>start</parameter></paramdef>
19229   <paramdef>const struct device_type * <parameter>type</parameter></paramdef>
19230  </funcprototype></funcsynopsis>
19231</refsynopsisdiv>
19232<refsect1>
19233 <title>Arguments</title>
19234 <variablelist>
19235  <varlistentry>
19236   <term><parameter>iter</parameter></term>
19237   <listitem>
19238    <para>
19239     class iterator to initialize
19240    </para>
19241   </listitem>
19242  </varlistentry>
19243  <varlistentry>
19244   <term><parameter>class</parameter></term>
19245   <listitem>
19246    <para>
19247     the class we wanna iterate over
19248    </para>
19249   </listitem>
19250  </varlistentry>
19251  <varlistentry>
19252   <term><parameter>start</parameter></term>
19253   <listitem>
19254    <para>
19255     the device to start iterating from, if any
19256    </para>
19257   </listitem>
19258  </varlistentry>
19259  <varlistentry>
19260   <term><parameter>type</parameter></term>
19261   <listitem>
19262    <para>
19263     device_type of the devices to iterate over, NULL for all
19264    </para>
19265   </listitem>
19266  </varlistentry>
19267 </variablelist>
19268</refsect1>
19269<refsect1>
19270<title>Description</title>
19271<para>
19272   Initialize class iterator <parameter>iter</parameter> such that it iterates over devices
19273   of <parameter>class</parameter>.  If <parameter>start</parameter> is set, the list iteration will start there,
19274   otherwise if it is NULL, the iteration starts at the beginning of
19275   the list.
19276</para>
19277</refsect1>
19278</refentry>
19279
19280<refentry id="API-class-dev-iter-next">
19281<refentryinfo>
19282 <title>LINUX</title>
19283 <productname>Kernel Hackers Manual</productname>
19284 <date>July 2017</date>
19285</refentryinfo>
19286<refmeta>
19287 <refentrytitle><phrase>class_dev_iter_next</phrase></refentrytitle>
19288 <manvolnum>9</manvolnum>
19289 <refmiscinfo class="version">4.1.27</refmiscinfo>
19290</refmeta>
19291<refnamediv>
19292 <refname>class_dev_iter_next</refname>
19293 <refpurpose>
19294     iterate to the next device
19295 </refpurpose>
19296</refnamediv>
19297<refsynopsisdiv>
19298 <title>Synopsis</title>
19299  <funcsynopsis><funcprototype>
19300   <funcdef>struct device * <function>class_dev_iter_next </function></funcdef>
19301   <paramdef>struct class_dev_iter * <parameter>iter</parameter></paramdef>
19302  </funcprototype></funcsynopsis>
19303</refsynopsisdiv>
19304<refsect1>
19305 <title>Arguments</title>
19306 <variablelist>
19307  <varlistentry>
19308   <term><parameter>iter</parameter></term>
19309   <listitem>
19310    <para>
19311     class iterator to proceed
19312    </para>
19313   </listitem>
19314  </varlistentry>
19315 </variablelist>
19316</refsect1>
19317<refsect1>
19318<title>Description</title>
19319<para>
19320   Proceed <parameter>iter</parameter> to the next device and return it.  Returns NULL if
19321   iteration is complete.
19322   </para><para>
19323
19324   The returned device is referenced and won't be released till
19325   iterator is proceed to the next device or exited.  The caller is
19326   free to do whatever it wants to do with the device including
19327   calling back into class code.
19328</para>
19329</refsect1>
19330</refentry>
19331
19332<refentry id="API-class-dev-iter-exit">
19333<refentryinfo>
19334 <title>LINUX</title>
19335 <productname>Kernel Hackers Manual</productname>
19336 <date>July 2017</date>
19337</refentryinfo>
19338<refmeta>
19339 <refentrytitle><phrase>class_dev_iter_exit</phrase></refentrytitle>
19340 <manvolnum>9</manvolnum>
19341 <refmiscinfo class="version">4.1.27</refmiscinfo>
19342</refmeta>
19343<refnamediv>
19344 <refname>class_dev_iter_exit</refname>
19345 <refpurpose>
19346     finish iteration
19347 </refpurpose>
19348</refnamediv>
19349<refsynopsisdiv>
19350 <title>Synopsis</title>
19351  <funcsynopsis><funcprototype>
19352   <funcdef>void <function>class_dev_iter_exit </function></funcdef>
19353   <paramdef>struct class_dev_iter * <parameter>iter</parameter></paramdef>
19354  </funcprototype></funcsynopsis>
19355</refsynopsisdiv>
19356<refsect1>
19357 <title>Arguments</title>
19358 <variablelist>
19359  <varlistentry>
19360   <term><parameter>iter</parameter></term>
19361   <listitem>
19362    <para>
19363     class iterator to finish
19364    </para>
19365   </listitem>
19366  </varlistentry>
19367 </variablelist>
19368</refsect1>
19369<refsect1>
19370<title>Description</title>
19371<para>
19372   Finish an iteration.  Always call this function after iteration is
19373   complete whether the iteration ran till the end or not.
19374</para>
19375</refsect1>
19376</refentry>
19377
19378<refentry id="API-class-for-each-device">
19379<refentryinfo>
19380 <title>LINUX</title>
19381 <productname>Kernel Hackers Manual</productname>
19382 <date>July 2017</date>
19383</refentryinfo>
19384<refmeta>
19385 <refentrytitle><phrase>class_for_each_device</phrase></refentrytitle>
19386 <manvolnum>9</manvolnum>
19387 <refmiscinfo class="version">4.1.27</refmiscinfo>
19388</refmeta>
19389<refnamediv>
19390 <refname>class_for_each_device</refname>
19391 <refpurpose>
19392     device iterator
19393 </refpurpose>
19394</refnamediv>
19395<refsynopsisdiv>
19396 <title>Synopsis</title>
19397  <funcsynopsis><funcprototype>
19398   <funcdef>int <function>class_for_each_device </function></funcdef>
19399   <paramdef>struct class * <parameter>class</parameter></paramdef>
19400   <paramdef>struct device * <parameter>start</parameter></paramdef>
19401   <paramdef>void * <parameter>data</parameter></paramdef>
19402   <paramdef>int (*<parameter>fn</parameter>)
19403     <funcparams>struct device *, void *</funcparams></paramdef>
19404  </funcprototype></funcsynopsis>
19405</refsynopsisdiv>
19406<refsect1>
19407 <title>Arguments</title>
19408 <variablelist>
19409  <varlistentry>
19410   <term><parameter>class</parameter></term>
19411   <listitem>
19412    <para>
19413     the class we're iterating
19414    </para>
19415   </listitem>
19416  </varlistentry>
19417  <varlistentry>
19418   <term><parameter>start</parameter></term>
19419   <listitem>
19420    <para>
19421     the device to start with in the list, if any.
19422    </para>
19423   </listitem>
19424  </varlistentry>
19425  <varlistentry>
19426   <term><parameter>data</parameter></term>
19427   <listitem>
19428    <para>
19429     data for the callback
19430    </para>
19431   </listitem>
19432  </varlistentry>
19433  <varlistentry>
19434   <term><parameter>fn</parameter></term>
19435   <listitem>
19436    <para>
19437     function to be called for each device
19438    </para>
19439   </listitem>
19440  </varlistentry>
19441 </variablelist>
19442</refsect1>
19443<refsect1>
19444<title>Description</title>
19445<para>
19446   Iterate over <parameter>class</parameter>'s list of devices, and call <parameter>fn</parameter> for each,
19447   passing it <parameter>data</parameter>.  If <parameter>start</parameter> is set, the list iteration will start
19448   there, otherwise if it is NULL, the iteration starts at the
19449   beginning of the list.
19450   </para><para>
19451
19452   We check the return of <parameter>fn</parameter> each time. If it returns anything
19453   other than 0, we break out and return that value.
19454   </para><para>
19455
19456   <parameter>fn</parameter> is allowed to do anything including calling back into class
19457   code.  There's no locking restriction.
19458</para>
19459</refsect1>
19460</refentry>
19461
19462<refentry id="API-class-find-device">
19463<refentryinfo>
19464 <title>LINUX</title>
19465 <productname>Kernel Hackers Manual</productname>
19466 <date>July 2017</date>
19467</refentryinfo>
19468<refmeta>
19469 <refentrytitle><phrase>class_find_device</phrase></refentrytitle>
19470 <manvolnum>9</manvolnum>
19471 <refmiscinfo class="version">4.1.27</refmiscinfo>
19472</refmeta>
19473<refnamediv>
19474 <refname>class_find_device</refname>
19475 <refpurpose>
19476     device iterator for locating a particular device
19477 </refpurpose>
19478</refnamediv>
19479<refsynopsisdiv>
19480 <title>Synopsis</title>
19481  <funcsynopsis><funcprototype>
19482   <funcdef>struct device * <function>class_find_device </function></funcdef>
19483   <paramdef>struct class * <parameter>class</parameter></paramdef>
19484   <paramdef>struct device * <parameter>start</parameter></paramdef>
19485   <paramdef>const void * <parameter>data</parameter></paramdef>
19486   <paramdef>int (*<parameter>match</parameter>)
19487     <funcparams>struct device *, const void *</funcparams></paramdef>
19488  </funcprototype></funcsynopsis>
19489</refsynopsisdiv>
19490<refsect1>
19491 <title>Arguments</title>
19492 <variablelist>
19493  <varlistentry>
19494   <term><parameter>class</parameter></term>
19495   <listitem>
19496    <para>
19497     the class we're iterating
19498    </para>
19499   </listitem>
19500  </varlistentry>
19501  <varlistentry>
19502   <term><parameter>start</parameter></term>
19503   <listitem>
19504    <para>
19505     Device to begin with
19506    </para>
19507   </listitem>
19508  </varlistentry>
19509  <varlistentry>
19510   <term><parameter>data</parameter></term>
19511   <listitem>
19512    <para>
19513     data for the match function
19514    </para>
19515   </listitem>
19516  </varlistentry>
19517  <varlistentry>
19518   <term><parameter>match</parameter></term>
19519   <listitem>
19520    <para>
19521     function to check device
19522    </para>
19523   </listitem>
19524  </varlistentry>
19525 </variablelist>
19526</refsect1>
19527<refsect1>
19528<title>Description</title>
19529<para>
19530   This is similar to the <function>class_for_each_dev</function> function above, but it
19531   returns a reference to a device that is 'found' for later use, as
19532   determined by the <parameter>match</parameter> callback.
19533   </para><para>
19534
19535   The callback should return 0 if the device doesn't match and non-zero
19536   if it does.  If the callback returns non-zero, this function will
19537   return to the caller and not iterate over any more devices.
19538   </para><para>
19539
19540   Note, you will need to drop the reference with <function>put_device</function> after use.
19541   </para><para>
19542
19543   <parameter>fn</parameter> is allowed to do anything including calling back into class
19544   code.  There's no locking restriction.
19545</para>
19546</refsect1>
19547</refentry>
19548
19549<refentry id="API-class-compat-register">
19550<refentryinfo>
19551 <title>LINUX</title>
19552 <productname>Kernel Hackers Manual</productname>
19553 <date>July 2017</date>
19554</refentryinfo>
19555<refmeta>
19556 <refentrytitle><phrase>class_compat_register</phrase></refentrytitle>
19557 <manvolnum>9</manvolnum>
19558 <refmiscinfo class="version">4.1.27</refmiscinfo>
19559</refmeta>
19560<refnamediv>
19561 <refname>class_compat_register</refname>
19562 <refpurpose>
19563     register a compatibility class
19564 </refpurpose>
19565</refnamediv>
19566<refsynopsisdiv>
19567 <title>Synopsis</title>
19568  <funcsynopsis><funcprototype>
19569   <funcdef>struct class_compat * <function>class_compat_register </function></funcdef>
19570   <paramdef>const char * <parameter>name</parameter></paramdef>
19571  </funcprototype></funcsynopsis>
19572</refsynopsisdiv>
19573<refsect1>
19574 <title>Arguments</title>
19575 <variablelist>
19576  <varlistentry>
19577   <term><parameter>name</parameter></term>
19578   <listitem>
19579    <para>
19580     the name of the class
19581    </para>
19582   </listitem>
19583  </varlistentry>
19584 </variablelist>
19585</refsect1>
19586<refsect1>
19587<title>Description</title>
19588<para>
19589   Compatibility class are meant as a temporary user-space compatibility
19590   workaround when converting a family of class devices to a bus devices.
19591</para>
19592</refsect1>
19593</refentry>
19594
19595<refentry id="API-class-compat-unregister">
19596<refentryinfo>
19597 <title>LINUX</title>
19598 <productname>Kernel Hackers Manual</productname>
19599 <date>July 2017</date>
19600</refentryinfo>
19601<refmeta>
19602 <refentrytitle><phrase>class_compat_unregister</phrase></refentrytitle>
19603 <manvolnum>9</manvolnum>
19604 <refmiscinfo class="version">4.1.27</refmiscinfo>
19605</refmeta>
19606<refnamediv>
19607 <refname>class_compat_unregister</refname>
19608 <refpurpose>
19609     unregister a compatibility class
19610 </refpurpose>
19611</refnamediv>
19612<refsynopsisdiv>
19613 <title>Synopsis</title>
19614  <funcsynopsis><funcprototype>
19615   <funcdef>void <function>class_compat_unregister </function></funcdef>
19616   <paramdef>struct class_compat * <parameter>cls</parameter></paramdef>
19617  </funcprototype></funcsynopsis>
19618</refsynopsisdiv>
19619<refsect1>
19620 <title>Arguments</title>
19621 <variablelist>
19622  <varlistentry>
19623   <term><parameter>cls</parameter></term>
19624   <listitem>
19625    <para>
19626     the class to unregister
19627    </para>
19628   </listitem>
19629  </varlistentry>
19630 </variablelist>
19631</refsect1>
19632</refentry>
19633
19634<refentry id="API-class-compat-create-link">
19635<refentryinfo>
19636 <title>LINUX</title>
19637 <productname>Kernel Hackers Manual</productname>
19638 <date>July 2017</date>
19639</refentryinfo>
19640<refmeta>
19641 <refentrytitle><phrase>class_compat_create_link</phrase></refentrytitle>
19642 <manvolnum>9</manvolnum>
19643 <refmiscinfo class="version">4.1.27</refmiscinfo>
19644</refmeta>
19645<refnamediv>
19646 <refname>class_compat_create_link</refname>
19647 <refpurpose>
19648     create a compatibility class device link to a bus device
19649 </refpurpose>
19650</refnamediv>
19651<refsynopsisdiv>
19652 <title>Synopsis</title>
19653  <funcsynopsis><funcprototype>
19654   <funcdef>int <function>class_compat_create_link </function></funcdef>
19655   <paramdef>struct class_compat * <parameter>cls</parameter></paramdef>
19656   <paramdef>struct device * <parameter>dev</parameter></paramdef>
19657   <paramdef>struct device * <parameter>device_link</parameter></paramdef>
19658  </funcprototype></funcsynopsis>
19659</refsynopsisdiv>
19660<refsect1>
19661 <title>Arguments</title>
19662 <variablelist>
19663  <varlistentry>
19664   <term><parameter>cls</parameter></term>
19665   <listitem>
19666    <para>
19667     the compatibility class
19668    </para>
19669   </listitem>
19670  </varlistentry>
19671  <varlistentry>
19672   <term><parameter>dev</parameter></term>
19673   <listitem>
19674    <para>
19675     the target bus device
19676    </para>
19677   </listitem>
19678  </varlistentry>
19679  <varlistentry>
19680   <term><parameter>device_link</parameter></term>
19681   <listitem>
19682    <para>
19683     an optional device to which a <quote>device</quote> link should be created
19684    </para>
19685   </listitem>
19686  </varlistentry>
19687 </variablelist>
19688</refsect1>
19689</refentry>
19690
19691<refentry id="API-class-compat-remove-link">
19692<refentryinfo>
19693 <title>LINUX</title>
19694 <productname>Kernel Hackers Manual</productname>
19695 <date>July 2017</date>
19696</refentryinfo>
19697<refmeta>
19698 <refentrytitle><phrase>class_compat_remove_link</phrase></refentrytitle>
19699 <manvolnum>9</manvolnum>
19700 <refmiscinfo class="version">4.1.27</refmiscinfo>
19701</refmeta>
19702<refnamediv>
19703 <refname>class_compat_remove_link</refname>
19704 <refpurpose>
19705     remove a compatibility class device link to a bus device
19706 </refpurpose>
19707</refnamediv>
19708<refsynopsisdiv>
19709 <title>Synopsis</title>
19710  <funcsynopsis><funcprototype>
19711   <funcdef>void <function>class_compat_remove_link </function></funcdef>
19712   <paramdef>struct class_compat * <parameter>cls</parameter></paramdef>
19713   <paramdef>struct device * <parameter>dev</parameter></paramdef>
19714   <paramdef>struct device * <parameter>device_link</parameter></paramdef>
19715  </funcprototype></funcsynopsis>
19716</refsynopsisdiv>
19717<refsect1>
19718 <title>Arguments</title>
19719 <variablelist>
19720  <varlistentry>
19721   <term><parameter>cls</parameter></term>
19722   <listitem>
19723    <para>
19724     the compatibility class
19725    </para>
19726   </listitem>
19727  </varlistentry>
19728  <varlistentry>
19729   <term><parameter>dev</parameter></term>
19730   <listitem>
19731    <para>
19732     the target bus device
19733    </para>
19734   </listitem>
19735  </varlistentry>
19736  <varlistentry>
19737   <term><parameter>device_link</parameter></term>
19738   <listitem>
19739    <para>
19740     an optional device to which a <quote>device</quote> link was previously
19741     created
19742    </para>
19743   </listitem>
19744  </varlistentry>
19745 </variablelist>
19746</refsect1>
19747</refentry>
19748
19749<!-- drivers/base/node.c -->
19750<refentry id="API-unregister-node">
19751<refentryinfo>
19752 <title>LINUX</title>
19753 <productname>Kernel Hackers Manual</productname>
19754 <date>July 2017</date>
19755</refentryinfo>
19756<refmeta>
19757 <refentrytitle><phrase>unregister_node</phrase></refentrytitle>
19758 <manvolnum>9</manvolnum>
19759 <refmiscinfo class="version">4.1.27</refmiscinfo>
19760</refmeta>
19761<refnamediv>
19762 <refname>unregister_node</refname>
19763 <refpurpose>
19764  unregister a node device
19765 </refpurpose>
19766</refnamediv>
19767<refsynopsisdiv>
19768 <title>Synopsis</title>
19769  <funcsynopsis><funcprototype>
19770   <funcdef>void <function>unregister_node </function></funcdef>
19771   <paramdef>struct node * <parameter>node</parameter></paramdef>
19772  </funcprototype></funcsynopsis>
19773</refsynopsisdiv>
19774<refsect1>
19775 <title>Arguments</title>
19776 <variablelist>
19777  <varlistentry>
19778   <term><parameter>node</parameter></term>
19779   <listitem>
19780    <para>
19781     node going away
19782    </para>
19783   </listitem>
19784  </varlistentry>
19785 </variablelist>
19786</refsect1>
19787<refsect1>
19788<title>Description</title>
19789<para>
19790   Unregisters a node device <parameter>node</parameter>.  All the devices on the node must be
19791   unregistered before calling this function.
19792</para>
19793</refsect1>
19794</refentry>
19795
19796<!-- drivers/base/firmware_class.c -->
19797<refentry id="API-request-firmware">
19798<refentryinfo>
19799 <title>LINUX</title>
19800 <productname>Kernel Hackers Manual</productname>
19801 <date>July 2017</date>
19802</refentryinfo>
19803<refmeta>
19804 <refentrytitle><phrase>request_firmware</phrase></refentrytitle>
19805 <manvolnum>9</manvolnum>
19806 <refmiscinfo class="version">4.1.27</refmiscinfo>
19807</refmeta>
19808<refnamediv>
19809 <refname>request_firmware</refname>
19810 <refpurpose>
19811  send firmware request and wait for it
19812 </refpurpose>
19813</refnamediv>
19814<refsynopsisdiv>
19815 <title>Synopsis</title>
19816  <funcsynopsis><funcprototype>
19817   <funcdef>int <function>request_firmware </function></funcdef>
19818   <paramdef>const struct firmware ** <parameter>firmware_p</parameter></paramdef>
19819   <paramdef>const char * <parameter>name</parameter></paramdef>
19820   <paramdef>struct device * <parameter>device</parameter></paramdef>
19821  </funcprototype></funcsynopsis>
19822</refsynopsisdiv>
19823<refsect1>
19824 <title>Arguments</title>
19825 <variablelist>
19826  <varlistentry>
19827   <term><parameter>firmware_p</parameter></term>
19828   <listitem>
19829    <para>
19830     pointer to firmware image
19831    </para>
19832   </listitem>
19833  </varlistentry>
19834  <varlistentry>
19835   <term><parameter>name</parameter></term>
19836   <listitem>
19837    <para>
19838     name of firmware file
19839    </para>
19840   </listitem>
19841  </varlistentry>
19842  <varlistentry>
19843   <term><parameter>device</parameter></term>
19844   <listitem>
19845    <para>
19846     device for which firmware is being loaded
19847    </para>
19848   </listitem>
19849  </varlistentry>
19850 </variablelist>
19851</refsect1>
19852<refsect1>
19853<title>Description</title>
19854<para>
19855   <parameter>firmware_p</parameter> will be used to return a firmware image by the name
19856   of <parameter>name</parameter> for device <parameter>device</parameter>.
19857   </para><para>
19858
19859   Should be called from user context where sleeping is allowed.
19860   </para><para>
19861
19862   <parameter>name</parameter> will be used as <envar>$FIRMWARE</envar> in the uevent environment and
19863   should be distinctive enough not to be confused with any other
19864   firmware image for this or any other device.
19865   </para><para>
19866
19867   Caller must hold the reference count of <parameter>device</parameter>.
19868   </para><para>
19869
19870   The function can be called safely inside device's suspend and
19871   resume callback.
19872</para>
19873</refsect1>
19874</refentry>
19875
19876<refentry id="API-request-firmware-direct">
19877<refentryinfo>
19878 <title>LINUX</title>
19879 <productname>Kernel Hackers Manual</productname>
19880 <date>July 2017</date>
19881</refentryinfo>
19882<refmeta>
19883 <refentrytitle><phrase>request_firmware_direct</phrase></refentrytitle>
19884 <manvolnum>9</manvolnum>
19885 <refmiscinfo class="version">4.1.27</refmiscinfo>
19886</refmeta>
19887<refnamediv>
19888 <refname>request_firmware_direct</refname>
19889 <refpurpose>
19890     load firmware directly without usermode helper
19891 </refpurpose>
19892</refnamediv>
19893<refsynopsisdiv>
19894 <title>Synopsis</title>
19895  <funcsynopsis><funcprototype>
19896   <funcdef>int <function>request_firmware_direct </function></funcdef>
19897   <paramdef>const struct firmware ** <parameter>firmware_p</parameter></paramdef>
19898   <paramdef>const char * <parameter>name</parameter></paramdef>
19899   <paramdef>struct device * <parameter>device</parameter></paramdef>
19900  </funcprototype></funcsynopsis>
19901</refsynopsisdiv>
19902<refsect1>
19903 <title>Arguments</title>
19904 <variablelist>
19905  <varlistentry>
19906   <term><parameter>firmware_p</parameter></term>
19907   <listitem>
19908    <para>
19909     pointer to firmware image
19910    </para>
19911   </listitem>
19912  </varlistentry>
19913  <varlistentry>
19914   <term><parameter>name</parameter></term>
19915   <listitem>
19916    <para>
19917     name of firmware file
19918    </para>
19919   </listitem>
19920  </varlistentry>
19921  <varlistentry>
19922   <term><parameter>device</parameter></term>
19923   <listitem>
19924    <para>
19925     device for which firmware is being loaded
19926    </para>
19927   </listitem>
19928  </varlistentry>
19929 </variablelist>
19930</refsect1>
19931<refsect1>
19932<title>Description</title>
19933<para>
19934   This function works pretty much like <function>request_firmware</function>, but this doesn't
19935   fall back to usermode helper even if the firmware couldn't be loaded
19936   directly from fs.  Hence it's useful for loading optional firmwares, which
19937   aren't always present, without extra long timeouts of udev.
19938</para>
19939</refsect1>
19940</refentry>
19941
19942<refentry id="API-release-firmware">
19943<refentryinfo>
19944 <title>LINUX</title>
19945 <productname>Kernel Hackers Manual</productname>
19946 <date>July 2017</date>
19947</refentryinfo>
19948<refmeta>
19949 <refentrytitle><phrase>release_firmware</phrase></refentrytitle>
19950 <manvolnum>9</manvolnum>
19951 <refmiscinfo class="version">4.1.27</refmiscinfo>
19952</refmeta>
19953<refnamediv>
19954 <refname>release_firmware</refname>
19955 <refpurpose>
19956     release the resource associated with a firmware image
19957 </refpurpose>
19958</refnamediv>
19959<refsynopsisdiv>
19960 <title>Synopsis</title>
19961  <funcsynopsis><funcprototype>
19962   <funcdef>void <function>release_firmware </function></funcdef>
19963   <paramdef>const struct firmware * <parameter>fw</parameter></paramdef>
19964  </funcprototype></funcsynopsis>
19965</refsynopsisdiv>
19966<refsect1>
19967 <title>Arguments</title>
19968 <variablelist>
19969  <varlistentry>
19970   <term><parameter>fw</parameter></term>
19971   <listitem>
19972    <para>
19973     firmware resource to release
19974    </para>
19975   </listitem>
19976  </varlistentry>
19977 </variablelist>
19978</refsect1>
19979</refentry>
19980
19981<refentry id="API-request-firmware-nowait">
19982<refentryinfo>
19983 <title>LINUX</title>
19984 <productname>Kernel Hackers Manual</productname>
19985 <date>July 2017</date>
19986</refentryinfo>
19987<refmeta>
19988 <refentrytitle><phrase>request_firmware_nowait</phrase></refentrytitle>
19989 <manvolnum>9</manvolnum>
19990 <refmiscinfo class="version">4.1.27</refmiscinfo>
19991</refmeta>
19992<refnamediv>
19993 <refname>request_firmware_nowait</refname>
19994 <refpurpose>
19995     asynchronous version of request_firmware
19996 </refpurpose>
19997</refnamediv>
19998<refsynopsisdiv>
19999 <title>Synopsis</title>
20000  <funcsynopsis><funcprototype>
20001   <funcdef>int <function>request_firmware_nowait </function></funcdef>
20002   <paramdef>struct module * <parameter>module</parameter></paramdef>
20003   <paramdef>bool <parameter>uevent</parameter></paramdef>
20004   <paramdef>const char * <parameter>name</parameter></paramdef>
20005   <paramdef>struct device * <parameter>device</parameter></paramdef>
20006   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
20007   <paramdef>void * <parameter>context</parameter></paramdef>
20008   <paramdef>void (*<parameter>cont</parameter>)
20009     <funcparams>const struct firmware *fw, void *context</funcparams></paramdef>
20010  </funcprototype></funcsynopsis>
20011</refsynopsisdiv>
20012<refsect1>
20013 <title>Arguments</title>
20014 <variablelist>
20015  <varlistentry>
20016   <term><parameter>module</parameter></term>
20017   <listitem>
20018    <para>
20019     module requesting the firmware
20020    </para>
20021   </listitem>
20022  </varlistentry>
20023  <varlistentry>
20024   <term><parameter>uevent</parameter></term>
20025   <listitem>
20026    <para>
20027     sends uevent to copy the firmware image if this flag
20028     is non-zero else the firmware copy must be done manually.
20029    </para>
20030   </listitem>
20031  </varlistentry>
20032  <varlistentry>
20033   <term><parameter>name</parameter></term>
20034   <listitem>
20035    <para>
20036     name of firmware file
20037    </para>
20038   </listitem>
20039  </varlistentry>
20040  <varlistentry>
20041   <term><parameter>device</parameter></term>
20042   <listitem>
20043    <para>
20044     device for which firmware is being loaded
20045    </para>
20046   </listitem>
20047  </varlistentry>
20048  <varlistentry>
20049   <term><parameter>gfp</parameter></term>
20050   <listitem>
20051    <para>
20052     allocation flags
20053    </para>
20054   </listitem>
20055  </varlistentry>
20056  <varlistentry>
20057   <term><parameter>context</parameter></term>
20058   <listitem>
20059    <para>
20060     will be passed over to <parameter>cont</parameter>, and
20061     <parameter>fw</parameter> may be <constant>NULL</constant> if firmware request fails.
20062    </para>
20063   </listitem>
20064  </varlistentry>
20065  <varlistentry>
20066   <term><parameter>cont</parameter></term>
20067   <listitem>
20068    <para>
20069     function will be called asynchronously when the firmware
20070     request is over.
20071    </para>
20072   </listitem>
20073  </varlistentry>
20074 </variablelist>
20075</refsect1>
20076<refsect1>
20077<title>Description</title>
20078<para>
20079   Caller must hold the reference count of <parameter>device</parameter>.
20080   </para><para>
20081
20082   Asynchronous variant of <function>request_firmware</function> for user contexts:
20083   - sleep for as small periods as possible since it may
20084   increase kernel boot time of built-in device drivers
20085   requesting firmware in their -&gt;<function>probe</function> methods, if
20086   <parameter>gfp</parameter> is GFP_KERNEL.
20087   </para><para>
20088
20089   - can't sleep at all if <parameter>gfp</parameter> is GFP_ATOMIC.
20090</para>
20091</refsect1>
20092</refentry>
20093
20094<!-- drivers/base/transport_class.c -->
20095<refentry id="API-transport-class-register">
20096<refentryinfo>
20097 <title>LINUX</title>
20098 <productname>Kernel Hackers Manual</productname>
20099 <date>July 2017</date>
20100</refentryinfo>
20101<refmeta>
20102 <refentrytitle><phrase>transport_class_register</phrase></refentrytitle>
20103 <manvolnum>9</manvolnum>
20104 <refmiscinfo class="version">4.1.27</refmiscinfo>
20105</refmeta>
20106<refnamediv>
20107 <refname>transport_class_register</refname>
20108 <refpurpose>
20109  register an initial transport class
20110 </refpurpose>
20111</refnamediv>
20112<refsynopsisdiv>
20113 <title>Synopsis</title>
20114  <funcsynopsis><funcprototype>
20115   <funcdef>int <function>transport_class_register </function></funcdef>
20116   <paramdef>struct transport_class * <parameter>tclass</parameter></paramdef>
20117  </funcprototype></funcsynopsis>
20118</refsynopsisdiv>
20119<refsect1>
20120 <title>Arguments</title>
20121 <variablelist>
20122  <varlistentry>
20123   <term><parameter>tclass</parameter></term>
20124   <listitem>
20125    <para>
20126     a pointer to the transport class structure to be initialised
20127    </para>
20128   </listitem>
20129  </varlistentry>
20130 </variablelist>
20131</refsect1>
20132<refsect1>
20133<title>Description</title>
20134<para>
20135   The transport class contains an embedded class which is used to
20136   identify it.  The caller should initialise this structure with
20137   zeros and then generic class must have been initialised with the
20138   actual transport class unique name.  There's a macro
20139   <function>DECLARE_TRANSPORT_CLASS</function> to do this (declared classes still must
20140   be registered).
20141   </para><para>
20142
20143   Returns 0 on success or error on failure.
20144</para>
20145</refsect1>
20146</refentry>
20147
20148<refentry id="API-transport-class-unregister">
20149<refentryinfo>
20150 <title>LINUX</title>
20151 <productname>Kernel Hackers Manual</productname>
20152 <date>July 2017</date>
20153</refentryinfo>
20154<refmeta>
20155 <refentrytitle><phrase>transport_class_unregister</phrase></refentrytitle>
20156 <manvolnum>9</manvolnum>
20157 <refmiscinfo class="version">4.1.27</refmiscinfo>
20158</refmeta>
20159<refnamediv>
20160 <refname>transport_class_unregister</refname>
20161 <refpurpose>
20162     unregister a previously registered class
20163 </refpurpose>
20164</refnamediv>
20165<refsynopsisdiv>
20166 <title>Synopsis</title>
20167  <funcsynopsis><funcprototype>
20168   <funcdef>void <function>transport_class_unregister </function></funcdef>
20169   <paramdef>struct transport_class * <parameter>tclass</parameter></paramdef>
20170  </funcprototype></funcsynopsis>
20171</refsynopsisdiv>
20172<refsect1>
20173 <title>Arguments</title>
20174 <variablelist>
20175  <varlistentry>
20176   <term><parameter>tclass</parameter></term>
20177   <listitem>
20178    <para>
20179     The transport class to unregister
20180    </para>
20181   </listitem>
20182  </varlistentry>
20183 </variablelist>
20184</refsect1>
20185<refsect1>
20186<title>Description</title>
20187<para>
20188   Must be called prior to deallocating the memory for the transport
20189   class.
20190</para>
20191</refsect1>
20192</refentry>
20193
20194<refentry id="API-anon-transport-class-register">
20195<refentryinfo>
20196 <title>LINUX</title>
20197 <productname>Kernel Hackers Manual</productname>
20198 <date>July 2017</date>
20199</refentryinfo>
20200<refmeta>
20201 <refentrytitle><phrase>anon_transport_class_register</phrase></refentrytitle>
20202 <manvolnum>9</manvolnum>
20203 <refmiscinfo class="version">4.1.27</refmiscinfo>
20204</refmeta>
20205<refnamediv>
20206 <refname>anon_transport_class_register</refname>
20207 <refpurpose>
20208     register an anonymous class
20209 </refpurpose>
20210</refnamediv>
20211<refsynopsisdiv>
20212 <title>Synopsis</title>
20213  <funcsynopsis><funcprototype>
20214   <funcdef>int <function>anon_transport_class_register </function></funcdef>
20215   <paramdef>struct anon_transport_class * <parameter>atc</parameter></paramdef>
20216  </funcprototype></funcsynopsis>
20217</refsynopsisdiv>
20218<refsect1>
20219 <title>Arguments</title>
20220 <variablelist>
20221  <varlistentry>
20222   <term><parameter>atc</parameter></term>
20223   <listitem>
20224    <para>
20225     The anon transport class to register
20226    </para>
20227   </listitem>
20228  </varlistentry>
20229 </variablelist>
20230</refsect1>
20231<refsect1>
20232<title>Description</title>
20233<para>
20234   The anonymous transport class contains both a transport class and a
20235   container.  The idea of an anonymous class is that it never
20236   actually has any device attributes associated with it (and thus
20237   saves on container storage).  So it can only be used for triggering
20238   events.  Use prezero and then use <function>DECLARE_ANON_TRANSPORT_CLASS</function> to
20239   initialise the anon transport class storage.
20240</para>
20241</refsect1>
20242</refentry>
20243
20244<refentry id="API-anon-transport-class-unregister">
20245<refentryinfo>
20246 <title>LINUX</title>
20247 <productname>Kernel Hackers Manual</productname>
20248 <date>July 2017</date>
20249</refentryinfo>
20250<refmeta>
20251 <refentrytitle><phrase>anon_transport_class_unregister</phrase></refentrytitle>
20252 <manvolnum>9</manvolnum>
20253 <refmiscinfo class="version">4.1.27</refmiscinfo>
20254</refmeta>
20255<refnamediv>
20256 <refname>anon_transport_class_unregister</refname>
20257 <refpurpose>
20258     unregister an anon class
20259 </refpurpose>
20260</refnamediv>
20261<refsynopsisdiv>
20262 <title>Synopsis</title>
20263  <funcsynopsis><funcprototype>
20264   <funcdef>void <function>anon_transport_class_unregister </function></funcdef>
20265   <paramdef>struct anon_transport_class * <parameter>atc</parameter></paramdef>
20266  </funcprototype></funcsynopsis>
20267</refsynopsisdiv>
20268<refsect1>
20269 <title>Arguments</title>
20270 <variablelist>
20271  <varlistentry>
20272   <term><parameter>atc</parameter></term>
20273   <listitem>
20274    <para>
20275     Pointer to the anon transport class to unregister
20276    </para>
20277   </listitem>
20278  </varlistentry>
20279 </variablelist>
20280</refsect1>
20281<refsect1>
20282<title>Description</title>
20283<para>
20284   Must be called prior to deallocating the memory for the anon
20285   transport class.
20286</para>
20287</refsect1>
20288</refentry>
20289
20290<refentry id="API-transport-setup-device">
20291<refentryinfo>
20292 <title>LINUX</title>
20293 <productname>Kernel Hackers Manual</productname>
20294 <date>July 2017</date>
20295</refentryinfo>
20296<refmeta>
20297 <refentrytitle><phrase>transport_setup_device</phrase></refentrytitle>
20298 <manvolnum>9</manvolnum>
20299 <refmiscinfo class="version">4.1.27</refmiscinfo>
20300</refmeta>
20301<refnamediv>
20302 <refname>transport_setup_device</refname>
20303 <refpurpose>
20304     declare a new dev for transport class association but don't make it visible yet.
20305 </refpurpose>
20306</refnamediv>
20307<refsynopsisdiv>
20308 <title>Synopsis</title>
20309  <funcsynopsis><funcprototype>
20310   <funcdef>void <function>transport_setup_device </function></funcdef>
20311   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20312  </funcprototype></funcsynopsis>
20313</refsynopsisdiv>
20314<refsect1>
20315 <title>Arguments</title>
20316 <variablelist>
20317  <varlistentry>
20318   <term><parameter>dev</parameter></term>
20319   <listitem>
20320    <para>
20321     the generic device representing the entity being added
20322    </para>
20323   </listitem>
20324  </varlistentry>
20325 </variablelist>
20326</refsect1>
20327<refsect1>
20328<title>Description</title>
20329<para>
20330   Usually, dev represents some component in the HBA system (either
20331   the HBA itself or a device remote across the HBA bus).  This
20332   routine is simply a trigger point to see if any set of transport
20333   classes wishes to associate with the added device.  This allocates
20334   storage for the class device and initialises it, but does not yet
20335   add it to the system or add attributes to it (you do this with
20336   transport_add_device).  If you have no need for a separate setup
20337   and add operations, use transport_register_device (see
20338   transport_class.h).
20339</para>
20340</refsect1>
20341</refentry>
20342
20343<refentry id="API-transport-add-device">
20344<refentryinfo>
20345 <title>LINUX</title>
20346 <productname>Kernel Hackers Manual</productname>
20347 <date>July 2017</date>
20348</refentryinfo>
20349<refmeta>
20350 <refentrytitle><phrase>transport_add_device</phrase></refentrytitle>
20351 <manvolnum>9</manvolnum>
20352 <refmiscinfo class="version">4.1.27</refmiscinfo>
20353</refmeta>
20354<refnamediv>
20355 <refname>transport_add_device</refname>
20356 <refpurpose>
20357     declare a new dev for transport class association
20358 </refpurpose>
20359</refnamediv>
20360<refsynopsisdiv>
20361 <title>Synopsis</title>
20362  <funcsynopsis><funcprototype>
20363   <funcdef>void <function>transport_add_device </function></funcdef>
20364   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20365  </funcprototype></funcsynopsis>
20366</refsynopsisdiv>
20367<refsect1>
20368 <title>Arguments</title>
20369 <variablelist>
20370  <varlistentry>
20371   <term><parameter>dev</parameter></term>
20372   <listitem>
20373    <para>
20374     the generic device representing the entity being added
20375    </para>
20376   </listitem>
20377  </varlistentry>
20378 </variablelist>
20379</refsect1>
20380<refsect1>
20381<title>Description</title>
20382<para>
20383   Usually, dev represents some component in the HBA system (either
20384   the HBA itself or a device remote across the HBA bus).  This
20385   routine is simply a trigger point used to add the device to the
20386   system and register attributes for it.
20387</para>
20388</refsect1>
20389</refentry>
20390
20391<refentry id="API-transport-configure-device">
20392<refentryinfo>
20393 <title>LINUX</title>
20394 <productname>Kernel Hackers Manual</productname>
20395 <date>July 2017</date>
20396</refentryinfo>
20397<refmeta>
20398 <refentrytitle><phrase>transport_configure_device</phrase></refentrytitle>
20399 <manvolnum>9</manvolnum>
20400 <refmiscinfo class="version">4.1.27</refmiscinfo>
20401</refmeta>
20402<refnamediv>
20403 <refname>transport_configure_device</refname>
20404 <refpurpose>
20405     configure an already set up device
20406 </refpurpose>
20407</refnamediv>
20408<refsynopsisdiv>
20409 <title>Synopsis</title>
20410  <funcsynopsis><funcprototype>
20411   <funcdef>void <function>transport_configure_device </function></funcdef>
20412   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20413  </funcprototype></funcsynopsis>
20414</refsynopsisdiv>
20415<refsect1>
20416 <title>Arguments</title>
20417 <variablelist>
20418  <varlistentry>
20419   <term><parameter>dev</parameter></term>
20420   <listitem>
20421    <para>
20422     generic device representing device to be configured
20423    </para>
20424   </listitem>
20425  </varlistentry>
20426 </variablelist>
20427</refsect1>
20428<refsect1>
20429<title>Description</title>
20430<para>
20431   The idea of configure is simply to provide a point within the setup
20432   process to allow the transport class to extract information from a
20433   device after it has been setup.  This is used in SCSI because we
20434   have to have a setup device to begin using the HBA, but after we
20435   send the initial inquiry, we use configure to extract the device
20436   parameters.  The device need not have been added to be configured.
20437</para>
20438</refsect1>
20439</refentry>
20440
20441<refentry id="API-transport-remove-device">
20442<refentryinfo>
20443 <title>LINUX</title>
20444 <productname>Kernel Hackers Manual</productname>
20445 <date>July 2017</date>
20446</refentryinfo>
20447<refmeta>
20448 <refentrytitle><phrase>transport_remove_device</phrase></refentrytitle>
20449 <manvolnum>9</manvolnum>
20450 <refmiscinfo class="version">4.1.27</refmiscinfo>
20451</refmeta>
20452<refnamediv>
20453 <refname>transport_remove_device</refname>
20454 <refpurpose>
20455     remove the visibility of a device
20456 </refpurpose>
20457</refnamediv>
20458<refsynopsisdiv>
20459 <title>Synopsis</title>
20460  <funcsynopsis><funcprototype>
20461   <funcdef>void <function>transport_remove_device </function></funcdef>
20462   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20463  </funcprototype></funcsynopsis>
20464</refsynopsisdiv>
20465<refsect1>
20466 <title>Arguments</title>
20467 <variablelist>
20468  <varlistentry>
20469   <term><parameter>dev</parameter></term>
20470   <listitem>
20471    <para>
20472     generic device to remove
20473    </para>
20474   </listitem>
20475  </varlistentry>
20476 </variablelist>
20477</refsect1>
20478<refsect1>
20479<title>Description</title>
20480<para>
20481   This call removes the visibility of the device (to the user from
20482   sysfs), but does not destroy it.  To eliminate a device entirely
20483   you must also call transport_destroy_device.  If you don't need to
20484   do remove and destroy as separate operations, use
20485   <function>transport_unregister_device</function> (see transport_class.h) which will
20486   perform both calls for you.
20487</para>
20488</refsect1>
20489</refentry>
20490
20491<refentry id="API-transport-destroy-device">
20492<refentryinfo>
20493 <title>LINUX</title>
20494 <productname>Kernel Hackers Manual</productname>
20495 <date>July 2017</date>
20496</refentryinfo>
20497<refmeta>
20498 <refentrytitle><phrase>transport_destroy_device</phrase></refentrytitle>
20499 <manvolnum>9</manvolnum>
20500 <refmiscinfo class="version">4.1.27</refmiscinfo>
20501</refmeta>
20502<refnamediv>
20503 <refname>transport_destroy_device</refname>
20504 <refpurpose>
20505     destroy a removed device
20506 </refpurpose>
20507</refnamediv>
20508<refsynopsisdiv>
20509 <title>Synopsis</title>
20510  <funcsynopsis><funcprototype>
20511   <funcdef>void <function>transport_destroy_device </function></funcdef>
20512   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20513  </funcprototype></funcsynopsis>
20514</refsynopsisdiv>
20515<refsect1>
20516 <title>Arguments</title>
20517 <variablelist>
20518  <varlistentry>
20519   <term><parameter>dev</parameter></term>
20520   <listitem>
20521    <para>
20522     device to eliminate from the transport class.
20523    </para>
20524   </listitem>
20525  </varlistentry>
20526 </variablelist>
20527</refsect1>
20528<refsect1>
20529<title>Description</title>
20530<para>
20531   This call triggers the elimination of storage associated with the
20532   transport classdev.  Note: all it really does is relinquish a
20533   reference to the classdev.  The memory will not be freed until the
20534   last reference goes to zero.  Note also that the classdev retains a
20535   reference count on dev, so dev too will remain for as long as the
20536   transport class device remains around.
20537</para>
20538</refsect1>
20539</refentry>
20540
20541<!-- Cannot be included, because
20542     attribute_container_add_class_device_adapter
20543 and attribute_container_classdev_to_container
20544     exceed allowed 44 characters maximum
20545X!Edrivers/base/attribute_container.c
20546-->
20547<!-- drivers/base/dd.c -->
20548<refentry id="API-device-bind-driver">
20549<refentryinfo>
20550 <title>LINUX</title>
20551 <productname>Kernel Hackers Manual</productname>
20552 <date>July 2017</date>
20553</refentryinfo>
20554<refmeta>
20555 <refentrytitle><phrase>device_bind_driver</phrase></refentrytitle>
20556 <manvolnum>9</manvolnum>
20557 <refmiscinfo class="version">4.1.27</refmiscinfo>
20558</refmeta>
20559<refnamediv>
20560 <refname>device_bind_driver</refname>
20561 <refpurpose>
20562  bind a driver to one device.
20563 </refpurpose>
20564</refnamediv>
20565<refsynopsisdiv>
20566 <title>Synopsis</title>
20567  <funcsynopsis><funcprototype>
20568   <funcdef>int <function>device_bind_driver </function></funcdef>
20569   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20570  </funcprototype></funcsynopsis>
20571</refsynopsisdiv>
20572<refsect1>
20573 <title>Arguments</title>
20574 <variablelist>
20575  <varlistentry>
20576   <term><parameter>dev</parameter></term>
20577   <listitem>
20578    <para>
20579     device.
20580    </para>
20581   </listitem>
20582  </varlistentry>
20583 </variablelist>
20584</refsect1>
20585<refsect1>
20586<title>Description</title>
20587<para>
20588   Allow manual attachment of a driver to a device.
20589   Caller must have already set <parameter>dev</parameter>-&gt;driver.
20590   </para><para>
20591
20592   Note that this does not modify the bus reference count
20593   nor take the bus's rwsem. Please verify those are accounted
20594   for before calling this. (It is ok to call with no other effort
20595   from a driver's <function>probe</function> method.)
20596   </para><para>
20597
20598   This function must be called with the device lock held.
20599</para>
20600</refsect1>
20601</refentry>
20602
20603<refentry id="API-wait-for-device-probe">
20604<refentryinfo>
20605 <title>LINUX</title>
20606 <productname>Kernel Hackers Manual</productname>
20607 <date>July 2017</date>
20608</refentryinfo>
20609<refmeta>
20610 <refentrytitle><phrase>wait_for_device_probe</phrase></refentrytitle>
20611 <manvolnum>9</manvolnum>
20612 <refmiscinfo class="version">4.1.27</refmiscinfo>
20613</refmeta>
20614<refnamediv>
20615 <refname>wait_for_device_probe</refname>
20616 <refpurpose>
20617   </refpurpose>
20618</refnamediv>
20619<refsynopsisdiv>
20620 <title>Synopsis</title>
20621  <funcsynopsis><funcprototype>
20622   <funcdef>void <function>wait_for_device_probe </function></funcdef>
20623   <paramdef> <parameter>void</parameter></paramdef>
20624  </funcprototype></funcsynopsis>
20625</refsynopsisdiv>
20626<refsect1>
20627 <title>Arguments</title>
20628 <variablelist>
20629  <varlistentry>
20630   <term><parameter>void</parameter></term>
20631   <listitem>
20632    <para>
20633     no arguments
20634    </para>
20635   </listitem>
20636  </varlistentry>
20637 </variablelist>
20638</refsect1>
20639<refsect1>
20640<title>Description</title>
20641<para>
20642   Wait for device probing to be completed.
20643</para>
20644</refsect1>
20645</refentry>
20646
20647<refentry id="API-device-attach">
20648<refentryinfo>
20649 <title>LINUX</title>
20650 <productname>Kernel Hackers Manual</productname>
20651 <date>July 2017</date>
20652</refentryinfo>
20653<refmeta>
20654 <refentrytitle><phrase>device_attach</phrase></refentrytitle>
20655 <manvolnum>9</manvolnum>
20656 <refmiscinfo class="version">4.1.27</refmiscinfo>
20657</refmeta>
20658<refnamediv>
20659 <refname>device_attach</refname>
20660 <refpurpose>
20661     try to attach device to a driver.
20662 </refpurpose>
20663</refnamediv>
20664<refsynopsisdiv>
20665 <title>Synopsis</title>
20666  <funcsynopsis><funcprototype>
20667   <funcdef>int <function>device_attach </function></funcdef>
20668   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20669  </funcprototype></funcsynopsis>
20670</refsynopsisdiv>
20671<refsect1>
20672 <title>Arguments</title>
20673 <variablelist>
20674  <varlistentry>
20675   <term><parameter>dev</parameter></term>
20676   <listitem>
20677    <para>
20678     device.
20679    </para>
20680   </listitem>
20681  </varlistentry>
20682 </variablelist>
20683</refsect1>
20684<refsect1>
20685<title>Description</title>
20686<para>
20687   Walk the list of drivers that the bus has and call
20688   <function>driver_probe_device</function> for each pair. If a compatible
20689   pair is found, break out and return.
20690   </para><para>
20691
20692   Returns 1 if the device was bound to a driver;
20693   0 if no matching driver was found;
20694   -ENODEV if the device is not registered.
20695   </para><para>
20696
20697   When called for a USB interface, <parameter>dev</parameter>-&gt;parent lock must be held.
20698</para>
20699</refsect1>
20700</refentry>
20701
20702<refentry id="API-driver-attach">
20703<refentryinfo>
20704 <title>LINUX</title>
20705 <productname>Kernel Hackers Manual</productname>
20706 <date>July 2017</date>
20707</refentryinfo>
20708<refmeta>
20709 <refentrytitle><phrase>driver_attach</phrase></refentrytitle>
20710 <manvolnum>9</manvolnum>
20711 <refmiscinfo class="version">4.1.27</refmiscinfo>
20712</refmeta>
20713<refnamediv>
20714 <refname>driver_attach</refname>
20715 <refpurpose>
20716     try to bind driver to devices.
20717 </refpurpose>
20718</refnamediv>
20719<refsynopsisdiv>
20720 <title>Synopsis</title>
20721  <funcsynopsis><funcprototype>
20722   <funcdef>int <function>driver_attach </function></funcdef>
20723   <paramdef>struct device_driver * <parameter>drv</parameter></paramdef>
20724  </funcprototype></funcsynopsis>
20725</refsynopsisdiv>
20726<refsect1>
20727 <title>Arguments</title>
20728 <variablelist>
20729  <varlistentry>
20730   <term><parameter>drv</parameter></term>
20731   <listitem>
20732    <para>
20733     driver.
20734    </para>
20735   </listitem>
20736  </varlistentry>
20737 </variablelist>
20738</refsect1>
20739<refsect1>
20740<title>Description</title>
20741<para>
20742   Walk the list of devices that the bus has on it and try to
20743   match the driver with each one.  If <function>driver_probe_device</function>
20744   returns 0 and the <parameter>dev</parameter>-&gt;driver is set, we've found a
20745   compatible pair.
20746</para>
20747</refsect1>
20748</refentry>
20749
20750<refentry id="API-device-release-driver">
20751<refentryinfo>
20752 <title>LINUX</title>
20753 <productname>Kernel Hackers Manual</productname>
20754 <date>July 2017</date>
20755</refentryinfo>
20756<refmeta>
20757 <refentrytitle><phrase>device_release_driver</phrase></refentrytitle>
20758 <manvolnum>9</manvolnum>
20759 <refmiscinfo class="version">4.1.27</refmiscinfo>
20760</refmeta>
20761<refnamediv>
20762 <refname>device_release_driver</refname>
20763 <refpurpose>
20764     manually detach device from driver.
20765 </refpurpose>
20766</refnamediv>
20767<refsynopsisdiv>
20768 <title>Synopsis</title>
20769  <funcsynopsis><funcprototype>
20770   <funcdef>void <function>device_release_driver </function></funcdef>
20771   <paramdef>struct device * <parameter>dev</parameter></paramdef>
20772  </funcprototype></funcsynopsis>
20773</refsynopsisdiv>
20774<refsect1>
20775 <title>Arguments</title>
20776 <variablelist>
20777  <varlistentry>
20778   <term><parameter>dev</parameter></term>
20779   <listitem>
20780    <para>
20781     device.
20782    </para>
20783   </listitem>
20784  </varlistentry>
20785 </variablelist>
20786</refsect1>
20787<refsect1>
20788<title>Description</title>
20789<para>
20790   Manually detach device from driver.
20791   When called for a USB interface, <parameter>dev</parameter>-&gt;parent lock must be held.
20792</para>
20793</refsect1>
20794</refentry>
20795
20796<!--
20797X!Edrivers/base/interface.c
20798-->
20799<!-- include/linux/platform_device.h -->
20800<refentry id="API-platform-device-register-resndata">
20801<refentryinfo>
20802 <title>LINUX</title>
20803 <productname>Kernel Hackers Manual</productname>
20804 <date>July 2017</date>
20805</refentryinfo>
20806<refmeta>
20807 <refentrytitle><phrase>platform_device_register_resndata</phrase></refentrytitle>
20808 <manvolnum>9</manvolnum>
20809 <refmiscinfo class="version">4.1.27</refmiscinfo>
20810</refmeta>
20811<refnamediv>
20812 <refname>platform_device_register_resndata</refname>
20813 <refpurpose>
20814  add a platform-level device with resources and platform-specific data
20815 </refpurpose>
20816</refnamediv>
20817<refsynopsisdiv>
20818 <title>Synopsis</title>
20819  <funcsynopsis><funcprototype>
20820   <funcdef>struct platform_device * <function>platform_device_register_resndata </function></funcdef>
20821   <paramdef>struct device * <parameter>parent</parameter></paramdef>
20822   <paramdef>const char * <parameter>name</parameter></paramdef>
20823   <paramdef>int <parameter>id</parameter></paramdef>
20824   <paramdef>const struct resource * <parameter>res</parameter></paramdef>
20825   <paramdef>unsigned int <parameter>num</parameter></paramdef>
20826   <paramdef>const void * <parameter>data</parameter></paramdef>
20827   <paramdef>size_t <parameter>size</parameter></paramdef>
20828  </funcprototype></funcsynopsis>
20829</refsynopsisdiv>
20830<refsect1>
20831 <title>Arguments</title>
20832 <variablelist>
20833  <varlistentry>
20834   <term><parameter>parent</parameter></term>
20835   <listitem>
20836    <para>
20837     parent device for the device we're adding
20838    </para>
20839   </listitem>
20840  </varlistentry>
20841  <varlistentry>
20842   <term><parameter>name</parameter></term>
20843   <listitem>
20844    <para>
20845     base name of the device we're adding
20846    </para>
20847   </listitem>
20848  </varlistentry>
20849  <varlistentry>
20850   <term><parameter>id</parameter></term>
20851   <listitem>
20852    <para>
20853     instance id
20854    </para>
20855   </listitem>
20856  </varlistentry>
20857  <varlistentry>
20858   <term><parameter>res</parameter></term>
20859   <listitem>
20860    <para>
20861     set of resources that needs to be allocated for the device
20862    </para>
20863   </listitem>
20864  </varlistentry>
20865  <varlistentry>
20866   <term><parameter>num</parameter></term>
20867   <listitem>
20868    <para>
20869     number of resources
20870    </para>
20871   </listitem>
20872  </varlistentry>
20873  <varlistentry>
20874   <term><parameter>data</parameter></term>
20875   <listitem>
20876    <para>
20877     platform specific data for this platform device
20878    </para>
20879   </listitem>
20880  </varlistentry>
20881  <varlistentry>
20882   <term><parameter>size</parameter></term>
20883   <listitem>
20884    <para>
20885     size of platform specific data
20886    </para>
20887   </listitem>
20888  </varlistentry>
20889 </variablelist>
20890</refsect1>
20891<refsect1>
20892<title>Description</title>
20893<para>
20894   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
20895</para>
20896</refsect1>
20897</refentry>
20898
20899<refentry id="API-platform-device-register-simple">
20900<refentryinfo>
20901 <title>LINUX</title>
20902 <productname>Kernel Hackers Manual</productname>
20903 <date>July 2017</date>
20904</refentryinfo>
20905<refmeta>
20906 <refentrytitle><phrase>platform_device_register_simple</phrase></refentrytitle>
20907 <manvolnum>9</manvolnum>
20908 <refmiscinfo class="version">4.1.27</refmiscinfo>
20909</refmeta>
20910<refnamediv>
20911 <refname>platform_device_register_simple</refname>
20912 <refpurpose>
20913     add a platform-level device and its resources
20914 </refpurpose>
20915</refnamediv>
20916<refsynopsisdiv>
20917 <title>Synopsis</title>
20918  <funcsynopsis><funcprototype>
20919   <funcdef>struct platform_device * <function>platform_device_register_simple </function></funcdef>
20920   <paramdef>const char * <parameter>name</parameter></paramdef>
20921   <paramdef>int <parameter>id</parameter></paramdef>
20922   <paramdef>const struct resource * <parameter>res</parameter></paramdef>
20923   <paramdef>unsigned int <parameter>num</parameter></paramdef>
20924  </funcprototype></funcsynopsis>
20925</refsynopsisdiv>
20926<refsect1>
20927 <title>Arguments</title>
20928 <variablelist>
20929  <varlistentry>
20930   <term><parameter>name</parameter></term>
20931   <listitem>
20932    <para>
20933     base name of the device we're adding
20934    </para>
20935   </listitem>
20936  </varlistentry>
20937  <varlistentry>
20938   <term><parameter>id</parameter></term>
20939   <listitem>
20940    <para>
20941     instance id
20942    </para>
20943   </listitem>
20944  </varlistentry>
20945  <varlistentry>
20946   <term><parameter>res</parameter></term>
20947   <listitem>
20948    <para>
20949     set of resources that needs to be allocated for the device
20950    </para>
20951   </listitem>
20952  </varlistentry>
20953  <varlistentry>
20954   <term><parameter>num</parameter></term>
20955   <listitem>
20956    <para>
20957     number of resources
20958    </para>
20959   </listitem>
20960  </varlistentry>
20961 </variablelist>
20962</refsect1>
20963<refsect1>
20964<title>Description</title>
20965<para>
20966   This function creates a simple platform device that requires minimal
20967   resource and memory management. Canned release function freeing memory
20968   allocated for the device allows drivers using such devices to be
20969   unloaded without waiting for the last reference to the device to be
20970   dropped.
20971   </para><para>
20972
20973   This interface is primarily intended for use with legacy drivers which
20974   probe hardware directly.  Because such drivers create sysfs device nodes
20975   themselves, rather than letting system infrastructure handle such device
20976   enumeration tasks, they don't fully conform to the Linux driver model.
20977   In particular, when such drivers are built as modules, they can't be
20978   <quote>hotplugged</quote>.
20979   </para><para>
20980
20981   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
20982</para>
20983</refsect1>
20984</refentry>
20985
20986<refentry id="API-platform-device-register-data">
20987<refentryinfo>
20988 <title>LINUX</title>
20989 <productname>Kernel Hackers Manual</productname>
20990 <date>July 2017</date>
20991</refentryinfo>
20992<refmeta>
20993 <refentrytitle><phrase>platform_device_register_data</phrase></refentrytitle>
20994 <manvolnum>9</manvolnum>
20995 <refmiscinfo class="version">4.1.27</refmiscinfo>
20996</refmeta>
20997<refnamediv>
20998 <refname>platform_device_register_data</refname>
20999 <refpurpose>
21000     add a platform-level device with platform-specific data
21001 </refpurpose>
21002</refnamediv>
21003<refsynopsisdiv>
21004 <title>Synopsis</title>
21005  <funcsynopsis><funcprototype>
21006   <funcdef>struct platform_device * <function>platform_device_register_data </function></funcdef>
21007   <paramdef>struct device * <parameter>parent</parameter></paramdef>
21008   <paramdef>const char * <parameter>name</parameter></paramdef>
21009   <paramdef>int <parameter>id</parameter></paramdef>
21010   <paramdef>const void * <parameter>data</parameter></paramdef>
21011   <paramdef>size_t <parameter>size</parameter></paramdef>
21012  </funcprototype></funcsynopsis>
21013</refsynopsisdiv>
21014<refsect1>
21015 <title>Arguments</title>
21016 <variablelist>
21017  <varlistentry>
21018   <term><parameter>parent</parameter></term>
21019   <listitem>
21020    <para>
21021     parent device for the device we're adding
21022    </para>
21023   </listitem>
21024  </varlistentry>
21025  <varlistentry>
21026   <term><parameter>name</parameter></term>
21027   <listitem>
21028    <para>
21029     base name of the device we're adding
21030    </para>
21031   </listitem>
21032  </varlistentry>
21033  <varlistentry>
21034   <term><parameter>id</parameter></term>
21035   <listitem>
21036    <para>
21037     instance id
21038    </para>
21039   </listitem>
21040  </varlistentry>
21041  <varlistentry>
21042   <term><parameter>data</parameter></term>
21043   <listitem>
21044    <para>
21045     platform specific data for this platform device
21046    </para>
21047   </listitem>
21048  </varlistentry>
21049  <varlistentry>
21050   <term><parameter>size</parameter></term>
21051   <listitem>
21052    <para>
21053     size of platform specific data
21054    </para>
21055   </listitem>
21056  </varlistentry>
21057 </variablelist>
21058</refsect1>
21059<refsect1>
21060<title>Description</title>
21061<para>
21062   This function creates a simple platform device that requires minimal
21063   resource and memory management. Canned release function freeing memory
21064   allocated for the device allows drivers using such devices to be
21065   unloaded without waiting for the last reference to the device to be
21066   dropped.
21067   </para><para>
21068
21069   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
21070</para>
21071</refsect1>
21072</refentry>
21073
21074<!-- drivers/base/platform.c -->
21075<refentry id="API-platform-get-resource">
21076<refentryinfo>
21077 <title>LINUX</title>
21078 <productname>Kernel Hackers Manual</productname>
21079 <date>July 2017</date>
21080</refentryinfo>
21081<refmeta>
21082 <refentrytitle><phrase>platform_get_resource</phrase></refentrytitle>
21083 <manvolnum>9</manvolnum>
21084 <refmiscinfo class="version">4.1.27</refmiscinfo>
21085</refmeta>
21086<refnamediv>
21087 <refname>platform_get_resource</refname>
21088 <refpurpose>
21089  get a resource for a device
21090 </refpurpose>
21091</refnamediv>
21092<refsynopsisdiv>
21093 <title>Synopsis</title>
21094  <funcsynopsis><funcprototype>
21095   <funcdef>struct resource * <function>platform_get_resource </function></funcdef>
21096   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
21097   <paramdef>unsigned int <parameter>type</parameter></paramdef>
21098   <paramdef>unsigned int <parameter>num</parameter></paramdef>
21099  </funcprototype></funcsynopsis>
21100</refsynopsisdiv>
21101<refsect1>
21102 <title>Arguments</title>
21103 <variablelist>
21104  <varlistentry>
21105   <term><parameter>dev</parameter></term>
21106   <listitem>
21107    <para>
21108     platform device
21109    </para>
21110   </listitem>
21111  </varlistentry>
21112  <varlistentry>
21113   <term><parameter>type</parameter></term>
21114   <listitem>
21115    <para>
21116     resource type
21117    </para>
21118   </listitem>
21119  </varlistentry>
21120  <varlistentry>
21121   <term><parameter>num</parameter></term>
21122   <listitem>
21123    <para>
21124     resource index
21125    </para>
21126   </listitem>
21127  </varlistentry>
21128 </variablelist>
21129</refsect1>
21130</refentry>
21131
21132<refentry id="API-platform-get-irq">
21133<refentryinfo>
21134 <title>LINUX</title>
21135 <productname>Kernel Hackers Manual</productname>
21136 <date>July 2017</date>
21137</refentryinfo>
21138<refmeta>
21139 <refentrytitle><phrase>platform_get_irq</phrase></refentrytitle>
21140 <manvolnum>9</manvolnum>
21141 <refmiscinfo class="version">4.1.27</refmiscinfo>
21142</refmeta>
21143<refnamediv>
21144 <refname>platform_get_irq</refname>
21145 <refpurpose>
21146     get an IRQ for a device
21147 </refpurpose>
21148</refnamediv>
21149<refsynopsisdiv>
21150 <title>Synopsis</title>
21151  <funcsynopsis><funcprototype>
21152   <funcdef>int <function>platform_get_irq </function></funcdef>
21153   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
21154   <paramdef>unsigned int <parameter>num</parameter></paramdef>
21155  </funcprototype></funcsynopsis>
21156</refsynopsisdiv>
21157<refsect1>
21158 <title>Arguments</title>
21159 <variablelist>
21160  <varlistentry>
21161   <term><parameter>dev</parameter></term>
21162   <listitem>
21163    <para>
21164     platform device
21165    </para>
21166   </listitem>
21167  </varlistentry>
21168  <varlistentry>
21169   <term><parameter>num</parameter></term>
21170   <listitem>
21171    <para>
21172     IRQ number index
21173    </para>
21174   </listitem>
21175  </varlistentry>
21176 </variablelist>
21177</refsect1>
21178</refentry>
21179
21180<refentry id="API-platform-get-resource-byname">
21181<refentryinfo>
21182 <title>LINUX</title>
21183 <productname>Kernel Hackers Manual</productname>
21184 <date>July 2017</date>
21185</refentryinfo>
21186<refmeta>
21187 <refentrytitle><phrase>platform_get_resource_byname</phrase></refentrytitle>
21188 <manvolnum>9</manvolnum>
21189 <refmiscinfo class="version">4.1.27</refmiscinfo>
21190</refmeta>
21191<refnamediv>
21192 <refname>platform_get_resource_byname</refname>
21193 <refpurpose>
21194     get a resource for a device by name
21195 </refpurpose>
21196</refnamediv>
21197<refsynopsisdiv>
21198 <title>Synopsis</title>
21199  <funcsynopsis><funcprototype>
21200   <funcdef>struct resource * <function>platform_get_resource_byname </function></funcdef>
21201   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
21202   <paramdef>unsigned int <parameter>type</parameter></paramdef>
21203   <paramdef>const char * <parameter>name</parameter></paramdef>
21204  </funcprototype></funcsynopsis>
21205</refsynopsisdiv>
21206<refsect1>
21207 <title>Arguments</title>
21208 <variablelist>
21209  <varlistentry>
21210   <term><parameter>dev</parameter></term>
21211   <listitem>
21212    <para>
21213     platform device
21214    </para>
21215   </listitem>
21216  </varlistentry>
21217  <varlistentry>
21218   <term><parameter>type</parameter></term>
21219   <listitem>
21220    <para>
21221     resource type
21222    </para>
21223   </listitem>
21224  </varlistentry>
21225  <varlistentry>
21226   <term><parameter>name</parameter></term>
21227   <listitem>
21228    <para>
21229     resource name
21230    </para>
21231   </listitem>
21232  </varlistentry>
21233 </variablelist>
21234</refsect1>
21235</refentry>
21236
21237<refentry id="API-platform-get-irq-byname">
21238<refentryinfo>
21239 <title>LINUX</title>
21240 <productname>Kernel Hackers Manual</productname>
21241 <date>July 2017</date>
21242</refentryinfo>
21243<refmeta>
21244 <refentrytitle><phrase>platform_get_irq_byname</phrase></refentrytitle>
21245 <manvolnum>9</manvolnum>
21246 <refmiscinfo class="version">4.1.27</refmiscinfo>
21247</refmeta>
21248<refnamediv>
21249 <refname>platform_get_irq_byname</refname>
21250 <refpurpose>
21251     get an IRQ for a device by name
21252 </refpurpose>
21253</refnamediv>
21254<refsynopsisdiv>
21255 <title>Synopsis</title>
21256  <funcsynopsis><funcprototype>
21257   <funcdef>int <function>platform_get_irq_byname </function></funcdef>
21258   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
21259   <paramdef>const char * <parameter>name</parameter></paramdef>
21260  </funcprototype></funcsynopsis>
21261</refsynopsisdiv>
21262<refsect1>
21263 <title>Arguments</title>
21264 <variablelist>
21265  <varlistentry>
21266   <term><parameter>dev</parameter></term>
21267   <listitem>
21268    <para>
21269     platform device
21270    </para>
21271   </listitem>
21272  </varlistentry>
21273  <varlistentry>
21274   <term><parameter>name</parameter></term>
21275   <listitem>
21276    <para>
21277     IRQ name
21278    </para>
21279   </listitem>
21280  </varlistentry>
21281 </variablelist>
21282</refsect1>
21283</refentry>
21284
21285<refentry id="API-platform-add-devices">
21286<refentryinfo>
21287 <title>LINUX</title>
21288 <productname>Kernel Hackers Manual</productname>
21289 <date>July 2017</date>
21290</refentryinfo>
21291<refmeta>
21292 <refentrytitle><phrase>platform_add_devices</phrase></refentrytitle>
21293 <manvolnum>9</manvolnum>
21294 <refmiscinfo class="version">4.1.27</refmiscinfo>
21295</refmeta>
21296<refnamediv>
21297 <refname>platform_add_devices</refname>
21298 <refpurpose>
21299     add a numbers of platform devices
21300 </refpurpose>
21301</refnamediv>
21302<refsynopsisdiv>
21303 <title>Synopsis</title>
21304  <funcsynopsis><funcprototype>
21305   <funcdef>int <function>platform_add_devices </function></funcdef>
21306   <paramdef>struct platform_device ** <parameter>devs</parameter></paramdef>
21307   <paramdef>int <parameter>num</parameter></paramdef>
21308  </funcprototype></funcsynopsis>
21309</refsynopsisdiv>
21310<refsect1>
21311 <title>Arguments</title>
21312 <variablelist>
21313  <varlistentry>
21314   <term><parameter>devs</parameter></term>
21315   <listitem>
21316    <para>
21317     array of platform devices to add
21318    </para>
21319   </listitem>
21320  </varlistentry>
21321  <varlistentry>
21322   <term><parameter>num</parameter></term>
21323   <listitem>
21324    <para>
21325     number of platform devices in array
21326    </para>
21327   </listitem>
21328  </varlistentry>
21329 </variablelist>
21330</refsect1>
21331</refentry>
21332
21333<refentry id="API-platform-device-put">
21334<refentryinfo>
21335 <title>LINUX</title>
21336 <productname>Kernel Hackers Manual</productname>
21337 <date>July 2017</date>
21338</refentryinfo>
21339<refmeta>
21340 <refentrytitle><phrase>platform_device_put</phrase></refentrytitle>
21341 <manvolnum>9</manvolnum>
21342 <refmiscinfo class="version">4.1.27</refmiscinfo>
21343</refmeta>
21344<refnamediv>
21345 <refname>platform_device_put</refname>
21346 <refpurpose>
21347     destroy a platform device
21348 </refpurpose>
21349</refnamediv>
21350<refsynopsisdiv>
21351 <title>Synopsis</title>
21352  <funcsynopsis><funcprototype>
21353   <funcdef>void <function>platform_device_put </function></funcdef>
21354   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
21355  </funcprototype></funcsynopsis>
21356</refsynopsisdiv>
21357<refsect1>
21358 <title>Arguments</title>
21359 <variablelist>
21360  <varlistentry>
21361   <term><parameter>pdev</parameter></term>
21362   <listitem>
21363    <para>
21364     platform device to free
21365    </para>
21366   </listitem>
21367  </varlistentry>
21368 </variablelist>
21369</refsect1>
21370<refsect1>
21371<title>Description</title>
21372<para>
21373   Free all memory associated with a platform device.  This function must
21374   _only_ be externally called in error cases.  All other usage is a bug.
21375</para>
21376</refsect1>
21377</refentry>
21378
21379<refentry id="API-platform-device-alloc">
21380<refentryinfo>
21381 <title>LINUX</title>
21382 <productname>Kernel Hackers Manual</productname>
21383 <date>July 2017</date>
21384</refentryinfo>
21385<refmeta>
21386 <refentrytitle><phrase>platform_device_alloc</phrase></refentrytitle>
21387 <manvolnum>9</manvolnum>
21388 <refmiscinfo class="version">4.1.27</refmiscinfo>
21389</refmeta>
21390<refnamediv>
21391 <refname>platform_device_alloc</refname>
21392 <refpurpose>
21393     create a platform device
21394 </refpurpose>
21395</refnamediv>
21396<refsynopsisdiv>
21397 <title>Synopsis</title>
21398  <funcsynopsis><funcprototype>
21399   <funcdef>struct platform_device * <function>platform_device_alloc </function></funcdef>
21400   <paramdef>const char * <parameter>name</parameter></paramdef>
21401   <paramdef>int <parameter>id</parameter></paramdef>
21402  </funcprototype></funcsynopsis>
21403</refsynopsisdiv>
21404<refsect1>
21405 <title>Arguments</title>
21406 <variablelist>
21407  <varlistentry>
21408   <term><parameter>name</parameter></term>
21409   <listitem>
21410    <para>
21411     base name of the device we're adding
21412    </para>
21413   </listitem>
21414  </varlistentry>
21415  <varlistentry>
21416   <term><parameter>id</parameter></term>
21417   <listitem>
21418    <para>
21419     instance id
21420    </para>
21421   </listitem>
21422  </varlistentry>
21423 </variablelist>
21424</refsect1>
21425<refsect1>
21426<title>Description</title>
21427<para>
21428   Create a platform device object which can have other objects attached
21429   to it, and which will have attached objects freed when it is released.
21430</para>
21431</refsect1>
21432</refentry>
21433
21434<refentry id="API-platform-device-add-resources">
21435<refentryinfo>
21436 <title>LINUX</title>
21437 <productname>Kernel Hackers Manual</productname>
21438 <date>July 2017</date>
21439</refentryinfo>
21440<refmeta>
21441 <refentrytitle><phrase>platform_device_add_resources</phrase></refentrytitle>
21442 <manvolnum>9</manvolnum>
21443 <refmiscinfo class="version">4.1.27</refmiscinfo>
21444</refmeta>
21445<refnamediv>
21446 <refname>platform_device_add_resources</refname>
21447 <refpurpose>
21448     add resources to a platform device
21449 </refpurpose>
21450</refnamediv>
21451<refsynopsisdiv>
21452 <title>Synopsis</title>
21453  <funcsynopsis><funcprototype>
21454   <funcdef>int <function>platform_device_add_resources </function></funcdef>
21455   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
21456   <paramdef>const struct resource * <parameter>res</parameter></paramdef>
21457   <paramdef>unsigned int <parameter>num</parameter></paramdef>
21458  </funcprototype></funcsynopsis>
21459</refsynopsisdiv>
21460<refsect1>
21461 <title>Arguments</title>
21462 <variablelist>
21463  <varlistentry>
21464   <term><parameter>pdev</parameter></term>
21465   <listitem>
21466    <para>
21467     platform device allocated by platform_device_alloc to add resources to
21468    </para>
21469   </listitem>
21470  </varlistentry>
21471  <varlistentry>
21472   <term><parameter>res</parameter></term>
21473   <listitem>
21474    <para>
21475     set of resources that needs to be allocated for the device
21476    </para>
21477   </listitem>
21478  </varlistentry>
21479  <varlistentry>
21480   <term><parameter>num</parameter></term>
21481   <listitem>
21482    <para>
21483     number of resources
21484    </para>
21485   </listitem>
21486  </varlistentry>
21487 </variablelist>
21488</refsect1>
21489<refsect1>
21490<title>Description</title>
21491<para>
21492   Add a copy of the resources to the platform device.  The memory
21493   associated with the resources will be freed when the platform device is
21494   released.
21495</para>
21496</refsect1>
21497</refentry>
21498
21499<refentry id="API-platform-device-add-data">
21500<refentryinfo>
21501 <title>LINUX</title>
21502 <productname>Kernel Hackers Manual</productname>
21503 <date>July 2017</date>
21504</refentryinfo>
21505<refmeta>
21506 <refentrytitle><phrase>platform_device_add_data</phrase></refentrytitle>
21507 <manvolnum>9</manvolnum>
21508 <refmiscinfo class="version">4.1.27</refmiscinfo>
21509</refmeta>
21510<refnamediv>
21511 <refname>platform_device_add_data</refname>
21512 <refpurpose>
21513     add platform-specific data to a platform device
21514 </refpurpose>
21515</refnamediv>
21516<refsynopsisdiv>
21517 <title>Synopsis</title>
21518  <funcsynopsis><funcprototype>
21519   <funcdef>int <function>platform_device_add_data </function></funcdef>
21520   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
21521   <paramdef>const void * <parameter>data</parameter></paramdef>
21522   <paramdef>size_t <parameter>size</parameter></paramdef>
21523  </funcprototype></funcsynopsis>
21524</refsynopsisdiv>
21525<refsect1>
21526 <title>Arguments</title>
21527 <variablelist>
21528  <varlistentry>
21529   <term><parameter>pdev</parameter></term>
21530   <listitem>
21531    <para>
21532     platform device allocated by platform_device_alloc to add resources to
21533    </para>
21534   </listitem>
21535  </varlistentry>
21536  <varlistentry>
21537   <term><parameter>data</parameter></term>
21538   <listitem>
21539    <para>
21540     platform specific data for this platform device
21541    </para>
21542   </listitem>
21543  </varlistentry>
21544  <varlistentry>
21545   <term><parameter>size</parameter></term>
21546   <listitem>
21547    <para>
21548     size of platform specific data
21549    </para>
21550   </listitem>
21551  </varlistentry>
21552 </variablelist>
21553</refsect1>
21554<refsect1>
21555<title>Description</title>
21556<para>
21557   Add a copy of platform specific data to the platform device's
21558   platform_data pointer.  The memory associated with the platform data
21559   will be freed when the platform device is released.
21560</para>
21561</refsect1>
21562</refentry>
21563
21564<refentry id="API-platform-device-add">
21565<refentryinfo>
21566 <title>LINUX</title>
21567 <productname>Kernel Hackers Manual</productname>
21568 <date>July 2017</date>
21569</refentryinfo>
21570<refmeta>
21571 <refentrytitle><phrase>platform_device_add</phrase></refentrytitle>
21572 <manvolnum>9</manvolnum>
21573 <refmiscinfo class="version">4.1.27</refmiscinfo>
21574</refmeta>
21575<refnamediv>
21576 <refname>platform_device_add</refname>
21577 <refpurpose>
21578     add a platform device to device hierarchy
21579 </refpurpose>
21580</refnamediv>
21581<refsynopsisdiv>
21582 <title>Synopsis</title>
21583  <funcsynopsis><funcprototype>
21584   <funcdef>int <function>platform_device_add </function></funcdef>
21585   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
21586  </funcprototype></funcsynopsis>
21587</refsynopsisdiv>
21588<refsect1>
21589 <title>Arguments</title>
21590 <variablelist>
21591  <varlistentry>
21592   <term><parameter>pdev</parameter></term>
21593   <listitem>
21594    <para>
21595     platform device we're adding
21596    </para>
21597   </listitem>
21598  </varlistentry>
21599 </variablelist>
21600</refsect1>
21601<refsect1>
21602<title>Description</title>
21603<para>
21604   This is part 2 of <function>platform_device_register</function>, though may be called
21605   separately _iff_ pdev was allocated by <function>platform_device_alloc</function>.
21606</para>
21607</refsect1>
21608</refentry>
21609
21610<refentry id="API-platform-device-del">
21611<refentryinfo>
21612 <title>LINUX</title>
21613 <productname>Kernel Hackers Manual</productname>
21614 <date>July 2017</date>
21615</refentryinfo>
21616<refmeta>
21617 <refentrytitle><phrase>platform_device_del</phrase></refentrytitle>
21618 <manvolnum>9</manvolnum>
21619 <refmiscinfo class="version">4.1.27</refmiscinfo>
21620</refmeta>
21621<refnamediv>
21622 <refname>platform_device_del</refname>
21623 <refpurpose>
21624     remove a platform-level device
21625 </refpurpose>
21626</refnamediv>
21627<refsynopsisdiv>
21628 <title>Synopsis</title>
21629  <funcsynopsis><funcprototype>
21630   <funcdef>void <function>platform_device_del </function></funcdef>
21631   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
21632  </funcprototype></funcsynopsis>
21633</refsynopsisdiv>
21634<refsect1>
21635 <title>Arguments</title>
21636 <variablelist>
21637  <varlistentry>
21638   <term><parameter>pdev</parameter></term>
21639   <listitem>
21640    <para>
21641     platform device we're removing
21642    </para>
21643   </listitem>
21644  </varlistentry>
21645 </variablelist>
21646</refsect1>
21647<refsect1>
21648<title>Description</title>
21649<para>
21650   Note that this function will also release all memory- and port-based
21651   resources owned by the device (<parameter>dev</parameter>-&gt;resource).  This function must
21652   _only_ be externally called in error cases.  All other usage is a bug.
21653</para>
21654</refsect1>
21655</refentry>
21656
21657<refentry id="API-platform-device-register">
21658<refentryinfo>
21659 <title>LINUX</title>
21660 <productname>Kernel Hackers Manual</productname>
21661 <date>July 2017</date>
21662</refentryinfo>
21663<refmeta>
21664 <refentrytitle><phrase>platform_device_register</phrase></refentrytitle>
21665 <manvolnum>9</manvolnum>
21666 <refmiscinfo class="version">4.1.27</refmiscinfo>
21667</refmeta>
21668<refnamediv>
21669 <refname>platform_device_register</refname>
21670 <refpurpose>
21671     add a platform-level device
21672 </refpurpose>
21673</refnamediv>
21674<refsynopsisdiv>
21675 <title>Synopsis</title>
21676  <funcsynopsis><funcprototype>
21677   <funcdef>int <function>platform_device_register </function></funcdef>
21678   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
21679  </funcprototype></funcsynopsis>
21680</refsynopsisdiv>
21681<refsect1>
21682 <title>Arguments</title>
21683 <variablelist>
21684  <varlistentry>
21685   <term><parameter>pdev</parameter></term>
21686   <listitem>
21687    <para>
21688     platform device we're adding
21689    </para>
21690   </listitem>
21691  </varlistentry>
21692 </variablelist>
21693</refsect1>
21694</refentry>
21695
21696<refentry id="API-platform-device-unregister">
21697<refentryinfo>
21698 <title>LINUX</title>
21699 <productname>Kernel Hackers Manual</productname>
21700 <date>July 2017</date>
21701</refentryinfo>
21702<refmeta>
21703 <refentrytitle><phrase>platform_device_unregister</phrase></refentrytitle>
21704 <manvolnum>9</manvolnum>
21705 <refmiscinfo class="version">4.1.27</refmiscinfo>
21706</refmeta>
21707<refnamediv>
21708 <refname>platform_device_unregister</refname>
21709 <refpurpose>
21710     unregister a platform-level device
21711 </refpurpose>
21712</refnamediv>
21713<refsynopsisdiv>
21714 <title>Synopsis</title>
21715  <funcsynopsis><funcprototype>
21716   <funcdef>void <function>platform_device_unregister </function></funcdef>
21717   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
21718  </funcprototype></funcsynopsis>
21719</refsynopsisdiv>
21720<refsect1>
21721 <title>Arguments</title>
21722 <variablelist>
21723  <varlistentry>
21724   <term><parameter>pdev</parameter></term>
21725   <listitem>
21726    <para>
21727     platform device we're unregistering
21728    </para>
21729   </listitem>
21730  </varlistentry>
21731 </variablelist>
21732</refsect1>
21733<refsect1>
21734<title>Description</title>
21735<para>
21736   Unregistration is done in 2 steps. First we release all resources
21737   and remove it from the subsystem, then we drop reference count by
21738   calling <function>platform_device_put</function>.
21739</para>
21740</refsect1>
21741</refentry>
21742
21743<refentry id="API-platform-device-register-full">
21744<refentryinfo>
21745 <title>LINUX</title>
21746 <productname>Kernel Hackers Manual</productname>
21747 <date>July 2017</date>
21748</refentryinfo>
21749<refmeta>
21750 <refentrytitle><phrase>platform_device_register_full</phrase></refentrytitle>
21751 <manvolnum>9</manvolnum>
21752 <refmiscinfo class="version">4.1.27</refmiscinfo>
21753</refmeta>
21754<refnamediv>
21755 <refname>platform_device_register_full</refname>
21756 <refpurpose>
21757     add a platform-level device with resources and platform-specific data
21758 </refpurpose>
21759</refnamediv>
21760<refsynopsisdiv>
21761 <title>Synopsis</title>
21762  <funcsynopsis><funcprototype>
21763   <funcdef>struct platform_device * <function>platform_device_register_full </function></funcdef>
21764   <paramdef>const struct platform_device_info * <parameter>pdevinfo</parameter></paramdef>
21765  </funcprototype></funcsynopsis>
21766</refsynopsisdiv>
21767<refsect1>
21768 <title>Arguments</title>
21769 <variablelist>
21770  <varlistentry>
21771   <term><parameter>pdevinfo</parameter></term>
21772   <listitem>
21773    <para>
21774     data used to create device
21775    </para>
21776   </listitem>
21777  </varlistentry>
21778 </variablelist>
21779</refsect1>
21780<refsect1>
21781<title>Description</title>
21782<para>
21783   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
21784</para>
21785</refsect1>
21786</refentry>
21787
21788<refentry id="API---platform-driver-register">
21789<refentryinfo>
21790 <title>LINUX</title>
21791 <productname>Kernel Hackers Manual</productname>
21792 <date>July 2017</date>
21793</refentryinfo>
21794<refmeta>
21795 <refentrytitle><phrase>__platform_driver_register</phrase></refentrytitle>
21796 <manvolnum>9</manvolnum>
21797 <refmiscinfo class="version">4.1.27</refmiscinfo>
21798</refmeta>
21799<refnamediv>
21800 <refname>__platform_driver_register</refname>
21801 <refpurpose>
21802     register a driver for platform-level devices
21803 </refpurpose>
21804</refnamediv>
21805<refsynopsisdiv>
21806 <title>Synopsis</title>
21807  <funcsynopsis><funcprototype>
21808   <funcdef>int <function>__platform_driver_register </function></funcdef>
21809   <paramdef>struct platform_driver * <parameter>drv</parameter></paramdef>
21810   <paramdef>struct module * <parameter>owner</parameter></paramdef>
21811  </funcprototype></funcsynopsis>
21812</refsynopsisdiv>
21813<refsect1>
21814 <title>Arguments</title>
21815 <variablelist>
21816  <varlistentry>
21817   <term><parameter>drv</parameter></term>
21818   <listitem>
21819    <para>
21820     platform driver structure
21821    </para>
21822   </listitem>
21823  </varlistentry>
21824  <varlistentry>
21825   <term><parameter>owner</parameter></term>
21826   <listitem>
21827    <para>
21828     owning module/driver
21829    </para>
21830   </listitem>
21831  </varlistentry>
21832 </variablelist>
21833</refsect1>
21834</refentry>
21835
21836<refentry id="API-platform-driver-unregister">
21837<refentryinfo>
21838 <title>LINUX</title>
21839 <productname>Kernel Hackers Manual</productname>
21840 <date>July 2017</date>
21841</refentryinfo>
21842<refmeta>
21843 <refentrytitle><phrase>platform_driver_unregister</phrase></refentrytitle>
21844 <manvolnum>9</manvolnum>
21845 <refmiscinfo class="version">4.1.27</refmiscinfo>
21846</refmeta>
21847<refnamediv>
21848 <refname>platform_driver_unregister</refname>
21849 <refpurpose>
21850     unregister a driver for platform-level devices
21851 </refpurpose>
21852</refnamediv>
21853<refsynopsisdiv>
21854 <title>Synopsis</title>
21855  <funcsynopsis><funcprototype>
21856   <funcdef>void <function>platform_driver_unregister </function></funcdef>
21857   <paramdef>struct platform_driver * <parameter>drv</parameter></paramdef>
21858  </funcprototype></funcsynopsis>
21859</refsynopsisdiv>
21860<refsect1>
21861 <title>Arguments</title>
21862 <variablelist>
21863  <varlistentry>
21864   <term><parameter>drv</parameter></term>
21865   <listitem>
21866    <para>
21867     platform driver structure
21868    </para>
21869   </listitem>
21870  </varlistentry>
21871 </variablelist>
21872</refsect1>
21873</refentry>
21874
21875<refentry id="API---platform-driver-probe">
21876<refentryinfo>
21877 <title>LINUX</title>
21878 <productname>Kernel Hackers Manual</productname>
21879 <date>July 2017</date>
21880</refentryinfo>
21881<refmeta>
21882 <refentrytitle><phrase>__platform_driver_probe</phrase></refentrytitle>
21883 <manvolnum>9</manvolnum>
21884 <refmiscinfo class="version">4.1.27</refmiscinfo>
21885</refmeta>
21886<refnamediv>
21887 <refname>__platform_driver_probe</refname>
21888 <refpurpose>
21889     register driver for non-hotpluggable device
21890 </refpurpose>
21891</refnamediv>
21892<refsynopsisdiv>
21893 <title>Synopsis</title>
21894  <funcsynopsis><funcprototype>
21895   <funcdef>int <function>__platform_driver_probe </function></funcdef>
21896   <paramdef>struct platform_driver * <parameter>drv</parameter></paramdef>
21897   <paramdef>int (*<parameter>probe</parameter>)
21898     <funcparams>struct platform_device *</funcparams></paramdef>
21899   <paramdef>struct module * <parameter>module</parameter></paramdef>
21900  </funcprototype></funcsynopsis>
21901</refsynopsisdiv>
21902<refsect1>
21903 <title>Arguments</title>
21904 <variablelist>
21905  <varlistentry>
21906   <term><parameter>drv</parameter></term>
21907   <listitem>
21908    <para>
21909     platform driver structure
21910    </para>
21911   </listitem>
21912  </varlistentry>
21913  <varlistentry>
21914   <term><parameter>probe</parameter></term>
21915   <listitem>
21916    <para>
21917     the driver probe routine, probably from an __init section
21918    </para>
21919   </listitem>
21920  </varlistentry>
21921  <varlistentry>
21922   <term><parameter>module</parameter></term>
21923   <listitem>
21924    <para>
21925     module which will be the owner of the driver
21926    </para>
21927   </listitem>
21928  </varlistentry>
21929 </variablelist>
21930</refsect1>
21931<refsect1>
21932<title>Description</title>
21933<para>
21934   Use this instead of <function>platform_driver_register</function> when you know the device
21935   is not hotpluggable and has already been registered, and you want to
21936   remove its run-once <function>probe</function> infrastructure from memory after the driver
21937   has bound to the device.
21938   </para><para>
21939
21940   One typical use for this would be with drivers for controllers integrated
21941   into system-on-chip processors, where the controller devices have been
21942   configured as part of board setup.
21943   </para><para>
21944
21945   Note that this is incompatible with deferred probing.
21946   </para><para>
21947
21948   Returns zero if the driver registered and bound to a device, else returns
21949   a negative error code and with the driver not registered.
21950</para>
21951</refsect1>
21952</refentry>
21953
21954<refentry id="API---platform-create-bundle">
21955<refentryinfo>
21956 <title>LINUX</title>
21957 <productname>Kernel Hackers Manual</productname>
21958 <date>July 2017</date>
21959</refentryinfo>
21960<refmeta>
21961 <refentrytitle><phrase>__platform_create_bundle</phrase></refentrytitle>
21962 <manvolnum>9</manvolnum>
21963 <refmiscinfo class="version">4.1.27</refmiscinfo>
21964</refmeta>
21965<refnamediv>
21966 <refname>__platform_create_bundle</refname>
21967 <refpurpose>
21968     register driver and create corresponding device
21969 </refpurpose>
21970</refnamediv>
21971<refsynopsisdiv>
21972 <title>Synopsis</title>
21973  <funcsynopsis><funcprototype>
21974   <funcdef>struct platform_device * <function>__platform_create_bundle </function></funcdef>
21975   <paramdef>struct platform_driver * <parameter>driver</parameter></paramdef>
21976   <paramdef>int (*<parameter>probe</parameter>)
21977     <funcparams>struct platform_device *</funcparams></paramdef>
21978   <paramdef>struct resource * <parameter>res</parameter></paramdef>
21979   <paramdef>unsigned int <parameter>n_res</parameter></paramdef>
21980   <paramdef>const void * <parameter>data</parameter></paramdef>
21981   <paramdef>size_t <parameter>size</parameter></paramdef>
21982   <paramdef>struct module * <parameter>module</parameter></paramdef>
21983  </funcprototype></funcsynopsis>
21984</refsynopsisdiv>
21985<refsect1>
21986 <title>Arguments</title>
21987 <variablelist>
21988  <varlistentry>
21989   <term><parameter>driver</parameter></term>
21990   <listitem>
21991    <para>
21992     platform driver structure
21993    </para>
21994   </listitem>
21995  </varlistentry>
21996  <varlistentry>
21997   <term><parameter>probe</parameter></term>
21998   <listitem>
21999    <para>
22000     the driver probe routine, probably from an __init section
22001    </para>
22002   </listitem>
22003  </varlistentry>
22004  <varlistentry>
22005   <term><parameter>res</parameter></term>
22006   <listitem>
22007    <para>
22008     set of resources that needs to be allocated for the device
22009    </para>
22010   </listitem>
22011  </varlistentry>
22012  <varlistentry>
22013   <term><parameter>n_res</parameter></term>
22014   <listitem>
22015    <para>
22016     number of resources
22017    </para>
22018   </listitem>
22019  </varlistentry>
22020  <varlistentry>
22021   <term><parameter>data</parameter></term>
22022   <listitem>
22023    <para>
22024     platform specific data for this platform device
22025    </para>
22026   </listitem>
22027  </varlistentry>
22028  <varlistentry>
22029   <term><parameter>size</parameter></term>
22030   <listitem>
22031    <para>
22032     size of platform specific data
22033    </para>
22034   </listitem>
22035  </varlistentry>
22036  <varlistentry>
22037   <term><parameter>module</parameter></term>
22038   <listitem>
22039    <para>
22040     module which will be the owner of the driver
22041    </para>
22042   </listitem>
22043  </varlistentry>
22044 </variablelist>
22045</refsect1>
22046<refsect1>
22047<title>Description</title>
22048<para>
22049   Use this in legacy-style modules that probe hardware directly and
22050   register a single platform device and corresponding platform driver.
22051   </para><para>
22052
22053   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
22054</para>
22055</refsect1>
22056</refentry>
22057
22058<!-- drivers/base/bus.c -->
22059<refentry id="API-bus-for-each-dev">
22060<refentryinfo>
22061 <title>LINUX</title>
22062 <productname>Kernel Hackers Manual</productname>
22063 <date>July 2017</date>
22064</refentryinfo>
22065<refmeta>
22066 <refentrytitle><phrase>bus_for_each_dev</phrase></refentrytitle>
22067 <manvolnum>9</manvolnum>
22068 <refmiscinfo class="version">4.1.27</refmiscinfo>
22069</refmeta>
22070<refnamediv>
22071 <refname>bus_for_each_dev</refname>
22072 <refpurpose>
22073  device iterator.
22074 </refpurpose>
22075</refnamediv>
22076<refsynopsisdiv>
22077 <title>Synopsis</title>
22078  <funcsynopsis><funcprototype>
22079   <funcdef>int <function>bus_for_each_dev </function></funcdef>
22080   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
22081   <paramdef>struct device * <parameter>start</parameter></paramdef>
22082   <paramdef>void * <parameter>data</parameter></paramdef>
22083   <paramdef>int (*<parameter>fn</parameter>)
22084     <funcparams>struct device *, void *</funcparams></paramdef>
22085  </funcprototype></funcsynopsis>
22086</refsynopsisdiv>
22087<refsect1>
22088 <title>Arguments</title>
22089 <variablelist>
22090  <varlistentry>
22091   <term><parameter>bus</parameter></term>
22092   <listitem>
22093    <para>
22094     bus type.
22095    </para>
22096   </listitem>
22097  </varlistentry>
22098  <varlistentry>
22099   <term><parameter>start</parameter></term>
22100   <listitem>
22101    <para>
22102     device to start iterating from.
22103    </para>
22104   </listitem>
22105  </varlistentry>
22106  <varlistentry>
22107   <term><parameter>data</parameter></term>
22108   <listitem>
22109    <para>
22110     data for the callback.
22111    </para>
22112   </listitem>
22113  </varlistentry>
22114  <varlistentry>
22115   <term><parameter>fn</parameter></term>
22116   <listitem>
22117    <para>
22118     function to be called for each device.
22119    </para>
22120   </listitem>
22121  </varlistentry>
22122 </variablelist>
22123</refsect1>
22124<refsect1>
22125<title>Description</title>
22126<para>
22127   Iterate over <parameter>bus</parameter>'s list of devices, and call <parameter>fn</parameter> for each,
22128   passing it <parameter>data</parameter>. If <parameter>start</parameter> is not NULL, we use that device to
22129   begin iterating from.
22130   </para><para>
22131
22132   We check the return of <parameter>fn</parameter> each time. If it returns anything
22133   other than 0, we break out and return that value.
22134</para>
22135</refsect1>
22136<refsect1>
22137<title>NOTE</title>
22138<para>
22139   The device that returns a non-zero value is not retained
22140   in any way, nor is its refcount incremented. If the caller needs
22141   to retain this data, it should do so, and increment the reference
22142   count in the supplied callback.
22143</para>
22144</refsect1>
22145</refentry>
22146
22147<refentry id="API-bus-find-device">
22148<refentryinfo>
22149 <title>LINUX</title>
22150 <productname>Kernel Hackers Manual</productname>
22151 <date>July 2017</date>
22152</refentryinfo>
22153<refmeta>
22154 <refentrytitle><phrase>bus_find_device</phrase></refentrytitle>
22155 <manvolnum>9</manvolnum>
22156 <refmiscinfo class="version">4.1.27</refmiscinfo>
22157</refmeta>
22158<refnamediv>
22159 <refname>bus_find_device</refname>
22160 <refpurpose>
22161     device iterator for locating a particular device.
22162 </refpurpose>
22163</refnamediv>
22164<refsynopsisdiv>
22165 <title>Synopsis</title>
22166  <funcsynopsis><funcprototype>
22167   <funcdef>struct device * <function>bus_find_device </function></funcdef>
22168   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
22169   <paramdef>struct device * <parameter>start</parameter></paramdef>
22170   <paramdef>void * <parameter>data</parameter></paramdef>
22171   <paramdef>int (*<parameter>match</parameter>)
22172     <funcparams>struct device *dev, void *data</funcparams></paramdef>
22173  </funcprototype></funcsynopsis>
22174</refsynopsisdiv>
22175<refsect1>
22176 <title>Arguments</title>
22177 <variablelist>
22178  <varlistentry>
22179   <term><parameter>bus</parameter></term>
22180   <listitem>
22181    <para>
22182     bus type
22183    </para>
22184   </listitem>
22185  </varlistentry>
22186  <varlistentry>
22187   <term><parameter>start</parameter></term>
22188   <listitem>
22189    <para>
22190     Device to begin with
22191    </para>
22192   </listitem>
22193  </varlistentry>
22194  <varlistentry>
22195   <term><parameter>data</parameter></term>
22196   <listitem>
22197    <para>
22198     Data to pass to match function
22199    </para>
22200   </listitem>
22201  </varlistentry>
22202  <varlistentry>
22203   <term><parameter>match</parameter></term>
22204   <listitem>
22205    <para>
22206     Callback function to check device
22207    </para>
22208   </listitem>
22209  </varlistentry>
22210 </variablelist>
22211</refsect1>
22212<refsect1>
22213<title>Description</title>
22214<para>
22215   This is similar to the <function>bus_for_each_dev</function> function above, but it
22216   returns a reference to a device that is 'found' for later use, as
22217   determined by the <parameter>match</parameter> callback.
22218   </para><para>
22219
22220   The callback should return 0 if the device doesn't match and non-zero
22221   if it does.  If the callback returns non-zero, this function will
22222   return to the caller and not iterate over any more devices.
22223</para>
22224</refsect1>
22225</refentry>
22226
22227<refentry id="API-bus-find-device-by-name">
22228<refentryinfo>
22229 <title>LINUX</title>
22230 <productname>Kernel Hackers Manual</productname>
22231 <date>July 2017</date>
22232</refentryinfo>
22233<refmeta>
22234 <refentrytitle><phrase>bus_find_device_by_name</phrase></refentrytitle>
22235 <manvolnum>9</manvolnum>
22236 <refmiscinfo class="version">4.1.27</refmiscinfo>
22237</refmeta>
22238<refnamediv>
22239 <refname>bus_find_device_by_name</refname>
22240 <refpurpose>
22241     device iterator for locating a particular device of a specific name
22242 </refpurpose>
22243</refnamediv>
22244<refsynopsisdiv>
22245 <title>Synopsis</title>
22246  <funcsynopsis><funcprototype>
22247   <funcdef>struct device * <function>bus_find_device_by_name </function></funcdef>
22248   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
22249   <paramdef>struct device * <parameter>start</parameter></paramdef>
22250   <paramdef>const char * <parameter>name</parameter></paramdef>
22251  </funcprototype></funcsynopsis>
22252</refsynopsisdiv>
22253<refsect1>
22254 <title>Arguments</title>
22255 <variablelist>
22256  <varlistentry>
22257   <term><parameter>bus</parameter></term>
22258   <listitem>
22259    <para>
22260     bus type
22261    </para>
22262   </listitem>
22263  </varlistentry>
22264  <varlistentry>
22265   <term><parameter>start</parameter></term>
22266   <listitem>
22267    <para>
22268     Device to begin with
22269    </para>
22270   </listitem>
22271  </varlistentry>
22272  <varlistentry>
22273   <term><parameter>name</parameter></term>
22274   <listitem>
22275    <para>
22276     name of the device to match
22277    </para>
22278   </listitem>
22279  </varlistentry>
22280 </variablelist>
22281</refsect1>
22282<refsect1>
22283<title>Description</title>
22284<para>
22285   This is similar to the <function>bus_find_device</function> function above, but it handles
22286   searching by a name automatically, no need to write another strcmp matching
22287   function.
22288</para>
22289</refsect1>
22290</refentry>
22291
22292<refentry id="API-subsys-find-device-by-id">
22293<refentryinfo>
22294 <title>LINUX</title>
22295 <productname>Kernel Hackers Manual</productname>
22296 <date>July 2017</date>
22297</refentryinfo>
22298<refmeta>
22299 <refentrytitle><phrase>subsys_find_device_by_id</phrase></refentrytitle>
22300 <manvolnum>9</manvolnum>
22301 <refmiscinfo class="version">4.1.27</refmiscinfo>
22302</refmeta>
22303<refnamediv>
22304 <refname>subsys_find_device_by_id</refname>
22305 <refpurpose>
22306     find a device with a specific enumeration number
22307 </refpurpose>
22308</refnamediv>
22309<refsynopsisdiv>
22310 <title>Synopsis</title>
22311  <funcsynopsis><funcprototype>
22312   <funcdef>struct device * <function>subsys_find_device_by_id </function></funcdef>
22313   <paramdef>struct bus_type * <parameter>subsys</parameter></paramdef>
22314   <paramdef>unsigned int <parameter>id</parameter></paramdef>
22315   <paramdef>struct device * <parameter>hint</parameter></paramdef>
22316  </funcprototype></funcsynopsis>
22317</refsynopsisdiv>
22318<refsect1>
22319 <title>Arguments</title>
22320 <variablelist>
22321  <varlistentry>
22322   <term><parameter>subsys</parameter></term>
22323   <listitem>
22324    <para>
22325     subsystem
22326    </para>
22327   </listitem>
22328  </varlistentry>
22329  <varlistentry>
22330   <term><parameter>id</parameter></term>
22331   <listitem>
22332    <para>
22333     index 'id' in struct device
22334    </para>
22335   </listitem>
22336  </varlistentry>
22337  <varlistentry>
22338   <term><parameter>hint</parameter></term>
22339   <listitem>
22340    <para>
22341     device to check first
22342    </para>
22343   </listitem>
22344  </varlistentry>
22345 </variablelist>
22346</refsect1>
22347<refsect1>
22348<title>Description</title>
22349<para>
22350   Check the hint's next object and if it is a match return it directly,
22351   otherwise, fall back to a full list search. Either way a reference for
22352   the returned object is taken.
22353</para>
22354</refsect1>
22355</refentry>
22356
22357<refentry id="API-bus-for-each-drv">
22358<refentryinfo>
22359 <title>LINUX</title>
22360 <productname>Kernel Hackers Manual</productname>
22361 <date>July 2017</date>
22362</refentryinfo>
22363<refmeta>
22364 <refentrytitle><phrase>bus_for_each_drv</phrase></refentrytitle>
22365 <manvolnum>9</manvolnum>
22366 <refmiscinfo class="version">4.1.27</refmiscinfo>
22367</refmeta>
22368<refnamediv>
22369 <refname>bus_for_each_drv</refname>
22370 <refpurpose>
22371     driver iterator
22372 </refpurpose>
22373</refnamediv>
22374<refsynopsisdiv>
22375 <title>Synopsis</title>
22376  <funcsynopsis><funcprototype>
22377   <funcdef>int <function>bus_for_each_drv </function></funcdef>
22378   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
22379   <paramdef>struct device_driver * <parameter>start</parameter></paramdef>
22380   <paramdef>void * <parameter>data</parameter></paramdef>
22381   <paramdef>int (*<parameter>fn</parameter>)
22382     <funcparams>struct device_driver *, void *</funcparams></paramdef>
22383  </funcprototype></funcsynopsis>
22384</refsynopsisdiv>
22385<refsect1>
22386 <title>Arguments</title>
22387 <variablelist>
22388  <varlistentry>
22389   <term><parameter>bus</parameter></term>
22390   <listitem>
22391    <para>
22392     bus we're dealing with.
22393    </para>
22394   </listitem>
22395  </varlistentry>
22396  <varlistentry>
22397   <term><parameter>start</parameter></term>
22398   <listitem>
22399    <para>
22400     driver to start iterating on.
22401    </para>
22402   </listitem>
22403  </varlistentry>
22404  <varlistentry>
22405   <term><parameter>data</parameter></term>
22406   <listitem>
22407    <para>
22408     data to pass to the callback.
22409    </para>
22410   </listitem>
22411  </varlistentry>
22412  <varlistentry>
22413   <term><parameter>fn</parameter></term>
22414   <listitem>
22415    <para>
22416     function to call for each driver.
22417    </para>
22418   </listitem>
22419  </varlistentry>
22420 </variablelist>
22421</refsect1>
22422<refsect1>
22423<title>Description</title>
22424<para>
22425   This is nearly identical to the device iterator above.
22426   We iterate over each driver that belongs to <parameter>bus</parameter>, and call
22427   <parameter>fn</parameter> for each. If <parameter>fn</parameter> returns anything but 0, we break out
22428   and return it. If <parameter>start</parameter> is not NULL, we use it as the head
22429   of the list.
22430</para>
22431</refsect1>
22432<refsect1>
22433<title>NOTE</title>
22434<para>
22435   we don't return the driver that returns a non-zero
22436   value, nor do we leave the reference count incremented for that
22437   driver. If the caller needs to know that info, it must set it
22438   in the callback. It must also be sure to increment the refcount
22439   so it doesn't disappear before returning to the caller.
22440</para>
22441</refsect1>
22442</refentry>
22443
22444<refentry id="API-bus-rescan-devices">
22445<refentryinfo>
22446 <title>LINUX</title>
22447 <productname>Kernel Hackers Manual</productname>
22448 <date>July 2017</date>
22449</refentryinfo>
22450<refmeta>
22451 <refentrytitle><phrase>bus_rescan_devices</phrase></refentrytitle>
22452 <manvolnum>9</manvolnum>
22453 <refmiscinfo class="version">4.1.27</refmiscinfo>
22454</refmeta>
22455<refnamediv>
22456 <refname>bus_rescan_devices</refname>
22457 <refpurpose>
22458     rescan devices on the bus for possible drivers
22459 </refpurpose>
22460</refnamediv>
22461<refsynopsisdiv>
22462 <title>Synopsis</title>
22463  <funcsynopsis><funcprototype>
22464   <funcdef>int <function>bus_rescan_devices </function></funcdef>
22465   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
22466  </funcprototype></funcsynopsis>
22467</refsynopsisdiv>
22468<refsect1>
22469 <title>Arguments</title>
22470 <variablelist>
22471  <varlistentry>
22472   <term><parameter>bus</parameter></term>
22473   <listitem>
22474    <para>
22475     the bus to scan.
22476    </para>
22477   </listitem>
22478  </varlistentry>
22479 </variablelist>
22480</refsect1>
22481<refsect1>
22482<title>Description</title>
22483<para>
22484   This function will look for devices on the bus with no driver
22485   attached and rescan it against existing drivers to see if it matches
22486   any by calling <function>device_attach</function> for the unbound devices.
22487</para>
22488</refsect1>
22489</refentry>
22490
22491<refentry id="API-device-reprobe">
22492<refentryinfo>
22493 <title>LINUX</title>
22494 <productname>Kernel Hackers Manual</productname>
22495 <date>July 2017</date>
22496</refentryinfo>
22497<refmeta>
22498 <refentrytitle><phrase>device_reprobe</phrase></refentrytitle>
22499 <manvolnum>9</manvolnum>
22500 <refmiscinfo class="version">4.1.27</refmiscinfo>
22501</refmeta>
22502<refnamediv>
22503 <refname>device_reprobe</refname>
22504 <refpurpose>
22505     remove driver for a device and probe for a new driver
22506 </refpurpose>
22507</refnamediv>
22508<refsynopsisdiv>
22509 <title>Synopsis</title>
22510  <funcsynopsis><funcprototype>
22511   <funcdef>int <function>device_reprobe </function></funcdef>
22512   <paramdef>struct device * <parameter>dev</parameter></paramdef>
22513  </funcprototype></funcsynopsis>
22514</refsynopsisdiv>
22515<refsect1>
22516 <title>Arguments</title>
22517 <variablelist>
22518  <varlistentry>
22519   <term><parameter>dev</parameter></term>
22520   <listitem>
22521    <para>
22522     the device to reprobe
22523    </para>
22524   </listitem>
22525  </varlistentry>
22526 </variablelist>
22527</refsect1>
22528<refsect1>
22529<title>Description</title>
22530<para>
22531   This function detaches the attached driver (if any) for the given
22532   device and restarts the driver probing process.  It is intended
22533   to use if probing criteria changed during a devices lifetime and
22534   driver attachment should change accordingly.
22535</para>
22536</refsect1>
22537</refentry>
22538
22539<refentry id="API-bus-register">
22540<refentryinfo>
22541 <title>LINUX</title>
22542 <productname>Kernel Hackers Manual</productname>
22543 <date>July 2017</date>
22544</refentryinfo>
22545<refmeta>
22546 <refentrytitle><phrase>bus_register</phrase></refentrytitle>
22547 <manvolnum>9</manvolnum>
22548 <refmiscinfo class="version">4.1.27</refmiscinfo>
22549</refmeta>
22550<refnamediv>
22551 <refname>bus_register</refname>
22552 <refpurpose>
22553     register a driver-core subsystem
22554 </refpurpose>
22555</refnamediv>
22556<refsynopsisdiv>
22557 <title>Synopsis</title>
22558  <funcsynopsis><funcprototype>
22559   <funcdef>int <function>bus_register </function></funcdef>
22560   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
22561  </funcprototype></funcsynopsis>
22562</refsynopsisdiv>
22563<refsect1>
22564 <title>Arguments</title>
22565 <variablelist>
22566  <varlistentry>
22567   <term><parameter>bus</parameter></term>
22568   <listitem>
22569    <para>
22570     bus to register
22571    </para>
22572   </listitem>
22573  </varlistentry>
22574 </variablelist>
22575</refsect1>
22576<refsect1>
22577<title>Description</title>
22578<para>
22579   Once we have that, we register the bus with the kobject
22580   infrastructure, then register the children subsystems it has:
22581   the devices and drivers that belong to the subsystem.
22582</para>
22583</refsect1>
22584</refentry>
22585
22586<refentry id="API-bus-unregister">
22587<refentryinfo>
22588 <title>LINUX</title>
22589 <productname>Kernel Hackers Manual</productname>
22590 <date>July 2017</date>
22591</refentryinfo>
22592<refmeta>
22593 <refentrytitle><phrase>bus_unregister</phrase></refentrytitle>
22594 <manvolnum>9</manvolnum>
22595 <refmiscinfo class="version">4.1.27</refmiscinfo>
22596</refmeta>
22597<refnamediv>
22598 <refname>bus_unregister</refname>
22599 <refpurpose>
22600     remove a bus from the system
22601 </refpurpose>
22602</refnamediv>
22603<refsynopsisdiv>
22604 <title>Synopsis</title>
22605  <funcsynopsis><funcprototype>
22606   <funcdef>void <function>bus_unregister </function></funcdef>
22607   <paramdef>struct bus_type * <parameter>bus</parameter></paramdef>
22608  </funcprototype></funcsynopsis>
22609</refsynopsisdiv>
22610<refsect1>
22611 <title>Arguments</title>
22612 <variablelist>
22613  <varlistentry>
22614   <term><parameter>bus</parameter></term>
22615   <listitem>
22616    <para>
22617     bus.
22618    </para>
22619   </listitem>
22620  </varlistentry>
22621 </variablelist>
22622</refsect1>
22623<refsect1>
22624<title>Description</title>
22625<para>
22626   Unregister the child subsystems and the bus itself.
22627   Finally, we call <function>bus_put</function> to release the refcount
22628</para>
22629</refsect1>
22630</refentry>
22631
22632<refentry id="API-subsys-dev-iter-init">
22633<refentryinfo>
22634 <title>LINUX</title>
22635 <productname>Kernel Hackers Manual</productname>
22636 <date>July 2017</date>
22637</refentryinfo>
22638<refmeta>
22639 <refentrytitle><phrase>subsys_dev_iter_init</phrase></refentrytitle>
22640 <manvolnum>9</manvolnum>
22641 <refmiscinfo class="version">4.1.27</refmiscinfo>
22642</refmeta>
22643<refnamediv>
22644 <refname>subsys_dev_iter_init</refname>
22645 <refpurpose>
22646     initialize subsys device iterator
22647 </refpurpose>
22648</refnamediv>
22649<refsynopsisdiv>
22650 <title>Synopsis</title>
22651  <funcsynopsis><funcprototype>
22652   <funcdef>void <function>subsys_dev_iter_init </function></funcdef>
22653   <paramdef>struct subsys_dev_iter * <parameter>iter</parameter></paramdef>
22654   <paramdef>struct bus_type * <parameter>subsys</parameter></paramdef>
22655   <paramdef>struct device * <parameter>start</parameter></paramdef>
22656   <paramdef>const struct device_type * <parameter>type</parameter></paramdef>
22657  </funcprototype></funcsynopsis>
22658</refsynopsisdiv>
22659<refsect1>
22660 <title>Arguments</title>
22661 <variablelist>
22662  <varlistentry>
22663   <term><parameter>iter</parameter></term>
22664   <listitem>
22665    <para>
22666     subsys iterator to initialize
22667    </para>
22668   </listitem>
22669  </varlistentry>
22670  <varlistentry>
22671   <term><parameter>subsys</parameter></term>
22672   <listitem>
22673    <para>
22674     the subsys we wanna iterate over
22675    </para>
22676   </listitem>
22677  </varlistentry>
22678  <varlistentry>
22679   <term><parameter>start</parameter></term>
22680   <listitem>
22681    <para>
22682     the device to start iterating from, if any
22683    </para>
22684   </listitem>
22685  </varlistentry>
22686  <varlistentry>
22687   <term><parameter>type</parameter></term>
22688   <listitem>
22689    <para>
22690     device_type of the devices to iterate over, NULL for all
22691    </para>
22692   </listitem>
22693  </varlistentry>
22694 </variablelist>
22695</refsect1>
22696<refsect1>
22697<title>Description</title>
22698<para>
22699   Initialize subsys iterator <parameter>iter</parameter> such that it iterates over devices
22700   of <parameter>subsys</parameter>.  If <parameter>start</parameter> is set, the list iteration will start there,
22701   otherwise if it is NULL, the iteration starts at the beginning of
22702   the list.
22703</para>
22704</refsect1>
22705</refentry>
22706
22707<refentry id="API-subsys-dev-iter-next">
22708<refentryinfo>
22709 <title>LINUX</title>
22710 <productname>Kernel Hackers Manual</productname>
22711 <date>July 2017</date>
22712</refentryinfo>
22713<refmeta>
22714 <refentrytitle><phrase>subsys_dev_iter_next</phrase></refentrytitle>
22715 <manvolnum>9</manvolnum>
22716 <refmiscinfo class="version">4.1.27</refmiscinfo>
22717</refmeta>
22718<refnamediv>
22719 <refname>subsys_dev_iter_next</refname>
22720 <refpurpose>
22721     iterate to the next device
22722 </refpurpose>
22723</refnamediv>
22724<refsynopsisdiv>
22725 <title>Synopsis</title>
22726  <funcsynopsis><funcprototype>
22727   <funcdef>struct device * <function>subsys_dev_iter_next </function></funcdef>
22728   <paramdef>struct subsys_dev_iter * <parameter>iter</parameter></paramdef>
22729  </funcprototype></funcsynopsis>
22730</refsynopsisdiv>
22731<refsect1>
22732 <title>Arguments</title>
22733 <variablelist>
22734  <varlistentry>
22735   <term><parameter>iter</parameter></term>
22736   <listitem>
22737    <para>
22738     subsys iterator to proceed
22739    </para>
22740   </listitem>
22741  </varlistentry>
22742 </variablelist>
22743</refsect1>
22744<refsect1>
22745<title>Description</title>
22746<para>
22747   Proceed <parameter>iter</parameter> to the next device and return it.  Returns NULL if
22748   iteration is complete.
22749   </para><para>
22750
22751   The returned device is referenced and won't be released till
22752   iterator is proceed to the next device or exited.  The caller is
22753   free to do whatever it wants to do with the device including
22754   calling back into subsys code.
22755</para>
22756</refsect1>
22757</refentry>
22758
22759<refentry id="API-subsys-dev-iter-exit">
22760<refentryinfo>
22761 <title>LINUX</title>
22762 <productname>Kernel Hackers Manual</productname>
22763 <date>July 2017</date>
22764</refentryinfo>
22765<refmeta>
22766 <refentrytitle><phrase>subsys_dev_iter_exit</phrase></refentrytitle>
22767 <manvolnum>9</manvolnum>
22768 <refmiscinfo class="version">4.1.27</refmiscinfo>
22769</refmeta>
22770<refnamediv>
22771 <refname>subsys_dev_iter_exit</refname>
22772 <refpurpose>
22773     finish iteration
22774 </refpurpose>
22775</refnamediv>
22776<refsynopsisdiv>
22777 <title>Synopsis</title>
22778  <funcsynopsis><funcprototype>
22779   <funcdef>void <function>subsys_dev_iter_exit </function></funcdef>
22780   <paramdef>struct subsys_dev_iter * <parameter>iter</parameter></paramdef>
22781  </funcprototype></funcsynopsis>
22782</refsynopsisdiv>
22783<refsect1>
22784 <title>Arguments</title>
22785 <variablelist>
22786  <varlistentry>
22787   <term><parameter>iter</parameter></term>
22788   <listitem>
22789    <para>
22790     subsys iterator to finish
22791    </para>
22792   </listitem>
22793  </varlistentry>
22794 </variablelist>
22795</refsect1>
22796<refsect1>
22797<title>Description</title>
22798<para>
22799   Finish an iteration.  Always call this function after iteration is
22800   complete whether the iteration ran till the end or not.
22801</para>
22802</refsect1>
22803</refentry>
22804
22805<refentry id="API-subsys-system-register">
22806<refentryinfo>
22807 <title>LINUX</title>
22808 <productname>Kernel Hackers Manual</productname>
22809 <date>July 2017</date>
22810</refentryinfo>
22811<refmeta>
22812 <refentrytitle><phrase>subsys_system_register</phrase></refentrytitle>
22813 <manvolnum>9</manvolnum>
22814 <refmiscinfo class="version">4.1.27</refmiscinfo>
22815</refmeta>
22816<refnamediv>
22817 <refname>subsys_system_register</refname>
22818 <refpurpose>
22819     register a subsystem at /sys/devices/system/
22820 </refpurpose>
22821</refnamediv>
22822<refsynopsisdiv>
22823 <title>Synopsis</title>
22824  <funcsynopsis><funcprototype>
22825   <funcdef>int <function>subsys_system_register </function></funcdef>
22826   <paramdef>struct bus_type * <parameter>subsys</parameter></paramdef>
22827   <paramdef>const struct attribute_group ** <parameter>groups</parameter></paramdef>
22828  </funcprototype></funcsynopsis>
22829</refsynopsisdiv>
22830<refsect1>
22831 <title>Arguments</title>
22832 <variablelist>
22833  <varlistentry>
22834   <term><parameter>subsys</parameter></term>
22835   <listitem>
22836    <para>
22837     system subsystem
22838    </para>
22839   </listitem>
22840  </varlistentry>
22841  <varlistentry>
22842   <term><parameter>groups</parameter></term>
22843   <listitem>
22844    <para>
22845     default attributes for the root device
22846    </para>
22847   </listitem>
22848  </varlistentry>
22849 </variablelist>
22850</refsect1>
22851<refsect1>
22852<title>Description</title>
22853<para>
22854   All 'system' subsystems have a /sys/devices/system/&lt;name&gt; root device
22855   with the name of the subsystem. The root device can carry subsystem-
22856   wide attributes. All registered devices are below this single root
22857   device and are named after the subsystem with a simple enumeration
22858   number appended. The registered devices are not explicitly named;
22859   only 'id' in the device needs to be set.
22860   </para><para>
22861
22862   Do not use this interface for anything new, it exists for compatibility
22863   with bad ideas only. New subsystems should use plain subsystems; and
22864   add the subsystem-wide attributes should be added to the subsystem
22865   directory itself and not some create fake root-device placed in
22866   /sys/devices/system/&lt;name&gt;.
22867</para>
22868</refsect1>
22869</refentry>
22870
22871<refentry id="API-subsys-virtual-register">
22872<refentryinfo>
22873 <title>LINUX</title>
22874 <productname>Kernel Hackers Manual</productname>
22875 <date>July 2017</date>
22876</refentryinfo>
22877<refmeta>
22878 <refentrytitle><phrase>subsys_virtual_register</phrase></refentrytitle>
22879 <manvolnum>9</manvolnum>
22880 <refmiscinfo class="version">4.1.27</refmiscinfo>
22881</refmeta>
22882<refnamediv>
22883 <refname>subsys_virtual_register</refname>
22884 <refpurpose>
22885     register a subsystem at /sys/devices/virtual/
22886 </refpurpose>
22887</refnamediv>
22888<refsynopsisdiv>
22889 <title>Synopsis</title>
22890  <funcsynopsis><funcprototype>
22891   <funcdef>int <function>subsys_virtual_register </function></funcdef>
22892   <paramdef>struct bus_type * <parameter>subsys</parameter></paramdef>
22893   <paramdef>const struct attribute_group ** <parameter>groups</parameter></paramdef>
22894  </funcprototype></funcsynopsis>
22895</refsynopsisdiv>
22896<refsect1>
22897 <title>Arguments</title>
22898 <variablelist>
22899  <varlistentry>
22900   <term><parameter>subsys</parameter></term>
22901   <listitem>
22902    <para>
22903     virtual subsystem
22904    </para>
22905   </listitem>
22906  </varlistentry>
22907  <varlistentry>
22908   <term><parameter>groups</parameter></term>
22909   <listitem>
22910    <para>
22911     default attributes for the root device
22912    </para>
22913   </listitem>
22914  </varlistentry>
22915 </variablelist>
22916</refsect1>
22917<refsect1>
22918<title>Description</title>
22919<para>
22920   All 'virtual' subsystems have a /sys/devices/system/&lt;name&gt; root device
22921   with the name of the subystem.  The root device can carry subsystem-wide
22922   attributes.  All registered devices are below this single root device.
22923   There's no restriction on device naming.  This is for kernel software
22924   constructs which need sysfs interface.
22925</para>
22926</refsect1>
22927</refentry>
22928
22929     </sect1>
22930     <sect1><title>Device Drivers DMA Management</title>
22931<!-- drivers/dma-buf/dma-buf.c -->
22932<refentry id="API-dma-buf-export">
22933<refentryinfo>
22934 <title>LINUX</title>
22935 <productname>Kernel Hackers Manual</productname>
22936 <date>July 2017</date>
22937</refentryinfo>
22938<refmeta>
22939 <refentrytitle><phrase>dma_buf_export</phrase></refentrytitle>
22940 <manvolnum>9</manvolnum>
22941 <refmiscinfo class="version">4.1.27</refmiscinfo>
22942</refmeta>
22943<refnamediv>
22944 <refname>dma_buf_export</refname>
22945 <refpurpose>
22946  Creates a new dma_buf, and associates an anon file with this buffer, so it can be exported. Also connect the allocator specific data and ops to the buffer. Additionally, provide a name string for exporter; useful in debugging.
22947 </refpurpose>
22948</refnamediv>
22949<refsynopsisdiv>
22950 <title>Synopsis</title>
22951  <funcsynopsis><funcprototype>
22952   <funcdef>struct dma_buf * <function>dma_buf_export </function></funcdef>
22953   <paramdef>const struct dma_buf_export_info * <parameter>exp_info</parameter></paramdef>
22954  </funcprototype></funcsynopsis>
22955</refsynopsisdiv>
22956<refsect1>
22957 <title>Arguments</title>
22958 <variablelist>
22959  <varlistentry>
22960   <term><parameter>exp_info</parameter></term>
22961   <listitem>
22962    <para>
22963     [in]	holds all the export related information provided
22964     by the exporter. see struct dma_buf_export_info
22965     for further details.
22966    </para>
22967   </listitem>
22968  </varlistentry>
22969 </variablelist>
22970</refsect1>
22971<refsect1>
22972<title>Description</title>
22973<para>
22974   Returns, on success, a newly created dma_buf object, which wraps the
22975   supplied private data and operations for dma_buf_ops. On either missing
22976   ops, or error in allocating struct dma_buf, will return negative error.
22977</para>
22978</refsect1>
22979</refentry>
22980
22981<refentry id="API-dma-buf-fd">
22982<refentryinfo>
22983 <title>LINUX</title>
22984 <productname>Kernel Hackers Manual</productname>
22985 <date>July 2017</date>
22986</refentryinfo>
22987<refmeta>
22988 <refentrytitle><phrase>dma_buf_fd</phrase></refentrytitle>
22989 <manvolnum>9</manvolnum>
22990 <refmiscinfo class="version">4.1.27</refmiscinfo>
22991</refmeta>
22992<refnamediv>
22993 <refname>dma_buf_fd</refname>
22994 <refpurpose>
22995     returns a file descriptor for the given dma_buf
22996 </refpurpose>
22997</refnamediv>
22998<refsynopsisdiv>
22999 <title>Synopsis</title>
23000  <funcsynopsis><funcprototype>
23001   <funcdef>int <function>dma_buf_fd </function></funcdef>
23002   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23003   <paramdef>int <parameter>flags</parameter></paramdef>
23004  </funcprototype></funcsynopsis>
23005</refsynopsisdiv>
23006<refsect1>
23007 <title>Arguments</title>
23008 <variablelist>
23009  <varlistentry>
23010   <term><parameter>dmabuf</parameter></term>
23011   <listitem>
23012    <para>
23013     [in]	pointer to dma_buf for which fd is required.
23014    </para>
23015   </listitem>
23016  </varlistentry>
23017  <varlistentry>
23018   <term><parameter>flags</parameter></term>
23019   <listitem>
23020    <para>
23021     [in]    flags to give to fd
23022    </para>
23023   </listitem>
23024  </varlistentry>
23025 </variablelist>
23026</refsect1>
23027<refsect1>
23028<title>Description</title>
23029<para>
23030   On success, returns an associated 'fd'. Else, returns error.
23031</para>
23032</refsect1>
23033</refentry>
23034
23035<refentry id="API-dma-buf-get">
23036<refentryinfo>
23037 <title>LINUX</title>
23038 <productname>Kernel Hackers Manual</productname>
23039 <date>July 2017</date>
23040</refentryinfo>
23041<refmeta>
23042 <refentrytitle><phrase>dma_buf_get</phrase></refentrytitle>
23043 <manvolnum>9</manvolnum>
23044 <refmiscinfo class="version">4.1.27</refmiscinfo>
23045</refmeta>
23046<refnamediv>
23047 <refname>dma_buf_get</refname>
23048 <refpurpose>
23049     returns the dma_buf structure related to an fd
23050 </refpurpose>
23051</refnamediv>
23052<refsynopsisdiv>
23053 <title>Synopsis</title>
23054  <funcsynopsis><funcprototype>
23055   <funcdef>struct dma_buf * <function>dma_buf_get </function></funcdef>
23056   <paramdef>int <parameter>fd</parameter></paramdef>
23057  </funcprototype></funcsynopsis>
23058</refsynopsisdiv>
23059<refsect1>
23060 <title>Arguments</title>
23061 <variablelist>
23062  <varlistentry>
23063   <term><parameter>fd</parameter></term>
23064   <listitem>
23065    <para>
23066     [in]	fd associated with the dma_buf to be returned
23067    </para>
23068   </listitem>
23069  </varlistentry>
23070 </variablelist>
23071</refsect1>
23072<refsect1>
23073<title>Description</title>
23074<para>
23075   On success, returns the dma_buf structure associated with an fd; uses
23076   file's refcounting done by fget to increase refcount. returns ERR_PTR
23077   otherwise.
23078</para>
23079</refsect1>
23080</refentry>
23081
23082<refentry id="API-dma-buf-put">
23083<refentryinfo>
23084 <title>LINUX</title>
23085 <productname>Kernel Hackers Manual</productname>
23086 <date>July 2017</date>
23087</refentryinfo>
23088<refmeta>
23089 <refentrytitle><phrase>dma_buf_put</phrase></refentrytitle>
23090 <manvolnum>9</manvolnum>
23091 <refmiscinfo class="version">4.1.27</refmiscinfo>
23092</refmeta>
23093<refnamediv>
23094 <refname>dma_buf_put</refname>
23095 <refpurpose>
23096     decreases refcount of the buffer
23097 </refpurpose>
23098</refnamediv>
23099<refsynopsisdiv>
23100 <title>Synopsis</title>
23101  <funcsynopsis><funcprototype>
23102   <funcdef>void <function>dma_buf_put </function></funcdef>
23103   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23104  </funcprototype></funcsynopsis>
23105</refsynopsisdiv>
23106<refsect1>
23107 <title>Arguments</title>
23108 <variablelist>
23109  <varlistentry>
23110   <term><parameter>dmabuf</parameter></term>
23111   <listitem>
23112    <para>
23113     [in]	buffer to reduce refcount of
23114    </para>
23115   </listitem>
23116  </varlistentry>
23117 </variablelist>
23118</refsect1>
23119<refsect1>
23120<title>Description</title>
23121<para>
23122   Uses file's refcounting done implicitly by <function>fput</function>
23123</para>
23124</refsect1>
23125</refentry>
23126
23127<refentry id="API-dma-buf-attach">
23128<refentryinfo>
23129 <title>LINUX</title>
23130 <productname>Kernel Hackers Manual</productname>
23131 <date>July 2017</date>
23132</refentryinfo>
23133<refmeta>
23134 <refentrytitle><phrase>dma_buf_attach</phrase></refentrytitle>
23135 <manvolnum>9</manvolnum>
23136 <refmiscinfo class="version">4.1.27</refmiscinfo>
23137</refmeta>
23138<refnamediv>
23139 <refname>dma_buf_attach</refname>
23140 <refpurpose>
23141     Add the device to dma_buf's attachments list; optionally, calls <function>attach</function> of dma_buf_ops to allow device-specific attach functionality
23142 </refpurpose>
23143</refnamediv>
23144<refsynopsisdiv>
23145 <title>Synopsis</title>
23146  <funcsynopsis><funcprototype>
23147   <funcdef>struct dma_buf_attachment * <function>dma_buf_attach </function></funcdef>
23148   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23149   <paramdef>struct device * <parameter>dev</parameter></paramdef>
23150  </funcprototype></funcsynopsis>
23151</refsynopsisdiv>
23152<refsect1>
23153 <title>Arguments</title>
23154 <variablelist>
23155  <varlistentry>
23156   <term><parameter>dmabuf</parameter></term>
23157   <listitem>
23158    <para>
23159     [in]	buffer to attach device to.
23160    </para>
23161   </listitem>
23162  </varlistentry>
23163  <varlistentry>
23164   <term><parameter>dev</parameter></term>
23165   <listitem>
23166    <para>
23167     [in]	device to be attached.
23168    </para>
23169   </listitem>
23170  </varlistentry>
23171 </variablelist>
23172</refsect1>
23173<refsect1>
23174<title>Description</title>
23175<para>
23176   Returns struct dma_buf_attachment * for this attachment; returns ERR_PTR on
23177   error.
23178</para>
23179</refsect1>
23180</refentry>
23181
23182<refentry id="API-dma-buf-detach">
23183<refentryinfo>
23184 <title>LINUX</title>
23185 <productname>Kernel Hackers Manual</productname>
23186 <date>July 2017</date>
23187</refentryinfo>
23188<refmeta>
23189 <refentrytitle><phrase>dma_buf_detach</phrase></refentrytitle>
23190 <manvolnum>9</manvolnum>
23191 <refmiscinfo class="version">4.1.27</refmiscinfo>
23192</refmeta>
23193<refnamediv>
23194 <refname>dma_buf_detach</refname>
23195 <refpurpose>
23196     Remove the given attachment from dmabuf's attachments list; optionally calls <function>detach</function> of dma_buf_ops for device-specific detach
23197 </refpurpose>
23198</refnamediv>
23199<refsynopsisdiv>
23200 <title>Synopsis</title>
23201  <funcsynopsis><funcprototype>
23202   <funcdef>void <function>dma_buf_detach </function></funcdef>
23203   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23204   <paramdef>struct dma_buf_attachment * <parameter>attach</parameter></paramdef>
23205  </funcprototype></funcsynopsis>
23206</refsynopsisdiv>
23207<refsect1>
23208 <title>Arguments</title>
23209 <variablelist>
23210  <varlistentry>
23211   <term><parameter>dmabuf</parameter></term>
23212   <listitem>
23213    <para>
23214     [in]	buffer to detach from.
23215    </para>
23216   </listitem>
23217  </varlistentry>
23218  <varlistentry>
23219   <term><parameter>attach</parameter></term>
23220   <listitem>
23221    <para>
23222     [in]	attachment to be detached; is free'd after this call.
23223    </para>
23224   </listitem>
23225  </varlistentry>
23226 </variablelist>
23227</refsect1>
23228</refentry>
23229
23230<refentry id="API-dma-buf-map-attachment">
23231<refentryinfo>
23232 <title>LINUX</title>
23233 <productname>Kernel Hackers Manual</productname>
23234 <date>July 2017</date>
23235</refentryinfo>
23236<refmeta>
23237 <refentrytitle><phrase>dma_buf_map_attachment</phrase></refentrytitle>
23238 <manvolnum>9</manvolnum>
23239 <refmiscinfo class="version">4.1.27</refmiscinfo>
23240</refmeta>
23241<refnamediv>
23242 <refname>dma_buf_map_attachment</refname>
23243 <refpurpose>
23244     Returns the scatterlist table of the attachment; mapped into _device_ address space. Is a wrapper for <function>map_dma_buf</function> of the dma_buf_ops.
23245 </refpurpose>
23246</refnamediv>
23247<refsynopsisdiv>
23248 <title>Synopsis</title>
23249  <funcsynopsis><funcprototype>
23250   <funcdef>struct sg_table * <function>dma_buf_map_attachment </function></funcdef>
23251   <paramdef>struct dma_buf_attachment * <parameter>attach</parameter></paramdef>
23252   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
23253  </funcprototype></funcsynopsis>
23254</refsynopsisdiv>
23255<refsect1>
23256 <title>Arguments</title>
23257 <variablelist>
23258  <varlistentry>
23259   <term><parameter>attach</parameter></term>
23260   <listitem>
23261    <para>
23262     [in]	attachment whose scatterlist is to be returned
23263    </para>
23264   </listitem>
23265  </varlistentry>
23266  <varlistentry>
23267   <term><parameter>direction</parameter></term>
23268   <listitem>
23269    <para>
23270     [in]	direction of DMA transfer
23271    </para>
23272   </listitem>
23273  </varlistentry>
23274 </variablelist>
23275</refsect1>
23276<refsect1>
23277<title>Description</title>
23278<para>
23279   Returns sg_table containing the scatterlist to be returned; returns ERR_PTR
23280   on error.
23281</para>
23282</refsect1>
23283</refentry>
23284
23285<refentry id="API-dma-buf-unmap-attachment">
23286<refentryinfo>
23287 <title>LINUX</title>
23288 <productname>Kernel Hackers Manual</productname>
23289 <date>July 2017</date>
23290</refentryinfo>
23291<refmeta>
23292 <refentrytitle><phrase>dma_buf_unmap_attachment</phrase></refentrytitle>
23293 <manvolnum>9</manvolnum>
23294 <refmiscinfo class="version">4.1.27</refmiscinfo>
23295</refmeta>
23296<refnamediv>
23297 <refname>dma_buf_unmap_attachment</refname>
23298 <refpurpose>
23299     unmaps and decreases usecount of the buffer;might deallocate the scatterlist associated. Is a wrapper for <function>unmap_dma_buf</function> of dma_buf_ops.
23300 </refpurpose>
23301</refnamediv>
23302<refsynopsisdiv>
23303 <title>Synopsis</title>
23304  <funcsynopsis><funcprototype>
23305   <funcdef>void <function>dma_buf_unmap_attachment </function></funcdef>
23306   <paramdef>struct dma_buf_attachment * <parameter>attach</parameter></paramdef>
23307   <paramdef>struct sg_table * <parameter>sg_table</parameter></paramdef>
23308   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
23309  </funcprototype></funcsynopsis>
23310</refsynopsisdiv>
23311<refsect1>
23312 <title>Arguments</title>
23313 <variablelist>
23314  <varlistentry>
23315   <term><parameter>attach</parameter></term>
23316   <listitem>
23317    <para>
23318     [in]	attachment to unmap buffer from
23319    </para>
23320   </listitem>
23321  </varlistentry>
23322  <varlistentry>
23323   <term><parameter>sg_table</parameter></term>
23324   <listitem>
23325    <para>
23326     [in]	scatterlist info of the buffer to unmap
23327    </para>
23328   </listitem>
23329  </varlistentry>
23330  <varlistentry>
23331   <term><parameter>direction</parameter></term>
23332   <listitem>
23333    <para>
23334     [in]    direction of DMA transfer
23335    </para>
23336   </listitem>
23337  </varlistentry>
23338 </variablelist>
23339</refsect1>
23340</refentry>
23341
23342<refentry id="API-dma-buf-begin-cpu-access">
23343<refentryinfo>
23344 <title>LINUX</title>
23345 <productname>Kernel Hackers Manual</productname>
23346 <date>July 2017</date>
23347</refentryinfo>
23348<refmeta>
23349 <refentrytitle><phrase>dma_buf_begin_cpu_access</phrase></refentrytitle>
23350 <manvolnum>9</manvolnum>
23351 <refmiscinfo class="version">4.1.27</refmiscinfo>
23352</refmeta>
23353<refnamediv>
23354 <refname>dma_buf_begin_cpu_access</refname>
23355 <refpurpose>
23356     Must be called before accessing a dma_buf from the cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific preparations. Coherency is only guaranteed in the specified range for the specified access direction.
23357 </refpurpose>
23358</refnamediv>
23359<refsynopsisdiv>
23360 <title>Synopsis</title>
23361  <funcsynopsis><funcprototype>
23362   <funcdef>int <function>dma_buf_begin_cpu_access </function></funcdef>
23363   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23364   <paramdef>size_t <parameter>start</parameter></paramdef>
23365   <paramdef>size_t <parameter>len</parameter></paramdef>
23366   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
23367  </funcprototype></funcsynopsis>
23368</refsynopsisdiv>
23369<refsect1>
23370 <title>Arguments</title>
23371 <variablelist>
23372  <varlistentry>
23373   <term><parameter>dmabuf</parameter></term>
23374   <listitem>
23375    <para>
23376     [in]	buffer to prepare cpu access for.
23377    </para>
23378   </listitem>
23379  </varlistentry>
23380  <varlistentry>
23381   <term><parameter>start</parameter></term>
23382   <listitem>
23383    <para>
23384     [in]	start of range for cpu access.
23385    </para>
23386   </listitem>
23387  </varlistentry>
23388  <varlistentry>
23389   <term><parameter>len</parameter></term>
23390   <listitem>
23391    <para>
23392     [in]	length of range for cpu access.
23393    </para>
23394   </listitem>
23395  </varlistentry>
23396  <varlistentry>
23397   <term><parameter>direction</parameter></term>
23398   <listitem>
23399    <para>
23400     [in]	length of range for cpu access.
23401    </para>
23402   </listitem>
23403  </varlistentry>
23404 </variablelist>
23405</refsect1>
23406<refsect1>
23407<title>Description</title>
23408<para>
23409   Can return negative error values, returns 0 on success.
23410</para>
23411</refsect1>
23412</refentry>
23413
23414<refentry id="API-dma-buf-end-cpu-access">
23415<refentryinfo>
23416 <title>LINUX</title>
23417 <productname>Kernel Hackers Manual</productname>
23418 <date>July 2017</date>
23419</refentryinfo>
23420<refmeta>
23421 <refentrytitle><phrase>dma_buf_end_cpu_access</phrase></refentrytitle>
23422 <manvolnum>9</manvolnum>
23423 <refmiscinfo class="version">4.1.27</refmiscinfo>
23424</refmeta>
23425<refnamediv>
23426 <refname>dma_buf_end_cpu_access</refname>
23427 <refpurpose>
23428     Must be called after accessing a dma_buf from the cpu in the kernel context. Calls end_cpu_access to allow exporter-specific actions. Coherency is only guaranteed in the specified range for the specified access direction.
23429 </refpurpose>
23430</refnamediv>
23431<refsynopsisdiv>
23432 <title>Synopsis</title>
23433  <funcsynopsis><funcprototype>
23434   <funcdef>void <function>dma_buf_end_cpu_access </function></funcdef>
23435   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23436   <paramdef>size_t <parameter>start</parameter></paramdef>
23437   <paramdef>size_t <parameter>len</parameter></paramdef>
23438   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
23439  </funcprototype></funcsynopsis>
23440</refsynopsisdiv>
23441<refsect1>
23442 <title>Arguments</title>
23443 <variablelist>
23444  <varlistentry>
23445   <term><parameter>dmabuf</parameter></term>
23446   <listitem>
23447    <para>
23448     [in]	buffer to complete cpu access for.
23449    </para>
23450   </listitem>
23451  </varlistentry>
23452  <varlistentry>
23453   <term><parameter>start</parameter></term>
23454   <listitem>
23455    <para>
23456     [in]	start of range for cpu access.
23457    </para>
23458   </listitem>
23459  </varlistentry>
23460  <varlistentry>
23461   <term><parameter>len</parameter></term>
23462   <listitem>
23463    <para>
23464     [in]	length of range for cpu access.
23465    </para>
23466   </listitem>
23467  </varlistentry>
23468  <varlistentry>
23469   <term><parameter>direction</parameter></term>
23470   <listitem>
23471    <para>
23472     [in]	length of range for cpu access.
23473    </para>
23474   </listitem>
23475  </varlistentry>
23476 </variablelist>
23477</refsect1>
23478<refsect1>
23479<title>Description</title>
23480<para>
23481   This call must always succeed.
23482</para>
23483</refsect1>
23484</refentry>
23485
23486<refentry id="API-dma-buf-kmap-atomic">
23487<refentryinfo>
23488 <title>LINUX</title>
23489 <productname>Kernel Hackers Manual</productname>
23490 <date>July 2017</date>
23491</refentryinfo>
23492<refmeta>
23493 <refentrytitle><phrase>dma_buf_kmap_atomic</phrase></refentrytitle>
23494 <manvolnum>9</manvolnum>
23495 <refmiscinfo class="version">4.1.27</refmiscinfo>
23496</refmeta>
23497<refnamediv>
23498 <refname>dma_buf_kmap_atomic</refname>
23499 <refpurpose>
23500     Map a page of the buffer object into kernel address space. The same restrictions as for kmap_atomic and friends apply.
23501 </refpurpose>
23502</refnamediv>
23503<refsynopsisdiv>
23504 <title>Synopsis</title>
23505  <funcsynopsis><funcprototype>
23506   <funcdef>void * <function>dma_buf_kmap_atomic </function></funcdef>
23507   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23508   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
23509  </funcprototype></funcsynopsis>
23510</refsynopsisdiv>
23511<refsect1>
23512 <title>Arguments</title>
23513 <variablelist>
23514  <varlistentry>
23515   <term><parameter>dmabuf</parameter></term>
23516   <listitem>
23517    <para>
23518     [in]	buffer to map page from.
23519    </para>
23520   </listitem>
23521  </varlistentry>
23522  <varlistentry>
23523   <term><parameter>page_num</parameter></term>
23524   <listitem>
23525    <para>
23526     [in]	page in PAGE_SIZE units to map.
23527    </para>
23528   </listitem>
23529  </varlistentry>
23530 </variablelist>
23531</refsect1>
23532<refsect1>
23533<title>Description</title>
23534<para>
23535   This call must always succeed, any necessary preparations that might fail
23536   need to be done in begin_cpu_access.
23537</para>
23538</refsect1>
23539</refentry>
23540
23541<refentry id="API-dma-buf-kunmap-atomic">
23542<refentryinfo>
23543 <title>LINUX</title>
23544 <productname>Kernel Hackers Manual</productname>
23545 <date>July 2017</date>
23546</refentryinfo>
23547<refmeta>
23548 <refentrytitle><phrase>dma_buf_kunmap_atomic</phrase></refentrytitle>
23549 <manvolnum>9</manvolnum>
23550 <refmiscinfo class="version">4.1.27</refmiscinfo>
23551</refmeta>
23552<refnamediv>
23553 <refname>dma_buf_kunmap_atomic</refname>
23554 <refpurpose>
23555     Unmap a page obtained by dma_buf_kmap_atomic.
23556 </refpurpose>
23557</refnamediv>
23558<refsynopsisdiv>
23559 <title>Synopsis</title>
23560  <funcsynopsis><funcprototype>
23561   <funcdef>void <function>dma_buf_kunmap_atomic </function></funcdef>
23562   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23563   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
23564   <paramdef>void * <parameter>vaddr</parameter></paramdef>
23565  </funcprototype></funcsynopsis>
23566</refsynopsisdiv>
23567<refsect1>
23568 <title>Arguments</title>
23569 <variablelist>
23570  <varlistentry>
23571   <term><parameter>dmabuf</parameter></term>
23572   <listitem>
23573    <para>
23574     [in]	buffer to unmap page from.
23575    </para>
23576   </listitem>
23577  </varlistentry>
23578  <varlistentry>
23579   <term><parameter>page_num</parameter></term>
23580   <listitem>
23581    <para>
23582     [in]	page in PAGE_SIZE units to unmap.
23583    </para>
23584   </listitem>
23585  </varlistentry>
23586  <varlistentry>
23587   <term><parameter>vaddr</parameter></term>
23588   <listitem>
23589    <para>
23590     [in]	kernel space pointer obtained from dma_buf_kmap_atomic.
23591    </para>
23592   </listitem>
23593  </varlistentry>
23594 </variablelist>
23595</refsect1>
23596<refsect1>
23597<title>Description</title>
23598<para>
23599   This call must always succeed.
23600</para>
23601</refsect1>
23602</refentry>
23603
23604<refentry id="API-dma-buf-kmap">
23605<refentryinfo>
23606 <title>LINUX</title>
23607 <productname>Kernel Hackers Manual</productname>
23608 <date>July 2017</date>
23609</refentryinfo>
23610<refmeta>
23611 <refentrytitle><phrase>dma_buf_kmap</phrase></refentrytitle>
23612 <manvolnum>9</manvolnum>
23613 <refmiscinfo class="version">4.1.27</refmiscinfo>
23614</refmeta>
23615<refnamediv>
23616 <refname>dma_buf_kmap</refname>
23617 <refpurpose>
23618     Map a page of the buffer object into kernel address space. The same restrictions as for kmap and friends apply.
23619 </refpurpose>
23620</refnamediv>
23621<refsynopsisdiv>
23622 <title>Synopsis</title>
23623  <funcsynopsis><funcprototype>
23624   <funcdef>void * <function>dma_buf_kmap </function></funcdef>
23625   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23626   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
23627  </funcprototype></funcsynopsis>
23628</refsynopsisdiv>
23629<refsect1>
23630 <title>Arguments</title>
23631 <variablelist>
23632  <varlistentry>
23633   <term><parameter>dmabuf</parameter></term>
23634   <listitem>
23635    <para>
23636     [in]	buffer to map page from.
23637    </para>
23638   </listitem>
23639  </varlistentry>
23640  <varlistentry>
23641   <term><parameter>page_num</parameter></term>
23642   <listitem>
23643    <para>
23644     [in]	page in PAGE_SIZE units to map.
23645    </para>
23646   </listitem>
23647  </varlistentry>
23648 </variablelist>
23649</refsect1>
23650<refsect1>
23651<title>Description</title>
23652<para>
23653   This call must always succeed, any necessary preparations that might fail
23654   need to be done in begin_cpu_access.
23655</para>
23656</refsect1>
23657</refentry>
23658
23659<refentry id="API-dma-buf-kunmap">
23660<refentryinfo>
23661 <title>LINUX</title>
23662 <productname>Kernel Hackers Manual</productname>
23663 <date>July 2017</date>
23664</refentryinfo>
23665<refmeta>
23666 <refentrytitle><phrase>dma_buf_kunmap</phrase></refentrytitle>
23667 <manvolnum>9</manvolnum>
23668 <refmiscinfo class="version">4.1.27</refmiscinfo>
23669</refmeta>
23670<refnamediv>
23671 <refname>dma_buf_kunmap</refname>
23672 <refpurpose>
23673     Unmap a page obtained by dma_buf_kmap.
23674 </refpurpose>
23675</refnamediv>
23676<refsynopsisdiv>
23677 <title>Synopsis</title>
23678  <funcsynopsis><funcprototype>
23679   <funcdef>void <function>dma_buf_kunmap </function></funcdef>
23680   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23681   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
23682   <paramdef>void * <parameter>vaddr</parameter></paramdef>
23683  </funcprototype></funcsynopsis>
23684</refsynopsisdiv>
23685<refsect1>
23686 <title>Arguments</title>
23687 <variablelist>
23688  <varlistentry>
23689   <term><parameter>dmabuf</parameter></term>
23690   <listitem>
23691    <para>
23692     [in]	buffer to unmap page from.
23693    </para>
23694   </listitem>
23695  </varlistentry>
23696  <varlistentry>
23697   <term><parameter>page_num</parameter></term>
23698   <listitem>
23699    <para>
23700     [in]	page in PAGE_SIZE units to unmap.
23701    </para>
23702   </listitem>
23703  </varlistentry>
23704  <varlistentry>
23705   <term><parameter>vaddr</parameter></term>
23706   <listitem>
23707    <para>
23708     [in]	kernel space pointer obtained from dma_buf_kmap.
23709    </para>
23710   </listitem>
23711  </varlistentry>
23712 </variablelist>
23713</refsect1>
23714<refsect1>
23715<title>Description</title>
23716<para>
23717   This call must always succeed.
23718</para>
23719</refsect1>
23720</refentry>
23721
23722<refentry id="API-dma-buf-mmap">
23723<refentryinfo>
23724 <title>LINUX</title>
23725 <productname>Kernel Hackers Manual</productname>
23726 <date>July 2017</date>
23727</refentryinfo>
23728<refmeta>
23729 <refentrytitle><phrase>dma_buf_mmap</phrase></refentrytitle>
23730 <manvolnum>9</manvolnum>
23731 <refmiscinfo class="version">4.1.27</refmiscinfo>
23732</refmeta>
23733<refnamediv>
23734 <refname>dma_buf_mmap</refname>
23735 <refpurpose>
23736     Setup up a userspace mmap with the given vma
23737 </refpurpose>
23738</refnamediv>
23739<refsynopsisdiv>
23740 <title>Synopsis</title>
23741  <funcsynopsis><funcprototype>
23742   <funcdef>int <function>dma_buf_mmap </function></funcdef>
23743   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23744   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
23745   <paramdef>unsigned long <parameter>pgoff</parameter></paramdef>
23746  </funcprototype></funcsynopsis>
23747</refsynopsisdiv>
23748<refsect1>
23749 <title>Arguments</title>
23750 <variablelist>
23751  <varlistentry>
23752   <term><parameter>dmabuf</parameter></term>
23753   <listitem>
23754    <para>
23755     [in]	buffer that should back the vma
23756    </para>
23757   </listitem>
23758  </varlistentry>
23759  <varlistentry>
23760   <term><parameter>vma</parameter></term>
23761   <listitem>
23762    <para>
23763     [in]	vma for the mmap
23764    </para>
23765   </listitem>
23766  </varlistentry>
23767  <varlistentry>
23768   <term><parameter>pgoff</parameter></term>
23769   <listitem>
23770    <para>
23771     [in]	offset in pages where this mmap should start within the
23772     dma-buf buffer.
23773    </para>
23774   </listitem>
23775  </varlistentry>
23776 </variablelist>
23777</refsect1>
23778<refsect1>
23779<title>Description</title>
23780<para>
23781   This function adjusts the passed in vma so that it points at the file of the
23782   dma_buf operation. It also adjusts the starting pgoff and does bounds
23783   checking on the size of the vma. Then it calls the exporters mmap function to
23784   set up the mapping.
23785   </para><para>
23786
23787   Can return negative error values, returns 0 on success.
23788</para>
23789</refsect1>
23790</refentry>
23791
23792<refentry id="API-dma-buf-vmap">
23793<refentryinfo>
23794 <title>LINUX</title>
23795 <productname>Kernel Hackers Manual</productname>
23796 <date>July 2017</date>
23797</refentryinfo>
23798<refmeta>
23799 <refentrytitle><phrase>dma_buf_vmap</phrase></refentrytitle>
23800 <manvolnum>9</manvolnum>
23801 <refmiscinfo class="version">4.1.27</refmiscinfo>
23802</refmeta>
23803<refnamediv>
23804 <refname>dma_buf_vmap</refname>
23805 <refpurpose>
23806     Create virtual mapping for the buffer object into kernel address space. Same restrictions as for vmap and friends apply.
23807 </refpurpose>
23808</refnamediv>
23809<refsynopsisdiv>
23810 <title>Synopsis</title>
23811  <funcsynopsis><funcprototype>
23812   <funcdef>void * <function>dma_buf_vmap </function></funcdef>
23813   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23814  </funcprototype></funcsynopsis>
23815</refsynopsisdiv>
23816<refsect1>
23817 <title>Arguments</title>
23818 <variablelist>
23819  <varlistentry>
23820   <term><parameter>dmabuf</parameter></term>
23821   <listitem>
23822    <para>
23823     [in]	buffer to vmap
23824    </para>
23825   </listitem>
23826  </varlistentry>
23827 </variablelist>
23828</refsect1>
23829<refsect1>
23830<title>Description</title>
23831<para>
23832   This call may fail due to lack of virtual mapping address space.
23833   These calls are optional in drivers. The intended use for them
23834   is for mapping objects linear in kernel space for high use objects.
23835   Please attempt to use kmap/kunmap before thinking about these interfaces.
23836   </para><para>
23837
23838   Returns NULL on error.
23839</para>
23840</refsect1>
23841</refentry>
23842
23843<refentry id="API-dma-buf-vunmap">
23844<refentryinfo>
23845 <title>LINUX</title>
23846 <productname>Kernel Hackers Manual</productname>
23847 <date>July 2017</date>
23848</refentryinfo>
23849<refmeta>
23850 <refentrytitle><phrase>dma_buf_vunmap</phrase></refentrytitle>
23851 <manvolnum>9</manvolnum>
23852 <refmiscinfo class="version">4.1.27</refmiscinfo>
23853</refmeta>
23854<refnamediv>
23855 <refname>dma_buf_vunmap</refname>
23856 <refpurpose>
23857     Unmap a vmap obtained by dma_buf_vmap.
23858 </refpurpose>
23859</refnamediv>
23860<refsynopsisdiv>
23861 <title>Synopsis</title>
23862  <funcsynopsis><funcprototype>
23863   <funcdef>void <function>dma_buf_vunmap </function></funcdef>
23864   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
23865   <paramdef>void * <parameter>vaddr</parameter></paramdef>
23866  </funcprototype></funcsynopsis>
23867</refsynopsisdiv>
23868<refsect1>
23869 <title>Arguments</title>
23870 <variablelist>
23871  <varlistentry>
23872   <term><parameter>dmabuf</parameter></term>
23873   <listitem>
23874    <para>
23875     [in]	buffer to vunmap
23876    </para>
23877   </listitem>
23878  </varlistentry>
23879  <varlistentry>
23880   <term><parameter>vaddr</parameter></term>
23881   <listitem>
23882    <para>
23883     [in]	vmap to vunmap
23884    </para>
23885   </listitem>
23886  </varlistentry>
23887 </variablelist>
23888</refsect1>
23889</refentry>
23890
23891<!-- drivers/dma-buf/fence.c -->
23892<refentry id="API-fence-context-alloc">
23893<refentryinfo>
23894 <title>LINUX</title>
23895 <productname>Kernel Hackers Manual</productname>
23896 <date>July 2017</date>
23897</refentryinfo>
23898<refmeta>
23899 <refentrytitle><phrase>fence_context_alloc</phrase></refentrytitle>
23900 <manvolnum>9</manvolnum>
23901 <refmiscinfo class="version">4.1.27</refmiscinfo>
23902</refmeta>
23903<refnamediv>
23904 <refname>fence_context_alloc</refname>
23905 <refpurpose>
23906  allocate an array of fence contexts
23907 </refpurpose>
23908</refnamediv>
23909<refsynopsisdiv>
23910 <title>Synopsis</title>
23911  <funcsynopsis><funcprototype>
23912   <funcdef>unsigned <function>fence_context_alloc </function></funcdef>
23913   <paramdef>unsigned <parameter>num</parameter></paramdef>
23914  </funcprototype></funcsynopsis>
23915</refsynopsisdiv>
23916<refsect1>
23917 <title>Arguments</title>
23918 <variablelist>
23919  <varlistentry>
23920   <term><parameter>num</parameter></term>
23921   <listitem>
23922    <para>
23923     [in]	amount of contexts to allocate
23924    </para>
23925   </listitem>
23926  </varlistentry>
23927 </variablelist>
23928</refsect1>
23929<refsect1>
23930<title>Description</title>
23931<para>
23932   This function will return the first index of the number of fences allocated.
23933   The fence context is used for setting fence-&gt;context to a unique number.
23934</para>
23935</refsect1>
23936</refentry>
23937
23938<refentry id="API-fence-signal-locked">
23939<refentryinfo>
23940 <title>LINUX</title>
23941 <productname>Kernel Hackers Manual</productname>
23942 <date>July 2017</date>
23943</refentryinfo>
23944<refmeta>
23945 <refentrytitle><phrase>fence_signal_locked</phrase></refentrytitle>
23946 <manvolnum>9</manvolnum>
23947 <refmiscinfo class="version">4.1.27</refmiscinfo>
23948</refmeta>
23949<refnamediv>
23950 <refname>fence_signal_locked</refname>
23951 <refpurpose>
23952     signal completion of a fence
23953 </refpurpose>
23954</refnamediv>
23955<refsynopsisdiv>
23956 <title>Synopsis</title>
23957  <funcsynopsis><funcprototype>
23958   <funcdef>int <function>fence_signal_locked </function></funcdef>
23959   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
23960  </funcprototype></funcsynopsis>
23961</refsynopsisdiv>
23962<refsect1>
23963 <title>Arguments</title>
23964 <variablelist>
23965  <varlistentry>
23966   <term><parameter>fence</parameter></term>
23967   <listitem>
23968    <para>
23969     the fence to signal
23970    </para>
23971   </listitem>
23972  </varlistentry>
23973 </variablelist>
23974</refsect1>
23975<refsect1>
23976<title>Description</title>
23977<para>
23978   Signal completion for software callbacks on a fence, this will unblock
23979   <function>fence_wait</function> calls and run all the callbacks added with
23980   <function>fence_add_callback</function>. Can be called multiple times, but since a fence
23981   can only go from unsignaled to signaled state, it will only be effective
23982   the first time.
23983   </para><para>
23984
23985   Unlike fence_signal, this function must be called with fence-&gt;lock held.
23986</para>
23987</refsect1>
23988</refentry>
23989
23990<refentry id="API-fence-signal">
23991<refentryinfo>
23992 <title>LINUX</title>
23993 <productname>Kernel Hackers Manual</productname>
23994 <date>July 2017</date>
23995</refentryinfo>
23996<refmeta>
23997 <refentrytitle><phrase>fence_signal</phrase></refentrytitle>
23998 <manvolnum>9</manvolnum>
23999 <refmiscinfo class="version">4.1.27</refmiscinfo>
24000</refmeta>
24001<refnamediv>
24002 <refname>fence_signal</refname>
24003 <refpurpose>
24004     signal completion of a fence
24005 </refpurpose>
24006</refnamediv>
24007<refsynopsisdiv>
24008 <title>Synopsis</title>
24009  <funcsynopsis><funcprototype>
24010   <funcdef>int <function>fence_signal </function></funcdef>
24011   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24012  </funcprototype></funcsynopsis>
24013</refsynopsisdiv>
24014<refsect1>
24015 <title>Arguments</title>
24016 <variablelist>
24017  <varlistentry>
24018   <term><parameter>fence</parameter></term>
24019   <listitem>
24020    <para>
24021     the fence to signal
24022    </para>
24023   </listitem>
24024  </varlistentry>
24025 </variablelist>
24026</refsect1>
24027<refsect1>
24028<title>Description</title>
24029<para>
24030   Signal completion for software callbacks on a fence, this will unblock
24031   <function>fence_wait</function> calls and run all the callbacks added with
24032   <function>fence_add_callback</function>. Can be called multiple times, but since a fence
24033   can only go from unsignaled to signaled state, it will only be effective
24034   the first time.
24035</para>
24036</refsect1>
24037</refentry>
24038
24039<refentry id="API-fence-wait-timeout">
24040<refentryinfo>
24041 <title>LINUX</title>
24042 <productname>Kernel Hackers Manual</productname>
24043 <date>July 2017</date>
24044</refentryinfo>
24045<refmeta>
24046 <refentrytitle><phrase>fence_wait_timeout</phrase></refentrytitle>
24047 <manvolnum>9</manvolnum>
24048 <refmiscinfo class="version">4.1.27</refmiscinfo>
24049</refmeta>
24050<refnamediv>
24051 <refname>fence_wait_timeout</refname>
24052 <refpurpose>
24053     sleep until the fence gets signaled or until timeout elapses
24054 </refpurpose>
24055</refnamediv>
24056<refsynopsisdiv>
24057 <title>Synopsis</title>
24058  <funcsynopsis><funcprototype>
24059   <funcdef>signed long <function>fence_wait_timeout </function></funcdef>
24060   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24061   <paramdef>bool <parameter>intr</parameter></paramdef>
24062   <paramdef>signed long <parameter>timeout</parameter></paramdef>
24063  </funcprototype></funcsynopsis>
24064</refsynopsisdiv>
24065<refsect1>
24066 <title>Arguments</title>
24067 <variablelist>
24068  <varlistentry>
24069   <term><parameter>fence</parameter></term>
24070   <listitem>
24071    <para>
24072     [in]	the fence to wait on
24073    </para>
24074   </listitem>
24075  </varlistentry>
24076  <varlistentry>
24077   <term><parameter>intr</parameter></term>
24078   <listitem>
24079    <para>
24080     [in]	if true, do an interruptible wait
24081    </para>
24082   </listitem>
24083  </varlistentry>
24084  <varlistentry>
24085   <term><parameter>timeout</parameter></term>
24086   <listitem>
24087    <para>
24088     [in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
24089    </para>
24090   </listitem>
24091  </varlistentry>
24092 </variablelist>
24093</refsect1>
24094<refsect1>
24095<title>Description</title>
24096<para>
24097   Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
24098   remaining timeout in jiffies on success. Other error values may be
24099   returned on custom implementations.
24100   </para><para>
24101
24102   Performs a synchronous wait on this fence. It is assumed the caller
24103   directly or indirectly (buf-mgr between reservation and committing)
24104   holds a reference to the fence, otherwise the fence might be
24105   freed before return, resulting in undefined behavior.
24106</para>
24107</refsect1>
24108</refentry>
24109
24110<refentry id="API-fence-enable-sw-signaling">
24111<refentryinfo>
24112 <title>LINUX</title>
24113 <productname>Kernel Hackers Manual</productname>
24114 <date>July 2017</date>
24115</refentryinfo>
24116<refmeta>
24117 <refentrytitle><phrase>fence_enable_sw_signaling</phrase></refentrytitle>
24118 <manvolnum>9</manvolnum>
24119 <refmiscinfo class="version">4.1.27</refmiscinfo>
24120</refmeta>
24121<refnamediv>
24122 <refname>fence_enable_sw_signaling</refname>
24123 <refpurpose>
24124     enable signaling on fence
24125 </refpurpose>
24126</refnamediv>
24127<refsynopsisdiv>
24128 <title>Synopsis</title>
24129  <funcsynopsis><funcprototype>
24130   <funcdef>void <function>fence_enable_sw_signaling </function></funcdef>
24131   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24132  </funcprototype></funcsynopsis>
24133</refsynopsisdiv>
24134<refsect1>
24135 <title>Arguments</title>
24136 <variablelist>
24137  <varlistentry>
24138   <term><parameter>fence</parameter></term>
24139   <listitem>
24140    <para>
24141     [in]	the fence to enable
24142    </para>
24143   </listitem>
24144  </varlistentry>
24145 </variablelist>
24146</refsect1>
24147<refsect1>
24148<title>Description</title>
24149<para>
24150   this will request for sw signaling to be enabled, to make the fence
24151   complete as soon as possible
24152</para>
24153</refsect1>
24154</refentry>
24155
24156<refentry id="API-fence-add-callback">
24157<refentryinfo>
24158 <title>LINUX</title>
24159 <productname>Kernel Hackers Manual</productname>
24160 <date>July 2017</date>
24161</refentryinfo>
24162<refmeta>
24163 <refentrytitle><phrase>fence_add_callback</phrase></refentrytitle>
24164 <manvolnum>9</manvolnum>
24165 <refmiscinfo class="version">4.1.27</refmiscinfo>
24166</refmeta>
24167<refnamediv>
24168 <refname>fence_add_callback</refname>
24169 <refpurpose>
24170     add a callback to be called when the fence is signaled
24171 </refpurpose>
24172</refnamediv>
24173<refsynopsisdiv>
24174 <title>Synopsis</title>
24175  <funcsynopsis><funcprototype>
24176   <funcdef>int <function>fence_add_callback </function></funcdef>
24177   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24178   <paramdef>struct fence_cb * <parameter>cb</parameter></paramdef>
24179   <paramdef>fence_func_t <parameter>func</parameter></paramdef>
24180  </funcprototype></funcsynopsis>
24181</refsynopsisdiv>
24182<refsect1>
24183 <title>Arguments</title>
24184 <variablelist>
24185  <varlistentry>
24186   <term><parameter>fence</parameter></term>
24187   <listitem>
24188    <para>
24189     [in]	the fence to wait on
24190    </para>
24191   </listitem>
24192  </varlistentry>
24193  <varlistentry>
24194   <term><parameter>cb</parameter></term>
24195   <listitem>
24196    <para>
24197     [in]	the callback to register
24198    </para>
24199   </listitem>
24200  </varlistentry>
24201  <varlistentry>
24202   <term><parameter>func</parameter></term>
24203   <listitem>
24204    <para>
24205     [in]	the function to call
24206    </para>
24207   </listitem>
24208  </varlistentry>
24209 </variablelist>
24210</refsect1>
24211<refsect1>
24212<title>Description</title>
24213<para>
24214   cb will be initialized by fence_add_callback, no initialization
24215   by the caller is required. Any number of callbacks can be registered
24216   to a fence, but a callback can only be registered to one fence at a time.
24217   </para><para>
24218
24219   Note that the callback can be called from an atomic context.  If
24220   fence is already signaled, this function will return -ENOENT (and
24221   *not* call the callback)
24222   </para><para>
24223
24224   Add a software callback to the fence. Same restrictions apply to
24225   refcount as it does to fence_wait, however the caller doesn't need to
24226</para>
24227</refsect1>
24228<refsect1>
24229<title>keep a refcount to fence afterwards</title>
24230<para>
24231   when software access is enabled,
24232   the creator of the fence is required to keep the fence alive until
24233   after it signals with fence_signal. The callback itself can be called
24234   from irq context.
24235</para>
24236</refsect1>
24237</refentry>
24238
24239<refentry id="API-fence-remove-callback">
24240<refentryinfo>
24241 <title>LINUX</title>
24242 <productname>Kernel Hackers Manual</productname>
24243 <date>July 2017</date>
24244</refentryinfo>
24245<refmeta>
24246 <refentrytitle><phrase>fence_remove_callback</phrase></refentrytitle>
24247 <manvolnum>9</manvolnum>
24248 <refmiscinfo class="version">4.1.27</refmiscinfo>
24249</refmeta>
24250<refnamediv>
24251 <refname>fence_remove_callback</refname>
24252 <refpurpose>
24253     remove a callback from the signaling list
24254 </refpurpose>
24255</refnamediv>
24256<refsynopsisdiv>
24257 <title>Synopsis</title>
24258  <funcsynopsis><funcprototype>
24259   <funcdef>bool <function>fence_remove_callback </function></funcdef>
24260   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24261   <paramdef>struct fence_cb * <parameter>cb</parameter></paramdef>
24262  </funcprototype></funcsynopsis>
24263</refsynopsisdiv>
24264<refsect1>
24265 <title>Arguments</title>
24266 <variablelist>
24267  <varlistentry>
24268   <term><parameter>fence</parameter></term>
24269   <listitem>
24270    <para>
24271     [in]	the fence to wait on
24272    </para>
24273   </listitem>
24274  </varlistentry>
24275  <varlistentry>
24276   <term><parameter>cb</parameter></term>
24277   <listitem>
24278    <para>
24279     [in]	the callback to remove
24280    </para>
24281   </listitem>
24282  </varlistentry>
24283 </variablelist>
24284</refsect1>
24285<refsect1>
24286<title>Description</title>
24287<para>
24288   Remove a previously queued callback from the fence. This function returns
24289   true if the callback is successfully removed, or false if the fence has
24290   already been signaled.
24291   </para><para>
24292
24293   *WARNING*:
24294   Cancelling a callback should only be done if you really know what you're
24295   doing, since deadlocks and race conditions could occur all too easily. For
24296   this reason, it should only ever be done on hardware lockup recovery,
24297   with a reference held to the fence.
24298</para>
24299</refsect1>
24300</refentry>
24301
24302<refentry id="API-fence-default-wait">
24303<refentryinfo>
24304 <title>LINUX</title>
24305 <productname>Kernel Hackers Manual</productname>
24306 <date>July 2017</date>
24307</refentryinfo>
24308<refmeta>
24309 <refentrytitle><phrase>fence_default_wait</phrase></refentrytitle>
24310 <manvolnum>9</manvolnum>
24311 <refmiscinfo class="version">4.1.27</refmiscinfo>
24312</refmeta>
24313<refnamediv>
24314 <refname>fence_default_wait</refname>
24315 <refpurpose>
24316     default sleep until the fence gets signaled or until timeout elapses
24317 </refpurpose>
24318</refnamediv>
24319<refsynopsisdiv>
24320 <title>Synopsis</title>
24321  <funcsynopsis><funcprototype>
24322   <funcdef>signed long <function>fence_default_wait </function></funcdef>
24323   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24324   <paramdef>bool <parameter>intr</parameter></paramdef>
24325   <paramdef>signed long <parameter>timeout</parameter></paramdef>
24326  </funcprototype></funcsynopsis>
24327</refsynopsisdiv>
24328<refsect1>
24329 <title>Arguments</title>
24330 <variablelist>
24331  <varlistentry>
24332   <term><parameter>fence</parameter></term>
24333   <listitem>
24334    <para>
24335     [in]	the fence to wait on
24336    </para>
24337   </listitem>
24338  </varlistentry>
24339  <varlistentry>
24340   <term><parameter>intr</parameter></term>
24341   <listitem>
24342    <para>
24343     [in]	if true, do an interruptible wait
24344    </para>
24345   </listitem>
24346  </varlistentry>
24347  <varlistentry>
24348   <term><parameter>timeout</parameter></term>
24349   <listitem>
24350    <para>
24351     [in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
24352    </para>
24353   </listitem>
24354  </varlistentry>
24355 </variablelist>
24356</refsect1>
24357<refsect1>
24358<title>Description</title>
24359<para>
24360   Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
24361   remaining timeout in jiffies on success.
24362</para>
24363</refsect1>
24364</refentry>
24365
24366<refentry id="API-fence-init">
24367<refentryinfo>
24368 <title>LINUX</title>
24369 <productname>Kernel Hackers Manual</productname>
24370 <date>July 2017</date>
24371</refentryinfo>
24372<refmeta>
24373 <refentrytitle><phrase>fence_init</phrase></refentrytitle>
24374 <manvolnum>9</manvolnum>
24375 <refmiscinfo class="version">4.1.27</refmiscinfo>
24376</refmeta>
24377<refnamediv>
24378 <refname>fence_init</refname>
24379 <refpurpose>
24380     Initialize a custom fence.
24381 </refpurpose>
24382</refnamediv>
24383<refsynopsisdiv>
24384 <title>Synopsis</title>
24385  <funcsynopsis><funcprototype>
24386   <funcdef>void <function>fence_init </function></funcdef>
24387   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24388   <paramdef>const struct fence_ops * <parameter>ops</parameter></paramdef>
24389   <paramdef>spinlock_t * <parameter>lock</parameter></paramdef>
24390   <paramdef>unsigned <parameter>context</parameter></paramdef>
24391   <paramdef>unsigned <parameter>seqno</parameter></paramdef>
24392  </funcprototype></funcsynopsis>
24393</refsynopsisdiv>
24394<refsect1>
24395 <title>Arguments</title>
24396 <variablelist>
24397  <varlistentry>
24398   <term><parameter>fence</parameter></term>
24399   <listitem>
24400    <para>
24401     [in]	the fence to initialize
24402    </para>
24403   </listitem>
24404  </varlistentry>
24405  <varlistentry>
24406   <term><parameter>ops</parameter></term>
24407   <listitem>
24408    <para>
24409     [in]	the fence_ops for operations on this fence
24410    </para>
24411   </listitem>
24412  </varlistentry>
24413  <varlistentry>
24414   <term><parameter>lock</parameter></term>
24415   <listitem>
24416    <para>
24417     [in]	the irqsafe spinlock to use for locking this fence
24418    </para>
24419   </listitem>
24420  </varlistentry>
24421  <varlistentry>
24422   <term><parameter>context</parameter></term>
24423   <listitem>
24424    <para>
24425     [in]	the execution context this fence is run on
24426    </para>
24427   </listitem>
24428  </varlistentry>
24429  <varlistentry>
24430   <term><parameter>seqno</parameter></term>
24431   <listitem>
24432    <para>
24433     [in]	a linear increasing sequence number for this context
24434    </para>
24435   </listitem>
24436  </varlistentry>
24437 </variablelist>
24438</refsect1>
24439<refsect1>
24440<title>Description</title>
24441<para>
24442   Initializes an allocated fence, the caller doesn't have to keep its
24443   refcount after committing with this fence, but it will need to hold a
24444   refcount again if fence_ops.enable_signaling gets called. This can
24445   be used for other implementing other types of fence.
24446   </para><para>
24447
24448   context and seqno are used for easy comparison between fences, allowing
24449   to check which fence is later by simply using fence_later.
24450</para>
24451</refsect1>
24452</refentry>
24453
24454<!-- drivers/dma-buf/seqno-fence.c -->
24455<refentry>
24456 <refnamediv>
24457  <refname>
24458   .//drivers/dma-buf/seqno-fence.c
24459  </refname>
24460  <refpurpose>
24461   Document generation inconsistency
24462  </refpurpose>
24463 </refnamediv>
24464 <refsect1>
24465  <title>
24466   Oops
24467  </title>
24468  <warning>
24469   <para>
24470    The template for this document tried to insert
24471    the structured comment from the file
24472    <filename>.//drivers/dma-buf/seqno-fence.c</filename> at this point,
24473    but none was found.
24474    This dummy section is inserted to allow
24475    generation to continue.
24476   </para>
24477  </warning>
24478 </refsect1>
24479</refentry>
24480<!-- include/linux/fence.h -->
24481<refentry id="API-struct-fence">
24482<refentryinfo>
24483 <title>LINUX</title>
24484 <productname>Kernel Hackers Manual</productname>
24485 <date>July 2017</date>
24486</refentryinfo>
24487<refmeta>
24488 <refentrytitle><phrase>struct fence</phrase></refentrytitle>
24489 <manvolnum>9</manvolnum>
24490 <refmiscinfo class="version">4.1.27</refmiscinfo>
24491</refmeta>
24492<refnamediv>
24493 <refname>struct fence</refname>
24494 <refpurpose>
24495  software synchronization primitive
24496 </refpurpose>
24497</refnamediv>
24498<refsynopsisdiv>
24499 <title>Synopsis</title>
24500  <programlisting>
24501struct fence {
24502  struct kref refcount;
24503  const struct fence_ops * ops;
24504  struct rcu_head rcu;
24505  struct list_head cb_list;
24506  spinlock_t * lock;
24507  unsigned context;
24508  unsigned seqno;
24509  unsigned long flags;
24510  ktime_t timestamp;
24511  int status;
24512};  </programlisting>
24513</refsynopsisdiv>
24514 <refsect1>
24515  <title>Members</title>
24516  <variablelist>
24517    <varlistentry>      <term>refcount</term>
24518      <listitem><para>
24519refcount for this fence
24520      </para></listitem>
24521    </varlistentry>
24522    <varlistentry>      <term>ops</term>
24523      <listitem><para>
24524fence_ops associated with this fence
24525      </para></listitem>
24526    </varlistentry>
24527    <varlistentry>      <term>rcu</term>
24528      <listitem><para>
24529used for releasing fence with kfree_rcu
24530      </para></listitem>
24531    </varlistentry>
24532    <varlistentry>      <term>cb_list</term>
24533      <listitem><para>
24534list of all callbacks to call
24535      </para></listitem>
24536    </varlistentry>
24537    <varlistentry>      <term>lock</term>
24538      <listitem><para>
24539spin_lock_irqsave used for locking
24540      </para></listitem>
24541    </varlistentry>
24542    <varlistentry>      <term>context</term>
24543      <listitem><para>
24544execution context this fence belongs to, returned by
24545<function>fence_context_alloc</function>
24546      </para></listitem>
24547    </varlistentry>
24548    <varlistentry>      <term>seqno</term>
24549      <listitem><para>
24550the sequence number of this fence inside the execution context,
24551can be compared to decide which fence would be signaled later.
24552      </para></listitem>
24553    </varlistentry>
24554    <varlistentry>      <term>flags</term>
24555      <listitem><para>
24556A mask of FENCE_FLAG_* defined below
24557      </para></listitem>
24558    </varlistentry>
24559    <varlistentry>      <term>timestamp</term>
24560      <listitem><para>
24561Timestamp when the fence was signaled.
24562      </para></listitem>
24563    </varlistentry>
24564    <varlistentry>      <term>status</term>
24565      <listitem><para>
24566Optional, only valid if &lt; 0, must be set before calling
24567fence_signal, indicates that the fence has completed with an error.
24568      </para></listitem>
24569    </varlistentry>
24570  </variablelist>
24571 </refsect1>
24572<refsect1>
24573<title>Description</title>
24574<para>
24575   the flags member must be manipulated and read using the appropriate
24576   atomic ops (bit_*), so taking the spinlock will not be needed most
24577   of the time.
24578   </para><para>
24579
24580   FENCE_FLAG_SIGNALED_BIT - fence is already signaled
24581   FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called*
24582   FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the
24583   implementer of the fence for its own purposes. Can be used in different
24584   ways by different fence implementers, so do not rely on this.
24585   </para><para>
24586
24587   *) Since atomic bitops are used, this is not guaranteed to be the case.
24588   Particularly, if the bit was set, but fence_signal was called right
24589   before this bit was set, it would have been able to set the
24590   FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called.
24591   Adding a check for FENCE_FLAG_SIGNALED_BIT after setting
24592   FENCE_FLAG_ENABLE_SIGNAL_BIT closes this race, and makes sure that
24593   after fence_signal was called, any enable_signaling call will have either
24594   been completed, or never called at all.
24595</para>
24596</refsect1>
24597</refentry>
24598
24599<refentry id="API-struct-fence-cb">
24600<refentryinfo>
24601 <title>LINUX</title>
24602 <productname>Kernel Hackers Manual</productname>
24603 <date>July 2017</date>
24604</refentryinfo>
24605<refmeta>
24606 <refentrytitle><phrase>struct fence_cb</phrase></refentrytitle>
24607 <manvolnum>9</manvolnum>
24608 <refmiscinfo class="version">4.1.27</refmiscinfo>
24609</refmeta>
24610<refnamediv>
24611 <refname>struct fence_cb</refname>
24612 <refpurpose>
24613     callback for fence_add_callback
24614 </refpurpose>
24615</refnamediv>
24616<refsynopsisdiv>
24617 <title>Synopsis</title>
24618  <programlisting>
24619struct fence_cb {
24620  struct list_head node;
24621  fence_func_t func;
24622};  </programlisting>
24623</refsynopsisdiv>
24624 <refsect1>
24625  <title>Members</title>
24626  <variablelist>
24627    <varlistentry>      <term>node</term>
24628      <listitem><para>
24629   used by fence_add_callback to append this struct to fence::cb_list
24630      </para></listitem>
24631    </varlistentry>
24632    <varlistentry>      <term>func</term>
24633      <listitem><para>
24634   fence_func_t to call
24635      </para></listitem>
24636    </varlistentry>
24637  </variablelist>
24638 </refsect1>
24639<refsect1>
24640<title>Description</title>
24641<para>
24642   This struct will be initialized by fence_add_callback, additional
24643   data can be passed along by embedding fence_cb in another struct.
24644</para>
24645</refsect1>
24646</refentry>
24647
24648<refentry id="API-struct-fence-ops">
24649<refentryinfo>
24650 <title>LINUX</title>
24651 <productname>Kernel Hackers Manual</productname>
24652 <date>July 2017</date>
24653</refentryinfo>
24654<refmeta>
24655 <refentrytitle><phrase>struct fence_ops</phrase></refentrytitle>
24656 <manvolnum>9</manvolnum>
24657 <refmiscinfo class="version">4.1.27</refmiscinfo>
24658</refmeta>
24659<refnamediv>
24660 <refname>struct fence_ops</refname>
24661 <refpurpose>
24662     operations implemented for fence
24663 </refpurpose>
24664</refnamediv>
24665<refsynopsisdiv>
24666 <title>Synopsis</title>
24667  <programlisting>
24668struct fence_ops {
24669  const char * (* get_driver_name) (struct fence *fence);
24670  const char * (* get_timeline_name) (struct fence *fence);
24671  bool (* enable_signaling) (struct fence *fence);
24672  bool (* signaled) (struct fence *fence);
24673  signed long (* wait) (struct fence *fence, bool intr, signed long timeout);
24674  void (* release) (struct fence *fence);
24675  int (* fill_driver_data) (struct fence *fence, void *data, int size);
24676  void (* fence_value_str) (struct fence *fence, char *str, int size);
24677  void (* timeline_value_str) (struct fence *fence, char *str, int size);
24678};  </programlisting>
24679</refsynopsisdiv>
24680 <refsect1>
24681  <title>Members</title>
24682  <variablelist>
24683    <varlistentry>      <term>get_driver_name</term>
24684      <listitem><para>
24685   returns the driver name.
24686      </para></listitem>
24687    </varlistentry>
24688    <varlistentry>      <term>get_timeline_name</term>
24689      <listitem><para>
24690   return the name of the context this fence belongs to.
24691      </para></listitem>
24692    </varlistentry>
24693    <varlistentry>      <term>enable_signaling</term>
24694      <listitem><para>
24695   enable software signaling of fence.
24696      </para></listitem>
24697    </varlistentry>
24698    <varlistentry>      <term>signaled</term>
24699      <listitem><para>
24700   [optional] peek whether the fence is signaled, can be null.
24701      </para></listitem>
24702    </varlistentry>
24703    <varlistentry>      <term>wait</term>
24704      <listitem><para>
24705   custom wait implementation, or fence_default_wait.
24706      </para></listitem>
24707    </varlistentry>
24708    <varlistentry>      <term>release</term>
24709      <listitem><para>
24710   [optional] called on destruction of fence, can be null
24711      </para></listitem>
24712    </varlistentry>
24713    <varlistentry>      <term>fill_driver_data</term>
24714      <listitem><para>
24715   [optional] callback to fill in free-form debug info
24716   Returns amount of bytes filled, or -errno.
24717      </para></listitem>
24718    </varlistentry>
24719    <varlistentry>      <term>fence_value_str</term>
24720      <listitem><para>
24721   [optional] fills in the value of the fence as a string
24722      </para></listitem>
24723    </varlistentry>
24724    <varlistentry>      <term>timeline_value_str</term>
24725      <listitem><para>
24726   [optional] fills in the current value of the timeline
24727   as a string
24728      </para></listitem>
24729    </varlistentry>
24730  </variablelist>
24731 </refsect1>
24732<refsect1>
24733<title>Notes on enable_signaling</title>
24734<para>
24735   For fence implementations that have the capability for hw-&gt;hw
24736   signaling, they can implement this op to enable the necessary
24737   irqs, or insert commands into cmdstream, etc.  This is called
24738   in the first <function>wait</function> or <function>add_callback</function> path to let the fence
24739   implementation know that there is another driver waiting on
24740   the signal (ie. hw-&gt;sw case).
24741   </para><para>
24742
24743   This function can be called called from atomic context, but not
24744   from irq context, so normal spinlocks can be used.
24745   </para><para>
24746
24747   A return value of false indicates the fence already passed,
24748   or some failure occurred that made it impossible to enable
24749   signaling. True indicates successful enabling.
24750   </para><para>
24751
24752   fence-&gt;status may be set in enable_signaling, but only when false is
24753   returned.
24754   </para><para>
24755
24756   Calling fence_signal before enable_signaling is called allows
24757   for a tiny race window in which enable_signaling is called during,
24758   before, or after fence_signal. To fight this, it is recommended
24759   that before enable_signaling returns true an extra reference is
24760   taken on the fence, to be released when the fence is signaled.
24761   This will mean fence_signal will still be called twice, but
24762   the second time will be a noop since it was already signaled.
24763</para>
24764</refsect1>
24765<refsect1>
24766<title>Notes on signaled</title>
24767<para>
24768   May set fence-&gt;status if returning true.
24769</para>
24770</refsect1>
24771<refsect1>
24772<title>Notes on wait</title>
24773<para>
24774   Must not be NULL, set to fence_default_wait for default implementation.
24775   the fence_default_wait implementation should work for any fence, as long
24776   as enable_signaling works correctly.
24777   </para><para>
24778
24779   Must return -ERESTARTSYS if the wait is intr = true and the wait was
24780   interrupted, and remaining jiffies if fence has signaled, or 0 if wait
24781   timed out. Can also return other error values on custom implementations,
24782   which should be treated as if the fence is signaled. For example a hardware
24783   lockup could be reported like that.
24784</para>
24785</refsect1>
24786<refsect1>
24787<title>Notes on release</title>
24788<para>
24789   Can be NULL, this function allows additional commands to run on
24790   destruction of the fence. Can be called from irq context.
24791   If pointer is set to NULL, kfree will get called instead.
24792</para>
24793</refsect1>
24794</refentry>
24795
24796<refentry id="API-fence-get">
24797<refentryinfo>
24798 <title>LINUX</title>
24799 <productname>Kernel Hackers Manual</productname>
24800 <date>July 2017</date>
24801</refentryinfo>
24802<refmeta>
24803 <refentrytitle><phrase>fence_get</phrase></refentrytitle>
24804 <manvolnum>9</manvolnum>
24805 <refmiscinfo class="version">4.1.27</refmiscinfo>
24806</refmeta>
24807<refnamediv>
24808 <refname>fence_get</refname>
24809 <refpurpose>
24810     increases refcount of the fence
24811 </refpurpose>
24812</refnamediv>
24813<refsynopsisdiv>
24814 <title>Synopsis</title>
24815  <funcsynopsis><funcprototype>
24816   <funcdef>struct fence * <function>fence_get </function></funcdef>
24817   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24818  </funcprototype></funcsynopsis>
24819</refsynopsisdiv>
24820<refsect1>
24821 <title>Arguments</title>
24822 <variablelist>
24823  <varlistentry>
24824   <term><parameter>fence</parameter></term>
24825   <listitem>
24826    <para>
24827     [in]	fence to increase refcount of
24828    </para>
24829   </listitem>
24830  </varlistentry>
24831 </variablelist>
24832</refsect1>
24833<refsect1>
24834<title>Description</title>
24835<para>
24836   Returns the same fence, with refcount increased by 1.
24837</para>
24838</refsect1>
24839</refentry>
24840
24841<refentry id="API-fence-get-rcu">
24842<refentryinfo>
24843 <title>LINUX</title>
24844 <productname>Kernel Hackers Manual</productname>
24845 <date>July 2017</date>
24846</refentryinfo>
24847<refmeta>
24848 <refentrytitle><phrase>fence_get_rcu</phrase></refentrytitle>
24849 <manvolnum>9</manvolnum>
24850 <refmiscinfo class="version">4.1.27</refmiscinfo>
24851</refmeta>
24852<refnamediv>
24853 <refname>fence_get_rcu</refname>
24854 <refpurpose>
24855     get a fence from a reservation_object_list with rcu read lock
24856 </refpurpose>
24857</refnamediv>
24858<refsynopsisdiv>
24859 <title>Synopsis</title>
24860  <funcsynopsis><funcprototype>
24861   <funcdef>struct fence * <function>fence_get_rcu </function></funcdef>
24862   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24863  </funcprototype></funcsynopsis>
24864</refsynopsisdiv>
24865<refsect1>
24866 <title>Arguments</title>
24867 <variablelist>
24868  <varlistentry>
24869   <term><parameter>fence</parameter></term>
24870   <listitem>
24871    <para>
24872     [in]	fence to increase refcount of
24873    </para>
24874   </listitem>
24875  </varlistentry>
24876 </variablelist>
24877</refsect1>
24878<refsect1>
24879<title>Description</title>
24880<para>
24881   Function returns NULL if no refcount could be obtained, or the fence.
24882</para>
24883</refsect1>
24884</refentry>
24885
24886<refentry id="API-fence-put">
24887<refentryinfo>
24888 <title>LINUX</title>
24889 <productname>Kernel Hackers Manual</productname>
24890 <date>July 2017</date>
24891</refentryinfo>
24892<refmeta>
24893 <refentrytitle><phrase>fence_put</phrase></refentrytitle>
24894 <manvolnum>9</manvolnum>
24895 <refmiscinfo class="version">4.1.27</refmiscinfo>
24896</refmeta>
24897<refnamediv>
24898 <refname>fence_put</refname>
24899 <refpurpose>
24900     decreases refcount of the fence
24901 </refpurpose>
24902</refnamediv>
24903<refsynopsisdiv>
24904 <title>Synopsis</title>
24905  <funcsynopsis><funcprototype>
24906   <funcdef>void <function>fence_put </function></funcdef>
24907   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24908  </funcprototype></funcsynopsis>
24909</refsynopsisdiv>
24910<refsect1>
24911 <title>Arguments</title>
24912 <variablelist>
24913  <varlistentry>
24914   <term><parameter>fence</parameter></term>
24915   <listitem>
24916    <para>
24917     [in]	fence to reduce refcount of
24918    </para>
24919   </listitem>
24920  </varlistentry>
24921 </variablelist>
24922</refsect1>
24923</refentry>
24924
24925<refentry id="API-fence-is-signaled-locked">
24926<refentryinfo>
24927 <title>LINUX</title>
24928 <productname>Kernel Hackers Manual</productname>
24929 <date>July 2017</date>
24930</refentryinfo>
24931<refmeta>
24932 <refentrytitle><phrase>fence_is_signaled_locked</phrase></refentrytitle>
24933 <manvolnum>9</manvolnum>
24934 <refmiscinfo class="version">4.1.27</refmiscinfo>
24935</refmeta>
24936<refnamediv>
24937 <refname>fence_is_signaled_locked</refname>
24938 <refpurpose>
24939     Return an indication if the fence is signaled yet.
24940 </refpurpose>
24941</refnamediv>
24942<refsynopsisdiv>
24943 <title>Synopsis</title>
24944  <funcsynopsis><funcprototype>
24945   <funcdef>bool <function>fence_is_signaled_locked </function></funcdef>
24946   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24947  </funcprototype></funcsynopsis>
24948</refsynopsisdiv>
24949<refsect1>
24950 <title>Arguments</title>
24951 <variablelist>
24952  <varlistentry>
24953   <term><parameter>fence</parameter></term>
24954   <listitem>
24955    <para>
24956     [in]	the fence to check
24957    </para>
24958   </listitem>
24959  </varlistentry>
24960 </variablelist>
24961</refsect1>
24962<refsect1>
24963<title>Description</title>
24964<para>
24965   Returns true if the fence was already signaled, false if not. Since this
24966   function doesn't enable signaling, it is not guaranteed to ever return
24967   true if fence_add_callback, fence_wait or fence_enable_sw_signaling
24968   haven't been called before.
24969   </para><para>
24970
24971   This function requires fence-&gt;lock to be held.
24972</para>
24973</refsect1>
24974</refentry>
24975
24976<refentry id="API-fence-is-signaled">
24977<refentryinfo>
24978 <title>LINUX</title>
24979 <productname>Kernel Hackers Manual</productname>
24980 <date>July 2017</date>
24981</refentryinfo>
24982<refmeta>
24983 <refentrytitle><phrase>fence_is_signaled</phrase></refentrytitle>
24984 <manvolnum>9</manvolnum>
24985 <refmiscinfo class="version">4.1.27</refmiscinfo>
24986</refmeta>
24987<refnamediv>
24988 <refname>fence_is_signaled</refname>
24989 <refpurpose>
24990     Return an indication if the fence is signaled yet.
24991 </refpurpose>
24992</refnamediv>
24993<refsynopsisdiv>
24994 <title>Synopsis</title>
24995  <funcsynopsis><funcprototype>
24996   <funcdef>bool <function>fence_is_signaled </function></funcdef>
24997   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
24998  </funcprototype></funcsynopsis>
24999</refsynopsisdiv>
25000<refsect1>
25001 <title>Arguments</title>
25002 <variablelist>
25003  <varlistentry>
25004   <term><parameter>fence</parameter></term>
25005   <listitem>
25006    <para>
25007     [in]	the fence to check
25008    </para>
25009   </listitem>
25010  </varlistentry>
25011 </variablelist>
25012</refsect1>
25013<refsect1>
25014<title>Description</title>
25015<para>
25016   Returns true if the fence was already signaled, false if not. Since this
25017   function doesn't enable signaling, it is not guaranteed to ever return
25018   true if fence_add_callback, fence_wait or fence_enable_sw_signaling
25019   haven't been called before.
25020   </para><para>
25021
25022   It's recommended for seqno fences to call fence_signal when the
25023   operation is complete, it makes it possible to prevent issues from
25024   wraparound between time of issue and time of use by checking the return
25025   value of this function before calling hardware-specific wait instructions.
25026</para>
25027</refsect1>
25028</refentry>
25029
25030<refentry id="API-fence-later">
25031<refentryinfo>
25032 <title>LINUX</title>
25033 <productname>Kernel Hackers Manual</productname>
25034 <date>July 2017</date>
25035</refentryinfo>
25036<refmeta>
25037 <refentrytitle><phrase>fence_later</phrase></refentrytitle>
25038 <manvolnum>9</manvolnum>
25039 <refmiscinfo class="version">4.1.27</refmiscinfo>
25040</refmeta>
25041<refnamediv>
25042 <refname>fence_later</refname>
25043 <refpurpose>
25044     return the chronologically later fence
25045 </refpurpose>
25046</refnamediv>
25047<refsynopsisdiv>
25048 <title>Synopsis</title>
25049  <funcsynopsis><funcprototype>
25050   <funcdef>struct fence * <function>fence_later </function></funcdef>
25051   <paramdef>struct fence * <parameter>f1</parameter></paramdef>
25052   <paramdef>struct fence * <parameter>f2</parameter></paramdef>
25053  </funcprototype></funcsynopsis>
25054</refsynopsisdiv>
25055<refsect1>
25056 <title>Arguments</title>
25057 <variablelist>
25058  <varlistentry>
25059   <term><parameter>f1</parameter></term>
25060   <listitem>
25061    <para>
25062     [in]	the first fence from the same context
25063    </para>
25064   </listitem>
25065  </varlistentry>
25066  <varlistentry>
25067   <term><parameter>f2</parameter></term>
25068   <listitem>
25069    <para>
25070     [in]	the second fence from the same context
25071    </para>
25072   </listitem>
25073  </varlistentry>
25074 </variablelist>
25075</refsect1>
25076<refsect1>
25077<title>Description</title>
25078<para>
25079   Returns NULL if both fences are signaled, otherwise the fence that would be
25080   signaled last. Both fences must be from the same context, since a seqno is
25081   not re-used across contexts.
25082</para>
25083</refsect1>
25084</refentry>
25085
25086<refentry id="API-fence-wait">
25087<refentryinfo>
25088 <title>LINUX</title>
25089 <productname>Kernel Hackers Manual</productname>
25090 <date>July 2017</date>
25091</refentryinfo>
25092<refmeta>
25093 <refentrytitle><phrase>fence_wait</phrase></refentrytitle>
25094 <manvolnum>9</manvolnum>
25095 <refmiscinfo class="version">4.1.27</refmiscinfo>
25096</refmeta>
25097<refnamediv>
25098 <refname>fence_wait</refname>
25099 <refpurpose>
25100     sleep until the fence gets signaled
25101 </refpurpose>
25102</refnamediv>
25103<refsynopsisdiv>
25104 <title>Synopsis</title>
25105  <funcsynopsis><funcprototype>
25106   <funcdef>signed long <function>fence_wait </function></funcdef>
25107   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
25108   <paramdef>bool <parameter>intr</parameter></paramdef>
25109  </funcprototype></funcsynopsis>
25110</refsynopsisdiv>
25111<refsect1>
25112 <title>Arguments</title>
25113 <variablelist>
25114  <varlistentry>
25115   <term><parameter>fence</parameter></term>
25116   <listitem>
25117    <para>
25118     [in]	the fence to wait on
25119    </para>
25120   </listitem>
25121  </varlistentry>
25122  <varlistentry>
25123   <term><parameter>intr</parameter></term>
25124   <listitem>
25125    <para>
25126     [in]	if true, do an interruptible wait
25127    </para>
25128   </listitem>
25129  </varlistentry>
25130 </variablelist>
25131</refsect1>
25132<refsect1>
25133<title>Description</title>
25134<para>
25135   This function will return -ERESTARTSYS if interrupted by a signal,
25136   or 0 if the fence was signaled. Other error values may be
25137   returned on custom implementations.
25138   </para><para>
25139
25140   Performs a synchronous wait on this fence. It is assumed the caller
25141   directly or indirectly holds a reference to the fence, otherwise the
25142   fence might be freed before return, resulting in undefined behavior.
25143</para>
25144</refsect1>
25145</refentry>
25146
25147<!-- include/linux/seqno-fence.h -->
25148<refentry id="API-to-seqno-fence">
25149<refentryinfo>
25150 <title>LINUX</title>
25151 <productname>Kernel Hackers Manual</productname>
25152 <date>July 2017</date>
25153</refentryinfo>
25154<refmeta>
25155 <refentrytitle><phrase>to_seqno_fence</phrase></refentrytitle>
25156 <manvolnum>9</manvolnum>
25157 <refmiscinfo class="version">4.1.27</refmiscinfo>
25158</refmeta>
25159<refnamediv>
25160 <refname>to_seqno_fence</refname>
25161 <refpurpose>
25162  cast a fence to a seqno_fence
25163 </refpurpose>
25164</refnamediv>
25165<refsynopsisdiv>
25166 <title>Synopsis</title>
25167  <funcsynopsis><funcprototype>
25168   <funcdef>struct seqno_fence * <function>to_seqno_fence </function></funcdef>
25169   <paramdef>struct fence * <parameter>fence</parameter></paramdef>
25170  </funcprototype></funcsynopsis>
25171</refsynopsisdiv>
25172<refsect1>
25173 <title>Arguments</title>
25174 <variablelist>
25175  <varlistentry>
25176   <term><parameter>fence</parameter></term>
25177   <listitem>
25178    <para>
25179     fence to cast to a seqno_fence
25180    </para>
25181   </listitem>
25182  </varlistentry>
25183 </variablelist>
25184</refsect1>
25185<refsect1>
25186<title>Description</title>
25187<para>
25188   Returns NULL if the fence is not a seqno_fence,
25189   or the seqno_fence otherwise.
25190</para>
25191</refsect1>
25192</refentry>
25193
25194<refentry id="API-seqno-fence-init">
25195<refentryinfo>
25196 <title>LINUX</title>
25197 <productname>Kernel Hackers Manual</productname>
25198 <date>July 2017</date>
25199</refentryinfo>
25200<refmeta>
25201 <refentrytitle><phrase>seqno_fence_init</phrase></refentrytitle>
25202 <manvolnum>9</manvolnum>
25203 <refmiscinfo class="version">4.1.27</refmiscinfo>
25204</refmeta>
25205<refnamediv>
25206 <refname>seqno_fence_init</refname>
25207 <refpurpose>
25208     initialize a seqno fence
25209 </refpurpose>
25210</refnamediv>
25211<refsynopsisdiv>
25212 <title>Synopsis</title>
25213  <funcsynopsis><funcprototype>
25214   <funcdef>void <function>seqno_fence_init </function></funcdef>
25215   <paramdef>struct seqno_fence * <parameter>fence</parameter></paramdef>
25216   <paramdef>spinlock_t * <parameter>lock</parameter></paramdef>
25217   <paramdef>struct dma_buf * <parameter>sync_buf</parameter></paramdef>
25218   <paramdef>uint32_t <parameter>context</parameter></paramdef>
25219   <paramdef>uint32_t <parameter>seqno_ofs</parameter></paramdef>
25220   <paramdef>uint32_t <parameter>seqno</parameter></paramdef>
25221   <paramdef>enum seqno_fence_condition <parameter>cond</parameter></paramdef>
25222   <paramdef>const struct fence_ops * <parameter>ops</parameter></paramdef>
25223  </funcprototype></funcsynopsis>
25224</refsynopsisdiv>
25225<refsect1>
25226 <title>Arguments</title>
25227 <variablelist>
25228  <varlistentry>
25229   <term><parameter>fence</parameter></term>
25230   <listitem>
25231    <para>
25232     seqno_fence to initialize
25233    </para>
25234   </listitem>
25235  </varlistentry>
25236  <varlistentry>
25237   <term><parameter>lock</parameter></term>
25238   <listitem>
25239    <para>
25240     pointer to spinlock to use for fence
25241    </para>
25242   </listitem>
25243  </varlistentry>
25244  <varlistentry>
25245   <term><parameter>sync_buf</parameter></term>
25246   <listitem>
25247    <para>
25248     buffer containing the memory location to signal on
25249    </para>
25250   </listitem>
25251  </varlistentry>
25252  <varlistentry>
25253   <term><parameter>context</parameter></term>
25254   <listitem>
25255    <para>
25256     the execution context this fence is a part of
25257    </para>
25258   </listitem>
25259  </varlistentry>
25260  <varlistentry>
25261   <term><parameter>seqno_ofs</parameter></term>
25262   <listitem>
25263    <para>
25264     the offset within <parameter>sync_buf</parameter>
25265    </para>
25266   </listitem>
25267  </varlistentry>
25268  <varlistentry>
25269   <term><parameter>seqno</parameter></term>
25270   <listitem>
25271    <para>
25272     the sequence # to signal on
25273    </para>
25274   </listitem>
25275  </varlistentry>
25276  <varlistentry>
25277   <term><parameter>cond</parameter></term>
25278   <listitem>
25279    <para>
25280     fence wait condition
25281    </para>
25282   </listitem>
25283  </varlistentry>
25284  <varlistentry>
25285   <term><parameter>ops</parameter></term>
25286   <listitem>
25287    <para>
25288     the fence_ops for operations on this seqno fence
25289    </para>
25290   </listitem>
25291  </varlistentry>
25292 </variablelist>
25293</refsect1>
25294<refsect1>
25295<title>Description</title>
25296<para>
25297   This function initializes a struct seqno_fence with passed parameters,
25298   and takes a reference on sync_buf which is released on fence destruction.
25299   </para><para>
25300
25301   A seqno_fence is a dma_fence which can complete in software when
25302   enable_signaling is called, but it also completes when
25303   (s32)((sync_buf)[seqno_ofs] - seqno) &gt;= 0 is true
25304   </para><para>
25305
25306   The seqno_fence will take a refcount on the sync_buf until it's
25307   destroyed, but actual lifetime of sync_buf may be longer if one of the
25308   callers take a reference to it.
25309   </para><para>
25310
25311   Certain hardware have instructions to insert this type of wait condition
25312   in the command stream, so no intervention from software would be needed.
25313   This type of fence can be destroyed before completed, however a reference
25314   on the sync_buf dma-buf can be taken. It is encouraged to re-use the same
25315   dma-buf for sync_buf, since mapping or unmapping the sync_buf to the
25316   device's vm can be expensive.
25317   </para><para>
25318
25319   It is recommended for creators of seqno_fence to call fence_signal
25320   before destruction. This will prevent possible issues from wraparound at
25321   time of issue vs time of check, since users can check fence_is_signaled
25322   before submitting instructions for the hardware to wait on the fence.
25323   However, when ops.enable_signaling is not called, it doesn't have to be
25324   done as soon as possible, just before there's any real danger of seqno
25325   wraparound.
25326</para>
25327</refsect1>
25328</refentry>
25329
25330<!-- drivers/dma-buf/reservation.c -->
25331<refentry>
25332 <refnamediv>
25333  <refname>
25334   .//drivers/dma-buf/reservation.c
25335  </refname>
25336  <refpurpose>
25337   Document generation inconsistency
25338  </refpurpose>
25339 </refnamediv>
25340 <refsect1>
25341  <title>
25342   Oops
25343  </title>
25344  <warning>
25345   <para>
25346    The template for this document tried to insert
25347    the structured comment from the file
25348    <filename>.//drivers/dma-buf/reservation.c</filename> at this point,
25349    but none was found.
25350    This dummy section is inserted to allow
25351    generation to continue.
25352   </para>
25353  </warning>
25354 </refsect1>
25355</refentry>
25356<!-- include/linux/reservation.h -->
25357<refentry>
25358 <refnamediv>
25359  <refname>
25360   .//include/linux/reservation.h
25361  </refname>
25362  <refpurpose>
25363   Document generation inconsistency
25364  </refpurpose>
25365 </refnamediv>
25366 <refsect1>
25367  <title>
25368   Oops
25369  </title>
25370  <warning>
25371   <para>
25372    The template for this document tried to insert
25373    the structured comment from the file
25374    <filename>.//include/linux/reservation.h</filename> at this point,
25375    but none was found.
25376    This dummy section is inserted to allow
25377    generation to continue.
25378   </para>
25379  </warning>
25380 </refsect1>
25381</refentry>
25382<!-- drivers/base/dma-coherent.c -->
25383<refentry id="API-dma-alloc-from-coherent">
25384<refentryinfo>
25385 <title>LINUX</title>
25386 <productname>Kernel Hackers Manual</productname>
25387 <date>July 2017</date>
25388</refentryinfo>
25389<refmeta>
25390 <refentrytitle><phrase>dma_alloc_from_coherent</phrase></refentrytitle>
25391 <manvolnum>9</manvolnum>
25392 <refmiscinfo class="version">4.1.27</refmiscinfo>
25393</refmeta>
25394<refnamediv>
25395 <refname>dma_alloc_from_coherent</refname>
25396 <refpurpose>
25397  try to allocate memory from the per-device coherent area
25398 </refpurpose>
25399</refnamediv>
25400<refsynopsisdiv>
25401 <title>Synopsis</title>
25402  <funcsynopsis><funcprototype>
25403   <funcdef>int <function>dma_alloc_from_coherent </function></funcdef>
25404   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25405   <paramdef>ssize_t <parameter>size</parameter></paramdef>
25406   <paramdef>dma_addr_t * <parameter>dma_handle</parameter></paramdef>
25407   <paramdef>void ** <parameter>ret</parameter></paramdef>
25408  </funcprototype></funcsynopsis>
25409</refsynopsisdiv>
25410<refsect1>
25411 <title>Arguments</title>
25412 <variablelist>
25413  <varlistentry>
25414   <term><parameter>dev</parameter></term>
25415   <listitem>
25416    <para>
25417     device from which we allocate memory
25418    </para>
25419   </listitem>
25420  </varlistentry>
25421  <varlistentry>
25422   <term><parameter>size</parameter></term>
25423   <listitem>
25424    <para>
25425     size of requested memory area
25426    </para>
25427   </listitem>
25428  </varlistentry>
25429  <varlistentry>
25430   <term><parameter>dma_handle</parameter></term>
25431   <listitem>
25432    <para>
25433     This will be filled with the correct dma handle
25434    </para>
25435   </listitem>
25436  </varlistentry>
25437  <varlistentry>
25438   <term><parameter>ret</parameter></term>
25439   <listitem>
25440    <para>
25441     This pointer will be filled with the virtual address
25442     to allocated area.
25443    </para>
25444   </listitem>
25445  </varlistentry>
25446 </variablelist>
25447</refsect1>
25448<refsect1>
25449<title>Description</title>
25450<para>
25451   This function should be only called from per-arch <function>dma_alloc_coherent</function>
25452   to support allocation from per-device coherent memory pools.
25453   </para><para>
25454
25455   Returns 0 if dma_alloc_coherent should continue with allocating from
25456   generic memory areas, or !0 if dma_alloc_coherent should return <parameter>ret</parameter>.
25457</para>
25458</refsect1>
25459</refentry>
25460
25461<refentry id="API-dma-release-from-coherent">
25462<refentryinfo>
25463 <title>LINUX</title>
25464 <productname>Kernel Hackers Manual</productname>
25465 <date>July 2017</date>
25466</refentryinfo>
25467<refmeta>
25468 <refentrytitle><phrase>dma_release_from_coherent</phrase></refentrytitle>
25469 <manvolnum>9</manvolnum>
25470 <refmiscinfo class="version">4.1.27</refmiscinfo>
25471</refmeta>
25472<refnamediv>
25473 <refname>dma_release_from_coherent</refname>
25474 <refpurpose>
25475     try to free the memory allocated from per-device coherent memory pool
25476 </refpurpose>
25477</refnamediv>
25478<refsynopsisdiv>
25479 <title>Synopsis</title>
25480  <funcsynopsis><funcprototype>
25481   <funcdef>int <function>dma_release_from_coherent </function></funcdef>
25482   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25483   <paramdef>int <parameter>order</parameter></paramdef>
25484   <paramdef>void * <parameter>vaddr</parameter></paramdef>
25485  </funcprototype></funcsynopsis>
25486</refsynopsisdiv>
25487<refsect1>
25488 <title>Arguments</title>
25489 <variablelist>
25490  <varlistentry>
25491   <term><parameter>dev</parameter></term>
25492   <listitem>
25493    <para>
25494     device from which the memory was allocated
25495    </para>
25496   </listitem>
25497  </varlistentry>
25498  <varlistentry>
25499   <term><parameter>order</parameter></term>
25500   <listitem>
25501    <para>
25502     the order of pages allocated
25503    </para>
25504   </listitem>
25505  </varlistentry>
25506  <varlistentry>
25507   <term><parameter>vaddr</parameter></term>
25508   <listitem>
25509    <para>
25510     virtual address of allocated pages
25511    </para>
25512   </listitem>
25513  </varlistentry>
25514 </variablelist>
25515</refsect1>
25516<refsect1>
25517<title>Description</title>
25518<para>
25519   This checks whether the memory was allocated from the per-device
25520   coherent memory pool and if so, releases that memory.
25521   </para><para>
25522
25523   Returns 1 if we correctly released the memory, or 0 if
25524   <function>dma_release_coherent</function> should proceed with releasing memory from
25525   generic pools.
25526</para>
25527</refsect1>
25528</refentry>
25529
25530<refentry id="API-dma-mmap-from-coherent">
25531<refentryinfo>
25532 <title>LINUX</title>
25533 <productname>Kernel Hackers Manual</productname>
25534 <date>July 2017</date>
25535</refentryinfo>
25536<refmeta>
25537 <refentrytitle><phrase>dma_mmap_from_coherent</phrase></refentrytitle>
25538 <manvolnum>9</manvolnum>
25539 <refmiscinfo class="version">4.1.27</refmiscinfo>
25540</refmeta>
25541<refnamediv>
25542 <refname>dma_mmap_from_coherent</refname>
25543 <refpurpose>
25544     try to mmap the memory allocated from per-device coherent memory pool to userspace
25545 </refpurpose>
25546</refnamediv>
25547<refsynopsisdiv>
25548 <title>Synopsis</title>
25549  <funcsynopsis><funcprototype>
25550   <funcdef>int <function>dma_mmap_from_coherent </function></funcdef>
25551   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25552   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
25553   <paramdef>void * <parameter>vaddr</parameter></paramdef>
25554   <paramdef>size_t <parameter>size</parameter></paramdef>
25555   <paramdef>int * <parameter>ret</parameter></paramdef>
25556  </funcprototype></funcsynopsis>
25557</refsynopsisdiv>
25558<refsect1>
25559 <title>Arguments</title>
25560 <variablelist>
25561  <varlistentry>
25562   <term><parameter>dev</parameter></term>
25563   <listitem>
25564    <para>
25565     device from which the memory was allocated
25566    </para>
25567   </listitem>
25568  </varlistentry>
25569  <varlistentry>
25570   <term><parameter>vma</parameter></term>
25571   <listitem>
25572    <para>
25573     vm_area for the userspace memory
25574    </para>
25575   </listitem>
25576  </varlistentry>
25577  <varlistentry>
25578   <term><parameter>vaddr</parameter></term>
25579   <listitem>
25580    <para>
25581     cpu address returned by dma_alloc_from_coherent
25582    </para>
25583   </listitem>
25584  </varlistentry>
25585  <varlistentry>
25586   <term><parameter>size</parameter></term>
25587   <listitem>
25588    <para>
25589     size of the memory buffer allocated by dma_alloc_from_coherent
25590    </para>
25591   </listitem>
25592  </varlistentry>
25593  <varlistentry>
25594   <term><parameter>ret</parameter></term>
25595   <listitem>
25596    <para>
25597     result from <function>remap_pfn_range</function>
25598    </para>
25599   </listitem>
25600  </varlistentry>
25601 </variablelist>
25602</refsect1>
25603<refsect1>
25604<title>Description</title>
25605<para>
25606   This checks whether the memory was allocated from the per-device
25607   coherent memory pool and if so, maps that memory to the provided vma.
25608   </para><para>
25609
25610   Returns 1 if we correctly mapped the memory, or 0 if the caller should
25611   proceed with mapping memory from generic pools.
25612</para>
25613</refsect1>
25614</refentry>
25615
25616<!-- drivers/base/dma-mapping.c -->
25617<refentry id="API-dmam-alloc-coherent">
25618<refentryinfo>
25619 <title>LINUX</title>
25620 <productname>Kernel Hackers Manual</productname>
25621 <date>July 2017</date>
25622</refentryinfo>
25623<refmeta>
25624 <refentrytitle><phrase>dmam_alloc_coherent</phrase></refentrytitle>
25625 <manvolnum>9</manvolnum>
25626 <refmiscinfo class="version">4.1.27</refmiscinfo>
25627</refmeta>
25628<refnamediv>
25629 <refname>dmam_alloc_coherent</refname>
25630 <refpurpose>
25631  Managed <function>dma_alloc_coherent</function>
25632 </refpurpose>
25633</refnamediv>
25634<refsynopsisdiv>
25635 <title>Synopsis</title>
25636  <funcsynopsis><funcprototype>
25637   <funcdef>void * <function>dmam_alloc_coherent </function></funcdef>
25638   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25639   <paramdef>size_t <parameter>size</parameter></paramdef>
25640   <paramdef>dma_addr_t * <parameter>dma_handle</parameter></paramdef>
25641   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
25642  </funcprototype></funcsynopsis>
25643</refsynopsisdiv>
25644<refsect1>
25645 <title>Arguments</title>
25646 <variablelist>
25647  <varlistentry>
25648   <term><parameter>dev</parameter></term>
25649   <listitem>
25650    <para>
25651     Device to allocate coherent memory for
25652    </para>
25653   </listitem>
25654  </varlistentry>
25655  <varlistentry>
25656   <term><parameter>size</parameter></term>
25657   <listitem>
25658    <para>
25659     Size of allocation
25660    </para>
25661   </listitem>
25662  </varlistentry>
25663  <varlistentry>
25664   <term><parameter>dma_handle</parameter></term>
25665   <listitem>
25666    <para>
25667     Out argument for allocated DMA handle
25668    </para>
25669   </listitem>
25670  </varlistentry>
25671  <varlistentry>
25672   <term><parameter>gfp</parameter></term>
25673   <listitem>
25674    <para>
25675     Allocation flags
25676    </para>
25677   </listitem>
25678  </varlistentry>
25679 </variablelist>
25680</refsect1>
25681<refsect1>
25682<title>Description</title>
25683<para>
25684   Managed <function>dma_alloc_coherent</function>.  Memory allocated using this function
25685   will be automatically released on driver detach.
25686</para>
25687</refsect1>
25688<refsect1>
25689<title>RETURNS</title>
25690<para>
25691   Pointer to allocated memory on success, NULL on failure.
25692</para>
25693</refsect1>
25694</refentry>
25695
25696<refentry id="API-dmam-free-coherent">
25697<refentryinfo>
25698 <title>LINUX</title>
25699 <productname>Kernel Hackers Manual</productname>
25700 <date>July 2017</date>
25701</refentryinfo>
25702<refmeta>
25703 <refentrytitle><phrase>dmam_free_coherent</phrase></refentrytitle>
25704 <manvolnum>9</manvolnum>
25705 <refmiscinfo class="version">4.1.27</refmiscinfo>
25706</refmeta>
25707<refnamediv>
25708 <refname>dmam_free_coherent</refname>
25709 <refpurpose>
25710     Managed <function>dma_free_coherent</function>
25711 </refpurpose>
25712</refnamediv>
25713<refsynopsisdiv>
25714 <title>Synopsis</title>
25715  <funcsynopsis><funcprototype>
25716   <funcdef>void <function>dmam_free_coherent </function></funcdef>
25717   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25718   <paramdef>size_t <parameter>size</parameter></paramdef>
25719   <paramdef>void * <parameter>vaddr</parameter></paramdef>
25720   <paramdef>dma_addr_t <parameter>dma_handle</parameter></paramdef>
25721  </funcprototype></funcsynopsis>
25722</refsynopsisdiv>
25723<refsect1>
25724 <title>Arguments</title>
25725 <variablelist>
25726  <varlistentry>
25727   <term><parameter>dev</parameter></term>
25728   <listitem>
25729    <para>
25730     Device to free coherent memory for
25731    </para>
25732   </listitem>
25733  </varlistentry>
25734  <varlistentry>
25735   <term><parameter>size</parameter></term>
25736   <listitem>
25737    <para>
25738     Size of allocation
25739    </para>
25740   </listitem>
25741  </varlistentry>
25742  <varlistentry>
25743   <term><parameter>vaddr</parameter></term>
25744   <listitem>
25745    <para>
25746     Virtual address of the memory to free
25747    </para>
25748   </listitem>
25749  </varlistentry>
25750  <varlistentry>
25751   <term><parameter>dma_handle</parameter></term>
25752   <listitem>
25753    <para>
25754     DMA handle of the memory to free
25755    </para>
25756   </listitem>
25757  </varlistentry>
25758 </variablelist>
25759</refsect1>
25760<refsect1>
25761<title>Description</title>
25762<para>
25763   Managed <function>dma_free_coherent</function>.
25764</para>
25765</refsect1>
25766</refentry>
25767
25768<refentry id="API-dmam-alloc-noncoherent">
25769<refentryinfo>
25770 <title>LINUX</title>
25771 <productname>Kernel Hackers Manual</productname>
25772 <date>July 2017</date>
25773</refentryinfo>
25774<refmeta>
25775 <refentrytitle><phrase>dmam_alloc_noncoherent</phrase></refentrytitle>
25776 <manvolnum>9</manvolnum>
25777 <refmiscinfo class="version">4.1.27</refmiscinfo>
25778</refmeta>
25779<refnamediv>
25780 <refname>dmam_alloc_noncoherent</refname>
25781 <refpurpose>
25782     Managed <function>dma_alloc_non_coherent</function>
25783 </refpurpose>
25784</refnamediv>
25785<refsynopsisdiv>
25786 <title>Synopsis</title>
25787  <funcsynopsis><funcprototype>
25788   <funcdef>void * <function>dmam_alloc_noncoherent </function></funcdef>
25789   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25790   <paramdef>size_t <parameter>size</parameter></paramdef>
25791   <paramdef>dma_addr_t * <parameter>dma_handle</parameter></paramdef>
25792   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
25793  </funcprototype></funcsynopsis>
25794</refsynopsisdiv>
25795<refsect1>
25796 <title>Arguments</title>
25797 <variablelist>
25798  <varlistentry>
25799   <term><parameter>dev</parameter></term>
25800   <listitem>
25801    <para>
25802     Device to allocate non_coherent memory for
25803    </para>
25804   </listitem>
25805  </varlistentry>
25806  <varlistentry>
25807   <term><parameter>size</parameter></term>
25808   <listitem>
25809    <para>
25810     Size of allocation
25811    </para>
25812   </listitem>
25813  </varlistentry>
25814  <varlistentry>
25815   <term><parameter>dma_handle</parameter></term>
25816   <listitem>
25817    <para>
25818     Out argument for allocated DMA handle
25819    </para>
25820   </listitem>
25821  </varlistentry>
25822  <varlistentry>
25823   <term><parameter>gfp</parameter></term>
25824   <listitem>
25825    <para>
25826     Allocation flags
25827    </para>
25828   </listitem>
25829  </varlistentry>
25830 </variablelist>
25831</refsect1>
25832<refsect1>
25833<title>Description</title>
25834<para>
25835   Managed <function>dma_alloc_non_coherent</function>.  Memory allocated using this
25836   function will be automatically released on driver detach.
25837</para>
25838</refsect1>
25839<refsect1>
25840<title>RETURNS</title>
25841<para>
25842   Pointer to allocated memory on success, NULL on failure.
25843</para>
25844</refsect1>
25845</refentry>
25846
25847<refentry id="API-dmam-free-noncoherent">
25848<refentryinfo>
25849 <title>LINUX</title>
25850 <productname>Kernel Hackers Manual</productname>
25851 <date>July 2017</date>
25852</refentryinfo>
25853<refmeta>
25854 <refentrytitle><phrase>dmam_free_noncoherent</phrase></refentrytitle>
25855 <manvolnum>9</manvolnum>
25856 <refmiscinfo class="version">4.1.27</refmiscinfo>
25857</refmeta>
25858<refnamediv>
25859 <refname>dmam_free_noncoherent</refname>
25860 <refpurpose>
25861     Managed <function>dma_free_noncoherent</function>
25862 </refpurpose>
25863</refnamediv>
25864<refsynopsisdiv>
25865 <title>Synopsis</title>
25866  <funcsynopsis><funcprototype>
25867   <funcdef>void <function>dmam_free_noncoherent </function></funcdef>
25868   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25869   <paramdef>size_t <parameter>size</parameter></paramdef>
25870   <paramdef>void * <parameter>vaddr</parameter></paramdef>
25871   <paramdef>dma_addr_t <parameter>dma_handle</parameter></paramdef>
25872  </funcprototype></funcsynopsis>
25873</refsynopsisdiv>
25874<refsect1>
25875 <title>Arguments</title>
25876 <variablelist>
25877  <varlistentry>
25878   <term><parameter>dev</parameter></term>
25879   <listitem>
25880    <para>
25881     Device to free noncoherent memory for
25882    </para>
25883   </listitem>
25884  </varlistentry>
25885  <varlistentry>
25886   <term><parameter>size</parameter></term>
25887   <listitem>
25888    <para>
25889     Size of allocation
25890    </para>
25891   </listitem>
25892  </varlistentry>
25893  <varlistentry>
25894   <term><parameter>vaddr</parameter></term>
25895   <listitem>
25896    <para>
25897     Virtual address of the memory to free
25898    </para>
25899   </listitem>
25900  </varlistentry>
25901  <varlistentry>
25902   <term><parameter>dma_handle</parameter></term>
25903   <listitem>
25904    <para>
25905     DMA handle of the memory to free
25906    </para>
25907   </listitem>
25908  </varlistentry>
25909 </variablelist>
25910</refsect1>
25911<refsect1>
25912<title>Description</title>
25913<para>
25914   Managed <function>dma_free_noncoherent</function>.
25915</para>
25916</refsect1>
25917</refentry>
25918
25919<refentry id="API-dmam-declare-coherent-memory">
25920<refentryinfo>
25921 <title>LINUX</title>
25922 <productname>Kernel Hackers Manual</productname>
25923 <date>July 2017</date>
25924</refentryinfo>
25925<refmeta>
25926 <refentrytitle><phrase>dmam_declare_coherent_memory</phrase></refentrytitle>
25927 <manvolnum>9</manvolnum>
25928 <refmiscinfo class="version">4.1.27</refmiscinfo>
25929</refmeta>
25930<refnamediv>
25931 <refname>dmam_declare_coherent_memory</refname>
25932 <refpurpose>
25933     Managed <function>dma_declare_coherent_memory</function>
25934 </refpurpose>
25935</refnamediv>
25936<refsynopsisdiv>
25937 <title>Synopsis</title>
25938  <funcsynopsis><funcprototype>
25939   <funcdef>int <function>dmam_declare_coherent_memory </function></funcdef>
25940   <paramdef>struct device * <parameter>dev</parameter></paramdef>
25941   <paramdef>phys_addr_t <parameter>phys_addr</parameter></paramdef>
25942   <paramdef>dma_addr_t <parameter>device_addr</parameter></paramdef>
25943   <paramdef>size_t <parameter>size</parameter></paramdef>
25944   <paramdef>int <parameter>flags</parameter></paramdef>
25945  </funcprototype></funcsynopsis>
25946</refsynopsisdiv>
25947<refsect1>
25948 <title>Arguments</title>
25949 <variablelist>
25950  <varlistentry>
25951   <term><parameter>dev</parameter></term>
25952   <listitem>
25953    <para>
25954     Device to declare coherent memory for
25955    </para>
25956   </listitem>
25957  </varlistentry>
25958  <varlistentry>
25959   <term><parameter>phys_addr</parameter></term>
25960   <listitem>
25961    <para>
25962     Physical address of coherent memory to be declared
25963    </para>
25964   </listitem>
25965  </varlistentry>
25966  <varlistentry>
25967   <term><parameter>device_addr</parameter></term>
25968   <listitem>
25969    <para>
25970     Device address of coherent memory to be declared
25971    </para>
25972   </listitem>
25973  </varlistentry>
25974  <varlistentry>
25975   <term><parameter>size</parameter></term>
25976   <listitem>
25977    <para>
25978     Size of coherent memory to be declared
25979    </para>
25980   </listitem>
25981  </varlistentry>
25982  <varlistentry>
25983   <term><parameter>flags</parameter></term>
25984   <listitem>
25985    <para>
25986     Flags
25987    </para>
25988   </listitem>
25989  </varlistentry>
25990 </variablelist>
25991</refsect1>
25992<refsect1>
25993<title>Description</title>
25994<para>
25995   Managed <function>dma_declare_coherent_memory</function>.
25996</para>
25997</refsect1>
25998<refsect1>
25999<title>RETURNS</title>
26000<para>
26001   0 on success, -errno on failure.
26002</para>
26003</refsect1>
26004</refentry>
26005
26006<refentry id="API-dmam-release-declared-memory">
26007<refentryinfo>
26008 <title>LINUX</title>
26009 <productname>Kernel Hackers Manual</productname>
26010 <date>July 2017</date>
26011</refentryinfo>
26012<refmeta>
26013 <refentrytitle><phrase>dmam_release_declared_memory</phrase></refentrytitle>
26014 <manvolnum>9</manvolnum>
26015 <refmiscinfo class="version">4.1.27</refmiscinfo>
26016</refmeta>
26017<refnamediv>
26018 <refname>dmam_release_declared_memory</refname>
26019 <refpurpose>
26020     Managed <function>dma_release_declared_memory</function>.
26021 </refpurpose>
26022</refnamediv>
26023<refsynopsisdiv>
26024 <title>Synopsis</title>
26025  <funcsynopsis><funcprototype>
26026   <funcdef>void <function>dmam_release_declared_memory </function></funcdef>
26027   <paramdef>struct device * <parameter>dev</parameter></paramdef>
26028  </funcprototype></funcsynopsis>
26029</refsynopsisdiv>
26030<refsect1>
26031 <title>Arguments</title>
26032 <variablelist>
26033  <varlistentry>
26034   <term><parameter>dev</parameter></term>
26035   <listitem>
26036    <para>
26037     Device to release declared coherent memory for
26038    </para>
26039   </listitem>
26040  </varlistentry>
26041 </variablelist>
26042</refsect1>
26043<refsect1>
26044<title>Description</title>
26045<para>
26046   Managed <function>dmam_release_declared_memory</function>.
26047</para>
26048</refsect1>
26049</refentry>
26050
26051     </sect1>
26052     <sect1><title>Device Drivers Power Management</title>
26053<!-- drivers/base/power/main.c -->
26054<refentry id="API-dpm-resume-start">
26055<refentryinfo>
26056 <title>LINUX</title>
26057 <productname>Kernel Hackers Manual</productname>
26058 <date>July 2017</date>
26059</refentryinfo>
26060<refmeta>
26061 <refentrytitle><phrase>dpm_resume_start</phrase></refentrytitle>
26062 <manvolnum>9</manvolnum>
26063 <refmiscinfo class="version">4.1.27</refmiscinfo>
26064</refmeta>
26065<refnamediv>
26066 <refname>dpm_resume_start</refname>
26067 <refpurpose>
26068  Execute <quote>noirq</quote> and <quote>early</quote> device callbacks.
26069 </refpurpose>
26070</refnamediv>
26071<refsynopsisdiv>
26072 <title>Synopsis</title>
26073  <funcsynopsis><funcprototype>
26074   <funcdef>void <function>dpm_resume_start </function></funcdef>
26075   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
26076  </funcprototype></funcsynopsis>
26077</refsynopsisdiv>
26078<refsect1>
26079 <title>Arguments</title>
26080 <variablelist>
26081  <varlistentry>
26082   <term><parameter>state</parameter></term>
26083   <listitem>
26084    <para>
26085     PM transition of the system being carried out.
26086    </para>
26087   </listitem>
26088  </varlistentry>
26089 </variablelist>
26090</refsect1>
26091</refentry>
26092
26093<refentry id="API-dpm-resume-end">
26094<refentryinfo>
26095 <title>LINUX</title>
26096 <productname>Kernel Hackers Manual</productname>
26097 <date>July 2017</date>
26098</refentryinfo>
26099<refmeta>
26100 <refentrytitle><phrase>dpm_resume_end</phrase></refentrytitle>
26101 <manvolnum>9</manvolnum>
26102 <refmiscinfo class="version">4.1.27</refmiscinfo>
26103</refmeta>
26104<refnamediv>
26105 <refname>dpm_resume_end</refname>
26106 <refpurpose>
26107     Execute <quote>resume</quote> callbacks and complete system transition.
26108 </refpurpose>
26109</refnamediv>
26110<refsynopsisdiv>
26111 <title>Synopsis</title>
26112  <funcsynopsis><funcprototype>
26113   <funcdef>void <function>dpm_resume_end </function></funcdef>
26114   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
26115  </funcprototype></funcsynopsis>
26116</refsynopsisdiv>
26117<refsect1>
26118 <title>Arguments</title>
26119 <variablelist>
26120  <varlistentry>
26121   <term><parameter>state</parameter></term>
26122   <listitem>
26123    <para>
26124     PM transition of the system being carried out.
26125    </para>
26126   </listitem>
26127  </varlistentry>
26128 </variablelist>
26129</refsect1>
26130<refsect1>
26131<title>Description</title>
26132<para>
26133   Execute <quote>resume</quote> callbacks for all devices and complete the PM transition of
26134   the system.
26135</para>
26136</refsect1>
26137</refentry>
26138
26139<refentry id="API-dpm-suspend-end">
26140<refentryinfo>
26141 <title>LINUX</title>
26142 <productname>Kernel Hackers Manual</productname>
26143 <date>July 2017</date>
26144</refentryinfo>
26145<refmeta>
26146 <refentrytitle><phrase>dpm_suspend_end</phrase></refentrytitle>
26147 <manvolnum>9</manvolnum>
26148 <refmiscinfo class="version">4.1.27</refmiscinfo>
26149</refmeta>
26150<refnamediv>
26151 <refname>dpm_suspend_end</refname>
26152 <refpurpose>
26153     Execute <quote>late</quote> and <quote>noirq</quote> device suspend callbacks.
26154 </refpurpose>
26155</refnamediv>
26156<refsynopsisdiv>
26157 <title>Synopsis</title>
26158  <funcsynopsis><funcprototype>
26159   <funcdef>int <function>dpm_suspend_end </function></funcdef>
26160   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
26161  </funcprototype></funcsynopsis>
26162</refsynopsisdiv>
26163<refsect1>
26164 <title>Arguments</title>
26165 <variablelist>
26166  <varlistentry>
26167   <term><parameter>state</parameter></term>
26168   <listitem>
26169    <para>
26170     PM transition of the system being carried out.
26171    </para>
26172   </listitem>
26173  </varlistentry>
26174 </variablelist>
26175</refsect1>
26176</refentry>
26177
26178<refentry id="API-dpm-suspend-start">
26179<refentryinfo>
26180 <title>LINUX</title>
26181 <productname>Kernel Hackers Manual</productname>
26182 <date>July 2017</date>
26183</refentryinfo>
26184<refmeta>
26185 <refentrytitle><phrase>dpm_suspend_start</phrase></refentrytitle>
26186 <manvolnum>9</manvolnum>
26187 <refmiscinfo class="version">4.1.27</refmiscinfo>
26188</refmeta>
26189<refnamediv>
26190 <refname>dpm_suspend_start</refname>
26191 <refpurpose>
26192     Prepare devices for PM transition and suspend them.
26193 </refpurpose>
26194</refnamediv>
26195<refsynopsisdiv>
26196 <title>Synopsis</title>
26197  <funcsynopsis><funcprototype>
26198   <funcdef>int <function>dpm_suspend_start </function></funcdef>
26199   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
26200  </funcprototype></funcsynopsis>
26201</refsynopsisdiv>
26202<refsect1>
26203 <title>Arguments</title>
26204 <variablelist>
26205  <varlistentry>
26206   <term><parameter>state</parameter></term>
26207   <listitem>
26208    <para>
26209     PM transition of the system being carried out.
26210    </para>
26211   </listitem>
26212  </varlistentry>
26213 </variablelist>
26214</refsect1>
26215<refsect1>
26216<title>Description</title>
26217<para>
26218   Prepare all non-sysdev devices for system PM transition and execute <quote>suspend</quote>
26219   callbacks for them.
26220</para>
26221</refsect1>
26222</refentry>
26223
26224<refentry id="API-device-pm-wait-for-dev">
26225<refentryinfo>
26226 <title>LINUX</title>
26227 <productname>Kernel Hackers Manual</productname>
26228 <date>July 2017</date>
26229</refentryinfo>
26230<refmeta>
26231 <refentrytitle><phrase>device_pm_wait_for_dev</phrase></refentrytitle>
26232 <manvolnum>9</manvolnum>
26233 <refmiscinfo class="version">4.1.27</refmiscinfo>
26234</refmeta>
26235<refnamediv>
26236 <refname>device_pm_wait_for_dev</refname>
26237 <refpurpose>
26238     Wait for suspend/resume of a device to complete.
26239 </refpurpose>
26240</refnamediv>
26241<refsynopsisdiv>
26242 <title>Synopsis</title>
26243  <funcsynopsis><funcprototype>
26244   <funcdef>int <function>device_pm_wait_for_dev </function></funcdef>
26245   <paramdef>struct device * <parameter>subordinate</parameter></paramdef>
26246   <paramdef>struct device * <parameter>dev</parameter></paramdef>
26247  </funcprototype></funcsynopsis>
26248</refsynopsisdiv>
26249<refsect1>
26250 <title>Arguments</title>
26251 <variablelist>
26252  <varlistentry>
26253   <term><parameter>subordinate</parameter></term>
26254   <listitem>
26255    <para>
26256     Device that needs to wait for <parameter>dev</parameter>.
26257    </para>
26258   </listitem>
26259  </varlistentry>
26260  <varlistentry>
26261   <term><parameter>dev</parameter></term>
26262   <listitem>
26263    <para>
26264     Device to wait for.
26265    </para>
26266   </listitem>
26267  </varlistentry>
26268 </variablelist>
26269</refsect1>
26270</refentry>
26271
26272<refentry id="API-dpm-for-each-dev">
26273<refentryinfo>
26274 <title>LINUX</title>
26275 <productname>Kernel Hackers Manual</productname>
26276 <date>July 2017</date>
26277</refentryinfo>
26278<refmeta>
26279 <refentrytitle><phrase>dpm_for_each_dev</phrase></refentrytitle>
26280 <manvolnum>9</manvolnum>
26281 <refmiscinfo class="version">4.1.27</refmiscinfo>
26282</refmeta>
26283<refnamediv>
26284 <refname>dpm_for_each_dev</refname>
26285 <refpurpose>
26286     device iterator.
26287 </refpurpose>
26288</refnamediv>
26289<refsynopsisdiv>
26290 <title>Synopsis</title>
26291  <funcsynopsis><funcprototype>
26292   <funcdef>void <function>dpm_for_each_dev </function></funcdef>
26293   <paramdef>void * <parameter>data</parameter></paramdef>
26294   <paramdef>void (*<parameter>fn</parameter>)
26295     <funcparams>struct device *, void *</funcparams></paramdef>
26296  </funcprototype></funcsynopsis>
26297</refsynopsisdiv>
26298<refsect1>
26299 <title>Arguments</title>
26300 <variablelist>
26301  <varlistentry>
26302   <term><parameter>data</parameter></term>
26303   <listitem>
26304    <para>
26305     data for the callback.
26306    </para>
26307   </listitem>
26308  </varlistentry>
26309  <varlistentry>
26310   <term><parameter>fn</parameter></term>
26311   <listitem>
26312    <para>
26313     function to be called for each device.
26314    </para>
26315   </listitem>
26316  </varlistentry>
26317 </variablelist>
26318</refsect1>
26319<refsect1>
26320<title>Description</title>
26321<para>
26322   Iterate over devices in dpm_list, and call <parameter>fn</parameter> for each device,
26323   passing it <parameter>data</parameter>.
26324</para>
26325</refsect1>
26326</refentry>
26327
26328     </sect1>
26329     <sect1><title>Device Drivers ACPI Support</title>
26330<!-- Internal functions only
26331X!Edrivers/acpi/sleep/main.c
26332X!Edrivers/acpi/sleep/wakeup.c
26333X!Edrivers/acpi/motherboard.c
26334X!Edrivers/acpi/bus.c
26335-->
26336<!-- drivers/acpi/scan.c -->
26337<refentry id="API-acpi-match-device">
26338<refentryinfo>
26339 <title>LINUX</title>
26340 <productname>Kernel Hackers Manual</productname>
26341 <date>July 2017</date>
26342</refentryinfo>
26343<refmeta>
26344 <refentrytitle><phrase>acpi_match_device</phrase></refentrytitle>
26345 <manvolnum>9</manvolnum>
26346 <refmiscinfo class="version">4.1.27</refmiscinfo>
26347</refmeta>
26348<refnamediv>
26349 <refname>acpi_match_device</refname>
26350 <refpurpose>
26351  Match a struct device against a given list of ACPI IDs
26352 </refpurpose>
26353</refnamediv>
26354<refsynopsisdiv>
26355 <title>Synopsis</title>
26356  <funcsynopsis><funcprototype>
26357   <funcdef>const struct acpi_device_id * <function>acpi_match_device </function></funcdef>
26358   <paramdef>const struct acpi_device_id * <parameter>ids</parameter></paramdef>
26359   <paramdef>const struct device * <parameter>dev</parameter></paramdef>
26360  </funcprototype></funcsynopsis>
26361</refsynopsisdiv>
26362<refsect1>
26363 <title>Arguments</title>
26364 <variablelist>
26365  <varlistentry>
26366   <term><parameter>ids</parameter></term>
26367   <listitem>
26368    <para>
26369     Array of struct acpi_device_id object to match against.
26370    </para>
26371   </listitem>
26372  </varlistentry>
26373  <varlistentry>
26374   <term><parameter>dev</parameter></term>
26375   <listitem>
26376    <para>
26377     The device structure to match.
26378    </para>
26379   </listitem>
26380  </varlistentry>
26381 </variablelist>
26382</refsect1>
26383<refsect1>
26384<title>Description</title>
26385<para>
26386   Check if <parameter>dev</parameter> has a valid ACPI handle and if there is a struct acpi_device
26387   object for that handle and use that object to match against a given list of
26388   device IDs.
26389   </para><para>
26390
26391   Return a pointer to the first matching ID on success or <constant>NULL</constant> on failure.
26392</para>
26393</refsect1>
26394</refentry>
26395
26396<refentry id="API-acpi-bus-register-driver">
26397<refentryinfo>
26398 <title>LINUX</title>
26399 <productname>Kernel Hackers Manual</productname>
26400 <date>July 2017</date>
26401</refentryinfo>
26402<refmeta>
26403 <refentrytitle><phrase>acpi_bus_register_driver</phrase></refentrytitle>
26404 <manvolnum>9</manvolnum>
26405 <refmiscinfo class="version">4.1.27</refmiscinfo>
26406</refmeta>
26407<refnamediv>
26408 <refname>acpi_bus_register_driver</refname>
26409 <refpurpose>
26410     register a driver with the ACPI bus
26411 </refpurpose>
26412</refnamediv>
26413<refsynopsisdiv>
26414 <title>Synopsis</title>
26415  <funcsynopsis><funcprototype>
26416   <funcdef>int <function>acpi_bus_register_driver </function></funcdef>
26417   <paramdef>struct acpi_driver * <parameter>driver</parameter></paramdef>
26418  </funcprototype></funcsynopsis>
26419</refsynopsisdiv>
26420<refsect1>
26421 <title>Arguments</title>
26422 <variablelist>
26423  <varlistentry>
26424   <term><parameter>driver</parameter></term>
26425   <listitem>
26426    <para>
26427     driver being registered
26428    </para>
26429   </listitem>
26430  </varlistentry>
26431 </variablelist>
26432</refsect1>
26433<refsect1>
26434<title>Description</title>
26435<para>
26436   Registers a driver with the ACPI bus.  Searches the namespace for all
26437   devices that match the driver's criteria and binds.  Returns zero for
26438   success or a negative error status for failure.
26439</para>
26440</refsect1>
26441</refentry>
26442
26443<refentry id="API-acpi-bus-unregister-driver">
26444<refentryinfo>
26445 <title>LINUX</title>
26446 <productname>Kernel Hackers Manual</productname>
26447 <date>July 2017</date>
26448</refentryinfo>
26449<refmeta>
26450 <refentrytitle><phrase>acpi_bus_unregister_driver</phrase></refentrytitle>
26451 <manvolnum>9</manvolnum>
26452 <refmiscinfo class="version">4.1.27</refmiscinfo>
26453</refmeta>
26454<refnamediv>
26455 <refname>acpi_bus_unregister_driver</refname>
26456 <refpurpose>
26457     unregisters a driver with the ACPI bus
26458 </refpurpose>
26459</refnamediv>
26460<refsynopsisdiv>
26461 <title>Synopsis</title>
26462  <funcsynopsis><funcprototype>
26463   <funcdef>void <function>acpi_bus_unregister_driver </function></funcdef>
26464   <paramdef>struct acpi_driver * <parameter>driver</parameter></paramdef>
26465  </funcprototype></funcsynopsis>
26466</refsynopsisdiv>
26467<refsect1>
26468 <title>Arguments</title>
26469 <variablelist>
26470  <varlistentry>
26471   <term><parameter>driver</parameter></term>
26472   <listitem>
26473    <para>
26474     driver to unregister
26475    </para>
26476   </listitem>
26477  </varlistentry>
26478 </variablelist>
26479</refsect1>
26480<refsect1>
26481<title>Description</title>
26482<para>
26483   Unregisters a driver with the ACPI bus.  Searches the namespace for all
26484   devices that match the driver's criteria and unbinds.
26485</para>
26486</refsect1>
26487</refentry>
26488
26489<refentry id="API-acpi-bus-scan">
26490<refentryinfo>
26491 <title>LINUX</title>
26492 <productname>Kernel Hackers Manual</productname>
26493 <date>July 2017</date>
26494</refentryinfo>
26495<refmeta>
26496 <refentrytitle><phrase>acpi_bus_scan</phrase></refentrytitle>
26497 <manvolnum>9</manvolnum>
26498 <refmiscinfo class="version">4.1.27</refmiscinfo>
26499</refmeta>
26500<refnamediv>
26501 <refname>acpi_bus_scan</refname>
26502 <refpurpose>
26503     Add ACPI device node objects in a given namespace scope.
26504 </refpurpose>
26505</refnamediv>
26506<refsynopsisdiv>
26507 <title>Synopsis</title>
26508  <funcsynopsis><funcprototype>
26509   <funcdef>int <function>acpi_bus_scan </function></funcdef>
26510   <paramdef>acpi_handle <parameter>handle</parameter></paramdef>
26511  </funcprototype></funcsynopsis>
26512</refsynopsisdiv>
26513<refsect1>
26514 <title>Arguments</title>
26515 <variablelist>
26516  <varlistentry>
26517   <term><parameter>handle</parameter></term>
26518   <listitem>
26519    <para>
26520     Root of the namespace scope to scan.
26521    </para>
26522   </listitem>
26523  </varlistentry>
26524 </variablelist>
26525</refsect1>
26526<refsect1>
26527<title>Description</title>
26528<para>
26529   Scan a given ACPI tree (probably recently hot-plugged) and create and add
26530   found devices.
26531   </para><para>
26532
26533   If no devices were found, -ENODEV is returned, but it does not mean that
26534   there has been a real error.  There just have been no suitable ACPI objects
26535   in the table trunk from which the kernel could create a device and add an
26536   appropriate driver.
26537   </para><para>
26538
26539   Must be called under acpi_scan_lock.
26540</para>
26541</refsect1>
26542</refentry>
26543
26544<refentry id="API-acpi-bus-trim">
26545<refentryinfo>
26546 <title>LINUX</title>
26547 <productname>Kernel Hackers Manual</productname>
26548 <date>July 2017</date>
26549</refentryinfo>
26550<refmeta>
26551 <refentrytitle><phrase>acpi_bus_trim</phrase></refentrytitle>
26552 <manvolnum>9</manvolnum>
26553 <refmiscinfo class="version">4.1.27</refmiscinfo>
26554</refmeta>
26555<refnamediv>
26556 <refname>acpi_bus_trim</refname>
26557 <refpurpose>
26558     Detach scan handlers and drivers from ACPI device objects.
26559 </refpurpose>
26560</refnamediv>
26561<refsynopsisdiv>
26562 <title>Synopsis</title>
26563  <funcsynopsis><funcprototype>
26564   <funcdef>void <function>acpi_bus_trim </function></funcdef>
26565   <paramdef>struct acpi_device * <parameter>adev</parameter></paramdef>
26566  </funcprototype></funcsynopsis>
26567</refsynopsisdiv>
26568<refsect1>
26569 <title>Arguments</title>
26570 <variablelist>
26571  <varlistentry>
26572   <term><parameter>adev</parameter></term>
26573   <listitem>
26574    <para>
26575     Root of the ACPI namespace scope to walk.
26576    </para>
26577   </listitem>
26578  </varlistentry>
26579 </variablelist>
26580</refsect1>
26581<refsect1>
26582<title>Description</title>
26583<para>
26584   Must be called under acpi_scan_lock.
26585</para>
26586</refsect1>
26587</refentry>
26588
26589<!-- drivers/acpi/scan.c -->
26590<refentry id="API-create-pnp-modalias">
26591<refentryinfo>
26592 <title>LINUX</title>
26593 <productname>Kernel Hackers Manual</productname>
26594 <date>July 2017</date>
26595</refentryinfo>
26596<refmeta>
26597 <refentrytitle><phrase>create_pnp_modalias</phrase></refentrytitle>
26598 <manvolnum>9</manvolnum>
26599 <refmiscinfo class="version">4.1.27</refmiscinfo>
26600</refmeta>
26601<refnamediv>
26602 <refname>create_pnp_modalias</refname>
26603 <refpurpose>
26604  Create hid/cid(s) string for modalias and uevent
26605 </refpurpose>
26606</refnamediv>
26607<refsynopsisdiv>
26608 <title>Synopsis</title>
26609  <funcsynopsis><funcprototype>
26610   <funcdef>int <function>create_pnp_modalias </function></funcdef>
26611   <paramdef>struct acpi_device * <parameter>acpi_dev</parameter></paramdef>
26612   <paramdef>char * <parameter>modalias</parameter></paramdef>
26613   <paramdef>int <parameter>size</parameter></paramdef>
26614  </funcprototype></funcsynopsis>
26615</refsynopsisdiv>
26616<refsect1>
26617 <title>Arguments</title>
26618 <variablelist>
26619  <varlistentry>
26620   <term><parameter>acpi_dev</parameter></term>
26621   <listitem>
26622    <para>
26623     ACPI device object.
26624    </para>
26625   </listitem>
26626  </varlistentry>
26627  <varlistentry>
26628   <term><parameter>modalias</parameter></term>
26629   <listitem>
26630    <para>
26631     Buffer to print into.
26632    </para>
26633   </listitem>
26634  </varlistentry>
26635  <varlistentry>
26636   <term><parameter>size</parameter></term>
26637   <listitem>
26638    <para>
26639     Size of the buffer.
26640    </para>
26641   </listitem>
26642  </varlistentry>
26643 </variablelist>
26644</refsect1>
26645<refsect1>
26646<title>Description</title>
26647<para>
26648   Creates hid/cid(s) string needed for modalias and uevent
26649   e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get:
26650</para>
26651</refsect1>
26652<refsect1>
26653<title>modalias</title>
26654<para>
26655   "acpi:IBM0001:ACPI0001"
26656</para>
26657</refsect1>
26658<refsect1>
26659<title>Return</title>
26660<para>
26661   0: no _HID and no _CID
26662   -EINVAL: output error
26663   -ENOMEM: output is truncated
26664</para>
26665</refsect1>
26666</refentry>
26667
26668<refentry id="API-create-of-modalias">
26669<refentryinfo>
26670 <title>LINUX</title>
26671 <productname>Kernel Hackers Manual</productname>
26672 <date>July 2017</date>
26673</refentryinfo>
26674<refmeta>
26675 <refentrytitle><phrase>create_of_modalias</phrase></refentrytitle>
26676 <manvolnum>9</manvolnum>
26677 <refmiscinfo class="version">4.1.27</refmiscinfo>
26678</refmeta>
26679<refnamediv>
26680 <refname>create_of_modalias</refname>
26681 <refpurpose>
26682     Creates DT compatible string for modalias and uevent
26683 </refpurpose>
26684</refnamediv>
26685<refsynopsisdiv>
26686 <title>Synopsis</title>
26687  <funcsynopsis><funcprototype>
26688   <funcdef>int <function>create_of_modalias </function></funcdef>
26689   <paramdef>struct acpi_device * <parameter>acpi_dev</parameter></paramdef>
26690   <paramdef>char * <parameter>modalias</parameter></paramdef>
26691   <paramdef>int <parameter>size</parameter></paramdef>
26692  </funcprototype></funcsynopsis>
26693</refsynopsisdiv>
26694<refsect1>
26695 <title>Arguments</title>
26696 <variablelist>
26697  <varlistentry>
26698   <term><parameter>acpi_dev</parameter></term>
26699   <listitem>
26700    <para>
26701     ACPI device object.
26702    </para>
26703   </listitem>
26704  </varlistentry>
26705  <varlistentry>
26706   <term><parameter>modalias</parameter></term>
26707   <listitem>
26708    <para>
26709     Buffer to print into.
26710    </para>
26711   </listitem>
26712  </varlistentry>
26713  <varlistentry>
26714   <term><parameter>size</parameter></term>
26715   <listitem>
26716    <para>
26717     Size of the buffer.
26718    </para>
26719   </listitem>
26720  </varlistentry>
26721 </variablelist>
26722</refsect1>
26723<refsect1>
26724<title>Expose DT compatible modalias as of</title>
26725<para>
26726   NnameTCcompatible.  This function should
26727   only be called for devices having PRP0001 in their list of ACPI/PNP IDs.
26728</para>
26729</refsect1>
26730</refentry>
26731
26732<refentry id="API-acpi-of-match-device">
26733<refentryinfo>
26734 <title>LINUX</title>
26735 <productname>Kernel Hackers Manual</productname>
26736 <date>July 2017</date>
26737</refentryinfo>
26738<refmeta>
26739 <refentrytitle><phrase>acpi_of_match_device</phrase></refentrytitle>
26740 <manvolnum>9</manvolnum>
26741 <refmiscinfo class="version">4.1.27</refmiscinfo>
26742</refmeta>
26743<refnamediv>
26744 <refname>acpi_of_match_device</refname>
26745 <refpurpose>
26746     Match device object using the <quote>compatible</quote> property.
26747 </refpurpose>
26748</refnamediv>
26749<refsynopsisdiv>
26750 <title>Synopsis</title>
26751  <funcsynopsis><funcprototype>
26752   <funcdef>bool <function>acpi_of_match_device </function></funcdef>
26753   <paramdef>struct acpi_device * <parameter>adev</parameter></paramdef>
26754   <paramdef>const struct of_device_id * <parameter>of_match_table</parameter></paramdef>
26755  </funcprototype></funcsynopsis>
26756</refsynopsisdiv>
26757<refsect1>
26758 <title>Arguments</title>
26759 <variablelist>
26760  <varlistentry>
26761   <term><parameter>adev</parameter></term>
26762   <listitem>
26763    <para>
26764     ACPI device object to match.
26765    </para>
26766   </listitem>
26767  </varlistentry>
26768  <varlistentry>
26769   <term><parameter>of_match_table</parameter></term>
26770   <listitem>
26771    <para>
26772     List of device IDs to match against.
26773    </para>
26774   </listitem>
26775  </varlistentry>
26776 </variablelist>
26777</refsect1>
26778<refsect1>
26779<title>Description</title>
26780<para>
26781   If <parameter>dev</parameter> has an ACPI companion which has the special PRP0001 device ID in its
26782   list of identifiers and a _DSD object with the <quote>compatible</quote> property, use
26783   that property to match against the given list of identifiers.
26784</para>
26785</refsect1>
26786</refentry>
26787
26788<refentry id="API-acpi-scan-drop-device">
26789<refentryinfo>
26790 <title>LINUX</title>
26791 <productname>Kernel Hackers Manual</productname>
26792 <date>July 2017</date>
26793</refentryinfo>
26794<refmeta>
26795 <refentrytitle><phrase>acpi_scan_drop_device</phrase></refentrytitle>
26796 <manvolnum>9</manvolnum>
26797 <refmiscinfo class="version">4.1.27</refmiscinfo>
26798</refmeta>
26799<refnamediv>
26800 <refname>acpi_scan_drop_device</refname>
26801 <refpurpose>
26802     Drop an ACPI device object.
26803 </refpurpose>
26804</refnamediv>
26805<refsynopsisdiv>
26806 <title>Synopsis</title>
26807  <funcsynopsis><funcprototype>
26808   <funcdef>void <function>acpi_scan_drop_device </function></funcdef>
26809   <paramdef>acpi_handle <parameter>handle</parameter></paramdef>
26810   <paramdef>void * <parameter>context</parameter></paramdef>
26811  </funcprototype></funcsynopsis>
26812</refsynopsisdiv>
26813<refsect1>
26814 <title>Arguments</title>
26815 <variablelist>
26816  <varlistentry>
26817   <term><parameter>handle</parameter></term>
26818   <listitem>
26819    <para>
26820     Handle of an ACPI namespace node, not used.
26821    </para>
26822   </listitem>
26823  </varlistentry>
26824  <varlistentry>
26825   <term><parameter>context</parameter></term>
26826   <listitem>
26827    <para>
26828     Address of the ACPI device object to drop.
26829    </para>
26830   </listitem>
26831  </varlistentry>
26832 </variablelist>
26833</refsect1>
26834<refsect1>
26835<title>Description</title>
26836<para>
26837   This is invoked by <function>acpi_ns_delete_node</function> during the removal of the ACPI
26838   namespace node the device object pointed to by <parameter>context</parameter> is attached to.
26839   </para><para>
26840
26841   The unregistration is carried out asynchronously to avoid running
26842   <function>acpi_device_del</function> under the ACPICA's namespace mutex and the list is used to
26843   ensure the correct ordering (the device objects must be unregistered in the
26844   same order in which the corresponding namespace nodes are deleted).
26845</para>
26846</refsect1>
26847</refentry>
26848
26849<!-- No correct structured comments
26850X!Edrivers/acpi/pci_bind.c
26851-->
26852     </sect1>
26853     <sect1><title>Device drivers PnP support</title>
26854<!-- drivers/pnp/core.c -->
26855<refentry id="API-pnp-register-protocol">
26856<refentryinfo>
26857 <title>LINUX</title>
26858 <productname>Kernel Hackers Manual</productname>
26859 <date>July 2017</date>
26860</refentryinfo>
26861<refmeta>
26862 <refentrytitle><phrase>pnp_register_protocol</phrase></refentrytitle>
26863 <manvolnum>9</manvolnum>
26864 <refmiscinfo class="version">4.1.27</refmiscinfo>
26865</refmeta>
26866<refnamediv>
26867 <refname>pnp_register_protocol</refname>
26868 <refpurpose>
26869  adds a pnp protocol to the pnp layer
26870 </refpurpose>
26871</refnamediv>
26872<refsynopsisdiv>
26873 <title>Synopsis</title>
26874  <funcsynopsis><funcprototype>
26875   <funcdef>int <function>pnp_register_protocol </function></funcdef>
26876   <paramdef>struct pnp_protocol * <parameter>protocol</parameter></paramdef>
26877  </funcprototype></funcsynopsis>
26878</refsynopsisdiv>
26879<refsect1>
26880 <title>Arguments</title>
26881 <variablelist>
26882  <varlistentry>
26883   <term><parameter>protocol</parameter></term>
26884   <listitem>
26885    <para>
26886     pointer to the corresponding pnp_protocol structure
26887    </para>
26888   </listitem>
26889  </varlistentry>
26890 </variablelist>
26891</refsect1>
26892<refsect1>
26893<title>Ex protocols</title>
26894<para>
26895   ISAPNP, PNPBIOS, etc
26896</para>
26897</refsect1>
26898</refentry>
26899
26900<refentry id="API-pnp-unregister-protocol">
26901<refentryinfo>
26902 <title>LINUX</title>
26903 <productname>Kernel Hackers Manual</productname>
26904 <date>July 2017</date>
26905</refentryinfo>
26906<refmeta>
26907 <refentrytitle><phrase>pnp_unregister_protocol</phrase></refentrytitle>
26908 <manvolnum>9</manvolnum>
26909 <refmiscinfo class="version">4.1.27</refmiscinfo>
26910</refmeta>
26911<refnamediv>
26912 <refname>pnp_unregister_protocol</refname>
26913 <refpurpose>
26914     removes a pnp protocol from the pnp layer
26915 </refpurpose>
26916</refnamediv>
26917<refsynopsisdiv>
26918 <title>Synopsis</title>
26919  <funcsynopsis><funcprototype>
26920   <funcdef>void <function>pnp_unregister_protocol </function></funcdef>
26921   <paramdef>struct pnp_protocol * <parameter>protocol</parameter></paramdef>
26922  </funcprototype></funcsynopsis>
26923</refsynopsisdiv>
26924<refsect1>
26925 <title>Arguments</title>
26926 <variablelist>
26927  <varlistentry>
26928   <term><parameter>protocol</parameter></term>
26929   <listitem>
26930    <para>
26931     pointer to the corresponding pnp_protocol structure
26932    </para>
26933   </listitem>
26934  </varlistentry>
26935 </variablelist>
26936</refsect1>
26937</refentry>
26938
26939<!-- No correct structured comments
26940X!Edrivers/pnp/system.c
26941 -->
26942<!-- drivers/pnp/card.c -->
26943<refentry id="API-pnp-request-card-device">
26944<refentryinfo>
26945 <title>LINUX</title>
26946 <productname>Kernel Hackers Manual</productname>
26947 <date>July 2017</date>
26948</refentryinfo>
26949<refmeta>
26950 <refentrytitle><phrase>pnp_request_card_device</phrase></refentrytitle>
26951 <manvolnum>9</manvolnum>
26952 <refmiscinfo class="version">4.1.27</refmiscinfo>
26953</refmeta>
26954<refnamediv>
26955 <refname>pnp_request_card_device</refname>
26956 <refpurpose>
26957  Searches for a PnP device under the specified card
26958 </refpurpose>
26959</refnamediv>
26960<refsynopsisdiv>
26961 <title>Synopsis</title>
26962  <funcsynopsis><funcprototype>
26963   <funcdef>struct pnp_dev * <function>pnp_request_card_device </function></funcdef>
26964   <paramdef>struct pnp_card_link * <parameter>clink</parameter></paramdef>
26965   <paramdef>const char * <parameter>id</parameter></paramdef>
26966   <paramdef>struct pnp_dev * <parameter>from</parameter></paramdef>
26967  </funcprototype></funcsynopsis>
26968</refsynopsisdiv>
26969<refsect1>
26970 <title>Arguments</title>
26971 <variablelist>
26972  <varlistentry>
26973   <term><parameter>clink</parameter></term>
26974   <listitem>
26975    <para>
26976     pointer to the card link, cannot be NULL
26977    </para>
26978   </listitem>
26979  </varlistentry>
26980  <varlistentry>
26981   <term><parameter>id</parameter></term>
26982   <listitem>
26983    <para>
26984     pointer to a PnP ID structure that explains the rules for finding the device
26985    </para>
26986   </listitem>
26987  </varlistentry>
26988  <varlistentry>
26989   <term><parameter>from</parameter></term>
26990   <listitem>
26991    <para>
26992     Starting place to search from. If NULL it will start from the beginning.
26993    </para>
26994   </listitem>
26995  </varlistentry>
26996 </variablelist>
26997</refsect1>
26998</refentry>
26999
27000<refentry id="API-pnp-release-card-device">
27001<refentryinfo>
27002 <title>LINUX</title>
27003 <productname>Kernel Hackers Manual</productname>
27004 <date>July 2017</date>
27005</refentryinfo>
27006<refmeta>
27007 <refentrytitle><phrase>pnp_release_card_device</phrase></refentrytitle>
27008 <manvolnum>9</manvolnum>
27009 <refmiscinfo class="version">4.1.27</refmiscinfo>
27010</refmeta>
27011<refnamediv>
27012 <refname>pnp_release_card_device</refname>
27013 <refpurpose>
27014     call this when the driver no longer needs the device
27015 </refpurpose>
27016</refnamediv>
27017<refsynopsisdiv>
27018 <title>Synopsis</title>
27019  <funcsynopsis><funcprototype>
27020   <funcdef>void <function>pnp_release_card_device </function></funcdef>
27021   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
27022  </funcprototype></funcsynopsis>
27023</refsynopsisdiv>
27024<refsect1>
27025 <title>Arguments</title>
27026 <variablelist>
27027  <varlistentry>
27028   <term><parameter>dev</parameter></term>
27029   <listitem>
27030    <para>
27031     pointer to the PnP device structure
27032    </para>
27033   </listitem>
27034  </varlistentry>
27035 </variablelist>
27036</refsect1>
27037</refentry>
27038
27039<refentry id="API-pnp-register-card-driver">
27040<refentryinfo>
27041 <title>LINUX</title>
27042 <productname>Kernel Hackers Manual</productname>
27043 <date>July 2017</date>
27044</refentryinfo>
27045<refmeta>
27046 <refentrytitle><phrase>pnp_register_card_driver</phrase></refentrytitle>
27047 <manvolnum>9</manvolnum>
27048 <refmiscinfo class="version">4.1.27</refmiscinfo>
27049</refmeta>
27050<refnamediv>
27051 <refname>pnp_register_card_driver</refname>
27052 <refpurpose>
27053     registers a PnP card driver with the PnP Layer
27054 </refpurpose>
27055</refnamediv>
27056<refsynopsisdiv>
27057 <title>Synopsis</title>
27058  <funcsynopsis><funcprototype>
27059   <funcdef>int <function>pnp_register_card_driver </function></funcdef>
27060   <paramdef>struct pnp_card_driver * <parameter>drv</parameter></paramdef>
27061  </funcprototype></funcsynopsis>
27062</refsynopsisdiv>
27063<refsect1>
27064 <title>Arguments</title>
27065 <variablelist>
27066  <varlistentry>
27067   <term><parameter>drv</parameter></term>
27068   <listitem>
27069    <para>
27070     pointer to the driver to register
27071    </para>
27072   </listitem>
27073  </varlistentry>
27074 </variablelist>
27075</refsect1>
27076</refentry>
27077
27078<refentry id="API-pnp-unregister-card-driver">
27079<refentryinfo>
27080 <title>LINUX</title>
27081 <productname>Kernel Hackers Manual</productname>
27082 <date>July 2017</date>
27083</refentryinfo>
27084<refmeta>
27085 <refentrytitle><phrase>pnp_unregister_card_driver</phrase></refentrytitle>
27086 <manvolnum>9</manvolnum>
27087 <refmiscinfo class="version">4.1.27</refmiscinfo>
27088</refmeta>
27089<refnamediv>
27090 <refname>pnp_unregister_card_driver</refname>
27091 <refpurpose>
27092     unregisters a PnP card driver from the PnP Layer
27093 </refpurpose>
27094</refnamediv>
27095<refsynopsisdiv>
27096 <title>Synopsis</title>
27097  <funcsynopsis><funcprototype>
27098   <funcdef>void <function>pnp_unregister_card_driver </function></funcdef>
27099   <paramdef>struct pnp_card_driver * <parameter>drv</parameter></paramdef>
27100  </funcprototype></funcsynopsis>
27101</refsynopsisdiv>
27102<refsect1>
27103 <title>Arguments</title>
27104 <variablelist>
27105  <varlistentry>
27106   <term><parameter>drv</parameter></term>
27107   <listitem>
27108    <para>
27109     pointer to the driver to unregister
27110    </para>
27111   </listitem>
27112  </varlistentry>
27113 </variablelist>
27114</refsect1>
27115</refentry>
27116
27117<!-- drivers/pnp/driver.c -->
27118<refentry id="API-pnp-add-id">
27119<refentryinfo>
27120 <title>LINUX</title>
27121 <productname>Kernel Hackers Manual</productname>
27122 <date>July 2017</date>
27123</refentryinfo>
27124<refmeta>
27125 <refentrytitle><phrase>pnp_add_id</phrase></refentrytitle>
27126 <manvolnum>9</manvolnum>
27127 <refmiscinfo class="version">4.1.27</refmiscinfo>
27128</refmeta>
27129<refnamediv>
27130 <refname>pnp_add_id</refname>
27131 <refpurpose>
27132  adds an EISA id to the specified device
27133 </refpurpose>
27134</refnamediv>
27135<refsynopsisdiv>
27136 <title>Synopsis</title>
27137  <funcsynopsis><funcprototype>
27138   <funcdef>struct pnp_id * <function>pnp_add_id </function></funcdef>
27139   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
27140   <paramdef>const char * <parameter>id</parameter></paramdef>
27141  </funcprototype></funcsynopsis>
27142</refsynopsisdiv>
27143<refsect1>
27144 <title>Arguments</title>
27145 <variablelist>
27146  <varlistentry>
27147   <term><parameter>dev</parameter></term>
27148   <listitem>
27149    <para>
27150     pointer to the desired device
27151    </para>
27152   </listitem>
27153  </varlistentry>
27154  <varlistentry>
27155   <term><parameter>id</parameter></term>
27156   <listitem>
27157    <para>
27158     pointer to an EISA id string
27159    </para>
27160   </listitem>
27161  </varlistentry>
27162 </variablelist>
27163</refsect1>
27164</refentry>
27165
27166<!-- drivers/pnp/manager.c -->
27167<refentry id="API-pnp-start-dev">
27168<refentryinfo>
27169 <title>LINUX</title>
27170 <productname>Kernel Hackers Manual</productname>
27171 <date>July 2017</date>
27172</refentryinfo>
27173<refmeta>
27174 <refentrytitle><phrase>pnp_start_dev</phrase></refentrytitle>
27175 <manvolnum>9</manvolnum>
27176 <refmiscinfo class="version">4.1.27</refmiscinfo>
27177</refmeta>
27178<refnamediv>
27179 <refname>pnp_start_dev</refname>
27180 <refpurpose>
27181  low-level start of the PnP device
27182 </refpurpose>
27183</refnamediv>
27184<refsynopsisdiv>
27185 <title>Synopsis</title>
27186  <funcsynopsis><funcprototype>
27187   <funcdef>int <function>pnp_start_dev </function></funcdef>
27188   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
27189  </funcprototype></funcsynopsis>
27190</refsynopsisdiv>
27191<refsect1>
27192 <title>Arguments</title>
27193 <variablelist>
27194  <varlistentry>
27195   <term><parameter>dev</parameter></term>
27196   <listitem>
27197    <para>
27198     pointer to the desired device
27199    </para>
27200   </listitem>
27201  </varlistentry>
27202 </variablelist>
27203</refsect1>
27204<refsect1>
27205<title>Description</title>
27206<para>
27207   assumes that resources have already been allocated
27208</para>
27209</refsect1>
27210</refentry>
27211
27212<refentry id="API-pnp-stop-dev">
27213<refentryinfo>
27214 <title>LINUX</title>
27215 <productname>Kernel Hackers Manual</productname>
27216 <date>July 2017</date>
27217</refentryinfo>
27218<refmeta>
27219 <refentrytitle><phrase>pnp_stop_dev</phrase></refentrytitle>
27220 <manvolnum>9</manvolnum>
27221 <refmiscinfo class="version">4.1.27</refmiscinfo>
27222</refmeta>
27223<refnamediv>
27224 <refname>pnp_stop_dev</refname>
27225 <refpurpose>
27226     low-level disable of the PnP device
27227 </refpurpose>
27228</refnamediv>
27229<refsynopsisdiv>
27230 <title>Synopsis</title>
27231  <funcsynopsis><funcprototype>
27232   <funcdef>int <function>pnp_stop_dev </function></funcdef>
27233   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
27234  </funcprototype></funcsynopsis>
27235</refsynopsisdiv>
27236<refsect1>
27237 <title>Arguments</title>
27238 <variablelist>
27239  <varlistentry>
27240   <term><parameter>dev</parameter></term>
27241   <listitem>
27242    <para>
27243     pointer to the desired device
27244    </para>
27245   </listitem>
27246  </varlistentry>
27247 </variablelist>
27248</refsect1>
27249<refsect1>
27250<title>Description</title>
27251<para>
27252   does not free resources
27253</para>
27254</refsect1>
27255</refentry>
27256
27257<refentry id="API-pnp-activate-dev">
27258<refentryinfo>
27259 <title>LINUX</title>
27260 <productname>Kernel Hackers Manual</productname>
27261 <date>July 2017</date>
27262</refentryinfo>
27263<refmeta>
27264 <refentrytitle><phrase>pnp_activate_dev</phrase></refentrytitle>
27265 <manvolnum>9</manvolnum>
27266 <refmiscinfo class="version">4.1.27</refmiscinfo>
27267</refmeta>
27268<refnamediv>
27269 <refname>pnp_activate_dev</refname>
27270 <refpurpose>
27271     activates a PnP device for use
27272 </refpurpose>
27273</refnamediv>
27274<refsynopsisdiv>
27275 <title>Synopsis</title>
27276  <funcsynopsis><funcprototype>
27277   <funcdef>int <function>pnp_activate_dev </function></funcdef>
27278   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
27279  </funcprototype></funcsynopsis>
27280</refsynopsisdiv>
27281<refsect1>
27282 <title>Arguments</title>
27283 <variablelist>
27284  <varlistentry>
27285   <term><parameter>dev</parameter></term>
27286   <listitem>
27287    <para>
27288     pointer to the desired device
27289    </para>
27290   </listitem>
27291  </varlistentry>
27292 </variablelist>
27293</refsect1>
27294<refsect1>
27295<title>Description</title>
27296<para>
27297   does not validate or set resources so be careful.
27298</para>
27299</refsect1>
27300</refentry>
27301
27302<refentry id="API-pnp-disable-dev">
27303<refentryinfo>
27304 <title>LINUX</title>
27305 <productname>Kernel Hackers Manual</productname>
27306 <date>July 2017</date>
27307</refentryinfo>
27308<refmeta>
27309 <refentrytitle><phrase>pnp_disable_dev</phrase></refentrytitle>
27310 <manvolnum>9</manvolnum>
27311 <refmiscinfo class="version">4.1.27</refmiscinfo>
27312</refmeta>
27313<refnamediv>
27314 <refname>pnp_disable_dev</refname>
27315 <refpurpose>
27316     disables device
27317 </refpurpose>
27318</refnamediv>
27319<refsynopsisdiv>
27320 <title>Synopsis</title>
27321  <funcsynopsis><funcprototype>
27322   <funcdef>int <function>pnp_disable_dev </function></funcdef>
27323   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
27324  </funcprototype></funcsynopsis>
27325</refsynopsisdiv>
27326<refsect1>
27327 <title>Arguments</title>
27328 <variablelist>
27329  <varlistentry>
27330   <term><parameter>dev</parameter></term>
27331   <listitem>
27332    <para>
27333     pointer to the desired device
27334    </para>
27335   </listitem>
27336  </varlistentry>
27337 </variablelist>
27338</refsect1>
27339<refsect1>
27340<title>Description</title>
27341<para>
27342   inform the correct pnp protocol so that resources can be used by other devices
27343</para>
27344</refsect1>
27345</refentry>
27346
27347<!-- drivers/pnp/support.c -->
27348<refentry id="API-pnp-is-active">
27349<refentryinfo>
27350 <title>LINUX</title>
27351 <productname>Kernel Hackers Manual</productname>
27352 <date>July 2017</date>
27353</refentryinfo>
27354<refmeta>
27355 <refentrytitle><phrase>pnp_is_active</phrase></refentrytitle>
27356 <manvolnum>9</manvolnum>
27357 <refmiscinfo class="version">4.1.27</refmiscinfo>
27358</refmeta>
27359<refnamediv>
27360 <refname>pnp_is_active</refname>
27361 <refpurpose>
27362  Determines if a device is active based on its current resources
27363 </refpurpose>
27364</refnamediv>
27365<refsynopsisdiv>
27366 <title>Synopsis</title>
27367  <funcsynopsis><funcprototype>
27368   <funcdef>int <function>pnp_is_active </function></funcdef>
27369   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
27370  </funcprototype></funcsynopsis>
27371</refsynopsisdiv>
27372<refsect1>
27373 <title>Arguments</title>
27374 <variablelist>
27375  <varlistentry>
27376   <term><parameter>dev</parameter></term>
27377   <listitem>
27378    <para>
27379     pointer to the desired PnP device
27380    </para>
27381   </listitem>
27382  </varlistentry>
27383 </variablelist>
27384</refsect1>
27385</refentry>
27386
27387     </sect1>
27388     <sect1><title>Userspace IO devices</title>
27389<!-- drivers/uio/uio.c -->
27390<refentry id="API-uio-event-notify">
27391<refentryinfo>
27392 <title>LINUX</title>
27393 <productname>Kernel Hackers Manual</productname>
27394 <date>July 2017</date>
27395</refentryinfo>
27396<refmeta>
27397 <refentrytitle><phrase>uio_event_notify</phrase></refentrytitle>
27398 <manvolnum>9</manvolnum>
27399 <refmiscinfo class="version">4.1.27</refmiscinfo>
27400</refmeta>
27401<refnamediv>
27402 <refname>uio_event_notify</refname>
27403 <refpurpose>
27404  trigger an interrupt event
27405 </refpurpose>
27406</refnamediv>
27407<refsynopsisdiv>
27408 <title>Synopsis</title>
27409  <funcsynopsis><funcprototype>
27410   <funcdef>void <function>uio_event_notify </function></funcdef>
27411   <paramdef>struct uio_info * <parameter>info</parameter></paramdef>
27412  </funcprototype></funcsynopsis>
27413</refsynopsisdiv>
27414<refsect1>
27415 <title>Arguments</title>
27416 <variablelist>
27417  <varlistentry>
27418   <term><parameter>info</parameter></term>
27419   <listitem>
27420    <para>
27421     UIO device capabilities
27422    </para>
27423   </listitem>
27424  </varlistentry>
27425 </variablelist>
27426</refsect1>
27427</refentry>
27428
27429<refentry id="API---uio-register-device">
27430<refentryinfo>
27431 <title>LINUX</title>
27432 <productname>Kernel Hackers Manual</productname>
27433 <date>July 2017</date>
27434</refentryinfo>
27435<refmeta>
27436 <refentrytitle><phrase>__uio_register_device</phrase></refentrytitle>
27437 <manvolnum>9</manvolnum>
27438 <refmiscinfo class="version">4.1.27</refmiscinfo>
27439</refmeta>
27440<refnamediv>
27441 <refname>__uio_register_device</refname>
27442 <refpurpose>
27443     register a new userspace IO device
27444 </refpurpose>
27445</refnamediv>
27446<refsynopsisdiv>
27447 <title>Synopsis</title>
27448  <funcsynopsis><funcprototype>
27449   <funcdef>int <function>__uio_register_device </function></funcdef>
27450   <paramdef>struct module * <parameter>owner</parameter></paramdef>
27451   <paramdef>struct device * <parameter>parent</parameter></paramdef>
27452   <paramdef>struct uio_info * <parameter>info</parameter></paramdef>
27453  </funcprototype></funcsynopsis>
27454</refsynopsisdiv>
27455<refsect1>
27456 <title>Arguments</title>
27457 <variablelist>
27458  <varlistentry>
27459   <term><parameter>owner</parameter></term>
27460   <listitem>
27461    <para>
27462     module that creates the new device
27463    </para>
27464   </listitem>
27465  </varlistentry>
27466  <varlistentry>
27467   <term><parameter>parent</parameter></term>
27468   <listitem>
27469    <para>
27470     parent device
27471    </para>
27472   </listitem>
27473  </varlistentry>
27474  <varlistentry>
27475   <term><parameter>info</parameter></term>
27476   <listitem>
27477    <para>
27478     UIO device capabilities
27479    </para>
27480   </listitem>
27481  </varlistentry>
27482 </variablelist>
27483</refsect1>
27484<refsect1>
27485<title>Description</title>
27486<para>
27487   returns zero on success or a negative error code.
27488</para>
27489</refsect1>
27490</refentry>
27491
27492<refentry id="API-uio-unregister-device">
27493<refentryinfo>
27494 <title>LINUX</title>
27495 <productname>Kernel Hackers Manual</productname>
27496 <date>July 2017</date>
27497</refentryinfo>
27498<refmeta>
27499 <refentrytitle><phrase>uio_unregister_device</phrase></refentrytitle>
27500 <manvolnum>9</manvolnum>
27501 <refmiscinfo class="version">4.1.27</refmiscinfo>
27502</refmeta>
27503<refnamediv>
27504 <refname>uio_unregister_device</refname>
27505 <refpurpose>
27506     unregister a industrial IO device
27507 </refpurpose>
27508</refnamediv>
27509<refsynopsisdiv>
27510 <title>Synopsis</title>
27511  <funcsynopsis><funcprototype>
27512   <funcdef>void <function>uio_unregister_device </function></funcdef>
27513   <paramdef>struct uio_info * <parameter>info</parameter></paramdef>
27514  </funcprototype></funcsynopsis>
27515</refsynopsisdiv>
27516<refsect1>
27517 <title>Arguments</title>
27518 <variablelist>
27519  <varlistentry>
27520   <term><parameter>info</parameter></term>
27521   <listitem>
27522    <para>
27523     UIO device capabilities
27524    </para>
27525   </listitem>
27526  </varlistentry>
27527 </variablelist>
27528</refsect1>
27529</refentry>
27530
27531<!-- include/linux/uio_driver.h -->
27532<refentry id="API-struct-uio-mem">
27533<refentryinfo>
27534 <title>LINUX</title>
27535 <productname>Kernel Hackers Manual</productname>
27536 <date>July 2017</date>
27537</refentryinfo>
27538<refmeta>
27539 <refentrytitle><phrase>struct uio_mem</phrase></refentrytitle>
27540 <manvolnum>9</manvolnum>
27541 <refmiscinfo class="version">4.1.27</refmiscinfo>
27542</refmeta>
27543<refnamediv>
27544 <refname>struct uio_mem</refname>
27545 <refpurpose>
27546  description of a UIO memory region
27547 </refpurpose>
27548</refnamediv>
27549<refsynopsisdiv>
27550 <title>Synopsis</title>
27551  <programlisting>
27552struct uio_mem {
27553  const char * name;
27554  phys_addr_t addr;
27555  resource_size_t size;
27556  int memtype;
27557  void __iomem * internal_addr;
27558  struct uio_map * map;
27559};  </programlisting>
27560</refsynopsisdiv>
27561 <refsect1>
27562  <title>Members</title>
27563  <variablelist>
27564    <varlistentry>      <term>name</term>
27565      <listitem><para>
27566name of the memory region for identification
27567      </para></listitem>
27568    </varlistentry>
27569    <varlistentry>      <term>addr</term>
27570      <listitem><para>
27571address of the device's memory (phys_addr is used since
27572addr can be logical, virtual, or physical &amp; phys_addr_t
27573should always be large enough to handle any of the
27574address types)
27575      </para></listitem>
27576    </varlistentry>
27577    <varlistentry>      <term>size</term>
27578      <listitem><para>
27579size of IO
27580      </para></listitem>
27581    </varlistentry>
27582    <varlistentry>      <term>memtype</term>
27583      <listitem><para>
27584type of memory addr points to
27585      </para></listitem>
27586    </varlistentry>
27587    <varlistentry>      <term>internal_addr</term>
27588      <listitem><para>
27589ioremap-ped version of addr, for driver internal use
27590      </para></listitem>
27591    </varlistentry>
27592    <varlistentry>      <term>map</term>
27593      <listitem><para>
27594for use by the UIO core only.
27595      </para></listitem>
27596    </varlistentry>
27597  </variablelist>
27598 </refsect1>
27599</refentry>
27600
27601<refentry id="API-struct-uio-port">
27602<refentryinfo>
27603 <title>LINUX</title>
27604 <productname>Kernel Hackers Manual</productname>
27605 <date>July 2017</date>
27606</refentryinfo>
27607<refmeta>
27608 <refentrytitle><phrase>struct uio_port</phrase></refentrytitle>
27609 <manvolnum>9</manvolnum>
27610 <refmiscinfo class="version">4.1.27</refmiscinfo>
27611</refmeta>
27612<refnamediv>
27613 <refname>struct uio_port</refname>
27614 <refpurpose>
27615     description of a UIO port region
27616 </refpurpose>
27617</refnamediv>
27618<refsynopsisdiv>
27619 <title>Synopsis</title>
27620  <programlisting>
27621struct uio_port {
27622  const char * name;
27623  unsigned long start;
27624  unsigned long size;
27625  int porttype;
27626  struct uio_portio * portio;
27627};  </programlisting>
27628</refsynopsisdiv>
27629 <refsect1>
27630  <title>Members</title>
27631  <variablelist>
27632    <varlistentry>      <term>name</term>
27633      <listitem><para>
27634   name of the port region for identification
27635      </para></listitem>
27636    </varlistentry>
27637    <varlistentry>      <term>start</term>
27638      <listitem><para>
27639   start of port region
27640      </para></listitem>
27641    </varlistentry>
27642    <varlistentry>      <term>size</term>
27643      <listitem><para>
27644   size of port region
27645      </para></listitem>
27646    </varlistentry>
27647    <varlistentry>      <term>porttype</term>
27648      <listitem><para>
27649   type of port (see UIO_PORT_* below)
27650      </para></listitem>
27651    </varlistentry>
27652    <varlistentry>      <term>portio</term>
27653      <listitem><para>
27654   for use by the UIO core only.
27655      </para></listitem>
27656    </varlistentry>
27657  </variablelist>
27658 </refsect1>
27659</refentry>
27660
27661<refentry id="API-struct-uio-info">
27662<refentryinfo>
27663 <title>LINUX</title>
27664 <productname>Kernel Hackers Manual</productname>
27665 <date>July 2017</date>
27666</refentryinfo>
27667<refmeta>
27668 <refentrytitle><phrase>struct uio_info</phrase></refentrytitle>
27669 <manvolnum>9</manvolnum>
27670 <refmiscinfo class="version">4.1.27</refmiscinfo>
27671</refmeta>
27672<refnamediv>
27673 <refname>struct uio_info</refname>
27674 <refpurpose>
27675     UIO device capabilities
27676 </refpurpose>
27677</refnamediv>
27678<refsynopsisdiv>
27679 <title>Synopsis</title>
27680  <programlisting>
27681struct uio_info {
27682  struct uio_device * uio_dev;
27683  const char * name;
27684  const char * version;
27685  struct uio_mem mem[MAX_UIO_MAPS];
27686  struct uio_port port[MAX_UIO_PORT_REGIONS];
27687  long irq;
27688  unsigned long irq_flags;
27689  void * priv;
27690  irqreturn_t (* handler) (int irq, struct uio_info *dev_info);
27691  int (* mmap) (struct uio_info *info, struct vm_area_struct *vma);
27692  int (* open) (struct uio_info *info, struct inode *inode);
27693  int (* release) (struct uio_info *info, struct inode *inode);
27694  int (* irqcontrol) (struct uio_info *info, s32 irq_on);
27695};  </programlisting>
27696</refsynopsisdiv>
27697 <refsect1>
27698  <title>Members</title>
27699  <variablelist>
27700    <varlistentry>      <term>uio_dev</term>
27701      <listitem><para>
27702   the UIO device this info belongs to
27703      </para></listitem>
27704    </varlistentry>
27705    <varlistentry>      <term>name</term>
27706      <listitem><para>
27707   device name
27708      </para></listitem>
27709    </varlistentry>
27710    <varlistentry>      <term>version</term>
27711      <listitem><para>
27712   device driver version
27713      </para></listitem>
27714    </varlistentry>
27715    <varlistentry>      <term>mem[MAX_UIO_MAPS]</term>
27716      <listitem><para>
27717   list of mappable memory regions, size==0 for end of list
27718      </para></listitem>
27719    </varlistentry>
27720    <varlistentry>      <term>port[MAX_UIO_PORT_REGIONS]</term>
27721      <listitem><para>
27722   list of port regions, size==0 for end of list
27723      </para></listitem>
27724    </varlistentry>
27725    <varlistentry>      <term>irq</term>
27726      <listitem><para>
27727   interrupt number or UIO_IRQ_CUSTOM
27728      </para></listitem>
27729    </varlistentry>
27730    <varlistentry>      <term>irq_flags</term>
27731      <listitem><para>
27732   flags for <function>request_irq</function>
27733      </para></listitem>
27734    </varlistentry>
27735    <varlistentry>      <term>priv</term>
27736      <listitem><para>
27737   optional private data
27738      </para></listitem>
27739    </varlistentry>
27740    <varlistentry>      <term>handler</term>
27741      <listitem><para>
27742   the device's irq handler
27743      </para></listitem>
27744    </varlistentry>
27745    <varlistentry>      <term>mmap</term>
27746      <listitem><para>
27747   mmap operation for this uio device
27748      </para></listitem>
27749    </varlistentry>
27750    <varlistentry>      <term>open</term>
27751      <listitem><para>
27752   open operation for this uio device
27753      </para></listitem>
27754    </varlistentry>
27755    <varlistentry>      <term>release</term>
27756      <listitem><para>
27757   release operation for this uio device
27758      </para></listitem>
27759    </varlistentry>
27760    <varlistentry>      <term>irqcontrol</term>
27761      <listitem><para>
27762   disable/enable irqs when 0/1 is written to /dev/uioX
27763      </para></listitem>
27764    </varlistentry>
27765  </variablelist>
27766 </refsect1>
27767</refentry>
27768
27769     </sect1>
27770  </chapter>
27771
27772  <chapter id="parportdev">
27773     <title>Parallel Port Devices</title>
27774<!-- include/linux/parport.h -->
27775<refentry id="API-parport-yield">
27776<refentryinfo>
27777 <title>LINUX</title>
27778 <productname>Kernel Hackers Manual</productname>
27779 <date>July 2017</date>
27780</refentryinfo>
27781<refmeta>
27782 <refentrytitle><phrase>parport_yield</phrase></refentrytitle>
27783 <manvolnum>9</manvolnum>
27784 <refmiscinfo class="version">4.1.27</refmiscinfo>
27785</refmeta>
27786<refnamediv>
27787 <refname>parport_yield</refname>
27788 <refpurpose>
27789  relinquish a parallel port temporarily
27790 </refpurpose>
27791</refnamediv>
27792<refsynopsisdiv>
27793 <title>Synopsis</title>
27794  <funcsynopsis><funcprototype>
27795   <funcdef>int <function>parport_yield </function></funcdef>
27796   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
27797  </funcprototype></funcsynopsis>
27798</refsynopsisdiv>
27799<refsect1>
27800 <title>Arguments</title>
27801 <variablelist>
27802  <varlistentry>
27803   <term><parameter>dev</parameter></term>
27804   <listitem>
27805    <para>
27806     a device on the parallel port
27807    </para>
27808   </listitem>
27809  </varlistentry>
27810 </variablelist>
27811</refsect1>
27812<refsect1>
27813<title>Description</title>
27814<para>
27815   This function relinquishes the port if it would be helpful to other
27816   drivers to do so.  Afterwards it tries to reclaim the port using
27817   <function>parport_claim</function>, and the return value is the same as for
27818   <function>parport_claim</function>.  If it fails, the port is left unclaimed and it is
27819   the driver's responsibility to reclaim the port.
27820   </para><para>
27821
27822   The <function>parport_yield</function> and <function>parport_yield_blocking</function> functions are for
27823   marking points in the driver at which other drivers may claim the
27824   port and use their devices.  Yielding the port is similar to
27825   releasing it and reclaiming it, but is more efficient because no
27826   action is taken if there are no other devices needing the port.  In
27827   fact, nothing is done even if there are other devices waiting but
27828   the current device is still within its <quote>timeslice</quote>.  The default
27829   timeslice is half a second, but it can be adjusted via the /proc
27830   interface.
27831</para>
27832</refsect1>
27833</refentry>
27834
27835<refentry id="API-parport-yield-blocking">
27836<refentryinfo>
27837 <title>LINUX</title>
27838 <productname>Kernel Hackers Manual</productname>
27839 <date>July 2017</date>
27840</refentryinfo>
27841<refmeta>
27842 <refentrytitle><phrase>parport_yield_blocking</phrase></refentrytitle>
27843 <manvolnum>9</manvolnum>
27844 <refmiscinfo class="version">4.1.27</refmiscinfo>
27845</refmeta>
27846<refnamediv>
27847 <refname>parport_yield_blocking</refname>
27848 <refpurpose>
27849     relinquish a parallel port temporarily
27850 </refpurpose>
27851</refnamediv>
27852<refsynopsisdiv>
27853 <title>Synopsis</title>
27854  <funcsynopsis><funcprototype>
27855   <funcdef>int <function>parport_yield_blocking </function></funcdef>
27856   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
27857  </funcprototype></funcsynopsis>
27858</refsynopsisdiv>
27859<refsect1>
27860 <title>Arguments</title>
27861 <variablelist>
27862  <varlistentry>
27863   <term><parameter>dev</parameter></term>
27864   <listitem>
27865    <para>
27866     a device on the parallel port
27867    </para>
27868   </listitem>
27869  </varlistentry>
27870 </variablelist>
27871</refsect1>
27872<refsect1>
27873<title>Description</title>
27874<para>
27875   This function relinquishes the port if it would be helpful to other
27876   drivers to do so.  Afterwards it tries to reclaim the port using
27877   <function>parport_claim_or_block</function>, and the return value is the same as for
27878   <function>parport_claim_or_block</function>.
27879</para>
27880</refsect1>
27881</refentry>
27882
27883<!-- drivers/parport/ieee1284.c -->
27884<refentry id="API-parport-wait-event">
27885<refentryinfo>
27886 <title>LINUX</title>
27887 <productname>Kernel Hackers Manual</productname>
27888 <date>July 2017</date>
27889</refentryinfo>
27890<refmeta>
27891 <refentrytitle><phrase>parport_wait_event</phrase></refentrytitle>
27892 <manvolnum>9</manvolnum>
27893 <refmiscinfo class="version">4.1.27</refmiscinfo>
27894</refmeta>
27895<refnamediv>
27896 <refname>parport_wait_event</refname>
27897 <refpurpose>
27898  wait for an event on a parallel port
27899 </refpurpose>
27900</refnamediv>
27901<refsynopsisdiv>
27902 <title>Synopsis</title>
27903  <funcsynopsis><funcprototype>
27904   <funcdef>int <function>parport_wait_event </function></funcdef>
27905   <paramdef>struct parport * <parameter>port</parameter></paramdef>
27906   <paramdef>signed long <parameter>timeout</parameter></paramdef>
27907  </funcprototype></funcsynopsis>
27908</refsynopsisdiv>
27909<refsect1>
27910 <title>Arguments</title>
27911 <variablelist>
27912  <varlistentry>
27913   <term><parameter>port</parameter></term>
27914   <listitem>
27915    <para>
27916     port to wait on
27917    </para>
27918   </listitem>
27919  </varlistentry>
27920  <varlistentry>
27921   <term><parameter>timeout</parameter></term>
27922   <listitem>
27923    <para>
27924     time to wait (in jiffies)
27925    </para>
27926   </listitem>
27927  </varlistentry>
27928 </variablelist>
27929</refsect1>
27930<refsect1>
27931<title>Description</title>
27932<para>
27933   This function waits for up to <parameter>timeout</parameter> jiffies for an
27934   interrupt to occur on a parallel port.  If the port timeout is
27935   set to zero, it returns immediately.
27936   </para><para>
27937
27938   If an interrupt occurs before the timeout period elapses, this
27939   function returns zero immediately.  If it times out, it returns
27940   one.  An error code less than zero indicates an error (most
27941   likely a pending signal), and the calling code should finish
27942   what it's doing as soon as it can.
27943</para>
27944</refsect1>
27945</refentry>
27946
27947<refentry id="API-parport-wait-peripheral">
27948<refentryinfo>
27949 <title>LINUX</title>
27950 <productname>Kernel Hackers Manual</productname>
27951 <date>July 2017</date>
27952</refentryinfo>
27953<refmeta>
27954 <refentrytitle><phrase>parport_wait_peripheral</phrase></refentrytitle>
27955 <manvolnum>9</manvolnum>
27956 <refmiscinfo class="version">4.1.27</refmiscinfo>
27957</refmeta>
27958<refnamediv>
27959 <refname>parport_wait_peripheral</refname>
27960 <refpurpose>
27961     wait for status lines to change in 35ms
27962 </refpurpose>
27963</refnamediv>
27964<refsynopsisdiv>
27965 <title>Synopsis</title>
27966  <funcsynopsis><funcprototype>
27967   <funcdef>int <function>parport_wait_peripheral </function></funcdef>
27968   <paramdef>struct parport * <parameter>port</parameter></paramdef>
27969   <paramdef>unsigned char <parameter>mask</parameter></paramdef>
27970   <paramdef>unsigned char <parameter>result</parameter></paramdef>
27971  </funcprototype></funcsynopsis>
27972</refsynopsisdiv>
27973<refsect1>
27974 <title>Arguments</title>
27975 <variablelist>
27976  <varlistentry>
27977   <term><parameter>port</parameter></term>
27978   <listitem>
27979    <para>
27980     port to watch
27981    </para>
27982   </listitem>
27983  </varlistentry>
27984  <varlistentry>
27985   <term><parameter>mask</parameter></term>
27986   <listitem>
27987    <para>
27988     status lines to watch
27989    </para>
27990   </listitem>
27991  </varlistentry>
27992  <varlistentry>
27993   <term><parameter>result</parameter></term>
27994   <listitem>
27995    <para>
27996     desired values of chosen status lines
27997    </para>
27998   </listitem>
27999  </varlistentry>
28000 </variablelist>
28001</refsect1>
28002<refsect1>
28003<title>Description</title>
28004<para>
28005   This function waits until the masked status lines have the
28006   desired values, or until 35ms have elapsed (see IEEE 1284-1994
28007   page 24 to 25 for why this value in particular is hardcoded).
28008   The <parameter>mask</parameter> and <parameter>result</parameter> parameters are bitmasks, with the bits
28009   defined by the constants in parport.h: <constant>PARPORT_STATUS_BUSY</constant>,
28010   and so on.
28011   </para><para>
28012
28013   The port is polled quickly to start off with, in anticipation
28014   of a fast response from the peripheral.  This fast polling
28015   time is configurable (using /proc), and defaults to 500usec.
28016   If the timeout for this port (see <function>parport_set_timeout</function>) is
28017   zero, the fast polling time is 35ms, and this function does
28018   not call <function>schedule</function>.
28019   </para><para>
28020
28021   If the timeout for this port is non-zero, after the fast
28022   polling fails it uses <function>parport_wait_event</function> to wait for up to
28023   10ms, waking up if an interrupt occurs.
28024</para>
28025</refsect1>
28026</refentry>
28027
28028<refentry id="API-parport-negotiate">
28029<refentryinfo>
28030 <title>LINUX</title>
28031 <productname>Kernel Hackers Manual</productname>
28032 <date>July 2017</date>
28033</refentryinfo>
28034<refmeta>
28035 <refentrytitle><phrase>parport_negotiate</phrase></refentrytitle>
28036 <manvolnum>9</manvolnum>
28037 <refmiscinfo class="version">4.1.27</refmiscinfo>
28038</refmeta>
28039<refnamediv>
28040 <refname>parport_negotiate</refname>
28041 <refpurpose>
28042     negotiate an IEEE 1284 mode
28043 </refpurpose>
28044</refnamediv>
28045<refsynopsisdiv>
28046 <title>Synopsis</title>
28047  <funcsynopsis><funcprototype>
28048   <funcdef>int <function>parport_negotiate </function></funcdef>
28049   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28050   <paramdef>int <parameter>mode</parameter></paramdef>
28051  </funcprototype></funcsynopsis>
28052</refsynopsisdiv>
28053<refsect1>
28054 <title>Arguments</title>
28055 <variablelist>
28056  <varlistentry>
28057   <term><parameter>port</parameter></term>
28058   <listitem>
28059    <para>
28060     port to use
28061    </para>
28062   </listitem>
28063  </varlistentry>
28064  <varlistentry>
28065   <term><parameter>mode</parameter></term>
28066   <listitem>
28067    <para>
28068     mode to negotiate to
28069    </para>
28070   </listitem>
28071  </varlistentry>
28072 </variablelist>
28073</refsect1>
28074<refsect1>
28075<title>Description</title>
28076<para>
28077   Use this to negotiate to a particular IEEE 1284 transfer mode.
28078   The <parameter>mode</parameter> parameter should be one of the constants in
28079   parport.h starting <constant>IEEE1284_MODE_xxx</constant>.
28080   </para><para>
28081
28082   The return value is 0 if the peripheral has accepted the
28083   negotiation to the mode specified, -1 if the peripheral is not
28084   IEEE 1284 compliant (or not present), or 1 if the peripheral
28085   has rejected the negotiation.
28086</para>
28087</refsect1>
28088</refentry>
28089
28090<refentry id="API-parport-write">
28091<refentryinfo>
28092 <title>LINUX</title>
28093 <productname>Kernel Hackers Manual</productname>
28094 <date>July 2017</date>
28095</refentryinfo>
28096<refmeta>
28097 <refentrytitle><phrase>parport_write</phrase></refentrytitle>
28098 <manvolnum>9</manvolnum>
28099 <refmiscinfo class="version">4.1.27</refmiscinfo>
28100</refmeta>
28101<refnamediv>
28102 <refname>parport_write</refname>
28103 <refpurpose>
28104     write a block of data to a parallel port
28105 </refpurpose>
28106</refnamediv>
28107<refsynopsisdiv>
28108 <title>Synopsis</title>
28109  <funcsynopsis><funcprototype>
28110   <funcdef>ssize_t <function>parport_write </function></funcdef>
28111   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28112   <paramdef>const void * <parameter>buffer</parameter></paramdef>
28113   <paramdef>size_t <parameter>len</parameter></paramdef>
28114  </funcprototype></funcsynopsis>
28115</refsynopsisdiv>
28116<refsect1>
28117 <title>Arguments</title>
28118 <variablelist>
28119  <varlistentry>
28120   <term><parameter>port</parameter></term>
28121   <listitem>
28122    <para>
28123     port to write to
28124    </para>
28125   </listitem>
28126  </varlistentry>
28127  <varlistentry>
28128   <term><parameter>buffer</parameter></term>
28129   <listitem>
28130    <para>
28131     data buffer (in kernel space)
28132    </para>
28133   </listitem>
28134  </varlistentry>
28135  <varlistentry>
28136   <term><parameter>len</parameter></term>
28137   <listitem>
28138    <para>
28139     number of bytes of data to transfer
28140    </para>
28141   </listitem>
28142  </varlistentry>
28143 </variablelist>
28144</refsect1>
28145<refsect1>
28146<title>Description</title>
28147<para>
28148   This will write up to <parameter>len</parameter> bytes of <parameter>buffer</parameter> to the port
28149   specified, using the IEEE 1284 transfer mode most recently
28150   negotiated to (using <function>parport_negotiate</function>), as long as that
28151   mode supports forward transfers (host to peripheral).
28152   </para><para>
28153
28154   It is the caller's responsibility to ensure that the first
28155   <parameter>len</parameter> bytes of <parameter>buffer</parameter> are valid.
28156   </para><para>
28157
28158   This function returns the number of bytes transferred (if zero
28159   or positive), or else an error code.
28160</para>
28161</refsect1>
28162</refentry>
28163
28164<refentry id="API-parport-read">
28165<refentryinfo>
28166 <title>LINUX</title>
28167 <productname>Kernel Hackers Manual</productname>
28168 <date>July 2017</date>
28169</refentryinfo>
28170<refmeta>
28171 <refentrytitle><phrase>parport_read</phrase></refentrytitle>
28172 <manvolnum>9</manvolnum>
28173 <refmiscinfo class="version">4.1.27</refmiscinfo>
28174</refmeta>
28175<refnamediv>
28176 <refname>parport_read</refname>
28177 <refpurpose>
28178     read a block of data from a parallel port
28179 </refpurpose>
28180</refnamediv>
28181<refsynopsisdiv>
28182 <title>Synopsis</title>
28183  <funcsynopsis><funcprototype>
28184   <funcdef>ssize_t <function>parport_read </function></funcdef>
28185   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28186   <paramdef>void * <parameter>buffer</parameter></paramdef>
28187   <paramdef>size_t <parameter>len</parameter></paramdef>
28188  </funcprototype></funcsynopsis>
28189</refsynopsisdiv>
28190<refsect1>
28191 <title>Arguments</title>
28192 <variablelist>
28193  <varlistentry>
28194   <term><parameter>port</parameter></term>
28195   <listitem>
28196    <para>
28197     port to read from
28198    </para>
28199   </listitem>
28200  </varlistentry>
28201  <varlistentry>
28202   <term><parameter>buffer</parameter></term>
28203   <listitem>
28204    <para>
28205     data buffer (in kernel space)
28206    </para>
28207   </listitem>
28208  </varlistentry>
28209  <varlistentry>
28210   <term><parameter>len</parameter></term>
28211   <listitem>
28212    <para>
28213     number of bytes of data to transfer
28214    </para>
28215   </listitem>
28216  </varlistentry>
28217 </variablelist>
28218</refsect1>
28219<refsect1>
28220<title>Description</title>
28221<para>
28222   This will read up to <parameter>len</parameter> bytes of <parameter>buffer</parameter> to the port
28223   specified, using the IEEE 1284 transfer mode most recently
28224   negotiated to (using <function>parport_negotiate</function>), as long as that
28225   mode supports reverse transfers (peripheral to host).
28226   </para><para>
28227
28228   It is the caller's responsibility to ensure that the first
28229   <parameter>len</parameter> bytes of <parameter>buffer</parameter> are available to write to.
28230   </para><para>
28231
28232   This function returns the number of bytes transferred (if zero
28233   or positive), or else an error code.
28234</para>
28235</refsect1>
28236</refentry>
28237
28238<refentry id="API-parport-set-timeout">
28239<refentryinfo>
28240 <title>LINUX</title>
28241 <productname>Kernel Hackers Manual</productname>
28242 <date>July 2017</date>
28243</refentryinfo>
28244<refmeta>
28245 <refentrytitle><phrase>parport_set_timeout</phrase></refentrytitle>
28246 <manvolnum>9</manvolnum>
28247 <refmiscinfo class="version">4.1.27</refmiscinfo>
28248</refmeta>
28249<refnamediv>
28250 <refname>parport_set_timeout</refname>
28251 <refpurpose>
28252     set the inactivity timeout for a device
28253 </refpurpose>
28254</refnamediv>
28255<refsynopsisdiv>
28256 <title>Synopsis</title>
28257  <funcsynopsis><funcprototype>
28258   <funcdef>long <function>parport_set_timeout </function></funcdef>
28259   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
28260   <paramdef>long <parameter>inactivity</parameter></paramdef>
28261  </funcprototype></funcsynopsis>
28262</refsynopsisdiv>
28263<refsect1>
28264 <title>Arguments</title>
28265 <variablelist>
28266  <varlistentry>
28267   <term><parameter>dev</parameter></term>
28268   <listitem>
28269    <para>
28270     device on a port
28271    </para>
28272   </listitem>
28273  </varlistentry>
28274  <varlistentry>
28275   <term><parameter>inactivity</parameter></term>
28276   <listitem>
28277    <para>
28278     inactivity timeout (in jiffies)
28279    </para>
28280   </listitem>
28281  </varlistentry>
28282 </variablelist>
28283</refsect1>
28284<refsect1>
28285<title>Description</title>
28286<para>
28287   This sets the inactivity timeout for a particular device on a
28288   port.  This affects functions like <function>parport_wait_peripheral</function>.
28289   The special value 0 means not to call <function>schedule</function> while dealing
28290   with this device.
28291   </para><para>
28292
28293   The return value is the previous inactivity timeout.
28294   </para><para>
28295
28296   Any callers of <function>parport_wait_event</function> for this device are woken
28297   up.
28298</para>
28299</refsect1>
28300</refentry>
28301
28302<!-- drivers/parport/share.c -->
28303<refentry id="API-parport-register-driver">
28304<refentryinfo>
28305 <title>LINUX</title>
28306 <productname>Kernel Hackers Manual</productname>
28307 <date>July 2017</date>
28308</refentryinfo>
28309<refmeta>
28310 <refentrytitle><phrase>parport_register_driver</phrase></refentrytitle>
28311 <manvolnum>9</manvolnum>
28312 <refmiscinfo class="version">4.1.27</refmiscinfo>
28313</refmeta>
28314<refnamediv>
28315 <refname>parport_register_driver</refname>
28316 <refpurpose>
28317  register a parallel port device driver
28318 </refpurpose>
28319</refnamediv>
28320<refsynopsisdiv>
28321 <title>Synopsis</title>
28322  <funcsynopsis><funcprototype>
28323   <funcdef>int <function>parport_register_driver </function></funcdef>
28324   <paramdef>struct parport_driver * <parameter>drv</parameter></paramdef>
28325  </funcprototype></funcsynopsis>
28326</refsynopsisdiv>
28327<refsect1>
28328 <title>Arguments</title>
28329 <variablelist>
28330  <varlistentry>
28331   <term><parameter>drv</parameter></term>
28332   <listitem>
28333    <para>
28334     structure describing the driver
28335    </para>
28336   </listitem>
28337  </varlistentry>
28338 </variablelist>
28339</refsect1>
28340<refsect1>
28341<title>Description</title>
28342<para>
28343   This can be called by a parallel port device driver in order
28344   to receive notifications about ports being found in the
28345   system, as well as ports no longer available.
28346   </para><para>
28347
28348   The <parameter>drv</parameter> structure is allocated by the caller and must not be
28349   deallocated until after calling <function>parport_unregister_driver</function>.
28350   </para><para>
28351
28352   The driver's <function>attach</function> function may block.  The port that
28353   <function>attach</function> is given will be valid for the duration of the
28354   callback, but if the driver wants to take a copy of the
28355   pointer it must call <function>parport_get_port</function> to do so.  Calling
28356   <function>parport_register_device</function> on that port will do this for you.
28357   </para><para>
28358
28359   The driver's <function>detach</function> function may block.  The port that
28360   <function>detach</function> is given will be valid for the duration of the
28361   callback, but if the driver wants to take a copy of the
28362   pointer it must call <function>parport_get_port</function> to do so.
28363   </para><para>
28364
28365   Returns 0 on success.  Currently it always succeeds.
28366</para>
28367</refsect1>
28368</refentry>
28369
28370<refentry id="API-parport-unregister-driver">
28371<refentryinfo>
28372 <title>LINUX</title>
28373 <productname>Kernel Hackers Manual</productname>
28374 <date>July 2017</date>
28375</refentryinfo>
28376<refmeta>
28377 <refentrytitle><phrase>parport_unregister_driver</phrase></refentrytitle>
28378 <manvolnum>9</manvolnum>
28379 <refmiscinfo class="version">4.1.27</refmiscinfo>
28380</refmeta>
28381<refnamediv>
28382 <refname>parport_unregister_driver</refname>
28383 <refpurpose>
28384     deregister a parallel port device driver
28385 </refpurpose>
28386</refnamediv>
28387<refsynopsisdiv>
28388 <title>Synopsis</title>
28389  <funcsynopsis><funcprototype>
28390   <funcdef>void <function>parport_unregister_driver </function></funcdef>
28391   <paramdef>struct parport_driver * <parameter>drv</parameter></paramdef>
28392  </funcprototype></funcsynopsis>
28393</refsynopsisdiv>
28394<refsect1>
28395 <title>Arguments</title>
28396 <variablelist>
28397  <varlistentry>
28398   <term><parameter>drv</parameter></term>
28399   <listitem>
28400    <para>
28401     structure describing the driver that was given to
28402     <function>parport_register_driver</function>
28403    </para>
28404   </listitem>
28405  </varlistentry>
28406 </variablelist>
28407</refsect1>
28408<refsect1>
28409<title>Description</title>
28410<para>
28411   This should be called by a parallel port device driver that
28412   has registered itself using <function>parport_register_driver</function> when it
28413   is about to be unloaded.
28414   </para><para>
28415
28416   When it returns, the driver's <function>attach</function> routine will no longer
28417   be called, and for each port that <function>attach</function> was called for, the
28418   <function>detach</function> routine will have been called.
28419   </para><para>
28420
28421   All the driver's <function>attach</function> and <function>detach</function> calls are guaranteed to have
28422   finished by the time this function returns.
28423</para>
28424</refsect1>
28425</refentry>
28426
28427<refentry id="API-parport-get-port">
28428<refentryinfo>
28429 <title>LINUX</title>
28430 <productname>Kernel Hackers Manual</productname>
28431 <date>July 2017</date>
28432</refentryinfo>
28433<refmeta>
28434 <refentrytitle><phrase>parport_get_port</phrase></refentrytitle>
28435 <manvolnum>9</manvolnum>
28436 <refmiscinfo class="version">4.1.27</refmiscinfo>
28437</refmeta>
28438<refnamediv>
28439 <refname>parport_get_port</refname>
28440 <refpurpose>
28441     increment a port's reference count
28442 </refpurpose>
28443</refnamediv>
28444<refsynopsisdiv>
28445 <title>Synopsis</title>
28446  <funcsynopsis><funcprototype>
28447   <funcdef>struct parport * <function>parport_get_port </function></funcdef>
28448   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28449  </funcprototype></funcsynopsis>
28450</refsynopsisdiv>
28451<refsect1>
28452 <title>Arguments</title>
28453 <variablelist>
28454  <varlistentry>
28455   <term><parameter>port</parameter></term>
28456   <listitem>
28457    <para>
28458     the port
28459    </para>
28460   </listitem>
28461  </varlistentry>
28462 </variablelist>
28463</refsect1>
28464<refsect1>
28465<title>Description</title>
28466<para>
28467   This ensures that a struct parport pointer remains valid
28468   until the matching <function>parport_put_port</function> call.
28469</para>
28470</refsect1>
28471</refentry>
28472
28473<refentry id="API-parport-put-port">
28474<refentryinfo>
28475 <title>LINUX</title>
28476 <productname>Kernel Hackers Manual</productname>
28477 <date>July 2017</date>
28478</refentryinfo>
28479<refmeta>
28480 <refentrytitle><phrase>parport_put_port</phrase></refentrytitle>
28481 <manvolnum>9</manvolnum>
28482 <refmiscinfo class="version">4.1.27</refmiscinfo>
28483</refmeta>
28484<refnamediv>
28485 <refname>parport_put_port</refname>
28486 <refpurpose>
28487     decrement a port's reference count
28488 </refpurpose>
28489</refnamediv>
28490<refsynopsisdiv>
28491 <title>Synopsis</title>
28492  <funcsynopsis><funcprototype>
28493   <funcdef>void <function>parport_put_port </function></funcdef>
28494   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28495  </funcprototype></funcsynopsis>
28496</refsynopsisdiv>
28497<refsect1>
28498 <title>Arguments</title>
28499 <variablelist>
28500  <varlistentry>
28501   <term><parameter>port</parameter></term>
28502   <listitem>
28503    <para>
28504     the port
28505    </para>
28506   </listitem>
28507  </varlistentry>
28508 </variablelist>
28509</refsect1>
28510<refsect1>
28511<title>Description</title>
28512<para>
28513   This should be called once for each call to <function>parport_get_port</function>,
28514   once the port is no longer needed.
28515</para>
28516</refsect1>
28517</refentry>
28518
28519<refentry id="API-parport-register-port">
28520<refentryinfo>
28521 <title>LINUX</title>
28522 <productname>Kernel Hackers Manual</productname>
28523 <date>July 2017</date>
28524</refentryinfo>
28525<refmeta>
28526 <refentrytitle><phrase>parport_register_port</phrase></refentrytitle>
28527 <manvolnum>9</manvolnum>
28528 <refmiscinfo class="version">4.1.27</refmiscinfo>
28529</refmeta>
28530<refnamediv>
28531 <refname>parport_register_port</refname>
28532 <refpurpose>
28533     register a parallel port
28534 </refpurpose>
28535</refnamediv>
28536<refsynopsisdiv>
28537 <title>Synopsis</title>
28538  <funcsynopsis><funcprototype>
28539   <funcdef>struct parport * <function>parport_register_port </function></funcdef>
28540   <paramdef>unsigned long <parameter>base</parameter></paramdef>
28541   <paramdef>int <parameter>irq</parameter></paramdef>
28542   <paramdef>int <parameter>dma</parameter></paramdef>
28543   <paramdef>struct parport_operations * <parameter>ops</parameter></paramdef>
28544  </funcprototype></funcsynopsis>
28545</refsynopsisdiv>
28546<refsect1>
28547 <title>Arguments</title>
28548 <variablelist>
28549  <varlistentry>
28550   <term><parameter>base</parameter></term>
28551   <listitem>
28552    <para>
28553     base I/O address
28554    </para>
28555   </listitem>
28556  </varlistentry>
28557  <varlistentry>
28558   <term><parameter>irq</parameter></term>
28559   <listitem>
28560    <para>
28561     IRQ line
28562    </para>
28563   </listitem>
28564  </varlistentry>
28565  <varlistentry>
28566   <term><parameter>dma</parameter></term>
28567   <listitem>
28568    <para>
28569     DMA channel
28570    </para>
28571   </listitem>
28572  </varlistentry>
28573  <varlistentry>
28574   <term><parameter>ops</parameter></term>
28575   <listitem>
28576    <para>
28577     pointer to the port driver's port operations structure
28578    </para>
28579   </listitem>
28580  </varlistentry>
28581 </variablelist>
28582</refsect1>
28583<refsect1>
28584<title>Description</title>
28585<para>
28586   When a parallel port (lowlevel) driver finds a port that
28587   should be made available to parallel port device drivers, it
28588   should call <function>parport_register_port</function>.  The <parameter>base</parameter>, <parameter>irq</parameter>, and
28589   <parameter>dma</parameter> parameters are for the convenience of port drivers, and
28590   for ports where they aren't meaningful needn't be set to
28591   anything special.  They can be altered afterwards by adjusting
28592   the relevant members of the parport structure that is returned
28593   and represents the port.  They should not be tampered with
28594   after calling parport_announce_port, however.
28595   </para><para>
28596
28597   If there are parallel port device drivers in the system that
28598   have registered themselves using <function>parport_register_driver</function>,
28599   they are not told about the port at this time; that is done by
28600   <function>parport_announce_port</function>.
28601   </para><para>
28602
28603   The <parameter>ops</parameter> structure is allocated by the caller, and must not be
28604   deallocated before calling <function>parport_remove_port</function>.
28605   </para><para>
28606
28607   If there is no memory to allocate a new parport structure,
28608   this function will return <constant>NULL</constant>.
28609</para>
28610</refsect1>
28611</refentry>
28612
28613<refentry id="API-parport-announce-port">
28614<refentryinfo>
28615 <title>LINUX</title>
28616 <productname>Kernel Hackers Manual</productname>
28617 <date>July 2017</date>
28618</refentryinfo>
28619<refmeta>
28620 <refentrytitle><phrase>parport_announce_port</phrase></refentrytitle>
28621 <manvolnum>9</manvolnum>
28622 <refmiscinfo class="version">4.1.27</refmiscinfo>
28623</refmeta>
28624<refnamediv>
28625 <refname>parport_announce_port</refname>
28626 <refpurpose>
28627     tell device drivers about a parallel port
28628 </refpurpose>
28629</refnamediv>
28630<refsynopsisdiv>
28631 <title>Synopsis</title>
28632  <funcsynopsis><funcprototype>
28633   <funcdef>void <function>parport_announce_port </function></funcdef>
28634   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28635  </funcprototype></funcsynopsis>
28636</refsynopsisdiv>
28637<refsect1>
28638 <title>Arguments</title>
28639 <variablelist>
28640  <varlistentry>
28641   <term><parameter>port</parameter></term>
28642   <listitem>
28643    <para>
28644     parallel port to announce
28645    </para>
28646   </listitem>
28647  </varlistentry>
28648 </variablelist>
28649</refsect1>
28650<refsect1>
28651<title>Description</title>
28652<para>
28653   After a port driver has registered a parallel port with
28654   parport_register_port, and performed any necessary
28655   initialisation or adjustments, it should call
28656   <function>parport_announce_port</function> in order to notify all device drivers
28657   that have called <function>parport_register_driver</function>.  Their <function>attach</function>
28658   functions will be called, with <parameter>port</parameter> as the parameter.
28659</para>
28660</refsect1>
28661</refentry>
28662
28663<refentry id="API-parport-remove-port">
28664<refentryinfo>
28665 <title>LINUX</title>
28666 <productname>Kernel Hackers Manual</productname>
28667 <date>July 2017</date>
28668</refentryinfo>
28669<refmeta>
28670 <refentrytitle><phrase>parport_remove_port</phrase></refentrytitle>
28671 <manvolnum>9</manvolnum>
28672 <refmiscinfo class="version">4.1.27</refmiscinfo>
28673</refmeta>
28674<refnamediv>
28675 <refname>parport_remove_port</refname>
28676 <refpurpose>
28677     deregister a parallel port
28678 </refpurpose>
28679</refnamediv>
28680<refsynopsisdiv>
28681 <title>Synopsis</title>
28682  <funcsynopsis><funcprototype>
28683   <funcdef>void <function>parport_remove_port </function></funcdef>
28684   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28685  </funcprototype></funcsynopsis>
28686</refsynopsisdiv>
28687<refsect1>
28688 <title>Arguments</title>
28689 <variablelist>
28690  <varlistentry>
28691   <term><parameter>port</parameter></term>
28692   <listitem>
28693    <para>
28694     parallel port to deregister
28695    </para>
28696   </listitem>
28697  </varlistentry>
28698 </variablelist>
28699</refsect1>
28700<refsect1>
28701<title>Description</title>
28702<para>
28703   When a parallel port driver is forcibly unloaded, or a
28704   parallel port becomes inaccessible, the port driver must call
28705   this function in order to deal with device drivers that still
28706   want to use it.
28707   </para><para>
28708
28709   The parport structure associated with the port has its
28710   operations structure replaced with one containing 'null'
28711   operations that return errors or just don't do anything.
28712   </para><para>
28713
28714   Any drivers that have registered themselves using
28715   <function>parport_register_driver</function> are notified that the port is no
28716   longer accessible by having their <function>detach</function> routines called
28717   with <parameter>port</parameter> as the parameter.
28718</para>
28719</refsect1>
28720</refentry>
28721
28722<refentry id="API-parport-register-device">
28723<refentryinfo>
28724 <title>LINUX</title>
28725 <productname>Kernel Hackers Manual</productname>
28726 <date>July 2017</date>
28727</refentryinfo>
28728<refmeta>
28729 <refentrytitle><phrase>parport_register_device</phrase></refentrytitle>
28730 <manvolnum>9</manvolnum>
28731 <refmiscinfo class="version">4.1.27</refmiscinfo>
28732</refmeta>
28733<refnamediv>
28734 <refname>parport_register_device</refname>
28735 <refpurpose>
28736     register a device on a parallel port
28737 </refpurpose>
28738</refnamediv>
28739<refsynopsisdiv>
28740 <title>Synopsis</title>
28741  <funcsynopsis><funcprototype>
28742   <funcdef>struct pardevice * <function>parport_register_device </function></funcdef>
28743   <paramdef>struct parport * <parameter>port</parameter></paramdef>
28744   <paramdef>const char * <parameter>name</parameter></paramdef>
28745   <paramdef>int (*<parameter>pf</parameter>)
28746     <funcparams>void *</funcparams></paramdef>
28747   <paramdef>void (*<parameter>kf</parameter>)
28748     <funcparams>void *</funcparams></paramdef>
28749   <paramdef>void (*<parameter>irq_func</parameter>)
28750     <funcparams>void *</funcparams></paramdef>
28751   <paramdef>int <parameter>flags</parameter></paramdef>
28752   <paramdef>void * <parameter>handle</parameter></paramdef>
28753  </funcprototype></funcsynopsis>
28754</refsynopsisdiv>
28755<refsect1>
28756 <title>Arguments</title>
28757 <variablelist>
28758  <varlistentry>
28759   <term><parameter>port</parameter></term>
28760   <listitem>
28761    <para>
28762     port to which the device is attached
28763    </para>
28764   </listitem>
28765  </varlistentry>
28766  <varlistentry>
28767   <term><parameter>name</parameter></term>
28768   <listitem>
28769    <para>
28770     a name to refer to the device
28771    </para>
28772   </listitem>
28773  </varlistentry>
28774  <varlistentry>
28775   <term><parameter>pf</parameter></term>
28776   <listitem>
28777    <para>
28778     preemption callback
28779    </para>
28780   </listitem>
28781  </varlistentry>
28782  <varlistentry>
28783   <term><parameter>kf</parameter></term>
28784   <listitem>
28785    <para>
28786     kick callback (wake-up)
28787    </para>
28788   </listitem>
28789  </varlistentry>
28790  <varlistentry>
28791   <term><parameter>irq_func</parameter></term>
28792   <listitem>
28793    <para>
28794     interrupt handler
28795    </para>
28796   </listitem>
28797  </varlistentry>
28798  <varlistentry>
28799   <term><parameter>flags</parameter></term>
28800   <listitem>
28801    <para>
28802     registration flags
28803    </para>
28804   </listitem>
28805  </varlistentry>
28806  <varlistentry>
28807   <term><parameter>handle</parameter></term>
28808   <listitem>
28809    <para>
28810     data for callback functions
28811    </para>
28812   </listitem>
28813  </varlistentry>
28814 </variablelist>
28815</refsect1>
28816<refsect1>
28817<title>Description</title>
28818<para>
28819   This function, called by parallel port device drivers,
28820   declares that a device is connected to a port, and tells the
28821   system all it needs to know.
28822   </para><para>
28823
28824   The <parameter>name</parameter> is allocated by the caller and must not be
28825   deallocated until the caller calls <parameter>parport_unregister_device</parameter>
28826   for that device.
28827   </para><para>
28828
28829   The preemption callback function, <parameter>pf</parameter>, is called when this
28830   device driver has claimed access to the port but another
28831   device driver wants to use it.  It is given <parameter>handle</parameter> as its
28832   parameter, and should return zero if it is willing for the
28833   system to release the port to another driver on its behalf.
28834   If it wants to keep control of the port it should return
28835   non-zero, and no action will be taken.  It is good manners for
28836   the driver to try to release the port at the earliest
28837   opportunity after its preemption callback rejects a preemption
28838   attempt.  Note that if a preemption callback is happy for
28839   preemption to go ahead, there is no need to release the port;
28840   it is done automatically.  This function may not block, as it
28841   may be called from interrupt context.  If the device driver
28842   does not support preemption, <parameter>pf</parameter> can be <constant>NULL</constant>.
28843   </para><para>
28844
28845   The wake-up (<quote>kick</quote>) callback function, <parameter>kf</parameter>, is called when
28846   the port is available to be claimed for exclusive access; that
28847   is, <function>parport_claim</function> is guaranteed to succeed when called from
28848   inside the wake-up callback function.  If the driver wants to
28849   claim the port it should do so; otherwise, it need not take
28850   any action.  This function may not block, as it may be called
28851   from interrupt context.  If the device driver does not want to
28852   be explicitly invited to claim the port in this way, <parameter>kf</parameter> can
28853   be <constant>NULL</constant>.
28854   </para><para>
28855
28856   The interrupt handler, <parameter>irq_func</parameter>, is called when an interrupt
28857   arrives from the parallel port.  Note that if a device driver
28858   wants to use interrupts it should use <function>parport_enable_irq</function>,
28859   and can also check the irq member of the parport structure
28860   representing the port.
28861   </para><para>
28862
28863   The parallel port (lowlevel) driver is the one that has called
28864   <function>request_irq</function> and whose interrupt handler is called first.
28865   This handler does whatever needs to be done to the hardware to
28866   acknowledge the interrupt (for PC-style ports there is nothing
28867   special to be done).  It then tells the IEEE 1284 code about
28868   the interrupt, which may involve reacting to an IEEE 1284
28869   event depending on the current IEEE 1284 phase.  After this,
28870   it calls <parameter>irq_func</parameter>.  Needless to say, <parameter>irq_func</parameter> will be called
28871   from interrupt context, and may not block.
28872   </para><para>
28873
28874   The <constant>PARPORT_DEV_EXCL</constant> flag is for preventing port sharing, and
28875   so should only be used when sharing the port with other device
28876   drivers is impossible and would lead to incorrect behaviour.
28877   Use it sparingly!  Normally, <parameter>flags</parameter> will be zero.
28878   </para><para>
28879
28880   This function returns a pointer to a structure that represents
28881   the device on the port, or <constant>NULL</constant> if there is not enough memory
28882   to allocate space for that structure.
28883</para>
28884</refsect1>
28885</refentry>
28886
28887<refentry id="API-parport-unregister-device">
28888<refentryinfo>
28889 <title>LINUX</title>
28890 <productname>Kernel Hackers Manual</productname>
28891 <date>July 2017</date>
28892</refentryinfo>
28893<refmeta>
28894 <refentrytitle><phrase>parport_unregister_device</phrase></refentrytitle>
28895 <manvolnum>9</manvolnum>
28896 <refmiscinfo class="version">4.1.27</refmiscinfo>
28897</refmeta>
28898<refnamediv>
28899 <refname>parport_unregister_device</refname>
28900 <refpurpose>
28901     deregister a device on a parallel port
28902 </refpurpose>
28903</refnamediv>
28904<refsynopsisdiv>
28905 <title>Synopsis</title>
28906  <funcsynopsis><funcprototype>
28907   <funcdef>void <function>parport_unregister_device </function></funcdef>
28908   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
28909  </funcprototype></funcsynopsis>
28910</refsynopsisdiv>
28911<refsect1>
28912 <title>Arguments</title>
28913 <variablelist>
28914  <varlistentry>
28915   <term><parameter>dev</parameter></term>
28916   <listitem>
28917    <para>
28918     pointer to structure representing device
28919    </para>
28920   </listitem>
28921  </varlistentry>
28922 </variablelist>
28923</refsect1>
28924<refsect1>
28925<title>Description</title>
28926<para>
28927   This undoes the effect of <function>parport_register_device</function>.
28928</para>
28929</refsect1>
28930</refentry>
28931
28932<refentry id="API-parport-find-number">
28933<refentryinfo>
28934 <title>LINUX</title>
28935 <productname>Kernel Hackers Manual</productname>
28936 <date>July 2017</date>
28937</refentryinfo>
28938<refmeta>
28939 <refentrytitle><phrase>parport_find_number</phrase></refentrytitle>
28940 <manvolnum>9</manvolnum>
28941 <refmiscinfo class="version">4.1.27</refmiscinfo>
28942</refmeta>
28943<refnamediv>
28944 <refname>parport_find_number</refname>
28945 <refpurpose>
28946     find a parallel port by number
28947 </refpurpose>
28948</refnamediv>
28949<refsynopsisdiv>
28950 <title>Synopsis</title>
28951  <funcsynopsis><funcprototype>
28952   <funcdef>struct parport * <function>parport_find_number </function></funcdef>
28953   <paramdef>int <parameter>number</parameter></paramdef>
28954  </funcprototype></funcsynopsis>
28955</refsynopsisdiv>
28956<refsect1>
28957 <title>Arguments</title>
28958 <variablelist>
28959  <varlistentry>
28960   <term><parameter>number</parameter></term>
28961   <listitem>
28962    <para>
28963     parallel port number
28964    </para>
28965   </listitem>
28966  </varlistentry>
28967 </variablelist>
28968</refsect1>
28969<refsect1>
28970<title>Description</title>
28971<para>
28972   This returns the parallel port with the specified number, or
28973   <constant>NULL</constant> if there is none.
28974   </para><para>
28975
28976   There is an implicit <function>parport_get_port</function> done already; to throw
28977   away the reference to the port that <function>parport_find_number</function>
28978   gives you, use <function>parport_put_port</function>.
28979</para>
28980</refsect1>
28981</refentry>
28982
28983<refentry id="API-parport-find-base">
28984<refentryinfo>
28985 <title>LINUX</title>
28986 <productname>Kernel Hackers Manual</productname>
28987 <date>July 2017</date>
28988</refentryinfo>
28989<refmeta>
28990 <refentrytitle><phrase>parport_find_base</phrase></refentrytitle>
28991 <manvolnum>9</manvolnum>
28992 <refmiscinfo class="version">4.1.27</refmiscinfo>
28993</refmeta>
28994<refnamediv>
28995 <refname>parport_find_base</refname>
28996 <refpurpose>
28997     find a parallel port by base address
28998 </refpurpose>
28999</refnamediv>
29000<refsynopsisdiv>
29001 <title>Synopsis</title>
29002  <funcsynopsis><funcprototype>
29003   <funcdef>struct parport * <function>parport_find_base </function></funcdef>
29004   <paramdef>unsigned long <parameter>base</parameter></paramdef>
29005  </funcprototype></funcsynopsis>
29006</refsynopsisdiv>
29007<refsect1>
29008 <title>Arguments</title>
29009 <variablelist>
29010  <varlistentry>
29011   <term><parameter>base</parameter></term>
29012   <listitem>
29013    <para>
29014     base I/O address
29015    </para>
29016   </listitem>
29017  </varlistentry>
29018 </variablelist>
29019</refsect1>
29020<refsect1>
29021<title>Description</title>
29022<para>
29023   This returns the parallel port with the specified base
29024   address, or <constant>NULL</constant> if there is none.
29025   </para><para>
29026
29027   There is an implicit <function>parport_get_port</function> done already; to throw
29028   away the reference to the port that <function>parport_find_base</function>
29029   gives you, use <function>parport_put_port</function>.
29030</para>
29031</refsect1>
29032</refentry>
29033
29034<refentry id="API-parport-claim">
29035<refentryinfo>
29036 <title>LINUX</title>
29037 <productname>Kernel Hackers Manual</productname>
29038 <date>July 2017</date>
29039</refentryinfo>
29040<refmeta>
29041 <refentrytitle><phrase>parport_claim</phrase></refentrytitle>
29042 <manvolnum>9</manvolnum>
29043 <refmiscinfo class="version">4.1.27</refmiscinfo>
29044</refmeta>
29045<refnamediv>
29046 <refname>parport_claim</refname>
29047 <refpurpose>
29048     claim access to a parallel port device
29049 </refpurpose>
29050</refnamediv>
29051<refsynopsisdiv>
29052 <title>Synopsis</title>
29053  <funcsynopsis><funcprototype>
29054   <funcdef>int <function>parport_claim </function></funcdef>
29055   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
29056  </funcprototype></funcsynopsis>
29057</refsynopsisdiv>
29058<refsect1>
29059 <title>Arguments</title>
29060 <variablelist>
29061  <varlistentry>
29062   <term><parameter>dev</parameter></term>
29063   <listitem>
29064    <para>
29065     pointer to structure representing a device on the port
29066    </para>
29067   </listitem>
29068  </varlistentry>
29069 </variablelist>
29070</refsect1>
29071<refsect1>
29072<title>Description</title>
29073<para>
29074   This function will not block and so can be used from interrupt
29075   context.  If <function>parport_claim</function> succeeds in claiming access to
29076   the port it returns zero and the port is available to use.  It
29077   may fail (returning non-zero) if the port is in use by another
29078   driver and that driver is not willing to relinquish control of
29079   the port.
29080</para>
29081</refsect1>
29082</refentry>
29083
29084<refentry id="API-parport-claim-or-block">
29085<refentryinfo>
29086 <title>LINUX</title>
29087 <productname>Kernel Hackers Manual</productname>
29088 <date>July 2017</date>
29089</refentryinfo>
29090<refmeta>
29091 <refentrytitle><phrase>parport_claim_or_block</phrase></refentrytitle>
29092 <manvolnum>9</manvolnum>
29093 <refmiscinfo class="version">4.1.27</refmiscinfo>
29094</refmeta>
29095<refnamediv>
29096 <refname>parport_claim_or_block</refname>
29097 <refpurpose>
29098     claim access to a parallel port device
29099 </refpurpose>
29100</refnamediv>
29101<refsynopsisdiv>
29102 <title>Synopsis</title>
29103  <funcsynopsis><funcprototype>
29104   <funcdef>int <function>parport_claim_or_block </function></funcdef>
29105   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
29106  </funcprototype></funcsynopsis>
29107</refsynopsisdiv>
29108<refsect1>
29109 <title>Arguments</title>
29110 <variablelist>
29111  <varlistentry>
29112   <term><parameter>dev</parameter></term>
29113   <listitem>
29114    <para>
29115     pointer to structure representing a device on the port
29116    </para>
29117   </listitem>
29118  </varlistentry>
29119 </variablelist>
29120</refsect1>
29121<refsect1>
29122<title>Description</title>
29123<para>
29124   This behaves like <function>parport_claim</function>, but will block if necessary
29125   to wait for the port to be free.  A return value of 1
29126   indicates that it slept; 0 means that it succeeded without
29127   needing to sleep.  A negative error code indicates failure.
29128</para>
29129</refsect1>
29130</refentry>
29131
29132<refentry id="API-parport-release">
29133<refentryinfo>
29134 <title>LINUX</title>
29135 <productname>Kernel Hackers Manual</productname>
29136 <date>July 2017</date>
29137</refentryinfo>
29138<refmeta>
29139 <refentrytitle><phrase>parport_release</phrase></refentrytitle>
29140 <manvolnum>9</manvolnum>
29141 <refmiscinfo class="version">4.1.27</refmiscinfo>
29142</refmeta>
29143<refnamediv>
29144 <refname>parport_release</refname>
29145 <refpurpose>
29146     give up access to a parallel port device
29147 </refpurpose>
29148</refnamediv>
29149<refsynopsisdiv>
29150 <title>Synopsis</title>
29151  <funcsynopsis><funcprototype>
29152   <funcdef>void <function>parport_release </function></funcdef>
29153   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
29154  </funcprototype></funcsynopsis>
29155</refsynopsisdiv>
29156<refsect1>
29157 <title>Arguments</title>
29158 <variablelist>
29159  <varlistentry>
29160   <term><parameter>dev</parameter></term>
29161   <listitem>
29162    <para>
29163     pointer to structure representing parallel port device
29164    </para>
29165   </listitem>
29166  </varlistentry>
29167 </variablelist>
29168</refsect1>
29169<refsect1>
29170<title>Description</title>
29171<para>
29172   This function cannot fail, but it should not be called without
29173   the port claimed.  Similarly, if the port is already claimed
29174   you should not try claiming it again.
29175</para>
29176</refsect1>
29177</refentry>
29178
29179<!-- drivers/parport/daisy.c -->
29180<refentry id="API-parport-open">
29181<refentryinfo>
29182 <title>LINUX</title>
29183 <productname>Kernel Hackers Manual</productname>
29184 <date>July 2017</date>
29185</refentryinfo>
29186<refmeta>
29187 <refentrytitle><phrase>parport_open</phrase></refentrytitle>
29188 <manvolnum>9</manvolnum>
29189 <refmiscinfo class="version">4.1.27</refmiscinfo>
29190</refmeta>
29191<refnamediv>
29192 <refname>parport_open</refname>
29193 <refpurpose>
29194  find a device by canonical device number
29195 </refpurpose>
29196</refnamediv>
29197<refsynopsisdiv>
29198 <title>Synopsis</title>
29199  <funcsynopsis><funcprototype>
29200   <funcdef>struct pardevice * <function>parport_open </function></funcdef>
29201   <paramdef>int <parameter>devnum</parameter></paramdef>
29202   <paramdef>const char * <parameter>name</parameter></paramdef>
29203  </funcprototype></funcsynopsis>
29204</refsynopsisdiv>
29205<refsect1>
29206 <title>Arguments</title>
29207 <variablelist>
29208  <varlistentry>
29209   <term><parameter>devnum</parameter></term>
29210   <listitem>
29211    <para>
29212     canonical device number
29213    </para>
29214   </listitem>
29215  </varlistentry>
29216  <varlistentry>
29217   <term><parameter>name</parameter></term>
29218   <listitem>
29219    <para>
29220     name to associate with the device
29221    </para>
29222   </listitem>
29223  </varlistentry>
29224 </variablelist>
29225</refsect1>
29226<refsect1>
29227<title>Description</title>
29228<para>
29229   This function is similar to <function>parport_register_device</function>, except
29230   that it locates a device by its number rather than by the port
29231   it is attached to.
29232   </para><para>
29233
29234   All parameters except for <parameter>devnum</parameter> are the same as for
29235   <function>parport_register_device</function>.  The return value is the same as
29236   for <function>parport_register_device</function>.
29237</para>
29238</refsect1>
29239</refentry>
29240
29241<refentry id="API-parport-close">
29242<refentryinfo>
29243 <title>LINUX</title>
29244 <productname>Kernel Hackers Manual</productname>
29245 <date>July 2017</date>
29246</refentryinfo>
29247<refmeta>
29248 <refentrytitle><phrase>parport_close</phrase></refentrytitle>
29249 <manvolnum>9</manvolnum>
29250 <refmiscinfo class="version">4.1.27</refmiscinfo>
29251</refmeta>
29252<refnamediv>
29253 <refname>parport_close</refname>
29254 <refpurpose>
29255     close a device opened with <function>parport_open</function>
29256 </refpurpose>
29257</refnamediv>
29258<refsynopsisdiv>
29259 <title>Synopsis</title>
29260  <funcsynopsis><funcprototype>
29261   <funcdef>void <function>parport_close </function></funcdef>
29262   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
29263  </funcprototype></funcsynopsis>
29264</refsynopsisdiv>
29265<refsect1>
29266 <title>Arguments</title>
29267 <variablelist>
29268  <varlistentry>
29269   <term><parameter>dev</parameter></term>
29270   <listitem>
29271    <para>
29272     device to close
29273    </para>
29274   </listitem>
29275  </varlistentry>
29276 </variablelist>
29277</refsect1>
29278<refsect1>
29279<title>Description</title>
29280<para>
29281   This is to <function>parport_open</function> as <function>parport_unregister_device</function> is to
29282   <function>parport_register_device</function>.
29283</para>
29284</refsect1>
29285</refentry>
29286
29287  </chapter>
29288
29289  <chapter id="message_devices">
29290	<title>Message-based devices</title>
29291     <sect1><title>Fusion message devices</title>
29292<!-- drivers/message/fusion/mptbase.c -->
29293<refentry id="API-mpt-register">
29294<refentryinfo>
29295 <title>LINUX</title>
29296 <productname>Kernel Hackers Manual</productname>
29297 <date>July 2017</date>
29298</refentryinfo>
29299<refmeta>
29300 <refentrytitle><phrase>mpt_register</phrase></refentrytitle>
29301 <manvolnum>9</manvolnum>
29302 <refmiscinfo class="version">4.1.27</refmiscinfo>
29303</refmeta>
29304<refnamediv>
29305 <refname>mpt_register</refname>
29306 <refpurpose>
29307  Register protocol-specific main callback handler.
29308 </refpurpose>
29309</refnamediv>
29310<refsynopsisdiv>
29311 <title>Synopsis</title>
29312  <funcsynopsis><funcprototype>
29313   <funcdef>u8 <function>mpt_register </function></funcdef>
29314   <paramdef>MPT_CALLBACK <parameter>cbfunc</parameter></paramdef>
29315   <paramdef>MPT_DRIVER_CLASS <parameter>dclass</parameter></paramdef>
29316   <paramdef>char * <parameter>func_name</parameter></paramdef>
29317  </funcprototype></funcsynopsis>
29318</refsynopsisdiv>
29319<refsect1>
29320 <title>Arguments</title>
29321 <variablelist>
29322  <varlistentry>
29323   <term><parameter>cbfunc</parameter></term>
29324   <listitem>
29325    <para>
29326     callback function pointer
29327    </para>
29328   </listitem>
29329  </varlistentry>
29330  <varlistentry>
29331   <term><parameter>dclass</parameter></term>
29332   <listitem>
29333    <para>
29334     Protocol driver's class (<constant>MPT_DRIVER_CLASS</constant> enum value)
29335    </para>
29336   </listitem>
29337  </varlistentry>
29338  <varlistentry>
29339   <term><parameter>func_name</parameter></term>
29340   <listitem>
29341    <para>
29342     call function's name
29343    </para>
29344   </listitem>
29345  </varlistentry>
29346 </variablelist>
29347</refsect1>
29348<refsect1>
29349<title>Description</title>
29350<para>
29351   This routine is called by a protocol-specific driver (SCSI host,
29352   LAN, SCSI target) to register its reply callback routine.  Each
29353   protocol-specific driver must do this before it will be able to
29354   use any IOC resources, such as obtaining request frames.
29355</para>
29356</refsect1>
29357<refsect1>
29358<title>NOTES</title>
29359<para>
29360   The SCSI protocol driver currently calls this routine thrice
29361   in order to register separate callbacks; one for <quote>normal</quote> SCSI IO;
29362   one for MptScsiTaskMgmt requests; one for Scan/DV requests.
29363   </para><para>
29364
29365   Returns u8 valued <quote>handle</quote> in the range (and S.O.D. order)
29366   {N,...,7,6,5,...,1} if successful.
29367   A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be
29368   considered an error by the caller.
29369</para>
29370</refsect1>
29371</refentry>
29372
29373<refentry id="API-mpt-deregister">
29374<refentryinfo>
29375 <title>LINUX</title>
29376 <productname>Kernel Hackers Manual</productname>
29377 <date>July 2017</date>
29378</refentryinfo>
29379<refmeta>
29380 <refentrytitle><phrase>mpt_deregister</phrase></refentrytitle>
29381 <manvolnum>9</manvolnum>
29382 <refmiscinfo class="version">4.1.27</refmiscinfo>
29383</refmeta>
29384<refnamediv>
29385 <refname>mpt_deregister</refname>
29386 <refpurpose>
29387     Deregister a protocol drivers resources.
29388 </refpurpose>
29389</refnamediv>
29390<refsynopsisdiv>
29391 <title>Synopsis</title>
29392  <funcsynopsis><funcprototype>
29393   <funcdef>void <function>mpt_deregister </function></funcdef>
29394   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29395  </funcprototype></funcsynopsis>
29396</refsynopsisdiv>
29397<refsect1>
29398 <title>Arguments</title>
29399 <variablelist>
29400  <varlistentry>
29401   <term><parameter>cb_idx</parameter></term>
29402   <listitem>
29403    <para>
29404     previously registered callback handle
29405    </para>
29406   </listitem>
29407  </varlistentry>
29408 </variablelist>
29409</refsect1>
29410<refsect1>
29411<title>Description</title>
29412<para>
29413   Each protocol-specific driver should call this routine when its
29414   module is unloaded.
29415</para>
29416</refsect1>
29417</refentry>
29418
29419<refentry id="API-mpt-event-register">
29420<refentryinfo>
29421 <title>LINUX</title>
29422 <productname>Kernel Hackers Manual</productname>
29423 <date>July 2017</date>
29424</refentryinfo>
29425<refmeta>
29426 <refentrytitle><phrase>mpt_event_register</phrase></refentrytitle>
29427 <manvolnum>9</manvolnum>
29428 <refmiscinfo class="version">4.1.27</refmiscinfo>
29429</refmeta>
29430<refnamediv>
29431 <refname>mpt_event_register</refname>
29432 <refpurpose>
29433     Register protocol-specific event callback handler.
29434 </refpurpose>
29435</refnamediv>
29436<refsynopsisdiv>
29437 <title>Synopsis</title>
29438  <funcsynopsis><funcprototype>
29439   <funcdef>int <function>mpt_event_register </function></funcdef>
29440   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29441   <paramdef>MPT_EVHANDLER <parameter>ev_cbfunc</parameter></paramdef>
29442  </funcprototype></funcsynopsis>
29443</refsynopsisdiv>
29444<refsect1>
29445 <title>Arguments</title>
29446 <variablelist>
29447  <varlistentry>
29448   <term><parameter>cb_idx</parameter></term>
29449   <listitem>
29450    <para>
29451     previously registered (via mpt_register) callback handle
29452    </para>
29453   </listitem>
29454  </varlistentry>
29455  <varlistentry>
29456   <term><parameter>ev_cbfunc</parameter></term>
29457   <listitem>
29458    <para>
29459     callback function
29460    </para>
29461   </listitem>
29462  </varlistentry>
29463 </variablelist>
29464</refsect1>
29465<refsect1>
29466<title>Description</title>
29467<para>
29468   This routine can be called by one or more protocol-specific drivers
29469   if/when they choose to be notified of MPT events.
29470   </para><para>
29471
29472   Returns 0 for success.
29473</para>
29474</refsect1>
29475</refentry>
29476
29477<refentry id="API-mpt-event-deregister">
29478<refentryinfo>
29479 <title>LINUX</title>
29480 <productname>Kernel Hackers Manual</productname>
29481 <date>July 2017</date>
29482</refentryinfo>
29483<refmeta>
29484 <refentrytitle><phrase>mpt_event_deregister</phrase></refentrytitle>
29485 <manvolnum>9</manvolnum>
29486 <refmiscinfo class="version">4.1.27</refmiscinfo>
29487</refmeta>
29488<refnamediv>
29489 <refname>mpt_event_deregister</refname>
29490 <refpurpose>
29491     Deregister protocol-specific event callback handler
29492 </refpurpose>
29493</refnamediv>
29494<refsynopsisdiv>
29495 <title>Synopsis</title>
29496  <funcsynopsis><funcprototype>
29497   <funcdef>void <function>mpt_event_deregister </function></funcdef>
29498   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29499  </funcprototype></funcsynopsis>
29500</refsynopsisdiv>
29501<refsect1>
29502 <title>Arguments</title>
29503 <variablelist>
29504  <varlistentry>
29505   <term><parameter>cb_idx</parameter></term>
29506   <listitem>
29507    <para>
29508     previously registered callback handle
29509    </para>
29510   </listitem>
29511  </varlistentry>
29512 </variablelist>
29513</refsect1>
29514<refsect1>
29515<title>Description</title>
29516<para>
29517   Each protocol-specific driver should call this routine
29518   when it does not (or can no longer) handle events,
29519   or when its module is unloaded.
29520</para>
29521</refsect1>
29522</refentry>
29523
29524<refentry id="API-mpt-reset-register">
29525<refentryinfo>
29526 <title>LINUX</title>
29527 <productname>Kernel Hackers Manual</productname>
29528 <date>July 2017</date>
29529</refentryinfo>
29530<refmeta>
29531 <refentrytitle><phrase>mpt_reset_register</phrase></refentrytitle>
29532 <manvolnum>9</manvolnum>
29533 <refmiscinfo class="version">4.1.27</refmiscinfo>
29534</refmeta>
29535<refnamediv>
29536 <refname>mpt_reset_register</refname>
29537 <refpurpose>
29538     Register protocol-specific IOC reset handler.
29539 </refpurpose>
29540</refnamediv>
29541<refsynopsisdiv>
29542 <title>Synopsis</title>
29543  <funcsynopsis><funcprototype>
29544   <funcdef>int <function>mpt_reset_register </function></funcdef>
29545   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29546   <paramdef>MPT_RESETHANDLER <parameter>reset_func</parameter></paramdef>
29547  </funcprototype></funcsynopsis>
29548</refsynopsisdiv>
29549<refsect1>
29550 <title>Arguments</title>
29551 <variablelist>
29552  <varlistentry>
29553   <term><parameter>cb_idx</parameter></term>
29554   <listitem>
29555    <para>
29556     previously registered (via mpt_register) callback handle
29557    </para>
29558   </listitem>
29559  </varlistentry>
29560  <varlistentry>
29561   <term><parameter>reset_func</parameter></term>
29562   <listitem>
29563    <para>
29564     reset function
29565    </para>
29566   </listitem>
29567  </varlistentry>
29568 </variablelist>
29569</refsect1>
29570<refsect1>
29571<title>Description</title>
29572<para>
29573   This routine can be called by one or more protocol-specific drivers
29574   if/when they choose to be notified of IOC resets.
29575   </para><para>
29576
29577   Returns 0 for success.
29578</para>
29579</refsect1>
29580</refentry>
29581
29582<refentry id="API-mpt-reset-deregister">
29583<refentryinfo>
29584 <title>LINUX</title>
29585 <productname>Kernel Hackers Manual</productname>
29586 <date>July 2017</date>
29587</refentryinfo>
29588<refmeta>
29589 <refentrytitle><phrase>mpt_reset_deregister</phrase></refentrytitle>
29590 <manvolnum>9</manvolnum>
29591 <refmiscinfo class="version">4.1.27</refmiscinfo>
29592</refmeta>
29593<refnamediv>
29594 <refname>mpt_reset_deregister</refname>
29595 <refpurpose>
29596     Deregister protocol-specific IOC reset handler.
29597 </refpurpose>
29598</refnamediv>
29599<refsynopsisdiv>
29600 <title>Synopsis</title>
29601  <funcsynopsis><funcprototype>
29602   <funcdef>void <function>mpt_reset_deregister </function></funcdef>
29603   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29604  </funcprototype></funcsynopsis>
29605</refsynopsisdiv>
29606<refsect1>
29607 <title>Arguments</title>
29608 <variablelist>
29609  <varlistentry>
29610   <term><parameter>cb_idx</parameter></term>
29611   <listitem>
29612    <para>
29613     previously registered callback handle
29614    </para>
29615   </listitem>
29616  </varlistentry>
29617 </variablelist>
29618</refsect1>
29619<refsect1>
29620<title>Description</title>
29621<para>
29622   Each protocol-specific driver should call this routine
29623   when it does not (or can no longer) handle IOC reset handling,
29624   or when its module is unloaded.
29625</para>
29626</refsect1>
29627</refentry>
29628
29629<refentry id="API-mpt-device-driver-register">
29630<refentryinfo>
29631 <title>LINUX</title>
29632 <productname>Kernel Hackers Manual</productname>
29633 <date>July 2017</date>
29634</refentryinfo>
29635<refmeta>
29636 <refentrytitle><phrase>mpt_device_driver_register</phrase></refentrytitle>
29637 <manvolnum>9</manvolnum>
29638 <refmiscinfo class="version">4.1.27</refmiscinfo>
29639</refmeta>
29640<refnamediv>
29641 <refname>mpt_device_driver_register</refname>
29642 <refpurpose>
29643     Register device driver hooks
29644 </refpurpose>
29645</refnamediv>
29646<refsynopsisdiv>
29647 <title>Synopsis</title>
29648  <funcsynopsis><funcprototype>
29649   <funcdef>int <function>mpt_device_driver_register </function></funcdef>
29650   <paramdef>struct mpt_pci_driver * <parameter>dd_cbfunc</parameter></paramdef>
29651   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29652  </funcprototype></funcsynopsis>
29653</refsynopsisdiv>
29654<refsect1>
29655 <title>Arguments</title>
29656 <variablelist>
29657  <varlistentry>
29658   <term><parameter>dd_cbfunc</parameter></term>
29659   <listitem>
29660    <para>
29661     driver callbacks struct
29662    </para>
29663   </listitem>
29664  </varlistentry>
29665  <varlistentry>
29666   <term><parameter>cb_idx</parameter></term>
29667   <listitem>
29668    <para>
29669     MPT protocol driver index
29670    </para>
29671   </listitem>
29672  </varlistentry>
29673 </variablelist>
29674</refsect1>
29675</refentry>
29676
29677<refentry id="API-mpt-device-driver-deregister">
29678<refentryinfo>
29679 <title>LINUX</title>
29680 <productname>Kernel Hackers Manual</productname>
29681 <date>July 2017</date>
29682</refentryinfo>
29683<refmeta>
29684 <refentrytitle><phrase>mpt_device_driver_deregister</phrase></refentrytitle>
29685 <manvolnum>9</manvolnum>
29686 <refmiscinfo class="version">4.1.27</refmiscinfo>
29687</refmeta>
29688<refnamediv>
29689 <refname>mpt_device_driver_deregister</refname>
29690 <refpurpose>
29691     DeRegister device driver hooks
29692 </refpurpose>
29693</refnamediv>
29694<refsynopsisdiv>
29695 <title>Synopsis</title>
29696  <funcsynopsis><funcprototype>
29697   <funcdef>void <function>mpt_device_driver_deregister </function></funcdef>
29698   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29699  </funcprototype></funcsynopsis>
29700</refsynopsisdiv>
29701<refsect1>
29702 <title>Arguments</title>
29703 <variablelist>
29704  <varlistentry>
29705   <term><parameter>cb_idx</parameter></term>
29706   <listitem>
29707    <para>
29708     MPT protocol driver index
29709    </para>
29710   </listitem>
29711  </varlistentry>
29712 </variablelist>
29713</refsect1>
29714</refentry>
29715
29716<refentry id="API-mpt-get-msg-frame">
29717<refentryinfo>
29718 <title>LINUX</title>
29719 <productname>Kernel Hackers Manual</productname>
29720 <date>July 2017</date>
29721</refentryinfo>
29722<refmeta>
29723 <refentrytitle><phrase>mpt_get_msg_frame</phrase></refentrytitle>
29724 <manvolnum>9</manvolnum>
29725 <refmiscinfo class="version">4.1.27</refmiscinfo>
29726</refmeta>
29727<refnamediv>
29728 <refname>mpt_get_msg_frame</refname>
29729 <refpurpose>
29730     Obtain an MPT request frame from the pool
29731 </refpurpose>
29732</refnamediv>
29733<refsynopsisdiv>
29734 <title>Synopsis</title>
29735  <funcsynopsis><funcprototype>
29736   <funcdef>MPT_FRAME_HDR* <function>mpt_get_msg_frame </function></funcdef>
29737   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29738   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
29739  </funcprototype></funcsynopsis>
29740</refsynopsisdiv>
29741<refsect1>
29742 <title>Arguments</title>
29743 <variablelist>
29744  <varlistentry>
29745   <term><parameter>cb_idx</parameter></term>
29746   <listitem>
29747    <para>
29748     Handle of registered MPT protocol driver
29749    </para>
29750   </listitem>
29751  </varlistentry>
29752  <varlistentry>
29753   <term><parameter>ioc</parameter></term>
29754   <listitem>
29755    <para>
29756     Pointer to MPT adapter structure
29757    </para>
29758   </listitem>
29759  </varlistentry>
29760 </variablelist>
29761</refsect1>
29762<refsect1>
29763<title>Description</title>
29764<para>
29765   Obtain an MPT request frame from the pool (of 1024) that are
29766   allocated per MPT adapter.
29767   </para><para>
29768
29769   Returns pointer to a MPT request frame or <constant>NULL</constant> if none are available
29770   or IOC is not active.
29771</para>
29772</refsect1>
29773</refentry>
29774
29775<refentry id="API-mpt-put-msg-frame">
29776<refentryinfo>
29777 <title>LINUX</title>
29778 <productname>Kernel Hackers Manual</productname>
29779 <date>July 2017</date>
29780</refentryinfo>
29781<refmeta>
29782 <refentrytitle><phrase>mpt_put_msg_frame</phrase></refentrytitle>
29783 <manvolnum>9</manvolnum>
29784 <refmiscinfo class="version">4.1.27</refmiscinfo>
29785</refmeta>
29786<refnamediv>
29787 <refname>mpt_put_msg_frame</refname>
29788 <refpurpose>
29789     Send a protocol-specific MPT request frame to an IOC
29790 </refpurpose>
29791</refnamediv>
29792<refsynopsisdiv>
29793 <title>Synopsis</title>
29794  <funcsynopsis><funcprototype>
29795   <funcdef>void <function>mpt_put_msg_frame </function></funcdef>
29796   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29797   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
29798   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
29799  </funcprototype></funcsynopsis>
29800</refsynopsisdiv>
29801<refsect1>
29802 <title>Arguments</title>
29803 <variablelist>
29804  <varlistentry>
29805   <term><parameter>cb_idx</parameter></term>
29806   <listitem>
29807    <para>
29808     Handle of registered MPT protocol driver
29809    </para>
29810   </listitem>
29811  </varlistentry>
29812  <varlistentry>
29813   <term><parameter>ioc</parameter></term>
29814   <listitem>
29815    <para>
29816     Pointer to MPT adapter structure
29817    </para>
29818   </listitem>
29819  </varlistentry>
29820  <varlistentry>
29821   <term><parameter>mf</parameter></term>
29822   <listitem>
29823    <para>
29824     Pointer to MPT request frame
29825    </para>
29826   </listitem>
29827  </varlistentry>
29828 </variablelist>
29829</refsect1>
29830<refsect1>
29831<title>Description</title>
29832<para>
29833   This routine posts an MPT request frame to the request post FIFO of a
29834   specific MPT adapter.
29835</para>
29836</refsect1>
29837</refentry>
29838
29839<refentry id="API-mpt-put-msg-frame-hi-pri">
29840<refentryinfo>
29841 <title>LINUX</title>
29842 <productname>Kernel Hackers Manual</productname>
29843 <date>July 2017</date>
29844</refentryinfo>
29845<refmeta>
29846 <refentrytitle><phrase>mpt_put_msg_frame_hi_pri</phrase></refentrytitle>
29847 <manvolnum>9</manvolnum>
29848 <refmiscinfo class="version">4.1.27</refmiscinfo>
29849</refmeta>
29850<refnamediv>
29851 <refname>mpt_put_msg_frame_hi_pri</refname>
29852 <refpurpose>
29853     Send a hi-pri protocol-specific MPT request frame
29854 </refpurpose>
29855</refnamediv>
29856<refsynopsisdiv>
29857 <title>Synopsis</title>
29858  <funcsynopsis><funcprototype>
29859   <funcdef>void <function>mpt_put_msg_frame_hi_pri </function></funcdef>
29860   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29861   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
29862   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
29863  </funcprototype></funcsynopsis>
29864</refsynopsisdiv>
29865<refsect1>
29866 <title>Arguments</title>
29867 <variablelist>
29868  <varlistentry>
29869   <term><parameter>cb_idx</parameter></term>
29870   <listitem>
29871    <para>
29872     Handle of registered MPT protocol driver
29873    </para>
29874   </listitem>
29875  </varlistentry>
29876  <varlistentry>
29877   <term><parameter>ioc</parameter></term>
29878   <listitem>
29879    <para>
29880     Pointer to MPT adapter structure
29881    </para>
29882   </listitem>
29883  </varlistentry>
29884  <varlistentry>
29885   <term><parameter>mf</parameter></term>
29886   <listitem>
29887    <para>
29888     Pointer to MPT request frame
29889    </para>
29890   </listitem>
29891  </varlistentry>
29892 </variablelist>
29893</refsect1>
29894<refsect1>
29895<title>Description</title>
29896<para>
29897   Send a protocol-specific MPT request frame to an IOC using
29898   hi-priority request queue.
29899   </para><para>
29900
29901   This routine posts an MPT request frame to the request post FIFO of a
29902   specific MPT adapter.
29903</para>
29904</refsect1>
29905</refentry>
29906
29907<refentry id="API-mpt-free-msg-frame">
29908<refentryinfo>
29909 <title>LINUX</title>
29910 <productname>Kernel Hackers Manual</productname>
29911 <date>July 2017</date>
29912</refentryinfo>
29913<refmeta>
29914 <refentrytitle><phrase>mpt_free_msg_frame</phrase></refentrytitle>
29915 <manvolnum>9</manvolnum>
29916 <refmiscinfo class="version">4.1.27</refmiscinfo>
29917</refmeta>
29918<refnamediv>
29919 <refname>mpt_free_msg_frame</refname>
29920 <refpurpose>
29921     Place MPT request frame back on FreeQ.
29922 </refpurpose>
29923</refnamediv>
29924<refsynopsisdiv>
29925 <title>Synopsis</title>
29926  <funcsynopsis><funcprototype>
29927   <funcdef>void <function>mpt_free_msg_frame </function></funcdef>
29928   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
29929   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
29930  </funcprototype></funcsynopsis>
29931</refsynopsisdiv>
29932<refsect1>
29933 <title>Arguments</title>
29934 <variablelist>
29935  <varlistentry>
29936   <term><parameter>ioc</parameter></term>
29937   <listitem>
29938    <para>
29939     Pointer to MPT adapter structure
29940    </para>
29941   </listitem>
29942  </varlistentry>
29943  <varlistentry>
29944   <term><parameter>mf</parameter></term>
29945   <listitem>
29946    <para>
29947     Pointer to MPT request frame
29948    </para>
29949   </listitem>
29950  </varlistentry>
29951 </variablelist>
29952</refsect1>
29953<refsect1>
29954<title>Description</title>
29955<para>
29956   This routine places a MPT request frame back on the MPT adapter's
29957   FreeQ.
29958</para>
29959</refsect1>
29960</refentry>
29961
29962<refentry id="API-mpt-send-handshake-request">
29963<refentryinfo>
29964 <title>LINUX</title>
29965 <productname>Kernel Hackers Manual</productname>
29966 <date>July 2017</date>
29967</refentryinfo>
29968<refmeta>
29969 <refentrytitle><phrase>mpt_send_handshake_request</phrase></refentrytitle>
29970 <manvolnum>9</manvolnum>
29971 <refmiscinfo class="version">4.1.27</refmiscinfo>
29972</refmeta>
29973<refnamediv>
29974 <refname>mpt_send_handshake_request</refname>
29975 <refpurpose>
29976     Send MPT request via doorbell handshake method.
29977 </refpurpose>
29978</refnamediv>
29979<refsynopsisdiv>
29980 <title>Synopsis</title>
29981  <funcsynopsis><funcprototype>
29982   <funcdef>int <function>mpt_send_handshake_request </function></funcdef>
29983   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
29984   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
29985   <paramdef>int <parameter>reqBytes</parameter></paramdef>
29986   <paramdef>u32 * <parameter>req</parameter></paramdef>
29987   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
29988  </funcprototype></funcsynopsis>
29989</refsynopsisdiv>
29990<refsect1>
29991 <title>Arguments</title>
29992 <variablelist>
29993  <varlistentry>
29994   <term><parameter>cb_idx</parameter></term>
29995   <listitem>
29996    <para>
29997     Handle of registered MPT protocol driver
29998    </para>
29999   </listitem>
30000  </varlistentry>
30001  <varlistentry>
30002   <term><parameter>ioc</parameter></term>
30003   <listitem>
30004    <para>
30005     Pointer to MPT adapter structure
30006    </para>
30007   </listitem>
30008  </varlistentry>
30009  <varlistentry>
30010   <term><parameter>reqBytes</parameter></term>
30011   <listitem>
30012    <para>
30013     Size of the request in bytes
30014    </para>
30015   </listitem>
30016  </varlistentry>
30017  <varlistentry>
30018   <term><parameter>req</parameter></term>
30019   <listitem>
30020    <para>
30021     Pointer to MPT request frame
30022    </para>
30023   </listitem>
30024  </varlistentry>
30025  <varlistentry>
30026   <term><parameter>sleepFlag</parameter></term>
30027   <listitem>
30028    <para>
30029     Use schedule if CAN_SLEEP else use udelay.
30030    </para>
30031   </listitem>
30032  </varlistentry>
30033 </variablelist>
30034</refsect1>
30035<refsect1>
30036<title>Description</title>
30037<para>
30038   This routine is used exclusively to send MptScsiTaskMgmt
30039   requests since they are required to be sent via doorbell handshake.
30040</para>
30041</refsect1>
30042<refsect1>
30043<title>NOTE</title>
30044<para>
30045   It is the callers responsibility to byte-swap fields in the
30046   request which are greater than 1 byte in size.
30047   </para><para>
30048
30049   Returns 0 for success, non-zero for failure.
30050</para>
30051</refsect1>
30052</refentry>
30053
30054<refentry id="API-mpt-verify-adapter">
30055<refentryinfo>
30056 <title>LINUX</title>
30057 <productname>Kernel Hackers Manual</productname>
30058 <date>July 2017</date>
30059</refentryinfo>
30060<refmeta>
30061 <refentrytitle><phrase>mpt_verify_adapter</phrase></refentrytitle>
30062 <manvolnum>9</manvolnum>
30063 <refmiscinfo class="version">4.1.27</refmiscinfo>
30064</refmeta>
30065<refnamediv>
30066 <refname>mpt_verify_adapter</refname>
30067 <refpurpose>
30068     Given IOC identifier, set pointer to its adapter structure.
30069 </refpurpose>
30070</refnamediv>
30071<refsynopsisdiv>
30072 <title>Synopsis</title>
30073  <funcsynopsis><funcprototype>
30074   <funcdef>int <function>mpt_verify_adapter </function></funcdef>
30075   <paramdef>int <parameter>iocid</parameter></paramdef>
30076   <paramdef>MPT_ADAPTER ** <parameter>iocpp</parameter></paramdef>
30077  </funcprototype></funcsynopsis>
30078</refsynopsisdiv>
30079<refsect1>
30080 <title>Arguments</title>
30081 <variablelist>
30082  <varlistentry>
30083   <term><parameter>iocid</parameter></term>
30084   <listitem>
30085    <para>
30086     IOC unique identifier (integer)
30087    </para>
30088   </listitem>
30089  </varlistentry>
30090  <varlistentry>
30091   <term><parameter>iocpp</parameter></term>
30092   <listitem>
30093    <para>
30094     Pointer to pointer to IOC adapter
30095    </para>
30096   </listitem>
30097  </varlistentry>
30098 </variablelist>
30099</refsect1>
30100<refsect1>
30101<title>Description</title>
30102<para>
30103   Given a unique IOC identifier, set pointer to the associated MPT
30104   adapter structure.
30105   </para><para>
30106
30107   Returns iocid and sets iocpp if iocid is found.
30108   Returns -1 if iocid is not found.
30109</para>
30110</refsect1>
30111</refentry>
30112
30113<refentry id="API-mpt-attach">
30114<refentryinfo>
30115 <title>LINUX</title>
30116 <productname>Kernel Hackers Manual</productname>
30117 <date>July 2017</date>
30118</refentryinfo>
30119<refmeta>
30120 <refentrytitle><phrase>mpt_attach</phrase></refentrytitle>
30121 <manvolnum>9</manvolnum>
30122 <refmiscinfo class="version">4.1.27</refmiscinfo>
30123</refmeta>
30124<refnamediv>
30125 <refname>mpt_attach</refname>
30126 <refpurpose>
30127     Install a PCI intelligent MPT adapter.
30128 </refpurpose>
30129</refnamediv>
30130<refsynopsisdiv>
30131 <title>Synopsis</title>
30132  <funcsynopsis><funcprototype>
30133   <funcdef>int <function>mpt_attach </function></funcdef>
30134   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
30135   <paramdef>const struct pci_device_id * <parameter>id</parameter></paramdef>
30136  </funcprototype></funcsynopsis>
30137</refsynopsisdiv>
30138<refsect1>
30139 <title>Arguments</title>
30140 <variablelist>
30141  <varlistentry>
30142   <term><parameter>pdev</parameter></term>
30143   <listitem>
30144    <para>
30145     Pointer to pci_dev structure
30146    </para>
30147   </listitem>
30148  </varlistentry>
30149  <varlistentry>
30150   <term><parameter>id</parameter></term>
30151   <listitem>
30152    <para>
30153     PCI device ID information
30154    </para>
30155   </listitem>
30156  </varlistentry>
30157 </variablelist>
30158</refsect1>
30159<refsect1>
30160<title>Description</title>
30161<para>
30162   This routine performs all the steps necessary to bring the IOC of
30163   a MPT adapter to a OPERATIONAL state.  This includes registering
30164   memory regions, registering the interrupt, and allocating request
30165   and reply memory pools.
30166   </para><para>
30167
30168   This routine also pre-fetches the LAN MAC address of a Fibre Channel
30169   MPT adapter.
30170   </para><para>
30171
30172   Returns 0 for success, non-zero for failure.
30173</para>
30174</refsect1>
30175<refsect1>
30176<title>TODO</title>
30177<para>
30178   Add support for polled controllers
30179</para>
30180</refsect1>
30181</refentry>
30182
30183<refentry id="API-mpt-detach">
30184<refentryinfo>
30185 <title>LINUX</title>
30186 <productname>Kernel Hackers Manual</productname>
30187 <date>July 2017</date>
30188</refentryinfo>
30189<refmeta>
30190 <refentrytitle><phrase>mpt_detach</phrase></refentrytitle>
30191 <manvolnum>9</manvolnum>
30192 <refmiscinfo class="version">4.1.27</refmiscinfo>
30193</refmeta>
30194<refnamediv>
30195 <refname>mpt_detach</refname>
30196 <refpurpose>
30197     Remove a PCI intelligent MPT adapter.
30198 </refpurpose>
30199</refnamediv>
30200<refsynopsisdiv>
30201 <title>Synopsis</title>
30202  <funcsynopsis><funcprototype>
30203   <funcdef>void <function>mpt_detach </function></funcdef>
30204   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
30205  </funcprototype></funcsynopsis>
30206</refsynopsisdiv>
30207<refsect1>
30208 <title>Arguments</title>
30209 <variablelist>
30210  <varlistentry>
30211   <term><parameter>pdev</parameter></term>
30212   <listitem>
30213    <para>
30214     Pointer to pci_dev structure
30215    </para>
30216   </listitem>
30217  </varlistentry>
30218 </variablelist>
30219</refsect1>
30220</refentry>
30221
30222<refentry id="API-mpt-suspend">
30223<refentryinfo>
30224 <title>LINUX</title>
30225 <productname>Kernel Hackers Manual</productname>
30226 <date>July 2017</date>
30227</refentryinfo>
30228<refmeta>
30229 <refentrytitle><phrase>mpt_suspend</phrase></refentrytitle>
30230 <manvolnum>9</manvolnum>
30231 <refmiscinfo class="version">4.1.27</refmiscinfo>
30232</refmeta>
30233<refnamediv>
30234 <refname>mpt_suspend</refname>
30235 <refpurpose>
30236     Fusion MPT base driver suspend routine.
30237 </refpurpose>
30238</refnamediv>
30239<refsynopsisdiv>
30240 <title>Synopsis</title>
30241  <funcsynopsis><funcprototype>
30242   <funcdef>int <function>mpt_suspend </function></funcdef>
30243   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
30244   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
30245  </funcprototype></funcsynopsis>
30246</refsynopsisdiv>
30247<refsect1>
30248 <title>Arguments</title>
30249 <variablelist>
30250  <varlistentry>
30251   <term><parameter>pdev</parameter></term>
30252   <listitem>
30253    <para>
30254     Pointer to pci_dev structure
30255    </para>
30256   </listitem>
30257  </varlistentry>
30258  <varlistentry>
30259   <term><parameter>state</parameter></term>
30260   <listitem>
30261    <para>
30262     new state to enter
30263    </para>
30264   </listitem>
30265  </varlistentry>
30266 </variablelist>
30267</refsect1>
30268</refentry>
30269
30270<refentry id="API-mpt-resume">
30271<refentryinfo>
30272 <title>LINUX</title>
30273 <productname>Kernel Hackers Manual</productname>
30274 <date>July 2017</date>
30275</refentryinfo>
30276<refmeta>
30277 <refentrytitle><phrase>mpt_resume</phrase></refentrytitle>
30278 <manvolnum>9</manvolnum>
30279 <refmiscinfo class="version">4.1.27</refmiscinfo>
30280</refmeta>
30281<refnamediv>
30282 <refname>mpt_resume</refname>
30283 <refpurpose>
30284     Fusion MPT base driver resume routine.
30285 </refpurpose>
30286</refnamediv>
30287<refsynopsisdiv>
30288 <title>Synopsis</title>
30289  <funcsynopsis><funcprototype>
30290   <funcdef>int <function>mpt_resume </function></funcdef>
30291   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
30292  </funcprototype></funcsynopsis>
30293</refsynopsisdiv>
30294<refsect1>
30295 <title>Arguments</title>
30296 <variablelist>
30297  <varlistentry>
30298   <term><parameter>pdev</parameter></term>
30299   <listitem>
30300    <para>
30301     Pointer to pci_dev structure
30302    </para>
30303   </listitem>
30304  </varlistentry>
30305 </variablelist>
30306</refsect1>
30307</refentry>
30308
30309<refentry id="API-mpt-GetIocState">
30310<refentryinfo>
30311 <title>LINUX</title>
30312 <productname>Kernel Hackers Manual</productname>
30313 <date>July 2017</date>
30314</refentryinfo>
30315<refmeta>
30316 <refentrytitle><phrase>mpt_GetIocState</phrase></refentrytitle>
30317 <manvolnum>9</manvolnum>
30318 <refmiscinfo class="version">4.1.27</refmiscinfo>
30319</refmeta>
30320<refnamediv>
30321 <refname>mpt_GetIocState</refname>
30322 <refpurpose>
30323     Get the current state of a MPT adapter.
30324 </refpurpose>
30325</refnamediv>
30326<refsynopsisdiv>
30327 <title>Synopsis</title>
30328  <funcsynopsis><funcprototype>
30329   <funcdef>u32 <function>mpt_GetIocState </function></funcdef>
30330   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30331   <paramdef>int <parameter>cooked</parameter></paramdef>
30332  </funcprototype></funcsynopsis>
30333</refsynopsisdiv>
30334<refsect1>
30335 <title>Arguments</title>
30336 <variablelist>
30337  <varlistentry>
30338   <term><parameter>ioc</parameter></term>
30339   <listitem>
30340    <para>
30341     Pointer to MPT_ADAPTER structure
30342    </para>
30343   </listitem>
30344  </varlistentry>
30345  <varlistentry>
30346   <term><parameter>cooked</parameter></term>
30347   <listitem>
30348    <para>
30349     Request raw or cooked IOC state
30350    </para>
30351   </listitem>
30352  </varlistentry>
30353 </variablelist>
30354</refsect1>
30355<refsect1>
30356<title>Description</title>
30357<para>
30358   Returns all IOC Doorbell register bits if cooked==0, else just the
30359   Doorbell bits in MPI_IOC_STATE_MASK.
30360</para>
30361</refsect1>
30362</refentry>
30363
30364<refentry id="API-mpt-alloc-fw-memory">
30365<refentryinfo>
30366 <title>LINUX</title>
30367 <productname>Kernel Hackers Manual</productname>
30368 <date>July 2017</date>
30369</refentryinfo>
30370<refmeta>
30371 <refentrytitle><phrase>mpt_alloc_fw_memory</phrase></refentrytitle>
30372 <manvolnum>9</manvolnum>
30373 <refmiscinfo class="version">4.1.27</refmiscinfo>
30374</refmeta>
30375<refnamediv>
30376 <refname>mpt_alloc_fw_memory</refname>
30377 <refpurpose>
30378     allocate firmware memory
30379 </refpurpose>
30380</refnamediv>
30381<refsynopsisdiv>
30382 <title>Synopsis</title>
30383  <funcsynopsis><funcprototype>
30384   <funcdef>int <function>mpt_alloc_fw_memory </function></funcdef>
30385   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30386   <paramdef>int <parameter>size</parameter></paramdef>
30387  </funcprototype></funcsynopsis>
30388</refsynopsisdiv>
30389<refsect1>
30390 <title>Arguments</title>
30391 <variablelist>
30392  <varlistentry>
30393   <term><parameter>ioc</parameter></term>
30394   <listitem>
30395    <para>
30396     Pointer to MPT_ADAPTER structure
30397    </para>
30398   </listitem>
30399  </varlistentry>
30400  <varlistentry>
30401   <term><parameter>size</parameter></term>
30402   <listitem>
30403    <para>
30404     total FW bytes
30405    </para>
30406   </listitem>
30407  </varlistentry>
30408 </variablelist>
30409</refsect1>
30410<refsect1>
30411<title>Description</title>
30412<para>
30413   If memory has already been allocated, the same (cached) value
30414   is returned.
30415   </para><para>
30416
30417   Return 0 if successful, or non-zero for failure
30418</para>
30419</refsect1>
30420</refentry>
30421
30422<refentry id="API-mpt-free-fw-memory">
30423<refentryinfo>
30424 <title>LINUX</title>
30425 <productname>Kernel Hackers Manual</productname>
30426 <date>July 2017</date>
30427</refentryinfo>
30428<refmeta>
30429 <refentrytitle><phrase>mpt_free_fw_memory</phrase></refentrytitle>
30430 <manvolnum>9</manvolnum>
30431 <refmiscinfo class="version">4.1.27</refmiscinfo>
30432</refmeta>
30433<refnamediv>
30434 <refname>mpt_free_fw_memory</refname>
30435 <refpurpose>
30436     free firmware memory
30437 </refpurpose>
30438</refnamediv>
30439<refsynopsisdiv>
30440 <title>Synopsis</title>
30441  <funcsynopsis><funcprototype>
30442   <funcdef>void <function>mpt_free_fw_memory </function></funcdef>
30443   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30444  </funcprototype></funcsynopsis>
30445</refsynopsisdiv>
30446<refsect1>
30447 <title>Arguments</title>
30448 <variablelist>
30449  <varlistentry>
30450   <term><parameter>ioc</parameter></term>
30451   <listitem>
30452    <para>
30453     Pointer to MPT_ADAPTER structure
30454    </para>
30455   </listitem>
30456  </varlistentry>
30457 </variablelist>
30458</refsect1>
30459<refsect1>
30460<title>Description</title>
30461<para>
30462   If alt_img is NULL, delete from ioc structure.
30463   Else, delete a secondary image in same format.
30464</para>
30465</refsect1>
30466</refentry>
30467
30468<refentry id="API-mptbase-sas-persist-operation">
30469<refentryinfo>
30470 <title>LINUX</title>
30471 <productname>Kernel Hackers Manual</productname>
30472 <date>July 2017</date>
30473</refentryinfo>
30474<refmeta>
30475 <refentrytitle><phrase>mptbase_sas_persist_operation</phrase></refentrytitle>
30476 <manvolnum>9</manvolnum>
30477 <refmiscinfo class="version">4.1.27</refmiscinfo>
30478</refmeta>
30479<refnamediv>
30480 <refname>mptbase_sas_persist_operation</refname>
30481 <refpurpose>
30482     Perform operation on SAS Persistent Table
30483 </refpurpose>
30484</refnamediv>
30485<refsynopsisdiv>
30486 <title>Synopsis</title>
30487  <funcsynopsis><funcprototype>
30488   <funcdef>int <function>mptbase_sas_persist_operation </function></funcdef>
30489   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30490   <paramdef>u8 <parameter>persist_opcode</parameter></paramdef>
30491  </funcprototype></funcsynopsis>
30492</refsynopsisdiv>
30493<refsect1>
30494 <title>Arguments</title>
30495 <variablelist>
30496  <varlistentry>
30497   <term><parameter>ioc</parameter></term>
30498   <listitem>
30499    <para>
30500     Pointer to MPT_ADAPTER structure
30501    </para>
30502   </listitem>
30503  </varlistentry>
30504  <varlistentry>
30505   <term><parameter>persist_opcode</parameter></term>
30506   <listitem>
30507    <para>
30508     see below
30509    </para>
30510   </listitem>
30511  </varlistentry>
30512 </variablelist>
30513</refsect1>
30514<refsect1>
30515<title>Description</title>
30516<para>
30517   MPI_SAS_OP_CLEAR_NOT_PRESENT - Free all persist TargetID mappings for
30518   devices not currently present.
30519   MPI_SAS_OP_CLEAR_ALL_PERSISTENT - Clear al persist TargetID mappings
30520</para>
30521</refsect1>
30522<refsect1>
30523<title>NOTE</title>
30524<para>
30525   Don't use not this function during interrupt time.
30526   </para><para>
30527
30528   Returns 0 for success, non-zero error
30529</para>
30530</refsect1>
30531</refentry>
30532
30533<refentry id="API-mpt-raid-phys-disk-pg0">
30534<refentryinfo>
30535 <title>LINUX</title>
30536 <productname>Kernel Hackers Manual</productname>
30537 <date>July 2017</date>
30538</refentryinfo>
30539<refmeta>
30540 <refentrytitle><phrase>mpt_raid_phys_disk_pg0</phrase></refentrytitle>
30541 <manvolnum>9</manvolnum>
30542 <refmiscinfo class="version">4.1.27</refmiscinfo>
30543</refmeta>
30544<refnamediv>
30545 <refname>mpt_raid_phys_disk_pg0</refname>
30546 <refpurpose>
30547     returns phys disk page zero
30548 </refpurpose>
30549</refnamediv>
30550<refsynopsisdiv>
30551 <title>Synopsis</title>
30552  <funcsynopsis><funcprototype>
30553   <funcdef>int <function>mpt_raid_phys_disk_pg0 </function></funcdef>
30554   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30555   <paramdef>u8 <parameter>phys_disk_num</parameter></paramdef>
30556   <paramdef>RaidPhysDiskPage0_t * <parameter>phys_disk</parameter></paramdef>
30557  </funcprototype></funcsynopsis>
30558</refsynopsisdiv>
30559<refsect1>
30560 <title>Arguments</title>
30561 <variablelist>
30562  <varlistentry>
30563   <term><parameter>ioc</parameter></term>
30564   <listitem>
30565    <para>
30566     Pointer to a Adapter Structure
30567    </para>
30568   </listitem>
30569  </varlistentry>
30570  <varlistentry>
30571   <term><parameter>phys_disk_num</parameter></term>
30572   <listitem>
30573    <para>
30574     io unit unique phys disk num generated by the ioc
30575    </para>
30576   </listitem>
30577  </varlistentry>
30578  <varlistentry>
30579   <term><parameter>phys_disk</parameter></term>
30580   <listitem>
30581    <para>
30582     requested payload data returned
30583    </para>
30584   </listitem>
30585  </varlistentry>
30586 </variablelist>
30587</refsect1>
30588<refsect1>
30589<title>Return</title>
30590<para>
30591   0 on success
30592   -EFAULT if read of config page header fails or data pointer not NULL
30593   -ENOMEM if pci_alloc failed
30594</para>
30595</refsect1>
30596</refentry>
30597
30598<refentry id="API-mpt-raid-phys-disk-get-num-paths">
30599<refentryinfo>
30600 <title>LINUX</title>
30601 <productname>Kernel Hackers Manual</productname>
30602 <date>July 2017</date>
30603</refentryinfo>
30604<refmeta>
30605 <refentrytitle><phrase>mpt_raid_phys_disk_get_num_paths</phrase></refentrytitle>
30606 <manvolnum>9</manvolnum>
30607 <refmiscinfo class="version">4.1.27</refmiscinfo>
30608</refmeta>
30609<refnamediv>
30610 <refname>mpt_raid_phys_disk_get_num_paths</refname>
30611 <refpurpose>
30612     returns number paths associated to this phys_num
30613 </refpurpose>
30614</refnamediv>
30615<refsynopsisdiv>
30616 <title>Synopsis</title>
30617  <funcsynopsis><funcprototype>
30618   <funcdef>int <function>mpt_raid_phys_disk_get_num_paths </function></funcdef>
30619   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30620   <paramdef>u8 <parameter>phys_disk_num</parameter></paramdef>
30621  </funcprototype></funcsynopsis>
30622</refsynopsisdiv>
30623<refsect1>
30624 <title>Arguments</title>
30625 <variablelist>
30626  <varlistentry>
30627   <term><parameter>ioc</parameter></term>
30628   <listitem>
30629    <para>
30630     Pointer to a Adapter Structure
30631    </para>
30632   </listitem>
30633  </varlistentry>
30634  <varlistentry>
30635   <term><parameter>phys_disk_num</parameter></term>
30636   <listitem>
30637    <para>
30638     io unit unique phys disk num generated by the ioc
30639    </para>
30640   </listitem>
30641  </varlistentry>
30642 </variablelist>
30643</refsect1>
30644<refsect1>
30645<title>Return</title>
30646<para>
30647   returns number paths
30648</para>
30649</refsect1>
30650</refentry>
30651
30652<refentry id="API-mpt-raid-phys-disk-pg1">
30653<refentryinfo>
30654 <title>LINUX</title>
30655 <productname>Kernel Hackers Manual</productname>
30656 <date>July 2017</date>
30657</refentryinfo>
30658<refmeta>
30659 <refentrytitle><phrase>mpt_raid_phys_disk_pg1</phrase></refentrytitle>
30660 <manvolnum>9</manvolnum>
30661 <refmiscinfo class="version">4.1.27</refmiscinfo>
30662</refmeta>
30663<refnamediv>
30664 <refname>mpt_raid_phys_disk_pg1</refname>
30665 <refpurpose>
30666     returns phys disk page 1
30667 </refpurpose>
30668</refnamediv>
30669<refsynopsisdiv>
30670 <title>Synopsis</title>
30671  <funcsynopsis><funcprototype>
30672   <funcdef>int <function>mpt_raid_phys_disk_pg1 </function></funcdef>
30673   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30674   <paramdef>u8 <parameter>phys_disk_num</parameter></paramdef>
30675   <paramdef>RaidPhysDiskPage1_t * <parameter>phys_disk</parameter></paramdef>
30676  </funcprototype></funcsynopsis>
30677</refsynopsisdiv>
30678<refsect1>
30679 <title>Arguments</title>
30680 <variablelist>
30681  <varlistentry>
30682   <term><parameter>ioc</parameter></term>
30683   <listitem>
30684    <para>
30685     Pointer to a Adapter Structure
30686    </para>
30687   </listitem>
30688  </varlistentry>
30689  <varlistentry>
30690   <term><parameter>phys_disk_num</parameter></term>
30691   <listitem>
30692    <para>
30693     io unit unique phys disk num generated by the ioc
30694    </para>
30695   </listitem>
30696  </varlistentry>
30697  <varlistentry>
30698   <term><parameter>phys_disk</parameter></term>
30699   <listitem>
30700    <para>
30701     requested payload data returned
30702    </para>
30703   </listitem>
30704  </varlistentry>
30705 </variablelist>
30706</refsect1>
30707<refsect1>
30708<title>Return</title>
30709<para>
30710   0 on success
30711   -EFAULT if read of config page header fails or data pointer not NULL
30712   -ENOMEM if pci_alloc failed
30713</para>
30714</refsect1>
30715</refentry>
30716
30717<refentry id="API-mpt-findImVolumes">
30718<refentryinfo>
30719 <title>LINUX</title>
30720 <productname>Kernel Hackers Manual</productname>
30721 <date>July 2017</date>
30722</refentryinfo>
30723<refmeta>
30724 <refentrytitle><phrase>mpt_findImVolumes</phrase></refentrytitle>
30725 <manvolnum>9</manvolnum>
30726 <refmiscinfo class="version">4.1.27</refmiscinfo>
30727</refmeta>
30728<refnamediv>
30729 <refname>mpt_findImVolumes</refname>
30730 <refpurpose>
30731     Identify IDs of hidden disks and RAID Volumes
30732 </refpurpose>
30733</refnamediv>
30734<refsynopsisdiv>
30735 <title>Synopsis</title>
30736  <funcsynopsis><funcprototype>
30737   <funcdef>int <function>mpt_findImVolumes </function></funcdef>
30738   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30739  </funcprototype></funcsynopsis>
30740</refsynopsisdiv>
30741<refsect1>
30742 <title>Arguments</title>
30743 <variablelist>
30744  <varlistentry>
30745   <term><parameter>ioc</parameter></term>
30746   <listitem>
30747    <para>
30748     Pointer to a Adapter Strucutre
30749    </para>
30750   </listitem>
30751  </varlistentry>
30752 </variablelist>
30753</refsect1>
30754<refsect1>
30755<title>Return</title>
30756<para>
30757   0 on success
30758   -EFAULT if read of config page header fails or data pointer not NULL
30759   -ENOMEM if pci_alloc failed
30760</para>
30761</refsect1>
30762</refentry>
30763
30764<refentry id="API-mpt-config">
30765<refentryinfo>
30766 <title>LINUX</title>
30767 <productname>Kernel Hackers Manual</productname>
30768 <date>July 2017</date>
30769</refentryinfo>
30770<refmeta>
30771 <refentrytitle><phrase>mpt_config</phrase></refentrytitle>
30772 <manvolnum>9</manvolnum>
30773 <refmiscinfo class="version">4.1.27</refmiscinfo>
30774</refmeta>
30775<refnamediv>
30776 <refname>mpt_config</refname>
30777 <refpurpose>
30778     Generic function to issue config message
30779 </refpurpose>
30780</refnamediv>
30781<refsynopsisdiv>
30782 <title>Synopsis</title>
30783  <funcsynopsis><funcprototype>
30784   <funcdef>int <function>mpt_config </function></funcdef>
30785   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30786   <paramdef>CONFIGPARMS * <parameter>pCfg</parameter></paramdef>
30787  </funcprototype></funcsynopsis>
30788</refsynopsisdiv>
30789<refsect1>
30790 <title>Arguments</title>
30791 <variablelist>
30792  <varlistentry>
30793   <term><parameter>ioc</parameter></term>
30794   <listitem>
30795    <para>
30796     Pointer to an adapter structure
30797    </para>
30798   </listitem>
30799  </varlistentry>
30800  <varlistentry>
30801   <term><parameter>pCfg</parameter></term>
30802   <listitem>
30803    <para>
30804     Pointer to a configuration structure. Struct contains
30805     action, page address, direction, physical address
30806     and pointer to a configuration page header
30807     Page header is updated.
30808    </para>
30809   </listitem>
30810  </varlistentry>
30811 </variablelist>
30812</refsect1>
30813<refsect1>
30814<title>Description</title>
30815<para>
30816   Returns 0 for success
30817   -EPERM if not allowed due to ISR context
30818   -EAGAIN if no msg frames currently available
30819   -EFAULT for non-successful reply or no reply (timeout)
30820</para>
30821</refsect1>
30822</refentry>
30823
30824<refentry id="API-mpt-print-ioc-summary">
30825<refentryinfo>
30826 <title>LINUX</title>
30827 <productname>Kernel Hackers Manual</productname>
30828 <date>July 2017</date>
30829</refentryinfo>
30830<refmeta>
30831 <refentrytitle><phrase>mpt_print_ioc_summary</phrase></refentrytitle>
30832 <manvolnum>9</manvolnum>
30833 <refmiscinfo class="version">4.1.27</refmiscinfo>
30834</refmeta>
30835<refnamediv>
30836 <refname>mpt_print_ioc_summary</refname>
30837 <refpurpose>
30838     Write ASCII summary of IOC to a buffer.
30839 </refpurpose>
30840</refnamediv>
30841<refsynopsisdiv>
30842 <title>Synopsis</title>
30843  <funcsynopsis><funcprototype>
30844   <funcdef>void <function>mpt_print_ioc_summary </function></funcdef>
30845   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30846   <paramdef>char * <parameter>buffer</parameter></paramdef>
30847   <paramdef>int * <parameter>size</parameter></paramdef>
30848   <paramdef>int <parameter>len</parameter></paramdef>
30849   <paramdef>int <parameter>showlan</parameter></paramdef>
30850  </funcprototype></funcsynopsis>
30851</refsynopsisdiv>
30852<refsect1>
30853 <title>Arguments</title>
30854 <variablelist>
30855  <varlistentry>
30856   <term><parameter>ioc</parameter></term>
30857   <listitem>
30858    <para>
30859     Pointer to MPT_ADAPTER structure
30860    </para>
30861   </listitem>
30862  </varlistentry>
30863  <varlistentry>
30864   <term><parameter>buffer</parameter></term>
30865   <listitem>
30866    <para>
30867     Pointer to buffer where IOC summary info should be written
30868    </para>
30869   </listitem>
30870  </varlistentry>
30871  <varlistentry>
30872   <term><parameter>size</parameter></term>
30873   <listitem>
30874    <para>
30875     Pointer to number of bytes we wrote (set by this routine)
30876    </para>
30877   </listitem>
30878  </varlistentry>
30879  <varlistentry>
30880   <term><parameter>len</parameter></term>
30881   <listitem>
30882    <para>
30883     Offset at which to start writing in buffer
30884    </para>
30885   </listitem>
30886  </varlistentry>
30887  <varlistentry>
30888   <term><parameter>showlan</parameter></term>
30889   <listitem>
30890    <para>
30891     Display LAN stuff?
30892    </para>
30893   </listitem>
30894  </varlistentry>
30895 </variablelist>
30896</refsect1>
30897<refsect1>
30898<title>Description</title>
30899<para>
30900   This routine writes (english readable) ASCII text, which represents
30901   a summary of IOC information, to a buffer.
30902</para>
30903</refsect1>
30904</refentry>
30905
30906<refentry id="API-mpt-set-taskmgmt-in-progress-flag">
30907<refentryinfo>
30908 <title>LINUX</title>
30909 <productname>Kernel Hackers Manual</productname>
30910 <date>July 2017</date>
30911</refentryinfo>
30912<refmeta>
30913 <refentrytitle><phrase>mpt_set_taskmgmt_in_progress_flag</phrase></refentrytitle>
30914 <manvolnum>9</manvolnum>
30915 <refmiscinfo class="version">4.1.27</refmiscinfo>
30916</refmeta>
30917<refnamediv>
30918 <refname>mpt_set_taskmgmt_in_progress_flag</refname>
30919 <refpurpose>
30920     set flags associated with task management
30921 </refpurpose>
30922</refnamediv>
30923<refsynopsisdiv>
30924 <title>Synopsis</title>
30925  <funcsynopsis><funcprototype>
30926   <funcdef>int <function>mpt_set_taskmgmt_in_progress_flag </function></funcdef>
30927   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30928  </funcprototype></funcsynopsis>
30929</refsynopsisdiv>
30930<refsect1>
30931 <title>Arguments</title>
30932 <variablelist>
30933  <varlistentry>
30934   <term><parameter>ioc</parameter></term>
30935   <listitem>
30936    <para>
30937     Pointer to MPT_ADAPTER structure
30938    </para>
30939   </listitem>
30940  </varlistentry>
30941 </variablelist>
30942</refsect1>
30943<refsect1>
30944<title>Description</title>
30945<para>
30946   Returns 0 for SUCCESS or -1 if FAILED.
30947   </para><para>
30948
30949   If -1 is return, then it was not possible to set the flags
30950</para>
30951</refsect1>
30952</refentry>
30953
30954<refentry id="API-mpt-clear-taskmgmt-in-progress-flag">
30955<refentryinfo>
30956 <title>LINUX</title>
30957 <productname>Kernel Hackers Manual</productname>
30958 <date>July 2017</date>
30959</refentryinfo>
30960<refmeta>
30961 <refentrytitle><phrase>mpt_clear_taskmgmt_in_progress_flag</phrase></refentrytitle>
30962 <manvolnum>9</manvolnum>
30963 <refmiscinfo class="version">4.1.27</refmiscinfo>
30964</refmeta>
30965<refnamediv>
30966 <refname>mpt_clear_taskmgmt_in_progress_flag</refname>
30967 <refpurpose>
30968     clear flags associated with task management
30969 </refpurpose>
30970</refnamediv>
30971<refsynopsisdiv>
30972 <title>Synopsis</title>
30973  <funcsynopsis><funcprototype>
30974   <funcdef>void <function>mpt_clear_taskmgmt_in_progress_flag </function></funcdef>
30975   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
30976  </funcprototype></funcsynopsis>
30977</refsynopsisdiv>
30978<refsect1>
30979 <title>Arguments</title>
30980 <variablelist>
30981  <varlistentry>
30982   <term><parameter>ioc</parameter></term>
30983   <listitem>
30984    <para>
30985     Pointer to MPT_ADAPTER structure
30986    </para>
30987   </listitem>
30988  </varlistentry>
30989 </variablelist>
30990</refsect1>
30991</refentry>
30992
30993<refentry id="API-mpt-halt-firmware">
30994<refentryinfo>
30995 <title>LINUX</title>
30996 <productname>Kernel Hackers Manual</productname>
30997 <date>July 2017</date>
30998</refentryinfo>
30999<refmeta>
31000 <refentrytitle><phrase>mpt_halt_firmware</phrase></refentrytitle>
31001 <manvolnum>9</manvolnum>
31002 <refmiscinfo class="version">4.1.27</refmiscinfo>
31003</refmeta>
31004<refnamediv>
31005 <refname>mpt_halt_firmware</refname>
31006 <refpurpose>
31007     Halts the firmware if it is operational and panic the kernel
31008 </refpurpose>
31009</refnamediv>
31010<refsynopsisdiv>
31011 <title>Synopsis</title>
31012  <funcsynopsis><funcprototype>
31013   <funcdef>void <function>mpt_halt_firmware </function></funcdef>
31014   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31015  </funcprototype></funcsynopsis>
31016</refsynopsisdiv>
31017<refsect1>
31018 <title>Arguments</title>
31019 <variablelist>
31020  <varlistentry>
31021   <term><parameter>ioc</parameter></term>
31022   <listitem>
31023    <para>
31024     Pointer to MPT_ADAPTER structure
31025    </para>
31026   </listitem>
31027  </varlistentry>
31028 </variablelist>
31029</refsect1>
31030</refentry>
31031
31032<refentry id="API-mpt-Soft-Hard-ResetHandler">
31033<refentryinfo>
31034 <title>LINUX</title>
31035 <productname>Kernel Hackers Manual</productname>
31036 <date>July 2017</date>
31037</refentryinfo>
31038<refmeta>
31039 <refentrytitle><phrase>mpt_Soft_Hard_ResetHandler</phrase></refentrytitle>
31040 <manvolnum>9</manvolnum>
31041 <refmiscinfo class="version">4.1.27</refmiscinfo>
31042</refmeta>
31043<refnamediv>
31044 <refname>mpt_Soft_Hard_ResetHandler</refname>
31045 <refpurpose>
31046     Try less expensive reset
31047 </refpurpose>
31048</refnamediv>
31049<refsynopsisdiv>
31050 <title>Synopsis</title>
31051  <funcsynopsis><funcprototype>
31052   <funcdef>int <function>mpt_Soft_Hard_ResetHandler </function></funcdef>
31053   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31054   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
31055  </funcprototype></funcsynopsis>
31056</refsynopsisdiv>
31057<refsect1>
31058 <title>Arguments</title>
31059 <variablelist>
31060  <varlistentry>
31061   <term><parameter>ioc</parameter></term>
31062   <listitem>
31063    <para>
31064     Pointer to MPT_ADAPTER structure
31065    </para>
31066   </listitem>
31067  </varlistentry>
31068  <varlistentry>
31069   <term><parameter>sleepFlag</parameter></term>
31070   <listitem>
31071    <para>
31072     Indicates if sleep or schedule must be called.
31073    </para>
31074   </listitem>
31075  </varlistentry>
31076 </variablelist>
31077</refsect1>
31078<refsect1>
31079<title>Description</title>
31080<para>
31081   Returns 0 for SUCCESS or -1 if FAILED.
31082   Try for softreset first, only if it fails go for expensive
31083   HardReset.
31084</para>
31085</refsect1>
31086</refentry>
31087
31088<refentry id="API-mpt-HardResetHandler">
31089<refentryinfo>
31090 <title>LINUX</title>
31091 <productname>Kernel Hackers Manual</productname>
31092 <date>July 2017</date>
31093</refentryinfo>
31094<refmeta>
31095 <refentrytitle><phrase>mpt_HardResetHandler</phrase></refentrytitle>
31096 <manvolnum>9</manvolnum>
31097 <refmiscinfo class="version">4.1.27</refmiscinfo>
31098</refmeta>
31099<refnamediv>
31100 <refname>mpt_HardResetHandler</refname>
31101 <refpurpose>
31102     Generic reset handler
31103 </refpurpose>
31104</refnamediv>
31105<refsynopsisdiv>
31106 <title>Synopsis</title>
31107  <funcsynopsis><funcprototype>
31108   <funcdef>int <function>mpt_HardResetHandler </function></funcdef>
31109   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31110   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
31111  </funcprototype></funcsynopsis>
31112</refsynopsisdiv>
31113<refsect1>
31114 <title>Arguments</title>
31115 <variablelist>
31116  <varlistentry>
31117   <term><parameter>ioc</parameter></term>
31118   <listitem>
31119    <para>
31120     Pointer to MPT_ADAPTER structure
31121    </para>
31122   </listitem>
31123  </varlistentry>
31124  <varlistentry>
31125   <term><parameter>sleepFlag</parameter></term>
31126   <listitem>
31127    <para>
31128     Indicates if sleep or schedule must be called.
31129    </para>
31130   </listitem>
31131  </varlistentry>
31132 </variablelist>
31133</refsect1>
31134<refsect1>
31135<title>Description</title>
31136<para>
31137   Issues SCSI Task Management call based on input arg values.
31138   If TaskMgmt fails, returns associated SCSI request.
31139</para>
31140</refsect1>
31141<refsect1>
31142<title>Remark</title>
31143<para>
31144   _HardResetHandler can be invoked from an interrupt thread (timer)
31145   or a non-interrupt thread.  In the former, must not call <function>schedule</function>.
31146</para>
31147</refsect1>
31148<refsect1>
31149<title>Note</title>
31150<para>
31151   A return of -1 is a FATAL error case, as it means a
31152   FW reload/initialization failed.
31153   </para><para>
31154
31155   Returns 0 for SUCCESS or -1 if FAILED.
31156</para>
31157</refsect1>
31158</refentry>
31159
31160<!-- drivers/message/fusion/mptbase.c -->
31161<refentry id="API-mpt-get-cb-idx">
31162<refentryinfo>
31163 <title>LINUX</title>
31164 <productname>Kernel Hackers Manual</productname>
31165 <date>July 2017</date>
31166</refentryinfo>
31167<refmeta>
31168 <refentrytitle><phrase>mpt_get_cb_idx</phrase></refentrytitle>
31169 <manvolnum>9</manvolnum>
31170 <refmiscinfo class="version">4.1.27</refmiscinfo>
31171</refmeta>
31172<refnamediv>
31173 <refname>mpt_get_cb_idx</refname>
31174 <refpurpose>
31175  obtain cb_idx for registered driver
31176 </refpurpose>
31177</refnamediv>
31178<refsynopsisdiv>
31179 <title>Synopsis</title>
31180  <funcsynopsis><funcprototype>
31181   <funcdef>u8 <function>mpt_get_cb_idx </function></funcdef>
31182   <paramdef>MPT_DRIVER_CLASS <parameter>dclass</parameter></paramdef>
31183  </funcprototype></funcsynopsis>
31184</refsynopsisdiv>
31185<refsect1>
31186 <title>Arguments</title>
31187 <variablelist>
31188  <varlistentry>
31189   <term><parameter>dclass</parameter></term>
31190   <listitem>
31191    <para>
31192     class driver enum
31193    </para>
31194   </listitem>
31195  </varlistentry>
31196 </variablelist>
31197</refsect1>
31198<refsect1>
31199<title>Description</title>
31200<para>
31201   Returns cb_idx, or zero means it wasn't found
31202</para>
31203</refsect1>
31204</refentry>
31205
31206<refentry id="API-mpt-is-discovery-complete">
31207<refentryinfo>
31208 <title>LINUX</title>
31209 <productname>Kernel Hackers Manual</productname>
31210 <date>July 2017</date>
31211</refentryinfo>
31212<refmeta>
31213 <refentrytitle><phrase>mpt_is_discovery_complete</phrase></refentrytitle>
31214 <manvolnum>9</manvolnum>
31215 <refmiscinfo class="version">4.1.27</refmiscinfo>
31216</refmeta>
31217<refnamediv>
31218 <refname>mpt_is_discovery_complete</refname>
31219 <refpurpose>
31220     determine if discovery has completed
31221 </refpurpose>
31222</refnamediv>
31223<refsynopsisdiv>
31224 <title>Synopsis</title>
31225  <funcsynopsis><funcprototype>
31226   <funcdef>int <function>mpt_is_discovery_complete </function></funcdef>
31227   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31228  </funcprototype></funcsynopsis>
31229</refsynopsisdiv>
31230<refsect1>
31231 <title>Arguments</title>
31232 <variablelist>
31233  <varlistentry>
31234   <term><parameter>ioc</parameter></term>
31235   <listitem>
31236    <para>
31237     per adatper instance
31238    </para>
31239   </listitem>
31240  </varlistentry>
31241 </variablelist>
31242</refsect1>
31243<refsect1>
31244<title>Description</title>
31245<para>
31246   Returns 1 when discovery completed, else zero.
31247</para>
31248</refsect1>
31249</refentry>
31250
31251<refentry id="API-mpt-remove-dead-ioc-func">
31252<refentryinfo>
31253 <title>LINUX</title>
31254 <productname>Kernel Hackers Manual</productname>
31255 <date>July 2017</date>
31256</refentryinfo>
31257<refmeta>
31258 <refentrytitle><phrase>mpt_remove_dead_ioc_func</phrase></refentrytitle>
31259 <manvolnum>9</manvolnum>
31260 <refmiscinfo class="version">4.1.27</refmiscinfo>
31261</refmeta>
31262<refnamediv>
31263 <refname>mpt_remove_dead_ioc_func</refname>
31264 <refpurpose>
31265     kthread context to remove dead ioc
31266 </refpurpose>
31267</refnamediv>
31268<refsynopsisdiv>
31269 <title>Synopsis</title>
31270  <funcsynopsis><funcprototype>
31271   <funcdef>int <function>mpt_remove_dead_ioc_func </function></funcdef>
31272   <paramdef>void * <parameter>arg</parameter></paramdef>
31273  </funcprototype></funcsynopsis>
31274</refsynopsisdiv>
31275<refsect1>
31276 <title>Arguments</title>
31277 <variablelist>
31278  <varlistentry>
31279   <term><parameter>arg</parameter></term>
31280   <listitem>
31281    <para>
31282     input argument, used to derive ioc
31283    </para>
31284   </listitem>
31285  </varlistentry>
31286 </variablelist>
31287</refsect1>
31288<refsect1>
31289<title>Description</title>
31290<para>
31291   Return 0 if controller is removed from pci subsystem.
31292   Return -1 for other case.
31293</para>
31294</refsect1>
31295</refentry>
31296
31297<refentry id="API-mpt-fault-reset-work">
31298<refentryinfo>
31299 <title>LINUX</title>
31300 <productname>Kernel Hackers Manual</productname>
31301 <date>July 2017</date>
31302</refentryinfo>
31303<refmeta>
31304 <refentrytitle><phrase>mpt_fault_reset_work</phrase></refentrytitle>
31305 <manvolnum>9</manvolnum>
31306 <refmiscinfo class="version">4.1.27</refmiscinfo>
31307</refmeta>
31308<refnamediv>
31309 <refname>mpt_fault_reset_work</refname>
31310 <refpurpose>
31311     work performed on workq after ioc fault
31312 </refpurpose>
31313</refnamediv>
31314<refsynopsisdiv>
31315 <title>Synopsis</title>
31316  <funcsynopsis><funcprototype>
31317   <funcdef>void <function>mpt_fault_reset_work </function></funcdef>
31318   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
31319  </funcprototype></funcsynopsis>
31320</refsynopsisdiv>
31321<refsect1>
31322 <title>Arguments</title>
31323 <variablelist>
31324  <varlistentry>
31325   <term><parameter>work</parameter></term>
31326   <listitem>
31327    <para>
31328     input argument, used to derive ioc
31329    </para>
31330   </listitem>
31331  </varlistentry>
31332 </variablelist>
31333</refsect1>
31334</refentry>
31335
31336<refentry id="API-mpt-interrupt">
31337<refentryinfo>
31338 <title>LINUX</title>
31339 <productname>Kernel Hackers Manual</productname>
31340 <date>July 2017</date>
31341</refentryinfo>
31342<refmeta>
31343 <refentrytitle><phrase>mpt_interrupt</phrase></refentrytitle>
31344 <manvolnum>9</manvolnum>
31345 <refmiscinfo class="version">4.1.27</refmiscinfo>
31346</refmeta>
31347<refnamediv>
31348 <refname>mpt_interrupt</refname>
31349 <refpurpose>
31350     MPT adapter (IOC) specific interrupt handler.
31351 </refpurpose>
31352</refnamediv>
31353<refsynopsisdiv>
31354 <title>Synopsis</title>
31355  <funcsynopsis><funcprototype>
31356   <funcdef>irqreturn_t <function>mpt_interrupt </function></funcdef>
31357   <paramdef>int <parameter>irq</parameter></paramdef>
31358   <paramdef>void * <parameter>bus_id</parameter></paramdef>
31359  </funcprototype></funcsynopsis>
31360</refsynopsisdiv>
31361<refsect1>
31362 <title>Arguments</title>
31363 <variablelist>
31364  <varlistentry>
31365   <term><parameter>irq</parameter></term>
31366   <listitem>
31367    <para>
31368     irq number (not used)
31369    </para>
31370   </listitem>
31371  </varlistentry>
31372  <varlistentry>
31373   <term><parameter>bus_id</parameter></term>
31374   <listitem>
31375    <para>
31376     bus identifier cookie == pointer to MPT_ADAPTER structure
31377    </para>
31378   </listitem>
31379  </varlistentry>
31380 </variablelist>
31381</refsect1>
31382<refsect1>
31383<title>Description</title>
31384<para>
31385   This routine is registered via the <function>request_irq</function> kernel API call,
31386   and handles all interrupts generated from a specific MPT adapter
31387   (also referred to as a IO Controller or IOC).
31388   This routine must clear the interrupt from the adapter and does
31389   so by reading the reply FIFO.  Multiple replies may be processed
31390   per single call to this routine.
31391   </para><para>
31392
31393   This routine handles register-level access of the adapter but
31394   dispatches (calls) a protocol-specific callback routine to handle
31395   the protocol-specific details of the MPT request completion.
31396</para>
31397</refsect1>
31398</refentry>
31399
31400<refentry id="API-mptbase-reply">
31401<refentryinfo>
31402 <title>LINUX</title>
31403 <productname>Kernel Hackers Manual</productname>
31404 <date>July 2017</date>
31405</refentryinfo>
31406<refmeta>
31407 <refentrytitle><phrase>mptbase_reply</phrase></refentrytitle>
31408 <manvolnum>9</manvolnum>
31409 <refmiscinfo class="version">4.1.27</refmiscinfo>
31410</refmeta>
31411<refnamediv>
31412 <refname>mptbase_reply</refname>
31413 <refpurpose>
31414     MPT base driver's callback routine
31415 </refpurpose>
31416</refnamediv>
31417<refsynopsisdiv>
31418 <title>Synopsis</title>
31419  <funcsynopsis><funcprototype>
31420   <funcdef>int <function>mptbase_reply </function></funcdef>
31421   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31422   <paramdef>MPT_FRAME_HDR * <parameter>req</parameter></paramdef>
31423   <paramdef>MPT_FRAME_HDR * <parameter>reply</parameter></paramdef>
31424  </funcprototype></funcsynopsis>
31425</refsynopsisdiv>
31426<refsect1>
31427 <title>Arguments</title>
31428 <variablelist>
31429  <varlistentry>
31430   <term><parameter>ioc</parameter></term>
31431   <listitem>
31432    <para>
31433     Pointer to MPT_ADAPTER structure
31434    </para>
31435   </listitem>
31436  </varlistentry>
31437  <varlistentry>
31438   <term><parameter>req</parameter></term>
31439   <listitem>
31440    <para>
31441     Pointer to original MPT request frame
31442    </para>
31443   </listitem>
31444  </varlistentry>
31445  <varlistentry>
31446   <term><parameter>reply</parameter></term>
31447   <listitem>
31448    <para>
31449     Pointer to MPT reply frame (NULL if TurboReply)
31450    </para>
31451   </listitem>
31452  </varlistentry>
31453 </variablelist>
31454</refsect1>
31455<refsect1>
31456<title>Description</title>
31457<para>
31458   MPT base driver's callback routine; all base driver
31459   <quote>internal</quote> request/reply processing is routed here.
31460   Currently used for EventNotification and EventAck handling.
31461   </para><para>
31462
31463   Returns 1 indicating original alloc'd request frame ptr
31464   should be freed, or 0 if it shouldn't.
31465</para>
31466</refsect1>
31467</refentry>
31468
31469<refentry id="API-mpt-add-sge">
31470<refentryinfo>
31471 <title>LINUX</title>
31472 <productname>Kernel Hackers Manual</productname>
31473 <date>July 2017</date>
31474</refentryinfo>
31475<refmeta>
31476 <refentrytitle><phrase>mpt_add_sge</phrase></refentrytitle>
31477 <manvolnum>9</manvolnum>
31478 <refmiscinfo class="version">4.1.27</refmiscinfo>
31479</refmeta>
31480<refnamediv>
31481 <refname>mpt_add_sge</refname>
31482 <refpurpose>
31483     Place a simple 32 bit SGE at address pAddr.
31484 </refpurpose>
31485</refnamediv>
31486<refsynopsisdiv>
31487 <title>Synopsis</title>
31488  <funcsynopsis><funcprototype>
31489   <funcdef>void <function>mpt_add_sge </function></funcdef>
31490   <paramdef>void * <parameter>pAddr</parameter></paramdef>
31491   <paramdef>u32 <parameter>flagslength</parameter></paramdef>
31492   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
31493  </funcprototype></funcsynopsis>
31494</refsynopsisdiv>
31495<refsect1>
31496 <title>Arguments</title>
31497 <variablelist>
31498  <varlistentry>
31499   <term><parameter>pAddr</parameter></term>
31500   <listitem>
31501    <para>
31502     virtual address for SGE
31503    </para>
31504   </listitem>
31505  </varlistentry>
31506  <varlistentry>
31507   <term><parameter>flagslength</parameter></term>
31508   <listitem>
31509    <para>
31510     SGE flags and data transfer length
31511    </para>
31512   </listitem>
31513  </varlistentry>
31514  <varlistentry>
31515   <term><parameter>dma_addr</parameter></term>
31516   <listitem>
31517    <para>
31518     Physical address
31519    </para>
31520   </listitem>
31521  </varlistentry>
31522 </variablelist>
31523</refsect1>
31524<refsect1>
31525<title>Description</title>
31526<para>
31527   This routine places a MPT request frame back on the MPT adapter's
31528   FreeQ.
31529</para>
31530</refsect1>
31531</refentry>
31532
31533<refentry id="API-mpt-add-sge-64bit">
31534<refentryinfo>
31535 <title>LINUX</title>
31536 <productname>Kernel Hackers Manual</productname>
31537 <date>July 2017</date>
31538</refentryinfo>
31539<refmeta>
31540 <refentrytitle><phrase>mpt_add_sge_64bit</phrase></refentrytitle>
31541 <manvolnum>9</manvolnum>
31542 <refmiscinfo class="version">4.1.27</refmiscinfo>
31543</refmeta>
31544<refnamediv>
31545 <refname>mpt_add_sge_64bit</refname>
31546 <refpurpose>
31547     Place a simple 64 bit SGE at address pAddr.
31548 </refpurpose>
31549</refnamediv>
31550<refsynopsisdiv>
31551 <title>Synopsis</title>
31552  <funcsynopsis><funcprototype>
31553   <funcdef>void <function>mpt_add_sge_64bit </function></funcdef>
31554   <paramdef>void * <parameter>pAddr</parameter></paramdef>
31555   <paramdef>u32 <parameter>flagslength</parameter></paramdef>
31556   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
31557  </funcprototype></funcsynopsis>
31558</refsynopsisdiv>
31559<refsect1>
31560 <title>Arguments</title>
31561 <variablelist>
31562  <varlistentry>
31563   <term><parameter>pAddr</parameter></term>
31564   <listitem>
31565    <para>
31566     virtual address for SGE
31567    </para>
31568   </listitem>
31569  </varlistentry>
31570  <varlistentry>
31571   <term><parameter>flagslength</parameter></term>
31572   <listitem>
31573    <para>
31574     SGE flags and data transfer length
31575    </para>
31576   </listitem>
31577  </varlistentry>
31578  <varlistentry>
31579   <term><parameter>dma_addr</parameter></term>
31580   <listitem>
31581    <para>
31582     Physical address
31583    </para>
31584   </listitem>
31585  </varlistentry>
31586 </variablelist>
31587</refsect1>
31588<refsect1>
31589<title>Description</title>
31590<para>
31591   This routine places a MPT request frame back on the MPT adapter's
31592   FreeQ.
31593</para>
31594</refsect1>
31595</refentry>
31596
31597<refentry id="API-mpt-add-sge-64bit-1078">
31598<refentryinfo>
31599 <title>LINUX</title>
31600 <productname>Kernel Hackers Manual</productname>
31601 <date>July 2017</date>
31602</refentryinfo>
31603<refmeta>
31604 <refentrytitle><phrase>mpt_add_sge_64bit_1078</phrase></refentrytitle>
31605 <manvolnum>9</manvolnum>
31606 <refmiscinfo class="version">4.1.27</refmiscinfo>
31607</refmeta>
31608<refnamediv>
31609 <refname>mpt_add_sge_64bit_1078</refname>
31610 <refpurpose>
31611     Place a simple 64 bit SGE at address pAddr (1078 workaround).
31612 </refpurpose>
31613</refnamediv>
31614<refsynopsisdiv>
31615 <title>Synopsis</title>
31616  <funcsynopsis><funcprototype>
31617   <funcdef>void <function>mpt_add_sge_64bit_1078 </function></funcdef>
31618   <paramdef>void * <parameter>pAddr</parameter></paramdef>
31619   <paramdef>u32 <parameter>flagslength</parameter></paramdef>
31620   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
31621  </funcprototype></funcsynopsis>
31622</refsynopsisdiv>
31623<refsect1>
31624 <title>Arguments</title>
31625 <variablelist>
31626  <varlistentry>
31627   <term><parameter>pAddr</parameter></term>
31628   <listitem>
31629    <para>
31630     virtual address for SGE
31631    </para>
31632   </listitem>
31633  </varlistentry>
31634  <varlistentry>
31635   <term><parameter>flagslength</parameter></term>
31636   <listitem>
31637    <para>
31638     SGE flags and data transfer length
31639    </para>
31640   </listitem>
31641  </varlistentry>
31642  <varlistentry>
31643   <term><parameter>dma_addr</parameter></term>
31644   <listitem>
31645    <para>
31646     Physical address
31647    </para>
31648   </listitem>
31649  </varlistentry>
31650 </variablelist>
31651</refsect1>
31652<refsect1>
31653<title>Description</title>
31654<para>
31655   This routine places a MPT request frame back on the MPT adapter's
31656   FreeQ.
31657</para>
31658</refsect1>
31659</refentry>
31660
31661<refentry id="API-mpt-add-chain">
31662<refentryinfo>
31663 <title>LINUX</title>
31664 <productname>Kernel Hackers Manual</productname>
31665 <date>July 2017</date>
31666</refentryinfo>
31667<refmeta>
31668 <refentrytitle><phrase>mpt_add_chain</phrase></refentrytitle>
31669 <manvolnum>9</manvolnum>
31670 <refmiscinfo class="version">4.1.27</refmiscinfo>
31671</refmeta>
31672<refnamediv>
31673 <refname>mpt_add_chain</refname>
31674 <refpurpose>
31675     Place a 32 bit chain SGE at address pAddr.
31676 </refpurpose>
31677</refnamediv>
31678<refsynopsisdiv>
31679 <title>Synopsis</title>
31680  <funcsynopsis><funcprototype>
31681   <funcdef>void <function>mpt_add_chain </function></funcdef>
31682   <paramdef>void * <parameter>pAddr</parameter></paramdef>
31683   <paramdef>u8 <parameter>next</parameter></paramdef>
31684   <paramdef>u16 <parameter>length</parameter></paramdef>
31685   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
31686  </funcprototype></funcsynopsis>
31687</refsynopsisdiv>
31688<refsect1>
31689 <title>Arguments</title>
31690 <variablelist>
31691  <varlistentry>
31692   <term><parameter>pAddr</parameter></term>
31693   <listitem>
31694    <para>
31695     virtual address for SGE
31696    </para>
31697   </listitem>
31698  </varlistentry>
31699  <varlistentry>
31700   <term><parameter>next</parameter></term>
31701   <listitem>
31702    <para>
31703     nextChainOffset value (u32's)
31704    </para>
31705   </listitem>
31706  </varlistentry>
31707  <varlistentry>
31708   <term><parameter>length</parameter></term>
31709   <listitem>
31710    <para>
31711     length of next SGL segment
31712    </para>
31713   </listitem>
31714  </varlistentry>
31715  <varlistentry>
31716   <term><parameter>dma_addr</parameter></term>
31717   <listitem>
31718    <para>
31719     Physical address
31720    </para>
31721   </listitem>
31722  </varlistentry>
31723 </variablelist>
31724</refsect1>
31725</refentry>
31726
31727<refentry id="API-mpt-add-chain-64bit">
31728<refentryinfo>
31729 <title>LINUX</title>
31730 <productname>Kernel Hackers Manual</productname>
31731 <date>July 2017</date>
31732</refentryinfo>
31733<refmeta>
31734 <refentrytitle><phrase>mpt_add_chain_64bit</phrase></refentrytitle>
31735 <manvolnum>9</manvolnum>
31736 <refmiscinfo class="version">4.1.27</refmiscinfo>
31737</refmeta>
31738<refnamediv>
31739 <refname>mpt_add_chain_64bit</refname>
31740 <refpurpose>
31741     Place a 64 bit chain SGE at address pAddr.
31742 </refpurpose>
31743</refnamediv>
31744<refsynopsisdiv>
31745 <title>Synopsis</title>
31746  <funcsynopsis><funcprototype>
31747   <funcdef>void <function>mpt_add_chain_64bit </function></funcdef>
31748   <paramdef>void * <parameter>pAddr</parameter></paramdef>
31749   <paramdef>u8 <parameter>next</parameter></paramdef>
31750   <paramdef>u16 <parameter>length</parameter></paramdef>
31751   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
31752  </funcprototype></funcsynopsis>
31753</refsynopsisdiv>
31754<refsect1>
31755 <title>Arguments</title>
31756 <variablelist>
31757  <varlistentry>
31758   <term><parameter>pAddr</parameter></term>
31759   <listitem>
31760    <para>
31761     virtual address for SGE
31762    </para>
31763   </listitem>
31764  </varlistentry>
31765  <varlistentry>
31766   <term><parameter>next</parameter></term>
31767   <listitem>
31768    <para>
31769     nextChainOffset value (u32's)
31770    </para>
31771   </listitem>
31772  </varlistentry>
31773  <varlistentry>
31774   <term><parameter>length</parameter></term>
31775   <listitem>
31776    <para>
31777     length of next SGL segment
31778    </para>
31779   </listitem>
31780  </varlistentry>
31781  <varlistentry>
31782   <term><parameter>dma_addr</parameter></term>
31783   <listitem>
31784    <para>
31785     Physical address
31786    </para>
31787   </listitem>
31788  </varlistentry>
31789 </variablelist>
31790</refsect1>
31791</refentry>
31792
31793<refentry id="API-mpt-host-page-access-control">
31794<refentryinfo>
31795 <title>LINUX</title>
31796 <productname>Kernel Hackers Manual</productname>
31797 <date>July 2017</date>
31798</refentryinfo>
31799<refmeta>
31800 <refentrytitle><phrase>mpt_host_page_access_control</phrase></refentrytitle>
31801 <manvolnum>9</manvolnum>
31802 <refmiscinfo class="version">4.1.27</refmiscinfo>
31803</refmeta>
31804<refnamediv>
31805 <refname>mpt_host_page_access_control</refname>
31806 <refpurpose>
31807     control the IOC's Host Page Buffer access
31808 </refpurpose>
31809</refnamediv>
31810<refsynopsisdiv>
31811 <title>Synopsis</title>
31812  <funcsynopsis><funcprototype>
31813   <funcdef>int <function>mpt_host_page_access_control </function></funcdef>
31814   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31815   <paramdef>u8 <parameter>access_control_value</parameter></paramdef>
31816   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
31817  </funcprototype></funcsynopsis>
31818</refsynopsisdiv>
31819<refsect1>
31820 <title>Arguments</title>
31821 <variablelist>
31822  <varlistentry>
31823   <term><parameter>ioc</parameter></term>
31824   <listitem>
31825    <para>
31826     Pointer to MPT adapter structure
31827    </para>
31828   </listitem>
31829  </varlistentry>
31830  <varlistentry>
31831   <term><parameter>access_control_value</parameter></term>
31832   <listitem>
31833    <para>
31834     define bits below
31835    </para>
31836   </listitem>
31837  </varlistentry>
31838  <varlistentry>
31839   <term><parameter>sleepFlag</parameter></term>
31840   <listitem>
31841    <para>
31842     Specifies whether the process can sleep
31843    </para>
31844   </listitem>
31845  </varlistentry>
31846 </variablelist>
31847</refsect1>
31848<refsect1>
31849<title>Description</title>
31850<para>
31851   Provides mechanism for the host driver to control the IOC's
31852   Host Page Buffer access.
31853   </para><para>
31854
31855   Access Control Value - bits[15:12]
31856   0h Reserved
31857   1h Enable Access { MPI_DB_HPBAC_ENABLE_ACCESS }
31858   2h Disable Access { MPI_DB_HPBAC_DISABLE_ACCESS }
31859   3h Free Buffer { MPI_DB_HPBAC_FREE_BUFFER }
31860   </para><para>
31861
31862   Returns 0 for success, non-zero for failure.
31863</para>
31864</refsect1>
31865</refentry>
31866
31867<refentry id="API-mpt-host-page-alloc">
31868<refentryinfo>
31869 <title>LINUX</title>
31870 <productname>Kernel Hackers Manual</productname>
31871 <date>July 2017</date>
31872</refentryinfo>
31873<refmeta>
31874 <refentrytitle><phrase>mpt_host_page_alloc</phrase></refentrytitle>
31875 <manvolnum>9</manvolnum>
31876 <refmiscinfo class="version">4.1.27</refmiscinfo>
31877</refmeta>
31878<refnamediv>
31879 <refname>mpt_host_page_alloc</refname>
31880 <refpurpose>
31881     allocate system memory for the fw
31882 </refpurpose>
31883</refnamediv>
31884<refsynopsisdiv>
31885 <title>Synopsis</title>
31886  <funcsynopsis><funcprototype>
31887   <funcdef>int <function>mpt_host_page_alloc </function></funcdef>
31888   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31889   <paramdef>pIOCInit_t <parameter>ioc_init</parameter></paramdef>
31890  </funcprototype></funcsynopsis>
31891</refsynopsisdiv>
31892<refsect1>
31893 <title>Arguments</title>
31894 <variablelist>
31895  <varlistentry>
31896   <term><parameter>ioc</parameter></term>
31897   <listitem>
31898    <para>
31899     Pointer to pointer to IOC adapter
31900    </para>
31901   </listitem>
31902  </varlistentry>
31903  <varlistentry>
31904   <term><parameter>ioc_init</parameter></term>
31905   <listitem>
31906    <para>
31907     Pointer to ioc init config page
31908    </para>
31909   </listitem>
31910  </varlistentry>
31911 </variablelist>
31912</refsect1>
31913<refsect1>
31914<title>Description</title>
31915<para>
31916   If we already allocated memory in past, then resend the same pointer.
31917   Returns 0 for success, non-zero for failure.
31918</para>
31919</refsect1>
31920</refentry>
31921
31922<refentry id="API-mpt-get-product-name">
31923<refentryinfo>
31924 <title>LINUX</title>
31925 <productname>Kernel Hackers Manual</productname>
31926 <date>July 2017</date>
31927</refentryinfo>
31928<refmeta>
31929 <refentrytitle><phrase>mpt_get_product_name</phrase></refentrytitle>
31930 <manvolnum>9</manvolnum>
31931 <refmiscinfo class="version">4.1.27</refmiscinfo>
31932</refmeta>
31933<refnamediv>
31934 <refname>mpt_get_product_name</refname>
31935 <refpurpose>
31936     returns product string
31937 </refpurpose>
31938</refnamediv>
31939<refsynopsisdiv>
31940 <title>Synopsis</title>
31941  <funcsynopsis><funcprototype>
31942   <funcdef>const char* <function>mpt_get_product_name </function></funcdef>
31943   <paramdef>u16 <parameter>vendor</parameter></paramdef>
31944   <paramdef>u16 <parameter>device</parameter></paramdef>
31945   <paramdef>u8 <parameter>revision</parameter></paramdef>
31946  </funcprototype></funcsynopsis>
31947</refsynopsisdiv>
31948<refsect1>
31949 <title>Arguments</title>
31950 <variablelist>
31951  <varlistentry>
31952   <term><parameter>vendor</parameter></term>
31953   <listitem>
31954    <para>
31955     pci vendor id
31956    </para>
31957   </listitem>
31958  </varlistentry>
31959  <varlistentry>
31960   <term><parameter>device</parameter></term>
31961   <listitem>
31962    <para>
31963     pci device id
31964    </para>
31965   </listitem>
31966  </varlistentry>
31967  <varlistentry>
31968   <term><parameter>revision</parameter></term>
31969   <listitem>
31970    <para>
31971     pci revision id
31972    </para>
31973   </listitem>
31974  </varlistentry>
31975 </variablelist>
31976</refsect1>
31977<refsect1>
31978<title>Description</title>
31979<para>
31980   Returns product string displayed when driver loads,
31981   in /proc/mpt/summary and /sysfs/class/scsi_host/host&lt;X&gt;/version_product
31982</para>
31983</refsect1>
31984</refentry>
31985
31986<refentry id="API-mpt-mapresources">
31987<refentryinfo>
31988 <title>LINUX</title>
31989 <productname>Kernel Hackers Manual</productname>
31990 <date>July 2017</date>
31991</refentryinfo>
31992<refmeta>
31993 <refentrytitle><phrase>mpt_mapresources</phrase></refentrytitle>
31994 <manvolnum>9</manvolnum>
31995 <refmiscinfo class="version">4.1.27</refmiscinfo>
31996</refmeta>
31997<refnamediv>
31998 <refname>mpt_mapresources</refname>
31999 <refpurpose>
32000     map in memory mapped io
32001 </refpurpose>
32002</refnamediv>
32003<refsynopsisdiv>
32004 <title>Synopsis</title>
32005  <funcsynopsis><funcprototype>
32006   <funcdef>int <function>mpt_mapresources </function></funcdef>
32007   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32008  </funcprototype></funcsynopsis>
32009</refsynopsisdiv>
32010<refsect1>
32011 <title>Arguments</title>
32012 <variablelist>
32013  <varlistentry>
32014   <term><parameter>ioc</parameter></term>
32015   <listitem>
32016    <para>
32017     Pointer to pointer to IOC adapter
32018    </para>
32019   </listitem>
32020  </varlistentry>
32021 </variablelist>
32022</refsect1>
32023</refentry>
32024
32025<refentry id="API-mpt-do-ioc-recovery">
32026<refentryinfo>
32027 <title>LINUX</title>
32028 <productname>Kernel Hackers Manual</productname>
32029 <date>July 2017</date>
32030</refentryinfo>
32031<refmeta>
32032 <refentrytitle><phrase>mpt_do_ioc_recovery</phrase></refentrytitle>
32033 <manvolnum>9</manvolnum>
32034 <refmiscinfo class="version">4.1.27</refmiscinfo>
32035</refmeta>
32036<refnamediv>
32037 <refname>mpt_do_ioc_recovery</refname>
32038 <refpurpose>
32039     Initialize or recover MPT adapter.
32040 </refpurpose>
32041</refnamediv>
32042<refsynopsisdiv>
32043 <title>Synopsis</title>
32044  <funcsynopsis><funcprototype>
32045   <funcdef>int <function>mpt_do_ioc_recovery </function></funcdef>
32046   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32047   <paramdef>u32 <parameter>reason</parameter></paramdef>
32048   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32049  </funcprototype></funcsynopsis>
32050</refsynopsisdiv>
32051<refsect1>
32052 <title>Arguments</title>
32053 <variablelist>
32054  <varlistentry>
32055   <term><parameter>ioc</parameter></term>
32056   <listitem>
32057    <para>
32058     Pointer to MPT adapter structure
32059    </para>
32060   </listitem>
32061  </varlistentry>
32062  <varlistentry>
32063   <term><parameter>reason</parameter></term>
32064   <listitem>
32065    <para>
32066     Event word / reason
32067    </para>
32068   </listitem>
32069  </varlistentry>
32070  <varlistentry>
32071   <term><parameter>sleepFlag</parameter></term>
32072   <listitem>
32073    <para>
32074     Use schedule if CAN_SLEEP else use udelay.
32075    </para>
32076   </listitem>
32077  </varlistentry>
32078 </variablelist>
32079</refsect1>
32080<refsect1>
32081<title>Description</title>
32082<para>
32083   This routine performs all the steps necessary to bring the IOC
32084   to a OPERATIONAL state.
32085   </para><para>
32086
32087   This routine also pre-fetches the LAN MAC address of a Fibre Channel
32088   MPT adapter.
32089</para>
32090</refsect1>
32091<refsect1>
32092<title>Returns</title>
32093<para>
32094   0 for success
32095   -1 if failed to get board READY
32096   -2 if READY but IOCFacts Failed
32097   -3 if READY but PrimeIOCFifos Failed
32098   -4 if READY but IOCInit Failed
32099   -5 if failed to enable_device and/or request_selected_regions
32100   -6 if failed to upload firmware
32101</para>
32102</refsect1>
32103</refentry>
32104
32105<refentry id="API-mpt-detect-bound-ports">
32106<refentryinfo>
32107 <title>LINUX</title>
32108 <productname>Kernel Hackers Manual</productname>
32109 <date>July 2017</date>
32110</refentryinfo>
32111<refmeta>
32112 <refentrytitle><phrase>mpt_detect_bound_ports</phrase></refentrytitle>
32113 <manvolnum>9</manvolnum>
32114 <refmiscinfo class="version">4.1.27</refmiscinfo>
32115</refmeta>
32116<refnamediv>
32117 <refname>mpt_detect_bound_ports</refname>
32118 <refpurpose>
32119     Search for matching PCI bus/dev_function
32120 </refpurpose>
32121</refnamediv>
32122<refsynopsisdiv>
32123 <title>Synopsis</title>
32124  <funcsynopsis><funcprototype>
32125   <funcdef>void <function>mpt_detect_bound_ports </function></funcdef>
32126   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32127   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
32128  </funcprototype></funcsynopsis>
32129</refsynopsisdiv>
32130<refsect1>
32131 <title>Arguments</title>
32132 <variablelist>
32133  <varlistentry>
32134   <term><parameter>ioc</parameter></term>
32135   <listitem>
32136    <para>
32137     Pointer to MPT adapter structure
32138    </para>
32139   </listitem>
32140  </varlistentry>
32141  <varlistentry>
32142   <term><parameter>pdev</parameter></term>
32143   <listitem>
32144    <para>
32145     Pointer to (struct pci_dev) structure
32146    </para>
32147   </listitem>
32148  </varlistentry>
32149 </variablelist>
32150</refsect1>
32151<refsect1>
32152<title>Description</title>
32153<para>
32154   Search for PCI bus/dev_function which matches
32155   PCI bus/dev_function (+/-1) for newly discovered 929,
32156   929X, 1030 or 1035.
32157   </para><para>
32158
32159   If match on PCI dev_function +/-1 is found, bind the two MPT adapters
32160   using alt_ioc pointer fields in their <constant>MPT_ADAPTER</constant> structures.
32161</para>
32162</refsect1>
32163</refentry>
32164
32165<refentry id="API-mpt-adapter-disable">
32166<refentryinfo>
32167 <title>LINUX</title>
32168 <productname>Kernel Hackers Manual</productname>
32169 <date>July 2017</date>
32170</refentryinfo>
32171<refmeta>
32172 <refentrytitle><phrase>mpt_adapter_disable</phrase></refentrytitle>
32173 <manvolnum>9</manvolnum>
32174 <refmiscinfo class="version">4.1.27</refmiscinfo>
32175</refmeta>
32176<refnamediv>
32177 <refname>mpt_adapter_disable</refname>
32178 <refpurpose>
32179     Disable misbehaving MPT adapter.
32180 </refpurpose>
32181</refnamediv>
32182<refsynopsisdiv>
32183 <title>Synopsis</title>
32184  <funcsynopsis><funcprototype>
32185   <funcdef>void <function>mpt_adapter_disable </function></funcdef>
32186   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32187  </funcprototype></funcsynopsis>
32188</refsynopsisdiv>
32189<refsect1>
32190 <title>Arguments</title>
32191 <variablelist>
32192  <varlistentry>
32193   <term><parameter>ioc</parameter></term>
32194   <listitem>
32195    <para>
32196     Pointer to MPT adapter structure
32197    </para>
32198   </listitem>
32199  </varlistentry>
32200 </variablelist>
32201</refsect1>
32202</refentry>
32203
32204<refentry id="API-mpt-adapter-dispose">
32205<refentryinfo>
32206 <title>LINUX</title>
32207 <productname>Kernel Hackers Manual</productname>
32208 <date>July 2017</date>
32209</refentryinfo>
32210<refmeta>
32211 <refentrytitle><phrase>mpt_adapter_dispose</phrase></refentrytitle>
32212 <manvolnum>9</manvolnum>
32213 <refmiscinfo class="version">4.1.27</refmiscinfo>
32214</refmeta>
32215<refnamediv>
32216 <refname>mpt_adapter_dispose</refname>
32217 <refpurpose>
32218     Free all resources associated with an MPT adapter
32219 </refpurpose>
32220</refnamediv>
32221<refsynopsisdiv>
32222 <title>Synopsis</title>
32223  <funcsynopsis><funcprototype>
32224   <funcdef>void <function>mpt_adapter_dispose </function></funcdef>
32225   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32226  </funcprototype></funcsynopsis>
32227</refsynopsisdiv>
32228<refsect1>
32229 <title>Arguments</title>
32230 <variablelist>
32231  <varlistentry>
32232   <term><parameter>ioc</parameter></term>
32233   <listitem>
32234    <para>
32235     Pointer to MPT adapter structure
32236    </para>
32237   </listitem>
32238  </varlistentry>
32239 </variablelist>
32240</refsect1>
32241<refsect1>
32242<title>Description</title>
32243<para>
32244   This routine unregisters h/w resources and frees all alloc'd memory
32245   associated with a MPT adapter structure.
32246</para>
32247</refsect1>
32248</refentry>
32249
32250<refentry id="API-MptDisplayIocCapabilities">
32251<refentryinfo>
32252 <title>LINUX</title>
32253 <productname>Kernel Hackers Manual</productname>
32254 <date>July 2017</date>
32255</refentryinfo>
32256<refmeta>
32257 <refentrytitle><phrase>MptDisplayIocCapabilities</phrase></refentrytitle>
32258 <manvolnum>9</manvolnum>
32259 <refmiscinfo class="version">4.1.27</refmiscinfo>
32260</refmeta>
32261<refnamediv>
32262 <refname>MptDisplayIocCapabilities</refname>
32263 <refpurpose>
32264     Disply IOC's capabilities.
32265 </refpurpose>
32266</refnamediv>
32267<refsynopsisdiv>
32268 <title>Synopsis</title>
32269  <funcsynopsis><funcprototype>
32270   <funcdef>void <function>MptDisplayIocCapabilities </function></funcdef>
32271   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32272  </funcprototype></funcsynopsis>
32273</refsynopsisdiv>
32274<refsect1>
32275 <title>Arguments</title>
32276 <variablelist>
32277  <varlistentry>
32278   <term><parameter>ioc</parameter></term>
32279   <listitem>
32280    <para>
32281     Pointer to MPT adapter structure
32282    </para>
32283   </listitem>
32284  </varlistentry>
32285 </variablelist>
32286</refsect1>
32287</refentry>
32288
32289<refentry id="API-MakeIocReady">
32290<refentryinfo>
32291 <title>LINUX</title>
32292 <productname>Kernel Hackers Manual</productname>
32293 <date>July 2017</date>
32294</refentryinfo>
32295<refmeta>
32296 <refentrytitle><phrase>MakeIocReady</phrase></refentrytitle>
32297 <manvolnum>9</manvolnum>
32298 <refmiscinfo class="version">4.1.27</refmiscinfo>
32299</refmeta>
32300<refnamediv>
32301 <refname>MakeIocReady</refname>
32302 <refpurpose>
32303     Get IOC to a READY state, using KickStart if needed.
32304 </refpurpose>
32305</refnamediv>
32306<refsynopsisdiv>
32307 <title>Synopsis</title>
32308  <funcsynopsis><funcprototype>
32309   <funcdef>int <function>MakeIocReady </function></funcdef>
32310   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32311   <paramdef>int <parameter>force</parameter></paramdef>
32312   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32313  </funcprototype></funcsynopsis>
32314</refsynopsisdiv>
32315<refsect1>
32316 <title>Arguments</title>
32317 <variablelist>
32318  <varlistentry>
32319   <term><parameter>ioc</parameter></term>
32320   <listitem>
32321    <para>
32322     Pointer to MPT_ADAPTER structure
32323    </para>
32324   </listitem>
32325  </varlistentry>
32326  <varlistentry>
32327   <term><parameter>force</parameter></term>
32328   <listitem>
32329    <para>
32330     Force hard KickStart of IOC
32331    </para>
32332   </listitem>
32333  </varlistentry>
32334  <varlistentry>
32335   <term><parameter>sleepFlag</parameter></term>
32336   <listitem>
32337    <para>
32338     Specifies whether the process can sleep
32339    </para>
32340   </listitem>
32341  </varlistentry>
32342 </variablelist>
32343</refsect1>
32344<refsect1>
32345<title>Returns</title>
32346<para>
32347   1 - DIAG reset and READY
32348   0 - READY initially OR soft reset and READY
32349   -1 - Any failure on KickStart
32350   -2 - Msg Unit Reset Failed
32351   -3 - IO Unit Reset Failed
32352   -4 - IOC owned by a PEER
32353</para>
32354</refsect1>
32355</refentry>
32356
32357<refentry id="API-GetIocFacts">
32358<refentryinfo>
32359 <title>LINUX</title>
32360 <productname>Kernel Hackers Manual</productname>
32361 <date>July 2017</date>
32362</refentryinfo>
32363<refmeta>
32364 <refentrytitle><phrase>GetIocFacts</phrase></refentrytitle>
32365 <manvolnum>9</manvolnum>
32366 <refmiscinfo class="version">4.1.27</refmiscinfo>
32367</refmeta>
32368<refnamediv>
32369 <refname>GetIocFacts</refname>
32370 <refpurpose>
32371     Send IOCFacts request to MPT adapter.
32372 </refpurpose>
32373</refnamediv>
32374<refsynopsisdiv>
32375 <title>Synopsis</title>
32376  <funcsynopsis><funcprototype>
32377   <funcdef>int <function>GetIocFacts </function></funcdef>
32378   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32379   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32380   <paramdef>int <parameter>reason</parameter></paramdef>
32381  </funcprototype></funcsynopsis>
32382</refsynopsisdiv>
32383<refsect1>
32384 <title>Arguments</title>
32385 <variablelist>
32386  <varlistentry>
32387   <term><parameter>ioc</parameter></term>
32388   <listitem>
32389    <para>
32390     Pointer to MPT_ADAPTER structure
32391    </para>
32392   </listitem>
32393  </varlistentry>
32394  <varlistentry>
32395   <term><parameter>sleepFlag</parameter></term>
32396   <listitem>
32397    <para>
32398     Specifies whether the process can sleep
32399    </para>
32400   </listitem>
32401  </varlistentry>
32402  <varlistentry>
32403   <term><parameter>reason</parameter></term>
32404   <listitem>
32405    <para>
32406     If recovery, only update facts.
32407    </para>
32408   </listitem>
32409  </varlistentry>
32410 </variablelist>
32411</refsect1>
32412<refsect1>
32413<title>Description</title>
32414<para>
32415   Returns 0 for success, non-zero for failure.
32416</para>
32417</refsect1>
32418</refentry>
32419
32420<refentry id="API-GetPortFacts">
32421<refentryinfo>
32422 <title>LINUX</title>
32423 <productname>Kernel Hackers Manual</productname>
32424 <date>July 2017</date>
32425</refentryinfo>
32426<refmeta>
32427 <refentrytitle><phrase>GetPortFacts</phrase></refentrytitle>
32428 <manvolnum>9</manvolnum>
32429 <refmiscinfo class="version">4.1.27</refmiscinfo>
32430</refmeta>
32431<refnamediv>
32432 <refname>GetPortFacts</refname>
32433 <refpurpose>
32434     Send PortFacts request to MPT adapter.
32435 </refpurpose>
32436</refnamediv>
32437<refsynopsisdiv>
32438 <title>Synopsis</title>
32439  <funcsynopsis><funcprototype>
32440   <funcdef>int <function>GetPortFacts </function></funcdef>
32441   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32442   <paramdef>int <parameter>portnum</parameter></paramdef>
32443   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32444  </funcprototype></funcsynopsis>
32445</refsynopsisdiv>
32446<refsect1>
32447 <title>Arguments</title>
32448 <variablelist>
32449  <varlistentry>
32450   <term><parameter>ioc</parameter></term>
32451   <listitem>
32452    <para>
32453     Pointer to MPT_ADAPTER structure
32454    </para>
32455   </listitem>
32456  </varlistentry>
32457  <varlistentry>
32458   <term><parameter>portnum</parameter></term>
32459   <listitem>
32460    <para>
32461     Port number
32462    </para>
32463   </listitem>
32464  </varlistentry>
32465  <varlistentry>
32466   <term><parameter>sleepFlag</parameter></term>
32467   <listitem>
32468    <para>
32469     Specifies whether the process can sleep
32470    </para>
32471   </listitem>
32472  </varlistentry>
32473 </variablelist>
32474</refsect1>
32475<refsect1>
32476<title>Description</title>
32477<para>
32478   Returns 0 for success, non-zero for failure.
32479</para>
32480</refsect1>
32481</refentry>
32482
32483<refentry id="API-SendIocInit">
32484<refentryinfo>
32485 <title>LINUX</title>
32486 <productname>Kernel Hackers Manual</productname>
32487 <date>July 2017</date>
32488</refentryinfo>
32489<refmeta>
32490 <refentrytitle><phrase>SendIocInit</phrase></refentrytitle>
32491 <manvolnum>9</manvolnum>
32492 <refmiscinfo class="version">4.1.27</refmiscinfo>
32493</refmeta>
32494<refnamediv>
32495 <refname>SendIocInit</refname>
32496 <refpurpose>
32497     Send IOCInit request to MPT adapter.
32498 </refpurpose>
32499</refnamediv>
32500<refsynopsisdiv>
32501 <title>Synopsis</title>
32502  <funcsynopsis><funcprototype>
32503   <funcdef>int <function>SendIocInit </function></funcdef>
32504   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32505   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32506  </funcprototype></funcsynopsis>
32507</refsynopsisdiv>
32508<refsect1>
32509 <title>Arguments</title>
32510 <variablelist>
32511  <varlistentry>
32512   <term><parameter>ioc</parameter></term>
32513   <listitem>
32514    <para>
32515     Pointer to MPT_ADAPTER structure
32516    </para>
32517   </listitem>
32518  </varlistentry>
32519  <varlistentry>
32520   <term><parameter>sleepFlag</parameter></term>
32521   <listitem>
32522    <para>
32523     Specifies whether the process can sleep
32524    </para>
32525   </listitem>
32526  </varlistentry>
32527 </variablelist>
32528</refsect1>
32529<refsect1>
32530<title>Description</title>
32531<para>
32532   Send IOCInit followed by PortEnable to bring IOC to OPERATIONAL state.
32533   </para><para>
32534
32535   Returns 0 for success, non-zero for failure.
32536</para>
32537</refsect1>
32538</refentry>
32539
32540<refentry id="API-SendPortEnable">
32541<refentryinfo>
32542 <title>LINUX</title>
32543 <productname>Kernel Hackers Manual</productname>
32544 <date>July 2017</date>
32545</refentryinfo>
32546<refmeta>
32547 <refentrytitle><phrase>SendPortEnable</phrase></refentrytitle>
32548 <manvolnum>9</manvolnum>
32549 <refmiscinfo class="version">4.1.27</refmiscinfo>
32550</refmeta>
32551<refnamediv>
32552 <refname>SendPortEnable</refname>
32553 <refpurpose>
32554     Send PortEnable request to MPT adapter port.
32555 </refpurpose>
32556</refnamediv>
32557<refsynopsisdiv>
32558 <title>Synopsis</title>
32559  <funcsynopsis><funcprototype>
32560   <funcdef>int <function>SendPortEnable </function></funcdef>
32561   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32562   <paramdef>int <parameter>portnum</parameter></paramdef>
32563   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32564  </funcprototype></funcsynopsis>
32565</refsynopsisdiv>
32566<refsect1>
32567 <title>Arguments</title>
32568 <variablelist>
32569  <varlistentry>
32570   <term><parameter>ioc</parameter></term>
32571   <listitem>
32572    <para>
32573     Pointer to MPT_ADAPTER structure
32574    </para>
32575   </listitem>
32576  </varlistentry>
32577  <varlistentry>
32578   <term><parameter>portnum</parameter></term>
32579   <listitem>
32580    <para>
32581     Port number to enable
32582    </para>
32583   </listitem>
32584  </varlistentry>
32585  <varlistentry>
32586   <term><parameter>sleepFlag</parameter></term>
32587   <listitem>
32588    <para>
32589     Specifies whether the process can sleep
32590    </para>
32591   </listitem>
32592  </varlistentry>
32593 </variablelist>
32594</refsect1>
32595<refsect1>
32596<title>Description</title>
32597<para>
32598   Send PortEnable to bring IOC to OPERATIONAL state.
32599   </para><para>
32600
32601   Returns 0 for success, non-zero for failure.
32602</para>
32603</refsect1>
32604</refentry>
32605
32606<refentry id="API-mpt-do-upload">
32607<refentryinfo>
32608 <title>LINUX</title>
32609 <productname>Kernel Hackers Manual</productname>
32610 <date>July 2017</date>
32611</refentryinfo>
32612<refmeta>
32613 <refentrytitle><phrase>mpt_do_upload</phrase></refentrytitle>
32614 <manvolnum>9</manvolnum>
32615 <refmiscinfo class="version">4.1.27</refmiscinfo>
32616</refmeta>
32617<refnamediv>
32618 <refname>mpt_do_upload</refname>
32619 <refpurpose>
32620     Construct and Send FWUpload request to MPT adapter port.
32621 </refpurpose>
32622</refnamediv>
32623<refsynopsisdiv>
32624 <title>Synopsis</title>
32625  <funcsynopsis><funcprototype>
32626   <funcdef>int <function>mpt_do_upload </function></funcdef>
32627   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32628   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32629  </funcprototype></funcsynopsis>
32630</refsynopsisdiv>
32631<refsect1>
32632 <title>Arguments</title>
32633 <variablelist>
32634  <varlistentry>
32635   <term><parameter>ioc</parameter></term>
32636   <listitem>
32637    <para>
32638     Pointer to MPT_ADAPTER structure
32639    </para>
32640   </listitem>
32641  </varlistentry>
32642  <varlistentry>
32643   <term><parameter>sleepFlag</parameter></term>
32644   <listitem>
32645    <para>
32646     Specifies whether the process can sleep
32647    </para>
32648   </listitem>
32649  </varlistentry>
32650 </variablelist>
32651</refsect1>
32652<refsect1>
32653<title>Description</title>
32654<para>
32655   Returns 0 for success, &gt;0 for handshake failure
32656   &lt;0 for fw upload failure.
32657</para>
32658</refsect1>
32659<refsect1>
32660<title>Remark</title>
32661<para>
32662   If bound IOC and a successful FWUpload was performed
32663   on the bound IOC, the second image is discarded
32664   and memory is free'd. Both channels must upload to prevent
32665   IOC from running in degraded mode.
32666</para>
32667</refsect1>
32668</refentry>
32669
32670<refentry id="API-mpt-downloadboot">
32671<refentryinfo>
32672 <title>LINUX</title>
32673 <productname>Kernel Hackers Manual</productname>
32674 <date>July 2017</date>
32675</refentryinfo>
32676<refmeta>
32677 <refentrytitle><phrase>mpt_downloadboot</phrase></refentrytitle>
32678 <manvolnum>9</manvolnum>
32679 <refmiscinfo class="version">4.1.27</refmiscinfo>
32680</refmeta>
32681<refnamediv>
32682 <refname>mpt_downloadboot</refname>
32683 <refpurpose>
32684     DownloadBoot code
32685 </refpurpose>
32686</refnamediv>
32687<refsynopsisdiv>
32688 <title>Synopsis</title>
32689  <funcsynopsis><funcprototype>
32690   <funcdef>int <function>mpt_downloadboot </function></funcdef>
32691   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32692   <paramdef>MpiFwHeader_t * <parameter>pFwHeader</parameter></paramdef>
32693   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32694  </funcprototype></funcsynopsis>
32695</refsynopsisdiv>
32696<refsect1>
32697 <title>Arguments</title>
32698 <variablelist>
32699  <varlistentry>
32700   <term><parameter>ioc</parameter></term>
32701   <listitem>
32702    <para>
32703     Pointer to MPT_ADAPTER structure
32704    </para>
32705   </listitem>
32706  </varlistentry>
32707  <varlistentry>
32708   <term><parameter>pFwHeader</parameter></term>
32709   <listitem>
32710    <para>
32711     Pointer to firmware header info
32712    </para>
32713   </listitem>
32714  </varlistentry>
32715  <varlistentry>
32716   <term><parameter>sleepFlag</parameter></term>
32717   <listitem>
32718    <para>
32719     Specifies whether the process can sleep
32720    </para>
32721   </listitem>
32722  </varlistentry>
32723 </variablelist>
32724</refsect1>
32725<refsect1>
32726<title>Description</title>
32727<para>
32728   FwDownloadBoot requires Programmed IO access.
32729   </para><para>
32730
32731   Returns 0 for success
32732   -1 FW Image size is 0
32733   -2 No valid cached_fw Pointer
32734   &lt;0 for fw upload failure.
32735</para>
32736</refsect1>
32737</refentry>
32738
32739<refentry id="API-KickStart">
32740<refentryinfo>
32741 <title>LINUX</title>
32742 <productname>Kernel Hackers Manual</productname>
32743 <date>July 2017</date>
32744</refentryinfo>
32745<refmeta>
32746 <refentrytitle><phrase>KickStart</phrase></refentrytitle>
32747 <manvolnum>9</manvolnum>
32748 <refmiscinfo class="version">4.1.27</refmiscinfo>
32749</refmeta>
32750<refnamediv>
32751 <refname>KickStart</refname>
32752 <refpurpose>
32753     Perform hard reset of MPT adapter.
32754 </refpurpose>
32755</refnamediv>
32756<refsynopsisdiv>
32757 <title>Synopsis</title>
32758  <funcsynopsis><funcprototype>
32759   <funcdef>int <function>KickStart </function></funcdef>
32760   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32761   <paramdef>int <parameter>force</parameter></paramdef>
32762   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32763  </funcprototype></funcsynopsis>
32764</refsynopsisdiv>
32765<refsect1>
32766 <title>Arguments</title>
32767 <variablelist>
32768  <varlistentry>
32769   <term><parameter>ioc</parameter></term>
32770   <listitem>
32771    <para>
32772     Pointer to MPT_ADAPTER structure
32773    </para>
32774   </listitem>
32775  </varlistentry>
32776  <varlistentry>
32777   <term><parameter>force</parameter></term>
32778   <listitem>
32779    <para>
32780     Force hard reset
32781    </para>
32782   </listitem>
32783  </varlistentry>
32784  <varlistentry>
32785   <term><parameter>sleepFlag</parameter></term>
32786   <listitem>
32787    <para>
32788     Specifies whether the process can sleep
32789    </para>
32790   </listitem>
32791  </varlistentry>
32792 </variablelist>
32793</refsect1>
32794<refsect1>
32795<title>Description</title>
32796<para>
32797   This routine places MPT adapter in diagnostic mode via the
32798   WriteSequence register, and then performs a hard reset of adapter
32799   via the Diagnostic register.
32800</para>
32801</refsect1>
32802<refsect1>
32803<title>Inputs</title>
32804<para>
32805   sleepflag - CAN_SLEEP (non-interrupt thread)
32806   or NO_SLEEP (interrupt thread, use mdelay)
32807   force - 1 if doorbell active, board fault state
32808   board operational, IOC_RECOVERY or
32809   IOC_BRINGUP and there is an alt_ioc.
32810   0 else
32811</para>
32812</refsect1>
32813<refsect1>
32814<title>Returns</title>
32815<para>
32816   1 - hard reset, READY
32817   0 - no reset due to History bit, READY
32818   -1 - no reset due to History bit but not READY
32819   OR reset but failed to come READY
32820   -2 - no reset, could not enter DIAG mode
32821   -3 - reset but bad FW bit
32822</para>
32823</refsect1>
32824</refentry>
32825
32826<refentry id="API-mpt-diag-reset">
32827<refentryinfo>
32828 <title>LINUX</title>
32829 <productname>Kernel Hackers Manual</productname>
32830 <date>July 2017</date>
32831</refentryinfo>
32832<refmeta>
32833 <refentrytitle><phrase>mpt_diag_reset</phrase></refentrytitle>
32834 <manvolnum>9</manvolnum>
32835 <refmiscinfo class="version">4.1.27</refmiscinfo>
32836</refmeta>
32837<refnamediv>
32838 <refname>mpt_diag_reset</refname>
32839 <refpurpose>
32840     Perform hard reset of the adapter.
32841 </refpurpose>
32842</refnamediv>
32843<refsynopsisdiv>
32844 <title>Synopsis</title>
32845  <funcsynopsis><funcprototype>
32846   <funcdef>int <function>mpt_diag_reset </function></funcdef>
32847   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32848   <paramdef>int <parameter>ignore</parameter></paramdef>
32849   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32850  </funcprototype></funcsynopsis>
32851</refsynopsisdiv>
32852<refsect1>
32853 <title>Arguments</title>
32854 <variablelist>
32855  <varlistentry>
32856   <term><parameter>ioc</parameter></term>
32857   <listitem>
32858    <para>
32859     Pointer to MPT_ADAPTER structure
32860    </para>
32861   </listitem>
32862  </varlistentry>
32863  <varlistentry>
32864   <term><parameter>ignore</parameter></term>
32865   <listitem>
32866    <para>
32867     Set if to honor and clear to ignore
32868     the reset history bit
32869    </para>
32870   </listitem>
32871  </varlistentry>
32872  <varlistentry>
32873   <term><parameter>sleepFlag</parameter></term>
32874   <listitem>
32875    <para>
32876     CAN_SLEEP if called in a non-interrupt thread,
32877     else set to NO_SLEEP (use mdelay instead)
32878    </para>
32879   </listitem>
32880  </varlistentry>
32881 </variablelist>
32882</refsect1>
32883<refsect1>
32884<title>Description</title>
32885<para>
32886   This routine places the adapter in diagnostic mode via the
32887   WriteSequence register and then performs a hard reset of adapter
32888   via the Diagnostic register. Adapter should be in ready state
32889   upon successful completion.
32890</para>
32891</refsect1>
32892<refsect1>
32893<title>Returns</title>
32894<para>
32895   1  hard reset successful
32896   0  no reset performed because reset history bit set
32897   -2  enabling diagnostic mode failed
32898   -3  diagnostic reset failed
32899</para>
32900</refsect1>
32901</refentry>
32902
32903<refentry id="API-SendIocReset">
32904<refentryinfo>
32905 <title>LINUX</title>
32906 <productname>Kernel Hackers Manual</productname>
32907 <date>July 2017</date>
32908</refentryinfo>
32909<refmeta>
32910 <refentrytitle><phrase>SendIocReset</phrase></refentrytitle>
32911 <manvolnum>9</manvolnum>
32912 <refmiscinfo class="version">4.1.27</refmiscinfo>
32913</refmeta>
32914<refnamediv>
32915 <refname>SendIocReset</refname>
32916 <refpurpose>
32917     Send IOCReset request to MPT adapter.
32918 </refpurpose>
32919</refnamediv>
32920<refsynopsisdiv>
32921 <title>Synopsis</title>
32922  <funcsynopsis><funcprototype>
32923   <funcdef>int <function>SendIocReset </function></funcdef>
32924   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32925   <paramdef>u8 <parameter>reset_type</parameter></paramdef>
32926   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32927  </funcprototype></funcsynopsis>
32928</refsynopsisdiv>
32929<refsect1>
32930 <title>Arguments</title>
32931 <variablelist>
32932  <varlistentry>
32933   <term><parameter>ioc</parameter></term>
32934   <listitem>
32935    <para>
32936     Pointer to MPT_ADAPTER structure
32937    </para>
32938   </listitem>
32939  </varlistentry>
32940  <varlistentry>
32941   <term><parameter>reset_type</parameter></term>
32942   <listitem>
32943    <para>
32944     reset type, expected values are
32945     <constant>MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET</constant> or <constant>MPI_FUNCTION_IO_UNIT_RESET</constant>
32946    </para>
32947   </listitem>
32948  </varlistentry>
32949  <varlistentry>
32950   <term><parameter>sleepFlag</parameter></term>
32951   <listitem>
32952    <para>
32953     Specifies whether the process can sleep
32954    </para>
32955   </listitem>
32956  </varlistentry>
32957 </variablelist>
32958</refsect1>
32959<refsect1>
32960<title>Description</title>
32961<para>
32962   Send IOCReset request to the MPT adapter.
32963   </para><para>
32964
32965   Returns 0 for success, non-zero for failure.
32966</para>
32967</refsect1>
32968</refentry>
32969
32970<refentry id="API-initChainBuffers">
32971<refentryinfo>
32972 <title>LINUX</title>
32973 <productname>Kernel Hackers Manual</productname>
32974 <date>July 2017</date>
32975</refentryinfo>
32976<refmeta>
32977 <refentrytitle><phrase>initChainBuffers</phrase></refentrytitle>
32978 <manvolnum>9</manvolnum>
32979 <refmiscinfo class="version">4.1.27</refmiscinfo>
32980</refmeta>
32981<refnamediv>
32982 <refname>initChainBuffers</refname>
32983 <refpurpose>
32984     Allocate memory for and initialize chain buffers
32985 </refpurpose>
32986</refnamediv>
32987<refsynopsisdiv>
32988 <title>Synopsis</title>
32989  <funcsynopsis><funcprototype>
32990   <funcdef>int <function>initChainBuffers </function></funcdef>
32991   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32992  </funcprototype></funcsynopsis>
32993</refsynopsisdiv>
32994<refsect1>
32995 <title>Arguments</title>
32996 <variablelist>
32997  <varlistentry>
32998   <term><parameter>ioc</parameter></term>
32999   <listitem>
33000    <para>
33001     Pointer to MPT_ADAPTER structure
33002    </para>
33003   </listitem>
33004  </varlistentry>
33005 </variablelist>
33006</refsect1>
33007<refsect1>
33008<title>Description</title>
33009<para>
33010   Allocates memory for and initializes chain buffers,
33011   chain buffer control arrays and spinlock.
33012</para>
33013</refsect1>
33014</refentry>
33015
33016<refentry id="API-PrimeIocFifos">
33017<refentryinfo>
33018 <title>LINUX</title>
33019 <productname>Kernel Hackers Manual</productname>
33020 <date>July 2017</date>
33021</refentryinfo>
33022<refmeta>
33023 <refentrytitle><phrase>PrimeIocFifos</phrase></refentrytitle>
33024 <manvolnum>9</manvolnum>
33025 <refmiscinfo class="version">4.1.27</refmiscinfo>
33026</refmeta>
33027<refnamediv>
33028 <refname>PrimeIocFifos</refname>
33029 <refpurpose>
33030     Initialize IOC request and reply FIFOs.
33031 </refpurpose>
33032</refnamediv>
33033<refsynopsisdiv>
33034 <title>Synopsis</title>
33035  <funcsynopsis><funcprototype>
33036   <funcdef>int <function>PrimeIocFifos </function></funcdef>
33037   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33038  </funcprototype></funcsynopsis>
33039</refsynopsisdiv>
33040<refsect1>
33041 <title>Arguments</title>
33042 <variablelist>
33043  <varlistentry>
33044   <term><parameter>ioc</parameter></term>
33045   <listitem>
33046    <para>
33047     Pointer to MPT_ADAPTER structure
33048    </para>
33049   </listitem>
33050  </varlistentry>
33051 </variablelist>
33052</refsect1>
33053<refsect1>
33054<title>Description</title>
33055<para>
33056   This routine allocates memory for the MPT reply and request frame
33057   pools (if necessary), and primes the IOC reply FIFO with
33058   reply frames.
33059   </para><para>
33060
33061   Returns 0 for success, non-zero for failure.
33062</para>
33063</refsect1>
33064</refentry>
33065
33066<refentry id="API-mpt-handshake-req-reply-wait">
33067<refentryinfo>
33068 <title>LINUX</title>
33069 <productname>Kernel Hackers Manual</productname>
33070 <date>July 2017</date>
33071</refentryinfo>
33072<refmeta>
33073 <refentrytitle><phrase>mpt_handshake_req_reply_wait</phrase></refentrytitle>
33074 <manvolnum>9</manvolnum>
33075 <refmiscinfo class="version">4.1.27</refmiscinfo>
33076</refmeta>
33077<refnamediv>
33078 <refname>mpt_handshake_req_reply_wait</refname>
33079 <refpurpose>
33080     Send MPT request to and receive reply from IOC via doorbell handshake method.
33081 </refpurpose>
33082</refnamediv>
33083<refsynopsisdiv>
33084 <title>Synopsis</title>
33085  <funcsynopsis><funcprototype>
33086   <funcdef>int <function>mpt_handshake_req_reply_wait </function></funcdef>
33087   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33088   <paramdef>int <parameter>reqBytes</parameter></paramdef>
33089   <paramdef>u32 * <parameter>req</parameter></paramdef>
33090   <paramdef>int <parameter>replyBytes</parameter></paramdef>
33091   <paramdef>u16 * <parameter>u16reply</parameter></paramdef>
33092   <paramdef>int <parameter>maxwait</parameter></paramdef>
33093   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33094  </funcprototype></funcsynopsis>
33095</refsynopsisdiv>
33096<refsect1>
33097 <title>Arguments</title>
33098 <variablelist>
33099  <varlistentry>
33100   <term><parameter>ioc</parameter></term>
33101   <listitem>
33102    <para>
33103     Pointer to MPT_ADAPTER structure
33104    </para>
33105   </listitem>
33106  </varlistentry>
33107  <varlistentry>
33108   <term><parameter>reqBytes</parameter></term>
33109   <listitem>
33110    <para>
33111     Size of the request in bytes
33112    </para>
33113   </listitem>
33114  </varlistentry>
33115  <varlistentry>
33116   <term><parameter>req</parameter></term>
33117   <listitem>
33118    <para>
33119     Pointer to MPT request frame
33120    </para>
33121   </listitem>
33122  </varlistentry>
33123  <varlistentry>
33124   <term><parameter>replyBytes</parameter></term>
33125   <listitem>
33126    <para>
33127     Expected size of the reply in bytes
33128    </para>
33129   </listitem>
33130  </varlistentry>
33131  <varlistentry>
33132   <term><parameter>u16reply</parameter></term>
33133   <listitem>
33134    <para>
33135     Pointer to area where reply should be written
33136    </para>
33137   </listitem>
33138  </varlistentry>
33139  <varlistentry>
33140   <term><parameter>maxwait</parameter></term>
33141   <listitem>
33142    <para>
33143     Max wait time for a reply (in seconds)
33144    </para>
33145   </listitem>
33146  </varlistentry>
33147  <varlistentry>
33148   <term><parameter>sleepFlag</parameter></term>
33149   <listitem>
33150    <para>
33151     Specifies whether the process can sleep
33152    </para>
33153   </listitem>
33154  </varlistentry>
33155 </variablelist>
33156</refsect1>
33157<refsect1>
33158<title>NOTES</title>
33159<para>
33160   It is the callers responsibility to byte-swap fields in the
33161   request which are greater than 1 byte in size.  It is also the
33162   callers responsibility to byte-swap response fields which are
33163   greater than 1 byte in size.
33164   </para><para>
33165
33166   Returns 0 for success, non-zero for failure.
33167</para>
33168</refsect1>
33169</refentry>
33170
33171<refentry id="API-WaitForDoorbellAck">
33172<refentryinfo>
33173 <title>LINUX</title>
33174 <productname>Kernel Hackers Manual</productname>
33175 <date>July 2017</date>
33176</refentryinfo>
33177<refmeta>
33178 <refentrytitle><phrase>WaitForDoorbellAck</phrase></refentrytitle>
33179 <manvolnum>9</manvolnum>
33180 <refmiscinfo class="version">4.1.27</refmiscinfo>
33181</refmeta>
33182<refnamediv>
33183 <refname>WaitForDoorbellAck</refname>
33184 <refpurpose>
33185     Wait for IOC doorbell handshake acknowledge
33186 </refpurpose>
33187</refnamediv>
33188<refsynopsisdiv>
33189 <title>Synopsis</title>
33190  <funcsynopsis><funcprototype>
33191   <funcdef>int <function>WaitForDoorbellAck </function></funcdef>
33192   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33193   <paramdef>int <parameter>howlong</parameter></paramdef>
33194   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33195  </funcprototype></funcsynopsis>
33196</refsynopsisdiv>
33197<refsect1>
33198 <title>Arguments</title>
33199 <variablelist>
33200  <varlistentry>
33201   <term><parameter>ioc</parameter></term>
33202   <listitem>
33203    <para>
33204     Pointer to MPT_ADAPTER structure
33205    </para>
33206   </listitem>
33207  </varlistentry>
33208  <varlistentry>
33209   <term><parameter>howlong</parameter></term>
33210   <listitem>
33211    <para>
33212     How long to wait (in seconds)
33213    </para>
33214   </listitem>
33215  </varlistentry>
33216  <varlistentry>
33217   <term><parameter>sleepFlag</parameter></term>
33218   <listitem>
33219    <para>
33220     Specifies whether the process can sleep
33221    </para>
33222   </listitem>
33223  </varlistentry>
33224 </variablelist>
33225</refsect1>
33226<refsect1>
33227<title>Description</title>
33228<para>
33229   This routine waits (up to ~2 seconds max) for IOC doorbell
33230   handshake ACKnowledge, indicated by the IOP_DOORBELL_STATUS
33231   bit in its IntStatus register being clear.
33232   </para><para>
33233
33234   Returns a negative value on failure, else wait loop count.
33235</para>
33236</refsect1>
33237</refentry>
33238
33239<refentry id="API-WaitForDoorbellInt">
33240<refentryinfo>
33241 <title>LINUX</title>
33242 <productname>Kernel Hackers Manual</productname>
33243 <date>July 2017</date>
33244</refentryinfo>
33245<refmeta>
33246 <refentrytitle><phrase>WaitForDoorbellInt</phrase></refentrytitle>
33247 <manvolnum>9</manvolnum>
33248 <refmiscinfo class="version">4.1.27</refmiscinfo>
33249</refmeta>
33250<refnamediv>
33251 <refname>WaitForDoorbellInt</refname>
33252 <refpurpose>
33253     Wait for IOC to set its doorbell interrupt bit
33254 </refpurpose>
33255</refnamediv>
33256<refsynopsisdiv>
33257 <title>Synopsis</title>
33258  <funcsynopsis><funcprototype>
33259   <funcdef>int <function>WaitForDoorbellInt </function></funcdef>
33260   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33261   <paramdef>int <parameter>howlong</parameter></paramdef>
33262   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33263  </funcprototype></funcsynopsis>
33264</refsynopsisdiv>
33265<refsect1>
33266 <title>Arguments</title>
33267 <variablelist>
33268  <varlistentry>
33269   <term><parameter>ioc</parameter></term>
33270   <listitem>
33271    <para>
33272     Pointer to MPT_ADAPTER structure
33273    </para>
33274   </listitem>
33275  </varlistentry>
33276  <varlistentry>
33277   <term><parameter>howlong</parameter></term>
33278   <listitem>
33279    <para>
33280     How long to wait (in seconds)
33281    </para>
33282   </listitem>
33283  </varlistentry>
33284  <varlistentry>
33285   <term><parameter>sleepFlag</parameter></term>
33286   <listitem>
33287    <para>
33288     Specifies whether the process can sleep
33289    </para>
33290   </listitem>
33291  </varlistentry>
33292 </variablelist>
33293</refsect1>
33294<refsect1>
33295<title>Description</title>
33296<para>
33297   This routine waits (up to ~2 seconds max) for IOC doorbell interrupt
33298   (MPI_HIS_DOORBELL_INTERRUPT) to be set in the IntStatus register.
33299   </para><para>
33300
33301   Returns a negative value on failure, else wait loop count.
33302</para>
33303</refsect1>
33304</refentry>
33305
33306<refentry id="API-WaitForDoorbellReply">
33307<refentryinfo>
33308 <title>LINUX</title>
33309 <productname>Kernel Hackers Manual</productname>
33310 <date>July 2017</date>
33311</refentryinfo>
33312<refmeta>
33313 <refentrytitle><phrase>WaitForDoorbellReply</phrase></refentrytitle>
33314 <manvolnum>9</manvolnum>
33315 <refmiscinfo class="version">4.1.27</refmiscinfo>
33316</refmeta>
33317<refnamediv>
33318 <refname>WaitForDoorbellReply</refname>
33319 <refpurpose>
33320     Wait for and capture an IOC handshake reply.
33321 </refpurpose>
33322</refnamediv>
33323<refsynopsisdiv>
33324 <title>Synopsis</title>
33325  <funcsynopsis><funcprototype>
33326   <funcdef>int <function>WaitForDoorbellReply </function></funcdef>
33327   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33328   <paramdef>int <parameter>howlong</parameter></paramdef>
33329   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33330  </funcprototype></funcsynopsis>
33331</refsynopsisdiv>
33332<refsect1>
33333 <title>Arguments</title>
33334 <variablelist>
33335  <varlistentry>
33336   <term><parameter>ioc</parameter></term>
33337   <listitem>
33338    <para>
33339     Pointer to MPT_ADAPTER structure
33340    </para>
33341   </listitem>
33342  </varlistentry>
33343  <varlistentry>
33344   <term><parameter>howlong</parameter></term>
33345   <listitem>
33346    <para>
33347     How long to wait (in seconds)
33348    </para>
33349   </listitem>
33350  </varlistentry>
33351  <varlistentry>
33352   <term><parameter>sleepFlag</parameter></term>
33353   <listitem>
33354    <para>
33355     Specifies whether the process can sleep
33356    </para>
33357   </listitem>
33358  </varlistentry>
33359 </variablelist>
33360</refsect1>
33361<refsect1>
33362<title>Description</title>
33363<para>
33364   This routine polls the IOC for a handshake reply, 16 bits at a time.
33365   Reply is cached to IOC private area large enough to hold a maximum
33366   of 128 bytes of reply data.
33367   </para><para>
33368
33369   Returns a negative value on failure, else size of reply in WORDS.
33370</para>
33371</refsect1>
33372</refentry>
33373
33374<refentry id="API-GetLanConfigPages">
33375<refentryinfo>
33376 <title>LINUX</title>
33377 <productname>Kernel Hackers Manual</productname>
33378 <date>July 2017</date>
33379</refentryinfo>
33380<refmeta>
33381 <refentrytitle><phrase>GetLanConfigPages</phrase></refentrytitle>
33382 <manvolnum>9</manvolnum>
33383 <refmiscinfo class="version">4.1.27</refmiscinfo>
33384</refmeta>
33385<refnamediv>
33386 <refname>GetLanConfigPages</refname>
33387 <refpurpose>
33388     Fetch LANConfig pages.
33389 </refpurpose>
33390</refnamediv>
33391<refsynopsisdiv>
33392 <title>Synopsis</title>
33393  <funcsynopsis><funcprototype>
33394   <funcdef>int <function>GetLanConfigPages </function></funcdef>
33395   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33396  </funcprototype></funcsynopsis>
33397</refsynopsisdiv>
33398<refsect1>
33399 <title>Arguments</title>
33400 <variablelist>
33401  <varlistentry>
33402   <term><parameter>ioc</parameter></term>
33403   <listitem>
33404    <para>
33405     Pointer to MPT_ADAPTER structure
33406    </para>
33407   </listitem>
33408  </varlistentry>
33409 </variablelist>
33410</refsect1>
33411<refsect1>
33412<title>Return</title>
33413<para>
33414   0 for success
33415   -ENOMEM if no memory available
33416   -EPERM if not allowed due to ISR context
33417   -EAGAIN if no msg frames currently available
33418   -EFAULT for non-successful reply or no reply (timeout)
33419</para>
33420</refsect1>
33421</refentry>
33422
33423<refentry id="API-GetIoUnitPage2">
33424<refentryinfo>
33425 <title>LINUX</title>
33426 <productname>Kernel Hackers Manual</productname>
33427 <date>July 2017</date>
33428</refentryinfo>
33429<refmeta>
33430 <refentrytitle><phrase>GetIoUnitPage2</phrase></refentrytitle>
33431 <manvolnum>9</manvolnum>
33432 <refmiscinfo class="version">4.1.27</refmiscinfo>
33433</refmeta>
33434<refnamediv>
33435 <refname>GetIoUnitPage2</refname>
33436 <refpurpose>
33437     Retrieve BIOS version and boot order information.
33438 </refpurpose>
33439</refnamediv>
33440<refsynopsisdiv>
33441 <title>Synopsis</title>
33442  <funcsynopsis><funcprototype>
33443   <funcdef>int <function>GetIoUnitPage2 </function></funcdef>
33444   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33445  </funcprototype></funcsynopsis>
33446</refsynopsisdiv>
33447<refsect1>
33448 <title>Arguments</title>
33449 <variablelist>
33450  <varlistentry>
33451   <term><parameter>ioc</parameter></term>
33452   <listitem>
33453    <para>
33454     Pointer to MPT_ADAPTER structure
33455    </para>
33456   </listitem>
33457  </varlistentry>
33458 </variablelist>
33459</refsect1>
33460<refsect1>
33461<title>Returns</title>
33462<para>
33463   0 for success
33464   -ENOMEM if no memory available
33465   -EPERM if not allowed due to ISR context
33466   -EAGAIN if no msg frames currently available
33467   -EFAULT for non-successful reply or no reply (timeout)
33468</para>
33469</refsect1>
33470</refentry>
33471
33472<refentry id="API-mpt-GetScsiPortSettings">
33473<refentryinfo>
33474 <title>LINUX</title>
33475 <productname>Kernel Hackers Manual</productname>
33476 <date>July 2017</date>
33477</refentryinfo>
33478<refmeta>
33479 <refentrytitle><phrase>mpt_GetScsiPortSettings</phrase></refentrytitle>
33480 <manvolnum>9</manvolnum>
33481 <refmiscinfo class="version">4.1.27</refmiscinfo>
33482</refmeta>
33483<refnamediv>
33484 <refname>mpt_GetScsiPortSettings</refname>
33485 <refpurpose>
33486     read SCSI Port Page 0 and 2
33487 </refpurpose>
33488</refnamediv>
33489<refsynopsisdiv>
33490 <title>Synopsis</title>
33491  <funcsynopsis><funcprototype>
33492   <funcdef>int <function>mpt_GetScsiPortSettings </function></funcdef>
33493   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33494   <paramdef>int <parameter>portnum</parameter></paramdef>
33495  </funcprototype></funcsynopsis>
33496</refsynopsisdiv>
33497<refsect1>
33498 <title>Arguments</title>
33499 <variablelist>
33500  <varlistentry>
33501   <term><parameter>ioc</parameter></term>
33502   <listitem>
33503    <para>
33504     Pointer to a Adapter Strucutre
33505    </para>
33506   </listitem>
33507  </varlistentry>
33508  <varlistentry>
33509   <term><parameter>portnum</parameter></term>
33510   <listitem>
33511    <para>
33512     IOC port number
33513    </para>
33514   </listitem>
33515  </varlistentry>
33516 </variablelist>
33517</refsect1>
33518<refsect1>
33519<title>Return</title>
33520<para>
33521   -EFAULT if read of config page header fails
33522   or if no nvram
33523   If read of SCSI Port Page 0 fails,
33524   NVRAM = MPT_HOST_NVRAM_INVALID  (0xFFFFFFFF)
33525</para>
33526</refsect1>
33527<refsect1>
33528<title>Adapter settings</title>
33529<para>
33530   async, narrow
33531   Return 1
33532   If read of SCSI Port Page 2 fails,
33533   Adapter settings valid
33534   NVRAM = MPT_HOST_NVRAM_INVALID  (0xFFFFFFFF)
33535   Return 1
33536   Else
33537   Both valid
33538   Return 0
33539   CHECK - what type of locking mechanisms should be used????
33540</para>
33541</refsect1>
33542</refentry>
33543
33544<refentry id="API-mpt-readScsiDevicePageHeaders">
33545<refentryinfo>
33546 <title>LINUX</title>
33547 <productname>Kernel Hackers Manual</productname>
33548 <date>July 2017</date>
33549</refentryinfo>
33550<refmeta>
33551 <refentrytitle><phrase>mpt_readScsiDevicePageHeaders</phrase></refentrytitle>
33552 <manvolnum>9</manvolnum>
33553 <refmiscinfo class="version">4.1.27</refmiscinfo>
33554</refmeta>
33555<refnamediv>
33556 <refname>mpt_readScsiDevicePageHeaders</refname>
33557 <refpurpose>
33558     save version and length of SDP1
33559 </refpurpose>
33560</refnamediv>
33561<refsynopsisdiv>
33562 <title>Synopsis</title>
33563  <funcsynopsis><funcprototype>
33564   <funcdef>int <function>mpt_readScsiDevicePageHeaders </function></funcdef>
33565   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33566   <paramdef>int <parameter>portnum</parameter></paramdef>
33567  </funcprototype></funcsynopsis>
33568</refsynopsisdiv>
33569<refsect1>
33570 <title>Arguments</title>
33571 <variablelist>
33572  <varlistentry>
33573   <term><parameter>ioc</parameter></term>
33574   <listitem>
33575    <para>
33576     Pointer to a Adapter Strucutre
33577    </para>
33578   </listitem>
33579  </varlistentry>
33580  <varlistentry>
33581   <term><parameter>portnum</parameter></term>
33582   <listitem>
33583    <para>
33584     IOC port number
33585    </para>
33586   </listitem>
33587  </varlistentry>
33588 </variablelist>
33589</refsect1>
33590<refsect1>
33591<title>Return</title>
33592<para>
33593   -EFAULT if read of config page header fails
33594   or 0 if success.
33595</para>
33596</refsect1>
33597</refentry>
33598
33599<refentry id="API-mpt-inactive-raid-list-free">
33600<refentryinfo>
33601 <title>LINUX</title>
33602 <productname>Kernel Hackers Manual</productname>
33603 <date>July 2017</date>
33604</refentryinfo>
33605<refmeta>
33606 <refentrytitle><phrase>mpt_inactive_raid_list_free</phrase></refentrytitle>
33607 <manvolnum>9</manvolnum>
33608 <refmiscinfo class="version">4.1.27</refmiscinfo>
33609</refmeta>
33610<refnamediv>
33611 <refname>mpt_inactive_raid_list_free</refname>
33612 <refpurpose>
33613     This clears this link list.
33614 </refpurpose>
33615</refnamediv>
33616<refsynopsisdiv>
33617 <title>Synopsis</title>
33618  <funcsynopsis><funcprototype>
33619   <funcdef>void <function>mpt_inactive_raid_list_free </function></funcdef>
33620   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33621  </funcprototype></funcsynopsis>
33622</refsynopsisdiv>
33623<refsect1>
33624 <title>Arguments</title>
33625 <variablelist>
33626  <varlistentry>
33627   <term><parameter>ioc</parameter></term>
33628   <listitem>
33629    <para>
33630     pointer to per adapter structure
33631    </para>
33632   </listitem>
33633  </varlistentry>
33634 </variablelist>
33635</refsect1>
33636</refentry>
33637
33638<refentry id="API-mpt-inactive-raid-volumes">
33639<refentryinfo>
33640 <title>LINUX</title>
33641 <productname>Kernel Hackers Manual</productname>
33642 <date>July 2017</date>
33643</refentryinfo>
33644<refmeta>
33645 <refentrytitle><phrase>mpt_inactive_raid_volumes</phrase></refentrytitle>
33646 <manvolnum>9</manvolnum>
33647 <refmiscinfo class="version">4.1.27</refmiscinfo>
33648</refmeta>
33649<refnamediv>
33650 <refname>mpt_inactive_raid_volumes</refname>
33651 <refpurpose>
33652     sets up link list of phy_disk_nums for devices belonging in an inactive volume
33653 </refpurpose>
33654</refnamediv>
33655<refsynopsisdiv>
33656 <title>Synopsis</title>
33657  <funcsynopsis><funcprototype>
33658   <funcdef>void <function>mpt_inactive_raid_volumes </function></funcdef>
33659   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33660   <paramdef>u8 <parameter>channel</parameter></paramdef>
33661   <paramdef>u8 <parameter>id</parameter></paramdef>
33662  </funcprototype></funcsynopsis>
33663</refsynopsisdiv>
33664<refsect1>
33665 <title>Arguments</title>
33666 <variablelist>
33667  <varlistentry>
33668   <term><parameter>ioc</parameter></term>
33669   <listitem>
33670    <para>
33671     pointer to per adapter structure
33672    </para>
33673   </listitem>
33674  </varlistentry>
33675  <varlistentry>
33676   <term><parameter>channel</parameter></term>
33677   <listitem>
33678    <para>
33679     volume channel
33680    </para>
33681   </listitem>
33682  </varlistentry>
33683  <varlistentry>
33684   <term><parameter>id</parameter></term>
33685   <listitem>
33686    <para>
33687     volume target id
33688    </para>
33689   </listitem>
33690  </varlistentry>
33691 </variablelist>
33692</refsect1>
33693</refentry>
33694
33695<refentry id="API-SendEventNotification">
33696<refentryinfo>
33697 <title>LINUX</title>
33698 <productname>Kernel Hackers Manual</productname>
33699 <date>July 2017</date>
33700</refentryinfo>
33701<refmeta>
33702 <refentrytitle><phrase>SendEventNotification</phrase></refentrytitle>
33703 <manvolnum>9</manvolnum>
33704 <refmiscinfo class="version">4.1.27</refmiscinfo>
33705</refmeta>
33706<refnamediv>
33707 <refname>SendEventNotification</refname>
33708 <refpurpose>
33709     Send EventNotification (on or off) request to adapter
33710 </refpurpose>
33711</refnamediv>
33712<refsynopsisdiv>
33713 <title>Synopsis</title>
33714  <funcsynopsis><funcprototype>
33715   <funcdef>int <function>SendEventNotification </function></funcdef>
33716   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33717   <paramdef>u8 <parameter>EvSwitch</parameter></paramdef>
33718   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33719  </funcprototype></funcsynopsis>
33720</refsynopsisdiv>
33721<refsect1>
33722 <title>Arguments</title>
33723 <variablelist>
33724  <varlistentry>
33725   <term><parameter>ioc</parameter></term>
33726   <listitem>
33727    <para>
33728     Pointer to MPT_ADAPTER structure
33729    </para>
33730   </listitem>
33731  </varlistentry>
33732  <varlistentry>
33733   <term><parameter>EvSwitch</parameter></term>
33734   <listitem>
33735    <para>
33736     Event switch flags
33737    </para>
33738   </listitem>
33739  </varlistentry>
33740  <varlistentry>
33741   <term><parameter>sleepFlag</parameter></term>
33742   <listitem>
33743    <para>
33744     Specifies whether the process can sleep
33745    </para>
33746   </listitem>
33747  </varlistentry>
33748 </variablelist>
33749</refsect1>
33750</refentry>
33751
33752<refentry id="API-SendEventAck">
33753<refentryinfo>
33754 <title>LINUX</title>
33755 <productname>Kernel Hackers Manual</productname>
33756 <date>July 2017</date>
33757</refentryinfo>
33758<refmeta>
33759 <refentrytitle><phrase>SendEventAck</phrase></refentrytitle>
33760 <manvolnum>9</manvolnum>
33761 <refmiscinfo class="version">4.1.27</refmiscinfo>
33762</refmeta>
33763<refnamediv>
33764 <refname>SendEventAck</refname>
33765 <refpurpose>
33766     Send EventAck request to MPT adapter.
33767 </refpurpose>
33768</refnamediv>
33769<refsynopsisdiv>
33770 <title>Synopsis</title>
33771  <funcsynopsis><funcprototype>
33772   <funcdef>int <function>SendEventAck </function></funcdef>
33773   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33774   <paramdef>EventNotificationReply_t * <parameter>evnp</parameter></paramdef>
33775  </funcprototype></funcsynopsis>
33776</refsynopsisdiv>
33777<refsect1>
33778 <title>Arguments</title>
33779 <variablelist>
33780  <varlistentry>
33781   <term><parameter>ioc</parameter></term>
33782   <listitem>
33783    <para>
33784     Pointer to MPT_ADAPTER structure
33785    </para>
33786   </listitem>
33787  </varlistentry>
33788  <varlistentry>
33789   <term><parameter>evnp</parameter></term>
33790   <listitem>
33791    <para>
33792     Pointer to original EventNotification request
33793    </para>
33794   </listitem>
33795  </varlistentry>
33796 </variablelist>
33797</refsect1>
33798</refentry>
33799
33800<refentry id="API-mpt-ioc-reset">
33801<refentryinfo>
33802 <title>LINUX</title>
33803 <productname>Kernel Hackers Manual</productname>
33804 <date>July 2017</date>
33805</refentryinfo>
33806<refmeta>
33807 <refentrytitle><phrase>mpt_ioc_reset</phrase></refentrytitle>
33808 <manvolnum>9</manvolnum>
33809 <refmiscinfo class="version">4.1.27</refmiscinfo>
33810</refmeta>
33811<refnamediv>
33812 <refname>mpt_ioc_reset</refname>
33813 <refpurpose>
33814     Base cleanup for hard reset
33815 </refpurpose>
33816</refnamediv>
33817<refsynopsisdiv>
33818 <title>Synopsis</title>
33819  <funcsynopsis><funcprototype>
33820   <funcdef>int <function>mpt_ioc_reset </function></funcdef>
33821   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33822   <paramdef>int <parameter>reset_phase</parameter></paramdef>
33823  </funcprototype></funcsynopsis>
33824</refsynopsisdiv>
33825<refsect1>
33826 <title>Arguments</title>
33827 <variablelist>
33828  <varlistentry>
33829   <term><parameter>ioc</parameter></term>
33830   <listitem>
33831    <para>
33832     Pointer to the adapter structure
33833    </para>
33834   </listitem>
33835  </varlistentry>
33836  <varlistentry>
33837   <term><parameter>reset_phase</parameter></term>
33838   <listitem>
33839    <para>
33840     Indicates pre- or post-reset functionality
33841    </para>
33842   </listitem>
33843  </varlistentry>
33844 </variablelist>
33845</refsect1>
33846<refsect1>
33847<title>Remark</title>
33848<para>
33849   Frees resources with internally generated commands.
33850</para>
33851</refsect1>
33852</refentry>
33853
33854<refentry id="API-procmpt-create">
33855<refentryinfo>
33856 <title>LINUX</title>
33857 <productname>Kernel Hackers Manual</productname>
33858 <date>July 2017</date>
33859</refentryinfo>
33860<refmeta>
33861 <refentrytitle><phrase>procmpt_create</phrase></refentrytitle>
33862 <manvolnum>9</manvolnum>
33863 <refmiscinfo class="version">4.1.27</refmiscinfo>
33864</refmeta>
33865<refnamediv>
33866 <refname>procmpt_create</refname>
33867 <refpurpose>
33868     Create <constant>MPT_PROCFS_MPTBASEDIR</constant> entries.
33869 </refpurpose>
33870</refnamediv>
33871<refsynopsisdiv>
33872 <title>Synopsis</title>
33873  <funcsynopsis><funcprototype>
33874   <funcdef>int <function>procmpt_create </function></funcdef>
33875   <paramdef> <parameter>void</parameter></paramdef>
33876  </funcprototype></funcsynopsis>
33877</refsynopsisdiv>
33878<refsect1>
33879 <title>Arguments</title>
33880 <variablelist>
33881  <varlistentry>
33882   <term><parameter>void</parameter></term>
33883   <listitem>
33884    <para>
33885     no arguments
33886    </para>
33887   </listitem>
33888  </varlistentry>
33889 </variablelist>
33890</refsect1>
33891<refsect1>
33892<title>Description</title>
33893<para>
33894   </para><para>
33895
33896   Returns 0 for success, non-zero for failure.
33897</para>
33898</refsect1>
33899</refentry>
33900
33901<refentry id="API-procmpt-destroy">
33902<refentryinfo>
33903 <title>LINUX</title>
33904 <productname>Kernel Hackers Manual</productname>
33905 <date>July 2017</date>
33906</refentryinfo>
33907<refmeta>
33908 <refentrytitle><phrase>procmpt_destroy</phrase></refentrytitle>
33909 <manvolnum>9</manvolnum>
33910 <refmiscinfo class="version">4.1.27</refmiscinfo>
33911</refmeta>
33912<refnamediv>
33913 <refname>procmpt_destroy</refname>
33914 <refpurpose>
33915     Tear down <constant>MPT_PROCFS_MPTBASEDIR</constant> entries.
33916 </refpurpose>
33917</refnamediv>
33918<refsynopsisdiv>
33919 <title>Synopsis</title>
33920  <funcsynopsis><funcprototype>
33921   <funcdef>void <function>procmpt_destroy </function></funcdef>
33922   <paramdef> <parameter>void</parameter></paramdef>
33923  </funcprototype></funcsynopsis>
33924</refsynopsisdiv>
33925<refsect1>
33926 <title>Arguments</title>
33927 <variablelist>
33928  <varlistentry>
33929   <term><parameter>void</parameter></term>
33930   <listitem>
33931    <para>
33932     no arguments
33933    </para>
33934   </listitem>
33935  </varlistentry>
33936 </variablelist>
33937</refsect1>
33938<refsect1>
33939<title>Description</title>
33940<para>
33941   </para><para>
33942
33943   Returns 0 for success, non-zero for failure.
33944</para>
33945</refsect1>
33946</refentry>
33947
33948<refentry id="API-mpt-SoftResetHandler">
33949<refentryinfo>
33950 <title>LINUX</title>
33951 <productname>Kernel Hackers Manual</productname>
33952 <date>July 2017</date>
33953</refentryinfo>
33954<refmeta>
33955 <refentrytitle><phrase>mpt_SoftResetHandler</phrase></refentrytitle>
33956 <manvolnum>9</manvolnum>
33957 <refmiscinfo class="version">4.1.27</refmiscinfo>
33958</refmeta>
33959<refnamediv>
33960 <refname>mpt_SoftResetHandler</refname>
33961 <refpurpose>
33962     Issues a less expensive reset
33963 </refpurpose>
33964</refnamediv>
33965<refsynopsisdiv>
33966 <title>Synopsis</title>
33967  <funcsynopsis><funcprototype>
33968   <funcdef>int <function>mpt_SoftResetHandler </function></funcdef>
33969   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33970   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33971  </funcprototype></funcsynopsis>
33972</refsynopsisdiv>
33973<refsect1>
33974 <title>Arguments</title>
33975 <variablelist>
33976  <varlistentry>
33977   <term><parameter>ioc</parameter></term>
33978   <listitem>
33979    <para>
33980     Pointer to MPT_ADAPTER structure
33981    </para>
33982   </listitem>
33983  </varlistentry>
33984  <varlistentry>
33985   <term><parameter>sleepFlag</parameter></term>
33986   <listitem>
33987    <para>
33988     Indicates if sleep or schedule must be called.
33989    </para>
33990   </listitem>
33991  </varlistentry>
33992 </variablelist>
33993</refsect1>
33994<refsect1>
33995<title>Description</title>
33996<para>
33997   Returns 0 for SUCCESS or -1 if FAILED.
33998   </para><para>
33999
34000   Message Unit Reset - instructs the IOC to reset the Reply Post and
34001   Free FIFO's. All the Message Frames on Reply Free FIFO are discarded.
34002   All posted buffers are freed, and event notification is turned off.
34003   IOC doesn't reply to any outstanding request. This will transfer IOC
34004   to READY state.
34005</para>
34006</refsect1>
34007</refentry>
34008
34009<refentry id="API-ProcessEventNotification">
34010<refentryinfo>
34011 <title>LINUX</title>
34012 <productname>Kernel Hackers Manual</productname>
34013 <date>July 2017</date>
34014</refentryinfo>
34015<refmeta>
34016 <refentrytitle><phrase>ProcessEventNotification</phrase></refentrytitle>
34017 <manvolnum>9</manvolnum>
34018 <refmiscinfo class="version">4.1.27</refmiscinfo>
34019</refmeta>
34020<refnamediv>
34021 <refname>ProcessEventNotification</refname>
34022 <refpurpose>
34023     Route EventNotificationReply to all event handlers
34024 </refpurpose>
34025</refnamediv>
34026<refsynopsisdiv>
34027 <title>Synopsis</title>
34028  <funcsynopsis><funcprototype>
34029   <funcdef>int <function>ProcessEventNotification </function></funcdef>
34030   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34031   <paramdef>EventNotificationReply_t * <parameter>pEventReply</parameter></paramdef>
34032   <paramdef>int * <parameter>evHandlers</parameter></paramdef>
34033  </funcprototype></funcsynopsis>
34034</refsynopsisdiv>
34035<refsect1>
34036 <title>Arguments</title>
34037 <variablelist>
34038  <varlistentry>
34039   <term><parameter>ioc</parameter></term>
34040   <listitem>
34041    <para>
34042     Pointer to MPT_ADAPTER structure
34043    </para>
34044   </listitem>
34045  </varlistentry>
34046  <varlistentry>
34047   <term><parameter>pEventReply</parameter></term>
34048   <listitem>
34049    <para>
34050     Pointer to EventNotification reply frame
34051    </para>
34052   </listitem>
34053  </varlistentry>
34054  <varlistentry>
34055   <term><parameter>evHandlers</parameter></term>
34056   <listitem>
34057    <para>
34058     Pointer to integer, number of event handlers
34059    </para>
34060   </listitem>
34061  </varlistentry>
34062 </variablelist>
34063</refsect1>
34064<refsect1>
34065<title>Description</title>
34066<para>
34067   Routes a received EventNotificationReply to all currently registered
34068   event handlers.
34069   Returns sum of event handlers return values.
34070</para>
34071</refsect1>
34072</refentry>
34073
34074<refentry id="API-mpt-fc-log-info">
34075<refentryinfo>
34076 <title>LINUX</title>
34077 <productname>Kernel Hackers Manual</productname>
34078 <date>July 2017</date>
34079</refentryinfo>
34080<refmeta>
34081 <refentrytitle><phrase>mpt_fc_log_info</phrase></refentrytitle>
34082 <manvolnum>9</manvolnum>
34083 <refmiscinfo class="version">4.1.27</refmiscinfo>
34084</refmeta>
34085<refnamediv>
34086 <refname>mpt_fc_log_info</refname>
34087 <refpurpose>
34088     Log information returned from Fibre Channel IOC.
34089 </refpurpose>
34090</refnamediv>
34091<refsynopsisdiv>
34092 <title>Synopsis</title>
34093  <funcsynopsis><funcprototype>
34094   <funcdef>void <function>mpt_fc_log_info </function></funcdef>
34095   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34096   <paramdef>u32 <parameter>log_info</parameter></paramdef>
34097  </funcprototype></funcsynopsis>
34098</refsynopsisdiv>
34099<refsect1>
34100 <title>Arguments</title>
34101 <variablelist>
34102  <varlistentry>
34103   <term><parameter>ioc</parameter></term>
34104   <listitem>
34105    <para>
34106     Pointer to MPT_ADAPTER structure
34107    </para>
34108   </listitem>
34109  </varlistentry>
34110  <varlistentry>
34111   <term><parameter>log_info</parameter></term>
34112   <listitem>
34113    <para>
34114     U32 LogInfo reply word from the IOC
34115    </para>
34116   </listitem>
34117  </varlistentry>
34118 </variablelist>
34119</refsect1>
34120<refsect1>
34121<title>Description</title>
34122<para>
34123   Refer to lsi/mpi_log_fc.h.
34124</para>
34125</refsect1>
34126</refentry>
34127
34128<refentry id="API-mpt-spi-log-info">
34129<refentryinfo>
34130 <title>LINUX</title>
34131 <productname>Kernel Hackers Manual</productname>
34132 <date>July 2017</date>
34133</refentryinfo>
34134<refmeta>
34135 <refentrytitle><phrase>mpt_spi_log_info</phrase></refentrytitle>
34136 <manvolnum>9</manvolnum>
34137 <refmiscinfo class="version">4.1.27</refmiscinfo>
34138</refmeta>
34139<refnamediv>
34140 <refname>mpt_spi_log_info</refname>
34141 <refpurpose>
34142     Log information returned from SCSI Parallel IOC.
34143 </refpurpose>
34144</refnamediv>
34145<refsynopsisdiv>
34146 <title>Synopsis</title>
34147  <funcsynopsis><funcprototype>
34148   <funcdef>void <function>mpt_spi_log_info </function></funcdef>
34149   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34150   <paramdef>u32 <parameter>log_info</parameter></paramdef>
34151  </funcprototype></funcsynopsis>
34152</refsynopsisdiv>
34153<refsect1>
34154 <title>Arguments</title>
34155 <variablelist>
34156  <varlistentry>
34157   <term><parameter>ioc</parameter></term>
34158   <listitem>
34159    <para>
34160     Pointer to MPT_ADAPTER structure
34161    </para>
34162   </listitem>
34163  </varlistentry>
34164  <varlistentry>
34165   <term><parameter>log_info</parameter></term>
34166   <listitem>
34167    <para>
34168     U32 LogInfo word from the IOC
34169    </para>
34170   </listitem>
34171  </varlistentry>
34172 </variablelist>
34173</refsect1>
34174<refsect1>
34175<title>Description</title>
34176<para>
34177   Refer to lsi/sp_log.h.
34178</para>
34179</refsect1>
34180</refentry>
34181
34182<refentry id="API-mpt-sas-log-info">
34183<refentryinfo>
34184 <title>LINUX</title>
34185 <productname>Kernel Hackers Manual</productname>
34186 <date>July 2017</date>
34187</refentryinfo>
34188<refmeta>
34189 <refentrytitle><phrase>mpt_sas_log_info</phrase></refentrytitle>
34190 <manvolnum>9</manvolnum>
34191 <refmiscinfo class="version">4.1.27</refmiscinfo>
34192</refmeta>
34193<refnamediv>
34194 <refname>mpt_sas_log_info</refname>
34195 <refpurpose>
34196     Log information returned from SAS IOC.
34197 </refpurpose>
34198</refnamediv>
34199<refsynopsisdiv>
34200 <title>Synopsis</title>
34201  <funcsynopsis><funcprototype>
34202   <funcdef>void <function>mpt_sas_log_info </function></funcdef>
34203   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34204   <paramdef>u32 <parameter>log_info</parameter></paramdef>
34205   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
34206  </funcprototype></funcsynopsis>
34207</refsynopsisdiv>
34208<refsect1>
34209 <title>Arguments</title>
34210 <variablelist>
34211  <varlistentry>
34212   <term><parameter>ioc</parameter></term>
34213   <listitem>
34214    <para>
34215     Pointer to MPT_ADAPTER structure
34216    </para>
34217   </listitem>
34218  </varlistentry>
34219  <varlistentry>
34220   <term><parameter>log_info</parameter></term>
34221   <listitem>
34222    <para>
34223     U32 LogInfo reply word from the IOC
34224    </para>
34225   </listitem>
34226  </varlistentry>
34227  <varlistentry>
34228   <term><parameter>cb_idx</parameter></term>
34229   <listitem>
34230    <para>
34231     callback function's handle
34232    </para>
34233   </listitem>
34234  </varlistentry>
34235 </variablelist>
34236</refsect1>
34237<refsect1>
34238<title>Description</title>
34239<para>
34240   Refer to lsi/mpi_log_sas.h.
34241</para>
34242</refsect1>
34243</refentry>
34244
34245<refentry id="API-mpt-iocstatus-info-config">
34246<refentryinfo>
34247 <title>LINUX</title>
34248 <productname>Kernel Hackers Manual</productname>
34249 <date>July 2017</date>
34250</refentryinfo>
34251<refmeta>
34252 <refentrytitle><phrase>mpt_iocstatus_info_config</phrase></refentrytitle>
34253 <manvolnum>9</manvolnum>
34254 <refmiscinfo class="version">4.1.27</refmiscinfo>
34255</refmeta>
34256<refnamediv>
34257 <refname>mpt_iocstatus_info_config</refname>
34258 <refpurpose>
34259     IOCSTATUS information for config pages
34260 </refpurpose>
34261</refnamediv>
34262<refsynopsisdiv>
34263 <title>Synopsis</title>
34264  <funcsynopsis><funcprototype>
34265   <funcdef>void <function>mpt_iocstatus_info_config </function></funcdef>
34266   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34267   <paramdef>u32 <parameter>ioc_status</parameter></paramdef>
34268   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
34269  </funcprototype></funcsynopsis>
34270</refsynopsisdiv>
34271<refsect1>
34272 <title>Arguments</title>
34273 <variablelist>
34274  <varlistentry>
34275   <term><parameter>ioc</parameter></term>
34276   <listitem>
34277    <para>
34278     Pointer to MPT_ADAPTER structure
34279    </para>
34280   </listitem>
34281  </varlistentry>
34282  <varlistentry>
34283   <term><parameter>ioc_status</parameter></term>
34284   <listitem>
34285    <para>
34286     U32 IOCStatus word from IOC
34287    </para>
34288   </listitem>
34289  </varlistentry>
34290  <varlistentry>
34291   <term><parameter>mf</parameter></term>
34292   <listitem>
34293    <para>
34294     Pointer to MPT request frame
34295    </para>
34296   </listitem>
34297  </varlistentry>
34298 </variablelist>
34299</refsect1>
34300<refsect1>
34301<title>Description</title>
34302<para>
34303   Refer to lsi/mpi.h.
34304</para>
34305</refsect1>
34306</refentry>
34307
34308<refentry id="API-mpt-iocstatus-info">
34309<refentryinfo>
34310 <title>LINUX</title>
34311 <productname>Kernel Hackers Manual</productname>
34312 <date>July 2017</date>
34313</refentryinfo>
34314<refmeta>
34315 <refentrytitle><phrase>mpt_iocstatus_info</phrase></refentrytitle>
34316 <manvolnum>9</manvolnum>
34317 <refmiscinfo class="version">4.1.27</refmiscinfo>
34318</refmeta>
34319<refnamediv>
34320 <refname>mpt_iocstatus_info</refname>
34321 <refpurpose>
34322     IOCSTATUS information returned from IOC.
34323 </refpurpose>
34324</refnamediv>
34325<refsynopsisdiv>
34326 <title>Synopsis</title>
34327  <funcsynopsis><funcprototype>
34328   <funcdef>void <function>mpt_iocstatus_info </function></funcdef>
34329   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34330   <paramdef>u32 <parameter>ioc_status</parameter></paramdef>
34331   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
34332  </funcprototype></funcsynopsis>
34333</refsynopsisdiv>
34334<refsect1>
34335 <title>Arguments</title>
34336 <variablelist>
34337  <varlistentry>
34338   <term><parameter>ioc</parameter></term>
34339   <listitem>
34340    <para>
34341     Pointer to MPT_ADAPTER structure
34342    </para>
34343   </listitem>
34344  </varlistentry>
34345  <varlistentry>
34346   <term><parameter>ioc_status</parameter></term>
34347   <listitem>
34348    <para>
34349     U32 IOCStatus word from IOC
34350    </para>
34351   </listitem>
34352  </varlistentry>
34353  <varlistentry>
34354   <term><parameter>mf</parameter></term>
34355   <listitem>
34356    <para>
34357     Pointer to MPT request frame
34358    </para>
34359   </listitem>
34360  </varlistentry>
34361 </variablelist>
34362</refsect1>
34363<refsect1>
34364<title>Description</title>
34365<para>
34366   Refer to lsi/mpi.h.
34367</para>
34368</refsect1>
34369</refentry>
34370
34371<refentry id="API-fusion-init">
34372<refentryinfo>
34373 <title>LINUX</title>
34374 <productname>Kernel Hackers Manual</productname>
34375 <date>July 2017</date>
34376</refentryinfo>
34377<refmeta>
34378 <refentrytitle><phrase>fusion_init</phrase></refentrytitle>
34379 <manvolnum>9</manvolnum>
34380 <refmiscinfo class="version">4.1.27</refmiscinfo>
34381</refmeta>
34382<refnamediv>
34383 <refname>fusion_init</refname>
34384 <refpurpose>
34385     Fusion MPT base driver initialization routine.
34386 </refpurpose>
34387</refnamediv>
34388<refsynopsisdiv>
34389 <title>Synopsis</title>
34390  <funcsynopsis><funcprototype>
34391   <funcdef>int <function>fusion_init </function></funcdef>
34392   <paramdef> <parameter>void</parameter></paramdef>
34393  </funcprototype></funcsynopsis>
34394</refsynopsisdiv>
34395<refsect1>
34396 <title>Arguments</title>
34397 <variablelist>
34398  <varlistentry>
34399   <term><parameter>void</parameter></term>
34400   <listitem>
34401    <para>
34402     no arguments
34403    </para>
34404   </listitem>
34405  </varlistentry>
34406 </variablelist>
34407</refsect1>
34408<refsect1>
34409<title>Description</title>
34410<para>
34411   </para><para>
34412
34413   Returns 0 for success, non-zero for failure.
34414</para>
34415</refsect1>
34416</refentry>
34417
34418<refentry id="API-fusion-exit">
34419<refentryinfo>
34420 <title>LINUX</title>
34421 <productname>Kernel Hackers Manual</productname>
34422 <date>July 2017</date>
34423</refentryinfo>
34424<refmeta>
34425 <refentrytitle><phrase>fusion_exit</phrase></refentrytitle>
34426 <manvolnum>9</manvolnum>
34427 <refmiscinfo class="version">4.1.27</refmiscinfo>
34428</refmeta>
34429<refnamediv>
34430 <refname>fusion_exit</refname>
34431 <refpurpose>
34432     Perform driver unload cleanup.
34433 </refpurpose>
34434</refnamediv>
34435<refsynopsisdiv>
34436 <title>Synopsis</title>
34437  <funcsynopsis><funcprototype>
34438   <funcdef>void __exit <function>fusion_exit </function></funcdef>
34439   <paramdef> <parameter>void</parameter></paramdef>
34440  </funcprototype></funcsynopsis>
34441</refsynopsisdiv>
34442<refsect1>
34443 <title>Arguments</title>
34444 <variablelist>
34445  <varlistentry>
34446   <term><parameter>void</parameter></term>
34447   <listitem>
34448    <para>
34449     no arguments
34450    </para>
34451   </listitem>
34452  </varlistentry>
34453 </variablelist>
34454</refsect1>
34455<refsect1>
34456<title>Description</title>
34457<para>
34458   </para><para>
34459
34460   This routine frees all resources associated with each MPT adapter
34461   and removes all <constant>MPT_PROCFS_MPTBASEDIR</constant> entries.
34462</para>
34463</refsect1>
34464</refentry>
34465
34466<!-- drivers/message/fusion/mptscsih.c -->
34467<refentry id="API-mptscsih-info">
34468<refentryinfo>
34469 <title>LINUX</title>
34470 <productname>Kernel Hackers Manual</productname>
34471 <date>July 2017</date>
34472</refentryinfo>
34473<refmeta>
34474 <refentrytitle><phrase>mptscsih_info</phrase></refentrytitle>
34475 <manvolnum>9</manvolnum>
34476 <refmiscinfo class="version">4.1.27</refmiscinfo>
34477</refmeta>
34478<refnamediv>
34479 <refname>mptscsih_info</refname>
34480 <refpurpose>
34481  Return information about MPT adapter
34482 </refpurpose>
34483</refnamediv>
34484<refsynopsisdiv>
34485 <title>Synopsis</title>
34486  <funcsynopsis><funcprototype>
34487   <funcdef>const char * <function>mptscsih_info </function></funcdef>
34488   <paramdef>struct Scsi_Host * <parameter>SChost</parameter></paramdef>
34489  </funcprototype></funcsynopsis>
34490</refsynopsisdiv>
34491<refsect1>
34492 <title>Arguments</title>
34493 <variablelist>
34494  <varlistentry>
34495   <term><parameter>SChost</parameter></term>
34496   <listitem>
34497    <para>
34498     Pointer to Scsi_Host structure
34499    </para>
34500   </listitem>
34501  </varlistentry>
34502 </variablelist>
34503</refsect1>
34504<refsect1>
34505<title>Description</title>
34506<para>
34507   (linux scsi_host_template.info routine)
34508   </para><para>
34509
34510   Returns pointer to buffer where information was written.
34511</para>
34512</refsect1>
34513</refentry>
34514
34515<refentry id="API-mptscsih-qcmd">
34516<refentryinfo>
34517 <title>LINUX</title>
34518 <productname>Kernel Hackers Manual</productname>
34519 <date>July 2017</date>
34520</refentryinfo>
34521<refmeta>
34522 <refentrytitle><phrase>mptscsih_qcmd</phrase></refentrytitle>
34523 <manvolnum>9</manvolnum>
34524 <refmiscinfo class="version">4.1.27</refmiscinfo>
34525</refmeta>
34526<refnamediv>
34527 <refname>mptscsih_qcmd</refname>
34528 <refpurpose>
34529     Primary Fusion MPT SCSI initiator IO start routine.
34530 </refpurpose>
34531</refnamediv>
34532<refsynopsisdiv>
34533 <title>Synopsis</title>
34534  <funcsynopsis><funcprototype>
34535   <funcdef>int <function>mptscsih_qcmd </function></funcdef>
34536   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
34537  </funcprototype></funcsynopsis>
34538</refsynopsisdiv>
34539<refsect1>
34540 <title>Arguments</title>
34541 <variablelist>
34542  <varlistentry>
34543   <term><parameter>SCpnt</parameter></term>
34544   <listitem>
34545    <para>
34546     Pointer to scsi_cmnd structure
34547    </para>
34548   </listitem>
34549  </varlistentry>
34550 </variablelist>
34551</refsect1>
34552<refsect1>
34553<title>Description</title>
34554<para>
34555   (linux scsi_host_template.queuecommand routine)
34556   This is the primary SCSI IO start routine.  Create a MPI SCSIIORequest
34557   from a linux scsi_cmnd request and send it to the IOC.
34558   </para><para>
34559
34560   Returns 0. (rtn value discarded by linux scsi mid-layer)
34561</para>
34562</refsect1>
34563</refentry>
34564
34565<refentry id="API-mptscsih-IssueTaskMgmt">
34566<refentryinfo>
34567 <title>LINUX</title>
34568 <productname>Kernel Hackers Manual</productname>
34569 <date>July 2017</date>
34570</refentryinfo>
34571<refmeta>
34572 <refentrytitle><phrase>mptscsih_IssueTaskMgmt</phrase></refentrytitle>
34573 <manvolnum>9</manvolnum>
34574 <refmiscinfo class="version">4.1.27</refmiscinfo>
34575</refmeta>
34576<refnamediv>
34577 <refname>mptscsih_IssueTaskMgmt</refname>
34578 <refpurpose>
34579     Generic send Task Management function.
34580 </refpurpose>
34581</refnamediv>
34582<refsynopsisdiv>
34583 <title>Synopsis</title>
34584  <funcsynopsis><funcprototype>
34585   <funcdef>int <function>mptscsih_IssueTaskMgmt </function></funcdef>
34586   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
34587   <paramdef>u8 <parameter>type</parameter></paramdef>
34588   <paramdef>u8 <parameter>channel</parameter></paramdef>
34589   <paramdef>u8 <parameter>id</parameter></paramdef>
34590   <paramdef>u64 <parameter>lun</parameter></paramdef>
34591   <paramdef>int <parameter>ctx2abort</parameter></paramdef>
34592   <paramdef>ulong <parameter>timeout</parameter></paramdef>
34593  </funcprototype></funcsynopsis>
34594</refsynopsisdiv>
34595<refsect1>
34596 <title>Arguments</title>
34597 <variablelist>
34598  <varlistentry>
34599   <term><parameter>hd</parameter></term>
34600   <listitem>
34601    <para>
34602     Pointer to MPT_SCSI_HOST structure
34603    </para>
34604   </listitem>
34605  </varlistentry>
34606  <varlistentry>
34607   <term><parameter>type</parameter></term>
34608   <listitem>
34609    <para>
34610     Task Management type
34611    </para>
34612   </listitem>
34613  </varlistentry>
34614  <varlistentry>
34615   <term><parameter>channel</parameter></term>
34616   <listitem>
34617    <para>
34618     channel number for task management
34619    </para>
34620   </listitem>
34621  </varlistentry>
34622  <varlistentry>
34623   <term><parameter>id</parameter></term>
34624   <listitem>
34625    <para>
34626     Logical Target ID for reset (if appropriate)
34627    </para>
34628   </listitem>
34629  </varlistentry>
34630  <varlistentry>
34631   <term><parameter>lun</parameter></term>
34632   <listitem>
34633    <para>
34634     Logical Unit for reset (if appropriate)
34635    </para>
34636   </listitem>
34637  </varlistentry>
34638  <varlistentry>
34639   <term><parameter>ctx2abort</parameter></term>
34640   <listitem>
34641    <para>
34642     Context for the task to be aborted (if appropriate)
34643    </para>
34644   </listitem>
34645  </varlistentry>
34646  <varlistentry>
34647   <term><parameter>timeout</parameter></term>
34648   <listitem>
34649    <para>
34650     timeout for task management control
34651    </para>
34652   </listitem>
34653  </varlistentry>
34654 </variablelist>
34655</refsect1>
34656<refsect1>
34657<title>Remark</title>
34658<para>
34659   _HardResetHandler can be invoked from an interrupt thread (timer)
34660   or a non-interrupt thread.  In the former, must not call <function>schedule</function>.
34661   </para><para>
34662
34663   Not all fields are meaningfull for all task types.
34664   </para><para>
34665
34666   Returns 0 for SUCCESS, or FAILED.
34667</para>
34668</refsect1>
34669</refentry>
34670
34671<refentry id="API-mptscsih-abort">
34672<refentryinfo>
34673 <title>LINUX</title>
34674 <productname>Kernel Hackers Manual</productname>
34675 <date>July 2017</date>
34676</refentryinfo>
34677<refmeta>
34678 <refentrytitle><phrase>mptscsih_abort</phrase></refentrytitle>
34679 <manvolnum>9</manvolnum>
34680 <refmiscinfo class="version">4.1.27</refmiscinfo>
34681</refmeta>
34682<refnamediv>
34683 <refname>mptscsih_abort</refname>
34684 <refpurpose>
34685     Abort linux scsi_cmnd routine, new_eh variant
34686 </refpurpose>
34687</refnamediv>
34688<refsynopsisdiv>
34689 <title>Synopsis</title>
34690  <funcsynopsis><funcprototype>
34691   <funcdef>int <function>mptscsih_abort </function></funcdef>
34692   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
34693  </funcprototype></funcsynopsis>
34694</refsynopsisdiv>
34695<refsect1>
34696 <title>Arguments</title>
34697 <variablelist>
34698  <varlistentry>
34699   <term><parameter>SCpnt</parameter></term>
34700   <listitem>
34701    <para>
34702     Pointer to scsi_cmnd structure, IO to be aborted
34703    </para>
34704   </listitem>
34705  </varlistentry>
34706 </variablelist>
34707</refsect1>
34708<refsect1>
34709<title>Description</title>
34710<para>
34711   (linux scsi_host_template.eh_abort_handler routine)
34712   </para><para>
34713
34714   Returns SUCCESS or FAILED.
34715</para>
34716</refsect1>
34717</refentry>
34718
34719<refentry id="API-mptscsih-dev-reset">
34720<refentryinfo>
34721 <title>LINUX</title>
34722 <productname>Kernel Hackers Manual</productname>
34723 <date>July 2017</date>
34724</refentryinfo>
34725<refmeta>
34726 <refentrytitle><phrase>mptscsih_dev_reset</phrase></refentrytitle>
34727 <manvolnum>9</manvolnum>
34728 <refmiscinfo class="version">4.1.27</refmiscinfo>
34729</refmeta>
34730<refnamediv>
34731 <refname>mptscsih_dev_reset</refname>
34732 <refpurpose>
34733     Perform a SCSI TARGET_RESET! new_eh variant
34734 </refpurpose>
34735</refnamediv>
34736<refsynopsisdiv>
34737 <title>Synopsis</title>
34738  <funcsynopsis><funcprototype>
34739   <funcdef>int <function>mptscsih_dev_reset </function></funcdef>
34740   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
34741  </funcprototype></funcsynopsis>
34742</refsynopsisdiv>
34743<refsect1>
34744 <title>Arguments</title>
34745 <variablelist>
34746  <varlistentry>
34747   <term><parameter>SCpnt</parameter></term>
34748   <listitem>
34749    <para>
34750     Pointer to scsi_cmnd structure, IO which reset is due to
34751    </para>
34752   </listitem>
34753  </varlistentry>
34754 </variablelist>
34755</refsect1>
34756<refsect1>
34757<title>Description</title>
34758<para>
34759   (linux scsi_host_template.eh_dev_reset_handler routine)
34760   </para><para>
34761
34762   Returns SUCCESS or FAILED.
34763</para>
34764</refsect1>
34765</refentry>
34766
34767<refentry id="API-mptscsih-bus-reset">
34768<refentryinfo>
34769 <title>LINUX</title>
34770 <productname>Kernel Hackers Manual</productname>
34771 <date>July 2017</date>
34772</refentryinfo>
34773<refmeta>
34774 <refentrytitle><phrase>mptscsih_bus_reset</phrase></refentrytitle>
34775 <manvolnum>9</manvolnum>
34776 <refmiscinfo class="version">4.1.27</refmiscinfo>
34777</refmeta>
34778<refnamediv>
34779 <refname>mptscsih_bus_reset</refname>
34780 <refpurpose>
34781     Perform a SCSI BUS_RESET! new_eh variant
34782 </refpurpose>
34783</refnamediv>
34784<refsynopsisdiv>
34785 <title>Synopsis</title>
34786  <funcsynopsis><funcprototype>
34787   <funcdef>int <function>mptscsih_bus_reset </function></funcdef>
34788   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
34789  </funcprototype></funcsynopsis>
34790</refsynopsisdiv>
34791<refsect1>
34792 <title>Arguments</title>
34793 <variablelist>
34794  <varlistentry>
34795   <term><parameter>SCpnt</parameter></term>
34796   <listitem>
34797    <para>
34798     Pointer to scsi_cmnd structure, IO which reset is due to
34799    </para>
34800   </listitem>
34801  </varlistentry>
34802 </variablelist>
34803</refsect1>
34804<refsect1>
34805<title>Description</title>
34806<para>
34807   (linux scsi_host_template.eh_bus_reset_handler routine)
34808   </para><para>
34809
34810   Returns SUCCESS or FAILED.
34811</para>
34812</refsect1>
34813</refentry>
34814
34815<refentry id="API-mptscsih-host-reset">
34816<refentryinfo>
34817 <title>LINUX</title>
34818 <productname>Kernel Hackers Manual</productname>
34819 <date>July 2017</date>
34820</refentryinfo>
34821<refmeta>
34822 <refentrytitle><phrase>mptscsih_host_reset</phrase></refentrytitle>
34823 <manvolnum>9</manvolnum>
34824 <refmiscinfo class="version">4.1.27</refmiscinfo>
34825</refmeta>
34826<refnamediv>
34827 <refname>mptscsih_host_reset</refname>
34828 <refpurpose>
34829     Perform a SCSI host adapter RESET (new_eh variant)
34830 </refpurpose>
34831</refnamediv>
34832<refsynopsisdiv>
34833 <title>Synopsis</title>
34834  <funcsynopsis><funcprototype>
34835   <funcdef>int <function>mptscsih_host_reset </function></funcdef>
34836   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
34837  </funcprototype></funcsynopsis>
34838</refsynopsisdiv>
34839<refsect1>
34840 <title>Arguments</title>
34841 <variablelist>
34842  <varlistentry>
34843   <term><parameter>SCpnt</parameter></term>
34844   <listitem>
34845    <para>
34846     Pointer to scsi_cmnd structure, IO which reset is due to
34847    </para>
34848   </listitem>
34849  </varlistentry>
34850 </variablelist>
34851</refsect1>
34852<refsect1>
34853<title>Description</title>
34854<para>
34855   (linux scsi_host_template.eh_host_reset_handler routine)
34856   </para><para>
34857
34858   Returns SUCCESS or FAILED.
34859</para>
34860</refsect1>
34861</refentry>
34862
34863<refentry id="API-mptscsih-taskmgmt-complete">
34864<refentryinfo>
34865 <title>LINUX</title>
34866 <productname>Kernel Hackers Manual</productname>
34867 <date>July 2017</date>
34868</refentryinfo>
34869<refmeta>
34870 <refentrytitle><phrase>mptscsih_taskmgmt_complete</phrase></refentrytitle>
34871 <manvolnum>9</manvolnum>
34872 <refmiscinfo class="version">4.1.27</refmiscinfo>
34873</refmeta>
34874<refnamediv>
34875 <refname>mptscsih_taskmgmt_complete</refname>
34876 <refpurpose>
34877     Registered with Fusion MPT base driver
34878 </refpurpose>
34879</refnamediv>
34880<refsynopsisdiv>
34881 <title>Synopsis</title>
34882  <funcsynopsis><funcprototype>
34883   <funcdef>int <function>mptscsih_taskmgmt_complete </function></funcdef>
34884   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34885   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
34886   <paramdef>MPT_FRAME_HDR * <parameter>mr</parameter></paramdef>
34887  </funcprototype></funcsynopsis>
34888</refsynopsisdiv>
34889<refsect1>
34890 <title>Arguments</title>
34891 <variablelist>
34892  <varlistentry>
34893   <term><parameter>ioc</parameter></term>
34894   <listitem>
34895    <para>
34896     Pointer to MPT_ADAPTER structure
34897    </para>
34898   </listitem>
34899  </varlistentry>
34900  <varlistentry>
34901   <term><parameter>mf</parameter></term>
34902   <listitem>
34903    <para>
34904     Pointer to SCSI task mgmt request frame
34905    </para>
34906   </listitem>
34907  </varlistentry>
34908  <varlistentry>
34909   <term><parameter>mr</parameter></term>
34910   <listitem>
34911    <para>
34912     Pointer to SCSI task mgmt reply frame
34913    </para>
34914   </listitem>
34915  </varlistentry>
34916 </variablelist>
34917</refsect1>
34918<refsect1>
34919<title>Description</title>
34920<para>
34921   This routine is called from mptbase.c::<function>mpt_interrupt</function> at the completion
34922   of any SCSI task management request.
34923   This routine is registered with the MPT (base) driver at driver
34924   load/init time via the <function>mpt_register</function> API call.
34925   </para><para>
34926
34927   Returns 1 indicating alloc'd request frame ptr should be freed.
34928</para>
34929</refsect1>
34930</refentry>
34931
34932<refentry id="API-mptscsih-get-scsi-lookup">
34933<refentryinfo>
34934 <title>LINUX</title>
34935 <productname>Kernel Hackers Manual</productname>
34936 <date>July 2017</date>
34937</refentryinfo>
34938<refmeta>
34939 <refentrytitle><phrase>mptscsih_get_scsi_lookup</phrase></refentrytitle>
34940 <manvolnum>9</manvolnum>
34941 <refmiscinfo class="version">4.1.27</refmiscinfo>
34942</refmeta>
34943<refnamediv>
34944 <refname>mptscsih_get_scsi_lookup</refname>
34945 <refpurpose>
34946     retrieves scmd entry
34947 </refpurpose>
34948</refnamediv>
34949<refsynopsisdiv>
34950 <title>Synopsis</title>
34951  <funcsynopsis><funcprototype>
34952   <funcdef>struct scsi_cmnd * <function>mptscsih_get_scsi_lookup </function></funcdef>
34953   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34954   <paramdef>int <parameter>i</parameter></paramdef>
34955  </funcprototype></funcsynopsis>
34956</refsynopsisdiv>
34957<refsect1>
34958 <title>Arguments</title>
34959 <variablelist>
34960  <varlistentry>
34961   <term><parameter>ioc</parameter></term>
34962   <listitem>
34963    <para>
34964     Pointer to MPT_ADAPTER structure
34965    </para>
34966   </listitem>
34967  </varlistentry>
34968  <varlistentry>
34969   <term><parameter>i</parameter></term>
34970   <listitem>
34971    <para>
34972     index into the array
34973    </para>
34974   </listitem>
34975  </varlistentry>
34976 </variablelist>
34977</refsect1>
34978<refsect1>
34979<title>Description</title>
34980<para>
34981   Returns the scsi_cmd pointer
34982</para>
34983</refsect1>
34984</refentry>
34985
34986<!-- drivers/message/fusion/mptscsih.c -->
34987<refentry id="API-mptscsih-info-scsiio">
34988<refentryinfo>
34989 <title>LINUX</title>
34990 <productname>Kernel Hackers Manual</productname>
34991 <date>July 2017</date>
34992</refentryinfo>
34993<refmeta>
34994 <refentrytitle><phrase>mptscsih_info_scsiio</phrase></refentrytitle>
34995 <manvolnum>9</manvolnum>
34996 <refmiscinfo class="version">4.1.27</refmiscinfo>
34997</refmeta>
34998<refnamediv>
34999 <refname>mptscsih_info_scsiio</refname>
35000 <refpurpose>
35001  debug print info on reply frame
35002 </refpurpose>
35003</refnamediv>
35004<refsynopsisdiv>
35005 <title>Synopsis</title>
35006  <funcsynopsis><funcprototype>
35007   <funcdef>void <function>mptscsih_info_scsiio </function></funcdef>
35008   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35009   <paramdef>struct scsi_cmnd * <parameter>sc</parameter></paramdef>
35010   <paramdef>SCSIIOReply_t * <parameter>pScsiReply</parameter></paramdef>
35011  </funcprototype></funcsynopsis>
35012</refsynopsisdiv>
35013<refsect1>
35014 <title>Arguments</title>
35015 <variablelist>
35016  <varlistentry>
35017   <term><parameter>ioc</parameter></term>
35018   <listitem>
35019    <para>
35020     Pointer to MPT_ADAPTER structure
35021    </para>
35022   </listitem>
35023  </varlistentry>
35024  <varlistentry>
35025   <term><parameter>sc</parameter></term>
35026   <listitem>
35027    <para>
35028     original scsi cmnd pointer
35029    </para>
35030   </listitem>
35031  </varlistentry>
35032  <varlistentry>
35033   <term><parameter>pScsiReply</parameter></term>
35034   <listitem>
35035    <para>
35036     Pointer to MPT reply frame
35037    </para>
35038   </listitem>
35039  </varlistentry>
35040 </variablelist>
35041</refsect1>
35042<refsect1>
35043<title>Description</title>
35044<para>
35045   MPT_DEBUG_REPLY needs to be enabled to obtain this info
35046   </para><para>
35047
35048   Refer to lsi/mpi.h.
35049</para>
35050</refsect1>
35051</refentry>
35052
35053<refentry id="API-mptscsih-getclear-scsi-lookup">
35054<refentryinfo>
35055 <title>LINUX</title>
35056 <productname>Kernel Hackers Manual</productname>
35057 <date>July 2017</date>
35058</refentryinfo>
35059<refmeta>
35060 <refentrytitle><phrase>mptscsih_getclear_scsi_lookup</phrase></refentrytitle>
35061 <manvolnum>9</manvolnum>
35062 <refmiscinfo class="version">4.1.27</refmiscinfo>
35063</refmeta>
35064<refnamediv>
35065 <refname>mptscsih_getclear_scsi_lookup</refname>
35066 <refpurpose>
35067     retrieves and clears scmd entry from ScsiLookup[] array list
35068 </refpurpose>
35069</refnamediv>
35070<refsynopsisdiv>
35071 <title>Synopsis</title>
35072  <funcsynopsis><funcprototype>
35073   <funcdef>struct scsi_cmnd * <function>mptscsih_getclear_scsi_lookup </function></funcdef>
35074   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35075   <paramdef>int <parameter>i</parameter></paramdef>
35076  </funcprototype></funcsynopsis>
35077</refsynopsisdiv>
35078<refsect1>
35079 <title>Arguments</title>
35080 <variablelist>
35081  <varlistentry>
35082   <term><parameter>ioc</parameter></term>
35083   <listitem>
35084    <para>
35085     Pointer to MPT_ADAPTER structure
35086    </para>
35087   </listitem>
35088  </varlistentry>
35089  <varlistentry>
35090   <term><parameter>i</parameter></term>
35091   <listitem>
35092    <para>
35093     index into the array
35094    </para>
35095   </listitem>
35096  </varlistentry>
35097 </variablelist>
35098</refsect1>
35099<refsect1>
35100<title>Description</title>
35101<para>
35102   Returns the scsi_cmd pointer
35103</para>
35104</refsect1>
35105</refentry>
35106
35107<refentry id="API-mptscsih-set-scsi-lookup">
35108<refentryinfo>
35109 <title>LINUX</title>
35110 <productname>Kernel Hackers Manual</productname>
35111 <date>July 2017</date>
35112</refentryinfo>
35113<refmeta>
35114 <refentrytitle><phrase>mptscsih_set_scsi_lookup</phrase></refentrytitle>
35115 <manvolnum>9</manvolnum>
35116 <refmiscinfo class="version">4.1.27</refmiscinfo>
35117</refmeta>
35118<refnamediv>
35119 <refname>mptscsih_set_scsi_lookup</refname>
35120 <refpurpose>
35121     write a scmd entry into the ScsiLookup[] array list
35122 </refpurpose>
35123</refnamediv>
35124<refsynopsisdiv>
35125 <title>Synopsis</title>
35126  <funcsynopsis><funcprototype>
35127   <funcdef>void <function>mptscsih_set_scsi_lookup </function></funcdef>
35128   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35129   <paramdef>int <parameter>i</parameter></paramdef>
35130   <paramdef>struct scsi_cmnd * <parameter>scmd</parameter></paramdef>
35131  </funcprototype></funcsynopsis>
35132</refsynopsisdiv>
35133<refsect1>
35134 <title>Arguments</title>
35135 <variablelist>
35136  <varlistentry>
35137   <term><parameter>ioc</parameter></term>
35138   <listitem>
35139    <para>
35140     Pointer to MPT_ADAPTER structure
35141    </para>
35142   </listitem>
35143  </varlistentry>
35144  <varlistentry>
35145   <term><parameter>i</parameter></term>
35146   <listitem>
35147    <para>
35148     index into the array
35149    </para>
35150   </listitem>
35151  </varlistentry>
35152  <varlistentry>
35153   <term><parameter>scmd</parameter></term>
35154   <listitem>
35155    <para>
35156     scsi_cmnd pointer
35157    </para>
35158   </listitem>
35159  </varlistentry>
35160 </variablelist>
35161</refsect1>
35162</refentry>
35163
35164<refentry id="API-SCPNT-TO-LOOKUP-IDX">
35165<refentryinfo>
35166 <title>LINUX</title>
35167 <productname>Kernel Hackers Manual</productname>
35168 <date>July 2017</date>
35169</refentryinfo>
35170<refmeta>
35171 <refentrytitle><phrase>SCPNT_TO_LOOKUP_IDX</phrase></refentrytitle>
35172 <manvolnum>9</manvolnum>
35173 <refmiscinfo class="version">4.1.27</refmiscinfo>
35174</refmeta>
35175<refnamediv>
35176 <refname>SCPNT_TO_LOOKUP_IDX</refname>
35177 <refpurpose>
35178     searches for a given scmd in the ScsiLookup[] array list
35179 </refpurpose>
35180</refnamediv>
35181<refsynopsisdiv>
35182 <title>Synopsis</title>
35183  <funcsynopsis><funcprototype>
35184   <funcdef>int <function>SCPNT_TO_LOOKUP_IDX </function></funcdef>
35185   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35186   <paramdef>struct scsi_cmnd * <parameter>sc</parameter></paramdef>
35187  </funcprototype></funcsynopsis>
35188</refsynopsisdiv>
35189<refsect1>
35190 <title>Arguments</title>
35191 <variablelist>
35192  <varlistentry>
35193   <term><parameter>ioc</parameter></term>
35194   <listitem>
35195    <para>
35196     Pointer to MPT_ADAPTER structure
35197    </para>
35198   </listitem>
35199  </varlistentry>
35200  <varlistentry>
35201   <term><parameter>sc</parameter></term>
35202   <listitem>
35203    <para>
35204     scsi_cmnd pointer
35205    </para>
35206   </listitem>
35207  </varlistentry>
35208 </variablelist>
35209</refsect1>
35210</refentry>
35211
35212<refentry id="API-mptscsih-get-completion-code">
35213<refentryinfo>
35214 <title>LINUX</title>
35215 <productname>Kernel Hackers Manual</productname>
35216 <date>July 2017</date>
35217</refentryinfo>
35218<refmeta>
35219 <refentrytitle><phrase>mptscsih_get_completion_code</phrase></refentrytitle>
35220 <manvolnum>9</manvolnum>
35221 <refmiscinfo class="version">4.1.27</refmiscinfo>
35222</refmeta>
35223<refnamediv>
35224 <refname>mptscsih_get_completion_code</refname>
35225 <refpurpose>
35226     get completion code from MPT request
35227 </refpurpose>
35228</refnamediv>
35229<refsynopsisdiv>
35230 <title>Synopsis</title>
35231  <funcsynopsis><funcprototype>
35232   <funcdef>int <function>mptscsih_get_completion_code </function></funcdef>
35233   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35234   <paramdef>MPT_FRAME_HDR * <parameter>req</parameter></paramdef>
35235   <paramdef>MPT_FRAME_HDR * <parameter>reply</parameter></paramdef>
35236  </funcprototype></funcsynopsis>
35237</refsynopsisdiv>
35238<refsect1>
35239 <title>Arguments</title>
35240 <variablelist>
35241  <varlistentry>
35242   <term><parameter>ioc</parameter></term>
35243   <listitem>
35244    <para>
35245     Pointer to MPT_ADAPTER structure
35246    </para>
35247   </listitem>
35248  </varlistentry>
35249  <varlistentry>
35250   <term><parameter>req</parameter></term>
35251   <listitem>
35252    <para>
35253     Pointer to original MPT request frame
35254    </para>
35255   </listitem>
35256  </varlistentry>
35257  <varlistentry>
35258   <term><parameter>reply</parameter></term>
35259   <listitem>
35260    <para>
35261     Pointer to MPT reply frame (NULL if TurboReply)
35262    </para>
35263   </listitem>
35264  </varlistentry>
35265 </variablelist>
35266</refsect1>
35267</refentry>
35268
35269<refentry id="API-mptscsih-do-cmd">
35270<refentryinfo>
35271 <title>LINUX</title>
35272 <productname>Kernel Hackers Manual</productname>
35273 <date>July 2017</date>
35274</refentryinfo>
35275<refmeta>
35276 <refentrytitle><phrase>mptscsih_do_cmd</phrase></refentrytitle>
35277 <manvolnum>9</manvolnum>
35278 <refmiscinfo class="version">4.1.27</refmiscinfo>
35279</refmeta>
35280<refnamediv>
35281 <refname>mptscsih_do_cmd</refname>
35282 <refpurpose>
35283     Do internal command.
35284 </refpurpose>
35285</refnamediv>
35286<refsynopsisdiv>
35287 <title>Synopsis</title>
35288  <funcsynopsis><funcprototype>
35289   <funcdef>int <function>mptscsih_do_cmd </function></funcdef>
35290   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35291   <paramdef>INTERNAL_CMD * <parameter>io</parameter></paramdef>
35292  </funcprototype></funcsynopsis>
35293</refsynopsisdiv>
35294<refsect1>
35295 <title>Arguments</title>
35296 <variablelist>
35297  <varlistentry>
35298   <term><parameter>hd</parameter></term>
35299   <listitem>
35300    <para>
35301     MPT_SCSI_HOST pointer
35302    </para>
35303   </listitem>
35304  </varlistentry>
35305  <varlistentry>
35306   <term><parameter>io</parameter></term>
35307   <listitem>
35308    <para>
35309     INTERNAL_CMD pointer.
35310    </para>
35311   </listitem>
35312  </varlistentry>
35313 </variablelist>
35314</refsect1>
35315<refsect1>
35316<title>Description</title>
35317<para>
35318   Issue the specified internally generated command and do command
35319   specific cleanup. For bus scan / DV only.
35320</para>
35321</refsect1>
35322<refsect1>
35323<title>NOTES</title>
35324<para>
35325   If command is Inquiry and status is good,
35326   initialize a target structure, save the data
35327</para>
35328</refsect1>
35329<refsect1>
35330<title>Remark</title>
35331<para>
35332   Single threaded access only.
35333</para>
35334</refsect1>
35335<refsect1>
35336<title>Return</title>
35337<para>
35338   &lt; 0 if an illegal command or no resources
35339   </para><para>
35340
35341   0 if good
35342   </para><para>
35343
35344   &gt; 0 if command complete but some type of completion error.
35345</para>
35346</refsect1>
35347</refentry>
35348
35349<refentry id="API-mptscsih-synchronize-cache">
35350<refentryinfo>
35351 <title>LINUX</title>
35352 <productname>Kernel Hackers Manual</productname>
35353 <date>July 2017</date>
35354</refentryinfo>
35355<refmeta>
35356 <refentrytitle><phrase>mptscsih_synchronize_cache</phrase></refentrytitle>
35357 <manvolnum>9</manvolnum>
35358 <refmiscinfo class="version">4.1.27</refmiscinfo>
35359</refmeta>
35360<refnamediv>
35361 <refname>mptscsih_synchronize_cache</refname>
35362 <refpurpose>
35363     Send SYNCHRONIZE_CACHE to all disks.
35364 </refpurpose>
35365</refnamediv>
35366<refsynopsisdiv>
35367 <title>Synopsis</title>
35368  <funcsynopsis><funcprototype>
35369   <funcdef>void <function>mptscsih_synchronize_cache </function></funcdef>
35370   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35371   <paramdef>VirtDevice * <parameter>vdevice</parameter></paramdef>
35372  </funcprototype></funcsynopsis>
35373</refsynopsisdiv>
35374<refsect1>
35375 <title>Arguments</title>
35376 <variablelist>
35377  <varlistentry>
35378   <term><parameter>hd</parameter></term>
35379   <listitem>
35380    <para>
35381     Pointer to a SCSI HOST structure
35382    </para>
35383   </listitem>
35384  </varlistentry>
35385  <varlistentry>
35386   <term><parameter>vdevice</parameter></term>
35387   <listitem>
35388    <para>
35389     virtual target device
35390    </para>
35391   </listitem>
35392  </varlistentry>
35393 </variablelist>
35394</refsect1>
35395<refsect1>
35396<title>Description</title>
35397<para>
35398   Uses the ISR, but with special processing.
35399   MUST be single-threaded.
35400</para>
35401</refsect1>
35402</refentry>
35403
35404<!-- drivers/message/fusion/mptctl.c -->
35405<refentry id="API-mptctl-syscall-down">
35406<refentryinfo>
35407 <title>LINUX</title>
35408 <productname>Kernel Hackers Manual</productname>
35409 <date>July 2017</date>
35410</refentryinfo>
35411<refmeta>
35412 <refentrytitle><phrase>mptctl_syscall_down</phrase></refentrytitle>
35413 <manvolnum>9</manvolnum>
35414 <refmiscinfo class="version">4.1.27</refmiscinfo>
35415</refmeta>
35416<refnamediv>
35417 <refname>mptctl_syscall_down</refname>
35418 <refpurpose>
35419  Down the MPT adapter syscall semaphore.
35420 </refpurpose>
35421</refnamediv>
35422<refsynopsisdiv>
35423 <title>Synopsis</title>
35424  <funcsynopsis><funcprototype>
35425   <funcdef>int <function>mptctl_syscall_down </function></funcdef>
35426   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35427   <paramdef>int <parameter>nonblock</parameter></paramdef>
35428  </funcprototype></funcsynopsis>
35429</refsynopsisdiv>
35430<refsect1>
35431 <title>Arguments</title>
35432 <variablelist>
35433  <varlistentry>
35434   <term><parameter>ioc</parameter></term>
35435   <listitem>
35436    <para>
35437     Pointer to MPT adapter
35438    </para>
35439   </listitem>
35440  </varlistentry>
35441  <varlistentry>
35442   <term><parameter>nonblock</parameter></term>
35443   <listitem>
35444    <para>
35445     boolean, non-zero if O_NONBLOCK is set
35446    </para>
35447   </listitem>
35448  </varlistentry>
35449 </variablelist>
35450</refsect1>
35451<refsect1>
35452<title>Description</title>
35453<para>
35454   All of the ioctl commands can potentially sleep, which is illegal
35455   with a spinlock held, thus we perform mutual exclusion here.
35456   </para><para>
35457
35458   Returns negative errno on error, or zero for success.
35459</para>
35460</refsect1>
35461</refentry>
35462
35463<!-- drivers/message/fusion/mptspi.c -->
35464<refentry id="API-mptspi-setTargetNegoParms">
35465<refentryinfo>
35466 <title>LINUX</title>
35467 <productname>Kernel Hackers Manual</productname>
35468 <date>July 2017</date>
35469</refentryinfo>
35470<refmeta>
35471 <refentrytitle><phrase>mptspi_setTargetNegoParms</phrase></refentrytitle>
35472 <manvolnum>9</manvolnum>
35473 <refmiscinfo class="version">4.1.27</refmiscinfo>
35474</refmeta>
35475<refnamediv>
35476 <refname>mptspi_setTargetNegoParms</refname>
35477 <refpurpose>
35478  Update the target negotiation parameters
35479 </refpurpose>
35480</refnamediv>
35481<refsynopsisdiv>
35482 <title>Synopsis</title>
35483  <funcsynopsis><funcprototype>
35484   <funcdef>void <function>mptspi_setTargetNegoParms </function></funcdef>
35485   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35486   <paramdef>VirtTarget * <parameter>target</parameter></paramdef>
35487   <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef>
35488  </funcprototype></funcsynopsis>
35489</refsynopsisdiv>
35490<refsect1>
35491 <title>Arguments</title>
35492 <variablelist>
35493  <varlistentry>
35494   <term><parameter>hd</parameter></term>
35495   <listitem>
35496    <para>
35497     Pointer to a SCSI Host Structure
35498    </para>
35499   </listitem>
35500  </varlistentry>
35501  <varlistentry>
35502   <term><parameter>target</parameter></term>
35503   <listitem>
35504    <para>
35505     per target private data
35506    </para>
35507   </listitem>
35508  </varlistentry>
35509  <varlistentry>
35510   <term><parameter>sdev</parameter></term>
35511   <listitem>
35512    <para>
35513     SCSI device
35514    </para>
35515   </listitem>
35516  </varlistentry>
35517 </variablelist>
35518</refsect1>
35519<refsect1>
35520<title>Description</title>
35521<para>
35522   Update the target negotiation parameters based on the the Inquiry
35523   data, adapter capabilities, and NVRAM settings.
35524</para>
35525</refsect1>
35526</refentry>
35527
35528<refentry id="API-mptspi-writeIOCPage4">
35529<refentryinfo>
35530 <title>LINUX</title>
35531 <productname>Kernel Hackers Manual</productname>
35532 <date>July 2017</date>
35533</refentryinfo>
35534<refmeta>
35535 <refentrytitle><phrase>mptspi_writeIOCPage4</phrase></refentrytitle>
35536 <manvolnum>9</manvolnum>
35537 <refmiscinfo class="version">4.1.27</refmiscinfo>
35538</refmeta>
35539<refnamediv>
35540 <refname>mptspi_writeIOCPage4</refname>
35541 <refpurpose>
35542     write IOC Page 4
35543 </refpurpose>
35544</refnamediv>
35545<refsynopsisdiv>
35546 <title>Synopsis</title>
35547  <funcsynopsis><funcprototype>
35548   <funcdef>int <function>mptspi_writeIOCPage4 </function></funcdef>
35549   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35550   <paramdef>u8 <parameter>channel</parameter></paramdef>
35551   <paramdef>u8 <parameter>id</parameter></paramdef>
35552  </funcprototype></funcsynopsis>
35553</refsynopsisdiv>
35554<refsect1>
35555 <title>Arguments</title>
35556 <variablelist>
35557  <varlistentry>
35558   <term><parameter>hd</parameter></term>
35559   <listitem>
35560    <para>
35561     Pointer to a SCSI Host Structure
35562    </para>
35563   </listitem>
35564  </varlistentry>
35565  <varlistentry>
35566   <term><parameter>channel</parameter></term>
35567   <listitem>
35568    <para>
35569     channel number
35570    </para>
35571   </listitem>
35572  </varlistentry>
35573  <varlistentry>
35574   <term><parameter>id</parameter></term>
35575   <listitem>
35576    <para>
35577     write IOC Page4 for this ID &amp; Bus
35578    </para>
35579   </listitem>
35580  </varlistentry>
35581 </variablelist>
35582</refsect1>
35583<refsect1>
35584<title>Return</title>
35585<para>
35586   -EAGAIN if unable to obtain a Message Frame
35587   or 0 if success.
35588</para>
35589</refsect1>
35590<refsect1>
35591<title>Remark</title>
35592<para>
35593   We do not wait for a return, write pages sequentially.
35594</para>
35595</refsect1>
35596</refentry>
35597
35598<refentry id="API-mptspi-initTarget">
35599<refentryinfo>
35600 <title>LINUX</title>
35601 <productname>Kernel Hackers Manual</productname>
35602 <date>July 2017</date>
35603</refentryinfo>
35604<refmeta>
35605 <refentrytitle><phrase>mptspi_initTarget</phrase></refentrytitle>
35606 <manvolnum>9</manvolnum>
35607 <refmiscinfo class="version">4.1.27</refmiscinfo>
35608</refmeta>
35609<refnamediv>
35610 <refname>mptspi_initTarget</refname>
35611 <refpurpose>
35612     Target, LUN alloc/free functionality.
35613 </refpurpose>
35614</refnamediv>
35615<refsynopsisdiv>
35616 <title>Synopsis</title>
35617  <funcsynopsis><funcprototype>
35618   <funcdef>void <function>mptspi_initTarget </function></funcdef>
35619   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35620   <paramdef>VirtTarget * <parameter>vtarget</parameter></paramdef>
35621   <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef>
35622  </funcprototype></funcsynopsis>
35623</refsynopsisdiv>
35624<refsect1>
35625 <title>Arguments</title>
35626 <variablelist>
35627  <varlistentry>
35628   <term><parameter>hd</parameter></term>
35629   <listitem>
35630    <para>
35631     Pointer to MPT_SCSI_HOST structure
35632    </para>
35633   </listitem>
35634  </varlistentry>
35635  <varlistentry>
35636   <term><parameter>vtarget</parameter></term>
35637   <listitem>
35638    <para>
35639     per target private data
35640    </para>
35641   </listitem>
35642  </varlistentry>
35643  <varlistentry>
35644   <term><parameter>sdev</parameter></term>
35645   <listitem>
35646    <para>
35647     SCSI device
35648    </para>
35649   </listitem>
35650  </varlistentry>
35651 </variablelist>
35652</refsect1>
35653<refsect1>
35654<title>NOTE</title>
35655<para>
35656   It's only SAFE to call this routine if data points to
35657   sane &amp; valid STANDARD INQUIRY data!
35658   </para><para>
35659
35660   Allocate and initialize memory for this target.
35661   Save inquiry data.
35662</para>
35663</refsect1>
35664</refentry>
35665
35666<refentry id="API-mptspi-is-raid">
35667<refentryinfo>
35668 <title>LINUX</title>
35669 <productname>Kernel Hackers Manual</productname>
35670 <date>July 2017</date>
35671</refentryinfo>
35672<refmeta>
35673 <refentrytitle><phrase>mptspi_is_raid</phrase></refentrytitle>
35674 <manvolnum>9</manvolnum>
35675 <refmiscinfo class="version">4.1.27</refmiscinfo>
35676</refmeta>
35677<refnamediv>
35678 <refname>mptspi_is_raid</refname>
35679 <refpurpose>
35680     Determines whether target is belonging to volume
35681 </refpurpose>
35682</refnamediv>
35683<refsynopsisdiv>
35684 <title>Synopsis</title>
35685  <funcsynopsis><funcprototype>
35686   <funcdef>int <function>mptspi_is_raid </function></funcdef>
35687   <paramdef>struct _MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35688   <paramdef>u32 <parameter>id</parameter></paramdef>
35689  </funcprototype></funcsynopsis>
35690</refsynopsisdiv>
35691<refsect1>
35692 <title>Arguments</title>
35693 <variablelist>
35694  <varlistentry>
35695   <term><parameter>hd</parameter></term>
35696   <listitem>
35697    <para>
35698     Pointer to a SCSI HOST structure
35699    </para>
35700   </listitem>
35701  </varlistentry>
35702  <varlistentry>
35703   <term><parameter>id</parameter></term>
35704   <listitem>
35705    <para>
35706     target device id
35707    </para>
35708   </listitem>
35709  </varlistentry>
35710 </variablelist>
35711</refsect1>
35712<refsect1>
35713<title>Return</title>
35714<para>
35715   non-zero = true
35716   zero = false
35717</para>
35718</refsect1>
35719</refentry>
35720
35721<refentry id="API-mptspi-print-write-nego">
35722<refentryinfo>
35723 <title>LINUX</title>
35724 <productname>Kernel Hackers Manual</productname>
35725 <date>July 2017</date>
35726</refentryinfo>
35727<refmeta>
35728 <refentrytitle><phrase>mptspi_print_write_nego</phrase></refentrytitle>
35729 <manvolnum>9</manvolnum>
35730 <refmiscinfo class="version">4.1.27</refmiscinfo>
35731</refmeta>
35732<refnamediv>
35733 <refname>mptspi_print_write_nego</refname>
35734 <refpurpose>
35735     negotiation parameters debug info that is being sent
35736 </refpurpose>
35737</refnamediv>
35738<refsynopsisdiv>
35739 <title>Synopsis</title>
35740  <funcsynopsis><funcprototype>
35741   <funcdef>void <function>mptspi_print_write_nego </function></funcdef>
35742   <paramdef>struct _MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35743   <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef>
35744   <paramdef>u32 <parameter>ii</parameter></paramdef>
35745  </funcprototype></funcsynopsis>
35746</refsynopsisdiv>
35747<refsect1>
35748 <title>Arguments</title>
35749 <variablelist>
35750  <varlistentry>
35751   <term><parameter>hd</parameter></term>
35752   <listitem>
35753    <para>
35754     Pointer to a SCSI HOST structure
35755    </para>
35756   </listitem>
35757  </varlistentry>
35758  <varlistentry>
35759   <term><parameter>starget</parameter></term>
35760   <listitem>
35761    <para>
35762     SCSI target
35763    </para>
35764   </listitem>
35765  </varlistentry>
35766  <varlistentry>
35767   <term><parameter>ii</parameter></term>
35768   <listitem>
35769    <para>
35770     negotiation parameters
35771    </para>
35772   </listitem>
35773  </varlistentry>
35774 </variablelist>
35775</refsect1>
35776</refentry>
35777
35778<refentry id="API-mptspi-print-read-nego">
35779<refentryinfo>
35780 <title>LINUX</title>
35781 <productname>Kernel Hackers Manual</productname>
35782 <date>July 2017</date>
35783</refentryinfo>
35784<refmeta>
35785 <refentrytitle><phrase>mptspi_print_read_nego</phrase></refentrytitle>
35786 <manvolnum>9</manvolnum>
35787 <refmiscinfo class="version">4.1.27</refmiscinfo>
35788</refmeta>
35789<refnamediv>
35790 <refname>mptspi_print_read_nego</refname>
35791 <refpurpose>
35792     negotiation parameters debug info that is being read
35793 </refpurpose>
35794</refnamediv>
35795<refsynopsisdiv>
35796 <title>Synopsis</title>
35797  <funcsynopsis><funcprototype>
35798   <funcdef>void <function>mptspi_print_read_nego </function></funcdef>
35799   <paramdef>struct _MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35800   <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef>
35801   <paramdef>u32 <parameter>ii</parameter></paramdef>
35802  </funcprototype></funcsynopsis>
35803</refsynopsisdiv>
35804<refsect1>
35805 <title>Arguments</title>
35806 <variablelist>
35807  <varlistentry>
35808   <term><parameter>hd</parameter></term>
35809   <listitem>
35810    <para>
35811     Pointer to a SCSI HOST structure
35812    </para>
35813   </listitem>
35814  </varlistentry>
35815  <varlistentry>
35816   <term><parameter>starget</parameter></term>
35817   <listitem>
35818    <para>
35819     SCSI target
35820    </para>
35821   </listitem>
35822  </varlistentry>
35823  <varlistentry>
35824   <term><parameter>ii</parameter></term>
35825   <listitem>
35826    <para>
35827     negotiation parameters
35828    </para>
35829   </listitem>
35830  </varlistentry>
35831 </variablelist>
35832</refsect1>
35833</refentry>
35834
35835<refentry id="API-mptspi-init">
35836<refentryinfo>
35837 <title>LINUX</title>
35838 <productname>Kernel Hackers Manual</productname>
35839 <date>July 2017</date>
35840</refentryinfo>
35841<refmeta>
35842 <refentrytitle><phrase>mptspi_init</phrase></refentrytitle>
35843 <manvolnum>9</manvolnum>
35844 <refmiscinfo class="version">4.1.27</refmiscinfo>
35845</refmeta>
35846<refnamediv>
35847 <refname>mptspi_init</refname>
35848 <refpurpose>
35849     Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
35850 </refpurpose>
35851</refnamediv>
35852<refsynopsisdiv>
35853 <title>Synopsis</title>
35854  <funcsynopsis><funcprototype>
35855   <funcdef>int <function>mptspi_init </function></funcdef>
35856   <paramdef> <parameter>void</parameter></paramdef>
35857  </funcprototype></funcsynopsis>
35858</refsynopsisdiv>
35859<refsect1>
35860 <title>Arguments</title>
35861 <variablelist>
35862  <varlistentry>
35863   <term><parameter>void</parameter></term>
35864   <listitem>
35865    <para>
35866     no arguments
35867    </para>
35868   </listitem>
35869  </varlistentry>
35870 </variablelist>
35871</refsect1>
35872<refsect1>
35873<title>Description</title>
35874<para>
35875   </para><para>
35876
35877   Returns 0 for success, non-zero for failure.
35878</para>
35879</refsect1>
35880</refentry>
35881
35882<refentry id="API-mptspi-exit">
35883<refentryinfo>
35884 <title>LINUX</title>
35885 <productname>Kernel Hackers Manual</productname>
35886 <date>July 2017</date>
35887</refentryinfo>
35888<refmeta>
35889 <refentrytitle><phrase>mptspi_exit</phrase></refentrytitle>
35890 <manvolnum>9</manvolnum>
35891 <refmiscinfo class="version">4.1.27</refmiscinfo>
35892</refmeta>
35893<refnamediv>
35894 <refname>mptspi_exit</refname>
35895 <refpurpose>
35896     Unregisters MPT adapter(s)
35897 </refpurpose>
35898</refnamediv>
35899<refsynopsisdiv>
35900 <title>Synopsis</title>
35901  <funcsynopsis><funcprototype>
35902   <funcdef>void __exit <function>mptspi_exit </function></funcdef>
35903   <paramdef> <parameter>void</parameter></paramdef>
35904  </funcprototype></funcsynopsis>
35905</refsynopsisdiv>
35906<refsect1>
35907 <title>Arguments</title>
35908 <variablelist>
35909  <varlistentry>
35910   <term><parameter>void</parameter></term>
35911   <listitem>
35912    <para>
35913     no arguments
35914    </para>
35915   </listitem>
35916  </varlistentry>
35917 </variablelist>
35918</refsect1>
35919</refentry>
35920
35921<!-- drivers/message/fusion/mptfc.c -->
35922<refentry id="API-mptfc-init">
35923<refentryinfo>
35924 <title>LINUX</title>
35925 <productname>Kernel Hackers Manual</productname>
35926 <date>July 2017</date>
35927</refentryinfo>
35928<refmeta>
35929 <refentrytitle><phrase>mptfc_init</phrase></refentrytitle>
35930 <manvolnum>9</manvolnum>
35931 <refmiscinfo class="version">4.1.27</refmiscinfo>
35932</refmeta>
35933<refnamediv>
35934 <refname>mptfc_init</refname>
35935 <refpurpose>
35936  Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
35937 </refpurpose>
35938</refnamediv>
35939<refsynopsisdiv>
35940 <title>Synopsis</title>
35941  <funcsynopsis><funcprototype>
35942   <funcdef>int <function>mptfc_init </function></funcdef>
35943   <paramdef> <parameter>void</parameter></paramdef>
35944  </funcprototype></funcsynopsis>
35945</refsynopsisdiv>
35946<refsect1>
35947 <title>Arguments</title>
35948 <variablelist>
35949  <varlistentry>
35950   <term><parameter>void</parameter></term>
35951   <listitem>
35952    <para>
35953     no arguments
35954    </para>
35955   </listitem>
35956  </varlistentry>
35957 </variablelist>
35958</refsect1>
35959<refsect1>
35960<title>Description</title>
35961<para>
35962   </para><para>
35963
35964   Returns 0 for success, non-zero for failure.
35965</para>
35966</refsect1>
35967</refentry>
35968
35969<refentry id="API-mptfc-remove">
35970<refentryinfo>
35971 <title>LINUX</title>
35972 <productname>Kernel Hackers Manual</productname>
35973 <date>July 2017</date>
35974</refentryinfo>
35975<refmeta>
35976 <refentrytitle><phrase>mptfc_remove</phrase></refentrytitle>
35977 <manvolnum>9</manvolnum>
35978 <refmiscinfo class="version">4.1.27</refmiscinfo>
35979</refmeta>
35980<refnamediv>
35981 <refname>mptfc_remove</refname>
35982 <refpurpose>
35983     Remove fc infrastructure for devices
35984 </refpurpose>
35985</refnamediv>
35986<refsynopsisdiv>
35987 <title>Synopsis</title>
35988  <funcsynopsis><funcprototype>
35989   <funcdef>void <function>mptfc_remove </function></funcdef>
35990   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
35991  </funcprototype></funcsynopsis>
35992</refsynopsisdiv>
35993<refsect1>
35994 <title>Arguments</title>
35995 <variablelist>
35996  <varlistentry>
35997   <term><parameter>pdev</parameter></term>
35998   <listitem>
35999    <para>
36000     Pointer to pci_dev structure
36001    </para>
36002   </listitem>
36003  </varlistentry>
36004 </variablelist>
36005</refsect1>
36006</refentry>
36007
36008<refentry id="API-mptfc-exit">
36009<refentryinfo>
36010 <title>LINUX</title>
36011 <productname>Kernel Hackers Manual</productname>
36012 <date>July 2017</date>
36013</refentryinfo>
36014<refmeta>
36015 <refentrytitle><phrase>mptfc_exit</phrase></refentrytitle>
36016 <manvolnum>9</manvolnum>
36017 <refmiscinfo class="version">4.1.27</refmiscinfo>
36018</refmeta>
36019<refnamediv>
36020 <refname>mptfc_exit</refname>
36021 <refpurpose>
36022     Unregisters MPT adapter(s)
36023 </refpurpose>
36024</refnamediv>
36025<refsynopsisdiv>
36026 <title>Synopsis</title>
36027  <funcsynopsis><funcprototype>
36028   <funcdef>void __exit <function>mptfc_exit </function></funcdef>
36029   <paramdef> <parameter>void</parameter></paramdef>
36030  </funcprototype></funcsynopsis>
36031</refsynopsisdiv>
36032<refsect1>
36033 <title>Arguments</title>
36034 <variablelist>
36035  <varlistentry>
36036   <term><parameter>void</parameter></term>
36037   <listitem>
36038    <para>
36039     no arguments
36040    </para>
36041   </listitem>
36042  </varlistentry>
36043 </variablelist>
36044</refsect1>
36045</refentry>
36046
36047<!-- drivers/message/fusion/mptlan.c -->
36048<refentry id="API-lan-reply">
36049<refentryinfo>
36050 <title>LINUX</title>
36051 <productname>Kernel Hackers Manual</productname>
36052 <date>July 2017</date>
36053</refentryinfo>
36054<refmeta>
36055 <refentrytitle><phrase>lan_reply</phrase></refentrytitle>
36056 <manvolnum>9</manvolnum>
36057 <refmiscinfo class="version">4.1.27</refmiscinfo>
36058</refmeta>
36059<refnamediv>
36060 <refname>lan_reply</refname>
36061 <refpurpose>
36062  Handle all data sent from the hardware.
36063 </refpurpose>
36064</refnamediv>
36065<refsynopsisdiv>
36066 <title>Synopsis</title>
36067  <funcsynopsis><funcprototype>
36068   <funcdef>int <function>lan_reply </function></funcdef>
36069   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36070   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
36071   <paramdef>MPT_FRAME_HDR * <parameter>reply</parameter></paramdef>
36072  </funcprototype></funcsynopsis>
36073</refsynopsisdiv>
36074<refsect1>
36075 <title>Arguments</title>
36076 <variablelist>
36077  <varlistentry>
36078   <term><parameter>ioc</parameter></term>
36079   <listitem>
36080    <para>
36081     Pointer to MPT_ADAPTER structure
36082    </para>
36083   </listitem>
36084  </varlistentry>
36085  <varlistentry>
36086   <term><parameter>mf</parameter></term>
36087   <listitem>
36088    <para>
36089     Pointer to original MPT request frame (NULL if TurboReply)
36090    </para>
36091   </listitem>
36092  </varlistentry>
36093  <varlistentry>
36094   <term><parameter>reply</parameter></term>
36095   <listitem>
36096    <para>
36097     Pointer to MPT reply frame
36098    </para>
36099   </listitem>
36100  </varlistentry>
36101 </variablelist>
36102</refsect1>
36103<refsect1>
36104<title>Description</title>
36105<para>
36106   Returns 1 indicating original alloc'd request frame ptr
36107   should be freed, or 0 if it shouldn't.
36108</para>
36109</refsect1>
36110</refentry>
36111
36112     </sect1>
36113  </chapter>
36114
36115  <chapter id="snddev">
36116     <title>Sound Devices</title>
36117<!-- include/sound/core.h -->
36118<refentry id="API-snd-printk">
36119<refentryinfo>
36120 <title>LINUX</title>
36121 <productname>Kernel Hackers Manual</productname>
36122 <date>July 2017</date>
36123</refentryinfo>
36124<refmeta>
36125 <refentrytitle><phrase>snd_printk</phrase></refentrytitle>
36126 <manvolnum>9</manvolnum>
36127 <refmiscinfo class="version">4.1.27</refmiscinfo>
36128</refmeta>
36129<refnamediv>
36130 <refname>snd_printk</refname>
36131 <refpurpose>
36132  printk wrapper
36133 </refpurpose>
36134</refnamediv>
36135<refsynopsisdiv>
36136 <title>Synopsis</title>
36137  <funcsynopsis><funcprototype>
36138   <funcdef> <function>snd_printk </function></funcdef>
36139   <paramdef> <parameter>fmt</parameter></paramdef>
36140   <paramdef> <parameter>args...</parameter></paramdef>
36141  </funcprototype></funcsynopsis>
36142</refsynopsisdiv>
36143<refsect1>
36144 <title>Arguments</title>
36145 <variablelist>
36146  <varlistentry>
36147   <term><parameter>fmt</parameter></term>
36148   <listitem>
36149    <para>
36150     format string
36151    </para>
36152   </listitem>
36153  </varlistentry>
36154  <varlistentry>
36155   <term><parameter>args...</parameter></term>
36156   <listitem>
36157    <para>
36158     variable arguments
36159    </para>
36160   </listitem>
36161  </varlistentry>
36162 </variablelist>
36163</refsect1>
36164<refsect1>
36165<title>Description</title>
36166<para>
36167   Works like <function>printk</function> but prints the file and the line of the caller
36168   when configured with CONFIG_SND_VERBOSE_PRINTK.
36169</para>
36170</refsect1>
36171</refentry>
36172
36173<refentry id="API-snd-printd">
36174<refentryinfo>
36175 <title>LINUX</title>
36176 <productname>Kernel Hackers Manual</productname>
36177 <date>July 2017</date>
36178</refentryinfo>
36179<refmeta>
36180 <refentrytitle><phrase>snd_printd</phrase></refentrytitle>
36181 <manvolnum>9</manvolnum>
36182 <refmiscinfo class="version">4.1.27</refmiscinfo>
36183</refmeta>
36184<refnamediv>
36185 <refname>snd_printd</refname>
36186 <refpurpose>
36187     debug printk
36188 </refpurpose>
36189</refnamediv>
36190<refsynopsisdiv>
36191 <title>Synopsis</title>
36192  <funcsynopsis><funcprototype>
36193   <funcdef> <function>snd_printd </function></funcdef>
36194   <paramdef> <parameter>fmt</parameter></paramdef>
36195   <paramdef> <parameter>args...</parameter></paramdef>
36196  </funcprototype></funcsynopsis>
36197</refsynopsisdiv>
36198<refsect1>
36199 <title>Arguments</title>
36200 <variablelist>
36201  <varlistentry>
36202   <term><parameter>fmt</parameter></term>
36203   <listitem>
36204    <para>
36205     format string
36206    </para>
36207   </listitem>
36208  </varlistentry>
36209  <varlistentry>
36210   <term><parameter>args...</parameter></term>
36211   <listitem>
36212    <para>
36213     variable arguments
36214    </para>
36215   </listitem>
36216  </varlistentry>
36217 </variablelist>
36218</refsect1>
36219<refsect1>
36220<title>Description</title>
36221<para>
36222   Works like <function>snd_printk</function> for debugging purposes.
36223   Ignored when CONFIG_SND_DEBUG is not set.
36224</para>
36225</refsect1>
36226</refentry>
36227
36228<refentry id="API-snd-BUG">
36229<refentryinfo>
36230 <title>LINUX</title>
36231 <productname>Kernel Hackers Manual</productname>
36232 <date>July 2017</date>
36233</refentryinfo>
36234<refmeta>
36235 <refentrytitle><phrase>snd_BUG</phrase></refentrytitle>
36236 <manvolnum>9</manvolnum>
36237 <refmiscinfo class="version">4.1.27</refmiscinfo>
36238</refmeta>
36239<refnamediv>
36240 <refname>snd_BUG</refname>
36241 <refpurpose>
36242     give a BUG warning message and stack trace
36243 </refpurpose>
36244</refnamediv>
36245<refsynopsisdiv>
36246 <title>Synopsis</title>
36247  <funcsynopsis><funcprototype>
36248   <funcdef> <function>snd_BUG </function></funcdef>
36249  <void/>
36250  </funcprototype></funcsynopsis>
36251</refsynopsisdiv>
36252<refsect1>
36253 <title>Arguments</title>
36254 <para>
36255  None
36256 </para>
36257</refsect1>
36258<refsect1>
36259<title>Description</title>
36260<para>
36261   </para><para>
36262
36263   Calls <function>WARN</function> if CONFIG_SND_DEBUG is set.
36264   Ignored when CONFIG_SND_DEBUG is not set.
36265</para>
36266</refsect1>
36267</refentry>
36268
36269<refentry id="API-snd-printd-ratelimit">
36270<refentryinfo>
36271 <title>LINUX</title>
36272 <productname>Kernel Hackers Manual</productname>
36273 <date>July 2017</date>
36274</refentryinfo>
36275<refmeta>
36276 <refentrytitle><phrase>snd_printd_ratelimit</phrase></refentrytitle>
36277 <manvolnum>9</manvolnum>
36278 <refmiscinfo class="version">4.1.27</refmiscinfo>
36279</refmeta>
36280<refnamediv>
36281 <refname>snd_printd_ratelimit</refname>
36282 <refpurpose>
36283   </refpurpose>
36284</refnamediv>
36285<refsynopsisdiv>
36286 <title>Synopsis</title>
36287  <funcsynopsis><funcprototype>
36288   <funcdef> <function>snd_printd_ratelimit </function></funcdef>
36289  <void/>
36290  </funcprototype></funcsynopsis>
36291</refsynopsisdiv>
36292<refsect1>
36293 <title>Arguments</title>
36294 <para>
36295  None
36296 </para>
36297</refsect1>
36298</refentry>
36299
36300<refentry id="API-snd-BUG-ON">
36301<refentryinfo>
36302 <title>LINUX</title>
36303 <productname>Kernel Hackers Manual</productname>
36304 <date>July 2017</date>
36305</refentryinfo>
36306<refmeta>
36307 <refentrytitle><phrase>snd_BUG_ON</phrase></refentrytitle>
36308 <manvolnum>9</manvolnum>
36309 <refmiscinfo class="version">4.1.27</refmiscinfo>
36310</refmeta>
36311<refnamediv>
36312 <refname>snd_BUG_ON</refname>
36313 <refpurpose>
36314     debugging check macro
36315 </refpurpose>
36316</refnamediv>
36317<refsynopsisdiv>
36318 <title>Synopsis</title>
36319  <funcsynopsis><funcprototype>
36320   <funcdef> <function>snd_BUG_ON </function></funcdef>
36321   <paramdef> <parameter>cond</parameter></paramdef>
36322  </funcprototype></funcsynopsis>
36323</refsynopsisdiv>
36324<refsect1>
36325 <title>Arguments</title>
36326 <variablelist>
36327  <varlistentry>
36328   <term><parameter>cond</parameter></term>
36329   <listitem>
36330    <para>
36331     condition to evaluate
36332    </para>
36333   </listitem>
36334  </varlistentry>
36335 </variablelist>
36336</refsect1>
36337<refsect1>
36338<title>Description</title>
36339<para>
36340   Has the same behavior as WARN_ON when CONFIG_SND_DEBUG is set,
36341   otherwise just evaluates the conditional and returns the value.
36342</para>
36343</refsect1>
36344</refentry>
36345
36346<refentry id="API-snd-printdd">
36347<refentryinfo>
36348 <title>LINUX</title>
36349 <productname>Kernel Hackers Manual</productname>
36350 <date>July 2017</date>
36351</refentryinfo>
36352<refmeta>
36353 <refentrytitle><phrase>snd_printdd</phrase></refentrytitle>
36354 <manvolnum>9</manvolnum>
36355 <refmiscinfo class="version">4.1.27</refmiscinfo>
36356</refmeta>
36357<refnamediv>
36358 <refname>snd_printdd</refname>
36359 <refpurpose>
36360     debug printk
36361 </refpurpose>
36362</refnamediv>
36363<refsynopsisdiv>
36364 <title>Synopsis</title>
36365  <funcsynopsis><funcprototype>
36366   <funcdef> <function>snd_printdd </function></funcdef>
36367   <paramdef> <parameter>format</parameter></paramdef>
36368   <paramdef> <parameter>args...</parameter></paramdef>
36369  </funcprototype></funcsynopsis>
36370</refsynopsisdiv>
36371<refsect1>
36372 <title>Arguments</title>
36373 <variablelist>
36374  <varlistentry>
36375   <term><parameter>format</parameter></term>
36376   <listitem>
36377    <para>
36378     format string
36379    </para>
36380   </listitem>
36381  </varlistentry>
36382  <varlistentry>
36383   <term><parameter>args...</parameter></term>
36384   <listitem>
36385    <para>
36386     variable arguments
36387    </para>
36388   </listitem>
36389  </varlistentry>
36390 </variablelist>
36391</refsect1>
36392<refsect1>
36393<title>Description</title>
36394<para>
36395   Works like <function>snd_printk</function> for debugging purposes.
36396   Ignored when CONFIG_SND_DEBUG_VERBOSE is not set.
36397</para>
36398</refsect1>
36399</refentry>
36400
36401<!-- sound/sound_core.c -->
36402<refentry id="API-register-sound-special-device">
36403<refentryinfo>
36404 <title>LINUX</title>
36405 <productname>Kernel Hackers Manual</productname>
36406 <date>July 2017</date>
36407</refentryinfo>
36408<refmeta>
36409 <refentrytitle><phrase>register_sound_special_device</phrase></refentrytitle>
36410 <manvolnum>9</manvolnum>
36411 <refmiscinfo class="version">4.1.27</refmiscinfo>
36412</refmeta>
36413<refnamediv>
36414 <refname>register_sound_special_device</refname>
36415 <refpurpose>
36416  register a special sound node
36417 </refpurpose>
36418</refnamediv>
36419<refsynopsisdiv>
36420 <title>Synopsis</title>
36421  <funcsynopsis><funcprototype>
36422   <funcdef>int <function>register_sound_special_device </function></funcdef>
36423   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
36424   <paramdef>int <parameter>unit</parameter></paramdef>
36425   <paramdef>struct device * <parameter>dev</parameter></paramdef>
36426  </funcprototype></funcsynopsis>
36427</refsynopsisdiv>
36428<refsect1>
36429 <title>Arguments</title>
36430 <variablelist>
36431  <varlistentry>
36432   <term><parameter>fops</parameter></term>
36433   <listitem>
36434    <para>
36435     File operations for the driver
36436    </para>
36437   </listitem>
36438  </varlistentry>
36439  <varlistentry>
36440   <term><parameter>unit</parameter></term>
36441   <listitem>
36442    <para>
36443     Unit number to allocate
36444    </para>
36445   </listitem>
36446  </varlistentry>
36447  <varlistentry>
36448   <term><parameter>dev</parameter></term>
36449   <listitem>
36450    <para>
36451     device pointer
36452    </para>
36453   </listitem>
36454  </varlistentry>
36455 </variablelist>
36456</refsect1>
36457<refsect1>
36458<title>Description</title>
36459<para>
36460   Allocate a special sound device by minor number from the sound
36461   subsystem.
36462</para>
36463</refsect1>
36464<refsect1>
36465<title>Return</title>
36466<para>
36467   The allocated number is returned on success. On failure,
36468   a negative error code is returned.
36469</para>
36470</refsect1>
36471</refentry>
36472
36473<refentry id="API-register-sound-mixer">
36474<refentryinfo>
36475 <title>LINUX</title>
36476 <productname>Kernel Hackers Manual</productname>
36477 <date>July 2017</date>
36478</refentryinfo>
36479<refmeta>
36480 <refentrytitle><phrase>register_sound_mixer</phrase></refentrytitle>
36481 <manvolnum>9</manvolnum>
36482 <refmiscinfo class="version">4.1.27</refmiscinfo>
36483</refmeta>
36484<refnamediv>
36485 <refname>register_sound_mixer</refname>
36486 <refpurpose>
36487     register a mixer device
36488 </refpurpose>
36489</refnamediv>
36490<refsynopsisdiv>
36491 <title>Synopsis</title>
36492  <funcsynopsis><funcprototype>
36493   <funcdef>int <function>register_sound_mixer </function></funcdef>
36494   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
36495   <paramdef>int <parameter>dev</parameter></paramdef>
36496  </funcprototype></funcsynopsis>
36497</refsynopsisdiv>
36498<refsect1>
36499 <title>Arguments</title>
36500 <variablelist>
36501  <varlistentry>
36502   <term><parameter>fops</parameter></term>
36503   <listitem>
36504    <para>
36505     File operations for the driver
36506    </para>
36507   </listitem>
36508  </varlistentry>
36509  <varlistentry>
36510   <term><parameter>dev</parameter></term>
36511   <listitem>
36512    <para>
36513     Unit number to allocate
36514    </para>
36515   </listitem>
36516  </varlistentry>
36517 </variablelist>
36518</refsect1>
36519<refsect1>
36520<title>Description</title>
36521<para>
36522   Allocate a mixer device. Unit is the number of the mixer requested.
36523   Pass -1 to request the next free mixer unit.
36524</para>
36525</refsect1>
36526<refsect1>
36527<title>Return</title>
36528<para>
36529   On success, the allocated number is returned. On failure,
36530   a negative error code is returned.
36531</para>
36532</refsect1>
36533</refentry>
36534
36535<refentry id="API-register-sound-midi">
36536<refentryinfo>
36537 <title>LINUX</title>
36538 <productname>Kernel Hackers Manual</productname>
36539 <date>July 2017</date>
36540</refentryinfo>
36541<refmeta>
36542 <refentrytitle><phrase>register_sound_midi</phrase></refentrytitle>
36543 <manvolnum>9</manvolnum>
36544 <refmiscinfo class="version">4.1.27</refmiscinfo>
36545</refmeta>
36546<refnamediv>
36547 <refname>register_sound_midi</refname>
36548 <refpurpose>
36549     register a midi device
36550 </refpurpose>
36551</refnamediv>
36552<refsynopsisdiv>
36553 <title>Synopsis</title>
36554  <funcsynopsis><funcprototype>
36555   <funcdef>int <function>register_sound_midi </function></funcdef>
36556   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
36557   <paramdef>int <parameter>dev</parameter></paramdef>
36558  </funcprototype></funcsynopsis>
36559</refsynopsisdiv>
36560<refsect1>
36561 <title>Arguments</title>
36562 <variablelist>
36563  <varlistentry>
36564   <term><parameter>fops</parameter></term>
36565   <listitem>
36566    <para>
36567     File operations for the driver
36568    </para>
36569   </listitem>
36570  </varlistentry>
36571  <varlistentry>
36572   <term><parameter>dev</parameter></term>
36573   <listitem>
36574    <para>
36575     Unit number to allocate
36576    </para>
36577   </listitem>
36578  </varlistentry>
36579 </variablelist>
36580</refsect1>
36581<refsect1>
36582<title>Description</title>
36583<para>
36584   Allocate a midi device. Unit is the number of the midi device requested.
36585   Pass -1 to request the next free midi unit.
36586</para>
36587</refsect1>
36588<refsect1>
36589<title>Return</title>
36590<para>
36591   On success, the allocated number is returned. On failure,
36592   a negative error code is returned.
36593</para>
36594</refsect1>
36595</refentry>
36596
36597<refentry id="API-register-sound-dsp">
36598<refentryinfo>
36599 <title>LINUX</title>
36600 <productname>Kernel Hackers Manual</productname>
36601 <date>July 2017</date>
36602</refentryinfo>
36603<refmeta>
36604 <refentrytitle><phrase>register_sound_dsp</phrase></refentrytitle>
36605 <manvolnum>9</manvolnum>
36606 <refmiscinfo class="version">4.1.27</refmiscinfo>
36607</refmeta>
36608<refnamediv>
36609 <refname>register_sound_dsp</refname>
36610 <refpurpose>
36611     register a DSP device
36612 </refpurpose>
36613</refnamediv>
36614<refsynopsisdiv>
36615 <title>Synopsis</title>
36616  <funcsynopsis><funcprototype>
36617   <funcdef>int <function>register_sound_dsp </function></funcdef>
36618   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
36619   <paramdef>int <parameter>dev</parameter></paramdef>
36620  </funcprototype></funcsynopsis>
36621</refsynopsisdiv>
36622<refsect1>
36623 <title>Arguments</title>
36624 <variablelist>
36625  <varlistentry>
36626   <term><parameter>fops</parameter></term>
36627   <listitem>
36628    <para>
36629     File operations for the driver
36630    </para>
36631   </listitem>
36632  </varlistentry>
36633  <varlistentry>
36634   <term><parameter>dev</parameter></term>
36635   <listitem>
36636    <para>
36637     Unit number to allocate
36638    </para>
36639   </listitem>
36640  </varlistentry>
36641 </variablelist>
36642</refsect1>
36643<refsect1>
36644<title>Description</title>
36645<para>
36646   Allocate a DSP device. Unit is the number of the DSP requested.
36647   Pass -1 to request the next free DSP unit.
36648   </para><para>
36649
36650   This function allocates both the audio and dsp device entries together
36651   and will always allocate them as a matching pair - eg dsp3/audio3
36652</para>
36653</refsect1>
36654<refsect1>
36655<title>Return</title>
36656<para>
36657   On success, the allocated number is returned. On failure,
36658   a negative error code is returned.
36659</para>
36660</refsect1>
36661</refentry>
36662
36663<refentry id="API-unregister-sound-special">
36664<refentryinfo>
36665 <title>LINUX</title>
36666 <productname>Kernel Hackers Manual</productname>
36667 <date>July 2017</date>
36668</refentryinfo>
36669<refmeta>
36670 <refentrytitle><phrase>unregister_sound_special</phrase></refentrytitle>
36671 <manvolnum>9</manvolnum>
36672 <refmiscinfo class="version">4.1.27</refmiscinfo>
36673</refmeta>
36674<refnamediv>
36675 <refname>unregister_sound_special</refname>
36676 <refpurpose>
36677     unregister a special sound device
36678 </refpurpose>
36679</refnamediv>
36680<refsynopsisdiv>
36681 <title>Synopsis</title>
36682  <funcsynopsis><funcprototype>
36683   <funcdef>void <function>unregister_sound_special </function></funcdef>
36684   <paramdef>int <parameter>unit</parameter></paramdef>
36685  </funcprototype></funcsynopsis>
36686</refsynopsisdiv>
36687<refsect1>
36688 <title>Arguments</title>
36689 <variablelist>
36690  <varlistentry>
36691   <term><parameter>unit</parameter></term>
36692   <listitem>
36693    <para>
36694     unit number to allocate
36695    </para>
36696   </listitem>
36697  </varlistentry>
36698 </variablelist>
36699</refsect1>
36700<refsect1>
36701<title>Description</title>
36702<para>
36703   Release a sound device that was allocated with
36704   <function>register_sound_special</function>. The unit passed is the return value from
36705   the register function.
36706</para>
36707</refsect1>
36708</refentry>
36709
36710<refentry id="API-unregister-sound-mixer">
36711<refentryinfo>
36712 <title>LINUX</title>
36713 <productname>Kernel Hackers Manual</productname>
36714 <date>July 2017</date>
36715</refentryinfo>
36716<refmeta>
36717 <refentrytitle><phrase>unregister_sound_mixer</phrase></refentrytitle>
36718 <manvolnum>9</manvolnum>
36719 <refmiscinfo class="version">4.1.27</refmiscinfo>
36720</refmeta>
36721<refnamediv>
36722 <refname>unregister_sound_mixer</refname>
36723 <refpurpose>
36724     unregister a mixer
36725 </refpurpose>
36726</refnamediv>
36727<refsynopsisdiv>
36728 <title>Synopsis</title>
36729  <funcsynopsis><funcprototype>
36730   <funcdef>void <function>unregister_sound_mixer </function></funcdef>
36731   <paramdef>int <parameter>unit</parameter></paramdef>
36732  </funcprototype></funcsynopsis>
36733</refsynopsisdiv>
36734<refsect1>
36735 <title>Arguments</title>
36736 <variablelist>
36737  <varlistentry>
36738   <term><parameter>unit</parameter></term>
36739   <listitem>
36740    <para>
36741     unit number to allocate
36742    </para>
36743   </listitem>
36744  </varlistentry>
36745 </variablelist>
36746</refsect1>
36747<refsect1>
36748<title>Description</title>
36749<para>
36750   Release a sound device that was allocated with <function>register_sound_mixer</function>.
36751   The unit passed is the return value from the register function.
36752</para>
36753</refsect1>
36754</refentry>
36755
36756<refentry id="API-unregister-sound-midi">
36757<refentryinfo>
36758 <title>LINUX</title>
36759 <productname>Kernel Hackers Manual</productname>
36760 <date>July 2017</date>
36761</refentryinfo>
36762<refmeta>
36763 <refentrytitle><phrase>unregister_sound_midi</phrase></refentrytitle>
36764 <manvolnum>9</manvolnum>
36765 <refmiscinfo class="version">4.1.27</refmiscinfo>
36766</refmeta>
36767<refnamediv>
36768 <refname>unregister_sound_midi</refname>
36769 <refpurpose>
36770     unregister a midi device
36771 </refpurpose>
36772</refnamediv>
36773<refsynopsisdiv>
36774 <title>Synopsis</title>
36775  <funcsynopsis><funcprototype>
36776   <funcdef>void <function>unregister_sound_midi </function></funcdef>
36777   <paramdef>int <parameter>unit</parameter></paramdef>
36778  </funcprototype></funcsynopsis>
36779</refsynopsisdiv>
36780<refsect1>
36781 <title>Arguments</title>
36782 <variablelist>
36783  <varlistentry>
36784   <term><parameter>unit</parameter></term>
36785   <listitem>
36786    <para>
36787     unit number to allocate
36788    </para>
36789   </listitem>
36790  </varlistentry>
36791 </variablelist>
36792</refsect1>
36793<refsect1>
36794<title>Description</title>
36795<para>
36796   Release a sound device that was allocated with <function>register_sound_midi</function>.
36797   The unit passed is the return value from the register function.
36798</para>
36799</refsect1>
36800</refentry>
36801
36802<refentry id="API-unregister-sound-dsp">
36803<refentryinfo>
36804 <title>LINUX</title>
36805 <productname>Kernel Hackers Manual</productname>
36806 <date>July 2017</date>
36807</refentryinfo>
36808<refmeta>
36809 <refentrytitle><phrase>unregister_sound_dsp</phrase></refentrytitle>
36810 <manvolnum>9</manvolnum>
36811 <refmiscinfo class="version">4.1.27</refmiscinfo>
36812</refmeta>
36813<refnamediv>
36814 <refname>unregister_sound_dsp</refname>
36815 <refpurpose>
36816     unregister a DSP device
36817 </refpurpose>
36818</refnamediv>
36819<refsynopsisdiv>
36820 <title>Synopsis</title>
36821  <funcsynopsis><funcprototype>
36822   <funcdef>void <function>unregister_sound_dsp </function></funcdef>
36823   <paramdef>int <parameter>unit</parameter></paramdef>
36824  </funcprototype></funcsynopsis>
36825</refsynopsisdiv>
36826<refsect1>
36827 <title>Arguments</title>
36828 <variablelist>
36829  <varlistentry>
36830   <term><parameter>unit</parameter></term>
36831   <listitem>
36832    <para>
36833     unit number to allocate
36834    </para>
36835   </listitem>
36836  </varlistentry>
36837 </variablelist>
36838</refsect1>
36839<refsect1>
36840<title>Description</title>
36841<para>
36842   Release a sound device that was allocated with <function>register_sound_dsp</function>.
36843   The unit passed is the return value from the register function.
36844   </para><para>
36845
36846   Both of the allocated units are released together automatically.
36847</para>
36848</refsect1>
36849</refentry>
36850
36851<!-- include/sound/pcm.h -->
36852<refentry id="API-snd-pcm-stream-linked">
36853<refentryinfo>
36854 <title>LINUX</title>
36855 <productname>Kernel Hackers Manual</productname>
36856 <date>July 2017</date>
36857</refentryinfo>
36858<refmeta>
36859 <refentrytitle><phrase>snd_pcm_stream_linked</phrase></refentrytitle>
36860 <manvolnum>9</manvolnum>
36861 <refmiscinfo class="version">4.1.27</refmiscinfo>
36862</refmeta>
36863<refnamediv>
36864 <refname>snd_pcm_stream_linked</refname>
36865 <refpurpose>
36866  Check whether the substream is linked with others
36867 </refpurpose>
36868</refnamediv>
36869<refsynopsisdiv>
36870 <title>Synopsis</title>
36871  <funcsynopsis><funcprototype>
36872   <funcdef>int <function>snd_pcm_stream_linked </function></funcdef>
36873   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
36874  </funcprototype></funcsynopsis>
36875</refsynopsisdiv>
36876<refsect1>
36877 <title>Arguments</title>
36878 <variablelist>
36879  <varlistentry>
36880   <term><parameter>substream</parameter></term>
36881   <listitem>
36882    <para>
36883     substream to check
36884    </para>
36885   </listitem>
36886  </varlistentry>
36887 </variablelist>
36888</refsect1>
36889<refsect1>
36890<title>Description</title>
36891<para>
36892   Returns true if the given substream is being linked with others.
36893</para>
36894</refsect1>
36895</refentry>
36896
36897<refentry id="API-snd-pcm-stream-lock-irqsave">
36898<refentryinfo>
36899 <title>LINUX</title>
36900 <productname>Kernel Hackers Manual</productname>
36901 <date>July 2017</date>
36902</refentryinfo>
36903<refmeta>
36904 <refentrytitle><phrase>snd_pcm_stream_lock_irqsave</phrase></refentrytitle>
36905 <manvolnum>9</manvolnum>
36906 <refmiscinfo class="version">4.1.27</refmiscinfo>
36907</refmeta>
36908<refnamediv>
36909 <refname>snd_pcm_stream_lock_irqsave</refname>
36910 <refpurpose>
36911     Lock the PCM stream
36912 </refpurpose>
36913</refnamediv>
36914<refsynopsisdiv>
36915 <title>Synopsis</title>
36916  <funcsynopsis><funcprototype>
36917   <funcdef> <function>snd_pcm_stream_lock_irqsave </function></funcdef>
36918   <paramdef> <parameter>substream</parameter></paramdef>
36919   <paramdef> <parameter>flags</parameter></paramdef>
36920  </funcprototype></funcsynopsis>
36921</refsynopsisdiv>
36922<refsect1>
36923 <title>Arguments</title>
36924 <variablelist>
36925  <varlistentry>
36926   <term><parameter>substream</parameter></term>
36927   <listitem>
36928    <para>
36929     PCM substream
36930    </para>
36931   </listitem>
36932  </varlistentry>
36933  <varlistentry>
36934   <term><parameter>flags</parameter></term>
36935   <listitem>
36936    <para>
36937     irq flags
36938    </para>
36939   </listitem>
36940  </varlistentry>
36941 </variablelist>
36942</refsect1>
36943<refsect1>
36944<title>Description</title>
36945<para>
36946   This locks the PCM stream like <function>snd_pcm_stream_lock</function> but with the local
36947   IRQ (only when nonatomic is false).  In nonatomic case, this is identical
36948   as <function>snd_pcm_stream_lock</function>.
36949</para>
36950</refsect1>
36951</refentry>
36952
36953<refentry id="API-snd-pcm-group-for-each-entry">
36954<refentryinfo>
36955 <title>LINUX</title>
36956 <productname>Kernel Hackers Manual</productname>
36957 <date>July 2017</date>
36958</refentryinfo>
36959<refmeta>
36960 <refentrytitle><phrase>snd_pcm_group_for_each_entry</phrase></refentrytitle>
36961 <manvolnum>9</manvolnum>
36962 <refmiscinfo class="version">4.1.27</refmiscinfo>
36963</refmeta>
36964<refnamediv>
36965 <refname>snd_pcm_group_for_each_entry</refname>
36966 <refpurpose>
36967     iterate over the linked substreams
36968 </refpurpose>
36969</refnamediv>
36970<refsynopsisdiv>
36971 <title>Synopsis</title>
36972  <funcsynopsis><funcprototype>
36973   <funcdef> <function>snd_pcm_group_for_each_entry </function></funcdef>
36974   <paramdef> <parameter>s</parameter></paramdef>
36975   <paramdef> <parameter>substream</parameter></paramdef>
36976  </funcprototype></funcsynopsis>
36977</refsynopsisdiv>
36978<refsect1>
36979 <title>Arguments</title>
36980 <variablelist>
36981  <varlistentry>
36982   <term><parameter>s</parameter></term>
36983   <listitem>
36984    <para>
36985     the iterator
36986    </para>
36987   </listitem>
36988  </varlistentry>
36989  <varlistentry>
36990   <term><parameter>substream</parameter></term>
36991   <listitem>
36992    <para>
36993     the substream
36994    </para>
36995   </listitem>
36996  </varlistentry>
36997 </variablelist>
36998</refsect1>
36999<refsect1>
37000<title>Description</title>
37001<para>
37002   Iterate over the all linked substreams to the given <parameter>substream</parameter>.
37003   When <parameter>substream</parameter> isn't linked with any others, this gives returns <parameter>substream</parameter>
37004   itself once.
37005</para>
37006</refsect1>
37007</refentry>
37008
37009<refentry id="API-snd-pcm-running">
37010<refentryinfo>
37011 <title>LINUX</title>
37012 <productname>Kernel Hackers Manual</productname>
37013 <date>July 2017</date>
37014</refentryinfo>
37015<refmeta>
37016 <refentrytitle><phrase>snd_pcm_running</phrase></refentrytitle>
37017 <manvolnum>9</manvolnum>
37018 <refmiscinfo class="version">4.1.27</refmiscinfo>
37019</refmeta>
37020<refnamediv>
37021 <refname>snd_pcm_running</refname>
37022 <refpurpose>
37023     Check whether the substream is in a running state
37024 </refpurpose>
37025</refnamediv>
37026<refsynopsisdiv>
37027 <title>Synopsis</title>
37028  <funcsynopsis><funcprototype>
37029   <funcdef>int <function>snd_pcm_running </function></funcdef>
37030   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37031  </funcprototype></funcsynopsis>
37032</refsynopsisdiv>
37033<refsect1>
37034 <title>Arguments</title>
37035 <variablelist>
37036  <varlistentry>
37037   <term><parameter>substream</parameter></term>
37038   <listitem>
37039    <para>
37040     substream to check
37041    </para>
37042   </listitem>
37043  </varlistentry>
37044 </variablelist>
37045</refsect1>
37046<refsect1>
37047<title>Description</title>
37048<para>
37049   Returns true if the given substream is in the state RUNNING, or in the
37050   state DRAINING for playback.
37051</para>
37052</refsect1>
37053</refentry>
37054
37055<refentry id="API-bytes-to-samples">
37056<refentryinfo>
37057 <title>LINUX</title>
37058 <productname>Kernel Hackers Manual</productname>
37059 <date>July 2017</date>
37060</refentryinfo>
37061<refmeta>
37062 <refentrytitle><phrase>bytes_to_samples</phrase></refentrytitle>
37063 <manvolnum>9</manvolnum>
37064 <refmiscinfo class="version">4.1.27</refmiscinfo>
37065</refmeta>
37066<refnamediv>
37067 <refname>bytes_to_samples</refname>
37068 <refpurpose>
37069     Unit conversion of the size from bytes to samples
37070 </refpurpose>
37071</refnamediv>
37072<refsynopsisdiv>
37073 <title>Synopsis</title>
37074  <funcsynopsis><funcprototype>
37075   <funcdef>ssize_t <function>bytes_to_samples </function></funcdef>
37076   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37077   <paramdef>ssize_t <parameter>size</parameter></paramdef>
37078  </funcprototype></funcsynopsis>
37079</refsynopsisdiv>
37080<refsect1>
37081 <title>Arguments</title>
37082 <variablelist>
37083  <varlistentry>
37084   <term><parameter>runtime</parameter></term>
37085   <listitem>
37086    <para>
37087     PCM runtime instance
37088    </para>
37089   </listitem>
37090  </varlistentry>
37091  <varlistentry>
37092   <term><parameter>size</parameter></term>
37093   <listitem>
37094    <para>
37095     size in bytes
37096    </para>
37097   </listitem>
37098  </varlistentry>
37099 </variablelist>
37100</refsect1>
37101</refentry>
37102
37103<refentry id="API-bytes-to-frames">
37104<refentryinfo>
37105 <title>LINUX</title>
37106 <productname>Kernel Hackers Manual</productname>
37107 <date>July 2017</date>
37108</refentryinfo>
37109<refmeta>
37110 <refentrytitle><phrase>bytes_to_frames</phrase></refentrytitle>
37111 <manvolnum>9</manvolnum>
37112 <refmiscinfo class="version">4.1.27</refmiscinfo>
37113</refmeta>
37114<refnamediv>
37115 <refname>bytes_to_frames</refname>
37116 <refpurpose>
37117     Unit conversion of the size from bytes to frames
37118 </refpurpose>
37119</refnamediv>
37120<refsynopsisdiv>
37121 <title>Synopsis</title>
37122  <funcsynopsis><funcprototype>
37123   <funcdef>snd_pcm_sframes_t <function>bytes_to_frames </function></funcdef>
37124   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37125   <paramdef>ssize_t <parameter>size</parameter></paramdef>
37126  </funcprototype></funcsynopsis>
37127</refsynopsisdiv>
37128<refsect1>
37129 <title>Arguments</title>
37130 <variablelist>
37131  <varlistentry>
37132   <term><parameter>runtime</parameter></term>
37133   <listitem>
37134    <para>
37135     PCM runtime instance
37136    </para>
37137   </listitem>
37138  </varlistentry>
37139  <varlistentry>
37140   <term><parameter>size</parameter></term>
37141   <listitem>
37142    <para>
37143     size in bytes
37144    </para>
37145   </listitem>
37146  </varlistentry>
37147 </variablelist>
37148</refsect1>
37149</refentry>
37150
37151<refentry id="API-samples-to-bytes">
37152<refentryinfo>
37153 <title>LINUX</title>
37154 <productname>Kernel Hackers Manual</productname>
37155 <date>July 2017</date>
37156</refentryinfo>
37157<refmeta>
37158 <refentrytitle><phrase>samples_to_bytes</phrase></refentrytitle>
37159 <manvolnum>9</manvolnum>
37160 <refmiscinfo class="version">4.1.27</refmiscinfo>
37161</refmeta>
37162<refnamediv>
37163 <refname>samples_to_bytes</refname>
37164 <refpurpose>
37165     Unit conversion of the size from samples to bytes
37166 </refpurpose>
37167</refnamediv>
37168<refsynopsisdiv>
37169 <title>Synopsis</title>
37170  <funcsynopsis><funcprototype>
37171   <funcdef>ssize_t <function>samples_to_bytes </function></funcdef>
37172   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37173   <paramdef>ssize_t <parameter>size</parameter></paramdef>
37174  </funcprototype></funcsynopsis>
37175</refsynopsisdiv>
37176<refsect1>
37177 <title>Arguments</title>
37178 <variablelist>
37179  <varlistentry>
37180   <term><parameter>runtime</parameter></term>
37181   <listitem>
37182    <para>
37183     PCM runtime instance
37184    </para>
37185   </listitem>
37186  </varlistentry>
37187  <varlistentry>
37188   <term><parameter>size</parameter></term>
37189   <listitem>
37190    <para>
37191     size in samples
37192    </para>
37193   </listitem>
37194  </varlistentry>
37195 </variablelist>
37196</refsect1>
37197</refentry>
37198
37199<refentry id="API-frames-to-bytes">
37200<refentryinfo>
37201 <title>LINUX</title>
37202 <productname>Kernel Hackers Manual</productname>
37203 <date>July 2017</date>
37204</refentryinfo>
37205<refmeta>
37206 <refentrytitle><phrase>frames_to_bytes</phrase></refentrytitle>
37207 <manvolnum>9</manvolnum>
37208 <refmiscinfo class="version">4.1.27</refmiscinfo>
37209</refmeta>
37210<refnamediv>
37211 <refname>frames_to_bytes</refname>
37212 <refpurpose>
37213     Unit conversion of the size from frames to bytes
37214 </refpurpose>
37215</refnamediv>
37216<refsynopsisdiv>
37217 <title>Synopsis</title>
37218  <funcsynopsis><funcprototype>
37219   <funcdef>ssize_t <function>frames_to_bytes </function></funcdef>
37220   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37221   <paramdef>snd_pcm_sframes_t <parameter>size</parameter></paramdef>
37222  </funcprototype></funcsynopsis>
37223</refsynopsisdiv>
37224<refsect1>
37225 <title>Arguments</title>
37226 <variablelist>
37227  <varlistentry>
37228   <term><parameter>runtime</parameter></term>
37229   <listitem>
37230    <para>
37231     PCM runtime instance
37232    </para>
37233   </listitem>
37234  </varlistentry>
37235  <varlistentry>
37236   <term><parameter>size</parameter></term>
37237   <listitem>
37238    <para>
37239     size in frames
37240    </para>
37241   </listitem>
37242  </varlistentry>
37243 </variablelist>
37244</refsect1>
37245</refentry>
37246
37247<refentry id="API-frame-aligned">
37248<refentryinfo>
37249 <title>LINUX</title>
37250 <productname>Kernel Hackers Manual</productname>
37251 <date>July 2017</date>
37252</refentryinfo>
37253<refmeta>
37254 <refentrytitle><phrase>frame_aligned</phrase></refentrytitle>
37255 <manvolnum>9</manvolnum>
37256 <refmiscinfo class="version">4.1.27</refmiscinfo>
37257</refmeta>
37258<refnamediv>
37259 <refname>frame_aligned</refname>
37260 <refpurpose>
37261     Check whether the byte size is aligned to frames
37262 </refpurpose>
37263</refnamediv>
37264<refsynopsisdiv>
37265 <title>Synopsis</title>
37266  <funcsynopsis><funcprototype>
37267   <funcdef>int <function>frame_aligned </function></funcdef>
37268   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37269   <paramdef>ssize_t <parameter>bytes</parameter></paramdef>
37270  </funcprototype></funcsynopsis>
37271</refsynopsisdiv>
37272<refsect1>
37273 <title>Arguments</title>
37274 <variablelist>
37275  <varlistentry>
37276   <term><parameter>runtime</parameter></term>
37277   <listitem>
37278    <para>
37279     PCM runtime instance
37280    </para>
37281   </listitem>
37282  </varlistentry>
37283  <varlistentry>
37284   <term><parameter>bytes</parameter></term>
37285   <listitem>
37286    <para>
37287     size in bytes
37288    </para>
37289   </listitem>
37290  </varlistentry>
37291 </variablelist>
37292</refsect1>
37293</refentry>
37294
37295<refentry id="API-snd-pcm-lib-buffer-bytes">
37296<refentryinfo>
37297 <title>LINUX</title>
37298 <productname>Kernel Hackers Manual</productname>
37299 <date>July 2017</date>
37300</refentryinfo>
37301<refmeta>
37302 <refentrytitle><phrase>snd_pcm_lib_buffer_bytes</phrase></refentrytitle>
37303 <manvolnum>9</manvolnum>
37304 <refmiscinfo class="version">4.1.27</refmiscinfo>
37305</refmeta>
37306<refnamediv>
37307 <refname>snd_pcm_lib_buffer_bytes</refname>
37308 <refpurpose>
37309     Get the buffer size of the current PCM in bytes
37310 </refpurpose>
37311</refnamediv>
37312<refsynopsisdiv>
37313 <title>Synopsis</title>
37314  <funcsynopsis><funcprototype>
37315   <funcdef>size_t <function>snd_pcm_lib_buffer_bytes </function></funcdef>
37316   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37317  </funcprototype></funcsynopsis>
37318</refsynopsisdiv>
37319<refsect1>
37320 <title>Arguments</title>
37321 <variablelist>
37322  <varlistentry>
37323   <term><parameter>substream</parameter></term>
37324   <listitem>
37325    <para>
37326     PCM substream
37327    </para>
37328   </listitem>
37329  </varlistentry>
37330 </variablelist>
37331</refsect1>
37332</refentry>
37333
37334<refentry id="API-snd-pcm-lib-period-bytes">
37335<refentryinfo>
37336 <title>LINUX</title>
37337 <productname>Kernel Hackers Manual</productname>
37338 <date>July 2017</date>
37339</refentryinfo>
37340<refmeta>
37341 <refentrytitle><phrase>snd_pcm_lib_period_bytes</phrase></refentrytitle>
37342 <manvolnum>9</manvolnum>
37343 <refmiscinfo class="version">4.1.27</refmiscinfo>
37344</refmeta>
37345<refnamediv>
37346 <refname>snd_pcm_lib_period_bytes</refname>
37347 <refpurpose>
37348     Get the period size of the current PCM in bytes
37349 </refpurpose>
37350</refnamediv>
37351<refsynopsisdiv>
37352 <title>Synopsis</title>
37353  <funcsynopsis><funcprototype>
37354   <funcdef>size_t <function>snd_pcm_lib_period_bytes </function></funcdef>
37355   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37356  </funcprototype></funcsynopsis>
37357</refsynopsisdiv>
37358<refsect1>
37359 <title>Arguments</title>
37360 <variablelist>
37361  <varlistentry>
37362   <term><parameter>substream</parameter></term>
37363   <listitem>
37364    <para>
37365     PCM substream
37366    </para>
37367   </listitem>
37368  </varlistentry>
37369 </variablelist>
37370</refsect1>
37371</refentry>
37372
37373<refentry id="API-snd-pcm-playback-avail">
37374<refentryinfo>
37375 <title>LINUX</title>
37376 <productname>Kernel Hackers Manual</productname>
37377 <date>July 2017</date>
37378</refentryinfo>
37379<refmeta>
37380 <refentrytitle><phrase>snd_pcm_playback_avail</phrase></refentrytitle>
37381 <manvolnum>9</manvolnum>
37382 <refmiscinfo class="version">4.1.27</refmiscinfo>
37383</refmeta>
37384<refnamediv>
37385 <refname>snd_pcm_playback_avail</refname>
37386 <refpurpose>
37387     Get the available (writable) space for playback
37388 </refpurpose>
37389</refnamediv>
37390<refsynopsisdiv>
37391 <title>Synopsis</title>
37392  <funcsynopsis><funcprototype>
37393   <funcdef>snd_pcm_uframes_t <function>snd_pcm_playback_avail </function></funcdef>
37394   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37395  </funcprototype></funcsynopsis>
37396</refsynopsisdiv>
37397<refsect1>
37398 <title>Arguments</title>
37399 <variablelist>
37400  <varlistentry>
37401   <term><parameter>runtime</parameter></term>
37402   <listitem>
37403    <para>
37404     PCM runtime instance
37405    </para>
37406   </listitem>
37407  </varlistentry>
37408 </variablelist>
37409</refsect1>
37410<refsect1>
37411<title>Description</title>
37412<para>
37413   Result is between 0 ... (boundary - 1)
37414</para>
37415</refsect1>
37416</refentry>
37417
37418<refentry id="API-snd-pcm-capture-avail">
37419<refentryinfo>
37420 <title>LINUX</title>
37421 <productname>Kernel Hackers Manual</productname>
37422 <date>July 2017</date>
37423</refentryinfo>
37424<refmeta>
37425 <refentrytitle><phrase>snd_pcm_capture_avail</phrase></refentrytitle>
37426 <manvolnum>9</manvolnum>
37427 <refmiscinfo class="version">4.1.27</refmiscinfo>
37428</refmeta>
37429<refnamediv>
37430 <refname>snd_pcm_capture_avail</refname>
37431 <refpurpose>
37432     Get the available (readable) space for capture
37433 </refpurpose>
37434</refnamediv>
37435<refsynopsisdiv>
37436 <title>Synopsis</title>
37437  <funcsynopsis><funcprototype>
37438   <funcdef>snd_pcm_uframes_t <function>snd_pcm_capture_avail </function></funcdef>
37439   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37440  </funcprototype></funcsynopsis>
37441</refsynopsisdiv>
37442<refsect1>
37443 <title>Arguments</title>
37444 <variablelist>
37445  <varlistentry>
37446   <term><parameter>runtime</parameter></term>
37447   <listitem>
37448    <para>
37449     PCM runtime instance
37450    </para>
37451   </listitem>
37452  </varlistentry>
37453 </variablelist>
37454</refsect1>
37455<refsect1>
37456<title>Description</title>
37457<para>
37458   Result is between 0 ... (boundary - 1)
37459</para>
37460</refsect1>
37461</refentry>
37462
37463<refentry id="API-snd-pcm-playback-hw-avail">
37464<refentryinfo>
37465 <title>LINUX</title>
37466 <productname>Kernel Hackers Manual</productname>
37467 <date>July 2017</date>
37468</refentryinfo>
37469<refmeta>
37470 <refentrytitle><phrase>snd_pcm_playback_hw_avail</phrase></refentrytitle>
37471 <manvolnum>9</manvolnum>
37472 <refmiscinfo class="version">4.1.27</refmiscinfo>
37473</refmeta>
37474<refnamediv>
37475 <refname>snd_pcm_playback_hw_avail</refname>
37476 <refpurpose>
37477     Get the queued space for playback
37478 </refpurpose>
37479</refnamediv>
37480<refsynopsisdiv>
37481 <title>Synopsis</title>
37482  <funcsynopsis><funcprototype>
37483   <funcdef>snd_pcm_sframes_t <function>snd_pcm_playback_hw_avail </function></funcdef>
37484   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37485  </funcprototype></funcsynopsis>
37486</refsynopsisdiv>
37487<refsect1>
37488 <title>Arguments</title>
37489 <variablelist>
37490  <varlistentry>
37491   <term><parameter>runtime</parameter></term>
37492   <listitem>
37493    <para>
37494     PCM runtime instance
37495    </para>
37496   </listitem>
37497  </varlistentry>
37498 </variablelist>
37499</refsect1>
37500</refentry>
37501
37502<refentry id="API-snd-pcm-capture-hw-avail">
37503<refentryinfo>
37504 <title>LINUX</title>
37505 <productname>Kernel Hackers Manual</productname>
37506 <date>July 2017</date>
37507</refentryinfo>
37508<refmeta>
37509 <refentrytitle><phrase>snd_pcm_capture_hw_avail</phrase></refentrytitle>
37510 <manvolnum>9</manvolnum>
37511 <refmiscinfo class="version">4.1.27</refmiscinfo>
37512</refmeta>
37513<refnamediv>
37514 <refname>snd_pcm_capture_hw_avail</refname>
37515 <refpurpose>
37516     Get the free space for capture
37517 </refpurpose>
37518</refnamediv>
37519<refsynopsisdiv>
37520 <title>Synopsis</title>
37521  <funcsynopsis><funcprototype>
37522   <funcdef>snd_pcm_sframes_t <function>snd_pcm_capture_hw_avail </function></funcdef>
37523   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
37524  </funcprototype></funcsynopsis>
37525</refsynopsisdiv>
37526<refsect1>
37527 <title>Arguments</title>
37528 <variablelist>
37529  <varlistentry>
37530   <term><parameter>runtime</parameter></term>
37531   <listitem>
37532    <para>
37533     PCM runtime instance
37534    </para>
37535   </listitem>
37536  </varlistentry>
37537 </variablelist>
37538</refsect1>
37539</refentry>
37540
37541<refentry id="API-snd-pcm-playback-ready">
37542<refentryinfo>
37543 <title>LINUX</title>
37544 <productname>Kernel Hackers Manual</productname>
37545 <date>July 2017</date>
37546</refentryinfo>
37547<refmeta>
37548 <refentrytitle><phrase>snd_pcm_playback_ready</phrase></refentrytitle>
37549 <manvolnum>9</manvolnum>
37550 <refmiscinfo class="version">4.1.27</refmiscinfo>
37551</refmeta>
37552<refnamediv>
37553 <refname>snd_pcm_playback_ready</refname>
37554 <refpurpose>
37555     check whether the playback buffer is available
37556 </refpurpose>
37557</refnamediv>
37558<refsynopsisdiv>
37559 <title>Synopsis</title>
37560  <funcsynopsis><funcprototype>
37561   <funcdef>int <function>snd_pcm_playback_ready </function></funcdef>
37562   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37563  </funcprototype></funcsynopsis>
37564</refsynopsisdiv>
37565<refsect1>
37566 <title>Arguments</title>
37567 <variablelist>
37568  <varlistentry>
37569   <term><parameter>substream</parameter></term>
37570   <listitem>
37571    <para>
37572     the pcm substream instance
37573    </para>
37574   </listitem>
37575  </varlistentry>
37576 </variablelist>
37577</refsect1>
37578<refsect1>
37579<title>Description</title>
37580<para>
37581   Checks whether enough free space is available on the playback buffer.
37582</para>
37583</refsect1>
37584<refsect1>
37585<title>Return</title>
37586<para>
37587   Non-zero if available, or zero if not.
37588</para>
37589</refsect1>
37590</refentry>
37591
37592<refentry id="API-snd-pcm-capture-ready">
37593<refentryinfo>
37594 <title>LINUX</title>
37595 <productname>Kernel Hackers Manual</productname>
37596 <date>July 2017</date>
37597</refentryinfo>
37598<refmeta>
37599 <refentrytitle><phrase>snd_pcm_capture_ready</phrase></refentrytitle>
37600 <manvolnum>9</manvolnum>
37601 <refmiscinfo class="version">4.1.27</refmiscinfo>
37602</refmeta>
37603<refnamediv>
37604 <refname>snd_pcm_capture_ready</refname>
37605 <refpurpose>
37606     check whether the capture buffer is available
37607 </refpurpose>
37608</refnamediv>
37609<refsynopsisdiv>
37610 <title>Synopsis</title>
37611  <funcsynopsis><funcprototype>
37612   <funcdef>int <function>snd_pcm_capture_ready </function></funcdef>
37613   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37614  </funcprototype></funcsynopsis>
37615</refsynopsisdiv>
37616<refsect1>
37617 <title>Arguments</title>
37618 <variablelist>
37619  <varlistentry>
37620   <term><parameter>substream</parameter></term>
37621   <listitem>
37622    <para>
37623     the pcm substream instance
37624    </para>
37625   </listitem>
37626  </varlistentry>
37627 </variablelist>
37628</refsect1>
37629<refsect1>
37630<title>Description</title>
37631<para>
37632   Checks whether enough capture data is available on the capture buffer.
37633</para>
37634</refsect1>
37635<refsect1>
37636<title>Return</title>
37637<para>
37638   Non-zero if available, or zero if not.
37639</para>
37640</refsect1>
37641</refentry>
37642
37643<refentry id="API-snd-pcm-playback-data">
37644<refentryinfo>
37645 <title>LINUX</title>
37646 <productname>Kernel Hackers Manual</productname>
37647 <date>July 2017</date>
37648</refentryinfo>
37649<refmeta>
37650 <refentrytitle><phrase>snd_pcm_playback_data</phrase></refentrytitle>
37651 <manvolnum>9</manvolnum>
37652 <refmiscinfo class="version">4.1.27</refmiscinfo>
37653</refmeta>
37654<refnamediv>
37655 <refname>snd_pcm_playback_data</refname>
37656 <refpurpose>
37657     check whether any data exists on the playback buffer
37658 </refpurpose>
37659</refnamediv>
37660<refsynopsisdiv>
37661 <title>Synopsis</title>
37662  <funcsynopsis><funcprototype>
37663   <funcdef>int <function>snd_pcm_playback_data </function></funcdef>
37664   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37665  </funcprototype></funcsynopsis>
37666</refsynopsisdiv>
37667<refsect1>
37668 <title>Arguments</title>
37669 <variablelist>
37670  <varlistentry>
37671   <term><parameter>substream</parameter></term>
37672   <listitem>
37673    <para>
37674     the pcm substream instance
37675    </para>
37676   </listitem>
37677  </varlistentry>
37678 </variablelist>
37679</refsect1>
37680<refsect1>
37681<title>Description</title>
37682<para>
37683   Checks whether any data exists on the playback buffer.
37684</para>
37685</refsect1>
37686<refsect1>
37687<title>Return</title>
37688<para>
37689   Non-zero if any data exists, or zero if not. If stop_threshold
37690   is bigger or equal to boundary, then this function returns always non-zero.
37691</para>
37692</refsect1>
37693</refentry>
37694
37695<refentry id="API-snd-pcm-playback-empty">
37696<refentryinfo>
37697 <title>LINUX</title>
37698 <productname>Kernel Hackers Manual</productname>
37699 <date>July 2017</date>
37700</refentryinfo>
37701<refmeta>
37702 <refentrytitle><phrase>snd_pcm_playback_empty</phrase></refentrytitle>
37703 <manvolnum>9</manvolnum>
37704 <refmiscinfo class="version">4.1.27</refmiscinfo>
37705</refmeta>
37706<refnamediv>
37707 <refname>snd_pcm_playback_empty</refname>
37708 <refpurpose>
37709     check whether the playback buffer is empty
37710 </refpurpose>
37711</refnamediv>
37712<refsynopsisdiv>
37713 <title>Synopsis</title>
37714  <funcsynopsis><funcprototype>
37715   <funcdef>int <function>snd_pcm_playback_empty </function></funcdef>
37716   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37717  </funcprototype></funcsynopsis>
37718</refsynopsisdiv>
37719<refsect1>
37720 <title>Arguments</title>
37721 <variablelist>
37722  <varlistentry>
37723   <term><parameter>substream</parameter></term>
37724   <listitem>
37725    <para>
37726     the pcm substream instance
37727    </para>
37728   </listitem>
37729  </varlistentry>
37730 </variablelist>
37731</refsect1>
37732<refsect1>
37733<title>Description</title>
37734<para>
37735   Checks whether the playback buffer is empty.
37736</para>
37737</refsect1>
37738<refsect1>
37739<title>Return</title>
37740<para>
37741   Non-zero if empty, or zero if not.
37742</para>
37743</refsect1>
37744</refentry>
37745
37746<refentry id="API-snd-pcm-capture-empty">
37747<refentryinfo>
37748 <title>LINUX</title>
37749 <productname>Kernel Hackers Manual</productname>
37750 <date>July 2017</date>
37751</refentryinfo>
37752<refmeta>
37753 <refentrytitle><phrase>snd_pcm_capture_empty</phrase></refentrytitle>
37754 <manvolnum>9</manvolnum>
37755 <refmiscinfo class="version">4.1.27</refmiscinfo>
37756</refmeta>
37757<refnamediv>
37758 <refname>snd_pcm_capture_empty</refname>
37759 <refpurpose>
37760     check whether the capture buffer is empty
37761 </refpurpose>
37762</refnamediv>
37763<refsynopsisdiv>
37764 <title>Synopsis</title>
37765  <funcsynopsis><funcprototype>
37766   <funcdef>int <function>snd_pcm_capture_empty </function></funcdef>
37767   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37768  </funcprototype></funcsynopsis>
37769</refsynopsisdiv>
37770<refsect1>
37771 <title>Arguments</title>
37772 <variablelist>
37773  <varlistentry>
37774   <term><parameter>substream</parameter></term>
37775   <listitem>
37776    <para>
37777     the pcm substream instance
37778    </para>
37779   </listitem>
37780  </varlistentry>
37781 </variablelist>
37782</refsect1>
37783<refsect1>
37784<title>Description</title>
37785<para>
37786   Checks whether the capture buffer is empty.
37787</para>
37788</refsect1>
37789<refsect1>
37790<title>Return</title>
37791<para>
37792   Non-zero if empty, or zero if not.
37793</para>
37794</refsect1>
37795</refentry>
37796
37797<refentry id="API-snd-pcm-trigger-done">
37798<refentryinfo>
37799 <title>LINUX</title>
37800 <productname>Kernel Hackers Manual</productname>
37801 <date>July 2017</date>
37802</refentryinfo>
37803<refmeta>
37804 <refentrytitle><phrase>snd_pcm_trigger_done</phrase></refentrytitle>
37805 <manvolnum>9</manvolnum>
37806 <refmiscinfo class="version">4.1.27</refmiscinfo>
37807</refmeta>
37808<refnamediv>
37809 <refname>snd_pcm_trigger_done</refname>
37810 <refpurpose>
37811     Mark the master substream
37812 </refpurpose>
37813</refnamediv>
37814<refsynopsisdiv>
37815 <title>Synopsis</title>
37816  <funcsynopsis><funcprototype>
37817   <funcdef>void <function>snd_pcm_trigger_done </function></funcdef>
37818   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
37819   <paramdef>struct snd_pcm_substream * <parameter>master</parameter></paramdef>
37820  </funcprototype></funcsynopsis>
37821</refsynopsisdiv>
37822<refsect1>
37823 <title>Arguments</title>
37824 <variablelist>
37825  <varlistentry>
37826   <term><parameter>substream</parameter></term>
37827   <listitem>
37828    <para>
37829     the pcm substream instance
37830    </para>
37831   </listitem>
37832  </varlistentry>
37833  <varlistentry>
37834   <term><parameter>master</parameter></term>
37835   <listitem>
37836    <para>
37837     the linked master substream
37838    </para>
37839   </listitem>
37840  </varlistentry>
37841 </variablelist>
37842</refsect1>
37843<refsect1>
37844<title>Description</title>
37845<para>
37846   When multiple substreams of the same card are linked and the hardware
37847   supports the single-shot operation, the driver calls this in the loop
37848   in <function>snd_pcm_group_for_each_entry</function> for marking the substream as <quote>done</quote>.
37849   Then most of trigger operations are performed only to the given master
37850   substream.
37851   </para><para>
37852
37853   The trigger_master mark is cleared at timestamp updates at the end
37854   of trigger operations.
37855</para>
37856</refsect1>
37857</refentry>
37858
37859<refentry id="API-params-channels">
37860<refentryinfo>
37861 <title>LINUX</title>
37862 <productname>Kernel Hackers Manual</productname>
37863 <date>July 2017</date>
37864</refentryinfo>
37865<refmeta>
37866 <refentrytitle><phrase>params_channels</phrase></refentrytitle>
37867 <manvolnum>9</manvolnum>
37868 <refmiscinfo class="version">4.1.27</refmiscinfo>
37869</refmeta>
37870<refnamediv>
37871 <refname>params_channels</refname>
37872 <refpurpose>
37873     Get the number of channels from the hw params
37874 </refpurpose>
37875</refnamediv>
37876<refsynopsisdiv>
37877 <title>Synopsis</title>
37878  <funcsynopsis><funcprototype>
37879   <funcdef>unsigned int <function>params_channels </function></funcdef>
37880   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
37881  </funcprototype></funcsynopsis>
37882</refsynopsisdiv>
37883<refsect1>
37884 <title>Arguments</title>
37885 <variablelist>
37886  <varlistentry>
37887   <term><parameter>p</parameter></term>
37888   <listitem>
37889    <para>
37890     hw params
37891    </para>
37892   </listitem>
37893  </varlistentry>
37894 </variablelist>
37895</refsect1>
37896</refentry>
37897
37898<refentry id="API-params-rate">
37899<refentryinfo>
37900 <title>LINUX</title>
37901 <productname>Kernel Hackers Manual</productname>
37902 <date>July 2017</date>
37903</refentryinfo>
37904<refmeta>
37905 <refentrytitle><phrase>params_rate</phrase></refentrytitle>
37906 <manvolnum>9</manvolnum>
37907 <refmiscinfo class="version">4.1.27</refmiscinfo>
37908</refmeta>
37909<refnamediv>
37910 <refname>params_rate</refname>
37911 <refpurpose>
37912     Get the sample rate from the hw params
37913 </refpurpose>
37914</refnamediv>
37915<refsynopsisdiv>
37916 <title>Synopsis</title>
37917  <funcsynopsis><funcprototype>
37918   <funcdef>unsigned int <function>params_rate </function></funcdef>
37919   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
37920  </funcprototype></funcsynopsis>
37921</refsynopsisdiv>
37922<refsect1>
37923 <title>Arguments</title>
37924 <variablelist>
37925  <varlistentry>
37926   <term><parameter>p</parameter></term>
37927   <listitem>
37928    <para>
37929     hw params
37930    </para>
37931   </listitem>
37932  </varlistentry>
37933 </variablelist>
37934</refsect1>
37935</refentry>
37936
37937<refentry id="API-params-period-size">
37938<refentryinfo>
37939 <title>LINUX</title>
37940 <productname>Kernel Hackers Manual</productname>
37941 <date>July 2017</date>
37942</refentryinfo>
37943<refmeta>
37944 <refentrytitle><phrase>params_period_size</phrase></refentrytitle>
37945 <manvolnum>9</manvolnum>
37946 <refmiscinfo class="version">4.1.27</refmiscinfo>
37947</refmeta>
37948<refnamediv>
37949 <refname>params_period_size</refname>
37950 <refpurpose>
37951     Get the period size (in frames) from the hw params
37952 </refpurpose>
37953</refnamediv>
37954<refsynopsisdiv>
37955 <title>Synopsis</title>
37956  <funcsynopsis><funcprototype>
37957   <funcdef>unsigned int <function>params_period_size </function></funcdef>
37958   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
37959  </funcprototype></funcsynopsis>
37960</refsynopsisdiv>
37961<refsect1>
37962 <title>Arguments</title>
37963 <variablelist>
37964  <varlistentry>
37965   <term><parameter>p</parameter></term>
37966   <listitem>
37967    <para>
37968     hw params
37969    </para>
37970   </listitem>
37971  </varlistentry>
37972 </variablelist>
37973</refsect1>
37974</refentry>
37975
37976<refentry id="API-params-periods">
37977<refentryinfo>
37978 <title>LINUX</title>
37979 <productname>Kernel Hackers Manual</productname>
37980 <date>July 2017</date>
37981</refentryinfo>
37982<refmeta>
37983 <refentrytitle><phrase>params_periods</phrase></refentrytitle>
37984 <manvolnum>9</manvolnum>
37985 <refmiscinfo class="version">4.1.27</refmiscinfo>
37986</refmeta>
37987<refnamediv>
37988 <refname>params_periods</refname>
37989 <refpurpose>
37990     Get the number of periods from the hw params
37991 </refpurpose>
37992</refnamediv>
37993<refsynopsisdiv>
37994 <title>Synopsis</title>
37995  <funcsynopsis><funcprototype>
37996   <funcdef>unsigned int <function>params_periods </function></funcdef>
37997   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
37998  </funcprototype></funcsynopsis>
37999</refsynopsisdiv>
38000<refsect1>
38001 <title>Arguments</title>
38002 <variablelist>
38003  <varlistentry>
38004   <term><parameter>p</parameter></term>
38005   <listitem>
38006    <para>
38007     hw params
38008    </para>
38009   </listitem>
38010  </varlistentry>
38011 </variablelist>
38012</refsect1>
38013</refentry>
38014
38015<refentry id="API-params-buffer-size">
38016<refentryinfo>
38017 <title>LINUX</title>
38018 <productname>Kernel Hackers Manual</productname>
38019 <date>July 2017</date>
38020</refentryinfo>
38021<refmeta>
38022 <refentrytitle><phrase>params_buffer_size</phrase></refentrytitle>
38023 <manvolnum>9</manvolnum>
38024 <refmiscinfo class="version">4.1.27</refmiscinfo>
38025</refmeta>
38026<refnamediv>
38027 <refname>params_buffer_size</refname>
38028 <refpurpose>
38029     Get the buffer size (in frames) from the hw params
38030 </refpurpose>
38031</refnamediv>
38032<refsynopsisdiv>
38033 <title>Synopsis</title>
38034  <funcsynopsis><funcprototype>
38035   <funcdef>unsigned int <function>params_buffer_size </function></funcdef>
38036   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
38037  </funcprototype></funcsynopsis>
38038</refsynopsisdiv>
38039<refsect1>
38040 <title>Arguments</title>
38041 <variablelist>
38042  <varlistentry>
38043   <term><parameter>p</parameter></term>
38044   <listitem>
38045    <para>
38046     hw params
38047    </para>
38048   </listitem>
38049  </varlistentry>
38050 </variablelist>
38051</refsect1>
38052</refentry>
38053
38054<refentry id="API-params-buffer-bytes">
38055<refentryinfo>
38056 <title>LINUX</title>
38057 <productname>Kernel Hackers Manual</productname>
38058 <date>July 2017</date>
38059</refentryinfo>
38060<refmeta>
38061 <refentrytitle><phrase>params_buffer_bytes</phrase></refentrytitle>
38062 <manvolnum>9</manvolnum>
38063 <refmiscinfo class="version">4.1.27</refmiscinfo>
38064</refmeta>
38065<refnamediv>
38066 <refname>params_buffer_bytes</refname>
38067 <refpurpose>
38068     Get the buffer size (in bytes) from the hw params
38069 </refpurpose>
38070</refnamediv>
38071<refsynopsisdiv>
38072 <title>Synopsis</title>
38073  <funcsynopsis><funcprototype>
38074   <funcdef>unsigned int <function>params_buffer_bytes </function></funcdef>
38075   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
38076  </funcprototype></funcsynopsis>
38077</refsynopsisdiv>
38078<refsect1>
38079 <title>Arguments</title>
38080 <variablelist>
38081  <varlistentry>
38082   <term><parameter>p</parameter></term>
38083   <listitem>
38084    <para>
38085     hw params
38086    </para>
38087   </listitem>
38088  </varlistentry>
38089 </variablelist>
38090</refsect1>
38091</refentry>
38092
38093<refentry id="API-snd-pcm-format-cpu-endian">
38094<refentryinfo>
38095 <title>LINUX</title>
38096 <productname>Kernel Hackers Manual</productname>
38097 <date>July 2017</date>
38098</refentryinfo>
38099<refmeta>
38100 <refentrytitle><phrase>snd_pcm_format_cpu_endian</phrase></refentrytitle>
38101 <manvolnum>9</manvolnum>
38102 <refmiscinfo class="version">4.1.27</refmiscinfo>
38103</refmeta>
38104<refnamediv>
38105 <refname>snd_pcm_format_cpu_endian</refname>
38106 <refpurpose>
38107     Check the PCM format is CPU-endian
38108 </refpurpose>
38109</refnamediv>
38110<refsynopsisdiv>
38111 <title>Synopsis</title>
38112  <funcsynopsis><funcprototype>
38113   <funcdef>int <function>snd_pcm_format_cpu_endian </function></funcdef>
38114   <paramdef>snd_pcm_format_t <parameter>format</parameter></paramdef>
38115  </funcprototype></funcsynopsis>
38116</refsynopsisdiv>
38117<refsect1>
38118 <title>Arguments</title>
38119 <variablelist>
38120  <varlistentry>
38121   <term><parameter>format</parameter></term>
38122   <listitem>
38123    <para>
38124     the format to check
38125    </para>
38126   </listitem>
38127  </varlistentry>
38128 </variablelist>
38129</refsect1>
38130<refsect1>
38131<title>Return</title>
38132<para>
38133   1 if the given PCM format is CPU-endian, 0 if
38134   opposite, or a negative error code if endian not specified.
38135</para>
38136</refsect1>
38137</refentry>
38138
38139<refentry id="API-snd-pcm-set-runtime-buffer">
38140<refentryinfo>
38141 <title>LINUX</title>
38142 <productname>Kernel Hackers Manual</productname>
38143 <date>July 2017</date>
38144</refentryinfo>
38145<refmeta>
38146 <refentrytitle><phrase>snd_pcm_set_runtime_buffer</phrase></refentrytitle>
38147 <manvolnum>9</manvolnum>
38148 <refmiscinfo class="version">4.1.27</refmiscinfo>
38149</refmeta>
38150<refnamediv>
38151 <refname>snd_pcm_set_runtime_buffer</refname>
38152 <refpurpose>
38153     Set the PCM runtime buffer
38154 </refpurpose>
38155</refnamediv>
38156<refsynopsisdiv>
38157 <title>Synopsis</title>
38158  <funcsynopsis><funcprototype>
38159   <funcdef>void <function>snd_pcm_set_runtime_buffer </function></funcdef>
38160   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38161   <paramdef>struct snd_dma_buffer * <parameter>bufp</parameter></paramdef>
38162  </funcprototype></funcsynopsis>
38163</refsynopsisdiv>
38164<refsect1>
38165 <title>Arguments</title>
38166 <variablelist>
38167  <varlistentry>
38168   <term><parameter>substream</parameter></term>
38169   <listitem>
38170    <para>
38171     PCM substream to set
38172    </para>
38173   </listitem>
38174  </varlistentry>
38175  <varlistentry>
38176   <term><parameter>bufp</parameter></term>
38177   <listitem>
38178    <para>
38179     the buffer information, NULL to clear
38180    </para>
38181   </listitem>
38182  </varlistentry>
38183 </variablelist>
38184</refsect1>
38185<refsect1>
38186<title>Description</title>
38187<para>
38188   Copy the buffer information to runtime-&gt;dma_buffer when <parameter>bufp</parameter> is non-NULL.
38189   Otherwise it clears the current buffer information.
38190</para>
38191</refsect1>
38192</refentry>
38193
38194<refentry id="API-snd-pcm-gettime">
38195<refentryinfo>
38196 <title>LINUX</title>
38197 <productname>Kernel Hackers Manual</productname>
38198 <date>July 2017</date>
38199</refentryinfo>
38200<refmeta>
38201 <refentrytitle><phrase>snd_pcm_gettime</phrase></refentrytitle>
38202 <manvolnum>9</manvolnum>
38203 <refmiscinfo class="version">4.1.27</refmiscinfo>
38204</refmeta>
38205<refnamediv>
38206 <refname>snd_pcm_gettime</refname>
38207 <refpurpose>
38208     Fill the timespec depending on the timestamp mode
38209 </refpurpose>
38210</refnamediv>
38211<refsynopsisdiv>
38212 <title>Synopsis</title>
38213  <funcsynopsis><funcprototype>
38214   <funcdef>void <function>snd_pcm_gettime </function></funcdef>
38215   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38216   <paramdef>struct timespec * <parameter>tv</parameter></paramdef>
38217  </funcprototype></funcsynopsis>
38218</refsynopsisdiv>
38219<refsect1>
38220 <title>Arguments</title>
38221 <variablelist>
38222  <varlistentry>
38223   <term><parameter>runtime</parameter></term>
38224   <listitem>
38225    <para>
38226     PCM runtime instance
38227    </para>
38228   </listitem>
38229  </varlistentry>
38230  <varlistentry>
38231   <term><parameter>tv</parameter></term>
38232   <listitem>
38233    <para>
38234     timespec to fill
38235    </para>
38236   </listitem>
38237  </varlistentry>
38238 </variablelist>
38239</refsect1>
38240</refentry>
38241
38242<refentry id="API-snd-pcm-lib-alloc-vmalloc-buffer">
38243<refentryinfo>
38244 <title>LINUX</title>
38245 <productname>Kernel Hackers Manual</productname>
38246 <date>July 2017</date>
38247</refentryinfo>
38248<refmeta>
38249 <refentrytitle><phrase>snd_pcm_lib_alloc_vmalloc_buffer</phrase></refentrytitle>
38250 <manvolnum>9</manvolnum>
38251 <refmiscinfo class="version">4.1.27</refmiscinfo>
38252</refmeta>
38253<refnamediv>
38254 <refname>snd_pcm_lib_alloc_vmalloc_buffer</refname>
38255 <refpurpose>
38256     allocate virtual DMA buffer
38257 </refpurpose>
38258</refnamediv>
38259<refsynopsisdiv>
38260 <title>Synopsis</title>
38261  <funcsynopsis><funcprototype>
38262   <funcdef>int <function>snd_pcm_lib_alloc_vmalloc_buffer </function></funcdef>
38263   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38264   <paramdef>size_t <parameter>size</parameter></paramdef>
38265  </funcprototype></funcsynopsis>
38266</refsynopsisdiv>
38267<refsect1>
38268 <title>Arguments</title>
38269 <variablelist>
38270  <varlistentry>
38271   <term><parameter>substream</parameter></term>
38272   <listitem>
38273    <para>
38274     the substream to allocate the buffer to
38275    </para>
38276   </listitem>
38277  </varlistentry>
38278  <varlistentry>
38279   <term><parameter>size</parameter></term>
38280   <listitem>
38281    <para>
38282     the requested buffer size, in bytes
38283    </para>
38284   </listitem>
38285  </varlistentry>
38286 </variablelist>
38287</refsect1>
38288<refsect1>
38289<title>Description</title>
38290<para>
38291   Allocates the PCM substream buffer using <function>vmalloc</function>, i.e., the memory is
38292   contiguous in kernel virtual space, but not in physical memory.  Use this
38293   if the buffer is accessed by kernel code but not by device DMA.
38294</para>
38295</refsect1>
38296<refsect1>
38297<title>Return</title>
38298<para>
38299   1 if the buffer was changed, 0 if not changed, or a negative error
38300   code.
38301</para>
38302</refsect1>
38303</refentry>
38304
38305<refentry id="API-snd-pcm-lib-alloc-vmalloc-32-buffer">
38306<refentryinfo>
38307 <title>LINUX</title>
38308 <productname>Kernel Hackers Manual</productname>
38309 <date>July 2017</date>
38310</refentryinfo>
38311<refmeta>
38312 <refentrytitle><phrase>snd_pcm_lib_alloc_vmalloc_32_buffer</phrase></refentrytitle>
38313 <manvolnum>9</manvolnum>
38314 <refmiscinfo class="version">4.1.27</refmiscinfo>
38315</refmeta>
38316<refnamediv>
38317 <refname>snd_pcm_lib_alloc_vmalloc_32_buffer</refname>
38318 <refpurpose>
38319     allocate 32-bit-addressable buffer
38320 </refpurpose>
38321</refnamediv>
38322<refsynopsisdiv>
38323 <title>Synopsis</title>
38324  <funcsynopsis><funcprototype>
38325   <funcdef>int <function>snd_pcm_lib_alloc_vmalloc_32_buffer </function></funcdef>
38326   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38327   <paramdef>size_t <parameter>size</parameter></paramdef>
38328  </funcprototype></funcsynopsis>
38329</refsynopsisdiv>
38330<refsect1>
38331 <title>Arguments</title>
38332 <variablelist>
38333  <varlistentry>
38334   <term><parameter>substream</parameter></term>
38335   <listitem>
38336    <para>
38337     the substream to allocate the buffer to
38338    </para>
38339   </listitem>
38340  </varlistentry>
38341  <varlistentry>
38342   <term><parameter>size</parameter></term>
38343   <listitem>
38344    <para>
38345     the requested buffer size, in bytes
38346    </para>
38347   </listitem>
38348  </varlistentry>
38349 </variablelist>
38350</refsect1>
38351<refsect1>
38352<title>Description</title>
38353<para>
38354   This function works like <function>snd_pcm_lib_alloc_vmalloc_buffer</function>, but uses
38355   <function>vmalloc_32</function>, i.e., the pages are allocated from 32-bit-addressable memory.
38356</para>
38357</refsect1>
38358<refsect1>
38359<title>Return</title>
38360<para>
38361   1 if the buffer was changed, 0 if not changed, or a negative error
38362   code.
38363</para>
38364</refsect1>
38365</refentry>
38366
38367<refentry id="API-snd-pcm-sgbuf-get-addr">
38368<refentryinfo>
38369 <title>LINUX</title>
38370 <productname>Kernel Hackers Manual</productname>
38371 <date>July 2017</date>
38372</refentryinfo>
38373<refmeta>
38374 <refentrytitle><phrase>snd_pcm_sgbuf_get_addr</phrase></refentrytitle>
38375 <manvolnum>9</manvolnum>
38376 <refmiscinfo class="version">4.1.27</refmiscinfo>
38377</refmeta>
38378<refnamediv>
38379 <refname>snd_pcm_sgbuf_get_addr</refname>
38380 <refpurpose>
38381     Get the DMA address at the corresponding offset
38382 </refpurpose>
38383</refnamediv>
38384<refsynopsisdiv>
38385 <title>Synopsis</title>
38386  <funcsynopsis><funcprototype>
38387   <funcdef>dma_addr_t <function>snd_pcm_sgbuf_get_addr </function></funcdef>
38388   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38389   <paramdef>unsigned int <parameter>ofs</parameter></paramdef>
38390  </funcprototype></funcsynopsis>
38391</refsynopsisdiv>
38392<refsect1>
38393 <title>Arguments</title>
38394 <variablelist>
38395  <varlistentry>
38396   <term><parameter>substream</parameter></term>
38397   <listitem>
38398    <para>
38399     PCM substream
38400    </para>
38401   </listitem>
38402  </varlistentry>
38403  <varlistentry>
38404   <term><parameter>ofs</parameter></term>
38405   <listitem>
38406    <para>
38407     byte offset
38408    </para>
38409   </listitem>
38410  </varlistentry>
38411 </variablelist>
38412</refsect1>
38413</refentry>
38414
38415<refentry id="API-snd-pcm-sgbuf-get-ptr">
38416<refentryinfo>
38417 <title>LINUX</title>
38418 <productname>Kernel Hackers Manual</productname>
38419 <date>July 2017</date>
38420</refentryinfo>
38421<refmeta>
38422 <refentrytitle><phrase>snd_pcm_sgbuf_get_ptr</phrase></refentrytitle>
38423 <manvolnum>9</manvolnum>
38424 <refmiscinfo class="version">4.1.27</refmiscinfo>
38425</refmeta>
38426<refnamediv>
38427 <refname>snd_pcm_sgbuf_get_ptr</refname>
38428 <refpurpose>
38429     Get the virtual address at the corresponding offset
38430 </refpurpose>
38431</refnamediv>
38432<refsynopsisdiv>
38433 <title>Synopsis</title>
38434  <funcsynopsis><funcprototype>
38435   <funcdef>void * <function>snd_pcm_sgbuf_get_ptr </function></funcdef>
38436   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38437   <paramdef>unsigned int <parameter>ofs</parameter></paramdef>
38438  </funcprototype></funcsynopsis>
38439</refsynopsisdiv>
38440<refsect1>
38441 <title>Arguments</title>
38442 <variablelist>
38443  <varlistentry>
38444   <term><parameter>substream</parameter></term>
38445   <listitem>
38446    <para>
38447     PCM substream
38448    </para>
38449   </listitem>
38450  </varlistentry>
38451  <varlistentry>
38452   <term><parameter>ofs</parameter></term>
38453   <listitem>
38454    <para>
38455     byte offset
38456    </para>
38457   </listitem>
38458  </varlistentry>
38459 </variablelist>
38460</refsect1>
38461</refentry>
38462
38463<refentry id="API-snd-pcm-sgbuf-get-chunk-size">
38464<refentryinfo>
38465 <title>LINUX</title>
38466 <productname>Kernel Hackers Manual</productname>
38467 <date>July 2017</date>
38468</refentryinfo>
38469<refmeta>
38470 <refentrytitle><phrase>snd_pcm_sgbuf_get_chunk_size</phrase></refentrytitle>
38471 <manvolnum>9</manvolnum>
38472 <refmiscinfo class="version">4.1.27</refmiscinfo>
38473</refmeta>
38474<refnamediv>
38475 <refname>snd_pcm_sgbuf_get_chunk_size</refname>
38476 <refpurpose>
38477     Compute the max size that fits within the contig. page from the given size
38478 </refpurpose>
38479</refnamediv>
38480<refsynopsisdiv>
38481 <title>Synopsis</title>
38482  <funcsynopsis><funcprototype>
38483   <funcdef>unsigned int <function>snd_pcm_sgbuf_get_chunk_size </function></funcdef>
38484   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38485   <paramdef>unsigned int <parameter>ofs</parameter></paramdef>
38486   <paramdef>unsigned int <parameter>size</parameter></paramdef>
38487  </funcprototype></funcsynopsis>
38488</refsynopsisdiv>
38489<refsect1>
38490 <title>Arguments</title>
38491 <variablelist>
38492  <varlistentry>
38493   <term><parameter>substream</parameter></term>
38494   <listitem>
38495    <para>
38496     PCM substream
38497    </para>
38498   </listitem>
38499  </varlistentry>
38500  <varlistentry>
38501   <term><parameter>ofs</parameter></term>
38502   <listitem>
38503    <para>
38504     byte offset
38505    </para>
38506   </listitem>
38507  </varlistentry>
38508  <varlistentry>
38509   <term><parameter>size</parameter></term>
38510   <listitem>
38511    <para>
38512     byte size to examine
38513    </para>
38514   </listitem>
38515  </varlistentry>
38516 </variablelist>
38517</refsect1>
38518</refentry>
38519
38520<refentry id="API-snd-pcm-mmap-data-open">
38521<refentryinfo>
38522 <title>LINUX</title>
38523 <productname>Kernel Hackers Manual</productname>
38524 <date>July 2017</date>
38525</refentryinfo>
38526<refmeta>
38527 <refentrytitle><phrase>snd_pcm_mmap_data_open</phrase></refentrytitle>
38528 <manvolnum>9</manvolnum>
38529 <refmiscinfo class="version">4.1.27</refmiscinfo>
38530</refmeta>
38531<refnamediv>
38532 <refname>snd_pcm_mmap_data_open</refname>
38533 <refpurpose>
38534     increase the mmap counter
38535 </refpurpose>
38536</refnamediv>
38537<refsynopsisdiv>
38538 <title>Synopsis</title>
38539  <funcsynopsis><funcprototype>
38540   <funcdef>void <function>snd_pcm_mmap_data_open </function></funcdef>
38541   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
38542  </funcprototype></funcsynopsis>
38543</refsynopsisdiv>
38544<refsect1>
38545 <title>Arguments</title>
38546 <variablelist>
38547  <varlistentry>
38548   <term><parameter>area</parameter></term>
38549   <listitem>
38550    <para>
38551     VMA
38552    </para>
38553   </listitem>
38554  </varlistentry>
38555 </variablelist>
38556</refsect1>
38557<refsect1>
38558<title>Description</title>
38559<para>
38560   PCM mmap callback should handle this counter properly
38561</para>
38562</refsect1>
38563</refentry>
38564
38565<refentry id="API-snd-pcm-mmap-data-close">
38566<refentryinfo>
38567 <title>LINUX</title>
38568 <productname>Kernel Hackers Manual</productname>
38569 <date>July 2017</date>
38570</refentryinfo>
38571<refmeta>
38572 <refentrytitle><phrase>snd_pcm_mmap_data_close</phrase></refentrytitle>
38573 <manvolnum>9</manvolnum>
38574 <refmiscinfo class="version">4.1.27</refmiscinfo>
38575</refmeta>
38576<refnamediv>
38577 <refname>snd_pcm_mmap_data_close</refname>
38578 <refpurpose>
38579     decrease the mmap counter
38580 </refpurpose>
38581</refnamediv>
38582<refsynopsisdiv>
38583 <title>Synopsis</title>
38584  <funcsynopsis><funcprototype>
38585   <funcdef>void <function>snd_pcm_mmap_data_close </function></funcdef>
38586   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
38587  </funcprototype></funcsynopsis>
38588</refsynopsisdiv>
38589<refsect1>
38590 <title>Arguments</title>
38591 <variablelist>
38592  <varlistentry>
38593   <term><parameter>area</parameter></term>
38594   <listitem>
38595    <para>
38596     VMA
38597    </para>
38598   </listitem>
38599  </varlistentry>
38600 </variablelist>
38601</refsect1>
38602<refsect1>
38603<title>Description</title>
38604<para>
38605   PCM mmap callback should handle this counter properly
38606</para>
38607</refsect1>
38608</refentry>
38609
38610<refentry id="API-snd-pcm-limit-isa-dma-size">
38611<refentryinfo>
38612 <title>LINUX</title>
38613 <productname>Kernel Hackers Manual</productname>
38614 <date>July 2017</date>
38615</refentryinfo>
38616<refmeta>
38617 <refentrytitle><phrase>snd_pcm_limit_isa_dma_size</phrase></refentrytitle>
38618 <manvolnum>9</manvolnum>
38619 <refmiscinfo class="version">4.1.27</refmiscinfo>
38620</refmeta>
38621<refnamediv>
38622 <refname>snd_pcm_limit_isa_dma_size</refname>
38623 <refpurpose>
38624     Get the max size fitting with ISA DMA transfer
38625 </refpurpose>
38626</refnamediv>
38627<refsynopsisdiv>
38628 <title>Synopsis</title>
38629  <funcsynopsis><funcprototype>
38630   <funcdef>void <function>snd_pcm_limit_isa_dma_size </function></funcdef>
38631   <paramdef>int <parameter>dma</parameter></paramdef>
38632   <paramdef>size_t * <parameter>max</parameter></paramdef>
38633  </funcprototype></funcsynopsis>
38634</refsynopsisdiv>
38635<refsect1>
38636 <title>Arguments</title>
38637 <variablelist>
38638  <varlistentry>
38639   <term><parameter>dma</parameter></term>
38640   <listitem>
38641    <para>
38642     DMA number
38643    </para>
38644   </listitem>
38645  </varlistentry>
38646  <varlistentry>
38647   <term><parameter>max</parameter></term>
38648   <listitem>
38649    <para>
38650     pointer to store the max size
38651    </para>
38652   </listitem>
38653  </varlistentry>
38654 </variablelist>
38655</refsect1>
38656</refentry>
38657
38658<refentry id="API-snd-pcm-stream-str">
38659<refentryinfo>
38660 <title>LINUX</title>
38661 <productname>Kernel Hackers Manual</productname>
38662 <date>July 2017</date>
38663</refentryinfo>
38664<refmeta>
38665 <refentrytitle><phrase>snd_pcm_stream_str</phrase></refentrytitle>
38666 <manvolnum>9</manvolnum>
38667 <refmiscinfo class="version">4.1.27</refmiscinfo>
38668</refmeta>
38669<refnamediv>
38670 <refname>snd_pcm_stream_str</refname>
38671 <refpurpose>
38672     Get a string naming the direction of a stream
38673 </refpurpose>
38674</refnamediv>
38675<refsynopsisdiv>
38676 <title>Synopsis</title>
38677  <funcsynopsis><funcprototype>
38678   <funcdef>const char * <function>snd_pcm_stream_str </function></funcdef>
38679   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38680  </funcprototype></funcsynopsis>
38681</refsynopsisdiv>
38682<refsect1>
38683 <title>Arguments</title>
38684 <variablelist>
38685  <varlistentry>
38686   <term><parameter>substream</parameter></term>
38687   <listitem>
38688    <para>
38689     the pcm substream instance
38690    </para>
38691   </listitem>
38692  </varlistentry>
38693 </variablelist>
38694</refsect1>
38695<refsect1>
38696<title>Return</title>
38697<para>
38698   A string naming the direction of the stream.
38699</para>
38700</refsect1>
38701</refentry>
38702
38703<refentry id="API-snd-pcm-chmap-substream">
38704<refentryinfo>
38705 <title>LINUX</title>
38706 <productname>Kernel Hackers Manual</productname>
38707 <date>July 2017</date>
38708</refentryinfo>
38709<refmeta>
38710 <refentrytitle><phrase>snd_pcm_chmap_substream</phrase></refentrytitle>
38711 <manvolnum>9</manvolnum>
38712 <refmiscinfo class="version">4.1.27</refmiscinfo>
38713</refmeta>
38714<refnamediv>
38715 <refname>snd_pcm_chmap_substream</refname>
38716 <refpurpose>
38717     get the PCM substream assigned to the given chmap info
38718 </refpurpose>
38719</refnamediv>
38720<refsynopsisdiv>
38721 <title>Synopsis</title>
38722  <funcsynopsis><funcprototype>
38723   <funcdef>struct snd_pcm_substream * <function>snd_pcm_chmap_substream </function></funcdef>
38724   <paramdef>struct snd_pcm_chmap * <parameter>info</parameter></paramdef>
38725   <paramdef>unsigned int <parameter>idx</parameter></paramdef>
38726  </funcprototype></funcsynopsis>
38727</refsynopsisdiv>
38728<refsect1>
38729 <title>Arguments</title>
38730 <variablelist>
38731  <varlistentry>
38732   <term><parameter>info</parameter></term>
38733   <listitem>
38734    <para>
38735     chmap information
38736    </para>
38737   </listitem>
38738  </varlistentry>
38739  <varlistentry>
38740   <term><parameter>idx</parameter></term>
38741   <listitem>
38742    <para>
38743     the substream number index
38744    </para>
38745   </listitem>
38746  </varlistentry>
38747 </variablelist>
38748</refsect1>
38749</refentry>
38750
38751<refentry id="API-pcm-format-to-bits">
38752<refentryinfo>
38753 <title>LINUX</title>
38754 <productname>Kernel Hackers Manual</productname>
38755 <date>July 2017</date>
38756</refentryinfo>
38757<refmeta>
38758 <refentrytitle><phrase>pcm_format_to_bits</phrase></refentrytitle>
38759 <manvolnum>9</manvolnum>
38760 <refmiscinfo class="version">4.1.27</refmiscinfo>
38761</refmeta>
38762<refnamediv>
38763 <refname>pcm_format_to_bits</refname>
38764 <refpurpose>
38765     Strong-typed conversion of pcm_format to bitwise
38766 </refpurpose>
38767</refnamediv>
38768<refsynopsisdiv>
38769 <title>Synopsis</title>
38770  <funcsynopsis><funcprototype>
38771   <funcdef>u64 <function>pcm_format_to_bits </function></funcdef>
38772   <paramdef>snd_pcm_format_t <parameter>pcm_format</parameter></paramdef>
38773  </funcprototype></funcsynopsis>
38774</refsynopsisdiv>
38775<refsect1>
38776 <title>Arguments</title>
38777 <variablelist>
38778  <varlistentry>
38779   <term><parameter>pcm_format</parameter></term>
38780   <listitem>
38781    <para>
38782     PCM format
38783    </para>
38784   </listitem>
38785  </varlistentry>
38786 </variablelist>
38787</refsect1>
38788</refentry>
38789
38790<!-- sound/core/pcm.c -->
38791<refentry id="API-snd-pcm-format-name">
38792<refentryinfo>
38793 <title>LINUX</title>
38794 <productname>Kernel Hackers Manual</productname>
38795 <date>July 2017</date>
38796</refentryinfo>
38797<refmeta>
38798 <refentrytitle><phrase>snd_pcm_format_name</phrase></refentrytitle>
38799 <manvolnum>9</manvolnum>
38800 <refmiscinfo class="version">4.1.27</refmiscinfo>
38801</refmeta>
38802<refnamediv>
38803 <refname>snd_pcm_format_name</refname>
38804 <refpurpose>
38805  Return a name string for the given PCM format
38806 </refpurpose>
38807</refnamediv>
38808<refsynopsisdiv>
38809 <title>Synopsis</title>
38810  <funcsynopsis><funcprototype>
38811   <funcdef>const char * <function>snd_pcm_format_name </function></funcdef>
38812   <paramdef>snd_pcm_format_t <parameter>format</parameter></paramdef>
38813  </funcprototype></funcsynopsis>
38814</refsynopsisdiv>
38815<refsect1>
38816 <title>Arguments</title>
38817 <variablelist>
38818  <varlistentry>
38819   <term><parameter>format</parameter></term>
38820   <listitem>
38821    <para>
38822     PCM format
38823    </para>
38824   </listitem>
38825  </varlistentry>
38826 </variablelist>
38827</refsect1>
38828</refentry>
38829
38830<refentry id="API-snd-pcm-new-stream">
38831<refentryinfo>
38832 <title>LINUX</title>
38833 <productname>Kernel Hackers Manual</productname>
38834 <date>July 2017</date>
38835</refentryinfo>
38836<refmeta>
38837 <refentrytitle><phrase>snd_pcm_new_stream</phrase></refentrytitle>
38838 <manvolnum>9</manvolnum>
38839 <refmiscinfo class="version">4.1.27</refmiscinfo>
38840</refmeta>
38841<refnamediv>
38842 <refname>snd_pcm_new_stream</refname>
38843 <refpurpose>
38844     create a new PCM stream
38845 </refpurpose>
38846</refnamediv>
38847<refsynopsisdiv>
38848 <title>Synopsis</title>
38849  <funcsynopsis><funcprototype>
38850   <funcdef>int <function>snd_pcm_new_stream </function></funcdef>
38851   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
38852   <paramdef>int <parameter>stream</parameter></paramdef>
38853   <paramdef>int <parameter>substream_count</parameter></paramdef>
38854  </funcprototype></funcsynopsis>
38855</refsynopsisdiv>
38856<refsect1>
38857 <title>Arguments</title>
38858 <variablelist>
38859  <varlistentry>
38860   <term><parameter>pcm</parameter></term>
38861   <listitem>
38862    <para>
38863     the pcm instance
38864    </para>
38865   </listitem>
38866  </varlistentry>
38867  <varlistentry>
38868   <term><parameter>stream</parameter></term>
38869   <listitem>
38870    <para>
38871     the stream direction, SNDRV_PCM_STREAM_XXX
38872    </para>
38873   </listitem>
38874  </varlistentry>
38875  <varlistentry>
38876   <term><parameter>substream_count</parameter></term>
38877   <listitem>
38878    <para>
38879     the number of substreams
38880    </para>
38881   </listitem>
38882  </varlistentry>
38883 </variablelist>
38884</refsect1>
38885<refsect1>
38886<title>Description</title>
38887<para>
38888   Creates a new stream for the pcm.
38889   The corresponding stream on the pcm must have been empty before
38890   calling this, i.e. zero must be given to the argument of
38891   <function>snd_pcm_new</function>.
38892</para>
38893</refsect1>
38894<refsect1>
38895<title>Return</title>
38896<para>
38897   Zero if successful, or a negative error code on failure.
38898</para>
38899</refsect1>
38900</refentry>
38901
38902<refentry id="API-snd-pcm-new">
38903<refentryinfo>
38904 <title>LINUX</title>
38905 <productname>Kernel Hackers Manual</productname>
38906 <date>July 2017</date>
38907</refentryinfo>
38908<refmeta>
38909 <refentrytitle><phrase>snd_pcm_new</phrase></refentrytitle>
38910 <manvolnum>9</manvolnum>
38911 <refmiscinfo class="version">4.1.27</refmiscinfo>
38912</refmeta>
38913<refnamediv>
38914 <refname>snd_pcm_new</refname>
38915 <refpurpose>
38916     create a new PCM instance
38917 </refpurpose>
38918</refnamediv>
38919<refsynopsisdiv>
38920 <title>Synopsis</title>
38921  <funcsynopsis><funcprototype>
38922   <funcdef>int <function>snd_pcm_new </function></funcdef>
38923   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
38924   <paramdef>const char * <parameter>id</parameter></paramdef>
38925   <paramdef>int <parameter>device</parameter></paramdef>
38926   <paramdef>int <parameter>playback_count</parameter></paramdef>
38927   <paramdef>int <parameter>capture_count</parameter></paramdef>
38928   <paramdef>struct snd_pcm ** <parameter>rpcm</parameter></paramdef>
38929  </funcprototype></funcsynopsis>
38930</refsynopsisdiv>
38931<refsect1>
38932 <title>Arguments</title>
38933 <variablelist>
38934  <varlistentry>
38935   <term><parameter>card</parameter></term>
38936   <listitem>
38937    <para>
38938     the card instance
38939    </para>
38940   </listitem>
38941  </varlistentry>
38942  <varlistentry>
38943   <term><parameter>id</parameter></term>
38944   <listitem>
38945    <para>
38946     the id string
38947    </para>
38948   </listitem>
38949  </varlistentry>
38950  <varlistentry>
38951   <term><parameter>device</parameter></term>
38952   <listitem>
38953    <para>
38954     the device index (zero based)
38955    </para>
38956   </listitem>
38957  </varlistentry>
38958  <varlistentry>
38959   <term><parameter>playback_count</parameter></term>
38960   <listitem>
38961    <para>
38962     the number of substreams for playback
38963    </para>
38964   </listitem>
38965  </varlistentry>
38966  <varlistentry>
38967   <term><parameter>capture_count</parameter></term>
38968   <listitem>
38969    <para>
38970     the number of substreams for capture
38971    </para>
38972   </listitem>
38973  </varlistentry>
38974  <varlistentry>
38975   <term><parameter>rpcm</parameter></term>
38976   <listitem>
38977    <para>
38978     the pointer to store the new pcm instance
38979    </para>
38980   </listitem>
38981  </varlistentry>
38982 </variablelist>
38983</refsect1>
38984<refsect1>
38985<title>Description</title>
38986<para>
38987   Creates a new PCM instance.
38988   </para><para>
38989
38990   The pcm operators have to be set afterwards to the new instance
38991   via <function>snd_pcm_set_ops</function>.
38992</para>
38993</refsect1>
38994<refsect1>
38995<title>Return</title>
38996<para>
38997   Zero if successful, or a negative error code on failure.
38998</para>
38999</refsect1>
39000</refentry>
39001
39002<refentry id="API-snd-pcm-new-internal">
39003<refentryinfo>
39004 <title>LINUX</title>
39005 <productname>Kernel Hackers Manual</productname>
39006 <date>July 2017</date>
39007</refentryinfo>
39008<refmeta>
39009 <refentrytitle><phrase>snd_pcm_new_internal</phrase></refentrytitle>
39010 <manvolnum>9</manvolnum>
39011 <refmiscinfo class="version">4.1.27</refmiscinfo>
39012</refmeta>
39013<refnamediv>
39014 <refname>snd_pcm_new_internal</refname>
39015 <refpurpose>
39016     create a new internal PCM instance
39017 </refpurpose>
39018</refnamediv>
39019<refsynopsisdiv>
39020 <title>Synopsis</title>
39021  <funcsynopsis><funcprototype>
39022   <funcdef>int <function>snd_pcm_new_internal </function></funcdef>
39023   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
39024   <paramdef>const char * <parameter>id</parameter></paramdef>
39025   <paramdef>int <parameter>device</parameter></paramdef>
39026   <paramdef>int <parameter>playback_count</parameter></paramdef>
39027   <paramdef>int <parameter>capture_count</parameter></paramdef>
39028   <paramdef>struct snd_pcm ** <parameter>rpcm</parameter></paramdef>
39029  </funcprototype></funcsynopsis>
39030</refsynopsisdiv>
39031<refsect1>
39032 <title>Arguments</title>
39033 <variablelist>
39034  <varlistentry>
39035   <term><parameter>card</parameter></term>
39036   <listitem>
39037    <para>
39038     the card instance
39039    </para>
39040   </listitem>
39041  </varlistentry>
39042  <varlistentry>
39043   <term><parameter>id</parameter></term>
39044   <listitem>
39045    <para>
39046     the id string
39047    </para>
39048   </listitem>
39049  </varlistentry>
39050  <varlistentry>
39051   <term><parameter>device</parameter></term>
39052   <listitem>
39053    <para>
39054     the device index (zero based - shared with normal PCMs)
39055    </para>
39056   </listitem>
39057  </varlistentry>
39058  <varlistentry>
39059   <term><parameter>playback_count</parameter></term>
39060   <listitem>
39061    <para>
39062     the number of substreams for playback
39063    </para>
39064   </listitem>
39065  </varlistentry>
39066  <varlistentry>
39067   <term><parameter>capture_count</parameter></term>
39068   <listitem>
39069    <para>
39070     the number of substreams for capture
39071    </para>
39072   </listitem>
39073  </varlistentry>
39074  <varlistentry>
39075   <term><parameter>rpcm</parameter></term>
39076   <listitem>
39077    <para>
39078     the pointer to store the new pcm instance
39079    </para>
39080   </listitem>
39081  </varlistentry>
39082 </variablelist>
39083</refsect1>
39084<refsect1>
39085<title>Description</title>
39086<para>
39087   Creates a new internal PCM instance with no userspace device or procfs
39088   entries. This is used by ASoC Back End PCMs in order to create a PCM that
39089   will only be used internally by kernel drivers. i.e. it cannot be opened
39090   by userspace. It provides existing ASoC components drivers with a substream
39091   and access to any private data.
39092   </para><para>
39093
39094   The pcm operators have to be set afterwards to the new instance
39095   via <function>snd_pcm_set_ops</function>.
39096</para>
39097</refsect1>
39098<refsect1>
39099<title>Return</title>
39100<para>
39101   Zero if successful, or a negative error code on failure.
39102</para>
39103</refsect1>
39104</refentry>
39105
39106<refentry id="API-snd-pcm-notify">
39107<refentryinfo>
39108 <title>LINUX</title>
39109 <productname>Kernel Hackers Manual</productname>
39110 <date>July 2017</date>
39111</refentryinfo>
39112<refmeta>
39113 <refentrytitle><phrase>snd_pcm_notify</phrase></refentrytitle>
39114 <manvolnum>9</manvolnum>
39115 <refmiscinfo class="version">4.1.27</refmiscinfo>
39116</refmeta>
39117<refnamediv>
39118 <refname>snd_pcm_notify</refname>
39119 <refpurpose>
39120     Add/remove the notify list
39121 </refpurpose>
39122</refnamediv>
39123<refsynopsisdiv>
39124 <title>Synopsis</title>
39125  <funcsynopsis><funcprototype>
39126   <funcdef>int <function>snd_pcm_notify </function></funcdef>
39127   <paramdef>struct snd_pcm_notify * <parameter>notify</parameter></paramdef>
39128   <paramdef>int <parameter>nfree</parameter></paramdef>
39129  </funcprototype></funcsynopsis>
39130</refsynopsisdiv>
39131<refsect1>
39132 <title>Arguments</title>
39133 <variablelist>
39134  <varlistentry>
39135   <term><parameter>notify</parameter></term>
39136   <listitem>
39137    <para>
39138     PCM notify list
39139    </para>
39140   </listitem>
39141  </varlistentry>
39142  <varlistentry>
39143   <term><parameter>nfree</parameter></term>
39144   <listitem>
39145    <para>
39146     0 = register, 1 = unregister
39147    </para>
39148   </listitem>
39149  </varlistentry>
39150 </variablelist>
39151</refsect1>
39152<refsect1>
39153<title>Description</title>
39154<para>
39155   This adds the given notifier to the global list so that the callback is
39156   called for each registered PCM devices.  This exists only for PCM OSS
39157   emulation, so far.
39158</para>
39159</refsect1>
39160</refentry>
39161
39162<!-- sound/core/device.c -->
39163<refentry id="API-snd-device-new">
39164<refentryinfo>
39165 <title>LINUX</title>
39166 <productname>Kernel Hackers Manual</productname>
39167 <date>July 2017</date>
39168</refentryinfo>
39169<refmeta>
39170 <refentrytitle><phrase>snd_device_new</phrase></refentrytitle>
39171 <manvolnum>9</manvolnum>
39172 <refmiscinfo class="version">4.1.27</refmiscinfo>
39173</refmeta>
39174<refnamediv>
39175 <refname>snd_device_new</refname>
39176 <refpurpose>
39177  create an ALSA device component
39178 </refpurpose>
39179</refnamediv>
39180<refsynopsisdiv>
39181 <title>Synopsis</title>
39182  <funcsynopsis><funcprototype>
39183   <funcdef>int <function>snd_device_new </function></funcdef>
39184   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
39185   <paramdef>enum snd_device_type <parameter>type</parameter></paramdef>
39186   <paramdef>void * <parameter>device_data</parameter></paramdef>
39187   <paramdef>struct snd_device_ops * <parameter>ops</parameter></paramdef>
39188  </funcprototype></funcsynopsis>
39189</refsynopsisdiv>
39190<refsect1>
39191 <title>Arguments</title>
39192 <variablelist>
39193  <varlistentry>
39194   <term><parameter>card</parameter></term>
39195   <listitem>
39196    <para>
39197     the card instance
39198    </para>
39199   </listitem>
39200  </varlistentry>
39201  <varlistentry>
39202   <term><parameter>type</parameter></term>
39203   <listitem>
39204    <para>
39205     the device type, SNDRV_DEV_XXX
39206    </para>
39207   </listitem>
39208  </varlistentry>
39209  <varlistentry>
39210   <term><parameter>device_data</parameter></term>
39211   <listitem>
39212    <para>
39213     the data pointer of this device
39214    </para>
39215   </listitem>
39216  </varlistentry>
39217  <varlistentry>
39218   <term><parameter>ops</parameter></term>
39219   <listitem>
39220    <para>
39221     the operator table
39222    </para>
39223   </listitem>
39224  </varlistentry>
39225 </variablelist>
39226</refsect1>
39227<refsect1>
39228<title>Description</title>
39229<para>
39230   Creates a new device component for the given data pointer.
39231   The device will be assigned to the card and managed together
39232   by the card.
39233   </para><para>
39234
39235   The data pointer plays a role as the identifier, too, so the
39236   pointer address must be unique and unchanged.
39237</para>
39238</refsect1>
39239<refsect1>
39240<title>Return</title>
39241<para>
39242   Zero if successful, or a negative error code on failure.
39243</para>
39244</refsect1>
39245</refentry>
39246
39247<refentry id="API-snd-device-disconnect">
39248<refentryinfo>
39249 <title>LINUX</title>
39250 <productname>Kernel Hackers Manual</productname>
39251 <date>July 2017</date>
39252</refentryinfo>
39253<refmeta>
39254 <refentrytitle><phrase>snd_device_disconnect</phrase></refentrytitle>
39255 <manvolnum>9</manvolnum>
39256 <refmiscinfo class="version">4.1.27</refmiscinfo>
39257</refmeta>
39258<refnamediv>
39259 <refname>snd_device_disconnect</refname>
39260 <refpurpose>
39261     disconnect the device
39262 </refpurpose>
39263</refnamediv>
39264<refsynopsisdiv>
39265 <title>Synopsis</title>
39266  <funcsynopsis><funcprototype>
39267   <funcdef>void <function>snd_device_disconnect </function></funcdef>
39268   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
39269   <paramdef>void * <parameter>device_data</parameter></paramdef>
39270  </funcprototype></funcsynopsis>
39271</refsynopsisdiv>
39272<refsect1>
39273 <title>Arguments</title>
39274 <variablelist>
39275  <varlistentry>
39276   <term><parameter>card</parameter></term>
39277   <listitem>
39278    <para>
39279     the card instance
39280    </para>
39281   </listitem>
39282  </varlistentry>
39283  <varlistentry>
39284   <term><parameter>device_data</parameter></term>
39285   <listitem>
39286    <para>
39287     the data pointer to disconnect
39288    </para>
39289   </listitem>
39290  </varlistentry>
39291 </variablelist>
39292</refsect1>
39293<refsect1>
39294<title>Description</title>
39295<para>
39296   Turns the device into the disconnection state, invoking
39297   dev_disconnect callback, if the device was already registered.
39298   </para><para>
39299
39300   Usually called from <function>snd_card_disconnect</function>.
39301</para>
39302</refsect1>
39303<refsect1>
39304<title>Return</title>
39305<para>
39306   Zero if successful, or a negative error code on failure or if the
39307   device not found.
39308</para>
39309</refsect1>
39310</refentry>
39311
39312<refentry id="API-snd-device-free">
39313<refentryinfo>
39314 <title>LINUX</title>
39315 <productname>Kernel Hackers Manual</productname>
39316 <date>July 2017</date>
39317</refentryinfo>
39318<refmeta>
39319 <refentrytitle><phrase>snd_device_free</phrase></refentrytitle>
39320 <manvolnum>9</manvolnum>
39321 <refmiscinfo class="version">4.1.27</refmiscinfo>
39322</refmeta>
39323<refnamediv>
39324 <refname>snd_device_free</refname>
39325 <refpurpose>
39326     release the device from the card
39327 </refpurpose>
39328</refnamediv>
39329<refsynopsisdiv>
39330 <title>Synopsis</title>
39331  <funcsynopsis><funcprototype>
39332   <funcdef>void <function>snd_device_free </function></funcdef>
39333   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
39334   <paramdef>void * <parameter>device_data</parameter></paramdef>
39335  </funcprototype></funcsynopsis>
39336</refsynopsisdiv>
39337<refsect1>
39338 <title>Arguments</title>
39339 <variablelist>
39340  <varlistentry>
39341   <term><parameter>card</parameter></term>
39342   <listitem>
39343    <para>
39344     the card instance
39345    </para>
39346   </listitem>
39347  </varlistentry>
39348  <varlistentry>
39349   <term><parameter>device_data</parameter></term>
39350   <listitem>
39351    <para>
39352     the data pointer to release
39353    </para>
39354   </listitem>
39355  </varlistentry>
39356 </variablelist>
39357</refsect1>
39358<refsect1>
39359<title>Description</title>
39360<para>
39361   Removes the device from the list on the card and invokes the
39362   callbacks, dev_disconnect and dev_free, corresponding to the state.
39363   Then release the device.
39364</para>
39365</refsect1>
39366</refentry>
39367
39368<refentry id="API-snd-device-register">
39369<refentryinfo>
39370 <title>LINUX</title>
39371 <productname>Kernel Hackers Manual</productname>
39372 <date>July 2017</date>
39373</refentryinfo>
39374<refmeta>
39375 <refentrytitle><phrase>snd_device_register</phrase></refentrytitle>
39376 <manvolnum>9</manvolnum>
39377 <refmiscinfo class="version">4.1.27</refmiscinfo>
39378</refmeta>
39379<refnamediv>
39380 <refname>snd_device_register</refname>
39381 <refpurpose>
39382     register the device
39383 </refpurpose>
39384</refnamediv>
39385<refsynopsisdiv>
39386 <title>Synopsis</title>
39387  <funcsynopsis><funcprototype>
39388   <funcdef>int <function>snd_device_register </function></funcdef>
39389   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
39390   <paramdef>void * <parameter>device_data</parameter></paramdef>
39391  </funcprototype></funcsynopsis>
39392</refsynopsisdiv>
39393<refsect1>
39394 <title>Arguments</title>
39395 <variablelist>
39396  <varlistentry>
39397   <term><parameter>card</parameter></term>
39398   <listitem>
39399    <para>
39400     the card instance
39401    </para>
39402   </listitem>
39403  </varlistentry>
39404  <varlistentry>
39405   <term><parameter>device_data</parameter></term>
39406   <listitem>
39407    <para>
39408     the data pointer to register
39409    </para>
39410   </listitem>
39411  </varlistentry>
39412 </variablelist>
39413</refsect1>
39414<refsect1>
39415<title>Description</title>
39416<para>
39417   Registers the device which was already created via
39418   <function>snd_device_new</function>.  Usually this is called from <function>snd_card_register</function>,
39419   but it can be called later if any new devices are created after
39420   invocation of <function>snd_card_register</function>.
39421</para>
39422</refsect1>
39423<refsect1>
39424<title>Return</title>
39425<para>
39426   Zero if successful, or a negative error code on failure or if the
39427   device not found.
39428</para>
39429</refsect1>
39430</refentry>
39431
39432<!-- sound/core/info.c -->
39433<refentry id="API-snd-iprintf">
39434<refentryinfo>
39435 <title>LINUX</title>
39436 <productname>Kernel Hackers Manual</productname>
39437 <date>July 2017</date>
39438</refentryinfo>
39439<refmeta>
39440 <refentrytitle><phrase>snd_iprintf</phrase></refentrytitle>
39441 <manvolnum>9</manvolnum>
39442 <refmiscinfo class="version">4.1.27</refmiscinfo>
39443</refmeta>
39444<refnamediv>
39445 <refname>snd_iprintf</refname>
39446 <refpurpose>
39447  printf on the procfs buffer
39448 </refpurpose>
39449</refnamediv>
39450<refsynopsisdiv>
39451 <title>Synopsis</title>
39452  <funcsynopsis><funcprototype>
39453   <funcdef>int <function>snd_iprintf </function></funcdef>
39454   <paramdef>struct snd_info_buffer * <parameter>buffer</parameter></paramdef>
39455   <paramdef>const char * <parameter>fmt</parameter></paramdef>
39456   <paramdef> <parameter>...</parameter></paramdef>
39457  </funcprototype></funcsynopsis>
39458</refsynopsisdiv>
39459<refsect1>
39460 <title>Arguments</title>
39461 <variablelist>
39462  <varlistentry>
39463   <term><parameter>buffer</parameter></term>
39464   <listitem>
39465    <para>
39466     the procfs buffer
39467    </para>
39468   </listitem>
39469  </varlistentry>
39470  <varlistentry>
39471   <term><parameter>fmt</parameter></term>
39472   <listitem>
39473    <para>
39474     the printf format
39475    </para>
39476   </listitem>
39477  </varlistentry>
39478  <varlistentry>
39479   <term><parameter>...</parameter></term>
39480   <listitem>
39481    <para>
39482     variable arguments
39483    </para>
39484   </listitem>
39485  </varlistentry>
39486 </variablelist>
39487</refsect1>
39488<refsect1>
39489<title>Description</title>
39490<para>
39491   Outputs the string on the procfs buffer just like <function>printf</function>.
39492</para>
39493</refsect1>
39494<refsect1>
39495<title>Return</title>
39496<para>
39497   The size of output string, or a negative error code.
39498</para>
39499</refsect1>
39500</refentry>
39501
39502<refentry id="API-snd-info-get-line">
39503<refentryinfo>
39504 <title>LINUX</title>
39505 <productname>Kernel Hackers Manual</productname>
39506 <date>July 2017</date>
39507</refentryinfo>
39508<refmeta>
39509 <refentrytitle><phrase>snd_info_get_line</phrase></refentrytitle>
39510 <manvolnum>9</manvolnum>
39511 <refmiscinfo class="version">4.1.27</refmiscinfo>
39512</refmeta>
39513<refnamediv>
39514 <refname>snd_info_get_line</refname>
39515 <refpurpose>
39516     read one line from the procfs buffer
39517 </refpurpose>
39518</refnamediv>
39519<refsynopsisdiv>
39520 <title>Synopsis</title>
39521  <funcsynopsis><funcprototype>
39522   <funcdef>int <function>snd_info_get_line </function></funcdef>
39523   <paramdef>struct snd_info_buffer * <parameter>buffer</parameter></paramdef>
39524   <paramdef>char * <parameter>line</parameter></paramdef>
39525   <paramdef>int <parameter>len</parameter></paramdef>
39526  </funcprototype></funcsynopsis>
39527</refsynopsisdiv>
39528<refsect1>
39529 <title>Arguments</title>
39530 <variablelist>
39531  <varlistentry>
39532   <term><parameter>buffer</parameter></term>
39533   <listitem>
39534    <para>
39535     the procfs buffer
39536    </para>
39537   </listitem>
39538  </varlistentry>
39539  <varlistentry>
39540   <term><parameter>line</parameter></term>
39541   <listitem>
39542    <para>
39543     the buffer to store
39544    </para>
39545   </listitem>
39546  </varlistentry>
39547  <varlistentry>
39548   <term><parameter>len</parameter></term>
39549   <listitem>
39550    <para>
39551     the max. buffer size
39552    </para>
39553   </listitem>
39554  </varlistentry>
39555 </variablelist>
39556</refsect1>
39557<refsect1>
39558<title>Description</title>
39559<para>
39560   Reads one line from the buffer and stores the string.
39561</para>
39562</refsect1>
39563<refsect1>
39564<title>Return</title>
39565<para>
39566   Zero if successful, or 1 if error or EOF.
39567</para>
39568</refsect1>
39569</refentry>
39570
39571<refentry id="API-snd-info-get-str">
39572<refentryinfo>
39573 <title>LINUX</title>
39574 <productname>Kernel Hackers Manual</productname>
39575 <date>July 2017</date>
39576</refentryinfo>
39577<refmeta>
39578 <refentrytitle><phrase>snd_info_get_str</phrase></refentrytitle>
39579 <manvolnum>9</manvolnum>
39580 <refmiscinfo class="version">4.1.27</refmiscinfo>
39581</refmeta>
39582<refnamediv>
39583 <refname>snd_info_get_str</refname>
39584 <refpurpose>
39585     parse a string token
39586 </refpurpose>
39587</refnamediv>
39588<refsynopsisdiv>
39589 <title>Synopsis</title>
39590  <funcsynopsis><funcprototype>
39591   <funcdef>const char * <function>snd_info_get_str </function></funcdef>
39592   <paramdef>char * <parameter>dest</parameter></paramdef>
39593   <paramdef>const char * <parameter>src</parameter></paramdef>
39594   <paramdef>int <parameter>len</parameter></paramdef>
39595  </funcprototype></funcsynopsis>
39596</refsynopsisdiv>
39597<refsect1>
39598 <title>Arguments</title>
39599 <variablelist>
39600  <varlistentry>
39601   <term><parameter>dest</parameter></term>
39602   <listitem>
39603    <para>
39604     the buffer to store the string token
39605    </para>
39606   </listitem>
39607  </varlistentry>
39608  <varlistentry>
39609   <term><parameter>src</parameter></term>
39610   <listitem>
39611    <para>
39612     the original string
39613    </para>
39614   </listitem>
39615  </varlistentry>
39616  <varlistentry>
39617   <term><parameter>len</parameter></term>
39618   <listitem>
39619    <para>
39620     the max. length of token - 1
39621    </para>
39622   </listitem>
39623  </varlistentry>
39624 </variablelist>
39625</refsect1>
39626<refsect1>
39627<title>Description</title>
39628<para>
39629   Parses the original string and copy a token to the given
39630   string buffer.
39631</para>
39632</refsect1>
39633<refsect1>
39634<title>Return</title>
39635<para>
39636   The updated pointer of the original string so that
39637   it can be used for the next call.
39638</para>
39639</refsect1>
39640</refentry>
39641
39642<refentry id="API-snd-info-create-module-entry">
39643<refentryinfo>
39644 <title>LINUX</title>
39645 <productname>Kernel Hackers Manual</productname>
39646 <date>July 2017</date>
39647</refentryinfo>
39648<refmeta>
39649 <refentrytitle><phrase>snd_info_create_module_entry</phrase></refentrytitle>
39650 <manvolnum>9</manvolnum>
39651 <refmiscinfo class="version">4.1.27</refmiscinfo>
39652</refmeta>
39653<refnamediv>
39654 <refname>snd_info_create_module_entry</refname>
39655 <refpurpose>
39656     create an info entry for the given module
39657 </refpurpose>
39658</refnamediv>
39659<refsynopsisdiv>
39660 <title>Synopsis</title>
39661  <funcsynopsis><funcprototype>
39662   <funcdef>struct snd_info_entry * <function>snd_info_create_module_entry </function></funcdef>
39663   <paramdef>struct module * <parameter>module</parameter></paramdef>
39664   <paramdef>const char * <parameter>name</parameter></paramdef>
39665   <paramdef>struct snd_info_entry * <parameter>parent</parameter></paramdef>
39666  </funcprototype></funcsynopsis>
39667</refsynopsisdiv>
39668<refsect1>
39669 <title>Arguments</title>
39670 <variablelist>
39671  <varlistentry>
39672   <term><parameter>module</parameter></term>
39673   <listitem>
39674    <para>
39675     the module pointer
39676    </para>
39677   </listitem>
39678  </varlistentry>
39679  <varlistentry>
39680   <term><parameter>name</parameter></term>
39681   <listitem>
39682    <para>
39683     the file name
39684    </para>
39685   </listitem>
39686  </varlistentry>
39687  <varlistentry>
39688   <term><parameter>parent</parameter></term>
39689   <listitem>
39690    <para>
39691     the parent directory
39692    </para>
39693   </listitem>
39694  </varlistentry>
39695 </variablelist>
39696</refsect1>
39697<refsect1>
39698<title>Description</title>
39699<para>
39700   Creates a new info entry and assigns it to the given module.
39701</para>
39702</refsect1>
39703<refsect1>
39704<title>Return</title>
39705<para>
39706   The pointer of the new instance, or <constant>NULL</constant> on failure.
39707</para>
39708</refsect1>
39709</refentry>
39710
39711<refentry id="API-snd-info-create-card-entry">
39712<refentryinfo>
39713 <title>LINUX</title>
39714 <productname>Kernel Hackers Manual</productname>
39715 <date>July 2017</date>
39716</refentryinfo>
39717<refmeta>
39718 <refentrytitle><phrase>snd_info_create_card_entry</phrase></refentrytitle>
39719 <manvolnum>9</manvolnum>
39720 <refmiscinfo class="version">4.1.27</refmiscinfo>
39721</refmeta>
39722<refnamediv>
39723 <refname>snd_info_create_card_entry</refname>
39724 <refpurpose>
39725     create an info entry for the given card
39726 </refpurpose>
39727</refnamediv>
39728<refsynopsisdiv>
39729 <title>Synopsis</title>
39730  <funcsynopsis><funcprototype>
39731   <funcdef>struct snd_info_entry * <function>snd_info_create_card_entry </function></funcdef>
39732   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
39733   <paramdef>const char * <parameter>name</parameter></paramdef>
39734   <paramdef>struct snd_info_entry * <parameter>parent</parameter></paramdef>
39735  </funcprototype></funcsynopsis>
39736</refsynopsisdiv>
39737<refsect1>
39738 <title>Arguments</title>
39739 <variablelist>
39740  <varlistentry>
39741   <term><parameter>card</parameter></term>
39742   <listitem>
39743    <para>
39744     the card instance
39745    </para>
39746   </listitem>
39747  </varlistentry>
39748  <varlistentry>
39749   <term><parameter>name</parameter></term>
39750   <listitem>
39751    <para>
39752     the file name
39753    </para>
39754   </listitem>
39755  </varlistentry>
39756  <varlistentry>
39757   <term><parameter>parent</parameter></term>
39758   <listitem>
39759    <para>
39760     the parent directory
39761    </para>
39762   </listitem>
39763  </varlistentry>
39764 </variablelist>
39765</refsect1>
39766<refsect1>
39767<title>Description</title>
39768<para>
39769   Creates a new info entry and assigns it to the given card.
39770</para>
39771</refsect1>
39772<refsect1>
39773<title>Return</title>
39774<para>
39775   The pointer of the new instance, or <constant>NULL</constant> on failure.
39776</para>
39777</refsect1>
39778</refentry>
39779
39780<refentry id="API-snd-card-proc-new">
39781<refentryinfo>
39782 <title>LINUX</title>
39783 <productname>Kernel Hackers Manual</productname>
39784 <date>July 2017</date>
39785</refentryinfo>
39786<refmeta>
39787 <refentrytitle><phrase>snd_card_proc_new</phrase></refentrytitle>
39788 <manvolnum>9</manvolnum>
39789 <refmiscinfo class="version">4.1.27</refmiscinfo>
39790</refmeta>
39791<refnamediv>
39792 <refname>snd_card_proc_new</refname>
39793 <refpurpose>
39794     create an info entry for the given card
39795 </refpurpose>
39796</refnamediv>
39797<refsynopsisdiv>
39798 <title>Synopsis</title>
39799  <funcsynopsis><funcprototype>
39800   <funcdef>int <function>snd_card_proc_new </function></funcdef>
39801   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
39802   <paramdef>const char * <parameter>name</parameter></paramdef>
39803   <paramdef>struct snd_info_entry ** <parameter>entryp</parameter></paramdef>
39804  </funcprototype></funcsynopsis>
39805</refsynopsisdiv>
39806<refsect1>
39807 <title>Arguments</title>
39808 <variablelist>
39809  <varlistentry>
39810   <term><parameter>card</parameter></term>
39811   <listitem>
39812    <para>
39813     the card instance
39814    </para>
39815   </listitem>
39816  </varlistentry>
39817  <varlistentry>
39818   <term><parameter>name</parameter></term>
39819   <listitem>
39820    <para>
39821     the file name
39822    </para>
39823   </listitem>
39824  </varlistentry>
39825  <varlistentry>
39826   <term><parameter>entryp</parameter></term>
39827   <listitem>
39828    <para>
39829     the pointer to store the new info entry
39830    </para>
39831   </listitem>
39832  </varlistentry>
39833 </variablelist>
39834</refsect1>
39835<refsect1>
39836<title>Description</title>
39837<para>
39838   Creates a new info entry and assigns it to the given card.
39839   Unlike <function>snd_info_create_card_entry</function>, this function registers the
39840   info entry as an ALSA device component, so that it can be
39841   unregistered/released without explicit call.
39842   Also, you don't have to register this entry via <function>snd_info_register</function>,
39843   since this will be registered by <function>snd_card_register</function> automatically.
39844   </para><para>
39845
39846   The parent is assumed as card-&gt;proc_root.
39847   </para><para>
39848
39849   For releasing this entry, use <function>snd_device_free</function> instead of
39850   <function>snd_info_free_entry</function>.
39851</para>
39852</refsect1>
39853<refsect1>
39854<title>Return</title>
39855<para>
39856   Zero if successful, or a negative error code on failure.
39857</para>
39858</refsect1>
39859</refentry>
39860
39861<refentry id="API-snd-info-free-entry">
39862<refentryinfo>
39863 <title>LINUX</title>
39864 <productname>Kernel Hackers Manual</productname>
39865 <date>July 2017</date>
39866</refentryinfo>
39867<refmeta>
39868 <refentrytitle><phrase>snd_info_free_entry</phrase></refentrytitle>
39869 <manvolnum>9</manvolnum>
39870 <refmiscinfo class="version">4.1.27</refmiscinfo>
39871</refmeta>
39872<refnamediv>
39873 <refname>snd_info_free_entry</refname>
39874 <refpurpose>
39875     release the info entry
39876 </refpurpose>
39877</refnamediv>
39878<refsynopsisdiv>
39879 <title>Synopsis</title>
39880  <funcsynopsis><funcprototype>
39881   <funcdef>void <function>snd_info_free_entry </function></funcdef>
39882   <paramdef>struct snd_info_entry * <parameter>entry</parameter></paramdef>
39883  </funcprototype></funcsynopsis>
39884</refsynopsisdiv>
39885<refsect1>
39886 <title>Arguments</title>
39887 <variablelist>
39888  <varlistentry>
39889   <term><parameter>entry</parameter></term>
39890   <listitem>
39891    <para>
39892     the info entry
39893    </para>
39894   </listitem>
39895  </varlistentry>
39896 </variablelist>
39897</refsect1>
39898<refsect1>
39899<title>Description</title>
39900<para>
39901   Releases the info entry.  Don't call this after registered.
39902</para>
39903</refsect1>
39904</refentry>
39905
39906<refentry id="API-snd-info-register">
39907<refentryinfo>
39908 <title>LINUX</title>
39909 <productname>Kernel Hackers Manual</productname>
39910 <date>July 2017</date>
39911</refentryinfo>
39912<refmeta>
39913 <refentrytitle><phrase>snd_info_register</phrase></refentrytitle>
39914 <manvolnum>9</manvolnum>
39915 <refmiscinfo class="version">4.1.27</refmiscinfo>
39916</refmeta>
39917<refnamediv>
39918 <refname>snd_info_register</refname>
39919 <refpurpose>
39920     register the info entry
39921 </refpurpose>
39922</refnamediv>
39923<refsynopsisdiv>
39924 <title>Synopsis</title>
39925  <funcsynopsis><funcprototype>
39926   <funcdef>int <function>snd_info_register </function></funcdef>
39927   <paramdef>struct snd_info_entry * <parameter>entry</parameter></paramdef>
39928  </funcprototype></funcsynopsis>
39929</refsynopsisdiv>
39930<refsect1>
39931 <title>Arguments</title>
39932 <variablelist>
39933  <varlistentry>
39934   <term><parameter>entry</parameter></term>
39935   <listitem>
39936    <para>
39937     the info entry
39938    </para>
39939   </listitem>
39940  </varlistentry>
39941 </variablelist>
39942</refsect1>
39943<refsect1>
39944<title>Description</title>
39945<para>
39946   Registers the proc info entry.
39947</para>
39948</refsect1>
39949<refsect1>
39950<title>Return</title>
39951<para>
39952   Zero if successful, or a negative error code on failure.
39953</para>
39954</refsect1>
39955</refentry>
39956
39957<!-- sound/core/rawmidi.c -->
39958<refentry id="API-snd-rawmidi-receive">
39959<refentryinfo>
39960 <title>LINUX</title>
39961 <productname>Kernel Hackers Manual</productname>
39962 <date>July 2017</date>
39963</refentryinfo>
39964<refmeta>
39965 <refentrytitle><phrase>snd_rawmidi_receive</phrase></refentrytitle>
39966 <manvolnum>9</manvolnum>
39967 <refmiscinfo class="version">4.1.27</refmiscinfo>
39968</refmeta>
39969<refnamediv>
39970 <refname>snd_rawmidi_receive</refname>
39971 <refpurpose>
39972  receive the input data from the device
39973 </refpurpose>
39974</refnamediv>
39975<refsynopsisdiv>
39976 <title>Synopsis</title>
39977  <funcsynopsis><funcprototype>
39978   <funcdef>int <function>snd_rawmidi_receive </function></funcdef>
39979   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
39980   <paramdef>const unsigned char * <parameter>buffer</parameter></paramdef>
39981   <paramdef>int <parameter>count</parameter></paramdef>
39982  </funcprototype></funcsynopsis>
39983</refsynopsisdiv>
39984<refsect1>
39985 <title>Arguments</title>
39986 <variablelist>
39987  <varlistentry>
39988   <term><parameter>substream</parameter></term>
39989   <listitem>
39990    <para>
39991     the rawmidi substream
39992    </para>
39993   </listitem>
39994  </varlistentry>
39995  <varlistentry>
39996   <term><parameter>buffer</parameter></term>
39997   <listitem>
39998    <para>
39999     the buffer pointer
40000    </para>
40001   </listitem>
40002  </varlistentry>
40003  <varlistentry>
40004   <term><parameter>count</parameter></term>
40005   <listitem>
40006    <para>
40007     the data size to read
40008    </para>
40009   </listitem>
40010  </varlistentry>
40011 </variablelist>
40012</refsect1>
40013<refsect1>
40014<title>Description</title>
40015<para>
40016   Reads the data from the internal buffer.
40017</para>
40018</refsect1>
40019<refsect1>
40020<title>Return</title>
40021<para>
40022   The size of read data, or a negative error code on failure.
40023</para>
40024</refsect1>
40025</refentry>
40026
40027<refentry id="API-snd-rawmidi-transmit-empty">
40028<refentryinfo>
40029 <title>LINUX</title>
40030 <productname>Kernel Hackers Manual</productname>
40031 <date>July 2017</date>
40032</refentryinfo>
40033<refmeta>
40034 <refentrytitle><phrase>snd_rawmidi_transmit_empty</phrase></refentrytitle>
40035 <manvolnum>9</manvolnum>
40036 <refmiscinfo class="version">4.1.27</refmiscinfo>
40037</refmeta>
40038<refnamediv>
40039 <refname>snd_rawmidi_transmit_empty</refname>
40040 <refpurpose>
40041     check whether the output buffer is empty
40042 </refpurpose>
40043</refnamediv>
40044<refsynopsisdiv>
40045 <title>Synopsis</title>
40046  <funcsynopsis><funcprototype>
40047   <funcdef>int <function>snd_rawmidi_transmit_empty </function></funcdef>
40048   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
40049  </funcprototype></funcsynopsis>
40050</refsynopsisdiv>
40051<refsect1>
40052 <title>Arguments</title>
40053 <variablelist>
40054  <varlistentry>
40055   <term><parameter>substream</parameter></term>
40056   <listitem>
40057    <para>
40058     the rawmidi substream
40059    </para>
40060   </listitem>
40061  </varlistentry>
40062 </variablelist>
40063</refsect1>
40064<refsect1>
40065<title>Return</title>
40066<para>
40067   1 if the internal output buffer is empty, 0 if not.
40068</para>
40069</refsect1>
40070</refentry>
40071
40072<refentry id="API---snd-rawmidi-transmit-peek">
40073<refentryinfo>
40074 <title>LINUX</title>
40075 <productname>Kernel Hackers Manual</productname>
40076 <date>July 2017</date>
40077</refentryinfo>
40078<refmeta>
40079 <refentrytitle><phrase>__snd_rawmidi_transmit_peek</phrase></refentrytitle>
40080 <manvolnum>9</manvolnum>
40081 <refmiscinfo class="version">4.1.27</refmiscinfo>
40082</refmeta>
40083<refnamediv>
40084 <refname>__snd_rawmidi_transmit_peek</refname>
40085 <refpurpose>
40086     copy data from the internal buffer
40087 </refpurpose>
40088</refnamediv>
40089<refsynopsisdiv>
40090 <title>Synopsis</title>
40091  <funcsynopsis><funcprototype>
40092   <funcdef>int <function>__snd_rawmidi_transmit_peek </function></funcdef>
40093   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
40094   <paramdef>unsigned char * <parameter>buffer</parameter></paramdef>
40095   <paramdef>int <parameter>count</parameter></paramdef>
40096  </funcprototype></funcsynopsis>
40097</refsynopsisdiv>
40098<refsect1>
40099 <title>Arguments</title>
40100 <variablelist>
40101  <varlistentry>
40102   <term><parameter>substream</parameter></term>
40103   <listitem>
40104    <para>
40105     the rawmidi substream
40106    </para>
40107   </listitem>
40108  </varlistentry>
40109  <varlistentry>
40110   <term><parameter>buffer</parameter></term>
40111   <listitem>
40112    <para>
40113     the buffer pointer
40114    </para>
40115   </listitem>
40116  </varlistentry>
40117  <varlistentry>
40118   <term><parameter>count</parameter></term>
40119   <listitem>
40120    <para>
40121     data size to transfer
40122    </para>
40123   </listitem>
40124  </varlistentry>
40125 </variablelist>
40126</refsect1>
40127<refsect1>
40128<title>Description</title>
40129<para>
40130   This is a variant of <function>snd_rawmidi_transmit_peek</function> without spinlock.
40131</para>
40132</refsect1>
40133</refentry>
40134
40135<refentry id="API-snd-rawmidi-transmit-peek">
40136<refentryinfo>
40137 <title>LINUX</title>
40138 <productname>Kernel Hackers Manual</productname>
40139 <date>July 2017</date>
40140</refentryinfo>
40141<refmeta>
40142 <refentrytitle><phrase>snd_rawmidi_transmit_peek</phrase></refentrytitle>
40143 <manvolnum>9</manvolnum>
40144 <refmiscinfo class="version">4.1.27</refmiscinfo>
40145</refmeta>
40146<refnamediv>
40147 <refname>snd_rawmidi_transmit_peek</refname>
40148 <refpurpose>
40149     copy data from the internal buffer
40150 </refpurpose>
40151</refnamediv>
40152<refsynopsisdiv>
40153 <title>Synopsis</title>
40154  <funcsynopsis><funcprototype>
40155   <funcdef>int <function>snd_rawmidi_transmit_peek </function></funcdef>
40156   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
40157   <paramdef>unsigned char * <parameter>buffer</parameter></paramdef>
40158   <paramdef>int <parameter>count</parameter></paramdef>
40159  </funcprototype></funcsynopsis>
40160</refsynopsisdiv>
40161<refsect1>
40162 <title>Arguments</title>
40163 <variablelist>
40164  <varlistentry>
40165   <term><parameter>substream</parameter></term>
40166   <listitem>
40167    <para>
40168     the rawmidi substream
40169    </para>
40170   </listitem>
40171  </varlistentry>
40172  <varlistentry>
40173   <term><parameter>buffer</parameter></term>
40174   <listitem>
40175    <para>
40176     the buffer pointer
40177    </para>
40178   </listitem>
40179  </varlistentry>
40180  <varlistentry>
40181   <term><parameter>count</parameter></term>
40182   <listitem>
40183    <para>
40184     data size to transfer
40185    </para>
40186   </listitem>
40187  </varlistentry>
40188 </variablelist>
40189</refsect1>
40190<refsect1>
40191<title>Description</title>
40192<para>
40193   Copies data from the internal output buffer to the given buffer.
40194   </para><para>
40195
40196   Call this in the interrupt handler when the midi output is ready,
40197   and call <function>snd_rawmidi_transmit_ack</function> after the transmission is
40198   finished.
40199</para>
40200</refsect1>
40201<refsect1>
40202<title>Return</title>
40203<para>
40204   The size of copied data, or a negative error code on failure.
40205</para>
40206</refsect1>
40207</refentry>
40208
40209<refentry id="API---snd-rawmidi-transmit-ack">
40210<refentryinfo>
40211 <title>LINUX</title>
40212 <productname>Kernel Hackers Manual</productname>
40213 <date>July 2017</date>
40214</refentryinfo>
40215<refmeta>
40216 <refentrytitle><phrase>__snd_rawmidi_transmit_ack</phrase></refentrytitle>
40217 <manvolnum>9</manvolnum>
40218 <refmiscinfo class="version">4.1.27</refmiscinfo>
40219</refmeta>
40220<refnamediv>
40221 <refname>__snd_rawmidi_transmit_ack</refname>
40222 <refpurpose>
40223     acknowledge the transmission
40224 </refpurpose>
40225</refnamediv>
40226<refsynopsisdiv>
40227 <title>Synopsis</title>
40228  <funcsynopsis><funcprototype>
40229   <funcdef>int <function>__snd_rawmidi_transmit_ack </function></funcdef>
40230   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
40231   <paramdef>int <parameter>count</parameter></paramdef>
40232  </funcprototype></funcsynopsis>
40233</refsynopsisdiv>
40234<refsect1>
40235 <title>Arguments</title>
40236 <variablelist>
40237  <varlistentry>
40238   <term><parameter>substream</parameter></term>
40239   <listitem>
40240    <para>
40241     the rawmidi substream
40242    </para>
40243   </listitem>
40244  </varlistentry>
40245  <varlistentry>
40246   <term><parameter>count</parameter></term>
40247   <listitem>
40248    <para>
40249     the transferred count
40250    </para>
40251   </listitem>
40252  </varlistentry>
40253 </variablelist>
40254</refsect1>
40255<refsect1>
40256<title>Description</title>
40257<para>
40258   This is a variant of <function>__snd_rawmidi_transmit_ack</function> without spinlock.
40259</para>
40260</refsect1>
40261</refentry>
40262
40263<refentry id="API-snd-rawmidi-transmit-ack">
40264<refentryinfo>
40265 <title>LINUX</title>
40266 <productname>Kernel Hackers Manual</productname>
40267 <date>July 2017</date>
40268</refentryinfo>
40269<refmeta>
40270 <refentrytitle><phrase>snd_rawmidi_transmit_ack</phrase></refentrytitle>
40271 <manvolnum>9</manvolnum>
40272 <refmiscinfo class="version">4.1.27</refmiscinfo>
40273</refmeta>
40274<refnamediv>
40275 <refname>snd_rawmidi_transmit_ack</refname>
40276 <refpurpose>
40277     acknowledge the transmission
40278 </refpurpose>
40279</refnamediv>
40280<refsynopsisdiv>
40281 <title>Synopsis</title>
40282  <funcsynopsis><funcprototype>
40283   <funcdef>int <function>snd_rawmidi_transmit_ack </function></funcdef>
40284   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
40285   <paramdef>int <parameter>count</parameter></paramdef>
40286  </funcprototype></funcsynopsis>
40287</refsynopsisdiv>
40288<refsect1>
40289 <title>Arguments</title>
40290 <variablelist>
40291  <varlistentry>
40292   <term><parameter>substream</parameter></term>
40293   <listitem>
40294    <para>
40295     the rawmidi substream
40296    </para>
40297   </listitem>
40298  </varlistentry>
40299  <varlistentry>
40300   <term><parameter>count</parameter></term>
40301   <listitem>
40302    <para>
40303     the transferred count
40304    </para>
40305   </listitem>
40306  </varlistentry>
40307 </variablelist>
40308</refsect1>
40309<refsect1>
40310<title>Description</title>
40311<para>
40312   Advances the hardware pointer for the internal output buffer with
40313   the given size and updates the condition.
40314   Call after the transmission is finished.
40315</para>
40316</refsect1>
40317<refsect1>
40318<title>Return</title>
40319<para>
40320   The advanced size if successful, or a negative error code on failure.
40321</para>
40322</refsect1>
40323</refentry>
40324
40325<refentry id="API-snd-rawmidi-transmit">
40326<refentryinfo>
40327 <title>LINUX</title>
40328 <productname>Kernel Hackers Manual</productname>
40329 <date>July 2017</date>
40330</refentryinfo>
40331<refmeta>
40332 <refentrytitle><phrase>snd_rawmidi_transmit</phrase></refentrytitle>
40333 <manvolnum>9</manvolnum>
40334 <refmiscinfo class="version">4.1.27</refmiscinfo>
40335</refmeta>
40336<refnamediv>
40337 <refname>snd_rawmidi_transmit</refname>
40338 <refpurpose>
40339     copy from the buffer to the device
40340 </refpurpose>
40341</refnamediv>
40342<refsynopsisdiv>
40343 <title>Synopsis</title>
40344  <funcsynopsis><funcprototype>
40345   <funcdef>int <function>snd_rawmidi_transmit </function></funcdef>
40346   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
40347   <paramdef>unsigned char * <parameter>buffer</parameter></paramdef>
40348   <paramdef>int <parameter>count</parameter></paramdef>
40349  </funcprototype></funcsynopsis>
40350</refsynopsisdiv>
40351<refsect1>
40352 <title>Arguments</title>
40353 <variablelist>
40354  <varlistentry>
40355   <term><parameter>substream</parameter></term>
40356   <listitem>
40357    <para>
40358     the rawmidi substream
40359    </para>
40360   </listitem>
40361  </varlistentry>
40362  <varlistentry>
40363   <term><parameter>buffer</parameter></term>
40364   <listitem>
40365    <para>
40366     the buffer pointer
40367    </para>
40368   </listitem>
40369  </varlistentry>
40370  <varlistentry>
40371   <term><parameter>count</parameter></term>
40372   <listitem>
40373    <para>
40374     the data size to transfer
40375    </para>
40376   </listitem>
40377  </varlistentry>
40378 </variablelist>
40379</refsect1>
40380<refsect1>
40381<title>Description</title>
40382<para>
40383   Copies data from the buffer to the device and advances the pointer.
40384</para>
40385</refsect1>
40386<refsect1>
40387<title>Return</title>
40388<para>
40389   The copied size if successful, or a negative error code on failure.
40390</para>
40391</refsect1>
40392</refentry>
40393
40394<refentry id="API-snd-rawmidi-new">
40395<refentryinfo>
40396 <title>LINUX</title>
40397 <productname>Kernel Hackers Manual</productname>
40398 <date>July 2017</date>
40399</refentryinfo>
40400<refmeta>
40401 <refentrytitle><phrase>snd_rawmidi_new</phrase></refentrytitle>
40402 <manvolnum>9</manvolnum>
40403 <refmiscinfo class="version">4.1.27</refmiscinfo>
40404</refmeta>
40405<refnamediv>
40406 <refname>snd_rawmidi_new</refname>
40407 <refpurpose>
40408     create a rawmidi instance
40409 </refpurpose>
40410</refnamediv>
40411<refsynopsisdiv>
40412 <title>Synopsis</title>
40413  <funcsynopsis><funcprototype>
40414   <funcdef>int <function>snd_rawmidi_new </function></funcdef>
40415   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40416   <paramdef>char * <parameter>id</parameter></paramdef>
40417   <paramdef>int <parameter>device</parameter></paramdef>
40418   <paramdef>int <parameter>output_count</parameter></paramdef>
40419   <paramdef>int <parameter>input_count</parameter></paramdef>
40420   <paramdef>struct snd_rawmidi ** <parameter>rrawmidi</parameter></paramdef>
40421  </funcprototype></funcsynopsis>
40422</refsynopsisdiv>
40423<refsect1>
40424 <title>Arguments</title>
40425 <variablelist>
40426  <varlistentry>
40427   <term><parameter>card</parameter></term>
40428   <listitem>
40429    <para>
40430     the card instance
40431    </para>
40432   </listitem>
40433  </varlistentry>
40434  <varlistentry>
40435   <term><parameter>id</parameter></term>
40436   <listitem>
40437    <para>
40438     the id string
40439    </para>
40440   </listitem>
40441  </varlistentry>
40442  <varlistentry>
40443   <term><parameter>device</parameter></term>
40444   <listitem>
40445    <para>
40446     the device index
40447    </para>
40448   </listitem>
40449  </varlistentry>
40450  <varlistentry>
40451   <term><parameter>output_count</parameter></term>
40452   <listitem>
40453    <para>
40454     the number of output streams
40455    </para>
40456   </listitem>
40457  </varlistentry>
40458  <varlistentry>
40459   <term><parameter>input_count</parameter></term>
40460   <listitem>
40461    <para>
40462     the number of input streams
40463    </para>
40464   </listitem>
40465  </varlistentry>
40466  <varlistentry>
40467   <term><parameter>rrawmidi</parameter></term>
40468   <listitem>
40469    <para>
40470     the pointer to store the new rawmidi instance
40471    </para>
40472   </listitem>
40473  </varlistentry>
40474 </variablelist>
40475</refsect1>
40476<refsect1>
40477<title>Description</title>
40478<para>
40479   Creates a new rawmidi instance.
40480   Use <function>snd_rawmidi_set_ops</function> to set the operators to the new instance.
40481</para>
40482</refsect1>
40483<refsect1>
40484<title>Return</title>
40485<para>
40486   Zero if successful, or a negative error code on failure.
40487</para>
40488</refsect1>
40489</refentry>
40490
40491<refentry id="API-snd-rawmidi-set-ops">
40492<refentryinfo>
40493 <title>LINUX</title>
40494 <productname>Kernel Hackers Manual</productname>
40495 <date>July 2017</date>
40496</refentryinfo>
40497<refmeta>
40498 <refentrytitle><phrase>snd_rawmidi_set_ops</phrase></refentrytitle>
40499 <manvolnum>9</manvolnum>
40500 <refmiscinfo class="version">4.1.27</refmiscinfo>
40501</refmeta>
40502<refnamediv>
40503 <refname>snd_rawmidi_set_ops</refname>
40504 <refpurpose>
40505     set the rawmidi operators
40506 </refpurpose>
40507</refnamediv>
40508<refsynopsisdiv>
40509 <title>Synopsis</title>
40510  <funcsynopsis><funcprototype>
40511   <funcdef>void <function>snd_rawmidi_set_ops </function></funcdef>
40512   <paramdef>struct snd_rawmidi * <parameter>rmidi</parameter></paramdef>
40513   <paramdef>int <parameter>stream</parameter></paramdef>
40514   <paramdef>struct snd_rawmidi_ops * <parameter>ops</parameter></paramdef>
40515  </funcprototype></funcsynopsis>
40516</refsynopsisdiv>
40517<refsect1>
40518 <title>Arguments</title>
40519 <variablelist>
40520  <varlistentry>
40521   <term><parameter>rmidi</parameter></term>
40522   <listitem>
40523    <para>
40524     the rawmidi instance
40525    </para>
40526   </listitem>
40527  </varlistentry>
40528  <varlistentry>
40529   <term><parameter>stream</parameter></term>
40530   <listitem>
40531    <para>
40532     the stream direction, SNDRV_RAWMIDI_STREAM_XXX
40533    </para>
40534   </listitem>
40535  </varlistentry>
40536  <varlistentry>
40537   <term><parameter>ops</parameter></term>
40538   <listitem>
40539    <para>
40540     the operator table
40541    </para>
40542   </listitem>
40543  </varlistentry>
40544 </variablelist>
40545</refsect1>
40546<refsect1>
40547<title>Description</title>
40548<para>
40549   Sets the rawmidi operators for the given stream direction.
40550</para>
40551</refsect1>
40552</refentry>
40553
40554<!-- sound/core/sound.c -->
40555<refentry id="API-snd-request-card">
40556<refentryinfo>
40557 <title>LINUX</title>
40558 <productname>Kernel Hackers Manual</productname>
40559 <date>July 2017</date>
40560</refentryinfo>
40561<refmeta>
40562 <refentrytitle><phrase>snd_request_card</phrase></refentrytitle>
40563 <manvolnum>9</manvolnum>
40564 <refmiscinfo class="version">4.1.27</refmiscinfo>
40565</refmeta>
40566<refnamediv>
40567 <refname>snd_request_card</refname>
40568 <refpurpose>
40569  try to load the card module
40570 </refpurpose>
40571</refnamediv>
40572<refsynopsisdiv>
40573 <title>Synopsis</title>
40574  <funcsynopsis><funcprototype>
40575   <funcdef>void <function>snd_request_card </function></funcdef>
40576   <paramdef>int <parameter>card</parameter></paramdef>
40577  </funcprototype></funcsynopsis>
40578</refsynopsisdiv>
40579<refsect1>
40580 <title>Arguments</title>
40581 <variablelist>
40582  <varlistentry>
40583   <term><parameter>card</parameter></term>
40584   <listitem>
40585    <para>
40586     the card number
40587    </para>
40588   </listitem>
40589  </varlistentry>
40590 </variablelist>
40591</refsect1>
40592<refsect1>
40593<title>Description</title>
40594<para>
40595   Tries to load the module <quote>snd-card-X</quote> for the given card number
40596   via request_module.  Returns immediately if already loaded.
40597</para>
40598</refsect1>
40599</refentry>
40600
40601<refentry id="API-snd-lookup-minor-data">
40602<refentryinfo>
40603 <title>LINUX</title>
40604 <productname>Kernel Hackers Manual</productname>
40605 <date>July 2017</date>
40606</refentryinfo>
40607<refmeta>
40608 <refentrytitle><phrase>snd_lookup_minor_data</phrase></refentrytitle>
40609 <manvolnum>9</manvolnum>
40610 <refmiscinfo class="version">4.1.27</refmiscinfo>
40611</refmeta>
40612<refnamediv>
40613 <refname>snd_lookup_minor_data</refname>
40614 <refpurpose>
40615     get user data of a registered device
40616 </refpurpose>
40617</refnamediv>
40618<refsynopsisdiv>
40619 <title>Synopsis</title>
40620  <funcsynopsis><funcprototype>
40621   <funcdef>void * <function>snd_lookup_minor_data </function></funcdef>
40622   <paramdef>unsigned int <parameter>minor</parameter></paramdef>
40623   <paramdef>int <parameter>type</parameter></paramdef>
40624  </funcprototype></funcsynopsis>
40625</refsynopsisdiv>
40626<refsect1>
40627 <title>Arguments</title>
40628 <variablelist>
40629  <varlistentry>
40630   <term><parameter>minor</parameter></term>
40631   <listitem>
40632    <para>
40633     the minor number
40634    </para>
40635   </listitem>
40636  </varlistentry>
40637  <varlistentry>
40638   <term><parameter>type</parameter></term>
40639   <listitem>
40640    <para>
40641     device type (SNDRV_DEVICE_TYPE_XXX)
40642    </para>
40643   </listitem>
40644  </varlistentry>
40645 </variablelist>
40646</refsect1>
40647<refsect1>
40648<title>Description</title>
40649<para>
40650   Checks that a minor device with the specified type is registered, and returns
40651   its user data pointer.
40652   </para><para>
40653
40654   This function increments the reference counter of the card instance
40655   if an associated instance with the given minor number and type is found.
40656   The caller must call <function>snd_card_unref</function> appropriately later.
40657</para>
40658</refsect1>
40659<refsect1>
40660<title>Return</title>
40661<para>
40662   The user data pointer if the specified device is found. <constant>NULL</constant>
40663   otherwise.
40664</para>
40665</refsect1>
40666</refentry>
40667
40668<refentry id="API-snd-register-device">
40669<refentryinfo>
40670 <title>LINUX</title>
40671 <productname>Kernel Hackers Manual</productname>
40672 <date>July 2017</date>
40673</refentryinfo>
40674<refmeta>
40675 <refentrytitle><phrase>snd_register_device</phrase></refentrytitle>
40676 <manvolnum>9</manvolnum>
40677 <refmiscinfo class="version">4.1.27</refmiscinfo>
40678</refmeta>
40679<refnamediv>
40680 <refname>snd_register_device</refname>
40681 <refpurpose>
40682     Register the ALSA device file for the card
40683 </refpurpose>
40684</refnamediv>
40685<refsynopsisdiv>
40686 <title>Synopsis</title>
40687  <funcsynopsis><funcprototype>
40688   <funcdef>int <function>snd_register_device </function></funcdef>
40689   <paramdef>int <parameter>type</parameter></paramdef>
40690   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40691   <paramdef>int <parameter>dev</parameter></paramdef>
40692   <paramdef>const struct file_operations * <parameter>f_ops</parameter></paramdef>
40693   <paramdef>void * <parameter>private_data</parameter></paramdef>
40694   <paramdef>struct device * <parameter>device</parameter></paramdef>
40695  </funcprototype></funcsynopsis>
40696</refsynopsisdiv>
40697<refsect1>
40698 <title>Arguments</title>
40699 <variablelist>
40700  <varlistentry>
40701   <term><parameter>type</parameter></term>
40702   <listitem>
40703    <para>
40704     the device type, SNDRV_DEVICE_TYPE_XXX
40705    </para>
40706   </listitem>
40707  </varlistentry>
40708  <varlistentry>
40709   <term><parameter>card</parameter></term>
40710   <listitem>
40711    <para>
40712     the card instance
40713    </para>
40714   </listitem>
40715  </varlistentry>
40716  <varlistentry>
40717   <term><parameter>dev</parameter></term>
40718   <listitem>
40719    <para>
40720     the device index
40721    </para>
40722   </listitem>
40723  </varlistentry>
40724  <varlistentry>
40725   <term><parameter>f_ops</parameter></term>
40726   <listitem>
40727    <para>
40728     the file operations
40729    </para>
40730   </listitem>
40731  </varlistentry>
40732  <varlistentry>
40733   <term><parameter>private_data</parameter></term>
40734   <listitem>
40735    <para>
40736     user pointer for f_ops-&gt;<function>open</function>
40737    </para>
40738   </listitem>
40739  </varlistentry>
40740  <varlistentry>
40741   <term><parameter>device</parameter></term>
40742   <listitem>
40743    <para>
40744     the device to register
40745    </para>
40746   </listitem>
40747  </varlistentry>
40748 </variablelist>
40749</refsect1>
40750<refsect1>
40751<title>Description</title>
40752<para>
40753   Registers an ALSA device file for the given card.
40754   The operators have to be set in reg parameter.
40755</para>
40756</refsect1>
40757<refsect1>
40758<title>Return</title>
40759<para>
40760   Zero if successful, or a negative error code on failure.
40761</para>
40762</refsect1>
40763</refentry>
40764
40765<refentry id="API-snd-unregister-device">
40766<refentryinfo>
40767 <title>LINUX</title>
40768 <productname>Kernel Hackers Manual</productname>
40769 <date>July 2017</date>
40770</refentryinfo>
40771<refmeta>
40772 <refentrytitle><phrase>snd_unregister_device</phrase></refentrytitle>
40773 <manvolnum>9</manvolnum>
40774 <refmiscinfo class="version">4.1.27</refmiscinfo>
40775</refmeta>
40776<refnamediv>
40777 <refname>snd_unregister_device</refname>
40778 <refpurpose>
40779     unregister the device on the given card
40780 </refpurpose>
40781</refnamediv>
40782<refsynopsisdiv>
40783 <title>Synopsis</title>
40784  <funcsynopsis><funcprototype>
40785   <funcdef>int <function>snd_unregister_device </function></funcdef>
40786   <paramdef>struct device * <parameter>dev</parameter></paramdef>
40787  </funcprototype></funcsynopsis>
40788</refsynopsisdiv>
40789<refsect1>
40790 <title>Arguments</title>
40791 <variablelist>
40792  <varlistentry>
40793   <term><parameter>dev</parameter></term>
40794   <listitem>
40795    <para>
40796     the device instance
40797    </para>
40798   </listitem>
40799  </varlistentry>
40800 </variablelist>
40801</refsect1>
40802<refsect1>
40803<title>Description</title>
40804<para>
40805   Unregisters the device file already registered via
40806   <function>snd_register_device</function>.
40807</para>
40808</refsect1>
40809<refsect1>
40810<title>Return</title>
40811<para>
40812   Zero if successful, or a negative error code on failure.
40813</para>
40814</refsect1>
40815</refentry>
40816
40817<!-- sound/core/memory.c -->
40818<refentry id="API-copy-to-user-fromio">
40819<refentryinfo>
40820 <title>LINUX</title>
40821 <productname>Kernel Hackers Manual</productname>
40822 <date>July 2017</date>
40823</refentryinfo>
40824<refmeta>
40825 <refentrytitle><phrase>copy_to_user_fromio</phrase></refentrytitle>
40826 <manvolnum>9</manvolnum>
40827 <refmiscinfo class="version">4.1.27</refmiscinfo>
40828</refmeta>
40829<refnamediv>
40830 <refname>copy_to_user_fromio</refname>
40831 <refpurpose>
40832  copy data from mmio-space to user-space
40833 </refpurpose>
40834</refnamediv>
40835<refsynopsisdiv>
40836 <title>Synopsis</title>
40837  <funcsynopsis><funcprototype>
40838   <funcdef>int <function>copy_to_user_fromio </function></funcdef>
40839   <paramdef>void __user * <parameter>dst</parameter></paramdef>
40840   <paramdef>const volatile void __iomem * <parameter>src</parameter></paramdef>
40841   <paramdef>size_t <parameter>count</parameter></paramdef>
40842  </funcprototype></funcsynopsis>
40843</refsynopsisdiv>
40844<refsect1>
40845 <title>Arguments</title>
40846 <variablelist>
40847  <varlistentry>
40848   <term><parameter>dst</parameter></term>
40849   <listitem>
40850    <para>
40851     the destination pointer on user-space
40852    </para>
40853   </listitem>
40854  </varlistentry>
40855  <varlistentry>
40856   <term><parameter>src</parameter></term>
40857   <listitem>
40858    <para>
40859     the source pointer on mmio
40860    </para>
40861   </listitem>
40862  </varlistentry>
40863  <varlistentry>
40864   <term><parameter>count</parameter></term>
40865   <listitem>
40866    <para>
40867     the data size to copy in bytes
40868    </para>
40869   </listitem>
40870  </varlistentry>
40871 </variablelist>
40872</refsect1>
40873<refsect1>
40874<title>Description</title>
40875<para>
40876   Copies the data from mmio-space to user-space.
40877</para>
40878</refsect1>
40879<refsect1>
40880<title>Return</title>
40881<para>
40882   Zero if successful, or non-zero on failure.
40883</para>
40884</refsect1>
40885</refentry>
40886
40887<refentry id="API-copy-from-user-toio">
40888<refentryinfo>
40889 <title>LINUX</title>
40890 <productname>Kernel Hackers Manual</productname>
40891 <date>July 2017</date>
40892</refentryinfo>
40893<refmeta>
40894 <refentrytitle><phrase>copy_from_user_toio</phrase></refentrytitle>
40895 <manvolnum>9</manvolnum>
40896 <refmiscinfo class="version">4.1.27</refmiscinfo>
40897</refmeta>
40898<refnamediv>
40899 <refname>copy_from_user_toio</refname>
40900 <refpurpose>
40901     copy data from user-space to mmio-space
40902 </refpurpose>
40903</refnamediv>
40904<refsynopsisdiv>
40905 <title>Synopsis</title>
40906  <funcsynopsis><funcprototype>
40907   <funcdef>int <function>copy_from_user_toio </function></funcdef>
40908   <paramdef>volatile void __iomem * <parameter>dst</parameter></paramdef>
40909   <paramdef>const void __user * <parameter>src</parameter></paramdef>
40910   <paramdef>size_t <parameter>count</parameter></paramdef>
40911  </funcprototype></funcsynopsis>
40912</refsynopsisdiv>
40913<refsect1>
40914 <title>Arguments</title>
40915 <variablelist>
40916  <varlistentry>
40917   <term><parameter>dst</parameter></term>
40918   <listitem>
40919    <para>
40920     the destination pointer on mmio-space
40921    </para>
40922   </listitem>
40923  </varlistentry>
40924  <varlistentry>
40925   <term><parameter>src</parameter></term>
40926   <listitem>
40927    <para>
40928     the source pointer on user-space
40929    </para>
40930   </listitem>
40931  </varlistentry>
40932  <varlistentry>
40933   <term><parameter>count</parameter></term>
40934   <listitem>
40935    <para>
40936     the data size to copy in bytes
40937    </para>
40938   </listitem>
40939  </varlistentry>
40940 </variablelist>
40941</refsect1>
40942<refsect1>
40943<title>Description</title>
40944<para>
40945   Copies the data from user-space to mmio-space.
40946</para>
40947</refsect1>
40948<refsect1>
40949<title>Return</title>
40950<para>
40951   Zero if successful, or non-zero on failure.
40952</para>
40953</refsect1>
40954</refentry>
40955
40956<!-- sound/core/pcm_memory.c -->
40957<refentry id="API-snd-pcm-lib-preallocate-free-for-all">
40958<refentryinfo>
40959 <title>LINUX</title>
40960 <productname>Kernel Hackers Manual</productname>
40961 <date>July 2017</date>
40962</refentryinfo>
40963<refmeta>
40964 <refentrytitle><phrase>snd_pcm_lib_preallocate_free_for_all</phrase></refentrytitle>
40965 <manvolnum>9</manvolnum>
40966 <refmiscinfo class="version">4.1.27</refmiscinfo>
40967</refmeta>
40968<refnamediv>
40969 <refname>snd_pcm_lib_preallocate_free_for_all</refname>
40970 <refpurpose>
40971  release all pre-allocated buffers on the pcm
40972 </refpurpose>
40973</refnamediv>
40974<refsynopsisdiv>
40975 <title>Synopsis</title>
40976  <funcsynopsis><funcprototype>
40977   <funcdef>int <function>snd_pcm_lib_preallocate_free_for_all </function></funcdef>
40978   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
40979  </funcprototype></funcsynopsis>
40980</refsynopsisdiv>
40981<refsect1>
40982 <title>Arguments</title>
40983 <variablelist>
40984  <varlistentry>
40985   <term><parameter>pcm</parameter></term>
40986   <listitem>
40987    <para>
40988     the pcm instance
40989    </para>
40990   </listitem>
40991  </varlistentry>
40992 </variablelist>
40993</refsect1>
40994<refsect1>
40995<title>Description</title>
40996<para>
40997   Releases all the pre-allocated buffers on the given pcm.
40998</para>
40999</refsect1>
41000<refsect1>
41001<title>Return</title>
41002<para>
41003   Zero if successful, or a negative error code on failure.
41004</para>
41005</refsect1>
41006</refentry>
41007
41008<refentry id="API-snd-pcm-lib-preallocate-pages">
41009<refentryinfo>
41010 <title>LINUX</title>
41011 <productname>Kernel Hackers Manual</productname>
41012 <date>July 2017</date>
41013</refentryinfo>
41014<refmeta>
41015 <refentrytitle><phrase>snd_pcm_lib_preallocate_pages</phrase></refentrytitle>
41016 <manvolnum>9</manvolnum>
41017 <refmiscinfo class="version">4.1.27</refmiscinfo>
41018</refmeta>
41019<refnamediv>
41020 <refname>snd_pcm_lib_preallocate_pages</refname>
41021 <refpurpose>
41022     pre-allocation for the given DMA type
41023 </refpurpose>
41024</refnamediv>
41025<refsynopsisdiv>
41026 <title>Synopsis</title>
41027  <funcsynopsis><funcprototype>
41028   <funcdef>int <function>snd_pcm_lib_preallocate_pages </function></funcdef>
41029   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
41030   <paramdef>int <parameter>type</parameter></paramdef>
41031   <paramdef>struct device * <parameter>data</parameter></paramdef>
41032   <paramdef>size_t <parameter>size</parameter></paramdef>
41033   <paramdef>size_t <parameter>max</parameter></paramdef>
41034  </funcprototype></funcsynopsis>
41035</refsynopsisdiv>
41036<refsect1>
41037 <title>Arguments</title>
41038 <variablelist>
41039  <varlistentry>
41040   <term><parameter>substream</parameter></term>
41041   <listitem>
41042    <para>
41043     the pcm substream instance
41044    </para>
41045   </listitem>
41046  </varlistentry>
41047  <varlistentry>
41048   <term><parameter>type</parameter></term>
41049   <listitem>
41050    <para>
41051     DMA type (SNDRV_DMA_TYPE_*)
41052    </para>
41053   </listitem>
41054  </varlistentry>
41055  <varlistentry>
41056   <term><parameter>data</parameter></term>
41057   <listitem>
41058    <para>
41059     DMA type dependent data
41060    </para>
41061   </listitem>
41062  </varlistentry>
41063  <varlistentry>
41064   <term><parameter>size</parameter></term>
41065   <listitem>
41066    <para>
41067     the requested pre-allocation size in bytes
41068    </para>
41069   </listitem>
41070  </varlistentry>
41071  <varlistentry>
41072   <term><parameter>max</parameter></term>
41073   <listitem>
41074    <para>
41075     the max. allowed pre-allocation size
41076    </para>
41077   </listitem>
41078  </varlistentry>
41079 </variablelist>
41080</refsect1>
41081<refsect1>
41082<title>Description</title>
41083<para>
41084   Do pre-allocation for the given DMA buffer type.
41085</para>
41086</refsect1>
41087<refsect1>
41088<title>Return</title>
41089<para>
41090   Zero if successful, or a negative error code on failure.
41091</para>
41092</refsect1>
41093</refentry>
41094
41095<refentry id="API-snd-pcm-lib-preallocate-pages-for-all">
41096<refentryinfo>
41097 <title>LINUX</title>
41098 <productname>Kernel Hackers Manual</productname>
41099 <date>July 2017</date>
41100</refentryinfo>
41101<refmeta>
41102 <refentrytitle><phrase>snd_pcm_lib_preallocate_pages_for_all</phrase></refentrytitle>
41103 <manvolnum>9</manvolnum>
41104 <refmiscinfo class="version">4.1.27</refmiscinfo>
41105</refmeta>
41106<refnamediv>
41107 <refname>snd_pcm_lib_preallocate_pages_for_all</refname>
41108 <refpurpose>
41109     pre-allocation for continuous memory type (all substreams)
41110 </refpurpose>
41111</refnamediv>
41112<refsynopsisdiv>
41113 <title>Synopsis</title>
41114  <funcsynopsis><funcprototype>
41115   <funcdef>int <function>snd_pcm_lib_preallocate_pages_for_all </function></funcdef>
41116   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
41117   <paramdef>int <parameter>type</parameter></paramdef>
41118   <paramdef>void * <parameter>data</parameter></paramdef>
41119   <paramdef>size_t <parameter>size</parameter></paramdef>
41120   <paramdef>size_t <parameter>max</parameter></paramdef>
41121  </funcprototype></funcsynopsis>
41122</refsynopsisdiv>
41123<refsect1>
41124 <title>Arguments</title>
41125 <variablelist>
41126  <varlistentry>
41127   <term><parameter>pcm</parameter></term>
41128   <listitem>
41129    <para>
41130     the pcm instance
41131    </para>
41132   </listitem>
41133  </varlistentry>
41134  <varlistentry>
41135   <term><parameter>type</parameter></term>
41136   <listitem>
41137    <para>
41138     DMA type (SNDRV_DMA_TYPE_*)
41139    </para>
41140   </listitem>
41141  </varlistentry>
41142  <varlistentry>
41143   <term><parameter>data</parameter></term>
41144   <listitem>
41145    <para>
41146     DMA type dependent data
41147    </para>
41148   </listitem>
41149  </varlistentry>
41150  <varlistentry>
41151   <term><parameter>size</parameter></term>
41152   <listitem>
41153    <para>
41154     the requested pre-allocation size in bytes
41155    </para>
41156   </listitem>
41157  </varlistentry>
41158  <varlistentry>
41159   <term><parameter>max</parameter></term>
41160   <listitem>
41161    <para>
41162     the max. allowed pre-allocation size
41163    </para>
41164   </listitem>
41165  </varlistentry>
41166 </variablelist>
41167</refsect1>
41168<refsect1>
41169<title>Description</title>
41170<para>
41171   Do pre-allocation to all substreams of the given pcm for the
41172   specified DMA type.
41173</para>
41174</refsect1>
41175<refsect1>
41176<title>Return</title>
41177<para>
41178   Zero if successful, or a negative error code on failure.
41179</para>
41180</refsect1>
41181</refentry>
41182
41183<refentry id="API-snd-pcm-sgbuf-ops-page">
41184<refentryinfo>
41185 <title>LINUX</title>
41186 <productname>Kernel Hackers Manual</productname>
41187 <date>July 2017</date>
41188</refentryinfo>
41189<refmeta>
41190 <refentrytitle><phrase>snd_pcm_sgbuf_ops_page</phrase></refentrytitle>
41191 <manvolnum>9</manvolnum>
41192 <refmiscinfo class="version">4.1.27</refmiscinfo>
41193</refmeta>
41194<refnamediv>
41195 <refname>snd_pcm_sgbuf_ops_page</refname>
41196 <refpurpose>
41197     get the page struct at the given offset
41198 </refpurpose>
41199</refnamediv>
41200<refsynopsisdiv>
41201 <title>Synopsis</title>
41202  <funcsynopsis><funcprototype>
41203   <funcdef>struct page * <function>snd_pcm_sgbuf_ops_page </function></funcdef>
41204   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
41205   <paramdef>unsigned long <parameter>offset</parameter></paramdef>
41206  </funcprototype></funcsynopsis>
41207</refsynopsisdiv>
41208<refsect1>
41209 <title>Arguments</title>
41210 <variablelist>
41211  <varlistentry>
41212   <term><parameter>substream</parameter></term>
41213   <listitem>
41214    <para>
41215     the pcm substream instance
41216    </para>
41217   </listitem>
41218  </varlistentry>
41219  <varlistentry>
41220   <term><parameter>offset</parameter></term>
41221   <listitem>
41222    <para>
41223     the buffer offset
41224    </para>
41225   </listitem>
41226  </varlistentry>
41227 </variablelist>
41228</refsect1>
41229<refsect1>
41230<title>Description</title>
41231<para>
41232   Used as the page callback of PCM ops.
41233</para>
41234</refsect1>
41235<refsect1>
41236<title>Return</title>
41237<para>
41238   The page struct at the given buffer offset. <constant>NULL</constant> on failure.
41239</para>
41240</refsect1>
41241</refentry>
41242
41243<refentry id="API-snd-pcm-lib-malloc-pages">
41244<refentryinfo>
41245 <title>LINUX</title>
41246 <productname>Kernel Hackers Manual</productname>
41247 <date>July 2017</date>
41248</refentryinfo>
41249<refmeta>
41250 <refentrytitle><phrase>snd_pcm_lib_malloc_pages</phrase></refentrytitle>
41251 <manvolnum>9</manvolnum>
41252 <refmiscinfo class="version">4.1.27</refmiscinfo>
41253</refmeta>
41254<refnamediv>
41255 <refname>snd_pcm_lib_malloc_pages</refname>
41256 <refpurpose>
41257     allocate the DMA buffer
41258 </refpurpose>
41259</refnamediv>
41260<refsynopsisdiv>
41261 <title>Synopsis</title>
41262  <funcsynopsis><funcprototype>
41263   <funcdef>int <function>snd_pcm_lib_malloc_pages </function></funcdef>
41264   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
41265   <paramdef>size_t <parameter>size</parameter></paramdef>
41266  </funcprototype></funcsynopsis>
41267</refsynopsisdiv>
41268<refsect1>
41269 <title>Arguments</title>
41270 <variablelist>
41271  <varlistentry>
41272   <term><parameter>substream</parameter></term>
41273   <listitem>
41274    <para>
41275     the substream to allocate the DMA buffer to
41276    </para>
41277   </listitem>
41278  </varlistentry>
41279  <varlistentry>
41280   <term><parameter>size</parameter></term>
41281   <listitem>
41282    <para>
41283     the requested buffer size in bytes
41284    </para>
41285   </listitem>
41286  </varlistentry>
41287 </variablelist>
41288</refsect1>
41289<refsect1>
41290<title>Description</title>
41291<para>
41292   Allocates the DMA buffer on the BUS type given earlier to
41293   <function>snd_pcm_lib_preallocate_xxx_pages</function>.
41294</para>
41295</refsect1>
41296<refsect1>
41297<title>Return</title>
41298<para>
41299   1 if the buffer is changed, 0 if not changed, or a negative
41300   code on failure.
41301</para>
41302</refsect1>
41303</refentry>
41304
41305<refentry id="API-snd-pcm-lib-free-pages">
41306<refentryinfo>
41307 <title>LINUX</title>
41308 <productname>Kernel Hackers Manual</productname>
41309 <date>July 2017</date>
41310</refentryinfo>
41311<refmeta>
41312 <refentrytitle><phrase>snd_pcm_lib_free_pages</phrase></refentrytitle>
41313 <manvolnum>9</manvolnum>
41314 <refmiscinfo class="version">4.1.27</refmiscinfo>
41315</refmeta>
41316<refnamediv>
41317 <refname>snd_pcm_lib_free_pages</refname>
41318 <refpurpose>
41319     release the allocated DMA buffer.
41320 </refpurpose>
41321</refnamediv>
41322<refsynopsisdiv>
41323 <title>Synopsis</title>
41324  <funcsynopsis><funcprototype>
41325   <funcdef>int <function>snd_pcm_lib_free_pages </function></funcdef>
41326   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
41327  </funcprototype></funcsynopsis>
41328</refsynopsisdiv>
41329<refsect1>
41330 <title>Arguments</title>
41331 <variablelist>
41332  <varlistentry>
41333   <term><parameter>substream</parameter></term>
41334   <listitem>
41335    <para>
41336     the substream to release the DMA buffer
41337    </para>
41338   </listitem>
41339  </varlistentry>
41340 </variablelist>
41341</refsect1>
41342<refsect1>
41343<title>Description</title>
41344<para>
41345   Releases the DMA buffer allocated via <function>snd_pcm_lib_malloc_pages</function>.
41346</para>
41347</refsect1>
41348<refsect1>
41349<title>Return</title>
41350<para>
41351   Zero if successful, or a negative error code on failure.
41352</para>
41353</refsect1>
41354</refentry>
41355
41356<refentry id="API-snd-pcm-lib-free-vmalloc-buffer">
41357<refentryinfo>
41358 <title>LINUX</title>
41359 <productname>Kernel Hackers Manual</productname>
41360 <date>July 2017</date>
41361</refentryinfo>
41362<refmeta>
41363 <refentrytitle><phrase>snd_pcm_lib_free_vmalloc_buffer</phrase></refentrytitle>
41364 <manvolnum>9</manvolnum>
41365 <refmiscinfo class="version">4.1.27</refmiscinfo>
41366</refmeta>
41367<refnamediv>
41368 <refname>snd_pcm_lib_free_vmalloc_buffer</refname>
41369 <refpurpose>
41370     free vmalloc buffer
41371 </refpurpose>
41372</refnamediv>
41373<refsynopsisdiv>
41374 <title>Synopsis</title>
41375  <funcsynopsis><funcprototype>
41376   <funcdef>int <function>snd_pcm_lib_free_vmalloc_buffer </function></funcdef>
41377   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
41378  </funcprototype></funcsynopsis>
41379</refsynopsisdiv>
41380<refsect1>
41381 <title>Arguments</title>
41382 <variablelist>
41383  <varlistentry>
41384   <term><parameter>substream</parameter></term>
41385   <listitem>
41386    <para>
41387     the substream with a buffer allocated by
41388     <function>snd_pcm_lib_alloc_vmalloc_buffer</function>
41389    </para>
41390   </listitem>
41391  </varlistentry>
41392 </variablelist>
41393</refsect1>
41394<refsect1>
41395<title>Return</title>
41396<para>
41397   Zero if successful, or a negative error code on failure.
41398</para>
41399</refsect1>
41400</refentry>
41401
41402<refentry id="API-snd-pcm-lib-get-vmalloc-page">
41403<refentryinfo>
41404 <title>LINUX</title>
41405 <productname>Kernel Hackers Manual</productname>
41406 <date>July 2017</date>
41407</refentryinfo>
41408<refmeta>
41409 <refentrytitle><phrase>snd_pcm_lib_get_vmalloc_page</phrase></refentrytitle>
41410 <manvolnum>9</manvolnum>
41411 <refmiscinfo class="version">4.1.27</refmiscinfo>
41412</refmeta>
41413<refnamediv>
41414 <refname>snd_pcm_lib_get_vmalloc_page</refname>
41415 <refpurpose>
41416     map vmalloc buffer offset to page struct
41417 </refpurpose>
41418</refnamediv>
41419<refsynopsisdiv>
41420 <title>Synopsis</title>
41421  <funcsynopsis><funcprototype>
41422   <funcdef>struct page * <function>snd_pcm_lib_get_vmalloc_page </function></funcdef>
41423   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
41424   <paramdef>unsigned long <parameter>offset</parameter></paramdef>
41425  </funcprototype></funcsynopsis>
41426</refsynopsisdiv>
41427<refsect1>
41428 <title>Arguments</title>
41429 <variablelist>
41430  <varlistentry>
41431   <term><parameter>substream</parameter></term>
41432   <listitem>
41433    <para>
41434     the substream with a buffer allocated by
41435     <function>snd_pcm_lib_alloc_vmalloc_buffer</function>
41436    </para>
41437   </listitem>
41438  </varlistentry>
41439  <varlistentry>
41440   <term><parameter>offset</parameter></term>
41441   <listitem>
41442    <para>
41443     offset in the buffer
41444    </para>
41445   </listitem>
41446  </varlistentry>
41447 </variablelist>
41448</refsect1>
41449<refsect1>
41450<title>Description</title>
41451<para>
41452   This function is to be used as the page callback in the PCM ops.
41453</para>
41454</refsect1>
41455<refsect1>
41456<title>Return</title>
41457<para>
41458   The page struct, or <constant>NULL</constant> on failure.
41459</para>
41460</refsect1>
41461</refentry>
41462
41463<!-- sound/core/init.c -->
41464<refentry id="API-snd-device-initialize">
41465<refentryinfo>
41466 <title>LINUX</title>
41467 <productname>Kernel Hackers Manual</productname>
41468 <date>July 2017</date>
41469</refentryinfo>
41470<refmeta>
41471 <refentrytitle><phrase>snd_device_initialize</phrase></refentrytitle>
41472 <manvolnum>9</manvolnum>
41473 <refmiscinfo class="version">4.1.27</refmiscinfo>
41474</refmeta>
41475<refnamediv>
41476 <refname>snd_device_initialize</refname>
41477 <refpurpose>
41478  Initialize struct device for sound devices
41479 </refpurpose>
41480</refnamediv>
41481<refsynopsisdiv>
41482 <title>Synopsis</title>
41483  <funcsynopsis><funcprototype>
41484   <funcdef>void <function>snd_device_initialize </function></funcdef>
41485   <paramdef>struct device * <parameter>dev</parameter></paramdef>
41486   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41487  </funcprototype></funcsynopsis>
41488</refsynopsisdiv>
41489<refsect1>
41490 <title>Arguments</title>
41491 <variablelist>
41492  <varlistentry>
41493   <term><parameter>dev</parameter></term>
41494   <listitem>
41495    <para>
41496     device to initialize
41497    </para>
41498   </listitem>
41499  </varlistentry>
41500  <varlistentry>
41501   <term><parameter>card</parameter></term>
41502   <listitem>
41503    <para>
41504     card to assign, optional
41505    </para>
41506   </listitem>
41507  </varlistentry>
41508 </variablelist>
41509</refsect1>
41510</refentry>
41511
41512<refentry id="API-snd-card-new">
41513<refentryinfo>
41514 <title>LINUX</title>
41515 <productname>Kernel Hackers Manual</productname>
41516 <date>July 2017</date>
41517</refentryinfo>
41518<refmeta>
41519 <refentrytitle><phrase>snd_card_new</phrase></refentrytitle>
41520 <manvolnum>9</manvolnum>
41521 <refmiscinfo class="version">4.1.27</refmiscinfo>
41522</refmeta>
41523<refnamediv>
41524 <refname>snd_card_new</refname>
41525 <refpurpose>
41526     create and initialize a soundcard structure
41527 </refpurpose>
41528</refnamediv>
41529<refsynopsisdiv>
41530 <title>Synopsis</title>
41531  <funcsynopsis><funcprototype>
41532   <funcdef>int <function>snd_card_new </function></funcdef>
41533   <paramdef>struct device * <parameter>parent</parameter></paramdef>
41534   <paramdef>int <parameter>idx</parameter></paramdef>
41535   <paramdef>const char * <parameter>xid</parameter></paramdef>
41536   <paramdef>struct module * <parameter>module</parameter></paramdef>
41537   <paramdef>int <parameter>extra_size</parameter></paramdef>
41538   <paramdef>struct snd_card ** <parameter>card_ret</parameter></paramdef>
41539  </funcprototype></funcsynopsis>
41540</refsynopsisdiv>
41541<refsect1>
41542 <title>Arguments</title>
41543 <variablelist>
41544  <varlistentry>
41545   <term><parameter>parent</parameter></term>
41546   <listitem>
41547    <para>
41548     the parent device object
41549    </para>
41550   </listitem>
41551  </varlistentry>
41552  <varlistentry>
41553   <term><parameter>idx</parameter></term>
41554   <listitem>
41555    <para>
41556     card index (address) [0 ... (SNDRV_CARDS-1)]
41557    </para>
41558   </listitem>
41559  </varlistentry>
41560  <varlistentry>
41561   <term><parameter>xid</parameter></term>
41562   <listitem>
41563    <para>
41564     card identification (ASCII string)
41565    </para>
41566   </listitem>
41567  </varlistentry>
41568  <varlistentry>
41569   <term><parameter>module</parameter></term>
41570   <listitem>
41571    <para>
41572     top level module for locking
41573    </para>
41574   </listitem>
41575  </varlistentry>
41576  <varlistentry>
41577   <term><parameter>extra_size</parameter></term>
41578   <listitem>
41579    <para>
41580     allocate this extra size after the main soundcard structure
41581    </para>
41582   </listitem>
41583  </varlistentry>
41584  <varlistentry>
41585   <term><parameter>card_ret</parameter></term>
41586   <listitem>
41587    <para>
41588     the pointer to store the created card instance
41589    </para>
41590   </listitem>
41591  </varlistentry>
41592 </variablelist>
41593</refsect1>
41594<refsect1>
41595<title>Description</title>
41596<para>
41597   Creates and initializes a soundcard structure.
41598   </para><para>
41599
41600   The function allocates snd_card instance via kzalloc with the given
41601   space for the driver to use freely.  The allocated struct is stored
41602   in the given card_ret pointer.
41603</para>
41604</refsect1>
41605<refsect1>
41606<title>Return</title>
41607<para>
41608   Zero if successful or a negative error code.
41609</para>
41610</refsect1>
41611</refentry>
41612
41613<refentry id="API-snd-card-disconnect">
41614<refentryinfo>
41615 <title>LINUX</title>
41616 <productname>Kernel Hackers Manual</productname>
41617 <date>July 2017</date>
41618</refentryinfo>
41619<refmeta>
41620 <refentrytitle><phrase>snd_card_disconnect</phrase></refentrytitle>
41621 <manvolnum>9</manvolnum>
41622 <refmiscinfo class="version">4.1.27</refmiscinfo>
41623</refmeta>
41624<refnamediv>
41625 <refname>snd_card_disconnect</refname>
41626 <refpurpose>
41627     disconnect all APIs from the file-operations (user space)
41628 </refpurpose>
41629</refnamediv>
41630<refsynopsisdiv>
41631 <title>Synopsis</title>
41632  <funcsynopsis><funcprototype>
41633   <funcdef>int <function>snd_card_disconnect </function></funcdef>
41634   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41635  </funcprototype></funcsynopsis>
41636</refsynopsisdiv>
41637<refsect1>
41638 <title>Arguments</title>
41639 <variablelist>
41640  <varlistentry>
41641   <term><parameter>card</parameter></term>
41642   <listitem>
41643    <para>
41644     soundcard structure
41645    </para>
41646   </listitem>
41647  </varlistentry>
41648 </variablelist>
41649</refsect1>
41650<refsect1>
41651<title>Description</title>
41652<para>
41653   Disconnects all APIs from the file-operations (user space).
41654</para>
41655</refsect1>
41656<refsect1>
41657<title>Return</title>
41658<para>
41659   Zero, otherwise a negative error code.
41660</para>
41661</refsect1>
41662<refsect1>
41663<title>Note</title>
41664<para>
41665   The current implementation replaces all active file-&gt;f_op with special
41666   dummy file operations (they do nothing except release).
41667</para>
41668</refsect1>
41669</refentry>
41670
41671<refentry id="API-snd-card-free-when-closed">
41672<refentryinfo>
41673 <title>LINUX</title>
41674 <productname>Kernel Hackers Manual</productname>
41675 <date>July 2017</date>
41676</refentryinfo>
41677<refmeta>
41678 <refentrytitle><phrase>snd_card_free_when_closed</phrase></refentrytitle>
41679 <manvolnum>9</manvolnum>
41680 <refmiscinfo class="version">4.1.27</refmiscinfo>
41681</refmeta>
41682<refnamediv>
41683 <refname>snd_card_free_when_closed</refname>
41684 <refpurpose>
41685     Disconnect the card, free it later eventually
41686 </refpurpose>
41687</refnamediv>
41688<refsynopsisdiv>
41689 <title>Synopsis</title>
41690  <funcsynopsis><funcprototype>
41691   <funcdef>int <function>snd_card_free_when_closed </function></funcdef>
41692   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41693  </funcprototype></funcsynopsis>
41694</refsynopsisdiv>
41695<refsect1>
41696 <title>Arguments</title>
41697 <variablelist>
41698  <varlistentry>
41699   <term><parameter>card</parameter></term>
41700   <listitem>
41701    <para>
41702     soundcard structure
41703    </para>
41704   </listitem>
41705  </varlistentry>
41706 </variablelist>
41707</refsect1>
41708<refsect1>
41709<title>Description</title>
41710<para>
41711   Unlike <function>snd_card_free</function>, this function doesn't try to release the card
41712   resource immediately, but tries to disconnect at first.  When the card
41713   is still in use, the function returns before freeing the resources.
41714   The card resources will be freed when the refcount gets to zero.
41715</para>
41716</refsect1>
41717</refentry>
41718
41719<refentry id="API-snd-card-free">
41720<refentryinfo>
41721 <title>LINUX</title>
41722 <productname>Kernel Hackers Manual</productname>
41723 <date>July 2017</date>
41724</refentryinfo>
41725<refmeta>
41726 <refentrytitle><phrase>snd_card_free</phrase></refentrytitle>
41727 <manvolnum>9</manvolnum>
41728 <refmiscinfo class="version">4.1.27</refmiscinfo>
41729</refmeta>
41730<refnamediv>
41731 <refname>snd_card_free</refname>
41732 <refpurpose>
41733     frees given soundcard structure
41734 </refpurpose>
41735</refnamediv>
41736<refsynopsisdiv>
41737 <title>Synopsis</title>
41738  <funcsynopsis><funcprototype>
41739   <funcdef>int <function>snd_card_free </function></funcdef>
41740   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41741  </funcprototype></funcsynopsis>
41742</refsynopsisdiv>
41743<refsect1>
41744 <title>Arguments</title>
41745 <variablelist>
41746  <varlistentry>
41747   <term><parameter>card</parameter></term>
41748   <listitem>
41749    <para>
41750     soundcard structure
41751    </para>
41752   </listitem>
41753  </varlistentry>
41754 </variablelist>
41755</refsect1>
41756<refsect1>
41757<title>Description</title>
41758<para>
41759   This function releases the soundcard structure and the all assigned
41760   devices automatically.  That is, you don't have to release the devices
41761   by yourself.
41762   </para><para>
41763
41764   This function waits until the all resources are properly released.
41765</para>
41766</refsect1>
41767<refsect1>
41768<title>Return</title>
41769<para>
41770   Zero. Frees all associated devices and frees the control
41771   interface associated to given soundcard.
41772</para>
41773</refsect1>
41774</refentry>
41775
41776<refentry id="API-snd-card-set-id">
41777<refentryinfo>
41778 <title>LINUX</title>
41779 <productname>Kernel Hackers Manual</productname>
41780 <date>July 2017</date>
41781</refentryinfo>
41782<refmeta>
41783 <refentrytitle><phrase>snd_card_set_id</phrase></refentrytitle>
41784 <manvolnum>9</manvolnum>
41785 <refmiscinfo class="version">4.1.27</refmiscinfo>
41786</refmeta>
41787<refnamediv>
41788 <refname>snd_card_set_id</refname>
41789 <refpurpose>
41790     set card identification name
41791 </refpurpose>
41792</refnamediv>
41793<refsynopsisdiv>
41794 <title>Synopsis</title>
41795  <funcsynopsis><funcprototype>
41796   <funcdef>void <function>snd_card_set_id </function></funcdef>
41797   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41798   <paramdef>const char * <parameter>nid</parameter></paramdef>
41799  </funcprototype></funcsynopsis>
41800</refsynopsisdiv>
41801<refsect1>
41802 <title>Arguments</title>
41803 <variablelist>
41804  <varlistentry>
41805   <term><parameter>card</parameter></term>
41806   <listitem>
41807    <para>
41808     soundcard structure
41809    </para>
41810   </listitem>
41811  </varlistentry>
41812  <varlistentry>
41813   <term><parameter>nid</parameter></term>
41814   <listitem>
41815    <para>
41816     new identification string
41817    </para>
41818   </listitem>
41819  </varlistentry>
41820 </variablelist>
41821</refsect1>
41822<refsect1>
41823<title>Description</title>
41824<para>
41825   This function sets the card identification and checks for name
41826   collisions.
41827</para>
41828</refsect1>
41829</refentry>
41830
41831<refentry id="API-snd-card-add-dev-attr">
41832<refentryinfo>
41833 <title>LINUX</title>
41834 <productname>Kernel Hackers Manual</productname>
41835 <date>July 2017</date>
41836</refentryinfo>
41837<refmeta>
41838 <refentrytitle><phrase>snd_card_add_dev_attr</phrase></refentrytitle>
41839 <manvolnum>9</manvolnum>
41840 <refmiscinfo class="version">4.1.27</refmiscinfo>
41841</refmeta>
41842<refnamediv>
41843 <refname>snd_card_add_dev_attr</refname>
41844 <refpurpose>
41845     Append a new sysfs attribute group to card
41846 </refpurpose>
41847</refnamediv>
41848<refsynopsisdiv>
41849 <title>Synopsis</title>
41850  <funcsynopsis><funcprototype>
41851   <funcdef>int <function>snd_card_add_dev_attr </function></funcdef>
41852   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41853   <paramdef>const struct attribute_group * <parameter>group</parameter></paramdef>
41854  </funcprototype></funcsynopsis>
41855</refsynopsisdiv>
41856<refsect1>
41857 <title>Arguments</title>
41858 <variablelist>
41859  <varlistentry>
41860   <term><parameter>card</parameter></term>
41861   <listitem>
41862    <para>
41863     card instance
41864    </para>
41865   </listitem>
41866  </varlistentry>
41867  <varlistentry>
41868   <term><parameter>group</parameter></term>
41869   <listitem>
41870    <para>
41871     attribute group to append
41872    </para>
41873   </listitem>
41874  </varlistentry>
41875 </variablelist>
41876</refsect1>
41877</refentry>
41878
41879<refentry id="API-snd-card-register">
41880<refentryinfo>
41881 <title>LINUX</title>
41882 <productname>Kernel Hackers Manual</productname>
41883 <date>July 2017</date>
41884</refentryinfo>
41885<refmeta>
41886 <refentrytitle><phrase>snd_card_register</phrase></refentrytitle>
41887 <manvolnum>9</manvolnum>
41888 <refmiscinfo class="version">4.1.27</refmiscinfo>
41889</refmeta>
41890<refnamediv>
41891 <refname>snd_card_register</refname>
41892 <refpurpose>
41893     register the soundcard
41894 </refpurpose>
41895</refnamediv>
41896<refsynopsisdiv>
41897 <title>Synopsis</title>
41898  <funcsynopsis><funcprototype>
41899   <funcdef>int <function>snd_card_register </function></funcdef>
41900   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41901  </funcprototype></funcsynopsis>
41902</refsynopsisdiv>
41903<refsect1>
41904 <title>Arguments</title>
41905 <variablelist>
41906  <varlistentry>
41907   <term><parameter>card</parameter></term>
41908   <listitem>
41909    <para>
41910     soundcard structure
41911    </para>
41912   </listitem>
41913  </varlistentry>
41914 </variablelist>
41915</refsect1>
41916<refsect1>
41917<title>Description</title>
41918<para>
41919   This function registers all the devices assigned to the soundcard.
41920   Until calling this, the ALSA control interface is blocked from the
41921   external accesses.  Thus, you should call this function at the end
41922   of the initialization of the card.
41923</para>
41924</refsect1>
41925<refsect1>
41926<title>Return</title>
41927<para>
41928   Zero otherwise a negative error code if the registration failed.
41929</para>
41930</refsect1>
41931</refentry>
41932
41933<refentry id="API-snd-component-add">
41934<refentryinfo>
41935 <title>LINUX</title>
41936 <productname>Kernel Hackers Manual</productname>
41937 <date>July 2017</date>
41938</refentryinfo>
41939<refmeta>
41940 <refentrytitle><phrase>snd_component_add</phrase></refentrytitle>
41941 <manvolnum>9</manvolnum>
41942 <refmiscinfo class="version">4.1.27</refmiscinfo>
41943</refmeta>
41944<refnamediv>
41945 <refname>snd_component_add</refname>
41946 <refpurpose>
41947     add a component string
41948 </refpurpose>
41949</refnamediv>
41950<refsynopsisdiv>
41951 <title>Synopsis</title>
41952  <funcsynopsis><funcprototype>
41953   <funcdef>int <function>snd_component_add </function></funcdef>
41954   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41955   <paramdef>const char * <parameter>component</parameter></paramdef>
41956  </funcprototype></funcsynopsis>
41957</refsynopsisdiv>
41958<refsect1>
41959 <title>Arguments</title>
41960 <variablelist>
41961  <varlistentry>
41962   <term><parameter>card</parameter></term>
41963   <listitem>
41964    <para>
41965     soundcard structure
41966    </para>
41967   </listitem>
41968  </varlistentry>
41969  <varlistentry>
41970   <term><parameter>component</parameter></term>
41971   <listitem>
41972    <para>
41973     the component id string
41974    </para>
41975   </listitem>
41976  </varlistentry>
41977 </variablelist>
41978</refsect1>
41979<refsect1>
41980<title>Description</title>
41981<para>
41982   This function adds the component id string to the supported list.
41983   The component can be referred from the alsa-lib.
41984</para>
41985</refsect1>
41986<refsect1>
41987<title>Return</title>
41988<para>
41989   Zero otherwise a negative error code.
41990</para>
41991</refsect1>
41992</refentry>
41993
41994<refentry id="API-snd-card-file-add">
41995<refentryinfo>
41996 <title>LINUX</title>
41997 <productname>Kernel Hackers Manual</productname>
41998 <date>July 2017</date>
41999</refentryinfo>
42000<refmeta>
42001 <refentrytitle><phrase>snd_card_file_add</phrase></refentrytitle>
42002 <manvolnum>9</manvolnum>
42003 <refmiscinfo class="version">4.1.27</refmiscinfo>
42004</refmeta>
42005<refnamediv>
42006 <refname>snd_card_file_add</refname>
42007 <refpurpose>
42008     add the file to the file list of the card
42009 </refpurpose>
42010</refnamediv>
42011<refsynopsisdiv>
42012 <title>Synopsis</title>
42013  <funcsynopsis><funcprototype>
42014   <funcdef>int <function>snd_card_file_add </function></funcdef>
42015   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42016   <paramdef>struct file * <parameter>file</parameter></paramdef>
42017  </funcprototype></funcsynopsis>
42018</refsynopsisdiv>
42019<refsect1>
42020 <title>Arguments</title>
42021 <variablelist>
42022  <varlistentry>
42023   <term><parameter>card</parameter></term>
42024   <listitem>
42025    <para>
42026     soundcard structure
42027    </para>
42028   </listitem>
42029  </varlistentry>
42030  <varlistentry>
42031   <term><parameter>file</parameter></term>
42032   <listitem>
42033    <para>
42034     file pointer
42035    </para>
42036   </listitem>
42037  </varlistentry>
42038 </variablelist>
42039</refsect1>
42040<refsect1>
42041<title>Description</title>
42042<para>
42043   This function adds the file to the file linked-list of the card.
42044   This linked-list is used to keep tracking the connection state,
42045   and to avoid the release of busy resources by hotplug.
42046</para>
42047</refsect1>
42048<refsect1>
42049<title>Return</title>
42050<para>
42051   zero or a negative error code.
42052</para>
42053</refsect1>
42054</refentry>
42055
42056<refentry id="API-snd-card-file-remove">
42057<refentryinfo>
42058 <title>LINUX</title>
42059 <productname>Kernel Hackers Manual</productname>
42060 <date>July 2017</date>
42061</refentryinfo>
42062<refmeta>
42063 <refentrytitle><phrase>snd_card_file_remove</phrase></refentrytitle>
42064 <manvolnum>9</manvolnum>
42065 <refmiscinfo class="version">4.1.27</refmiscinfo>
42066</refmeta>
42067<refnamediv>
42068 <refname>snd_card_file_remove</refname>
42069 <refpurpose>
42070     remove the file from the file list
42071 </refpurpose>
42072</refnamediv>
42073<refsynopsisdiv>
42074 <title>Synopsis</title>
42075  <funcsynopsis><funcprototype>
42076   <funcdef>int <function>snd_card_file_remove </function></funcdef>
42077   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42078   <paramdef>struct file * <parameter>file</parameter></paramdef>
42079  </funcprototype></funcsynopsis>
42080</refsynopsisdiv>
42081<refsect1>
42082 <title>Arguments</title>
42083 <variablelist>
42084  <varlistentry>
42085   <term><parameter>card</parameter></term>
42086   <listitem>
42087    <para>
42088     soundcard structure
42089    </para>
42090   </listitem>
42091  </varlistentry>
42092  <varlistentry>
42093   <term><parameter>file</parameter></term>
42094   <listitem>
42095    <para>
42096     file pointer
42097    </para>
42098   </listitem>
42099  </varlistentry>
42100 </variablelist>
42101</refsect1>
42102<refsect1>
42103<title>Description</title>
42104<para>
42105   This function removes the file formerly added to the card via
42106   <function>snd_card_file_add</function> function.
42107   If all files are removed and <function>snd_card_free_when_closed</function> was
42108   called beforehand, it processes the pending release of
42109   resources.
42110</para>
42111</refsect1>
42112<refsect1>
42113<title>Return</title>
42114<para>
42115   Zero or a negative error code.
42116</para>
42117</refsect1>
42118</refentry>
42119
42120<refentry id="API-snd-power-wait">
42121<refentryinfo>
42122 <title>LINUX</title>
42123 <productname>Kernel Hackers Manual</productname>
42124 <date>July 2017</date>
42125</refentryinfo>
42126<refmeta>
42127 <refentrytitle><phrase>snd_power_wait</phrase></refentrytitle>
42128 <manvolnum>9</manvolnum>
42129 <refmiscinfo class="version">4.1.27</refmiscinfo>
42130</refmeta>
42131<refnamediv>
42132 <refname>snd_power_wait</refname>
42133 <refpurpose>
42134     wait until the power-state is changed.
42135 </refpurpose>
42136</refnamediv>
42137<refsynopsisdiv>
42138 <title>Synopsis</title>
42139  <funcsynopsis><funcprototype>
42140   <funcdef>int <function>snd_power_wait </function></funcdef>
42141   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42142   <paramdef>unsigned int <parameter>power_state</parameter></paramdef>
42143  </funcprototype></funcsynopsis>
42144</refsynopsisdiv>
42145<refsect1>
42146 <title>Arguments</title>
42147 <variablelist>
42148  <varlistentry>
42149   <term><parameter>card</parameter></term>
42150   <listitem>
42151    <para>
42152     soundcard structure
42153    </para>
42154   </listitem>
42155  </varlistentry>
42156  <varlistentry>
42157   <term><parameter>power_state</parameter></term>
42158   <listitem>
42159    <para>
42160     expected power state
42161    </para>
42162   </listitem>
42163  </varlistentry>
42164 </variablelist>
42165</refsect1>
42166<refsect1>
42167<title>Description</title>
42168<para>
42169   Waits until the power-state is changed.
42170</para>
42171</refsect1>
42172<refsect1>
42173<title>Return</title>
42174<para>
42175   Zero if successful, or a negative error code.
42176</para>
42177</refsect1>
42178<refsect1>
42179<title>Note</title>
42180<para>
42181   the power lock must be active before call.
42182</para>
42183</refsect1>
42184</refentry>
42185
42186<!-- sound/core/isadma.c -->
42187<refentry id="API-snd-dma-program">
42188<refentryinfo>
42189 <title>LINUX</title>
42190 <productname>Kernel Hackers Manual</productname>
42191 <date>July 2017</date>
42192</refentryinfo>
42193<refmeta>
42194 <refentrytitle><phrase>snd_dma_program</phrase></refentrytitle>
42195 <manvolnum>9</manvolnum>
42196 <refmiscinfo class="version">4.1.27</refmiscinfo>
42197</refmeta>
42198<refnamediv>
42199 <refname>snd_dma_program</refname>
42200 <refpurpose>
42201  program an ISA DMA transfer
42202 </refpurpose>
42203</refnamediv>
42204<refsynopsisdiv>
42205 <title>Synopsis</title>
42206  <funcsynopsis><funcprototype>
42207   <funcdef>void <function>snd_dma_program </function></funcdef>
42208   <paramdef>unsigned long <parameter>dma</parameter></paramdef>
42209   <paramdef>unsigned long <parameter>addr</parameter></paramdef>
42210   <paramdef>unsigned int <parameter>size</parameter></paramdef>
42211   <paramdef>unsigned short <parameter>mode</parameter></paramdef>
42212  </funcprototype></funcsynopsis>
42213</refsynopsisdiv>
42214<refsect1>
42215 <title>Arguments</title>
42216 <variablelist>
42217  <varlistentry>
42218   <term><parameter>dma</parameter></term>
42219   <listitem>
42220    <para>
42221     the dma number
42222    </para>
42223   </listitem>
42224  </varlistentry>
42225  <varlistentry>
42226   <term><parameter>addr</parameter></term>
42227   <listitem>
42228    <para>
42229     the physical address of the buffer
42230    </para>
42231   </listitem>
42232  </varlistentry>
42233  <varlistentry>
42234   <term><parameter>size</parameter></term>
42235   <listitem>
42236    <para>
42237     the DMA transfer size
42238    </para>
42239   </listitem>
42240  </varlistentry>
42241  <varlistentry>
42242   <term><parameter>mode</parameter></term>
42243   <listitem>
42244    <para>
42245     the DMA transfer mode, DMA_MODE_XXX
42246    </para>
42247   </listitem>
42248  </varlistentry>
42249 </variablelist>
42250</refsect1>
42251<refsect1>
42252<title>Description</title>
42253<para>
42254   Programs an ISA DMA transfer for the given buffer.
42255</para>
42256</refsect1>
42257</refentry>
42258
42259<refentry id="API-snd-dma-disable">
42260<refentryinfo>
42261 <title>LINUX</title>
42262 <productname>Kernel Hackers Manual</productname>
42263 <date>July 2017</date>
42264</refentryinfo>
42265<refmeta>
42266 <refentrytitle><phrase>snd_dma_disable</phrase></refentrytitle>
42267 <manvolnum>9</manvolnum>
42268 <refmiscinfo class="version">4.1.27</refmiscinfo>
42269</refmeta>
42270<refnamediv>
42271 <refname>snd_dma_disable</refname>
42272 <refpurpose>
42273     stop the ISA DMA transfer
42274 </refpurpose>
42275</refnamediv>
42276<refsynopsisdiv>
42277 <title>Synopsis</title>
42278  <funcsynopsis><funcprototype>
42279   <funcdef>void <function>snd_dma_disable </function></funcdef>
42280   <paramdef>unsigned long <parameter>dma</parameter></paramdef>
42281  </funcprototype></funcsynopsis>
42282</refsynopsisdiv>
42283<refsect1>
42284 <title>Arguments</title>
42285 <variablelist>
42286  <varlistentry>
42287   <term><parameter>dma</parameter></term>
42288   <listitem>
42289    <para>
42290     the dma number
42291    </para>
42292   </listitem>
42293  </varlistentry>
42294 </variablelist>
42295</refsect1>
42296<refsect1>
42297<title>Description</title>
42298<para>
42299   Stops the ISA DMA transfer.
42300</para>
42301</refsect1>
42302</refentry>
42303
42304<refentry id="API-snd-dma-pointer">
42305<refentryinfo>
42306 <title>LINUX</title>
42307 <productname>Kernel Hackers Manual</productname>
42308 <date>July 2017</date>
42309</refentryinfo>
42310<refmeta>
42311 <refentrytitle><phrase>snd_dma_pointer</phrase></refentrytitle>
42312 <manvolnum>9</manvolnum>
42313 <refmiscinfo class="version">4.1.27</refmiscinfo>
42314</refmeta>
42315<refnamediv>
42316 <refname>snd_dma_pointer</refname>
42317 <refpurpose>
42318     return the current pointer to DMA transfer buffer in bytes
42319 </refpurpose>
42320</refnamediv>
42321<refsynopsisdiv>
42322 <title>Synopsis</title>
42323  <funcsynopsis><funcprototype>
42324   <funcdef>unsigned int <function>snd_dma_pointer </function></funcdef>
42325   <paramdef>unsigned long <parameter>dma</parameter></paramdef>
42326   <paramdef>unsigned int <parameter>size</parameter></paramdef>
42327  </funcprototype></funcsynopsis>
42328</refsynopsisdiv>
42329<refsect1>
42330 <title>Arguments</title>
42331 <variablelist>
42332  <varlistentry>
42333   <term><parameter>dma</parameter></term>
42334   <listitem>
42335    <para>
42336     the dma number
42337    </para>
42338   </listitem>
42339  </varlistentry>
42340  <varlistentry>
42341   <term><parameter>size</parameter></term>
42342   <listitem>
42343    <para>
42344     the dma transfer size
42345    </para>
42346   </listitem>
42347  </varlistentry>
42348 </variablelist>
42349</refsect1>
42350<refsect1>
42351<title>Return</title>
42352<para>
42353   The current pointer in DMA transfer buffer in bytes.
42354</para>
42355</refsect1>
42356</refentry>
42357
42358<!-- sound/core/control.c -->
42359<refentry id="API-snd-ctl-notify">
42360<refentryinfo>
42361 <title>LINUX</title>
42362 <productname>Kernel Hackers Manual</productname>
42363 <date>July 2017</date>
42364</refentryinfo>
42365<refmeta>
42366 <refentrytitle><phrase>snd_ctl_notify</phrase></refentrytitle>
42367 <manvolnum>9</manvolnum>
42368 <refmiscinfo class="version">4.1.27</refmiscinfo>
42369</refmeta>
42370<refnamediv>
42371 <refname>snd_ctl_notify</refname>
42372 <refpurpose>
42373  Send notification to user-space for a control change
42374 </refpurpose>
42375</refnamediv>
42376<refsynopsisdiv>
42377 <title>Synopsis</title>
42378  <funcsynopsis><funcprototype>
42379   <funcdef>void <function>snd_ctl_notify </function></funcdef>
42380   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42381   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
42382   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
42383  </funcprototype></funcsynopsis>
42384</refsynopsisdiv>
42385<refsect1>
42386 <title>Arguments</title>
42387 <variablelist>
42388  <varlistentry>
42389   <term><parameter>card</parameter></term>
42390   <listitem>
42391    <para>
42392     the card to send notification
42393    </para>
42394   </listitem>
42395  </varlistentry>
42396  <varlistentry>
42397   <term><parameter>mask</parameter></term>
42398   <listitem>
42399    <para>
42400     the event mask, SNDRV_CTL_EVENT_*
42401    </para>
42402   </listitem>
42403  </varlistentry>
42404  <varlistentry>
42405   <term><parameter>id</parameter></term>
42406   <listitem>
42407    <para>
42408     the ctl element id to send notification
42409    </para>
42410   </listitem>
42411  </varlistentry>
42412 </variablelist>
42413</refsect1>
42414<refsect1>
42415<title>Description</title>
42416<para>
42417   This function adds an event record with the given id and mask, appends
42418   to the list and wakes up the user-space for notification.  This can be
42419   called in the atomic context.
42420</para>
42421</refsect1>
42422</refentry>
42423
42424<refentry id="API-snd-ctl-new1">
42425<refentryinfo>
42426 <title>LINUX</title>
42427 <productname>Kernel Hackers Manual</productname>
42428 <date>July 2017</date>
42429</refentryinfo>
42430<refmeta>
42431 <refentrytitle><phrase>snd_ctl_new1</phrase></refentrytitle>
42432 <manvolnum>9</manvolnum>
42433 <refmiscinfo class="version">4.1.27</refmiscinfo>
42434</refmeta>
42435<refnamediv>
42436 <refname>snd_ctl_new1</refname>
42437 <refpurpose>
42438     create a control instance from the template
42439 </refpurpose>
42440</refnamediv>
42441<refsynopsisdiv>
42442 <title>Synopsis</title>
42443  <funcsynopsis><funcprototype>
42444   <funcdef>struct snd_kcontrol * <function>snd_ctl_new1 </function></funcdef>
42445   <paramdef>const struct snd_kcontrol_new * <parameter>ncontrol</parameter></paramdef>
42446   <paramdef>void * <parameter>private_data</parameter></paramdef>
42447  </funcprototype></funcsynopsis>
42448</refsynopsisdiv>
42449<refsect1>
42450 <title>Arguments</title>
42451 <variablelist>
42452  <varlistentry>
42453   <term><parameter>ncontrol</parameter></term>
42454   <listitem>
42455    <para>
42456     the initialization record
42457    </para>
42458   </listitem>
42459  </varlistentry>
42460  <varlistentry>
42461   <term><parameter>private_data</parameter></term>
42462   <listitem>
42463    <para>
42464     the private data to set
42465    </para>
42466   </listitem>
42467  </varlistentry>
42468 </variablelist>
42469</refsect1>
42470<refsect1>
42471<title>Description</title>
42472<para>
42473   Allocates a new struct snd_kcontrol instance and initialize from the given
42474   template.  When the access field of ncontrol is 0, it's assumed as
42475   READWRITE access. When the count field is 0, it's assumes as one.
42476</para>
42477</refsect1>
42478<refsect1>
42479<title>Return</title>
42480<para>
42481   The pointer of the newly generated instance, or <constant>NULL</constant> on failure.
42482</para>
42483</refsect1>
42484</refentry>
42485
42486<refentry id="API-snd-ctl-free-one">
42487<refentryinfo>
42488 <title>LINUX</title>
42489 <productname>Kernel Hackers Manual</productname>
42490 <date>July 2017</date>
42491</refentryinfo>
42492<refmeta>
42493 <refentrytitle><phrase>snd_ctl_free_one</phrase></refentrytitle>
42494 <manvolnum>9</manvolnum>
42495 <refmiscinfo class="version">4.1.27</refmiscinfo>
42496</refmeta>
42497<refnamediv>
42498 <refname>snd_ctl_free_one</refname>
42499 <refpurpose>
42500     release the control instance
42501 </refpurpose>
42502</refnamediv>
42503<refsynopsisdiv>
42504 <title>Synopsis</title>
42505  <funcsynopsis><funcprototype>
42506   <funcdef>void <function>snd_ctl_free_one </function></funcdef>
42507   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
42508  </funcprototype></funcsynopsis>
42509</refsynopsisdiv>
42510<refsect1>
42511 <title>Arguments</title>
42512 <variablelist>
42513  <varlistentry>
42514   <term><parameter>kcontrol</parameter></term>
42515   <listitem>
42516    <para>
42517     the control instance
42518    </para>
42519   </listitem>
42520  </varlistentry>
42521 </variablelist>
42522</refsect1>
42523<refsect1>
42524<title>Description</title>
42525<para>
42526   Releases the control instance created via <function>snd_ctl_new</function>
42527   or <function>snd_ctl_new1</function>.
42528   Don't call this after the control was added to the card.
42529</para>
42530</refsect1>
42531</refentry>
42532
42533<refentry id="API-snd-ctl-add">
42534<refentryinfo>
42535 <title>LINUX</title>
42536 <productname>Kernel Hackers Manual</productname>
42537 <date>July 2017</date>
42538</refentryinfo>
42539<refmeta>
42540 <refentrytitle><phrase>snd_ctl_add</phrase></refentrytitle>
42541 <manvolnum>9</manvolnum>
42542 <refmiscinfo class="version">4.1.27</refmiscinfo>
42543</refmeta>
42544<refnamediv>
42545 <refname>snd_ctl_add</refname>
42546 <refpurpose>
42547     add the control instance to the card
42548 </refpurpose>
42549</refnamediv>
42550<refsynopsisdiv>
42551 <title>Synopsis</title>
42552  <funcsynopsis><funcprototype>
42553   <funcdef>int <function>snd_ctl_add </function></funcdef>
42554   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42555   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
42556  </funcprototype></funcsynopsis>
42557</refsynopsisdiv>
42558<refsect1>
42559 <title>Arguments</title>
42560 <variablelist>
42561  <varlistentry>
42562   <term><parameter>card</parameter></term>
42563   <listitem>
42564    <para>
42565     the card instance
42566    </para>
42567   </listitem>
42568  </varlistentry>
42569  <varlistentry>
42570   <term><parameter>kcontrol</parameter></term>
42571   <listitem>
42572    <para>
42573     the control instance to add
42574    </para>
42575   </listitem>
42576  </varlistentry>
42577 </variablelist>
42578</refsect1>
42579<refsect1>
42580<title>Description</title>
42581<para>
42582   Adds the control instance created via <function>snd_ctl_new</function> or
42583   <function>snd_ctl_new1</function> to the given card. Assigns also an unique
42584   numid used for fast search.
42585   </para><para>
42586
42587   It frees automatically the control which cannot be added.
42588</para>
42589</refsect1>
42590<refsect1>
42591<title>Return</title>
42592<para>
42593   Zero if successful, or a negative error code on failure.
42594</para>
42595</refsect1>
42596</refentry>
42597
42598<refentry id="API-snd-ctl-replace">
42599<refentryinfo>
42600 <title>LINUX</title>
42601 <productname>Kernel Hackers Manual</productname>
42602 <date>July 2017</date>
42603</refentryinfo>
42604<refmeta>
42605 <refentrytitle><phrase>snd_ctl_replace</phrase></refentrytitle>
42606 <manvolnum>9</manvolnum>
42607 <refmiscinfo class="version">4.1.27</refmiscinfo>
42608</refmeta>
42609<refnamediv>
42610 <refname>snd_ctl_replace</refname>
42611 <refpurpose>
42612     replace the control instance of the card
42613 </refpurpose>
42614</refnamediv>
42615<refsynopsisdiv>
42616 <title>Synopsis</title>
42617  <funcsynopsis><funcprototype>
42618   <funcdef>int <function>snd_ctl_replace </function></funcdef>
42619   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42620   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
42621   <paramdef>bool <parameter>add_on_replace</parameter></paramdef>
42622  </funcprototype></funcsynopsis>
42623</refsynopsisdiv>
42624<refsect1>
42625 <title>Arguments</title>
42626 <variablelist>
42627  <varlistentry>
42628   <term><parameter>card</parameter></term>
42629   <listitem>
42630    <para>
42631     the card instance
42632    </para>
42633   </listitem>
42634  </varlistentry>
42635  <varlistentry>
42636   <term><parameter>kcontrol</parameter></term>
42637   <listitem>
42638    <para>
42639     the control instance to replace
42640    </para>
42641   </listitem>
42642  </varlistentry>
42643  <varlistentry>
42644   <term><parameter>add_on_replace</parameter></term>
42645   <listitem>
42646    <para>
42647     add the control if not already added
42648    </para>
42649   </listitem>
42650  </varlistentry>
42651 </variablelist>
42652</refsect1>
42653<refsect1>
42654<title>Description</title>
42655<para>
42656   Replaces the given control.  If the given control does not exist
42657   and the add_on_replace flag is set, the control is added.  If the
42658   control exists, it is destroyed first.
42659   </para><para>
42660
42661   It frees automatically the control which cannot be added or replaced.
42662</para>
42663</refsect1>
42664<refsect1>
42665<title>Return</title>
42666<para>
42667   Zero if successful, or a negative error code on failure.
42668</para>
42669</refsect1>
42670</refentry>
42671
42672<refentry id="API-snd-ctl-remove">
42673<refentryinfo>
42674 <title>LINUX</title>
42675 <productname>Kernel Hackers Manual</productname>
42676 <date>July 2017</date>
42677</refentryinfo>
42678<refmeta>
42679 <refentrytitle><phrase>snd_ctl_remove</phrase></refentrytitle>
42680 <manvolnum>9</manvolnum>
42681 <refmiscinfo class="version">4.1.27</refmiscinfo>
42682</refmeta>
42683<refnamediv>
42684 <refname>snd_ctl_remove</refname>
42685 <refpurpose>
42686     remove the control from the card and release it
42687 </refpurpose>
42688</refnamediv>
42689<refsynopsisdiv>
42690 <title>Synopsis</title>
42691  <funcsynopsis><funcprototype>
42692   <funcdef>int <function>snd_ctl_remove </function></funcdef>
42693   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42694   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
42695  </funcprototype></funcsynopsis>
42696</refsynopsisdiv>
42697<refsect1>
42698 <title>Arguments</title>
42699 <variablelist>
42700  <varlistentry>
42701   <term><parameter>card</parameter></term>
42702   <listitem>
42703    <para>
42704     the card instance
42705    </para>
42706   </listitem>
42707  </varlistentry>
42708  <varlistentry>
42709   <term><parameter>kcontrol</parameter></term>
42710   <listitem>
42711    <para>
42712     the control instance to remove
42713    </para>
42714   </listitem>
42715  </varlistentry>
42716 </variablelist>
42717</refsect1>
42718<refsect1>
42719<title>Description</title>
42720<para>
42721   Removes the control from the card and then releases the instance.
42722   You don't need to call <function>snd_ctl_free_one</function>. You must be in
42723   the write lock - down_write(<structname>card</structname>-&gt;controls_rwsem).
42724</para>
42725</refsect1>
42726<refsect1>
42727<title>Return</title>
42728<para>
42729   0 if successful, or a negative error code on failure.
42730</para>
42731</refsect1>
42732</refentry>
42733
42734<refentry id="API-snd-ctl-remove-id">
42735<refentryinfo>
42736 <title>LINUX</title>
42737 <productname>Kernel Hackers Manual</productname>
42738 <date>July 2017</date>
42739</refentryinfo>
42740<refmeta>
42741 <refentrytitle><phrase>snd_ctl_remove_id</phrase></refentrytitle>
42742 <manvolnum>9</manvolnum>
42743 <refmiscinfo class="version">4.1.27</refmiscinfo>
42744</refmeta>
42745<refnamediv>
42746 <refname>snd_ctl_remove_id</refname>
42747 <refpurpose>
42748     remove the control of the given id and release it
42749 </refpurpose>
42750</refnamediv>
42751<refsynopsisdiv>
42752 <title>Synopsis</title>
42753  <funcsynopsis><funcprototype>
42754   <funcdef>int <function>snd_ctl_remove_id </function></funcdef>
42755   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42756   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
42757  </funcprototype></funcsynopsis>
42758</refsynopsisdiv>
42759<refsect1>
42760 <title>Arguments</title>
42761 <variablelist>
42762  <varlistentry>
42763   <term><parameter>card</parameter></term>
42764   <listitem>
42765    <para>
42766     the card instance
42767    </para>
42768   </listitem>
42769  </varlistentry>
42770  <varlistentry>
42771   <term><parameter>id</parameter></term>
42772   <listitem>
42773    <para>
42774     the control id to remove
42775    </para>
42776   </listitem>
42777  </varlistentry>
42778 </variablelist>
42779</refsect1>
42780<refsect1>
42781<title>Description</title>
42782<para>
42783   Finds the control instance with the given id, removes it from the
42784   card list and releases it.
42785</para>
42786</refsect1>
42787<refsect1>
42788<title>Return</title>
42789<para>
42790   0 if successful, or a negative error code on failure.
42791</para>
42792</refsect1>
42793</refentry>
42794
42795<refentry id="API-snd-ctl-activate-id">
42796<refentryinfo>
42797 <title>LINUX</title>
42798 <productname>Kernel Hackers Manual</productname>
42799 <date>July 2017</date>
42800</refentryinfo>
42801<refmeta>
42802 <refentrytitle><phrase>snd_ctl_activate_id</phrase></refentrytitle>
42803 <manvolnum>9</manvolnum>
42804 <refmiscinfo class="version">4.1.27</refmiscinfo>
42805</refmeta>
42806<refnamediv>
42807 <refname>snd_ctl_activate_id</refname>
42808 <refpurpose>
42809     activate/inactivate the control of the given id
42810 </refpurpose>
42811</refnamediv>
42812<refsynopsisdiv>
42813 <title>Synopsis</title>
42814  <funcsynopsis><funcprototype>
42815   <funcdef>int <function>snd_ctl_activate_id </function></funcdef>
42816   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42817   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
42818   <paramdef>int <parameter>active</parameter></paramdef>
42819  </funcprototype></funcsynopsis>
42820</refsynopsisdiv>
42821<refsect1>
42822 <title>Arguments</title>
42823 <variablelist>
42824  <varlistentry>
42825   <term><parameter>card</parameter></term>
42826   <listitem>
42827    <para>
42828     the card instance
42829    </para>
42830   </listitem>
42831  </varlistentry>
42832  <varlistentry>
42833   <term><parameter>id</parameter></term>
42834   <listitem>
42835    <para>
42836     the control id to activate/inactivate
42837    </para>
42838   </listitem>
42839  </varlistentry>
42840  <varlistentry>
42841   <term><parameter>active</parameter></term>
42842   <listitem>
42843    <para>
42844     non-zero to activate
42845    </para>
42846   </listitem>
42847  </varlistentry>
42848 </variablelist>
42849</refsect1>
42850<refsect1>
42851<title>Description</title>
42852<para>
42853   Finds the control instance with the given id, and activate or
42854   inactivate the control together with notification, if changed.
42855   The given ID data is filled with full information.
42856</para>
42857</refsect1>
42858<refsect1>
42859<title>Return</title>
42860<para>
42861   0 if unchanged, 1 if changed, or a negative error code on failure.
42862</para>
42863</refsect1>
42864</refentry>
42865
42866<refentry id="API-snd-ctl-rename-id">
42867<refentryinfo>
42868 <title>LINUX</title>
42869 <productname>Kernel Hackers Manual</productname>
42870 <date>July 2017</date>
42871</refentryinfo>
42872<refmeta>
42873 <refentrytitle><phrase>snd_ctl_rename_id</phrase></refentrytitle>
42874 <manvolnum>9</manvolnum>
42875 <refmiscinfo class="version">4.1.27</refmiscinfo>
42876</refmeta>
42877<refnamediv>
42878 <refname>snd_ctl_rename_id</refname>
42879 <refpurpose>
42880     replace the id of a control on the card
42881 </refpurpose>
42882</refnamediv>
42883<refsynopsisdiv>
42884 <title>Synopsis</title>
42885  <funcsynopsis><funcprototype>
42886   <funcdef>int <function>snd_ctl_rename_id </function></funcdef>
42887   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42888   <paramdef>struct snd_ctl_elem_id * <parameter>src_id</parameter></paramdef>
42889   <paramdef>struct snd_ctl_elem_id * <parameter>dst_id</parameter></paramdef>
42890  </funcprototype></funcsynopsis>
42891</refsynopsisdiv>
42892<refsect1>
42893 <title>Arguments</title>
42894 <variablelist>
42895  <varlistentry>
42896   <term><parameter>card</parameter></term>
42897   <listitem>
42898    <para>
42899     the card instance
42900    </para>
42901   </listitem>
42902  </varlistentry>
42903  <varlistentry>
42904   <term><parameter>src_id</parameter></term>
42905   <listitem>
42906    <para>
42907     the old id
42908    </para>
42909   </listitem>
42910  </varlistentry>
42911  <varlistentry>
42912   <term><parameter>dst_id</parameter></term>
42913   <listitem>
42914    <para>
42915     the new id
42916    </para>
42917   </listitem>
42918  </varlistentry>
42919 </variablelist>
42920</refsect1>
42921<refsect1>
42922<title>Description</title>
42923<para>
42924   Finds the control with the old id from the card, and replaces the
42925   id with the new one.
42926</para>
42927</refsect1>
42928<refsect1>
42929<title>Return</title>
42930<para>
42931   Zero if successful, or a negative error code on failure.
42932</para>
42933</refsect1>
42934</refentry>
42935
42936<refentry id="API-snd-ctl-find-numid">
42937<refentryinfo>
42938 <title>LINUX</title>
42939 <productname>Kernel Hackers Manual</productname>
42940 <date>July 2017</date>
42941</refentryinfo>
42942<refmeta>
42943 <refentrytitle><phrase>snd_ctl_find_numid</phrase></refentrytitle>
42944 <manvolnum>9</manvolnum>
42945 <refmiscinfo class="version">4.1.27</refmiscinfo>
42946</refmeta>
42947<refnamediv>
42948 <refname>snd_ctl_find_numid</refname>
42949 <refpurpose>
42950     find the control instance with the given number-id
42951 </refpurpose>
42952</refnamediv>
42953<refsynopsisdiv>
42954 <title>Synopsis</title>
42955  <funcsynopsis><funcprototype>
42956   <funcdef>struct snd_kcontrol * <function>snd_ctl_find_numid </function></funcdef>
42957   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42958   <paramdef>unsigned int <parameter>numid</parameter></paramdef>
42959  </funcprototype></funcsynopsis>
42960</refsynopsisdiv>
42961<refsect1>
42962 <title>Arguments</title>
42963 <variablelist>
42964  <varlistentry>
42965   <term><parameter>card</parameter></term>
42966   <listitem>
42967    <para>
42968     the card instance
42969    </para>
42970   </listitem>
42971  </varlistentry>
42972  <varlistentry>
42973   <term><parameter>numid</parameter></term>
42974   <listitem>
42975    <para>
42976     the number-id to search
42977    </para>
42978   </listitem>
42979  </varlistentry>
42980 </variablelist>
42981</refsect1>
42982<refsect1>
42983<title>Description</title>
42984<para>
42985   Finds the control instance with the given number-id from the card.
42986   </para><para>
42987
42988   The caller must down card-&gt;controls_rwsem before calling this function
42989   (if the race condition can happen).
42990</para>
42991</refsect1>
42992<refsect1>
42993<title>Return</title>
42994<para>
42995   The pointer of the instance if found, or <constant>NULL</constant> if not.
42996</para>
42997</refsect1>
42998</refentry>
42999
43000<refentry id="API-snd-ctl-find-id">
43001<refentryinfo>
43002 <title>LINUX</title>
43003 <productname>Kernel Hackers Manual</productname>
43004 <date>July 2017</date>
43005</refentryinfo>
43006<refmeta>
43007 <refentrytitle><phrase>snd_ctl_find_id</phrase></refentrytitle>
43008 <manvolnum>9</manvolnum>
43009 <refmiscinfo class="version">4.1.27</refmiscinfo>
43010</refmeta>
43011<refnamediv>
43012 <refname>snd_ctl_find_id</refname>
43013 <refpurpose>
43014     find the control instance with the given id
43015 </refpurpose>
43016</refnamediv>
43017<refsynopsisdiv>
43018 <title>Synopsis</title>
43019  <funcsynopsis><funcprototype>
43020   <funcdef>struct snd_kcontrol * <function>snd_ctl_find_id </function></funcdef>
43021   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43022   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
43023  </funcprototype></funcsynopsis>
43024</refsynopsisdiv>
43025<refsect1>
43026 <title>Arguments</title>
43027 <variablelist>
43028  <varlistentry>
43029   <term><parameter>card</parameter></term>
43030   <listitem>
43031    <para>
43032     the card instance
43033    </para>
43034   </listitem>
43035  </varlistentry>
43036  <varlistentry>
43037   <term><parameter>id</parameter></term>
43038   <listitem>
43039    <para>
43040     the id to search
43041    </para>
43042   </listitem>
43043  </varlistentry>
43044 </variablelist>
43045</refsect1>
43046<refsect1>
43047<title>Description</title>
43048<para>
43049   Finds the control instance with the given id from the card.
43050   </para><para>
43051
43052   The caller must down card-&gt;controls_rwsem before calling this function
43053   (if the race condition can happen).
43054</para>
43055</refsect1>
43056<refsect1>
43057<title>Return</title>
43058<para>
43059   The pointer of the instance if found, or <constant>NULL</constant> if not.
43060</para>
43061</refsect1>
43062</refentry>
43063
43064<refentry id="API-snd-ctl-register-ioctl">
43065<refentryinfo>
43066 <title>LINUX</title>
43067 <productname>Kernel Hackers Manual</productname>
43068 <date>July 2017</date>
43069</refentryinfo>
43070<refmeta>
43071 <refentrytitle><phrase>snd_ctl_register_ioctl</phrase></refentrytitle>
43072 <manvolnum>9</manvolnum>
43073 <refmiscinfo class="version">4.1.27</refmiscinfo>
43074</refmeta>
43075<refnamediv>
43076 <refname>snd_ctl_register_ioctl</refname>
43077 <refpurpose>
43078     register the device-specific control-ioctls
43079 </refpurpose>
43080</refnamediv>
43081<refsynopsisdiv>
43082 <title>Synopsis</title>
43083  <funcsynopsis><funcprototype>
43084   <funcdef>int <function>snd_ctl_register_ioctl </function></funcdef>
43085   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
43086  </funcprototype></funcsynopsis>
43087</refsynopsisdiv>
43088<refsect1>
43089 <title>Arguments</title>
43090 <variablelist>
43091  <varlistentry>
43092   <term><parameter>fcn</parameter></term>
43093   <listitem>
43094    <para>
43095     ioctl callback function
43096    </para>
43097   </listitem>
43098  </varlistentry>
43099 </variablelist>
43100</refsect1>
43101<refsect1>
43102<title>Description</title>
43103<para>
43104   called from each device manager like pcm.c, hwdep.c, etc.
43105</para>
43106</refsect1>
43107</refentry>
43108
43109<refentry id="API-snd-ctl-register-ioctl-compat">
43110<refentryinfo>
43111 <title>LINUX</title>
43112 <productname>Kernel Hackers Manual</productname>
43113 <date>July 2017</date>
43114</refentryinfo>
43115<refmeta>
43116 <refentrytitle><phrase>snd_ctl_register_ioctl_compat</phrase></refentrytitle>
43117 <manvolnum>9</manvolnum>
43118 <refmiscinfo class="version">4.1.27</refmiscinfo>
43119</refmeta>
43120<refnamediv>
43121 <refname>snd_ctl_register_ioctl_compat</refname>
43122 <refpurpose>
43123     register the device-specific 32bit compat control-ioctls
43124 </refpurpose>
43125</refnamediv>
43126<refsynopsisdiv>
43127 <title>Synopsis</title>
43128  <funcsynopsis><funcprototype>
43129   <funcdef>int <function>snd_ctl_register_ioctl_compat </function></funcdef>
43130   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
43131  </funcprototype></funcsynopsis>
43132</refsynopsisdiv>
43133<refsect1>
43134 <title>Arguments</title>
43135 <variablelist>
43136  <varlistentry>
43137   <term><parameter>fcn</parameter></term>
43138   <listitem>
43139    <para>
43140     ioctl callback function
43141    </para>
43142   </listitem>
43143  </varlistentry>
43144 </variablelist>
43145</refsect1>
43146</refentry>
43147
43148<refentry id="API-snd-ctl-unregister-ioctl">
43149<refentryinfo>
43150 <title>LINUX</title>
43151 <productname>Kernel Hackers Manual</productname>
43152 <date>July 2017</date>
43153</refentryinfo>
43154<refmeta>
43155 <refentrytitle><phrase>snd_ctl_unregister_ioctl</phrase></refentrytitle>
43156 <manvolnum>9</manvolnum>
43157 <refmiscinfo class="version">4.1.27</refmiscinfo>
43158</refmeta>
43159<refnamediv>
43160 <refname>snd_ctl_unregister_ioctl</refname>
43161 <refpurpose>
43162     de-register the device-specific control-ioctls
43163 </refpurpose>
43164</refnamediv>
43165<refsynopsisdiv>
43166 <title>Synopsis</title>
43167  <funcsynopsis><funcprototype>
43168   <funcdef>int <function>snd_ctl_unregister_ioctl </function></funcdef>
43169   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
43170  </funcprototype></funcsynopsis>
43171</refsynopsisdiv>
43172<refsect1>
43173 <title>Arguments</title>
43174 <variablelist>
43175  <varlistentry>
43176   <term><parameter>fcn</parameter></term>
43177   <listitem>
43178    <para>
43179     ioctl callback function to unregister
43180    </para>
43181   </listitem>
43182  </varlistentry>
43183 </variablelist>
43184</refsect1>
43185</refentry>
43186
43187<refentry id="API-snd-ctl-unregister-ioctl-compat">
43188<refentryinfo>
43189 <title>LINUX</title>
43190 <productname>Kernel Hackers Manual</productname>
43191 <date>July 2017</date>
43192</refentryinfo>
43193<refmeta>
43194 <refentrytitle><phrase>snd_ctl_unregister_ioctl_compat</phrase></refentrytitle>
43195 <manvolnum>9</manvolnum>
43196 <refmiscinfo class="version">4.1.27</refmiscinfo>
43197</refmeta>
43198<refnamediv>
43199 <refname>snd_ctl_unregister_ioctl_compat</refname>
43200 <refpurpose>
43201     de-register the device-specific compat 32bit control-ioctls
43202 </refpurpose>
43203</refnamediv>
43204<refsynopsisdiv>
43205 <title>Synopsis</title>
43206  <funcsynopsis><funcprototype>
43207   <funcdef>int <function>snd_ctl_unregister_ioctl_compat </function></funcdef>
43208   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
43209  </funcprototype></funcsynopsis>
43210</refsynopsisdiv>
43211<refsect1>
43212 <title>Arguments</title>
43213 <variablelist>
43214  <varlistentry>
43215   <term><parameter>fcn</parameter></term>
43216   <listitem>
43217    <para>
43218     ioctl callback function to unregister
43219    </para>
43220   </listitem>
43221  </varlistentry>
43222 </variablelist>
43223</refsect1>
43224</refentry>
43225
43226<refentry id="API-snd-ctl-boolean-mono-info">
43227<refentryinfo>
43228 <title>LINUX</title>
43229 <productname>Kernel Hackers Manual</productname>
43230 <date>July 2017</date>
43231</refentryinfo>
43232<refmeta>
43233 <refentrytitle><phrase>snd_ctl_boolean_mono_info</phrase></refentrytitle>
43234 <manvolnum>9</manvolnum>
43235 <refmiscinfo class="version">4.1.27</refmiscinfo>
43236</refmeta>
43237<refnamediv>
43238 <refname>snd_ctl_boolean_mono_info</refname>
43239 <refpurpose>
43240     Helper function for a standard boolean info callback with a mono channel
43241 </refpurpose>
43242</refnamediv>
43243<refsynopsisdiv>
43244 <title>Synopsis</title>
43245  <funcsynopsis><funcprototype>
43246   <funcdef>int <function>snd_ctl_boolean_mono_info </function></funcdef>
43247   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
43248   <paramdef>struct snd_ctl_elem_info * <parameter>uinfo</parameter></paramdef>
43249  </funcprototype></funcsynopsis>
43250</refsynopsisdiv>
43251<refsect1>
43252 <title>Arguments</title>
43253 <variablelist>
43254  <varlistentry>
43255   <term><parameter>kcontrol</parameter></term>
43256   <listitem>
43257    <para>
43258     the kcontrol instance
43259    </para>
43260   </listitem>
43261  </varlistentry>
43262  <varlistentry>
43263   <term><parameter>uinfo</parameter></term>
43264   <listitem>
43265    <para>
43266     info to store
43267    </para>
43268   </listitem>
43269  </varlistentry>
43270 </variablelist>
43271</refsect1>
43272<refsect1>
43273<title>Description</title>
43274<para>
43275   This is a function that can be used as info callback for a standard
43276   boolean control with a single mono channel.
43277</para>
43278</refsect1>
43279</refentry>
43280
43281<refentry id="API-snd-ctl-boolean-stereo-info">
43282<refentryinfo>
43283 <title>LINUX</title>
43284 <productname>Kernel Hackers Manual</productname>
43285 <date>July 2017</date>
43286</refentryinfo>
43287<refmeta>
43288 <refentrytitle><phrase>snd_ctl_boolean_stereo_info</phrase></refentrytitle>
43289 <manvolnum>9</manvolnum>
43290 <refmiscinfo class="version">4.1.27</refmiscinfo>
43291</refmeta>
43292<refnamediv>
43293 <refname>snd_ctl_boolean_stereo_info</refname>
43294 <refpurpose>
43295     Helper function for a standard boolean info callback with stereo two channels
43296 </refpurpose>
43297</refnamediv>
43298<refsynopsisdiv>
43299 <title>Synopsis</title>
43300  <funcsynopsis><funcprototype>
43301   <funcdef>int <function>snd_ctl_boolean_stereo_info </function></funcdef>
43302   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
43303   <paramdef>struct snd_ctl_elem_info * <parameter>uinfo</parameter></paramdef>
43304  </funcprototype></funcsynopsis>
43305</refsynopsisdiv>
43306<refsect1>
43307 <title>Arguments</title>
43308 <variablelist>
43309  <varlistentry>
43310   <term><parameter>kcontrol</parameter></term>
43311   <listitem>
43312    <para>
43313     the kcontrol instance
43314    </para>
43315   </listitem>
43316  </varlistentry>
43317  <varlistentry>
43318   <term><parameter>uinfo</parameter></term>
43319   <listitem>
43320    <para>
43321     info to store
43322    </para>
43323   </listitem>
43324  </varlistentry>
43325 </variablelist>
43326</refsect1>
43327<refsect1>
43328<title>Description</title>
43329<para>
43330   This is a function that can be used as info callback for a standard
43331   boolean control with stereo two channels.
43332</para>
43333</refsect1>
43334</refentry>
43335
43336<refentry id="API-snd-ctl-enum-info">
43337<refentryinfo>
43338 <title>LINUX</title>
43339 <productname>Kernel Hackers Manual</productname>
43340 <date>July 2017</date>
43341</refentryinfo>
43342<refmeta>
43343 <refentrytitle><phrase>snd_ctl_enum_info</phrase></refentrytitle>
43344 <manvolnum>9</manvolnum>
43345 <refmiscinfo class="version">4.1.27</refmiscinfo>
43346</refmeta>
43347<refnamediv>
43348 <refname>snd_ctl_enum_info</refname>
43349 <refpurpose>
43350     fills the info structure for an enumerated control
43351 </refpurpose>
43352</refnamediv>
43353<refsynopsisdiv>
43354 <title>Synopsis</title>
43355  <funcsynopsis><funcprototype>
43356   <funcdef>int <function>snd_ctl_enum_info </function></funcdef>
43357   <paramdef>struct snd_ctl_elem_info * <parameter>info</parameter></paramdef>
43358   <paramdef>unsigned int <parameter>channels</parameter></paramdef>
43359   <paramdef>unsigned int <parameter>items</parameter></paramdef>
43360   <paramdef>const char *const <parameter>names[]</parameter></paramdef>
43361  </funcprototype></funcsynopsis>
43362</refsynopsisdiv>
43363<refsect1>
43364 <title>Arguments</title>
43365 <variablelist>
43366  <varlistentry>
43367   <term><parameter>info</parameter></term>
43368   <listitem>
43369    <para>
43370     the structure to be filled
43371    </para>
43372   </listitem>
43373  </varlistentry>
43374  <varlistentry>
43375   <term><parameter>channels</parameter></term>
43376   <listitem>
43377    <para>
43378     the number of the control's channels; often one
43379    </para>
43380   </listitem>
43381  </varlistentry>
43382  <varlistentry>
43383   <term><parameter>items</parameter></term>
43384   <listitem>
43385    <para>
43386     the number of control values; also the size of <parameter>names</parameter>
43387    </para>
43388   </listitem>
43389  </varlistentry>
43390  <varlistentry>
43391   <term><parameter>names[]</parameter></term>
43392   <listitem>
43393    <para>
43394     an array containing the names of all control values
43395    </para>
43396   </listitem>
43397  </varlistentry>
43398 </variablelist>
43399</refsect1>
43400<refsect1>
43401<title>Description</title>
43402<para>
43403   Sets all required fields in <parameter>info</parameter> to their appropriate values.
43404   If the control's accessibility is not the default (readable and writable),
43405   the caller has to fill <parameter>info</parameter>-&gt;access.
43406</para>
43407</refsect1>
43408<refsect1>
43409<title>Return</title>
43410<para>
43411   Zero.
43412</para>
43413</refsect1>
43414</refentry>
43415
43416<!-- sound/core/pcm_lib.c -->
43417<refentry id="API-snd-pcm-set-ops">
43418<refentryinfo>
43419 <title>LINUX</title>
43420 <productname>Kernel Hackers Manual</productname>
43421 <date>July 2017</date>
43422</refentryinfo>
43423<refmeta>
43424 <refentrytitle><phrase>snd_pcm_set_ops</phrase></refentrytitle>
43425 <manvolnum>9</manvolnum>
43426 <refmiscinfo class="version">4.1.27</refmiscinfo>
43427</refmeta>
43428<refnamediv>
43429 <refname>snd_pcm_set_ops</refname>
43430 <refpurpose>
43431  set the PCM operators
43432 </refpurpose>
43433</refnamediv>
43434<refsynopsisdiv>
43435 <title>Synopsis</title>
43436  <funcsynopsis><funcprototype>
43437   <funcdef>void <function>snd_pcm_set_ops </function></funcdef>
43438   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
43439   <paramdef>int <parameter>direction</parameter></paramdef>
43440   <paramdef>const struct snd_pcm_ops * <parameter>ops</parameter></paramdef>
43441  </funcprototype></funcsynopsis>
43442</refsynopsisdiv>
43443<refsect1>
43444 <title>Arguments</title>
43445 <variablelist>
43446  <varlistentry>
43447   <term><parameter>pcm</parameter></term>
43448   <listitem>
43449    <para>
43450     the pcm instance
43451    </para>
43452   </listitem>
43453  </varlistentry>
43454  <varlistentry>
43455   <term><parameter>direction</parameter></term>
43456   <listitem>
43457    <para>
43458     stream direction, SNDRV_PCM_STREAM_XXX
43459    </para>
43460   </listitem>
43461  </varlistentry>
43462  <varlistentry>
43463   <term><parameter>ops</parameter></term>
43464   <listitem>
43465    <para>
43466     the operator table
43467    </para>
43468   </listitem>
43469  </varlistentry>
43470 </variablelist>
43471</refsect1>
43472<refsect1>
43473<title>Description</title>
43474<para>
43475   Sets the given PCM operators to the pcm instance.
43476</para>
43477</refsect1>
43478</refentry>
43479
43480<refentry id="API-snd-pcm-set-sync">
43481<refentryinfo>
43482 <title>LINUX</title>
43483 <productname>Kernel Hackers Manual</productname>
43484 <date>July 2017</date>
43485</refentryinfo>
43486<refmeta>
43487 <refentrytitle><phrase>snd_pcm_set_sync</phrase></refentrytitle>
43488 <manvolnum>9</manvolnum>
43489 <refmiscinfo class="version">4.1.27</refmiscinfo>
43490</refmeta>
43491<refnamediv>
43492 <refname>snd_pcm_set_sync</refname>
43493 <refpurpose>
43494     set the PCM sync id
43495 </refpurpose>
43496</refnamediv>
43497<refsynopsisdiv>
43498 <title>Synopsis</title>
43499  <funcsynopsis><funcprototype>
43500   <funcdef>void <function>snd_pcm_set_sync </function></funcdef>
43501   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
43502  </funcprototype></funcsynopsis>
43503</refsynopsisdiv>
43504<refsect1>
43505 <title>Arguments</title>
43506 <variablelist>
43507  <varlistentry>
43508   <term><parameter>substream</parameter></term>
43509   <listitem>
43510    <para>
43511     the pcm substream
43512    </para>
43513   </listitem>
43514  </varlistentry>
43515 </variablelist>
43516</refsect1>
43517<refsect1>
43518<title>Description</title>
43519<para>
43520   Sets the PCM sync identifier for the card.
43521</para>
43522</refsect1>
43523</refentry>
43524
43525<refentry id="API-snd-interval-refine">
43526<refentryinfo>
43527 <title>LINUX</title>
43528 <productname>Kernel Hackers Manual</productname>
43529 <date>July 2017</date>
43530</refentryinfo>
43531<refmeta>
43532 <refentrytitle><phrase>snd_interval_refine</phrase></refentrytitle>
43533 <manvolnum>9</manvolnum>
43534 <refmiscinfo class="version">4.1.27</refmiscinfo>
43535</refmeta>
43536<refnamediv>
43537 <refname>snd_interval_refine</refname>
43538 <refpurpose>
43539     refine the interval value of configurator
43540 </refpurpose>
43541</refnamediv>
43542<refsynopsisdiv>
43543 <title>Synopsis</title>
43544  <funcsynopsis><funcprototype>
43545   <funcdef>int <function>snd_interval_refine </function></funcdef>
43546   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
43547   <paramdef>const struct snd_interval * <parameter>v</parameter></paramdef>
43548  </funcprototype></funcsynopsis>
43549</refsynopsisdiv>
43550<refsect1>
43551 <title>Arguments</title>
43552 <variablelist>
43553  <varlistentry>
43554   <term><parameter>i</parameter></term>
43555   <listitem>
43556    <para>
43557     the interval value to refine
43558    </para>
43559   </listitem>
43560  </varlistentry>
43561  <varlistentry>
43562   <term><parameter>v</parameter></term>
43563   <listitem>
43564    <para>
43565     the interval value to refer to
43566    </para>
43567   </listitem>
43568  </varlistentry>
43569 </variablelist>
43570</refsect1>
43571<refsect1>
43572<title>Description</title>
43573<para>
43574   Refines the interval value with the reference value.
43575   The interval is changed to the range satisfying both intervals.
43576   The interval status (min, max, integer, etc.) are evaluated.
43577</para>
43578</refsect1>
43579<refsect1>
43580<title>Return</title>
43581<para>
43582   Positive if the value is changed, zero if it's not changed, or a
43583   negative error code.
43584</para>
43585</refsect1>
43586</refentry>
43587
43588<refentry id="API-snd-interval-ratnum">
43589<refentryinfo>
43590 <title>LINUX</title>
43591 <productname>Kernel Hackers Manual</productname>
43592 <date>July 2017</date>
43593</refentryinfo>
43594<refmeta>
43595 <refentrytitle><phrase>snd_interval_ratnum</phrase></refentrytitle>
43596 <manvolnum>9</manvolnum>
43597 <refmiscinfo class="version">4.1.27</refmiscinfo>
43598</refmeta>
43599<refnamediv>
43600 <refname>snd_interval_ratnum</refname>
43601 <refpurpose>
43602     refine the interval value
43603 </refpurpose>
43604</refnamediv>
43605<refsynopsisdiv>
43606 <title>Synopsis</title>
43607  <funcsynopsis><funcprototype>
43608   <funcdef>int <function>snd_interval_ratnum </function></funcdef>
43609   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
43610   <paramdef>unsigned int <parameter>rats_count</parameter></paramdef>
43611   <paramdef>struct snd_ratnum * <parameter>rats</parameter></paramdef>
43612   <paramdef>unsigned int * <parameter>nump</parameter></paramdef>
43613   <paramdef>unsigned int * <parameter>denp</parameter></paramdef>
43614  </funcprototype></funcsynopsis>
43615</refsynopsisdiv>
43616<refsect1>
43617 <title>Arguments</title>
43618 <variablelist>
43619  <varlistentry>
43620   <term><parameter>i</parameter></term>
43621   <listitem>
43622    <para>
43623     interval to refine
43624    </para>
43625   </listitem>
43626  </varlistentry>
43627  <varlistentry>
43628   <term><parameter>rats_count</parameter></term>
43629   <listitem>
43630    <para>
43631     number of ratnum_t
43632    </para>
43633   </listitem>
43634  </varlistentry>
43635  <varlistentry>
43636   <term><parameter>rats</parameter></term>
43637   <listitem>
43638    <para>
43639     ratnum_t array
43640    </para>
43641   </listitem>
43642  </varlistentry>
43643  <varlistentry>
43644   <term><parameter>nump</parameter></term>
43645   <listitem>
43646    <para>
43647     pointer to store the resultant numerator
43648    </para>
43649   </listitem>
43650  </varlistentry>
43651  <varlistentry>
43652   <term><parameter>denp</parameter></term>
43653   <listitem>
43654    <para>
43655     pointer to store the resultant denominator
43656    </para>
43657   </listitem>
43658  </varlistentry>
43659 </variablelist>
43660</refsect1>
43661<refsect1>
43662<title>Return</title>
43663<para>
43664   Positive if the value is changed, zero if it's not changed, or a
43665   negative error code.
43666</para>
43667</refsect1>
43668</refentry>
43669
43670<refentry id="API-snd-interval-list">
43671<refentryinfo>
43672 <title>LINUX</title>
43673 <productname>Kernel Hackers Manual</productname>
43674 <date>July 2017</date>
43675</refentryinfo>
43676<refmeta>
43677 <refentrytitle><phrase>snd_interval_list</phrase></refentrytitle>
43678 <manvolnum>9</manvolnum>
43679 <refmiscinfo class="version">4.1.27</refmiscinfo>
43680</refmeta>
43681<refnamediv>
43682 <refname>snd_interval_list</refname>
43683 <refpurpose>
43684     refine the interval value from the list
43685 </refpurpose>
43686</refnamediv>
43687<refsynopsisdiv>
43688 <title>Synopsis</title>
43689  <funcsynopsis><funcprototype>
43690   <funcdef>int <function>snd_interval_list </function></funcdef>
43691   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
43692   <paramdef>unsigned int <parameter>count</parameter></paramdef>
43693   <paramdef>const unsigned int * <parameter>list</parameter></paramdef>
43694   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
43695  </funcprototype></funcsynopsis>
43696</refsynopsisdiv>
43697<refsect1>
43698 <title>Arguments</title>
43699 <variablelist>
43700  <varlistentry>
43701   <term><parameter>i</parameter></term>
43702   <listitem>
43703    <para>
43704     the interval value to refine
43705    </para>
43706   </listitem>
43707  </varlistentry>
43708  <varlistentry>
43709   <term><parameter>count</parameter></term>
43710   <listitem>
43711    <para>
43712     the number of elements in the list
43713    </para>
43714   </listitem>
43715  </varlistentry>
43716  <varlistentry>
43717   <term><parameter>list</parameter></term>
43718   <listitem>
43719    <para>
43720     the value list
43721    </para>
43722   </listitem>
43723  </varlistentry>
43724  <varlistentry>
43725   <term><parameter>mask</parameter></term>
43726   <listitem>
43727    <para>
43728     the bit-mask to evaluate
43729    </para>
43730   </listitem>
43731  </varlistentry>
43732 </variablelist>
43733</refsect1>
43734<refsect1>
43735<title>Description</title>
43736<para>
43737   Refines the interval value from the list.
43738   When mask is non-zero, only the elements corresponding to bit 1 are
43739   evaluated.
43740</para>
43741</refsect1>
43742<refsect1>
43743<title>Return</title>
43744<para>
43745   Positive if the value is changed, zero if it's not changed, or a
43746   negative error code.
43747</para>
43748</refsect1>
43749</refentry>
43750
43751<refentry id="API-snd-interval-ranges">
43752<refentryinfo>
43753 <title>LINUX</title>
43754 <productname>Kernel Hackers Manual</productname>
43755 <date>July 2017</date>
43756</refentryinfo>
43757<refmeta>
43758 <refentrytitle><phrase>snd_interval_ranges</phrase></refentrytitle>
43759 <manvolnum>9</manvolnum>
43760 <refmiscinfo class="version">4.1.27</refmiscinfo>
43761</refmeta>
43762<refnamediv>
43763 <refname>snd_interval_ranges</refname>
43764 <refpurpose>
43765     refine the interval value from the list of ranges
43766 </refpurpose>
43767</refnamediv>
43768<refsynopsisdiv>
43769 <title>Synopsis</title>
43770  <funcsynopsis><funcprototype>
43771   <funcdef>int <function>snd_interval_ranges </function></funcdef>
43772   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
43773   <paramdef>unsigned int <parameter>count</parameter></paramdef>
43774   <paramdef>const struct snd_interval * <parameter>ranges</parameter></paramdef>
43775   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
43776  </funcprototype></funcsynopsis>
43777</refsynopsisdiv>
43778<refsect1>
43779 <title>Arguments</title>
43780 <variablelist>
43781  <varlistentry>
43782   <term><parameter>i</parameter></term>
43783   <listitem>
43784    <para>
43785     the interval value to refine
43786    </para>
43787   </listitem>
43788  </varlistentry>
43789  <varlistentry>
43790   <term><parameter>count</parameter></term>
43791   <listitem>
43792    <para>
43793     the number of elements in the list of ranges
43794    </para>
43795   </listitem>
43796  </varlistentry>
43797  <varlistentry>
43798   <term><parameter>ranges</parameter></term>
43799   <listitem>
43800    <para>
43801     the ranges list
43802    </para>
43803   </listitem>
43804  </varlistentry>
43805  <varlistentry>
43806   <term><parameter>mask</parameter></term>
43807   <listitem>
43808    <para>
43809     the bit-mask to evaluate
43810    </para>
43811   </listitem>
43812  </varlistentry>
43813 </variablelist>
43814</refsect1>
43815<refsect1>
43816<title>Description</title>
43817<para>
43818   Refines the interval value from the list of ranges.
43819   When mask is non-zero, only the elements corresponding to bit 1 are
43820   evaluated.
43821</para>
43822</refsect1>
43823<refsect1>
43824<title>Return</title>
43825<para>
43826   Positive if the value is changed, zero if it's not changed, or a
43827   negative error code.
43828</para>
43829</refsect1>
43830</refentry>
43831
43832<refentry id="API-snd-pcm-hw-rule-add">
43833<refentryinfo>
43834 <title>LINUX</title>
43835 <productname>Kernel Hackers Manual</productname>
43836 <date>July 2017</date>
43837</refentryinfo>
43838<refmeta>
43839 <refentrytitle><phrase>snd_pcm_hw_rule_add</phrase></refentrytitle>
43840 <manvolnum>9</manvolnum>
43841 <refmiscinfo class="version">4.1.27</refmiscinfo>
43842</refmeta>
43843<refnamediv>
43844 <refname>snd_pcm_hw_rule_add</refname>
43845 <refpurpose>
43846     add the hw-constraint rule
43847 </refpurpose>
43848</refnamediv>
43849<refsynopsisdiv>
43850 <title>Synopsis</title>
43851  <funcsynopsis><funcprototype>
43852   <funcdef>int <function>snd_pcm_hw_rule_add </function></funcdef>
43853   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
43854   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
43855   <paramdef>int <parameter>var</parameter></paramdef>
43856   <paramdef>snd_pcm_hw_rule_func_t <parameter>func</parameter></paramdef>
43857   <paramdef>void * <parameter>private</parameter></paramdef>
43858   <paramdef>int <parameter>dep</parameter></paramdef>
43859   <paramdef> <parameter>...</parameter></paramdef>
43860  </funcprototype></funcsynopsis>
43861</refsynopsisdiv>
43862<refsect1>
43863 <title>Arguments</title>
43864 <variablelist>
43865  <varlistentry>
43866   <term><parameter>runtime</parameter></term>
43867   <listitem>
43868    <para>
43869     the pcm runtime instance
43870    </para>
43871   </listitem>
43872  </varlistentry>
43873  <varlistentry>
43874   <term><parameter>cond</parameter></term>
43875   <listitem>
43876    <para>
43877     condition bits
43878    </para>
43879   </listitem>
43880  </varlistentry>
43881  <varlistentry>
43882   <term><parameter>var</parameter></term>
43883   <listitem>
43884    <para>
43885     the variable to evaluate
43886    </para>
43887   </listitem>
43888  </varlistentry>
43889  <varlistentry>
43890   <term><parameter>func</parameter></term>
43891   <listitem>
43892    <para>
43893     the evaluation function
43894    </para>
43895   </listitem>
43896  </varlistentry>
43897  <varlistentry>
43898   <term><parameter>private</parameter></term>
43899   <listitem>
43900    <para>
43901     the private data pointer passed to function
43902    </para>
43903   </listitem>
43904  </varlistentry>
43905  <varlistentry>
43906   <term><parameter>dep</parameter></term>
43907   <listitem>
43908    <para>
43909     the dependent variables
43910    </para>
43911   </listitem>
43912  </varlistentry>
43913  <varlistentry>
43914   <term><parameter>...</parameter></term>
43915   <listitem>
43916    <para>
43917     variable arguments
43918    </para>
43919   </listitem>
43920  </varlistentry>
43921 </variablelist>
43922</refsect1>
43923<refsect1>
43924<title>Return</title>
43925<para>
43926   Zero if successful, or a negative error code on failure.
43927</para>
43928</refsect1>
43929</refentry>
43930
43931<refentry id="API-snd-pcm-hw-constraint-mask64">
43932<refentryinfo>
43933 <title>LINUX</title>
43934 <productname>Kernel Hackers Manual</productname>
43935 <date>July 2017</date>
43936</refentryinfo>
43937<refmeta>
43938 <refentrytitle><phrase>snd_pcm_hw_constraint_mask64</phrase></refentrytitle>
43939 <manvolnum>9</manvolnum>
43940 <refmiscinfo class="version">4.1.27</refmiscinfo>
43941</refmeta>
43942<refnamediv>
43943 <refname>snd_pcm_hw_constraint_mask64</refname>
43944 <refpurpose>
43945     apply the given bitmap mask constraint
43946 </refpurpose>
43947</refnamediv>
43948<refsynopsisdiv>
43949 <title>Synopsis</title>
43950  <funcsynopsis><funcprototype>
43951   <funcdef>int <function>snd_pcm_hw_constraint_mask64 </function></funcdef>
43952   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
43953   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
43954   <paramdef>u_int64_t <parameter>mask</parameter></paramdef>
43955  </funcprototype></funcsynopsis>
43956</refsynopsisdiv>
43957<refsect1>
43958 <title>Arguments</title>
43959 <variablelist>
43960  <varlistentry>
43961   <term><parameter>runtime</parameter></term>
43962   <listitem>
43963    <para>
43964     PCM runtime instance
43965    </para>
43966   </listitem>
43967  </varlistentry>
43968  <varlistentry>
43969   <term><parameter>var</parameter></term>
43970   <listitem>
43971    <para>
43972     hw_params variable to apply the mask
43973    </para>
43974   </listitem>
43975  </varlistentry>
43976  <varlistentry>
43977   <term><parameter>mask</parameter></term>
43978   <listitem>
43979    <para>
43980     the 64bit bitmap mask
43981    </para>
43982   </listitem>
43983  </varlistentry>
43984 </variablelist>
43985</refsect1>
43986<refsect1>
43987<title>Description</title>
43988<para>
43989   Apply the constraint of the given bitmap mask to a 64-bit mask parameter.
43990</para>
43991</refsect1>
43992<refsect1>
43993<title>Return</title>
43994<para>
43995   Zero if successful, or a negative error code on failure.
43996</para>
43997</refsect1>
43998</refentry>
43999
44000<refentry id="API-snd-pcm-hw-constraint-integer">
44001<refentryinfo>
44002 <title>LINUX</title>
44003 <productname>Kernel Hackers Manual</productname>
44004 <date>July 2017</date>
44005</refentryinfo>
44006<refmeta>
44007 <refentrytitle><phrase>snd_pcm_hw_constraint_integer</phrase></refentrytitle>
44008 <manvolnum>9</manvolnum>
44009 <refmiscinfo class="version">4.1.27</refmiscinfo>
44010</refmeta>
44011<refnamediv>
44012 <refname>snd_pcm_hw_constraint_integer</refname>
44013 <refpurpose>
44014     apply an integer constraint to an interval
44015 </refpurpose>
44016</refnamediv>
44017<refsynopsisdiv>
44018 <title>Synopsis</title>
44019  <funcsynopsis><funcprototype>
44020   <funcdef>int <function>snd_pcm_hw_constraint_integer </function></funcdef>
44021   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44022   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44023  </funcprototype></funcsynopsis>
44024</refsynopsisdiv>
44025<refsect1>
44026 <title>Arguments</title>
44027 <variablelist>
44028  <varlistentry>
44029   <term><parameter>runtime</parameter></term>
44030   <listitem>
44031    <para>
44032     PCM runtime instance
44033    </para>
44034   </listitem>
44035  </varlistentry>
44036  <varlistentry>
44037   <term><parameter>var</parameter></term>
44038   <listitem>
44039    <para>
44040     hw_params variable to apply the integer constraint
44041    </para>
44042   </listitem>
44043  </varlistentry>
44044 </variablelist>
44045</refsect1>
44046<refsect1>
44047<title>Description</title>
44048<para>
44049   Apply the constraint of integer to an interval parameter.
44050</para>
44051</refsect1>
44052<refsect1>
44053<title>Return</title>
44054<para>
44055   Positive if the value is changed, zero if it's not changed, or a
44056   negative error code.
44057</para>
44058</refsect1>
44059</refentry>
44060
44061<refentry id="API-snd-pcm-hw-constraint-minmax">
44062<refentryinfo>
44063 <title>LINUX</title>
44064 <productname>Kernel Hackers Manual</productname>
44065 <date>July 2017</date>
44066</refentryinfo>
44067<refmeta>
44068 <refentrytitle><phrase>snd_pcm_hw_constraint_minmax</phrase></refentrytitle>
44069 <manvolnum>9</manvolnum>
44070 <refmiscinfo class="version">4.1.27</refmiscinfo>
44071</refmeta>
44072<refnamediv>
44073 <refname>snd_pcm_hw_constraint_minmax</refname>
44074 <refpurpose>
44075     apply a min/max range constraint to an interval
44076 </refpurpose>
44077</refnamediv>
44078<refsynopsisdiv>
44079 <title>Synopsis</title>
44080  <funcsynopsis><funcprototype>
44081   <funcdef>int <function>snd_pcm_hw_constraint_minmax </function></funcdef>
44082   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44083   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44084   <paramdef>unsigned int <parameter>min</parameter></paramdef>
44085   <paramdef>unsigned int <parameter>max</parameter></paramdef>
44086  </funcprototype></funcsynopsis>
44087</refsynopsisdiv>
44088<refsect1>
44089 <title>Arguments</title>
44090 <variablelist>
44091  <varlistentry>
44092   <term><parameter>runtime</parameter></term>
44093   <listitem>
44094    <para>
44095     PCM runtime instance
44096    </para>
44097   </listitem>
44098  </varlistentry>
44099  <varlistentry>
44100   <term><parameter>var</parameter></term>
44101   <listitem>
44102    <para>
44103     hw_params variable to apply the range
44104    </para>
44105   </listitem>
44106  </varlistentry>
44107  <varlistentry>
44108   <term><parameter>min</parameter></term>
44109   <listitem>
44110    <para>
44111     the minimal value
44112    </para>
44113   </listitem>
44114  </varlistentry>
44115  <varlistentry>
44116   <term><parameter>max</parameter></term>
44117   <listitem>
44118    <para>
44119     the maximal value
44120    </para>
44121   </listitem>
44122  </varlistentry>
44123 </variablelist>
44124</refsect1>
44125<refsect1>
44126<title>Description</title>
44127<para>
44128   Apply the min/max range constraint to an interval parameter.
44129</para>
44130</refsect1>
44131<refsect1>
44132<title>Return</title>
44133<para>
44134   Positive if the value is changed, zero if it's not changed, or a
44135   negative error code.
44136</para>
44137</refsect1>
44138</refentry>
44139
44140<refentry id="API-snd-pcm-hw-constraint-list">
44141<refentryinfo>
44142 <title>LINUX</title>
44143 <productname>Kernel Hackers Manual</productname>
44144 <date>July 2017</date>
44145</refentryinfo>
44146<refmeta>
44147 <refentrytitle><phrase>snd_pcm_hw_constraint_list</phrase></refentrytitle>
44148 <manvolnum>9</manvolnum>
44149 <refmiscinfo class="version">4.1.27</refmiscinfo>
44150</refmeta>
44151<refnamediv>
44152 <refname>snd_pcm_hw_constraint_list</refname>
44153 <refpurpose>
44154     apply a list of constraints to a parameter
44155 </refpurpose>
44156</refnamediv>
44157<refsynopsisdiv>
44158 <title>Synopsis</title>
44159  <funcsynopsis><funcprototype>
44160   <funcdef>int <function>snd_pcm_hw_constraint_list </function></funcdef>
44161   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44162   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
44163   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44164   <paramdef>const struct snd_pcm_hw_constraint_list * <parameter>l</parameter></paramdef>
44165  </funcprototype></funcsynopsis>
44166</refsynopsisdiv>
44167<refsect1>
44168 <title>Arguments</title>
44169 <variablelist>
44170  <varlistentry>
44171   <term><parameter>runtime</parameter></term>
44172   <listitem>
44173    <para>
44174     PCM runtime instance
44175    </para>
44176   </listitem>
44177  </varlistentry>
44178  <varlistentry>
44179   <term><parameter>cond</parameter></term>
44180   <listitem>
44181    <para>
44182     condition bits
44183    </para>
44184   </listitem>
44185  </varlistentry>
44186  <varlistentry>
44187   <term><parameter>var</parameter></term>
44188   <listitem>
44189    <para>
44190     hw_params variable to apply the list constraint
44191    </para>
44192   </listitem>
44193  </varlistentry>
44194  <varlistentry>
44195   <term><parameter>l</parameter></term>
44196   <listitem>
44197    <para>
44198     list
44199    </para>
44200   </listitem>
44201  </varlistentry>
44202 </variablelist>
44203</refsect1>
44204<refsect1>
44205<title>Description</title>
44206<para>
44207   Apply the list of constraints to an interval parameter.
44208</para>
44209</refsect1>
44210<refsect1>
44211<title>Return</title>
44212<para>
44213   Zero if successful, or a negative error code on failure.
44214</para>
44215</refsect1>
44216</refentry>
44217
44218<refentry id="API-snd-pcm-hw-constraint-ranges">
44219<refentryinfo>
44220 <title>LINUX</title>
44221 <productname>Kernel Hackers Manual</productname>
44222 <date>July 2017</date>
44223</refentryinfo>
44224<refmeta>
44225 <refentrytitle><phrase>snd_pcm_hw_constraint_ranges</phrase></refentrytitle>
44226 <manvolnum>9</manvolnum>
44227 <refmiscinfo class="version">4.1.27</refmiscinfo>
44228</refmeta>
44229<refnamediv>
44230 <refname>snd_pcm_hw_constraint_ranges</refname>
44231 <refpurpose>
44232     apply list of range constraints to a parameter
44233 </refpurpose>
44234</refnamediv>
44235<refsynopsisdiv>
44236 <title>Synopsis</title>
44237  <funcsynopsis><funcprototype>
44238   <funcdef>int <function>snd_pcm_hw_constraint_ranges </function></funcdef>
44239   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44240   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
44241   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44242   <paramdef>const struct snd_pcm_hw_constraint_ranges * <parameter>r</parameter></paramdef>
44243  </funcprototype></funcsynopsis>
44244</refsynopsisdiv>
44245<refsect1>
44246 <title>Arguments</title>
44247 <variablelist>
44248  <varlistentry>
44249   <term><parameter>runtime</parameter></term>
44250   <listitem>
44251    <para>
44252     PCM runtime instance
44253    </para>
44254   </listitem>
44255  </varlistentry>
44256  <varlistentry>
44257   <term><parameter>cond</parameter></term>
44258   <listitem>
44259    <para>
44260     condition bits
44261    </para>
44262   </listitem>
44263  </varlistentry>
44264  <varlistentry>
44265   <term><parameter>var</parameter></term>
44266   <listitem>
44267    <para>
44268     hw_params variable to apply the list of range constraints
44269    </para>
44270   </listitem>
44271  </varlistentry>
44272  <varlistentry>
44273   <term><parameter>r</parameter></term>
44274   <listitem>
44275    <para>
44276     ranges
44277    </para>
44278   </listitem>
44279  </varlistentry>
44280 </variablelist>
44281</refsect1>
44282<refsect1>
44283<title>Description</title>
44284<para>
44285   Apply the list of range constraints to an interval parameter.
44286</para>
44287</refsect1>
44288<refsect1>
44289<title>Return</title>
44290<para>
44291   Zero if successful, or a negative error code on failure.
44292</para>
44293</refsect1>
44294</refentry>
44295
44296<refentry id="API-snd-pcm-hw-constraint-ratnums">
44297<refentryinfo>
44298 <title>LINUX</title>
44299 <productname>Kernel Hackers Manual</productname>
44300 <date>July 2017</date>
44301</refentryinfo>
44302<refmeta>
44303 <refentrytitle><phrase>snd_pcm_hw_constraint_ratnums</phrase></refentrytitle>
44304 <manvolnum>9</manvolnum>
44305 <refmiscinfo class="version">4.1.27</refmiscinfo>
44306</refmeta>
44307<refnamediv>
44308 <refname>snd_pcm_hw_constraint_ratnums</refname>
44309 <refpurpose>
44310     apply ratnums constraint to a parameter
44311 </refpurpose>
44312</refnamediv>
44313<refsynopsisdiv>
44314 <title>Synopsis</title>
44315  <funcsynopsis><funcprototype>
44316   <funcdef>int <function>snd_pcm_hw_constraint_ratnums </function></funcdef>
44317   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44318   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
44319   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44320   <paramdef>struct snd_pcm_hw_constraint_ratnums * <parameter>r</parameter></paramdef>
44321  </funcprototype></funcsynopsis>
44322</refsynopsisdiv>
44323<refsect1>
44324 <title>Arguments</title>
44325 <variablelist>
44326  <varlistentry>
44327   <term><parameter>runtime</parameter></term>
44328   <listitem>
44329    <para>
44330     PCM runtime instance
44331    </para>
44332   </listitem>
44333  </varlistentry>
44334  <varlistentry>
44335   <term><parameter>cond</parameter></term>
44336   <listitem>
44337    <para>
44338     condition bits
44339    </para>
44340   </listitem>
44341  </varlistentry>
44342  <varlistentry>
44343   <term><parameter>var</parameter></term>
44344   <listitem>
44345    <para>
44346     hw_params variable to apply the ratnums constraint
44347    </para>
44348   </listitem>
44349  </varlistentry>
44350  <varlistentry>
44351   <term><parameter>r</parameter></term>
44352   <listitem>
44353    <para>
44354     struct snd_ratnums constriants
44355    </para>
44356   </listitem>
44357  </varlistentry>
44358 </variablelist>
44359</refsect1>
44360<refsect1>
44361<title>Return</title>
44362<para>
44363   Zero if successful, or a negative error code on failure.
44364</para>
44365</refsect1>
44366</refentry>
44367
44368<refentry id="API-snd-pcm-hw-constraint-ratdens">
44369<refentryinfo>
44370 <title>LINUX</title>
44371 <productname>Kernel Hackers Manual</productname>
44372 <date>July 2017</date>
44373</refentryinfo>
44374<refmeta>
44375 <refentrytitle><phrase>snd_pcm_hw_constraint_ratdens</phrase></refentrytitle>
44376 <manvolnum>9</manvolnum>
44377 <refmiscinfo class="version">4.1.27</refmiscinfo>
44378</refmeta>
44379<refnamediv>
44380 <refname>snd_pcm_hw_constraint_ratdens</refname>
44381 <refpurpose>
44382     apply ratdens constraint to a parameter
44383 </refpurpose>
44384</refnamediv>
44385<refsynopsisdiv>
44386 <title>Synopsis</title>
44387  <funcsynopsis><funcprototype>
44388   <funcdef>int <function>snd_pcm_hw_constraint_ratdens </function></funcdef>
44389   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44390   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
44391   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44392   <paramdef>struct snd_pcm_hw_constraint_ratdens * <parameter>r</parameter></paramdef>
44393  </funcprototype></funcsynopsis>
44394</refsynopsisdiv>
44395<refsect1>
44396 <title>Arguments</title>
44397 <variablelist>
44398  <varlistentry>
44399   <term><parameter>runtime</parameter></term>
44400   <listitem>
44401    <para>
44402     PCM runtime instance
44403    </para>
44404   </listitem>
44405  </varlistentry>
44406  <varlistentry>
44407   <term><parameter>cond</parameter></term>
44408   <listitem>
44409    <para>
44410     condition bits
44411    </para>
44412   </listitem>
44413  </varlistentry>
44414  <varlistentry>
44415   <term><parameter>var</parameter></term>
44416   <listitem>
44417    <para>
44418     hw_params variable to apply the ratdens constraint
44419    </para>
44420   </listitem>
44421  </varlistentry>
44422  <varlistentry>
44423   <term><parameter>r</parameter></term>
44424   <listitem>
44425    <para>
44426     struct snd_ratdens constriants
44427    </para>
44428   </listitem>
44429  </varlistentry>
44430 </variablelist>
44431</refsect1>
44432<refsect1>
44433<title>Return</title>
44434<para>
44435   Zero if successful, or a negative error code on failure.
44436</para>
44437</refsect1>
44438</refentry>
44439
44440<refentry id="API-snd-pcm-hw-constraint-msbits">
44441<refentryinfo>
44442 <title>LINUX</title>
44443 <productname>Kernel Hackers Manual</productname>
44444 <date>July 2017</date>
44445</refentryinfo>
44446<refmeta>
44447 <refentrytitle><phrase>snd_pcm_hw_constraint_msbits</phrase></refentrytitle>
44448 <manvolnum>9</manvolnum>
44449 <refmiscinfo class="version">4.1.27</refmiscinfo>
44450</refmeta>
44451<refnamediv>
44452 <refname>snd_pcm_hw_constraint_msbits</refname>
44453 <refpurpose>
44454     add a hw constraint msbits rule
44455 </refpurpose>
44456</refnamediv>
44457<refsynopsisdiv>
44458 <title>Synopsis</title>
44459  <funcsynopsis><funcprototype>
44460   <funcdef>int <function>snd_pcm_hw_constraint_msbits </function></funcdef>
44461   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44462   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
44463   <paramdef>unsigned int <parameter>width</parameter></paramdef>
44464   <paramdef>unsigned int <parameter>msbits</parameter></paramdef>
44465  </funcprototype></funcsynopsis>
44466</refsynopsisdiv>
44467<refsect1>
44468 <title>Arguments</title>
44469 <variablelist>
44470  <varlistentry>
44471   <term><parameter>runtime</parameter></term>
44472   <listitem>
44473    <para>
44474     PCM runtime instance
44475    </para>
44476   </listitem>
44477  </varlistentry>
44478  <varlistentry>
44479   <term><parameter>cond</parameter></term>
44480   <listitem>
44481    <para>
44482     condition bits
44483    </para>
44484   </listitem>
44485  </varlistentry>
44486  <varlistentry>
44487   <term><parameter>width</parameter></term>
44488   <listitem>
44489    <para>
44490     sample bits width
44491    </para>
44492   </listitem>
44493  </varlistentry>
44494  <varlistentry>
44495   <term><parameter>msbits</parameter></term>
44496   <listitem>
44497    <para>
44498     msbits width
44499    </para>
44500   </listitem>
44501  </varlistentry>
44502 </variablelist>
44503</refsect1>
44504<refsect1>
44505<title>Description</title>
44506<para>
44507   This constraint will set the number of most significant bits (msbits) if a
44508   sample format with the specified width has been select. If width is set to 0
44509   the msbits will be set for any sample format with a width larger than the
44510   specified msbits.
44511</para>
44512</refsect1>
44513<refsect1>
44514<title>Return</title>
44515<para>
44516   Zero if successful, or a negative error code on failure.
44517</para>
44518</refsect1>
44519</refentry>
44520
44521<refentry id="API-snd-pcm-hw-constraint-step">
44522<refentryinfo>
44523 <title>LINUX</title>
44524 <productname>Kernel Hackers Manual</productname>
44525 <date>July 2017</date>
44526</refentryinfo>
44527<refmeta>
44528 <refentrytitle><phrase>snd_pcm_hw_constraint_step</phrase></refentrytitle>
44529 <manvolnum>9</manvolnum>
44530 <refmiscinfo class="version">4.1.27</refmiscinfo>
44531</refmeta>
44532<refnamediv>
44533 <refname>snd_pcm_hw_constraint_step</refname>
44534 <refpurpose>
44535     add a hw constraint step rule
44536 </refpurpose>
44537</refnamediv>
44538<refsynopsisdiv>
44539 <title>Synopsis</title>
44540  <funcsynopsis><funcprototype>
44541   <funcdef>int <function>snd_pcm_hw_constraint_step </function></funcdef>
44542   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44543   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
44544   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44545   <paramdef>unsigned long <parameter>step</parameter></paramdef>
44546  </funcprototype></funcsynopsis>
44547</refsynopsisdiv>
44548<refsect1>
44549 <title>Arguments</title>
44550 <variablelist>
44551  <varlistentry>
44552   <term><parameter>runtime</parameter></term>
44553   <listitem>
44554    <para>
44555     PCM runtime instance
44556    </para>
44557   </listitem>
44558  </varlistentry>
44559  <varlistentry>
44560   <term><parameter>cond</parameter></term>
44561   <listitem>
44562    <para>
44563     condition bits
44564    </para>
44565   </listitem>
44566  </varlistentry>
44567  <varlistentry>
44568   <term><parameter>var</parameter></term>
44569   <listitem>
44570    <para>
44571     hw_params variable to apply the step constraint
44572    </para>
44573   </listitem>
44574  </varlistentry>
44575  <varlistentry>
44576   <term><parameter>step</parameter></term>
44577   <listitem>
44578    <para>
44579     step size
44580    </para>
44581   </listitem>
44582  </varlistentry>
44583 </variablelist>
44584</refsect1>
44585<refsect1>
44586<title>Return</title>
44587<para>
44588   Zero if successful, or a negative error code on failure.
44589</para>
44590</refsect1>
44591</refentry>
44592
44593<refentry id="API-snd-pcm-hw-constraint-pow2">
44594<refentryinfo>
44595 <title>LINUX</title>
44596 <productname>Kernel Hackers Manual</productname>
44597 <date>July 2017</date>
44598</refentryinfo>
44599<refmeta>
44600 <refentrytitle><phrase>snd_pcm_hw_constraint_pow2</phrase></refentrytitle>
44601 <manvolnum>9</manvolnum>
44602 <refmiscinfo class="version">4.1.27</refmiscinfo>
44603</refmeta>
44604<refnamediv>
44605 <refname>snd_pcm_hw_constraint_pow2</refname>
44606 <refpurpose>
44607     add a hw constraint power-of-2 rule
44608 </refpurpose>
44609</refnamediv>
44610<refsynopsisdiv>
44611 <title>Synopsis</title>
44612  <funcsynopsis><funcprototype>
44613   <funcdef>int <function>snd_pcm_hw_constraint_pow2 </function></funcdef>
44614   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44615   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
44616   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44617  </funcprototype></funcsynopsis>
44618</refsynopsisdiv>
44619<refsect1>
44620 <title>Arguments</title>
44621 <variablelist>
44622  <varlistentry>
44623   <term><parameter>runtime</parameter></term>
44624   <listitem>
44625    <para>
44626     PCM runtime instance
44627    </para>
44628   </listitem>
44629  </varlistentry>
44630  <varlistentry>
44631   <term><parameter>cond</parameter></term>
44632   <listitem>
44633    <para>
44634     condition bits
44635    </para>
44636   </listitem>
44637  </varlistentry>
44638  <varlistentry>
44639   <term><parameter>var</parameter></term>
44640   <listitem>
44641    <para>
44642     hw_params variable to apply the power-of-2 constraint
44643    </para>
44644   </listitem>
44645  </varlistentry>
44646 </variablelist>
44647</refsect1>
44648<refsect1>
44649<title>Return</title>
44650<para>
44651   Zero if successful, or a negative error code on failure.
44652</para>
44653</refsect1>
44654</refentry>
44655
44656<refentry id="API-snd-pcm-hw-rule-noresample">
44657<refentryinfo>
44658 <title>LINUX</title>
44659 <productname>Kernel Hackers Manual</productname>
44660 <date>July 2017</date>
44661</refentryinfo>
44662<refmeta>
44663 <refentrytitle><phrase>snd_pcm_hw_rule_noresample</phrase></refentrytitle>
44664 <manvolnum>9</manvolnum>
44665 <refmiscinfo class="version">4.1.27</refmiscinfo>
44666</refmeta>
44667<refnamediv>
44668 <refname>snd_pcm_hw_rule_noresample</refname>
44669 <refpurpose>
44670     add a rule to allow disabling hw resampling
44671 </refpurpose>
44672</refnamediv>
44673<refsynopsisdiv>
44674 <title>Synopsis</title>
44675  <funcsynopsis><funcprototype>
44676   <funcdef>int <function>snd_pcm_hw_rule_noresample </function></funcdef>
44677   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
44678   <paramdef>unsigned int <parameter>base_rate</parameter></paramdef>
44679  </funcprototype></funcsynopsis>
44680</refsynopsisdiv>
44681<refsect1>
44682 <title>Arguments</title>
44683 <variablelist>
44684  <varlistentry>
44685   <term><parameter>runtime</parameter></term>
44686   <listitem>
44687    <para>
44688     PCM runtime instance
44689    </para>
44690   </listitem>
44691  </varlistentry>
44692  <varlistentry>
44693   <term><parameter>base_rate</parameter></term>
44694   <listitem>
44695    <para>
44696     the rate at which the hardware does not resample
44697    </para>
44698   </listitem>
44699  </varlistentry>
44700 </variablelist>
44701</refsect1>
44702<refsect1>
44703<title>Return</title>
44704<para>
44705   Zero if successful, or a negative error code on failure.
44706</para>
44707</refsect1>
44708</refentry>
44709
44710<refentry id="API-snd-pcm-hw-param-value">
44711<refentryinfo>
44712 <title>LINUX</title>
44713 <productname>Kernel Hackers Manual</productname>
44714 <date>July 2017</date>
44715</refentryinfo>
44716<refmeta>
44717 <refentrytitle><phrase>snd_pcm_hw_param_value</phrase></refentrytitle>
44718 <manvolnum>9</manvolnum>
44719 <refmiscinfo class="version">4.1.27</refmiscinfo>
44720</refmeta>
44721<refnamediv>
44722 <refname>snd_pcm_hw_param_value</refname>
44723 <refpurpose>
44724     return <parameter>params</parameter> field <parameter>var</parameter> value
44725 </refpurpose>
44726</refnamediv>
44727<refsynopsisdiv>
44728 <title>Synopsis</title>
44729  <funcsynopsis><funcprototype>
44730   <funcdef>int <function>snd_pcm_hw_param_value </function></funcdef>
44731   <paramdef>const struct snd_pcm_hw_params * <parameter>params</parameter></paramdef>
44732   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44733   <paramdef>int * <parameter>dir</parameter></paramdef>
44734  </funcprototype></funcsynopsis>
44735</refsynopsisdiv>
44736<refsect1>
44737 <title>Arguments</title>
44738 <variablelist>
44739  <varlistentry>
44740   <term><parameter>params</parameter></term>
44741   <listitem>
44742    <para>
44743     the hw_params instance
44744    </para>
44745   </listitem>
44746  </varlistentry>
44747  <varlistentry>
44748   <term><parameter>var</parameter></term>
44749   <listitem>
44750    <para>
44751     parameter to retrieve
44752    </para>
44753   </listitem>
44754  </varlistentry>
44755  <varlistentry>
44756   <term><parameter>dir</parameter></term>
44757   <listitem>
44758    <para>
44759     pointer to the direction (-1,0,1) or <constant>NULL</constant>
44760    </para>
44761   </listitem>
44762  </varlistentry>
44763 </variablelist>
44764</refsect1>
44765<refsect1>
44766<title>Return</title>
44767<para>
44768   The value for field <parameter>var</parameter> if it's fixed in configuration space
44769   defined by <parameter>params</parameter>. -<constant>EINVAL</constant> otherwise.
44770</para>
44771</refsect1>
44772</refentry>
44773
44774<refentry id="API-snd-pcm-hw-param-first">
44775<refentryinfo>
44776 <title>LINUX</title>
44777 <productname>Kernel Hackers Manual</productname>
44778 <date>July 2017</date>
44779</refentryinfo>
44780<refmeta>
44781 <refentrytitle><phrase>snd_pcm_hw_param_first</phrase></refentrytitle>
44782 <manvolnum>9</manvolnum>
44783 <refmiscinfo class="version">4.1.27</refmiscinfo>
44784</refmeta>
44785<refnamediv>
44786 <refname>snd_pcm_hw_param_first</refname>
44787 <refpurpose>
44788     refine config space and return minimum value
44789 </refpurpose>
44790</refnamediv>
44791<refsynopsisdiv>
44792 <title>Synopsis</title>
44793  <funcsynopsis><funcprototype>
44794   <funcdef>int <function>snd_pcm_hw_param_first </function></funcdef>
44795   <paramdef>struct snd_pcm_substream * <parameter>pcm</parameter></paramdef>
44796   <paramdef>struct snd_pcm_hw_params * <parameter>params</parameter></paramdef>
44797   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44798   <paramdef>int * <parameter>dir</parameter></paramdef>
44799  </funcprototype></funcsynopsis>
44800</refsynopsisdiv>
44801<refsect1>
44802 <title>Arguments</title>
44803 <variablelist>
44804  <varlistentry>
44805   <term><parameter>pcm</parameter></term>
44806   <listitem>
44807    <para>
44808     PCM instance
44809    </para>
44810   </listitem>
44811  </varlistentry>
44812  <varlistentry>
44813   <term><parameter>params</parameter></term>
44814   <listitem>
44815    <para>
44816     the hw_params instance
44817    </para>
44818   </listitem>
44819  </varlistentry>
44820  <varlistentry>
44821   <term><parameter>var</parameter></term>
44822   <listitem>
44823    <para>
44824     parameter to retrieve
44825    </para>
44826   </listitem>
44827  </varlistentry>
44828  <varlistentry>
44829   <term><parameter>dir</parameter></term>
44830   <listitem>
44831    <para>
44832     pointer to the direction (-1,0,1) or <constant>NULL</constant>
44833    </para>
44834   </listitem>
44835  </varlistentry>
44836 </variablelist>
44837</refsect1>
44838<refsect1>
44839<title>Description</title>
44840<para>
44841   Inside configuration space defined by <parameter>params</parameter> remove from <parameter>var</parameter> all
44842   values &gt; minimum. Reduce configuration space accordingly.
44843</para>
44844</refsect1>
44845<refsect1>
44846<title>Return</title>
44847<para>
44848   The minimum, or a negative error code on failure.
44849</para>
44850</refsect1>
44851</refentry>
44852
44853<refentry id="API-snd-pcm-hw-param-last">
44854<refentryinfo>
44855 <title>LINUX</title>
44856 <productname>Kernel Hackers Manual</productname>
44857 <date>July 2017</date>
44858</refentryinfo>
44859<refmeta>
44860 <refentrytitle><phrase>snd_pcm_hw_param_last</phrase></refentrytitle>
44861 <manvolnum>9</manvolnum>
44862 <refmiscinfo class="version">4.1.27</refmiscinfo>
44863</refmeta>
44864<refnamediv>
44865 <refname>snd_pcm_hw_param_last</refname>
44866 <refpurpose>
44867     refine config space and return maximum value
44868 </refpurpose>
44869</refnamediv>
44870<refsynopsisdiv>
44871 <title>Synopsis</title>
44872  <funcsynopsis><funcprototype>
44873   <funcdef>int <function>snd_pcm_hw_param_last </function></funcdef>
44874   <paramdef>struct snd_pcm_substream * <parameter>pcm</parameter></paramdef>
44875   <paramdef>struct snd_pcm_hw_params * <parameter>params</parameter></paramdef>
44876   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
44877   <paramdef>int * <parameter>dir</parameter></paramdef>
44878  </funcprototype></funcsynopsis>
44879</refsynopsisdiv>
44880<refsect1>
44881 <title>Arguments</title>
44882 <variablelist>
44883  <varlistentry>
44884   <term><parameter>pcm</parameter></term>
44885   <listitem>
44886    <para>
44887     PCM instance
44888    </para>
44889   </listitem>
44890  </varlistentry>
44891  <varlistentry>
44892   <term><parameter>params</parameter></term>
44893   <listitem>
44894    <para>
44895     the hw_params instance
44896    </para>
44897   </listitem>
44898  </varlistentry>
44899  <varlistentry>
44900   <term><parameter>var</parameter></term>
44901   <listitem>
44902    <para>
44903     parameter to retrieve
44904    </para>
44905   </listitem>
44906  </varlistentry>
44907  <varlistentry>
44908   <term><parameter>dir</parameter></term>
44909   <listitem>
44910    <para>
44911     pointer to the direction (-1,0,1) or <constant>NULL</constant>
44912    </para>
44913   </listitem>
44914  </varlistentry>
44915 </variablelist>
44916</refsect1>
44917<refsect1>
44918<title>Description</title>
44919<para>
44920   Inside configuration space defined by <parameter>params</parameter> remove from <parameter>var</parameter> all
44921   values &lt; maximum. Reduce configuration space accordingly.
44922</para>
44923</refsect1>
44924<refsect1>
44925<title>Return</title>
44926<para>
44927   The maximum, or a negative error code on failure.
44928</para>
44929</refsect1>
44930</refentry>
44931
44932<refentry id="API-snd-pcm-lib-ioctl">
44933<refentryinfo>
44934 <title>LINUX</title>
44935 <productname>Kernel Hackers Manual</productname>
44936 <date>July 2017</date>
44937</refentryinfo>
44938<refmeta>
44939 <refentrytitle><phrase>snd_pcm_lib_ioctl</phrase></refentrytitle>
44940 <manvolnum>9</manvolnum>
44941 <refmiscinfo class="version">4.1.27</refmiscinfo>
44942</refmeta>
44943<refnamediv>
44944 <refname>snd_pcm_lib_ioctl</refname>
44945 <refpurpose>
44946     a generic PCM ioctl callback
44947 </refpurpose>
44948</refnamediv>
44949<refsynopsisdiv>
44950 <title>Synopsis</title>
44951  <funcsynopsis><funcprototype>
44952   <funcdef>int <function>snd_pcm_lib_ioctl </function></funcdef>
44953   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
44954   <paramdef>unsigned int <parameter>cmd</parameter></paramdef>
44955   <paramdef>void * <parameter>arg</parameter></paramdef>
44956  </funcprototype></funcsynopsis>
44957</refsynopsisdiv>
44958<refsect1>
44959 <title>Arguments</title>
44960 <variablelist>
44961  <varlistentry>
44962   <term><parameter>substream</parameter></term>
44963   <listitem>
44964    <para>
44965     the pcm substream instance
44966    </para>
44967   </listitem>
44968  </varlistentry>
44969  <varlistentry>
44970   <term><parameter>cmd</parameter></term>
44971   <listitem>
44972    <para>
44973     ioctl command
44974    </para>
44975   </listitem>
44976  </varlistentry>
44977  <varlistentry>
44978   <term><parameter>arg</parameter></term>
44979   <listitem>
44980    <para>
44981     ioctl argument
44982    </para>
44983   </listitem>
44984  </varlistentry>
44985 </variablelist>
44986</refsect1>
44987<refsect1>
44988<title>Description</title>
44989<para>
44990   Processes the generic ioctl commands for PCM.
44991   Can be passed as the ioctl callback for PCM ops.
44992</para>
44993</refsect1>
44994<refsect1>
44995<title>Return</title>
44996<para>
44997   Zero if successful, or a negative error code on failure.
44998</para>
44999</refsect1>
45000</refentry>
45001
45002<refentry id="API-snd-pcm-period-elapsed">
45003<refentryinfo>
45004 <title>LINUX</title>
45005 <productname>Kernel Hackers Manual</productname>
45006 <date>July 2017</date>
45007</refentryinfo>
45008<refmeta>
45009 <refentrytitle><phrase>snd_pcm_period_elapsed</phrase></refentrytitle>
45010 <manvolnum>9</manvolnum>
45011 <refmiscinfo class="version">4.1.27</refmiscinfo>
45012</refmeta>
45013<refnamediv>
45014 <refname>snd_pcm_period_elapsed</refname>
45015 <refpurpose>
45016     update the pcm status for the next period
45017 </refpurpose>
45018</refnamediv>
45019<refsynopsisdiv>
45020 <title>Synopsis</title>
45021  <funcsynopsis><funcprototype>
45022   <funcdef>void <function>snd_pcm_period_elapsed </function></funcdef>
45023   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45024  </funcprototype></funcsynopsis>
45025</refsynopsisdiv>
45026<refsect1>
45027 <title>Arguments</title>
45028 <variablelist>
45029  <varlistentry>
45030   <term><parameter>substream</parameter></term>
45031   <listitem>
45032    <para>
45033     the pcm substream instance
45034    </para>
45035   </listitem>
45036  </varlistentry>
45037 </variablelist>
45038</refsect1>
45039<refsect1>
45040<title>Description</title>
45041<para>
45042   This function is called from the interrupt handler when the
45043   PCM has processed the period size.  It will update the current
45044   pointer, wake up sleepers, etc.
45045   </para><para>
45046
45047   Even if more than one periods have elapsed since the last call, you
45048   have to call this only once.
45049</para>
45050</refsect1>
45051</refentry>
45052
45053<refentry id="API-snd-pcm-add-chmap-ctls">
45054<refentryinfo>
45055 <title>LINUX</title>
45056 <productname>Kernel Hackers Manual</productname>
45057 <date>July 2017</date>
45058</refentryinfo>
45059<refmeta>
45060 <refentrytitle><phrase>snd_pcm_add_chmap_ctls</phrase></refentrytitle>
45061 <manvolnum>9</manvolnum>
45062 <refmiscinfo class="version">4.1.27</refmiscinfo>
45063</refmeta>
45064<refnamediv>
45065 <refname>snd_pcm_add_chmap_ctls</refname>
45066 <refpurpose>
45067     create channel-mapping control elements
45068 </refpurpose>
45069</refnamediv>
45070<refsynopsisdiv>
45071 <title>Synopsis</title>
45072  <funcsynopsis><funcprototype>
45073   <funcdef>int <function>snd_pcm_add_chmap_ctls </function></funcdef>
45074   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
45075   <paramdef>int <parameter>stream</parameter></paramdef>
45076   <paramdef>const struct snd_pcm_chmap_elem * <parameter>chmap</parameter></paramdef>
45077   <paramdef>int <parameter>max_channels</parameter></paramdef>
45078   <paramdef>unsigned long <parameter>private_value</parameter></paramdef>
45079   <paramdef>struct snd_pcm_chmap ** <parameter>info_ret</parameter></paramdef>
45080  </funcprototype></funcsynopsis>
45081</refsynopsisdiv>
45082<refsect1>
45083 <title>Arguments</title>
45084 <variablelist>
45085  <varlistentry>
45086   <term><parameter>pcm</parameter></term>
45087   <listitem>
45088    <para>
45089     the assigned PCM instance
45090    </para>
45091   </listitem>
45092  </varlistentry>
45093  <varlistentry>
45094   <term><parameter>stream</parameter></term>
45095   <listitem>
45096    <para>
45097     stream direction
45098    </para>
45099   </listitem>
45100  </varlistentry>
45101  <varlistentry>
45102   <term><parameter>chmap</parameter></term>
45103   <listitem>
45104    <para>
45105     channel map elements (for query)
45106    </para>
45107   </listitem>
45108  </varlistentry>
45109  <varlistentry>
45110   <term><parameter>max_channels</parameter></term>
45111   <listitem>
45112    <para>
45113     the max number of channels for the stream
45114    </para>
45115   </listitem>
45116  </varlistentry>
45117  <varlistentry>
45118   <term><parameter>private_value</parameter></term>
45119   <listitem>
45120    <para>
45121     the value passed to each kcontrol's private_value field
45122    </para>
45123   </listitem>
45124  </varlistentry>
45125  <varlistentry>
45126   <term><parameter>info_ret</parameter></term>
45127   <listitem>
45128    <para>
45129     store struct snd_pcm_chmap instance if non-NULL
45130    </para>
45131   </listitem>
45132  </varlistentry>
45133 </variablelist>
45134</refsect1>
45135<refsect1>
45136<title>Description</title>
45137<para>
45138   Create channel-mapping control elements assigned to the given PCM stream(s).
45139</para>
45140</refsect1>
45141<refsect1>
45142<title>Return</title>
45143<para>
45144   Zero if successful, or a negative error value.
45145</para>
45146</refsect1>
45147</refentry>
45148
45149<!-- sound/core/hwdep.c -->
45150<refentry id="API-snd-hwdep-new">
45151<refentryinfo>
45152 <title>LINUX</title>
45153 <productname>Kernel Hackers Manual</productname>
45154 <date>July 2017</date>
45155</refentryinfo>
45156<refmeta>
45157 <refentrytitle><phrase>snd_hwdep_new</phrase></refentrytitle>
45158 <manvolnum>9</manvolnum>
45159 <refmiscinfo class="version">4.1.27</refmiscinfo>
45160</refmeta>
45161<refnamediv>
45162 <refname>snd_hwdep_new</refname>
45163 <refpurpose>
45164  create a new hwdep instance
45165 </refpurpose>
45166</refnamediv>
45167<refsynopsisdiv>
45168 <title>Synopsis</title>
45169  <funcsynopsis><funcprototype>
45170   <funcdef>int <function>snd_hwdep_new </function></funcdef>
45171   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
45172   <paramdef>char * <parameter>id</parameter></paramdef>
45173   <paramdef>int <parameter>device</parameter></paramdef>
45174   <paramdef>struct snd_hwdep ** <parameter>rhwdep</parameter></paramdef>
45175  </funcprototype></funcsynopsis>
45176</refsynopsisdiv>
45177<refsect1>
45178 <title>Arguments</title>
45179 <variablelist>
45180  <varlistentry>
45181   <term><parameter>card</parameter></term>
45182   <listitem>
45183    <para>
45184     the card instance
45185    </para>
45186   </listitem>
45187  </varlistentry>
45188  <varlistentry>
45189   <term><parameter>id</parameter></term>
45190   <listitem>
45191    <para>
45192     the id string
45193    </para>
45194   </listitem>
45195  </varlistentry>
45196  <varlistentry>
45197   <term><parameter>device</parameter></term>
45198   <listitem>
45199    <para>
45200     the device index (zero-based)
45201    </para>
45202   </listitem>
45203  </varlistentry>
45204  <varlistentry>
45205   <term><parameter>rhwdep</parameter></term>
45206   <listitem>
45207    <para>
45208     the pointer to store the new hwdep instance
45209    </para>
45210   </listitem>
45211  </varlistentry>
45212 </variablelist>
45213</refsect1>
45214<refsect1>
45215<title>Description</title>
45216<para>
45217   Creates a new hwdep instance with the given index on the card.
45218   The callbacks (hwdep-&gt;ops) must be set on the returned instance
45219   after this call manually by the caller.
45220</para>
45221</refsect1>
45222<refsect1>
45223<title>Return</title>
45224<para>
45225   Zero if successful, or a negative error code on failure.
45226</para>
45227</refsect1>
45228</refentry>
45229
45230<!-- sound/core/pcm_native.c -->
45231<refentry id="API-snd-pcm-stream-lock">
45232<refentryinfo>
45233 <title>LINUX</title>
45234 <productname>Kernel Hackers Manual</productname>
45235 <date>July 2017</date>
45236</refentryinfo>
45237<refmeta>
45238 <refentrytitle><phrase>snd_pcm_stream_lock</phrase></refentrytitle>
45239 <manvolnum>9</manvolnum>
45240 <refmiscinfo class="version">4.1.27</refmiscinfo>
45241</refmeta>
45242<refnamediv>
45243 <refname>snd_pcm_stream_lock</refname>
45244 <refpurpose>
45245  Lock the PCM stream
45246 </refpurpose>
45247</refnamediv>
45248<refsynopsisdiv>
45249 <title>Synopsis</title>
45250  <funcsynopsis><funcprototype>
45251   <funcdef>void <function>snd_pcm_stream_lock </function></funcdef>
45252   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45253  </funcprototype></funcsynopsis>
45254</refsynopsisdiv>
45255<refsect1>
45256 <title>Arguments</title>
45257 <variablelist>
45258  <varlistentry>
45259   <term><parameter>substream</parameter></term>
45260   <listitem>
45261    <para>
45262     PCM substream
45263    </para>
45264   </listitem>
45265  </varlistentry>
45266 </variablelist>
45267</refsect1>
45268<refsect1>
45269<title>Description</title>
45270<para>
45271   This locks the PCM stream's spinlock or mutex depending on the nonatomic
45272   flag of the given substream.  This also takes the global link rw lock
45273   (or rw sem), too, for avoiding the race with linked streams.
45274</para>
45275</refsect1>
45276</refentry>
45277
45278<refentry id="API-snd-pcm-stream-unlock">
45279<refentryinfo>
45280 <title>LINUX</title>
45281 <productname>Kernel Hackers Manual</productname>
45282 <date>July 2017</date>
45283</refentryinfo>
45284<refmeta>
45285 <refentrytitle><phrase>snd_pcm_stream_unlock</phrase></refentrytitle>
45286 <manvolnum>9</manvolnum>
45287 <refmiscinfo class="version">4.1.27</refmiscinfo>
45288</refmeta>
45289<refnamediv>
45290 <refname>snd_pcm_stream_unlock</refname>
45291 <refpurpose>
45292     Unlock the PCM stream
45293 </refpurpose>
45294</refnamediv>
45295<refsynopsisdiv>
45296 <title>Synopsis</title>
45297  <funcsynopsis><funcprototype>
45298   <funcdef>void <function>snd_pcm_stream_unlock </function></funcdef>
45299   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45300  </funcprototype></funcsynopsis>
45301</refsynopsisdiv>
45302<refsect1>
45303 <title>Arguments</title>
45304 <variablelist>
45305  <varlistentry>
45306   <term><parameter>substream</parameter></term>
45307   <listitem>
45308    <para>
45309     PCM substream
45310    </para>
45311   </listitem>
45312  </varlistentry>
45313 </variablelist>
45314</refsect1>
45315<refsect1>
45316<title>Description</title>
45317<para>
45318   This unlocks the PCM stream that has been locked via <function>snd_pcm_stream_lock</function>.
45319</para>
45320</refsect1>
45321</refentry>
45322
45323<refentry id="API-snd-pcm-stream-lock-irq">
45324<refentryinfo>
45325 <title>LINUX</title>
45326 <productname>Kernel Hackers Manual</productname>
45327 <date>July 2017</date>
45328</refentryinfo>
45329<refmeta>
45330 <refentrytitle><phrase>snd_pcm_stream_lock_irq</phrase></refentrytitle>
45331 <manvolnum>9</manvolnum>
45332 <refmiscinfo class="version">4.1.27</refmiscinfo>
45333</refmeta>
45334<refnamediv>
45335 <refname>snd_pcm_stream_lock_irq</refname>
45336 <refpurpose>
45337     Lock the PCM stream
45338 </refpurpose>
45339</refnamediv>
45340<refsynopsisdiv>
45341 <title>Synopsis</title>
45342  <funcsynopsis><funcprototype>
45343   <funcdef>void <function>snd_pcm_stream_lock_irq </function></funcdef>
45344   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45345  </funcprototype></funcsynopsis>
45346</refsynopsisdiv>
45347<refsect1>
45348 <title>Arguments</title>
45349 <variablelist>
45350  <varlistentry>
45351   <term><parameter>substream</parameter></term>
45352   <listitem>
45353    <para>
45354     PCM substream
45355    </para>
45356   </listitem>
45357  </varlistentry>
45358 </variablelist>
45359</refsect1>
45360<refsect1>
45361<title>Description</title>
45362<para>
45363   This locks the PCM stream like <function>snd_pcm_stream_lock</function> and disables the local
45364   IRQ (only when nonatomic is false).  In nonatomic case, this is identical
45365   as <function>snd_pcm_stream_lock</function>.
45366</para>
45367</refsect1>
45368</refentry>
45369
45370<refentry id="API-snd-pcm-stream-unlock-irq">
45371<refentryinfo>
45372 <title>LINUX</title>
45373 <productname>Kernel Hackers Manual</productname>
45374 <date>July 2017</date>
45375</refentryinfo>
45376<refmeta>
45377 <refentrytitle><phrase>snd_pcm_stream_unlock_irq</phrase></refentrytitle>
45378 <manvolnum>9</manvolnum>
45379 <refmiscinfo class="version">4.1.27</refmiscinfo>
45380</refmeta>
45381<refnamediv>
45382 <refname>snd_pcm_stream_unlock_irq</refname>
45383 <refpurpose>
45384     Unlock the PCM stream
45385 </refpurpose>
45386</refnamediv>
45387<refsynopsisdiv>
45388 <title>Synopsis</title>
45389  <funcsynopsis><funcprototype>
45390   <funcdef>void <function>snd_pcm_stream_unlock_irq </function></funcdef>
45391   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45392  </funcprototype></funcsynopsis>
45393</refsynopsisdiv>
45394<refsect1>
45395 <title>Arguments</title>
45396 <variablelist>
45397  <varlistentry>
45398   <term><parameter>substream</parameter></term>
45399   <listitem>
45400    <para>
45401     PCM substream
45402    </para>
45403   </listitem>
45404  </varlistentry>
45405 </variablelist>
45406</refsect1>
45407<refsect1>
45408<title>Description</title>
45409<para>
45410   This is a counter-part of <function>snd_pcm_stream_lock_irq</function>.
45411</para>
45412</refsect1>
45413</refentry>
45414
45415<refentry id="API-snd-pcm-stream-unlock-irqrestore">
45416<refentryinfo>
45417 <title>LINUX</title>
45418 <productname>Kernel Hackers Manual</productname>
45419 <date>July 2017</date>
45420</refentryinfo>
45421<refmeta>
45422 <refentrytitle><phrase>snd_pcm_stream_unlock_irqrestore</phrase></refentrytitle>
45423 <manvolnum>9</manvolnum>
45424 <refmiscinfo class="version">4.1.27</refmiscinfo>
45425</refmeta>
45426<refnamediv>
45427 <refname>snd_pcm_stream_unlock_irqrestore</refname>
45428 <refpurpose>
45429     Unlock the PCM stream
45430 </refpurpose>
45431</refnamediv>
45432<refsynopsisdiv>
45433 <title>Synopsis</title>
45434  <funcsynopsis><funcprototype>
45435   <funcdef>void <function>snd_pcm_stream_unlock_irqrestore </function></funcdef>
45436   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45437   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
45438  </funcprototype></funcsynopsis>
45439</refsynopsisdiv>
45440<refsect1>
45441 <title>Arguments</title>
45442 <variablelist>
45443  <varlistentry>
45444   <term><parameter>substream</parameter></term>
45445   <listitem>
45446    <para>
45447     PCM substream
45448    </para>
45449   </listitem>
45450  </varlistentry>
45451  <varlistentry>
45452   <term><parameter>flags</parameter></term>
45453   <listitem>
45454    <para>
45455     irq flags
45456    </para>
45457   </listitem>
45458  </varlistentry>
45459 </variablelist>
45460</refsect1>
45461<refsect1>
45462<title>Description</title>
45463<para>
45464   This is a counter-part of <function>snd_pcm_stream_lock_irqsave</function>.
45465</para>
45466</refsect1>
45467</refentry>
45468
45469<refentry id="API-snd-pcm-stop">
45470<refentryinfo>
45471 <title>LINUX</title>
45472 <productname>Kernel Hackers Manual</productname>
45473 <date>July 2017</date>
45474</refentryinfo>
45475<refmeta>
45476 <refentrytitle><phrase>snd_pcm_stop</phrase></refentrytitle>
45477 <manvolnum>9</manvolnum>
45478 <refmiscinfo class="version">4.1.27</refmiscinfo>
45479</refmeta>
45480<refnamediv>
45481 <refname>snd_pcm_stop</refname>
45482 <refpurpose>
45483     try to stop all running streams in the substream group
45484 </refpurpose>
45485</refnamediv>
45486<refsynopsisdiv>
45487 <title>Synopsis</title>
45488  <funcsynopsis><funcprototype>
45489   <funcdef>int <function>snd_pcm_stop </function></funcdef>
45490   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45491   <paramdef>snd_pcm_state_t <parameter>state</parameter></paramdef>
45492  </funcprototype></funcsynopsis>
45493</refsynopsisdiv>
45494<refsect1>
45495 <title>Arguments</title>
45496 <variablelist>
45497  <varlistentry>
45498   <term><parameter>substream</parameter></term>
45499   <listitem>
45500    <para>
45501     the PCM substream instance
45502    </para>
45503   </listitem>
45504  </varlistentry>
45505  <varlistentry>
45506   <term><parameter>state</parameter></term>
45507   <listitem>
45508    <para>
45509     PCM state after stopping the stream
45510    </para>
45511   </listitem>
45512  </varlistentry>
45513 </variablelist>
45514</refsect1>
45515<refsect1>
45516<title>Description</title>
45517<para>
45518   The state of each stream is then changed to the given state unconditionally.
45519</para>
45520</refsect1>
45521<refsect1>
45522<title>Return</title>
45523<para>
45524   Zero if successful, or a negative error code.
45525</para>
45526</refsect1>
45527</refentry>
45528
45529<refentry id="API-snd-pcm-stop-xrun">
45530<refentryinfo>
45531 <title>LINUX</title>
45532 <productname>Kernel Hackers Manual</productname>
45533 <date>July 2017</date>
45534</refentryinfo>
45535<refmeta>
45536 <refentrytitle><phrase>snd_pcm_stop_xrun</phrase></refentrytitle>
45537 <manvolnum>9</manvolnum>
45538 <refmiscinfo class="version">4.1.27</refmiscinfo>
45539</refmeta>
45540<refnamediv>
45541 <refname>snd_pcm_stop_xrun</refname>
45542 <refpurpose>
45543     stop the running streams as XRUN
45544 </refpurpose>
45545</refnamediv>
45546<refsynopsisdiv>
45547 <title>Synopsis</title>
45548  <funcsynopsis><funcprototype>
45549   <funcdef>int <function>snd_pcm_stop_xrun </function></funcdef>
45550   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45551  </funcprototype></funcsynopsis>
45552</refsynopsisdiv>
45553<refsect1>
45554 <title>Arguments</title>
45555 <variablelist>
45556  <varlistentry>
45557   <term><parameter>substream</parameter></term>
45558   <listitem>
45559    <para>
45560     the PCM substream instance
45561    </para>
45562   </listitem>
45563  </varlistentry>
45564 </variablelist>
45565</refsect1>
45566<refsect1>
45567<title>Description</title>
45568<para>
45569   This stops the given running substream (and all linked substreams) as XRUN.
45570   Unlike <function>snd_pcm_stop</function>, this function takes the substream lock by itself.
45571</para>
45572</refsect1>
45573<refsect1>
45574<title>Return</title>
45575<para>
45576   Zero if successful, or a negative error code.
45577</para>
45578</refsect1>
45579</refentry>
45580
45581<refentry id="API-snd-pcm-suspend">
45582<refentryinfo>
45583 <title>LINUX</title>
45584 <productname>Kernel Hackers Manual</productname>
45585 <date>July 2017</date>
45586</refentryinfo>
45587<refmeta>
45588 <refentrytitle><phrase>snd_pcm_suspend</phrase></refentrytitle>
45589 <manvolnum>9</manvolnum>
45590 <refmiscinfo class="version">4.1.27</refmiscinfo>
45591</refmeta>
45592<refnamediv>
45593 <refname>snd_pcm_suspend</refname>
45594 <refpurpose>
45595     trigger SUSPEND to all linked streams
45596 </refpurpose>
45597</refnamediv>
45598<refsynopsisdiv>
45599 <title>Synopsis</title>
45600  <funcsynopsis><funcprototype>
45601   <funcdef>int <function>snd_pcm_suspend </function></funcdef>
45602   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45603  </funcprototype></funcsynopsis>
45604</refsynopsisdiv>
45605<refsect1>
45606 <title>Arguments</title>
45607 <variablelist>
45608  <varlistentry>
45609   <term><parameter>substream</parameter></term>
45610   <listitem>
45611    <para>
45612     the PCM substream
45613    </para>
45614   </listitem>
45615  </varlistentry>
45616 </variablelist>
45617</refsect1>
45618<refsect1>
45619<title>Description</title>
45620<para>
45621   After this call, all streams are changed to SUSPENDED state.
45622</para>
45623</refsect1>
45624<refsect1>
45625<title>Return</title>
45626<para>
45627   Zero if successful (or <parameter>substream</parameter> is <constant>NULL</constant>), or a negative error
45628   code.
45629</para>
45630</refsect1>
45631</refentry>
45632
45633<refentry id="API-snd-pcm-suspend-all">
45634<refentryinfo>
45635 <title>LINUX</title>
45636 <productname>Kernel Hackers Manual</productname>
45637 <date>July 2017</date>
45638</refentryinfo>
45639<refmeta>
45640 <refentrytitle><phrase>snd_pcm_suspend_all</phrase></refentrytitle>
45641 <manvolnum>9</manvolnum>
45642 <refmiscinfo class="version">4.1.27</refmiscinfo>
45643</refmeta>
45644<refnamediv>
45645 <refname>snd_pcm_suspend_all</refname>
45646 <refpurpose>
45647     trigger SUSPEND to all substreams in the given pcm
45648 </refpurpose>
45649</refnamediv>
45650<refsynopsisdiv>
45651 <title>Synopsis</title>
45652  <funcsynopsis><funcprototype>
45653   <funcdef>int <function>snd_pcm_suspend_all </function></funcdef>
45654   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
45655  </funcprototype></funcsynopsis>
45656</refsynopsisdiv>
45657<refsect1>
45658 <title>Arguments</title>
45659 <variablelist>
45660  <varlistentry>
45661   <term><parameter>pcm</parameter></term>
45662   <listitem>
45663    <para>
45664     the PCM instance
45665    </para>
45666   </listitem>
45667  </varlistentry>
45668 </variablelist>
45669</refsect1>
45670<refsect1>
45671<title>Description</title>
45672<para>
45673   After this call, all streams are changed to SUSPENDED state.
45674</para>
45675</refsect1>
45676<refsect1>
45677<title>Return</title>
45678<para>
45679   Zero if successful (or <parameter>pcm</parameter> is <constant>NULL</constant>), or a negative error code.
45680</para>
45681</refsect1>
45682</refentry>
45683
45684<refentry id="API-snd-pcm-lib-default-mmap">
45685<refentryinfo>
45686 <title>LINUX</title>
45687 <productname>Kernel Hackers Manual</productname>
45688 <date>July 2017</date>
45689</refentryinfo>
45690<refmeta>
45691 <refentrytitle><phrase>snd_pcm_lib_default_mmap</phrase></refentrytitle>
45692 <manvolnum>9</manvolnum>
45693 <refmiscinfo class="version">4.1.27</refmiscinfo>
45694</refmeta>
45695<refnamediv>
45696 <refname>snd_pcm_lib_default_mmap</refname>
45697 <refpurpose>
45698     Default PCM data mmap function
45699 </refpurpose>
45700</refnamediv>
45701<refsynopsisdiv>
45702 <title>Synopsis</title>
45703  <funcsynopsis><funcprototype>
45704   <funcdef>int <function>snd_pcm_lib_default_mmap </function></funcdef>
45705   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45706   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
45707  </funcprototype></funcsynopsis>
45708</refsynopsisdiv>
45709<refsect1>
45710 <title>Arguments</title>
45711 <variablelist>
45712  <varlistentry>
45713   <term><parameter>substream</parameter></term>
45714   <listitem>
45715    <para>
45716     PCM substream
45717    </para>
45718   </listitem>
45719  </varlistentry>
45720  <varlistentry>
45721   <term><parameter>area</parameter></term>
45722   <listitem>
45723    <para>
45724     VMA
45725    </para>
45726   </listitem>
45727  </varlistentry>
45728 </variablelist>
45729</refsect1>
45730<refsect1>
45731<title>Description</title>
45732<para>
45733   This is the default mmap handler for PCM data.  When mmap pcm_ops is NULL,
45734   this function is invoked implicitly.
45735</para>
45736</refsect1>
45737</refentry>
45738
45739<refentry id="API-snd-pcm-lib-mmap-iomem">
45740<refentryinfo>
45741 <title>LINUX</title>
45742 <productname>Kernel Hackers Manual</productname>
45743 <date>July 2017</date>
45744</refentryinfo>
45745<refmeta>
45746 <refentrytitle><phrase>snd_pcm_lib_mmap_iomem</phrase></refentrytitle>
45747 <manvolnum>9</manvolnum>
45748 <refmiscinfo class="version">4.1.27</refmiscinfo>
45749</refmeta>
45750<refnamediv>
45751 <refname>snd_pcm_lib_mmap_iomem</refname>
45752 <refpurpose>
45753     Default PCM data mmap function for I/O mem
45754 </refpurpose>
45755</refnamediv>
45756<refsynopsisdiv>
45757 <title>Synopsis</title>
45758  <funcsynopsis><funcprototype>
45759   <funcdef>int <function>snd_pcm_lib_mmap_iomem </function></funcdef>
45760   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
45761   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
45762  </funcprototype></funcsynopsis>
45763</refsynopsisdiv>
45764<refsect1>
45765 <title>Arguments</title>
45766 <variablelist>
45767  <varlistentry>
45768   <term><parameter>substream</parameter></term>
45769   <listitem>
45770    <para>
45771     PCM substream
45772    </para>
45773   </listitem>
45774  </varlistentry>
45775  <varlistentry>
45776   <term><parameter>area</parameter></term>
45777   <listitem>
45778    <para>
45779     VMA
45780    </para>
45781   </listitem>
45782  </varlistentry>
45783 </variablelist>
45784</refsect1>
45785<refsect1>
45786<title>Description</title>
45787<para>
45788   When your hardware uses the iomapped pages as the hardware buffer and
45789   wants to mmap it, pass this function as mmap pcm_ops.  Note that this
45790   is supposed to work only on limited architectures.
45791</para>
45792</refsect1>
45793</refentry>
45794
45795<!-- sound/core/memalloc.c -->
45796<refentry id="API-snd-malloc-pages">
45797<refentryinfo>
45798 <title>LINUX</title>
45799 <productname>Kernel Hackers Manual</productname>
45800 <date>July 2017</date>
45801</refentryinfo>
45802<refmeta>
45803 <refentrytitle><phrase>snd_malloc_pages</phrase></refentrytitle>
45804 <manvolnum>9</manvolnum>
45805 <refmiscinfo class="version">4.1.27</refmiscinfo>
45806</refmeta>
45807<refnamediv>
45808 <refname>snd_malloc_pages</refname>
45809 <refpurpose>
45810  allocate pages with the given size
45811 </refpurpose>
45812</refnamediv>
45813<refsynopsisdiv>
45814 <title>Synopsis</title>
45815  <funcsynopsis><funcprototype>
45816   <funcdef>void * <function>snd_malloc_pages </function></funcdef>
45817   <paramdef>size_t <parameter>size</parameter></paramdef>
45818   <paramdef>gfp_t <parameter>gfp_flags</parameter></paramdef>
45819  </funcprototype></funcsynopsis>
45820</refsynopsisdiv>
45821<refsect1>
45822 <title>Arguments</title>
45823 <variablelist>
45824  <varlistentry>
45825   <term><parameter>size</parameter></term>
45826   <listitem>
45827    <para>
45828     the size to allocate in bytes
45829    </para>
45830   </listitem>
45831  </varlistentry>
45832  <varlistentry>
45833   <term><parameter>gfp_flags</parameter></term>
45834   <listitem>
45835    <para>
45836     the allocation conditions, GFP_XXX
45837    </para>
45838   </listitem>
45839  </varlistentry>
45840 </variablelist>
45841</refsect1>
45842<refsect1>
45843<title>Description</title>
45844<para>
45845   Allocates the physically contiguous pages with the given size.
45846</para>
45847</refsect1>
45848<refsect1>
45849<title>Return</title>
45850<para>
45851   The pointer of the buffer, or <constant>NULL</constant> if no enough memory.
45852</para>
45853</refsect1>
45854</refentry>
45855
45856<refentry id="API-snd-free-pages">
45857<refentryinfo>
45858 <title>LINUX</title>
45859 <productname>Kernel Hackers Manual</productname>
45860 <date>July 2017</date>
45861</refentryinfo>
45862<refmeta>
45863 <refentrytitle><phrase>snd_free_pages</phrase></refentrytitle>
45864 <manvolnum>9</manvolnum>
45865 <refmiscinfo class="version">4.1.27</refmiscinfo>
45866</refmeta>
45867<refnamediv>
45868 <refname>snd_free_pages</refname>
45869 <refpurpose>
45870     release the pages
45871 </refpurpose>
45872</refnamediv>
45873<refsynopsisdiv>
45874 <title>Synopsis</title>
45875  <funcsynopsis><funcprototype>
45876   <funcdef>void <function>snd_free_pages </function></funcdef>
45877   <paramdef>void * <parameter>ptr</parameter></paramdef>
45878   <paramdef>size_t <parameter>size</parameter></paramdef>
45879  </funcprototype></funcsynopsis>
45880</refsynopsisdiv>
45881<refsect1>
45882 <title>Arguments</title>
45883 <variablelist>
45884  <varlistentry>
45885   <term><parameter>ptr</parameter></term>
45886   <listitem>
45887    <para>
45888     the buffer pointer to release
45889    </para>
45890   </listitem>
45891  </varlistentry>
45892  <varlistentry>
45893   <term><parameter>size</parameter></term>
45894   <listitem>
45895    <para>
45896     the allocated buffer size
45897    </para>
45898   </listitem>
45899  </varlistentry>
45900 </variablelist>
45901</refsect1>
45902<refsect1>
45903<title>Description</title>
45904<para>
45905   Releases the buffer allocated via <function>snd_malloc_pages</function>.
45906</para>
45907</refsect1>
45908</refentry>
45909
45910<refentry id="API-snd-dma-alloc-pages">
45911<refentryinfo>
45912 <title>LINUX</title>
45913 <productname>Kernel Hackers Manual</productname>
45914 <date>July 2017</date>
45915</refentryinfo>
45916<refmeta>
45917 <refentrytitle><phrase>snd_dma_alloc_pages</phrase></refentrytitle>
45918 <manvolnum>9</manvolnum>
45919 <refmiscinfo class="version">4.1.27</refmiscinfo>
45920</refmeta>
45921<refnamediv>
45922 <refname>snd_dma_alloc_pages</refname>
45923 <refpurpose>
45924     allocate the buffer area according to the given type
45925 </refpurpose>
45926</refnamediv>
45927<refsynopsisdiv>
45928 <title>Synopsis</title>
45929  <funcsynopsis><funcprototype>
45930   <funcdef>int <function>snd_dma_alloc_pages </function></funcdef>
45931   <paramdef>int <parameter>type</parameter></paramdef>
45932   <paramdef>struct device * <parameter>device</parameter></paramdef>
45933   <paramdef>size_t <parameter>size</parameter></paramdef>
45934   <paramdef>struct snd_dma_buffer * <parameter>dmab</parameter></paramdef>
45935  </funcprototype></funcsynopsis>
45936</refsynopsisdiv>
45937<refsect1>
45938 <title>Arguments</title>
45939 <variablelist>
45940  <varlistentry>
45941   <term><parameter>type</parameter></term>
45942   <listitem>
45943    <para>
45944     the DMA buffer type
45945    </para>
45946   </listitem>
45947  </varlistentry>
45948  <varlistentry>
45949   <term><parameter>device</parameter></term>
45950   <listitem>
45951    <para>
45952     the device pointer
45953    </para>
45954   </listitem>
45955  </varlistentry>
45956  <varlistentry>
45957   <term><parameter>size</parameter></term>
45958   <listitem>
45959    <para>
45960     the buffer size to allocate
45961    </para>
45962   </listitem>
45963  </varlistentry>
45964  <varlistentry>
45965   <term><parameter>dmab</parameter></term>
45966   <listitem>
45967    <para>
45968     buffer allocation record to store the allocated data
45969    </para>
45970   </listitem>
45971  </varlistentry>
45972 </variablelist>
45973</refsect1>
45974<refsect1>
45975<title>Description</title>
45976<para>
45977   Calls the memory-allocator function for the corresponding
45978   buffer type.
45979</para>
45980</refsect1>
45981<refsect1>
45982<title>Return</title>
45983<para>
45984   Zero if the buffer with the given size is allocated successfully,
45985   otherwise a negative value on error.
45986</para>
45987</refsect1>
45988</refentry>
45989
45990<refentry id="API-snd-dma-alloc-pages-fallback">
45991<refentryinfo>
45992 <title>LINUX</title>
45993 <productname>Kernel Hackers Manual</productname>
45994 <date>July 2017</date>
45995</refentryinfo>
45996<refmeta>
45997 <refentrytitle><phrase>snd_dma_alloc_pages_fallback</phrase></refentrytitle>
45998 <manvolnum>9</manvolnum>
45999 <refmiscinfo class="version">4.1.27</refmiscinfo>
46000</refmeta>
46001<refnamediv>
46002 <refname>snd_dma_alloc_pages_fallback</refname>
46003 <refpurpose>
46004     allocate the buffer area according to the given type with fallback
46005 </refpurpose>
46006</refnamediv>
46007<refsynopsisdiv>
46008 <title>Synopsis</title>
46009  <funcsynopsis><funcprototype>
46010   <funcdef>int <function>snd_dma_alloc_pages_fallback </function></funcdef>
46011   <paramdef>int <parameter>type</parameter></paramdef>
46012   <paramdef>struct device * <parameter>device</parameter></paramdef>
46013   <paramdef>size_t <parameter>size</parameter></paramdef>
46014   <paramdef>struct snd_dma_buffer * <parameter>dmab</parameter></paramdef>
46015  </funcprototype></funcsynopsis>
46016</refsynopsisdiv>
46017<refsect1>
46018 <title>Arguments</title>
46019 <variablelist>
46020  <varlistentry>
46021   <term><parameter>type</parameter></term>
46022   <listitem>
46023    <para>
46024     the DMA buffer type
46025    </para>
46026   </listitem>
46027  </varlistentry>
46028  <varlistentry>
46029   <term><parameter>device</parameter></term>
46030   <listitem>
46031    <para>
46032     the device pointer
46033    </para>
46034   </listitem>
46035  </varlistentry>
46036  <varlistentry>
46037   <term><parameter>size</parameter></term>
46038   <listitem>
46039    <para>
46040     the buffer size to allocate
46041    </para>
46042   </listitem>
46043  </varlistentry>
46044  <varlistentry>
46045   <term><parameter>dmab</parameter></term>
46046   <listitem>
46047    <para>
46048     buffer allocation record to store the allocated data
46049    </para>
46050   </listitem>
46051  </varlistentry>
46052 </variablelist>
46053</refsect1>
46054<refsect1>
46055<title>Description</title>
46056<para>
46057   Calls the memory-allocator function for the corresponding
46058   buffer type.  When no space is left, this function reduces the size and
46059   tries to allocate again.  The size actually allocated is stored in
46060   res_size argument.
46061</para>
46062</refsect1>
46063<refsect1>
46064<title>Return</title>
46065<para>
46066   Zero if the buffer with the given size is allocated successfully,
46067   otherwise a negative value on error.
46068</para>
46069</refsect1>
46070</refentry>
46071
46072<refentry id="API-snd-dma-free-pages">
46073<refentryinfo>
46074 <title>LINUX</title>
46075 <productname>Kernel Hackers Manual</productname>
46076 <date>July 2017</date>
46077</refentryinfo>
46078<refmeta>
46079 <refentrytitle><phrase>snd_dma_free_pages</phrase></refentrytitle>
46080 <manvolnum>9</manvolnum>
46081 <refmiscinfo class="version">4.1.27</refmiscinfo>
46082</refmeta>
46083<refnamediv>
46084 <refname>snd_dma_free_pages</refname>
46085 <refpurpose>
46086     release the allocated buffer
46087 </refpurpose>
46088</refnamediv>
46089<refsynopsisdiv>
46090 <title>Synopsis</title>
46091  <funcsynopsis><funcprototype>
46092   <funcdef>void <function>snd_dma_free_pages </function></funcdef>
46093   <paramdef>struct snd_dma_buffer * <parameter>dmab</parameter></paramdef>
46094  </funcprototype></funcsynopsis>
46095</refsynopsisdiv>
46096<refsect1>
46097 <title>Arguments</title>
46098 <variablelist>
46099  <varlistentry>
46100   <term><parameter>dmab</parameter></term>
46101   <listitem>
46102    <para>
46103     the buffer allocation record to release
46104    </para>
46105   </listitem>
46106  </varlistentry>
46107 </variablelist>
46108</refsect1>
46109<refsect1>
46110<title>Description</title>
46111<para>
46112   Releases the allocated buffer via <function>snd_dma_alloc_pages</function>.
46113</para>
46114</refsect1>
46115</refentry>
46116
46117<!-- FIXME: Removed for now since no structured comments in source
46118X!Isound/sound_firmware.c
46119-->
46120  </chapter>
46121
46122  <chapter id="uart16x50">
46123     <title>16x50 UART Driver</title>
46124<!-- drivers/tty/serial/serial_core.c -->
46125<refentry id="API-uart-update-timeout">
46126<refentryinfo>
46127 <title>LINUX</title>
46128 <productname>Kernel Hackers Manual</productname>
46129 <date>July 2017</date>
46130</refentryinfo>
46131<refmeta>
46132 <refentrytitle><phrase>uart_update_timeout</phrase></refentrytitle>
46133 <manvolnum>9</manvolnum>
46134 <refmiscinfo class="version">4.1.27</refmiscinfo>
46135</refmeta>
46136<refnamediv>
46137 <refname>uart_update_timeout</refname>
46138 <refpurpose>
46139  update per-port FIFO timeout.
46140 </refpurpose>
46141</refnamediv>
46142<refsynopsisdiv>
46143 <title>Synopsis</title>
46144  <funcsynopsis><funcprototype>
46145   <funcdef>void <function>uart_update_timeout </function></funcdef>
46146   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
46147   <paramdef>unsigned int <parameter>cflag</parameter></paramdef>
46148   <paramdef>unsigned int <parameter>baud</parameter></paramdef>
46149  </funcprototype></funcsynopsis>
46150</refsynopsisdiv>
46151<refsect1>
46152 <title>Arguments</title>
46153 <variablelist>
46154  <varlistentry>
46155   <term><parameter>port</parameter></term>
46156   <listitem>
46157    <para>
46158     uart_port structure describing the port
46159    </para>
46160   </listitem>
46161  </varlistentry>
46162  <varlistentry>
46163   <term><parameter>cflag</parameter></term>
46164   <listitem>
46165    <para>
46166     termios cflag value
46167    </para>
46168   </listitem>
46169  </varlistentry>
46170  <varlistentry>
46171   <term><parameter>baud</parameter></term>
46172   <listitem>
46173    <para>
46174     speed of the port
46175    </para>
46176   </listitem>
46177  </varlistentry>
46178 </variablelist>
46179</refsect1>
46180<refsect1>
46181<title>Description</title>
46182<para>
46183   Set the port FIFO timeout value.  The <parameter>cflag</parameter> value should
46184   reflect the actual hardware settings.
46185</para>
46186</refsect1>
46187</refentry>
46188
46189<refentry id="API-uart-get-baud-rate">
46190<refentryinfo>
46191 <title>LINUX</title>
46192 <productname>Kernel Hackers Manual</productname>
46193 <date>July 2017</date>
46194</refentryinfo>
46195<refmeta>
46196 <refentrytitle><phrase>uart_get_baud_rate</phrase></refentrytitle>
46197 <manvolnum>9</manvolnum>
46198 <refmiscinfo class="version">4.1.27</refmiscinfo>
46199</refmeta>
46200<refnamediv>
46201 <refname>uart_get_baud_rate</refname>
46202 <refpurpose>
46203     return baud rate for a particular port
46204 </refpurpose>
46205</refnamediv>
46206<refsynopsisdiv>
46207 <title>Synopsis</title>
46208  <funcsynopsis><funcprototype>
46209   <funcdef>unsigned int <function>uart_get_baud_rate </function></funcdef>
46210   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
46211   <paramdef>struct ktermios * <parameter>termios</parameter></paramdef>
46212   <paramdef>struct ktermios * <parameter>old</parameter></paramdef>
46213   <paramdef>unsigned int <parameter>min</parameter></paramdef>
46214   <paramdef>unsigned int <parameter>max</parameter></paramdef>
46215  </funcprototype></funcsynopsis>
46216</refsynopsisdiv>
46217<refsect1>
46218 <title>Arguments</title>
46219 <variablelist>
46220  <varlistentry>
46221   <term><parameter>port</parameter></term>
46222   <listitem>
46223    <para>
46224     uart_port structure describing the port in question.
46225    </para>
46226   </listitem>
46227  </varlistentry>
46228  <varlistentry>
46229   <term><parameter>termios</parameter></term>
46230   <listitem>
46231    <para>
46232     desired termios settings.
46233    </para>
46234   </listitem>
46235  </varlistentry>
46236  <varlistentry>
46237   <term><parameter>old</parameter></term>
46238   <listitem>
46239    <para>
46240     old termios (or NULL)
46241    </para>
46242   </listitem>
46243  </varlistentry>
46244  <varlistentry>
46245   <term><parameter>min</parameter></term>
46246   <listitem>
46247    <para>
46248     minimum acceptable baud rate
46249    </para>
46250   </listitem>
46251  </varlistentry>
46252  <varlistentry>
46253   <term><parameter>max</parameter></term>
46254   <listitem>
46255    <para>
46256     maximum acceptable baud rate
46257    </para>
46258   </listitem>
46259  </varlistentry>
46260 </variablelist>
46261</refsect1>
46262<refsect1>
46263<title>Description</title>
46264<para>
46265   Decode the termios structure into a numeric baud rate,
46266   taking account of the magic 38400 baud rate (with spd_*
46267   flags), and mapping the <constant>B0</constant> rate to 9600 baud.
46268   </para><para>
46269
46270   If the new baud rate is invalid, try the old termios setting.
46271   If it's still invalid, we try 9600 baud.
46272   </para><para>
46273
46274   Update the <parameter>termios</parameter> structure to reflect the baud rate
46275   we're actually going to be using. Don't do this for the case
46276   where B0 is requested (<quote>hang up</quote>).
46277</para>
46278</refsect1>
46279</refentry>
46280
46281<refentry id="API-uart-get-divisor">
46282<refentryinfo>
46283 <title>LINUX</title>
46284 <productname>Kernel Hackers Manual</productname>
46285 <date>July 2017</date>
46286</refentryinfo>
46287<refmeta>
46288 <refentrytitle><phrase>uart_get_divisor</phrase></refentrytitle>
46289 <manvolnum>9</manvolnum>
46290 <refmiscinfo class="version">4.1.27</refmiscinfo>
46291</refmeta>
46292<refnamediv>
46293 <refname>uart_get_divisor</refname>
46294 <refpurpose>
46295     return uart clock divisor
46296 </refpurpose>
46297</refnamediv>
46298<refsynopsisdiv>
46299 <title>Synopsis</title>
46300  <funcsynopsis><funcprototype>
46301   <funcdef>unsigned int <function>uart_get_divisor </function></funcdef>
46302   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
46303   <paramdef>unsigned int <parameter>baud</parameter></paramdef>
46304  </funcprototype></funcsynopsis>
46305</refsynopsisdiv>
46306<refsect1>
46307 <title>Arguments</title>
46308 <variablelist>
46309  <varlistentry>
46310   <term><parameter>port</parameter></term>
46311   <listitem>
46312    <para>
46313     uart_port structure describing the port.
46314    </para>
46315   </listitem>
46316  </varlistentry>
46317  <varlistentry>
46318   <term><parameter>baud</parameter></term>
46319   <listitem>
46320    <para>
46321     desired baud rate
46322    </para>
46323   </listitem>
46324  </varlistentry>
46325 </variablelist>
46326</refsect1>
46327<refsect1>
46328<title>Description</title>
46329<para>
46330   Calculate the uart clock divisor for the port.
46331</para>
46332</refsect1>
46333</refentry>
46334
46335<refentry id="API-uart-console-write">
46336<refentryinfo>
46337 <title>LINUX</title>
46338 <productname>Kernel Hackers Manual</productname>
46339 <date>July 2017</date>
46340</refentryinfo>
46341<refmeta>
46342 <refentrytitle><phrase>uart_console_write</phrase></refentrytitle>
46343 <manvolnum>9</manvolnum>
46344 <refmiscinfo class="version">4.1.27</refmiscinfo>
46345</refmeta>
46346<refnamediv>
46347 <refname>uart_console_write</refname>
46348 <refpurpose>
46349     write a console message to a serial port
46350 </refpurpose>
46351</refnamediv>
46352<refsynopsisdiv>
46353 <title>Synopsis</title>
46354  <funcsynopsis><funcprototype>
46355   <funcdef>void <function>uart_console_write </function></funcdef>
46356   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
46357   <paramdef>const char * <parameter>s</parameter></paramdef>
46358   <paramdef>unsigned int <parameter>count</parameter></paramdef>
46359   <paramdef>void (*<parameter>putchar</parameter>)
46360     <funcparams>struct uart_port *, int</funcparams></paramdef>
46361  </funcprototype></funcsynopsis>
46362</refsynopsisdiv>
46363<refsect1>
46364 <title>Arguments</title>
46365 <variablelist>
46366  <varlistentry>
46367   <term><parameter>port</parameter></term>
46368   <listitem>
46369    <para>
46370     the port to write the message
46371    </para>
46372   </listitem>
46373  </varlistentry>
46374  <varlistentry>
46375   <term><parameter>s</parameter></term>
46376   <listitem>
46377    <para>
46378     array of characters
46379    </para>
46380   </listitem>
46381  </varlistentry>
46382  <varlistentry>
46383   <term><parameter>count</parameter></term>
46384   <listitem>
46385    <para>
46386     number of characters in string to write
46387    </para>
46388   </listitem>
46389  </varlistentry>
46390  <varlistentry>
46391   <term><parameter>putchar</parameter></term>
46392   <listitem>
46393    <para>
46394     function to write character to port
46395    </para>
46396   </listitem>
46397  </varlistentry>
46398 </variablelist>
46399</refsect1>
46400</refentry>
46401
46402<refentry id="API-uart-parse-earlycon">
46403<refentryinfo>
46404 <title>LINUX</title>
46405 <productname>Kernel Hackers Manual</productname>
46406 <date>July 2017</date>
46407</refentryinfo>
46408<refmeta>
46409 <refentrytitle><phrase>uart_parse_earlycon</phrase></refentrytitle>
46410 <manvolnum>9</manvolnum>
46411 <refmiscinfo class="version">4.1.27</refmiscinfo>
46412</refmeta>
46413<refnamediv>
46414 <refname>uart_parse_earlycon</refname>
46415 <refpurpose>
46416     Parse earlycon options
46417 </refpurpose>
46418</refnamediv>
46419<refsynopsisdiv>
46420 <title>Synopsis</title>
46421  <funcsynopsis><funcprototype>
46422   <funcdef>int <function>uart_parse_earlycon </function></funcdef>
46423   <paramdef>char * <parameter>p</parameter></paramdef>
46424   <paramdef>unsigned char * <parameter>iotype</parameter></paramdef>
46425   <paramdef>unsigned long * <parameter>addr</parameter></paramdef>
46426   <paramdef>char ** <parameter>options</parameter></paramdef>
46427  </funcprototype></funcsynopsis>
46428</refsynopsisdiv>
46429<refsect1>
46430 <title>Arguments</title>
46431 <variablelist>
46432  <varlistentry>
46433   <term><parameter>p</parameter></term>
46434   <listitem>
46435    <para>
46436     ptr to 2nd field (ie., just beyond '&lt;name&gt;,')
46437    </para>
46438   </listitem>
46439  </varlistentry>
46440  <varlistentry>
46441   <term><parameter>iotype</parameter></term>
46442   <listitem>
46443    <para>
46444     ptr for decoded iotype (out)
46445    </para>
46446   </listitem>
46447  </varlistentry>
46448  <varlistentry>
46449   <term><parameter>addr</parameter></term>
46450   <listitem>
46451    <para>
46452     ptr for decoded mapbase/iobase (out)
46453    </para>
46454   </listitem>
46455  </varlistentry>
46456  <varlistentry>
46457   <term><parameter>options</parameter></term>
46458   <listitem>
46459    <para>
46460     ptr for &lt;options&gt; field; NULL if not present (out)
46461    </para>
46462   </listitem>
46463  </varlistentry>
46464 </variablelist>
46465</refsect1>
46466<refsect1>
46467<title>Description</title>
46468<para>
46469   Decodes earlycon kernel command line parameters of the form
46470   earlycon=&lt;name&gt;,io|mmio|mmio32,&lt;addr&gt;,&lt;options&gt;
46471   console=&lt;name&gt;,io|mmio|mmio32,&lt;addr&gt;,&lt;options&gt;
46472   </para><para>
46473
46474   The optional form
46475   earlycon=&lt;name&gt;,0x&lt;addr&gt;,&lt;options&gt;
46476   console=&lt;name&gt;,0x&lt;addr&gt;,&lt;options&gt;
46477   is also accepted; the returned <parameter>iotype</parameter> will be UPIO_MEM.
46478   </para><para>
46479
46480   Returns 0 on success or -EINVAL on failure
46481</para>
46482</refsect1>
46483</refentry>
46484
46485<refentry id="API-uart-parse-options">
46486<refentryinfo>
46487 <title>LINUX</title>
46488 <productname>Kernel Hackers Manual</productname>
46489 <date>July 2017</date>
46490</refentryinfo>
46491<refmeta>
46492 <refentrytitle><phrase>uart_parse_options</phrase></refentrytitle>
46493 <manvolnum>9</manvolnum>
46494 <refmiscinfo class="version">4.1.27</refmiscinfo>
46495</refmeta>
46496<refnamediv>
46497 <refname>uart_parse_options</refname>
46498 <refpurpose>
46499     Parse serial port baud/parity/bits/flow control.
46500 </refpurpose>
46501</refnamediv>
46502<refsynopsisdiv>
46503 <title>Synopsis</title>
46504  <funcsynopsis><funcprototype>
46505   <funcdef>void <function>uart_parse_options </function></funcdef>
46506   <paramdef>char * <parameter>options</parameter></paramdef>
46507   <paramdef>int * <parameter>baud</parameter></paramdef>
46508   <paramdef>int * <parameter>parity</parameter></paramdef>
46509   <paramdef>int * <parameter>bits</parameter></paramdef>
46510   <paramdef>int * <parameter>flow</parameter></paramdef>
46511  </funcprototype></funcsynopsis>
46512</refsynopsisdiv>
46513<refsect1>
46514 <title>Arguments</title>
46515 <variablelist>
46516  <varlistentry>
46517   <term><parameter>options</parameter></term>
46518   <listitem>
46519    <para>
46520     pointer to option string
46521    </para>
46522   </listitem>
46523  </varlistentry>
46524  <varlistentry>
46525   <term><parameter>baud</parameter></term>
46526   <listitem>
46527    <para>
46528     pointer to an 'int' variable for the baud rate.
46529    </para>
46530   </listitem>
46531  </varlistentry>
46532  <varlistentry>
46533   <term><parameter>parity</parameter></term>
46534   <listitem>
46535    <para>
46536     pointer to an 'int' variable for the parity.
46537    </para>
46538   </listitem>
46539  </varlistentry>
46540  <varlistentry>
46541   <term><parameter>bits</parameter></term>
46542   <listitem>
46543    <para>
46544     pointer to an 'int' variable for the number of data bits.
46545    </para>
46546   </listitem>
46547  </varlistentry>
46548  <varlistentry>
46549   <term><parameter>flow</parameter></term>
46550   <listitem>
46551    <para>
46552     pointer to an 'int' variable for the flow control character.
46553    </para>
46554   </listitem>
46555  </varlistentry>
46556 </variablelist>
46557</refsect1>
46558<refsect1>
46559<title>Description</title>
46560<para>
46561   uart_parse_options decodes a string containing the serial console
46562   options.  The format of the string is &lt;baud&gt;&lt;parity&gt;&lt;bits&gt;&lt;flow&gt;,
46563</para>
46564</refsect1>
46565<refsect1>
46566<title>eg</title>
46567<para>
46568   115200n8r
46569</para>
46570</refsect1>
46571</refentry>
46572
46573<refentry id="API-uart-set-options">
46574<refentryinfo>
46575 <title>LINUX</title>
46576 <productname>Kernel Hackers Manual</productname>
46577 <date>July 2017</date>
46578</refentryinfo>
46579<refmeta>
46580 <refentrytitle><phrase>uart_set_options</phrase></refentrytitle>
46581 <manvolnum>9</manvolnum>
46582 <refmiscinfo class="version">4.1.27</refmiscinfo>
46583</refmeta>
46584<refnamediv>
46585 <refname>uart_set_options</refname>
46586 <refpurpose>
46587     setup the serial console parameters
46588 </refpurpose>
46589</refnamediv>
46590<refsynopsisdiv>
46591 <title>Synopsis</title>
46592  <funcsynopsis><funcprototype>
46593   <funcdef>int <function>uart_set_options </function></funcdef>
46594   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
46595   <paramdef>struct console * <parameter>co</parameter></paramdef>
46596   <paramdef>int <parameter>baud</parameter></paramdef>
46597   <paramdef>int <parameter>parity</parameter></paramdef>
46598   <paramdef>int <parameter>bits</parameter></paramdef>
46599   <paramdef>int <parameter>flow</parameter></paramdef>
46600  </funcprototype></funcsynopsis>
46601</refsynopsisdiv>
46602<refsect1>
46603 <title>Arguments</title>
46604 <variablelist>
46605  <varlistentry>
46606   <term><parameter>port</parameter></term>
46607   <listitem>
46608    <para>
46609     pointer to the serial ports uart_port structure
46610    </para>
46611   </listitem>
46612  </varlistentry>
46613  <varlistentry>
46614   <term><parameter>co</parameter></term>
46615   <listitem>
46616    <para>
46617     console pointer
46618    </para>
46619   </listitem>
46620  </varlistentry>
46621  <varlistentry>
46622   <term><parameter>baud</parameter></term>
46623   <listitem>
46624    <para>
46625     baud rate
46626    </para>
46627   </listitem>
46628  </varlistentry>
46629  <varlistentry>
46630   <term><parameter>parity</parameter></term>
46631   <listitem>
46632    <para>
46633     parity character - 'n' (none), 'o' (odd), 'e' (even)
46634    </para>
46635   </listitem>
46636  </varlistentry>
46637  <varlistentry>
46638   <term><parameter>bits</parameter></term>
46639   <listitem>
46640    <para>
46641     number of data bits
46642    </para>
46643   </listitem>
46644  </varlistentry>
46645  <varlistentry>
46646   <term><parameter>flow</parameter></term>
46647   <listitem>
46648    <para>
46649     flow control character - 'r' (rts)
46650    </para>
46651   </listitem>
46652  </varlistentry>
46653 </variablelist>
46654</refsect1>
46655</refentry>
46656
46657<refentry id="API-uart-register-driver">
46658<refentryinfo>
46659 <title>LINUX</title>
46660 <productname>Kernel Hackers Manual</productname>
46661 <date>July 2017</date>
46662</refentryinfo>
46663<refmeta>
46664 <refentrytitle><phrase>uart_register_driver</phrase></refentrytitle>
46665 <manvolnum>9</manvolnum>
46666 <refmiscinfo class="version">4.1.27</refmiscinfo>
46667</refmeta>
46668<refnamediv>
46669 <refname>uart_register_driver</refname>
46670 <refpurpose>
46671     register a driver with the uart core layer
46672 </refpurpose>
46673</refnamediv>
46674<refsynopsisdiv>
46675 <title>Synopsis</title>
46676  <funcsynopsis><funcprototype>
46677   <funcdef>int <function>uart_register_driver </function></funcdef>
46678   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
46679  </funcprototype></funcsynopsis>
46680</refsynopsisdiv>
46681<refsect1>
46682 <title>Arguments</title>
46683 <variablelist>
46684  <varlistentry>
46685   <term><parameter>drv</parameter></term>
46686   <listitem>
46687    <para>
46688     low level driver structure
46689    </para>
46690   </listitem>
46691  </varlistentry>
46692 </variablelist>
46693</refsect1>
46694<refsect1>
46695<title>Description</title>
46696<para>
46697   Register a uart driver with the core driver.  We in turn register
46698   with the tty layer, and initialise the core driver per-port state.
46699   </para><para>
46700
46701   We have a proc file in /proc/tty/driver which is named after the
46702   normal driver.
46703   </para><para>
46704
46705   drv-&gt;port should be NULL, and the per-port structures should be
46706   registered using uart_add_one_port after this call has succeeded.
46707</para>
46708</refsect1>
46709</refentry>
46710
46711<refentry id="API-uart-unregister-driver">
46712<refentryinfo>
46713 <title>LINUX</title>
46714 <productname>Kernel Hackers Manual</productname>
46715 <date>July 2017</date>
46716</refentryinfo>
46717<refmeta>
46718 <refentrytitle><phrase>uart_unregister_driver</phrase></refentrytitle>
46719 <manvolnum>9</manvolnum>
46720 <refmiscinfo class="version">4.1.27</refmiscinfo>
46721</refmeta>
46722<refnamediv>
46723 <refname>uart_unregister_driver</refname>
46724 <refpurpose>
46725     remove a driver from the uart core layer
46726 </refpurpose>
46727</refnamediv>
46728<refsynopsisdiv>
46729 <title>Synopsis</title>
46730  <funcsynopsis><funcprototype>
46731   <funcdef>void <function>uart_unregister_driver </function></funcdef>
46732   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
46733  </funcprototype></funcsynopsis>
46734</refsynopsisdiv>
46735<refsect1>
46736 <title>Arguments</title>
46737 <variablelist>
46738  <varlistentry>
46739   <term><parameter>drv</parameter></term>
46740   <listitem>
46741    <para>
46742     low level driver structure
46743    </para>
46744   </listitem>
46745  </varlistentry>
46746 </variablelist>
46747</refsect1>
46748<refsect1>
46749<title>Description</title>
46750<para>
46751   Remove all references to a driver from the core driver.  The low
46752   level driver must have removed all its ports via the
46753   <function>uart_remove_one_port</function> if it registered them with <function>uart_add_one_port</function>.
46754   (ie, drv-&gt;port == NULL)
46755</para>
46756</refsect1>
46757</refentry>
46758
46759<refentry id="API-uart-add-one-port">
46760<refentryinfo>
46761 <title>LINUX</title>
46762 <productname>Kernel Hackers Manual</productname>
46763 <date>July 2017</date>
46764</refentryinfo>
46765<refmeta>
46766 <refentrytitle><phrase>uart_add_one_port</phrase></refentrytitle>
46767 <manvolnum>9</manvolnum>
46768 <refmiscinfo class="version">4.1.27</refmiscinfo>
46769</refmeta>
46770<refnamediv>
46771 <refname>uart_add_one_port</refname>
46772 <refpurpose>
46773     attach a driver-defined port structure
46774 </refpurpose>
46775</refnamediv>
46776<refsynopsisdiv>
46777 <title>Synopsis</title>
46778  <funcsynopsis><funcprototype>
46779   <funcdef>int <function>uart_add_one_port </function></funcdef>
46780   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
46781   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
46782  </funcprototype></funcsynopsis>
46783</refsynopsisdiv>
46784<refsect1>
46785 <title>Arguments</title>
46786 <variablelist>
46787  <varlistentry>
46788   <term><parameter>drv</parameter></term>
46789   <listitem>
46790    <para>
46791     pointer to the uart low level driver structure for this port
46792    </para>
46793   </listitem>
46794  </varlistentry>
46795  <varlistentry>
46796   <term><parameter>uport</parameter></term>
46797   <listitem>
46798    <para>
46799     uart port structure to use for this port.
46800    </para>
46801   </listitem>
46802  </varlistentry>
46803 </variablelist>
46804</refsect1>
46805<refsect1>
46806<title>Description</title>
46807<para>
46808   This allows the driver to register its own uart_port structure
46809   with the core driver.  The main purpose is to allow the low
46810   level uart drivers to expand uart_port, rather than having yet
46811   more levels of structures.
46812</para>
46813</refsect1>
46814</refentry>
46815
46816<refentry id="API-uart-remove-one-port">
46817<refentryinfo>
46818 <title>LINUX</title>
46819 <productname>Kernel Hackers Manual</productname>
46820 <date>July 2017</date>
46821</refentryinfo>
46822<refmeta>
46823 <refentrytitle><phrase>uart_remove_one_port</phrase></refentrytitle>
46824 <manvolnum>9</manvolnum>
46825 <refmiscinfo class="version">4.1.27</refmiscinfo>
46826</refmeta>
46827<refnamediv>
46828 <refname>uart_remove_one_port</refname>
46829 <refpurpose>
46830     detach a driver defined port structure
46831 </refpurpose>
46832</refnamediv>
46833<refsynopsisdiv>
46834 <title>Synopsis</title>
46835  <funcsynopsis><funcprototype>
46836   <funcdef>int <function>uart_remove_one_port </function></funcdef>
46837   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
46838   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
46839  </funcprototype></funcsynopsis>
46840</refsynopsisdiv>
46841<refsect1>
46842 <title>Arguments</title>
46843 <variablelist>
46844  <varlistentry>
46845   <term><parameter>drv</parameter></term>
46846   <listitem>
46847    <para>
46848     pointer to the uart low level driver structure for this port
46849    </para>
46850   </listitem>
46851  </varlistentry>
46852  <varlistentry>
46853   <term><parameter>uport</parameter></term>
46854   <listitem>
46855    <para>
46856     uart port structure for this port
46857    </para>
46858   </listitem>
46859  </varlistentry>
46860 </variablelist>
46861</refsect1>
46862<refsect1>
46863<title>Description</title>
46864<para>
46865   This unhooks (and hangs up) the specified port structure from the
46866   core driver.  No further calls will be made to the low-level code
46867   for this port.
46868</para>
46869</refsect1>
46870</refentry>
46871
46872<refentry id="API-uart-handle-dcd-change">
46873<refentryinfo>
46874 <title>LINUX</title>
46875 <productname>Kernel Hackers Manual</productname>
46876 <date>July 2017</date>
46877</refentryinfo>
46878<refmeta>
46879 <refentrytitle><phrase>uart_handle_dcd_change</phrase></refentrytitle>
46880 <manvolnum>9</manvolnum>
46881 <refmiscinfo class="version">4.1.27</refmiscinfo>
46882</refmeta>
46883<refnamediv>
46884 <refname>uart_handle_dcd_change</refname>
46885 <refpurpose>
46886     handle a change of carrier detect state
46887 </refpurpose>
46888</refnamediv>
46889<refsynopsisdiv>
46890 <title>Synopsis</title>
46891  <funcsynopsis><funcprototype>
46892   <funcdef>void <function>uart_handle_dcd_change </function></funcdef>
46893   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
46894   <paramdef>unsigned int <parameter>status</parameter></paramdef>
46895  </funcprototype></funcsynopsis>
46896</refsynopsisdiv>
46897<refsect1>
46898 <title>Arguments</title>
46899 <variablelist>
46900  <varlistentry>
46901   <term><parameter>uport</parameter></term>
46902   <listitem>
46903    <para>
46904     uart_port structure for the open port
46905    </para>
46906   </listitem>
46907  </varlistentry>
46908  <varlistentry>
46909   <term><parameter>status</parameter></term>
46910   <listitem>
46911    <para>
46912     new carrier detect status, nonzero if active
46913    </para>
46914   </listitem>
46915  </varlistentry>
46916 </variablelist>
46917</refsect1>
46918<refsect1>
46919<title>Description</title>
46920<para>
46921   Caller must hold uport-&gt;lock
46922</para>
46923</refsect1>
46924</refentry>
46925
46926<refentry id="API-uart-handle-cts-change">
46927<refentryinfo>
46928 <title>LINUX</title>
46929 <productname>Kernel Hackers Manual</productname>
46930 <date>July 2017</date>
46931</refentryinfo>
46932<refmeta>
46933 <refentrytitle><phrase>uart_handle_cts_change</phrase></refentrytitle>
46934 <manvolnum>9</manvolnum>
46935 <refmiscinfo class="version">4.1.27</refmiscinfo>
46936</refmeta>
46937<refnamediv>
46938 <refname>uart_handle_cts_change</refname>
46939 <refpurpose>
46940     handle a change of clear-to-send state
46941 </refpurpose>
46942</refnamediv>
46943<refsynopsisdiv>
46944 <title>Synopsis</title>
46945  <funcsynopsis><funcprototype>
46946   <funcdef>void <function>uart_handle_cts_change </function></funcdef>
46947   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
46948   <paramdef>unsigned int <parameter>status</parameter></paramdef>
46949  </funcprototype></funcsynopsis>
46950</refsynopsisdiv>
46951<refsect1>
46952 <title>Arguments</title>
46953 <variablelist>
46954  <varlistentry>
46955   <term><parameter>uport</parameter></term>
46956   <listitem>
46957    <para>
46958     uart_port structure for the open port
46959    </para>
46960   </listitem>
46961  </varlistentry>
46962  <varlistentry>
46963   <term><parameter>status</parameter></term>
46964   <listitem>
46965    <para>
46966     new clear to send status, nonzero if active
46967    </para>
46968   </listitem>
46969  </varlistentry>
46970 </variablelist>
46971</refsect1>
46972<refsect1>
46973<title>Description</title>
46974<para>
46975   Caller must hold uport-&gt;lock
46976</para>
46977</refsect1>
46978</refentry>
46979
46980<refentry id="API-uart-insert-char">
46981<refentryinfo>
46982 <title>LINUX</title>
46983 <productname>Kernel Hackers Manual</productname>
46984 <date>July 2017</date>
46985</refentryinfo>
46986<refmeta>
46987 <refentrytitle><phrase>uart_insert_char</phrase></refentrytitle>
46988 <manvolnum>9</manvolnum>
46989 <refmiscinfo class="version">4.1.27</refmiscinfo>
46990</refmeta>
46991<refnamediv>
46992 <refname>uart_insert_char</refname>
46993 <refpurpose>
46994     push a char to the uart layer
46995 </refpurpose>
46996</refnamediv>
46997<refsynopsisdiv>
46998 <title>Synopsis</title>
46999  <funcsynopsis><funcprototype>
47000   <funcdef>void <function>uart_insert_char </function></funcdef>
47001   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
47002   <paramdef>unsigned int <parameter>status</parameter></paramdef>
47003   <paramdef>unsigned int <parameter>overrun</parameter></paramdef>
47004   <paramdef>unsigned int <parameter>ch</parameter></paramdef>
47005   <paramdef>unsigned int <parameter>flag</parameter></paramdef>
47006  </funcprototype></funcsynopsis>
47007</refsynopsisdiv>
47008<refsect1>
47009 <title>Arguments</title>
47010 <variablelist>
47011  <varlistentry>
47012   <term><parameter>port</parameter></term>
47013   <listitem>
47014    <para>
47015     corresponding port
47016    </para>
47017   </listitem>
47018  </varlistentry>
47019  <varlistentry>
47020   <term><parameter>status</parameter></term>
47021   <listitem>
47022    <para>
47023     state of the serial port RX buffer (LSR for 8250)
47024    </para>
47025   </listitem>
47026  </varlistentry>
47027  <varlistentry>
47028   <term><parameter>overrun</parameter></term>
47029   <listitem>
47030    <para>
47031     mask of overrun bits in <parameter>status</parameter>
47032    </para>
47033   </listitem>
47034  </varlistentry>
47035  <varlistentry>
47036   <term><parameter>ch</parameter></term>
47037   <listitem>
47038    <para>
47039     character to push
47040    </para>
47041   </listitem>
47042  </varlistentry>
47043  <varlistentry>
47044   <term><parameter>flag</parameter></term>
47045   <listitem>
47046    <para>
47047     flag for the character (see TTY_NORMAL and friends)
47048    </para>
47049   </listitem>
47050  </varlistentry>
47051 </variablelist>
47052</refsect1>
47053<refsect1>
47054<title>Description</title>
47055<para>
47056   </para><para>
47057
47058   User is responsible to call tty_flip_buffer_push when they are done with
47059   insertion.
47060</para>
47061</refsect1>
47062</refentry>
47063
47064<!-- drivers/tty/serial/8250/8250_core.c -->
47065<refentry id="API-serial8250-get-port">
47066<refentryinfo>
47067 <title>LINUX</title>
47068 <productname>Kernel Hackers Manual</productname>
47069 <date>July 2017</date>
47070</refentryinfo>
47071<refmeta>
47072 <refentrytitle><phrase>serial8250_get_port</phrase></refentrytitle>
47073 <manvolnum>9</manvolnum>
47074 <refmiscinfo class="version">4.1.27</refmiscinfo>
47075</refmeta>
47076<refnamediv>
47077 <refname>serial8250_get_port</refname>
47078 <refpurpose>
47079  retrieve struct uart_8250_port
47080 </refpurpose>
47081</refnamediv>
47082<refsynopsisdiv>
47083 <title>Synopsis</title>
47084  <funcsynopsis><funcprototype>
47085   <funcdef>struct uart_8250_port * <function>serial8250_get_port </function></funcdef>
47086   <paramdef>int <parameter>line</parameter></paramdef>
47087  </funcprototype></funcsynopsis>
47088</refsynopsisdiv>
47089<refsect1>
47090 <title>Arguments</title>
47091 <variablelist>
47092  <varlistentry>
47093   <term><parameter>line</parameter></term>
47094   <listitem>
47095    <para>
47096     serial line number
47097    </para>
47098   </listitem>
47099  </varlistentry>
47100 </variablelist>
47101</refsect1>
47102<refsect1>
47103<title>Description</title>
47104<para>
47105   This function retrieves struct uart_8250_port for the specific line.
47106   This struct *must* *not* be used to perform a 8250 or serial core operation
47107   which is not accessible otherwise. Its only purpose is to make the struct
47108   accessible to the runtime-pm callbacks for context suspend/restore.
47109   The lock assumption made here is none because runtime-pm suspend/resume
47110   callbacks should not be invoked if there is any operation performed on the
47111   port.
47112</para>
47113</refsect1>
47114</refentry>
47115
47116<refentry id="API-serial8250-suspend-port">
47117<refentryinfo>
47118 <title>LINUX</title>
47119 <productname>Kernel Hackers Manual</productname>
47120 <date>July 2017</date>
47121</refentryinfo>
47122<refmeta>
47123 <refentrytitle><phrase>serial8250_suspend_port</phrase></refentrytitle>
47124 <manvolnum>9</manvolnum>
47125 <refmiscinfo class="version">4.1.27</refmiscinfo>
47126</refmeta>
47127<refnamediv>
47128 <refname>serial8250_suspend_port</refname>
47129 <refpurpose>
47130     suspend one serial port
47131 </refpurpose>
47132</refnamediv>
47133<refsynopsisdiv>
47134 <title>Synopsis</title>
47135  <funcsynopsis><funcprototype>
47136   <funcdef>void <function>serial8250_suspend_port </function></funcdef>
47137   <paramdef>int <parameter>line</parameter></paramdef>
47138  </funcprototype></funcsynopsis>
47139</refsynopsisdiv>
47140<refsect1>
47141 <title>Arguments</title>
47142 <variablelist>
47143  <varlistentry>
47144   <term><parameter>line</parameter></term>
47145   <listitem>
47146    <para>
47147     serial line number
47148    </para>
47149   </listitem>
47150  </varlistentry>
47151 </variablelist>
47152</refsect1>
47153<refsect1>
47154<title>Description</title>
47155<para>
47156   Suspend one serial port.
47157</para>
47158</refsect1>
47159</refentry>
47160
47161<refentry id="API-serial8250-resume-port">
47162<refentryinfo>
47163 <title>LINUX</title>
47164 <productname>Kernel Hackers Manual</productname>
47165 <date>July 2017</date>
47166</refentryinfo>
47167<refmeta>
47168 <refentrytitle><phrase>serial8250_resume_port</phrase></refentrytitle>
47169 <manvolnum>9</manvolnum>
47170 <refmiscinfo class="version">4.1.27</refmiscinfo>
47171</refmeta>
47172<refnamediv>
47173 <refname>serial8250_resume_port</refname>
47174 <refpurpose>
47175     resume one serial port
47176 </refpurpose>
47177</refnamediv>
47178<refsynopsisdiv>
47179 <title>Synopsis</title>
47180  <funcsynopsis><funcprototype>
47181   <funcdef>void <function>serial8250_resume_port </function></funcdef>
47182   <paramdef>int <parameter>line</parameter></paramdef>
47183  </funcprototype></funcsynopsis>
47184</refsynopsisdiv>
47185<refsect1>
47186 <title>Arguments</title>
47187 <variablelist>
47188  <varlistentry>
47189   <term><parameter>line</parameter></term>
47190   <listitem>
47191    <para>
47192     serial line number
47193    </para>
47194   </listitem>
47195  </varlistentry>
47196 </variablelist>
47197</refsect1>
47198<refsect1>
47199<title>Description</title>
47200<para>
47201   Resume one serial port.
47202</para>
47203</refsect1>
47204</refentry>
47205
47206<refentry id="API-serial8250-register-8250-port">
47207<refentryinfo>
47208 <title>LINUX</title>
47209 <productname>Kernel Hackers Manual</productname>
47210 <date>July 2017</date>
47211</refentryinfo>
47212<refmeta>
47213 <refentrytitle><phrase>serial8250_register_8250_port</phrase></refentrytitle>
47214 <manvolnum>9</manvolnum>
47215 <refmiscinfo class="version">4.1.27</refmiscinfo>
47216</refmeta>
47217<refnamediv>
47218 <refname>serial8250_register_8250_port</refname>
47219 <refpurpose>
47220     register a serial port
47221 </refpurpose>
47222</refnamediv>
47223<refsynopsisdiv>
47224 <title>Synopsis</title>
47225  <funcsynopsis><funcprototype>
47226   <funcdef>int <function>serial8250_register_8250_port </function></funcdef>
47227   <paramdef>struct uart_8250_port * <parameter>up</parameter></paramdef>
47228  </funcprototype></funcsynopsis>
47229</refsynopsisdiv>
47230<refsect1>
47231 <title>Arguments</title>
47232 <variablelist>
47233  <varlistentry>
47234   <term><parameter>up</parameter></term>
47235   <listitem>
47236    <para>
47237     serial port template
47238    </para>
47239   </listitem>
47240  </varlistentry>
47241 </variablelist>
47242</refsect1>
47243<refsect1>
47244<title>Description</title>
47245<para>
47246   Configure the serial port specified by the request. If the
47247   port exists and is in use, it is hung up and unregistered
47248   first.
47249   </para><para>
47250
47251   The port is then probed and if necessary the IRQ is autodetected
47252   If this fails an error is returned.
47253   </para><para>
47254
47255   On success the port is ready to use and the line number is returned.
47256</para>
47257</refsect1>
47258</refentry>
47259
47260<refentry id="API-serial8250-unregister-port">
47261<refentryinfo>
47262 <title>LINUX</title>
47263 <productname>Kernel Hackers Manual</productname>
47264 <date>July 2017</date>
47265</refentryinfo>
47266<refmeta>
47267 <refentrytitle><phrase>serial8250_unregister_port</phrase></refentrytitle>
47268 <manvolnum>9</manvolnum>
47269 <refmiscinfo class="version">4.1.27</refmiscinfo>
47270</refmeta>
47271<refnamediv>
47272 <refname>serial8250_unregister_port</refname>
47273 <refpurpose>
47274     remove a 16x50 serial port at runtime
47275 </refpurpose>
47276</refnamediv>
47277<refsynopsisdiv>
47278 <title>Synopsis</title>
47279  <funcsynopsis><funcprototype>
47280   <funcdef>void <function>serial8250_unregister_port </function></funcdef>
47281   <paramdef>int <parameter>line</parameter></paramdef>
47282  </funcprototype></funcsynopsis>
47283</refsynopsisdiv>
47284<refsect1>
47285 <title>Arguments</title>
47286 <variablelist>
47287  <varlistentry>
47288   <term><parameter>line</parameter></term>
47289   <listitem>
47290    <para>
47291     serial line number
47292    </para>
47293   </listitem>
47294  </varlistentry>
47295 </variablelist>
47296</refsect1>
47297<refsect1>
47298<title>Description</title>
47299<para>
47300   Remove one serial port.  This may not be called from interrupt
47301   context.  We hand the port back to the our control.
47302</para>
47303</refsect1>
47304</refentry>
47305
47306  </chapter>
47307
47308  <chapter id="fbdev">
47309     <title>Frame Buffer Library</title>
47310
47311     <para>
47312       The frame buffer drivers depend heavily on four data structures.
47313       These structures are declared in include/linux/fb.h.  They are
47314       fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
47315       The last three can be made available to and from userland.
47316     </para>
47317
47318     <para>
47319       fb_info defines the current state of a particular video card.
47320       Inside fb_info, there exists a fb_ops structure which is a
47321       collection of needed functions to make fbdev and fbcon work.
47322       fb_info is only visible to the kernel.
47323     </para>
47324
47325     <para>
47326       fb_var_screeninfo is used to describe the features of a video card
47327       that are user defined.  With fb_var_screeninfo, things such as
47328       depth and the resolution may be defined.
47329     </para>
47330
47331     <para>
47332       The next structure is fb_fix_screeninfo. This defines the
47333       properties of a card that are created when a mode is set and can't
47334       be changed otherwise.  A good example of this is the start of the
47335       frame buffer memory.  This "locks" the address of the frame buffer
47336       memory, so that it cannot be changed or moved.
47337     </para>
47338
47339     <para>
47340       The last structure is fb_monospecs. In the old API, there was
47341       little importance for fb_monospecs. This allowed for forbidden things
47342       such as setting a mode of 800x600 on a fix frequency monitor. With
47343       the new API, fb_monospecs prevents such things, and if used
47344       correctly, can prevent a monitor from being cooked.  fb_monospecs
47345       will not be useful until kernels 2.5.x.
47346     </para>
47347
47348     <sect1><title>Frame Buffer Memory</title>
47349<!-- drivers/video/fbdev/core/fbmem.c -->
47350<refentry id="API-register-framebuffer">
47351<refentryinfo>
47352 <title>LINUX</title>
47353 <productname>Kernel Hackers Manual</productname>
47354 <date>July 2017</date>
47355</refentryinfo>
47356<refmeta>
47357 <refentrytitle><phrase>register_framebuffer</phrase></refentrytitle>
47358 <manvolnum>9</manvolnum>
47359 <refmiscinfo class="version">4.1.27</refmiscinfo>
47360</refmeta>
47361<refnamediv>
47362 <refname>register_framebuffer</refname>
47363 <refpurpose>
47364  registers a frame buffer device
47365 </refpurpose>
47366</refnamediv>
47367<refsynopsisdiv>
47368 <title>Synopsis</title>
47369  <funcsynopsis><funcprototype>
47370   <funcdef>int <function>register_framebuffer </function></funcdef>
47371   <paramdef>struct fb_info * <parameter>fb_info</parameter></paramdef>
47372  </funcprototype></funcsynopsis>
47373</refsynopsisdiv>
47374<refsect1>
47375 <title>Arguments</title>
47376 <variablelist>
47377  <varlistentry>
47378   <term><parameter>fb_info</parameter></term>
47379   <listitem>
47380    <para>
47381     frame buffer info structure
47382    </para>
47383   </listitem>
47384  </varlistentry>
47385 </variablelist>
47386</refsect1>
47387<refsect1>
47388<title>Description</title>
47389<para>
47390   Registers a frame buffer device <parameter>fb_info</parameter>.
47391   </para><para>
47392
47393   Returns negative errno on error, or zero for success.
47394</para>
47395</refsect1>
47396</refentry>
47397
47398<refentry id="API-unregister-framebuffer">
47399<refentryinfo>
47400 <title>LINUX</title>
47401 <productname>Kernel Hackers Manual</productname>
47402 <date>July 2017</date>
47403</refentryinfo>
47404<refmeta>
47405 <refentrytitle><phrase>unregister_framebuffer</phrase></refentrytitle>
47406 <manvolnum>9</manvolnum>
47407 <refmiscinfo class="version">4.1.27</refmiscinfo>
47408</refmeta>
47409<refnamediv>
47410 <refname>unregister_framebuffer</refname>
47411 <refpurpose>
47412     releases a frame buffer device
47413 </refpurpose>
47414</refnamediv>
47415<refsynopsisdiv>
47416 <title>Synopsis</title>
47417  <funcsynopsis><funcprototype>
47418   <funcdef>int <function>unregister_framebuffer </function></funcdef>
47419   <paramdef>struct fb_info * <parameter>fb_info</parameter></paramdef>
47420  </funcprototype></funcsynopsis>
47421</refsynopsisdiv>
47422<refsect1>
47423 <title>Arguments</title>
47424 <variablelist>
47425  <varlistentry>
47426   <term><parameter>fb_info</parameter></term>
47427   <listitem>
47428    <para>
47429     frame buffer info structure
47430    </para>
47431   </listitem>
47432  </varlistentry>
47433 </variablelist>
47434</refsect1>
47435<refsect1>
47436<title>Description</title>
47437<para>
47438   Unregisters a frame buffer device <parameter>fb_info</parameter>.
47439   </para><para>
47440
47441   Returns negative errno on error, or zero for success.
47442   </para><para>
47443
47444   This function will also notify the framebuffer console
47445   to release the driver.
47446   </para><para>
47447
47448   This is meant to be called within a driver's <function>module_exit</function>
47449   function. If this is called outside <function>module_exit</function>, ensure
47450   that the driver implements <function>fb_open</function> and <function>fb_release</function> to
47451   check that no processes are using the device.
47452</para>
47453</refsect1>
47454</refentry>
47455
47456<refentry id="API-fb-set-suspend">
47457<refentryinfo>
47458 <title>LINUX</title>
47459 <productname>Kernel Hackers Manual</productname>
47460 <date>July 2017</date>
47461</refentryinfo>
47462<refmeta>
47463 <refentrytitle><phrase>fb_set_suspend</phrase></refentrytitle>
47464 <manvolnum>9</manvolnum>
47465 <refmiscinfo class="version">4.1.27</refmiscinfo>
47466</refmeta>
47467<refnamediv>
47468 <refname>fb_set_suspend</refname>
47469 <refpurpose>
47470     low level driver signals suspend
47471 </refpurpose>
47472</refnamediv>
47473<refsynopsisdiv>
47474 <title>Synopsis</title>
47475  <funcsynopsis><funcprototype>
47476   <funcdef>void <function>fb_set_suspend </function></funcdef>
47477   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
47478   <paramdef>int <parameter>state</parameter></paramdef>
47479  </funcprototype></funcsynopsis>
47480</refsynopsisdiv>
47481<refsect1>
47482 <title>Arguments</title>
47483 <variablelist>
47484  <varlistentry>
47485   <term><parameter>info</parameter></term>
47486   <listitem>
47487    <para>
47488     framebuffer affected
47489    </para>
47490   </listitem>
47491  </varlistentry>
47492  <varlistentry>
47493   <term><parameter>state</parameter></term>
47494   <listitem>
47495    <para>
47496     0 = resuming, !=0 = suspending
47497    </para>
47498   </listitem>
47499  </varlistentry>
47500 </variablelist>
47501</refsect1>
47502<refsect1>
47503<title>Description</title>
47504<para>
47505   This is meant to be used by low level drivers to
47506   signal suspend/resume to the core &amp; clients.
47507   It must be called with the console semaphore held
47508</para>
47509</refsect1>
47510</refentry>
47511
47512     </sect1>
47513<!--
47514     <sect1><title>Frame Buffer Console</title>
47515X!Edrivers/video/console/fbcon.c
47516     </sect1>
47517-->
47518     <sect1><title>Frame Buffer Colormap</title>
47519<!-- drivers/video/fbdev/core/fbcmap.c -->
47520<refentry id="API-fb-dealloc-cmap">
47521<refentryinfo>
47522 <title>LINUX</title>
47523 <productname>Kernel Hackers Manual</productname>
47524 <date>July 2017</date>
47525</refentryinfo>
47526<refmeta>
47527 <refentrytitle><phrase>fb_dealloc_cmap</phrase></refentrytitle>
47528 <manvolnum>9</manvolnum>
47529 <refmiscinfo class="version">4.1.27</refmiscinfo>
47530</refmeta>
47531<refnamediv>
47532 <refname>fb_dealloc_cmap</refname>
47533 <refpurpose>
47534  deallocate a colormap
47535 </refpurpose>
47536</refnamediv>
47537<refsynopsisdiv>
47538 <title>Synopsis</title>
47539  <funcsynopsis><funcprototype>
47540   <funcdef>void <function>fb_dealloc_cmap </function></funcdef>
47541   <paramdef>struct fb_cmap * <parameter>cmap</parameter></paramdef>
47542  </funcprototype></funcsynopsis>
47543</refsynopsisdiv>
47544<refsect1>
47545 <title>Arguments</title>
47546 <variablelist>
47547  <varlistentry>
47548   <term><parameter>cmap</parameter></term>
47549   <listitem>
47550    <para>
47551     frame buffer colormap structure
47552    </para>
47553   </listitem>
47554  </varlistentry>
47555 </variablelist>
47556</refsect1>
47557<refsect1>
47558<title>Description</title>
47559<para>
47560   Deallocates a colormap that was previously allocated with
47561   <function>fb_alloc_cmap</function>.
47562</para>
47563</refsect1>
47564</refentry>
47565
47566<refentry id="API-fb-copy-cmap">
47567<refentryinfo>
47568 <title>LINUX</title>
47569 <productname>Kernel Hackers Manual</productname>
47570 <date>July 2017</date>
47571</refentryinfo>
47572<refmeta>
47573 <refentrytitle><phrase>fb_copy_cmap</phrase></refentrytitle>
47574 <manvolnum>9</manvolnum>
47575 <refmiscinfo class="version">4.1.27</refmiscinfo>
47576</refmeta>
47577<refnamediv>
47578 <refname>fb_copy_cmap</refname>
47579 <refpurpose>
47580     copy a colormap
47581 </refpurpose>
47582</refnamediv>
47583<refsynopsisdiv>
47584 <title>Synopsis</title>
47585  <funcsynopsis><funcprototype>
47586   <funcdef>int <function>fb_copy_cmap </function></funcdef>
47587   <paramdef>const struct fb_cmap * <parameter>from</parameter></paramdef>
47588   <paramdef>struct fb_cmap * <parameter>to</parameter></paramdef>
47589  </funcprototype></funcsynopsis>
47590</refsynopsisdiv>
47591<refsect1>
47592 <title>Arguments</title>
47593 <variablelist>
47594  <varlistentry>
47595   <term><parameter>from</parameter></term>
47596   <listitem>
47597    <para>
47598     frame buffer colormap structure
47599    </para>
47600   </listitem>
47601  </varlistentry>
47602  <varlistentry>
47603   <term><parameter>to</parameter></term>
47604   <listitem>
47605    <para>
47606     frame buffer colormap structure
47607    </para>
47608   </listitem>
47609  </varlistentry>
47610 </variablelist>
47611</refsect1>
47612<refsect1>
47613<title>Description</title>
47614<para>
47615   Copy contents of colormap from <parameter>from</parameter> to <parameter>to</parameter>.
47616</para>
47617</refsect1>
47618</refentry>
47619
47620<refentry id="API-fb-set-cmap">
47621<refentryinfo>
47622 <title>LINUX</title>
47623 <productname>Kernel Hackers Manual</productname>
47624 <date>July 2017</date>
47625</refentryinfo>
47626<refmeta>
47627 <refentrytitle><phrase>fb_set_cmap</phrase></refentrytitle>
47628 <manvolnum>9</manvolnum>
47629 <refmiscinfo class="version">4.1.27</refmiscinfo>
47630</refmeta>
47631<refnamediv>
47632 <refname>fb_set_cmap</refname>
47633 <refpurpose>
47634     set the colormap
47635 </refpurpose>
47636</refnamediv>
47637<refsynopsisdiv>
47638 <title>Synopsis</title>
47639  <funcsynopsis><funcprototype>
47640   <funcdef>int <function>fb_set_cmap </function></funcdef>
47641   <paramdef>struct fb_cmap * <parameter>cmap</parameter></paramdef>
47642   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
47643  </funcprototype></funcsynopsis>
47644</refsynopsisdiv>
47645<refsect1>
47646 <title>Arguments</title>
47647 <variablelist>
47648  <varlistentry>
47649   <term><parameter>cmap</parameter></term>
47650   <listitem>
47651    <para>
47652     frame buffer colormap structure
47653    </para>
47654   </listitem>
47655  </varlistentry>
47656  <varlistentry>
47657   <term><parameter>info</parameter></term>
47658   <listitem>
47659    <para>
47660     frame buffer info structure
47661    </para>
47662   </listitem>
47663  </varlistentry>
47664 </variablelist>
47665</refsect1>
47666<refsect1>
47667<title>Description</title>
47668<para>
47669   Sets the colormap <parameter>cmap</parameter> for a screen of device <parameter>info</parameter>.
47670   </para><para>
47671
47672   Returns negative errno on error, or zero on success.
47673</para>
47674</refsect1>
47675</refentry>
47676
47677<refentry id="API-fb-default-cmap">
47678<refentryinfo>
47679 <title>LINUX</title>
47680 <productname>Kernel Hackers Manual</productname>
47681 <date>July 2017</date>
47682</refentryinfo>
47683<refmeta>
47684 <refentrytitle><phrase>fb_default_cmap</phrase></refentrytitle>
47685 <manvolnum>9</manvolnum>
47686 <refmiscinfo class="version">4.1.27</refmiscinfo>
47687</refmeta>
47688<refnamediv>
47689 <refname>fb_default_cmap</refname>
47690 <refpurpose>
47691     get default colormap
47692 </refpurpose>
47693</refnamediv>
47694<refsynopsisdiv>
47695 <title>Synopsis</title>
47696  <funcsynopsis><funcprototype>
47697   <funcdef>const struct fb_cmap * <function>fb_default_cmap </function></funcdef>
47698   <paramdef>int <parameter>len</parameter></paramdef>
47699  </funcprototype></funcsynopsis>
47700</refsynopsisdiv>
47701<refsect1>
47702 <title>Arguments</title>
47703 <variablelist>
47704  <varlistentry>
47705   <term><parameter>len</parameter></term>
47706   <listitem>
47707    <para>
47708     size of palette for a depth
47709    </para>
47710   </listitem>
47711  </varlistentry>
47712 </variablelist>
47713</refsect1>
47714<refsect1>
47715<title>Description</title>
47716<para>
47717   Gets the default colormap for a specific screen depth.  <parameter>len</parameter>
47718   is the size of the palette for a particular screen depth.
47719   </para><para>
47720
47721   Returns pointer to a frame buffer colormap structure.
47722</para>
47723</refsect1>
47724</refentry>
47725
47726<refentry id="API-fb-invert-cmaps">
47727<refentryinfo>
47728 <title>LINUX</title>
47729 <productname>Kernel Hackers Manual</productname>
47730 <date>July 2017</date>
47731</refentryinfo>
47732<refmeta>
47733 <refentrytitle><phrase>fb_invert_cmaps</phrase></refentrytitle>
47734 <manvolnum>9</manvolnum>
47735 <refmiscinfo class="version">4.1.27</refmiscinfo>
47736</refmeta>
47737<refnamediv>
47738 <refname>fb_invert_cmaps</refname>
47739 <refpurpose>
47740     invert all defaults colormaps
47741 </refpurpose>
47742</refnamediv>
47743<refsynopsisdiv>
47744 <title>Synopsis</title>
47745  <funcsynopsis><funcprototype>
47746   <funcdef>void <function>fb_invert_cmaps </function></funcdef>
47747   <paramdef> <parameter>void</parameter></paramdef>
47748  </funcprototype></funcsynopsis>
47749</refsynopsisdiv>
47750<refsect1>
47751 <title>Arguments</title>
47752 <variablelist>
47753  <varlistentry>
47754   <term><parameter>void</parameter></term>
47755   <listitem>
47756    <para>
47757     no arguments
47758    </para>
47759   </listitem>
47760  </varlistentry>
47761 </variablelist>
47762</refsect1>
47763<refsect1>
47764<title>Description</title>
47765<para>
47766   </para><para>
47767
47768   Invert all default colormaps.
47769</para>
47770</refsect1>
47771</refentry>
47772
47773     </sect1>
47774<!-- FIXME:
47775  drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment
47776  out until somebody adds docs.  KAO
47777     <sect1><title>Frame Buffer Generic Functions</title>
47778X!Idrivers/video/fbgen.c
47779     </sect1>
47780KAO -->
47781     <sect1><title>Frame Buffer Video Mode Database</title>
47782<!-- drivers/video/fbdev/core/modedb.c -->
47783<refentry id="API-fb-try-mode">
47784<refentryinfo>
47785 <title>LINUX</title>
47786 <productname>Kernel Hackers Manual</productname>
47787 <date>July 2017</date>
47788</refentryinfo>
47789<refmeta>
47790 <refentrytitle><phrase>fb_try_mode</phrase></refentrytitle>
47791 <manvolnum>9</manvolnum>
47792 <refmiscinfo class="version">4.1.27</refmiscinfo>
47793</refmeta>
47794<refnamediv>
47795 <refname>fb_try_mode</refname>
47796 <refpurpose>
47797  test a video mode
47798 </refpurpose>
47799</refnamediv>
47800<refsynopsisdiv>
47801 <title>Synopsis</title>
47802  <funcsynopsis><funcprototype>
47803   <funcdef>int <function>fb_try_mode </function></funcdef>
47804   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
47805   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
47806   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
47807   <paramdef>unsigned int <parameter>bpp</parameter></paramdef>
47808  </funcprototype></funcsynopsis>
47809</refsynopsisdiv>
47810<refsect1>
47811 <title>Arguments</title>
47812 <variablelist>
47813  <varlistentry>
47814   <term><parameter>var</parameter></term>
47815   <listitem>
47816    <para>
47817     frame buffer user defined part of display
47818    </para>
47819   </listitem>
47820  </varlistentry>
47821  <varlistentry>
47822   <term><parameter>info</parameter></term>
47823   <listitem>
47824    <para>
47825     frame buffer info structure
47826    </para>
47827   </listitem>
47828  </varlistentry>
47829  <varlistentry>
47830   <term><parameter>mode</parameter></term>
47831   <listitem>
47832    <para>
47833     frame buffer video mode structure
47834    </para>
47835   </listitem>
47836  </varlistentry>
47837  <varlistentry>
47838   <term><parameter>bpp</parameter></term>
47839   <listitem>
47840    <para>
47841     color depth in bits per pixel
47842    </para>
47843   </listitem>
47844  </varlistentry>
47845 </variablelist>
47846</refsect1>
47847<refsect1>
47848<title>Description</title>
47849<para>
47850   Tries a video mode to test it's validity for device <parameter>info</parameter>.
47851   </para><para>
47852
47853   Returns 1 on success.
47854</para>
47855</refsect1>
47856</refentry>
47857
47858<refentry id="API-fb-delete-videomode">
47859<refentryinfo>
47860 <title>LINUX</title>
47861 <productname>Kernel Hackers Manual</productname>
47862 <date>July 2017</date>
47863</refentryinfo>
47864<refmeta>
47865 <refentrytitle><phrase>fb_delete_videomode</phrase></refentrytitle>
47866 <manvolnum>9</manvolnum>
47867 <refmiscinfo class="version">4.1.27</refmiscinfo>
47868</refmeta>
47869<refnamediv>
47870 <refname>fb_delete_videomode</refname>
47871 <refpurpose>
47872     removed videomode entry from modelist
47873 </refpurpose>
47874</refnamediv>
47875<refsynopsisdiv>
47876 <title>Synopsis</title>
47877  <funcsynopsis><funcprototype>
47878   <funcdef>void <function>fb_delete_videomode </function></funcdef>
47879   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
47880   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
47881  </funcprototype></funcsynopsis>
47882</refsynopsisdiv>
47883<refsect1>
47884 <title>Arguments</title>
47885 <variablelist>
47886  <varlistentry>
47887   <term><parameter>mode</parameter></term>
47888   <listitem>
47889    <para>
47890     videomode to remove
47891    </para>
47892   </listitem>
47893  </varlistentry>
47894  <varlistentry>
47895   <term><parameter>head</parameter></term>
47896   <listitem>
47897    <para>
47898     struct list_head of modelist
47899    </para>
47900   </listitem>
47901  </varlistentry>
47902 </variablelist>
47903</refsect1>
47904<refsect1>
47905<title>NOTES</title>
47906<para>
47907   Will remove all matching mode entries
47908</para>
47909</refsect1>
47910</refentry>
47911
47912<!-- drivers/video/fbdev/core/modedb.c -->
47913<refentry id="API-fb-find-mode">
47914<refentryinfo>
47915 <title>LINUX</title>
47916 <productname>Kernel Hackers Manual</productname>
47917 <date>July 2017</date>
47918</refentryinfo>
47919<refmeta>
47920 <refentrytitle><phrase>fb_find_mode</phrase></refentrytitle>
47921 <manvolnum>9</manvolnum>
47922 <refmiscinfo class="version">4.1.27</refmiscinfo>
47923</refmeta>
47924<refnamediv>
47925 <refname>fb_find_mode</refname>
47926 <refpurpose>
47927  finds a valid video mode
47928 </refpurpose>
47929</refnamediv>
47930<refsynopsisdiv>
47931 <title>Synopsis</title>
47932  <funcsynopsis><funcprototype>
47933   <funcdef>int <function>fb_find_mode </function></funcdef>
47934   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
47935   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
47936   <paramdef>const char * <parameter>mode_option</parameter></paramdef>
47937   <paramdef>const struct fb_videomode * <parameter>db</parameter></paramdef>
47938   <paramdef>unsigned int <parameter>dbsize</parameter></paramdef>
47939   <paramdef>const struct fb_videomode * <parameter>default_mode</parameter></paramdef>
47940   <paramdef>unsigned int <parameter>default_bpp</parameter></paramdef>
47941  </funcprototype></funcsynopsis>
47942</refsynopsisdiv>
47943<refsect1>
47944 <title>Arguments</title>
47945 <variablelist>
47946  <varlistentry>
47947   <term><parameter>var</parameter></term>
47948   <listitem>
47949    <para>
47950     frame buffer user defined part of display
47951    </para>
47952   </listitem>
47953  </varlistentry>
47954  <varlistentry>
47955   <term><parameter>info</parameter></term>
47956   <listitem>
47957    <para>
47958     frame buffer info structure
47959    </para>
47960   </listitem>
47961  </varlistentry>
47962  <varlistentry>
47963   <term><parameter>mode_option</parameter></term>
47964   <listitem>
47965    <para>
47966     string video mode to find
47967    </para>
47968   </listitem>
47969  </varlistentry>
47970  <varlistentry>
47971   <term><parameter>db</parameter></term>
47972   <listitem>
47973    <para>
47974     video mode database
47975    </para>
47976   </listitem>
47977  </varlistentry>
47978  <varlistentry>
47979   <term><parameter>dbsize</parameter></term>
47980   <listitem>
47981    <para>
47982     size of <parameter>db</parameter>
47983    </para>
47984   </listitem>
47985  </varlistentry>
47986  <varlistentry>
47987   <term><parameter>default_mode</parameter></term>
47988   <listitem>
47989    <para>
47990     default video mode to fall back to
47991    </para>
47992   </listitem>
47993  </varlistentry>
47994  <varlistentry>
47995   <term><parameter>default_bpp</parameter></term>
47996   <listitem>
47997    <para>
47998     default color depth in bits per pixel
47999    </para>
48000   </listitem>
48001  </varlistentry>
48002 </variablelist>
48003</refsect1>
48004<refsect1>
48005<title>Description</title>
48006<para>
48007   Finds a suitable video mode, starting with the specified mode
48008   in <parameter>mode_option</parameter> with fallback to <parameter>default_mode</parameter>.  If
48009   <parameter>default_mode</parameter> fails, all modes in the video mode database will
48010   be tried.
48011   </para><para>
48012
48013   Valid mode specifiers for <parameter>mode_option</parameter>:
48014   </para><para>
48015
48016   &lt;xres&gt;x&lt;yres&gt;[M][R][-&lt;bpp&gt;][@&lt;refresh&gt;][i][m] or
48017   &lt;name&gt;[-&lt;bpp&gt;][@&lt;refresh&gt;]
48018   </para><para>
48019
48020   with &lt;xres&gt;, &lt;yres&gt;, &lt;bpp&gt; and &lt;refresh&gt; decimal numbers and
48021   &lt;name&gt; a string.
48022   </para><para>
48023
48024   If 'M' is present after yres (and before refresh/bpp if present),
48025   the function will compute the timings using VESA(tm) Coordinated
48026   Video Timings (CVT).  If 'R' is present after 'M', will compute with
48027   reduced blanking (for flatpanels).  If 'i' is present, compute
48028   interlaced mode.  If 'm' is present, add margins equal to 1.8%
48029   of xres rounded down to 8 pixels, and 1.8% of yres. The char
48030   'i' and 'm' must be after 'M' and 'R'. Example:
48031   </para><para>
48032
48033   1024x768MR-8<parameter>60m</parameter> - Reduced blank with margins at 60Hz.
48034</para>
48035</refsect1>
48036<refsect1>
48037<title>NOTE</title>
48038<para>
48039   The passed struct <parameter>var</parameter> is _not_ cleared!  This allows you
48040   to supply values for e.g. the grayscale and accel_flags fields.
48041   </para><para>
48042
48043   Returns zero for failure, 1 if using specified <parameter>mode_option</parameter>,
48044   2 if using specified <parameter>mode_option</parameter> with an ignored refresh rate,
48045   3 if default mode is used, 4 if fall back to any valid mode.
48046</para>
48047</refsect1>
48048</refentry>
48049
48050<refentry id="API-fb-var-to-videomode">
48051<refentryinfo>
48052 <title>LINUX</title>
48053 <productname>Kernel Hackers Manual</productname>
48054 <date>July 2017</date>
48055</refentryinfo>
48056<refmeta>
48057 <refentrytitle><phrase>fb_var_to_videomode</phrase></refentrytitle>
48058 <manvolnum>9</manvolnum>
48059 <refmiscinfo class="version">4.1.27</refmiscinfo>
48060</refmeta>
48061<refnamediv>
48062 <refname>fb_var_to_videomode</refname>
48063 <refpurpose>
48064     convert fb_var_screeninfo to fb_videomode
48065 </refpurpose>
48066</refnamediv>
48067<refsynopsisdiv>
48068 <title>Synopsis</title>
48069  <funcsynopsis><funcprototype>
48070   <funcdef>void <function>fb_var_to_videomode </function></funcdef>
48071   <paramdef>struct fb_videomode * <parameter>mode</parameter></paramdef>
48072   <paramdef>const struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
48073  </funcprototype></funcsynopsis>
48074</refsynopsisdiv>
48075<refsect1>
48076 <title>Arguments</title>
48077 <variablelist>
48078  <varlistentry>
48079   <term><parameter>mode</parameter></term>
48080   <listitem>
48081    <para>
48082     pointer to struct fb_videomode
48083    </para>
48084   </listitem>
48085  </varlistentry>
48086  <varlistentry>
48087   <term><parameter>var</parameter></term>
48088   <listitem>
48089    <para>
48090     pointer to struct fb_var_screeninfo
48091    </para>
48092   </listitem>
48093  </varlistentry>
48094 </variablelist>
48095</refsect1>
48096</refentry>
48097
48098<refentry id="API-fb-videomode-to-var">
48099<refentryinfo>
48100 <title>LINUX</title>
48101 <productname>Kernel Hackers Manual</productname>
48102 <date>July 2017</date>
48103</refentryinfo>
48104<refmeta>
48105 <refentrytitle><phrase>fb_videomode_to_var</phrase></refentrytitle>
48106 <manvolnum>9</manvolnum>
48107 <refmiscinfo class="version">4.1.27</refmiscinfo>
48108</refmeta>
48109<refnamediv>
48110 <refname>fb_videomode_to_var</refname>
48111 <refpurpose>
48112     convert fb_videomode to fb_var_screeninfo
48113 </refpurpose>
48114</refnamediv>
48115<refsynopsisdiv>
48116 <title>Synopsis</title>
48117  <funcsynopsis><funcprototype>
48118   <funcdef>void <function>fb_videomode_to_var </function></funcdef>
48119   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
48120   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
48121  </funcprototype></funcsynopsis>
48122</refsynopsisdiv>
48123<refsect1>
48124 <title>Arguments</title>
48125 <variablelist>
48126  <varlistentry>
48127   <term><parameter>var</parameter></term>
48128   <listitem>
48129    <para>
48130     pointer to struct fb_var_screeninfo
48131    </para>
48132   </listitem>
48133  </varlistentry>
48134  <varlistentry>
48135   <term><parameter>mode</parameter></term>
48136   <listitem>
48137    <para>
48138     pointer to struct fb_videomode
48139    </para>
48140   </listitem>
48141  </varlistentry>
48142 </variablelist>
48143</refsect1>
48144</refentry>
48145
48146<refentry id="API-fb-mode-is-equal">
48147<refentryinfo>
48148 <title>LINUX</title>
48149 <productname>Kernel Hackers Manual</productname>
48150 <date>July 2017</date>
48151</refentryinfo>
48152<refmeta>
48153 <refentrytitle><phrase>fb_mode_is_equal</phrase></refentrytitle>
48154 <manvolnum>9</manvolnum>
48155 <refmiscinfo class="version">4.1.27</refmiscinfo>
48156</refmeta>
48157<refnamediv>
48158 <refname>fb_mode_is_equal</refname>
48159 <refpurpose>
48160     compare 2 videomodes
48161 </refpurpose>
48162</refnamediv>
48163<refsynopsisdiv>
48164 <title>Synopsis</title>
48165  <funcsynopsis><funcprototype>
48166   <funcdef>int <function>fb_mode_is_equal </function></funcdef>
48167   <paramdef>const struct fb_videomode * <parameter>mode1</parameter></paramdef>
48168   <paramdef>const struct fb_videomode * <parameter>mode2</parameter></paramdef>
48169  </funcprototype></funcsynopsis>
48170</refsynopsisdiv>
48171<refsect1>
48172 <title>Arguments</title>
48173 <variablelist>
48174  <varlistentry>
48175   <term><parameter>mode1</parameter></term>
48176   <listitem>
48177    <para>
48178     first videomode
48179    </para>
48180   </listitem>
48181  </varlistentry>
48182  <varlistentry>
48183   <term><parameter>mode2</parameter></term>
48184   <listitem>
48185    <para>
48186     second videomode
48187    </para>
48188   </listitem>
48189  </varlistentry>
48190 </variablelist>
48191</refsect1>
48192<refsect1>
48193<title>RETURNS</title>
48194<para>
48195   1 if equal, 0 if not
48196</para>
48197</refsect1>
48198</refentry>
48199
48200<refentry id="API-fb-find-best-mode">
48201<refentryinfo>
48202 <title>LINUX</title>
48203 <productname>Kernel Hackers Manual</productname>
48204 <date>July 2017</date>
48205</refentryinfo>
48206<refmeta>
48207 <refentrytitle><phrase>fb_find_best_mode</phrase></refentrytitle>
48208 <manvolnum>9</manvolnum>
48209 <refmiscinfo class="version">4.1.27</refmiscinfo>
48210</refmeta>
48211<refnamediv>
48212 <refname>fb_find_best_mode</refname>
48213 <refpurpose>
48214     find best matching videomode
48215 </refpurpose>
48216</refnamediv>
48217<refsynopsisdiv>
48218 <title>Synopsis</title>
48219  <funcsynopsis><funcprototype>
48220   <funcdef>const struct fb_videomode * <function>fb_find_best_mode </function></funcdef>
48221   <paramdef>const struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
48222   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
48223  </funcprototype></funcsynopsis>
48224</refsynopsisdiv>
48225<refsect1>
48226 <title>Arguments</title>
48227 <variablelist>
48228  <varlistentry>
48229   <term><parameter>var</parameter></term>
48230   <listitem>
48231    <para>
48232     pointer to struct fb_var_screeninfo
48233    </para>
48234   </listitem>
48235  </varlistentry>
48236  <varlistentry>
48237   <term><parameter>head</parameter></term>
48238   <listitem>
48239    <para>
48240     pointer to struct list_head of modelist
48241    </para>
48242   </listitem>
48243  </varlistentry>
48244 </variablelist>
48245</refsect1>
48246<refsect1>
48247<title>RETURNS</title>
48248<para>
48249   struct fb_videomode, NULL if none found
48250</para>
48251</refsect1>
48252<refsect1>
48253<title>IMPORTANT</title>
48254<para>
48255   This function assumes that all modelist entries in
48256   info-&gt;modelist are valid.
48257</para>
48258</refsect1>
48259<refsect1>
48260<title>NOTES</title>
48261<para>
48262   Finds best matching videomode which has an equal or greater dimension than
48263   var-&gt;xres and var-&gt;yres.  If more than 1 videomode is found, will return
48264   the videomode with the highest refresh rate
48265</para>
48266</refsect1>
48267</refentry>
48268
48269<refentry id="API-fb-find-nearest-mode">
48270<refentryinfo>
48271 <title>LINUX</title>
48272 <productname>Kernel Hackers Manual</productname>
48273 <date>July 2017</date>
48274</refentryinfo>
48275<refmeta>
48276 <refentrytitle><phrase>fb_find_nearest_mode</phrase></refentrytitle>
48277 <manvolnum>9</manvolnum>
48278 <refmiscinfo class="version">4.1.27</refmiscinfo>
48279</refmeta>
48280<refnamediv>
48281 <refname>fb_find_nearest_mode</refname>
48282 <refpurpose>
48283     find closest videomode
48284 </refpurpose>
48285</refnamediv>
48286<refsynopsisdiv>
48287 <title>Synopsis</title>
48288  <funcsynopsis><funcprototype>
48289   <funcdef>const struct fb_videomode * <function>fb_find_nearest_mode </function></funcdef>
48290   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
48291   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
48292  </funcprototype></funcsynopsis>
48293</refsynopsisdiv>
48294<refsect1>
48295 <title>Arguments</title>
48296 <variablelist>
48297  <varlistentry>
48298   <term><parameter>mode</parameter></term>
48299   <listitem>
48300    <para>
48301     pointer to struct fb_videomode
48302    </para>
48303   </listitem>
48304  </varlistentry>
48305  <varlistentry>
48306   <term><parameter>head</parameter></term>
48307   <listitem>
48308    <para>
48309     pointer to modelist
48310    </para>
48311   </listitem>
48312  </varlistentry>
48313 </variablelist>
48314</refsect1>
48315<refsect1>
48316<title>Description</title>
48317<para>
48318   Finds best matching videomode, smaller or greater in dimension.
48319   If more than 1 videomode is found, will return the videomode with
48320   the closest refresh rate.
48321</para>
48322</refsect1>
48323</refentry>
48324
48325<refentry id="API-fb-match-mode">
48326<refentryinfo>
48327 <title>LINUX</title>
48328 <productname>Kernel Hackers Manual</productname>
48329 <date>July 2017</date>
48330</refentryinfo>
48331<refmeta>
48332 <refentrytitle><phrase>fb_match_mode</phrase></refentrytitle>
48333 <manvolnum>9</manvolnum>
48334 <refmiscinfo class="version">4.1.27</refmiscinfo>
48335</refmeta>
48336<refnamediv>
48337 <refname>fb_match_mode</refname>
48338 <refpurpose>
48339     find a videomode which exactly matches the timings in var
48340 </refpurpose>
48341</refnamediv>
48342<refsynopsisdiv>
48343 <title>Synopsis</title>
48344  <funcsynopsis><funcprototype>
48345   <funcdef>const struct fb_videomode * <function>fb_match_mode </function></funcdef>
48346   <paramdef>const struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
48347   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
48348  </funcprototype></funcsynopsis>
48349</refsynopsisdiv>
48350<refsect1>
48351 <title>Arguments</title>
48352 <variablelist>
48353  <varlistentry>
48354   <term><parameter>var</parameter></term>
48355   <listitem>
48356    <para>
48357     pointer to struct fb_var_screeninfo
48358    </para>
48359   </listitem>
48360  </varlistentry>
48361  <varlistentry>
48362   <term><parameter>head</parameter></term>
48363   <listitem>
48364    <para>
48365     pointer to struct list_head of modelist
48366    </para>
48367   </listitem>
48368  </varlistentry>
48369 </variablelist>
48370</refsect1>
48371<refsect1>
48372<title>RETURNS</title>
48373<para>
48374   struct fb_videomode, NULL if none found
48375</para>
48376</refsect1>
48377</refentry>
48378
48379<refentry id="API-fb-add-videomode">
48380<refentryinfo>
48381 <title>LINUX</title>
48382 <productname>Kernel Hackers Manual</productname>
48383 <date>July 2017</date>
48384</refentryinfo>
48385<refmeta>
48386 <refentrytitle><phrase>fb_add_videomode</phrase></refentrytitle>
48387 <manvolnum>9</manvolnum>
48388 <refmiscinfo class="version">4.1.27</refmiscinfo>
48389</refmeta>
48390<refnamediv>
48391 <refname>fb_add_videomode</refname>
48392 <refpurpose>
48393     adds videomode entry to modelist
48394 </refpurpose>
48395</refnamediv>
48396<refsynopsisdiv>
48397 <title>Synopsis</title>
48398  <funcsynopsis><funcprototype>
48399   <funcdef>int <function>fb_add_videomode </function></funcdef>
48400   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
48401   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
48402  </funcprototype></funcsynopsis>
48403</refsynopsisdiv>
48404<refsect1>
48405 <title>Arguments</title>
48406 <variablelist>
48407  <varlistentry>
48408   <term><parameter>mode</parameter></term>
48409   <listitem>
48410    <para>
48411     videomode to add
48412    </para>
48413   </listitem>
48414  </varlistentry>
48415  <varlistentry>
48416   <term><parameter>head</parameter></term>
48417   <listitem>
48418    <para>
48419     struct list_head of modelist
48420    </para>
48421   </listitem>
48422  </varlistentry>
48423 </variablelist>
48424</refsect1>
48425<refsect1>
48426<title>NOTES</title>
48427<para>
48428   Will only add unmatched mode entries
48429</para>
48430</refsect1>
48431</refentry>
48432
48433<refentry id="API-fb-destroy-modelist">
48434<refentryinfo>
48435 <title>LINUX</title>
48436 <productname>Kernel Hackers Manual</productname>
48437 <date>July 2017</date>
48438</refentryinfo>
48439<refmeta>
48440 <refentrytitle><phrase>fb_destroy_modelist</phrase></refentrytitle>
48441 <manvolnum>9</manvolnum>
48442 <refmiscinfo class="version">4.1.27</refmiscinfo>
48443</refmeta>
48444<refnamediv>
48445 <refname>fb_destroy_modelist</refname>
48446 <refpurpose>
48447     destroy modelist
48448 </refpurpose>
48449</refnamediv>
48450<refsynopsisdiv>
48451 <title>Synopsis</title>
48452  <funcsynopsis><funcprototype>
48453   <funcdef>void <function>fb_destroy_modelist </function></funcdef>
48454   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
48455  </funcprototype></funcsynopsis>
48456</refsynopsisdiv>
48457<refsect1>
48458 <title>Arguments</title>
48459 <variablelist>
48460  <varlistentry>
48461   <term><parameter>head</parameter></term>
48462   <listitem>
48463    <para>
48464     struct list_head of modelist
48465    </para>
48466   </listitem>
48467  </varlistentry>
48468 </variablelist>
48469</refsect1>
48470</refentry>
48471
48472<refentry id="API-fb-videomode-to-modelist">
48473<refentryinfo>
48474 <title>LINUX</title>
48475 <productname>Kernel Hackers Manual</productname>
48476 <date>July 2017</date>
48477</refentryinfo>
48478<refmeta>
48479 <refentrytitle><phrase>fb_videomode_to_modelist</phrase></refentrytitle>
48480 <manvolnum>9</manvolnum>
48481 <refmiscinfo class="version">4.1.27</refmiscinfo>
48482</refmeta>
48483<refnamediv>
48484 <refname>fb_videomode_to_modelist</refname>
48485 <refpurpose>
48486     convert mode array to mode list
48487 </refpurpose>
48488</refnamediv>
48489<refsynopsisdiv>
48490 <title>Synopsis</title>
48491  <funcsynopsis><funcprototype>
48492   <funcdef>void <function>fb_videomode_to_modelist </function></funcdef>
48493   <paramdef>const struct fb_videomode * <parameter>modedb</parameter></paramdef>
48494   <paramdef>int <parameter>num</parameter></paramdef>
48495   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
48496  </funcprototype></funcsynopsis>
48497</refsynopsisdiv>
48498<refsect1>
48499 <title>Arguments</title>
48500 <variablelist>
48501  <varlistentry>
48502   <term><parameter>modedb</parameter></term>
48503   <listitem>
48504    <para>
48505     array of struct fb_videomode
48506    </para>
48507   </listitem>
48508  </varlistentry>
48509  <varlistentry>
48510   <term><parameter>num</parameter></term>
48511   <listitem>
48512    <para>
48513     number of entries in array
48514    </para>
48515   </listitem>
48516  </varlistentry>
48517  <varlistentry>
48518   <term><parameter>head</parameter></term>
48519   <listitem>
48520    <para>
48521     struct list_head of modelist
48522    </para>
48523   </listitem>
48524  </varlistentry>
48525 </variablelist>
48526</refsect1>
48527</refentry>
48528
48529     </sect1>
48530     <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
48531<!-- drivers/video/fbdev/macmodes.c -->
48532<refentry id="API-mac-vmode-to-var">
48533<refentryinfo>
48534 <title>LINUX</title>
48535 <productname>Kernel Hackers Manual</productname>
48536 <date>July 2017</date>
48537</refentryinfo>
48538<refmeta>
48539 <refentrytitle><phrase>mac_vmode_to_var</phrase></refentrytitle>
48540 <manvolnum>9</manvolnum>
48541 <refmiscinfo class="version">4.1.27</refmiscinfo>
48542</refmeta>
48543<refnamediv>
48544 <refname>mac_vmode_to_var</refname>
48545 <refpurpose>
48546  converts vmode/cmode pair to var structure
48547 </refpurpose>
48548</refnamediv>
48549<refsynopsisdiv>
48550 <title>Synopsis</title>
48551  <funcsynopsis><funcprototype>
48552   <funcdef>int <function>mac_vmode_to_var </function></funcdef>
48553   <paramdef>int <parameter>vmode</parameter></paramdef>
48554   <paramdef>int <parameter>cmode</parameter></paramdef>
48555   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
48556  </funcprototype></funcsynopsis>
48557</refsynopsisdiv>
48558<refsect1>
48559 <title>Arguments</title>
48560 <variablelist>
48561  <varlistentry>
48562   <term><parameter>vmode</parameter></term>
48563   <listitem>
48564    <para>
48565     MacOS video mode
48566    </para>
48567   </listitem>
48568  </varlistentry>
48569  <varlistentry>
48570   <term><parameter>cmode</parameter></term>
48571   <listitem>
48572    <para>
48573     MacOS color mode
48574    </para>
48575   </listitem>
48576  </varlistentry>
48577  <varlistentry>
48578   <term><parameter>var</parameter></term>
48579   <listitem>
48580    <para>
48581     frame buffer video mode structure
48582    </para>
48583   </listitem>
48584  </varlistentry>
48585 </variablelist>
48586</refsect1>
48587<refsect1>
48588<title>Description</title>
48589<para>
48590   Converts a MacOS vmode/cmode pair to a frame buffer video
48591   mode structure.
48592   </para><para>
48593
48594   Returns negative errno on error, or zero for success.
48595</para>
48596</refsect1>
48597</refentry>
48598
48599<refentry id="API-mac-map-monitor-sense">
48600<refentryinfo>
48601 <title>LINUX</title>
48602 <productname>Kernel Hackers Manual</productname>
48603 <date>July 2017</date>
48604</refentryinfo>
48605<refmeta>
48606 <refentrytitle><phrase>mac_map_monitor_sense</phrase></refentrytitle>
48607 <manvolnum>9</manvolnum>
48608 <refmiscinfo class="version">4.1.27</refmiscinfo>
48609</refmeta>
48610<refnamediv>
48611 <refname>mac_map_monitor_sense</refname>
48612 <refpurpose>
48613     Convert monitor sense to vmode
48614 </refpurpose>
48615</refnamediv>
48616<refsynopsisdiv>
48617 <title>Synopsis</title>
48618  <funcsynopsis><funcprototype>
48619   <funcdef>int <function>mac_map_monitor_sense </function></funcdef>
48620   <paramdef>int <parameter>sense</parameter></paramdef>
48621  </funcprototype></funcsynopsis>
48622</refsynopsisdiv>
48623<refsect1>
48624 <title>Arguments</title>
48625 <variablelist>
48626  <varlistentry>
48627   <term><parameter>sense</parameter></term>
48628   <listitem>
48629    <para>
48630     Macintosh monitor sense number
48631    </para>
48632   </listitem>
48633  </varlistentry>
48634 </variablelist>
48635</refsect1>
48636<refsect1>
48637<title>Description</title>
48638<para>
48639   Converts a Macintosh monitor sense number to a MacOS
48640   vmode number.
48641   </para><para>
48642
48643   Returns MacOS vmode video mode number.
48644</para>
48645</refsect1>
48646</refentry>
48647
48648<refentry id="API-mac-find-mode">
48649<refentryinfo>
48650 <title>LINUX</title>
48651 <productname>Kernel Hackers Manual</productname>
48652 <date>July 2017</date>
48653</refentryinfo>
48654<refmeta>
48655 <refentrytitle><phrase>mac_find_mode</phrase></refentrytitle>
48656 <manvolnum>9</manvolnum>
48657 <refmiscinfo class="version">4.1.27</refmiscinfo>
48658</refmeta>
48659<refnamediv>
48660 <refname>mac_find_mode</refname>
48661 <refpurpose>
48662     find a video mode
48663 </refpurpose>
48664</refnamediv>
48665<refsynopsisdiv>
48666 <title>Synopsis</title>
48667  <funcsynopsis><funcprototype>
48668   <funcdef>int <function>mac_find_mode </function></funcdef>
48669   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
48670   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
48671   <paramdef>const char * <parameter>mode_option</parameter></paramdef>
48672   <paramdef>unsigned int <parameter>default_bpp</parameter></paramdef>
48673  </funcprototype></funcsynopsis>
48674</refsynopsisdiv>
48675<refsect1>
48676 <title>Arguments</title>
48677 <variablelist>
48678  <varlistentry>
48679   <term><parameter>var</parameter></term>
48680   <listitem>
48681    <para>
48682     frame buffer user defined part of display
48683    </para>
48684   </listitem>
48685  </varlistentry>
48686  <varlistentry>
48687   <term><parameter>info</parameter></term>
48688   <listitem>
48689    <para>
48690     frame buffer info structure
48691    </para>
48692   </listitem>
48693  </varlistentry>
48694  <varlistentry>
48695   <term><parameter>mode_option</parameter></term>
48696   <listitem>
48697    <para>
48698     video mode name (see mac_modedb[])
48699    </para>
48700   </listitem>
48701  </varlistentry>
48702  <varlistentry>
48703   <term><parameter>default_bpp</parameter></term>
48704   <listitem>
48705    <para>
48706     default color depth in bits per pixel
48707    </para>
48708   </listitem>
48709  </varlistentry>
48710 </variablelist>
48711</refsect1>
48712<refsect1>
48713<title>Description</title>
48714<para>
48715   Finds a suitable video mode.  Tries to set mode specified
48716   by <parameter>mode_option</parameter>.  If the name of the wanted mode begins with
48717   'mac', the Mac video mode database will be used, otherwise it
48718   will fall back to the standard video mode database.
48719</para>
48720</refsect1>
48721<refsect1>
48722<title>Note</title>
48723<para>
48724   Function marked as __init and can only be used during
48725   system boot.
48726   </para><para>
48727
48728   Returns error code from fb_find_mode (see fb_find_mode
48729   function).
48730</para>
48731</refsect1>
48732</refentry>
48733
48734     </sect1>
48735     <sect1><title>Frame Buffer Fonts</title>
48736        <para>
48737           Refer to the file lib/fonts/fonts.c for more information.
48738        </para>
48739<!-- FIXME: Removed for now since no structured comments in source
48740X!Ilib/fonts/fonts.c
48741-->
48742     </sect1>
48743  </chapter>
48744
48745  <chapter id="input_subsystem">
48746     <title>Input Subsystem</title>
48747     <sect1><title>Input core</title>
48748<!-- include/linux/input.h -->
48749<refentry id="API-struct-input-value">
48750<refentryinfo>
48751 <title>LINUX</title>
48752 <productname>Kernel Hackers Manual</productname>
48753 <date>July 2017</date>
48754</refentryinfo>
48755<refmeta>
48756 <refentrytitle><phrase>struct input_value</phrase></refentrytitle>
48757 <manvolnum>9</manvolnum>
48758 <refmiscinfo class="version">4.1.27</refmiscinfo>
48759</refmeta>
48760<refnamediv>
48761 <refname>struct input_value</refname>
48762 <refpurpose>
48763  input value representation
48764 </refpurpose>
48765</refnamediv>
48766<refsynopsisdiv>
48767 <title>Synopsis</title>
48768  <programlisting>
48769struct input_value {
48770  __u16 type;
48771  __u16 code;
48772  __s32 value;
48773};  </programlisting>
48774</refsynopsisdiv>
48775 <refsect1>
48776  <title>Members</title>
48777  <variablelist>
48778    <varlistentry>      <term>type</term>
48779      <listitem><para>
48780type of value (EV_KEY, EV_ABS, etc)
48781      </para></listitem>
48782    </varlistentry>
48783    <varlistentry>      <term>code</term>
48784      <listitem><para>
48785the value code
48786      </para></listitem>
48787    </varlistentry>
48788    <varlistentry>      <term>value</term>
48789      <listitem><para>
48790the value
48791      </para></listitem>
48792    </varlistentry>
48793  </variablelist>
48794 </refsect1>
48795</refentry>
48796
48797<refentry id="API-struct-input-dev">
48798<refentryinfo>
48799 <title>LINUX</title>
48800 <productname>Kernel Hackers Manual</productname>
48801 <date>July 2017</date>
48802</refentryinfo>
48803<refmeta>
48804 <refentrytitle><phrase>struct input_dev</phrase></refentrytitle>
48805 <manvolnum>9</manvolnum>
48806 <refmiscinfo class="version">4.1.27</refmiscinfo>
48807</refmeta>
48808<refnamediv>
48809 <refname>struct input_dev</refname>
48810 <refpurpose>
48811     represents an input device
48812 </refpurpose>
48813</refnamediv>
48814<refsynopsisdiv>
48815 <title>Synopsis</title>
48816  <programlisting>
48817struct input_dev {
48818  const char * name;
48819  const char * phys;
48820  const char * uniq;
48821  struct input_id id;
48822  unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];
48823  unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
48824  unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
48825  unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
48826  unsigned long absbit[BITS_TO_LONGS(ABS_CNT)];
48827  unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)];
48828  unsigned long ledbit[BITS_TO_LONGS(LED_CNT)];
48829  unsigned long sndbit[BITS_TO_LONGS(SND_CNT)];
48830  unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
48831  unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
48832  unsigned int hint_events_per_packet;
48833  unsigned int keycodemax;
48834  unsigned int keycodesize;
48835  void * keycode;
48836  int (* setkeycode) (struct input_dev *dev,const struct input_keymap_entry *ke,unsigned int *old_keycode);
48837  int (* getkeycode) (struct input_dev *dev,struct input_keymap_entry *ke);
48838  struct ff_device * ff;
48839  unsigned int repeat_key;
48840  struct timer_list timer;
48841  int rep[REP_CNT];
48842  struct input_mt * mt;
48843  struct input_absinfo * absinfo;
48844  unsigned long key[BITS_TO_LONGS(KEY_CNT)];
48845  unsigned long led[BITS_TO_LONGS(LED_CNT)];
48846  unsigned long snd[BITS_TO_LONGS(SND_CNT)];
48847  unsigned long sw[BITS_TO_LONGS(SW_CNT)];
48848  int (* open) (struct input_dev *dev);
48849  void (* close) (struct input_dev *dev);
48850  int (* flush) (struct input_dev *dev, struct file *file);
48851  int (* event) (struct input_dev *dev, unsigned int type, unsigned int code, int value);
48852  struct input_handle __rcu * grab;
48853  spinlock_t event_lock;
48854  struct mutex mutex;
48855  unsigned int users;
48856  bool going_away;
48857  struct device dev;
48858  struct list_head h_list;
48859  struct list_head node;
48860  unsigned int num_vals;
48861  unsigned int max_vals;
48862  struct input_value * vals;
48863  bool devres_managed;
48864};  </programlisting>
48865</refsynopsisdiv>
48866 <refsect1>
48867  <title>Members</title>
48868  <variablelist>
48869    <varlistentry>      <term>name</term>
48870      <listitem><para>
48871   name of the device
48872      </para></listitem>
48873    </varlistentry>
48874    <varlistentry>      <term>phys</term>
48875      <listitem><para>
48876   physical path to the device in the system hierarchy
48877      </para></listitem>
48878    </varlistentry>
48879    <varlistentry>      <term>uniq</term>
48880      <listitem><para>
48881   unique identification code for the device (if device has it)
48882      </para></listitem>
48883    </varlistentry>
48884    <varlistentry>      <term>id</term>
48885      <listitem><para>
48886   id of the device (struct input_id)
48887      </para></listitem>
48888    </varlistentry>
48889    <varlistentry>      <term>propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]</term>
48890      <listitem><para>
48891   bitmap of device properties and quirks
48892      </para></listitem>
48893    </varlistentry>
48894    <varlistentry>      <term>evbit[BITS_TO_LONGS(EV_CNT)]</term>
48895      <listitem><para>
48896   bitmap of types of events supported by the device (EV_KEY,
48897   EV_REL, etc.)
48898      </para></listitem>
48899    </varlistentry>
48900    <varlistentry>      <term>keybit[BITS_TO_LONGS(KEY_CNT)]</term>
48901      <listitem><para>
48902   bitmap of keys/buttons this device has
48903      </para></listitem>
48904    </varlistentry>
48905    <varlistentry>      <term>relbit[BITS_TO_LONGS(REL_CNT)]</term>
48906      <listitem><para>
48907   bitmap of relative axes for the device
48908      </para></listitem>
48909    </varlistentry>
48910    <varlistentry>      <term>absbit[BITS_TO_LONGS(ABS_CNT)]</term>
48911      <listitem><para>
48912   bitmap of absolute axes for the device
48913      </para></listitem>
48914    </varlistentry>
48915    <varlistentry>      <term>mscbit[BITS_TO_LONGS(MSC_CNT)]</term>
48916      <listitem><para>
48917   bitmap of miscellaneous events supported by the device
48918      </para></listitem>
48919    </varlistentry>
48920    <varlistentry>      <term>ledbit[BITS_TO_LONGS(LED_CNT)]</term>
48921      <listitem><para>
48922   bitmap of leds present on the device
48923      </para></listitem>
48924    </varlistentry>
48925    <varlistentry>      <term>sndbit[BITS_TO_LONGS(SND_CNT)]</term>
48926      <listitem><para>
48927   bitmap of sound effects supported by the device
48928      </para></listitem>
48929    </varlistentry>
48930    <varlistentry>      <term>ffbit[BITS_TO_LONGS(FF_CNT)]</term>
48931      <listitem><para>
48932   bitmap of force feedback effects supported by the device
48933      </para></listitem>
48934    </varlistentry>
48935    <varlistentry>      <term>swbit[BITS_TO_LONGS(SW_CNT)]</term>
48936      <listitem><para>
48937   bitmap of switches present on the device
48938      </para></listitem>
48939    </varlistentry>
48940    <varlistentry>      <term>hint_events_per_packet</term>
48941      <listitem><para>
48942   average number of events generated by the
48943   device in a packet (between EV_SYN/SYN_REPORT events). Used by
48944   event handlers to estimate size of the buffer needed to hold
48945   events.
48946      </para></listitem>
48947    </varlistentry>
48948    <varlistentry>      <term>keycodemax</term>
48949      <listitem><para>
48950   size of keycode table
48951      </para></listitem>
48952    </varlistentry>
48953    <varlistentry>      <term>keycodesize</term>
48954      <listitem><para>
48955   size of elements in keycode table
48956      </para></listitem>
48957    </varlistentry>
48958    <varlistentry>      <term>keycode</term>
48959      <listitem><para>
48960   map of scancodes to keycodes for this device
48961      </para></listitem>
48962    </varlistentry>
48963    <varlistentry>      <term>setkeycode</term>
48964      <listitem><para>
48965   optional method to alter current keymap, used to implement
48966   sparse keymaps. If not supplied default mechanism will be used.
48967   The method is being called while holding event_lock and thus must
48968   not sleep
48969      </para></listitem>
48970    </varlistentry>
48971    <varlistentry>      <term>getkeycode</term>
48972      <listitem><para>
48973   optional legacy method to retrieve current keymap.
48974      </para></listitem>
48975    </varlistentry>
48976    <varlistentry>      <term>ff</term>
48977      <listitem><para>
48978   force feedback structure associated with the device if device
48979   supports force feedback effects
48980      </para></listitem>
48981    </varlistentry>
48982    <varlistentry>      <term>repeat_key</term>
48983      <listitem><para>
48984   stores key code of the last key pressed; used to implement
48985   software autorepeat
48986      </para></listitem>
48987    </varlistentry>
48988    <varlistentry>      <term>timer</term>
48989      <listitem><para>
48990   timer for software autorepeat
48991      </para></listitem>
48992    </varlistentry>
48993    <varlistentry>      <term>rep[REP_CNT]</term>
48994      <listitem><para>
48995   current values for autorepeat parameters (delay, rate)
48996      </para></listitem>
48997    </varlistentry>
48998    <varlistentry>      <term>mt</term>
48999      <listitem><para>
49000   pointer to multitouch state
49001      </para></listitem>
49002    </varlistentry>
49003    <varlistentry>      <term>absinfo</term>
49004      <listitem><para>
49005   array of <structname>struct input_absinfo</structname> elements holding information
49006   about absolute axes (current value, min, max, flat, fuzz,
49007   resolution)
49008      </para></listitem>
49009    </varlistentry>
49010    <varlistentry>      <term>key[BITS_TO_LONGS(KEY_CNT)]</term>
49011      <listitem><para>
49012   reflects current state of device's keys/buttons
49013      </para></listitem>
49014    </varlistentry>
49015    <varlistentry>      <term>led[BITS_TO_LONGS(LED_CNT)]</term>
49016      <listitem><para>
49017   reflects current state of device's LEDs
49018      </para></listitem>
49019    </varlistentry>
49020    <varlistentry>      <term>snd[BITS_TO_LONGS(SND_CNT)]</term>
49021      <listitem><para>
49022   reflects current state of sound effects
49023      </para></listitem>
49024    </varlistentry>
49025    <varlistentry>      <term>sw[BITS_TO_LONGS(SW_CNT)]</term>
49026      <listitem><para>
49027   reflects current state of device's switches
49028      </para></listitem>
49029    </varlistentry>
49030    <varlistentry>      <term>open</term>
49031      <listitem><para>
49032   this method is called when the very first user calls
49033   <function>input_open_device</function>. The driver must prepare the device
49034   to start generating events (start polling thread,
49035   request an IRQ, submit URB, etc.)
49036      </para></listitem>
49037    </varlistentry>
49038    <varlistentry>      <term>close</term>
49039      <listitem><para>
49040   this method is called when the very last user calls
49041   <function>input_close_device</function>.
49042      </para></listitem>
49043    </varlistentry>
49044    <varlistentry>      <term>flush</term>
49045      <listitem><para>
49046   purges the device. Most commonly used to get rid of force
49047   feedback effects loaded into the device when disconnecting
49048   from it
49049      </para></listitem>
49050    </varlistentry>
49051    <varlistentry>      <term>event</term>
49052      <listitem><para>
49053   event handler for events sent _to_ the device, like EV_LED
49054   or EV_SND. The device is expected to carry out the requested
49055   action (turn on a LED, play sound, etc.) The call is protected
49056   by <parameter>event_lock</parameter> and must not sleep
49057      </para></listitem>
49058    </varlistentry>
49059    <varlistentry>      <term>grab</term>
49060      <listitem><para>
49061   input handle that currently has the device grabbed (via
49062   EVIOCGRAB ioctl). When a handle grabs a device it becomes sole
49063   recipient for all input events coming from the device
49064      </para></listitem>
49065    </varlistentry>
49066    <varlistentry>      <term>event_lock</term>
49067      <listitem><para>
49068   this spinlock is is taken when input core receives
49069   and processes a new event for the device (in <function>input_event</function>).
49070   Code that accesses and/or modifies parameters of a device
49071   (such as keymap or absmin, absmax, absfuzz, etc.) after device
49072   has been registered with input core must take this lock.
49073      </para></listitem>
49074    </varlistentry>
49075    <varlistentry>      <term>mutex</term>
49076      <listitem><para>
49077   serializes calls to <function>open</function>, <function>close</function> and <function>flush</function> methods
49078      </para></listitem>
49079    </varlistentry>
49080    <varlistentry>      <term>users</term>
49081      <listitem><para>
49082   stores number of users (input handlers) that opened this
49083   device. It is used by <function>input_open_device</function> and <function>input_close_device</function>
49084   to make sure that dev-&gt;<function>open</function> is only called when the first
49085   user opens device and dev-&gt;<function>close</function> is called when the very
49086   last user closes the device
49087      </para></listitem>
49088    </varlistentry>
49089    <varlistentry>      <term>going_away</term>
49090      <listitem><para>
49091   marks devices that are in a middle of unregistering and
49092   causes input_open_device*() fail with -ENODEV.
49093      </para></listitem>
49094    </varlistentry>
49095    <varlistentry>      <term>dev</term>
49096      <listitem><para>
49097   driver model's view of this device
49098      </para></listitem>
49099    </varlistentry>
49100    <varlistentry>      <term>h_list</term>
49101      <listitem><para>
49102   list of input handles associated with the device. When
49103   accessing the list dev-&gt;mutex must be held
49104      </para></listitem>
49105    </varlistentry>
49106    <varlistentry>      <term>node</term>
49107      <listitem><para>
49108   used to place the device onto input_dev_list
49109      </para></listitem>
49110    </varlistentry>
49111    <varlistentry>      <term>num_vals</term>
49112      <listitem><para>
49113   number of values queued in the current frame
49114      </para></listitem>
49115    </varlistentry>
49116    <varlistentry>      <term>max_vals</term>
49117      <listitem><para>
49118   maximum number of values queued in a frame
49119      </para></listitem>
49120    </varlistentry>
49121    <varlistentry>      <term>vals</term>
49122      <listitem><para>
49123   array of values queued in the current frame
49124      </para></listitem>
49125    </varlistentry>
49126    <varlistentry>      <term>devres_managed</term>
49127      <listitem><para>
49128   indicates that devices is managed with devres framework
49129   and needs not be explicitly unregistered or freed.
49130      </para></listitem>
49131    </varlistentry>
49132  </variablelist>
49133 </refsect1>
49134</refentry>
49135
49136<refentry id="API-struct-input-handler">
49137<refentryinfo>
49138 <title>LINUX</title>
49139 <productname>Kernel Hackers Manual</productname>
49140 <date>July 2017</date>
49141</refentryinfo>
49142<refmeta>
49143 <refentrytitle><phrase>struct input_handler</phrase></refentrytitle>
49144 <manvolnum>9</manvolnum>
49145 <refmiscinfo class="version">4.1.27</refmiscinfo>
49146</refmeta>
49147<refnamediv>
49148 <refname>struct input_handler</refname>
49149 <refpurpose>
49150     implements one of interfaces for input devices
49151 </refpurpose>
49152</refnamediv>
49153<refsynopsisdiv>
49154 <title>Synopsis</title>
49155  <programlisting>
49156struct input_handler {
49157  void * private;
49158  void (* event) (struct input_handle *handle, unsigned int type, unsigned int code, int value);
49159  void (* events) (struct input_handle *handle,const struct input_value *vals, unsigned int count);
49160  bool (* filter) (struct input_handle *handle, unsigned int type, unsigned int code, int value);
49161  bool (* match) (struct input_handler *handler, struct input_dev *dev);
49162  int (* connect) (struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
49163  void (* disconnect) (struct input_handle *handle);
49164  void (* start) (struct input_handle *handle);
49165  bool legacy_minors;
49166  int minor;
49167  const char * name;
49168  const struct input_device_id * id_table;
49169  struct list_head h_list;
49170  struct list_head node;
49171};  </programlisting>
49172</refsynopsisdiv>
49173 <refsect1>
49174  <title>Members</title>
49175  <variablelist>
49176    <varlistentry>      <term>private</term>
49177      <listitem><para>
49178   driver-specific data
49179      </para></listitem>
49180    </varlistentry>
49181    <varlistentry>      <term>event</term>
49182      <listitem><para>
49183   event handler. This method is being called by input core with
49184   interrupts disabled and dev-&gt;event_lock spinlock held and so
49185   it may not sleep
49186      </para></listitem>
49187    </varlistentry>
49188    <varlistentry>      <term>events</term>
49189      <listitem><para>
49190   event sequence handler. This method is being called by
49191   input core with interrupts disabled and dev-&gt;event_lock
49192   spinlock held and so it may not sleep
49193      </para></listitem>
49194    </varlistentry>
49195    <varlistentry>      <term>filter</term>
49196      <listitem><para>
49197   similar to <parameter>event</parameter>; separates normal event handlers from
49198   <quote>filters</quote>.
49199      </para></listitem>
49200    </varlistentry>
49201    <varlistentry>      <term>match</term>
49202      <listitem><para>
49203   called after comparing device's id with handler's id_table
49204   to perform fine-grained matching between device and handler
49205      </para></listitem>
49206    </varlistentry>
49207    <varlistentry>      <term>connect</term>
49208      <listitem><para>
49209   called when attaching a handler to an input device
49210      </para></listitem>
49211    </varlistentry>
49212    <varlistentry>      <term>disconnect</term>
49213      <listitem><para>
49214   disconnects a handler from input device
49215      </para></listitem>
49216    </varlistentry>
49217    <varlistentry>      <term>start</term>
49218      <listitem><para>
49219   starts handler for given handle. This function is called by
49220   input core right after <function>connect</function> method and also when a process
49221   that <quote>grabbed</quote> a device releases it
49222      </para></listitem>
49223    </varlistentry>
49224    <varlistentry>      <term>legacy_minors</term>
49225      <listitem><para>
49226   set to <constant>true</constant> by drivers using legacy minor ranges
49227      </para></listitem>
49228    </varlistentry>
49229    <varlistentry>      <term>minor</term>
49230      <listitem><para>
49231   beginning of range of 32 legacy minors for devices this driver
49232   can provide
49233      </para></listitem>
49234    </varlistentry>
49235    <varlistentry>      <term>name</term>
49236      <listitem><para>
49237   name of the handler, to be shown in /proc/bus/input/handlers
49238      </para></listitem>
49239    </varlistentry>
49240    <varlistentry>      <term>id_table</term>
49241      <listitem><para>
49242   pointer to a table of input_device_ids this driver can
49243   handle
49244      </para></listitem>
49245    </varlistentry>
49246    <varlistentry>      <term>h_list</term>
49247      <listitem><para>
49248   list of input handles associated with the handler
49249      </para></listitem>
49250    </varlistentry>
49251    <varlistentry>      <term>node</term>
49252      <listitem><para>
49253   for placing the driver onto input_handler_list
49254      </para></listitem>
49255    </varlistentry>
49256  </variablelist>
49257 </refsect1>
49258<refsect1>
49259<title>Description</title>
49260<para>
49261   Input handlers attach to input devices and create input handles. There
49262   are likely several handlers attached to any given input device at the
49263   same time. All of them will get their copy of input event generated by
49264   the device.
49265   </para><para>
49266
49267   The very same structure is used to implement input filters. Input core
49268   allows filters to run first and will not pass event to regular handlers
49269   if any of the filters indicate that the event should be filtered (by
49270   returning <constant>true</constant> from their <function>filter</function> method).
49271   </para><para>
49272
49273   Note that input core serializes calls to <function>connect</function> and <function>disconnect</function>
49274   methods.
49275</para>
49276</refsect1>
49277</refentry>
49278
49279<refentry id="API-struct-input-handle">
49280<refentryinfo>
49281 <title>LINUX</title>
49282 <productname>Kernel Hackers Manual</productname>
49283 <date>July 2017</date>
49284</refentryinfo>
49285<refmeta>
49286 <refentrytitle><phrase>struct input_handle</phrase></refentrytitle>
49287 <manvolnum>9</manvolnum>
49288 <refmiscinfo class="version">4.1.27</refmiscinfo>
49289</refmeta>
49290<refnamediv>
49291 <refname>struct input_handle</refname>
49292 <refpurpose>
49293     links input device with an input handler
49294 </refpurpose>
49295</refnamediv>
49296<refsynopsisdiv>
49297 <title>Synopsis</title>
49298  <programlisting>
49299struct input_handle {
49300  void * private;
49301  int open;
49302  const char * name;
49303  struct input_dev * dev;
49304  struct input_handler * handler;
49305  struct list_head d_node;
49306  struct list_head h_node;
49307};  </programlisting>
49308</refsynopsisdiv>
49309 <refsect1>
49310  <title>Members</title>
49311  <variablelist>
49312    <varlistentry>      <term>private</term>
49313      <listitem><para>
49314   handler-specific data
49315      </para></listitem>
49316    </varlistentry>
49317    <varlistentry>      <term>open</term>
49318      <listitem><para>
49319   counter showing whether the handle is 'open', i.e. should deliver
49320   events from its device
49321      </para></listitem>
49322    </varlistentry>
49323    <varlistentry>      <term>name</term>
49324      <listitem><para>
49325   name given to the handle by handler that created it
49326      </para></listitem>
49327    </varlistentry>
49328    <varlistentry>      <term>dev</term>
49329      <listitem><para>
49330   input device the handle is attached to
49331      </para></listitem>
49332    </varlistentry>
49333    <varlistentry>      <term>handler</term>
49334      <listitem><para>
49335   handler that works with the device through this handle
49336      </para></listitem>
49337    </varlistentry>
49338    <varlistentry>      <term>d_node</term>
49339      <listitem><para>
49340   used to put the handle on device's list of attached handles
49341      </para></listitem>
49342    </varlistentry>
49343    <varlistentry>      <term>h_node</term>
49344      <listitem><para>
49345   used to put the handle on handler's list of handles from which
49346   it gets events
49347      </para></listitem>
49348    </varlistentry>
49349  </variablelist>
49350 </refsect1>
49351</refentry>
49352
49353<refentry id="API-input-set-events-per-packet">
49354<refentryinfo>
49355 <title>LINUX</title>
49356 <productname>Kernel Hackers Manual</productname>
49357 <date>July 2017</date>
49358</refentryinfo>
49359<refmeta>
49360 <refentrytitle><phrase>input_set_events_per_packet</phrase></refentrytitle>
49361 <manvolnum>9</manvolnum>
49362 <refmiscinfo class="version">4.1.27</refmiscinfo>
49363</refmeta>
49364<refnamediv>
49365 <refname>input_set_events_per_packet</refname>
49366 <refpurpose>
49367     tell handlers about the driver event rate
49368 </refpurpose>
49369</refnamediv>
49370<refsynopsisdiv>
49371 <title>Synopsis</title>
49372  <funcsynopsis><funcprototype>
49373   <funcdef>void <function>input_set_events_per_packet </function></funcdef>
49374   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
49375   <paramdef>int <parameter>n_events</parameter></paramdef>
49376  </funcprototype></funcsynopsis>
49377</refsynopsisdiv>
49378<refsect1>
49379 <title>Arguments</title>
49380 <variablelist>
49381  <varlistentry>
49382   <term><parameter>dev</parameter></term>
49383   <listitem>
49384    <para>
49385     the input device used by the driver
49386    </para>
49387   </listitem>
49388  </varlistentry>
49389  <varlistentry>
49390   <term><parameter>n_events</parameter></term>
49391   <listitem>
49392    <para>
49393     the average number of events between calls to <function>input_sync</function>
49394    </para>
49395   </listitem>
49396  </varlistentry>
49397 </variablelist>
49398</refsect1>
49399<refsect1>
49400<title>Description</title>
49401<para>
49402   If the event rate sent from a device is unusually large, use this
49403   function to set the expected event rate. This will allow handlers
49404   to set up an appropriate buffer size for the event stream, in order
49405   to minimize information loss.
49406</para>
49407</refsect1>
49408</refentry>
49409
49410<refentry id="API-struct-ff-device">
49411<refentryinfo>
49412 <title>LINUX</title>
49413 <productname>Kernel Hackers Manual</productname>
49414 <date>July 2017</date>
49415</refentryinfo>
49416<refmeta>
49417 <refentrytitle><phrase>struct ff_device</phrase></refentrytitle>
49418 <manvolnum>9</manvolnum>
49419 <refmiscinfo class="version">4.1.27</refmiscinfo>
49420</refmeta>
49421<refnamediv>
49422 <refname>struct ff_device</refname>
49423 <refpurpose>
49424     force-feedback part of an input device
49425 </refpurpose>
49426</refnamediv>
49427<refsynopsisdiv>
49428 <title>Synopsis</title>
49429  <programlisting>
49430struct ff_device {
49431  int (* upload) (struct input_dev *dev, struct ff_effect *effect,struct ff_effect *old);
49432  int (* erase) (struct input_dev *dev, int effect_id);
49433  int (* playback) (struct input_dev *dev, int effect_id, int value);
49434  void (* set_gain) (struct input_dev *dev, u16 gain);
49435  void (* set_autocenter) (struct input_dev *dev, u16 magnitude);
49436  void (* destroy) (struct ff_device *);
49437  void * private;
49438  unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
49439  struct mutex mutex;
49440  int max_effects;
49441  struct ff_effect * effects;
49442  struct file * effect_owners[];
49443};  </programlisting>
49444</refsynopsisdiv>
49445 <refsect1>
49446  <title>Members</title>
49447  <variablelist>
49448    <varlistentry>      <term>upload</term>
49449      <listitem><para>
49450   Called to upload an new effect into device
49451      </para></listitem>
49452    </varlistentry>
49453    <varlistentry>      <term>erase</term>
49454      <listitem><para>
49455   Called to erase an effect from device
49456      </para></listitem>
49457    </varlistentry>
49458    <varlistentry>      <term>playback</term>
49459      <listitem><para>
49460   Called to request device to start playing specified effect
49461      </para></listitem>
49462    </varlistentry>
49463    <varlistentry>      <term>set_gain</term>
49464      <listitem><para>
49465   Called to set specified gain
49466      </para></listitem>
49467    </varlistentry>
49468    <varlistentry>      <term>set_autocenter</term>
49469      <listitem><para>
49470   Called to auto-center device
49471      </para></listitem>
49472    </varlistentry>
49473    <varlistentry>      <term>destroy</term>
49474      <listitem><para>
49475   called by input core when parent input device is being
49476   destroyed
49477      </para></listitem>
49478    </varlistentry>
49479    <varlistentry>      <term>private</term>
49480      <listitem><para>
49481   driver-specific data, will be freed automatically
49482      </para></listitem>
49483    </varlistentry>
49484    <varlistentry>      <term>ffbit[BITS_TO_LONGS(FF_CNT)]</term>
49485      <listitem><para>
49486   bitmap of force feedback capabilities truly supported by
49487   device (not emulated like ones in input_dev-&gt;ffbit)
49488      </para></listitem>
49489    </varlistentry>
49490    <varlistentry>      <term>mutex</term>
49491      <listitem><para>
49492   mutex for serializing access to the device
49493      </para></listitem>
49494    </varlistentry>
49495    <varlistentry>      <term>max_effects</term>
49496      <listitem><para>
49497   maximum number of effects supported by device
49498      </para></listitem>
49499    </varlistentry>
49500    <varlistentry>      <term>effects</term>
49501      <listitem><para>
49502   pointer to an array of effects currently loaded into device
49503      </para></listitem>
49504    </varlistentry>
49505    <varlistentry>      <term>effect_owners[]</term>
49506      <listitem><para>
49507   array of effect owners; when file handle owning
49508   an effect gets closed the effect is automatically erased
49509      </para></listitem>
49510    </varlistentry>
49511  </variablelist>
49512 </refsect1>
49513<refsect1>
49514<title>Description</title>
49515<para>
49516   Every force-feedback device must implement <function>upload</function> and <function>playback</function>
49517   methods; <function>erase</function> is optional. <function>set_gain</function> and <function>set_autocenter</function> need
49518   only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
49519   bits.
49520   </para><para>
49521
49522   Note that <function>playback</function>, <function>set_gain</function> and <function>set_autocenter</function> are called with
49523   dev-&gt;event_lock spinlock held and interrupts off and thus may not
49524   sleep.
49525</para>
49526</refsect1>
49527</refentry>
49528
49529<!-- drivers/input/input.c -->
49530<refentry id="API-input-event">
49531<refentryinfo>
49532 <title>LINUX</title>
49533 <productname>Kernel Hackers Manual</productname>
49534 <date>July 2017</date>
49535</refentryinfo>
49536<refmeta>
49537 <refentrytitle><phrase>input_event</phrase></refentrytitle>
49538 <manvolnum>9</manvolnum>
49539 <refmiscinfo class="version">4.1.27</refmiscinfo>
49540</refmeta>
49541<refnamediv>
49542 <refname>input_event</refname>
49543 <refpurpose>
49544  report new input event
49545 </refpurpose>
49546</refnamediv>
49547<refsynopsisdiv>
49548 <title>Synopsis</title>
49549  <funcsynopsis><funcprototype>
49550   <funcdef>void <function>input_event </function></funcdef>
49551   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
49552   <paramdef>unsigned int <parameter>type</parameter></paramdef>
49553   <paramdef>unsigned int <parameter>code</parameter></paramdef>
49554   <paramdef>int <parameter>value</parameter></paramdef>
49555  </funcprototype></funcsynopsis>
49556</refsynopsisdiv>
49557<refsect1>
49558 <title>Arguments</title>
49559 <variablelist>
49560  <varlistentry>
49561   <term><parameter>dev</parameter></term>
49562   <listitem>
49563    <para>
49564     device that generated the event
49565    </para>
49566   </listitem>
49567  </varlistentry>
49568  <varlistentry>
49569   <term><parameter>type</parameter></term>
49570   <listitem>
49571    <para>
49572     type of the event
49573    </para>
49574   </listitem>
49575  </varlistentry>
49576  <varlistentry>
49577   <term><parameter>code</parameter></term>
49578   <listitem>
49579    <para>
49580     event code
49581    </para>
49582   </listitem>
49583  </varlistentry>
49584  <varlistentry>
49585   <term><parameter>value</parameter></term>
49586   <listitem>
49587    <para>
49588     value of the event
49589    </para>
49590   </listitem>
49591  </varlistentry>
49592 </variablelist>
49593</refsect1>
49594<refsect1>
49595<title>Description</title>
49596<para>
49597   This function should be used by drivers implementing various input
49598   devices to report input events. See also <function>input_inject_event</function>.
49599</para>
49600</refsect1>
49601<refsect1>
49602<title>NOTE</title>
49603<para>
49604   <function>input_event</function> may be safely used right after input device was
49605   allocated with <function>input_allocate_device</function>, even before it is registered
49606   with <function>input_register_device</function>, but the event will not reach any of the
49607   input handlers. Such early invocation of <function>input_event</function> may be used
49608   to 'seed' initial state of a switch or initial position of absolute
49609   axis, etc.
49610</para>
49611</refsect1>
49612</refentry>
49613
49614<refentry id="API-input-inject-event">
49615<refentryinfo>
49616 <title>LINUX</title>
49617 <productname>Kernel Hackers Manual</productname>
49618 <date>July 2017</date>
49619</refentryinfo>
49620<refmeta>
49621 <refentrytitle><phrase>input_inject_event</phrase></refentrytitle>
49622 <manvolnum>9</manvolnum>
49623 <refmiscinfo class="version">4.1.27</refmiscinfo>
49624</refmeta>
49625<refnamediv>
49626 <refname>input_inject_event</refname>
49627 <refpurpose>
49628     send input event from input handler
49629 </refpurpose>
49630</refnamediv>
49631<refsynopsisdiv>
49632 <title>Synopsis</title>
49633  <funcsynopsis><funcprototype>
49634   <funcdef>void <function>input_inject_event </function></funcdef>
49635   <paramdef>struct input_handle * <parameter>handle</parameter></paramdef>
49636   <paramdef>unsigned int <parameter>type</parameter></paramdef>
49637   <paramdef>unsigned int <parameter>code</parameter></paramdef>
49638   <paramdef>int <parameter>value</parameter></paramdef>
49639  </funcprototype></funcsynopsis>
49640</refsynopsisdiv>
49641<refsect1>
49642 <title>Arguments</title>
49643 <variablelist>
49644  <varlistentry>
49645   <term><parameter>handle</parameter></term>
49646   <listitem>
49647    <para>
49648     input handle to send event through
49649    </para>
49650   </listitem>
49651  </varlistentry>
49652  <varlistentry>
49653   <term><parameter>type</parameter></term>
49654   <listitem>
49655    <para>
49656     type of the event
49657    </para>
49658   </listitem>
49659  </varlistentry>
49660  <varlistentry>
49661   <term><parameter>code</parameter></term>
49662   <listitem>
49663    <para>
49664     event code
49665    </para>
49666   </listitem>
49667  </varlistentry>
49668  <varlistentry>
49669   <term><parameter>value</parameter></term>
49670   <listitem>
49671    <para>
49672     value of the event
49673    </para>
49674   </listitem>
49675  </varlistentry>
49676 </variablelist>
49677</refsect1>
49678<refsect1>
49679<title>Description</title>
49680<para>
49681   Similar to <function>input_event</function> but will ignore event if device is
49682   <quote>grabbed</quote> and handle injecting event is not the one that owns
49683   the device.
49684</para>
49685</refsect1>
49686</refentry>
49687
49688<refentry id="API-input-alloc-absinfo">
49689<refentryinfo>
49690 <title>LINUX</title>
49691 <productname>Kernel Hackers Manual</productname>
49692 <date>July 2017</date>
49693</refentryinfo>
49694<refmeta>
49695 <refentrytitle><phrase>input_alloc_absinfo</phrase></refentrytitle>
49696 <manvolnum>9</manvolnum>
49697 <refmiscinfo class="version">4.1.27</refmiscinfo>
49698</refmeta>
49699<refnamediv>
49700 <refname>input_alloc_absinfo</refname>
49701 <refpurpose>
49702     allocates array of input_absinfo structs
49703 </refpurpose>
49704</refnamediv>
49705<refsynopsisdiv>
49706 <title>Synopsis</title>
49707  <funcsynopsis><funcprototype>
49708   <funcdef>void <function>input_alloc_absinfo </function></funcdef>
49709   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
49710  </funcprototype></funcsynopsis>
49711</refsynopsisdiv>
49712<refsect1>
49713 <title>Arguments</title>
49714 <variablelist>
49715  <varlistentry>
49716   <term><parameter>dev</parameter></term>
49717   <listitem>
49718    <para>
49719     the input device emitting absolute events
49720    </para>
49721   </listitem>
49722  </varlistentry>
49723 </variablelist>
49724</refsect1>
49725<refsect1>
49726<title>Description</title>
49727<para>
49728   If the absinfo struct the caller asked for is already allocated, this
49729   functions will not do anything.
49730</para>
49731</refsect1>
49732</refentry>
49733
49734<refentry id="API-input-grab-device">
49735<refentryinfo>
49736 <title>LINUX</title>
49737 <productname>Kernel Hackers Manual</productname>
49738 <date>July 2017</date>
49739</refentryinfo>
49740<refmeta>
49741 <refentrytitle><phrase>input_grab_device</phrase></refentrytitle>
49742 <manvolnum>9</manvolnum>
49743 <refmiscinfo class="version">4.1.27</refmiscinfo>
49744</refmeta>
49745<refnamediv>
49746 <refname>input_grab_device</refname>
49747 <refpurpose>
49748     grabs device for exclusive use
49749 </refpurpose>
49750</refnamediv>
49751<refsynopsisdiv>
49752 <title>Synopsis</title>
49753  <funcsynopsis><funcprototype>
49754   <funcdef>int <function>input_grab_device </function></funcdef>
49755   <paramdef>struct input_handle * <parameter>handle</parameter></paramdef>
49756  </funcprototype></funcsynopsis>
49757</refsynopsisdiv>
49758<refsect1>
49759 <title>Arguments</title>
49760 <variablelist>
49761  <varlistentry>
49762   <term><parameter>handle</parameter></term>
49763   <listitem>
49764    <para>
49765     input handle that wants to own the device
49766    </para>
49767   </listitem>
49768  </varlistentry>
49769 </variablelist>
49770</refsect1>
49771<refsect1>
49772<title>Description</title>
49773<para>
49774   When a device is grabbed by an input handle all events generated by
49775   the device are delivered only to this handle. Also events injected
49776   by other input handles are ignored while device is grabbed.
49777</para>
49778</refsect1>
49779</refentry>
49780
49781<refentry id="API-input-release-device">
49782<refentryinfo>
49783 <title>LINUX</title>
49784 <productname>Kernel Hackers Manual</productname>
49785 <date>July 2017</date>
49786</refentryinfo>
49787<refmeta>
49788 <refentrytitle><phrase>input_release_device</phrase></refentrytitle>
49789 <manvolnum>9</manvolnum>
49790 <refmiscinfo class="version">4.1.27</refmiscinfo>
49791</refmeta>
49792<refnamediv>
49793 <refname>input_release_device</refname>
49794 <refpurpose>
49795     release previously grabbed device
49796 </refpurpose>
49797</refnamediv>
49798<refsynopsisdiv>
49799 <title>Synopsis</title>
49800  <funcsynopsis><funcprototype>
49801   <funcdef>void <function>input_release_device </function></funcdef>
49802   <paramdef>struct input_handle * <parameter>handle</parameter></paramdef>
49803  </funcprototype></funcsynopsis>
49804</refsynopsisdiv>
49805<refsect1>
49806 <title>Arguments</title>
49807 <variablelist>
49808  <varlistentry>
49809   <term><parameter>handle</parameter></term>
49810   <listitem>
49811    <para>
49812     input handle that owns the device
49813    </para>
49814   </listitem>
49815  </varlistentry>
49816 </variablelist>
49817</refsect1>
49818<refsect1>
49819<title>Description</title>
49820<para>
49821   Releases previously grabbed device so that other input handles can
49822   start receiving input events. Upon release all handlers attached
49823   to the device have their <function>start</function> method called so they have a change
49824   to synchronize device state with the rest of the system.
49825</para>
49826</refsect1>
49827</refentry>
49828
49829<refentry id="API-input-open-device">
49830<refentryinfo>
49831 <title>LINUX</title>
49832 <productname>Kernel Hackers Manual</productname>
49833 <date>July 2017</date>
49834</refentryinfo>
49835<refmeta>
49836 <refentrytitle><phrase>input_open_device</phrase></refentrytitle>
49837 <manvolnum>9</manvolnum>
49838 <refmiscinfo class="version">4.1.27</refmiscinfo>
49839</refmeta>
49840<refnamediv>
49841 <refname>input_open_device</refname>
49842 <refpurpose>
49843     open input device
49844 </refpurpose>
49845</refnamediv>
49846<refsynopsisdiv>
49847 <title>Synopsis</title>
49848  <funcsynopsis><funcprototype>
49849   <funcdef>int <function>input_open_device </function></funcdef>
49850   <paramdef>struct input_handle * <parameter>handle</parameter></paramdef>
49851  </funcprototype></funcsynopsis>
49852</refsynopsisdiv>
49853<refsect1>
49854 <title>Arguments</title>
49855 <variablelist>
49856  <varlistentry>
49857   <term><parameter>handle</parameter></term>
49858   <listitem>
49859    <para>
49860     handle through which device is being accessed
49861    </para>
49862   </listitem>
49863  </varlistentry>
49864 </variablelist>
49865</refsect1>
49866<refsect1>
49867<title>Description</title>
49868<para>
49869   This function should be called by input handlers when they
49870   want to start receive events from given input device.
49871</para>
49872</refsect1>
49873</refentry>
49874
49875<refentry id="API-input-close-device">
49876<refentryinfo>
49877 <title>LINUX</title>
49878 <productname>Kernel Hackers Manual</productname>
49879 <date>July 2017</date>
49880</refentryinfo>
49881<refmeta>
49882 <refentrytitle><phrase>input_close_device</phrase></refentrytitle>
49883 <manvolnum>9</manvolnum>
49884 <refmiscinfo class="version">4.1.27</refmiscinfo>
49885</refmeta>
49886<refnamediv>
49887 <refname>input_close_device</refname>
49888 <refpurpose>
49889     close input device
49890 </refpurpose>
49891</refnamediv>
49892<refsynopsisdiv>
49893 <title>Synopsis</title>
49894  <funcsynopsis><funcprototype>
49895   <funcdef>void <function>input_close_device </function></funcdef>
49896   <paramdef>struct input_handle * <parameter>handle</parameter></paramdef>
49897  </funcprototype></funcsynopsis>
49898</refsynopsisdiv>
49899<refsect1>
49900 <title>Arguments</title>
49901 <variablelist>
49902  <varlistentry>
49903   <term><parameter>handle</parameter></term>
49904   <listitem>
49905    <para>
49906     handle through which device is being accessed
49907    </para>
49908   </listitem>
49909  </varlistentry>
49910 </variablelist>
49911</refsect1>
49912<refsect1>
49913<title>Description</title>
49914<para>
49915   This function should be called by input handlers when they
49916   want to stop receive events from given input device.
49917</para>
49918</refsect1>
49919</refentry>
49920
49921<refentry id="API-input-scancode-to-scalar">
49922<refentryinfo>
49923 <title>LINUX</title>
49924 <productname>Kernel Hackers Manual</productname>
49925 <date>July 2017</date>
49926</refentryinfo>
49927<refmeta>
49928 <refentrytitle><phrase>input_scancode_to_scalar</phrase></refentrytitle>
49929 <manvolnum>9</manvolnum>
49930 <refmiscinfo class="version">4.1.27</refmiscinfo>
49931</refmeta>
49932<refnamediv>
49933 <refname>input_scancode_to_scalar</refname>
49934 <refpurpose>
49935     converts scancode in <structname>struct input_keymap_entry</structname>
49936 </refpurpose>
49937</refnamediv>
49938<refsynopsisdiv>
49939 <title>Synopsis</title>
49940  <funcsynopsis><funcprototype>
49941   <funcdef>int <function>input_scancode_to_scalar </function></funcdef>
49942   <paramdef>const struct input_keymap_entry * <parameter>ke</parameter></paramdef>
49943   <paramdef>unsigned int * <parameter>scancode</parameter></paramdef>
49944  </funcprototype></funcsynopsis>
49945</refsynopsisdiv>
49946<refsect1>
49947 <title>Arguments</title>
49948 <variablelist>
49949  <varlistentry>
49950   <term><parameter>ke</parameter></term>
49951   <listitem>
49952    <para>
49953     keymap entry containing scancode to be converted.
49954    </para>
49955   </listitem>
49956  </varlistentry>
49957  <varlistentry>
49958   <term><parameter>scancode</parameter></term>
49959   <listitem>
49960    <para>
49961     pointer to the location where converted scancode should
49962     be stored.
49963    </para>
49964   </listitem>
49965  </varlistentry>
49966 </variablelist>
49967</refsect1>
49968<refsect1>
49969<title>Description</title>
49970<para>
49971   This function is used to convert scancode stored in <structname>struct keymap_entry</structname>
49972   into scalar form understood by legacy keymap handling methods. These
49973   methods expect scancodes to be represented as 'unsigned int'.
49974</para>
49975</refsect1>
49976</refentry>
49977
49978<refentry id="API-input-get-keycode">
49979<refentryinfo>
49980 <title>LINUX</title>
49981 <productname>Kernel Hackers Manual</productname>
49982 <date>July 2017</date>
49983</refentryinfo>
49984<refmeta>
49985 <refentrytitle><phrase>input_get_keycode</phrase></refentrytitle>
49986 <manvolnum>9</manvolnum>
49987 <refmiscinfo class="version">4.1.27</refmiscinfo>
49988</refmeta>
49989<refnamediv>
49990 <refname>input_get_keycode</refname>
49991 <refpurpose>
49992     retrieve keycode currently mapped to a given scancode
49993 </refpurpose>
49994</refnamediv>
49995<refsynopsisdiv>
49996 <title>Synopsis</title>
49997  <funcsynopsis><funcprototype>
49998   <funcdef>int <function>input_get_keycode </function></funcdef>
49999   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50000   <paramdef>struct input_keymap_entry * <parameter>ke</parameter></paramdef>
50001  </funcprototype></funcsynopsis>
50002</refsynopsisdiv>
50003<refsect1>
50004 <title>Arguments</title>
50005 <variablelist>
50006  <varlistentry>
50007   <term><parameter>dev</parameter></term>
50008   <listitem>
50009    <para>
50010     input device which keymap is being queried
50011    </para>
50012   </listitem>
50013  </varlistentry>
50014  <varlistentry>
50015   <term><parameter>ke</parameter></term>
50016   <listitem>
50017    <para>
50018     keymap entry
50019    </para>
50020   </listitem>
50021  </varlistentry>
50022 </variablelist>
50023</refsect1>
50024<refsect1>
50025<title>Description</title>
50026<para>
50027   This function should be called by anyone interested in retrieving current
50028   keymap. Presently evdev handlers use it.
50029</para>
50030</refsect1>
50031</refentry>
50032
50033<refentry id="API-input-set-keycode">
50034<refentryinfo>
50035 <title>LINUX</title>
50036 <productname>Kernel Hackers Manual</productname>
50037 <date>July 2017</date>
50038</refentryinfo>
50039<refmeta>
50040 <refentrytitle><phrase>input_set_keycode</phrase></refentrytitle>
50041 <manvolnum>9</manvolnum>
50042 <refmiscinfo class="version">4.1.27</refmiscinfo>
50043</refmeta>
50044<refnamediv>
50045 <refname>input_set_keycode</refname>
50046 <refpurpose>
50047     attribute a keycode to a given scancode
50048 </refpurpose>
50049</refnamediv>
50050<refsynopsisdiv>
50051 <title>Synopsis</title>
50052  <funcsynopsis><funcprototype>
50053   <funcdef>int <function>input_set_keycode </function></funcdef>
50054   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50055   <paramdef>const struct input_keymap_entry * <parameter>ke</parameter></paramdef>
50056  </funcprototype></funcsynopsis>
50057</refsynopsisdiv>
50058<refsect1>
50059 <title>Arguments</title>
50060 <variablelist>
50061  <varlistentry>
50062   <term><parameter>dev</parameter></term>
50063   <listitem>
50064    <para>
50065     input device which keymap is being updated
50066    </para>
50067   </listitem>
50068  </varlistentry>
50069  <varlistentry>
50070   <term><parameter>ke</parameter></term>
50071   <listitem>
50072    <para>
50073     new keymap entry
50074    </para>
50075   </listitem>
50076  </varlistentry>
50077 </variablelist>
50078</refsect1>
50079<refsect1>
50080<title>Description</title>
50081<para>
50082   This function should be called by anyone needing to update current
50083   keymap. Presently keyboard and evdev handlers use it.
50084</para>
50085</refsect1>
50086</refentry>
50087
50088<refentry id="API-input-reset-device">
50089<refentryinfo>
50090 <title>LINUX</title>
50091 <productname>Kernel Hackers Manual</productname>
50092 <date>July 2017</date>
50093</refentryinfo>
50094<refmeta>
50095 <refentrytitle><phrase>input_reset_device</phrase></refentrytitle>
50096 <manvolnum>9</manvolnum>
50097 <refmiscinfo class="version">4.1.27</refmiscinfo>
50098</refmeta>
50099<refnamediv>
50100 <refname>input_reset_device</refname>
50101 <refpurpose>
50102     reset/restore the state of input device
50103 </refpurpose>
50104</refnamediv>
50105<refsynopsisdiv>
50106 <title>Synopsis</title>
50107  <funcsynopsis><funcprototype>
50108   <funcdef>void <function>input_reset_device </function></funcdef>
50109   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50110  </funcprototype></funcsynopsis>
50111</refsynopsisdiv>
50112<refsect1>
50113 <title>Arguments</title>
50114 <variablelist>
50115  <varlistentry>
50116   <term><parameter>dev</parameter></term>
50117   <listitem>
50118    <para>
50119     input device whose state needs to be reset
50120    </para>
50121   </listitem>
50122  </varlistentry>
50123 </variablelist>
50124</refsect1>
50125<refsect1>
50126<title>Description</title>
50127<para>
50128   This function tries to reset the state of an opened input device and
50129   bring internal state and state if the hardware in sync with each other.
50130   We mark all keys as released, restore LED state, repeat rate, etc.
50131</para>
50132</refsect1>
50133</refentry>
50134
50135<refentry id="API-input-allocate-device">
50136<refentryinfo>
50137 <title>LINUX</title>
50138 <productname>Kernel Hackers Manual</productname>
50139 <date>July 2017</date>
50140</refentryinfo>
50141<refmeta>
50142 <refentrytitle><phrase>input_allocate_device</phrase></refentrytitle>
50143 <manvolnum>9</manvolnum>
50144 <refmiscinfo class="version">4.1.27</refmiscinfo>
50145</refmeta>
50146<refnamediv>
50147 <refname>input_allocate_device</refname>
50148 <refpurpose>
50149     allocate memory for new input device
50150 </refpurpose>
50151</refnamediv>
50152<refsynopsisdiv>
50153 <title>Synopsis</title>
50154  <funcsynopsis><funcprototype>
50155   <funcdef>struct input_dev * <function>input_allocate_device </function></funcdef>
50156   <paramdef> <parameter>void</parameter></paramdef>
50157  </funcprototype></funcsynopsis>
50158</refsynopsisdiv>
50159<refsect1>
50160 <title>Arguments</title>
50161 <variablelist>
50162  <varlistentry>
50163   <term><parameter>void</parameter></term>
50164   <listitem>
50165    <para>
50166     no arguments
50167    </para>
50168   </listitem>
50169  </varlistentry>
50170 </variablelist>
50171</refsect1>
50172<refsect1>
50173<title>Description</title>
50174<para>
50175   </para><para>
50176
50177   Returns prepared struct input_dev or <constant>NULL</constant>.
50178</para>
50179</refsect1>
50180<refsect1>
50181<title>NOTE</title>
50182<para>
50183   Use <function>input_free_device</function> to free devices that have not been
50184   registered; <function>input_unregister_device</function> should be used for already
50185   registered devices.
50186</para>
50187</refsect1>
50188</refentry>
50189
50190<refentry id="API-devm-input-allocate-device">
50191<refentryinfo>
50192 <title>LINUX</title>
50193 <productname>Kernel Hackers Manual</productname>
50194 <date>July 2017</date>
50195</refentryinfo>
50196<refmeta>
50197 <refentrytitle><phrase>devm_input_allocate_device</phrase></refentrytitle>
50198 <manvolnum>9</manvolnum>
50199 <refmiscinfo class="version">4.1.27</refmiscinfo>
50200</refmeta>
50201<refnamediv>
50202 <refname>devm_input_allocate_device</refname>
50203 <refpurpose>
50204     allocate managed input device
50205 </refpurpose>
50206</refnamediv>
50207<refsynopsisdiv>
50208 <title>Synopsis</title>
50209  <funcsynopsis><funcprototype>
50210   <funcdef>struct input_dev * <function>devm_input_allocate_device </function></funcdef>
50211   <paramdef>struct device * <parameter>dev</parameter></paramdef>
50212  </funcprototype></funcsynopsis>
50213</refsynopsisdiv>
50214<refsect1>
50215 <title>Arguments</title>
50216 <variablelist>
50217  <varlistentry>
50218   <term><parameter>dev</parameter></term>
50219   <listitem>
50220    <para>
50221     device owning the input device being created
50222    </para>
50223   </listitem>
50224  </varlistentry>
50225 </variablelist>
50226</refsect1>
50227<refsect1>
50228<title>Description</title>
50229<para>
50230   Returns prepared struct input_dev or <constant>NULL</constant>.
50231   </para><para>
50232
50233   Managed input devices do not need to be explicitly unregistered or
50234   freed as it will be done automatically when owner device unbinds from
50235   its driver (or binding fails). Once managed input device is allocated,
50236   it is ready to be set up and registered in the same fashion as regular
50237   input device. There are no special devm_input_device_[un]<function>register</function>
50238   variants, regular ones work with both managed and unmanaged devices,
50239   should you need them. In most cases however, managed input device need
50240   not be explicitly unregistered or freed.
50241</para>
50242</refsect1>
50243<refsect1>
50244<title>NOTE</title>
50245<para>
50246   the owner device is set up as parent of input device and users
50247   should not override it.
50248</para>
50249</refsect1>
50250</refentry>
50251
50252<refentry id="API-input-free-device">
50253<refentryinfo>
50254 <title>LINUX</title>
50255 <productname>Kernel Hackers Manual</productname>
50256 <date>July 2017</date>
50257</refentryinfo>
50258<refmeta>
50259 <refentrytitle><phrase>input_free_device</phrase></refentrytitle>
50260 <manvolnum>9</manvolnum>
50261 <refmiscinfo class="version">4.1.27</refmiscinfo>
50262</refmeta>
50263<refnamediv>
50264 <refname>input_free_device</refname>
50265 <refpurpose>
50266     free memory occupied by input_dev structure
50267 </refpurpose>
50268</refnamediv>
50269<refsynopsisdiv>
50270 <title>Synopsis</title>
50271  <funcsynopsis><funcprototype>
50272   <funcdef>void <function>input_free_device </function></funcdef>
50273   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50274  </funcprototype></funcsynopsis>
50275</refsynopsisdiv>
50276<refsect1>
50277 <title>Arguments</title>
50278 <variablelist>
50279  <varlistentry>
50280   <term><parameter>dev</parameter></term>
50281   <listitem>
50282    <para>
50283     input device to free
50284    </para>
50285   </listitem>
50286  </varlistentry>
50287 </variablelist>
50288</refsect1>
50289<refsect1>
50290<title>Description</title>
50291<para>
50292   This function should only be used if <function>input_register_device</function>
50293   was not called yet or if it failed. Once device was registered
50294   use <function>input_unregister_device</function> and memory will be freed once last
50295   reference to the device is dropped.
50296   </para><para>
50297
50298   Device should be allocated by <function>input_allocate_device</function>.
50299</para>
50300</refsect1>
50301<refsect1>
50302<title>NOTE</title>
50303<para>
50304   If there are references to the input device then memory
50305   will not be freed until last reference is dropped.
50306</para>
50307</refsect1>
50308</refentry>
50309
50310<refentry id="API-input-set-capability">
50311<refentryinfo>
50312 <title>LINUX</title>
50313 <productname>Kernel Hackers Manual</productname>
50314 <date>July 2017</date>
50315</refentryinfo>
50316<refmeta>
50317 <refentrytitle><phrase>input_set_capability</phrase></refentrytitle>
50318 <manvolnum>9</manvolnum>
50319 <refmiscinfo class="version">4.1.27</refmiscinfo>
50320</refmeta>
50321<refnamediv>
50322 <refname>input_set_capability</refname>
50323 <refpurpose>
50324     mark device as capable of a certain event
50325 </refpurpose>
50326</refnamediv>
50327<refsynopsisdiv>
50328 <title>Synopsis</title>
50329  <funcsynopsis><funcprototype>
50330   <funcdef>void <function>input_set_capability </function></funcdef>
50331   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50332   <paramdef>unsigned int <parameter>type</parameter></paramdef>
50333   <paramdef>unsigned int <parameter>code</parameter></paramdef>
50334  </funcprototype></funcsynopsis>
50335</refsynopsisdiv>
50336<refsect1>
50337 <title>Arguments</title>
50338 <variablelist>
50339  <varlistentry>
50340   <term><parameter>dev</parameter></term>
50341   <listitem>
50342    <para>
50343     device that is capable of emitting or accepting event
50344    </para>
50345   </listitem>
50346  </varlistentry>
50347  <varlistentry>
50348   <term><parameter>type</parameter></term>
50349   <listitem>
50350    <para>
50351     type of the event (EV_KEY, EV_REL, etc...)
50352    </para>
50353   </listitem>
50354  </varlistentry>
50355  <varlistentry>
50356   <term><parameter>code</parameter></term>
50357   <listitem>
50358    <para>
50359     event code
50360    </para>
50361   </listitem>
50362  </varlistentry>
50363 </variablelist>
50364</refsect1>
50365<refsect1>
50366<title>Description</title>
50367<para>
50368   In addition to setting up corresponding bit in appropriate capability
50369   bitmap the function also adjusts dev-&gt;evbit.
50370</para>
50371</refsect1>
50372</refentry>
50373
50374<refentry id="API-input-register-device">
50375<refentryinfo>
50376 <title>LINUX</title>
50377 <productname>Kernel Hackers Manual</productname>
50378 <date>July 2017</date>
50379</refentryinfo>
50380<refmeta>
50381 <refentrytitle><phrase>input_register_device</phrase></refentrytitle>
50382 <manvolnum>9</manvolnum>
50383 <refmiscinfo class="version">4.1.27</refmiscinfo>
50384</refmeta>
50385<refnamediv>
50386 <refname>input_register_device</refname>
50387 <refpurpose>
50388     register device with input core
50389 </refpurpose>
50390</refnamediv>
50391<refsynopsisdiv>
50392 <title>Synopsis</title>
50393  <funcsynopsis><funcprototype>
50394   <funcdef>int <function>input_register_device </function></funcdef>
50395   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50396  </funcprototype></funcsynopsis>
50397</refsynopsisdiv>
50398<refsect1>
50399 <title>Arguments</title>
50400 <variablelist>
50401  <varlistentry>
50402   <term><parameter>dev</parameter></term>
50403   <listitem>
50404    <para>
50405     device to be registered
50406    </para>
50407   </listitem>
50408  </varlistentry>
50409 </variablelist>
50410</refsect1>
50411<refsect1>
50412<title>Description</title>
50413<para>
50414   This function registers device with input core. The device must be
50415   allocated with <function>input_allocate_device</function> and all it's capabilities
50416   set up before registering.
50417   If function fails the device must be freed with <function>input_free_device</function>.
50418   Once device has been successfully registered it can be unregistered
50419   with <function>input_unregister_device</function>; <function>input_free_device</function> should not be
50420   called in this case.
50421   </para><para>
50422
50423   Note that this function is also used to register managed input devices
50424   (ones allocated with <function>devm_input_allocate_device</function>). Such managed input
50425   devices need not be explicitly unregistered or freed, their tear down
50426   is controlled by the devres infrastructure. It is also worth noting
50427   that tear down of managed input devices is internally a 2-step process:
50428   registered managed input device is first unregistered, but stays in
50429   memory and can still handle <function>input_event</function> calls (although events will
50430   not be delivered anywhere). The freeing of managed input device will
50431   happen later, when devres stack is unwound to the point where device
50432   allocation was made.
50433</para>
50434</refsect1>
50435</refentry>
50436
50437<refentry id="API-input-unregister-device">
50438<refentryinfo>
50439 <title>LINUX</title>
50440 <productname>Kernel Hackers Manual</productname>
50441 <date>July 2017</date>
50442</refentryinfo>
50443<refmeta>
50444 <refentrytitle><phrase>input_unregister_device</phrase></refentrytitle>
50445 <manvolnum>9</manvolnum>
50446 <refmiscinfo class="version">4.1.27</refmiscinfo>
50447</refmeta>
50448<refnamediv>
50449 <refname>input_unregister_device</refname>
50450 <refpurpose>
50451     unregister previously registered device
50452 </refpurpose>
50453</refnamediv>
50454<refsynopsisdiv>
50455 <title>Synopsis</title>
50456  <funcsynopsis><funcprototype>
50457   <funcdef>void <function>input_unregister_device </function></funcdef>
50458   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50459  </funcprototype></funcsynopsis>
50460</refsynopsisdiv>
50461<refsect1>
50462 <title>Arguments</title>
50463 <variablelist>
50464  <varlistentry>
50465   <term><parameter>dev</parameter></term>
50466   <listitem>
50467    <para>
50468     device to be unregistered
50469    </para>
50470   </listitem>
50471  </varlistentry>
50472 </variablelist>
50473</refsect1>
50474<refsect1>
50475<title>Description</title>
50476<para>
50477   This function unregisters an input device. Once device is unregistered
50478   the caller should not try to access it as it may get freed at any moment.
50479</para>
50480</refsect1>
50481</refentry>
50482
50483<refentry id="API-input-register-handler">
50484<refentryinfo>
50485 <title>LINUX</title>
50486 <productname>Kernel Hackers Manual</productname>
50487 <date>July 2017</date>
50488</refentryinfo>
50489<refmeta>
50490 <refentrytitle><phrase>input_register_handler</phrase></refentrytitle>
50491 <manvolnum>9</manvolnum>
50492 <refmiscinfo class="version">4.1.27</refmiscinfo>
50493</refmeta>
50494<refnamediv>
50495 <refname>input_register_handler</refname>
50496 <refpurpose>
50497     register a new input handler
50498 </refpurpose>
50499</refnamediv>
50500<refsynopsisdiv>
50501 <title>Synopsis</title>
50502  <funcsynopsis><funcprototype>
50503   <funcdef>int <function>input_register_handler </function></funcdef>
50504   <paramdef>struct input_handler * <parameter>handler</parameter></paramdef>
50505  </funcprototype></funcsynopsis>
50506</refsynopsisdiv>
50507<refsect1>
50508 <title>Arguments</title>
50509 <variablelist>
50510  <varlistentry>
50511   <term><parameter>handler</parameter></term>
50512   <listitem>
50513    <para>
50514     handler to be registered
50515    </para>
50516   </listitem>
50517  </varlistentry>
50518 </variablelist>
50519</refsect1>
50520<refsect1>
50521<title>Description</title>
50522<para>
50523   This function registers a new input handler (interface) for input
50524   devices in the system and attaches it to all input devices that
50525   are compatible with the handler.
50526</para>
50527</refsect1>
50528</refentry>
50529
50530<refentry id="API-input-unregister-handler">
50531<refentryinfo>
50532 <title>LINUX</title>
50533 <productname>Kernel Hackers Manual</productname>
50534 <date>July 2017</date>
50535</refentryinfo>
50536<refmeta>
50537 <refentrytitle><phrase>input_unregister_handler</phrase></refentrytitle>
50538 <manvolnum>9</manvolnum>
50539 <refmiscinfo class="version">4.1.27</refmiscinfo>
50540</refmeta>
50541<refnamediv>
50542 <refname>input_unregister_handler</refname>
50543 <refpurpose>
50544     unregisters an input handler
50545 </refpurpose>
50546</refnamediv>
50547<refsynopsisdiv>
50548 <title>Synopsis</title>
50549  <funcsynopsis><funcprototype>
50550   <funcdef>void <function>input_unregister_handler </function></funcdef>
50551   <paramdef>struct input_handler * <parameter>handler</parameter></paramdef>
50552  </funcprototype></funcsynopsis>
50553</refsynopsisdiv>
50554<refsect1>
50555 <title>Arguments</title>
50556 <variablelist>
50557  <varlistentry>
50558   <term><parameter>handler</parameter></term>
50559   <listitem>
50560    <para>
50561     handler to be unregistered
50562    </para>
50563   </listitem>
50564  </varlistentry>
50565 </variablelist>
50566</refsect1>
50567<refsect1>
50568<title>Description</title>
50569<para>
50570   This function disconnects a handler from its input devices and
50571   removes it from lists of known handlers.
50572</para>
50573</refsect1>
50574</refentry>
50575
50576<refentry id="API-input-handler-for-each-handle">
50577<refentryinfo>
50578 <title>LINUX</title>
50579 <productname>Kernel Hackers Manual</productname>
50580 <date>July 2017</date>
50581</refentryinfo>
50582<refmeta>
50583 <refentrytitle><phrase>input_handler_for_each_handle</phrase></refentrytitle>
50584 <manvolnum>9</manvolnum>
50585 <refmiscinfo class="version">4.1.27</refmiscinfo>
50586</refmeta>
50587<refnamediv>
50588 <refname>input_handler_for_each_handle</refname>
50589 <refpurpose>
50590     handle iterator
50591 </refpurpose>
50592</refnamediv>
50593<refsynopsisdiv>
50594 <title>Synopsis</title>
50595  <funcsynopsis><funcprototype>
50596   <funcdef>int <function>input_handler_for_each_handle </function></funcdef>
50597   <paramdef>struct input_handler * <parameter>handler</parameter></paramdef>
50598   <paramdef>void * <parameter>data</parameter></paramdef>
50599   <paramdef>int (*<parameter>fn</parameter>)
50600     <funcparams>struct input_handle *, void *</funcparams></paramdef>
50601  </funcprototype></funcsynopsis>
50602</refsynopsisdiv>
50603<refsect1>
50604 <title>Arguments</title>
50605 <variablelist>
50606  <varlistentry>
50607   <term><parameter>handler</parameter></term>
50608   <listitem>
50609    <para>
50610     input handler to iterate
50611    </para>
50612   </listitem>
50613  </varlistentry>
50614  <varlistentry>
50615   <term><parameter>data</parameter></term>
50616   <listitem>
50617    <para>
50618     data for the callback
50619    </para>
50620   </listitem>
50621  </varlistentry>
50622  <varlistentry>
50623   <term><parameter>fn</parameter></term>
50624   <listitem>
50625    <para>
50626     function to be called for each handle
50627    </para>
50628   </listitem>
50629  </varlistentry>
50630 </variablelist>
50631</refsect1>
50632<refsect1>
50633<title>Description</title>
50634<para>
50635   Iterate over <parameter>bus</parameter>'s list of devices, and call <parameter>fn</parameter> for each, passing
50636   it <parameter>data</parameter> and stop when <parameter>fn</parameter> returns a non-zero value. The function is
50637   using RCU to traverse the list and therefore may be usind in atonic
50638   contexts. The <parameter>fn</parameter> callback is invoked from RCU critical section and
50639   thus must not sleep.
50640</para>
50641</refsect1>
50642</refentry>
50643
50644<refentry id="API-input-register-handle">
50645<refentryinfo>
50646 <title>LINUX</title>
50647 <productname>Kernel Hackers Manual</productname>
50648 <date>July 2017</date>
50649</refentryinfo>
50650<refmeta>
50651 <refentrytitle><phrase>input_register_handle</phrase></refentrytitle>
50652 <manvolnum>9</manvolnum>
50653 <refmiscinfo class="version">4.1.27</refmiscinfo>
50654</refmeta>
50655<refnamediv>
50656 <refname>input_register_handle</refname>
50657 <refpurpose>
50658     register a new input handle
50659 </refpurpose>
50660</refnamediv>
50661<refsynopsisdiv>
50662 <title>Synopsis</title>
50663  <funcsynopsis><funcprototype>
50664   <funcdef>int <function>input_register_handle </function></funcdef>
50665   <paramdef>struct input_handle * <parameter>handle</parameter></paramdef>
50666  </funcprototype></funcsynopsis>
50667</refsynopsisdiv>
50668<refsect1>
50669 <title>Arguments</title>
50670 <variablelist>
50671  <varlistentry>
50672   <term><parameter>handle</parameter></term>
50673   <listitem>
50674    <para>
50675     handle to register
50676    </para>
50677   </listitem>
50678  </varlistentry>
50679 </variablelist>
50680</refsect1>
50681<refsect1>
50682<title>Description</title>
50683<para>
50684   This function puts a new input handle onto device's
50685   and handler's lists so that events can flow through
50686   it once it is opened using <function>input_open_device</function>.
50687   </para><para>
50688
50689   This function is supposed to be called from handler's
50690   <function>connect</function> method.
50691</para>
50692</refsect1>
50693</refentry>
50694
50695<refentry id="API-input-unregister-handle">
50696<refentryinfo>
50697 <title>LINUX</title>
50698 <productname>Kernel Hackers Manual</productname>
50699 <date>July 2017</date>
50700</refentryinfo>
50701<refmeta>
50702 <refentrytitle><phrase>input_unregister_handle</phrase></refentrytitle>
50703 <manvolnum>9</manvolnum>
50704 <refmiscinfo class="version">4.1.27</refmiscinfo>
50705</refmeta>
50706<refnamediv>
50707 <refname>input_unregister_handle</refname>
50708 <refpurpose>
50709     unregister an input handle
50710 </refpurpose>
50711</refnamediv>
50712<refsynopsisdiv>
50713 <title>Synopsis</title>
50714  <funcsynopsis><funcprototype>
50715   <funcdef>void <function>input_unregister_handle </function></funcdef>
50716   <paramdef>struct input_handle * <parameter>handle</parameter></paramdef>
50717  </funcprototype></funcsynopsis>
50718</refsynopsisdiv>
50719<refsect1>
50720 <title>Arguments</title>
50721 <variablelist>
50722  <varlistentry>
50723   <term><parameter>handle</parameter></term>
50724   <listitem>
50725    <para>
50726     handle to unregister
50727    </para>
50728   </listitem>
50729  </varlistentry>
50730 </variablelist>
50731</refsect1>
50732<refsect1>
50733<title>Description</title>
50734<para>
50735   This function removes input handle from device's
50736   and handler's lists.
50737   </para><para>
50738
50739   This function is supposed to be called from handler's
50740   <function>disconnect</function> method.
50741</para>
50742</refsect1>
50743</refentry>
50744
50745<refentry id="API-input-get-new-minor">
50746<refentryinfo>
50747 <title>LINUX</title>
50748 <productname>Kernel Hackers Manual</productname>
50749 <date>July 2017</date>
50750</refentryinfo>
50751<refmeta>
50752 <refentrytitle><phrase>input_get_new_minor</phrase></refentrytitle>
50753 <manvolnum>9</manvolnum>
50754 <refmiscinfo class="version">4.1.27</refmiscinfo>
50755</refmeta>
50756<refnamediv>
50757 <refname>input_get_new_minor</refname>
50758 <refpurpose>
50759     allocates a new input minor number
50760 </refpurpose>
50761</refnamediv>
50762<refsynopsisdiv>
50763 <title>Synopsis</title>
50764  <funcsynopsis><funcprototype>
50765   <funcdef>int <function>input_get_new_minor </function></funcdef>
50766   <paramdef>int <parameter>legacy_base</parameter></paramdef>
50767   <paramdef>unsigned int <parameter>legacy_num</parameter></paramdef>
50768   <paramdef>bool <parameter>allow_dynamic</parameter></paramdef>
50769  </funcprototype></funcsynopsis>
50770</refsynopsisdiv>
50771<refsect1>
50772 <title>Arguments</title>
50773 <variablelist>
50774  <varlistentry>
50775   <term><parameter>legacy_base</parameter></term>
50776   <listitem>
50777    <para>
50778     beginning or the legacy range to be searched
50779    </para>
50780   </listitem>
50781  </varlistentry>
50782  <varlistentry>
50783   <term><parameter>legacy_num</parameter></term>
50784   <listitem>
50785    <para>
50786     size of legacy range
50787    </para>
50788   </listitem>
50789  </varlistentry>
50790  <varlistentry>
50791   <term><parameter>allow_dynamic</parameter></term>
50792   <listitem>
50793    <para>
50794     whether we can also take ID from the dynamic range
50795    </para>
50796   </listitem>
50797  </varlistentry>
50798 </variablelist>
50799</refsect1>
50800<refsect1>
50801<title>Description</title>
50802<para>
50803   This function allocates a new device minor for from input major namespace.
50804   Caller can request legacy minor by specifying <parameter>legacy_base</parameter> and <parameter>legacy_num</parameter>
50805   parameters and whether ID can be allocated from dynamic range if there are
50806   no free IDs in legacy range.
50807</para>
50808</refsect1>
50809</refentry>
50810
50811<refentry id="API-input-free-minor">
50812<refentryinfo>
50813 <title>LINUX</title>
50814 <productname>Kernel Hackers Manual</productname>
50815 <date>July 2017</date>
50816</refentryinfo>
50817<refmeta>
50818 <refentrytitle><phrase>input_free_minor</phrase></refentrytitle>
50819 <manvolnum>9</manvolnum>
50820 <refmiscinfo class="version">4.1.27</refmiscinfo>
50821</refmeta>
50822<refnamediv>
50823 <refname>input_free_minor</refname>
50824 <refpurpose>
50825     release previously allocated minor
50826 </refpurpose>
50827</refnamediv>
50828<refsynopsisdiv>
50829 <title>Synopsis</title>
50830  <funcsynopsis><funcprototype>
50831   <funcdef>void <function>input_free_minor </function></funcdef>
50832   <paramdef>unsigned int <parameter>minor</parameter></paramdef>
50833  </funcprototype></funcsynopsis>
50834</refsynopsisdiv>
50835<refsect1>
50836 <title>Arguments</title>
50837 <variablelist>
50838  <varlistentry>
50839   <term><parameter>minor</parameter></term>
50840   <listitem>
50841    <para>
50842     minor to be released
50843    </para>
50844   </listitem>
50845  </varlistentry>
50846 </variablelist>
50847</refsect1>
50848<refsect1>
50849<title>Description</title>
50850<para>
50851   This function releases previously allocated input minor so that it can be
50852   reused later.
50853</para>
50854</refsect1>
50855</refentry>
50856
50857<!-- drivers/input/ff-core.c -->
50858<refentry id="API-input-ff-upload">
50859<refentryinfo>
50860 <title>LINUX</title>
50861 <productname>Kernel Hackers Manual</productname>
50862 <date>July 2017</date>
50863</refentryinfo>
50864<refmeta>
50865 <refentrytitle><phrase>input_ff_upload</phrase></refentrytitle>
50866 <manvolnum>9</manvolnum>
50867 <refmiscinfo class="version">4.1.27</refmiscinfo>
50868</refmeta>
50869<refnamediv>
50870 <refname>input_ff_upload</refname>
50871 <refpurpose>
50872  upload effect into force-feedback device
50873 </refpurpose>
50874</refnamediv>
50875<refsynopsisdiv>
50876 <title>Synopsis</title>
50877  <funcsynopsis><funcprototype>
50878   <funcdef>int <function>input_ff_upload </function></funcdef>
50879   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50880   <paramdef>struct ff_effect * <parameter>effect</parameter></paramdef>
50881   <paramdef>struct file * <parameter>file</parameter></paramdef>
50882  </funcprototype></funcsynopsis>
50883</refsynopsisdiv>
50884<refsect1>
50885 <title>Arguments</title>
50886 <variablelist>
50887  <varlistentry>
50888   <term><parameter>dev</parameter></term>
50889   <listitem>
50890    <para>
50891     input device
50892    </para>
50893   </listitem>
50894  </varlistentry>
50895  <varlistentry>
50896   <term><parameter>effect</parameter></term>
50897   <listitem>
50898    <para>
50899     effect to be uploaded
50900    </para>
50901   </listitem>
50902  </varlistentry>
50903  <varlistentry>
50904   <term><parameter>file</parameter></term>
50905   <listitem>
50906    <para>
50907     owner of the effect
50908    </para>
50909   </listitem>
50910  </varlistentry>
50911 </variablelist>
50912</refsect1>
50913</refentry>
50914
50915<refentry id="API-input-ff-erase">
50916<refentryinfo>
50917 <title>LINUX</title>
50918 <productname>Kernel Hackers Manual</productname>
50919 <date>July 2017</date>
50920</refentryinfo>
50921<refmeta>
50922 <refentrytitle><phrase>input_ff_erase</phrase></refentrytitle>
50923 <manvolnum>9</manvolnum>
50924 <refmiscinfo class="version">4.1.27</refmiscinfo>
50925</refmeta>
50926<refnamediv>
50927 <refname>input_ff_erase</refname>
50928 <refpurpose>
50929     erase a force-feedback effect from device
50930 </refpurpose>
50931</refnamediv>
50932<refsynopsisdiv>
50933 <title>Synopsis</title>
50934  <funcsynopsis><funcprototype>
50935   <funcdef>int <function>input_ff_erase </function></funcdef>
50936   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
50937   <paramdef>int <parameter>effect_id</parameter></paramdef>
50938   <paramdef>struct file * <parameter>file</parameter></paramdef>
50939  </funcprototype></funcsynopsis>
50940</refsynopsisdiv>
50941<refsect1>
50942 <title>Arguments</title>
50943 <variablelist>
50944  <varlistentry>
50945   <term><parameter>dev</parameter></term>
50946   <listitem>
50947    <para>
50948     input device to erase effect from
50949    </para>
50950   </listitem>
50951  </varlistentry>
50952  <varlistentry>
50953   <term><parameter>effect_id</parameter></term>
50954   <listitem>
50955    <para>
50956     id of the ffect to be erased
50957    </para>
50958   </listitem>
50959  </varlistentry>
50960  <varlistentry>
50961   <term><parameter>file</parameter></term>
50962   <listitem>
50963    <para>
50964     purported owner of the request
50965    </para>
50966   </listitem>
50967  </varlistentry>
50968 </variablelist>
50969</refsect1>
50970<refsect1>
50971<title>Description</title>
50972<para>
50973   This function erases a force-feedback effect from specified device.
50974   The effect will only be erased if it was uploaded through the same
50975   file handle that is requesting erase.
50976</para>
50977</refsect1>
50978</refentry>
50979
50980<refentry id="API-input-ff-event">
50981<refentryinfo>
50982 <title>LINUX</title>
50983 <productname>Kernel Hackers Manual</productname>
50984 <date>July 2017</date>
50985</refentryinfo>
50986<refmeta>
50987 <refentrytitle><phrase>input_ff_event</phrase></refentrytitle>
50988 <manvolnum>9</manvolnum>
50989 <refmiscinfo class="version">4.1.27</refmiscinfo>
50990</refmeta>
50991<refnamediv>
50992 <refname>input_ff_event</refname>
50993 <refpurpose>
50994     generic handler for force-feedback events
50995 </refpurpose>
50996</refnamediv>
50997<refsynopsisdiv>
50998 <title>Synopsis</title>
50999  <funcsynopsis><funcprototype>
51000   <funcdef>int <function>input_ff_event </function></funcdef>
51001   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51002   <paramdef>unsigned int <parameter>type</parameter></paramdef>
51003   <paramdef>unsigned int <parameter>code</parameter></paramdef>
51004   <paramdef>int <parameter>value</parameter></paramdef>
51005  </funcprototype></funcsynopsis>
51006</refsynopsisdiv>
51007<refsect1>
51008 <title>Arguments</title>
51009 <variablelist>
51010  <varlistentry>
51011   <term><parameter>dev</parameter></term>
51012   <listitem>
51013    <para>
51014     input device to send the effect to
51015    </para>
51016   </listitem>
51017  </varlistentry>
51018  <varlistentry>
51019   <term><parameter>type</parameter></term>
51020   <listitem>
51021    <para>
51022     event type (anything but EV_FF is ignored)
51023    </para>
51024   </listitem>
51025  </varlistentry>
51026  <varlistentry>
51027   <term><parameter>code</parameter></term>
51028   <listitem>
51029    <para>
51030     event code
51031    </para>
51032   </listitem>
51033  </varlistentry>
51034  <varlistentry>
51035   <term><parameter>value</parameter></term>
51036   <listitem>
51037    <para>
51038     event value
51039    </para>
51040   </listitem>
51041  </varlistentry>
51042 </variablelist>
51043</refsect1>
51044</refentry>
51045
51046<refentry id="API-input-ff-create">
51047<refentryinfo>
51048 <title>LINUX</title>
51049 <productname>Kernel Hackers Manual</productname>
51050 <date>July 2017</date>
51051</refentryinfo>
51052<refmeta>
51053 <refentrytitle><phrase>input_ff_create</phrase></refentrytitle>
51054 <manvolnum>9</manvolnum>
51055 <refmiscinfo class="version">4.1.27</refmiscinfo>
51056</refmeta>
51057<refnamediv>
51058 <refname>input_ff_create</refname>
51059 <refpurpose>
51060     create force-feedback device
51061 </refpurpose>
51062</refnamediv>
51063<refsynopsisdiv>
51064 <title>Synopsis</title>
51065  <funcsynopsis><funcprototype>
51066   <funcdef>int <function>input_ff_create </function></funcdef>
51067   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51068   <paramdef>unsigned int <parameter>max_effects</parameter></paramdef>
51069  </funcprototype></funcsynopsis>
51070</refsynopsisdiv>
51071<refsect1>
51072 <title>Arguments</title>
51073 <variablelist>
51074  <varlistentry>
51075   <term><parameter>dev</parameter></term>
51076   <listitem>
51077    <para>
51078     input device supporting force-feedback
51079    </para>
51080   </listitem>
51081  </varlistentry>
51082  <varlistentry>
51083   <term><parameter>max_effects</parameter></term>
51084   <listitem>
51085    <para>
51086     maximum number of effects supported by the device
51087    </para>
51088   </listitem>
51089  </varlistentry>
51090 </variablelist>
51091</refsect1>
51092<refsect1>
51093<title>Description</title>
51094<para>
51095   This function allocates all necessary memory for a force feedback
51096   portion of an input device and installs all default handlers.
51097   <parameter>dev</parameter>-&gt;ffbit should be already set up before calling this function.
51098   Once ff device is created you need to setup its upload, erase,
51099   playback and other handlers before registering input device
51100</para>
51101</refsect1>
51102</refentry>
51103
51104<refentry id="API-input-ff-destroy">
51105<refentryinfo>
51106 <title>LINUX</title>
51107 <productname>Kernel Hackers Manual</productname>
51108 <date>July 2017</date>
51109</refentryinfo>
51110<refmeta>
51111 <refentrytitle><phrase>input_ff_destroy</phrase></refentrytitle>
51112 <manvolnum>9</manvolnum>
51113 <refmiscinfo class="version">4.1.27</refmiscinfo>
51114</refmeta>
51115<refnamediv>
51116 <refname>input_ff_destroy</refname>
51117 <refpurpose>
51118     frees force feedback portion of input device
51119 </refpurpose>
51120</refnamediv>
51121<refsynopsisdiv>
51122 <title>Synopsis</title>
51123  <funcsynopsis><funcprototype>
51124   <funcdef>void <function>input_ff_destroy </function></funcdef>
51125   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51126  </funcprototype></funcsynopsis>
51127</refsynopsisdiv>
51128<refsect1>
51129 <title>Arguments</title>
51130 <variablelist>
51131  <varlistentry>
51132   <term><parameter>dev</parameter></term>
51133   <listitem>
51134    <para>
51135     input device supporting force feedback
51136    </para>
51137   </listitem>
51138  </varlistentry>
51139 </variablelist>
51140</refsect1>
51141<refsect1>
51142<title>Description</title>
51143<para>
51144   This function is only needed in error path as input core will
51145   automatically free force feedback structures when device is
51146   destroyed.
51147</para>
51148</refsect1>
51149</refentry>
51150
51151<!-- drivers/input/ff-memless.c -->
51152<refentry id="API-input-ff-create-memless">
51153<refentryinfo>
51154 <title>LINUX</title>
51155 <productname>Kernel Hackers Manual</productname>
51156 <date>July 2017</date>
51157</refentryinfo>
51158<refmeta>
51159 <refentrytitle><phrase>input_ff_create_memless</phrase></refentrytitle>
51160 <manvolnum>9</manvolnum>
51161 <refmiscinfo class="version">4.1.27</refmiscinfo>
51162</refmeta>
51163<refnamediv>
51164 <refname>input_ff_create_memless</refname>
51165 <refpurpose>
51166  create memoryless force-feedback device
51167 </refpurpose>
51168</refnamediv>
51169<refsynopsisdiv>
51170 <title>Synopsis</title>
51171  <funcsynopsis><funcprototype>
51172   <funcdef>int <function>input_ff_create_memless </function></funcdef>
51173   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51174   <paramdef>void * <parameter>data</parameter></paramdef>
51175   <paramdef>int (*<parameter>play_effect</parameter>)
51176     <funcparams>struct input_dev *, void *, struct ff_effect *</funcparams></paramdef>
51177  </funcprototype></funcsynopsis>
51178</refsynopsisdiv>
51179<refsect1>
51180 <title>Arguments</title>
51181 <variablelist>
51182  <varlistentry>
51183   <term><parameter>dev</parameter></term>
51184   <listitem>
51185    <para>
51186     input device supporting force-feedback
51187    </para>
51188   </listitem>
51189  </varlistentry>
51190  <varlistentry>
51191   <term><parameter>data</parameter></term>
51192   <listitem>
51193    <para>
51194     driver-specific data to be passed into <parameter>play_effect</parameter>
51195    </para>
51196   </listitem>
51197  </varlistentry>
51198  <varlistentry>
51199   <term><parameter>play_effect</parameter></term>
51200   <listitem>
51201    <para>
51202     driver-specific method for playing FF effect
51203    </para>
51204   </listitem>
51205  </varlistentry>
51206 </variablelist>
51207</refsect1>
51208</refentry>
51209
51210     </sect1>
51211     <sect1><title>Multitouch Library</title>
51212<!-- include/linux/input/mt.h -->
51213<refentry id="API-struct-input-mt-slot">
51214<refentryinfo>
51215 <title>LINUX</title>
51216 <productname>Kernel Hackers Manual</productname>
51217 <date>July 2017</date>
51218</refentryinfo>
51219<refmeta>
51220 <refentrytitle><phrase>struct input_mt_slot</phrase></refentrytitle>
51221 <manvolnum>9</manvolnum>
51222 <refmiscinfo class="version">4.1.27</refmiscinfo>
51223</refmeta>
51224<refnamediv>
51225 <refname>struct input_mt_slot</refname>
51226 <refpurpose>
51227  represents the state of an input MT slot
51228 </refpurpose>
51229</refnamediv>
51230<refsynopsisdiv>
51231 <title>Synopsis</title>
51232  <programlisting>
51233struct input_mt_slot {
51234  int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
51235  unsigned int frame;
51236  unsigned int key;
51237};  </programlisting>
51238</refsynopsisdiv>
51239 <refsect1>
51240  <title>Members</title>
51241  <variablelist>
51242    <varlistentry>      <term>abs[ABS_MT_LAST - ABS_MT_FIRST + 1]</term>
51243      <listitem><para>
51244holds current values of ABS_MT axes for this slot
51245      </para></listitem>
51246    </varlistentry>
51247    <varlistentry>      <term>frame</term>
51248      <listitem><para>
51249last frame at which <function>input_mt_report_slot_state</function> was called
51250      </para></listitem>
51251    </varlistentry>
51252    <varlistentry>      <term>key</term>
51253      <listitem><para>
51254optional driver designation of this slot
51255      </para></listitem>
51256    </varlistentry>
51257  </variablelist>
51258 </refsect1>
51259</refentry>
51260
51261<refentry id="API-struct-input-mt">
51262<refentryinfo>
51263 <title>LINUX</title>
51264 <productname>Kernel Hackers Manual</productname>
51265 <date>July 2017</date>
51266</refentryinfo>
51267<refmeta>
51268 <refentrytitle><phrase>struct input_mt</phrase></refentrytitle>
51269 <manvolnum>9</manvolnum>
51270 <refmiscinfo class="version">4.1.27</refmiscinfo>
51271</refmeta>
51272<refnamediv>
51273 <refname>struct input_mt</refname>
51274 <refpurpose>
51275     state of tracked contacts
51276 </refpurpose>
51277</refnamediv>
51278<refsynopsisdiv>
51279 <title>Synopsis</title>
51280  <programlisting>
51281struct input_mt {
51282  int trkid;
51283  int num_slots;
51284  int slot;
51285  unsigned int flags;
51286  unsigned int frame;
51287  int * red;
51288  struct input_mt_slot slots[];
51289};  </programlisting>
51290</refsynopsisdiv>
51291 <refsect1>
51292  <title>Members</title>
51293  <variablelist>
51294    <varlistentry>      <term>trkid</term>
51295      <listitem><para>
51296   stores MT tracking ID for the next contact
51297      </para></listitem>
51298    </varlistentry>
51299    <varlistentry>      <term>num_slots</term>
51300      <listitem><para>
51301   number of MT slots the device uses
51302      </para></listitem>
51303    </varlistentry>
51304    <varlistentry>      <term>slot</term>
51305      <listitem><para>
51306   MT slot currently being transmitted
51307      </para></listitem>
51308    </varlistentry>
51309    <varlistentry>      <term>flags</term>
51310      <listitem><para>
51311   input_mt operation flags
51312      </para></listitem>
51313    </varlistentry>
51314    <varlistentry>      <term>frame</term>
51315      <listitem><para>
51316   increases every time <function>input_mt_sync_frame</function> is called
51317      </para></listitem>
51318    </varlistentry>
51319    <varlistentry>      <term>red</term>
51320      <listitem><para>
51321   reduced cost matrix for in-kernel tracking
51322      </para></listitem>
51323    </varlistentry>
51324    <varlistentry>      <term>slots[]</term>
51325      <listitem><para>
51326   array of slots holding current values of tracked contacts
51327      </para></listitem>
51328    </varlistentry>
51329  </variablelist>
51330 </refsect1>
51331</refentry>
51332
51333<refentry id="API-struct-input-mt-pos">
51334<refentryinfo>
51335 <title>LINUX</title>
51336 <productname>Kernel Hackers Manual</productname>
51337 <date>July 2017</date>
51338</refentryinfo>
51339<refmeta>
51340 <refentrytitle><phrase>struct input_mt_pos</phrase></refentrytitle>
51341 <manvolnum>9</manvolnum>
51342 <refmiscinfo class="version">4.1.27</refmiscinfo>
51343</refmeta>
51344<refnamediv>
51345 <refname>struct input_mt_pos</refname>
51346 <refpurpose>
51347     contact position
51348 </refpurpose>
51349</refnamediv>
51350<refsynopsisdiv>
51351 <title>Synopsis</title>
51352  <programlisting>
51353struct input_mt_pos {
51354  s16 x;
51355  s16 y;
51356};  </programlisting>
51357</refsynopsisdiv>
51358 <refsect1>
51359  <title>Members</title>
51360  <variablelist>
51361    <varlistentry>      <term>x</term>
51362      <listitem><para>
51363   horizontal coordinate
51364      </para></listitem>
51365    </varlistentry>
51366    <varlistentry>      <term>y</term>
51367      <listitem><para>
51368   vertical coordinate
51369      </para></listitem>
51370    </varlistentry>
51371  </variablelist>
51372 </refsect1>
51373</refentry>
51374
51375<!-- drivers/input/input-mt.c -->
51376<refentry id="API-input-mt-init-slots">
51377<refentryinfo>
51378 <title>LINUX</title>
51379 <productname>Kernel Hackers Manual</productname>
51380 <date>July 2017</date>
51381</refentryinfo>
51382<refmeta>
51383 <refentrytitle><phrase>input_mt_init_slots</phrase></refentrytitle>
51384 <manvolnum>9</manvolnum>
51385 <refmiscinfo class="version">4.1.27</refmiscinfo>
51386</refmeta>
51387<refnamediv>
51388 <refname>input_mt_init_slots</refname>
51389 <refpurpose>
51390  initialize MT input slots
51391 </refpurpose>
51392</refnamediv>
51393<refsynopsisdiv>
51394 <title>Synopsis</title>
51395  <funcsynopsis><funcprototype>
51396   <funcdef>int <function>input_mt_init_slots </function></funcdef>
51397   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51398   <paramdef>unsigned int <parameter>num_slots</parameter></paramdef>
51399   <paramdef>unsigned int <parameter>flags</parameter></paramdef>
51400  </funcprototype></funcsynopsis>
51401</refsynopsisdiv>
51402<refsect1>
51403 <title>Arguments</title>
51404 <variablelist>
51405  <varlistentry>
51406   <term><parameter>dev</parameter></term>
51407   <listitem>
51408    <para>
51409     input device supporting MT events and finger tracking
51410    </para>
51411   </listitem>
51412  </varlistentry>
51413  <varlistentry>
51414   <term><parameter>num_slots</parameter></term>
51415   <listitem>
51416    <para>
51417     number of slots used by the device
51418    </para>
51419   </listitem>
51420  </varlistentry>
51421  <varlistentry>
51422   <term><parameter>flags</parameter></term>
51423   <listitem>
51424    <para>
51425     mt tasks to handle in core
51426    </para>
51427   </listitem>
51428  </varlistentry>
51429 </variablelist>
51430</refsect1>
51431<refsect1>
51432<title>Description</title>
51433<para>
51434   This function allocates all necessary memory for MT slot handling
51435   in the input device, prepares the ABS_MT_SLOT and
51436   ABS_MT_TRACKING_ID events for use and sets up appropriate buffers.
51437   Depending on the flags set, it also performs pointer emulation and
51438   frame synchronization.
51439   </para><para>
51440
51441   May be called repeatedly. Returns -EINVAL if attempting to
51442   reinitialize with a different number of slots.
51443</para>
51444</refsect1>
51445</refentry>
51446
51447<refentry id="API-input-mt-destroy-slots">
51448<refentryinfo>
51449 <title>LINUX</title>
51450 <productname>Kernel Hackers Manual</productname>
51451 <date>July 2017</date>
51452</refentryinfo>
51453<refmeta>
51454 <refentrytitle><phrase>input_mt_destroy_slots</phrase></refentrytitle>
51455 <manvolnum>9</manvolnum>
51456 <refmiscinfo class="version">4.1.27</refmiscinfo>
51457</refmeta>
51458<refnamediv>
51459 <refname>input_mt_destroy_slots</refname>
51460 <refpurpose>
51461     frees the MT slots of the input device
51462 </refpurpose>
51463</refnamediv>
51464<refsynopsisdiv>
51465 <title>Synopsis</title>
51466  <funcsynopsis><funcprototype>
51467   <funcdef>void <function>input_mt_destroy_slots </function></funcdef>
51468   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51469  </funcprototype></funcsynopsis>
51470</refsynopsisdiv>
51471<refsect1>
51472 <title>Arguments</title>
51473 <variablelist>
51474  <varlistentry>
51475   <term><parameter>dev</parameter></term>
51476   <listitem>
51477    <para>
51478     input device with allocated MT slots
51479    </para>
51480   </listitem>
51481  </varlistentry>
51482 </variablelist>
51483</refsect1>
51484<refsect1>
51485<title>Description</title>
51486<para>
51487   This function is only needed in error path as the input core will
51488   automatically free the MT slots when the device is destroyed.
51489</para>
51490</refsect1>
51491</refentry>
51492
51493<refentry id="API-input-mt-report-slot-state">
51494<refentryinfo>
51495 <title>LINUX</title>
51496 <productname>Kernel Hackers Manual</productname>
51497 <date>July 2017</date>
51498</refentryinfo>
51499<refmeta>
51500 <refentrytitle><phrase>input_mt_report_slot_state</phrase></refentrytitle>
51501 <manvolnum>9</manvolnum>
51502 <refmiscinfo class="version">4.1.27</refmiscinfo>
51503</refmeta>
51504<refnamediv>
51505 <refname>input_mt_report_slot_state</refname>
51506 <refpurpose>
51507     report contact state
51508 </refpurpose>
51509</refnamediv>
51510<refsynopsisdiv>
51511 <title>Synopsis</title>
51512  <funcsynopsis><funcprototype>
51513   <funcdef>void <function>input_mt_report_slot_state </function></funcdef>
51514   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51515   <paramdef>unsigned int <parameter>tool_type</parameter></paramdef>
51516   <paramdef>bool <parameter>active</parameter></paramdef>
51517  </funcprototype></funcsynopsis>
51518</refsynopsisdiv>
51519<refsect1>
51520 <title>Arguments</title>
51521 <variablelist>
51522  <varlistentry>
51523   <term><parameter>dev</parameter></term>
51524   <listitem>
51525    <para>
51526     input device with allocated MT slots
51527    </para>
51528   </listitem>
51529  </varlistentry>
51530  <varlistentry>
51531   <term><parameter>tool_type</parameter></term>
51532   <listitem>
51533    <para>
51534     the tool type to use in this slot
51535    </para>
51536   </listitem>
51537  </varlistentry>
51538  <varlistentry>
51539   <term><parameter>active</parameter></term>
51540   <listitem>
51541    <para>
51542     true if contact is active, false otherwise
51543    </para>
51544   </listitem>
51545  </varlistentry>
51546 </variablelist>
51547</refsect1>
51548<refsect1>
51549<title>Description</title>
51550<para>
51551   Reports a contact via ABS_MT_TRACKING_ID, and optionally
51552   ABS_MT_TOOL_TYPE. If active is true and the slot is currently
51553   inactive, or if the tool type is changed, a new tracking id is
51554   assigned to the slot. The tool type is only reported if the
51555   corresponding absbit field is set.
51556</para>
51557</refsect1>
51558</refentry>
51559
51560<refentry id="API-input-mt-report-finger-count">
51561<refentryinfo>
51562 <title>LINUX</title>
51563 <productname>Kernel Hackers Manual</productname>
51564 <date>July 2017</date>
51565</refentryinfo>
51566<refmeta>
51567 <refentrytitle><phrase>input_mt_report_finger_count</phrase></refentrytitle>
51568 <manvolnum>9</manvolnum>
51569 <refmiscinfo class="version">4.1.27</refmiscinfo>
51570</refmeta>
51571<refnamediv>
51572 <refname>input_mt_report_finger_count</refname>
51573 <refpurpose>
51574     report contact count
51575 </refpurpose>
51576</refnamediv>
51577<refsynopsisdiv>
51578 <title>Synopsis</title>
51579  <funcsynopsis><funcprototype>
51580   <funcdef>void <function>input_mt_report_finger_count </function></funcdef>
51581   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51582   <paramdef>int <parameter>count</parameter></paramdef>
51583  </funcprototype></funcsynopsis>
51584</refsynopsisdiv>
51585<refsect1>
51586 <title>Arguments</title>
51587 <variablelist>
51588  <varlistentry>
51589   <term><parameter>dev</parameter></term>
51590   <listitem>
51591    <para>
51592     input device with allocated MT slots
51593    </para>
51594   </listitem>
51595  </varlistentry>
51596  <varlistentry>
51597   <term><parameter>count</parameter></term>
51598   <listitem>
51599    <para>
51600     the number of contacts
51601    </para>
51602   </listitem>
51603  </varlistentry>
51604 </variablelist>
51605</refsect1>
51606<refsect1>
51607<title>Description</title>
51608<para>
51609   Reports the contact count via BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP,
51610   BTN_TOOL_TRIPLETAP and BTN_TOOL_QUADTAP.
51611   </para><para>
51612
51613   The input core ensures only the KEY events already setup for
51614   this device will produce output.
51615</para>
51616</refsect1>
51617</refentry>
51618
51619<refentry id="API-input-mt-report-pointer-emulation">
51620<refentryinfo>
51621 <title>LINUX</title>
51622 <productname>Kernel Hackers Manual</productname>
51623 <date>July 2017</date>
51624</refentryinfo>
51625<refmeta>
51626 <refentrytitle><phrase>input_mt_report_pointer_emulation</phrase></refentrytitle>
51627 <manvolnum>9</manvolnum>
51628 <refmiscinfo class="version">4.1.27</refmiscinfo>
51629</refmeta>
51630<refnamediv>
51631 <refname>input_mt_report_pointer_emulation</refname>
51632 <refpurpose>
51633     common pointer emulation
51634 </refpurpose>
51635</refnamediv>
51636<refsynopsisdiv>
51637 <title>Synopsis</title>
51638  <funcsynopsis><funcprototype>
51639   <funcdef>void <function>input_mt_report_pointer_emulation </function></funcdef>
51640   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51641   <paramdef>bool <parameter>use_count</parameter></paramdef>
51642  </funcprototype></funcsynopsis>
51643</refsynopsisdiv>
51644<refsect1>
51645 <title>Arguments</title>
51646 <variablelist>
51647  <varlistentry>
51648   <term><parameter>dev</parameter></term>
51649   <listitem>
51650    <para>
51651     input device with allocated MT slots
51652    </para>
51653   </listitem>
51654  </varlistentry>
51655  <varlistentry>
51656   <term><parameter>use_count</parameter></term>
51657   <listitem>
51658    <para>
51659     report number of active contacts as finger count
51660    </para>
51661   </listitem>
51662  </varlistentry>
51663 </variablelist>
51664</refsect1>
51665<refsect1>
51666<title>Description</title>
51667<para>
51668   Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y and
51669   ABS_PRESSURE. Touchpad finger count is emulated if use_count is true.
51670   </para><para>
51671
51672   The input core ensures only the KEY and ABS axes already setup for
51673   this device will produce output.
51674</para>
51675</refsect1>
51676</refentry>
51677
51678<refentry id="API-input-mt-drop-unused">
51679<refentryinfo>
51680 <title>LINUX</title>
51681 <productname>Kernel Hackers Manual</productname>
51682 <date>July 2017</date>
51683</refentryinfo>
51684<refmeta>
51685 <refentrytitle><phrase>input_mt_drop_unused</phrase></refentrytitle>
51686 <manvolnum>9</manvolnum>
51687 <refmiscinfo class="version">4.1.27</refmiscinfo>
51688</refmeta>
51689<refnamediv>
51690 <refname>input_mt_drop_unused</refname>
51691 <refpurpose>
51692     Inactivate slots not seen in this frame
51693 </refpurpose>
51694</refnamediv>
51695<refsynopsisdiv>
51696 <title>Synopsis</title>
51697  <funcsynopsis><funcprototype>
51698   <funcdef>void <function>input_mt_drop_unused </function></funcdef>
51699   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51700  </funcprototype></funcsynopsis>
51701</refsynopsisdiv>
51702<refsect1>
51703 <title>Arguments</title>
51704 <variablelist>
51705  <varlistentry>
51706   <term><parameter>dev</parameter></term>
51707   <listitem>
51708    <para>
51709     input device with allocated MT slots
51710    </para>
51711   </listitem>
51712  </varlistentry>
51713 </variablelist>
51714</refsect1>
51715<refsect1>
51716<title>Description</title>
51717<para>
51718   Lift all slots not seen since the last call to this function.
51719</para>
51720</refsect1>
51721</refentry>
51722
51723<refentry id="API-input-mt-sync-frame">
51724<refentryinfo>
51725 <title>LINUX</title>
51726 <productname>Kernel Hackers Manual</productname>
51727 <date>July 2017</date>
51728</refentryinfo>
51729<refmeta>
51730 <refentrytitle><phrase>input_mt_sync_frame</phrase></refentrytitle>
51731 <manvolnum>9</manvolnum>
51732 <refmiscinfo class="version">4.1.27</refmiscinfo>
51733</refmeta>
51734<refnamediv>
51735 <refname>input_mt_sync_frame</refname>
51736 <refpurpose>
51737     synchronize mt frame
51738 </refpurpose>
51739</refnamediv>
51740<refsynopsisdiv>
51741 <title>Synopsis</title>
51742  <funcsynopsis><funcprototype>
51743   <funcdef>void <function>input_mt_sync_frame </function></funcdef>
51744   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51745  </funcprototype></funcsynopsis>
51746</refsynopsisdiv>
51747<refsect1>
51748 <title>Arguments</title>
51749 <variablelist>
51750  <varlistentry>
51751   <term><parameter>dev</parameter></term>
51752   <listitem>
51753    <para>
51754     input device with allocated MT slots
51755    </para>
51756   </listitem>
51757  </varlistentry>
51758 </variablelist>
51759</refsect1>
51760<refsect1>
51761<title>Description</title>
51762<para>
51763   Close the frame and prepare the internal state for a new one.
51764   Depending on the flags, marks unused slots as inactive and performs
51765   pointer emulation.
51766</para>
51767</refsect1>
51768</refentry>
51769
51770<refentry id="API-input-mt-assign-slots">
51771<refentryinfo>
51772 <title>LINUX</title>
51773 <productname>Kernel Hackers Manual</productname>
51774 <date>July 2017</date>
51775</refentryinfo>
51776<refmeta>
51777 <refentrytitle><phrase>input_mt_assign_slots</phrase></refentrytitle>
51778 <manvolnum>9</manvolnum>
51779 <refmiscinfo class="version">4.1.27</refmiscinfo>
51780</refmeta>
51781<refnamediv>
51782 <refname>input_mt_assign_slots</refname>
51783 <refpurpose>
51784     perform a best-match assignment
51785 </refpurpose>
51786</refnamediv>
51787<refsynopsisdiv>
51788 <title>Synopsis</title>
51789  <funcsynopsis><funcprototype>
51790   <funcdef>int <function>input_mt_assign_slots </function></funcdef>
51791   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51792   <paramdef>int * <parameter>slots</parameter></paramdef>
51793   <paramdef>const struct input_mt_pos * <parameter>pos</parameter></paramdef>
51794   <paramdef>int <parameter>num_pos</parameter></paramdef>
51795   <paramdef>int <parameter>dmax</parameter></paramdef>
51796  </funcprototype></funcsynopsis>
51797</refsynopsisdiv>
51798<refsect1>
51799 <title>Arguments</title>
51800 <variablelist>
51801  <varlistentry>
51802   <term><parameter>dev</parameter></term>
51803   <listitem>
51804    <para>
51805     input device with allocated MT slots
51806    </para>
51807   </listitem>
51808  </varlistentry>
51809  <varlistentry>
51810   <term><parameter>slots</parameter></term>
51811   <listitem>
51812    <para>
51813     the slot assignment to be filled
51814    </para>
51815   </listitem>
51816  </varlistentry>
51817  <varlistentry>
51818   <term><parameter>pos</parameter></term>
51819   <listitem>
51820    <para>
51821     the position array to match
51822    </para>
51823   </listitem>
51824  </varlistentry>
51825  <varlistentry>
51826   <term><parameter>num_pos</parameter></term>
51827   <listitem>
51828    <para>
51829     number of positions
51830    </para>
51831   </listitem>
51832  </varlistentry>
51833  <varlistentry>
51834   <term><parameter>dmax</parameter></term>
51835   <listitem>
51836    <para>
51837     maximum ABS_MT_POSITION displacement (zero for infinite)
51838    </para>
51839   </listitem>
51840  </varlistentry>
51841 </variablelist>
51842</refsect1>
51843<refsect1>
51844<title>Description</title>
51845<para>
51846   Performs a best match against the current contacts and returns
51847   the slot assignment list. New contacts are assigned to unused
51848   slots.
51849   </para><para>
51850
51851   The assignments are balanced so that all coordinate displacements are
51852   below the euclidian distance dmax. If no such assignment can be found,
51853   some contacts are assigned to unused slots.
51854   </para><para>
51855
51856   Returns zero on success, or negative error in case of failure.
51857</para>
51858</refsect1>
51859</refentry>
51860
51861<refentry id="API-input-mt-get-slot-by-key">
51862<refentryinfo>
51863 <title>LINUX</title>
51864 <productname>Kernel Hackers Manual</productname>
51865 <date>July 2017</date>
51866</refentryinfo>
51867<refmeta>
51868 <refentrytitle><phrase>input_mt_get_slot_by_key</phrase></refentrytitle>
51869 <manvolnum>9</manvolnum>
51870 <refmiscinfo class="version">4.1.27</refmiscinfo>
51871</refmeta>
51872<refnamediv>
51873 <refname>input_mt_get_slot_by_key</refname>
51874 <refpurpose>
51875     return slot matching key
51876 </refpurpose>
51877</refnamediv>
51878<refsynopsisdiv>
51879 <title>Synopsis</title>
51880  <funcsynopsis><funcprototype>
51881   <funcdef>int <function>input_mt_get_slot_by_key </function></funcdef>
51882   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
51883   <paramdef>int <parameter>key</parameter></paramdef>
51884  </funcprototype></funcsynopsis>
51885</refsynopsisdiv>
51886<refsect1>
51887 <title>Arguments</title>
51888 <variablelist>
51889  <varlistentry>
51890   <term><parameter>dev</parameter></term>
51891   <listitem>
51892    <para>
51893     input device with allocated MT slots
51894    </para>
51895   </listitem>
51896  </varlistentry>
51897  <varlistentry>
51898   <term><parameter>key</parameter></term>
51899   <listitem>
51900    <para>
51901     the key of the sought slot
51902    </para>
51903   </listitem>
51904  </varlistentry>
51905 </variablelist>
51906</refsect1>
51907<refsect1>
51908<title>Description</title>
51909<para>
51910   Returns the slot of the given key, if it exists, otherwise
51911   set the key on the first unused slot and return.
51912   </para><para>
51913
51914   If no available slot can be found, -1 is returned.
51915   Note that for this function to work properly, <function>input_mt_sync_frame</function> has
51916   to be called at each frame.
51917</para>
51918</refsect1>
51919</refentry>
51920
51921     </sect1>
51922     <sect1><title>Polled input devices</title>
51923<!-- include/linux/input-polldev.h -->
51924<refentry id="API-struct-input-polled-dev">
51925<refentryinfo>
51926 <title>LINUX</title>
51927 <productname>Kernel Hackers Manual</productname>
51928 <date>July 2017</date>
51929</refentryinfo>
51930<refmeta>
51931 <refentrytitle><phrase>struct input_polled_dev</phrase></refentrytitle>
51932 <manvolnum>9</manvolnum>
51933 <refmiscinfo class="version">4.1.27</refmiscinfo>
51934</refmeta>
51935<refnamediv>
51936 <refname>struct input_polled_dev</refname>
51937 <refpurpose>
51938  simple polled input device
51939 </refpurpose>
51940</refnamediv>
51941<refsynopsisdiv>
51942 <title>Synopsis</title>
51943  <programlisting>
51944struct input_polled_dev {
51945  void * private;
51946  void (* open) (struct input_polled_dev *dev);
51947  void (* close) (struct input_polled_dev *dev);
51948  void (* poll) (struct input_polled_dev *dev);
51949  unsigned int poll_interval;
51950  unsigned int poll_interval_max;
51951  unsigned int poll_interval_min;
51952  struct input_dev * input;
51953};  </programlisting>
51954</refsynopsisdiv>
51955 <refsect1>
51956  <title>Members</title>
51957  <variablelist>
51958    <varlistentry>      <term>private</term>
51959      <listitem><para>
51960private driver data.
51961      </para></listitem>
51962    </varlistentry>
51963    <varlistentry>      <term>open</term>
51964      <listitem><para>
51965driver-supplied method that prepares device for polling
51966(enabled the device and maybe flushes device state).
51967      </para></listitem>
51968    </varlistentry>
51969    <varlistentry>      <term>close</term>
51970      <listitem><para>
51971driver-supplied method that is called when device is no
51972longer being polled. Used to put device into low power mode.
51973      </para></listitem>
51974    </varlistentry>
51975    <varlistentry>      <term>poll</term>
51976      <listitem><para>
51977driver-supplied method that polls the device and posts
51978input events (mandatory).
51979      </para></listitem>
51980    </varlistentry>
51981    <varlistentry>      <term>poll_interval</term>
51982      <listitem><para>
51983specifies how often the <function>poll</function> method should be called.
51984Defaults to 500 msec unless overridden when registering the device.
51985      </para></listitem>
51986    </varlistentry>
51987    <varlistentry>      <term>poll_interval_max</term>
51988      <listitem><para>
51989specifies upper bound for the poll interval.
51990Defaults to the initial value of <parameter>poll_interval</parameter>.
51991      </para></listitem>
51992    </varlistentry>
51993    <varlistentry>      <term>poll_interval_min</term>
51994      <listitem><para>
51995specifies lower bound for the poll interval.
51996Defaults to 0.
51997      </para></listitem>
51998    </varlistentry>
51999    <varlistentry>      <term>input</term>
52000      <listitem><para>
52001input device structure associated with the polled device.
52002Must be properly initialized by the driver (id, name, phys, bits).
52003      </para></listitem>
52004    </varlistentry>
52005  </variablelist>
52006 </refsect1>
52007<refsect1>
52008<title>Description</title>
52009<para>
52010   Polled input device provides a skeleton for supporting simple input
52011   devices that do not raise interrupts but have to be periodically
52012   scanned or polled to detect changes in their state.
52013</para>
52014</refsect1>
52015</refentry>
52016
52017<!-- drivers/input/input-polldev.c -->
52018<refentry id="API-input-allocate-polled-device">
52019<refentryinfo>
52020 <title>LINUX</title>
52021 <productname>Kernel Hackers Manual</productname>
52022 <date>July 2017</date>
52023</refentryinfo>
52024<refmeta>
52025 <refentrytitle><phrase>input_allocate_polled_device</phrase></refentrytitle>
52026 <manvolnum>9</manvolnum>
52027 <refmiscinfo class="version">4.1.27</refmiscinfo>
52028</refmeta>
52029<refnamediv>
52030 <refname>input_allocate_polled_device</refname>
52031 <refpurpose>
52032  allocate memory for polled device
52033 </refpurpose>
52034</refnamediv>
52035<refsynopsisdiv>
52036 <title>Synopsis</title>
52037  <funcsynopsis><funcprototype>
52038   <funcdef>struct input_polled_dev * <function>input_allocate_polled_device </function></funcdef>
52039   <paramdef> <parameter>void</parameter></paramdef>
52040  </funcprototype></funcsynopsis>
52041</refsynopsisdiv>
52042<refsect1>
52043 <title>Arguments</title>
52044 <variablelist>
52045  <varlistentry>
52046   <term><parameter>void</parameter></term>
52047   <listitem>
52048    <para>
52049     no arguments
52050    </para>
52051   </listitem>
52052  </varlistentry>
52053 </variablelist>
52054</refsect1>
52055<refsect1>
52056<title>Description</title>
52057<para>
52058   </para><para>
52059
52060   The function allocates memory for a polled device and also
52061   for an input device associated with this polled device.
52062</para>
52063</refsect1>
52064</refentry>
52065
52066<refentry id="API-devm-input-allocate-polled-device">
52067<refentryinfo>
52068 <title>LINUX</title>
52069 <productname>Kernel Hackers Manual</productname>
52070 <date>July 2017</date>
52071</refentryinfo>
52072<refmeta>
52073 <refentrytitle><phrase>devm_input_allocate_polled_device</phrase></refentrytitle>
52074 <manvolnum>9</manvolnum>
52075 <refmiscinfo class="version">4.1.27</refmiscinfo>
52076</refmeta>
52077<refnamediv>
52078 <refname>devm_input_allocate_polled_device</refname>
52079 <refpurpose>
52080     allocate managed polled device
52081 </refpurpose>
52082</refnamediv>
52083<refsynopsisdiv>
52084 <title>Synopsis</title>
52085  <funcsynopsis><funcprototype>
52086   <funcdef>struct input_polled_dev * <function>devm_input_allocate_polled_device </function></funcdef>
52087   <paramdef>struct device * <parameter>dev</parameter></paramdef>
52088  </funcprototype></funcsynopsis>
52089</refsynopsisdiv>
52090<refsect1>
52091 <title>Arguments</title>
52092 <variablelist>
52093  <varlistentry>
52094   <term><parameter>dev</parameter></term>
52095   <listitem>
52096    <para>
52097     device owning the polled device being created
52098    </para>
52099   </listitem>
52100  </varlistentry>
52101 </variablelist>
52102</refsect1>
52103<refsect1>
52104<title>Description</title>
52105<para>
52106   Returns prepared <structname>struct input_polled_dev</structname> or <constant>NULL</constant>.
52107   </para><para>
52108
52109   Managed polled input devices do not need to be explicitly unregistered
52110   or freed as it will be done automatically when owner device unbinds
52111   from * its driver (or binding fails). Once such managed polled device
52112   is allocated, it is ready to be set up and registered in the same
52113   fashion as regular polled input devices (using
52114   <function>input_register_polled_device</function> function).
52115   </para><para>
52116
52117   If you want to manually unregister and free such managed polled devices,
52118   it can be still done by calling <function>input_unregister_polled_device</function> and
52119   <function>input_free_polled_device</function>, although it is rarely needed.
52120</para>
52121</refsect1>
52122<refsect1>
52123<title>NOTE</title>
52124<para>
52125   the owner device is set up as parent of input device and users
52126   should not override it.
52127</para>
52128</refsect1>
52129</refentry>
52130
52131<refentry id="API-input-free-polled-device">
52132<refentryinfo>
52133 <title>LINUX</title>
52134 <productname>Kernel Hackers Manual</productname>
52135 <date>July 2017</date>
52136</refentryinfo>
52137<refmeta>
52138 <refentrytitle><phrase>input_free_polled_device</phrase></refentrytitle>
52139 <manvolnum>9</manvolnum>
52140 <refmiscinfo class="version">4.1.27</refmiscinfo>
52141</refmeta>
52142<refnamediv>
52143 <refname>input_free_polled_device</refname>
52144 <refpurpose>
52145     free memory allocated for polled device
52146 </refpurpose>
52147</refnamediv>
52148<refsynopsisdiv>
52149 <title>Synopsis</title>
52150  <funcsynopsis><funcprototype>
52151   <funcdef>void <function>input_free_polled_device </function></funcdef>
52152   <paramdef>struct input_polled_dev * <parameter>dev</parameter></paramdef>
52153  </funcprototype></funcsynopsis>
52154</refsynopsisdiv>
52155<refsect1>
52156 <title>Arguments</title>
52157 <variablelist>
52158  <varlistentry>
52159   <term><parameter>dev</parameter></term>
52160   <listitem>
52161    <para>
52162     device to free
52163    </para>
52164   </listitem>
52165  </varlistentry>
52166 </variablelist>
52167</refsect1>
52168<refsect1>
52169<title>Description</title>
52170<para>
52171   The function frees memory allocated for polling device and drops
52172   reference to the associated input device.
52173</para>
52174</refsect1>
52175</refentry>
52176
52177<refentry id="API-input-register-polled-device">
52178<refentryinfo>
52179 <title>LINUX</title>
52180 <productname>Kernel Hackers Manual</productname>
52181 <date>July 2017</date>
52182</refentryinfo>
52183<refmeta>
52184 <refentrytitle><phrase>input_register_polled_device</phrase></refentrytitle>
52185 <manvolnum>9</manvolnum>
52186 <refmiscinfo class="version">4.1.27</refmiscinfo>
52187</refmeta>
52188<refnamediv>
52189 <refname>input_register_polled_device</refname>
52190 <refpurpose>
52191     register polled device
52192 </refpurpose>
52193</refnamediv>
52194<refsynopsisdiv>
52195 <title>Synopsis</title>
52196  <funcsynopsis><funcprototype>
52197   <funcdef>int <function>input_register_polled_device </function></funcdef>
52198   <paramdef>struct input_polled_dev * <parameter>dev</parameter></paramdef>
52199  </funcprototype></funcsynopsis>
52200</refsynopsisdiv>
52201<refsect1>
52202 <title>Arguments</title>
52203 <variablelist>
52204  <varlistentry>
52205   <term><parameter>dev</parameter></term>
52206   <listitem>
52207    <para>
52208     device to register
52209    </para>
52210   </listitem>
52211  </varlistentry>
52212 </variablelist>
52213</refsect1>
52214<refsect1>
52215<title>Description</title>
52216<para>
52217   The function registers previously initialized polled input device
52218   with input layer. The device should be allocated with call to
52219   <function>input_allocate_polled_device</function>. Callers should also set up <function>poll</function>
52220   method and set up capabilities (id, name, phys, bits) of the
52221   corresponding input_dev structure.
52222</para>
52223</refsect1>
52224</refentry>
52225
52226<refentry id="API-input-unregister-polled-device">
52227<refentryinfo>
52228 <title>LINUX</title>
52229 <productname>Kernel Hackers Manual</productname>
52230 <date>July 2017</date>
52231</refentryinfo>
52232<refmeta>
52233 <refentrytitle><phrase>input_unregister_polled_device</phrase></refentrytitle>
52234 <manvolnum>9</manvolnum>
52235 <refmiscinfo class="version">4.1.27</refmiscinfo>
52236</refmeta>
52237<refnamediv>
52238 <refname>input_unregister_polled_device</refname>
52239 <refpurpose>
52240     unregister polled device
52241 </refpurpose>
52242</refnamediv>
52243<refsynopsisdiv>
52244 <title>Synopsis</title>
52245  <funcsynopsis><funcprototype>
52246   <funcdef>void <function>input_unregister_polled_device </function></funcdef>
52247   <paramdef>struct input_polled_dev * <parameter>dev</parameter></paramdef>
52248  </funcprototype></funcsynopsis>
52249</refsynopsisdiv>
52250<refsect1>
52251 <title>Arguments</title>
52252 <variablelist>
52253  <varlistentry>
52254   <term><parameter>dev</parameter></term>
52255   <listitem>
52256    <para>
52257     device to unregister
52258    </para>
52259   </listitem>
52260  </varlistentry>
52261 </variablelist>
52262</refsect1>
52263<refsect1>
52264<title>Description</title>
52265<para>
52266   The function unregisters previously registered polled input
52267   device from input layer. Polling is stopped and device is
52268   ready to be freed with call to <function>input_free_polled_device</function>.
52269</para>
52270</refsect1>
52271</refentry>
52272
52273     </sect1>
52274     <sect1><title>Matrix keyboars/keypads</title>
52275<!-- include/linux/input/matrix_keypad.h -->
52276<refentry id="API-struct-matrix-keymap-data">
52277<refentryinfo>
52278 <title>LINUX</title>
52279 <productname>Kernel Hackers Manual</productname>
52280 <date>July 2017</date>
52281</refentryinfo>
52282<refmeta>
52283 <refentrytitle><phrase>struct matrix_keymap_data</phrase></refentrytitle>
52284 <manvolnum>9</manvolnum>
52285 <refmiscinfo class="version">4.1.27</refmiscinfo>
52286</refmeta>
52287<refnamediv>
52288 <refname>struct matrix_keymap_data</refname>
52289 <refpurpose>
52290  keymap for matrix keyboards
52291 </refpurpose>
52292</refnamediv>
52293<refsynopsisdiv>
52294 <title>Synopsis</title>
52295  <programlisting>
52296struct matrix_keymap_data {
52297  const uint32_t * keymap;
52298  unsigned int keymap_size;
52299};  </programlisting>
52300</refsynopsisdiv>
52301 <refsect1>
52302  <title>Members</title>
52303  <variablelist>
52304    <varlistentry>      <term>keymap</term>
52305      <listitem><para>
52306pointer to array of uint32 values encoded with <function>KEY</function> macro
52307representing keymap
52308      </para></listitem>
52309    </varlistentry>
52310    <varlistentry>      <term>keymap_size</term>
52311      <listitem><para>
52312number of entries (initialized) in this keymap
52313      </para></listitem>
52314    </varlistentry>
52315  </variablelist>
52316 </refsect1>
52317<refsect1>
52318<title>Description</title>
52319<para>
52320   This structure is supposed to be used by platform code to supply
52321   keymaps to drivers that implement matrix-like keypads/keyboards.
52322</para>
52323</refsect1>
52324</refentry>
52325
52326<refentry id="API-struct-matrix-keypad-platform-data">
52327<refentryinfo>
52328 <title>LINUX</title>
52329 <productname>Kernel Hackers Manual</productname>
52330 <date>July 2017</date>
52331</refentryinfo>
52332<refmeta>
52333 <refentrytitle><phrase>struct matrix_keypad_platform_data</phrase></refentrytitle>
52334 <manvolnum>9</manvolnum>
52335 <refmiscinfo class="version">4.1.27</refmiscinfo>
52336</refmeta>
52337<refnamediv>
52338 <refname>struct matrix_keypad_platform_data</refname>
52339 <refpurpose>
52340     platform-dependent keypad data
52341 </refpurpose>
52342</refnamediv>
52343<refsynopsisdiv>
52344 <title>Synopsis</title>
52345  <programlisting>
52346struct matrix_keypad_platform_data {
52347  const struct matrix_keymap_data * keymap_data;
52348  const unsigned int * row_gpios;
52349  const unsigned int * col_gpios;
52350  unsigned int num_row_gpios;
52351  unsigned int num_col_gpios;
52352  unsigned int col_scan_delay_us;
52353  unsigned int debounce_ms;
52354  unsigned int clustered_irq;
52355  unsigned int clustered_irq_flags;
52356  bool active_low;
52357  bool wakeup;
52358  bool no_autorepeat;
52359};  </programlisting>
52360</refsynopsisdiv>
52361 <refsect1>
52362  <title>Members</title>
52363  <variablelist>
52364    <varlistentry>      <term>keymap_data</term>
52365      <listitem><para>
52366   pointer to <structname>matrix_keymap_data</structname>
52367      </para></listitem>
52368    </varlistentry>
52369    <varlistentry>      <term>row_gpios</term>
52370      <listitem><para>
52371   pointer to array of gpio numbers representing rows
52372      </para></listitem>
52373    </varlistentry>
52374    <varlistentry>      <term>col_gpios</term>
52375      <listitem><para>
52376   pointer to array of gpio numbers reporesenting colums
52377      </para></listitem>
52378    </varlistentry>
52379    <varlistentry>      <term>num_row_gpios</term>
52380      <listitem><para>
52381   actual number of row gpios used by device
52382      </para></listitem>
52383    </varlistentry>
52384    <varlistentry>      <term>num_col_gpios</term>
52385      <listitem><para>
52386   actual number of col gpios used by device
52387      </para></listitem>
52388    </varlistentry>
52389    <varlistentry>      <term>col_scan_delay_us</term>
52390      <listitem><para>
52391   delay, measured in microseconds, that is
52392   needed before we can keypad after activating column gpio
52393      </para></listitem>
52394    </varlistentry>
52395    <varlistentry>      <term>debounce_ms</term>
52396      <listitem><para>
52397   debounce interval in milliseconds
52398      </para></listitem>
52399    </varlistentry>
52400    <varlistentry>      <term>clustered_irq</term>
52401      <listitem><para>
52402   may be specified if interrupts of all row/column GPIOs
52403   are bundled to one single irq
52404      </para></listitem>
52405    </varlistentry>
52406    <varlistentry>      <term>clustered_irq_flags</term>
52407      <listitem><para>
52408   flags that are needed for the clustered irq
52409      </para></listitem>
52410    </varlistentry>
52411    <varlistentry>      <term>active_low</term>
52412      <listitem><para>
52413   gpio polarity
52414      </para></listitem>
52415    </varlistentry>
52416    <varlistentry>      <term>wakeup</term>
52417      <listitem><para>
52418   controls whether the device should be set up as wakeup
52419   source
52420      </para></listitem>
52421    </varlistentry>
52422    <varlistentry>      <term>no_autorepeat</term>
52423      <listitem><para>
52424   disable key autorepeat
52425      </para></listitem>
52426    </varlistentry>
52427  </variablelist>
52428 </refsect1>
52429<refsect1>
52430<title>Description</title>
52431<para>
52432   This structure represents platform-specific data that use used by
52433   matrix_keypad driver to perform proper initialization.
52434</para>
52435</refsect1>
52436</refentry>
52437
52438<refentry id="API-matrix-keypad-parse-of-params">
52439<refentryinfo>
52440 <title>LINUX</title>
52441 <productname>Kernel Hackers Manual</productname>
52442 <date>July 2017</date>
52443</refentryinfo>
52444<refmeta>
52445 <refentrytitle><phrase>matrix_keypad_parse_of_params</phrase></refentrytitle>
52446 <manvolnum>9</manvolnum>
52447 <refmiscinfo class="version">4.1.27</refmiscinfo>
52448</refmeta>
52449<refnamediv>
52450 <refname>matrix_keypad_parse_of_params</refname>
52451 <refpurpose>
52452     Read parameters from matrix-keypad node
52453 </refpurpose>
52454</refnamediv>
52455<refsynopsisdiv>
52456 <title>Synopsis</title>
52457  <funcsynopsis><funcprototype>
52458   <funcdef>int <function>matrix_keypad_parse_of_params </function></funcdef>
52459   <paramdef>struct device * <parameter>dev</parameter></paramdef>
52460   <paramdef>unsigned int * <parameter>rows</parameter></paramdef>
52461   <paramdef>unsigned int * <parameter>cols</parameter></paramdef>
52462  </funcprototype></funcsynopsis>
52463</refsynopsisdiv>
52464<refsect1>
52465 <title>Arguments</title>
52466 <variablelist>
52467  <varlistentry>
52468   <term><parameter>dev</parameter></term>
52469   <listitem>
52470    <para>
52471     Device containing of_node
52472    </para>
52473   </listitem>
52474  </varlistentry>
52475  <varlistentry>
52476   <term><parameter>rows</parameter></term>
52477   <listitem>
52478    <para>
52479     Returns number of matrix rows
52480    </para>
52481   </listitem>
52482  </varlistentry>
52483  <varlistentry>
52484   <term><parameter>cols</parameter></term>
52485   <listitem>
52486    <para>
52487     Returns number of matrix columns
52488     <parameter>return</parameter> 0 if OK, &lt;0 on error
52489    </para>
52490   </listitem>
52491  </varlistentry>
52492 </variablelist>
52493</refsect1>
52494</refentry>
52495
52496     </sect1>
52497     <sect1><title>Sparse keymap support</title>
52498<!-- include/linux/input/sparse-keymap.h -->
52499<refentry id="API-struct-key-entry">
52500<refentryinfo>
52501 <title>LINUX</title>
52502 <productname>Kernel Hackers Manual</productname>
52503 <date>July 2017</date>
52504</refentryinfo>
52505<refmeta>
52506 <refentrytitle><phrase>struct key_entry</phrase></refentrytitle>
52507 <manvolnum>9</manvolnum>
52508 <refmiscinfo class="version">4.1.27</refmiscinfo>
52509</refmeta>
52510<refnamediv>
52511 <refname>struct key_entry</refname>
52512 <refpurpose>
52513  keymap entry for use in sparse keymap
52514 </refpurpose>
52515</refnamediv>
52516<refsynopsisdiv>
52517 <title>Synopsis</title>
52518  <programlisting>
52519struct key_entry {
52520  int type;
52521  u32 code;
52522  union {unnamed_union};
52523};  </programlisting>
52524</refsynopsisdiv>
52525 <refsect1>
52526  <title>Members</title>
52527  <variablelist>
52528    <varlistentry>      <term>type</term>
52529      <listitem><para>
52530Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END);
52531drivers are allowed to extend the list with their own
52532private definitions.
52533      </para></listitem>
52534    </varlistentry>
52535    <varlistentry>      <term>code</term>
52536      <listitem><para>
52537Device-specific data identifying the button/switch
52538      </para></listitem>
52539    </varlistentry>
52540    <varlistentry>      <term>{unnamed_union}</term>
52541      <listitem><para>
52542anonymous
52543      </para></listitem>
52544    </varlistentry>
52545  </variablelist>
52546 </refsect1>
52547<refsect1>
52548<title>Description</title>
52549<para>
52550   This structure defines an entry in a sparse keymap used by some
52551   input devices for which traditional table-based approach is not
52552   suitable.
52553</para>
52554</refsect1>
52555</refentry>
52556
52557<!-- drivers/input/sparse-keymap.c -->
52558<refentry id="API-sparse-keymap-entry-from-scancode">
52559<refentryinfo>
52560 <title>LINUX</title>
52561 <productname>Kernel Hackers Manual</productname>
52562 <date>July 2017</date>
52563</refentryinfo>
52564<refmeta>
52565 <refentrytitle><phrase>sparse_keymap_entry_from_scancode</phrase></refentrytitle>
52566 <manvolnum>9</manvolnum>
52567 <refmiscinfo class="version">4.1.27</refmiscinfo>
52568</refmeta>
52569<refnamediv>
52570 <refname>sparse_keymap_entry_from_scancode</refname>
52571 <refpurpose>
52572  perform sparse keymap lookup
52573 </refpurpose>
52574</refnamediv>
52575<refsynopsisdiv>
52576 <title>Synopsis</title>
52577  <funcsynopsis><funcprototype>
52578   <funcdef>struct key_entry * <function>sparse_keymap_entry_from_scancode </function></funcdef>
52579   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
52580   <paramdef>unsigned int <parameter>code</parameter></paramdef>
52581  </funcprototype></funcsynopsis>
52582</refsynopsisdiv>
52583<refsect1>
52584 <title>Arguments</title>
52585 <variablelist>
52586  <varlistentry>
52587   <term><parameter>dev</parameter></term>
52588   <listitem>
52589    <para>
52590     Input device using sparse keymap
52591    </para>
52592   </listitem>
52593  </varlistentry>
52594  <varlistentry>
52595   <term><parameter>code</parameter></term>
52596   <listitem>
52597    <para>
52598     Scan code
52599    </para>
52600   </listitem>
52601  </varlistentry>
52602 </variablelist>
52603</refsect1>
52604<refsect1>
52605<title>Description</title>
52606<para>
52607   This function is used to perform <structname>struct key_entry</structname> lookup in an
52608   input device using sparse keymap.
52609</para>
52610</refsect1>
52611</refentry>
52612
52613<refentry id="API-sparse-keymap-entry-from-keycode">
52614<refentryinfo>
52615 <title>LINUX</title>
52616 <productname>Kernel Hackers Manual</productname>
52617 <date>July 2017</date>
52618</refentryinfo>
52619<refmeta>
52620 <refentrytitle><phrase>sparse_keymap_entry_from_keycode</phrase></refentrytitle>
52621 <manvolnum>9</manvolnum>
52622 <refmiscinfo class="version">4.1.27</refmiscinfo>
52623</refmeta>
52624<refnamediv>
52625 <refname>sparse_keymap_entry_from_keycode</refname>
52626 <refpurpose>
52627     perform sparse keymap lookup
52628 </refpurpose>
52629</refnamediv>
52630<refsynopsisdiv>
52631 <title>Synopsis</title>
52632  <funcsynopsis><funcprototype>
52633   <funcdef>struct key_entry * <function>sparse_keymap_entry_from_keycode </function></funcdef>
52634   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
52635   <paramdef>unsigned int <parameter>keycode</parameter></paramdef>
52636  </funcprototype></funcsynopsis>
52637</refsynopsisdiv>
52638<refsect1>
52639 <title>Arguments</title>
52640 <variablelist>
52641  <varlistentry>
52642   <term><parameter>dev</parameter></term>
52643   <listitem>
52644    <para>
52645     Input device using sparse keymap
52646    </para>
52647   </listitem>
52648  </varlistentry>
52649  <varlistentry>
52650   <term><parameter>keycode</parameter></term>
52651   <listitem>
52652    <para>
52653     Key code
52654    </para>
52655   </listitem>
52656  </varlistentry>
52657 </variablelist>
52658</refsect1>
52659<refsect1>
52660<title>Description</title>
52661<para>
52662   This function is used to perform <structname>struct key_entry</structname> lookup in an
52663   input device using sparse keymap.
52664</para>
52665</refsect1>
52666</refentry>
52667
52668<refentry id="API-sparse-keymap-setup">
52669<refentryinfo>
52670 <title>LINUX</title>
52671 <productname>Kernel Hackers Manual</productname>
52672 <date>July 2017</date>
52673</refentryinfo>
52674<refmeta>
52675 <refentrytitle><phrase>sparse_keymap_setup</phrase></refentrytitle>
52676 <manvolnum>9</manvolnum>
52677 <refmiscinfo class="version">4.1.27</refmiscinfo>
52678</refmeta>
52679<refnamediv>
52680 <refname>sparse_keymap_setup</refname>
52681 <refpurpose>
52682     set up sparse keymap for an input device
52683 </refpurpose>
52684</refnamediv>
52685<refsynopsisdiv>
52686 <title>Synopsis</title>
52687  <funcsynopsis><funcprototype>
52688   <funcdef>int <function>sparse_keymap_setup </function></funcdef>
52689   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
52690   <paramdef>const struct key_entry * <parameter>keymap</parameter></paramdef>
52691   <paramdef>int (*<parameter>setup</parameter>)
52692     <funcparams>struct input_dev *, struct key_entry *</funcparams></paramdef>
52693  </funcprototype></funcsynopsis>
52694</refsynopsisdiv>
52695<refsect1>
52696 <title>Arguments</title>
52697 <variablelist>
52698  <varlistentry>
52699   <term><parameter>dev</parameter></term>
52700   <listitem>
52701    <para>
52702     Input device
52703    </para>
52704   </listitem>
52705  </varlistentry>
52706  <varlistentry>
52707   <term><parameter>keymap</parameter></term>
52708   <listitem>
52709    <para>
52710     Keymap in form of array of <structname>key_entry</structname> structures ending
52711     with <constant>KE_END</constant> type entry
52712    </para>
52713   </listitem>
52714  </varlistentry>
52715  <varlistentry>
52716   <term><parameter>setup</parameter></term>
52717   <listitem>
52718    <para>
52719     Function that can be used to adjust keymap entries
52720     depending on device's deeds, may be <constant>NULL</constant>
52721    </para>
52722   </listitem>
52723  </varlistentry>
52724 </variablelist>
52725</refsect1>
52726<refsect1>
52727<title>Description</title>
52728<para>
52729   The function calculates size and allocates copy of the original
52730   keymap after which sets up input device event bits appropriately.
52731   Before destroying input device allocated keymap should be freed
52732   with a call to <function>sparse_keymap_free</function>.
52733</para>
52734</refsect1>
52735</refentry>
52736
52737<refentry id="API-sparse-keymap-free">
52738<refentryinfo>
52739 <title>LINUX</title>
52740 <productname>Kernel Hackers Manual</productname>
52741 <date>July 2017</date>
52742</refentryinfo>
52743<refmeta>
52744 <refentrytitle><phrase>sparse_keymap_free</phrase></refentrytitle>
52745 <manvolnum>9</manvolnum>
52746 <refmiscinfo class="version">4.1.27</refmiscinfo>
52747</refmeta>
52748<refnamediv>
52749 <refname>sparse_keymap_free</refname>
52750 <refpurpose>
52751     free memory allocated for sparse keymap
52752 </refpurpose>
52753</refnamediv>
52754<refsynopsisdiv>
52755 <title>Synopsis</title>
52756  <funcsynopsis><funcprototype>
52757   <funcdef>void <function>sparse_keymap_free </function></funcdef>
52758   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
52759  </funcprototype></funcsynopsis>
52760</refsynopsisdiv>
52761<refsect1>
52762 <title>Arguments</title>
52763 <variablelist>
52764  <varlistentry>
52765   <term><parameter>dev</parameter></term>
52766   <listitem>
52767    <para>
52768     Input device using sparse keymap
52769    </para>
52770   </listitem>
52771  </varlistentry>
52772 </variablelist>
52773</refsect1>
52774<refsect1>
52775<title>Description</title>
52776<para>
52777   This function is used to free memory allocated by sparse keymap
52778   in an input device that was set up by <function>sparse_keymap_setup</function>.
52779</para>
52780</refsect1>
52781<refsect1>
52782<title>NOTE</title>
52783<para>
52784   It is safe to cal this function while input device is
52785   still registered (however the drivers should care not to try to
52786   use freed keymap and thus have to shut off interrupts/polling
52787   before freeing the keymap).
52788</para>
52789</refsect1>
52790</refentry>
52791
52792<refentry id="API-sparse-keymap-report-entry">
52793<refentryinfo>
52794 <title>LINUX</title>
52795 <productname>Kernel Hackers Manual</productname>
52796 <date>July 2017</date>
52797</refentryinfo>
52798<refmeta>
52799 <refentrytitle><phrase>sparse_keymap_report_entry</phrase></refentrytitle>
52800 <manvolnum>9</manvolnum>
52801 <refmiscinfo class="version">4.1.27</refmiscinfo>
52802</refmeta>
52803<refnamediv>
52804 <refname>sparse_keymap_report_entry</refname>
52805 <refpurpose>
52806     report event corresponding to given key entry
52807 </refpurpose>
52808</refnamediv>
52809<refsynopsisdiv>
52810 <title>Synopsis</title>
52811  <funcsynopsis><funcprototype>
52812   <funcdef>void <function>sparse_keymap_report_entry </function></funcdef>
52813   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
52814   <paramdef>const struct key_entry * <parameter>ke</parameter></paramdef>
52815   <paramdef>unsigned int <parameter>value</parameter></paramdef>
52816   <paramdef>bool <parameter>autorelease</parameter></paramdef>
52817  </funcprototype></funcsynopsis>
52818</refsynopsisdiv>
52819<refsect1>
52820 <title>Arguments</title>
52821 <variablelist>
52822  <varlistentry>
52823   <term><parameter>dev</parameter></term>
52824   <listitem>
52825    <para>
52826     Input device for which event should be reported
52827    </para>
52828   </listitem>
52829  </varlistentry>
52830  <varlistentry>
52831   <term><parameter>ke</parameter></term>
52832   <listitem>
52833    <para>
52834     key entry describing event
52835    </para>
52836   </listitem>
52837  </varlistentry>
52838  <varlistentry>
52839   <term><parameter>value</parameter></term>
52840   <listitem>
52841    <para>
52842     Value that should be reported (ignored by <constant>KE_SW</constant> entries)
52843    </para>
52844   </listitem>
52845  </varlistentry>
52846  <varlistentry>
52847   <term><parameter>autorelease</parameter></term>
52848   <listitem>
52849    <para>
52850     Signals whether release event should be emitted for <constant>KE_KEY</constant>
52851     entries right after reporting press event, ignored by all other
52852     entries
52853    </para>
52854   </listitem>
52855  </varlistentry>
52856 </variablelist>
52857</refsect1>
52858<refsect1>
52859<title>Description</title>
52860<para>
52861   This function is used to report input event described by given
52862   <structname>struct key_entry</structname>.
52863</para>
52864</refsect1>
52865</refentry>
52866
52867<refentry id="API-sparse-keymap-report-event">
52868<refentryinfo>
52869 <title>LINUX</title>
52870 <productname>Kernel Hackers Manual</productname>
52871 <date>July 2017</date>
52872</refentryinfo>
52873<refmeta>
52874 <refentrytitle><phrase>sparse_keymap_report_event</phrase></refentrytitle>
52875 <manvolnum>9</manvolnum>
52876 <refmiscinfo class="version">4.1.27</refmiscinfo>
52877</refmeta>
52878<refnamediv>
52879 <refname>sparse_keymap_report_event</refname>
52880 <refpurpose>
52881     report event corresponding to given scancode
52882 </refpurpose>
52883</refnamediv>
52884<refsynopsisdiv>
52885 <title>Synopsis</title>
52886  <funcsynopsis><funcprototype>
52887   <funcdef>bool <function>sparse_keymap_report_event </function></funcdef>
52888   <paramdef>struct input_dev * <parameter>dev</parameter></paramdef>
52889   <paramdef>unsigned int <parameter>code</parameter></paramdef>
52890   <paramdef>unsigned int <parameter>value</parameter></paramdef>
52891   <paramdef>bool <parameter>autorelease</parameter></paramdef>
52892  </funcprototype></funcsynopsis>
52893</refsynopsisdiv>
52894<refsect1>
52895 <title>Arguments</title>
52896 <variablelist>
52897  <varlistentry>
52898   <term><parameter>dev</parameter></term>
52899   <listitem>
52900    <para>
52901     Input device using sparse keymap
52902    </para>
52903   </listitem>
52904  </varlistentry>
52905  <varlistentry>
52906   <term><parameter>code</parameter></term>
52907   <listitem>
52908    <para>
52909     Scan code
52910    </para>
52911   </listitem>
52912  </varlistentry>
52913  <varlistentry>
52914   <term><parameter>value</parameter></term>
52915   <listitem>
52916    <para>
52917     Value that should be reported (ignored by <constant>KE_SW</constant> entries)
52918    </para>
52919   </listitem>
52920  </varlistentry>
52921  <varlistentry>
52922   <term><parameter>autorelease</parameter></term>
52923   <listitem>
52924    <para>
52925     Signals whether release event should be emitted for <constant>KE_KEY</constant>
52926     entries right after reporting press event, ignored by all other
52927     entries
52928    </para>
52929   </listitem>
52930  </varlistentry>
52931 </variablelist>
52932</refsect1>
52933<refsect1>
52934<title>Description</title>
52935<para>
52936   This function is used to perform lookup in an input device using sparse
52937   keymap and report corresponding event. Returns <constant>true</constant> if lookup was
52938   successful and <constant>false</constant> otherwise.
52939</para>
52940</refsect1>
52941</refentry>
52942
52943     </sect1>
52944  </chapter>
52945
52946  <chapter id="spi">
52947      <title>Serial Peripheral Interface (SPI)</title>
52948  <para>
52949	SPI is the "Serial Peripheral Interface", widely used with
52950	embedded systems because it is a simple and efficient
52951	interface:  basically a multiplexed shift register.
52952	Its three signal wires hold a clock (SCK, often in the range
52953	of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
52954	a "Master In, Slave Out" (MISO) data line.
52955	SPI is a full duplex protocol; for each bit shifted out the
52956	MOSI line (one per clock) another is shifted in on the MISO line.
52957	Those bits are assembled into words of various sizes on the
52958	way to and from system memory.
52959	An additional chipselect line is usually active-low (nCS);
52960	four signals are normally used for each peripheral, plus
52961	sometimes an interrupt.
52962  </para>
52963  <para>
52964	The SPI bus facilities listed here provide a generalized
52965	interface to declare SPI busses and devices, manage them
52966	according to the standard Linux driver model, and perform
52967	input/output operations.
52968	At this time, only "master" side interfaces are supported,
52969	where Linux talks to SPI peripherals and does not implement
52970	such a peripheral itself.
52971	(Interfaces to support implementing SPI slaves would
52972	necessarily look different.)
52973  </para>
52974  <para>
52975	The programming interface is structured around two kinds of driver,
52976	and two kinds of device.
52977	A "Controller Driver" abstracts the controller hardware, which may
52978	be as simple as a set of GPIO pins or as complex as a pair of FIFOs
52979	connected to dual DMA engines on the other side of the SPI shift
52980	register (maximizing throughput).  Such drivers bridge between
52981	whatever bus they sit on (often the platform bus) and SPI, and
52982	expose the SPI side of their device as a
52983	<structname>struct spi_master</structname>.
52984	SPI devices are children of that master, represented as a
52985	<structname>struct spi_device</structname> and manufactured from
52986	<structname>struct spi_board_info</structname> descriptors which
52987	are usually provided by board-specific initialization code.
52988	A <structname>struct spi_driver</structname> is called a
52989	"Protocol Driver", and is bound to a spi_device using normal
52990	driver model calls.
52991  </para>
52992  <para>
52993	The I/O model is a set of queued messages.  Protocol drivers
52994	submit one or more <structname>struct spi_message</structname>
52995	objects, which are processed and completed asynchronously.
52996	(There are synchronous wrappers, however.)  Messages are
52997	built from one or more <structname>struct spi_transfer</structname>
52998	objects, each of which wraps a full duplex SPI transfer.
52999	A variety of protocol tweaking options are needed, because
53000	different chips adopt very different policies for how they
53001	use the bits transferred with SPI.
53002  </para>
53003<!-- include/linux/spi/spi.h -->
53004<refentry id="API-struct-spi-device">
53005<refentryinfo>
53006 <title>LINUX</title>
53007 <productname>Kernel Hackers Manual</productname>
53008 <date>July 2017</date>
53009</refentryinfo>
53010<refmeta>
53011 <refentrytitle><phrase>struct spi_device</phrase></refentrytitle>
53012 <manvolnum>9</manvolnum>
53013 <refmiscinfo class="version">4.1.27</refmiscinfo>
53014</refmeta>
53015<refnamediv>
53016 <refname>struct spi_device</refname>
53017 <refpurpose>
53018  Master side proxy for an SPI slave device
53019 </refpurpose>
53020</refnamediv>
53021<refsynopsisdiv>
53022 <title>Synopsis</title>
53023  <programlisting>
53024struct spi_device {
53025  struct device dev;
53026  struct spi_master * master;
53027  u32 max_speed_hz;
53028  u8 chip_select;
53029  u8 bits_per_word;
53030  u16 mode;
53031#define SPI_CPHA	0x01
53032#define SPI_CPOL	0x02
53033#define SPI_MODE_0	(0|0)
53034#define SPI_MODE_1	(0|SPI_CPHA)
53035#define SPI_MODE_2	(SPI_CPOL|0)
53036#define SPI_MODE_3	(SPI_CPOL|SPI_CPHA)
53037#define SPI_CS_HIGH	0x04
53038#define SPI_LSB_FIRST	0x08
53039#define SPI_3WIRE	0x10
53040#define SPI_LOOP	0x20
53041#define SPI_NO_CS	0x40
53042#define SPI_READY	0x80
53043#define SPI_TX_DUAL	0x100
53044#define SPI_TX_QUAD	0x200
53045#define SPI_RX_DUAL	0x400
53046#define SPI_RX_QUAD	0x800
53047  int irq;
53048  void * controller_state;
53049  void * controller_data;
53050  char modalias[SPI_NAME_SIZE];
53051  int cs_gpio;
53052};  </programlisting>
53053</refsynopsisdiv>
53054 <refsect1>
53055  <title>Members</title>
53056  <variablelist>
53057    <varlistentry>      <term>dev</term>
53058      <listitem><para>
53059Driver model representation of the device.
53060      </para></listitem>
53061    </varlistentry>
53062    <varlistentry>      <term>master</term>
53063      <listitem><para>
53064SPI controller used with the device.
53065      </para></listitem>
53066    </varlistentry>
53067    <varlistentry>      <term>max_speed_hz</term>
53068      <listitem><para>
53069Maximum clock rate to be used with this chip
53070(on this board); may be changed by the device's driver.
53071The spi_transfer.speed_hz can override this for each transfer.
53072      </para></listitem>
53073    </varlistentry>
53074    <varlistentry>      <term>chip_select</term>
53075      <listitem><para>
53076Chipselect, distinguishing chips handled by <parameter>master</parameter>.
53077      </para></listitem>
53078    </varlistentry>
53079    <varlistentry>      <term>bits_per_word</term>
53080      <listitem><para>
53081Data transfers involve one or more words; word sizes
53082like eight or 12 bits are common.  In-memory wordsizes are
53083powers of two bytes (e.g. 20 bit samples use 32 bits).
53084This may be changed by the device's driver, or left at the
53085default (0) indicating protocol words are eight bit bytes.
53086The spi_transfer.bits_per_word can override this for each transfer.
53087      </para></listitem>
53088    </varlistentry>
53089    <varlistentry>      <term>mode</term>
53090      <listitem><para>
53091The spi mode defines how data is clocked out and in.
53092This may be changed by the device's driver.
53093The <quote>active low</quote> default for chipselect mode can be overridden
53094(by specifying SPI_CS_HIGH) as can the <quote>MSB first</quote> default for
53095each word in a transfer (by specifying SPI_LSB_FIRST).
53096      </para></listitem>
53097    </varlistentry>
53098    <varlistentry>      <term>irq</term>
53099      <listitem><para>
53100Negative, or the number passed to <function>request_irq</function> to receive
53101interrupts from this device.
53102      </para></listitem>
53103    </varlistentry>
53104    <varlistentry>      <term>controller_state</term>
53105      <listitem><para>
53106Controller's runtime state
53107      </para></listitem>
53108    </varlistentry>
53109    <varlistentry>      <term>controller_data</term>
53110      <listitem><para>
53111Board-specific definitions for controller, such as
53112FIFO initialization parameters; from board_info.controller_data
53113      </para></listitem>
53114    </varlistentry>
53115    <varlistentry>      <term>modalias[SPI_NAME_SIZE]</term>
53116      <listitem><para>
53117Name of the driver to use with this device, or an alias
53118for that name.  This appears in the sysfs <quote>modalias</quote> attribute
53119for driver coldplugging, and in uevents used for hotplugging
53120      </para></listitem>
53121    </varlistentry>
53122    <varlistentry>      <term>cs_gpio</term>
53123      <listitem><para>
53124gpio number of the chipselect line (optional, -ENOENT when
53125when not using a GPIO line)
53126      </para></listitem>
53127    </varlistentry>
53128  </variablelist>
53129 </refsect1>
53130<refsect1>
53131<title>Description</title>
53132<para>
53133   A <parameter>spi_device</parameter> is used to interchange data between an SPI slave
53134   (usually a discrete chip) and CPU memory.
53135   </para><para>
53136
53137   In <parameter>dev</parameter>, the platform_data is used to hold information about this
53138   device that's meaningful to the device's protocol driver, but not
53139   to its controller.  One example might be an identifier for a chip
53140   variant with slightly different functionality; another might be
53141   information about how this particular board wires the chip's pins.
53142</para>
53143</refsect1>
53144</refentry>
53145
53146<refentry id="API-struct-spi-driver">
53147<refentryinfo>
53148 <title>LINUX</title>
53149 <productname>Kernel Hackers Manual</productname>
53150 <date>July 2017</date>
53151</refentryinfo>
53152<refmeta>
53153 <refentrytitle><phrase>struct spi_driver</phrase></refentrytitle>
53154 <manvolnum>9</manvolnum>
53155 <refmiscinfo class="version">4.1.27</refmiscinfo>
53156</refmeta>
53157<refnamediv>
53158 <refname>struct spi_driver</refname>
53159 <refpurpose>
53160     Host side <quote>protocol</quote> driver
53161 </refpurpose>
53162</refnamediv>
53163<refsynopsisdiv>
53164 <title>Synopsis</title>
53165  <programlisting>
53166struct spi_driver {
53167  const struct spi_device_id * id_table;
53168  int (* probe) (struct spi_device *spi);
53169  int (* remove) (struct spi_device *spi);
53170  void (* shutdown) (struct spi_device *spi);
53171  struct device_driver driver;
53172};  </programlisting>
53173</refsynopsisdiv>
53174 <refsect1>
53175  <title>Members</title>
53176  <variablelist>
53177    <varlistentry>      <term>id_table</term>
53178      <listitem><para>
53179   List of SPI devices supported by this driver
53180      </para></listitem>
53181    </varlistentry>
53182    <varlistentry>      <term>probe</term>
53183      <listitem><para>
53184   Binds this driver to the spi device.  Drivers can verify
53185   that the device is actually present, and may need to configure
53186   characteristics (such as bits_per_word) which weren't needed for
53187   the initial configuration done during system setup.
53188      </para></listitem>
53189    </varlistentry>
53190    <varlistentry>      <term>remove</term>
53191      <listitem><para>
53192   Unbinds this driver from the spi device
53193      </para></listitem>
53194    </varlistentry>
53195    <varlistentry>      <term>shutdown</term>
53196      <listitem><para>
53197   Standard shutdown callback used during system state
53198   transitions such as powerdown/halt and kexec
53199      </para></listitem>
53200    </varlistentry>
53201    <varlistentry>      <term>driver</term>
53202      <listitem><para>
53203   SPI device drivers should initialize the name and owner
53204   field of this structure.
53205      </para></listitem>
53206    </varlistentry>
53207  </variablelist>
53208 </refsect1>
53209<refsect1>
53210<title>Description</title>
53211<para>
53212   This represents the kind of device driver that uses SPI messages to
53213   interact with the hardware at the other end of a SPI link.  It's called
53214   a <quote>protocol</quote> driver because it works through messages rather than talking
53215   directly to SPI hardware (which is what the underlying SPI controller
53216   driver does to pass those messages).  These protocols are defined in the
53217   specification for the device(s) supported by the driver.
53218   </para><para>
53219
53220   As a rule, those device protocols represent the lowest level interface
53221   supported by a driver, and it will support upper level interfaces too.
53222   Examples of such upper levels include frameworks like MTD, networking,
53223   MMC, RTC, filesystem character device nodes, and hardware monitoring.
53224</para>
53225</refsect1>
53226</refentry>
53227
53228<refentry id="API-spi-unregister-driver">
53229<refentryinfo>
53230 <title>LINUX</title>
53231 <productname>Kernel Hackers Manual</productname>
53232 <date>July 2017</date>
53233</refentryinfo>
53234<refmeta>
53235 <refentrytitle><phrase>spi_unregister_driver</phrase></refentrytitle>
53236 <manvolnum>9</manvolnum>
53237 <refmiscinfo class="version">4.1.27</refmiscinfo>
53238</refmeta>
53239<refnamediv>
53240 <refname>spi_unregister_driver</refname>
53241 <refpurpose>
53242     reverse effect of spi_register_driver
53243 </refpurpose>
53244</refnamediv>
53245<refsynopsisdiv>
53246 <title>Synopsis</title>
53247  <funcsynopsis><funcprototype>
53248   <funcdef>void <function>spi_unregister_driver </function></funcdef>
53249   <paramdef>struct spi_driver * <parameter>sdrv</parameter></paramdef>
53250  </funcprototype></funcsynopsis>
53251</refsynopsisdiv>
53252<refsect1>
53253 <title>Arguments</title>
53254 <variablelist>
53255  <varlistentry>
53256   <term><parameter>sdrv</parameter></term>
53257   <listitem>
53258    <para>
53259     the driver to unregister
53260    </para>
53261   </listitem>
53262  </varlistentry>
53263 </variablelist>
53264</refsect1>
53265<refsect1>
53266<title>Context</title>
53267<para>
53268   can sleep
53269</para>
53270</refsect1>
53271</refentry>
53272
53273<refentry id="API-module-spi-driver">
53274<refentryinfo>
53275 <title>LINUX</title>
53276 <productname>Kernel Hackers Manual</productname>
53277 <date>July 2017</date>
53278</refentryinfo>
53279<refmeta>
53280 <refentrytitle><phrase>module_spi_driver</phrase></refentrytitle>
53281 <manvolnum>9</manvolnum>
53282 <refmiscinfo class="version">4.1.27</refmiscinfo>
53283</refmeta>
53284<refnamediv>
53285 <refname>module_spi_driver</refname>
53286 <refpurpose>
53287     Helper macro for registering a SPI driver
53288 </refpurpose>
53289</refnamediv>
53290<refsynopsisdiv>
53291 <title>Synopsis</title>
53292  <funcsynopsis><funcprototype>
53293   <funcdef> <function>module_spi_driver </function></funcdef>
53294   <paramdef> <parameter>__spi_driver</parameter></paramdef>
53295  </funcprototype></funcsynopsis>
53296</refsynopsisdiv>
53297<refsect1>
53298 <title>Arguments</title>
53299 <variablelist>
53300  <varlistentry>
53301   <term><parameter>__spi_driver</parameter></term>
53302   <listitem>
53303    <para>
53304     spi_driver struct
53305    </para>
53306   </listitem>
53307  </varlistentry>
53308 </variablelist>
53309</refsect1>
53310<refsect1>
53311<title>Description</title>
53312<para>
53313   Helper macro for SPI drivers which do not do anything special in module
53314   init/exit. This eliminates a lot of boilerplate. Each module may only
53315   use this macro once, and calling it replaces <function>module_init</function> and <function>module_exit</function>
53316</para>
53317</refsect1>
53318</refentry>
53319
53320<refentry id="API-struct-spi-master">
53321<refentryinfo>
53322 <title>LINUX</title>
53323 <productname>Kernel Hackers Manual</productname>
53324 <date>July 2017</date>
53325</refentryinfo>
53326<refmeta>
53327 <refentrytitle><phrase>struct spi_master</phrase></refentrytitle>
53328 <manvolnum>9</manvolnum>
53329 <refmiscinfo class="version">4.1.27</refmiscinfo>
53330</refmeta>
53331<refnamediv>
53332 <refname>struct spi_master</refname>
53333 <refpurpose>
53334     interface to SPI master controller
53335 </refpurpose>
53336</refnamediv>
53337<refsynopsisdiv>
53338 <title>Synopsis</title>
53339  <programlisting>
53340struct spi_master {
53341  struct device dev;
53342  struct list_head list;
53343  s16 bus_num;
53344  u16 num_chipselect;
53345  u16 dma_alignment;
53346  u16 mode_bits;
53347  u32 bits_per_word_mask;
53348#define SPI_BPW_MASK(bits) BIT((bits) - 1)
53349#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
53350#define SPI_BPW_RANGE_MASK(min# max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
53351  u32 min_speed_hz;
53352  u32 max_speed_hz;
53353  u16 flags;
53354#define SPI_MASTER_HALF_DUPLEX	BIT(0)
53355#define SPI_MASTER_NO_RX	BIT(1)
53356#define SPI_MASTER_NO_TX	BIT(2)
53357#define SPI_MASTER_MUST_RX      BIT(3)
53358#define SPI_MASTER_MUST_TX      BIT(4)
53359  spinlock_t bus_lock_spinlock;
53360  struct mutex bus_lock_mutex;
53361  bool bus_lock_flag;
53362  int (* setup) (struct spi_device *spi);
53363  int (* transfer) (struct spi_device *spi,struct spi_message *mesg);
53364  void (* cleanup) (struct spi_device *spi);
53365  bool (* can_dma) (struct spi_master *master,struct spi_device *spi,struct spi_transfer *xfer);
53366  bool queued;
53367  struct kthread_worker kworker;
53368  struct task_struct * kworker_task;
53369  struct kthread_work pump_messages;
53370  spinlock_t queue_lock;
53371  struct list_head queue;
53372  struct spi_message * cur_msg;
53373  bool idling;
53374  bool busy;
53375  bool running;
53376  bool rt;
53377  bool auto_runtime_pm;
53378  bool cur_msg_prepared;
53379  bool cur_msg_mapped;
53380  struct completion xfer_completion;
53381  size_t max_dma_len;
53382  int (* prepare_transfer_hardware) (struct spi_master *master);
53383  int (* transfer_one_message) (struct spi_master *master,struct spi_message *mesg);
53384  int (* unprepare_transfer_hardware) (struct spi_master *master);
53385  int (* prepare_message) (struct spi_master *master,struct spi_message *message);
53386  int (* unprepare_message) (struct spi_master *master,struct spi_message *message);
53387  void (* set_cs) (struct spi_device *spi, bool enable);
53388  int (* transfer_one) (struct spi_master *master, struct spi_device *spi,struct spi_transfer *transfer);
53389  void (* handle_err) (struct spi_master *master,struct spi_message *message);
53390  int * cs_gpios;
53391  struct dma_chan * dma_tx;
53392  struct dma_chan * dma_rx;
53393  void * dummy_rx;
53394  void * dummy_tx;
53395};  </programlisting>
53396</refsynopsisdiv>
53397 <refsect1>
53398  <title>Members</title>
53399  <variablelist>
53400    <varlistentry>      <term>dev</term>
53401      <listitem><para>
53402   device interface to this driver
53403      </para></listitem>
53404    </varlistentry>
53405    <varlistentry>      <term>list</term>
53406      <listitem><para>
53407   link with the global spi_master list
53408      </para></listitem>
53409    </varlistentry>
53410    <varlistentry>      <term>bus_num</term>
53411      <listitem><para>
53412   board-specific (and often SOC-specific) identifier for a
53413   given SPI controller.
53414      </para></listitem>
53415    </varlistentry>
53416    <varlistentry>      <term>num_chipselect</term>
53417      <listitem><para>
53418   chipselects are used to distinguish individual
53419   SPI slaves, and are numbered from zero to num_chipselects.
53420   each slave has a chipselect signal, but it's common that not
53421   every chipselect is connected to a slave.
53422      </para></listitem>
53423    </varlistentry>
53424    <varlistentry>      <term>dma_alignment</term>
53425      <listitem><para>
53426   SPI controller constraint on DMA buffers alignment.
53427      </para></listitem>
53428    </varlistentry>
53429    <varlistentry>      <term>mode_bits</term>
53430      <listitem><para>
53431   flags understood by this controller driver
53432      </para></listitem>
53433    </varlistentry>
53434    <varlistentry>      <term>bits_per_word_mask</term>
53435      <listitem><para>
53436   A mask indicating which values of bits_per_word are
53437   supported by the driver. Bit n indicates that a bits_per_word n+1 is
53438   supported. If set, the SPI core will reject any transfer with an
53439   unsupported bits_per_word. If not set, this value is simply ignored,
53440   and it's up to the individual driver to perform any validation.
53441      </para></listitem>
53442    </varlistentry>
53443    <varlistentry>      <term>min_speed_hz</term>
53444      <listitem><para>
53445   Lowest supported transfer speed
53446      </para></listitem>
53447    </varlistentry>
53448    <varlistentry>      <term>max_speed_hz</term>
53449      <listitem><para>
53450   Highest supported transfer speed
53451      </para></listitem>
53452    </varlistentry>
53453    <varlistentry>      <term>flags</term>
53454      <listitem><para>
53455   other constraints relevant to this driver
53456      </para></listitem>
53457    </varlistentry>
53458    <varlistentry>      <term>bus_lock_spinlock</term>
53459      <listitem><para>
53460   spinlock for SPI bus locking
53461      </para></listitem>
53462    </varlistentry>
53463    <varlistentry>      <term>bus_lock_mutex</term>
53464      <listitem><para>
53465   mutex for SPI bus locking
53466      </para></listitem>
53467    </varlistentry>
53468    <varlistentry>      <term>bus_lock_flag</term>
53469      <listitem><para>
53470   indicates that the SPI bus is locked for exclusive use
53471      </para></listitem>
53472    </varlistentry>
53473    <varlistentry>      <term>setup</term>
53474      <listitem><para>
53475   updates the device mode and clocking records used by a
53476   device's SPI controller; protocol code may call this.  This
53477   must fail if an unrecognized or unsupported mode is requested.
53478   It's always safe to call this unless transfers are pending on
53479   the device whose settings are being modified.
53480      </para></listitem>
53481    </varlistentry>
53482    <varlistentry>      <term>transfer</term>
53483      <listitem><para>
53484   adds a message to the controller's transfer queue.
53485      </para></listitem>
53486    </varlistentry>
53487    <varlistentry>      <term>cleanup</term>
53488      <listitem><para>
53489   frees controller-specific state
53490      </para></listitem>
53491    </varlistentry>
53492    <varlistentry>      <term>can_dma</term>
53493      <listitem><para>
53494   determine whether this master supports DMA
53495      </para></listitem>
53496    </varlistentry>
53497    <varlistentry>      <term>queued</term>
53498      <listitem><para>
53499   whether this master is providing an internal message queue
53500      </para></listitem>
53501    </varlistentry>
53502    <varlistentry>      <term>kworker</term>
53503      <listitem><para>
53504   thread struct for message pump
53505      </para></listitem>
53506    </varlistentry>
53507    <varlistentry>      <term>kworker_task</term>
53508      <listitem><para>
53509   pointer to task for message pump kworker thread
53510      </para></listitem>
53511    </varlistentry>
53512    <varlistentry>      <term>pump_messages</term>
53513      <listitem><para>
53514   work struct for scheduling work to the message pump
53515      </para></listitem>
53516    </varlistentry>
53517    <varlistentry>      <term>queue_lock</term>
53518      <listitem><para>
53519   spinlock to syncronise access to message queue
53520      </para></listitem>
53521    </varlistentry>
53522    <varlistentry>      <term>queue</term>
53523      <listitem><para>
53524   message queue
53525      </para></listitem>
53526    </varlistentry>
53527    <varlistentry>      <term>cur_msg</term>
53528      <listitem><para>
53529   the currently in-flight message
53530      </para></listitem>
53531    </varlistentry>
53532    <varlistentry>      <term>idling</term>
53533      <listitem><para>
53534   the device is entering idle state
53535      </para></listitem>
53536    </varlistentry>
53537    <varlistentry>      <term>busy</term>
53538      <listitem><para>
53539   message pump is busy
53540      </para></listitem>
53541    </varlistentry>
53542    <varlistentry>      <term>running</term>
53543      <listitem><para>
53544   message pump is running
53545      </para></listitem>
53546    </varlistentry>
53547    <varlistentry>      <term>rt</term>
53548      <listitem><para>
53549   whether this queue is set to run as a realtime task
53550      </para></listitem>
53551    </varlistentry>
53552    <varlistentry>      <term>auto_runtime_pm</term>
53553      <listitem><para>
53554   the core should ensure a runtime PM reference is held
53555   while the hardware is prepared, using the parent
53556   device for the spidev
53557      </para></listitem>
53558    </varlistentry>
53559    <varlistentry>      <term>cur_msg_prepared</term>
53560      <listitem><para>
53561   spi_prepare_message was called for the currently
53562   in-flight message
53563      </para></listitem>
53564    </varlistentry>
53565    <varlistentry>      <term>cur_msg_mapped</term>
53566      <listitem><para>
53567   message has been mapped for DMA
53568      </para></listitem>
53569    </varlistentry>
53570    <varlistentry>      <term>xfer_completion</term>
53571      <listitem><para>
53572   used by core <function>transfer_one_message</function>
53573      </para></listitem>
53574    </varlistentry>
53575    <varlistentry>      <term>max_dma_len</term>
53576      <listitem><para>
53577   Maximum length of a DMA transfer for the device.
53578      </para></listitem>
53579    </varlistentry>
53580    <varlistentry>      <term>prepare_transfer_hardware</term>
53581      <listitem><para>
53582   a message will soon arrive from the queue
53583   so the subsystem requests the driver to prepare the transfer hardware
53584   by issuing this call
53585      </para></listitem>
53586    </varlistentry>
53587    <varlistentry>      <term>transfer_one_message</term>
53588      <listitem><para>
53589   the subsystem calls the driver to transfer a single
53590   message while queuing transfers that arrive in the meantime. When the
53591   driver is finished with this message, it must call
53592   <function>spi_finalize_current_message</function> so the subsystem can issue the next
53593   message
53594      </para></listitem>
53595    </varlistentry>
53596    <varlistentry>      <term>unprepare_transfer_hardware</term>
53597      <listitem><para>
53598   there are currently no more messages on the
53599   queue so the subsystem notifies the driver that it may relax the
53600   hardware by issuing this call
53601      </para></listitem>
53602    </varlistentry>
53603    <varlistentry>      <term>prepare_message</term>
53604      <listitem><para>
53605   set up the controller to transfer a single message,
53606   for example doing DMA mapping.  Called from threaded
53607   context.
53608      </para></listitem>
53609    </varlistentry>
53610    <varlistentry>      <term>unprepare_message</term>
53611      <listitem><para>
53612   undo any work done by <function>prepare_message</function>.
53613      </para></listitem>
53614    </varlistentry>
53615    <varlistentry>      <term>set_cs</term>
53616      <listitem><para>
53617   set the logic level of the chip select line.  May be called
53618   from interrupt context.
53619      </para></listitem>
53620    </varlistentry>
53621    <varlistentry>      <term>transfer_one</term>
53622      <listitem><para>
53623   transfer a single spi_transfer.
53624   - return 0 if the transfer is finished,
53625   - return 1 if the transfer is still in progress. When
53626   the driver is finished with this transfer it must
53627   call <function>spi_finalize_current_transfer</function> so the subsystem
53628   can issue the next transfer. Note: transfer_one and
53629   transfer_one_message are mutually exclusive; when both
53630   are set, the generic subsystem does not call your
53631   transfer_one callback.
53632      </para></listitem>
53633    </varlistentry>
53634    <varlistentry>      <term>handle_err</term>
53635      <listitem><para>
53636   the subsystem calls the driver to handle an error that occurs
53637   in the generic implementation of <function>transfer_one_message</function>.
53638      </para></listitem>
53639    </varlistentry>
53640    <varlistentry>      <term>cs_gpios</term>
53641      <listitem><para>
53642   Array of GPIOs to use as chip select lines; one per CS
53643   number. Any individual value may be -ENOENT for CS lines that
53644   are not GPIOs (driven by the SPI controller itself).
53645      </para></listitem>
53646    </varlistentry>
53647    <varlistentry>      <term>dma_tx</term>
53648      <listitem><para>
53649   DMA transmit channel
53650      </para></listitem>
53651    </varlistentry>
53652    <varlistentry>      <term>dma_rx</term>
53653      <listitem><para>
53654   DMA receive channel
53655      </para></listitem>
53656    </varlistentry>
53657    <varlistentry>      <term>dummy_rx</term>
53658      <listitem><para>
53659   dummy receive buffer for full-duplex devices
53660      </para></listitem>
53661    </varlistentry>
53662    <varlistentry>      <term>dummy_tx</term>
53663      <listitem><para>
53664   dummy transmit buffer for full-duplex devices
53665      </para></listitem>
53666    </varlistentry>
53667  </variablelist>
53668 </refsect1>
53669<refsect1>
53670<title>Description</title>
53671<para>
53672   Each SPI master controller can communicate with one or more <parameter>spi_device</parameter>
53673   children.  These make a small bus, sharing MOSI, MISO and SCK signals
53674   but not chip select signals.  Each device may be configured to use a
53675   different clock rate, since those shared signals are ignored unless
53676   the chip is selected.
53677   </para><para>
53678
53679   The driver for an SPI controller manages access to those devices through
53680   a queue of spi_message transactions, copying data between CPU memory and
53681   an SPI slave device.  For each such message it queues, it calls the
53682   message's completion function when the transaction completes.
53683</para>
53684</refsect1>
53685</refentry>
53686
53687<refentry id="API-struct-spi-transfer">
53688<refentryinfo>
53689 <title>LINUX</title>
53690 <productname>Kernel Hackers Manual</productname>
53691 <date>July 2017</date>
53692</refentryinfo>
53693<refmeta>
53694 <refentrytitle><phrase>struct spi_transfer</phrase></refentrytitle>
53695 <manvolnum>9</manvolnum>
53696 <refmiscinfo class="version">4.1.27</refmiscinfo>
53697</refmeta>
53698<refnamediv>
53699 <refname>struct spi_transfer</refname>
53700 <refpurpose>
53701     a read/write buffer pair
53702 </refpurpose>
53703</refnamediv>
53704<refsynopsisdiv>
53705 <title>Synopsis</title>
53706  <programlisting>
53707struct spi_transfer {
53708  const void * tx_buf;
53709  void * rx_buf;
53710  unsigned len;
53711  dma_addr_t tx_dma;
53712  dma_addr_t rx_dma;
53713  struct sg_table tx_sg;
53714  struct sg_table rx_sg;
53715  unsigned cs_change:1;
53716  unsigned tx_nbits:3;
53717  unsigned rx_nbits:3;
53718#define SPI_NBITS_SINGLE	0x01
53719#define SPI_NBITS_DUAL		0x02
53720#define SPI_NBITS_QUAD		0x04
53721  u8 bits_per_word;
53722  u16 delay_usecs;
53723  u32 speed_hz;
53724  struct list_head transfer_list;
53725};  </programlisting>
53726</refsynopsisdiv>
53727 <refsect1>
53728  <title>Members</title>
53729  <variablelist>
53730    <varlistentry>      <term>tx_buf</term>
53731      <listitem><para>
53732   data to be written (dma-safe memory), or NULL
53733      </para></listitem>
53734    </varlistentry>
53735    <varlistentry>      <term>rx_buf</term>
53736      <listitem><para>
53737   data to be read (dma-safe memory), or NULL
53738      </para></listitem>
53739    </varlistentry>
53740    <varlistentry>      <term>len</term>
53741      <listitem><para>
53742   size of rx and tx buffers (in bytes)
53743      </para></listitem>
53744    </varlistentry>
53745    <varlistentry>      <term>tx_dma</term>
53746      <listitem><para>
53747   DMA address of tx_buf, if <parameter>spi_message</parameter>.is_dma_mapped
53748      </para></listitem>
53749    </varlistentry>
53750    <varlistentry>      <term>rx_dma</term>
53751      <listitem><para>
53752   DMA address of rx_buf, if <parameter>spi_message</parameter>.is_dma_mapped
53753      </para></listitem>
53754    </varlistentry>
53755    <varlistentry>      <term>tx_sg</term>
53756      <listitem><para>
53757   Scatterlist for transmit, currently not for client use
53758      </para></listitem>
53759    </varlistentry>
53760    <varlistentry>      <term>rx_sg</term>
53761      <listitem><para>
53762   Scatterlist for receive, currently not for client use
53763      </para></listitem>
53764    </varlistentry>
53765    <varlistentry>      <term>cs_change</term>
53766      <listitem><para>
53767   affects chipselect after this transfer completes
53768      </para></listitem>
53769    </varlistentry>
53770    <varlistentry>      <term>tx_nbits</term>
53771      <listitem><para>
53772   number of bits used for writing. If 0 the default
53773   (SPI_NBITS_SINGLE) is used.
53774      </para></listitem>
53775    </varlistentry>
53776    <varlistentry>      <term>rx_nbits</term>
53777      <listitem><para>
53778   number of bits used for reading. If 0 the default
53779   (SPI_NBITS_SINGLE) is used.
53780      </para></listitem>
53781    </varlistentry>
53782    <varlistentry>      <term>bits_per_word</term>
53783      <listitem><para>
53784   select a bits_per_word other than the device default
53785   for this transfer. If 0 the default (from <parameter>spi_device</parameter>) is used.
53786      </para></listitem>
53787    </varlistentry>
53788    <varlistentry>      <term>delay_usecs</term>
53789      <listitem><para>
53790   microseconds to delay after this transfer before
53791   (optionally) changing the chipselect status, then starting
53792   the next transfer or completing this <parameter>spi_message</parameter>.
53793      </para></listitem>
53794    </varlistentry>
53795    <varlistentry>      <term>speed_hz</term>
53796      <listitem><para>
53797   Select a speed other than the device default for this
53798   transfer. If 0 the default (from <parameter>spi_device</parameter>) is used.
53799      </para></listitem>
53800    </varlistentry>
53801    <varlistentry>      <term>transfer_list</term>
53802      <listitem><para>
53803   transfers are sequenced through <parameter>spi_message</parameter>.transfers
53804      </para></listitem>
53805    </varlistentry>
53806  </variablelist>
53807 </refsect1>
53808<refsect1>
53809<title>Description</title>
53810<para>
53811   SPI transfers always write the same number of bytes as they read.
53812   Protocol drivers should always provide <parameter>rx_buf</parameter> and/or <parameter>tx_buf</parameter>.
53813   In some cases, they may also want to provide DMA addresses for
53814   the data being transferred; that may reduce overhead, when the
53815   underlying driver uses dma.
53816   </para><para>
53817
53818   If the transmit buffer is null, zeroes will be shifted out
53819   while filling <parameter>rx_buf</parameter>.  If the receive buffer is null, the data
53820   shifted in will be discarded.  Only <quote>len</quote> bytes shift out (or in).
53821   It's an error to try to shift out a partial word.  (For example, by
53822   shifting out three bytes with word size of sixteen or twenty bits;
53823   the former uses two bytes per word, the latter uses four bytes.)
53824   </para><para>
53825
53826   In-memory data values are always in native CPU byte order, translated
53827   from the wire byte order (big-endian except with SPI_LSB_FIRST).  So
53828   for example when bits_per_word is sixteen, buffers are 2N bytes long
53829   (<parameter>len</parameter> = 2N) and hold N sixteen bit words in CPU byte order.
53830   </para><para>
53831
53832   When the word size of the SPI transfer is not a power-of-two multiple
53833   of eight bits, those in-memory words include extra bits.  In-memory
53834   words are always seen by protocol drivers as right-justified, so the
53835   undefined (rx) or unused (tx) bits are always the most significant bits.
53836   </para><para>
53837
53838   All SPI transfers start with the relevant chipselect active.  Normally
53839   it stays selected until after the last transfer in a message.  Drivers
53840   can affect the chipselect signal using cs_change.
53841   </para><para>
53842
53843   (i) If the transfer isn't the last one in the message, this flag is
53844   used to make the chipselect briefly go inactive in the middle of the
53845   message.  Toggling chipselect in this way may be needed to terminate
53846   a chip command, letting a single spi_message perform all of group of
53847   chip transactions together.
53848   </para><para>
53849
53850   (ii) When the transfer is the last one in the message, the chip may
53851   stay selected until the next transfer.  On multi-device SPI busses
53852   with nothing blocking messages going to other devices, this is just
53853   a performance hint; starting a message to another device deselects
53854   this one.  But in other cases, this can be used to ensure correctness.
53855   Some devices need protocol transactions to be built from a series of
53856   spi_message submissions, where the content of one message is determined
53857   by the results of previous messages and where the whole transaction
53858   ends when the chipselect goes intactive.
53859   </para><para>
53860
53861   When SPI can transfer in 1x,2x or 4x. It can get this transfer information
53862   from device through <parameter>tx_nbits</parameter> and <parameter>rx_nbits</parameter>. In Bi-direction, these
53863   two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
53864   SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
53865   </para><para>
53866
53867   The code that submits an spi_message (and its spi_transfers)
53868   to the lower layers is responsible for managing its memory.
53869   Zero-initialize every field you don't set up explicitly, to
53870   insulate against future API updates.  After you submit a message
53871   and its transfers, ignore them until its completion callback.
53872</para>
53873</refsect1>
53874</refentry>
53875
53876<refentry id="API-struct-spi-message">
53877<refentryinfo>
53878 <title>LINUX</title>
53879 <productname>Kernel Hackers Manual</productname>
53880 <date>July 2017</date>
53881</refentryinfo>
53882<refmeta>
53883 <refentrytitle><phrase>struct spi_message</phrase></refentrytitle>
53884 <manvolnum>9</manvolnum>
53885 <refmiscinfo class="version">4.1.27</refmiscinfo>
53886</refmeta>
53887<refnamediv>
53888 <refname>struct spi_message</refname>
53889 <refpurpose>
53890     one multi-segment SPI transaction
53891 </refpurpose>
53892</refnamediv>
53893<refsynopsisdiv>
53894 <title>Synopsis</title>
53895  <programlisting>
53896struct spi_message {
53897  struct list_head transfers;
53898  struct spi_device * spi;
53899  unsigned is_dma_mapped:1;
53900  void (* complete) (void *context);
53901  void * context;
53902  unsigned frame_length;
53903  unsigned actual_length;
53904  int status;
53905  struct list_head queue;
53906  void * state;
53907};  </programlisting>
53908</refsynopsisdiv>
53909 <refsect1>
53910  <title>Members</title>
53911  <variablelist>
53912    <varlistentry>      <term>transfers</term>
53913      <listitem><para>
53914   list of transfer segments in this transaction
53915      </para></listitem>
53916    </varlistentry>
53917    <varlistentry>      <term>spi</term>
53918      <listitem><para>
53919   SPI device to which the transaction is queued
53920      </para></listitem>
53921    </varlistentry>
53922    <varlistentry>      <term>is_dma_mapped</term>
53923      <listitem><para>
53924   if true, the caller provided both dma and cpu virtual
53925   addresses for each transfer buffer
53926      </para></listitem>
53927    </varlistentry>
53928    <varlistentry>      <term>complete</term>
53929      <listitem><para>
53930   called to report transaction completions
53931      </para></listitem>
53932    </varlistentry>
53933    <varlistentry>      <term>context</term>
53934      <listitem><para>
53935   the argument to <function>complete</function> when it's called
53936      </para></listitem>
53937    </varlistentry>
53938    <varlistentry>      <term>frame_length</term>
53939      <listitem><para>
53940   the total number of bytes in the message
53941      </para></listitem>
53942    </varlistentry>
53943    <varlistentry>      <term>actual_length</term>
53944      <listitem><para>
53945   the total number of bytes that were transferred in all
53946   successful segments
53947      </para></listitem>
53948    </varlistentry>
53949    <varlistentry>      <term>status</term>
53950      <listitem><para>
53951   zero for success, else negative errno
53952      </para></listitem>
53953    </varlistentry>
53954    <varlistentry>      <term>queue</term>
53955      <listitem><para>
53956   for use by whichever driver currently owns the message
53957      </para></listitem>
53958    </varlistentry>
53959    <varlistentry>      <term>state</term>
53960      <listitem><para>
53961   for use by whichever driver currently owns the message
53962      </para></listitem>
53963    </varlistentry>
53964  </variablelist>
53965 </refsect1>
53966<refsect1>
53967<title>Description</title>
53968<para>
53969   A <parameter>spi_message</parameter> is used to execute an atomic sequence of data transfers,
53970   each represented by a struct spi_transfer.  The sequence is <quote>atomic</quote>
53971   in the sense that no other spi_message may use that SPI bus until that
53972   sequence completes.  On some systems, many such sequences can execute as
53973   as single programmed DMA transfer.  On all systems, these messages are
53974   queued, and might complete after transactions to other devices.  Messages
53975   sent to a given spi_device are always executed in FIFO order.
53976   </para><para>
53977
53978   The code that submits an spi_message (and its spi_transfers)
53979   to the lower layers is responsible for managing its memory.
53980   Zero-initialize every field you don't set up explicitly, to
53981   insulate against future API updates.  After you submit a message
53982   and its transfers, ignore them until its completion callback.
53983</para>
53984</refsect1>
53985</refentry>
53986
53987<refentry id="API-spi-message-init-with-transfers">
53988<refentryinfo>
53989 <title>LINUX</title>
53990 <productname>Kernel Hackers Manual</productname>
53991 <date>July 2017</date>
53992</refentryinfo>
53993<refmeta>
53994 <refentrytitle><phrase>spi_message_init_with_transfers</phrase></refentrytitle>
53995 <manvolnum>9</manvolnum>
53996 <refmiscinfo class="version">4.1.27</refmiscinfo>
53997</refmeta>
53998<refnamediv>
53999 <refname>spi_message_init_with_transfers</refname>
54000 <refpurpose>
54001     Initialize spi_message and append transfers
54002 </refpurpose>
54003</refnamediv>
54004<refsynopsisdiv>
54005 <title>Synopsis</title>
54006  <funcsynopsis><funcprototype>
54007   <funcdef>void <function>spi_message_init_with_transfers </function></funcdef>
54008   <paramdef>struct spi_message * <parameter>m</parameter></paramdef>
54009   <paramdef>struct spi_transfer * <parameter>xfers</parameter></paramdef>
54010   <paramdef>unsigned int <parameter>num_xfers</parameter></paramdef>
54011  </funcprototype></funcsynopsis>
54012</refsynopsisdiv>
54013<refsect1>
54014 <title>Arguments</title>
54015 <variablelist>
54016  <varlistentry>
54017   <term><parameter>m</parameter></term>
54018   <listitem>
54019    <para>
54020     spi_message to be initialized
54021    </para>
54022   </listitem>
54023  </varlistentry>
54024  <varlistentry>
54025   <term><parameter>xfers</parameter></term>
54026   <listitem>
54027    <para>
54028     An array of spi transfers
54029    </para>
54030   </listitem>
54031  </varlistentry>
54032  <varlistentry>
54033   <term><parameter>num_xfers</parameter></term>
54034   <listitem>
54035    <para>
54036     Number of items in the xfer array
54037    </para>
54038   </listitem>
54039  </varlistentry>
54040 </variablelist>
54041</refsect1>
54042<refsect1>
54043<title>Description</title>
54044<para>
54045   This function initializes the given spi_message and adds each spi_transfer in
54046   the given array to the message.
54047</para>
54048</refsect1>
54049</refentry>
54050
54051<refentry id="API-spi-write">
54052<refentryinfo>
54053 <title>LINUX</title>
54054 <productname>Kernel Hackers Manual</productname>
54055 <date>July 2017</date>
54056</refentryinfo>
54057<refmeta>
54058 <refentrytitle><phrase>spi_write</phrase></refentrytitle>
54059 <manvolnum>9</manvolnum>
54060 <refmiscinfo class="version">4.1.27</refmiscinfo>
54061</refmeta>
54062<refnamediv>
54063 <refname>spi_write</refname>
54064 <refpurpose>
54065     SPI synchronous write
54066 </refpurpose>
54067</refnamediv>
54068<refsynopsisdiv>
54069 <title>Synopsis</title>
54070  <funcsynopsis><funcprototype>
54071   <funcdef>int <function>spi_write </function></funcdef>
54072   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
54073   <paramdef>const void * <parameter>buf</parameter></paramdef>
54074   <paramdef>size_t <parameter>len</parameter></paramdef>
54075  </funcprototype></funcsynopsis>
54076</refsynopsisdiv>
54077<refsect1>
54078 <title>Arguments</title>
54079 <variablelist>
54080  <varlistentry>
54081   <term><parameter>spi</parameter></term>
54082   <listitem>
54083    <para>
54084     device to which data will be written
54085    </para>
54086   </listitem>
54087  </varlistentry>
54088  <varlistentry>
54089   <term><parameter>buf</parameter></term>
54090   <listitem>
54091    <para>
54092     data buffer
54093    </para>
54094   </listitem>
54095  </varlistentry>
54096  <varlistentry>
54097   <term><parameter>len</parameter></term>
54098   <listitem>
54099    <para>
54100     data buffer size
54101    </para>
54102   </listitem>
54103  </varlistentry>
54104 </variablelist>
54105</refsect1>
54106<refsect1>
54107<title>Context</title>
54108<para>
54109   can sleep
54110</para>
54111</refsect1>
54112<refsect1>
54113<title>Description</title>
54114<para>
54115   This writes the buffer and returns zero or a negative error code.
54116   Callable only from contexts that can sleep.
54117</para>
54118</refsect1>
54119</refentry>
54120
54121<refentry id="API-spi-read">
54122<refentryinfo>
54123 <title>LINUX</title>
54124 <productname>Kernel Hackers Manual</productname>
54125 <date>July 2017</date>
54126</refentryinfo>
54127<refmeta>
54128 <refentrytitle><phrase>spi_read</phrase></refentrytitle>
54129 <manvolnum>9</manvolnum>
54130 <refmiscinfo class="version">4.1.27</refmiscinfo>
54131</refmeta>
54132<refnamediv>
54133 <refname>spi_read</refname>
54134 <refpurpose>
54135     SPI synchronous read
54136 </refpurpose>
54137</refnamediv>
54138<refsynopsisdiv>
54139 <title>Synopsis</title>
54140  <funcsynopsis><funcprototype>
54141   <funcdef>int <function>spi_read </function></funcdef>
54142   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
54143   <paramdef>void * <parameter>buf</parameter></paramdef>
54144   <paramdef>size_t <parameter>len</parameter></paramdef>
54145  </funcprototype></funcsynopsis>
54146</refsynopsisdiv>
54147<refsect1>
54148 <title>Arguments</title>
54149 <variablelist>
54150  <varlistentry>
54151   <term><parameter>spi</parameter></term>
54152   <listitem>
54153    <para>
54154     device from which data will be read
54155    </para>
54156   </listitem>
54157  </varlistentry>
54158  <varlistentry>
54159   <term><parameter>buf</parameter></term>
54160   <listitem>
54161    <para>
54162     data buffer
54163    </para>
54164   </listitem>
54165  </varlistentry>
54166  <varlistentry>
54167   <term><parameter>len</parameter></term>
54168   <listitem>
54169    <para>
54170     data buffer size
54171    </para>
54172   </listitem>
54173  </varlistentry>
54174 </variablelist>
54175</refsect1>
54176<refsect1>
54177<title>Context</title>
54178<para>
54179   can sleep
54180</para>
54181</refsect1>
54182<refsect1>
54183<title>Description</title>
54184<para>
54185   This reads the buffer and returns zero or a negative error code.
54186   Callable only from contexts that can sleep.
54187</para>
54188</refsect1>
54189</refentry>
54190
54191<refentry id="API-spi-sync-transfer">
54192<refentryinfo>
54193 <title>LINUX</title>
54194 <productname>Kernel Hackers Manual</productname>
54195 <date>July 2017</date>
54196</refentryinfo>
54197<refmeta>
54198 <refentrytitle><phrase>spi_sync_transfer</phrase></refentrytitle>
54199 <manvolnum>9</manvolnum>
54200 <refmiscinfo class="version">4.1.27</refmiscinfo>
54201</refmeta>
54202<refnamediv>
54203 <refname>spi_sync_transfer</refname>
54204 <refpurpose>
54205     synchronous SPI data transfer
54206 </refpurpose>
54207</refnamediv>
54208<refsynopsisdiv>
54209 <title>Synopsis</title>
54210  <funcsynopsis><funcprototype>
54211   <funcdef>int <function>spi_sync_transfer </function></funcdef>
54212   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
54213   <paramdef>struct spi_transfer * <parameter>xfers</parameter></paramdef>
54214   <paramdef>unsigned int <parameter>num_xfers</parameter></paramdef>
54215  </funcprototype></funcsynopsis>
54216</refsynopsisdiv>
54217<refsect1>
54218 <title>Arguments</title>
54219 <variablelist>
54220  <varlistentry>
54221   <term><parameter>spi</parameter></term>
54222   <listitem>
54223    <para>
54224     device with which data will be exchanged
54225    </para>
54226   </listitem>
54227  </varlistentry>
54228  <varlistentry>
54229   <term><parameter>xfers</parameter></term>
54230   <listitem>
54231    <para>
54232     An array of spi_transfers
54233    </para>
54234   </listitem>
54235  </varlistentry>
54236  <varlistentry>
54237   <term><parameter>num_xfers</parameter></term>
54238   <listitem>
54239    <para>
54240     Number of items in the xfer array
54241    </para>
54242   </listitem>
54243  </varlistentry>
54244 </variablelist>
54245</refsect1>
54246<refsect1>
54247<title>Context</title>
54248<para>
54249   can sleep
54250</para>
54251</refsect1>
54252<refsect1>
54253<title>Description</title>
54254<para>
54255   Does a synchronous SPI data transfer of the given spi_transfer array.
54256   </para><para>
54257
54258   For more specific semantics see <function>spi_sync</function>.
54259   </para><para>
54260
54261   It returns zero on success, else a negative error code.
54262</para>
54263</refsect1>
54264</refentry>
54265
54266<refentry id="API-spi-w8r8">
54267<refentryinfo>
54268 <title>LINUX</title>
54269 <productname>Kernel Hackers Manual</productname>
54270 <date>July 2017</date>
54271</refentryinfo>
54272<refmeta>
54273 <refentrytitle><phrase>spi_w8r8</phrase></refentrytitle>
54274 <manvolnum>9</manvolnum>
54275 <refmiscinfo class="version">4.1.27</refmiscinfo>
54276</refmeta>
54277<refnamediv>
54278 <refname>spi_w8r8</refname>
54279 <refpurpose>
54280     SPI synchronous 8 bit write followed by 8 bit read
54281 </refpurpose>
54282</refnamediv>
54283<refsynopsisdiv>
54284 <title>Synopsis</title>
54285  <funcsynopsis><funcprototype>
54286   <funcdef>ssize_t <function>spi_w8r8 </function></funcdef>
54287   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
54288   <paramdef>u8 <parameter>cmd</parameter></paramdef>
54289  </funcprototype></funcsynopsis>
54290</refsynopsisdiv>
54291<refsect1>
54292 <title>Arguments</title>
54293 <variablelist>
54294  <varlistentry>
54295   <term><parameter>spi</parameter></term>
54296   <listitem>
54297    <para>
54298     device with which data will be exchanged
54299    </para>
54300   </listitem>
54301  </varlistentry>
54302  <varlistentry>
54303   <term><parameter>cmd</parameter></term>
54304   <listitem>
54305    <para>
54306     command to be written before data is read back
54307    </para>
54308   </listitem>
54309  </varlistentry>
54310 </variablelist>
54311</refsect1>
54312<refsect1>
54313<title>Context</title>
54314<para>
54315   can sleep
54316</para>
54317</refsect1>
54318<refsect1>
54319<title>Description</title>
54320<para>
54321   This returns the (unsigned) eight bit number returned by the
54322   device, or else a negative error code.  Callable only from
54323   contexts that can sleep.
54324</para>
54325</refsect1>
54326</refentry>
54327
54328<refentry id="API-spi-w8r16">
54329<refentryinfo>
54330 <title>LINUX</title>
54331 <productname>Kernel Hackers Manual</productname>
54332 <date>July 2017</date>
54333</refentryinfo>
54334<refmeta>
54335 <refentrytitle><phrase>spi_w8r16</phrase></refentrytitle>
54336 <manvolnum>9</manvolnum>
54337 <refmiscinfo class="version">4.1.27</refmiscinfo>
54338</refmeta>
54339<refnamediv>
54340 <refname>spi_w8r16</refname>
54341 <refpurpose>
54342     SPI synchronous 8 bit write followed by 16 bit read
54343 </refpurpose>
54344</refnamediv>
54345<refsynopsisdiv>
54346 <title>Synopsis</title>
54347  <funcsynopsis><funcprototype>
54348   <funcdef>ssize_t <function>spi_w8r16 </function></funcdef>
54349   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
54350   <paramdef>u8 <parameter>cmd</parameter></paramdef>
54351  </funcprototype></funcsynopsis>
54352</refsynopsisdiv>
54353<refsect1>
54354 <title>Arguments</title>
54355 <variablelist>
54356  <varlistentry>
54357   <term><parameter>spi</parameter></term>
54358   <listitem>
54359    <para>
54360     device with which data will be exchanged
54361    </para>
54362   </listitem>
54363  </varlistentry>
54364  <varlistentry>
54365   <term><parameter>cmd</parameter></term>
54366   <listitem>
54367    <para>
54368     command to be written before data is read back
54369    </para>
54370   </listitem>
54371  </varlistentry>
54372 </variablelist>
54373</refsect1>
54374<refsect1>
54375<title>Context</title>
54376<para>
54377   can sleep
54378</para>
54379</refsect1>
54380<refsect1>
54381<title>Description</title>
54382<para>
54383   This returns the (unsigned) sixteen bit number returned by the
54384   device, or else a negative error code.  Callable only from
54385   contexts that can sleep.
54386   </para><para>
54387
54388   The number is returned in wire-order, which is at least sometimes
54389   big-endian.
54390</para>
54391</refsect1>
54392</refentry>
54393
54394<refentry id="API-spi-w8r16be">
54395<refentryinfo>
54396 <title>LINUX</title>
54397 <productname>Kernel Hackers Manual</productname>
54398 <date>July 2017</date>
54399</refentryinfo>
54400<refmeta>
54401 <refentrytitle><phrase>spi_w8r16be</phrase></refentrytitle>
54402 <manvolnum>9</manvolnum>
54403 <refmiscinfo class="version">4.1.27</refmiscinfo>
54404</refmeta>
54405<refnamediv>
54406 <refname>spi_w8r16be</refname>
54407 <refpurpose>
54408     SPI synchronous 8 bit write followed by 16 bit big-endian read
54409 </refpurpose>
54410</refnamediv>
54411<refsynopsisdiv>
54412 <title>Synopsis</title>
54413  <funcsynopsis><funcprototype>
54414   <funcdef>ssize_t <function>spi_w8r16be </function></funcdef>
54415   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
54416   <paramdef>u8 <parameter>cmd</parameter></paramdef>
54417  </funcprototype></funcsynopsis>
54418</refsynopsisdiv>
54419<refsect1>
54420 <title>Arguments</title>
54421 <variablelist>
54422  <varlistentry>
54423   <term><parameter>spi</parameter></term>
54424   <listitem>
54425    <para>
54426     device with which data will be exchanged
54427    </para>
54428   </listitem>
54429  </varlistentry>
54430  <varlistentry>
54431   <term><parameter>cmd</parameter></term>
54432   <listitem>
54433    <para>
54434     command to be written before data is read back
54435    </para>
54436   </listitem>
54437  </varlistentry>
54438 </variablelist>
54439</refsect1>
54440<refsect1>
54441<title>Context</title>
54442<para>
54443   can sleep
54444</para>
54445</refsect1>
54446<refsect1>
54447<title>Description</title>
54448<para>
54449   This returns the (unsigned) sixteen bit number returned by the device in cpu
54450   endianness, or else a negative error code. Callable only from contexts that
54451   can sleep.
54452   </para><para>
54453
54454   This function is similar to spi_w8r16, with the exception that it will
54455   convert the read 16 bit data word from big-endian to native endianness.
54456</para>
54457</refsect1>
54458</refentry>
54459
54460<refentry id="API-struct-spi-board-info">
54461<refentryinfo>
54462 <title>LINUX</title>
54463 <productname>Kernel Hackers Manual</productname>
54464 <date>July 2017</date>
54465</refentryinfo>
54466<refmeta>
54467 <refentrytitle><phrase>struct spi_board_info</phrase></refentrytitle>
54468 <manvolnum>9</manvolnum>
54469 <refmiscinfo class="version">4.1.27</refmiscinfo>
54470</refmeta>
54471<refnamediv>
54472 <refname>struct spi_board_info</refname>
54473 <refpurpose>
54474     board-specific template for a SPI device
54475 </refpurpose>
54476</refnamediv>
54477<refsynopsisdiv>
54478 <title>Synopsis</title>
54479  <programlisting>
54480struct spi_board_info {
54481  char modalias[SPI_NAME_SIZE];
54482  const void * platform_data;
54483  void * controller_data;
54484  int irq;
54485  u32 max_speed_hz;
54486  u16 bus_num;
54487  u16 chip_select;
54488  u16 mode;
54489};  </programlisting>
54490</refsynopsisdiv>
54491 <refsect1>
54492  <title>Members</title>
54493  <variablelist>
54494    <varlistentry>      <term>modalias[SPI_NAME_SIZE]</term>
54495      <listitem><para>
54496   Initializes spi_device.modalias; identifies the driver.
54497      </para></listitem>
54498    </varlistentry>
54499    <varlistentry>      <term>platform_data</term>
54500      <listitem><para>
54501   Initializes spi_device.platform_data; the particular
54502   data stored there is driver-specific.
54503      </para></listitem>
54504    </varlistentry>
54505    <varlistentry>      <term>controller_data</term>
54506      <listitem><para>
54507   Initializes spi_device.controller_data; some
54508   controllers need hints about hardware setup, e.g. for DMA.
54509      </para></listitem>
54510    </varlistentry>
54511    <varlistentry>      <term>irq</term>
54512      <listitem><para>
54513   Initializes spi_device.irq; depends on how the board is wired.
54514      </para></listitem>
54515    </varlistentry>
54516    <varlistentry>      <term>max_speed_hz</term>
54517      <listitem><para>
54518   Initializes spi_device.max_speed_hz; based on limits
54519   from the chip datasheet and board-specific signal quality issues.
54520      </para></listitem>
54521    </varlistentry>
54522    <varlistentry>      <term>bus_num</term>
54523      <listitem><para>
54524   Identifies which spi_master parents the spi_device; unused
54525   by <function>spi_new_device</function>, and otherwise depends on board wiring.
54526      </para></listitem>
54527    </varlistentry>
54528    <varlistentry>      <term>chip_select</term>
54529      <listitem><para>
54530   Initializes spi_device.chip_select; depends on how
54531   the board is wired.
54532      </para></listitem>
54533    </varlistentry>
54534    <varlistentry>      <term>mode</term>
54535      <listitem><para>
54536   Initializes spi_device.mode; based on the chip datasheet, board
54537   wiring (some devices support both 3WIRE and standard modes), and
54538   possibly presence of an inverter in the chipselect path.
54539      </para></listitem>
54540    </varlistentry>
54541  </variablelist>
54542 </refsect1>
54543<refsect1>
54544<title>Description</title>
54545<para>
54546   When adding new SPI devices to the device tree, these structures serve
54547   as a partial device template.  They hold information which can't always
54548   be determined by drivers.  Information that <function>probe</function> can establish (such
54549   as the default transfer wordsize) is not included here.
54550   </para><para>
54551
54552   These structures are used in two places.  Their primary role is to
54553   be stored in tables of board-specific device descriptors, which are
54554   declared early in board initialization and then used (much later) to
54555   populate a controller's device tree after the that controller's driver
54556   initializes.  A secondary (and atypical) role is as a parameter to
54557   <function>spi_new_device</function> call, which happens after those controller drivers
54558   are active in some dynamic board configuration models.
54559</para>
54560</refsect1>
54561</refentry>
54562
54563<refentry id="API-spi-register-board-info">
54564<refentryinfo>
54565 <title>LINUX</title>
54566 <productname>Kernel Hackers Manual</productname>
54567 <date>July 2017</date>
54568</refentryinfo>
54569<refmeta>
54570 <refentrytitle><phrase>spi_register_board_info</phrase></refentrytitle>
54571 <manvolnum>9</manvolnum>
54572 <refmiscinfo class="version">4.1.27</refmiscinfo>
54573</refmeta>
54574<refnamediv>
54575 <refname>spi_register_board_info</refname>
54576 <refpurpose>
54577  register SPI devices for a given board
54578 </refpurpose>
54579</refnamediv>
54580<refsynopsisdiv>
54581 <title>Synopsis</title>
54582  <funcsynopsis><funcprototype>
54583   <funcdef>int <function>spi_register_board_info </function></funcdef>
54584   <paramdef>struct spi_board_info const * <parameter>info</parameter></paramdef>
54585   <paramdef>unsigned <parameter>n</parameter></paramdef>
54586  </funcprototype></funcsynopsis>
54587</refsynopsisdiv>
54588<refsect1>
54589 <title>Arguments</title>
54590 <variablelist>
54591  <varlistentry>
54592   <term><parameter>info</parameter></term>
54593   <listitem>
54594    <para>
54595     array of chip descriptors
54596    </para>
54597   </listitem>
54598  </varlistentry>
54599  <varlistentry>
54600   <term><parameter>n</parameter></term>
54601   <listitem>
54602    <para>
54603     how many descriptors are provided
54604    </para>
54605   </listitem>
54606  </varlistentry>
54607 </variablelist>
54608</refsect1>
54609<refsect1>
54610<title>Context</title>
54611<para>
54612   can sleep
54613</para>
54614</refsect1>
54615<refsect1>
54616<title>Description</title>
54617<para>
54618   Board-specific early init code calls this (probably during arch_initcall)
54619   with segments of the SPI device table.  Any device nodes are created later,
54620   after the relevant parent SPI controller (bus_num) is defined.  We keep
54621   this table of devices forever, so that reloading a controller driver will
54622   not make Linux forget about these hard-wired devices.
54623   </para><para>
54624
54625   Other code can also call this, e.g. a particular add-on board might provide
54626   SPI devices through its expansion connector, so code initializing that board
54627   would naturally declare its SPI devices.
54628   </para><para>
54629
54630   The board info passed can safely be __initdata ... but be careful of
54631   any embedded pointers (platform_data, etc), they're copied as-is.
54632</para>
54633</refsect1>
54634</refentry>
54635
54636<!-- drivers/spi/spi.c -->
54637<refentry id="API-spi-register-driver">
54638<refentryinfo>
54639 <title>LINUX</title>
54640 <productname>Kernel Hackers Manual</productname>
54641 <date>July 2017</date>
54642</refentryinfo>
54643<refmeta>
54644 <refentrytitle><phrase>spi_register_driver</phrase></refentrytitle>
54645 <manvolnum>9</manvolnum>
54646 <refmiscinfo class="version">4.1.27</refmiscinfo>
54647</refmeta>
54648<refnamediv>
54649 <refname>spi_register_driver</refname>
54650 <refpurpose>
54651  register a SPI driver
54652 </refpurpose>
54653</refnamediv>
54654<refsynopsisdiv>
54655 <title>Synopsis</title>
54656  <funcsynopsis><funcprototype>
54657   <funcdef>int <function>spi_register_driver </function></funcdef>
54658   <paramdef>struct spi_driver * <parameter>sdrv</parameter></paramdef>
54659  </funcprototype></funcsynopsis>
54660</refsynopsisdiv>
54661<refsect1>
54662 <title>Arguments</title>
54663 <variablelist>
54664  <varlistentry>
54665   <term><parameter>sdrv</parameter></term>
54666   <listitem>
54667    <para>
54668     the driver to register
54669    </para>
54670   </listitem>
54671  </varlistentry>
54672 </variablelist>
54673</refsect1>
54674<refsect1>
54675<title>Context</title>
54676<para>
54677   can sleep
54678</para>
54679</refsect1>
54680</refentry>
54681
54682<refentry id="API-spi-alloc-device">
54683<refentryinfo>
54684 <title>LINUX</title>
54685 <productname>Kernel Hackers Manual</productname>
54686 <date>July 2017</date>
54687</refentryinfo>
54688<refmeta>
54689 <refentrytitle><phrase>spi_alloc_device</phrase></refentrytitle>
54690 <manvolnum>9</manvolnum>
54691 <refmiscinfo class="version">4.1.27</refmiscinfo>
54692</refmeta>
54693<refnamediv>
54694 <refname>spi_alloc_device</refname>
54695 <refpurpose>
54696     Allocate a new SPI device
54697 </refpurpose>
54698</refnamediv>
54699<refsynopsisdiv>
54700 <title>Synopsis</title>
54701  <funcsynopsis><funcprototype>
54702   <funcdef>struct spi_device * <function>spi_alloc_device </function></funcdef>
54703   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
54704  </funcprototype></funcsynopsis>
54705</refsynopsisdiv>
54706<refsect1>
54707 <title>Arguments</title>
54708 <variablelist>
54709  <varlistentry>
54710   <term><parameter>master</parameter></term>
54711   <listitem>
54712    <para>
54713     Controller to which device is connected
54714    </para>
54715   </listitem>
54716  </varlistentry>
54717 </variablelist>
54718</refsect1>
54719<refsect1>
54720<title>Context</title>
54721<para>
54722   can sleep
54723</para>
54724</refsect1>
54725<refsect1>
54726<title>Description</title>
54727<para>
54728   Allows a driver to allocate and initialize a spi_device without
54729   registering it immediately.  This allows a driver to directly
54730   fill the spi_device with device parameters before calling
54731   <function>spi_add_device</function> on it.
54732   </para><para>
54733
54734   Caller is responsible to call <function>spi_add_device</function> on the returned
54735   spi_device structure to add it to the SPI master.  If the caller
54736   needs to discard the spi_device without adding it, then it should
54737   call <function>spi_dev_put</function> on it.
54738   </para><para>
54739
54740   Returns a pointer to the new device, or NULL.
54741</para>
54742</refsect1>
54743</refentry>
54744
54745<refentry id="API-spi-add-device">
54746<refentryinfo>
54747 <title>LINUX</title>
54748 <productname>Kernel Hackers Manual</productname>
54749 <date>July 2017</date>
54750</refentryinfo>
54751<refmeta>
54752 <refentrytitle><phrase>spi_add_device</phrase></refentrytitle>
54753 <manvolnum>9</manvolnum>
54754 <refmiscinfo class="version">4.1.27</refmiscinfo>
54755</refmeta>
54756<refnamediv>
54757 <refname>spi_add_device</refname>
54758 <refpurpose>
54759     Add spi_device allocated with spi_alloc_device
54760 </refpurpose>
54761</refnamediv>
54762<refsynopsisdiv>
54763 <title>Synopsis</title>
54764  <funcsynopsis><funcprototype>
54765   <funcdef>int <function>spi_add_device </function></funcdef>
54766   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
54767  </funcprototype></funcsynopsis>
54768</refsynopsisdiv>
54769<refsect1>
54770 <title>Arguments</title>
54771 <variablelist>
54772  <varlistentry>
54773   <term><parameter>spi</parameter></term>
54774   <listitem>
54775    <para>
54776     spi_device to register
54777    </para>
54778   </listitem>
54779  </varlistentry>
54780 </variablelist>
54781</refsect1>
54782<refsect1>
54783<title>Description</title>
54784<para>
54785   Companion function to spi_alloc_device.  Devices allocated with
54786   spi_alloc_device can be added onto the spi bus with this function.
54787   </para><para>
54788
54789   Returns 0 on success; negative errno on failure
54790</para>
54791</refsect1>
54792</refentry>
54793
54794<refentry id="API-spi-new-device">
54795<refentryinfo>
54796 <title>LINUX</title>
54797 <productname>Kernel Hackers Manual</productname>
54798 <date>July 2017</date>
54799</refentryinfo>
54800<refmeta>
54801 <refentrytitle><phrase>spi_new_device</phrase></refentrytitle>
54802 <manvolnum>9</manvolnum>
54803 <refmiscinfo class="version">4.1.27</refmiscinfo>
54804</refmeta>
54805<refnamediv>
54806 <refname>spi_new_device</refname>
54807 <refpurpose>
54808     instantiate one new SPI device
54809 </refpurpose>
54810</refnamediv>
54811<refsynopsisdiv>
54812 <title>Synopsis</title>
54813  <funcsynopsis><funcprototype>
54814   <funcdef>struct spi_device * <function>spi_new_device </function></funcdef>
54815   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
54816   <paramdef>struct spi_board_info * <parameter>chip</parameter></paramdef>
54817  </funcprototype></funcsynopsis>
54818</refsynopsisdiv>
54819<refsect1>
54820 <title>Arguments</title>
54821 <variablelist>
54822  <varlistentry>
54823   <term><parameter>master</parameter></term>
54824   <listitem>
54825    <para>
54826     Controller to which device is connected
54827    </para>
54828   </listitem>
54829  </varlistentry>
54830  <varlistentry>
54831   <term><parameter>chip</parameter></term>
54832   <listitem>
54833    <para>
54834     Describes the SPI device
54835    </para>
54836   </listitem>
54837  </varlistentry>
54838 </variablelist>
54839</refsect1>
54840<refsect1>
54841<title>Context</title>
54842<para>
54843   can sleep
54844</para>
54845</refsect1>
54846<refsect1>
54847<title>Description</title>
54848<para>
54849   On typical mainboards, this is purely internal; and it's not needed
54850   after board init creates the hard-wired devices.  Some development
54851   platforms may not be able to use spi_register_board_info though, and
54852   this is exported so that for example a USB or parport based adapter
54853   driver could add devices (which it would learn about out-of-band).
54854   </para><para>
54855
54856   Returns the new device, or NULL.
54857</para>
54858</refsect1>
54859</refentry>
54860
54861<refentry id="API-spi-finalize-current-transfer">
54862<refentryinfo>
54863 <title>LINUX</title>
54864 <productname>Kernel Hackers Manual</productname>
54865 <date>July 2017</date>
54866</refentryinfo>
54867<refmeta>
54868 <refentrytitle><phrase>spi_finalize_current_transfer</phrase></refentrytitle>
54869 <manvolnum>9</manvolnum>
54870 <refmiscinfo class="version">4.1.27</refmiscinfo>
54871</refmeta>
54872<refnamediv>
54873 <refname>spi_finalize_current_transfer</refname>
54874 <refpurpose>
54875     report completion of a transfer
54876 </refpurpose>
54877</refnamediv>
54878<refsynopsisdiv>
54879 <title>Synopsis</title>
54880  <funcsynopsis><funcprototype>
54881   <funcdef>void <function>spi_finalize_current_transfer </function></funcdef>
54882   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
54883  </funcprototype></funcsynopsis>
54884</refsynopsisdiv>
54885<refsect1>
54886 <title>Arguments</title>
54887 <variablelist>
54888  <varlistentry>
54889   <term><parameter>master</parameter></term>
54890   <listitem>
54891    <para>
54892     the master reporting completion
54893    </para>
54894   </listitem>
54895  </varlistentry>
54896 </variablelist>
54897</refsect1>
54898<refsect1>
54899<title>Description</title>
54900<para>
54901   Called by SPI drivers using the core <function>transfer_one_message</function>
54902   implementation to notify it that the current interrupt driven
54903   transfer has finished and the next one may be scheduled.
54904</para>
54905</refsect1>
54906</refentry>
54907
54908<refentry id="API-spi-get-next-queued-message">
54909<refentryinfo>
54910 <title>LINUX</title>
54911 <productname>Kernel Hackers Manual</productname>
54912 <date>July 2017</date>
54913</refentryinfo>
54914<refmeta>
54915 <refentrytitle><phrase>spi_get_next_queued_message</phrase></refentrytitle>
54916 <manvolnum>9</manvolnum>
54917 <refmiscinfo class="version">4.1.27</refmiscinfo>
54918</refmeta>
54919<refnamediv>
54920 <refname>spi_get_next_queued_message</refname>
54921 <refpurpose>
54922     called by driver to check for queued messages
54923 </refpurpose>
54924</refnamediv>
54925<refsynopsisdiv>
54926 <title>Synopsis</title>
54927  <funcsynopsis><funcprototype>
54928   <funcdef>struct spi_message * <function>spi_get_next_queued_message </function></funcdef>
54929   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
54930  </funcprototype></funcsynopsis>
54931</refsynopsisdiv>
54932<refsect1>
54933 <title>Arguments</title>
54934 <variablelist>
54935  <varlistentry>
54936   <term><parameter>master</parameter></term>
54937   <listitem>
54938    <para>
54939     the master to check for queued messages
54940    </para>
54941   </listitem>
54942  </varlistentry>
54943 </variablelist>
54944</refsect1>
54945<refsect1>
54946<title>Description</title>
54947<para>
54948   If there are more messages in the queue, the next message is returned from
54949   this call.
54950</para>
54951</refsect1>
54952</refentry>
54953
54954<refentry id="API-spi-finalize-current-message">
54955<refentryinfo>
54956 <title>LINUX</title>
54957 <productname>Kernel Hackers Manual</productname>
54958 <date>July 2017</date>
54959</refentryinfo>
54960<refmeta>
54961 <refentrytitle><phrase>spi_finalize_current_message</phrase></refentrytitle>
54962 <manvolnum>9</manvolnum>
54963 <refmiscinfo class="version">4.1.27</refmiscinfo>
54964</refmeta>
54965<refnamediv>
54966 <refname>spi_finalize_current_message</refname>
54967 <refpurpose>
54968     the current message is complete
54969 </refpurpose>
54970</refnamediv>
54971<refsynopsisdiv>
54972 <title>Synopsis</title>
54973  <funcsynopsis><funcprototype>
54974   <funcdef>void <function>spi_finalize_current_message </function></funcdef>
54975   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
54976  </funcprototype></funcsynopsis>
54977</refsynopsisdiv>
54978<refsect1>
54979 <title>Arguments</title>
54980 <variablelist>
54981  <varlistentry>
54982   <term><parameter>master</parameter></term>
54983   <listitem>
54984    <para>
54985     the master to return the message to
54986    </para>
54987   </listitem>
54988  </varlistentry>
54989 </variablelist>
54990</refsect1>
54991<refsect1>
54992<title>Description</title>
54993<para>
54994   Called by the driver to notify the core that the message in the front of the
54995   queue is complete and can be removed from the queue.
54996</para>
54997</refsect1>
54998</refentry>
54999
55000<refentry id="API-spi-alloc-master">
55001<refentryinfo>
55002 <title>LINUX</title>
55003 <productname>Kernel Hackers Manual</productname>
55004 <date>July 2017</date>
55005</refentryinfo>
55006<refmeta>
55007 <refentrytitle><phrase>spi_alloc_master</phrase></refentrytitle>
55008 <manvolnum>9</manvolnum>
55009 <refmiscinfo class="version">4.1.27</refmiscinfo>
55010</refmeta>
55011<refnamediv>
55012 <refname>spi_alloc_master</refname>
55013 <refpurpose>
55014     allocate SPI master controller
55015 </refpurpose>
55016</refnamediv>
55017<refsynopsisdiv>
55018 <title>Synopsis</title>
55019  <funcsynopsis><funcprototype>
55020   <funcdef>struct spi_master * <function>spi_alloc_master </function></funcdef>
55021   <paramdef>struct device * <parameter>dev</parameter></paramdef>
55022   <paramdef>unsigned <parameter>size</parameter></paramdef>
55023  </funcprototype></funcsynopsis>
55024</refsynopsisdiv>
55025<refsect1>
55026 <title>Arguments</title>
55027 <variablelist>
55028  <varlistentry>
55029   <term><parameter>dev</parameter></term>
55030   <listitem>
55031    <para>
55032     the controller, possibly using the platform_bus
55033    </para>
55034   </listitem>
55035  </varlistentry>
55036  <varlistentry>
55037   <term><parameter>size</parameter></term>
55038   <listitem>
55039    <para>
55040     how much zeroed driver-private data to allocate; the pointer to this
55041     memory is in the driver_data field of the returned device,
55042     accessible with <function>spi_master_get_devdata</function>.
55043    </para>
55044   </listitem>
55045  </varlistentry>
55046 </variablelist>
55047</refsect1>
55048<refsect1>
55049<title>Context</title>
55050<para>
55051   can sleep
55052</para>
55053</refsect1>
55054<refsect1>
55055<title>Description</title>
55056<para>
55057   This call is used only by SPI master controller drivers, which are the
55058   only ones directly touching chip registers.  It's how they allocate
55059   an spi_master structure, prior to calling <function>spi_register_master</function>.
55060   </para><para>
55061
55062   This must be called from context that can sleep.  It returns the SPI
55063   master structure on success, else NULL.
55064   </para><para>
55065
55066   The caller is responsible for assigning the bus number and initializing
55067   the master's methods before calling <function>spi_register_master</function>; and (after errors
55068   adding the device) calling <function>spi_master_put</function> to prevent a memory leak.
55069</para>
55070</refsect1>
55071</refentry>
55072
55073<refentry id="API-spi-register-master">
55074<refentryinfo>
55075 <title>LINUX</title>
55076 <productname>Kernel Hackers Manual</productname>
55077 <date>July 2017</date>
55078</refentryinfo>
55079<refmeta>
55080 <refentrytitle><phrase>spi_register_master</phrase></refentrytitle>
55081 <manvolnum>9</manvolnum>
55082 <refmiscinfo class="version">4.1.27</refmiscinfo>
55083</refmeta>
55084<refnamediv>
55085 <refname>spi_register_master</refname>
55086 <refpurpose>
55087     register SPI master controller
55088 </refpurpose>
55089</refnamediv>
55090<refsynopsisdiv>
55091 <title>Synopsis</title>
55092  <funcsynopsis><funcprototype>
55093   <funcdef>int <function>spi_register_master </function></funcdef>
55094   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
55095  </funcprototype></funcsynopsis>
55096</refsynopsisdiv>
55097<refsect1>
55098 <title>Arguments</title>
55099 <variablelist>
55100  <varlistentry>
55101   <term><parameter>master</parameter></term>
55102   <listitem>
55103    <para>
55104     initialized master, originally from <function>spi_alloc_master</function>
55105    </para>
55106   </listitem>
55107  </varlistentry>
55108 </variablelist>
55109</refsect1>
55110<refsect1>
55111<title>Context</title>
55112<para>
55113   can sleep
55114</para>
55115</refsect1>
55116<refsect1>
55117<title>Description</title>
55118<para>
55119   SPI master controllers connect to their drivers using some non-SPI bus,
55120   such as the platform bus.  The final stage of <function>probe</function> in that code
55121   includes calling <function>spi_register_master</function> to hook up to this SPI bus glue.
55122   </para><para>
55123
55124   SPI controllers use board specific (often SOC specific) bus numbers,
55125   and board-specific addressing for SPI devices combines those numbers
55126   with chip select numbers.  Since SPI does not directly support dynamic
55127   device identification, boards need configuration tables telling which
55128   chip is at which address.
55129   </para><para>
55130
55131   This must be called from context that can sleep.  It returns zero on
55132   success, else a negative error code (dropping the master's refcount).
55133   After a successful return, the caller is responsible for calling
55134   <function>spi_unregister_master</function>.
55135</para>
55136</refsect1>
55137</refentry>
55138
55139<refentry id="API-devm-spi-register-master">
55140<refentryinfo>
55141 <title>LINUX</title>
55142 <productname>Kernel Hackers Manual</productname>
55143 <date>July 2017</date>
55144</refentryinfo>
55145<refmeta>
55146 <refentrytitle><phrase>devm_spi_register_master</phrase></refentrytitle>
55147 <manvolnum>9</manvolnum>
55148 <refmiscinfo class="version">4.1.27</refmiscinfo>
55149</refmeta>
55150<refnamediv>
55151 <refname>devm_spi_register_master</refname>
55152 <refpurpose>
55153     register managed SPI master controller
55154 </refpurpose>
55155</refnamediv>
55156<refsynopsisdiv>
55157 <title>Synopsis</title>
55158  <funcsynopsis><funcprototype>
55159   <funcdef>int <function>devm_spi_register_master </function></funcdef>
55160   <paramdef>struct device * <parameter>dev</parameter></paramdef>
55161   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
55162  </funcprototype></funcsynopsis>
55163</refsynopsisdiv>
55164<refsect1>
55165 <title>Arguments</title>
55166 <variablelist>
55167  <varlistentry>
55168   <term><parameter>dev</parameter></term>
55169   <listitem>
55170    <para>
55171     device managing SPI master
55172    </para>
55173   </listitem>
55174  </varlistentry>
55175  <varlistentry>
55176   <term><parameter>master</parameter></term>
55177   <listitem>
55178    <para>
55179     initialized master, originally from <function>spi_alloc_master</function>
55180    </para>
55181   </listitem>
55182  </varlistentry>
55183 </variablelist>
55184</refsect1>
55185<refsect1>
55186<title>Context</title>
55187<para>
55188   can sleep
55189</para>
55190</refsect1>
55191<refsect1>
55192<title>Description</title>
55193<para>
55194   Register a SPI device as with <function>spi_register_master</function> which will
55195   automatically be unregister
55196</para>
55197</refsect1>
55198</refentry>
55199
55200<refentry id="API-spi-unregister-master">
55201<refentryinfo>
55202 <title>LINUX</title>
55203 <productname>Kernel Hackers Manual</productname>
55204 <date>July 2017</date>
55205</refentryinfo>
55206<refmeta>
55207 <refentrytitle><phrase>spi_unregister_master</phrase></refentrytitle>
55208 <manvolnum>9</manvolnum>
55209 <refmiscinfo class="version">4.1.27</refmiscinfo>
55210</refmeta>
55211<refnamediv>
55212 <refname>spi_unregister_master</refname>
55213 <refpurpose>
55214     unregister SPI master controller
55215 </refpurpose>
55216</refnamediv>
55217<refsynopsisdiv>
55218 <title>Synopsis</title>
55219  <funcsynopsis><funcprototype>
55220   <funcdef>void <function>spi_unregister_master </function></funcdef>
55221   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
55222  </funcprototype></funcsynopsis>
55223</refsynopsisdiv>
55224<refsect1>
55225 <title>Arguments</title>
55226 <variablelist>
55227  <varlistentry>
55228   <term><parameter>master</parameter></term>
55229   <listitem>
55230    <para>
55231     the master being unregistered
55232    </para>
55233   </listitem>
55234  </varlistentry>
55235 </variablelist>
55236</refsect1>
55237<refsect1>
55238<title>Context</title>
55239<para>
55240   can sleep
55241</para>
55242</refsect1>
55243<refsect1>
55244<title>Description</title>
55245<para>
55246   This call is used only by SPI master controller drivers, which are the
55247   only ones directly touching chip registers.
55248   </para><para>
55249
55250   This must be called from context that can sleep.
55251</para>
55252</refsect1>
55253</refentry>
55254
55255<refentry id="API-spi-busnum-to-master">
55256<refentryinfo>
55257 <title>LINUX</title>
55258 <productname>Kernel Hackers Manual</productname>
55259 <date>July 2017</date>
55260</refentryinfo>
55261<refmeta>
55262 <refentrytitle><phrase>spi_busnum_to_master</phrase></refentrytitle>
55263 <manvolnum>9</manvolnum>
55264 <refmiscinfo class="version">4.1.27</refmiscinfo>
55265</refmeta>
55266<refnamediv>
55267 <refname>spi_busnum_to_master</refname>
55268 <refpurpose>
55269     look up master associated with bus_num
55270 </refpurpose>
55271</refnamediv>
55272<refsynopsisdiv>
55273 <title>Synopsis</title>
55274  <funcsynopsis><funcprototype>
55275   <funcdef>struct spi_master * <function>spi_busnum_to_master </function></funcdef>
55276   <paramdef>u16 <parameter>bus_num</parameter></paramdef>
55277  </funcprototype></funcsynopsis>
55278</refsynopsisdiv>
55279<refsect1>
55280 <title>Arguments</title>
55281 <variablelist>
55282  <varlistentry>
55283   <term><parameter>bus_num</parameter></term>
55284   <listitem>
55285    <para>
55286     the master's bus number
55287    </para>
55288   </listitem>
55289  </varlistentry>
55290 </variablelist>
55291</refsect1>
55292<refsect1>
55293<title>Context</title>
55294<para>
55295   can sleep
55296</para>
55297</refsect1>
55298<refsect1>
55299<title>Description</title>
55300<para>
55301   This call may be used with devices that are registered after
55302   arch init time.  It returns a refcounted pointer to the relevant
55303   spi_master (which the caller must release), or NULL if there is
55304   no such master registered.
55305</para>
55306</refsect1>
55307</refentry>
55308
55309<refentry id="API-spi-setup">
55310<refentryinfo>
55311 <title>LINUX</title>
55312 <productname>Kernel Hackers Manual</productname>
55313 <date>July 2017</date>
55314</refentryinfo>
55315<refmeta>
55316 <refentrytitle><phrase>spi_setup</phrase></refentrytitle>
55317 <manvolnum>9</manvolnum>
55318 <refmiscinfo class="version">4.1.27</refmiscinfo>
55319</refmeta>
55320<refnamediv>
55321 <refname>spi_setup</refname>
55322 <refpurpose>
55323     setup SPI mode and clock rate
55324 </refpurpose>
55325</refnamediv>
55326<refsynopsisdiv>
55327 <title>Synopsis</title>
55328  <funcsynopsis><funcprototype>
55329   <funcdef>int <function>spi_setup </function></funcdef>
55330   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
55331  </funcprototype></funcsynopsis>
55332</refsynopsisdiv>
55333<refsect1>
55334 <title>Arguments</title>
55335 <variablelist>
55336  <varlistentry>
55337   <term><parameter>spi</parameter></term>
55338   <listitem>
55339    <para>
55340     the device whose settings are being modified
55341    </para>
55342   </listitem>
55343  </varlistentry>
55344 </variablelist>
55345</refsect1>
55346<refsect1>
55347<title>Context</title>
55348<para>
55349   can sleep, and no requests are queued to the device
55350</para>
55351</refsect1>
55352<refsect1>
55353<title>Description</title>
55354<para>
55355   SPI protocol drivers may need to update the transfer mode if the
55356   device doesn't work with its default.  They may likewise need
55357   to update clock rates or word sizes from initial values.  This function
55358   changes those settings, and must be called from a context that can sleep.
55359   Except for SPI_CS_HIGH, which takes effect immediately, the changes take
55360   effect the next time the device is selected and data is transferred to
55361   or from it.  When this function returns, the spi device is deselected.
55362   </para><para>
55363
55364   Note that this call will fail if the protocol driver specifies an option
55365   that the underlying controller or its driver does not support.  For
55366   example, not all hardware supports wire transfers using nine bit words,
55367   LSB-first wire encoding, or active-high chipselects.
55368</para>
55369</refsect1>
55370</refentry>
55371
55372<refentry id="API-spi-async">
55373<refentryinfo>
55374 <title>LINUX</title>
55375 <productname>Kernel Hackers Manual</productname>
55376 <date>July 2017</date>
55377</refentryinfo>
55378<refmeta>
55379 <refentrytitle><phrase>spi_async</phrase></refentrytitle>
55380 <manvolnum>9</manvolnum>
55381 <refmiscinfo class="version">4.1.27</refmiscinfo>
55382</refmeta>
55383<refnamediv>
55384 <refname>spi_async</refname>
55385 <refpurpose>
55386     asynchronous SPI transfer
55387 </refpurpose>
55388</refnamediv>
55389<refsynopsisdiv>
55390 <title>Synopsis</title>
55391  <funcsynopsis><funcprototype>
55392   <funcdef>int <function>spi_async </function></funcdef>
55393   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
55394   <paramdef>struct spi_message * <parameter>message</parameter></paramdef>
55395  </funcprototype></funcsynopsis>
55396</refsynopsisdiv>
55397<refsect1>
55398 <title>Arguments</title>
55399 <variablelist>
55400  <varlistentry>
55401   <term><parameter>spi</parameter></term>
55402   <listitem>
55403    <para>
55404     device with which data will be exchanged
55405    </para>
55406   </listitem>
55407  </varlistentry>
55408  <varlistentry>
55409   <term><parameter>message</parameter></term>
55410   <listitem>
55411    <para>
55412     describes the data transfers, including completion callback
55413    </para>
55414   </listitem>
55415  </varlistentry>
55416 </variablelist>
55417</refsect1>
55418<refsect1>
55419<title>Context</title>
55420<para>
55421   any (irqs may be blocked, etc)
55422</para>
55423</refsect1>
55424<refsect1>
55425<title>Description</title>
55426<para>
55427   This call may be used in_irq and other contexts which can't sleep,
55428   as well as from task contexts which can sleep.
55429   </para><para>
55430
55431   The completion callback is invoked in a context which can't sleep.
55432   Before that invocation, the value of message-&gt;status is undefined.
55433   When the callback is issued, message-&gt;status holds either zero (to
55434   indicate complete success) or a negative error code.  After that
55435   callback returns, the driver which issued the transfer request may
55436   deallocate the associated memory; it's no longer in use by any SPI
55437   core or controller driver code.
55438   </para><para>
55439
55440   Note that although all messages to a spi_device are handled in
55441   FIFO order, messages may go to different devices in other orders.
55442   Some device might be higher priority, or have various <quote>hard</quote> access
55443   time requirements, for example.
55444   </para><para>
55445
55446   On detection of any fault during the transfer, processing of
55447   the entire message is aborted, and the device is deselected.
55448   Until returning from the associated message completion callback,
55449   no other spi_message queued to that device will be processed.
55450   (This rule applies equally to all the synchronous transfer calls,
55451   which are wrappers around this core asynchronous primitive.)
55452</para>
55453</refsect1>
55454</refentry>
55455
55456<refentry id="API-spi-async-locked">
55457<refentryinfo>
55458 <title>LINUX</title>
55459 <productname>Kernel Hackers Manual</productname>
55460 <date>July 2017</date>
55461</refentryinfo>
55462<refmeta>
55463 <refentrytitle><phrase>spi_async_locked</phrase></refentrytitle>
55464 <manvolnum>9</manvolnum>
55465 <refmiscinfo class="version">4.1.27</refmiscinfo>
55466</refmeta>
55467<refnamediv>
55468 <refname>spi_async_locked</refname>
55469 <refpurpose>
55470     version of spi_async with exclusive bus usage
55471 </refpurpose>
55472</refnamediv>
55473<refsynopsisdiv>
55474 <title>Synopsis</title>
55475  <funcsynopsis><funcprototype>
55476   <funcdef>int <function>spi_async_locked </function></funcdef>
55477   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
55478   <paramdef>struct spi_message * <parameter>message</parameter></paramdef>
55479  </funcprototype></funcsynopsis>
55480</refsynopsisdiv>
55481<refsect1>
55482 <title>Arguments</title>
55483 <variablelist>
55484  <varlistentry>
55485   <term><parameter>spi</parameter></term>
55486   <listitem>
55487    <para>
55488     device with which data will be exchanged
55489    </para>
55490   </listitem>
55491  </varlistentry>
55492  <varlistentry>
55493   <term><parameter>message</parameter></term>
55494   <listitem>
55495    <para>
55496     describes the data transfers, including completion callback
55497    </para>
55498   </listitem>
55499  </varlistentry>
55500 </variablelist>
55501</refsect1>
55502<refsect1>
55503<title>Context</title>
55504<para>
55505   any (irqs may be blocked, etc)
55506</para>
55507</refsect1>
55508<refsect1>
55509<title>Description</title>
55510<para>
55511   This call may be used in_irq and other contexts which can't sleep,
55512   as well as from task contexts which can sleep.
55513   </para><para>
55514
55515   The completion callback is invoked in a context which can't sleep.
55516   Before that invocation, the value of message-&gt;status is undefined.
55517   When the callback is issued, message-&gt;status holds either zero (to
55518   indicate complete success) or a negative error code.  After that
55519   callback returns, the driver which issued the transfer request may
55520   deallocate the associated memory; it's no longer in use by any SPI
55521   core or controller driver code.
55522   </para><para>
55523
55524   Note that although all messages to a spi_device are handled in
55525   FIFO order, messages may go to different devices in other orders.
55526   Some device might be higher priority, or have various <quote>hard</quote> access
55527   time requirements, for example.
55528   </para><para>
55529
55530   On detection of any fault during the transfer, processing of
55531   the entire message is aborted, and the device is deselected.
55532   Until returning from the associated message completion callback,
55533   no other spi_message queued to that device will be processed.
55534   (This rule applies equally to all the synchronous transfer calls,
55535   which are wrappers around this core asynchronous primitive.)
55536</para>
55537</refsect1>
55538</refentry>
55539
55540<refentry id="API-spi-sync">
55541<refentryinfo>
55542 <title>LINUX</title>
55543 <productname>Kernel Hackers Manual</productname>
55544 <date>July 2017</date>
55545</refentryinfo>
55546<refmeta>
55547 <refentrytitle><phrase>spi_sync</phrase></refentrytitle>
55548 <manvolnum>9</manvolnum>
55549 <refmiscinfo class="version">4.1.27</refmiscinfo>
55550</refmeta>
55551<refnamediv>
55552 <refname>spi_sync</refname>
55553 <refpurpose>
55554     blocking/synchronous SPI data transfers
55555 </refpurpose>
55556</refnamediv>
55557<refsynopsisdiv>
55558 <title>Synopsis</title>
55559  <funcsynopsis><funcprototype>
55560   <funcdef>int <function>spi_sync </function></funcdef>
55561   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
55562   <paramdef>struct spi_message * <parameter>message</parameter></paramdef>
55563  </funcprototype></funcsynopsis>
55564</refsynopsisdiv>
55565<refsect1>
55566 <title>Arguments</title>
55567 <variablelist>
55568  <varlistentry>
55569   <term><parameter>spi</parameter></term>
55570   <listitem>
55571    <para>
55572     device with which data will be exchanged
55573    </para>
55574   </listitem>
55575  </varlistentry>
55576  <varlistentry>
55577   <term><parameter>message</parameter></term>
55578   <listitem>
55579    <para>
55580     describes the data transfers
55581    </para>
55582   </listitem>
55583  </varlistentry>
55584 </variablelist>
55585</refsect1>
55586<refsect1>
55587<title>Context</title>
55588<para>
55589   can sleep
55590</para>
55591</refsect1>
55592<refsect1>
55593<title>Description</title>
55594<para>
55595   This call may only be used from a context that may sleep.  The sleep
55596   is non-interruptible, and has no timeout.  Low-overhead controller
55597   drivers may DMA directly into and out of the message buffers.
55598   </para><para>
55599
55600   Note that the SPI device's chip select is active during the message,
55601   and then is normally disabled between messages.  Drivers for some
55602   frequently-used devices may want to minimize costs of selecting a chip,
55603   by leaving it selected in anticipation that the next message will go
55604   to the same chip.  (That may increase power usage.)
55605   </para><para>
55606
55607   Also, the caller is guaranteeing that the memory associated with the
55608   message will not be freed before this call returns.
55609   </para><para>
55610
55611   It returns zero on success, else a negative error code.
55612</para>
55613</refsect1>
55614</refentry>
55615
55616<refentry id="API-spi-sync-locked">
55617<refentryinfo>
55618 <title>LINUX</title>
55619 <productname>Kernel Hackers Manual</productname>
55620 <date>July 2017</date>
55621</refentryinfo>
55622<refmeta>
55623 <refentrytitle><phrase>spi_sync_locked</phrase></refentrytitle>
55624 <manvolnum>9</manvolnum>
55625 <refmiscinfo class="version">4.1.27</refmiscinfo>
55626</refmeta>
55627<refnamediv>
55628 <refname>spi_sync_locked</refname>
55629 <refpurpose>
55630     version of spi_sync with exclusive bus usage
55631 </refpurpose>
55632</refnamediv>
55633<refsynopsisdiv>
55634 <title>Synopsis</title>
55635  <funcsynopsis><funcprototype>
55636   <funcdef>int <function>spi_sync_locked </function></funcdef>
55637   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
55638   <paramdef>struct spi_message * <parameter>message</parameter></paramdef>
55639  </funcprototype></funcsynopsis>
55640</refsynopsisdiv>
55641<refsect1>
55642 <title>Arguments</title>
55643 <variablelist>
55644  <varlistentry>
55645   <term><parameter>spi</parameter></term>
55646   <listitem>
55647    <para>
55648     device with which data will be exchanged
55649    </para>
55650   </listitem>
55651  </varlistentry>
55652  <varlistentry>
55653   <term><parameter>message</parameter></term>
55654   <listitem>
55655    <para>
55656     describes the data transfers
55657    </para>
55658   </listitem>
55659  </varlistentry>
55660 </variablelist>
55661</refsect1>
55662<refsect1>
55663<title>Context</title>
55664<para>
55665   can sleep
55666</para>
55667</refsect1>
55668<refsect1>
55669<title>Description</title>
55670<para>
55671   This call may only be used from a context that may sleep.  The sleep
55672   is non-interruptible, and has no timeout.  Low-overhead controller
55673   drivers may DMA directly into and out of the message buffers.
55674   </para><para>
55675
55676   This call should be used by drivers that require exclusive access to the
55677   SPI bus. It has to be preceded by a spi_bus_lock call. The SPI bus must
55678   be released by a spi_bus_unlock call when the exclusive access is over.
55679   </para><para>
55680
55681   It returns zero on success, else a negative error code.
55682</para>
55683</refsect1>
55684</refentry>
55685
55686<refentry id="API-spi-bus-lock">
55687<refentryinfo>
55688 <title>LINUX</title>
55689 <productname>Kernel Hackers Manual</productname>
55690 <date>July 2017</date>
55691</refentryinfo>
55692<refmeta>
55693 <refentrytitle><phrase>spi_bus_lock</phrase></refentrytitle>
55694 <manvolnum>9</manvolnum>
55695 <refmiscinfo class="version">4.1.27</refmiscinfo>
55696</refmeta>
55697<refnamediv>
55698 <refname>spi_bus_lock</refname>
55699 <refpurpose>
55700     obtain a lock for exclusive SPI bus usage
55701 </refpurpose>
55702</refnamediv>
55703<refsynopsisdiv>
55704 <title>Synopsis</title>
55705  <funcsynopsis><funcprototype>
55706   <funcdef>int <function>spi_bus_lock </function></funcdef>
55707   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
55708  </funcprototype></funcsynopsis>
55709</refsynopsisdiv>
55710<refsect1>
55711 <title>Arguments</title>
55712 <variablelist>
55713  <varlistentry>
55714   <term><parameter>master</parameter></term>
55715   <listitem>
55716    <para>
55717     SPI bus master that should be locked for exclusive bus access
55718    </para>
55719   </listitem>
55720  </varlistentry>
55721 </variablelist>
55722</refsect1>
55723<refsect1>
55724<title>Context</title>
55725<para>
55726   can sleep
55727</para>
55728</refsect1>
55729<refsect1>
55730<title>Description</title>
55731<para>
55732   This call may only be used from a context that may sleep.  The sleep
55733   is non-interruptible, and has no timeout.
55734   </para><para>
55735
55736   This call should be used by drivers that require exclusive access to the
55737   SPI bus. The SPI bus must be released by a spi_bus_unlock call when the
55738   exclusive access is over. Data transfer must be done by spi_sync_locked
55739   and spi_async_locked calls when the SPI bus lock is held.
55740   </para><para>
55741
55742   It returns zero on success, else a negative error code.
55743</para>
55744</refsect1>
55745</refentry>
55746
55747<refentry id="API-spi-bus-unlock">
55748<refentryinfo>
55749 <title>LINUX</title>
55750 <productname>Kernel Hackers Manual</productname>
55751 <date>July 2017</date>
55752</refentryinfo>
55753<refmeta>
55754 <refentrytitle><phrase>spi_bus_unlock</phrase></refentrytitle>
55755 <manvolnum>9</manvolnum>
55756 <refmiscinfo class="version">4.1.27</refmiscinfo>
55757</refmeta>
55758<refnamediv>
55759 <refname>spi_bus_unlock</refname>
55760 <refpurpose>
55761     release the lock for exclusive SPI bus usage
55762 </refpurpose>
55763</refnamediv>
55764<refsynopsisdiv>
55765 <title>Synopsis</title>
55766  <funcsynopsis><funcprototype>
55767   <funcdef>int <function>spi_bus_unlock </function></funcdef>
55768   <paramdef>struct spi_master * <parameter>master</parameter></paramdef>
55769  </funcprototype></funcsynopsis>
55770</refsynopsisdiv>
55771<refsect1>
55772 <title>Arguments</title>
55773 <variablelist>
55774  <varlistentry>
55775   <term><parameter>master</parameter></term>
55776   <listitem>
55777    <para>
55778     SPI bus master that was locked for exclusive bus access
55779    </para>
55780   </listitem>
55781  </varlistentry>
55782 </variablelist>
55783</refsect1>
55784<refsect1>
55785<title>Context</title>
55786<para>
55787   can sleep
55788</para>
55789</refsect1>
55790<refsect1>
55791<title>Description</title>
55792<para>
55793   This call may only be used from a context that may sleep.  The sleep
55794   is non-interruptible, and has no timeout.
55795   </para><para>
55796
55797   This call releases an SPI bus lock previously obtained by an spi_bus_lock
55798   call.
55799   </para><para>
55800
55801   It returns zero on success, else a negative error code.
55802</para>
55803</refsect1>
55804</refentry>
55805
55806<refentry id="API-spi-write-then-read">
55807<refentryinfo>
55808 <title>LINUX</title>
55809 <productname>Kernel Hackers Manual</productname>
55810 <date>July 2017</date>
55811</refentryinfo>
55812<refmeta>
55813 <refentrytitle><phrase>spi_write_then_read</phrase></refentrytitle>
55814 <manvolnum>9</manvolnum>
55815 <refmiscinfo class="version">4.1.27</refmiscinfo>
55816</refmeta>
55817<refnamediv>
55818 <refname>spi_write_then_read</refname>
55819 <refpurpose>
55820     SPI synchronous write followed by read
55821 </refpurpose>
55822</refnamediv>
55823<refsynopsisdiv>
55824 <title>Synopsis</title>
55825  <funcsynopsis><funcprototype>
55826   <funcdef>int <function>spi_write_then_read </function></funcdef>
55827   <paramdef>struct spi_device * <parameter>spi</parameter></paramdef>
55828   <paramdef>const void * <parameter>txbuf</parameter></paramdef>
55829   <paramdef>unsigned <parameter>n_tx</parameter></paramdef>
55830   <paramdef>void * <parameter>rxbuf</parameter></paramdef>
55831   <paramdef>unsigned <parameter>n_rx</parameter></paramdef>
55832  </funcprototype></funcsynopsis>
55833</refsynopsisdiv>
55834<refsect1>
55835 <title>Arguments</title>
55836 <variablelist>
55837  <varlistentry>
55838   <term><parameter>spi</parameter></term>
55839   <listitem>
55840    <para>
55841     device with which data will be exchanged
55842    </para>
55843   </listitem>
55844  </varlistentry>
55845  <varlistentry>
55846   <term><parameter>txbuf</parameter></term>
55847   <listitem>
55848    <para>
55849     data to be written (need not be dma-safe)
55850    </para>
55851   </listitem>
55852  </varlistentry>
55853  <varlistentry>
55854   <term><parameter>n_tx</parameter></term>
55855   <listitem>
55856    <para>
55857     size of txbuf, in bytes
55858    </para>
55859   </listitem>
55860  </varlistentry>
55861  <varlistentry>
55862   <term><parameter>rxbuf</parameter></term>
55863   <listitem>
55864    <para>
55865     buffer into which data will be read (need not be dma-safe)
55866    </para>
55867   </listitem>
55868  </varlistentry>
55869  <varlistentry>
55870   <term><parameter>n_rx</parameter></term>
55871   <listitem>
55872    <para>
55873     size of rxbuf, in bytes
55874    </para>
55875   </listitem>
55876  </varlistentry>
55877 </variablelist>
55878</refsect1>
55879<refsect1>
55880<title>Context</title>
55881<para>
55882   can sleep
55883</para>
55884</refsect1>
55885<refsect1>
55886<title>Description</title>
55887<para>
55888   This performs a half duplex MicroWire style transaction with the
55889   device, sending txbuf and then reading rxbuf.  The return value
55890   is zero for success, else a negative errno status code.
55891   This call may only be used from a context that may sleep.
55892   </para><para>
55893
55894   Parameters to this routine are always copied using a small buffer;
55895   portable code should never use this for more than 32 bytes.
55896   Performance-sensitive or bulk transfer code should instead use
55897   spi_{async,sync}() calls with dma-safe buffers.
55898</para>
55899</refsect1>
55900</refentry>
55901
55902  </chapter>
55903
55904  <chapter id="i2c">
55905     <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
55906
55907     <para>
55908	I<superscript>2</superscript>C (or without fancy typography, "I2C")
55909	is an acronym for the "Inter-IC" bus, a simple bus protocol which is
55910	widely used where low data rate communications suffice.
55911	Since it's also a licensed trademark, some vendors use another
55912	name (such as "Two-Wire Interface", TWI) for the same bus.
55913	I2C only needs two signals (SCL for clock, SDA for data), conserving
55914	board real estate and minimizing signal quality issues.
55915	Most I2C devices use seven bit addresses, and bus speeds of up
55916	to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
55917	found wide use.
55918	I2C is a multi-master bus; open drain signaling is used to
55919	arbitrate between masters, as well as to handshake and to
55920	synchronize clocks from slower clients.
55921     </para>
55922
55923     <para>
55924	The Linux I2C programming interfaces support only the master
55925	side of bus interactions, not the slave side.
55926	The programming interface is structured around two kinds of driver,
55927	and two kinds of device.
55928	An I2C "Adapter Driver" abstracts the controller hardware; it binds
55929	to a physical device (perhaps a PCI device or platform_device) and
55930	exposes a <structname>struct i2c_adapter</structname> representing
55931	each I2C bus segment it manages.
55932	On each I2C bus segment will be I2C devices represented by a
55933	<structname>struct i2c_client</structname>.  Those devices will
55934	be bound to a <structname>struct i2c_driver</structname>,
55935	which should follow the standard Linux driver model.
55936	(At this writing, a legacy model is more widely used.)
55937	There are functions to perform various I2C protocol operations; at
55938	this writing all such functions are usable only from task context.
55939     </para>
55940
55941     <para>
55942	The System Management Bus (SMBus) is a sibling protocol.  Most SMBus
55943	systems are also I2C conformant.  The electrical constraints are
55944	tighter for SMBus, and it standardizes particular protocol messages
55945	and idioms.  Controllers that support I2C can also support most
55946	SMBus operations, but SMBus controllers don't support all the protocol
55947	options that an I2C controller will.
55948	There are functions to perform various SMBus protocol operations,
55949	either using I2C primitives or by issuing SMBus commands to
55950	i2c_adapter devices which don't support those I2C operations.
55951     </para>
55952
55953<!-- include/linux/i2c.h -->
55954<refentry id="API-struct-i2c-driver">
55955<refentryinfo>
55956 <title>LINUX</title>
55957 <productname>Kernel Hackers Manual</productname>
55958 <date>July 2017</date>
55959</refentryinfo>
55960<refmeta>
55961 <refentrytitle><phrase>struct i2c_driver</phrase></refentrytitle>
55962 <manvolnum>9</manvolnum>
55963 <refmiscinfo class="version">4.1.27</refmiscinfo>
55964</refmeta>
55965<refnamediv>
55966 <refname>struct i2c_driver</refname>
55967 <refpurpose>
55968  represent an I2C device driver
55969 </refpurpose>
55970</refnamediv>
55971<refsynopsisdiv>
55972 <title>Synopsis</title>
55973  <programlisting>
55974struct i2c_driver {
55975  unsigned int class;
55976  int (* attach_adapter) (struct i2c_adapter *);
55977  int (* probe) (struct i2c_client *, const struct i2c_device_id *);
55978  int (* remove) (struct i2c_client *);
55979  void (* shutdown) (struct i2c_client *);
55980  void (* alert) (struct i2c_client *, unsigned int data);
55981  int (* command) (struct i2c_client *client, unsigned int cmd, void *arg);
55982  struct device_driver driver;
55983  const struct i2c_device_id * id_table;
55984  int (* detect) (struct i2c_client *, struct i2c_board_info *);
55985  const unsigned short * address_list;
55986  struct list_head clients;
55987};  </programlisting>
55988</refsynopsisdiv>
55989 <refsect1>
55990  <title>Members</title>
55991  <variablelist>
55992    <varlistentry>      <term>class</term>
55993      <listitem><para>
55994What kind of i2c device we instantiate (for detect)
55995      </para></listitem>
55996    </varlistentry>
55997    <varlistentry>      <term>attach_adapter</term>
55998      <listitem><para>
55999Callback for bus addition (deprecated)
56000      </para></listitem>
56001    </varlistentry>
56002    <varlistentry>      <term>probe</term>
56003      <listitem><para>
56004Callback for device binding
56005      </para></listitem>
56006    </varlistentry>
56007    <varlistentry>      <term>remove</term>
56008      <listitem><para>
56009Callback for device unbinding
56010      </para></listitem>
56011    </varlistentry>
56012    <varlistentry>      <term>shutdown</term>
56013      <listitem><para>
56014Callback for device shutdown
56015      </para></listitem>
56016    </varlistentry>
56017    <varlistentry>      <term>alert</term>
56018      <listitem><para>
56019Alert callback, for example for the SMBus alert protocol
56020      </para></listitem>
56021    </varlistentry>
56022    <varlistentry>      <term>command</term>
56023      <listitem><para>
56024Callback for bus-wide signaling (optional)
56025      </para></listitem>
56026    </varlistentry>
56027    <varlistentry>      <term>driver</term>
56028      <listitem><para>
56029Device driver model driver
56030      </para></listitem>
56031    </varlistentry>
56032    <varlistentry>      <term>id_table</term>
56033      <listitem><para>
56034List of I2C devices supported by this driver
56035      </para></listitem>
56036    </varlistentry>
56037    <varlistentry>      <term>detect</term>
56038      <listitem><para>
56039Callback for device detection
56040      </para></listitem>
56041    </varlistentry>
56042    <varlistentry>      <term>address_list</term>
56043      <listitem><para>
56044The I2C addresses to probe (for detect)
56045      </para></listitem>
56046    </varlistentry>
56047    <varlistentry>      <term>clients</term>
56048      <listitem><para>
56049List of detected clients we created (for i2c-core use only)
56050      </para></listitem>
56051    </varlistentry>
56052  </variablelist>
56053 </refsect1>
56054<refsect1>
56055<title>Description</title>
56056<para>
56057   The driver.owner field should be set to the module owner of this driver.
56058   The driver.name field should be set to the name of this driver.
56059   </para><para>
56060
56061   For automatic device detection, both <parameter>detect</parameter> and <parameter>address_list</parameter> must
56062   be defined. <parameter>class</parameter> should also be set, otherwise only devices forced
56063   with module parameters will be created. The detect function must
56064   fill at least the name field of the i2c_board_info structure it is
56065   handed upon successful detection, and possibly also the flags field.
56066   </para><para>
56067
56068   If <parameter>detect</parameter> is missing, the driver will still work fine for enumerated
56069   devices. Detected devices simply won't be supported. This is expected
56070   for the many I2C/SMBus devices which can't be detected reliably, and
56071   the ones which can always be enumerated in practice.
56072   </para><para>
56073
56074   The i2c_client structure which is handed to the <parameter>detect</parameter> callback is
56075   not a real i2c_client. It is initialized just enough so that you can
56076   call i2c_smbus_read_byte_data and friends on it. Don't do anything
56077   else with it. In particular, calling dev_dbg and friends on it is
56078   not allowed.
56079</para>
56080</refsect1>
56081</refentry>
56082
56083<refentry id="API-struct-i2c-client">
56084<refentryinfo>
56085 <title>LINUX</title>
56086 <productname>Kernel Hackers Manual</productname>
56087 <date>July 2017</date>
56088</refentryinfo>
56089<refmeta>
56090 <refentrytitle><phrase>struct i2c_client</phrase></refentrytitle>
56091 <manvolnum>9</manvolnum>
56092 <refmiscinfo class="version">4.1.27</refmiscinfo>
56093</refmeta>
56094<refnamediv>
56095 <refname>struct i2c_client</refname>
56096 <refpurpose>
56097     represent an I2C slave device
56098 </refpurpose>
56099</refnamediv>
56100<refsynopsisdiv>
56101 <title>Synopsis</title>
56102  <programlisting>
56103struct i2c_client {
56104  unsigned short flags;
56105  unsigned short addr;
56106  char name[I2C_NAME_SIZE];
56107  struct i2c_adapter * adapter;
56108  struct device dev;
56109  int irq;
56110  struct list_head detected;
56111#if IS_ENABLED(CONFIG_I2C_SLAVE)
56112  i2c_slave_cb_t slave_cb;
56113#endif
56114};  </programlisting>
56115</refsynopsisdiv>
56116 <refsect1>
56117  <title>Members</title>
56118  <variablelist>
56119    <varlistentry>      <term>flags</term>
56120      <listitem><para>
56121   I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
56122   I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking
56123      </para></listitem>
56124    </varlistentry>
56125    <varlistentry>      <term>addr</term>
56126      <listitem><para>
56127   Address used on the I2C bus connected to the parent adapter.
56128      </para></listitem>
56129    </varlistentry>
56130    <varlistentry>      <term>name[I2C_NAME_SIZE]</term>
56131      <listitem><para>
56132   Indicates the type of the device, usually a chip name that's
56133   generic enough to hide second-sourcing and compatible revisions.
56134      </para></listitem>
56135    </varlistentry>
56136    <varlistentry>      <term>adapter</term>
56137      <listitem><para>
56138   manages the bus segment hosting this I2C device
56139      </para></listitem>
56140    </varlistentry>
56141    <varlistentry>      <term>dev</term>
56142      <listitem><para>
56143   Driver model device node for the slave.
56144      </para></listitem>
56145    </varlistentry>
56146    <varlistentry>      <term>irq</term>
56147      <listitem><para>
56148   indicates the IRQ generated by this device (if any)
56149      </para></listitem>
56150    </varlistentry>
56151    <varlistentry>      <term>detected</term>
56152      <listitem><para>
56153   member of an i2c_driver.clients list or i2c-core's
56154   userspace_devices list
56155      </para></listitem>
56156    </varlistentry>
56157    <varlistentry>      <term>slave_cb</term>
56158      <listitem><para>
56159   Callback when I2C slave mode of an adapter is used. The adapter
56160   calls it to pass on slave events to the slave driver.
56161      </para></listitem>
56162    </varlistentry>
56163  </variablelist>
56164 </refsect1>
56165<refsect1>
56166<title>Description</title>
56167<para>
56168   An i2c_client identifies a single device (i.e. chip) connected to an
56169   i2c bus. The behaviour exposed to Linux is defined by the driver
56170   managing the device.
56171</para>
56172</refsect1>
56173</refentry>
56174
56175<refentry id="API-struct-i2c-board-info">
56176<refentryinfo>
56177 <title>LINUX</title>
56178 <productname>Kernel Hackers Manual</productname>
56179 <date>July 2017</date>
56180</refentryinfo>
56181<refmeta>
56182 <refentrytitle><phrase>struct i2c_board_info</phrase></refentrytitle>
56183 <manvolnum>9</manvolnum>
56184 <refmiscinfo class="version">4.1.27</refmiscinfo>
56185</refmeta>
56186<refnamediv>
56187 <refname>struct i2c_board_info</refname>
56188 <refpurpose>
56189     template for device creation
56190 </refpurpose>
56191</refnamediv>
56192<refsynopsisdiv>
56193 <title>Synopsis</title>
56194  <programlisting>
56195struct i2c_board_info {
56196  char type[I2C_NAME_SIZE];
56197  unsigned short flags;
56198  unsigned short addr;
56199  void * platform_data;
56200  struct dev_archdata * archdata;
56201  struct device_node * of_node;
56202  struct fwnode_handle * fwnode;
56203  int irq;
56204};  </programlisting>
56205</refsynopsisdiv>
56206 <refsect1>
56207  <title>Members</title>
56208  <variablelist>
56209    <varlistentry>      <term>type[I2C_NAME_SIZE]</term>
56210      <listitem><para>
56211   chip type, to initialize i2c_client.name
56212      </para></listitem>
56213    </varlistentry>
56214    <varlistentry>      <term>flags</term>
56215      <listitem><para>
56216   to initialize i2c_client.flags
56217      </para></listitem>
56218    </varlistentry>
56219    <varlistentry>      <term>addr</term>
56220      <listitem><para>
56221   stored in i2c_client.addr
56222      </para></listitem>
56223    </varlistentry>
56224    <varlistentry>      <term>platform_data</term>
56225      <listitem><para>
56226   stored in i2c_client.dev.platform_data
56227      </para></listitem>
56228    </varlistentry>
56229    <varlistentry>      <term>archdata</term>
56230      <listitem><para>
56231   copied into i2c_client.dev.archdata
56232      </para></listitem>
56233    </varlistentry>
56234    <varlistentry>      <term>of_node</term>
56235      <listitem><para>
56236   pointer to OpenFirmware device node
56237      </para></listitem>
56238    </varlistentry>
56239    <varlistentry>      <term>fwnode</term>
56240      <listitem><para>
56241   device node supplied by the platform firmware
56242      </para></listitem>
56243    </varlistentry>
56244    <varlistentry>      <term>irq</term>
56245      <listitem><para>
56246   stored in i2c_client.irq
56247      </para></listitem>
56248    </varlistentry>
56249  </variablelist>
56250 </refsect1>
56251<refsect1>
56252<title>Description</title>
56253<para>
56254   I2C doesn't actually support hardware probing, although controllers and
56255   devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's
56256   a device at a given address.  Drivers commonly need more information than
56257   that, such as chip type, configuration, associated IRQ, and so on.
56258   </para><para>
56259
56260   i2c_board_info is used to build tables of information listing I2C devices
56261   that are present.  This information is used to grow the driver model tree.
56262   For mainboards this is done statically using <function>i2c_register_board_info</function>;
56263   bus numbers identify adapters that aren't yet available.  For add-on boards,
56264   <function>i2c_new_device</function> does this dynamically with the adapter already known.
56265</para>
56266</refsect1>
56267</refentry>
56268
56269<refentry id="API-I2C-BOARD-INFO">
56270<refentryinfo>
56271 <title>LINUX</title>
56272 <productname>Kernel Hackers Manual</productname>
56273 <date>July 2017</date>
56274</refentryinfo>
56275<refmeta>
56276 <refentrytitle><phrase>I2C_BOARD_INFO</phrase></refentrytitle>
56277 <manvolnum>9</manvolnum>
56278 <refmiscinfo class="version">4.1.27</refmiscinfo>
56279</refmeta>
56280<refnamediv>
56281 <refname>I2C_BOARD_INFO</refname>
56282 <refpurpose>
56283     macro used to list an i2c device and its address
56284 </refpurpose>
56285</refnamediv>
56286<refsynopsisdiv>
56287 <title>Synopsis</title>
56288  <funcsynopsis><funcprototype>
56289   <funcdef> <function>I2C_BOARD_INFO </function></funcdef>
56290   <paramdef> <parameter>dev_type</parameter></paramdef>
56291   <paramdef> <parameter>dev_addr</parameter></paramdef>
56292  </funcprototype></funcsynopsis>
56293</refsynopsisdiv>
56294<refsect1>
56295 <title>Arguments</title>
56296 <variablelist>
56297  <varlistentry>
56298   <term><parameter>dev_type</parameter></term>
56299   <listitem>
56300    <para>
56301     identifies the device type
56302    </para>
56303   </listitem>
56304  </varlistentry>
56305  <varlistentry>
56306   <term><parameter>dev_addr</parameter></term>
56307   <listitem>
56308    <para>
56309     the device's address on the bus.
56310    </para>
56311   </listitem>
56312  </varlistentry>
56313 </variablelist>
56314</refsect1>
56315<refsect1>
56316<title>Description</title>
56317<para>
56318   This macro initializes essential fields of a struct i2c_board_info,
56319   declaring what has been provided on a particular board.  Optional
56320   fields (such as associated irq, or device-specific platform_data)
56321   are provided using conventional syntax.
56322</para>
56323</refsect1>
56324</refentry>
56325
56326<refentry id="API-struct-i2c-algorithm">
56327<refentryinfo>
56328 <title>LINUX</title>
56329 <productname>Kernel Hackers Manual</productname>
56330 <date>July 2017</date>
56331</refentryinfo>
56332<refmeta>
56333 <refentrytitle><phrase>struct i2c_algorithm</phrase></refentrytitle>
56334 <manvolnum>9</manvolnum>
56335 <refmiscinfo class="version">4.1.27</refmiscinfo>
56336</refmeta>
56337<refnamediv>
56338 <refname>struct i2c_algorithm</refname>
56339 <refpurpose>
56340     represent I2C transfer method
56341 </refpurpose>
56342</refnamediv>
56343<refsynopsisdiv>
56344 <title>Synopsis</title>
56345  <programlisting>
56346struct i2c_algorithm {
56347  int (* master_xfer) (struct i2c_adapter *adap, struct i2c_msg *msgs,int num);
56348  int (* smbus_xfer) (struct i2c_adapter *adap, u16 addr,unsigned short flags, char read_write,u8 command, int size, union i2c_smbus_data *data);
56349  u32 (* functionality) (struct i2c_adapter *);
56350#if IS_ENABLED(CONFIG_I2C_SLAVE)
56351  int (* reg_slave) (struct i2c_client *client);
56352  int (* unreg_slave) (struct i2c_client *client);
56353#endif
56354};  </programlisting>
56355</refsynopsisdiv>
56356 <refsect1>
56357  <title>Members</title>
56358  <variablelist>
56359    <varlistentry>      <term>master_xfer</term>
56360      <listitem><para>
56361   Issue a set of i2c transactions to the given I2C adapter
56362   defined by the msgs array, with num messages available to transfer via
56363   the adapter specified by adap.
56364      </para></listitem>
56365    </varlistentry>
56366    <varlistentry>      <term>smbus_xfer</term>
56367      <listitem><para>
56368   Issue smbus transactions to the given I2C adapter. If this
56369   is not present, then the bus layer will try and convert the SMBus calls
56370   into I2C transfers instead.
56371      </para></listitem>
56372    </varlistentry>
56373    <varlistentry>      <term>functionality</term>
56374      <listitem><para>
56375   Return the flags that this algorithm/adapter pair supports
56376   from the I2C_FUNC_* flags.
56377      </para></listitem>
56378    </varlistentry>
56379    <varlistentry>      <term>reg_slave</term>
56380      <listitem><para>
56381   Register given client to I2C slave mode of this adapter
56382      </para></listitem>
56383    </varlistentry>
56384    <varlistentry>      <term>unreg_slave</term>
56385      <listitem><para>
56386   Unregister given client from I2C slave mode of this adapter
56387      </para></listitem>
56388    </varlistentry>
56389  </variablelist>
56390 </refsect1>
56391<refsect1>
56392<title>The following structs are for those who like to implement new bus drivers</title>
56393<para>
56394   i2c_algorithm is the interface to a class of hardware solutions which can
56395   be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
56396   to name two of the most common.
56397   </para><para>
56398
56399   The return codes from the <parameter>master_xfer</parameter> field should indicate the type of
56400   error code that occurred during the transfer, as documented in the kernel
56401   Documentation file Documentation/i2c/fault-codes.
56402</para>
56403</refsect1>
56404</refentry>
56405
56406<refentry id="API-struct-i2c-bus-recovery-info">
56407<refentryinfo>
56408 <title>LINUX</title>
56409 <productname>Kernel Hackers Manual</productname>
56410 <date>July 2017</date>
56411</refentryinfo>
56412<refmeta>
56413 <refentrytitle><phrase>struct i2c_bus_recovery_info</phrase></refentrytitle>
56414 <manvolnum>9</manvolnum>
56415 <refmiscinfo class="version">4.1.27</refmiscinfo>
56416</refmeta>
56417<refnamediv>
56418 <refname>struct i2c_bus_recovery_info</refname>
56419 <refpurpose>
56420     I2C bus recovery information
56421 </refpurpose>
56422</refnamediv>
56423<refsynopsisdiv>
56424 <title>Synopsis</title>
56425  <programlisting>
56426struct i2c_bus_recovery_info {
56427  int (* recover_bus) (struct i2c_adapter *);
56428  int (* get_scl) (struct i2c_adapter *);
56429  void (* set_scl) (struct i2c_adapter *, int val);
56430  int (* get_sda) (struct i2c_adapter *);
56431  void (* prepare_recovery) (struct i2c_adapter *);
56432  void (* unprepare_recovery) (struct i2c_adapter *);
56433  int scl_gpio;
56434  int sda_gpio;
56435};  </programlisting>
56436</refsynopsisdiv>
56437 <refsect1>
56438  <title>Members</title>
56439  <variablelist>
56440    <varlistentry>      <term>recover_bus</term>
56441      <listitem><para>
56442   Recover routine. Either pass driver's <function>recover_bus</function> routine, or
56443   <function>i2c_generic_scl_recovery</function> or <function>i2c_generic_gpio_recovery</function>.
56444      </para></listitem>
56445    </varlistentry>
56446    <varlistentry>      <term>get_scl</term>
56447      <listitem><para>
56448   This gets current value of SCL line. Mandatory for generic SCL
56449   recovery. Used internally for generic GPIO recovery.
56450      </para></listitem>
56451    </varlistentry>
56452    <varlistentry>      <term>set_scl</term>
56453      <listitem><para>
56454   This sets/clears SCL line. Mandatory for generic SCL recovery. Used
56455   internally for generic GPIO recovery.
56456      </para></listitem>
56457    </varlistentry>
56458    <varlistentry>      <term>get_sda</term>
56459      <listitem><para>
56460   This gets current value of SDA line. Optional for generic SCL
56461   recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO
56462   recovery.
56463      </para></listitem>
56464    </varlistentry>
56465    <varlistentry>      <term>prepare_recovery</term>
56466      <listitem><para>
56467   This will be called before starting recovery. Platform may
56468   configure padmux here for SDA/SCL line or something else they want.
56469      </para></listitem>
56470    </varlistentry>
56471    <varlistentry>      <term>unprepare_recovery</term>
56472      <listitem><para>
56473   This will be called after completing recovery. Platform
56474   may configure padmux here for SDA/SCL line or something else they want.
56475      </para></listitem>
56476    </varlistentry>
56477    <varlistentry>      <term>scl_gpio</term>
56478      <listitem><para>
56479   gpio number of the SCL line. Only required for GPIO recovery.
56480      </para></listitem>
56481    </varlistentry>
56482    <varlistentry>      <term>sda_gpio</term>
56483      <listitem><para>
56484   gpio number of the SDA line. Only required for GPIO recovery.
56485      </para></listitem>
56486    </varlistentry>
56487  </variablelist>
56488 </refsect1>
56489</refentry>
56490
56491<refentry id="API-struct-i2c-adapter-quirks">
56492<refentryinfo>
56493 <title>LINUX</title>
56494 <productname>Kernel Hackers Manual</productname>
56495 <date>July 2017</date>
56496</refentryinfo>
56497<refmeta>
56498 <refentrytitle><phrase>struct i2c_adapter_quirks</phrase></refentrytitle>
56499 <manvolnum>9</manvolnum>
56500 <refmiscinfo class="version">4.1.27</refmiscinfo>
56501</refmeta>
56502<refnamediv>
56503 <refname>struct i2c_adapter_quirks</refname>
56504 <refpurpose>
56505     describe flaws of an i2c adapter
56506 </refpurpose>
56507</refnamediv>
56508<refsynopsisdiv>
56509 <title>Synopsis</title>
56510  <programlisting>
56511struct i2c_adapter_quirks {
56512  u64 flags;
56513  int max_num_msgs;
56514  u16 max_write_len;
56515  u16 max_read_len;
56516  u16 max_comb_1st_msg_len;
56517  u16 max_comb_2nd_msg_len;
56518};  </programlisting>
56519</refsynopsisdiv>
56520 <refsect1>
56521  <title>Members</title>
56522  <variablelist>
56523    <varlistentry>      <term>flags</term>
56524      <listitem><para>
56525   see I2C_AQ_* for possible flags and read below
56526      </para></listitem>
56527    </varlistentry>
56528    <varlistentry>      <term>max_num_msgs</term>
56529      <listitem><para>
56530   maximum number of messages per transfer
56531      </para></listitem>
56532    </varlistentry>
56533    <varlistentry>      <term>max_write_len</term>
56534      <listitem><para>
56535   maximum length of a write message
56536      </para></listitem>
56537    </varlistentry>
56538    <varlistentry>      <term>max_read_len</term>
56539      <listitem><para>
56540   maximum length of a read message
56541      </para></listitem>
56542    </varlistentry>
56543    <varlistentry>      <term>max_comb_1st_msg_len</term>
56544      <listitem><para>
56545   maximum length of the first msg in a combined message
56546      </para></listitem>
56547    </varlistentry>
56548    <varlistentry>      <term>max_comb_2nd_msg_len</term>
56549      <listitem><para>
56550   maximum length of the second msg in a combined message
56551      </para></listitem>
56552    </varlistentry>
56553  </variablelist>
56554 </refsect1>
56555<refsect1>
56556<title>Note about combined messages</title>
56557<para>
56558   Some I2C controllers can only send one message
56559   per transfer, plus something called combined message or write-then-read.
56560   This is (usually) a small write message followed by a read message and
56561   barely enough to access register based devices like EEPROMs. There is a flag
56562   to support this mode. It implies max_num_msg = 2 and does the length checks
56563   with max_comb_*_len because combined message mode usually has its own
56564   limitations. Because of HW implementations, some controllers can actually do
56565   write-then-anything or other variants. To support that, write-then-read has
56566   been broken out into smaller bits like write-first and read-second which can
56567   be combined as needed.
56568</para>
56569</refsect1>
56570</refentry>
56571
56572<refentry id="API-module-i2c-driver">
56573<refentryinfo>
56574 <title>LINUX</title>
56575 <productname>Kernel Hackers Manual</productname>
56576 <date>July 2017</date>
56577</refentryinfo>
56578<refmeta>
56579 <refentrytitle><phrase>module_i2c_driver</phrase></refentrytitle>
56580 <manvolnum>9</manvolnum>
56581 <refmiscinfo class="version">4.1.27</refmiscinfo>
56582</refmeta>
56583<refnamediv>
56584 <refname>module_i2c_driver</refname>
56585 <refpurpose>
56586     Helper macro for registering a I2C driver
56587 </refpurpose>
56588</refnamediv>
56589<refsynopsisdiv>
56590 <title>Synopsis</title>
56591  <funcsynopsis><funcprototype>
56592   <funcdef> <function>module_i2c_driver </function></funcdef>
56593   <paramdef> <parameter>__i2c_driver</parameter></paramdef>
56594  </funcprototype></funcsynopsis>
56595</refsynopsisdiv>
56596<refsect1>
56597 <title>Arguments</title>
56598 <variablelist>
56599  <varlistentry>
56600   <term><parameter>__i2c_driver</parameter></term>
56601   <listitem>
56602    <para>
56603     i2c_driver struct
56604    </para>
56605   </listitem>
56606  </varlistentry>
56607 </variablelist>
56608</refsect1>
56609<refsect1>
56610<title>Description</title>
56611<para>
56612   Helper macro for I2C drivers which do not do anything special in module
56613   init/exit. This eliminates a lot of boilerplate. Each module may only
56614   use this macro once, and calling it replaces <function>module_init</function> and <function>module_exit</function>
56615</para>
56616</refsect1>
56617</refentry>
56618
56619<refentry id="API-i2c-register-board-info">
56620<refentryinfo>
56621 <title>LINUX</title>
56622 <productname>Kernel Hackers Manual</productname>
56623 <date>July 2017</date>
56624</refentryinfo>
56625<refmeta>
56626 <refentrytitle><phrase>i2c_register_board_info</phrase></refentrytitle>
56627 <manvolnum>9</manvolnum>
56628 <refmiscinfo class="version">4.1.27</refmiscinfo>
56629</refmeta>
56630<refnamediv>
56631 <refname>i2c_register_board_info</refname>
56632 <refpurpose>
56633  statically declare I2C devices
56634 </refpurpose>
56635</refnamediv>
56636<refsynopsisdiv>
56637 <title>Synopsis</title>
56638  <funcsynopsis><funcprototype>
56639   <funcdef>int <function>i2c_register_board_info </function></funcdef>
56640   <paramdef>int <parameter>busnum</parameter></paramdef>
56641   <paramdef>struct i2c_board_info const * <parameter>info</parameter></paramdef>
56642   <paramdef>unsigned <parameter>len</parameter></paramdef>
56643  </funcprototype></funcsynopsis>
56644</refsynopsisdiv>
56645<refsect1>
56646 <title>Arguments</title>
56647 <variablelist>
56648  <varlistentry>
56649   <term><parameter>busnum</parameter></term>
56650   <listitem>
56651    <para>
56652     identifies the bus to which these devices belong
56653    </para>
56654   </listitem>
56655  </varlistentry>
56656  <varlistentry>
56657   <term><parameter>info</parameter></term>
56658   <listitem>
56659    <para>
56660     vector of i2c device descriptors
56661    </para>
56662   </listitem>
56663  </varlistentry>
56664  <varlistentry>
56665   <term><parameter>len</parameter></term>
56666   <listitem>
56667    <para>
56668     how many descriptors in the vector; may be zero to reserve
56669     the specified bus number.
56670    </para>
56671   </listitem>
56672  </varlistentry>
56673 </variablelist>
56674</refsect1>
56675<refsect1>
56676<title>Description</title>
56677<para>
56678   Systems using the Linux I2C driver stack can declare tables of board info
56679   while they initialize.  This should be done in board-specific init code
56680   near <function>arch_initcall</function> time, or equivalent, before any I2C adapter driver is
56681   registered.  For example, mainboard init code could define several devices,
56682   as could the init code for each daughtercard in a board stack.
56683   </para><para>
56684
56685   The I2C devices will be created later, after the adapter for the relevant
56686   bus has been registered.  After that moment, standard driver model tools
56687   are used to bind <quote>new style</quote> I2C drivers to the devices.  The bus number
56688   for any device declared using this routine is not available for dynamic
56689   allocation.
56690   </para><para>
56691
56692   The board info passed can safely be __initdata, but be careful of embedded
56693   pointers (for platform_data, functions, etc) since that won't be copied.
56694</para>
56695</refsect1>
56696</refentry>
56697
56698<!-- drivers/i2c/i2c-core.c -->
56699<refentry id="API-i2c-verify-client">
56700<refentryinfo>
56701 <title>LINUX</title>
56702 <productname>Kernel Hackers Manual</productname>
56703 <date>July 2017</date>
56704</refentryinfo>
56705<refmeta>
56706 <refentrytitle><phrase>i2c_verify_client</phrase></refentrytitle>
56707 <manvolnum>9</manvolnum>
56708 <refmiscinfo class="version">4.1.27</refmiscinfo>
56709</refmeta>
56710<refnamediv>
56711 <refname>i2c_verify_client</refname>
56712 <refpurpose>
56713  return parameter as i2c_client, or NULL
56714 </refpurpose>
56715</refnamediv>
56716<refsynopsisdiv>
56717 <title>Synopsis</title>
56718  <funcsynopsis><funcprototype>
56719   <funcdef>struct i2c_client * <function>i2c_verify_client </function></funcdef>
56720   <paramdef>struct device * <parameter>dev</parameter></paramdef>
56721  </funcprototype></funcsynopsis>
56722</refsynopsisdiv>
56723<refsect1>
56724 <title>Arguments</title>
56725 <variablelist>
56726  <varlistentry>
56727   <term><parameter>dev</parameter></term>
56728   <listitem>
56729    <para>
56730     device, probably from some driver model iterator
56731    </para>
56732   </listitem>
56733  </varlistentry>
56734 </variablelist>
56735</refsect1>
56736<refsect1>
56737<title>Description</title>
56738<para>
56739   When traversing the driver model tree, perhaps using driver model
56740   iterators like <parameter>device_for_each_child</parameter>(), you can't assume very much
56741   about the nodes you find.  Use this function to avoid oopses caused
56742   by wrongly treating some non-I2C device as an i2c_client.
56743</para>
56744</refsect1>
56745</refentry>
56746
56747<refentry id="API-i2c-lock-adapter">
56748<refentryinfo>
56749 <title>LINUX</title>
56750 <productname>Kernel Hackers Manual</productname>
56751 <date>July 2017</date>
56752</refentryinfo>
56753<refmeta>
56754 <refentrytitle><phrase>i2c_lock_adapter</phrase></refentrytitle>
56755 <manvolnum>9</manvolnum>
56756 <refmiscinfo class="version">4.1.27</refmiscinfo>
56757</refmeta>
56758<refnamediv>
56759 <refname>i2c_lock_adapter</refname>
56760 <refpurpose>
56761     Get exclusive access to an I2C bus segment
56762 </refpurpose>
56763</refnamediv>
56764<refsynopsisdiv>
56765 <title>Synopsis</title>
56766  <funcsynopsis><funcprototype>
56767   <funcdef>void <function>i2c_lock_adapter </function></funcdef>
56768   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
56769  </funcprototype></funcsynopsis>
56770</refsynopsisdiv>
56771<refsect1>
56772 <title>Arguments</title>
56773 <variablelist>
56774  <varlistentry>
56775   <term><parameter>adapter</parameter></term>
56776   <listitem>
56777    <para>
56778     Target I2C bus segment
56779    </para>
56780   </listitem>
56781  </varlistentry>
56782 </variablelist>
56783</refsect1>
56784</refentry>
56785
56786<refentry id="API-i2c-unlock-adapter">
56787<refentryinfo>
56788 <title>LINUX</title>
56789 <productname>Kernel Hackers Manual</productname>
56790 <date>July 2017</date>
56791</refentryinfo>
56792<refmeta>
56793 <refentrytitle><phrase>i2c_unlock_adapter</phrase></refentrytitle>
56794 <manvolnum>9</manvolnum>
56795 <refmiscinfo class="version">4.1.27</refmiscinfo>
56796</refmeta>
56797<refnamediv>
56798 <refname>i2c_unlock_adapter</refname>
56799 <refpurpose>
56800     Release exclusive access to an I2C bus segment
56801 </refpurpose>
56802</refnamediv>
56803<refsynopsisdiv>
56804 <title>Synopsis</title>
56805  <funcsynopsis><funcprototype>
56806   <funcdef>void <function>i2c_unlock_adapter </function></funcdef>
56807   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
56808  </funcprototype></funcsynopsis>
56809</refsynopsisdiv>
56810<refsect1>
56811 <title>Arguments</title>
56812 <variablelist>
56813  <varlistentry>
56814   <term><parameter>adapter</parameter></term>
56815   <listitem>
56816    <para>
56817     Target I2C bus segment
56818    </para>
56819   </listitem>
56820  </varlistentry>
56821 </variablelist>
56822</refsect1>
56823</refentry>
56824
56825<refentry id="API-i2c-new-device">
56826<refentryinfo>
56827 <title>LINUX</title>
56828 <productname>Kernel Hackers Manual</productname>
56829 <date>July 2017</date>
56830</refentryinfo>
56831<refmeta>
56832 <refentrytitle><phrase>i2c_new_device</phrase></refentrytitle>
56833 <manvolnum>9</manvolnum>
56834 <refmiscinfo class="version">4.1.27</refmiscinfo>
56835</refmeta>
56836<refnamediv>
56837 <refname>i2c_new_device</refname>
56838 <refpurpose>
56839     instantiate an i2c device
56840 </refpurpose>
56841</refnamediv>
56842<refsynopsisdiv>
56843 <title>Synopsis</title>
56844  <funcsynopsis><funcprototype>
56845   <funcdef>struct i2c_client * <function>i2c_new_device </function></funcdef>
56846   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
56847   <paramdef>struct i2c_board_info const * <parameter>info</parameter></paramdef>
56848  </funcprototype></funcsynopsis>
56849</refsynopsisdiv>
56850<refsect1>
56851 <title>Arguments</title>
56852 <variablelist>
56853  <varlistentry>
56854   <term><parameter>adap</parameter></term>
56855   <listitem>
56856    <para>
56857     the adapter managing the device
56858    </para>
56859   </listitem>
56860  </varlistentry>
56861  <varlistentry>
56862   <term><parameter>info</parameter></term>
56863   <listitem>
56864    <para>
56865     describes one I2C device; bus_num is ignored
56866    </para>
56867   </listitem>
56868  </varlistentry>
56869 </variablelist>
56870</refsect1>
56871<refsect1>
56872<title>Context</title>
56873<para>
56874   can sleep
56875</para>
56876</refsect1>
56877<refsect1>
56878<title>Description</title>
56879<para>
56880   Create an i2c device. Binding is handled through driver model
56881   <function>probe</function>/<function>remove</function> methods.  A driver may be bound to this device when we
56882   return from this function, or any later moment (e.g. maybe hotplugging will
56883   load the driver module).  This call is not appropriate for use by mainboard
56884   initialization logic, which usually runs during an <function>arch_initcall</function> long
56885   before any i2c_adapter could exist.
56886   </para><para>
56887
56888   This returns the new i2c client, which may be saved for later use with
56889   <function>i2c_unregister_device</function>; or NULL to indicate an error.
56890</para>
56891</refsect1>
56892</refentry>
56893
56894<refentry id="API-i2c-unregister-device">
56895<refentryinfo>
56896 <title>LINUX</title>
56897 <productname>Kernel Hackers Manual</productname>
56898 <date>July 2017</date>
56899</refentryinfo>
56900<refmeta>
56901 <refentrytitle><phrase>i2c_unregister_device</phrase></refentrytitle>
56902 <manvolnum>9</manvolnum>
56903 <refmiscinfo class="version">4.1.27</refmiscinfo>
56904</refmeta>
56905<refnamediv>
56906 <refname>i2c_unregister_device</refname>
56907 <refpurpose>
56908     reverse effect of <function>i2c_new_device</function>
56909 </refpurpose>
56910</refnamediv>
56911<refsynopsisdiv>
56912 <title>Synopsis</title>
56913  <funcsynopsis><funcprototype>
56914   <funcdef>void <function>i2c_unregister_device </function></funcdef>
56915   <paramdef>struct i2c_client * <parameter>client</parameter></paramdef>
56916  </funcprototype></funcsynopsis>
56917</refsynopsisdiv>
56918<refsect1>
56919 <title>Arguments</title>
56920 <variablelist>
56921  <varlistentry>
56922   <term><parameter>client</parameter></term>
56923   <listitem>
56924    <para>
56925     value returned from <function>i2c_new_device</function>
56926    </para>
56927   </listitem>
56928  </varlistentry>
56929 </variablelist>
56930</refsect1>
56931<refsect1>
56932<title>Context</title>
56933<para>
56934   can sleep
56935</para>
56936</refsect1>
56937</refentry>
56938
56939<refentry id="API-i2c-new-dummy">
56940<refentryinfo>
56941 <title>LINUX</title>
56942 <productname>Kernel Hackers Manual</productname>
56943 <date>July 2017</date>
56944</refentryinfo>
56945<refmeta>
56946 <refentrytitle><phrase>i2c_new_dummy</phrase></refentrytitle>
56947 <manvolnum>9</manvolnum>
56948 <refmiscinfo class="version">4.1.27</refmiscinfo>
56949</refmeta>
56950<refnamediv>
56951 <refname>i2c_new_dummy</refname>
56952 <refpurpose>
56953     return a new i2c device bound to a dummy driver
56954 </refpurpose>
56955</refnamediv>
56956<refsynopsisdiv>
56957 <title>Synopsis</title>
56958  <funcsynopsis><funcprototype>
56959   <funcdef>struct i2c_client * <function>i2c_new_dummy </function></funcdef>
56960   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
56961   <paramdef>u16 <parameter>address</parameter></paramdef>
56962  </funcprototype></funcsynopsis>
56963</refsynopsisdiv>
56964<refsect1>
56965 <title>Arguments</title>
56966 <variablelist>
56967  <varlistentry>
56968   <term><parameter>adapter</parameter></term>
56969   <listitem>
56970    <para>
56971     the adapter managing the device
56972    </para>
56973   </listitem>
56974  </varlistentry>
56975  <varlistentry>
56976   <term><parameter>address</parameter></term>
56977   <listitem>
56978    <para>
56979     seven bit address to be used
56980    </para>
56981   </listitem>
56982  </varlistentry>
56983 </variablelist>
56984</refsect1>
56985<refsect1>
56986<title>Context</title>
56987<para>
56988   can sleep
56989</para>
56990</refsect1>
56991<refsect1>
56992<title>Description</title>
56993<para>
56994   This returns an I2C client bound to the <quote>dummy</quote> driver, intended for use
56995   with devices that consume multiple addresses.  Examples of such chips
56996   include various EEPROMS (like 24c04 and 24c08 models).
56997   </para><para>
56998
56999   These dummy devices have two main uses.  First, most I2C and SMBus calls
57000   except <function>i2c_transfer</function> need a client handle; the dummy will be that handle.
57001   And second, this prevents the specified address from being bound to a
57002   different driver.
57003   </para><para>
57004
57005   This returns the new i2c client, which should be saved for later use with
57006   <function>i2c_unregister_device</function>; or NULL to indicate an error.
57007</para>
57008</refsect1>
57009</refentry>
57010
57011<refentry id="API-i2c-verify-adapter">
57012<refentryinfo>
57013 <title>LINUX</title>
57014 <productname>Kernel Hackers Manual</productname>
57015 <date>July 2017</date>
57016</refentryinfo>
57017<refmeta>
57018 <refentrytitle><phrase>i2c_verify_adapter</phrase></refentrytitle>
57019 <manvolnum>9</manvolnum>
57020 <refmiscinfo class="version">4.1.27</refmiscinfo>
57021</refmeta>
57022<refnamediv>
57023 <refname>i2c_verify_adapter</refname>
57024 <refpurpose>
57025     return parameter as i2c_adapter or NULL
57026 </refpurpose>
57027</refnamediv>
57028<refsynopsisdiv>
57029 <title>Synopsis</title>
57030  <funcsynopsis><funcprototype>
57031   <funcdef>struct i2c_adapter * <function>i2c_verify_adapter </function></funcdef>
57032   <paramdef>struct device * <parameter>dev</parameter></paramdef>
57033  </funcprototype></funcsynopsis>
57034</refsynopsisdiv>
57035<refsect1>
57036 <title>Arguments</title>
57037 <variablelist>
57038  <varlistentry>
57039   <term><parameter>dev</parameter></term>
57040   <listitem>
57041    <para>
57042     device, probably from some driver model iterator
57043    </para>
57044   </listitem>
57045  </varlistentry>
57046 </variablelist>
57047</refsect1>
57048<refsect1>
57049<title>Description</title>
57050<para>
57051   When traversing the driver model tree, perhaps using driver model
57052   iterators like <parameter>device_for_each_child</parameter>(), you can't assume very much
57053   about the nodes you find.  Use this function to avoid oopses caused
57054   by wrongly treating some non-I2C device as an i2c_adapter.
57055</para>
57056</refsect1>
57057</refentry>
57058
57059<refentry id="API-i2c-add-adapter">
57060<refentryinfo>
57061 <title>LINUX</title>
57062 <productname>Kernel Hackers Manual</productname>
57063 <date>July 2017</date>
57064</refentryinfo>
57065<refmeta>
57066 <refentrytitle><phrase>i2c_add_adapter</phrase></refentrytitle>
57067 <manvolnum>9</manvolnum>
57068 <refmiscinfo class="version">4.1.27</refmiscinfo>
57069</refmeta>
57070<refnamediv>
57071 <refname>i2c_add_adapter</refname>
57072 <refpurpose>
57073     declare i2c adapter, use dynamic bus number
57074 </refpurpose>
57075</refnamediv>
57076<refsynopsisdiv>
57077 <title>Synopsis</title>
57078  <funcsynopsis><funcprototype>
57079   <funcdef>int <function>i2c_add_adapter </function></funcdef>
57080   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
57081  </funcprototype></funcsynopsis>
57082</refsynopsisdiv>
57083<refsect1>
57084 <title>Arguments</title>
57085 <variablelist>
57086  <varlistentry>
57087   <term><parameter>adapter</parameter></term>
57088   <listitem>
57089    <para>
57090     the adapter to add
57091    </para>
57092   </listitem>
57093  </varlistentry>
57094 </variablelist>
57095</refsect1>
57096<refsect1>
57097<title>Context</title>
57098<para>
57099   can sleep
57100</para>
57101</refsect1>
57102<refsect1>
57103<title>Description</title>
57104<para>
57105   This routine is used to declare an I2C adapter when its bus number
57106   doesn't matter or when its bus number is specified by an dt alias.
57107   Examples of bases when the bus number doesn't matter: I2C adapters
57108   dynamically added by USB links or PCI plugin cards.
57109   </para><para>
57110
57111   When this returns zero, a new bus number was allocated and stored
57112   in adap-&gt;nr, and the specified adapter became available for clients.
57113   Otherwise, a negative errno value is returned.
57114</para>
57115</refsect1>
57116</refentry>
57117
57118<refentry id="API-i2c-add-numbered-adapter">
57119<refentryinfo>
57120 <title>LINUX</title>
57121 <productname>Kernel Hackers Manual</productname>
57122 <date>July 2017</date>
57123</refentryinfo>
57124<refmeta>
57125 <refentrytitle><phrase>i2c_add_numbered_adapter</phrase></refentrytitle>
57126 <manvolnum>9</manvolnum>
57127 <refmiscinfo class="version">4.1.27</refmiscinfo>
57128</refmeta>
57129<refnamediv>
57130 <refname>i2c_add_numbered_adapter</refname>
57131 <refpurpose>
57132     declare i2c adapter, use static bus number
57133 </refpurpose>
57134</refnamediv>
57135<refsynopsisdiv>
57136 <title>Synopsis</title>
57137  <funcsynopsis><funcprototype>
57138   <funcdef>int <function>i2c_add_numbered_adapter </function></funcdef>
57139   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
57140  </funcprototype></funcsynopsis>
57141</refsynopsisdiv>
57142<refsect1>
57143 <title>Arguments</title>
57144 <variablelist>
57145  <varlistentry>
57146   <term><parameter>adap</parameter></term>
57147   <listitem>
57148    <para>
57149     the adapter to register (with adap-&gt;nr initialized)
57150    </para>
57151   </listitem>
57152  </varlistentry>
57153 </variablelist>
57154</refsect1>
57155<refsect1>
57156<title>Context</title>
57157<para>
57158   can sleep
57159</para>
57160</refsect1>
57161<refsect1>
57162<title>Description</title>
57163<para>
57164   This routine is used to declare an I2C adapter when its bus number
57165   matters.  For example, use it for I2C adapters from system-on-chip CPUs,
57166   or otherwise built in to the system's mainboard, and where i2c_board_info
57167   is used to properly configure I2C devices.
57168   </para><para>
57169
57170   If the requested bus number is set to -1, then this function will behave
57171   identically to i2c_add_adapter, and will dynamically assign a bus number.
57172   </para><para>
57173
57174   If no devices have pre-been declared for this bus, then be sure to
57175   register the adapter before any dynamically allocated ones.  Otherwise
57176   the required bus ID may not be available.
57177   </para><para>
57178
57179   When this returns zero, the specified adapter became available for
57180   clients using the bus number provided in adap-&gt;nr.  Also, the table
57181   of I2C devices pre-declared using <function>i2c_register_board_info</function> is scanned,
57182   and the appropriate driver model device nodes are created.  Otherwise, a
57183   negative errno value is returned.
57184</para>
57185</refsect1>
57186</refentry>
57187
57188<refentry id="API-i2c-del-adapter">
57189<refentryinfo>
57190 <title>LINUX</title>
57191 <productname>Kernel Hackers Manual</productname>
57192 <date>July 2017</date>
57193</refentryinfo>
57194<refmeta>
57195 <refentrytitle><phrase>i2c_del_adapter</phrase></refentrytitle>
57196 <manvolnum>9</manvolnum>
57197 <refmiscinfo class="version">4.1.27</refmiscinfo>
57198</refmeta>
57199<refnamediv>
57200 <refname>i2c_del_adapter</refname>
57201 <refpurpose>
57202     unregister I2C adapter
57203 </refpurpose>
57204</refnamediv>
57205<refsynopsisdiv>
57206 <title>Synopsis</title>
57207  <funcsynopsis><funcprototype>
57208   <funcdef>void <function>i2c_del_adapter </function></funcdef>
57209   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
57210  </funcprototype></funcsynopsis>
57211</refsynopsisdiv>
57212<refsect1>
57213 <title>Arguments</title>
57214 <variablelist>
57215  <varlistentry>
57216   <term><parameter>adap</parameter></term>
57217   <listitem>
57218    <para>
57219     the adapter being unregistered
57220    </para>
57221   </listitem>
57222  </varlistentry>
57223 </variablelist>
57224</refsect1>
57225<refsect1>
57226<title>Context</title>
57227<para>
57228   can sleep
57229</para>
57230</refsect1>
57231<refsect1>
57232<title>Description</title>
57233<para>
57234   This unregisters an I2C adapter which was previously registered
57235   by <parameter>i2c_add_adapter</parameter> or <parameter>i2c_add_numbered_adapter</parameter>.
57236</para>
57237</refsect1>
57238</refentry>
57239
57240<refentry id="API-i2c-del-driver">
57241<refentryinfo>
57242 <title>LINUX</title>
57243 <productname>Kernel Hackers Manual</productname>
57244 <date>July 2017</date>
57245</refentryinfo>
57246<refmeta>
57247 <refentrytitle><phrase>i2c_del_driver</phrase></refentrytitle>
57248 <manvolnum>9</manvolnum>
57249 <refmiscinfo class="version">4.1.27</refmiscinfo>
57250</refmeta>
57251<refnamediv>
57252 <refname>i2c_del_driver</refname>
57253 <refpurpose>
57254     unregister I2C driver
57255 </refpurpose>
57256</refnamediv>
57257<refsynopsisdiv>
57258 <title>Synopsis</title>
57259  <funcsynopsis><funcprototype>
57260   <funcdef>void <function>i2c_del_driver </function></funcdef>
57261   <paramdef>struct i2c_driver * <parameter>driver</parameter></paramdef>
57262  </funcprototype></funcsynopsis>
57263</refsynopsisdiv>
57264<refsect1>
57265 <title>Arguments</title>
57266 <variablelist>
57267  <varlistentry>
57268   <term><parameter>driver</parameter></term>
57269   <listitem>
57270    <para>
57271     the driver being unregistered
57272    </para>
57273   </listitem>
57274  </varlistentry>
57275 </variablelist>
57276</refsect1>
57277<refsect1>
57278<title>Context</title>
57279<para>
57280   can sleep
57281</para>
57282</refsect1>
57283</refentry>
57284
57285<refentry id="API-i2c-use-client">
57286<refentryinfo>
57287 <title>LINUX</title>
57288 <productname>Kernel Hackers Manual</productname>
57289 <date>July 2017</date>
57290</refentryinfo>
57291<refmeta>
57292 <refentrytitle><phrase>i2c_use_client</phrase></refentrytitle>
57293 <manvolnum>9</manvolnum>
57294 <refmiscinfo class="version">4.1.27</refmiscinfo>
57295</refmeta>
57296<refnamediv>
57297 <refname>i2c_use_client</refname>
57298 <refpurpose>
57299     increments the reference count of the i2c client structure
57300 </refpurpose>
57301</refnamediv>
57302<refsynopsisdiv>
57303 <title>Synopsis</title>
57304  <funcsynopsis><funcprototype>
57305   <funcdef>struct i2c_client * <function>i2c_use_client </function></funcdef>
57306   <paramdef>struct i2c_client * <parameter>client</parameter></paramdef>
57307  </funcprototype></funcsynopsis>
57308</refsynopsisdiv>
57309<refsect1>
57310 <title>Arguments</title>
57311 <variablelist>
57312  <varlistentry>
57313   <term><parameter>client</parameter></term>
57314   <listitem>
57315    <para>
57316     the client being referenced
57317    </para>
57318   </listitem>
57319  </varlistentry>
57320 </variablelist>
57321</refsect1>
57322<refsect1>
57323<title>Description</title>
57324<para>
57325   Each live reference to a client should be refcounted. The driver model does
57326   that automatically as part of driver binding, so that most drivers don't
57327</para>
57328</refsect1>
57329<refsect1>
57330<title>need to do this explicitly</title>
57331<para>
57332   they hold a reference until they're unbound
57333   from the device.
57334   </para><para>
57335
57336   A pointer to the client with the incremented reference counter is returned.
57337</para>
57338</refsect1>
57339</refentry>
57340
57341<refentry id="API-i2c-release-client">
57342<refentryinfo>
57343 <title>LINUX</title>
57344 <productname>Kernel Hackers Manual</productname>
57345 <date>July 2017</date>
57346</refentryinfo>
57347<refmeta>
57348 <refentrytitle><phrase>i2c_release_client</phrase></refentrytitle>
57349 <manvolnum>9</manvolnum>
57350 <refmiscinfo class="version">4.1.27</refmiscinfo>
57351</refmeta>
57352<refnamediv>
57353 <refname>i2c_release_client</refname>
57354 <refpurpose>
57355     release a use of the i2c client structure
57356 </refpurpose>
57357</refnamediv>
57358<refsynopsisdiv>
57359 <title>Synopsis</title>
57360  <funcsynopsis><funcprototype>
57361   <funcdef>void <function>i2c_release_client </function></funcdef>
57362   <paramdef>struct i2c_client * <parameter>client</parameter></paramdef>
57363  </funcprototype></funcsynopsis>
57364</refsynopsisdiv>
57365<refsect1>
57366 <title>Arguments</title>
57367 <variablelist>
57368  <varlistentry>
57369   <term><parameter>client</parameter></term>
57370   <listitem>
57371    <para>
57372     the client being no longer referenced
57373    </para>
57374   </listitem>
57375  </varlistentry>
57376 </variablelist>
57377</refsect1>
57378<refsect1>
57379<title>Description</title>
57380<para>
57381   Must be called when a user of a client is finished with it.
57382</para>
57383</refsect1>
57384</refentry>
57385
57386<refentry id="API---i2c-transfer">
57387<refentryinfo>
57388 <title>LINUX</title>
57389 <productname>Kernel Hackers Manual</productname>
57390 <date>July 2017</date>
57391</refentryinfo>
57392<refmeta>
57393 <refentrytitle><phrase>__i2c_transfer</phrase></refentrytitle>
57394 <manvolnum>9</manvolnum>
57395 <refmiscinfo class="version">4.1.27</refmiscinfo>
57396</refmeta>
57397<refnamediv>
57398 <refname>__i2c_transfer</refname>
57399 <refpurpose>
57400     unlocked flavor of i2c_transfer
57401 </refpurpose>
57402</refnamediv>
57403<refsynopsisdiv>
57404 <title>Synopsis</title>
57405  <funcsynopsis><funcprototype>
57406   <funcdef>int <function>__i2c_transfer </function></funcdef>
57407   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
57408   <paramdef>struct i2c_msg * <parameter>msgs</parameter></paramdef>
57409   <paramdef>int <parameter>num</parameter></paramdef>
57410  </funcprototype></funcsynopsis>
57411</refsynopsisdiv>
57412<refsect1>
57413 <title>Arguments</title>
57414 <variablelist>
57415  <varlistentry>
57416   <term><parameter>adap</parameter></term>
57417   <listitem>
57418    <para>
57419     Handle to I2C bus
57420    </para>
57421   </listitem>
57422  </varlistentry>
57423  <varlistentry>
57424   <term><parameter>msgs</parameter></term>
57425   <listitem>
57426    <para>
57427     One or more messages to execute before STOP is issued to
57428     terminate the operation; each message begins with a START.
57429    </para>
57430   </listitem>
57431  </varlistentry>
57432  <varlistentry>
57433   <term><parameter>num</parameter></term>
57434   <listitem>
57435    <para>
57436     Number of messages to be executed.
57437    </para>
57438   </listitem>
57439  </varlistentry>
57440 </variablelist>
57441</refsect1>
57442<refsect1>
57443<title>Description</title>
57444<para>
57445   Returns negative errno, else the number of messages executed.
57446   </para><para>
57447
57448   Adapter lock must be held when calling this function. No debug logging
57449   takes place. adap-&gt;algo-&gt;master_xfer existence isn't checked.
57450</para>
57451</refsect1>
57452</refentry>
57453
57454<refentry id="API-i2c-transfer">
57455<refentryinfo>
57456 <title>LINUX</title>
57457 <productname>Kernel Hackers Manual</productname>
57458 <date>July 2017</date>
57459</refentryinfo>
57460<refmeta>
57461 <refentrytitle><phrase>i2c_transfer</phrase></refentrytitle>
57462 <manvolnum>9</manvolnum>
57463 <refmiscinfo class="version">4.1.27</refmiscinfo>
57464</refmeta>
57465<refnamediv>
57466 <refname>i2c_transfer</refname>
57467 <refpurpose>
57468     execute a single or combined I2C message
57469 </refpurpose>
57470</refnamediv>
57471<refsynopsisdiv>
57472 <title>Synopsis</title>
57473  <funcsynopsis><funcprototype>
57474   <funcdef>int <function>i2c_transfer </function></funcdef>
57475   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
57476   <paramdef>struct i2c_msg * <parameter>msgs</parameter></paramdef>
57477   <paramdef>int <parameter>num</parameter></paramdef>
57478  </funcprototype></funcsynopsis>
57479</refsynopsisdiv>
57480<refsect1>
57481 <title>Arguments</title>
57482 <variablelist>
57483  <varlistentry>
57484   <term><parameter>adap</parameter></term>
57485   <listitem>
57486    <para>
57487     Handle to I2C bus
57488    </para>
57489   </listitem>
57490  </varlistentry>
57491  <varlistentry>
57492   <term><parameter>msgs</parameter></term>
57493   <listitem>
57494    <para>
57495     One or more messages to execute before STOP is issued to
57496     terminate the operation; each message begins with a START.
57497    </para>
57498   </listitem>
57499  </varlistentry>
57500  <varlistentry>
57501   <term><parameter>num</parameter></term>
57502   <listitem>
57503    <para>
57504     Number of messages to be executed.
57505    </para>
57506   </listitem>
57507  </varlistentry>
57508 </variablelist>
57509</refsect1>
57510<refsect1>
57511<title>Description</title>
57512<para>
57513   Returns negative errno, else the number of messages executed.
57514   </para><para>
57515
57516   Note that there is no requirement that each message be sent to
57517   the same slave address, although that is the most common model.
57518</para>
57519</refsect1>
57520</refentry>
57521
57522<refentry id="API-i2c-master-send">
57523<refentryinfo>
57524 <title>LINUX</title>
57525 <productname>Kernel Hackers Manual</productname>
57526 <date>July 2017</date>
57527</refentryinfo>
57528<refmeta>
57529 <refentrytitle><phrase>i2c_master_send</phrase></refentrytitle>
57530 <manvolnum>9</manvolnum>
57531 <refmiscinfo class="version">4.1.27</refmiscinfo>
57532</refmeta>
57533<refnamediv>
57534 <refname>i2c_master_send</refname>
57535 <refpurpose>
57536     issue a single I2C message in master transmit mode
57537 </refpurpose>
57538</refnamediv>
57539<refsynopsisdiv>
57540 <title>Synopsis</title>
57541  <funcsynopsis><funcprototype>
57542   <funcdef>int <function>i2c_master_send </function></funcdef>
57543   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57544   <paramdef>const char * <parameter>buf</parameter></paramdef>
57545   <paramdef>int <parameter>count</parameter></paramdef>
57546  </funcprototype></funcsynopsis>
57547</refsynopsisdiv>
57548<refsect1>
57549 <title>Arguments</title>
57550 <variablelist>
57551  <varlistentry>
57552   <term><parameter>client</parameter></term>
57553   <listitem>
57554    <para>
57555     Handle to slave device
57556    </para>
57557   </listitem>
57558  </varlistentry>
57559  <varlistentry>
57560   <term><parameter>buf</parameter></term>
57561   <listitem>
57562    <para>
57563     Data that will be written to the slave
57564    </para>
57565   </listitem>
57566  </varlistentry>
57567  <varlistentry>
57568   <term><parameter>count</parameter></term>
57569   <listitem>
57570    <para>
57571     How many bytes to write, must be less than 64k since msg.len is u16
57572    </para>
57573   </listitem>
57574  </varlistentry>
57575 </variablelist>
57576</refsect1>
57577<refsect1>
57578<title>Description</title>
57579<para>
57580   Returns negative errno, or else the number of bytes written.
57581</para>
57582</refsect1>
57583</refentry>
57584
57585<refentry id="API-i2c-master-recv">
57586<refentryinfo>
57587 <title>LINUX</title>
57588 <productname>Kernel Hackers Manual</productname>
57589 <date>July 2017</date>
57590</refentryinfo>
57591<refmeta>
57592 <refentrytitle><phrase>i2c_master_recv</phrase></refentrytitle>
57593 <manvolnum>9</manvolnum>
57594 <refmiscinfo class="version">4.1.27</refmiscinfo>
57595</refmeta>
57596<refnamediv>
57597 <refname>i2c_master_recv</refname>
57598 <refpurpose>
57599     issue a single I2C message in master receive mode
57600 </refpurpose>
57601</refnamediv>
57602<refsynopsisdiv>
57603 <title>Synopsis</title>
57604  <funcsynopsis><funcprototype>
57605   <funcdef>int <function>i2c_master_recv </function></funcdef>
57606   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57607   <paramdef>char * <parameter>buf</parameter></paramdef>
57608   <paramdef>int <parameter>count</parameter></paramdef>
57609  </funcprototype></funcsynopsis>
57610</refsynopsisdiv>
57611<refsect1>
57612 <title>Arguments</title>
57613 <variablelist>
57614  <varlistentry>
57615   <term><parameter>client</parameter></term>
57616   <listitem>
57617    <para>
57618     Handle to slave device
57619    </para>
57620   </listitem>
57621  </varlistentry>
57622  <varlistentry>
57623   <term><parameter>buf</parameter></term>
57624   <listitem>
57625    <para>
57626     Where to store data read from slave
57627    </para>
57628   </listitem>
57629  </varlistentry>
57630  <varlistentry>
57631   <term><parameter>count</parameter></term>
57632   <listitem>
57633    <para>
57634     How many bytes to read, must be less than 64k since msg.len is u16
57635    </para>
57636   </listitem>
57637  </varlistentry>
57638 </variablelist>
57639</refsect1>
57640<refsect1>
57641<title>Description</title>
57642<para>
57643   Returns negative errno, or else the number of bytes read.
57644</para>
57645</refsect1>
57646</refentry>
57647
57648<refentry id="API-i2c-smbus-read-byte">
57649<refentryinfo>
57650 <title>LINUX</title>
57651 <productname>Kernel Hackers Manual</productname>
57652 <date>July 2017</date>
57653</refentryinfo>
57654<refmeta>
57655 <refentrytitle><phrase>i2c_smbus_read_byte</phrase></refentrytitle>
57656 <manvolnum>9</manvolnum>
57657 <refmiscinfo class="version">4.1.27</refmiscinfo>
57658</refmeta>
57659<refnamediv>
57660 <refname>i2c_smbus_read_byte</refname>
57661 <refpurpose>
57662     SMBus <quote>receive byte</quote> protocol
57663 </refpurpose>
57664</refnamediv>
57665<refsynopsisdiv>
57666 <title>Synopsis</title>
57667  <funcsynopsis><funcprototype>
57668   <funcdef>s32 <function>i2c_smbus_read_byte </function></funcdef>
57669   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57670  </funcprototype></funcsynopsis>
57671</refsynopsisdiv>
57672<refsect1>
57673 <title>Arguments</title>
57674 <variablelist>
57675  <varlistentry>
57676   <term><parameter>client</parameter></term>
57677   <listitem>
57678    <para>
57679     Handle to slave device
57680    </para>
57681   </listitem>
57682  </varlistentry>
57683 </variablelist>
57684</refsect1>
57685<refsect1>
57686<title>Description</title>
57687<para>
57688   This executes the SMBus <quote>receive byte</quote> protocol, returning negative errno
57689   else the byte received from the device.
57690</para>
57691</refsect1>
57692</refentry>
57693
57694<refentry id="API-i2c-smbus-write-byte">
57695<refentryinfo>
57696 <title>LINUX</title>
57697 <productname>Kernel Hackers Manual</productname>
57698 <date>July 2017</date>
57699</refentryinfo>
57700<refmeta>
57701 <refentrytitle><phrase>i2c_smbus_write_byte</phrase></refentrytitle>
57702 <manvolnum>9</manvolnum>
57703 <refmiscinfo class="version">4.1.27</refmiscinfo>
57704</refmeta>
57705<refnamediv>
57706 <refname>i2c_smbus_write_byte</refname>
57707 <refpurpose>
57708     SMBus <quote>send byte</quote> protocol
57709 </refpurpose>
57710</refnamediv>
57711<refsynopsisdiv>
57712 <title>Synopsis</title>
57713  <funcsynopsis><funcprototype>
57714   <funcdef>s32 <function>i2c_smbus_write_byte </function></funcdef>
57715   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57716   <paramdef>u8 <parameter>value</parameter></paramdef>
57717  </funcprototype></funcsynopsis>
57718</refsynopsisdiv>
57719<refsect1>
57720 <title>Arguments</title>
57721 <variablelist>
57722  <varlistentry>
57723   <term><parameter>client</parameter></term>
57724   <listitem>
57725    <para>
57726     Handle to slave device
57727    </para>
57728   </listitem>
57729  </varlistentry>
57730  <varlistentry>
57731   <term><parameter>value</parameter></term>
57732   <listitem>
57733    <para>
57734     Byte to be sent
57735    </para>
57736   </listitem>
57737  </varlistentry>
57738 </variablelist>
57739</refsect1>
57740<refsect1>
57741<title>Description</title>
57742<para>
57743   This executes the SMBus <quote>send byte</quote> protocol, returning negative errno
57744   else zero on success.
57745</para>
57746</refsect1>
57747</refentry>
57748
57749<refentry id="API-i2c-smbus-read-byte-data">
57750<refentryinfo>
57751 <title>LINUX</title>
57752 <productname>Kernel Hackers Manual</productname>
57753 <date>July 2017</date>
57754</refentryinfo>
57755<refmeta>
57756 <refentrytitle><phrase>i2c_smbus_read_byte_data</phrase></refentrytitle>
57757 <manvolnum>9</manvolnum>
57758 <refmiscinfo class="version">4.1.27</refmiscinfo>
57759</refmeta>
57760<refnamediv>
57761 <refname>i2c_smbus_read_byte_data</refname>
57762 <refpurpose>
57763     SMBus <quote>read byte</quote> protocol
57764 </refpurpose>
57765</refnamediv>
57766<refsynopsisdiv>
57767 <title>Synopsis</title>
57768  <funcsynopsis><funcprototype>
57769   <funcdef>s32 <function>i2c_smbus_read_byte_data </function></funcdef>
57770   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57771   <paramdef>u8 <parameter>command</parameter></paramdef>
57772  </funcprototype></funcsynopsis>
57773</refsynopsisdiv>
57774<refsect1>
57775 <title>Arguments</title>
57776 <variablelist>
57777  <varlistentry>
57778   <term><parameter>client</parameter></term>
57779   <listitem>
57780    <para>
57781     Handle to slave device
57782    </para>
57783   </listitem>
57784  </varlistentry>
57785  <varlistentry>
57786   <term><parameter>command</parameter></term>
57787   <listitem>
57788    <para>
57789     Byte interpreted by slave
57790    </para>
57791   </listitem>
57792  </varlistentry>
57793 </variablelist>
57794</refsect1>
57795<refsect1>
57796<title>Description</title>
57797<para>
57798   This executes the SMBus <quote>read byte</quote> protocol, returning negative errno
57799   else a data byte received from the device.
57800</para>
57801</refsect1>
57802</refentry>
57803
57804<refentry id="API-i2c-smbus-write-byte-data">
57805<refentryinfo>
57806 <title>LINUX</title>
57807 <productname>Kernel Hackers Manual</productname>
57808 <date>July 2017</date>
57809</refentryinfo>
57810<refmeta>
57811 <refentrytitle><phrase>i2c_smbus_write_byte_data</phrase></refentrytitle>
57812 <manvolnum>9</manvolnum>
57813 <refmiscinfo class="version">4.1.27</refmiscinfo>
57814</refmeta>
57815<refnamediv>
57816 <refname>i2c_smbus_write_byte_data</refname>
57817 <refpurpose>
57818     SMBus <quote>write byte</quote> protocol
57819 </refpurpose>
57820</refnamediv>
57821<refsynopsisdiv>
57822 <title>Synopsis</title>
57823  <funcsynopsis><funcprototype>
57824   <funcdef>s32 <function>i2c_smbus_write_byte_data </function></funcdef>
57825   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57826   <paramdef>u8 <parameter>command</parameter></paramdef>
57827   <paramdef>u8 <parameter>value</parameter></paramdef>
57828  </funcprototype></funcsynopsis>
57829</refsynopsisdiv>
57830<refsect1>
57831 <title>Arguments</title>
57832 <variablelist>
57833  <varlistentry>
57834   <term><parameter>client</parameter></term>
57835   <listitem>
57836    <para>
57837     Handle to slave device
57838    </para>
57839   </listitem>
57840  </varlistentry>
57841  <varlistentry>
57842   <term><parameter>command</parameter></term>
57843   <listitem>
57844    <para>
57845     Byte interpreted by slave
57846    </para>
57847   </listitem>
57848  </varlistentry>
57849  <varlistentry>
57850   <term><parameter>value</parameter></term>
57851   <listitem>
57852    <para>
57853     Byte being written
57854    </para>
57855   </listitem>
57856  </varlistentry>
57857 </variablelist>
57858</refsect1>
57859<refsect1>
57860<title>Description</title>
57861<para>
57862   This executes the SMBus <quote>write byte</quote> protocol, returning negative errno
57863   else zero on success.
57864</para>
57865</refsect1>
57866</refentry>
57867
57868<refentry id="API-i2c-smbus-read-word-data">
57869<refentryinfo>
57870 <title>LINUX</title>
57871 <productname>Kernel Hackers Manual</productname>
57872 <date>July 2017</date>
57873</refentryinfo>
57874<refmeta>
57875 <refentrytitle><phrase>i2c_smbus_read_word_data</phrase></refentrytitle>
57876 <manvolnum>9</manvolnum>
57877 <refmiscinfo class="version">4.1.27</refmiscinfo>
57878</refmeta>
57879<refnamediv>
57880 <refname>i2c_smbus_read_word_data</refname>
57881 <refpurpose>
57882     SMBus <quote>read word</quote> protocol
57883 </refpurpose>
57884</refnamediv>
57885<refsynopsisdiv>
57886 <title>Synopsis</title>
57887  <funcsynopsis><funcprototype>
57888   <funcdef>s32 <function>i2c_smbus_read_word_data </function></funcdef>
57889   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57890   <paramdef>u8 <parameter>command</parameter></paramdef>
57891  </funcprototype></funcsynopsis>
57892</refsynopsisdiv>
57893<refsect1>
57894 <title>Arguments</title>
57895 <variablelist>
57896  <varlistentry>
57897   <term><parameter>client</parameter></term>
57898   <listitem>
57899    <para>
57900     Handle to slave device
57901    </para>
57902   </listitem>
57903  </varlistentry>
57904  <varlistentry>
57905   <term><parameter>command</parameter></term>
57906   <listitem>
57907    <para>
57908     Byte interpreted by slave
57909    </para>
57910   </listitem>
57911  </varlistentry>
57912 </variablelist>
57913</refsect1>
57914<refsect1>
57915<title>Description</title>
57916<para>
57917   This executes the SMBus <quote>read word</quote> protocol, returning negative errno
57918   else a 16-bit unsigned <quote>word</quote> received from the device.
57919</para>
57920</refsect1>
57921</refentry>
57922
57923<refentry id="API-i2c-smbus-write-word-data">
57924<refentryinfo>
57925 <title>LINUX</title>
57926 <productname>Kernel Hackers Manual</productname>
57927 <date>July 2017</date>
57928</refentryinfo>
57929<refmeta>
57930 <refentrytitle><phrase>i2c_smbus_write_word_data</phrase></refentrytitle>
57931 <manvolnum>9</manvolnum>
57932 <refmiscinfo class="version">4.1.27</refmiscinfo>
57933</refmeta>
57934<refnamediv>
57935 <refname>i2c_smbus_write_word_data</refname>
57936 <refpurpose>
57937     SMBus <quote>write word</quote> protocol
57938 </refpurpose>
57939</refnamediv>
57940<refsynopsisdiv>
57941 <title>Synopsis</title>
57942  <funcsynopsis><funcprototype>
57943   <funcdef>s32 <function>i2c_smbus_write_word_data </function></funcdef>
57944   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
57945   <paramdef>u8 <parameter>command</parameter></paramdef>
57946   <paramdef>u16 <parameter>value</parameter></paramdef>
57947  </funcprototype></funcsynopsis>
57948</refsynopsisdiv>
57949<refsect1>
57950 <title>Arguments</title>
57951 <variablelist>
57952  <varlistentry>
57953   <term><parameter>client</parameter></term>
57954   <listitem>
57955    <para>
57956     Handle to slave device
57957    </para>
57958   </listitem>
57959  </varlistentry>
57960  <varlistentry>
57961   <term><parameter>command</parameter></term>
57962   <listitem>
57963    <para>
57964     Byte interpreted by slave
57965    </para>
57966   </listitem>
57967  </varlistentry>
57968  <varlistentry>
57969   <term><parameter>value</parameter></term>
57970   <listitem>
57971    <para>
57972     16-bit <quote>word</quote> being written
57973    </para>
57974   </listitem>
57975  </varlistentry>
57976 </variablelist>
57977</refsect1>
57978<refsect1>
57979<title>Description</title>
57980<para>
57981   This executes the SMBus <quote>write word</quote> protocol, returning negative errno
57982   else zero on success.
57983</para>
57984</refsect1>
57985</refentry>
57986
57987<refentry id="API-i2c-smbus-read-block-data">
57988<refentryinfo>
57989 <title>LINUX</title>
57990 <productname>Kernel Hackers Manual</productname>
57991 <date>July 2017</date>
57992</refentryinfo>
57993<refmeta>
57994 <refentrytitle><phrase>i2c_smbus_read_block_data</phrase></refentrytitle>
57995 <manvolnum>9</manvolnum>
57996 <refmiscinfo class="version">4.1.27</refmiscinfo>
57997</refmeta>
57998<refnamediv>
57999 <refname>i2c_smbus_read_block_data</refname>
58000 <refpurpose>
58001     SMBus <quote>block read</quote> protocol
58002 </refpurpose>
58003</refnamediv>
58004<refsynopsisdiv>
58005 <title>Synopsis</title>
58006  <funcsynopsis><funcprototype>
58007   <funcdef>s32 <function>i2c_smbus_read_block_data </function></funcdef>
58008   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
58009   <paramdef>u8 <parameter>command</parameter></paramdef>
58010   <paramdef>u8 * <parameter>values</parameter></paramdef>
58011  </funcprototype></funcsynopsis>
58012</refsynopsisdiv>
58013<refsect1>
58014 <title>Arguments</title>
58015 <variablelist>
58016  <varlistentry>
58017   <term><parameter>client</parameter></term>
58018   <listitem>
58019    <para>
58020     Handle to slave device
58021    </para>
58022   </listitem>
58023  </varlistentry>
58024  <varlistentry>
58025   <term><parameter>command</parameter></term>
58026   <listitem>
58027    <para>
58028     Byte interpreted by slave
58029    </para>
58030   </listitem>
58031  </varlistentry>
58032  <varlistentry>
58033   <term><parameter>values</parameter></term>
58034   <listitem>
58035    <para>
58036     Byte array into which data will be read; big enough to hold
58037     the data returned by the slave.  SMBus allows at most 32 bytes.
58038    </para>
58039   </listitem>
58040  </varlistentry>
58041 </variablelist>
58042</refsect1>
58043<refsect1>
58044<title>Description</title>
58045<para>
58046   This executes the SMBus <quote>block read</quote> protocol, returning negative errno
58047   else the number of data bytes in the slave's response.
58048   </para><para>
58049
58050   Note that using this function requires that the client's adapter support
58051   the I2C_FUNC_SMBUS_READ_BLOCK_DATA functionality.  Not all adapter drivers
58052   support this; its emulation through I2C messaging relies on a specific
58053   mechanism (I2C_M_RECV_LEN) which may not be implemented.
58054</para>
58055</refsect1>
58056</refentry>
58057
58058<refentry id="API-i2c-smbus-write-block-data">
58059<refentryinfo>
58060 <title>LINUX</title>
58061 <productname>Kernel Hackers Manual</productname>
58062 <date>July 2017</date>
58063</refentryinfo>
58064<refmeta>
58065 <refentrytitle><phrase>i2c_smbus_write_block_data</phrase></refentrytitle>
58066 <manvolnum>9</manvolnum>
58067 <refmiscinfo class="version">4.1.27</refmiscinfo>
58068</refmeta>
58069<refnamediv>
58070 <refname>i2c_smbus_write_block_data</refname>
58071 <refpurpose>
58072     SMBus <quote>block write</quote> protocol
58073 </refpurpose>
58074</refnamediv>
58075<refsynopsisdiv>
58076 <title>Synopsis</title>
58077  <funcsynopsis><funcprototype>
58078   <funcdef>s32 <function>i2c_smbus_write_block_data </function></funcdef>
58079   <paramdef>const struct i2c_client * <parameter>client</parameter></paramdef>
58080   <paramdef>u8 <parameter>command</parameter></paramdef>
58081   <paramdef>u8 <parameter>length</parameter></paramdef>
58082   <paramdef>const u8 * <parameter>values</parameter></paramdef>
58083  </funcprototype></funcsynopsis>
58084</refsynopsisdiv>
58085<refsect1>
58086 <title>Arguments</title>
58087 <variablelist>
58088  <varlistentry>
58089   <term><parameter>client</parameter></term>
58090   <listitem>
58091    <para>
58092     Handle to slave device
58093    </para>
58094   </listitem>
58095  </varlistentry>
58096  <varlistentry>
58097   <term><parameter>command</parameter></term>
58098   <listitem>
58099    <para>
58100     Byte interpreted by slave
58101    </para>
58102   </listitem>
58103  </varlistentry>
58104  <varlistentry>
58105   <term><parameter>length</parameter></term>
58106   <listitem>
58107    <para>
58108     Size of data block; SMBus allows at most 32 bytes
58109    </para>
58110   </listitem>
58111  </varlistentry>
58112  <varlistentry>
58113   <term><parameter>values</parameter></term>
58114   <listitem>
58115    <para>
58116     Byte array which will be written.
58117    </para>
58118   </listitem>
58119  </varlistentry>
58120 </variablelist>
58121</refsect1>
58122<refsect1>
58123<title>Description</title>
58124<para>
58125   This executes the SMBus <quote>block write</quote> protocol, returning negative errno
58126   else zero on success.
58127</para>
58128</refsect1>
58129</refentry>
58130
58131<refentry id="API-i2c-smbus-xfer">
58132<refentryinfo>
58133 <title>LINUX</title>
58134 <productname>Kernel Hackers Manual</productname>
58135 <date>July 2017</date>
58136</refentryinfo>
58137<refmeta>
58138 <refentrytitle><phrase>i2c_smbus_xfer</phrase></refentrytitle>
58139 <manvolnum>9</manvolnum>
58140 <refmiscinfo class="version">4.1.27</refmiscinfo>
58141</refmeta>
58142<refnamediv>
58143 <refname>i2c_smbus_xfer</refname>
58144 <refpurpose>
58145     execute SMBus protocol operations
58146 </refpurpose>
58147</refnamediv>
58148<refsynopsisdiv>
58149 <title>Synopsis</title>
58150  <funcsynopsis><funcprototype>
58151   <funcdef>s32 <function>i2c_smbus_xfer </function></funcdef>
58152   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
58153   <paramdef>u16 <parameter>addr</parameter></paramdef>
58154   <paramdef>unsigned short <parameter>flags</parameter></paramdef>
58155   <paramdef>char <parameter>read_write</parameter></paramdef>
58156   <paramdef>u8 <parameter>command</parameter></paramdef>
58157   <paramdef>int <parameter>protocol</parameter></paramdef>
58158   <paramdef>union i2c_smbus_data * <parameter>data</parameter></paramdef>
58159  </funcprototype></funcsynopsis>
58160</refsynopsisdiv>
58161<refsect1>
58162 <title>Arguments</title>
58163 <variablelist>
58164  <varlistentry>
58165   <term><parameter>adapter</parameter></term>
58166   <listitem>
58167    <para>
58168     Handle to I2C bus
58169    </para>
58170   </listitem>
58171  </varlistentry>
58172  <varlistentry>
58173   <term><parameter>addr</parameter></term>
58174   <listitem>
58175    <para>
58176     Address of SMBus slave on that bus
58177    </para>
58178   </listitem>
58179  </varlistentry>
58180  <varlistentry>
58181   <term><parameter>flags</parameter></term>
58182   <listitem>
58183    <para>
58184     I2C_CLIENT_* flags (usually zero or I2C_CLIENT_PEC)
58185    </para>
58186   </listitem>
58187  </varlistentry>
58188  <varlistentry>
58189   <term><parameter>read_write</parameter></term>
58190   <listitem>
58191    <para>
58192     I2C_SMBUS_READ or I2C_SMBUS_WRITE
58193    </para>
58194   </listitem>
58195  </varlistentry>
58196  <varlistentry>
58197   <term><parameter>command</parameter></term>
58198   <listitem>
58199    <para>
58200     Byte interpreted by slave, for protocols which use such bytes
58201    </para>
58202   </listitem>
58203  </varlistentry>
58204  <varlistentry>
58205   <term><parameter>protocol</parameter></term>
58206   <listitem>
58207    <para>
58208     SMBus protocol operation to execute, such as I2C_SMBUS_PROC_CALL
58209    </para>
58210   </listitem>
58211  </varlistentry>
58212  <varlistentry>
58213   <term><parameter>data</parameter></term>
58214   <listitem>
58215    <para>
58216     Data to be read or written
58217    </para>
58218   </listitem>
58219  </varlistentry>
58220 </variablelist>
58221</refsect1>
58222<refsect1>
58223<title>Description</title>
58224<para>
58225   This executes an SMBus protocol operation, and returns a negative
58226   errno code else zero on success.
58227</para>
58228</refsect1>
58229</refentry>
58230
58231  </chapter>
58232
58233  <chapter id="hsi">
58234     <title>High Speed Synchronous Serial Interface (HSI)</title>
58235
58236     <para>
58237	High Speed Synchronous Serial Interface (HSI) is a
58238	serial interface mainly used for connecting application
58239	engines (APE) with cellular modem engines (CMT) in cellular
58240	handsets.
58241
58242	HSI provides multiplexing for up to 16 logical channels,
58243	low-latency and full duplex communication.
58244     </para>
58245
58246<!-- include/linux/hsi/hsi.h -->
58247<refentry id="API-struct-hsi-channel">
58248<refentryinfo>
58249 <title>LINUX</title>
58250 <productname>Kernel Hackers Manual</productname>
58251 <date>July 2017</date>
58252</refentryinfo>
58253<refmeta>
58254 <refentrytitle><phrase>struct hsi_channel</phrase></refentrytitle>
58255 <manvolnum>9</manvolnum>
58256 <refmiscinfo class="version">4.1.27</refmiscinfo>
58257</refmeta>
58258<refnamediv>
58259 <refname>struct hsi_channel</refname>
58260 <refpurpose>
58261  channel resource used by the hsi clients
58262 </refpurpose>
58263</refnamediv>
58264<refsynopsisdiv>
58265 <title>Synopsis</title>
58266  <programlisting>
58267struct hsi_channel {
58268  unsigned int id;
58269  const char * name;
58270};  </programlisting>
58271</refsynopsisdiv>
58272 <refsect1>
58273  <title>Members</title>
58274  <variablelist>
58275    <varlistentry>      <term>id</term>
58276      <listitem><para>
58277Channel number
58278      </para></listitem>
58279    </varlistentry>
58280    <varlistentry>      <term>name</term>
58281      <listitem><para>
58282Channel name
58283      </para></listitem>
58284    </varlistentry>
58285  </variablelist>
58286 </refsect1>
58287</refentry>
58288
58289<refentry id="API-struct-hsi-config">
58290<refentryinfo>
58291 <title>LINUX</title>
58292 <productname>Kernel Hackers Manual</productname>
58293 <date>July 2017</date>
58294</refentryinfo>
58295<refmeta>
58296 <refentrytitle><phrase>struct hsi_config</phrase></refentrytitle>
58297 <manvolnum>9</manvolnum>
58298 <refmiscinfo class="version">4.1.27</refmiscinfo>
58299</refmeta>
58300<refnamediv>
58301 <refname>struct hsi_config</refname>
58302 <refpurpose>
58303     Configuration for RX/TX HSI modules
58304 </refpurpose>
58305</refnamediv>
58306<refsynopsisdiv>
58307 <title>Synopsis</title>
58308  <programlisting>
58309struct hsi_config {
58310  unsigned int mode;
58311  struct hsi_channel * channels;
58312  unsigned int num_channels;
58313  unsigned int num_hw_channels;
58314  unsigned int speed;
58315  union {unnamed_union};
58316};  </programlisting>
58317</refsynopsisdiv>
58318 <refsect1>
58319  <title>Members</title>
58320  <variablelist>
58321    <varlistentry>      <term>mode</term>
58322      <listitem><para>
58323   Bit transmission mode (STREAM or FRAME)
58324      </para></listitem>
58325    </varlistentry>
58326    <varlistentry>      <term>channels</term>
58327      <listitem><para>
58328   Channel resources used by the client
58329      </para></listitem>
58330    </varlistentry>
58331    <varlistentry>      <term>num_channels</term>
58332      <listitem><para>
58333   Number of channel resources
58334      </para></listitem>
58335    </varlistentry>
58336    <varlistentry>      <term>num_hw_channels</term>
58337      <listitem><para>
58338   Number of channels the transceiver is configured for [1..16]
58339      </para></listitem>
58340    </varlistentry>
58341    <varlistentry>      <term>speed</term>
58342      <listitem><para>
58343   Max bit transmission speed (Kbit/s)
58344      </para></listitem>
58345    </varlistentry>
58346    <varlistentry>      <term>{unnamed_union}</term>
58347      <listitem><para>
58348   anonymous
58349      </para></listitem>
58350    </varlistentry>
58351  </variablelist>
58352 </refsect1>
58353</refentry>
58354
58355<refentry id="API-struct-hsi-board-info">
58356<refentryinfo>
58357 <title>LINUX</title>
58358 <productname>Kernel Hackers Manual</productname>
58359 <date>July 2017</date>
58360</refentryinfo>
58361<refmeta>
58362 <refentrytitle><phrase>struct hsi_board_info</phrase></refentrytitle>
58363 <manvolnum>9</manvolnum>
58364 <refmiscinfo class="version">4.1.27</refmiscinfo>
58365</refmeta>
58366<refnamediv>
58367 <refname>struct hsi_board_info</refname>
58368 <refpurpose>
58369     HSI client board info
58370 </refpurpose>
58371</refnamediv>
58372<refsynopsisdiv>
58373 <title>Synopsis</title>
58374  <programlisting>
58375struct hsi_board_info {
58376  const char * name;
58377  unsigned int hsi_id;
58378  unsigned int port;
58379  struct hsi_config tx_cfg;
58380  struct hsi_config rx_cfg;
58381  void * platform_data;
58382  struct dev_archdata * archdata;
58383};  </programlisting>
58384</refsynopsisdiv>
58385 <refsect1>
58386  <title>Members</title>
58387  <variablelist>
58388    <varlistentry>      <term>name</term>
58389      <listitem><para>
58390   Name for the HSI device
58391      </para></listitem>
58392    </varlistentry>
58393    <varlistentry>      <term>hsi_id</term>
58394      <listitem><para>
58395   HSI controller id where the client sits
58396      </para></listitem>
58397    </varlistentry>
58398    <varlistentry>      <term>port</term>
58399      <listitem><para>
58400   Port number in the controller where the client sits
58401      </para></listitem>
58402    </varlistentry>
58403    <varlistentry>      <term>tx_cfg</term>
58404      <listitem><para>
58405   HSI TX configuration
58406      </para></listitem>
58407    </varlistentry>
58408    <varlistentry>      <term>rx_cfg</term>
58409      <listitem><para>
58410   HSI RX configuration
58411      </para></listitem>
58412    </varlistentry>
58413    <varlistentry>      <term>platform_data</term>
58414      <listitem><para>
58415   Platform related data
58416      </para></listitem>
58417    </varlistentry>
58418    <varlistentry>      <term>archdata</term>
58419      <listitem><para>
58420   Architecture-dependent device data
58421      </para></listitem>
58422    </varlistentry>
58423  </variablelist>
58424 </refsect1>
58425</refentry>
58426
58427<refentry id="API-struct-hsi-client">
58428<refentryinfo>
58429 <title>LINUX</title>
58430 <productname>Kernel Hackers Manual</productname>
58431 <date>July 2017</date>
58432</refentryinfo>
58433<refmeta>
58434 <refentrytitle><phrase>struct hsi_client</phrase></refentrytitle>
58435 <manvolnum>9</manvolnum>
58436 <refmiscinfo class="version">4.1.27</refmiscinfo>
58437</refmeta>
58438<refnamediv>
58439 <refname>struct hsi_client</refname>
58440 <refpurpose>
58441     HSI client attached to an HSI port
58442 </refpurpose>
58443</refnamediv>
58444<refsynopsisdiv>
58445 <title>Synopsis</title>
58446  <programlisting>
58447struct hsi_client {
58448  struct device device;
58449  struct hsi_config tx_cfg;
58450  struct hsi_config rx_cfg;
58451};  </programlisting>
58452</refsynopsisdiv>
58453 <refsect1>
58454  <title>Members</title>
58455  <variablelist>
58456    <varlistentry>      <term>device</term>
58457      <listitem><para>
58458   Driver model representation of the device
58459      </para></listitem>
58460    </varlistentry>
58461    <varlistentry>      <term>tx_cfg</term>
58462      <listitem><para>
58463   HSI TX configuration
58464      </para></listitem>
58465    </varlistentry>
58466    <varlistentry>      <term>rx_cfg</term>
58467      <listitem><para>
58468   HSI RX configuration
58469      </para></listitem>
58470    </varlistentry>
58471  </variablelist>
58472 </refsect1>
58473</refentry>
58474
58475<refentry id="API-struct-hsi-client-driver">
58476<refentryinfo>
58477 <title>LINUX</title>
58478 <productname>Kernel Hackers Manual</productname>
58479 <date>July 2017</date>
58480</refentryinfo>
58481<refmeta>
58482 <refentrytitle><phrase>struct hsi_client_driver</phrase></refentrytitle>
58483 <manvolnum>9</manvolnum>
58484 <refmiscinfo class="version">4.1.27</refmiscinfo>
58485</refmeta>
58486<refnamediv>
58487 <refname>struct hsi_client_driver</refname>
58488 <refpurpose>
58489     Driver associated to an HSI client
58490 </refpurpose>
58491</refnamediv>
58492<refsynopsisdiv>
58493 <title>Synopsis</title>
58494  <programlisting>
58495struct hsi_client_driver {
58496  struct device_driver driver;
58497};  </programlisting>
58498</refsynopsisdiv>
58499 <refsect1>
58500  <title>Members</title>
58501  <variablelist>
58502    <varlistentry>      <term>driver</term>
58503      <listitem><para>
58504   Driver model representation of the driver
58505      </para></listitem>
58506    </varlistentry>
58507  </variablelist>
58508 </refsect1>
58509</refentry>
58510
58511<refentry id="API-struct-hsi-msg">
58512<refentryinfo>
58513 <title>LINUX</title>
58514 <productname>Kernel Hackers Manual</productname>
58515 <date>July 2017</date>
58516</refentryinfo>
58517<refmeta>
58518 <refentrytitle><phrase>struct hsi_msg</phrase></refentrytitle>
58519 <manvolnum>9</manvolnum>
58520 <refmiscinfo class="version">4.1.27</refmiscinfo>
58521</refmeta>
58522<refnamediv>
58523 <refname>struct hsi_msg</refname>
58524 <refpurpose>
58525     HSI message descriptor
58526 </refpurpose>
58527</refnamediv>
58528<refsynopsisdiv>
58529 <title>Synopsis</title>
58530  <programlisting>
58531struct hsi_msg {
58532  struct list_head link;
58533  struct hsi_client * cl;
58534  struct sg_table sgt;
58535  void * context;
58536  void (* complete) (struct hsi_msg *msg);
58537  void (* destructor) (struct hsi_msg *msg);
58538  int status;
58539  unsigned int actual_len;
58540  unsigned int channel;
58541  unsigned int ttype:1;
58542  unsigned int break_frame:1;
58543};  </programlisting>
58544</refsynopsisdiv>
58545 <refsect1>
58546  <title>Members</title>
58547  <variablelist>
58548    <varlistentry>      <term>link</term>
58549      <listitem><para>
58550   Free to use by the current descriptor owner
58551      </para></listitem>
58552    </varlistentry>
58553    <varlistentry>      <term>cl</term>
58554      <listitem><para>
58555   HSI device client that issues the transfer
58556      </para></listitem>
58557    </varlistentry>
58558    <varlistentry>      <term>sgt</term>
58559      <listitem><para>
58560   Head of the scatterlist array
58561      </para></listitem>
58562    </varlistentry>
58563    <varlistentry>      <term>context</term>
58564      <listitem><para>
58565   Client context data associated to the transfer
58566      </para></listitem>
58567    </varlistentry>
58568    <varlistentry>      <term>complete</term>
58569      <listitem><para>
58570   Transfer completion callback
58571      </para></listitem>
58572    </varlistentry>
58573    <varlistentry>      <term>destructor</term>
58574      <listitem><para>
58575   Destructor to free resources when flushing
58576      </para></listitem>
58577    </varlistentry>
58578    <varlistentry>      <term>status</term>
58579      <listitem><para>
58580   Status of the transfer when completed
58581      </para></listitem>
58582    </varlistentry>
58583    <varlistentry>      <term>actual_len</term>
58584      <listitem><para>
58585   Actual length of data transferred on completion
58586      </para></listitem>
58587    </varlistentry>
58588    <varlistentry>      <term>channel</term>
58589      <listitem><para>
58590   Channel were to TX/RX the message
58591      </para></listitem>
58592    </varlistentry>
58593    <varlistentry>      <term>ttype</term>
58594      <listitem><para>
58595   Transfer type (TX if set, RX otherwise)
58596      </para></listitem>
58597    </varlistentry>
58598    <varlistentry>      <term>break_frame</term>
58599      <listitem><para>
58600   if true HSI will send/receive a break frame. Data buffers are
58601   ignored in the request.
58602      </para></listitem>
58603    </varlistentry>
58604  </variablelist>
58605 </refsect1>
58606</refentry>
58607
58608<refentry id="API-struct-hsi-port">
58609<refentryinfo>
58610 <title>LINUX</title>
58611 <productname>Kernel Hackers Manual</productname>
58612 <date>July 2017</date>
58613</refentryinfo>
58614<refmeta>
58615 <refentrytitle><phrase>struct hsi_port</phrase></refentrytitle>
58616 <manvolnum>9</manvolnum>
58617 <refmiscinfo class="version">4.1.27</refmiscinfo>
58618</refmeta>
58619<refnamediv>
58620 <refname>struct hsi_port</refname>
58621 <refpurpose>
58622     HSI port device
58623 </refpurpose>
58624</refnamediv>
58625<refsynopsisdiv>
58626 <title>Synopsis</title>
58627  <programlisting>
58628struct hsi_port {
58629  struct device device;
58630  struct hsi_config tx_cfg;
58631  struct hsi_config rx_cfg;
58632  unsigned int num;
58633  unsigned int shared:1;
58634  int claimed;
58635  struct mutex lock;
58636  int (* async) (struct hsi_msg *msg);
58637  int (* setup) (struct hsi_client *cl);
58638  int (* flush) (struct hsi_client *cl);
58639  int (* start_tx) (struct hsi_client *cl);
58640  int (* stop_tx) (struct hsi_client *cl);
58641  int (* release) (struct hsi_client *cl);
58642  struct atomic_notifier_head n_head;
58643};  </programlisting>
58644</refsynopsisdiv>
58645 <refsect1>
58646  <title>Members</title>
58647  <variablelist>
58648    <varlistentry>      <term>device</term>
58649      <listitem><para>
58650   Driver model representation of the device
58651      </para></listitem>
58652    </varlistentry>
58653    <varlistentry>      <term>tx_cfg</term>
58654      <listitem><para>
58655   Current TX path configuration
58656      </para></listitem>
58657    </varlistentry>
58658    <varlistentry>      <term>rx_cfg</term>
58659      <listitem><para>
58660   Current RX path configuration
58661      </para></listitem>
58662    </varlistentry>
58663    <varlistentry>      <term>num</term>
58664      <listitem><para>
58665   Port number
58666      </para></listitem>
58667    </varlistentry>
58668    <varlistentry>      <term>shared</term>
58669      <listitem><para>
58670   Set when port can be shared by different clients
58671      </para></listitem>
58672    </varlistentry>
58673    <varlistentry>      <term>claimed</term>
58674      <listitem><para>
58675   Reference count of clients which claimed the port
58676      </para></listitem>
58677    </varlistentry>
58678    <varlistentry>      <term>lock</term>
58679      <listitem><para>
58680   Serialize port claim
58681      </para></listitem>
58682    </varlistentry>
58683    <varlistentry>      <term>async</term>
58684      <listitem><para>
58685   Asynchronous transfer callback
58686      </para></listitem>
58687    </varlistentry>
58688    <varlistentry>      <term>setup</term>
58689      <listitem><para>
58690   Callback to set the HSI client configuration
58691      </para></listitem>
58692    </varlistentry>
58693    <varlistentry>      <term>flush</term>
58694      <listitem><para>
58695   Callback to clean the HW state and destroy all pending transfers
58696      </para></listitem>
58697    </varlistentry>
58698    <varlistentry>      <term>start_tx</term>
58699      <listitem><para>
58700   Callback to inform that a client wants to TX data
58701      </para></listitem>
58702    </varlistentry>
58703    <varlistentry>      <term>stop_tx</term>
58704      <listitem><para>
58705   Callback to inform that a client no longer wishes to TX data
58706      </para></listitem>
58707    </varlistentry>
58708    <varlistentry>      <term>release</term>
58709      <listitem><para>
58710   Callback to inform that a client no longer uses the port
58711      </para></listitem>
58712    </varlistentry>
58713    <varlistentry>      <term>n_head</term>
58714      <listitem><para>
58715   Notifier chain for signaling port events to the clients.
58716      </para></listitem>
58717    </varlistentry>
58718  </variablelist>
58719 </refsect1>
58720</refentry>
58721
58722<refentry id="API-struct-hsi-controller">
58723<refentryinfo>
58724 <title>LINUX</title>
58725 <productname>Kernel Hackers Manual</productname>
58726 <date>July 2017</date>
58727</refentryinfo>
58728<refmeta>
58729 <refentrytitle><phrase>struct hsi_controller</phrase></refentrytitle>
58730 <manvolnum>9</manvolnum>
58731 <refmiscinfo class="version">4.1.27</refmiscinfo>
58732</refmeta>
58733<refnamediv>
58734 <refname>struct hsi_controller</refname>
58735 <refpurpose>
58736     HSI controller device
58737 </refpurpose>
58738</refnamediv>
58739<refsynopsisdiv>
58740 <title>Synopsis</title>
58741  <programlisting>
58742struct hsi_controller {
58743  struct device device;
58744  struct module * owner;
58745  unsigned int id;
58746  unsigned int num_ports;
58747  struct hsi_port ** port;
58748};  </programlisting>
58749</refsynopsisdiv>
58750 <refsect1>
58751  <title>Members</title>
58752  <variablelist>
58753    <varlistentry>      <term>device</term>
58754      <listitem><para>
58755   Driver model representation of the device
58756      </para></listitem>
58757    </varlistentry>
58758    <varlistentry>      <term>owner</term>
58759      <listitem><para>
58760   Pointer to the module owning the controller
58761      </para></listitem>
58762    </varlistentry>
58763    <varlistentry>      <term>id</term>
58764      <listitem><para>
58765   HSI controller ID
58766      </para></listitem>
58767    </varlistentry>
58768    <varlistentry>      <term>num_ports</term>
58769      <listitem><para>
58770   Number of ports in the HSI controller
58771      </para></listitem>
58772    </varlistentry>
58773    <varlistentry>      <term>port</term>
58774      <listitem><para>
58775   Array of HSI ports
58776      </para></listitem>
58777    </varlistentry>
58778  </variablelist>
58779 </refsect1>
58780</refentry>
58781
58782<refentry id="API-hsi-id">
58783<refentryinfo>
58784 <title>LINUX</title>
58785 <productname>Kernel Hackers Manual</productname>
58786 <date>July 2017</date>
58787</refentryinfo>
58788<refmeta>
58789 <refentrytitle><phrase>hsi_id</phrase></refentrytitle>
58790 <manvolnum>9</manvolnum>
58791 <refmiscinfo class="version">4.1.27</refmiscinfo>
58792</refmeta>
58793<refnamediv>
58794 <refname>hsi_id</refname>
58795 <refpurpose>
58796     Get HSI controller ID associated to a client
58797 </refpurpose>
58798</refnamediv>
58799<refsynopsisdiv>
58800 <title>Synopsis</title>
58801  <funcsynopsis><funcprototype>
58802   <funcdef>unsigned int <function>hsi_id </function></funcdef>
58803   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
58804  </funcprototype></funcsynopsis>
58805</refsynopsisdiv>
58806<refsect1>
58807 <title>Arguments</title>
58808 <variablelist>
58809  <varlistentry>
58810   <term><parameter>cl</parameter></term>
58811   <listitem>
58812    <para>
58813     Pointer to a HSI client
58814    </para>
58815   </listitem>
58816  </varlistentry>
58817 </variablelist>
58818</refsect1>
58819<refsect1>
58820<title>Description</title>
58821<para>
58822   Return the controller id where the client is attached to
58823</para>
58824</refsect1>
58825</refentry>
58826
58827<refentry id="API-hsi-port-id">
58828<refentryinfo>
58829 <title>LINUX</title>
58830 <productname>Kernel Hackers Manual</productname>
58831 <date>July 2017</date>
58832</refentryinfo>
58833<refmeta>
58834 <refentrytitle><phrase>hsi_port_id</phrase></refentrytitle>
58835 <manvolnum>9</manvolnum>
58836 <refmiscinfo class="version">4.1.27</refmiscinfo>
58837</refmeta>
58838<refnamediv>
58839 <refname>hsi_port_id</refname>
58840 <refpurpose>
58841     Gets the port number a client is attached to
58842 </refpurpose>
58843</refnamediv>
58844<refsynopsisdiv>
58845 <title>Synopsis</title>
58846  <funcsynopsis><funcprototype>
58847   <funcdef>unsigned int <function>hsi_port_id </function></funcdef>
58848   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
58849  </funcprototype></funcsynopsis>
58850</refsynopsisdiv>
58851<refsect1>
58852 <title>Arguments</title>
58853 <variablelist>
58854  <varlistentry>
58855   <term><parameter>cl</parameter></term>
58856   <listitem>
58857    <para>
58858     Pointer to HSI client
58859    </para>
58860   </listitem>
58861  </varlistentry>
58862 </variablelist>
58863</refsect1>
58864<refsect1>
58865<title>Description</title>
58866<para>
58867   Return the port number associated to the client
58868</para>
58869</refsect1>
58870</refentry>
58871
58872<refentry id="API-hsi-setup">
58873<refentryinfo>
58874 <title>LINUX</title>
58875 <productname>Kernel Hackers Manual</productname>
58876 <date>July 2017</date>
58877</refentryinfo>
58878<refmeta>
58879 <refentrytitle><phrase>hsi_setup</phrase></refentrytitle>
58880 <manvolnum>9</manvolnum>
58881 <refmiscinfo class="version">4.1.27</refmiscinfo>
58882</refmeta>
58883<refnamediv>
58884 <refname>hsi_setup</refname>
58885 <refpurpose>
58886     Configure the client's port
58887 </refpurpose>
58888</refnamediv>
58889<refsynopsisdiv>
58890 <title>Synopsis</title>
58891  <funcsynopsis><funcprototype>
58892   <funcdef>int <function>hsi_setup </function></funcdef>
58893   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
58894  </funcprototype></funcsynopsis>
58895</refsynopsisdiv>
58896<refsect1>
58897 <title>Arguments</title>
58898 <variablelist>
58899  <varlistentry>
58900   <term><parameter>cl</parameter></term>
58901   <listitem>
58902    <para>
58903     Pointer to the HSI client
58904    </para>
58905   </listitem>
58906  </varlistentry>
58907 </variablelist>
58908</refsect1>
58909<refsect1>
58910<title>Description</title>
58911<para>
58912   When sharing ports, clients should either relay on a single
58913   client setup or have the same setup for all of them.
58914   </para><para>
58915
58916   Return -errno on failure, 0 on success
58917</para>
58918</refsect1>
58919</refentry>
58920
58921<refentry id="API-hsi-flush">
58922<refentryinfo>
58923 <title>LINUX</title>
58924 <productname>Kernel Hackers Manual</productname>
58925 <date>July 2017</date>
58926</refentryinfo>
58927<refmeta>
58928 <refentrytitle><phrase>hsi_flush</phrase></refentrytitle>
58929 <manvolnum>9</manvolnum>
58930 <refmiscinfo class="version">4.1.27</refmiscinfo>
58931</refmeta>
58932<refnamediv>
58933 <refname>hsi_flush</refname>
58934 <refpurpose>
58935     Flush all pending transactions on the client's port
58936 </refpurpose>
58937</refnamediv>
58938<refsynopsisdiv>
58939 <title>Synopsis</title>
58940  <funcsynopsis><funcprototype>
58941   <funcdef>int <function>hsi_flush </function></funcdef>
58942   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
58943  </funcprototype></funcsynopsis>
58944</refsynopsisdiv>
58945<refsect1>
58946 <title>Arguments</title>
58947 <variablelist>
58948  <varlistentry>
58949   <term><parameter>cl</parameter></term>
58950   <listitem>
58951    <para>
58952     Pointer to the HSI client
58953    </para>
58954   </listitem>
58955  </varlistentry>
58956 </variablelist>
58957</refsect1>
58958<refsect1>
58959<title>Description</title>
58960<para>
58961   This function will destroy all pending hsi_msg in the port and reset
58962   the HW port so it is ready to receive and transmit from a clean state.
58963   </para><para>
58964
58965   Return -errno on failure, 0 on success
58966</para>
58967</refsect1>
58968</refentry>
58969
58970<refentry id="API-hsi-async-read">
58971<refentryinfo>
58972 <title>LINUX</title>
58973 <productname>Kernel Hackers Manual</productname>
58974 <date>July 2017</date>
58975</refentryinfo>
58976<refmeta>
58977 <refentrytitle><phrase>hsi_async_read</phrase></refentrytitle>
58978 <manvolnum>9</manvolnum>
58979 <refmiscinfo class="version">4.1.27</refmiscinfo>
58980</refmeta>
58981<refnamediv>
58982 <refname>hsi_async_read</refname>
58983 <refpurpose>
58984     Submit a read transfer
58985 </refpurpose>
58986</refnamediv>
58987<refsynopsisdiv>
58988 <title>Synopsis</title>
58989  <funcsynopsis><funcprototype>
58990   <funcdef>int <function>hsi_async_read </function></funcdef>
58991   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
58992   <paramdef>struct hsi_msg * <parameter>msg</parameter></paramdef>
58993  </funcprototype></funcsynopsis>
58994</refsynopsisdiv>
58995<refsect1>
58996 <title>Arguments</title>
58997 <variablelist>
58998  <varlistentry>
58999   <term><parameter>cl</parameter></term>
59000   <listitem>
59001    <para>
59002     Pointer to the HSI client
59003    </para>
59004   </listitem>
59005  </varlistentry>
59006  <varlistentry>
59007   <term><parameter>msg</parameter></term>
59008   <listitem>
59009    <para>
59010     HSI message descriptor of the transfer
59011    </para>
59012   </listitem>
59013  </varlistentry>
59014 </variablelist>
59015</refsect1>
59016<refsect1>
59017<title>Description</title>
59018<para>
59019   Return -errno on failure, 0 on success
59020</para>
59021</refsect1>
59022</refentry>
59023
59024<refentry id="API-hsi-async-write">
59025<refentryinfo>
59026 <title>LINUX</title>
59027 <productname>Kernel Hackers Manual</productname>
59028 <date>July 2017</date>
59029</refentryinfo>
59030<refmeta>
59031 <refentrytitle><phrase>hsi_async_write</phrase></refentrytitle>
59032 <manvolnum>9</manvolnum>
59033 <refmiscinfo class="version">4.1.27</refmiscinfo>
59034</refmeta>
59035<refnamediv>
59036 <refname>hsi_async_write</refname>
59037 <refpurpose>
59038     Submit a write transfer
59039 </refpurpose>
59040</refnamediv>
59041<refsynopsisdiv>
59042 <title>Synopsis</title>
59043  <funcsynopsis><funcprototype>
59044   <funcdef>int <function>hsi_async_write </function></funcdef>
59045   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59046   <paramdef>struct hsi_msg * <parameter>msg</parameter></paramdef>
59047  </funcprototype></funcsynopsis>
59048</refsynopsisdiv>
59049<refsect1>
59050 <title>Arguments</title>
59051 <variablelist>
59052  <varlistentry>
59053   <term><parameter>cl</parameter></term>
59054   <listitem>
59055    <para>
59056     Pointer to the HSI client
59057    </para>
59058   </listitem>
59059  </varlistentry>
59060  <varlistentry>
59061   <term><parameter>msg</parameter></term>
59062   <listitem>
59063    <para>
59064     HSI message descriptor of the transfer
59065    </para>
59066   </listitem>
59067  </varlistentry>
59068 </variablelist>
59069</refsect1>
59070<refsect1>
59071<title>Description</title>
59072<para>
59073   Return -errno on failure, 0 on success
59074</para>
59075</refsect1>
59076</refentry>
59077
59078<refentry id="API-hsi-start-tx">
59079<refentryinfo>
59080 <title>LINUX</title>
59081 <productname>Kernel Hackers Manual</productname>
59082 <date>July 2017</date>
59083</refentryinfo>
59084<refmeta>
59085 <refentrytitle><phrase>hsi_start_tx</phrase></refentrytitle>
59086 <manvolnum>9</manvolnum>
59087 <refmiscinfo class="version">4.1.27</refmiscinfo>
59088</refmeta>
59089<refnamediv>
59090 <refname>hsi_start_tx</refname>
59091 <refpurpose>
59092     Signal the port that the client wants to start a TX
59093 </refpurpose>
59094</refnamediv>
59095<refsynopsisdiv>
59096 <title>Synopsis</title>
59097  <funcsynopsis><funcprototype>
59098   <funcdef>int <function>hsi_start_tx </function></funcdef>
59099   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59100  </funcprototype></funcsynopsis>
59101</refsynopsisdiv>
59102<refsect1>
59103 <title>Arguments</title>
59104 <variablelist>
59105  <varlistentry>
59106   <term><parameter>cl</parameter></term>
59107   <listitem>
59108    <para>
59109     Pointer to the HSI client
59110    </para>
59111   </listitem>
59112  </varlistentry>
59113 </variablelist>
59114</refsect1>
59115<refsect1>
59116<title>Description</title>
59117<para>
59118   Return -errno on failure, 0 on success
59119</para>
59120</refsect1>
59121</refentry>
59122
59123<refentry id="API-hsi-stop-tx">
59124<refentryinfo>
59125 <title>LINUX</title>
59126 <productname>Kernel Hackers Manual</productname>
59127 <date>July 2017</date>
59128</refentryinfo>
59129<refmeta>
59130 <refentrytitle><phrase>hsi_stop_tx</phrase></refentrytitle>
59131 <manvolnum>9</manvolnum>
59132 <refmiscinfo class="version">4.1.27</refmiscinfo>
59133</refmeta>
59134<refnamediv>
59135 <refname>hsi_stop_tx</refname>
59136 <refpurpose>
59137     Signal the port that the client no longer wants to transmit
59138 </refpurpose>
59139</refnamediv>
59140<refsynopsisdiv>
59141 <title>Synopsis</title>
59142  <funcsynopsis><funcprototype>
59143   <funcdef>int <function>hsi_stop_tx </function></funcdef>
59144   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59145  </funcprototype></funcsynopsis>
59146</refsynopsisdiv>
59147<refsect1>
59148 <title>Arguments</title>
59149 <variablelist>
59150  <varlistentry>
59151   <term><parameter>cl</parameter></term>
59152   <listitem>
59153    <para>
59154     Pointer to the HSI client
59155    </para>
59156   </listitem>
59157  </varlistentry>
59158 </variablelist>
59159</refsect1>
59160<refsect1>
59161<title>Description</title>
59162<para>
59163   Return -errno on failure, 0 on success
59164</para>
59165</refsect1>
59166</refentry>
59167
59168<!-- drivers/hsi/hsi.c -->
59169<refentry id="API-hsi-port-unregister-clients">
59170<refentryinfo>
59171 <title>LINUX</title>
59172 <productname>Kernel Hackers Manual</productname>
59173 <date>July 2017</date>
59174</refentryinfo>
59175<refmeta>
59176 <refentrytitle><phrase>hsi_port_unregister_clients</phrase></refentrytitle>
59177 <manvolnum>9</manvolnum>
59178 <refmiscinfo class="version">4.1.27</refmiscinfo>
59179</refmeta>
59180<refnamediv>
59181 <refname>hsi_port_unregister_clients</refname>
59182 <refpurpose>
59183  Unregister an HSI port
59184 </refpurpose>
59185</refnamediv>
59186<refsynopsisdiv>
59187 <title>Synopsis</title>
59188  <funcsynopsis><funcprototype>
59189   <funcdef>void <function>hsi_port_unregister_clients </function></funcdef>
59190   <paramdef>struct hsi_port * <parameter>port</parameter></paramdef>
59191  </funcprototype></funcsynopsis>
59192</refsynopsisdiv>
59193<refsect1>
59194 <title>Arguments</title>
59195 <variablelist>
59196  <varlistentry>
59197   <term><parameter>port</parameter></term>
59198   <listitem>
59199    <para>
59200     The HSI port to unregister
59201    </para>
59202   </listitem>
59203  </varlistentry>
59204 </variablelist>
59205</refsect1>
59206</refentry>
59207
59208<refentry id="API-hsi-unregister-controller">
59209<refentryinfo>
59210 <title>LINUX</title>
59211 <productname>Kernel Hackers Manual</productname>
59212 <date>July 2017</date>
59213</refentryinfo>
59214<refmeta>
59215 <refentrytitle><phrase>hsi_unregister_controller</phrase></refentrytitle>
59216 <manvolnum>9</manvolnum>
59217 <refmiscinfo class="version">4.1.27</refmiscinfo>
59218</refmeta>
59219<refnamediv>
59220 <refname>hsi_unregister_controller</refname>
59221 <refpurpose>
59222     Unregister an HSI controller
59223 </refpurpose>
59224</refnamediv>
59225<refsynopsisdiv>
59226 <title>Synopsis</title>
59227  <funcsynopsis><funcprototype>
59228   <funcdef>void <function>hsi_unregister_controller </function></funcdef>
59229   <paramdef>struct hsi_controller * <parameter>hsi</parameter></paramdef>
59230  </funcprototype></funcsynopsis>
59231</refsynopsisdiv>
59232<refsect1>
59233 <title>Arguments</title>
59234 <variablelist>
59235  <varlistentry>
59236   <term><parameter>hsi</parameter></term>
59237   <listitem>
59238    <para>
59239     The HSI controller to register
59240    </para>
59241   </listitem>
59242  </varlistentry>
59243 </variablelist>
59244</refsect1>
59245</refentry>
59246
59247<refentry id="API-hsi-register-controller">
59248<refentryinfo>
59249 <title>LINUX</title>
59250 <productname>Kernel Hackers Manual</productname>
59251 <date>July 2017</date>
59252</refentryinfo>
59253<refmeta>
59254 <refentrytitle><phrase>hsi_register_controller</phrase></refentrytitle>
59255 <manvolnum>9</manvolnum>
59256 <refmiscinfo class="version">4.1.27</refmiscinfo>
59257</refmeta>
59258<refnamediv>
59259 <refname>hsi_register_controller</refname>
59260 <refpurpose>
59261     Register an HSI controller and its ports
59262 </refpurpose>
59263</refnamediv>
59264<refsynopsisdiv>
59265 <title>Synopsis</title>
59266  <funcsynopsis><funcprototype>
59267   <funcdef>int <function>hsi_register_controller </function></funcdef>
59268   <paramdef>struct hsi_controller * <parameter>hsi</parameter></paramdef>
59269  </funcprototype></funcsynopsis>
59270</refsynopsisdiv>
59271<refsect1>
59272 <title>Arguments</title>
59273 <variablelist>
59274  <varlistentry>
59275   <term><parameter>hsi</parameter></term>
59276   <listitem>
59277    <para>
59278     The HSI controller to register
59279    </para>
59280   </listitem>
59281  </varlistentry>
59282 </variablelist>
59283</refsect1>
59284<refsect1>
59285<title>Description</title>
59286<para>
59287   Returns -errno on failure, 0 on success.
59288</para>
59289</refsect1>
59290</refentry>
59291
59292<refentry id="API-hsi-register-client-driver">
59293<refentryinfo>
59294 <title>LINUX</title>
59295 <productname>Kernel Hackers Manual</productname>
59296 <date>July 2017</date>
59297</refentryinfo>
59298<refmeta>
59299 <refentrytitle><phrase>hsi_register_client_driver</phrase></refentrytitle>
59300 <manvolnum>9</manvolnum>
59301 <refmiscinfo class="version">4.1.27</refmiscinfo>
59302</refmeta>
59303<refnamediv>
59304 <refname>hsi_register_client_driver</refname>
59305 <refpurpose>
59306     Register an HSI client to the HSI bus
59307 </refpurpose>
59308</refnamediv>
59309<refsynopsisdiv>
59310 <title>Synopsis</title>
59311  <funcsynopsis><funcprototype>
59312   <funcdef>int <function>hsi_register_client_driver </function></funcdef>
59313   <paramdef>struct hsi_client_driver * <parameter>drv</parameter></paramdef>
59314  </funcprototype></funcsynopsis>
59315</refsynopsisdiv>
59316<refsect1>
59317 <title>Arguments</title>
59318 <variablelist>
59319  <varlistentry>
59320   <term><parameter>drv</parameter></term>
59321   <listitem>
59322    <para>
59323     HSI client driver to register
59324    </para>
59325   </listitem>
59326  </varlistentry>
59327 </variablelist>
59328</refsect1>
59329<refsect1>
59330<title>Description</title>
59331<para>
59332   Returns -errno on failure, 0 on success.
59333</para>
59334</refsect1>
59335</refentry>
59336
59337<refentry id="API-hsi-put-controller">
59338<refentryinfo>
59339 <title>LINUX</title>
59340 <productname>Kernel Hackers Manual</productname>
59341 <date>July 2017</date>
59342</refentryinfo>
59343<refmeta>
59344 <refentrytitle><phrase>hsi_put_controller</phrase></refentrytitle>
59345 <manvolnum>9</manvolnum>
59346 <refmiscinfo class="version">4.1.27</refmiscinfo>
59347</refmeta>
59348<refnamediv>
59349 <refname>hsi_put_controller</refname>
59350 <refpurpose>
59351     Free an HSI controller
59352 </refpurpose>
59353</refnamediv>
59354<refsynopsisdiv>
59355 <title>Synopsis</title>
59356  <funcsynopsis><funcprototype>
59357   <funcdef>void <function>hsi_put_controller </function></funcdef>
59358   <paramdef>struct hsi_controller * <parameter>hsi</parameter></paramdef>
59359  </funcprototype></funcsynopsis>
59360</refsynopsisdiv>
59361<refsect1>
59362 <title>Arguments</title>
59363 <variablelist>
59364  <varlistentry>
59365   <term><parameter>hsi</parameter></term>
59366   <listitem>
59367    <para>
59368     Pointer to the HSI controller to freed
59369    </para>
59370   </listitem>
59371  </varlistentry>
59372 </variablelist>
59373</refsect1>
59374<refsect1>
59375<title>Description</title>
59376<para>
59377   HSI controller drivers should only use this function if they need
59378   to free their allocated hsi_controller structures before a successful
59379   call to hsi_register_controller. Other use is not allowed.
59380</para>
59381</refsect1>
59382</refentry>
59383
59384<refentry id="API-hsi-alloc-controller">
59385<refentryinfo>
59386 <title>LINUX</title>
59387 <productname>Kernel Hackers Manual</productname>
59388 <date>July 2017</date>
59389</refentryinfo>
59390<refmeta>
59391 <refentrytitle><phrase>hsi_alloc_controller</phrase></refentrytitle>
59392 <manvolnum>9</manvolnum>
59393 <refmiscinfo class="version">4.1.27</refmiscinfo>
59394</refmeta>
59395<refnamediv>
59396 <refname>hsi_alloc_controller</refname>
59397 <refpurpose>
59398     Allocate an HSI controller and its ports
59399 </refpurpose>
59400</refnamediv>
59401<refsynopsisdiv>
59402 <title>Synopsis</title>
59403  <funcsynopsis><funcprototype>
59404   <funcdef>struct hsi_controller * <function>hsi_alloc_controller </function></funcdef>
59405   <paramdef>unsigned int <parameter>n_ports</parameter></paramdef>
59406   <paramdef>gfp_t <parameter>flags</parameter></paramdef>
59407  </funcprototype></funcsynopsis>
59408</refsynopsisdiv>
59409<refsect1>
59410 <title>Arguments</title>
59411 <variablelist>
59412  <varlistentry>
59413   <term><parameter>n_ports</parameter></term>
59414   <listitem>
59415    <para>
59416     Number of ports on the HSI controller
59417    </para>
59418   </listitem>
59419  </varlistentry>
59420  <varlistentry>
59421   <term><parameter>flags</parameter></term>
59422   <listitem>
59423    <para>
59424     Kernel allocation flags
59425    </para>
59426   </listitem>
59427  </varlistentry>
59428 </variablelist>
59429</refsect1>
59430<refsect1>
59431<title>Description</title>
59432<para>
59433   Return NULL on failure or a pointer to an hsi_controller on success.
59434</para>
59435</refsect1>
59436</refentry>
59437
59438<refentry id="API-hsi-free-msg">
59439<refentryinfo>
59440 <title>LINUX</title>
59441 <productname>Kernel Hackers Manual</productname>
59442 <date>July 2017</date>
59443</refentryinfo>
59444<refmeta>
59445 <refentrytitle><phrase>hsi_free_msg</phrase></refentrytitle>
59446 <manvolnum>9</manvolnum>
59447 <refmiscinfo class="version">4.1.27</refmiscinfo>
59448</refmeta>
59449<refnamediv>
59450 <refname>hsi_free_msg</refname>
59451 <refpurpose>
59452     Free an HSI message
59453 </refpurpose>
59454</refnamediv>
59455<refsynopsisdiv>
59456 <title>Synopsis</title>
59457  <funcsynopsis><funcprototype>
59458   <funcdef>void <function>hsi_free_msg </function></funcdef>
59459   <paramdef>struct hsi_msg * <parameter>msg</parameter></paramdef>
59460  </funcprototype></funcsynopsis>
59461</refsynopsisdiv>
59462<refsect1>
59463 <title>Arguments</title>
59464 <variablelist>
59465  <varlistentry>
59466   <term><parameter>msg</parameter></term>
59467   <listitem>
59468    <para>
59469     Pointer to the HSI message
59470    </para>
59471   </listitem>
59472  </varlistentry>
59473 </variablelist>
59474</refsect1>
59475<refsect1>
59476<title>Description</title>
59477<para>
59478   Client is responsible to free the buffers pointed by the scatterlists.
59479</para>
59480</refsect1>
59481</refentry>
59482
59483<refentry id="API-hsi-alloc-msg">
59484<refentryinfo>
59485 <title>LINUX</title>
59486 <productname>Kernel Hackers Manual</productname>
59487 <date>July 2017</date>
59488</refentryinfo>
59489<refmeta>
59490 <refentrytitle><phrase>hsi_alloc_msg</phrase></refentrytitle>
59491 <manvolnum>9</manvolnum>
59492 <refmiscinfo class="version">4.1.27</refmiscinfo>
59493</refmeta>
59494<refnamediv>
59495 <refname>hsi_alloc_msg</refname>
59496 <refpurpose>
59497     Allocate an HSI message
59498 </refpurpose>
59499</refnamediv>
59500<refsynopsisdiv>
59501 <title>Synopsis</title>
59502  <funcsynopsis><funcprototype>
59503   <funcdef>struct hsi_msg * <function>hsi_alloc_msg </function></funcdef>
59504   <paramdef>unsigned int <parameter>nents</parameter></paramdef>
59505   <paramdef>gfp_t <parameter>flags</parameter></paramdef>
59506  </funcprototype></funcsynopsis>
59507</refsynopsisdiv>
59508<refsect1>
59509 <title>Arguments</title>
59510 <variablelist>
59511  <varlistentry>
59512   <term><parameter>nents</parameter></term>
59513   <listitem>
59514    <para>
59515     Number of memory entries
59516    </para>
59517   </listitem>
59518  </varlistentry>
59519  <varlistentry>
59520   <term><parameter>flags</parameter></term>
59521   <listitem>
59522    <para>
59523     Kernel allocation flags
59524    </para>
59525   </listitem>
59526  </varlistentry>
59527 </variablelist>
59528</refsect1>
59529<refsect1>
59530<title>Description</title>
59531<para>
59532   nents can be 0. This mainly makes sense for read transfer.
59533   In that case, HSI drivers will call the complete callback when
59534   there is data to be read without consuming it.
59535   </para><para>
59536
59537   Return NULL on failure or a pointer to an hsi_msg on success.
59538</para>
59539</refsect1>
59540</refentry>
59541
59542<refentry id="API-hsi-async">
59543<refentryinfo>
59544 <title>LINUX</title>
59545 <productname>Kernel Hackers Manual</productname>
59546 <date>July 2017</date>
59547</refentryinfo>
59548<refmeta>
59549 <refentrytitle><phrase>hsi_async</phrase></refentrytitle>
59550 <manvolnum>9</manvolnum>
59551 <refmiscinfo class="version">4.1.27</refmiscinfo>
59552</refmeta>
59553<refnamediv>
59554 <refname>hsi_async</refname>
59555 <refpurpose>
59556     Submit an HSI transfer to the controller
59557 </refpurpose>
59558</refnamediv>
59559<refsynopsisdiv>
59560 <title>Synopsis</title>
59561  <funcsynopsis><funcprototype>
59562   <funcdef>int <function>hsi_async </function></funcdef>
59563   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59564   <paramdef>struct hsi_msg * <parameter>msg</parameter></paramdef>
59565  </funcprototype></funcsynopsis>
59566</refsynopsisdiv>
59567<refsect1>
59568 <title>Arguments</title>
59569 <variablelist>
59570  <varlistentry>
59571   <term><parameter>cl</parameter></term>
59572   <listitem>
59573    <para>
59574     HSI client sending the transfer
59575    </para>
59576   </listitem>
59577  </varlistentry>
59578  <varlistentry>
59579   <term><parameter>msg</parameter></term>
59580   <listitem>
59581    <para>
59582     The HSI transfer passed to controller
59583    </para>
59584   </listitem>
59585  </varlistentry>
59586 </variablelist>
59587</refsect1>
59588<refsect1>
59589<title>Description</title>
59590<para>
59591   The HSI message must have the channel, ttype, complete and destructor
59592   fields set beforehand. If nents &gt; 0 then the client has to initialize
59593   also the scatterlists to point to the buffers to write to or read from.
59594   </para><para>
59595
59596   HSI controllers relay on pre-allocated buffers from their clients and they
59597   do not allocate buffers on their own.
59598   </para><para>
59599
59600   Once the HSI message transfer finishes, the HSI controller calls the
59601   complete callback with the status and actual_len fields of the HSI message
59602   updated. The complete callback can be called before returning from
59603   hsi_async.
59604   </para><para>
59605
59606   Returns -errno on failure or 0 on success
59607</para>
59608</refsect1>
59609</refentry>
59610
59611<refentry id="API-hsi-claim-port">
59612<refentryinfo>
59613 <title>LINUX</title>
59614 <productname>Kernel Hackers Manual</productname>
59615 <date>July 2017</date>
59616</refentryinfo>
59617<refmeta>
59618 <refentrytitle><phrase>hsi_claim_port</phrase></refentrytitle>
59619 <manvolnum>9</manvolnum>
59620 <refmiscinfo class="version">4.1.27</refmiscinfo>
59621</refmeta>
59622<refnamediv>
59623 <refname>hsi_claim_port</refname>
59624 <refpurpose>
59625     Claim the HSI client's port
59626 </refpurpose>
59627</refnamediv>
59628<refsynopsisdiv>
59629 <title>Synopsis</title>
59630  <funcsynopsis><funcprototype>
59631   <funcdef>int <function>hsi_claim_port </function></funcdef>
59632   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59633   <paramdef>unsigned int <parameter>share</parameter></paramdef>
59634  </funcprototype></funcsynopsis>
59635</refsynopsisdiv>
59636<refsect1>
59637 <title>Arguments</title>
59638 <variablelist>
59639  <varlistentry>
59640   <term><parameter>cl</parameter></term>
59641   <listitem>
59642    <para>
59643     HSI client that wants to claim its port
59644    </para>
59645   </listitem>
59646  </varlistentry>
59647  <varlistentry>
59648   <term><parameter>share</parameter></term>
59649   <listitem>
59650    <para>
59651     Flag to indicate if the client wants to share the port or not.
59652    </para>
59653   </listitem>
59654  </varlistentry>
59655 </variablelist>
59656</refsect1>
59657<refsect1>
59658<title>Description</title>
59659<para>
59660   Returns -errno on failure, 0 on success.
59661</para>
59662</refsect1>
59663</refentry>
59664
59665<refentry id="API-hsi-release-port">
59666<refentryinfo>
59667 <title>LINUX</title>
59668 <productname>Kernel Hackers Manual</productname>
59669 <date>July 2017</date>
59670</refentryinfo>
59671<refmeta>
59672 <refentrytitle><phrase>hsi_release_port</phrase></refentrytitle>
59673 <manvolnum>9</manvolnum>
59674 <refmiscinfo class="version">4.1.27</refmiscinfo>
59675</refmeta>
59676<refnamediv>
59677 <refname>hsi_release_port</refname>
59678 <refpurpose>
59679     Release the HSI client's port
59680 </refpurpose>
59681</refnamediv>
59682<refsynopsisdiv>
59683 <title>Synopsis</title>
59684  <funcsynopsis><funcprototype>
59685   <funcdef>void <function>hsi_release_port </function></funcdef>
59686   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59687  </funcprototype></funcsynopsis>
59688</refsynopsisdiv>
59689<refsect1>
59690 <title>Arguments</title>
59691 <variablelist>
59692  <varlistentry>
59693   <term><parameter>cl</parameter></term>
59694   <listitem>
59695    <para>
59696     HSI client which previously claimed its port
59697    </para>
59698   </listitem>
59699  </varlistentry>
59700 </variablelist>
59701</refsect1>
59702</refentry>
59703
59704<refentry id="API-hsi-register-port-event">
59705<refentryinfo>
59706 <title>LINUX</title>
59707 <productname>Kernel Hackers Manual</productname>
59708 <date>July 2017</date>
59709</refentryinfo>
59710<refmeta>
59711 <refentrytitle><phrase>hsi_register_port_event</phrase></refentrytitle>
59712 <manvolnum>9</manvolnum>
59713 <refmiscinfo class="version">4.1.27</refmiscinfo>
59714</refmeta>
59715<refnamediv>
59716 <refname>hsi_register_port_event</refname>
59717 <refpurpose>
59718     Register a client to receive port events
59719 </refpurpose>
59720</refnamediv>
59721<refsynopsisdiv>
59722 <title>Synopsis</title>
59723  <funcsynopsis><funcprototype>
59724   <funcdef>int <function>hsi_register_port_event </function></funcdef>
59725   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59726   <paramdef>void (*<parameter>handler</parameter>)
59727     <funcparams>struct hsi_client *, unsigned long</funcparams></paramdef>
59728  </funcprototype></funcsynopsis>
59729</refsynopsisdiv>
59730<refsect1>
59731 <title>Arguments</title>
59732 <variablelist>
59733  <varlistentry>
59734   <term><parameter>cl</parameter></term>
59735   <listitem>
59736    <para>
59737     HSI client that wants to receive port events
59738    </para>
59739   </listitem>
59740  </varlistentry>
59741  <varlistentry>
59742   <term><parameter>handler</parameter></term>
59743   <listitem>
59744    <para>
59745     Event handler callback
59746    </para>
59747   </listitem>
59748  </varlistentry>
59749 </variablelist>
59750</refsect1>
59751<refsect1>
59752<title>Description</title>
59753<para>
59754   Clients should register a callback to be able to receive
59755   events from the ports. Registration should happen after
59756   claiming the port.
59757   The handler can be called in interrupt context.
59758   </para><para>
59759
59760   Returns -errno on error, or 0 on success.
59761</para>
59762</refsect1>
59763</refentry>
59764
59765<refentry id="API-hsi-unregister-port-event">
59766<refentryinfo>
59767 <title>LINUX</title>
59768 <productname>Kernel Hackers Manual</productname>
59769 <date>July 2017</date>
59770</refentryinfo>
59771<refmeta>
59772 <refentrytitle><phrase>hsi_unregister_port_event</phrase></refentrytitle>
59773 <manvolnum>9</manvolnum>
59774 <refmiscinfo class="version">4.1.27</refmiscinfo>
59775</refmeta>
59776<refnamediv>
59777 <refname>hsi_unregister_port_event</refname>
59778 <refpurpose>
59779     Stop receiving port events for a client
59780 </refpurpose>
59781</refnamediv>
59782<refsynopsisdiv>
59783 <title>Synopsis</title>
59784  <funcsynopsis><funcprototype>
59785   <funcdef>int <function>hsi_unregister_port_event </function></funcdef>
59786   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59787  </funcprototype></funcsynopsis>
59788</refsynopsisdiv>
59789<refsect1>
59790 <title>Arguments</title>
59791 <variablelist>
59792  <varlistentry>
59793   <term><parameter>cl</parameter></term>
59794   <listitem>
59795    <para>
59796     HSI client that wants to stop receiving port events
59797    </para>
59798   </listitem>
59799  </varlistentry>
59800 </variablelist>
59801</refsect1>
59802<refsect1>
59803<title>Description</title>
59804<para>
59805   Clients should call this function before releasing their associated
59806   port.
59807   </para><para>
59808
59809   Returns -errno on error, or 0 on success.
59810</para>
59811</refsect1>
59812</refentry>
59813
59814<refentry id="API-hsi-event">
59815<refentryinfo>
59816 <title>LINUX</title>
59817 <productname>Kernel Hackers Manual</productname>
59818 <date>July 2017</date>
59819</refentryinfo>
59820<refmeta>
59821 <refentrytitle><phrase>hsi_event</phrase></refentrytitle>
59822 <manvolnum>9</manvolnum>
59823 <refmiscinfo class="version">4.1.27</refmiscinfo>
59824</refmeta>
59825<refnamediv>
59826 <refname>hsi_event</refname>
59827 <refpurpose>
59828     Notifies clients about port events
59829 </refpurpose>
59830</refnamediv>
59831<refsynopsisdiv>
59832 <title>Synopsis</title>
59833  <funcsynopsis><funcprototype>
59834   <funcdef>int <function>hsi_event </function></funcdef>
59835   <paramdef>struct hsi_port * <parameter>port</parameter></paramdef>
59836   <paramdef>unsigned long <parameter>event</parameter></paramdef>
59837  </funcprototype></funcsynopsis>
59838</refsynopsisdiv>
59839<refsect1>
59840 <title>Arguments</title>
59841 <variablelist>
59842  <varlistentry>
59843   <term><parameter>port</parameter></term>
59844   <listitem>
59845    <para>
59846     Port where the event occurred
59847    </para>
59848   </listitem>
59849  </varlistentry>
59850  <varlistentry>
59851   <term><parameter>event</parameter></term>
59852   <listitem>
59853    <para>
59854     The event type
59855    </para>
59856   </listitem>
59857  </varlistentry>
59858 </variablelist>
59859</refsect1>
59860<refsect1>
59861<title>Description</title>
59862<para>
59863   Clients should not be concerned about wake line behavior. However, due
59864   to a race condition in HSI HW protocol, clients need to be notified
59865   about wake line changes, so they can implement a workaround for it.
59866</para>
59867</refsect1>
59868<refsect1>
59869<title>Events</title>
59870<para>
59871   HSI_EVENT_START_RX - Incoming wake line high
59872   HSI_EVENT_STOP_RX - Incoming wake line down
59873   </para><para>
59874
59875   Returns -errno on error, or 0 on success.
59876</para>
59877</refsect1>
59878</refentry>
59879
59880<refentry id="API-hsi-get-channel-id-by-name">
59881<refentryinfo>
59882 <title>LINUX</title>
59883 <productname>Kernel Hackers Manual</productname>
59884 <date>July 2017</date>
59885</refentryinfo>
59886<refmeta>
59887 <refentrytitle><phrase>hsi_get_channel_id_by_name</phrase></refentrytitle>
59888 <manvolnum>9</manvolnum>
59889 <refmiscinfo class="version">4.1.27</refmiscinfo>
59890</refmeta>
59891<refnamediv>
59892 <refname>hsi_get_channel_id_by_name</refname>
59893 <refpurpose>
59894     acquire channel id by channel name
59895 </refpurpose>
59896</refnamediv>
59897<refsynopsisdiv>
59898 <title>Synopsis</title>
59899  <funcsynopsis><funcprototype>
59900   <funcdef>int <function>hsi_get_channel_id_by_name </function></funcdef>
59901   <paramdef>struct hsi_client * <parameter>cl</parameter></paramdef>
59902   <paramdef>char * <parameter>name</parameter></paramdef>
59903  </funcprototype></funcsynopsis>
59904</refsynopsisdiv>
59905<refsect1>
59906 <title>Arguments</title>
59907 <variablelist>
59908  <varlistentry>
59909   <term><parameter>cl</parameter></term>
59910   <listitem>
59911    <para>
59912     HSI client, which uses the channel
59913    </para>
59914   </listitem>
59915  </varlistentry>
59916  <varlistentry>
59917   <term><parameter>name</parameter></term>
59918   <listitem>
59919    <para>
59920     name the channel is known under
59921    </para>
59922   </listitem>
59923  </varlistentry>
59924 </variablelist>
59925</refsect1>
59926<refsect1>
59927<title>Description</title>
59928<para>
59929   Clients can call this function to get the hsi channel ids similar to
59930   requesting IRQs or GPIOs by name. This function assumes the same
59931   channel configuration is used for RX and TX.
59932   </para><para>
59933
59934   Returns -errno on error or channel id on success.
59935</para>
59936</refsect1>
59937</refentry>
59938
59939  </chapter>
59940
59941</book>
59942