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>
46 <refnamediv>
47  <refname>
48   include/linux/init.h
49  </refname>
50  <refpurpose>
51   Document generation inconsistency
52  </refpurpose>
53 </refnamediv>
54 <refsect1>
55  <title>
56   Oops
57  </title>
58  <warning>
59   <para>
60    The template for this document tried to insert
61    the structured comment from the file
62    <filename>include/linux/init.h</filename> at this point,
63    but none was found.
64    This dummy section is inserted to allow
65    generation to continue.
66   </para>
67  </warning>
68 </refsect1>
69</refentry>
70     </sect1>
71
72     <sect1><title>Atomic and pointer manipulation</title>
73<!-- arch/x86/include/asm/atomic.h -->
74<refentry id="API-atomic-read">
75<refentryinfo>
76 <title>LINUX</title>
77 <productname>Kernel Hackers Manual</productname>
78 <date>July 2017</date>
79</refentryinfo>
80<refmeta>
81 <refentrytitle><phrase>atomic_read</phrase></refentrytitle>
82 <manvolnum>9</manvolnum>
83 <refmiscinfo class="version">4.4.14</refmiscinfo>
84</refmeta>
85<refnamediv>
86 <refname>atomic_read</refname>
87 <refpurpose>
88  read atomic variable
89 </refpurpose>
90</refnamediv>
91<refsynopsisdiv>
92 <title>Synopsis</title>
93  <funcsynopsis><funcprototype>
94   <funcdef>int <function>atomic_read </function></funcdef>
95   <paramdef>const atomic_t * <parameter>v</parameter></paramdef>
96  </funcprototype></funcsynopsis>
97</refsynopsisdiv>
98<refsect1>
99 <title>Arguments</title>
100 <variablelist>
101  <varlistentry>
102   <term><parameter>v</parameter></term>
103   <listitem>
104    <para>
105     pointer of type atomic_t
106    </para>
107   </listitem>
108  </varlistentry>
109 </variablelist>
110</refsect1>
111<refsect1>
112<title>Description</title>
113<para>
114   Atomically reads the value of <parameter>v</parameter>.
115</para>
116</refsect1>
117</refentry>
118
119<refentry id="API-atomic-set">
120<refentryinfo>
121 <title>LINUX</title>
122 <productname>Kernel Hackers Manual</productname>
123 <date>July 2017</date>
124</refentryinfo>
125<refmeta>
126 <refentrytitle><phrase>atomic_set</phrase></refentrytitle>
127 <manvolnum>9</manvolnum>
128 <refmiscinfo class="version">4.4.14</refmiscinfo>
129</refmeta>
130<refnamediv>
131 <refname>atomic_set</refname>
132 <refpurpose>
133     set atomic variable
134 </refpurpose>
135</refnamediv>
136<refsynopsisdiv>
137 <title>Synopsis</title>
138  <funcsynopsis><funcprototype>
139   <funcdef>void <function>atomic_set </function></funcdef>
140   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
141   <paramdef>int <parameter>i</parameter></paramdef>
142  </funcprototype></funcsynopsis>
143</refsynopsisdiv>
144<refsect1>
145 <title>Arguments</title>
146 <variablelist>
147  <varlistentry>
148   <term><parameter>v</parameter></term>
149   <listitem>
150    <para>
151     pointer of type atomic_t
152    </para>
153   </listitem>
154  </varlistentry>
155  <varlistentry>
156   <term><parameter>i</parameter></term>
157   <listitem>
158    <para>
159     required value
160    </para>
161   </listitem>
162  </varlistentry>
163 </variablelist>
164</refsect1>
165<refsect1>
166<title>Description</title>
167<para>
168   Atomically sets the value of <parameter>v</parameter> to <parameter>i</parameter>.
169</para>
170</refsect1>
171</refentry>
172
173<refentry id="API-atomic-add">
174<refentryinfo>
175 <title>LINUX</title>
176 <productname>Kernel Hackers Manual</productname>
177 <date>July 2017</date>
178</refentryinfo>
179<refmeta>
180 <refentrytitle><phrase>atomic_add</phrase></refentrytitle>
181 <manvolnum>9</manvolnum>
182 <refmiscinfo class="version">4.4.14</refmiscinfo>
183</refmeta>
184<refnamediv>
185 <refname>atomic_add</refname>
186 <refpurpose>
187     add integer to atomic variable
188 </refpurpose>
189</refnamediv>
190<refsynopsisdiv>
191 <title>Synopsis</title>
192  <funcsynopsis><funcprototype>
193   <funcdef>void <function>atomic_add </function></funcdef>
194   <paramdef>int <parameter>i</parameter></paramdef>
195   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
196  </funcprototype></funcsynopsis>
197</refsynopsisdiv>
198<refsect1>
199 <title>Arguments</title>
200 <variablelist>
201  <varlistentry>
202   <term><parameter>i</parameter></term>
203   <listitem>
204    <para>
205     integer value to add
206    </para>
207   </listitem>
208  </varlistentry>
209  <varlistentry>
210   <term><parameter>v</parameter></term>
211   <listitem>
212    <para>
213     pointer of type atomic_t
214    </para>
215   </listitem>
216  </varlistentry>
217 </variablelist>
218</refsect1>
219<refsect1>
220<title>Description</title>
221<para>
222   Atomically adds <parameter>i</parameter> to <parameter>v</parameter>.
223</para>
224</refsect1>
225</refentry>
226
227<refentry id="API-atomic-sub">
228<refentryinfo>
229 <title>LINUX</title>
230 <productname>Kernel Hackers Manual</productname>
231 <date>July 2017</date>
232</refentryinfo>
233<refmeta>
234 <refentrytitle><phrase>atomic_sub</phrase></refentrytitle>
235 <manvolnum>9</manvolnum>
236 <refmiscinfo class="version">4.4.14</refmiscinfo>
237</refmeta>
238<refnamediv>
239 <refname>atomic_sub</refname>
240 <refpurpose>
241     subtract integer from atomic variable
242 </refpurpose>
243</refnamediv>
244<refsynopsisdiv>
245 <title>Synopsis</title>
246  <funcsynopsis><funcprototype>
247   <funcdef>void <function>atomic_sub </function></funcdef>
248   <paramdef>int <parameter>i</parameter></paramdef>
249   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
250  </funcprototype></funcsynopsis>
251</refsynopsisdiv>
252<refsect1>
253 <title>Arguments</title>
254 <variablelist>
255  <varlistentry>
256   <term><parameter>i</parameter></term>
257   <listitem>
258    <para>
259     integer value to subtract
260    </para>
261   </listitem>
262  </varlistentry>
263  <varlistentry>
264   <term><parameter>v</parameter></term>
265   <listitem>
266    <para>
267     pointer of type atomic_t
268    </para>
269   </listitem>
270  </varlistentry>
271 </variablelist>
272</refsect1>
273<refsect1>
274<title>Description</title>
275<para>
276   Atomically subtracts <parameter>i</parameter> from <parameter>v</parameter>.
277</para>
278</refsect1>
279</refentry>
280
281<refentry id="API-atomic-sub-and-test">
282<refentryinfo>
283 <title>LINUX</title>
284 <productname>Kernel Hackers Manual</productname>
285 <date>July 2017</date>
286</refentryinfo>
287<refmeta>
288 <refentrytitle><phrase>atomic_sub_and_test</phrase></refentrytitle>
289 <manvolnum>9</manvolnum>
290 <refmiscinfo class="version">4.4.14</refmiscinfo>
291</refmeta>
292<refnamediv>
293 <refname>atomic_sub_and_test</refname>
294 <refpurpose>
295     subtract value from variable and test result
296 </refpurpose>
297</refnamediv>
298<refsynopsisdiv>
299 <title>Synopsis</title>
300  <funcsynopsis><funcprototype>
301   <funcdef>int <function>atomic_sub_and_test </function></funcdef>
302   <paramdef>int <parameter>i</parameter></paramdef>
303   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
304  </funcprototype></funcsynopsis>
305</refsynopsisdiv>
306<refsect1>
307 <title>Arguments</title>
308 <variablelist>
309  <varlistentry>
310   <term><parameter>i</parameter></term>
311   <listitem>
312    <para>
313     integer value to subtract
314    </para>
315   </listitem>
316  </varlistentry>
317  <varlistentry>
318   <term><parameter>v</parameter></term>
319   <listitem>
320    <para>
321     pointer of type atomic_t
322    </para>
323   </listitem>
324  </varlistentry>
325 </variablelist>
326</refsect1>
327<refsect1>
328<title>Description</title>
329<para>
330   Atomically subtracts <parameter>i</parameter> from <parameter>v</parameter> and returns
331   true if the result is zero, or false for all
332   other cases.
333</para>
334</refsect1>
335</refentry>
336
337<refentry id="API-atomic-inc">
338<refentryinfo>
339 <title>LINUX</title>
340 <productname>Kernel Hackers Manual</productname>
341 <date>July 2017</date>
342</refentryinfo>
343<refmeta>
344 <refentrytitle><phrase>atomic_inc</phrase></refentrytitle>
345 <manvolnum>9</manvolnum>
346 <refmiscinfo class="version">4.4.14</refmiscinfo>
347</refmeta>
348<refnamediv>
349 <refname>atomic_inc</refname>
350 <refpurpose>
351     increment atomic variable
352 </refpurpose>
353</refnamediv>
354<refsynopsisdiv>
355 <title>Synopsis</title>
356  <funcsynopsis><funcprototype>
357   <funcdef>void <function>atomic_inc </function></funcdef>
358   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
359  </funcprototype></funcsynopsis>
360</refsynopsisdiv>
361<refsect1>
362 <title>Arguments</title>
363 <variablelist>
364  <varlistentry>
365   <term><parameter>v</parameter></term>
366   <listitem>
367    <para>
368     pointer of type atomic_t
369    </para>
370   </listitem>
371  </varlistentry>
372 </variablelist>
373</refsect1>
374<refsect1>
375<title>Description</title>
376<para>
377   Atomically increments <parameter>v</parameter> by 1.
378</para>
379</refsect1>
380</refentry>
381
382<refentry id="API-atomic-dec">
383<refentryinfo>
384 <title>LINUX</title>
385 <productname>Kernel Hackers Manual</productname>
386 <date>July 2017</date>
387</refentryinfo>
388<refmeta>
389 <refentrytitle><phrase>atomic_dec</phrase></refentrytitle>
390 <manvolnum>9</manvolnum>
391 <refmiscinfo class="version">4.4.14</refmiscinfo>
392</refmeta>
393<refnamediv>
394 <refname>atomic_dec</refname>
395 <refpurpose>
396     decrement atomic variable
397 </refpurpose>
398</refnamediv>
399<refsynopsisdiv>
400 <title>Synopsis</title>
401  <funcsynopsis><funcprototype>
402   <funcdef>void <function>atomic_dec </function></funcdef>
403   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
404  </funcprototype></funcsynopsis>
405</refsynopsisdiv>
406<refsect1>
407 <title>Arguments</title>
408 <variablelist>
409  <varlistentry>
410   <term><parameter>v</parameter></term>
411   <listitem>
412    <para>
413     pointer of type atomic_t
414    </para>
415   </listitem>
416  </varlistentry>
417 </variablelist>
418</refsect1>
419<refsect1>
420<title>Description</title>
421<para>
422   Atomically decrements <parameter>v</parameter> by 1.
423</para>
424</refsect1>
425</refentry>
426
427<refentry id="API-atomic-dec-and-test">
428<refentryinfo>
429 <title>LINUX</title>
430 <productname>Kernel Hackers Manual</productname>
431 <date>July 2017</date>
432</refentryinfo>
433<refmeta>
434 <refentrytitle><phrase>atomic_dec_and_test</phrase></refentrytitle>
435 <manvolnum>9</manvolnum>
436 <refmiscinfo class="version">4.4.14</refmiscinfo>
437</refmeta>
438<refnamediv>
439 <refname>atomic_dec_and_test</refname>
440 <refpurpose>
441     decrement and test
442 </refpurpose>
443</refnamediv>
444<refsynopsisdiv>
445 <title>Synopsis</title>
446  <funcsynopsis><funcprototype>
447   <funcdef>int <function>atomic_dec_and_test </function></funcdef>
448   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
449  </funcprototype></funcsynopsis>
450</refsynopsisdiv>
451<refsect1>
452 <title>Arguments</title>
453 <variablelist>
454  <varlistentry>
455   <term><parameter>v</parameter></term>
456   <listitem>
457    <para>
458     pointer of type atomic_t
459    </para>
460   </listitem>
461  </varlistentry>
462 </variablelist>
463</refsect1>
464<refsect1>
465<title>Description</title>
466<para>
467   Atomically decrements <parameter>v</parameter> by 1 and
468   returns true if the result is 0, or false for all other
469   cases.
470</para>
471</refsect1>
472</refentry>
473
474<refentry id="API-atomic-inc-and-test">
475<refentryinfo>
476 <title>LINUX</title>
477 <productname>Kernel Hackers Manual</productname>
478 <date>July 2017</date>
479</refentryinfo>
480<refmeta>
481 <refentrytitle><phrase>atomic_inc_and_test</phrase></refentrytitle>
482 <manvolnum>9</manvolnum>
483 <refmiscinfo class="version">4.4.14</refmiscinfo>
484</refmeta>
485<refnamediv>
486 <refname>atomic_inc_and_test</refname>
487 <refpurpose>
488     increment and test
489 </refpurpose>
490</refnamediv>
491<refsynopsisdiv>
492 <title>Synopsis</title>
493  <funcsynopsis><funcprototype>
494   <funcdef>int <function>atomic_inc_and_test </function></funcdef>
495   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
496  </funcprototype></funcsynopsis>
497</refsynopsisdiv>
498<refsect1>
499 <title>Arguments</title>
500 <variablelist>
501  <varlistentry>
502   <term><parameter>v</parameter></term>
503   <listitem>
504    <para>
505     pointer of type atomic_t
506    </para>
507   </listitem>
508  </varlistentry>
509 </variablelist>
510</refsect1>
511<refsect1>
512<title>Description</title>
513<para>
514   Atomically increments <parameter>v</parameter> by 1
515   and returns true if the result is zero, or false for all
516   other cases.
517</para>
518</refsect1>
519</refentry>
520
521<refentry id="API-atomic-add-negative">
522<refentryinfo>
523 <title>LINUX</title>
524 <productname>Kernel Hackers Manual</productname>
525 <date>July 2017</date>
526</refentryinfo>
527<refmeta>
528 <refentrytitle><phrase>atomic_add_negative</phrase></refentrytitle>
529 <manvolnum>9</manvolnum>
530 <refmiscinfo class="version">4.4.14</refmiscinfo>
531</refmeta>
532<refnamediv>
533 <refname>atomic_add_negative</refname>
534 <refpurpose>
535     add and test if negative
536 </refpurpose>
537</refnamediv>
538<refsynopsisdiv>
539 <title>Synopsis</title>
540  <funcsynopsis><funcprototype>
541   <funcdef>int <function>atomic_add_negative </function></funcdef>
542   <paramdef>int <parameter>i</parameter></paramdef>
543   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
544  </funcprototype></funcsynopsis>
545</refsynopsisdiv>
546<refsect1>
547 <title>Arguments</title>
548 <variablelist>
549  <varlistentry>
550   <term><parameter>i</parameter></term>
551   <listitem>
552    <para>
553     integer value to add
554    </para>
555   </listitem>
556  </varlistentry>
557  <varlistentry>
558   <term><parameter>v</parameter></term>
559   <listitem>
560    <para>
561     pointer of type atomic_t
562    </para>
563   </listitem>
564  </varlistentry>
565 </variablelist>
566</refsect1>
567<refsect1>
568<title>Description</title>
569<para>
570   Atomically adds <parameter>i</parameter> to <parameter>v</parameter> and returns true
571   if the result is negative, or false when
572   result is greater than or equal to zero.
573</para>
574</refsect1>
575</refentry>
576
577<refentry id="API-atomic-add-return">
578<refentryinfo>
579 <title>LINUX</title>
580 <productname>Kernel Hackers Manual</productname>
581 <date>July 2017</date>
582</refentryinfo>
583<refmeta>
584 <refentrytitle><phrase>atomic_add_return</phrase></refentrytitle>
585 <manvolnum>9</manvolnum>
586 <refmiscinfo class="version">4.4.14</refmiscinfo>
587</refmeta>
588<refnamediv>
589 <refname>atomic_add_return</refname>
590 <refpurpose>
591     add integer and return
592 </refpurpose>
593</refnamediv>
594<refsynopsisdiv>
595 <title>Synopsis</title>
596  <funcsynopsis><funcprototype>
597   <funcdef>int <function>atomic_add_return </function></funcdef>
598   <paramdef>int <parameter>i</parameter></paramdef>
599   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
600  </funcprototype></funcsynopsis>
601</refsynopsisdiv>
602<refsect1>
603 <title>Arguments</title>
604 <variablelist>
605  <varlistentry>
606   <term><parameter>i</parameter></term>
607   <listitem>
608    <para>
609     integer value to add
610    </para>
611   </listitem>
612  </varlistentry>
613  <varlistentry>
614   <term><parameter>v</parameter></term>
615   <listitem>
616    <para>
617     pointer of type atomic_t
618    </para>
619   </listitem>
620  </varlistentry>
621 </variablelist>
622</refsect1>
623<refsect1>
624<title>Description</title>
625<para>
626   Atomically adds <parameter>i</parameter> to <parameter>v</parameter> and returns <parameter>i</parameter> + <parameter>v</parameter>
627</para>
628</refsect1>
629</refentry>
630
631<refentry id="API-atomic-sub-return">
632<refentryinfo>
633 <title>LINUX</title>
634 <productname>Kernel Hackers Manual</productname>
635 <date>July 2017</date>
636</refentryinfo>
637<refmeta>
638 <refentrytitle><phrase>atomic_sub_return</phrase></refentrytitle>
639 <manvolnum>9</manvolnum>
640 <refmiscinfo class="version">4.4.14</refmiscinfo>
641</refmeta>
642<refnamediv>
643 <refname>atomic_sub_return</refname>
644 <refpurpose>
645     subtract integer and return
646 </refpurpose>
647</refnamediv>
648<refsynopsisdiv>
649 <title>Synopsis</title>
650  <funcsynopsis><funcprototype>
651   <funcdef>int <function>atomic_sub_return </function></funcdef>
652   <paramdef>int <parameter>i</parameter></paramdef>
653   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
654  </funcprototype></funcsynopsis>
655</refsynopsisdiv>
656<refsect1>
657 <title>Arguments</title>
658 <variablelist>
659  <varlistentry>
660   <term><parameter>i</parameter></term>
661   <listitem>
662    <para>
663     integer value to subtract
664    </para>
665   </listitem>
666  </varlistentry>
667  <varlistentry>
668   <term><parameter>v</parameter></term>
669   <listitem>
670    <para>
671     pointer of type atomic_t
672    </para>
673   </listitem>
674  </varlistentry>
675 </variablelist>
676</refsect1>
677<refsect1>
678<title>Description</title>
679<para>
680   Atomically subtracts <parameter>i</parameter> from <parameter>v</parameter> and returns <parameter>v</parameter> - <parameter>i</parameter>
681</para>
682</refsect1>
683</refentry>
684
685<refentry id="API---atomic-add-unless">
686<refentryinfo>
687 <title>LINUX</title>
688 <productname>Kernel Hackers Manual</productname>
689 <date>July 2017</date>
690</refentryinfo>
691<refmeta>
692 <refentrytitle><phrase>__atomic_add_unless</phrase></refentrytitle>
693 <manvolnum>9</manvolnum>
694 <refmiscinfo class="version">4.4.14</refmiscinfo>
695</refmeta>
696<refnamediv>
697 <refname>__atomic_add_unless</refname>
698 <refpurpose>
699     add unless the number is already a given value
700 </refpurpose>
701</refnamediv>
702<refsynopsisdiv>
703 <title>Synopsis</title>
704  <funcsynopsis><funcprototype>
705   <funcdef>int <function>__atomic_add_unless </function></funcdef>
706   <paramdef>atomic_t * <parameter>v</parameter></paramdef>
707   <paramdef>int <parameter>a</parameter></paramdef>
708   <paramdef>int <parameter>u</parameter></paramdef>
709  </funcprototype></funcsynopsis>
710</refsynopsisdiv>
711<refsect1>
712 <title>Arguments</title>
713 <variablelist>
714  <varlistentry>
715   <term><parameter>v</parameter></term>
716   <listitem>
717    <para>
718     pointer of type atomic_t
719    </para>
720   </listitem>
721  </varlistentry>
722  <varlistentry>
723   <term><parameter>a</parameter></term>
724   <listitem>
725    <para>
726     the amount to add to v...
727    </para>
728   </listitem>
729  </varlistentry>
730  <varlistentry>
731   <term><parameter>u</parameter></term>
732   <listitem>
733    <para>
734     ...unless v is equal to u.
735    </para>
736   </listitem>
737  </varlistentry>
738 </variablelist>
739</refsect1>
740<refsect1>
741<title>Description</title>
742<para>
743   Atomically adds <parameter>a</parameter> to <parameter>v</parameter>, so long as <parameter>v</parameter> was not already <parameter>u</parameter>.
744   Returns the old value of <parameter>v</parameter>.
745</para>
746</refsect1>
747</refentry>
748
749<refentry id="API-atomic-inc-short">
750<refentryinfo>
751 <title>LINUX</title>
752 <productname>Kernel Hackers Manual</productname>
753 <date>July 2017</date>
754</refentryinfo>
755<refmeta>
756 <refentrytitle><phrase>atomic_inc_short</phrase></refentrytitle>
757 <manvolnum>9</manvolnum>
758 <refmiscinfo class="version">4.4.14</refmiscinfo>
759</refmeta>
760<refnamediv>
761 <refname>atomic_inc_short</refname>
762 <refpurpose>
763     increment of a short integer
764 </refpurpose>
765</refnamediv>
766<refsynopsisdiv>
767 <title>Synopsis</title>
768  <funcsynopsis><funcprototype>
769   <funcdef>short int <function>atomic_inc_short </function></funcdef>
770   <paramdef>short int * <parameter>v</parameter></paramdef>
771  </funcprototype></funcsynopsis>
772</refsynopsisdiv>
773<refsect1>
774 <title>Arguments</title>
775 <variablelist>
776  <varlistentry>
777   <term><parameter>v</parameter></term>
778   <listitem>
779    <para>
780     pointer to type int
781    </para>
782   </listitem>
783  </varlistentry>
784 </variablelist>
785</refsect1>
786<refsect1>
787<title>Description</title>
788<para>
789   Atomically adds 1 to <parameter>v</parameter>
790   Returns the new value of <parameter>u</parameter>
791</para>
792</refsect1>
793</refentry>
794
795     </sect1>
796
797     <sect1><title>Delaying, scheduling, and timer routines</title>
798<!-- include/linux/sched.h -->
799<refentry id="API-struct-prev-cputime">
800<refentryinfo>
801 <title>LINUX</title>
802 <productname>Kernel Hackers Manual</productname>
803 <date>July 2017</date>
804</refentryinfo>
805<refmeta>
806 <refentrytitle><phrase>struct prev_cputime</phrase></refentrytitle>
807 <manvolnum>9</manvolnum>
808 <refmiscinfo class="version">4.4.14</refmiscinfo>
809</refmeta>
810<refnamediv>
811 <refname>struct prev_cputime</refname>
812 <refpurpose>
813  snaphsot of system and user cputime
814 </refpurpose>
815</refnamediv>
816<refsynopsisdiv>
817 <title>Synopsis</title>
818  <programlisting>
819struct prev_cputime {
820#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
821  cputime_t utime;
822  cputime_t stime;
823  raw_spinlock_t lock;
824#endif
825};  </programlisting>
826</refsynopsisdiv>
827 <refsect1>
828  <title>Members</title>
829  <variablelist>
830    <varlistentry>      <term>utime</term>
831      <listitem><para>
832time spent in user mode
833      </para></listitem>
834    </varlistentry>
835    <varlistentry>      <term>stime</term>
836      <listitem><para>
837time spent in system mode
838      </para></listitem>
839    </varlistentry>
840    <varlistentry>      <term>lock</term>
841      <listitem><para>
842protects the above two fields
843      </para></listitem>
844    </varlistentry>
845  </variablelist>
846 </refsect1>
847<refsect1>
848<title>Description</title>
849<para>
850   Stores previous user/system time values such that we can guarantee
851   monotonicity.
852</para>
853</refsect1>
854</refentry>
855
856<refentry id="API-struct-task-cputime">
857<refentryinfo>
858 <title>LINUX</title>
859 <productname>Kernel Hackers Manual</productname>
860 <date>July 2017</date>
861</refentryinfo>
862<refmeta>
863 <refentrytitle><phrase>struct task_cputime</phrase></refentrytitle>
864 <manvolnum>9</manvolnum>
865 <refmiscinfo class="version">4.4.14</refmiscinfo>
866</refmeta>
867<refnamediv>
868 <refname>struct task_cputime</refname>
869 <refpurpose>
870     collected CPU time counts
871 </refpurpose>
872</refnamediv>
873<refsynopsisdiv>
874 <title>Synopsis</title>
875  <programlisting>
876struct task_cputime {
877  cputime_t utime;
878  cputime_t stime;
879  unsigned long long sum_exec_runtime;
880};  </programlisting>
881</refsynopsisdiv>
882 <refsect1>
883  <title>Members</title>
884  <variablelist>
885    <varlistentry>      <term>utime</term>
886      <listitem><para>
887   time spent in user mode, in <structname>cputime_t</structname> units
888      </para></listitem>
889    </varlistentry>
890    <varlistentry>      <term>stime</term>
891      <listitem><para>
892   time spent in kernel mode, in <structname>cputime_t</structname> units
893      </para></listitem>
894    </varlistentry>
895    <varlistentry>      <term>sum_exec_runtime</term>
896      <listitem><para>
897   total time spent on the CPU, in nanoseconds
898      </para></listitem>
899    </varlistentry>
900  </variablelist>
901 </refsect1>
902<refsect1>
903<title>Description</title>
904<para>
905   This structure groups together three kinds of CPU time that are tracked for
906   threads and thread groups.  Most things considering CPU time want to group
907   these counts together and treat all three of them in parallel.
908</para>
909</refsect1>
910</refentry>
911
912<refentry id="API-struct-thread-group-cputimer">
913<refentryinfo>
914 <title>LINUX</title>
915 <productname>Kernel Hackers Manual</productname>
916 <date>July 2017</date>
917</refentryinfo>
918<refmeta>
919 <refentrytitle><phrase>struct thread_group_cputimer</phrase></refentrytitle>
920 <manvolnum>9</manvolnum>
921 <refmiscinfo class="version">4.4.14</refmiscinfo>
922</refmeta>
923<refnamediv>
924 <refname>struct thread_group_cputimer</refname>
925 <refpurpose>
926     thread group interval timer counts
927 </refpurpose>
928</refnamediv>
929<refsynopsisdiv>
930 <title>Synopsis</title>
931  <programlisting>
932struct thread_group_cputimer {
933  struct task_cputime_atomic cputime_atomic;
934  bool running;
935  bool checking_timer;
936};  </programlisting>
937</refsynopsisdiv>
938 <refsect1>
939  <title>Members</title>
940  <variablelist>
941    <varlistentry>      <term>cputime_atomic</term>
942      <listitem><para>
943   atomic thread group interval timers.
944      </para></listitem>
945    </varlistentry>
946    <varlistentry>      <term>running</term>
947      <listitem><para>
948   true when there are timers running and
949   <parameter>cputime_atomic</parameter> receives updates.
950      </para></listitem>
951    </varlistentry>
952    <varlistentry>      <term>checking_timer</term>
953      <listitem><para>
954   true when a thread in the group is in the
955   process of checking for thread group timers.
956      </para></listitem>
957    </varlistentry>
958  </variablelist>
959 </refsect1>
960<refsect1>
961<title>Description</title>
962<para>
963   This structure contains the version of task_cputime, above, that is
964   used for thread group CPU timer calculations.
965</para>
966</refsect1>
967</refentry>
968
969<refentry id="API-pid-alive">
970<refentryinfo>
971 <title>LINUX</title>
972 <productname>Kernel Hackers Manual</productname>
973 <date>July 2017</date>
974</refentryinfo>
975<refmeta>
976 <refentrytitle><phrase>pid_alive</phrase></refentrytitle>
977 <manvolnum>9</manvolnum>
978 <refmiscinfo class="version">4.4.14</refmiscinfo>
979</refmeta>
980<refnamediv>
981 <refname>pid_alive</refname>
982 <refpurpose>
983     check that a task structure is not stale
984 </refpurpose>
985</refnamediv>
986<refsynopsisdiv>
987 <title>Synopsis</title>
988  <funcsynopsis><funcprototype>
989   <funcdef>int <function>pid_alive </function></funcdef>
990   <paramdef>const struct task_struct * <parameter>p</parameter></paramdef>
991  </funcprototype></funcsynopsis>
992</refsynopsisdiv>
993<refsect1>
994 <title>Arguments</title>
995 <variablelist>
996  <varlistentry>
997   <term><parameter>p</parameter></term>
998   <listitem>
999    <para>
1000     Task structure to be checked.
1001    </para>
1002   </listitem>
1003  </varlistentry>
1004 </variablelist>
1005</refsect1>
1006<refsect1>
1007<title>Description</title>
1008<para>
1009   Test if a process is not yet dead (at most zombie state)
1010   If pid_alive fails, then pointers within the task structure
1011   can be stale and must not be dereferenced.
1012</para>
1013</refsect1>
1014<refsect1>
1015<title>Return</title>
1016<para>
1017   1 if the process is alive. 0 otherwise.
1018</para>
1019</refsect1>
1020</refentry>
1021
1022<refentry id="API-is-global-init">
1023<refentryinfo>
1024 <title>LINUX</title>
1025 <productname>Kernel Hackers Manual</productname>
1026 <date>July 2017</date>
1027</refentryinfo>
1028<refmeta>
1029 <refentrytitle><phrase>is_global_init</phrase></refentrytitle>
1030 <manvolnum>9</manvolnum>
1031 <refmiscinfo class="version">4.4.14</refmiscinfo>
1032</refmeta>
1033<refnamediv>
1034 <refname>is_global_init</refname>
1035 <refpurpose>
1036     check if a task structure is init. Since init is free to have sub-threads we need to check tgid.
1037 </refpurpose>
1038</refnamediv>
1039<refsynopsisdiv>
1040 <title>Synopsis</title>
1041  <funcsynopsis><funcprototype>
1042   <funcdef>int <function>is_global_init </function></funcdef>
1043   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
1044  </funcprototype></funcsynopsis>
1045</refsynopsisdiv>
1046<refsect1>
1047 <title>Arguments</title>
1048 <variablelist>
1049  <varlistentry>
1050   <term><parameter>tsk</parameter></term>
1051   <listitem>
1052    <para>
1053     Task structure to be checked.
1054    </para>
1055   </listitem>
1056  </varlistentry>
1057 </variablelist>
1058</refsect1>
1059<refsect1>
1060<title>Description</title>
1061<para>
1062   Check if a task structure is the first user space task the kernel created.
1063</para>
1064</refsect1>
1065<refsect1>
1066<title>Return</title>
1067<para>
1068   1 if the task structure is init. 0 otherwise.
1069</para>
1070</refsect1>
1071</refentry>
1072
1073<refentry id="API-task-nice">
1074<refentryinfo>
1075 <title>LINUX</title>
1076 <productname>Kernel Hackers Manual</productname>
1077 <date>July 2017</date>
1078</refentryinfo>
1079<refmeta>
1080 <refentrytitle><phrase>task_nice</phrase></refentrytitle>
1081 <manvolnum>9</manvolnum>
1082 <refmiscinfo class="version">4.4.14</refmiscinfo>
1083</refmeta>
1084<refnamediv>
1085 <refname>task_nice</refname>
1086 <refpurpose>
1087     return the nice value of a given task.
1088 </refpurpose>
1089</refnamediv>
1090<refsynopsisdiv>
1091 <title>Synopsis</title>
1092  <funcsynopsis><funcprototype>
1093   <funcdef>int <function>task_nice </function></funcdef>
1094   <paramdef>const struct task_struct * <parameter>p</parameter></paramdef>
1095  </funcprototype></funcsynopsis>
1096</refsynopsisdiv>
1097<refsect1>
1098 <title>Arguments</title>
1099 <variablelist>
1100  <varlistentry>
1101   <term><parameter>p</parameter></term>
1102   <listitem>
1103    <para>
1104     the task in question.
1105    </para>
1106   </listitem>
1107  </varlistentry>
1108 </variablelist>
1109</refsect1>
1110<refsect1>
1111<title>Return</title>
1112<para>
1113   The nice value [ -20 ... 0 ... 19 ].
1114</para>
1115</refsect1>
1116</refentry>
1117
1118<refentry id="API-is-idle-task">
1119<refentryinfo>
1120 <title>LINUX</title>
1121 <productname>Kernel Hackers Manual</productname>
1122 <date>July 2017</date>
1123</refentryinfo>
1124<refmeta>
1125 <refentrytitle><phrase>is_idle_task</phrase></refentrytitle>
1126 <manvolnum>9</manvolnum>
1127 <refmiscinfo class="version">4.4.14</refmiscinfo>
1128</refmeta>
1129<refnamediv>
1130 <refname>is_idle_task</refname>
1131 <refpurpose>
1132     is the specified task an idle task?
1133 </refpurpose>
1134</refnamediv>
1135<refsynopsisdiv>
1136 <title>Synopsis</title>
1137  <funcsynopsis><funcprototype>
1138   <funcdef>bool <function>is_idle_task </function></funcdef>
1139   <paramdef>const struct task_struct * <parameter>p</parameter></paramdef>
1140  </funcprototype></funcsynopsis>
1141</refsynopsisdiv>
1142<refsect1>
1143 <title>Arguments</title>
1144 <variablelist>
1145  <varlistentry>
1146   <term><parameter>p</parameter></term>
1147   <listitem>
1148    <para>
1149     the task in question.
1150    </para>
1151   </listitem>
1152  </varlistentry>
1153 </variablelist>
1154</refsect1>
1155<refsect1>
1156<title>Return</title>
1157<para>
1158   1 if <parameter>p</parameter> is an idle task. 0 otherwise.
1159</para>
1160</refsect1>
1161</refentry>
1162
1163<refentry id="API-threadgroup-change-begin">
1164<refentryinfo>
1165 <title>LINUX</title>
1166 <productname>Kernel Hackers Manual</productname>
1167 <date>July 2017</date>
1168</refentryinfo>
1169<refmeta>
1170 <refentrytitle><phrase>threadgroup_change_begin</phrase></refentrytitle>
1171 <manvolnum>9</manvolnum>
1172 <refmiscinfo class="version">4.4.14</refmiscinfo>
1173</refmeta>
1174<refnamediv>
1175 <refname>threadgroup_change_begin</refname>
1176 <refpurpose>
1177     mark the beginning of changes to a threadgroup
1178 </refpurpose>
1179</refnamediv>
1180<refsynopsisdiv>
1181 <title>Synopsis</title>
1182  <funcsynopsis><funcprototype>
1183   <funcdef>void <function>threadgroup_change_begin </function></funcdef>
1184   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
1185  </funcprototype></funcsynopsis>
1186</refsynopsisdiv>
1187<refsect1>
1188 <title>Arguments</title>
1189 <variablelist>
1190  <varlistentry>
1191   <term><parameter>tsk</parameter></term>
1192   <listitem>
1193    <para>
1194     task causing the changes
1195    </para>
1196   </listitem>
1197  </varlistentry>
1198 </variablelist>
1199</refsect1>
1200<refsect1>
1201<title>Description</title>
1202<para>
1203   All operations which modify a threadgroup - a new thread joining the
1204   group, death of a member thread (the assertion of PF_EXITING) and
1205   exec(2) dethreading the process and replacing the leader - are wrapped
1206   by threadgroup_change_{begin|end}().  This is to provide a place which
1207   subsystems needing threadgroup stability can hook into for
1208   synchronization.
1209</para>
1210</refsect1>
1211</refentry>
1212
1213<refentry id="API-threadgroup-change-end">
1214<refentryinfo>
1215 <title>LINUX</title>
1216 <productname>Kernel Hackers Manual</productname>
1217 <date>July 2017</date>
1218</refentryinfo>
1219<refmeta>
1220 <refentrytitle><phrase>threadgroup_change_end</phrase></refentrytitle>
1221 <manvolnum>9</manvolnum>
1222 <refmiscinfo class="version">4.4.14</refmiscinfo>
1223</refmeta>
1224<refnamediv>
1225 <refname>threadgroup_change_end</refname>
1226 <refpurpose>
1227     mark the end of changes to a threadgroup
1228 </refpurpose>
1229</refnamediv>
1230<refsynopsisdiv>
1231 <title>Synopsis</title>
1232  <funcsynopsis><funcprototype>
1233   <funcdef>void <function>threadgroup_change_end </function></funcdef>
1234   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
1235  </funcprototype></funcsynopsis>
1236</refsynopsisdiv>
1237<refsect1>
1238 <title>Arguments</title>
1239 <variablelist>
1240  <varlistentry>
1241   <term><parameter>tsk</parameter></term>
1242   <listitem>
1243    <para>
1244     task causing the changes
1245    </para>
1246   </listitem>
1247  </varlistentry>
1248 </variablelist>
1249</refsect1>
1250<refsect1>
1251<title>Description</title>
1252<para>
1253   See <function><link linkend="API-threadgroup-change-begin">threadgroup_change_begin</link></function>.
1254</para>
1255</refsect1>
1256</refentry>
1257
1258<!-- kernel/sched/core.c -->
1259<refentry id="API-wake-up-process">
1260<refentryinfo>
1261 <title>LINUX</title>
1262 <productname>Kernel Hackers Manual</productname>
1263 <date>July 2017</date>
1264</refentryinfo>
1265<refmeta>
1266 <refentrytitle><phrase>wake_up_process</phrase></refentrytitle>
1267 <manvolnum>9</manvolnum>
1268 <refmiscinfo class="version">4.4.14</refmiscinfo>
1269</refmeta>
1270<refnamediv>
1271 <refname>wake_up_process</refname>
1272 <refpurpose>
1273  Wake up a specific process
1274 </refpurpose>
1275</refnamediv>
1276<refsynopsisdiv>
1277 <title>Synopsis</title>
1278  <funcsynopsis><funcprototype>
1279   <funcdef>int <function>wake_up_process </function></funcdef>
1280   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1281  </funcprototype></funcsynopsis>
1282</refsynopsisdiv>
1283<refsect1>
1284 <title>Arguments</title>
1285 <variablelist>
1286  <varlistentry>
1287   <term><parameter>p</parameter></term>
1288   <listitem>
1289    <para>
1290     The process to be woken up.
1291    </para>
1292   </listitem>
1293  </varlistentry>
1294 </variablelist>
1295</refsect1>
1296<refsect1>
1297<title>Description</title>
1298<para>
1299   Attempt to wake up the nominated process and move it to the set of runnable
1300   processes.
1301</para>
1302</refsect1>
1303<refsect1>
1304<title>Return</title>
1305<para>
1306   1 if the process was woken up, 0 if it was already running.
1307   </para><para>
1308
1309   It may be assumed that this function implies a write memory barrier before
1310   changing the task state if and only if any tasks are woken up.
1311</para>
1312</refsect1>
1313</refentry>
1314
1315<refentry id="API-preempt-notifier-register">
1316<refentryinfo>
1317 <title>LINUX</title>
1318 <productname>Kernel Hackers Manual</productname>
1319 <date>July 2017</date>
1320</refentryinfo>
1321<refmeta>
1322 <refentrytitle><phrase>preempt_notifier_register</phrase></refentrytitle>
1323 <manvolnum>9</manvolnum>
1324 <refmiscinfo class="version">4.4.14</refmiscinfo>
1325</refmeta>
1326<refnamediv>
1327 <refname>preempt_notifier_register</refname>
1328 <refpurpose>
1329     tell me when current is being preempted &amp; rescheduled
1330 </refpurpose>
1331</refnamediv>
1332<refsynopsisdiv>
1333 <title>Synopsis</title>
1334  <funcsynopsis><funcprototype>
1335   <funcdef>void <function>preempt_notifier_register </function></funcdef>
1336   <paramdef>struct preempt_notifier * <parameter>notifier</parameter></paramdef>
1337  </funcprototype></funcsynopsis>
1338</refsynopsisdiv>
1339<refsect1>
1340 <title>Arguments</title>
1341 <variablelist>
1342  <varlistentry>
1343   <term><parameter>notifier</parameter></term>
1344   <listitem>
1345    <para>
1346     notifier struct to register
1347    </para>
1348   </listitem>
1349  </varlistentry>
1350 </variablelist>
1351</refsect1>
1352</refentry>
1353
1354<refentry id="API-preempt-notifier-unregister">
1355<refentryinfo>
1356 <title>LINUX</title>
1357 <productname>Kernel Hackers Manual</productname>
1358 <date>July 2017</date>
1359</refentryinfo>
1360<refmeta>
1361 <refentrytitle><phrase>preempt_notifier_unregister</phrase></refentrytitle>
1362 <manvolnum>9</manvolnum>
1363 <refmiscinfo class="version">4.4.14</refmiscinfo>
1364</refmeta>
1365<refnamediv>
1366 <refname>preempt_notifier_unregister</refname>
1367 <refpurpose>
1368     no longer interested in preemption notifications
1369 </refpurpose>
1370</refnamediv>
1371<refsynopsisdiv>
1372 <title>Synopsis</title>
1373  <funcsynopsis><funcprototype>
1374   <funcdef>void <function>preempt_notifier_unregister </function></funcdef>
1375   <paramdef>struct preempt_notifier * <parameter>notifier</parameter></paramdef>
1376  </funcprototype></funcsynopsis>
1377</refsynopsisdiv>
1378<refsect1>
1379 <title>Arguments</title>
1380 <variablelist>
1381  <varlistentry>
1382   <term><parameter>notifier</parameter></term>
1383   <listitem>
1384    <para>
1385     notifier struct to unregister
1386    </para>
1387   </listitem>
1388  </varlistentry>
1389 </variablelist>
1390</refsect1>
1391<refsect1>
1392<title>Description</title>
1393<para>
1394   This is *not* safe to call from within a preemption notifier.
1395</para>
1396</refsect1>
1397</refentry>
1398
1399<refentry id="API-preempt-schedule-notrace">
1400<refentryinfo>
1401 <title>LINUX</title>
1402 <productname>Kernel Hackers Manual</productname>
1403 <date>July 2017</date>
1404</refentryinfo>
1405<refmeta>
1406 <refentrytitle><phrase>preempt_schedule_notrace</phrase></refentrytitle>
1407 <manvolnum>9</manvolnum>
1408 <refmiscinfo class="version">4.4.14</refmiscinfo>
1409</refmeta>
1410<refnamediv>
1411 <refname>preempt_schedule_notrace</refname>
1412 <refpurpose>
1413     preempt_schedule called by tracing
1414 </refpurpose>
1415</refnamediv>
1416<refsynopsisdiv>
1417 <title>Synopsis</title>
1418  <funcsynopsis><funcprototype>
1419   <funcdef>__visible void __sched notrace <function>preempt_schedule_notrace </function></funcdef>
1420   <paramdef> <parameter>void</parameter></paramdef>
1421  </funcprototype></funcsynopsis>
1422</refsynopsisdiv>
1423<refsect1>
1424 <title>Arguments</title>
1425 <variablelist>
1426  <varlistentry>
1427   <term><parameter>void</parameter></term>
1428   <listitem>
1429    <para>
1430     no arguments
1431    </para>
1432   </listitem>
1433  </varlistentry>
1434 </variablelist>
1435</refsect1>
1436<refsect1>
1437<title>Description</title>
1438<para>
1439   </para><para>
1440
1441   The tracing infrastructure uses preempt_enable_notrace to prevent
1442   recursion and tracing preempt enabling caused by the tracing
1443   infrastructure itself. But as tracing can happen in areas coming
1444   from userspace or just about to enter userspace, a preempt enable
1445   can occur before <function>user_exit</function> is called. This will cause the scheduler
1446   to be called when the system is still in usermode.
1447   </para><para>
1448
1449   To prevent this, the preempt_enable_notrace will use this function
1450   instead of <function>preempt_schedule</function> to exit user context if needed before
1451   calling the scheduler.
1452</para>
1453</refsect1>
1454</refentry>
1455
1456<refentry id="API-sched-setscheduler">
1457<refentryinfo>
1458 <title>LINUX</title>
1459 <productname>Kernel Hackers Manual</productname>
1460 <date>July 2017</date>
1461</refentryinfo>
1462<refmeta>
1463 <refentrytitle><phrase>sched_setscheduler</phrase></refentrytitle>
1464 <manvolnum>9</manvolnum>
1465 <refmiscinfo class="version">4.4.14</refmiscinfo>
1466</refmeta>
1467<refnamediv>
1468 <refname>sched_setscheduler</refname>
1469 <refpurpose>
1470     change the scheduling policy and/or RT priority of a thread.
1471 </refpurpose>
1472</refnamediv>
1473<refsynopsisdiv>
1474 <title>Synopsis</title>
1475  <funcsynopsis><funcprototype>
1476   <funcdef>int <function>sched_setscheduler </function></funcdef>
1477   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1478   <paramdef>int <parameter>policy</parameter></paramdef>
1479   <paramdef>const struct sched_param * <parameter>param</parameter></paramdef>
1480  </funcprototype></funcsynopsis>
1481</refsynopsisdiv>
1482<refsect1>
1483 <title>Arguments</title>
1484 <variablelist>
1485  <varlistentry>
1486   <term><parameter>p</parameter></term>
1487   <listitem>
1488    <para>
1489     the task in question.
1490    </para>
1491   </listitem>
1492  </varlistentry>
1493  <varlistentry>
1494   <term><parameter>policy</parameter></term>
1495   <listitem>
1496    <para>
1497     new policy.
1498    </para>
1499   </listitem>
1500  </varlistentry>
1501  <varlistentry>
1502   <term><parameter>param</parameter></term>
1503   <listitem>
1504    <para>
1505     structure containing the new RT priority.
1506    </para>
1507   </listitem>
1508  </varlistentry>
1509 </variablelist>
1510</refsect1>
1511<refsect1>
1512<title>Return</title>
1513<para>
1514   0 on success. An error code otherwise.
1515   </para><para>
1516
1517   NOTE that the task may be already dead.
1518</para>
1519</refsect1>
1520</refentry>
1521
1522<refentry id="API-sched-setscheduler-nocheck">
1523<refentryinfo>
1524 <title>LINUX</title>
1525 <productname>Kernel Hackers Manual</productname>
1526 <date>July 2017</date>
1527</refentryinfo>
1528<refmeta>
1529 <refentrytitle><phrase>sched_setscheduler_nocheck</phrase></refentrytitle>
1530 <manvolnum>9</manvolnum>
1531 <refmiscinfo class="version">4.4.14</refmiscinfo>
1532</refmeta>
1533<refnamediv>
1534 <refname>sched_setscheduler_nocheck</refname>
1535 <refpurpose>
1536     change the scheduling policy and/or RT priority of a thread from kernelspace.
1537 </refpurpose>
1538</refnamediv>
1539<refsynopsisdiv>
1540 <title>Synopsis</title>
1541  <funcsynopsis><funcprototype>
1542   <funcdef>int <function>sched_setscheduler_nocheck </function></funcdef>
1543   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1544   <paramdef>int <parameter>policy</parameter></paramdef>
1545   <paramdef>const struct sched_param * <parameter>param</parameter></paramdef>
1546  </funcprototype></funcsynopsis>
1547</refsynopsisdiv>
1548<refsect1>
1549 <title>Arguments</title>
1550 <variablelist>
1551  <varlistentry>
1552   <term><parameter>p</parameter></term>
1553   <listitem>
1554    <para>
1555     the task in question.
1556    </para>
1557   </listitem>
1558  </varlistentry>
1559  <varlistentry>
1560   <term><parameter>policy</parameter></term>
1561   <listitem>
1562    <para>
1563     new policy.
1564    </para>
1565   </listitem>
1566  </varlistentry>
1567  <varlistentry>
1568   <term><parameter>param</parameter></term>
1569   <listitem>
1570    <para>
1571     structure containing the new RT priority.
1572    </para>
1573   </listitem>
1574  </varlistentry>
1575 </variablelist>
1576</refsect1>
1577<refsect1>
1578<title>Description</title>
1579<para>
1580   Just like sched_setscheduler, only don't bother checking if the
1581   current context has permission.  For example, this is needed in
1582   <function>stop_machine</function>: we create temporary high priority worker threads,
1583   but our caller might not have that capability.
1584</para>
1585</refsect1>
1586<refsect1>
1587<title>Return</title>
1588<para>
1589   0 on success. An error code otherwise.
1590</para>
1591</refsect1>
1592</refentry>
1593
1594<refentry id="API-yield">
1595<refentryinfo>
1596 <title>LINUX</title>
1597 <productname>Kernel Hackers Manual</productname>
1598 <date>July 2017</date>
1599</refentryinfo>
1600<refmeta>
1601 <refentrytitle><phrase>yield</phrase></refentrytitle>
1602 <manvolnum>9</manvolnum>
1603 <refmiscinfo class="version">4.4.14</refmiscinfo>
1604</refmeta>
1605<refnamediv>
1606 <refname>yield</refname>
1607 <refpurpose>
1608     yield the current processor to other threads.
1609 </refpurpose>
1610</refnamediv>
1611<refsynopsisdiv>
1612 <title>Synopsis</title>
1613  <funcsynopsis><funcprototype>
1614   <funcdef>void __sched <function>yield </function></funcdef>
1615   <paramdef> <parameter>void</parameter></paramdef>
1616  </funcprototype></funcsynopsis>
1617</refsynopsisdiv>
1618<refsect1>
1619 <title>Arguments</title>
1620 <variablelist>
1621  <varlistentry>
1622   <term><parameter>void</parameter></term>
1623   <listitem>
1624    <para>
1625     no arguments
1626    </para>
1627   </listitem>
1628  </varlistentry>
1629 </variablelist>
1630</refsect1>
1631<refsect1>
1632<title>Description</title>
1633<para>
1634   </para><para>
1635
1636   Do not ever use this function, there's a 99% chance you're doing it wrong.
1637   </para><para>
1638
1639   The scheduler is at all times free to pick the calling task as the most
1640   eligible task to run, if removing the <function><link linkend="API-yield">yield</link></function> call from your code breaks
1641   it, its already broken.
1642</para>
1643</refsect1>
1644<refsect1>
1645<title>Typical broken usage is</title>
1646<para>
1647   </para><para>
1648
1649   while (!event)
1650   <function><link linkend="API-yield">yield</link></function>;
1651   </para><para>
1652
1653   where one assumes that <function><link linkend="API-yield">yield</link></function> will let 'the other' process run that will
1654   make event true. If the current task is a SCHED_FIFO task that will never
1655   happen. Never use <function><link linkend="API-yield">yield</link></function> as a progress guarantee!!
1656   </para><para>
1657
1658   If you want to use <function><link linkend="API-yield">yield</link></function> to wait for something, use <function><link linkend="API-wait-event">wait_event</link></function>.
1659   If you want to use <function><link linkend="API-yield">yield</link></function> to be 'nice' for others, use <function>cond_resched</function>.
1660   If you still want to use <function><link linkend="API-yield">yield</link></function>, do not!
1661</para>
1662</refsect1>
1663</refentry>
1664
1665<refentry id="API-yield-to">
1666<refentryinfo>
1667 <title>LINUX</title>
1668 <productname>Kernel Hackers Manual</productname>
1669 <date>July 2017</date>
1670</refentryinfo>
1671<refmeta>
1672 <refentrytitle><phrase>yield_to</phrase></refentrytitle>
1673 <manvolnum>9</manvolnum>
1674 <refmiscinfo class="version">4.4.14</refmiscinfo>
1675</refmeta>
1676<refnamediv>
1677 <refname>yield_to</refname>
1678 <refpurpose>
1679     yield the current processor to another thread in your thread group, or accelerate that thread toward the processor it's on.
1680 </refpurpose>
1681</refnamediv>
1682<refsynopsisdiv>
1683 <title>Synopsis</title>
1684  <funcsynopsis><funcprototype>
1685   <funcdef>int __sched <function>yield_to </function></funcdef>
1686   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1687   <paramdef>bool <parameter>preempt</parameter></paramdef>
1688  </funcprototype></funcsynopsis>
1689</refsynopsisdiv>
1690<refsect1>
1691 <title>Arguments</title>
1692 <variablelist>
1693  <varlistentry>
1694   <term><parameter>p</parameter></term>
1695   <listitem>
1696    <para>
1697     target task
1698    </para>
1699   </listitem>
1700  </varlistentry>
1701  <varlistentry>
1702   <term><parameter>preempt</parameter></term>
1703   <listitem>
1704    <para>
1705     whether task preemption is allowed or not
1706    </para>
1707   </listitem>
1708  </varlistentry>
1709 </variablelist>
1710</refsect1>
1711<refsect1>
1712<title>Description</title>
1713<para>
1714   It's the caller's job to ensure that the target task struct
1715   can't go away on us before we can do any checks.
1716</para>
1717</refsect1>
1718<refsect1>
1719<title>Return</title>
1720<para>
1721   true (&gt;0) if we indeed boosted the target task.
1722   false (0) if we failed to boost the target.
1723   -ESRCH if there's no task to yield to.
1724</para>
1725</refsect1>
1726</refentry>
1727
1728<!-- kernel/sched/cpupri.c -->
1729<refentry id="API-cpupri-find">
1730<refentryinfo>
1731 <title>LINUX</title>
1732 <productname>Kernel Hackers Manual</productname>
1733 <date>July 2017</date>
1734</refentryinfo>
1735<refmeta>
1736 <refentrytitle><phrase>cpupri_find</phrase></refentrytitle>
1737 <manvolnum>9</manvolnum>
1738 <refmiscinfo class="version">4.4.14</refmiscinfo>
1739</refmeta>
1740<refnamediv>
1741 <refname>cpupri_find</refname>
1742 <refpurpose>
1743  find the best (lowest-pri) CPU in the system
1744 </refpurpose>
1745</refnamediv>
1746<refsynopsisdiv>
1747 <title>Synopsis</title>
1748  <funcsynopsis><funcprototype>
1749   <funcdef>int <function>cpupri_find </function></funcdef>
1750   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1751   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
1752   <paramdef>struct cpumask * <parameter>lowest_mask</parameter></paramdef>
1753  </funcprototype></funcsynopsis>
1754</refsynopsisdiv>
1755<refsect1>
1756 <title>Arguments</title>
1757 <variablelist>
1758  <varlistentry>
1759   <term><parameter>cp</parameter></term>
1760   <listitem>
1761    <para>
1762     The cpupri context
1763    </para>
1764   </listitem>
1765  </varlistentry>
1766  <varlistentry>
1767   <term><parameter>p</parameter></term>
1768   <listitem>
1769    <para>
1770     The task
1771    </para>
1772   </listitem>
1773  </varlistentry>
1774  <varlistentry>
1775   <term><parameter>lowest_mask</parameter></term>
1776   <listitem>
1777    <para>
1778     A mask to fill in with selected CPUs (or NULL)
1779    </para>
1780   </listitem>
1781  </varlistentry>
1782 </variablelist>
1783</refsect1>
1784<refsect1>
1785<title>Note</title>
1786<para>
1787   This function returns the recommended CPUs as calculated during the
1788   current invocation.  By the time the call returns, the CPUs may have in
1789   fact changed priorities any number of times.  While not ideal, it is not
1790   an issue of correctness since the normal rebalancer logic will correct
1791   any discrepancies created by racing against the uncertainty of the current
1792   priority configuration.
1793</para>
1794</refsect1>
1795<refsect1>
1796<title>Return</title>
1797<para>
1798   (int)bool - CPUs were found
1799</para>
1800</refsect1>
1801</refentry>
1802
1803<refentry id="API-cpupri-set">
1804<refentryinfo>
1805 <title>LINUX</title>
1806 <productname>Kernel Hackers Manual</productname>
1807 <date>July 2017</date>
1808</refentryinfo>
1809<refmeta>
1810 <refentrytitle><phrase>cpupri_set</phrase></refentrytitle>
1811 <manvolnum>9</manvolnum>
1812 <refmiscinfo class="version">4.4.14</refmiscinfo>
1813</refmeta>
1814<refnamediv>
1815 <refname>cpupri_set</refname>
1816 <refpurpose>
1817     update the cpu priority setting
1818 </refpurpose>
1819</refnamediv>
1820<refsynopsisdiv>
1821 <title>Synopsis</title>
1822  <funcsynopsis><funcprototype>
1823   <funcdef>void <function>cpupri_set </function></funcdef>
1824   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1825   <paramdef>int <parameter>cpu</parameter></paramdef>
1826   <paramdef>int <parameter>newpri</parameter></paramdef>
1827  </funcprototype></funcsynopsis>
1828</refsynopsisdiv>
1829<refsect1>
1830 <title>Arguments</title>
1831 <variablelist>
1832  <varlistentry>
1833   <term><parameter>cp</parameter></term>
1834   <listitem>
1835    <para>
1836     The cpupri context
1837    </para>
1838   </listitem>
1839  </varlistentry>
1840  <varlistentry>
1841   <term><parameter>cpu</parameter></term>
1842   <listitem>
1843    <para>
1844     The target cpu
1845    </para>
1846   </listitem>
1847  </varlistentry>
1848  <varlistentry>
1849   <term><parameter>newpri</parameter></term>
1850   <listitem>
1851    <para>
1852     The priority (INVALID-RT99) to assign to this CPU
1853    </para>
1854   </listitem>
1855  </varlistentry>
1856 </variablelist>
1857</refsect1>
1858<refsect1>
1859<title>Note</title>
1860<para>
1861   Assumes cpu_rq(cpu)-&gt;lock is locked
1862</para>
1863</refsect1>
1864<refsect1>
1865<title>Returns</title>
1866<para>
1867   (void)
1868</para>
1869</refsect1>
1870</refentry>
1871
1872<refentry id="API-cpupri-init">
1873<refentryinfo>
1874 <title>LINUX</title>
1875 <productname>Kernel Hackers Manual</productname>
1876 <date>July 2017</date>
1877</refentryinfo>
1878<refmeta>
1879 <refentrytitle><phrase>cpupri_init</phrase></refentrytitle>
1880 <manvolnum>9</manvolnum>
1881 <refmiscinfo class="version">4.4.14</refmiscinfo>
1882</refmeta>
1883<refnamediv>
1884 <refname>cpupri_init</refname>
1885 <refpurpose>
1886     initialize the cpupri structure
1887 </refpurpose>
1888</refnamediv>
1889<refsynopsisdiv>
1890 <title>Synopsis</title>
1891  <funcsynopsis><funcprototype>
1892   <funcdef>int <function>cpupri_init </function></funcdef>
1893   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1894  </funcprototype></funcsynopsis>
1895</refsynopsisdiv>
1896<refsect1>
1897 <title>Arguments</title>
1898 <variablelist>
1899  <varlistentry>
1900   <term><parameter>cp</parameter></term>
1901   <listitem>
1902    <para>
1903     The cpupri context
1904    </para>
1905   </listitem>
1906  </varlistentry>
1907 </variablelist>
1908</refsect1>
1909<refsect1>
1910<title>Return</title>
1911<para>
1912   -ENOMEM on memory allocation failure.
1913</para>
1914</refsect1>
1915</refentry>
1916
1917<refentry id="API-cpupri-cleanup">
1918<refentryinfo>
1919 <title>LINUX</title>
1920 <productname>Kernel Hackers Manual</productname>
1921 <date>July 2017</date>
1922</refentryinfo>
1923<refmeta>
1924 <refentrytitle><phrase>cpupri_cleanup</phrase></refentrytitle>
1925 <manvolnum>9</manvolnum>
1926 <refmiscinfo class="version">4.4.14</refmiscinfo>
1927</refmeta>
1928<refnamediv>
1929 <refname>cpupri_cleanup</refname>
1930 <refpurpose>
1931     clean up the cpupri structure
1932 </refpurpose>
1933</refnamediv>
1934<refsynopsisdiv>
1935 <title>Synopsis</title>
1936  <funcsynopsis><funcprototype>
1937   <funcdef>void <function>cpupri_cleanup </function></funcdef>
1938   <paramdef>struct cpupri * <parameter>cp</parameter></paramdef>
1939  </funcprototype></funcsynopsis>
1940</refsynopsisdiv>
1941<refsect1>
1942 <title>Arguments</title>
1943 <variablelist>
1944  <varlistentry>
1945   <term><parameter>cp</parameter></term>
1946   <listitem>
1947    <para>
1948     The cpupri context
1949    </para>
1950   </listitem>
1951  </varlistentry>
1952 </variablelist>
1953</refsect1>
1954</refentry>
1955
1956<!-- kernel/sched/fair.c -->
1957<refentry id="API-get-sd-load-idx">
1958<refentryinfo>
1959 <title>LINUX</title>
1960 <productname>Kernel Hackers Manual</productname>
1961 <date>July 2017</date>
1962</refentryinfo>
1963<refmeta>
1964 <refentrytitle><phrase>get_sd_load_idx</phrase></refentrytitle>
1965 <manvolnum>9</manvolnum>
1966 <refmiscinfo class="version">4.4.14</refmiscinfo>
1967</refmeta>
1968<refnamediv>
1969 <refname>get_sd_load_idx</refname>
1970 <refpurpose>
1971  Obtain the load index for a given sched domain.
1972 </refpurpose>
1973</refnamediv>
1974<refsynopsisdiv>
1975 <title>Synopsis</title>
1976  <funcsynopsis><funcprototype>
1977   <funcdef>int <function>get_sd_load_idx </function></funcdef>
1978   <paramdef>struct sched_domain * <parameter>sd</parameter></paramdef>
1979   <paramdef>enum cpu_idle_type <parameter>idle</parameter></paramdef>
1980  </funcprototype></funcsynopsis>
1981</refsynopsisdiv>
1982<refsect1>
1983 <title>Arguments</title>
1984 <variablelist>
1985  <varlistentry>
1986   <term><parameter>sd</parameter></term>
1987   <listitem>
1988    <para>
1989     The sched_domain whose load_idx is to be obtained.
1990    </para>
1991   </listitem>
1992  </varlistentry>
1993  <varlistentry>
1994   <term><parameter>idle</parameter></term>
1995   <listitem>
1996    <para>
1997     The idle status of the CPU for whose sd load_idx is obtained.
1998    </para>
1999   </listitem>
2000  </varlistentry>
2001 </variablelist>
2002</refsect1>
2003<refsect1>
2004<title>Return</title>
2005<para>
2006   The load index.
2007</para>
2008</refsect1>
2009</refentry>
2010
2011<refentry id="API-update-sg-lb-stats">
2012<refentryinfo>
2013 <title>LINUX</title>
2014 <productname>Kernel Hackers Manual</productname>
2015 <date>July 2017</date>
2016</refentryinfo>
2017<refmeta>
2018 <refentrytitle><phrase>update_sg_lb_stats</phrase></refentrytitle>
2019 <manvolnum>9</manvolnum>
2020 <refmiscinfo class="version">4.4.14</refmiscinfo>
2021</refmeta>
2022<refnamediv>
2023 <refname>update_sg_lb_stats</refname>
2024 <refpurpose>
2025     Update sched_group's statistics for load balancing.
2026 </refpurpose>
2027</refnamediv>
2028<refsynopsisdiv>
2029 <title>Synopsis</title>
2030  <funcsynopsis><funcprototype>
2031   <funcdef>void <function>update_sg_lb_stats </function></funcdef>
2032   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2033   <paramdef>struct sched_group * <parameter>group</parameter></paramdef>
2034   <paramdef>int <parameter>load_idx</parameter></paramdef>
2035   <paramdef>int <parameter>local_group</parameter></paramdef>
2036   <paramdef>struct sg_lb_stats * <parameter>sgs</parameter></paramdef>
2037   <paramdef>bool * <parameter>overload</parameter></paramdef>
2038  </funcprototype></funcsynopsis>
2039</refsynopsisdiv>
2040<refsect1>
2041 <title>Arguments</title>
2042 <variablelist>
2043  <varlistentry>
2044   <term><parameter>env</parameter></term>
2045   <listitem>
2046    <para>
2047     The load balancing environment.
2048    </para>
2049   </listitem>
2050  </varlistentry>
2051  <varlistentry>
2052   <term><parameter>group</parameter></term>
2053   <listitem>
2054    <para>
2055     sched_group whose statistics are to be updated.
2056    </para>
2057   </listitem>
2058  </varlistentry>
2059  <varlistentry>
2060   <term><parameter>load_idx</parameter></term>
2061   <listitem>
2062    <para>
2063     Load index of sched_domain of this_cpu for load calc.
2064    </para>
2065   </listitem>
2066  </varlistentry>
2067  <varlistentry>
2068   <term><parameter>local_group</parameter></term>
2069   <listitem>
2070    <para>
2071     Does group contain this_cpu.
2072    </para>
2073   </listitem>
2074  </varlistentry>
2075  <varlistentry>
2076   <term><parameter>sgs</parameter></term>
2077   <listitem>
2078    <para>
2079     variable to hold the statistics for this group.
2080    </para>
2081   </listitem>
2082  </varlistentry>
2083  <varlistentry>
2084   <term><parameter>overload</parameter></term>
2085   <listitem>
2086    <para>
2087     Indicate more than one runnable task for any CPU.
2088    </para>
2089   </listitem>
2090  </varlistentry>
2091 </variablelist>
2092</refsect1>
2093</refentry>
2094
2095<refentry id="API-update-sd-pick-busiest">
2096<refentryinfo>
2097 <title>LINUX</title>
2098 <productname>Kernel Hackers Manual</productname>
2099 <date>July 2017</date>
2100</refentryinfo>
2101<refmeta>
2102 <refentrytitle><phrase>update_sd_pick_busiest</phrase></refentrytitle>
2103 <manvolnum>9</manvolnum>
2104 <refmiscinfo class="version">4.4.14</refmiscinfo>
2105</refmeta>
2106<refnamediv>
2107 <refname>update_sd_pick_busiest</refname>
2108 <refpurpose>
2109     return 1 on busiest group
2110 </refpurpose>
2111</refnamediv>
2112<refsynopsisdiv>
2113 <title>Synopsis</title>
2114  <funcsynopsis><funcprototype>
2115   <funcdef>bool <function>update_sd_pick_busiest </function></funcdef>
2116   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2117   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2118   <paramdef>struct sched_group * <parameter>sg</parameter></paramdef>
2119   <paramdef>struct sg_lb_stats * <parameter>sgs</parameter></paramdef>
2120  </funcprototype></funcsynopsis>
2121</refsynopsisdiv>
2122<refsect1>
2123 <title>Arguments</title>
2124 <variablelist>
2125  <varlistentry>
2126   <term><parameter>env</parameter></term>
2127   <listitem>
2128    <para>
2129     The load balancing environment.
2130    </para>
2131   </listitem>
2132  </varlistentry>
2133  <varlistentry>
2134   <term><parameter>sds</parameter></term>
2135   <listitem>
2136    <para>
2137     sched_domain statistics
2138    </para>
2139   </listitem>
2140  </varlistentry>
2141  <varlistentry>
2142   <term><parameter>sg</parameter></term>
2143   <listitem>
2144    <para>
2145     sched_group candidate to be checked for being the busiest
2146    </para>
2147   </listitem>
2148  </varlistentry>
2149  <varlistentry>
2150   <term><parameter>sgs</parameter></term>
2151   <listitem>
2152    <para>
2153     sched_group statistics
2154    </para>
2155   </listitem>
2156  </varlistentry>
2157 </variablelist>
2158</refsect1>
2159<refsect1>
2160<title>Description</title>
2161<para>
2162   Determine if <parameter>sg</parameter> is a busier group than the previously selected
2163   busiest group.
2164</para>
2165</refsect1>
2166<refsect1>
2167<title>Return</title>
2168<para>
2169   <constant>true</constant> if <parameter>sg</parameter> is a busier group than the previously selected
2170   busiest group. <constant>false</constant> otherwise.
2171</para>
2172</refsect1>
2173</refentry>
2174
2175<refentry id="API-update-sd-lb-stats">
2176<refentryinfo>
2177 <title>LINUX</title>
2178 <productname>Kernel Hackers Manual</productname>
2179 <date>July 2017</date>
2180</refentryinfo>
2181<refmeta>
2182 <refentrytitle><phrase>update_sd_lb_stats</phrase></refentrytitle>
2183 <manvolnum>9</manvolnum>
2184 <refmiscinfo class="version">4.4.14</refmiscinfo>
2185</refmeta>
2186<refnamediv>
2187 <refname>update_sd_lb_stats</refname>
2188 <refpurpose>
2189     Update sched_domain's statistics for load balancing.
2190 </refpurpose>
2191</refnamediv>
2192<refsynopsisdiv>
2193 <title>Synopsis</title>
2194  <funcsynopsis><funcprototype>
2195   <funcdef>void <function>update_sd_lb_stats </function></funcdef>
2196   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2197   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2198  </funcprototype></funcsynopsis>
2199</refsynopsisdiv>
2200<refsect1>
2201 <title>Arguments</title>
2202 <variablelist>
2203  <varlistentry>
2204   <term><parameter>env</parameter></term>
2205   <listitem>
2206    <para>
2207     The load balancing environment.
2208    </para>
2209   </listitem>
2210  </varlistentry>
2211  <varlistentry>
2212   <term><parameter>sds</parameter></term>
2213   <listitem>
2214    <para>
2215     variable to hold the statistics for this sched_domain.
2216    </para>
2217   </listitem>
2218  </varlistentry>
2219 </variablelist>
2220</refsect1>
2221</refentry>
2222
2223<refentry id="API-check-asym-packing">
2224<refentryinfo>
2225 <title>LINUX</title>
2226 <productname>Kernel Hackers Manual</productname>
2227 <date>July 2017</date>
2228</refentryinfo>
2229<refmeta>
2230 <refentrytitle><phrase>check_asym_packing</phrase></refentrytitle>
2231 <manvolnum>9</manvolnum>
2232 <refmiscinfo class="version">4.4.14</refmiscinfo>
2233</refmeta>
2234<refnamediv>
2235 <refname>check_asym_packing</refname>
2236 <refpurpose>
2237     Check to see if the group is packed into the sched doman.
2238 </refpurpose>
2239</refnamediv>
2240<refsynopsisdiv>
2241 <title>Synopsis</title>
2242  <funcsynopsis><funcprototype>
2243   <funcdef>int <function>check_asym_packing </function></funcdef>
2244   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2245   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2246  </funcprototype></funcsynopsis>
2247</refsynopsisdiv>
2248<refsect1>
2249 <title>Arguments</title>
2250 <variablelist>
2251  <varlistentry>
2252   <term><parameter>env</parameter></term>
2253   <listitem>
2254    <para>
2255     The load balancing environment.
2256    </para>
2257   </listitem>
2258  </varlistentry>
2259  <varlistentry>
2260   <term><parameter>sds</parameter></term>
2261   <listitem>
2262    <para>
2263     Statistics of the sched_domain which is to be packed
2264    </para>
2265   </listitem>
2266  </varlistentry>
2267 </variablelist>
2268</refsect1>
2269<refsect1>
2270<title>Description</title>
2271<para>
2272   </para><para>
2273
2274   This is primarily intended to used at the sibling level.  Some
2275   cores like POWER7 prefer to use lower numbered SMT threads.  In the
2276   case of POWER7, it can move to lower SMT modes only when higher
2277   threads are idle.  When in lower SMT modes, the threads will
2278   perform better since they share less core resources.  Hence when we
2279   have idle threads, we want them to be the higher ones.
2280   </para><para>
2281
2282   This packing function is run on idle threads.  It checks to see if
2283   the busiest CPU in this domain (core in the P7 case) has a higher
2284   CPU number than the packing function is being run on.  Here we are
2285   assuming lower CPU number will be equivalent to lower a SMT thread
2286   number.
2287</para>
2288</refsect1>
2289<refsect1>
2290<title>Return</title>
2291<para>
2292   1 when packing is required and a task should be moved to
2293   this CPU.  The amount of the imbalance is returned in *imbalance.
2294</para>
2295</refsect1>
2296</refentry>
2297
2298<refentry id="API-fix-small-imbalance">
2299<refentryinfo>
2300 <title>LINUX</title>
2301 <productname>Kernel Hackers Manual</productname>
2302 <date>July 2017</date>
2303</refentryinfo>
2304<refmeta>
2305 <refentrytitle><phrase>fix_small_imbalance</phrase></refentrytitle>
2306 <manvolnum>9</manvolnum>
2307 <refmiscinfo class="version">4.4.14</refmiscinfo>
2308</refmeta>
2309<refnamediv>
2310 <refname>fix_small_imbalance</refname>
2311 <refpurpose>
2312     Calculate the minor imbalance that exists amongst the groups of a sched_domain, during load balancing.
2313 </refpurpose>
2314</refnamediv>
2315<refsynopsisdiv>
2316 <title>Synopsis</title>
2317  <funcsynopsis><funcprototype>
2318   <funcdef>void <function>fix_small_imbalance </function></funcdef>
2319   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2320   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2321  </funcprototype></funcsynopsis>
2322</refsynopsisdiv>
2323<refsect1>
2324 <title>Arguments</title>
2325 <variablelist>
2326  <varlistentry>
2327   <term><parameter>env</parameter></term>
2328   <listitem>
2329    <para>
2330     The load balancing environment.
2331    </para>
2332   </listitem>
2333  </varlistentry>
2334  <varlistentry>
2335   <term><parameter>sds</parameter></term>
2336   <listitem>
2337    <para>
2338     Statistics of the sched_domain whose imbalance is to be calculated.
2339    </para>
2340   </listitem>
2341  </varlistentry>
2342 </variablelist>
2343</refsect1>
2344</refentry>
2345
2346<refentry id="API-calculate-imbalance">
2347<refentryinfo>
2348 <title>LINUX</title>
2349 <productname>Kernel Hackers Manual</productname>
2350 <date>July 2017</date>
2351</refentryinfo>
2352<refmeta>
2353 <refentrytitle><phrase>calculate_imbalance</phrase></refentrytitle>
2354 <manvolnum>9</manvolnum>
2355 <refmiscinfo class="version">4.4.14</refmiscinfo>
2356</refmeta>
2357<refnamediv>
2358 <refname>calculate_imbalance</refname>
2359 <refpurpose>
2360     Calculate the amount of imbalance present within the groups of a given sched_domain during load balance.
2361 </refpurpose>
2362</refnamediv>
2363<refsynopsisdiv>
2364 <title>Synopsis</title>
2365  <funcsynopsis><funcprototype>
2366   <funcdef>void <function>calculate_imbalance </function></funcdef>
2367   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2368   <paramdef>struct sd_lb_stats * <parameter>sds</parameter></paramdef>
2369  </funcprototype></funcsynopsis>
2370</refsynopsisdiv>
2371<refsect1>
2372 <title>Arguments</title>
2373 <variablelist>
2374  <varlistentry>
2375   <term><parameter>env</parameter></term>
2376   <listitem>
2377    <para>
2378     load balance environment
2379    </para>
2380   </listitem>
2381  </varlistentry>
2382  <varlistentry>
2383   <term><parameter>sds</parameter></term>
2384   <listitem>
2385    <para>
2386     statistics of the sched_domain whose imbalance is to be calculated.
2387    </para>
2388   </listitem>
2389  </varlistentry>
2390 </variablelist>
2391</refsect1>
2392</refentry>
2393
2394<refentry id="API-find-busiest-group">
2395<refentryinfo>
2396 <title>LINUX</title>
2397 <productname>Kernel Hackers Manual</productname>
2398 <date>July 2017</date>
2399</refentryinfo>
2400<refmeta>
2401 <refentrytitle><phrase>find_busiest_group</phrase></refentrytitle>
2402 <manvolnum>9</manvolnum>
2403 <refmiscinfo class="version">4.4.14</refmiscinfo>
2404</refmeta>
2405<refnamediv>
2406 <refname>find_busiest_group</refname>
2407 <refpurpose>
2408     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.
2409 </refpurpose>
2410</refnamediv>
2411<refsynopsisdiv>
2412 <title>Synopsis</title>
2413  <funcsynopsis><funcprototype>
2414   <funcdef>struct sched_group * <function>find_busiest_group </function></funcdef>
2415   <paramdef>struct lb_env * <parameter>env</parameter></paramdef>
2416  </funcprototype></funcsynopsis>
2417</refsynopsisdiv>
2418<refsect1>
2419 <title>Arguments</title>
2420 <variablelist>
2421  <varlistentry>
2422   <term><parameter>env</parameter></term>
2423   <listitem>
2424    <para>
2425     The load balancing environment.
2426    </para>
2427   </listitem>
2428  </varlistentry>
2429 </variablelist>
2430</refsect1>
2431<refsect1>
2432<title>Description</title>
2433<para>
2434   </para><para>
2435
2436   Also calculates the amount of weighted load which should be moved
2437   to restore balance.
2438</para>
2439</refsect1>
2440<refsect1>
2441<title>Return</title>
2442<para>
2443   - The busiest group if imbalance exists.
2444   - If no imbalance and user has opted for power-savings balance,
2445   return the least loaded group whose CPUs can be
2446   put to idle by rebalancing its tasks onto our group.
2447</para>
2448</refsect1>
2449</refentry>
2450
2451<!-- include/linux/completion.h -->
2452<refentry id="API-DECLARE-COMPLETION">
2453<refentryinfo>
2454 <title>LINUX</title>
2455 <productname>Kernel Hackers Manual</productname>
2456 <date>July 2017</date>
2457</refentryinfo>
2458<refmeta>
2459 <refentrytitle><phrase>DECLARE_COMPLETION</phrase></refentrytitle>
2460 <manvolnum>9</manvolnum>
2461 <refmiscinfo class="version">4.4.14</refmiscinfo>
2462</refmeta>
2463<refnamediv>
2464 <refname>DECLARE_COMPLETION</refname>
2465 <refpurpose>
2466  declare and initialize a completion structure
2467 </refpurpose>
2468</refnamediv>
2469<refsynopsisdiv>
2470 <title>Synopsis</title>
2471  <funcsynopsis><funcprototype>
2472   <funcdef> <function>DECLARE_COMPLETION </function></funcdef>
2473   <paramdef> <parameter>work</parameter></paramdef>
2474  </funcprototype></funcsynopsis>
2475</refsynopsisdiv>
2476<refsect1>
2477 <title>Arguments</title>
2478 <variablelist>
2479  <varlistentry>
2480   <term><parameter>work</parameter></term>
2481   <listitem>
2482    <para>
2483     identifier for the completion structure
2484    </para>
2485   </listitem>
2486  </varlistentry>
2487 </variablelist>
2488</refsect1>
2489<refsect1>
2490<title>Description</title>
2491<para>
2492   This macro declares and initializes a completion structure. Generally used
2493   for static declarations. You should use the _ONSTACK variant for automatic
2494   variables.
2495</para>
2496</refsect1>
2497</refentry>
2498
2499<refentry id="API-DECLARE-COMPLETION-ONSTACK">
2500<refentryinfo>
2501 <title>LINUX</title>
2502 <productname>Kernel Hackers Manual</productname>
2503 <date>July 2017</date>
2504</refentryinfo>
2505<refmeta>
2506 <refentrytitle><phrase>DECLARE_COMPLETION_ONSTACK</phrase></refentrytitle>
2507 <manvolnum>9</manvolnum>
2508 <refmiscinfo class="version">4.4.14</refmiscinfo>
2509</refmeta>
2510<refnamediv>
2511 <refname>DECLARE_COMPLETION_ONSTACK</refname>
2512 <refpurpose>
2513     declare and initialize a completion structure
2514 </refpurpose>
2515</refnamediv>
2516<refsynopsisdiv>
2517 <title>Synopsis</title>
2518  <funcsynopsis><funcprototype>
2519   <funcdef> <function>DECLARE_COMPLETION_ONSTACK </function></funcdef>
2520   <paramdef> <parameter>work</parameter></paramdef>
2521  </funcprototype></funcsynopsis>
2522</refsynopsisdiv>
2523<refsect1>
2524 <title>Arguments</title>
2525 <variablelist>
2526  <varlistentry>
2527   <term><parameter>work</parameter></term>
2528   <listitem>
2529    <para>
2530     identifier for the completion structure
2531    </para>
2532   </listitem>
2533  </varlistentry>
2534 </variablelist>
2535</refsect1>
2536<refsect1>
2537<title>Description</title>
2538<para>
2539   This macro declares and initializes a completion structure on the kernel
2540   stack.
2541</para>
2542</refsect1>
2543</refentry>
2544
2545<refentry id="API-init-completion">
2546<refentryinfo>
2547 <title>LINUX</title>
2548 <productname>Kernel Hackers Manual</productname>
2549 <date>July 2017</date>
2550</refentryinfo>
2551<refmeta>
2552 <refentrytitle><phrase>init_completion</phrase></refentrytitle>
2553 <manvolnum>9</manvolnum>
2554 <refmiscinfo class="version">4.4.14</refmiscinfo>
2555</refmeta>
2556<refnamediv>
2557 <refname>init_completion</refname>
2558 <refpurpose>
2559     Initialize a dynamically allocated completion
2560 </refpurpose>
2561</refnamediv>
2562<refsynopsisdiv>
2563 <title>Synopsis</title>
2564  <funcsynopsis><funcprototype>
2565   <funcdef>void <function>init_completion </function></funcdef>
2566   <paramdef>struct completion * <parameter>x</parameter></paramdef>
2567  </funcprototype></funcsynopsis>
2568</refsynopsisdiv>
2569<refsect1>
2570 <title>Arguments</title>
2571 <variablelist>
2572  <varlistentry>
2573   <term><parameter>x</parameter></term>
2574   <listitem>
2575    <para>
2576     pointer to completion structure that is to be initialized
2577    </para>
2578   </listitem>
2579  </varlistentry>
2580 </variablelist>
2581</refsect1>
2582<refsect1>
2583<title>Description</title>
2584<para>
2585   This inline function will initialize a dynamically created completion
2586   structure.
2587</para>
2588</refsect1>
2589</refentry>
2590
2591<refentry id="API-reinit-completion">
2592<refentryinfo>
2593 <title>LINUX</title>
2594 <productname>Kernel Hackers Manual</productname>
2595 <date>July 2017</date>
2596</refentryinfo>
2597<refmeta>
2598 <refentrytitle><phrase>reinit_completion</phrase></refentrytitle>
2599 <manvolnum>9</manvolnum>
2600 <refmiscinfo class="version">4.4.14</refmiscinfo>
2601</refmeta>
2602<refnamediv>
2603 <refname>reinit_completion</refname>
2604 <refpurpose>
2605     reinitialize a completion structure
2606 </refpurpose>
2607</refnamediv>
2608<refsynopsisdiv>
2609 <title>Synopsis</title>
2610  <funcsynopsis><funcprototype>
2611   <funcdef>void <function>reinit_completion </function></funcdef>
2612   <paramdef>struct completion * <parameter>x</parameter></paramdef>
2613  </funcprototype></funcsynopsis>
2614</refsynopsisdiv>
2615<refsect1>
2616 <title>Arguments</title>
2617 <variablelist>
2618  <varlistentry>
2619   <term><parameter>x</parameter></term>
2620   <listitem>
2621    <para>
2622     pointer to completion structure that is to be reinitialized
2623    </para>
2624   </listitem>
2625  </varlistentry>
2626 </variablelist>
2627</refsect1>
2628<refsect1>
2629<title>Description</title>
2630<para>
2631   This inline function should be used to reinitialize a completion structure so it can
2632   be reused. This is especially important after <function>complete_all</function> is used.
2633</para>
2634</refsect1>
2635</refentry>
2636
2637<!-- kernel/time/timer.c -->
2638<refentry id="API---round-jiffies">
2639<refentryinfo>
2640 <title>LINUX</title>
2641 <productname>Kernel Hackers Manual</productname>
2642 <date>July 2017</date>
2643</refentryinfo>
2644<refmeta>
2645 <refentrytitle><phrase>__round_jiffies</phrase></refentrytitle>
2646 <manvolnum>9</manvolnum>
2647 <refmiscinfo class="version">4.4.14</refmiscinfo>
2648</refmeta>
2649<refnamediv>
2650 <refname>__round_jiffies</refname>
2651 <refpurpose>
2652  function to round jiffies to a full second
2653 </refpurpose>
2654</refnamediv>
2655<refsynopsisdiv>
2656 <title>Synopsis</title>
2657  <funcsynopsis><funcprototype>
2658   <funcdef>unsigned long <function>__round_jiffies </function></funcdef>
2659   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2660   <paramdef>int <parameter>cpu</parameter></paramdef>
2661  </funcprototype></funcsynopsis>
2662</refsynopsisdiv>
2663<refsect1>
2664 <title>Arguments</title>
2665 <variablelist>
2666  <varlistentry>
2667   <term><parameter>j</parameter></term>
2668   <listitem>
2669    <para>
2670     the time in (absolute) jiffies that should be rounded
2671    </para>
2672   </listitem>
2673  </varlistentry>
2674  <varlistentry>
2675   <term><parameter>cpu</parameter></term>
2676   <listitem>
2677    <para>
2678     the processor number on which the timeout will happen
2679    </para>
2680   </listitem>
2681  </varlistentry>
2682 </variablelist>
2683</refsect1>
2684<refsect1>
2685<title>Description</title>
2686<para>
2687   <function><link linkend="API---round-jiffies">__round_jiffies</link></function> rounds an absolute time in the future (in jiffies)
2688   up or down to (approximately) full seconds. This is useful for timers
2689   for which the exact time they fire does not matter too much, as long as
2690   they fire approximately every X seconds.
2691   </para><para>
2692
2693   By rounding these timers to whole seconds, all such timers will fire
2694   at the same time, rather than at various times spread out. The goal
2695   of this is to have the CPU wake up less, which saves power.
2696   </para><para>
2697
2698   The exact rounding is skewed for each processor to avoid all
2699   processors firing at the exact same time, which could lead
2700   to lock contention or spurious cache line bouncing.
2701   </para><para>
2702
2703   The return value is the rounded version of the <parameter>j</parameter> parameter.
2704</para>
2705</refsect1>
2706</refentry>
2707
2708<refentry id="API---round-jiffies-relative">
2709<refentryinfo>
2710 <title>LINUX</title>
2711 <productname>Kernel Hackers Manual</productname>
2712 <date>July 2017</date>
2713</refentryinfo>
2714<refmeta>
2715 <refentrytitle><phrase>__round_jiffies_relative</phrase></refentrytitle>
2716 <manvolnum>9</manvolnum>
2717 <refmiscinfo class="version">4.4.14</refmiscinfo>
2718</refmeta>
2719<refnamediv>
2720 <refname>__round_jiffies_relative</refname>
2721 <refpurpose>
2722     function to round jiffies to a full second
2723 </refpurpose>
2724</refnamediv>
2725<refsynopsisdiv>
2726 <title>Synopsis</title>
2727  <funcsynopsis><funcprototype>
2728   <funcdef>unsigned long <function>__round_jiffies_relative </function></funcdef>
2729   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2730   <paramdef>int <parameter>cpu</parameter></paramdef>
2731  </funcprototype></funcsynopsis>
2732</refsynopsisdiv>
2733<refsect1>
2734 <title>Arguments</title>
2735 <variablelist>
2736  <varlistentry>
2737   <term><parameter>j</parameter></term>
2738   <listitem>
2739    <para>
2740     the time in (relative) jiffies that should be rounded
2741    </para>
2742   </listitem>
2743  </varlistentry>
2744  <varlistentry>
2745   <term><parameter>cpu</parameter></term>
2746   <listitem>
2747    <para>
2748     the processor number on which the timeout will happen
2749    </para>
2750   </listitem>
2751  </varlistentry>
2752 </variablelist>
2753</refsect1>
2754<refsect1>
2755<title>Description</title>
2756<para>
2757   <function><link linkend="API---round-jiffies-relative">__round_jiffies_relative</link></function> rounds a time delta  in the future (in jiffies)
2758   up or down to (approximately) full seconds. This is useful for timers
2759   for which the exact time they fire does not matter too much, as long as
2760   they fire approximately every X seconds.
2761   </para><para>
2762
2763   By rounding these timers to whole seconds, all such timers will fire
2764   at the same time, rather than at various times spread out. The goal
2765   of this is to have the CPU wake up less, which saves power.
2766   </para><para>
2767
2768   The exact rounding is skewed for each processor to avoid all
2769   processors firing at the exact same time, which could lead
2770   to lock contention or spurious cache line bouncing.
2771   </para><para>
2772
2773   The return value is the rounded version of the <parameter>j</parameter> parameter.
2774</para>
2775</refsect1>
2776</refentry>
2777
2778<refentry id="API-round-jiffies">
2779<refentryinfo>
2780 <title>LINUX</title>
2781 <productname>Kernel Hackers Manual</productname>
2782 <date>July 2017</date>
2783</refentryinfo>
2784<refmeta>
2785 <refentrytitle><phrase>round_jiffies</phrase></refentrytitle>
2786 <manvolnum>9</manvolnum>
2787 <refmiscinfo class="version">4.4.14</refmiscinfo>
2788</refmeta>
2789<refnamediv>
2790 <refname>round_jiffies</refname>
2791 <refpurpose>
2792     function to round jiffies to a full second
2793 </refpurpose>
2794</refnamediv>
2795<refsynopsisdiv>
2796 <title>Synopsis</title>
2797  <funcsynopsis><funcprototype>
2798   <funcdef>unsigned long <function>round_jiffies </function></funcdef>
2799   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2800  </funcprototype></funcsynopsis>
2801</refsynopsisdiv>
2802<refsect1>
2803 <title>Arguments</title>
2804 <variablelist>
2805  <varlistentry>
2806   <term><parameter>j</parameter></term>
2807   <listitem>
2808    <para>
2809     the time in (absolute) jiffies that should be rounded
2810    </para>
2811   </listitem>
2812  </varlistentry>
2813 </variablelist>
2814</refsect1>
2815<refsect1>
2816<title>Description</title>
2817<para>
2818   <function><link linkend="API-round-jiffies">round_jiffies</link></function> rounds an absolute time in the future (in jiffies)
2819   up or down to (approximately) full seconds. This is useful for timers
2820   for which the exact time they fire does not matter too much, as long as
2821   they fire approximately every X seconds.
2822   </para><para>
2823
2824   By rounding these timers to whole seconds, all such timers will fire
2825   at the same time, rather than at various times spread out. The goal
2826   of this is to have the CPU wake up less, which saves power.
2827   </para><para>
2828
2829   The return value is the rounded version of the <parameter>j</parameter> parameter.
2830</para>
2831</refsect1>
2832</refentry>
2833
2834<refentry id="API-round-jiffies-relative">
2835<refentryinfo>
2836 <title>LINUX</title>
2837 <productname>Kernel Hackers Manual</productname>
2838 <date>July 2017</date>
2839</refentryinfo>
2840<refmeta>
2841 <refentrytitle><phrase>round_jiffies_relative</phrase></refentrytitle>
2842 <manvolnum>9</manvolnum>
2843 <refmiscinfo class="version">4.4.14</refmiscinfo>
2844</refmeta>
2845<refnamediv>
2846 <refname>round_jiffies_relative</refname>
2847 <refpurpose>
2848     function to round jiffies to a full second
2849 </refpurpose>
2850</refnamediv>
2851<refsynopsisdiv>
2852 <title>Synopsis</title>
2853  <funcsynopsis><funcprototype>
2854   <funcdef>unsigned long <function>round_jiffies_relative </function></funcdef>
2855   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2856  </funcprototype></funcsynopsis>
2857</refsynopsisdiv>
2858<refsect1>
2859 <title>Arguments</title>
2860 <variablelist>
2861  <varlistentry>
2862   <term><parameter>j</parameter></term>
2863   <listitem>
2864    <para>
2865     the time in (relative) jiffies that should be rounded
2866    </para>
2867   </listitem>
2868  </varlistentry>
2869 </variablelist>
2870</refsect1>
2871<refsect1>
2872<title>Description</title>
2873<para>
2874   <function><link linkend="API-round-jiffies-relative">round_jiffies_relative</link></function> rounds a time delta  in the future (in jiffies)
2875   up or down to (approximately) full seconds. This is useful for timers
2876   for which the exact time they fire does not matter too much, as long as
2877   they fire approximately every X seconds.
2878   </para><para>
2879
2880   By rounding these timers to whole seconds, all such timers will fire
2881   at the same time, rather than at various times spread out. The goal
2882   of this is to have the CPU wake up less, which saves power.
2883   </para><para>
2884
2885   The return value is the rounded version of the <parameter>j</parameter> parameter.
2886</para>
2887</refsect1>
2888</refentry>
2889
2890<refentry id="API---round-jiffies-up">
2891<refentryinfo>
2892 <title>LINUX</title>
2893 <productname>Kernel Hackers Manual</productname>
2894 <date>July 2017</date>
2895</refentryinfo>
2896<refmeta>
2897 <refentrytitle><phrase>__round_jiffies_up</phrase></refentrytitle>
2898 <manvolnum>9</manvolnum>
2899 <refmiscinfo class="version">4.4.14</refmiscinfo>
2900</refmeta>
2901<refnamediv>
2902 <refname>__round_jiffies_up</refname>
2903 <refpurpose>
2904     function to round jiffies up to a full second
2905 </refpurpose>
2906</refnamediv>
2907<refsynopsisdiv>
2908 <title>Synopsis</title>
2909  <funcsynopsis><funcprototype>
2910   <funcdef>unsigned long <function>__round_jiffies_up </function></funcdef>
2911   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2912   <paramdef>int <parameter>cpu</parameter></paramdef>
2913  </funcprototype></funcsynopsis>
2914</refsynopsisdiv>
2915<refsect1>
2916 <title>Arguments</title>
2917 <variablelist>
2918  <varlistentry>
2919   <term><parameter>j</parameter></term>
2920   <listitem>
2921    <para>
2922     the time in (absolute) jiffies that should be rounded
2923    </para>
2924   </listitem>
2925  </varlistentry>
2926  <varlistentry>
2927   <term><parameter>cpu</parameter></term>
2928   <listitem>
2929    <para>
2930     the processor number on which the timeout will happen
2931    </para>
2932   </listitem>
2933  </varlistentry>
2934 </variablelist>
2935</refsect1>
2936<refsect1>
2937<title>Description</title>
2938<para>
2939   This is the same as <function><link linkend="API---round-jiffies">__round_jiffies</link></function> except that it will never
2940   round down.  This is useful for timeouts for which the exact time
2941   of firing does not matter too much, as long as they don't fire too
2942   early.
2943</para>
2944</refsect1>
2945</refentry>
2946
2947<refentry id="API---round-jiffies-up-relative">
2948<refentryinfo>
2949 <title>LINUX</title>
2950 <productname>Kernel Hackers Manual</productname>
2951 <date>July 2017</date>
2952</refentryinfo>
2953<refmeta>
2954 <refentrytitle><phrase>__round_jiffies_up_relative</phrase></refentrytitle>
2955 <manvolnum>9</manvolnum>
2956 <refmiscinfo class="version">4.4.14</refmiscinfo>
2957</refmeta>
2958<refnamediv>
2959 <refname>__round_jiffies_up_relative</refname>
2960 <refpurpose>
2961     function to round jiffies up to a full second
2962 </refpurpose>
2963</refnamediv>
2964<refsynopsisdiv>
2965 <title>Synopsis</title>
2966  <funcsynopsis><funcprototype>
2967   <funcdef>unsigned long <function>__round_jiffies_up_relative </function></funcdef>
2968   <paramdef>unsigned long <parameter>j</parameter></paramdef>
2969   <paramdef>int <parameter>cpu</parameter></paramdef>
2970  </funcprototype></funcsynopsis>
2971</refsynopsisdiv>
2972<refsect1>
2973 <title>Arguments</title>
2974 <variablelist>
2975  <varlistentry>
2976   <term><parameter>j</parameter></term>
2977   <listitem>
2978    <para>
2979     the time in (relative) jiffies that should be rounded
2980    </para>
2981   </listitem>
2982  </varlistentry>
2983  <varlistentry>
2984   <term><parameter>cpu</parameter></term>
2985   <listitem>
2986    <para>
2987     the processor number on which the timeout will happen
2988    </para>
2989   </listitem>
2990  </varlistentry>
2991 </variablelist>
2992</refsect1>
2993<refsect1>
2994<title>Description</title>
2995<para>
2996   This is the same as <function><link linkend="API---round-jiffies-relative">__round_jiffies_relative</link></function> except that it will never
2997   round down.  This is useful for timeouts for which the exact time
2998   of firing does not matter too much, as long as they don't fire too
2999   early.
3000</para>
3001</refsect1>
3002</refentry>
3003
3004<refentry id="API-round-jiffies-up">
3005<refentryinfo>
3006 <title>LINUX</title>
3007 <productname>Kernel Hackers Manual</productname>
3008 <date>July 2017</date>
3009</refentryinfo>
3010<refmeta>
3011 <refentrytitle><phrase>round_jiffies_up</phrase></refentrytitle>
3012 <manvolnum>9</manvolnum>
3013 <refmiscinfo class="version">4.4.14</refmiscinfo>
3014</refmeta>
3015<refnamediv>
3016 <refname>round_jiffies_up</refname>
3017 <refpurpose>
3018     function to round jiffies up to a full second
3019 </refpurpose>
3020</refnamediv>
3021<refsynopsisdiv>
3022 <title>Synopsis</title>
3023  <funcsynopsis><funcprototype>
3024   <funcdef>unsigned long <function>round_jiffies_up </function></funcdef>
3025   <paramdef>unsigned long <parameter>j</parameter></paramdef>
3026  </funcprototype></funcsynopsis>
3027</refsynopsisdiv>
3028<refsect1>
3029 <title>Arguments</title>
3030 <variablelist>
3031  <varlistentry>
3032   <term><parameter>j</parameter></term>
3033   <listitem>
3034    <para>
3035     the time in (absolute) jiffies that should be rounded
3036    </para>
3037   </listitem>
3038  </varlistentry>
3039 </variablelist>
3040</refsect1>
3041<refsect1>
3042<title>Description</title>
3043<para>
3044   This is the same as <function><link linkend="API-round-jiffies">round_jiffies</link></function> except that it will never
3045   round down.  This is useful for timeouts for which the exact time
3046   of firing does not matter too much, as long as they don't fire too
3047   early.
3048</para>
3049</refsect1>
3050</refentry>
3051
3052<refentry id="API-round-jiffies-up-relative">
3053<refentryinfo>
3054 <title>LINUX</title>
3055 <productname>Kernel Hackers Manual</productname>
3056 <date>July 2017</date>
3057</refentryinfo>
3058<refmeta>
3059 <refentrytitle><phrase>round_jiffies_up_relative</phrase></refentrytitle>
3060 <manvolnum>9</manvolnum>
3061 <refmiscinfo class="version">4.4.14</refmiscinfo>
3062</refmeta>
3063<refnamediv>
3064 <refname>round_jiffies_up_relative</refname>
3065 <refpurpose>
3066     function to round jiffies up to a full second
3067 </refpurpose>
3068</refnamediv>
3069<refsynopsisdiv>
3070 <title>Synopsis</title>
3071  <funcsynopsis><funcprototype>
3072   <funcdef>unsigned long <function>round_jiffies_up_relative </function></funcdef>
3073   <paramdef>unsigned long <parameter>j</parameter></paramdef>
3074  </funcprototype></funcsynopsis>
3075</refsynopsisdiv>
3076<refsect1>
3077 <title>Arguments</title>
3078 <variablelist>
3079  <varlistentry>
3080   <term><parameter>j</parameter></term>
3081   <listitem>
3082    <para>
3083     the time in (relative) jiffies that should be rounded
3084    </para>
3085   </listitem>
3086  </varlistentry>
3087 </variablelist>
3088</refsect1>
3089<refsect1>
3090<title>Description</title>
3091<para>
3092   This is the same as <function><link linkend="API-round-jiffies-relative">round_jiffies_relative</link></function> except that it will never
3093   round down.  This is useful for timeouts for which the exact time
3094   of firing does not matter too much, as long as they don't fire too
3095   early.
3096</para>
3097</refsect1>
3098</refentry>
3099
3100<refentry id="API-set-timer-slack">
3101<refentryinfo>
3102 <title>LINUX</title>
3103 <productname>Kernel Hackers Manual</productname>
3104 <date>July 2017</date>
3105</refentryinfo>
3106<refmeta>
3107 <refentrytitle><phrase>set_timer_slack</phrase></refentrytitle>
3108 <manvolnum>9</manvolnum>
3109 <refmiscinfo class="version">4.4.14</refmiscinfo>
3110</refmeta>
3111<refnamediv>
3112 <refname>set_timer_slack</refname>
3113 <refpurpose>
3114     set the allowed slack for a timer
3115 </refpurpose>
3116</refnamediv>
3117<refsynopsisdiv>
3118 <title>Synopsis</title>
3119  <funcsynopsis><funcprototype>
3120   <funcdef>void <function>set_timer_slack </function></funcdef>
3121   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3122   <paramdef>int <parameter>slack_hz</parameter></paramdef>
3123  </funcprototype></funcsynopsis>
3124</refsynopsisdiv>
3125<refsect1>
3126 <title>Arguments</title>
3127 <variablelist>
3128  <varlistentry>
3129   <term><parameter>timer</parameter></term>
3130   <listitem>
3131    <para>
3132     the timer to be modified
3133    </para>
3134   </listitem>
3135  </varlistentry>
3136  <varlistentry>
3137   <term><parameter>slack_hz</parameter></term>
3138   <listitem>
3139    <para>
3140     the amount of time (in jiffies) allowed for rounding
3141    </para>
3142   </listitem>
3143  </varlistentry>
3144 </variablelist>
3145</refsect1>
3146<refsect1>
3147<title>Description</title>
3148<para>
3149   Set the amount of time, in jiffies, that a certain timer has
3150   in terms of slack. By setting this value, the timer subsystem
3151   will schedule the actual timer somewhere between
3152   the time <function><link linkend="API-mod-timer">mod_timer</link></function> asks for, and that time plus the slack.
3153   </para><para>
3154
3155   By setting the slack to -1, a percentage of the delay is used
3156   instead.
3157</para>
3158</refsect1>
3159</refentry>
3160
3161<refentry id="API-init-timer-key">
3162<refentryinfo>
3163 <title>LINUX</title>
3164 <productname>Kernel Hackers Manual</productname>
3165 <date>July 2017</date>
3166</refentryinfo>
3167<refmeta>
3168 <refentrytitle><phrase>init_timer_key</phrase></refentrytitle>
3169 <manvolnum>9</manvolnum>
3170 <refmiscinfo class="version">4.4.14</refmiscinfo>
3171</refmeta>
3172<refnamediv>
3173 <refname>init_timer_key</refname>
3174 <refpurpose>
3175     initialize a timer
3176 </refpurpose>
3177</refnamediv>
3178<refsynopsisdiv>
3179 <title>Synopsis</title>
3180  <funcsynopsis><funcprototype>
3181   <funcdef>void <function>init_timer_key </function></funcdef>
3182   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3183   <paramdef>unsigned int <parameter>flags</parameter></paramdef>
3184   <paramdef>const char * <parameter>name</parameter></paramdef>
3185   <paramdef>struct lock_class_key * <parameter>key</parameter></paramdef>
3186  </funcprototype></funcsynopsis>
3187</refsynopsisdiv>
3188<refsect1>
3189 <title>Arguments</title>
3190 <variablelist>
3191  <varlistentry>
3192   <term><parameter>timer</parameter></term>
3193   <listitem>
3194    <para>
3195     the timer to be initialized
3196    </para>
3197   </listitem>
3198  </varlistentry>
3199  <varlistentry>
3200   <term><parameter>flags</parameter></term>
3201   <listitem>
3202    <para>
3203     timer flags
3204    </para>
3205   </listitem>
3206  </varlistentry>
3207  <varlistentry>
3208   <term><parameter>name</parameter></term>
3209   <listitem>
3210    <para>
3211     name of the timer
3212    </para>
3213   </listitem>
3214  </varlistentry>
3215  <varlistentry>
3216   <term><parameter>key</parameter></term>
3217   <listitem>
3218    <para>
3219     lockdep class key of the fake lock used for tracking timer
3220     sync lock dependencies
3221    </para>
3222   </listitem>
3223  </varlistentry>
3224 </variablelist>
3225</refsect1>
3226<refsect1>
3227<title>Description</title>
3228<para>
3229   <function><link linkend="API-init-timer-key">init_timer_key</link></function> must be done to a timer prior calling *any* of the
3230   other timer functions.
3231</para>
3232</refsect1>
3233</refentry>
3234
3235<refentry id="API-mod-timer-pending">
3236<refentryinfo>
3237 <title>LINUX</title>
3238 <productname>Kernel Hackers Manual</productname>
3239 <date>July 2017</date>
3240</refentryinfo>
3241<refmeta>
3242 <refentrytitle><phrase>mod_timer_pending</phrase></refentrytitle>
3243 <manvolnum>9</manvolnum>
3244 <refmiscinfo class="version">4.4.14</refmiscinfo>
3245</refmeta>
3246<refnamediv>
3247 <refname>mod_timer_pending</refname>
3248 <refpurpose>
3249     modify a pending timer's timeout
3250 </refpurpose>
3251</refnamediv>
3252<refsynopsisdiv>
3253 <title>Synopsis</title>
3254  <funcsynopsis><funcprototype>
3255   <funcdef>int <function>mod_timer_pending </function></funcdef>
3256   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3257   <paramdef>unsigned long <parameter>expires</parameter></paramdef>
3258  </funcprototype></funcsynopsis>
3259</refsynopsisdiv>
3260<refsect1>
3261 <title>Arguments</title>
3262 <variablelist>
3263  <varlistentry>
3264   <term><parameter>timer</parameter></term>
3265   <listitem>
3266    <para>
3267     the pending timer to be modified
3268    </para>
3269   </listitem>
3270  </varlistentry>
3271  <varlistentry>
3272   <term><parameter>expires</parameter></term>
3273   <listitem>
3274    <para>
3275     new timeout in jiffies
3276    </para>
3277   </listitem>
3278  </varlistentry>
3279 </variablelist>
3280</refsect1>
3281<refsect1>
3282<title>Description</title>
3283<para>
3284   <function><link linkend="API-mod-timer-pending">mod_timer_pending</link></function> is the same for pending timers as <function><link linkend="API-mod-timer">mod_timer</link></function>,
3285   but will not re-activate and modify already deleted timers.
3286   </para><para>
3287
3288   It is useful for unserialized use of timers.
3289</para>
3290</refsect1>
3291</refentry>
3292
3293<refentry id="API-mod-timer">
3294<refentryinfo>
3295 <title>LINUX</title>
3296 <productname>Kernel Hackers Manual</productname>
3297 <date>July 2017</date>
3298</refentryinfo>
3299<refmeta>
3300 <refentrytitle><phrase>mod_timer</phrase></refentrytitle>
3301 <manvolnum>9</manvolnum>
3302 <refmiscinfo class="version">4.4.14</refmiscinfo>
3303</refmeta>
3304<refnamediv>
3305 <refname>mod_timer</refname>
3306 <refpurpose>
3307     modify a timer's timeout
3308 </refpurpose>
3309</refnamediv>
3310<refsynopsisdiv>
3311 <title>Synopsis</title>
3312  <funcsynopsis><funcprototype>
3313   <funcdef>int <function>mod_timer </function></funcdef>
3314   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3315   <paramdef>unsigned long <parameter>expires</parameter></paramdef>
3316  </funcprototype></funcsynopsis>
3317</refsynopsisdiv>
3318<refsect1>
3319 <title>Arguments</title>
3320 <variablelist>
3321  <varlistentry>
3322   <term><parameter>timer</parameter></term>
3323   <listitem>
3324    <para>
3325     the timer to be modified
3326    </para>
3327   </listitem>
3328  </varlistentry>
3329  <varlistentry>
3330   <term><parameter>expires</parameter></term>
3331   <listitem>
3332    <para>
3333     new timeout in jiffies
3334    </para>
3335   </listitem>
3336  </varlistentry>
3337 </variablelist>
3338</refsect1>
3339<refsect1>
3340<title>Description</title>
3341<para>
3342   <function><link linkend="API-mod-timer">mod_timer</link></function> is a more efficient way to update the expire field of an
3343   active timer (if the timer is inactive it will be activated)
3344   </para><para>
3345
3346   mod_timer(timer, expires) is equivalent to:
3347   </para><para>
3348
3349   del_timer(timer); timer-&gt;expires = expires; add_timer(timer);
3350   </para><para>
3351
3352   Note that if there are multiple unserialized concurrent users of the
3353   same timer, then <function><link linkend="API-mod-timer">mod_timer</link></function> is the only safe way to modify the timeout,
3354   since <function><link linkend="API-add-timer">add_timer</link></function> cannot modify an already running timer.
3355   </para><para>
3356
3357   The function returns whether it has modified a pending timer or not.
3358   (ie. <function><link linkend="API-mod-timer">mod_timer</link></function> of an inactive timer returns 0, <function><link linkend="API-mod-timer">mod_timer</link></function> of an
3359   active timer returns 1.)
3360</para>
3361</refsect1>
3362</refentry>
3363
3364<refentry id="API-mod-timer-pinned">
3365<refentryinfo>
3366 <title>LINUX</title>
3367 <productname>Kernel Hackers Manual</productname>
3368 <date>July 2017</date>
3369</refentryinfo>
3370<refmeta>
3371 <refentrytitle><phrase>mod_timer_pinned</phrase></refentrytitle>
3372 <manvolnum>9</manvolnum>
3373 <refmiscinfo class="version">4.4.14</refmiscinfo>
3374</refmeta>
3375<refnamediv>
3376 <refname>mod_timer_pinned</refname>
3377 <refpurpose>
3378     modify a timer's timeout
3379 </refpurpose>
3380</refnamediv>
3381<refsynopsisdiv>
3382 <title>Synopsis</title>
3383  <funcsynopsis><funcprototype>
3384   <funcdef>int <function>mod_timer_pinned </function></funcdef>
3385   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3386   <paramdef>unsigned long <parameter>expires</parameter></paramdef>
3387  </funcprototype></funcsynopsis>
3388</refsynopsisdiv>
3389<refsect1>
3390 <title>Arguments</title>
3391 <variablelist>
3392  <varlistentry>
3393   <term><parameter>timer</parameter></term>
3394   <listitem>
3395    <para>
3396     the timer to be modified
3397    </para>
3398   </listitem>
3399  </varlistentry>
3400  <varlistentry>
3401   <term><parameter>expires</parameter></term>
3402   <listitem>
3403    <para>
3404     new timeout in jiffies
3405    </para>
3406   </listitem>
3407  </varlistentry>
3408 </variablelist>
3409</refsect1>
3410<refsect1>
3411<title>Description</title>
3412<para>
3413   <function><link linkend="API-mod-timer-pinned">mod_timer_pinned</link></function> is a way to update the expire field of an
3414   active timer (if the timer is inactive it will be activated)
3415   and to ensure that the timer is scheduled on the current CPU.
3416   </para><para>
3417
3418   Note that this does not prevent the timer from being migrated
3419   when the current CPU goes offline.  If this is a problem for
3420   you, use CPU-hotplug notifiers to handle it correctly, for
3421   example, cancelling the timer when the corresponding CPU goes
3422   offline.
3423   </para><para>
3424
3425   mod_timer_pinned(timer, expires) is equivalent to:
3426   </para><para>
3427
3428   del_timer(timer); timer-&gt;expires = expires; add_timer(timer);
3429</para>
3430</refsect1>
3431</refentry>
3432
3433<refentry id="API-add-timer">
3434<refentryinfo>
3435 <title>LINUX</title>
3436 <productname>Kernel Hackers Manual</productname>
3437 <date>July 2017</date>
3438</refentryinfo>
3439<refmeta>
3440 <refentrytitle><phrase>add_timer</phrase></refentrytitle>
3441 <manvolnum>9</manvolnum>
3442 <refmiscinfo class="version">4.4.14</refmiscinfo>
3443</refmeta>
3444<refnamediv>
3445 <refname>add_timer</refname>
3446 <refpurpose>
3447     start a timer
3448 </refpurpose>
3449</refnamediv>
3450<refsynopsisdiv>
3451 <title>Synopsis</title>
3452  <funcsynopsis><funcprototype>
3453   <funcdef>void <function>add_timer </function></funcdef>
3454   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3455  </funcprototype></funcsynopsis>
3456</refsynopsisdiv>
3457<refsect1>
3458 <title>Arguments</title>
3459 <variablelist>
3460  <varlistentry>
3461   <term><parameter>timer</parameter></term>
3462   <listitem>
3463    <para>
3464     the timer to be added
3465    </para>
3466   </listitem>
3467  </varlistentry>
3468 </variablelist>
3469</refsect1>
3470<refsect1>
3471<title>Description</title>
3472<para>
3473   The kernel will do a -&gt;function(-&gt;data) callback from the
3474   timer interrupt at the -&gt;expires point in the future. The
3475   current time is 'jiffies'.
3476   </para><para>
3477
3478   The timer's -&gt;expires, -&gt;function (and if the handler uses it, -&gt;data)
3479   fields must be set prior calling this function.
3480   </para><para>
3481
3482   Timers with an -&gt;expires field in the past will be executed in the next
3483   timer tick.
3484</para>
3485</refsect1>
3486</refentry>
3487
3488<refentry id="API-add-timer-on">
3489<refentryinfo>
3490 <title>LINUX</title>
3491 <productname>Kernel Hackers Manual</productname>
3492 <date>July 2017</date>
3493</refentryinfo>
3494<refmeta>
3495 <refentrytitle><phrase>add_timer_on</phrase></refentrytitle>
3496 <manvolnum>9</manvolnum>
3497 <refmiscinfo class="version">4.4.14</refmiscinfo>
3498</refmeta>
3499<refnamediv>
3500 <refname>add_timer_on</refname>
3501 <refpurpose>
3502     start a timer on a particular CPU
3503 </refpurpose>
3504</refnamediv>
3505<refsynopsisdiv>
3506 <title>Synopsis</title>
3507  <funcsynopsis><funcprototype>
3508   <funcdef>void <function>add_timer_on </function></funcdef>
3509   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3510   <paramdef>int <parameter>cpu</parameter></paramdef>
3511  </funcprototype></funcsynopsis>
3512</refsynopsisdiv>
3513<refsect1>
3514 <title>Arguments</title>
3515 <variablelist>
3516  <varlistentry>
3517   <term><parameter>timer</parameter></term>
3518   <listitem>
3519    <para>
3520     the timer to be added
3521    </para>
3522   </listitem>
3523  </varlistentry>
3524  <varlistentry>
3525   <term><parameter>cpu</parameter></term>
3526   <listitem>
3527    <para>
3528     the CPU to start it on
3529    </para>
3530   </listitem>
3531  </varlistentry>
3532 </variablelist>
3533</refsect1>
3534<refsect1>
3535<title>Description</title>
3536<para>
3537   This is not very scalable on SMP. Double adds are not possible.
3538</para>
3539</refsect1>
3540</refentry>
3541
3542<refentry id="API-del-timer">
3543<refentryinfo>
3544 <title>LINUX</title>
3545 <productname>Kernel Hackers Manual</productname>
3546 <date>July 2017</date>
3547</refentryinfo>
3548<refmeta>
3549 <refentrytitle><phrase>del_timer</phrase></refentrytitle>
3550 <manvolnum>9</manvolnum>
3551 <refmiscinfo class="version">4.4.14</refmiscinfo>
3552</refmeta>
3553<refnamediv>
3554 <refname>del_timer</refname>
3555 <refpurpose>
3556     deactive a timer.
3557 </refpurpose>
3558</refnamediv>
3559<refsynopsisdiv>
3560 <title>Synopsis</title>
3561  <funcsynopsis><funcprototype>
3562   <funcdef>int <function>del_timer </function></funcdef>
3563   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3564  </funcprototype></funcsynopsis>
3565</refsynopsisdiv>
3566<refsect1>
3567 <title>Arguments</title>
3568 <variablelist>
3569  <varlistentry>
3570   <term><parameter>timer</parameter></term>
3571   <listitem>
3572    <para>
3573     the timer to be deactivated
3574    </para>
3575   </listitem>
3576  </varlistentry>
3577 </variablelist>
3578</refsect1>
3579<refsect1>
3580<title>Description</title>
3581<para>
3582   <function><link linkend="API-del-timer">del_timer</link></function> deactivates a timer - this works on both active and inactive
3583   timers.
3584   </para><para>
3585
3586   The function returns whether it has deactivated a pending timer or not.
3587   (ie. <function><link linkend="API-del-timer">del_timer</link></function> of an inactive timer returns 0, <function><link linkend="API-del-timer">del_timer</link></function> of an
3588   active timer returns 1.)
3589</para>
3590</refsect1>
3591</refentry>
3592
3593<refentry id="API-try-to-del-timer-sync">
3594<refentryinfo>
3595 <title>LINUX</title>
3596 <productname>Kernel Hackers Manual</productname>
3597 <date>July 2017</date>
3598</refentryinfo>
3599<refmeta>
3600 <refentrytitle><phrase>try_to_del_timer_sync</phrase></refentrytitle>
3601 <manvolnum>9</manvolnum>
3602 <refmiscinfo class="version">4.4.14</refmiscinfo>
3603</refmeta>
3604<refnamediv>
3605 <refname>try_to_del_timer_sync</refname>
3606 <refpurpose>
3607     Try to deactivate a timer
3608 </refpurpose>
3609</refnamediv>
3610<refsynopsisdiv>
3611 <title>Synopsis</title>
3612  <funcsynopsis><funcprototype>
3613   <funcdef>int <function>try_to_del_timer_sync </function></funcdef>
3614   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3615  </funcprototype></funcsynopsis>
3616</refsynopsisdiv>
3617<refsect1>
3618 <title>Arguments</title>
3619 <variablelist>
3620  <varlistentry>
3621   <term><parameter>timer</parameter></term>
3622   <listitem>
3623    <para>
3624     timer do del
3625    </para>
3626   </listitem>
3627  </varlistentry>
3628 </variablelist>
3629</refsect1>
3630<refsect1>
3631<title>Description</title>
3632<para>
3633   This function tries to deactivate a timer. Upon successful (ret &gt;= 0)
3634   exit the timer is not queued and the handler is not running on any CPU.
3635</para>
3636</refsect1>
3637</refentry>
3638
3639<refentry id="API-del-timer-sync">
3640<refentryinfo>
3641 <title>LINUX</title>
3642 <productname>Kernel Hackers Manual</productname>
3643 <date>July 2017</date>
3644</refentryinfo>
3645<refmeta>
3646 <refentrytitle><phrase>del_timer_sync</phrase></refentrytitle>
3647 <manvolnum>9</manvolnum>
3648 <refmiscinfo class="version">4.4.14</refmiscinfo>
3649</refmeta>
3650<refnamediv>
3651 <refname>del_timer_sync</refname>
3652 <refpurpose>
3653     deactivate a timer and wait for the handler to finish.
3654 </refpurpose>
3655</refnamediv>
3656<refsynopsisdiv>
3657 <title>Synopsis</title>
3658  <funcsynopsis><funcprototype>
3659   <funcdef>int <function>del_timer_sync </function></funcdef>
3660   <paramdef>struct timer_list * <parameter>timer</parameter></paramdef>
3661  </funcprototype></funcsynopsis>
3662</refsynopsisdiv>
3663<refsect1>
3664 <title>Arguments</title>
3665 <variablelist>
3666  <varlistentry>
3667   <term><parameter>timer</parameter></term>
3668   <listitem>
3669    <para>
3670     the timer to be deactivated
3671    </para>
3672   </listitem>
3673  </varlistentry>
3674 </variablelist>
3675</refsect1>
3676<refsect1>
3677<title>Description</title>
3678<para>
3679   This function only differs from <function><link linkend="API-del-timer">del_timer</link></function> on SMP: besides deactivating
3680   the timer it also makes sure the handler has finished executing on other
3681   CPUs.
3682</para>
3683</refsect1>
3684<refsect1>
3685<title>Synchronization rules</title>
3686<para>
3687   Callers must prevent restarting of the timer,
3688   otherwise this function is meaningless. It must not be called from
3689   interrupt contexts unless the timer is an irqsafe one. The caller must
3690   not hold locks which would prevent completion of the timer's
3691   handler. The timer's handler must not call <function><link linkend="API-add-timer-on">add_timer_on</link></function>. Upon exit the
3692   timer is not queued and the handler is not running on any CPU.
3693</para>
3694</refsect1>
3695<refsect1>
3696<title>Note</title>
3697<para>
3698   For !irqsafe timers, you must not hold locks that are held in
3699   interrupt context while calling this function. Even if the lock has
3700   nothing to do with the timer in question.  Here's why:
3701   </para><para>
3702
3703   CPU0                             CPU1
3704   ----                             ----
3705   &lt;SOFTIRQ&gt;
3706   <function>call_timer_fn</function>;
3707   base-&gt;running_timer = mytimer;
3708   spin_lock_irq(somelock);
3709   &lt;IRQ&gt;
3710   spin_lock(somelock);
3711   del_timer_sync(mytimer);
3712   while (base-&gt;running_timer == mytimer);
3713   </para><para>
3714
3715   Now <function><link linkend="API-del-timer-sync">del_timer_sync</link></function> will never return and never release somelock.
3716   The interrupt on the other CPU is waiting to grab somelock but
3717   it has interrupted the softirq that CPU0 is waiting to finish.
3718   </para><para>
3719
3720   The function returns whether it has deactivated a pending timer or not.
3721</para>
3722</refsect1>
3723</refentry>
3724
3725<refentry id="API-schedule-timeout">
3726<refentryinfo>
3727 <title>LINUX</title>
3728 <productname>Kernel Hackers Manual</productname>
3729 <date>July 2017</date>
3730</refentryinfo>
3731<refmeta>
3732 <refentrytitle><phrase>schedule_timeout</phrase></refentrytitle>
3733 <manvolnum>9</manvolnum>
3734 <refmiscinfo class="version">4.4.14</refmiscinfo>
3735</refmeta>
3736<refnamediv>
3737 <refname>schedule_timeout</refname>
3738 <refpurpose>
3739     sleep until timeout
3740 </refpurpose>
3741</refnamediv>
3742<refsynopsisdiv>
3743 <title>Synopsis</title>
3744  <funcsynopsis><funcprototype>
3745   <funcdef>signed long __sched <function>schedule_timeout </function></funcdef>
3746   <paramdef>signed long <parameter>timeout</parameter></paramdef>
3747  </funcprototype></funcsynopsis>
3748</refsynopsisdiv>
3749<refsect1>
3750 <title>Arguments</title>
3751 <variablelist>
3752  <varlistentry>
3753   <term><parameter>timeout</parameter></term>
3754   <listitem>
3755    <para>
3756     timeout value in jiffies
3757    </para>
3758   </listitem>
3759  </varlistentry>
3760 </variablelist>
3761</refsect1>
3762<refsect1>
3763<title>Description</title>
3764<para>
3765   Make the current task sleep until <parameter>timeout</parameter> jiffies have
3766   elapsed. The routine will return immediately unless
3767   the current task state has been set (see <function>set_current_state</function>).
3768   </para><para>
3769
3770   You can set the task state as follows -
3771   </para><para>
3772
3773   <constant>TASK_UNINTERRUPTIBLE</constant> - at least <parameter>timeout</parameter> jiffies are guaranteed to
3774   pass before the routine returns. The routine will return 0
3775   </para><para>
3776
3777   <constant>TASK_INTERRUPTIBLE</constant> - the routine may return early if a signal is
3778   delivered to the current task. In this case the remaining time
3779   in jiffies will be returned, or 0 if the timer expired in time
3780   </para><para>
3781
3782   The current task state is guaranteed to be TASK_RUNNING when this
3783   routine returns.
3784   </para><para>
3785
3786   Specifying a <parameter>timeout</parameter> value of <constant>MAX_SCHEDULE_TIMEOUT</constant> will schedule
3787   the CPU away without a bound on the timeout. In this case the return
3788   value will be <constant>MAX_SCHEDULE_TIMEOUT</constant>.
3789   </para><para>
3790
3791   In all cases the return value is guaranteed to be non-negative.
3792</para>
3793</refsect1>
3794</refentry>
3795
3796<refentry id="API-msleep">
3797<refentryinfo>
3798 <title>LINUX</title>
3799 <productname>Kernel Hackers Manual</productname>
3800 <date>July 2017</date>
3801</refentryinfo>
3802<refmeta>
3803 <refentrytitle><phrase>msleep</phrase></refentrytitle>
3804 <manvolnum>9</manvolnum>
3805 <refmiscinfo class="version">4.4.14</refmiscinfo>
3806</refmeta>
3807<refnamediv>
3808 <refname>msleep</refname>
3809 <refpurpose>
3810     sleep safely even with waitqueue interruptions
3811 </refpurpose>
3812</refnamediv>
3813<refsynopsisdiv>
3814 <title>Synopsis</title>
3815  <funcsynopsis><funcprototype>
3816   <funcdef>void <function>msleep </function></funcdef>
3817   <paramdef>unsigned int <parameter>msecs</parameter></paramdef>
3818  </funcprototype></funcsynopsis>
3819</refsynopsisdiv>
3820<refsect1>
3821 <title>Arguments</title>
3822 <variablelist>
3823  <varlistentry>
3824   <term><parameter>msecs</parameter></term>
3825   <listitem>
3826    <para>
3827     Time in milliseconds to sleep for
3828    </para>
3829   </listitem>
3830  </varlistentry>
3831 </variablelist>
3832</refsect1>
3833</refentry>
3834
3835<refentry id="API-msleep-interruptible">
3836<refentryinfo>
3837 <title>LINUX</title>
3838 <productname>Kernel Hackers Manual</productname>
3839 <date>July 2017</date>
3840</refentryinfo>
3841<refmeta>
3842 <refentrytitle><phrase>msleep_interruptible</phrase></refentrytitle>
3843 <manvolnum>9</manvolnum>
3844 <refmiscinfo class="version">4.4.14</refmiscinfo>
3845</refmeta>
3846<refnamediv>
3847 <refname>msleep_interruptible</refname>
3848 <refpurpose>
3849     sleep waiting for signals
3850 </refpurpose>
3851</refnamediv>
3852<refsynopsisdiv>
3853 <title>Synopsis</title>
3854  <funcsynopsis><funcprototype>
3855   <funcdef>unsigned long <function>msleep_interruptible </function></funcdef>
3856   <paramdef>unsigned int <parameter>msecs</parameter></paramdef>
3857  </funcprototype></funcsynopsis>
3858</refsynopsisdiv>
3859<refsect1>
3860 <title>Arguments</title>
3861 <variablelist>
3862  <varlistentry>
3863   <term><parameter>msecs</parameter></term>
3864   <listitem>
3865    <para>
3866     Time in milliseconds to sleep for
3867    </para>
3868   </listitem>
3869  </varlistentry>
3870 </variablelist>
3871</refsect1>
3872</refentry>
3873
3874<refentry id="API-usleep-range">
3875<refentryinfo>
3876 <title>LINUX</title>
3877 <productname>Kernel Hackers Manual</productname>
3878 <date>July 2017</date>
3879</refentryinfo>
3880<refmeta>
3881 <refentrytitle><phrase>usleep_range</phrase></refentrytitle>
3882 <manvolnum>9</manvolnum>
3883 <refmiscinfo class="version">4.4.14</refmiscinfo>
3884</refmeta>
3885<refnamediv>
3886 <refname>usleep_range</refname>
3887 <refpurpose>
3888     Drop in replacement for udelay where wakeup is flexible
3889 </refpurpose>
3890</refnamediv>
3891<refsynopsisdiv>
3892 <title>Synopsis</title>
3893  <funcsynopsis><funcprototype>
3894   <funcdef>void __sched <function>usleep_range </function></funcdef>
3895   <paramdef>unsigned long <parameter>min</parameter></paramdef>
3896   <paramdef>unsigned long <parameter>max</parameter></paramdef>
3897  </funcprototype></funcsynopsis>
3898</refsynopsisdiv>
3899<refsect1>
3900 <title>Arguments</title>
3901 <variablelist>
3902  <varlistentry>
3903   <term><parameter>min</parameter></term>
3904   <listitem>
3905    <para>
3906     Minimum time in usecs to sleep
3907    </para>
3908   </listitem>
3909  </varlistentry>
3910  <varlistentry>
3911   <term><parameter>max</parameter></term>
3912   <listitem>
3913    <para>
3914     Maximum time in usecs to sleep
3915    </para>
3916   </listitem>
3917  </varlistentry>
3918 </variablelist>
3919</refsect1>
3920</refentry>
3921
3922     </sect1>
3923     <sect1><title>Wait queues and Wake events</title>
3924<!-- include/linux/wait.h -->
3925<refentry id="API-wait-event">
3926<refentryinfo>
3927 <title>LINUX</title>
3928 <productname>Kernel Hackers Manual</productname>
3929 <date>July 2017</date>
3930</refentryinfo>
3931<refmeta>
3932 <refentrytitle><phrase>wait_event</phrase></refentrytitle>
3933 <manvolnum>9</manvolnum>
3934 <refmiscinfo class="version">4.4.14</refmiscinfo>
3935</refmeta>
3936<refnamediv>
3937 <refname>wait_event</refname>
3938 <refpurpose>
3939  sleep until a condition gets true
3940 </refpurpose>
3941</refnamediv>
3942<refsynopsisdiv>
3943 <title>Synopsis</title>
3944  <funcsynopsis><funcprototype>
3945   <funcdef> <function>wait_event </function></funcdef>
3946   <paramdef> <parameter>wq</parameter></paramdef>
3947   <paramdef> <parameter>condition</parameter></paramdef>
3948  </funcprototype></funcsynopsis>
3949</refsynopsisdiv>
3950<refsect1>
3951 <title>Arguments</title>
3952 <variablelist>
3953  <varlistentry>
3954   <term><parameter>wq</parameter></term>
3955   <listitem>
3956    <para>
3957     the waitqueue to wait on
3958    </para>
3959   </listitem>
3960  </varlistentry>
3961  <varlistentry>
3962   <term><parameter>condition</parameter></term>
3963   <listitem>
3964    <para>
3965     a C expression for the event to wait for
3966    </para>
3967   </listitem>
3968  </varlistentry>
3969 </variablelist>
3970</refsect1>
3971<refsect1>
3972<title>Description</title>
3973<para>
3974   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
3975   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
3976   the waitqueue <parameter>wq</parameter> is woken up.
3977   </para><para>
3978
3979   <function>wake_up</function> has to be called after changing any variable that could
3980   change the result of the wait condition.
3981</para>
3982</refsect1>
3983</refentry>
3984
3985<refentry id="API-wait-event-freezable">
3986<refentryinfo>
3987 <title>LINUX</title>
3988 <productname>Kernel Hackers Manual</productname>
3989 <date>July 2017</date>
3990</refentryinfo>
3991<refmeta>
3992 <refentrytitle><phrase>wait_event_freezable</phrase></refentrytitle>
3993 <manvolnum>9</manvolnum>
3994 <refmiscinfo class="version">4.4.14</refmiscinfo>
3995</refmeta>
3996<refnamediv>
3997 <refname>wait_event_freezable</refname>
3998 <refpurpose>
3999     sleep (or freeze) until a condition gets true
4000 </refpurpose>
4001</refnamediv>
4002<refsynopsisdiv>
4003 <title>Synopsis</title>
4004  <funcsynopsis><funcprototype>
4005   <funcdef> <function>wait_event_freezable </function></funcdef>
4006   <paramdef> <parameter>wq</parameter></paramdef>
4007   <paramdef> <parameter>condition</parameter></paramdef>
4008  </funcprototype></funcsynopsis>
4009</refsynopsisdiv>
4010<refsect1>
4011 <title>Arguments</title>
4012 <variablelist>
4013  <varlistentry>
4014   <term><parameter>wq</parameter></term>
4015   <listitem>
4016    <para>
4017     the waitqueue to wait on
4018    </para>
4019   </listitem>
4020  </varlistentry>
4021  <varlistentry>
4022   <term><parameter>condition</parameter></term>
4023   <listitem>
4024    <para>
4025     a C expression for the event to wait for
4026    </para>
4027   </listitem>
4028  </varlistentry>
4029 </variablelist>
4030</refsect1>
4031<refsect1>
4032<title>Description</title>
4033<para>
4034   The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
4035   to system load) until the <parameter>condition</parameter> evaluates to true. The
4036   <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4037   </para><para>
4038
4039   <function>wake_up</function> has to be called after changing any variable that could
4040   change the result of the wait condition.
4041</para>
4042</refsect1>
4043</refentry>
4044
4045<refentry id="API-wait-event-timeout">
4046<refentryinfo>
4047 <title>LINUX</title>
4048 <productname>Kernel Hackers Manual</productname>
4049 <date>July 2017</date>
4050</refentryinfo>
4051<refmeta>
4052 <refentrytitle><phrase>wait_event_timeout</phrase></refentrytitle>
4053 <manvolnum>9</manvolnum>
4054 <refmiscinfo class="version">4.4.14</refmiscinfo>
4055</refmeta>
4056<refnamediv>
4057 <refname>wait_event_timeout</refname>
4058 <refpurpose>
4059     sleep until a condition gets true or a timeout elapses
4060 </refpurpose>
4061</refnamediv>
4062<refsynopsisdiv>
4063 <title>Synopsis</title>
4064  <funcsynopsis><funcprototype>
4065   <funcdef> <function>wait_event_timeout </function></funcdef>
4066   <paramdef> <parameter>wq</parameter></paramdef>
4067   <paramdef> <parameter>condition</parameter></paramdef>
4068   <paramdef> <parameter>timeout</parameter></paramdef>
4069  </funcprototype></funcsynopsis>
4070</refsynopsisdiv>
4071<refsect1>
4072 <title>Arguments</title>
4073 <variablelist>
4074  <varlistentry>
4075   <term><parameter>wq</parameter></term>
4076   <listitem>
4077    <para>
4078     the waitqueue to wait on
4079    </para>
4080   </listitem>
4081  </varlistentry>
4082  <varlistentry>
4083   <term><parameter>condition</parameter></term>
4084   <listitem>
4085    <para>
4086     a C expression for the event to wait for
4087    </para>
4088   </listitem>
4089  </varlistentry>
4090  <varlistentry>
4091   <term><parameter>timeout</parameter></term>
4092   <listitem>
4093    <para>
4094     timeout, in jiffies
4095    </para>
4096   </listitem>
4097  </varlistentry>
4098 </variablelist>
4099</refsect1>
4100<refsect1>
4101<title>Description</title>
4102<para>
4103   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4104   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
4105   the waitqueue <parameter>wq</parameter> is woken up.
4106   </para><para>
4107
4108   <function>wake_up</function> has to be called after changing any variable that could
4109   change the result of the wait condition.
4110</para>
4111</refsect1>
4112<refsect1>
4113<title>Returns</title>
4114<para>
4115   0 if the <parameter>condition</parameter> evaluated to <constant>false</constant> after the <parameter>timeout</parameter> elapsed,
4116   1 if the <parameter>condition</parameter> evaluated to <constant>true</constant> after the <parameter>timeout</parameter> elapsed,
4117   or the remaining jiffies (at least 1) if the <parameter>condition</parameter> evaluated
4118   to <constant>true</constant> before the <parameter>timeout</parameter> elapsed.
4119</para>
4120</refsect1>
4121</refentry>
4122
4123<refentry id="API-wait-event-cmd">
4124<refentryinfo>
4125 <title>LINUX</title>
4126 <productname>Kernel Hackers Manual</productname>
4127 <date>July 2017</date>
4128</refentryinfo>
4129<refmeta>
4130 <refentrytitle><phrase>wait_event_cmd</phrase></refentrytitle>
4131 <manvolnum>9</manvolnum>
4132 <refmiscinfo class="version">4.4.14</refmiscinfo>
4133</refmeta>
4134<refnamediv>
4135 <refname>wait_event_cmd</refname>
4136 <refpurpose>
4137     sleep until a condition gets true
4138 </refpurpose>
4139</refnamediv>
4140<refsynopsisdiv>
4141 <title>Synopsis</title>
4142  <funcsynopsis><funcprototype>
4143   <funcdef> <function>wait_event_cmd </function></funcdef>
4144   <paramdef> <parameter>wq</parameter></paramdef>
4145   <paramdef> <parameter>condition</parameter></paramdef>
4146   <paramdef> <parameter>cmd1</parameter></paramdef>
4147   <paramdef> <parameter>cmd2</parameter></paramdef>
4148  </funcprototype></funcsynopsis>
4149</refsynopsisdiv>
4150<refsect1>
4151 <title>Arguments</title>
4152 <variablelist>
4153  <varlistentry>
4154   <term><parameter>wq</parameter></term>
4155   <listitem>
4156    <para>
4157     the waitqueue to wait on
4158    </para>
4159   </listitem>
4160  </varlistentry>
4161  <varlistentry>
4162   <term><parameter>condition</parameter></term>
4163   <listitem>
4164    <para>
4165     a C expression for the event to wait for
4166    </para>
4167   </listitem>
4168  </varlistentry>
4169  <varlistentry>
4170   <term><parameter>cmd1</parameter></term>
4171   <listitem>
4172    <para>
4173     the command will be executed before sleep
4174    </para>
4175   </listitem>
4176  </varlistentry>
4177  <varlistentry>
4178   <term><parameter>cmd2</parameter></term>
4179   <listitem>
4180    <para>
4181     the command will be executed after sleep
4182    </para>
4183   </listitem>
4184  </varlistentry>
4185 </variablelist>
4186</refsect1>
4187<refsect1>
4188<title>Description</title>
4189<para>
4190   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4191   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
4192   the waitqueue <parameter>wq</parameter> is woken up.
4193   </para><para>
4194
4195   <function>wake_up</function> has to be called after changing any variable that could
4196   change the result of the wait condition.
4197</para>
4198</refsect1>
4199</refentry>
4200
4201<refentry id="API-wait-event-interruptible">
4202<refentryinfo>
4203 <title>LINUX</title>
4204 <productname>Kernel Hackers Manual</productname>
4205 <date>July 2017</date>
4206</refentryinfo>
4207<refmeta>
4208 <refentrytitle><phrase>wait_event_interruptible</phrase></refentrytitle>
4209 <manvolnum>9</manvolnum>
4210 <refmiscinfo class="version">4.4.14</refmiscinfo>
4211</refmeta>
4212<refnamediv>
4213 <refname>wait_event_interruptible</refname>
4214 <refpurpose>
4215     sleep until a condition gets true
4216 </refpurpose>
4217</refnamediv>
4218<refsynopsisdiv>
4219 <title>Synopsis</title>
4220  <funcsynopsis><funcprototype>
4221   <funcdef> <function>wait_event_interruptible </function></funcdef>
4222   <paramdef> <parameter>wq</parameter></paramdef>
4223   <paramdef> <parameter>condition</parameter></paramdef>
4224  </funcprototype></funcsynopsis>
4225</refsynopsisdiv>
4226<refsect1>
4227 <title>Arguments</title>
4228 <variablelist>
4229  <varlistentry>
4230   <term><parameter>wq</parameter></term>
4231   <listitem>
4232    <para>
4233     the waitqueue to wait on
4234    </para>
4235   </listitem>
4236  </varlistentry>
4237  <varlistentry>
4238   <term><parameter>condition</parameter></term>
4239   <listitem>
4240    <para>
4241     a C expression for the event to wait for
4242    </para>
4243   </listitem>
4244  </varlistentry>
4245 </variablelist>
4246</refsect1>
4247<refsect1>
4248<title>Description</title>
4249<para>
4250   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4251   <parameter>condition</parameter> evaluates to true or a signal is received.
4252   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4253   </para><para>
4254
4255   <function>wake_up</function> has to be called after changing any variable that could
4256   change the result of the wait condition.
4257   </para><para>
4258
4259   The function will return -ERESTARTSYS if it was interrupted by a
4260   signal and 0 if <parameter>condition</parameter> evaluated to true.
4261</para>
4262</refsect1>
4263</refentry>
4264
4265<refentry id="API-wait-event-interruptible-timeout">
4266<refentryinfo>
4267 <title>LINUX</title>
4268 <productname>Kernel Hackers Manual</productname>
4269 <date>July 2017</date>
4270</refentryinfo>
4271<refmeta>
4272 <refentrytitle><phrase>wait_event_interruptible_timeout</phrase></refentrytitle>
4273 <manvolnum>9</manvolnum>
4274 <refmiscinfo class="version">4.4.14</refmiscinfo>
4275</refmeta>
4276<refnamediv>
4277 <refname>wait_event_interruptible_timeout</refname>
4278 <refpurpose>
4279     sleep until a condition gets true or a timeout elapses
4280 </refpurpose>
4281</refnamediv>
4282<refsynopsisdiv>
4283 <title>Synopsis</title>
4284  <funcsynopsis><funcprototype>
4285   <funcdef> <function>wait_event_interruptible_timeout </function></funcdef>
4286   <paramdef> <parameter>wq</parameter></paramdef>
4287   <paramdef> <parameter>condition</parameter></paramdef>
4288   <paramdef> <parameter>timeout</parameter></paramdef>
4289  </funcprototype></funcsynopsis>
4290</refsynopsisdiv>
4291<refsect1>
4292 <title>Arguments</title>
4293 <variablelist>
4294  <varlistentry>
4295   <term><parameter>wq</parameter></term>
4296   <listitem>
4297    <para>
4298     the waitqueue to wait on
4299    </para>
4300   </listitem>
4301  </varlistentry>
4302  <varlistentry>
4303   <term><parameter>condition</parameter></term>
4304   <listitem>
4305    <para>
4306     a C expression for the event to wait for
4307    </para>
4308   </listitem>
4309  </varlistentry>
4310  <varlistentry>
4311   <term><parameter>timeout</parameter></term>
4312   <listitem>
4313    <para>
4314     timeout, in jiffies
4315    </para>
4316   </listitem>
4317  </varlistentry>
4318 </variablelist>
4319</refsect1>
4320<refsect1>
4321<title>Description</title>
4322<para>
4323   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4324   <parameter>condition</parameter> evaluates to true or a signal is received.
4325   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4326   </para><para>
4327
4328   <function>wake_up</function> has to be called after changing any variable that could
4329   change the result of the wait condition.
4330</para>
4331</refsect1>
4332<refsect1>
4333<title>Returns</title>
4334<para>
4335   0 if the <parameter>condition</parameter> evaluated to <constant>false</constant> after the <parameter>timeout</parameter> elapsed,
4336   1 if the <parameter>condition</parameter> evaluated to <constant>true</constant> after the <parameter>timeout</parameter> elapsed,
4337   the remaining jiffies (at least 1) if the <parameter>condition</parameter> evaluated
4338   to <constant>true</constant> before the <parameter>timeout</parameter> elapsed, or -<constant>ERESTARTSYS</constant> if it was
4339   interrupted by a signal.
4340</para>
4341</refsect1>
4342</refentry>
4343
4344<refentry id="API-wait-event-hrtimeout">
4345<refentryinfo>
4346 <title>LINUX</title>
4347 <productname>Kernel Hackers Manual</productname>
4348 <date>July 2017</date>
4349</refentryinfo>
4350<refmeta>
4351 <refentrytitle><phrase>wait_event_hrtimeout</phrase></refentrytitle>
4352 <manvolnum>9</manvolnum>
4353 <refmiscinfo class="version">4.4.14</refmiscinfo>
4354</refmeta>
4355<refnamediv>
4356 <refname>wait_event_hrtimeout</refname>
4357 <refpurpose>
4358     sleep until a condition gets true or a timeout elapses
4359 </refpurpose>
4360</refnamediv>
4361<refsynopsisdiv>
4362 <title>Synopsis</title>
4363  <funcsynopsis><funcprototype>
4364   <funcdef> <function>wait_event_hrtimeout </function></funcdef>
4365   <paramdef> <parameter>wq</parameter></paramdef>
4366   <paramdef> <parameter>condition</parameter></paramdef>
4367   <paramdef> <parameter>timeout</parameter></paramdef>
4368  </funcprototype></funcsynopsis>
4369</refsynopsisdiv>
4370<refsect1>
4371 <title>Arguments</title>
4372 <variablelist>
4373  <varlistentry>
4374   <term><parameter>wq</parameter></term>
4375   <listitem>
4376    <para>
4377     the waitqueue to wait on
4378    </para>
4379   </listitem>
4380  </varlistentry>
4381  <varlistentry>
4382   <term><parameter>condition</parameter></term>
4383   <listitem>
4384    <para>
4385     a C expression for the event to wait for
4386    </para>
4387   </listitem>
4388  </varlistentry>
4389  <varlistentry>
4390   <term><parameter>timeout</parameter></term>
4391   <listitem>
4392    <para>
4393     timeout, as a ktime_t
4394    </para>
4395   </listitem>
4396  </varlistentry>
4397 </variablelist>
4398</refsect1>
4399<refsect1>
4400<title>Description</title>
4401<para>
4402   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4403   <parameter>condition</parameter> evaluates to true or a signal is received.
4404   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4405   </para><para>
4406
4407   <function>wake_up</function> has to be called after changing any variable that could
4408   change the result of the wait condition.
4409   </para><para>
4410
4411   The function returns 0 if <parameter>condition</parameter> became true, or -ETIME if the timeout
4412   elapsed.
4413</para>
4414</refsect1>
4415</refentry>
4416
4417<refentry id="API-wait-event-interruptible-hrtimeout">
4418<refentryinfo>
4419 <title>LINUX</title>
4420 <productname>Kernel Hackers Manual</productname>
4421 <date>July 2017</date>
4422</refentryinfo>
4423<refmeta>
4424 <refentrytitle><phrase>wait_event_interruptible_hrtimeout</phrase></refentrytitle>
4425 <manvolnum>9</manvolnum>
4426 <refmiscinfo class="version">4.4.14</refmiscinfo>
4427</refmeta>
4428<refnamediv>
4429 <refname>wait_event_interruptible_hrtimeout</refname>
4430 <refpurpose>
4431     sleep until a condition gets true or a timeout elapses
4432 </refpurpose>
4433</refnamediv>
4434<refsynopsisdiv>
4435 <title>Synopsis</title>
4436  <funcsynopsis><funcprototype>
4437   <funcdef> <function>wait_event_interruptible_hrtimeout </function></funcdef>
4438   <paramdef> <parameter>wq</parameter></paramdef>
4439   <paramdef> <parameter>condition</parameter></paramdef>
4440   <paramdef> <parameter>timeout</parameter></paramdef>
4441  </funcprototype></funcsynopsis>
4442</refsynopsisdiv>
4443<refsect1>
4444 <title>Arguments</title>
4445 <variablelist>
4446  <varlistentry>
4447   <term><parameter>wq</parameter></term>
4448   <listitem>
4449    <para>
4450     the waitqueue to wait on
4451    </para>
4452   </listitem>
4453  </varlistentry>
4454  <varlistentry>
4455   <term><parameter>condition</parameter></term>
4456   <listitem>
4457    <para>
4458     a C expression for the event to wait for
4459    </para>
4460   </listitem>
4461  </varlistentry>
4462  <varlistentry>
4463   <term><parameter>timeout</parameter></term>
4464   <listitem>
4465    <para>
4466     timeout, as a ktime_t
4467    </para>
4468   </listitem>
4469  </varlistentry>
4470 </variablelist>
4471</refsect1>
4472<refsect1>
4473<title>Description</title>
4474<para>
4475   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4476   <parameter>condition</parameter> evaluates to true or a signal is received.
4477   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4478   </para><para>
4479
4480   <function>wake_up</function> has to be called after changing any variable that could
4481   change the result of the wait condition.
4482   </para><para>
4483
4484   The function returns 0 if <parameter>condition</parameter> became true, -ERESTARTSYS if it was
4485   interrupted by a signal, or -ETIME if the timeout elapsed.
4486</para>
4487</refsect1>
4488</refentry>
4489
4490<refentry id="API-wait-event-interruptible-locked">
4491<refentryinfo>
4492 <title>LINUX</title>
4493 <productname>Kernel Hackers Manual</productname>
4494 <date>July 2017</date>
4495</refentryinfo>
4496<refmeta>
4497 <refentrytitle><phrase>wait_event_interruptible_locked</phrase></refentrytitle>
4498 <manvolnum>9</manvolnum>
4499 <refmiscinfo class="version">4.4.14</refmiscinfo>
4500</refmeta>
4501<refnamediv>
4502 <refname>wait_event_interruptible_locked</refname>
4503 <refpurpose>
4504     sleep until a condition gets true
4505 </refpurpose>
4506</refnamediv>
4507<refsynopsisdiv>
4508 <title>Synopsis</title>
4509  <funcsynopsis><funcprototype>
4510   <funcdef> <function>wait_event_interruptible_locked </function></funcdef>
4511   <paramdef> <parameter>wq</parameter></paramdef>
4512   <paramdef> <parameter>condition</parameter></paramdef>
4513  </funcprototype></funcsynopsis>
4514</refsynopsisdiv>
4515<refsect1>
4516 <title>Arguments</title>
4517 <variablelist>
4518  <varlistentry>
4519   <term><parameter>wq</parameter></term>
4520   <listitem>
4521    <para>
4522     the waitqueue to wait on
4523    </para>
4524   </listitem>
4525  </varlistentry>
4526  <varlistentry>
4527   <term><parameter>condition</parameter></term>
4528   <listitem>
4529    <para>
4530     a C expression for the event to wait for
4531    </para>
4532   </listitem>
4533  </varlistentry>
4534 </variablelist>
4535</refsect1>
4536<refsect1>
4537<title>Description</title>
4538<para>
4539   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4540   <parameter>condition</parameter> evaluates to true or a signal is received.
4541   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4542   </para><para>
4543
4544   It must be called with wq.lock being held.  This spinlock is
4545   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4546   is held and when this macro exits the lock is held.
4547   </para><para>
4548
4549   The lock is locked/unlocked using <function>spin_lock</function>/<function>spin_unlock</function>
4550   functions which must match the way they are locked/unlocked outside
4551   of this macro.
4552   </para><para>
4553
4554   <function>wake_up_locked</function> has to be called after changing any variable that could
4555   change the result of the wait condition.
4556   </para><para>
4557
4558   The function will return -ERESTARTSYS if it was interrupted by a
4559   signal and 0 if <parameter>condition</parameter> evaluated to true.
4560</para>
4561</refsect1>
4562</refentry>
4563
4564<refentry id="API-wait-event-interruptible-locked-irq">
4565<refentryinfo>
4566 <title>LINUX</title>
4567 <productname>Kernel Hackers Manual</productname>
4568 <date>July 2017</date>
4569</refentryinfo>
4570<refmeta>
4571 <refentrytitle><phrase>wait_event_interruptible_locked_irq</phrase></refentrytitle>
4572 <manvolnum>9</manvolnum>
4573 <refmiscinfo class="version">4.4.14</refmiscinfo>
4574</refmeta>
4575<refnamediv>
4576 <refname>wait_event_interruptible_locked_irq</refname>
4577 <refpurpose>
4578     sleep until a condition gets true
4579 </refpurpose>
4580</refnamediv>
4581<refsynopsisdiv>
4582 <title>Synopsis</title>
4583  <funcsynopsis><funcprototype>
4584   <funcdef> <function>wait_event_interruptible_locked_irq </function></funcdef>
4585   <paramdef> <parameter>wq</parameter></paramdef>
4586   <paramdef> <parameter>condition</parameter></paramdef>
4587  </funcprototype></funcsynopsis>
4588</refsynopsisdiv>
4589<refsect1>
4590 <title>Arguments</title>
4591 <variablelist>
4592  <varlistentry>
4593   <term><parameter>wq</parameter></term>
4594   <listitem>
4595    <para>
4596     the waitqueue to wait on
4597    </para>
4598   </listitem>
4599  </varlistentry>
4600  <varlistentry>
4601   <term><parameter>condition</parameter></term>
4602   <listitem>
4603    <para>
4604     a C expression for the event to wait for
4605    </para>
4606   </listitem>
4607  </varlistentry>
4608 </variablelist>
4609</refsect1>
4610<refsect1>
4611<title>Description</title>
4612<para>
4613   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4614   <parameter>condition</parameter> evaluates to true or a signal is received.
4615   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4616   </para><para>
4617
4618   It must be called with wq.lock being held.  This spinlock is
4619   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4620   is held and when this macro exits the lock is held.
4621   </para><para>
4622
4623   The lock is locked/unlocked using <function>spin_lock_irq</function>/<function>spin_unlock_irq</function>
4624   functions which must match the way they are locked/unlocked outside
4625   of this macro.
4626   </para><para>
4627
4628   <function>wake_up_locked</function> has to be called after changing any variable that could
4629   change the result of the wait condition.
4630   </para><para>
4631
4632   The function will return -ERESTARTSYS if it was interrupted by a
4633   signal and 0 if <parameter>condition</parameter> evaluated to true.
4634</para>
4635</refsect1>
4636</refentry>
4637
4638<refentry id="API-wait-event-interruptible-exclusive-locked">
4639<refentryinfo>
4640 <title>LINUX</title>
4641 <productname>Kernel Hackers Manual</productname>
4642 <date>July 2017</date>
4643</refentryinfo>
4644<refmeta>
4645 <refentrytitle><phrase>wait_event_interruptible_exclusive_locked</phrase></refentrytitle>
4646 <manvolnum>9</manvolnum>
4647 <refmiscinfo class="version">4.4.14</refmiscinfo>
4648</refmeta>
4649<refnamediv>
4650 <refname>wait_event_interruptible_exclusive_locked</refname>
4651 <refpurpose>
4652     sleep exclusively until a condition gets true
4653 </refpurpose>
4654</refnamediv>
4655<refsynopsisdiv>
4656 <title>Synopsis</title>
4657  <funcsynopsis><funcprototype>
4658   <funcdef> <function>wait_event_interruptible_exclusive_locked </function></funcdef>
4659   <paramdef> <parameter>wq</parameter></paramdef>
4660   <paramdef> <parameter>condition</parameter></paramdef>
4661  </funcprototype></funcsynopsis>
4662</refsynopsisdiv>
4663<refsect1>
4664 <title>Arguments</title>
4665 <variablelist>
4666  <varlistentry>
4667   <term><parameter>wq</parameter></term>
4668   <listitem>
4669    <para>
4670     the waitqueue to wait on
4671    </para>
4672   </listitem>
4673  </varlistentry>
4674  <varlistentry>
4675   <term><parameter>condition</parameter></term>
4676   <listitem>
4677    <para>
4678     a C expression for the event to wait for
4679    </para>
4680   </listitem>
4681  </varlistentry>
4682 </variablelist>
4683</refsect1>
4684<refsect1>
4685<title>Description</title>
4686<para>
4687   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4688   <parameter>condition</parameter> evaluates to true or a signal is received.
4689   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4690   </para><para>
4691
4692   It must be called with wq.lock being held.  This spinlock is
4693   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4694   is held and when this macro exits the lock is held.
4695   </para><para>
4696
4697   The lock is locked/unlocked using <function>spin_lock</function>/<function>spin_unlock</function>
4698   functions which must match the way they are locked/unlocked outside
4699   of this macro.
4700   </para><para>
4701
4702   The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
4703   set thus when other process waits process on the list if this
4704   process is awaken further processes are not considered.
4705   </para><para>
4706
4707   <function>wake_up_locked</function> has to be called after changing any variable that could
4708   change the result of the wait condition.
4709   </para><para>
4710
4711   The function will return -ERESTARTSYS if it was interrupted by a
4712   signal and 0 if <parameter>condition</parameter> evaluated to true.
4713</para>
4714</refsect1>
4715</refentry>
4716
4717<refentry id="API-wait-event-interruptible-exclusive-locked-irq">
4718<refentryinfo>
4719 <title>LINUX</title>
4720 <productname>Kernel Hackers Manual</productname>
4721 <date>July 2017</date>
4722</refentryinfo>
4723<refmeta>
4724 <refentrytitle><phrase>wait_event_interruptible_exclusive_locked_irq</phrase></refentrytitle>
4725 <manvolnum>9</manvolnum>
4726 <refmiscinfo class="version">4.4.14</refmiscinfo>
4727</refmeta>
4728<refnamediv>
4729 <refname>wait_event_interruptible_exclusive_locked_irq</refname>
4730 <refpurpose>
4731     sleep until a condition gets true
4732 </refpurpose>
4733</refnamediv>
4734<refsynopsisdiv>
4735 <title>Synopsis</title>
4736  <funcsynopsis><funcprototype>
4737   <funcdef> <function>wait_event_interruptible_exclusive_locked_irq </function></funcdef>
4738   <paramdef> <parameter>wq</parameter></paramdef>
4739   <paramdef> <parameter>condition</parameter></paramdef>
4740  </funcprototype></funcsynopsis>
4741</refsynopsisdiv>
4742<refsect1>
4743 <title>Arguments</title>
4744 <variablelist>
4745  <varlistentry>
4746   <term><parameter>wq</parameter></term>
4747   <listitem>
4748    <para>
4749     the waitqueue to wait on
4750    </para>
4751   </listitem>
4752  </varlistentry>
4753  <varlistentry>
4754   <term><parameter>condition</parameter></term>
4755   <listitem>
4756    <para>
4757     a C expression for the event to wait for
4758    </para>
4759   </listitem>
4760  </varlistentry>
4761 </variablelist>
4762</refsect1>
4763<refsect1>
4764<title>Description</title>
4765<para>
4766   The process is put to sleep (TASK_INTERRUPTIBLE) until the
4767   <parameter>condition</parameter> evaluates to true or a signal is received.
4768   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4769   </para><para>
4770
4771   It must be called with wq.lock being held.  This spinlock is
4772   unlocked while sleeping but <parameter>condition</parameter> testing is done while lock
4773   is held and when this macro exits the lock is held.
4774   </para><para>
4775
4776   The lock is locked/unlocked using <function>spin_lock_irq</function>/<function>spin_unlock_irq</function>
4777   functions which must match the way they are locked/unlocked outside
4778   of this macro.
4779   </para><para>
4780
4781   The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
4782   set thus when other process waits process on the list if this
4783   process is awaken further processes are not considered.
4784   </para><para>
4785
4786   <function>wake_up_locked</function> has to be called after changing any variable that could
4787   change the result of the wait condition.
4788   </para><para>
4789
4790   The function will return -ERESTARTSYS if it was interrupted by a
4791   signal and 0 if <parameter>condition</parameter> evaluated to true.
4792</para>
4793</refsect1>
4794</refentry>
4795
4796<refentry id="API-wait-event-killable">
4797<refentryinfo>
4798 <title>LINUX</title>
4799 <productname>Kernel Hackers Manual</productname>
4800 <date>July 2017</date>
4801</refentryinfo>
4802<refmeta>
4803 <refentrytitle><phrase>wait_event_killable</phrase></refentrytitle>
4804 <manvolnum>9</manvolnum>
4805 <refmiscinfo class="version">4.4.14</refmiscinfo>
4806</refmeta>
4807<refnamediv>
4808 <refname>wait_event_killable</refname>
4809 <refpurpose>
4810     sleep until a condition gets true
4811 </refpurpose>
4812</refnamediv>
4813<refsynopsisdiv>
4814 <title>Synopsis</title>
4815  <funcsynopsis><funcprototype>
4816   <funcdef> <function>wait_event_killable </function></funcdef>
4817   <paramdef> <parameter>wq</parameter></paramdef>
4818   <paramdef> <parameter>condition</parameter></paramdef>
4819  </funcprototype></funcsynopsis>
4820</refsynopsisdiv>
4821<refsect1>
4822 <title>Arguments</title>
4823 <variablelist>
4824  <varlistentry>
4825   <term><parameter>wq</parameter></term>
4826   <listitem>
4827    <para>
4828     the waitqueue to wait on
4829    </para>
4830   </listitem>
4831  </varlistentry>
4832  <varlistentry>
4833   <term><parameter>condition</parameter></term>
4834   <listitem>
4835    <para>
4836     a C expression for the event to wait for
4837    </para>
4838   </listitem>
4839  </varlistentry>
4840 </variablelist>
4841</refsect1>
4842<refsect1>
4843<title>Description</title>
4844<para>
4845   The process is put to sleep (TASK_KILLABLE) until the
4846   <parameter>condition</parameter> evaluates to true or a signal is received.
4847   The <parameter>condition</parameter> is checked each time the waitqueue <parameter>wq</parameter> is woken up.
4848   </para><para>
4849
4850   <function>wake_up</function> has to be called after changing any variable that could
4851   change the result of the wait condition.
4852   </para><para>
4853
4854   The function will return -ERESTARTSYS if it was interrupted by a
4855   signal and 0 if <parameter>condition</parameter> evaluated to true.
4856</para>
4857</refsect1>
4858</refentry>
4859
4860<refentry id="API-wait-event-lock-irq-cmd">
4861<refentryinfo>
4862 <title>LINUX</title>
4863 <productname>Kernel Hackers Manual</productname>
4864 <date>July 2017</date>
4865</refentryinfo>
4866<refmeta>
4867 <refentrytitle><phrase>wait_event_lock_irq_cmd</phrase></refentrytitle>
4868 <manvolnum>9</manvolnum>
4869 <refmiscinfo class="version">4.4.14</refmiscinfo>
4870</refmeta>
4871<refnamediv>
4872 <refname>wait_event_lock_irq_cmd</refname>
4873 <refpurpose>
4874     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
4875 </refpurpose>
4876</refnamediv>
4877<refsynopsisdiv>
4878 <title>Synopsis</title>
4879  <funcsynopsis><funcprototype>
4880   <funcdef> <function>wait_event_lock_irq_cmd </function></funcdef>
4881   <paramdef> <parameter>wq</parameter></paramdef>
4882   <paramdef> <parameter>condition</parameter></paramdef>
4883   <paramdef> <parameter>lock</parameter></paramdef>
4884   <paramdef> <parameter>cmd</parameter></paramdef>
4885  </funcprototype></funcsynopsis>
4886</refsynopsisdiv>
4887<refsect1>
4888 <title>Arguments</title>
4889 <variablelist>
4890  <varlistentry>
4891   <term><parameter>wq</parameter></term>
4892   <listitem>
4893    <para>
4894     the waitqueue to wait on
4895    </para>
4896   </listitem>
4897  </varlistentry>
4898  <varlistentry>
4899   <term><parameter>condition</parameter></term>
4900   <listitem>
4901    <para>
4902     a C expression for the event to wait for
4903    </para>
4904   </listitem>
4905  </varlistentry>
4906  <varlistentry>
4907   <term><parameter>lock</parameter></term>
4908   <listitem>
4909    <para>
4910     a locked spinlock_t, which will be released before cmd
4911     and <function>schedule</function> and reacquired afterwards.
4912    </para>
4913   </listitem>
4914  </varlistentry>
4915  <varlistentry>
4916   <term><parameter>cmd</parameter></term>
4917   <listitem>
4918    <para>
4919     a command which is invoked outside the critical section before
4920     sleep
4921    </para>
4922   </listitem>
4923  </varlistentry>
4924 </variablelist>
4925</refsect1>
4926<refsect1>
4927<title>Description</title>
4928<para>
4929   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
4930   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
4931   the waitqueue <parameter>wq</parameter> is woken up.
4932   </para><para>
4933
4934   <function>wake_up</function> has to be called after changing any variable that could
4935   change the result of the wait condition.
4936   </para><para>
4937
4938   This is supposed to be called while holding the lock. The lock is
4939   dropped before invoking the cmd and going to sleep and is reacquired
4940   afterwards.
4941</para>
4942</refsect1>
4943</refentry>
4944
4945<refentry id="API-wait-event-lock-irq">
4946<refentryinfo>
4947 <title>LINUX</title>
4948 <productname>Kernel Hackers Manual</productname>
4949 <date>July 2017</date>
4950</refentryinfo>
4951<refmeta>
4952 <refentrytitle><phrase>wait_event_lock_irq</phrase></refentrytitle>
4953 <manvolnum>9</manvolnum>
4954 <refmiscinfo class="version">4.4.14</refmiscinfo>
4955</refmeta>
4956<refnamediv>
4957 <refname>wait_event_lock_irq</refname>
4958 <refpurpose>
4959     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
4960 </refpurpose>
4961</refnamediv>
4962<refsynopsisdiv>
4963 <title>Synopsis</title>
4964  <funcsynopsis><funcprototype>
4965   <funcdef> <function>wait_event_lock_irq </function></funcdef>
4966   <paramdef> <parameter>wq</parameter></paramdef>
4967   <paramdef> <parameter>condition</parameter></paramdef>
4968   <paramdef> <parameter>lock</parameter></paramdef>
4969  </funcprototype></funcsynopsis>
4970</refsynopsisdiv>
4971<refsect1>
4972 <title>Arguments</title>
4973 <variablelist>
4974  <varlistentry>
4975   <term><parameter>wq</parameter></term>
4976   <listitem>
4977    <para>
4978     the waitqueue to wait on
4979    </para>
4980   </listitem>
4981  </varlistentry>
4982  <varlistentry>
4983   <term><parameter>condition</parameter></term>
4984   <listitem>
4985    <para>
4986     a C expression for the event to wait for
4987    </para>
4988   </listitem>
4989  </varlistentry>
4990  <varlistentry>
4991   <term><parameter>lock</parameter></term>
4992   <listitem>
4993    <para>
4994     a locked spinlock_t, which will be released before <function>schedule</function>
4995     and reacquired afterwards.
4996    </para>
4997   </listitem>
4998  </varlistentry>
4999 </variablelist>
5000</refsect1>
5001<refsect1>
5002<title>Description</title>
5003<para>
5004   The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
5005   <parameter>condition</parameter> evaluates to true. The <parameter>condition</parameter> is checked each time
5006   the waitqueue <parameter>wq</parameter> is woken up.
5007   </para><para>
5008
5009   <function>wake_up</function> has to be called after changing any variable that could
5010   change the result of the wait condition.
5011   </para><para>
5012
5013   This is supposed to be called while holding the lock. The lock is
5014   dropped before going to sleep and is reacquired afterwards.
5015</para>
5016</refsect1>
5017</refentry>
5018
5019<refentry id="API-wait-event-interruptible-lock-irq-cmd">
5020<refentryinfo>
5021 <title>LINUX</title>
5022 <productname>Kernel Hackers Manual</productname>
5023 <date>July 2017</date>
5024</refentryinfo>
5025<refmeta>
5026 <refentrytitle><phrase>wait_event_interruptible_lock_irq_cmd</phrase></refentrytitle>
5027 <manvolnum>9</manvolnum>
5028 <refmiscinfo class="version">4.4.14</refmiscinfo>
5029</refmeta>
5030<refnamediv>
5031 <refname>wait_event_interruptible_lock_irq_cmd</refname>
5032 <refpurpose>
5033     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
5034 </refpurpose>
5035</refnamediv>
5036<refsynopsisdiv>
5037 <title>Synopsis</title>
5038  <funcsynopsis><funcprototype>
5039   <funcdef> <function>wait_event_interruptible_lock_irq_cmd </function></funcdef>
5040   <paramdef> <parameter>wq</parameter></paramdef>
5041   <paramdef> <parameter>condition</parameter></paramdef>
5042   <paramdef> <parameter>lock</parameter></paramdef>
5043   <paramdef> <parameter>cmd</parameter></paramdef>
5044  </funcprototype></funcsynopsis>
5045</refsynopsisdiv>
5046<refsect1>
5047 <title>Arguments</title>
5048 <variablelist>
5049  <varlistentry>
5050   <term><parameter>wq</parameter></term>
5051   <listitem>
5052    <para>
5053     the waitqueue to wait on
5054    </para>
5055   </listitem>
5056  </varlistentry>
5057  <varlistentry>
5058   <term><parameter>condition</parameter></term>
5059   <listitem>
5060    <para>
5061     a C expression for the event to wait for
5062    </para>
5063   </listitem>
5064  </varlistentry>
5065  <varlistentry>
5066   <term><parameter>lock</parameter></term>
5067   <listitem>
5068    <para>
5069     a locked spinlock_t, which will be released before cmd and
5070     <function>schedule</function> and reacquired afterwards.
5071    </para>
5072   </listitem>
5073  </varlistentry>
5074  <varlistentry>
5075   <term><parameter>cmd</parameter></term>
5076   <listitem>
5077    <para>
5078     a command which is invoked outside the critical section before
5079     sleep
5080    </para>
5081   </listitem>
5082  </varlistentry>
5083 </variablelist>
5084</refsect1>
5085<refsect1>
5086<title>Description</title>
5087<para>
5088   The process is put to sleep (TASK_INTERRUPTIBLE) until the
5089   <parameter>condition</parameter> evaluates to true or a signal is received. The <parameter>condition</parameter> is
5090   checked each time the waitqueue <parameter>wq</parameter> is woken up.
5091   </para><para>
5092
5093   <function>wake_up</function> has to be called after changing any variable that could
5094   change the result of the wait condition.
5095   </para><para>
5096
5097   This is supposed to be called while holding the lock. The lock is
5098   dropped before invoking the cmd and going to sleep and is reacquired
5099   afterwards.
5100   </para><para>
5101
5102   The macro will return -ERESTARTSYS if it was interrupted by a signal
5103   and 0 if <parameter>condition</parameter> evaluated to true.
5104</para>
5105</refsect1>
5106</refentry>
5107
5108<refentry id="API-wait-event-interruptible-lock-irq">
5109<refentryinfo>
5110 <title>LINUX</title>
5111 <productname>Kernel Hackers Manual</productname>
5112 <date>July 2017</date>
5113</refentryinfo>
5114<refmeta>
5115 <refentrytitle><phrase>wait_event_interruptible_lock_irq</phrase></refentrytitle>
5116 <manvolnum>9</manvolnum>
5117 <refmiscinfo class="version">4.4.14</refmiscinfo>
5118</refmeta>
5119<refnamediv>
5120 <refname>wait_event_interruptible_lock_irq</refname>
5121 <refpurpose>
5122     sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
5123 </refpurpose>
5124</refnamediv>
5125<refsynopsisdiv>
5126 <title>Synopsis</title>
5127  <funcsynopsis><funcprototype>
5128   <funcdef> <function>wait_event_interruptible_lock_irq </function></funcdef>
5129   <paramdef> <parameter>wq</parameter></paramdef>
5130   <paramdef> <parameter>condition</parameter></paramdef>
5131   <paramdef> <parameter>lock</parameter></paramdef>
5132  </funcprototype></funcsynopsis>
5133</refsynopsisdiv>
5134<refsect1>
5135 <title>Arguments</title>
5136 <variablelist>
5137  <varlistentry>
5138   <term><parameter>wq</parameter></term>
5139   <listitem>
5140    <para>
5141     the waitqueue to wait on
5142    </para>
5143   </listitem>
5144  </varlistentry>
5145  <varlistentry>
5146   <term><parameter>condition</parameter></term>
5147   <listitem>
5148    <para>
5149     a C expression for the event to wait for
5150    </para>
5151   </listitem>
5152  </varlistentry>
5153  <varlistentry>
5154   <term><parameter>lock</parameter></term>
5155   <listitem>
5156    <para>
5157     a locked spinlock_t, which will be released before <function>schedule</function>
5158     and reacquired afterwards.
5159    </para>
5160   </listitem>
5161  </varlistentry>
5162 </variablelist>
5163</refsect1>
5164<refsect1>
5165<title>Description</title>
5166<para>
5167   The process is put to sleep (TASK_INTERRUPTIBLE) until the
5168   <parameter>condition</parameter> evaluates to true or signal is received. The <parameter>condition</parameter> is
5169   checked each time the waitqueue <parameter>wq</parameter> is woken up.
5170   </para><para>
5171
5172   <function>wake_up</function> has to be called after changing any variable that could
5173   change the result of the wait condition.
5174   </para><para>
5175
5176   This is supposed to be called while holding the lock. The lock is
5177   dropped before going to sleep and is reacquired afterwards.
5178   </para><para>
5179
5180   The macro will return -ERESTARTSYS if it was interrupted by a signal
5181   and 0 if <parameter>condition</parameter> evaluated to true.
5182</para>
5183</refsect1>
5184</refentry>
5185
5186<refentry id="API-wait-event-interruptible-lock-irq-timeout">
5187<refentryinfo>
5188 <title>LINUX</title>
5189 <productname>Kernel Hackers Manual</productname>
5190 <date>July 2017</date>
5191</refentryinfo>
5192<refmeta>
5193 <refentrytitle><phrase>wait_event_interruptible_lock_irq_timeout</phrase></refentrytitle>
5194 <manvolnum>9</manvolnum>
5195 <refmiscinfo class="version">4.4.14</refmiscinfo>
5196</refmeta>
5197<refnamediv>
5198 <refname>wait_event_interruptible_lock_irq_timeout</refname>
5199 <refpurpose>
5200     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.
5201 </refpurpose>
5202</refnamediv>
5203<refsynopsisdiv>
5204 <title>Synopsis</title>
5205  <funcsynopsis><funcprototype>
5206   <funcdef> <function>wait_event_interruptible_lock_irq_timeout </function></funcdef>
5207   <paramdef> <parameter>wq</parameter></paramdef>
5208   <paramdef> <parameter>condition</parameter></paramdef>
5209   <paramdef> <parameter>lock</parameter></paramdef>
5210   <paramdef> <parameter>timeout</parameter></paramdef>
5211  </funcprototype></funcsynopsis>
5212</refsynopsisdiv>
5213<refsect1>
5214 <title>Arguments</title>
5215 <variablelist>
5216  <varlistentry>
5217   <term><parameter>wq</parameter></term>
5218   <listitem>
5219    <para>
5220     the waitqueue to wait on
5221    </para>
5222   </listitem>
5223  </varlistentry>
5224  <varlistentry>
5225   <term><parameter>condition</parameter></term>
5226   <listitem>
5227    <para>
5228     a C expression for the event to wait for
5229    </para>
5230   </listitem>
5231  </varlistentry>
5232  <varlistentry>
5233   <term><parameter>lock</parameter></term>
5234   <listitem>
5235    <para>
5236     a locked spinlock_t, which will be released before <function>schedule</function>
5237     and reacquired afterwards.
5238    </para>
5239   </listitem>
5240  </varlistentry>
5241  <varlistentry>
5242   <term><parameter>timeout</parameter></term>
5243   <listitem>
5244    <para>
5245     timeout, in jiffies
5246    </para>
5247   </listitem>
5248  </varlistentry>
5249 </variablelist>
5250</refsect1>
5251<refsect1>
5252<title>Description</title>
5253<para>
5254   The process is put to sleep (TASK_INTERRUPTIBLE) until the
5255   <parameter>condition</parameter> evaluates to true or signal is received. The <parameter>condition</parameter> is
5256   checked each time the waitqueue <parameter>wq</parameter> is woken up.
5257   </para><para>
5258
5259   <function>wake_up</function> has to be called after changing any variable that could
5260   change the result of the wait condition.
5261   </para><para>
5262
5263   This is supposed to be called while holding the lock. The lock is
5264   dropped before going to sleep and is reacquired afterwards.
5265   </para><para>
5266
5267   The function returns 0 if the <parameter>timeout</parameter> elapsed, -ERESTARTSYS if it
5268   was interrupted by a signal, and the remaining jiffies otherwise
5269   if the condition evaluated to true before the timeout elapsed.
5270</para>
5271</refsect1>
5272</refentry>
5273
5274<refentry id="API-wait-on-bit">
5275<refentryinfo>
5276 <title>LINUX</title>
5277 <productname>Kernel Hackers Manual</productname>
5278 <date>July 2017</date>
5279</refentryinfo>
5280<refmeta>
5281 <refentrytitle><phrase>wait_on_bit</phrase></refentrytitle>
5282 <manvolnum>9</manvolnum>
5283 <refmiscinfo class="version">4.4.14</refmiscinfo>
5284</refmeta>
5285<refnamediv>
5286 <refname>wait_on_bit</refname>
5287 <refpurpose>
5288     wait for a bit to be cleared
5289 </refpurpose>
5290</refnamediv>
5291<refsynopsisdiv>
5292 <title>Synopsis</title>
5293  <funcsynopsis><funcprototype>
5294   <funcdef>int <function>wait_on_bit </function></funcdef>
5295   <paramdef>unsigned long * <parameter>word</parameter></paramdef>
5296   <paramdef>int <parameter>bit</parameter></paramdef>
5297   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5298  </funcprototype></funcsynopsis>
5299</refsynopsisdiv>
5300<refsect1>
5301 <title>Arguments</title>
5302 <variablelist>
5303  <varlistentry>
5304   <term><parameter>word</parameter></term>
5305   <listitem>
5306    <para>
5307     the word being waited on, a kernel virtual address
5308    </para>
5309   </listitem>
5310  </varlistentry>
5311  <varlistentry>
5312   <term><parameter>bit</parameter></term>
5313   <listitem>
5314    <para>
5315     the bit of the word being waited on
5316    </para>
5317   </listitem>
5318  </varlistentry>
5319  <varlistentry>
5320   <term><parameter>mode</parameter></term>
5321   <listitem>
5322    <para>
5323     the task state to sleep in
5324    </para>
5325   </listitem>
5326  </varlistentry>
5327 </variablelist>
5328</refsect1>
5329<refsect1>
5330<title>Description</title>
5331<para>
5332   There is a standard hashed waitqueue table for generic use. This
5333   is the part of the hashtable's accessor API that waits on a bit.
5334   For instance, if one were to have waiters on a bitflag, one would
5335   call <function><link linkend="API-wait-on-bit">wait_on_bit</link></function> in threads waiting for the bit to clear.
5336   One uses <function><link linkend="API-wait-on-bit">wait_on_bit</link></function> where one is waiting for the bit to clear,
5337   but has no intention of setting it.
5338   Returned value will be zero if the bit was cleared, or non-zero
5339   if the process received a signal and the mode permitted wakeup
5340   on that signal.
5341</para>
5342</refsect1>
5343</refentry>
5344
5345<refentry id="API-wait-on-bit-io">
5346<refentryinfo>
5347 <title>LINUX</title>
5348 <productname>Kernel Hackers Manual</productname>
5349 <date>July 2017</date>
5350</refentryinfo>
5351<refmeta>
5352 <refentrytitle><phrase>wait_on_bit_io</phrase></refentrytitle>
5353 <manvolnum>9</manvolnum>
5354 <refmiscinfo class="version">4.4.14</refmiscinfo>
5355</refmeta>
5356<refnamediv>
5357 <refname>wait_on_bit_io</refname>
5358 <refpurpose>
5359     wait for a bit to be cleared
5360 </refpurpose>
5361</refnamediv>
5362<refsynopsisdiv>
5363 <title>Synopsis</title>
5364  <funcsynopsis><funcprototype>
5365   <funcdef>int <function>wait_on_bit_io </function></funcdef>
5366   <paramdef>unsigned long * <parameter>word</parameter></paramdef>
5367   <paramdef>int <parameter>bit</parameter></paramdef>
5368   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5369  </funcprototype></funcsynopsis>
5370</refsynopsisdiv>
5371<refsect1>
5372 <title>Arguments</title>
5373 <variablelist>
5374  <varlistentry>
5375   <term><parameter>word</parameter></term>
5376   <listitem>
5377    <para>
5378     the word being waited on, a kernel virtual address
5379    </para>
5380   </listitem>
5381  </varlistentry>
5382  <varlistentry>
5383   <term><parameter>bit</parameter></term>
5384   <listitem>
5385    <para>
5386     the bit of the word being waited on
5387    </para>
5388   </listitem>
5389  </varlistentry>
5390  <varlistentry>
5391   <term><parameter>mode</parameter></term>
5392   <listitem>
5393    <para>
5394     the task state to sleep in
5395    </para>
5396   </listitem>
5397  </varlistentry>
5398 </variablelist>
5399</refsect1>
5400<refsect1>
5401<title>Description</title>
5402<para>
5403   Use the standard hashed waitqueue table to wait for a bit
5404   to be cleared.  This is similar to <function><link linkend="API-wait-on-bit">wait_on_bit</link></function>, but calls
5405   <function>io_schedule</function> instead of <function>schedule</function> for the actual waiting.
5406   </para><para>
5407
5408   Returned value will be zero if the bit was cleared, or non-zero
5409   if the process received a signal and the mode permitted wakeup
5410   on that signal.
5411</para>
5412</refsect1>
5413</refentry>
5414
5415<refentry id="API-wait-on-bit-timeout">
5416<refentryinfo>
5417 <title>LINUX</title>
5418 <productname>Kernel Hackers Manual</productname>
5419 <date>July 2017</date>
5420</refentryinfo>
5421<refmeta>
5422 <refentrytitle><phrase>wait_on_bit_timeout</phrase></refentrytitle>
5423 <manvolnum>9</manvolnum>
5424 <refmiscinfo class="version">4.4.14</refmiscinfo>
5425</refmeta>
5426<refnamediv>
5427 <refname>wait_on_bit_timeout</refname>
5428 <refpurpose>
5429     wait for a bit to be cleared or a timeout elapses
5430 </refpurpose>
5431</refnamediv>
5432<refsynopsisdiv>
5433 <title>Synopsis</title>
5434  <funcsynopsis><funcprototype>
5435   <funcdef>int <function>wait_on_bit_timeout </function></funcdef>
5436   <paramdef>unsigned long * <parameter>word</parameter></paramdef>
5437   <paramdef>int <parameter>bit</parameter></paramdef>
5438   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5439   <paramdef>unsigned long <parameter>timeout</parameter></paramdef>
5440  </funcprototype></funcsynopsis>
5441</refsynopsisdiv>
5442<refsect1>
5443 <title>Arguments</title>
5444 <variablelist>
5445  <varlistentry>
5446   <term><parameter>word</parameter></term>
5447   <listitem>
5448    <para>
5449     the word being waited on, a kernel virtual address
5450    </para>
5451   </listitem>
5452  </varlistentry>
5453  <varlistentry>
5454   <term><parameter>bit</parameter></term>
5455   <listitem>
5456    <para>
5457     the bit of the word being waited on
5458    </para>
5459   </listitem>
5460  </varlistentry>
5461  <varlistentry>
5462   <term><parameter>mode</parameter></term>
5463   <listitem>
5464    <para>
5465     the task state to sleep in
5466    </para>
5467   </listitem>
5468  </varlistentry>
5469  <varlistentry>
5470   <term><parameter>timeout</parameter></term>
5471   <listitem>
5472    <para>
5473     timeout, in jiffies
5474    </para>
5475   </listitem>
5476  </varlistentry>
5477 </variablelist>
5478</refsect1>
5479<refsect1>
5480<title>Description</title>
5481<para>
5482   Use the standard hashed waitqueue table to wait for a bit
5483   to be cleared. This is similar to <function><link linkend="API-wait-on-bit">wait_on_bit</link></function>, except also takes a
5484   timeout parameter.
5485   </para><para>
5486
5487   Returned value will be zero if the bit was cleared before the
5488   <parameter>timeout</parameter> elapsed, or non-zero if the <parameter>timeout</parameter> elapsed or process
5489   received a signal and the mode permitted wakeup on that signal.
5490</para>
5491</refsect1>
5492</refentry>
5493
5494<refentry id="API-wait-on-bit-action">
5495<refentryinfo>
5496 <title>LINUX</title>
5497 <productname>Kernel Hackers Manual</productname>
5498 <date>July 2017</date>
5499</refentryinfo>
5500<refmeta>
5501 <refentrytitle><phrase>wait_on_bit_action</phrase></refentrytitle>
5502 <manvolnum>9</manvolnum>
5503 <refmiscinfo class="version">4.4.14</refmiscinfo>
5504</refmeta>
5505<refnamediv>
5506 <refname>wait_on_bit_action</refname>
5507 <refpurpose>
5508     wait for a bit to be cleared
5509 </refpurpose>
5510</refnamediv>
5511<refsynopsisdiv>
5512 <title>Synopsis</title>
5513  <funcsynopsis><funcprototype>
5514   <funcdef>int <function>wait_on_bit_action </function></funcdef>
5515   <paramdef>unsigned long * <parameter>word</parameter></paramdef>
5516   <paramdef>int <parameter>bit</parameter></paramdef>
5517   <paramdef>wait_bit_action_f * <parameter>action</parameter></paramdef>
5518   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5519  </funcprototype></funcsynopsis>
5520</refsynopsisdiv>
5521<refsect1>
5522 <title>Arguments</title>
5523 <variablelist>
5524  <varlistentry>
5525   <term><parameter>word</parameter></term>
5526   <listitem>
5527    <para>
5528     the word being waited on, a kernel virtual address
5529    </para>
5530   </listitem>
5531  </varlistentry>
5532  <varlistentry>
5533   <term><parameter>bit</parameter></term>
5534   <listitem>
5535    <para>
5536     the bit of the word being waited on
5537    </para>
5538   </listitem>
5539  </varlistentry>
5540  <varlistentry>
5541   <term><parameter>action</parameter></term>
5542   <listitem>
5543    <para>
5544     the function used to sleep, which may take special actions
5545    </para>
5546   </listitem>
5547  </varlistentry>
5548  <varlistentry>
5549   <term><parameter>mode</parameter></term>
5550   <listitem>
5551    <para>
5552     the task state to sleep in
5553    </para>
5554   </listitem>
5555  </varlistentry>
5556 </variablelist>
5557</refsect1>
5558<refsect1>
5559<title>Description</title>
5560<para>
5561   Use the standard hashed waitqueue table to wait for a bit
5562   to be cleared, and allow the waiting action to be specified.
5563   This is like <function><link linkend="API-wait-on-bit">wait_on_bit</link></function> but allows fine control of how the waiting
5564   is done.
5565   </para><para>
5566
5567   Returned value will be zero if the bit was cleared, or non-zero
5568   if the process received a signal and the mode permitted wakeup
5569   on that signal.
5570</para>
5571</refsect1>
5572</refentry>
5573
5574<refentry id="API-wait-on-bit-lock">
5575<refentryinfo>
5576 <title>LINUX</title>
5577 <productname>Kernel Hackers Manual</productname>
5578 <date>July 2017</date>
5579</refentryinfo>
5580<refmeta>
5581 <refentrytitle><phrase>wait_on_bit_lock</phrase></refentrytitle>
5582 <manvolnum>9</manvolnum>
5583 <refmiscinfo class="version">4.4.14</refmiscinfo>
5584</refmeta>
5585<refnamediv>
5586 <refname>wait_on_bit_lock</refname>
5587 <refpurpose>
5588     wait for a bit to be cleared, when wanting to set it
5589 </refpurpose>
5590</refnamediv>
5591<refsynopsisdiv>
5592 <title>Synopsis</title>
5593  <funcsynopsis><funcprototype>
5594   <funcdef>int <function>wait_on_bit_lock </function></funcdef>
5595   <paramdef>unsigned long * <parameter>word</parameter></paramdef>
5596   <paramdef>int <parameter>bit</parameter></paramdef>
5597   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5598  </funcprototype></funcsynopsis>
5599</refsynopsisdiv>
5600<refsect1>
5601 <title>Arguments</title>
5602 <variablelist>
5603  <varlistentry>
5604   <term><parameter>word</parameter></term>
5605   <listitem>
5606    <para>
5607     the word being waited on, a kernel virtual address
5608    </para>
5609   </listitem>
5610  </varlistentry>
5611  <varlistentry>
5612   <term><parameter>bit</parameter></term>
5613   <listitem>
5614    <para>
5615     the bit of the word being waited on
5616    </para>
5617   </listitem>
5618  </varlistentry>
5619  <varlistentry>
5620   <term><parameter>mode</parameter></term>
5621   <listitem>
5622    <para>
5623     the task state to sleep in
5624    </para>
5625   </listitem>
5626  </varlistentry>
5627 </variablelist>
5628</refsect1>
5629<refsect1>
5630<title>Description</title>
5631<para>
5632   There is a standard hashed waitqueue table for generic use. This
5633   is the part of the hashtable's accessor API that waits on a bit
5634   when one intends to set it, for instance, trying to lock bitflags.
5635   For instance, if one were to have waiters trying to set bitflag
5636   and waiting for it to clear before setting it, one would call
5637   <function><link linkend="API-wait-on-bit">wait_on_bit</link></function> in threads waiting to be able to set the bit.
5638   One uses <function><link linkend="API-wait-on-bit-lock">wait_on_bit_lock</link></function> where one is waiting for the bit to
5639   clear with the intention of setting it, and when done, clearing it.
5640   </para><para>
5641
5642   Returns zero if the bit was (eventually) found to be clear and was
5643   set.  Returns non-zero if a signal was delivered to the process and
5644   the <parameter>mode</parameter> allows that signal to wake the process.
5645</para>
5646</refsect1>
5647</refentry>
5648
5649<refentry id="API-wait-on-bit-lock-io">
5650<refentryinfo>
5651 <title>LINUX</title>
5652 <productname>Kernel Hackers Manual</productname>
5653 <date>July 2017</date>
5654</refentryinfo>
5655<refmeta>
5656 <refentrytitle><phrase>wait_on_bit_lock_io</phrase></refentrytitle>
5657 <manvolnum>9</manvolnum>
5658 <refmiscinfo class="version">4.4.14</refmiscinfo>
5659</refmeta>
5660<refnamediv>
5661 <refname>wait_on_bit_lock_io</refname>
5662 <refpurpose>
5663     wait for a bit to be cleared, when wanting to set it
5664 </refpurpose>
5665</refnamediv>
5666<refsynopsisdiv>
5667 <title>Synopsis</title>
5668  <funcsynopsis><funcprototype>
5669   <funcdef>int <function>wait_on_bit_lock_io </function></funcdef>
5670   <paramdef>unsigned long * <parameter>word</parameter></paramdef>
5671   <paramdef>int <parameter>bit</parameter></paramdef>
5672   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5673  </funcprototype></funcsynopsis>
5674</refsynopsisdiv>
5675<refsect1>
5676 <title>Arguments</title>
5677 <variablelist>
5678  <varlistentry>
5679   <term><parameter>word</parameter></term>
5680   <listitem>
5681    <para>
5682     the word being waited on, a kernel virtual address
5683    </para>
5684   </listitem>
5685  </varlistentry>
5686  <varlistentry>
5687   <term><parameter>bit</parameter></term>
5688   <listitem>
5689    <para>
5690     the bit of the word being waited on
5691    </para>
5692   </listitem>
5693  </varlistentry>
5694  <varlistentry>
5695   <term><parameter>mode</parameter></term>
5696   <listitem>
5697    <para>
5698     the task state to sleep in
5699    </para>
5700   </listitem>
5701  </varlistentry>
5702 </variablelist>
5703</refsect1>
5704<refsect1>
5705<title>Description</title>
5706<para>
5707   Use the standard hashed waitqueue table to wait for a bit
5708   to be cleared and then to atomically set it.  This is similar
5709   to <function><link linkend="API-wait-on-bit">wait_on_bit</link></function>, but calls <function>io_schedule</function> instead of <function>schedule</function>
5710   for the actual waiting.
5711   </para><para>
5712
5713   Returns zero if the bit was (eventually) found to be clear and was
5714   set.  Returns non-zero if a signal was delivered to the process and
5715   the <parameter>mode</parameter> allows that signal to wake the process.
5716</para>
5717</refsect1>
5718</refentry>
5719
5720<refentry id="API-wait-on-bit-lock-action">
5721<refentryinfo>
5722 <title>LINUX</title>
5723 <productname>Kernel Hackers Manual</productname>
5724 <date>July 2017</date>
5725</refentryinfo>
5726<refmeta>
5727 <refentrytitle><phrase>wait_on_bit_lock_action</phrase></refentrytitle>
5728 <manvolnum>9</manvolnum>
5729 <refmiscinfo class="version">4.4.14</refmiscinfo>
5730</refmeta>
5731<refnamediv>
5732 <refname>wait_on_bit_lock_action</refname>
5733 <refpurpose>
5734     wait for a bit to be cleared, when wanting to set it
5735 </refpurpose>
5736</refnamediv>
5737<refsynopsisdiv>
5738 <title>Synopsis</title>
5739  <funcsynopsis><funcprototype>
5740   <funcdef>int <function>wait_on_bit_lock_action </function></funcdef>
5741   <paramdef>unsigned long * <parameter>word</parameter></paramdef>
5742   <paramdef>int <parameter>bit</parameter></paramdef>
5743   <paramdef>wait_bit_action_f * <parameter>action</parameter></paramdef>
5744   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5745  </funcprototype></funcsynopsis>
5746</refsynopsisdiv>
5747<refsect1>
5748 <title>Arguments</title>
5749 <variablelist>
5750  <varlistentry>
5751   <term><parameter>word</parameter></term>
5752   <listitem>
5753    <para>
5754     the word being waited on, a kernel virtual address
5755    </para>
5756   </listitem>
5757  </varlistentry>
5758  <varlistentry>
5759   <term><parameter>bit</parameter></term>
5760   <listitem>
5761    <para>
5762     the bit of the word being waited on
5763    </para>
5764   </listitem>
5765  </varlistentry>
5766  <varlistentry>
5767   <term><parameter>action</parameter></term>
5768   <listitem>
5769    <para>
5770     the function used to sleep, which may take special actions
5771    </para>
5772   </listitem>
5773  </varlistentry>
5774  <varlistentry>
5775   <term><parameter>mode</parameter></term>
5776   <listitem>
5777    <para>
5778     the task state to sleep in
5779    </para>
5780   </listitem>
5781  </varlistentry>
5782 </variablelist>
5783</refsect1>
5784<refsect1>
5785<title>Description</title>
5786<para>
5787   Use the standard hashed waitqueue table to wait for a bit
5788   to be cleared and then to set it, and allow the waiting action
5789   to be specified.
5790   This is like <function><link linkend="API-wait-on-bit">wait_on_bit</link></function> but allows fine control of how the waiting
5791   is done.
5792   </para><para>
5793
5794   Returns zero if the bit was (eventually) found to be clear and was
5795   set.  Returns non-zero if a signal was delivered to the process and
5796   the <parameter>mode</parameter> allows that signal to wake the process.
5797</para>
5798</refsect1>
5799</refentry>
5800
5801<refentry id="API-wait-on-atomic-t">
5802<refentryinfo>
5803 <title>LINUX</title>
5804 <productname>Kernel Hackers Manual</productname>
5805 <date>July 2017</date>
5806</refentryinfo>
5807<refmeta>
5808 <refentrytitle><phrase>wait_on_atomic_t</phrase></refentrytitle>
5809 <manvolnum>9</manvolnum>
5810 <refmiscinfo class="version">4.4.14</refmiscinfo>
5811</refmeta>
5812<refnamediv>
5813 <refname>wait_on_atomic_t</refname>
5814 <refpurpose>
5815     Wait for an atomic_t to become 0
5816 </refpurpose>
5817</refnamediv>
5818<refsynopsisdiv>
5819 <title>Synopsis</title>
5820  <funcsynopsis><funcprototype>
5821   <funcdef>int <function>wait_on_atomic_t </function></funcdef>
5822   <paramdef>atomic_t * <parameter>val</parameter></paramdef>
5823   <paramdef>int (*<parameter>action</parameter>)
5824     <funcparams>atomic_t *</funcparams></paramdef>
5825   <paramdef>unsigned <parameter>mode</parameter></paramdef>
5826  </funcprototype></funcsynopsis>
5827</refsynopsisdiv>
5828<refsect1>
5829 <title>Arguments</title>
5830 <variablelist>
5831  <varlistentry>
5832   <term><parameter>val</parameter></term>
5833   <listitem>
5834    <para>
5835     The atomic value being waited on, a kernel virtual address
5836    </para>
5837   </listitem>
5838  </varlistentry>
5839  <varlistentry>
5840   <term><parameter>action</parameter></term>
5841   <listitem>
5842    <para>
5843     the function used to sleep, which may take special actions
5844    </para>
5845   </listitem>
5846  </varlistentry>
5847  <varlistentry>
5848   <term><parameter>mode</parameter></term>
5849   <listitem>
5850    <para>
5851     the task state to sleep in
5852    </para>
5853   </listitem>
5854  </varlistentry>
5855 </variablelist>
5856</refsect1>
5857<refsect1>
5858<title>Description</title>
5859<para>
5860   Wait for an atomic_t to become 0.  We abuse the bit-wait waitqueue table for
5861   the purpose of getting a waitqueue, but we set the key to a bit number
5862   outside of the target 'word'.
5863</para>
5864</refsect1>
5865</refentry>
5866
5867<!-- kernel/sched/wait.c -->
5868<refentry id="API---wake-up">
5869<refentryinfo>
5870 <title>LINUX</title>
5871 <productname>Kernel Hackers Manual</productname>
5872 <date>July 2017</date>
5873</refentryinfo>
5874<refmeta>
5875 <refentrytitle><phrase>__wake_up</phrase></refentrytitle>
5876 <manvolnum>9</manvolnum>
5877 <refmiscinfo class="version">4.4.14</refmiscinfo>
5878</refmeta>
5879<refnamediv>
5880 <refname>__wake_up</refname>
5881 <refpurpose>
5882  wake up threads blocked on a waitqueue.
5883 </refpurpose>
5884</refnamediv>
5885<refsynopsisdiv>
5886 <title>Synopsis</title>
5887  <funcsynopsis><funcprototype>
5888   <funcdef>void <function>__wake_up </function></funcdef>
5889   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
5890   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
5891   <paramdef>int <parameter>nr_exclusive</parameter></paramdef>
5892   <paramdef>void * <parameter>key</parameter></paramdef>
5893  </funcprototype></funcsynopsis>
5894</refsynopsisdiv>
5895<refsect1>
5896 <title>Arguments</title>
5897 <variablelist>
5898  <varlistentry>
5899   <term><parameter>q</parameter></term>
5900   <listitem>
5901    <para>
5902     the waitqueue
5903    </para>
5904   </listitem>
5905  </varlistentry>
5906  <varlistentry>
5907   <term><parameter>mode</parameter></term>
5908   <listitem>
5909    <para>
5910     which threads
5911    </para>
5912   </listitem>
5913  </varlistentry>
5914  <varlistentry>
5915   <term><parameter>nr_exclusive</parameter></term>
5916   <listitem>
5917    <para>
5918     how many wake-one or wake-many threads to wake up
5919    </para>
5920   </listitem>
5921  </varlistentry>
5922  <varlistentry>
5923   <term><parameter>key</parameter></term>
5924   <listitem>
5925    <para>
5926     is directly passed to the wakeup function
5927    </para>
5928   </listitem>
5929  </varlistentry>
5930 </variablelist>
5931</refsect1>
5932<refsect1>
5933<title>Description</title>
5934<para>
5935   It may be assumed that this function implies a write memory barrier before
5936   changing the task state if and only if any tasks are woken up.
5937</para>
5938</refsect1>
5939</refentry>
5940
5941<refentry id="API---wake-up-sync-key">
5942<refentryinfo>
5943 <title>LINUX</title>
5944 <productname>Kernel Hackers Manual</productname>
5945 <date>July 2017</date>
5946</refentryinfo>
5947<refmeta>
5948 <refentrytitle><phrase>__wake_up_sync_key</phrase></refentrytitle>
5949 <manvolnum>9</manvolnum>
5950 <refmiscinfo class="version">4.4.14</refmiscinfo>
5951</refmeta>
5952<refnamediv>
5953 <refname>__wake_up_sync_key</refname>
5954 <refpurpose>
5955     wake up threads blocked on a waitqueue.
5956 </refpurpose>
5957</refnamediv>
5958<refsynopsisdiv>
5959 <title>Synopsis</title>
5960  <funcsynopsis><funcprototype>
5961   <funcdef>void <function>__wake_up_sync_key </function></funcdef>
5962   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
5963   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
5964   <paramdef>int <parameter>nr_exclusive</parameter></paramdef>
5965   <paramdef>void * <parameter>key</parameter></paramdef>
5966  </funcprototype></funcsynopsis>
5967</refsynopsisdiv>
5968<refsect1>
5969 <title>Arguments</title>
5970 <variablelist>
5971  <varlistentry>
5972   <term><parameter>q</parameter></term>
5973   <listitem>
5974    <para>
5975     the waitqueue
5976    </para>
5977   </listitem>
5978  </varlistentry>
5979  <varlistentry>
5980   <term><parameter>mode</parameter></term>
5981   <listitem>
5982    <para>
5983     which threads
5984    </para>
5985   </listitem>
5986  </varlistentry>
5987  <varlistentry>
5988   <term><parameter>nr_exclusive</parameter></term>
5989   <listitem>
5990    <para>
5991     how many wake-one or wake-many threads to wake up
5992    </para>
5993   </listitem>
5994  </varlistentry>
5995  <varlistentry>
5996   <term><parameter>key</parameter></term>
5997   <listitem>
5998    <para>
5999     opaque value to be passed to wakeup targets
6000    </para>
6001   </listitem>
6002  </varlistentry>
6003 </variablelist>
6004</refsect1>
6005<refsect1>
6006<title>Description</title>
6007<para>
6008   The sync wakeup differs that the waker knows that it will schedule
6009   away soon, so while the target thread will be woken up, it will not
6010   be migrated to another CPU - ie. the two threads are 'synchronized'
6011   with each other. This can prevent needless bouncing between CPUs.
6012   </para><para>
6013
6014   On UP it can prevent extra preemption.
6015   </para><para>
6016
6017   It may be assumed that this function implies a write memory barrier before
6018   changing the task state if and only if any tasks are woken up.
6019</para>
6020</refsect1>
6021</refentry>
6022
6023<refentry id="API-finish-wait">
6024<refentryinfo>
6025 <title>LINUX</title>
6026 <productname>Kernel Hackers Manual</productname>
6027 <date>July 2017</date>
6028</refentryinfo>
6029<refmeta>
6030 <refentrytitle><phrase>finish_wait</phrase></refentrytitle>
6031 <manvolnum>9</manvolnum>
6032 <refmiscinfo class="version">4.4.14</refmiscinfo>
6033</refmeta>
6034<refnamediv>
6035 <refname>finish_wait</refname>
6036 <refpurpose>
6037     clean up after waiting in a queue
6038 </refpurpose>
6039</refnamediv>
6040<refsynopsisdiv>
6041 <title>Synopsis</title>
6042  <funcsynopsis><funcprototype>
6043   <funcdef>void <function>finish_wait </function></funcdef>
6044   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
6045   <paramdef>wait_queue_t * <parameter>wait</parameter></paramdef>
6046  </funcprototype></funcsynopsis>
6047</refsynopsisdiv>
6048<refsect1>
6049 <title>Arguments</title>
6050 <variablelist>
6051  <varlistentry>
6052   <term><parameter>q</parameter></term>
6053   <listitem>
6054    <para>
6055     waitqueue waited on
6056    </para>
6057   </listitem>
6058  </varlistentry>
6059  <varlistentry>
6060   <term><parameter>wait</parameter></term>
6061   <listitem>
6062    <para>
6063     wait descriptor
6064    </para>
6065   </listitem>
6066  </varlistentry>
6067 </variablelist>
6068</refsect1>
6069<refsect1>
6070<title>Description</title>
6071<para>
6072   Sets current thread back to running state and removes
6073   the wait descriptor from the given waitqueue if still
6074   queued.
6075</para>
6076</refsect1>
6077</refentry>
6078
6079<refentry id="API-abort-exclusive-wait">
6080<refentryinfo>
6081 <title>LINUX</title>
6082 <productname>Kernel Hackers Manual</productname>
6083 <date>July 2017</date>
6084</refentryinfo>
6085<refmeta>
6086 <refentrytitle><phrase>abort_exclusive_wait</phrase></refentrytitle>
6087 <manvolnum>9</manvolnum>
6088 <refmiscinfo class="version">4.4.14</refmiscinfo>
6089</refmeta>
6090<refnamediv>
6091 <refname>abort_exclusive_wait</refname>
6092 <refpurpose>
6093     abort exclusive waiting in a queue
6094 </refpurpose>
6095</refnamediv>
6096<refsynopsisdiv>
6097 <title>Synopsis</title>
6098  <funcsynopsis><funcprototype>
6099   <funcdef>void <function>abort_exclusive_wait </function></funcdef>
6100   <paramdef>wait_queue_head_t * <parameter>q</parameter></paramdef>
6101   <paramdef>wait_queue_t * <parameter>wait</parameter></paramdef>
6102   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
6103   <paramdef>void * <parameter>key</parameter></paramdef>
6104  </funcprototype></funcsynopsis>
6105</refsynopsisdiv>
6106<refsect1>
6107 <title>Arguments</title>
6108 <variablelist>
6109  <varlistentry>
6110   <term><parameter>q</parameter></term>
6111   <listitem>
6112    <para>
6113     waitqueue waited on
6114    </para>
6115   </listitem>
6116  </varlistentry>
6117  <varlistentry>
6118   <term><parameter>wait</parameter></term>
6119   <listitem>
6120    <para>
6121     wait descriptor
6122    </para>
6123   </listitem>
6124  </varlistentry>
6125  <varlistentry>
6126   <term><parameter>mode</parameter></term>
6127   <listitem>
6128    <para>
6129     runstate of the waiter to be woken
6130    </para>
6131   </listitem>
6132  </varlistentry>
6133  <varlistentry>
6134   <term><parameter>key</parameter></term>
6135   <listitem>
6136    <para>
6137     key to identify a wait bit queue or <constant>NULL</constant>
6138    </para>
6139   </listitem>
6140  </varlistentry>
6141 </variablelist>
6142</refsect1>
6143<refsect1>
6144<title>Description</title>
6145<para>
6146   Sets current thread back to running state and removes
6147   the wait descriptor from the given waitqueue if still
6148   queued.
6149   </para><para>
6150
6151   Wakes up the next waiter if the caller is concurrently
6152   woken up through the queue.
6153   </para><para>
6154
6155   This prevents waiter starvation where an exclusive waiter
6156   aborts and is woken up concurrently and no one wakes up
6157   the next waiter.
6158</para>
6159</refsect1>
6160</refentry>
6161
6162<refentry id="API-wake-up-bit">
6163<refentryinfo>
6164 <title>LINUX</title>
6165 <productname>Kernel Hackers Manual</productname>
6166 <date>July 2017</date>
6167</refentryinfo>
6168<refmeta>
6169 <refentrytitle><phrase>wake_up_bit</phrase></refentrytitle>
6170 <manvolnum>9</manvolnum>
6171 <refmiscinfo class="version">4.4.14</refmiscinfo>
6172</refmeta>
6173<refnamediv>
6174 <refname>wake_up_bit</refname>
6175 <refpurpose>
6176     wake up a waiter on a bit
6177 </refpurpose>
6178</refnamediv>
6179<refsynopsisdiv>
6180 <title>Synopsis</title>
6181  <funcsynopsis><funcprototype>
6182   <funcdef>void <function>wake_up_bit </function></funcdef>
6183   <paramdef>void * <parameter>word</parameter></paramdef>
6184   <paramdef>int <parameter>bit</parameter></paramdef>
6185  </funcprototype></funcsynopsis>
6186</refsynopsisdiv>
6187<refsect1>
6188 <title>Arguments</title>
6189 <variablelist>
6190  <varlistentry>
6191   <term><parameter>word</parameter></term>
6192   <listitem>
6193    <para>
6194     the word being waited on, a kernel virtual address
6195    </para>
6196   </listitem>
6197  </varlistentry>
6198  <varlistentry>
6199   <term><parameter>bit</parameter></term>
6200   <listitem>
6201    <para>
6202     the bit of the word being waited on
6203    </para>
6204   </listitem>
6205  </varlistentry>
6206 </variablelist>
6207</refsect1>
6208<refsect1>
6209<title>Description</title>
6210<para>
6211   There is a standard hashed waitqueue table for generic use. This
6212   is the part of the hashtable's accessor API that wakes up waiters
6213   on a bit. For instance, if one were to have waiters on a bitflag,
6214   one would call <function><link linkend="API-wake-up-bit">wake_up_bit</link></function> after clearing the bit.
6215   </para><para>
6216
6217   In order for this to function properly, as it uses <function>waitqueue_active</function>
6218   internally, some kind of memory barrier must be done prior to calling
6219   this. Typically, this will be <function>smp_mb__after_atomic</function>, but in some
6220   cases where bitflags are manipulated non-atomically under a lock, one
6221   may need to use a less regular barrier, such fs/inode.c's <function>smp_mb</function>,
6222   because <function>spin_unlock</function> does not guarantee a memory barrier.
6223</para>
6224</refsect1>
6225</refentry>
6226
6227<refentry id="API-wake-up-atomic-t">
6228<refentryinfo>
6229 <title>LINUX</title>
6230 <productname>Kernel Hackers Manual</productname>
6231 <date>July 2017</date>
6232</refentryinfo>
6233<refmeta>
6234 <refentrytitle><phrase>wake_up_atomic_t</phrase></refentrytitle>
6235 <manvolnum>9</manvolnum>
6236 <refmiscinfo class="version">4.4.14</refmiscinfo>
6237</refmeta>
6238<refnamediv>
6239 <refname>wake_up_atomic_t</refname>
6240 <refpurpose>
6241     Wake up a waiter on a atomic_t
6242 </refpurpose>
6243</refnamediv>
6244<refsynopsisdiv>
6245 <title>Synopsis</title>
6246  <funcsynopsis><funcprototype>
6247   <funcdef>void <function>wake_up_atomic_t </function></funcdef>
6248   <paramdef>atomic_t * <parameter>p</parameter></paramdef>
6249  </funcprototype></funcsynopsis>
6250</refsynopsisdiv>
6251<refsect1>
6252 <title>Arguments</title>
6253 <variablelist>
6254  <varlistentry>
6255   <term><parameter>p</parameter></term>
6256   <listitem>
6257    <para>
6258     The atomic_t being waited on, a kernel virtual address
6259    </para>
6260   </listitem>
6261  </varlistentry>
6262 </variablelist>
6263</refsect1>
6264<refsect1>
6265<title>Description</title>
6266<para>
6267   Wake up anyone waiting for the atomic_t to go to zero.
6268   </para><para>
6269
6270   Abuse the bit-waker function and its waitqueue hash table set (the atomic_t
6271   check is done by the waiter's wake function, not the by the waker itself).
6272</para>
6273</refsect1>
6274</refentry>
6275
6276     </sect1>
6277     <sect1><title>High-resolution timers</title>
6278<!-- include/linux/ktime.h -->
6279<refentry id="API-ktime-set">
6280<refentryinfo>
6281 <title>LINUX</title>
6282 <productname>Kernel Hackers Manual</productname>
6283 <date>July 2017</date>
6284</refentryinfo>
6285<refmeta>
6286 <refentrytitle><phrase>ktime_set</phrase></refentrytitle>
6287 <manvolnum>9</manvolnum>
6288 <refmiscinfo class="version">4.4.14</refmiscinfo>
6289</refmeta>
6290<refnamediv>
6291 <refname>ktime_set</refname>
6292 <refpurpose>
6293  Set a ktime_t variable from a seconds/nanoseconds value
6294 </refpurpose>
6295</refnamediv>
6296<refsynopsisdiv>
6297 <title>Synopsis</title>
6298  <funcsynopsis><funcprototype>
6299   <funcdef>ktime_t <function>ktime_set </function></funcdef>
6300   <paramdef>const s64 <parameter>secs</parameter></paramdef>
6301   <paramdef>const unsigned long <parameter>nsecs</parameter></paramdef>
6302  </funcprototype></funcsynopsis>
6303</refsynopsisdiv>
6304<refsect1>
6305 <title>Arguments</title>
6306 <variablelist>
6307  <varlistentry>
6308   <term><parameter>secs</parameter></term>
6309   <listitem>
6310    <para>
6311     seconds to set
6312    </para>
6313   </listitem>
6314  </varlistentry>
6315  <varlistentry>
6316   <term><parameter>nsecs</parameter></term>
6317   <listitem>
6318    <para>
6319     nanoseconds to set
6320    </para>
6321   </listitem>
6322  </varlistentry>
6323 </variablelist>
6324</refsect1>
6325<refsect1>
6326<title>Return</title>
6327<para>
6328   The ktime_t representation of the value.
6329</para>
6330</refsect1>
6331</refentry>
6332
6333<refentry id="API-ktime-equal">
6334<refentryinfo>
6335 <title>LINUX</title>
6336 <productname>Kernel Hackers Manual</productname>
6337 <date>July 2017</date>
6338</refentryinfo>
6339<refmeta>
6340 <refentrytitle><phrase>ktime_equal</phrase></refentrytitle>
6341 <manvolnum>9</manvolnum>
6342 <refmiscinfo class="version">4.4.14</refmiscinfo>
6343</refmeta>
6344<refnamediv>
6345 <refname>ktime_equal</refname>
6346 <refpurpose>
6347     Compares two ktime_t variables to see if they are equal
6348 </refpurpose>
6349</refnamediv>
6350<refsynopsisdiv>
6351 <title>Synopsis</title>
6352  <funcsynopsis><funcprototype>
6353   <funcdef>int <function>ktime_equal </function></funcdef>
6354   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6355   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6356  </funcprototype></funcsynopsis>
6357</refsynopsisdiv>
6358<refsect1>
6359 <title>Arguments</title>
6360 <variablelist>
6361  <varlistentry>
6362   <term><parameter>cmp1</parameter></term>
6363   <listitem>
6364    <para>
6365     comparable1
6366    </para>
6367   </listitem>
6368  </varlistentry>
6369  <varlistentry>
6370   <term><parameter>cmp2</parameter></term>
6371   <listitem>
6372    <para>
6373     comparable2
6374    </para>
6375   </listitem>
6376  </varlistentry>
6377 </variablelist>
6378</refsect1>
6379<refsect1>
6380<title>Description</title>
6381<para>
6382   Compare two ktime_t variables.
6383</para>
6384</refsect1>
6385<refsect1>
6386<title>Return</title>
6387<para>
6388   1 if equal.
6389</para>
6390</refsect1>
6391</refentry>
6392
6393<refentry id="API-ktime-compare">
6394<refentryinfo>
6395 <title>LINUX</title>
6396 <productname>Kernel Hackers Manual</productname>
6397 <date>July 2017</date>
6398</refentryinfo>
6399<refmeta>
6400 <refentrytitle><phrase>ktime_compare</phrase></refentrytitle>
6401 <manvolnum>9</manvolnum>
6402 <refmiscinfo class="version">4.4.14</refmiscinfo>
6403</refmeta>
6404<refnamediv>
6405 <refname>ktime_compare</refname>
6406 <refpurpose>
6407     Compares two ktime_t variables for less, greater or equal
6408 </refpurpose>
6409</refnamediv>
6410<refsynopsisdiv>
6411 <title>Synopsis</title>
6412  <funcsynopsis><funcprototype>
6413   <funcdef>int <function>ktime_compare </function></funcdef>
6414   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6415   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6416  </funcprototype></funcsynopsis>
6417</refsynopsisdiv>
6418<refsect1>
6419 <title>Arguments</title>
6420 <variablelist>
6421  <varlistentry>
6422   <term><parameter>cmp1</parameter></term>
6423   <listitem>
6424    <para>
6425     comparable1
6426    </para>
6427   </listitem>
6428  </varlistentry>
6429  <varlistentry>
6430   <term><parameter>cmp2</parameter></term>
6431   <listitem>
6432    <para>
6433     comparable2
6434    </para>
6435   </listitem>
6436  </varlistentry>
6437 </variablelist>
6438</refsect1>
6439<refsect1>
6440<title>Return</title>
6441<para>
6442   ...
6443   cmp1  &lt; cmp2: return &lt;0
6444   cmp1 == cmp2: return 0
6445   cmp1  &gt; cmp2: return &gt;0
6446</para>
6447</refsect1>
6448</refentry>
6449
6450<refentry id="API-ktime-after">
6451<refentryinfo>
6452 <title>LINUX</title>
6453 <productname>Kernel Hackers Manual</productname>
6454 <date>July 2017</date>
6455</refentryinfo>
6456<refmeta>
6457 <refentrytitle><phrase>ktime_after</phrase></refentrytitle>
6458 <manvolnum>9</manvolnum>
6459 <refmiscinfo class="version">4.4.14</refmiscinfo>
6460</refmeta>
6461<refnamediv>
6462 <refname>ktime_after</refname>
6463 <refpurpose>
6464     Compare if a ktime_t value is bigger than another one.
6465 </refpurpose>
6466</refnamediv>
6467<refsynopsisdiv>
6468 <title>Synopsis</title>
6469  <funcsynopsis><funcprototype>
6470   <funcdef>bool <function>ktime_after </function></funcdef>
6471   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6472   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6473  </funcprototype></funcsynopsis>
6474</refsynopsisdiv>
6475<refsect1>
6476 <title>Arguments</title>
6477 <variablelist>
6478  <varlistentry>
6479   <term><parameter>cmp1</parameter></term>
6480   <listitem>
6481    <para>
6482     comparable1
6483    </para>
6484   </listitem>
6485  </varlistentry>
6486  <varlistentry>
6487   <term><parameter>cmp2</parameter></term>
6488   <listitem>
6489    <para>
6490     comparable2
6491    </para>
6492   </listitem>
6493  </varlistentry>
6494 </variablelist>
6495</refsect1>
6496<refsect1>
6497<title>Return</title>
6498<para>
6499   true if cmp1 happened after cmp2.
6500</para>
6501</refsect1>
6502</refentry>
6503
6504<refentry id="API-ktime-before">
6505<refentryinfo>
6506 <title>LINUX</title>
6507 <productname>Kernel Hackers Manual</productname>
6508 <date>July 2017</date>
6509</refentryinfo>
6510<refmeta>
6511 <refentrytitle><phrase>ktime_before</phrase></refentrytitle>
6512 <manvolnum>9</manvolnum>
6513 <refmiscinfo class="version">4.4.14</refmiscinfo>
6514</refmeta>
6515<refnamediv>
6516 <refname>ktime_before</refname>
6517 <refpurpose>
6518     Compare if a ktime_t value is smaller than another one.
6519 </refpurpose>
6520</refnamediv>
6521<refsynopsisdiv>
6522 <title>Synopsis</title>
6523  <funcsynopsis><funcprototype>
6524   <funcdef>bool <function>ktime_before </function></funcdef>
6525   <paramdef>const ktime_t <parameter>cmp1</parameter></paramdef>
6526   <paramdef>const ktime_t <parameter>cmp2</parameter></paramdef>
6527  </funcprototype></funcsynopsis>
6528</refsynopsisdiv>
6529<refsect1>
6530 <title>Arguments</title>
6531 <variablelist>
6532  <varlistentry>
6533   <term><parameter>cmp1</parameter></term>
6534   <listitem>
6535    <para>
6536     comparable1
6537    </para>
6538   </listitem>
6539  </varlistentry>
6540  <varlistentry>
6541   <term><parameter>cmp2</parameter></term>
6542   <listitem>
6543    <para>
6544     comparable2
6545    </para>
6546   </listitem>
6547  </varlistentry>
6548 </variablelist>
6549</refsect1>
6550<refsect1>
6551<title>Return</title>
6552<para>
6553   true if cmp1 happened before cmp2.
6554</para>
6555</refsect1>
6556</refentry>
6557
6558<refentry id="API-ktime-to-timespec-cond">
6559<refentryinfo>
6560 <title>LINUX</title>
6561 <productname>Kernel Hackers Manual</productname>
6562 <date>July 2017</date>
6563</refentryinfo>
6564<refmeta>
6565 <refentrytitle><phrase>ktime_to_timespec_cond</phrase></refentrytitle>
6566 <manvolnum>9</manvolnum>
6567 <refmiscinfo class="version">4.4.14</refmiscinfo>
6568</refmeta>
6569<refnamediv>
6570 <refname>ktime_to_timespec_cond</refname>
6571 <refpurpose>
6572     convert a ktime_t variable to timespec format only if the variable contains data
6573 </refpurpose>
6574</refnamediv>
6575<refsynopsisdiv>
6576 <title>Synopsis</title>
6577  <funcsynopsis><funcprototype>
6578   <funcdef>bool <function>ktime_to_timespec_cond </function></funcdef>
6579   <paramdef>const ktime_t <parameter>kt</parameter></paramdef>
6580   <paramdef>struct timespec * <parameter>ts</parameter></paramdef>
6581  </funcprototype></funcsynopsis>
6582</refsynopsisdiv>
6583<refsect1>
6584 <title>Arguments</title>
6585 <variablelist>
6586  <varlistentry>
6587   <term><parameter>kt</parameter></term>
6588   <listitem>
6589    <para>
6590     the ktime_t variable to convert
6591    </para>
6592   </listitem>
6593  </varlistentry>
6594  <varlistentry>
6595   <term><parameter>ts</parameter></term>
6596   <listitem>
6597    <para>
6598     the timespec variable to store the result in
6599    </para>
6600   </listitem>
6601  </varlistentry>
6602 </variablelist>
6603</refsect1>
6604<refsect1>
6605<title>Return</title>
6606<para>
6607   <constant>true</constant> if there was a successful conversion, <constant>false</constant> if kt was 0.
6608</para>
6609</refsect1>
6610</refentry>
6611
6612<refentry id="API-ktime-to-timespec64-cond">
6613<refentryinfo>
6614 <title>LINUX</title>
6615 <productname>Kernel Hackers Manual</productname>
6616 <date>July 2017</date>
6617</refentryinfo>
6618<refmeta>
6619 <refentrytitle><phrase>ktime_to_timespec64_cond</phrase></refentrytitle>
6620 <manvolnum>9</manvolnum>
6621 <refmiscinfo class="version">4.4.14</refmiscinfo>
6622</refmeta>
6623<refnamediv>
6624 <refname>ktime_to_timespec64_cond</refname>
6625 <refpurpose>
6626     convert a ktime_t variable to timespec64 format only if the variable contains data
6627 </refpurpose>
6628</refnamediv>
6629<refsynopsisdiv>
6630 <title>Synopsis</title>
6631  <funcsynopsis><funcprototype>
6632   <funcdef>bool <function>ktime_to_timespec64_cond </function></funcdef>
6633   <paramdef>const ktime_t <parameter>kt</parameter></paramdef>
6634   <paramdef>struct timespec64 * <parameter>ts</parameter></paramdef>
6635  </funcprototype></funcsynopsis>
6636</refsynopsisdiv>
6637<refsect1>
6638 <title>Arguments</title>
6639 <variablelist>
6640  <varlistentry>
6641   <term><parameter>kt</parameter></term>
6642   <listitem>
6643    <para>
6644     the ktime_t variable to convert
6645    </para>
6646   </listitem>
6647  </varlistentry>
6648  <varlistentry>
6649   <term><parameter>ts</parameter></term>
6650   <listitem>
6651    <para>
6652     the timespec variable to store the result in
6653    </para>
6654   </listitem>
6655  </varlistentry>
6656 </variablelist>
6657</refsect1>
6658<refsect1>
6659<title>Return</title>
6660<para>
6661   <constant>true</constant> if there was a successful conversion, <constant>false</constant> if kt was 0.
6662</para>
6663</refsect1>
6664</refentry>
6665
6666<!-- include/linux/hrtimer.h -->
6667<refentry id="API-struct-hrtimer">
6668<refentryinfo>
6669 <title>LINUX</title>
6670 <productname>Kernel Hackers Manual</productname>
6671 <date>July 2017</date>
6672</refentryinfo>
6673<refmeta>
6674 <refentrytitle><phrase>struct hrtimer</phrase></refentrytitle>
6675 <manvolnum>9</manvolnum>
6676 <refmiscinfo class="version">4.4.14</refmiscinfo>
6677</refmeta>
6678<refnamediv>
6679 <refname>struct hrtimer</refname>
6680 <refpurpose>
6681  the basic hrtimer structure
6682 </refpurpose>
6683</refnamediv>
6684<refsynopsisdiv>
6685 <title>Synopsis</title>
6686  <programlisting>
6687struct hrtimer {
6688  struct timerqueue_node node;
6689  ktime_t _softexpires;
6690  enum hrtimer_restart		(* function) (struct hrtimer *);
6691  struct hrtimer_clock_base * base;
6692  u8 state;
6693  u8 is_rel;
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>is_rel</term>
6737      <listitem><para>
6738Set if the timer was armed relative
6739      </para></listitem>
6740    </varlistentry>
6741    <varlistentry>      <term>start_pid</term>
6742      <listitem><para>
6743timer statistics field to store the pid of the task which
6744started the timer
6745      </para></listitem>
6746    </varlistentry>
6747    <varlistentry>      <term>start_site</term>
6748      <listitem><para>
6749timer statistics field to store the site where the timer
6750was started
6751      </para></listitem>
6752    </varlistentry>
6753    <varlistentry>      <term>start_comm[16]</term>
6754      <listitem><para>
6755timer statistics field to store the name of the process which
6756started the timer
6757      </para></listitem>
6758    </varlistentry>
6759  </variablelist>
6760 </refsect1>
6761<refsect1>
6762<title>Description</title>
6763<para>
6764   The hrtimer structure must be initialized by <function><link linkend="API-hrtimer-init">hrtimer_init</link></function>
6765</para>
6766</refsect1>
6767</refentry>
6768
6769<refentry id="API-struct-hrtimer-sleeper">
6770<refentryinfo>
6771 <title>LINUX</title>
6772 <productname>Kernel Hackers Manual</productname>
6773 <date>July 2017</date>
6774</refentryinfo>
6775<refmeta>
6776 <refentrytitle><phrase>struct hrtimer_sleeper</phrase></refentrytitle>
6777 <manvolnum>9</manvolnum>
6778 <refmiscinfo class="version">4.4.14</refmiscinfo>
6779</refmeta>
6780<refnamediv>
6781 <refname>struct hrtimer_sleeper</refname>
6782 <refpurpose>
6783     simple sleeper structure
6784 </refpurpose>
6785</refnamediv>
6786<refsynopsisdiv>
6787 <title>Synopsis</title>
6788  <programlisting>
6789struct hrtimer_sleeper {
6790  struct hrtimer timer;
6791  struct task_struct * task;
6792};  </programlisting>
6793</refsynopsisdiv>
6794 <refsect1>
6795  <title>Members</title>
6796  <variablelist>
6797    <varlistentry>      <term>timer</term>
6798      <listitem><para>
6799   embedded timer structure
6800      </para></listitem>
6801    </varlistentry>
6802    <varlistentry>      <term>task</term>
6803      <listitem><para>
6804   task to wake up
6805      </para></listitem>
6806    </varlistentry>
6807  </variablelist>
6808 </refsect1>
6809<refsect1>
6810<title>Description</title>
6811<para>
6812   task is set to NULL, when the timer expires.
6813</para>
6814</refsect1>
6815</refentry>
6816
6817<refentry id="API-struct-hrtimer-clock-base">
6818<refentryinfo>
6819 <title>LINUX</title>
6820 <productname>Kernel Hackers Manual</productname>
6821 <date>July 2017</date>
6822</refentryinfo>
6823<refmeta>
6824 <refentrytitle><phrase>struct hrtimer_clock_base</phrase></refentrytitle>
6825 <manvolnum>9</manvolnum>
6826 <refmiscinfo class="version">4.4.14</refmiscinfo>
6827</refmeta>
6828<refnamediv>
6829 <refname>struct hrtimer_clock_base</refname>
6830 <refpurpose>
6831     the timer base for a specific clock
6832 </refpurpose>
6833</refnamediv>
6834<refsynopsisdiv>
6835 <title>Synopsis</title>
6836  <programlisting>
6837struct hrtimer_clock_base {
6838  struct hrtimer_cpu_base * cpu_base;
6839  int index;
6840  clockid_t clockid;
6841  struct timerqueue_head active;
6842  ktime_t (* get_time) (void);
6843  ktime_t offset;
6844};  </programlisting>
6845</refsynopsisdiv>
6846 <refsect1>
6847  <title>Members</title>
6848  <variablelist>
6849    <varlistentry>      <term>cpu_base</term>
6850      <listitem><para>
6851   per cpu clock base
6852      </para></listitem>
6853    </varlistentry>
6854    <varlistentry>      <term>index</term>
6855      <listitem><para>
6856   clock type index for per_cpu support when moving a
6857   timer to a base on another cpu.
6858      </para></listitem>
6859    </varlistentry>
6860    <varlistentry>      <term>clockid</term>
6861      <listitem><para>
6862   clock id for per_cpu support
6863      </para></listitem>
6864    </varlistentry>
6865    <varlistentry>      <term>active</term>
6866      <listitem><para>
6867   red black tree root node for the active timers
6868      </para></listitem>
6869    </varlistentry>
6870    <varlistentry>      <term>get_time</term>
6871      <listitem><para>
6872   function to retrieve the current time of the clock
6873      </para></listitem>
6874    </varlistentry>
6875    <varlistentry>      <term>offset</term>
6876      <listitem><para>
6877   offset of this clock to the monotonic base
6878      </para></listitem>
6879    </varlistentry>
6880  </variablelist>
6881 </refsect1>
6882</refentry>
6883
6884<refentry id="API-hrtimer-start">
6885<refentryinfo>
6886 <title>LINUX</title>
6887 <productname>Kernel Hackers Manual</productname>
6888 <date>July 2017</date>
6889</refentryinfo>
6890<refmeta>
6891 <refentrytitle><phrase>hrtimer_start</phrase></refentrytitle>
6892 <manvolnum>9</manvolnum>
6893 <refmiscinfo class="version">4.4.14</refmiscinfo>
6894</refmeta>
6895<refnamediv>
6896 <refname>hrtimer_start</refname>
6897 <refpurpose>
6898     (re)start an hrtimer on the current CPU
6899 </refpurpose>
6900</refnamediv>
6901<refsynopsisdiv>
6902 <title>Synopsis</title>
6903  <funcsynopsis><funcprototype>
6904   <funcdef>void <function>hrtimer_start </function></funcdef>
6905   <paramdef><link linkend="API-struct-hrtimer">struct hrtimer</link> * <parameter>timer</parameter></paramdef>
6906   <paramdef>ktime_t <parameter>tim</parameter></paramdef>
6907   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
6908  </funcprototype></funcsynopsis>
6909</refsynopsisdiv>
6910<refsect1>
6911 <title>Arguments</title>
6912 <variablelist>
6913  <varlistentry>
6914   <term><parameter>timer</parameter></term>
6915   <listitem>
6916    <para>
6917     the timer to be added
6918    </para>
6919   </listitem>
6920  </varlistentry>
6921  <varlistentry>
6922   <term><parameter>tim</parameter></term>
6923   <listitem>
6924    <para>
6925     expiry time
6926    </para>
6927   </listitem>
6928  </varlistentry>
6929  <varlistentry>
6930   <term><parameter>mode</parameter></term>
6931   <listitem>
6932    <para>
6933     expiry mode: absolute (HRTIMER_MODE_ABS) or
6934     relative (HRTIMER_MODE_REL)
6935    </para>
6936   </listitem>
6937  </varlistentry>
6938 </variablelist>
6939</refsect1>
6940</refentry>
6941
6942<refentry id="API-hrtimer-forward-now">
6943<refentryinfo>
6944 <title>LINUX</title>
6945 <productname>Kernel Hackers Manual</productname>
6946 <date>July 2017</date>
6947</refentryinfo>
6948<refmeta>
6949 <refentrytitle><phrase>hrtimer_forward_now</phrase></refentrytitle>
6950 <manvolnum>9</manvolnum>
6951 <refmiscinfo class="version">4.4.14</refmiscinfo>
6952</refmeta>
6953<refnamediv>
6954 <refname>hrtimer_forward_now</refname>
6955 <refpurpose>
6956     forward the timer expiry so it expires after now
6957 </refpurpose>
6958</refnamediv>
6959<refsynopsisdiv>
6960 <title>Synopsis</title>
6961  <funcsynopsis><funcprototype>
6962   <funcdef>u64 <function>hrtimer_forward_now </function></funcdef>
6963   <paramdef><link linkend="API-struct-hrtimer">struct hrtimer</link> * <parameter>timer</parameter></paramdef>
6964   <paramdef>ktime_t <parameter>interval</parameter></paramdef>
6965  </funcprototype></funcsynopsis>
6966</refsynopsisdiv>
6967<refsect1>
6968 <title>Arguments</title>
6969 <variablelist>
6970  <varlistentry>
6971   <term><parameter>timer</parameter></term>
6972   <listitem>
6973    <para>
6974     hrtimer to forward
6975    </para>
6976   </listitem>
6977  </varlistentry>
6978  <varlistentry>
6979   <term><parameter>interval</parameter></term>
6980   <listitem>
6981    <para>
6982     the interval to forward
6983    </para>
6984   </listitem>
6985  </varlistentry>
6986 </variablelist>
6987</refsect1>
6988<refsect1>
6989<title>Description</title>
6990<para>
6991   Forward the timer expiry so it will expire after the current time
6992   of the hrtimer clock base. Returns the number of overruns.
6993   </para><para>
6994
6995   Can be safely called from the callback function of <parameter>timer</parameter>. If
6996   called from other contexts <parameter>timer</parameter> must neither be enqueued nor
6997   running the callback and the caller needs to take care of
6998   serialization.
6999</para>
7000</refsect1>
7001<refsect1>
7002<title>Note</title>
7003<para>
7004   This only updates the timer expiry value and does not requeue
7005   the timer.
7006</para>
7007</refsect1>
7008</refentry>
7009
7010<!-- kernel/time/hrtimer.c -->
7011<refentry id="API-hrtimer-forward">
7012<refentryinfo>
7013 <title>LINUX</title>
7014 <productname>Kernel Hackers Manual</productname>
7015 <date>July 2017</date>
7016</refentryinfo>
7017<refmeta>
7018 <refentrytitle><phrase>hrtimer_forward</phrase></refentrytitle>
7019 <manvolnum>9</manvolnum>
7020 <refmiscinfo class="version">4.4.14</refmiscinfo>
7021</refmeta>
7022<refnamediv>
7023 <refname>hrtimer_forward</refname>
7024 <refpurpose>
7025  forward the timer expiry
7026 </refpurpose>
7027</refnamediv>
7028<refsynopsisdiv>
7029 <title>Synopsis</title>
7030  <funcsynopsis><funcprototype>
7031   <funcdef>u64 <function>hrtimer_forward </function></funcdef>
7032   <paramdef><link linkend="API-struct-hrtimer">struct hrtimer</link> * <parameter>timer</parameter></paramdef>
7033   <paramdef>ktime_t <parameter>now</parameter></paramdef>
7034   <paramdef>ktime_t <parameter>interval</parameter></paramdef>
7035  </funcprototype></funcsynopsis>
7036</refsynopsisdiv>
7037<refsect1>
7038 <title>Arguments</title>
7039 <variablelist>
7040  <varlistentry>
7041   <term><parameter>timer</parameter></term>
7042   <listitem>
7043    <para>
7044     hrtimer to forward
7045    </para>
7046   </listitem>
7047  </varlistentry>
7048  <varlistentry>
7049   <term><parameter>now</parameter></term>
7050   <listitem>
7051    <para>
7052     forward past this time
7053    </para>
7054   </listitem>
7055  </varlistentry>
7056  <varlistentry>
7057   <term><parameter>interval</parameter></term>
7058   <listitem>
7059    <para>
7060     the interval to forward
7061    </para>
7062   </listitem>
7063  </varlistentry>
7064 </variablelist>
7065</refsect1>
7066<refsect1>
7067<title>Description</title>
7068<para>
7069   Forward the timer expiry so it will expire in the future.
7070   Returns the number of overruns.
7071   </para><para>
7072
7073   Can be safely called from the callback function of <parameter>timer</parameter>. If
7074   called from other contexts <parameter>timer</parameter> must neither be enqueued nor
7075   running the callback and the caller needs to take care of
7076   serialization.
7077</para>
7078</refsect1>
7079<refsect1>
7080<title>Note</title>
7081<para>
7082   This only updates the timer expiry value and does not requeue
7083   the timer.
7084</para>
7085</refsect1>
7086</refentry>
7087
7088<refentry id="API-hrtimer-start-range-ns">
7089<refentryinfo>
7090 <title>LINUX</title>
7091 <productname>Kernel Hackers Manual</productname>
7092 <date>July 2017</date>
7093</refentryinfo>
7094<refmeta>
7095 <refentrytitle><phrase>hrtimer_start_range_ns</phrase></refentrytitle>
7096 <manvolnum>9</manvolnum>
7097 <refmiscinfo class="version">4.4.14</refmiscinfo>
7098</refmeta>
7099<refnamediv>
7100 <refname>hrtimer_start_range_ns</refname>
7101 <refpurpose>
7102     (re)start an hrtimer on the current CPU
7103 </refpurpose>
7104</refnamediv>
7105<refsynopsisdiv>
7106 <title>Synopsis</title>
7107  <funcsynopsis><funcprototype>
7108   <funcdef>void <function>hrtimer_start_range_ns </function></funcdef>
7109   <paramdef><link linkend="API-struct-hrtimer">struct hrtimer</link> * <parameter>timer</parameter></paramdef>
7110   <paramdef>ktime_t <parameter>tim</parameter></paramdef>
7111   <paramdef>unsigned long <parameter>delta_ns</parameter></paramdef>
7112   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
7113  </funcprototype></funcsynopsis>
7114</refsynopsisdiv>
7115<refsect1>
7116 <title>Arguments</title>
7117 <variablelist>
7118  <varlistentry>
7119   <term><parameter>timer</parameter></term>
7120   <listitem>
7121    <para>
7122     the timer to be added
7123    </para>
7124   </listitem>
7125  </varlistentry>
7126  <varlistentry>
7127   <term><parameter>tim</parameter></term>
7128   <listitem>
7129    <para>
7130     expiry time
7131    </para>
7132   </listitem>
7133  </varlistentry>
7134  <varlistentry>
7135   <term><parameter>delta_ns</parameter></term>
7136   <listitem>
7137    <para>
7138     "slack" range for the timer
7139    </para>
7140   </listitem>
7141  </varlistentry>
7142  <varlistentry>
7143   <term><parameter>mode</parameter></term>
7144   <listitem>
7145    <para>
7146     expiry mode: absolute (HRTIMER_MODE_ABS) or
7147     relative (HRTIMER_MODE_REL)
7148    </para>
7149   </listitem>
7150  </varlistentry>
7151 </variablelist>
7152</refsect1>
7153</refentry>
7154
7155<refentry id="API-hrtimer-try-to-cancel">
7156<refentryinfo>
7157 <title>LINUX</title>
7158 <productname>Kernel Hackers Manual</productname>
7159 <date>July 2017</date>
7160</refentryinfo>
7161<refmeta>
7162 <refentrytitle><phrase>hrtimer_try_to_cancel</phrase></refentrytitle>
7163 <manvolnum>9</manvolnum>
7164 <refmiscinfo class="version">4.4.14</refmiscinfo>
7165</refmeta>
7166<refnamediv>
7167 <refname>hrtimer_try_to_cancel</refname>
7168 <refpurpose>
7169     try to deactivate a timer
7170 </refpurpose>
7171</refnamediv>
7172<refsynopsisdiv>
7173 <title>Synopsis</title>
7174  <funcsynopsis><funcprototype>
7175   <funcdef>int <function>hrtimer_try_to_cancel </function></funcdef>
7176   <paramdef><link linkend="API-struct-hrtimer">struct hrtimer</link> * <parameter>timer</parameter></paramdef>
7177  </funcprototype></funcsynopsis>
7178</refsynopsisdiv>
7179<refsect1>
7180 <title>Arguments</title>
7181 <variablelist>
7182  <varlistentry>
7183   <term><parameter>timer</parameter></term>
7184   <listitem>
7185    <para>
7186     hrtimer to stop
7187    </para>
7188   </listitem>
7189  </varlistentry>
7190 </variablelist>
7191</refsect1>
7192<refsect1>
7193<title>Returns</title>
7194<para>
7195   0 when the timer was not active
7196   1 when the timer was active
7197   -1 when the timer is currently excuting the callback function and
7198   cannot be stopped
7199</para>
7200</refsect1>
7201</refentry>
7202
7203<refentry id="API-hrtimer-cancel">
7204<refentryinfo>
7205 <title>LINUX</title>
7206 <productname>Kernel Hackers Manual</productname>
7207 <date>July 2017</date>
7208</refentryinfo>
7209<refmeta>
7210 <refentrytitle><phrase>hrtimer_cancel</phrase></refentrytitle>
7211 <manvolnum>9</manvolnum>
7212 <refmiscinfo class="version">4.4.14</refmiscinfo>
7213</refmeta>
7214<refnamediv>
7215 <refname>hrtimer_cancel</refname>
7216 <refpurpose>
7217     cancel a timer and wait for the handler to finish.
7218 </refpurpose>
7219</refnamediv>
7220<refsynopsisdiv>
7221 <title>Synopsis</title>
7222  <funcsynopsis><funcprototype>
7223   <funcdef>int <function>hrtimer_cancel </function></funcdef>
7224   <paramdef><link linkend="API-struct-hrtimer">struct hrtimer</link> * <parameter>timer</parameter></paramdef>
7225  </funcprototype></funcsynopsis>
7226</refsynopsisdiv>
7227<refsect1>
7228 <title>Arguments</title>
7229 <variablelist>
7230  <varlistentry>
7231   <term><parameter>timer</parameter></term>
7232   <listitem>
7233    <para>
7234     the timer to be cancelled
7235    </para>
7236   </listitem>
7237  </varlistentry>
7238 </variablelist>
7239</refsect1>
7240<refsect1>
7241<title>Returns</title>
7242<para>
7243   0 when the timer was not active
7244   1 when the timer was active
7245</para>
7246</refsect1>
7247</refentry>
7248
7249<refentry id="API---hrtimer-get-remaining">
7250<refentryinfo>
7251 <title>LINUX</title>
7252 <productname>Kernel Hackers Manual</productname>
7253 <date>July 2017</date>
7254</refentryinfo>
7255<refmeta>
7256 <refentrytitle><phrase>__hrtimer_get_remaining</phrase></refentrytitle>
7257 <manvolnum>9</manvolnum>
7258 <refmiscinfo class="version">4.4.14</refmiscinfo>
7259</refmeta>
7260<refnamediv>
7261 <refname>__hrtimer_get_remaining</refname>
7262 <refpurpose>
7263     get remaining time for the timer
7264 </refpurpose>
7265</refnamediv>
7266<refsynopsisdiv>
7267 <title>Synopsis</title>
7268  <funcsynopsis><funcprototype>
7269   <funcdef>ktime_t <function>__hrtimer_get_remaining </function></funcdef>
7270   <paramdef><link linkend="API-struct-hrtimer">const struct hrtimer</link> * <parameter>timer</parameter></paramdef>
7271   <paramdef>bool <parameter>adjust</parameter></paramdef>
7272  </funcprototype></funcsynopsis>
7273</refsynopsisdiv>
7274<refsect1>
7275 <title>Arguments</title>
7276 <variablelist>
7277  <varlistentry>
7278   <term><parameter>timer</parameter></term>
7279   <listitem>
7280    <para>
7281     the timer to read
7282    </para>
7283   </listitem>
7284  </varlistentry>
7285  <varlistentry>
7286   <term><parameter>adjust</parameter></term>
7287   <listitem>
7288    <para>
7289     adjust relative timers when CONFIG_TIME_LOW_RES=y
7290    </para>
7291   </listitem>
7292  </varlistentry>
7293 </variablelist>
7294</refsect1>
7295</refentry>
7296
7297<refentry id="API-hrtimer-init">
7298<refentryinfo>
7299 <title>LINUX</title>
7300 <productname>Kernel Hackers Manual</productname>
7301 <date>July 2017</date>
7302</refentryinfo>
7303<refmeta>
7304 <refentrytitle><phrase>hrtimer_init</phrase></refentrytitle>
7305 <manvolnum>9</manvolnum>
7306 <refmiscinfo class="version">4.4.14</refmiscinfo>
7307</refmeta>
7308<refnamediv>
7309 <refname>hrtimer_init</refname>
7310 <refpurpose>
7311     initialize a timer to the given clock
7312 </refpurpose>
7313</refnamediv>
7314<refsynopsisdiv>
7315 <title>Synopsis</title>
7316  <funcsynopsis><funcprototype>
7317   <funcdef>void <function>hrtimer_init </function></funcdef>
7318   <paramdef><link linkend="API-struct-hrtimer">struct hrtimer</link> * <parameter>timer</parameter></paramdef>
7319   <paramdef>clockid_t <parameter>clock_id</parameter></paramdef>
7320   <paramdef>enum hrtimer_mode <parameter>mode</parameter></paramdef>
7321  </funcprototype></funcsynopsis>
7322</refsynopsisdiv>
7323<refsect1>
7324 <title>Arguments</title>
7325 <variablelist>
7326  <varlistentry>
7327   <term><parameter>timer</parameter></term>
7328   <listitem>
7329    <para>
7330     the timer to be initialized
7331    </para>
7332   </listitem>
7333  </varlistentry>
7334  <varlistentry>
7335   <term><parameter>clock_id</parameter></term>
7336   <listitem>
7337    <para>
7338     the clock to be used
7339    </para>
7340   </listitem>
7341  </varlistentry>
7342  <varlistentry>
7343   <term><parameter>mode</parameter></term>
7344   <listitem>
7345    <para>
7346     timer mode abs/rel
7347    </para>
7348   </listitem>
7349  </varlistentry>
7350 </variablelist>
7351</refsect1>
7352</refentry>
7353
7354<refentry id="API-schedule-hrtimeout-range">
7355<refentryinfo>
7356 <title>LINUX</title>
7357 <productname>Kernel Hackers Manual</productname>
7358 <date>July 2017</date>
7359</refentryinfo>
7360<refmeta>
7361 <refentrytitle><phrase>schedule_hrtimeout_range</phrase></refentrytitle>
7362 <manvolnum>9</manvolnum>
7363 <refmiscinfo class="version">4.4.14</refmiscinfo>
7364</refmeta>
7365<refnamediv>
7366 <refname>schedule_hrtimeout_range</refname>
7367 <refpurpose>
7368     sleep until timeout
7369 </refpurpose>
7370</refnamediv>
7371<refsynopsisdiv>
7372 <title>Synopsis</title>
7373  <funcsynopsis><funcprototype>
7374   <funcdef>int __sched <function>schedule_hrtimeout_range </function></funcdef>
7375   <paramdef>ktime_t * <parameter>expires</parameter></paramdef>
7376   <paramdef>unsigned long <parameter>delta</parameter></paramdef>
7377   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
7378  </funcprototype></funcsynopsis>
7379</refsynopsisdiv>
7380<refsect1>
7381 <title>Arguments</title>
7382 <variablelist>
7383  <varlistentry>
7384   <term><parameter>expires</parameter></term>
7385   <listitem>
7386    <para>
7387     timeout value (ktime_t)
7388    </para>
7389   </listitem>
7390  </varlistentry>
7391  <varlistentry>
7392   <term><parameter>delta</parameter></term>
7393   <listitem>
7394    <para>
7395     slack in expires timeout (ktime_t)
7396    </para>
7397   </listitem>
7398  </varlistentry>
7399  <varlistentry>
7400   <term><parameter>mode</parameter></term>
7401   <listitem>
7402    <para>
7403     timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL
7404    </para>
7405   </listitem>
7406  </varlistentry>
7407 </variablelist>
7408</refsect1>
7409<refsect1>
7410<title>Description</title>
7411<para>
7412   Make the current task sleep until the given expiry time has
7413   elapsed. The routine will return immediately unless
7414   the current task state has been set (see <function>set_current_state</function>).
7415   </para><para>
7416
7417   The <parameter>delta</parameter> argument gives the kernel the freedom to schedule the
7418   actual wakeup to a time that is both power and performance friendly.
7419   The kernel give the normal best effort behavior for <quote><parameter>expires</parameter>+<parameter>delta</parameter></quote>,
7420   but may decide to fire the timer earlier, but no earlier than <parameter>expires</parameter>.
7421   </para><para>
7422
7423   You can set the task state as follows -
7424   </para><para>
7425
7426   <constant>TASK_UNINTERRUPTIBLE</constant> - at least <parameter>timeout</parameter> time is guaranteed to
7427   pass before the routine returns.
7428   </para><para>
7429
7430   <constant>TASK_INTERRUPTIBLE</constant> - the routine may return early if a signal is
7431   delivered to the current task.
7432   </para><para>
7433
7434   The current task state is guaranteed to be TASK_RUNNING when this
7435   routine returns.
7436   </para><para>
7437
7438   Returns 0 when the timer has expired otherwise -EINTR
7439</para>
7440</refsect1>
7441</refentry>
7442
7443<refentry id="API-schedule-hrtimeout">
7444<refentryinfo>
7445 <title>LINUX</title>
7446 <productname>Kernel Hackers Manual</productname>
7447 <date>July 2017</date>
7448</refentryinfo>
7449<refmeta>
7450 <refentrytitle><phrase>schedule_hrtimeout</phrase></refentrytitle>
7451 <manvolnum>9</manvolnum>
7452 <refmiscinfo class="version">4.4.14</refmiscinfo>
7453</refmeta>
7454<refnamediv>
7455 <refname>schedule_hrtimeout</refname>
7456 <refpurpose>
7457     sleep until timeout
7458 </refpurpose>
7459</refnamediv>
7460<refsynopsisdiv>
7461 <title>Synopsis</title>
7462  <funcsynopsis><funcprototype>
7463   <funcdef>int __sched <function>schedule_hrtimeout </function></funcdef>
7464   <paramdef>ktime_t * <parameter>expires</parameter></paramdef>
7465   <paramdef>const enum hrtimer_mode <parameter>mode</parameter></paramdef>
7466  </funcprototype></funcsynopsis>
7467</refsynopsisdiv>
7468<refsect1>
7469 <title>Arguments</title>
7470 <variablelist>
7471  <varlistentry>
7472   <term><parameter>expires</parameter></term>
7473   <listitem>
7474    <para>
7475     timeout value (ktime_t)
7476    </para>
7477   </listitem>
7478  </varlistentry>
7479  <varlistentry>
7480   <term><parameter>mode</parameter></term>
7481   <listitem>
7482    <para>
7483     timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL
7484    </para>
7485   </listitem>
7486  </varlistentry>
7487 </variablelist>
7488</refsect1>
7489<refsect1>
7490<title>Description</title>
7491<para>
7492   Make the current task sleep until the given expiry time has
7493   elapsed. The routine will return immediately unless
7494   the current task state has been set (see <function>set_current_state</function>).
7495   </para><para>
7496
7497   You can set the task state as follows -
7498   </para><para>
7499
7500   <constant>TASK_UNINTERRUPTIBLE</constant> - at least <parameter>timeout</parameter> time is guaranteed to
7501   pass before the routine returns.
7502   </para><para>
7503
7504   <constant>TASK_INTERRUPTIBLE</constant> - the routine may return early if a signal is
7505   delivered to the current task.
7506   </para><para>
7507
7508   The current task state is guaranteed to be TASK_RUNNING when this
7509   routine returns.
7510   </para><para>
7511
7512   Returns 0 when the timer has expired otherwise -EINTR
7513</para>
7514</refsect1>
7515</refentry>
7516
7517     </sect1>
7518     <sect1><title>Workqueues and Kevents</title>
7519<!-- include/linux/workqueue.h -->
7520<refentry id="API-work-pending">
7521<refentryinfo>
7522 <title>LINUX</title>
7523 <productname>Kernel Hackers Manual</productname>
7524 <date>July 2017</date>
7525</refentryinfo>
7526<refmeta>
7527 <refentrytitle><phrase>work_pending</phrase></refentrytitle>
7528 <manvolnum>9</manvolnum>
7529 <refmiscinfo class="version">4.4.14</refmiscinfo>
7530</refmeta>
7531<refnamediv>
7532 <refname>work_pending</refname>
7533 <refpurpose>
7534  Find out whether a work item is currently pending
7535 </refpurpose>
7536</refnamediv>
7537<refsynopsisdiv>
7538 <title>Synopsis</title>
7539  <funcsynopsis><funcprototype>
7540   <funcdef> <function>work_pending </function></funcdef>
7541   <paramdef> <parameter>work</parameter></paramdef>
7542  </funcprototype></funcsynopsis>
7543</refsynopsisdiv>
7544<refsect1>
7545 <title>Arguments</title>
7546 <variablelist>
7547  <varlistentry>
7548   <term><parameter>work</parameter></term>
7549   <listitem>
7550    <para>
7551     The work item in question
7552    </para>
7553   </listitem>
7554  </varlistentry>
7555 </variablelist>
7556</refsect1>
7557</refentry>
7558
7559<refentry id="API-delayed-work-pending">
7560<refentryinfo>
7561 <title>LINUX</title>
7562 <productname>Kernel Hackers Manual</productname>
7563 <date>July 2017</date>
7564</refentryinfo>
7565<refmeta>
7566 <refentrytitle><phrase>delayed_work_pending</phrase></refentrytitle>
7567 <manvolnum>9</manvolnum>
7568 <refmiscinfo class="version">4.4.14</refmiscinfo>
7569</refmeta>
7570<refnamediv>
7571 <refname>delayed_work_pending</refname>
7572 <refpurpose>
7573     Find out whether a delayable work item is currently pending
7574 </refpurpose>
7575</refnamediv>
7576<refsynopsisdiv>
7577 <title>Synopsis</title>
7578  <funcsynopsis><funcprototype>
7579   <funcdef> <function>delayed_work_pending </function></funcdef>
7580   <paramdef> <parameter>w</parameter></paramdef>
7581  </funcprototype></funcsynopsis>
7582</refsynopsisdiv>
7583<refsect1>
7584 <title>Arguments</title>
7585 <variablelist>
7586  <varlistentry>
7587   <term><parameter>w</parameter></term>
7588   <listitem>
7589    <para>
7590     The work item in question
7591    </para>
7592   </listitem>
7593  </varlistentry>
7594 </variablelist>
7595</refsect1>
7596</refentry>
7597
7598<refentry id="API-alloc-workqueue">
7599<refentryinfo>
7600 <title>LINUX</title>
7601 <productname>Kernel Hackers Manual</productname>
7602 <date>July 2017</date>
7603</refentryinfo>
7604<refmeta>
7605 <refentrytitle><phrase>alloc_workqueue</phrase></refentrytitle>
7606 <manvolnum>9</manvolnum>
7607 <refmiscinfo class="version">4.4.14</refmiscinfo>
7608</refmeta>
7609<refnamediv>
7610 <refname>alloc_workqueue</refname>
7611 <refpurpose>
7612     allocate a workqueue
7613 </refpurpose>
7614</refnamediv>
7615<refsynopsisdiv>
7616 <title>Synopsis</title>
7617  <funcsynopsis><funcprototype>
7618   <funcdef> <function>alloc_workqueue </function></funcdef>
7619   <paramdef> <parameter>fmt</parameter></paramdef>
7620   <paramdef> <parameter>flags</parameter></paramdef>
7621   <paramdef> <parameter>max_active</parameter></paramdef>
7622   <paramdef> <parameter>args...</parameter></paramdef>
7623  </funcprototype></funcsynopsis>
7624</refsynopsisdiv>
7625<refsect1>
7626 <title>Arguments</title>
7627 <variablelist>
7628  <varlistentry>
7629   <term><parameter>fmt</parameter></term>
7630   <listitem>
7631    <para>
7632     printf format for the name of the workqueue
7633    </para>
7634   </listitem>
7635  </varlistentry>
7636  <varlistentry>
7637   <term><parameter>flags</parameter></term>
7638   <listitem>
7639    <para>
7640     WQ_* flags
7641    </para>
7642   </listitem>
7643  </varlistentry>
7644  <varlistentry>
7645   <term><parameter>max_active</parameter></term>
7646   <listitem>
7647    <para>
7648     max in-flight work items, 0 for default
7649     <parameter>args</parameter>...: args for <parameter>fmt</parameter>
7650    </para>
7651   </listitem>
7652  </varlistentry>
7653  <varlistentry>
7654   <term><parameter>args...</parameter></term>
7655   <listitem>
7656    <para>
7657     variable arguments
7658    </para>
7659   </listitem>
7660  </varlistentry>
7661 </variablelist>
7662</refsect1>
7663<refsect1>
7664<title>Description</title>
7665<para>
7666   Allocate a workqueue with the specified parameters.  For detailed
7667   information on WQ_* flags, please refer to Documentation/workqueue.txt.
7668   </para><para>
7669
7670   The __lock_name macro dance is to guarantee that single lock_class_key
7671   doesn't end up with different namesm, which isn't allowed by lockdep.
7672</para>
7673</refsect1>
7674<refsect1>
7675<title>RETURNS</title>
7676<para>
7677   Pointer to the allocated workqueue on success, <constant>NULL</constant> on failure.
7678</para>
7679</refsect1>
7680</refentry>
7681
7682<refentry id="API-alloc-ordered-workqueue">
7683<refentryinfo>
7684 <title>LINUX</title>
7685 <productname>Kernel Hackers Manual</productname>
7686 <date>July 2017</date>
7687</refentryinfo>
7688<refmeta>
7689 <refentrytitle><phrase>alloc_ordered_workqueue</phrase></refentrytitle>
7690 <manvolnum>9</manvolnum>
7691 <refmiscinfo class="version">4.4.14</refmiscinfo>
7692</refmeta>
7693<refnamediv>
7694 <refname>alloc_ordered_workqueue</refname>
7695 <refpurpose>
7696     allocate an ordered workqueue
7697 </refpurpose>
7698</refnamediv>
7699<refsynopsisdiv>
7700 <title>Synopsis</title>
7701  <funcsynopsis><funcprototype>
7702   <funcdef> <function>alloc_ordered_workqueue </function></funcdef>
7703   <paramdef> <parameter>fmt</parameter></paramdef>
7704   <paramdef> <parameter>flags</parameter></paramdef>
7705   <paramdef> <parameter>args...</parameter></paramdef>
7706  </funcprototype></funcsynopsis>
7707</refsynopsisdiv>
7708<refsect1>
7709 <title>Arguments</title>
7710 <variablelist>
7711  <varlistentry>
7712   <term><parameter>fmt</parameter></term>
7713   <listitem>
7714    <para>
7715     printf format for the name of the workqueue
7716    </para>
7717   </listitem>
7718  </varlistentry>
7719  <varlistentry>
7720   <term><parameter>flags</parameter></term>
7721   <listitem>
7722    <para>
7723     WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful)
7724     <parameter>args</parameter>...: args for <parameter>fmt</parameter>
7725    </para>
7726   </listitem>
7727  </varlistentry>
7728  <varlistentry>
7729   <term><parameter>args...</parameter></term>
7730   <listitem>
7731    <para>
7732     variable arguments
7733    </para>
7734   </listitem>
7735  </varlistentry>
7736 </variablelist>
7737</refsect1>
7738<refsect1>
7739<title>Description</title>
7740<para>
7741   Allocate an ordered workqueue.  An ordered workqueue executes at
7742   most one work item at any given time in the queued order.  They are
7743   implemented as unbound workqueues with <parameter>max_active</parameter> of one.
7744</para>
7745</refsect1>
7746<refsect1>
7747<title>RETURNS</title>
7748<para>
7749   Pointer to the allocated workqueue on success, <constant>NULL</constant> on failure.
7750</para>
7751</refsect1>
7752</refentry>
7753
7754<refentry id="API-queue-work">
7755<refentryinfo>
7756 <title>LINUX</title>
7757 <productname>Kernel Hackers Manual</productname>
7758 <date>July 2017</date>
7759</refentryinfo>
7760<refmeta>
7761 <refentrytitle><phrase>queue_work</phrase></refentrytitle>
7762 <manvolnum>9</manvolnum>
7763 <refmiscinfo class="version">4.4.14</refmiscinfo>
7764</refmeta>
7765<refnamediv>
7766 <refname>queue_work</refname>
7767 <refpurpose>
7768     queue work on a workqueue
7769 </refpurpose>
7770</refnamediv>
7771<refsynopsisdiv>
7772 <title>Synopsis</title>
7773  <funcsynopsis><funcprototype>
7774   <funcdef>bool <function>queue_work </function></funcdef>
7775   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7776   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
7777  </funcprototype></funcsynopsis>
7778</refsynopsisdiv>
7779<refsect1>
7780 <title>Arguments</title>
7781 <variablelist>
7782  <varlistentry>
7783   <term><parameter>wq</parameter></term>
7784   <listitem>
7785    <para>
7786     workqueue to use
7787    </para>
7788   </listitem>
7789  </varlistentry>
7790  <varlistentry>
7791   <term><parameter>work</parameter></term>
7792   <listitem>
7793    <para>
7794     work to queue
7795    </para>
7796   </listitem>
7797  </varlistentry>
7798 </variablelist>
7799</refsect1>
7800<refsect1>
7801<title>Description</title>
7802<para>
7803   Returns <constant>false</constant> if <parameter>work</parameter> was already on a queue, <constant>true</constant> otherwise.
7804   </para><para>
7805
7806   We queue the work to the CPU on which it was submitted, but if the CPU dies
7807   it can be processed by another CPU.
7808</para>
7809</refsect1>
7810</refentry>
7811
7812<refentry id="API-queue-delayed-work">
7813<refentryinfo>
7814 <title>LINUX</title>
7815 <productname>Kernel Hackers Manual</productname>
7816 <date>July 2017</date>
7817</refentryinfo>
7818<refmeta>
7819 <refentrytitle><phrase>queue_delayed_work</phrase></refentrytitle>
7820 <manvolnum>9</manvolnum>
7821 <refmiscinfo class="version">4.4.14</refmiscinfo>
7822</refmeta>
7823<refnamediv>
7824 <refname>queue_delayed_work</refname>
7825 <refpurpose>
7826     queue work on a workqueue after delay
7827 </refpurpose>
7828</refnamediv>
7829<refsynopsisdiv>
7830 <title>Synopsis</title>
7831  <funcsynopsis><funcprototype>
7832   <funcdef>bool <function>queue_delayed_work </function></funcdef>
7833   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7834   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
7835   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
7836  </funcprototype></funcsynopsis>
7837</refsynopsisdiv>
7838<refsect1>
7839 <title>Arguments</title>
7840 <variablelist>
7841  <varlistentry>
7842   <term><parameter>wq</parameter></term>
7843   <listitem>
7844    <para>
7845     workqueue to use
7846    </para>
7847   </listitem>
7848  </varlistentry>
7849  <varlistentry>
7850   <term><parameter>dwork</parameter></term>
7851   <listitem>
7852    <para>
7853     delayable work to queue
7854    </para>
7855   </listitem>
7856  </varlistentry>
7857  <varlistentry>
7858   <term><parameter>delay</parameter></term>
7859   <listitem>
7860    <para>
7861     number of jiffies to wait before queueing
7862    </para>
7863   </listitem>
7864  </varlistentry>
7865 </variablelist>
7866</refsect1>
7867<refsect1>
7868<title>Description</title>
7869<para>
7870   Equivalent to <function><link linkend="API-queue-delayed-work-on">queue_delayed_work_on</link></function> but tries to use the local CPU.
7871</para>
7872</refsect1>
7873</refentry>
7874
7875<refentry id="API-mod-delayed-work">
7876<refentryinfo>
7877 <title>LINUX</title>
7878 <productname>Kernel Hackers Manual</productname>
7879 <date>July 2017</date>
7880</refentryinfo>
7881<refmeta>
7882 <refentrytitle><phrase>mod_delayed_work</phrase></refentrytitle>
7883 <manvolnum>9</manvolnum>
7884 <refmiscinfo class="version">4.4.14</refmiscinfo>
7885</refmeta>
7886<refnamediv>
7887 <refname>mod_delayed_work</refname>
7888 <refpurpose>
7889     modify delay of or queue a delayed work
7890 </refpurpose>
7891</refnamediv>
7892<refsynopsisdiv>
7893 <title>Synopsis</title>
7894  <funcsynopsis><funcprototype>
7895   <funcdef>bool <function>mod_delayed_work </function></funcdef>
7896   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
7897   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
7898   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
7899  </funcprototype></funcsynopsis>
7900</refsynopsisdiv>
7901<refsect1>
7902 <title>Arguments</title>
7903 <variablelist>
7904  <varlistentry>
7905   <term><parameter>wq</parameter></term>
7906   <listitem>
7907    <para>
7908     workqueue to use
7909    </para>
7910   </listitem>
7911  </varlistentry>
7912  <varlistentry>
7913   <term><parameter>dwork</parameter></term>
7914   <listitem>
7915    <para>
7916     work to queue
7917    </para>
7918   </listitem>
7919  </varlistentry>
7920  <varlistentry>
7921   <term><parameter>delay</parameter></term>
7922   <listitem>
7923    <para>
7924     number of jiffies to wait before queueing
7925    </para>
7926   </listitem>
7927  </varlistentry>
7928 </variablelist>
7929</refsect1>
7930<refsect1>
7931<title>Description</title>
7932<para>
7933   <function><link linkend="API-mod-delayed-work-on">mod_delayed_work_on</link></function> on local CPU.
7934</para>
7935</refsect1>
7936</refentry>
7937
7938<refentry id="API-schedule-work-on">
7939<refentryinfo>
7940 <title>LINUX</title>
7941 <productname>Kernel Hackers Manual</productname>
7942 <date>July 2017</date>
7943</refentryinfo>
7944<refmeta>
7945 <refentrytitle><phrase>schedule_work_on</phrase></refentrytitle>
7946 <manvolnum>9</manvolnum>
7947 <refmiscinfo class="version">4.4.14</refmiscinfo>
7948</refmeta>
7949<refnamediv>
7950 <refname>schedule_work_on</refname>
7951 <refpurpose>
7952     put work task on a specific cpu
7953 </refpurpose>
7954</refnamediv>
7955<refsynopsisdiv>
7956 <title>Synopsis</title>
7957  <funcsynopsis><funcprototype>
7958   <funcdef>bool <function>schedule_work_on </function></funcdef>
7959   <paramdef>int <parameter>cpu</parameter></paramdef>
7960   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
7961  </funcprototype></funcsynopsis>
7962</refsynopsisdiv>
7963<refsect1>
7964 <title>Arguments</title>
7965 <variablelist>
7966  <varlistentry>
7967   <term><parameter>cpu</parameter></term>
7968   <listitem>
7969    <para>
7970     cpu to put the work task on
7971    </para>
7972   </listitem>
7973  </varlistentry>
7974  <varlistentry>
7975   <term><parameter>work</parameter></term>
7976   <listitem>
7977    <para>
7978     job to be done
7979    </para>
7980   </listitem>
7981  </varlistentry>
7982 </variablelist>
7983</refsect1>
7984<refsect1>
7985<title>Description</title>
7986<para>
7987   This puts a job on a specific cpu
7988</para>
7989</refsect1>
7990</refentry>
7991
7992<refentry id="API-schedule-work">
7993<refentryinfo>
7994 <title>LINUX</title>
7995 <productname>Kernel Hackers Manual</productname>
7996 <date>July 2017</date>
7997</refentryinfo>
7998<refmeta>
7999 <refentrytitle><phrase>schedule_work</phrase></refentrytitle>
8000 <manvolnum>9</manvolnum>
8001 <refmiscinfo class="version">4.4.14</refmiscinfo>
8002</refmeta>
8003<refnamediv>
8004 <refname>schedule_work</refname>
8005 <refpurpose>
8006     put work task in global workqueue
8007 </refpurpose>
8008</refnamediv>
8009<refsynopsisdiv>
8010 <title>Synopsis</title>
8011  <funcsynopsis><funcprototype>
8012   <funcdef>bool <function>schedule_work </function></funcdef>
8013   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
8014  </funcprototype></funcsynopsis>
8015</refsynopsisdiv>
8016<refsect1>
8017 <title>Arguments</title>
8018 <variablelist>
8019  <varlistentry>
8020   <term><parameter>work</parameter></term>
8021   <listitem>
8022    <para>
8023     job to be done
8024    </para>
8025   </listitem>
8026  </varlistentry>
8027 </variablelist>
8028</refsect1>
8029<refsect1>
8030<title>Description</title>
8031<para>
8032   Returns <constant>false</constant> if <parameter>work</parameter> was already on the kernel-global workqueue and
8033   <constant>true</constant> otherwise.
8034   </para><para>
8035
8036   This puts a job in the kernel-global workqueue if it was not already
8037   queued and leaves it in the same position on the kernel-global
8038   workqueue otherwise.
8039</para>
8040</refsect1>
8041</refentry>
8042
8043<refentry id="API-flush-scheduled-work">
8044<refentryinfo>
8045 <title>LINUX</title>
8046 <productname>Kernel Hackers Manual</productname>
8047 <date>July 2017</date>
8048</refentryinfo>
8049<refmeta>
8050 <refentrytitle><phrase>flush_scheduled_work</phrase></refentrytitle>
8051 <manvolnum>9</manvolnum>
8052 <refmiscinfo class="version">4.4.14</refmiscinfo>
8053</refmeta>
8054<refnamediv>
8055 <refname>flush_scheduled_work</refname>
8056 <refpurpose>
8057     ensure that any scheduled work has run to completion.
8058 </refpurpose>
8059</refnamediv>
8060<refsynopsisdiv>
8061 <title>Synopsis</title>
8062  <funcsynopsis><funcprototype>
8063   <funcdef>void <function>flush_scheduled_work </function></funcdef>
8064   <paramdef> <parameter>void</parameter></paramdef>
8065  </funcprototype></funcsynopsis>
8066</refsynopsisdiv>
8067<refsect1>
8068 <title>Arguments</title>
8069 <variablelist>
8070  <varlistentry>
8071   <term><parameter>void</parameter></term>
8072   <listitem>
8073    <para>
8074     no arguments
8075    </para>
8076   </listitem>
8077  </varlistentry>
8078 </variablelist>
8079</refsect1>
8080<refsect1>
8081<title>Description</title>
8082<para>
8083   </para><para>
8084
8085   Forces execution of the kernel-global workqueue and blocks until its
8086   completion.
8087   </para><para>
8088
8089   Think twice before calling this function!  It's very easy to get into
8090   trouble if you don't take great care.  Either of the following situations
8091</para>
8092</refsect1>
8093<refsect1>
8094<title>will lead to deadlock</title>
8095<para>
8096   </para><para>
8097
8098   One of the work items currently on the workqueue needs to acquire
8099   a lock held by your code or its caller.
8100   </para><para>
8101
8102   Your code is running in the context of a work routine.
8103   </para><para>
8104
8105   They will be detected by lockdep when they occur, but the first might not
8106   occur very often.  It depends on what work items are on the workqueue and
8107   what locks they need, which you have no control over.
8108   </para><para>
8109
8110   In most situations flushing the entire workqueue is overkill; you merely
8111   need to know that a particular work item isn't queued and isn't running.
8112   In such cases you should use <function><link linkend="API-cancel-delayed-work-sync">cancel_delayed_work_sync</link></function> or
8113   <function><link linkend="API-cancel-work-sync">cancel_work_sync</link></function> instead.
8114</para>
8115</refsect1>
8116</refentry>
8117
8118<refentry id="API-schedule-delayed-work-on">
8119<refentryinfo>
8120 <title>LINUX</title>
8121 <productname>Kernel Hackers Manual</productname>
8122 <date>July 2017</date>
8123</refentryinfo>
8124<refmeta>
8125 <refentrytitle><phrase>schedule_delayed_work_on</phrase></refentrytitle>
8126 <manvolnum>9</manvolnum>
8127 <refmiscinfo class="version">4.4.14</refmiscinfo>
8128</refmeta>
8129<refnamediv>
8130 <refname>schedule_delayed_work_on</refname>
8131 <refpurpose>
8132     queue work in global workqueue on CPU after delay
8133 </refpurpose>
8134</refnamediv>
8135<refsynopsisdiv>
8136 <title>Synopsis</title>
8137  <funcsynopsis><funcprototype>
8138   <funcdef>bool <function>schedule_delayed_work_on </function></funcdef>
8139   <paramdef>int <parameter>cpu</parameter></paramdef>
8140   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8141   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
8142  </funcprototype></funcsynopsis>
8143</refsynopsisdiv>
8144<refsect1>
8145 <title>Arguments</title>
8146 <variablelist>
8147  <varlistentry>
8148   <term><parameter>cpu</parameter></term>
8149   <listitem>
8150    <para>
8151     cpu to use
8152    </para>
8153   </listitem>
8154  </varlistentry>
8155  <varlistentry>
8156   <term><parameter>dwork</parameter></term>
8157   <listitem>
8158    <para>
8159     job to be done
8160    </para>
8161   </listitem>
8162  </varlistentry>
8163  <varlistentry>
8164   <term><parameter>delay</parameter></term>
8165   <listitem>
8166    <para>
8167     number of jiffies to wait
8168    </para>
8169   </listitem>
8170  </varlistentry>
8171 </variablelist>
8172</refsect1>
8173<refsect1>
8174<title>Description</title>
8175<para>
8176   After waiting for a given time this puts a job in the kernel-global
8177   workqueue on the specified CPU.
8178</para>
8179</refsect1>
8180</refentry>
8181
8182<refentry id="API-schedule-delayed-work">
8183<refentryinfo>
8184 <title>LINUX</title>
8185 <productname>Kernel Hackers Manual</productname>
8186 <date>July 2017</date>
8187</refentryinfo>
8188<refmeta>
8189 <refentrytitle><phrase>schedule_delayed_work</phrase></refentrytitle>
8190 <manvolnum>9</manvolnum>
8191 <refmiscinfo class="version">4.4.14</refmiscinfo>
8192</refmeta>
8193<refnamediv>
8194 <refname>schedule_delayed_work</refname>
8195 <refpurpose>
8196     put work task in global workqueue after delay
8197 </refpurpose>
8198</refnamediv>
8199<refsynopsisdiv>
8200 <title>Synopsis</title>
8201  <funcsynopsis><funcprototype>
8202   <funcdef>bool <function>schedule_delayed_work </function></funcdef>
8203   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8204   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
8205  </funcprototype></funcsynopsis>
8206</refsynopsisdiv>
8207<refsect1>
8208 <title>Arguments</title>
8209 <variablelist>
8210  <varlistentry>
8211   <term><parameter>dwork</parameter></term>
8212   <listitem>
8213    <para>
8214     job to be done
8215    </para>
8216   </listitem>
8217  </varlistentry>
8218  <varlistentry>
8219   <term><parameter>delay</parameter></term>
8220   <listitem>
8221    <para>
8222     number of jiffies to wait or 0 for immediate execution
8223    </para>
8224   </listitem>
8225  </varlistentry>
8226 </variablelist>
8227</refsect1>
8228<refsect1>
8229<title>Description</title>
8230<para>
8231   After waiting for a given time this puts a job in the kernel-global
8232   workqueue.
8233</para>
8234</refsect1>
8235</refentry>
8236
8237<refentry id="API-keventd-up">
8238<refentryinfo>
8239 <title>LINUX</title>
8240 <productname>Kernel Hackers Manual</productname>
8241 <date>July 2017</date>
8242</refentryinfo>
8243<refmeta>
8244 <refentrytitle><phrase>keventd_up</phrase></refentrytitle>
8245 <manvolnum>9</manvolnum>
8246 <refmiscinfo class="version">4.4.14</refmiscinfo>
8247</refmeta>
8248<refnamediv>
8249 <refname>keventd_up</refname>
8250 <refpurpose>
8251     is workqueue initialized yet?
8252 </refpurpose>
8253</refnamediv>
8254<refsynopsisdiv>
8255 <title>Synopsis</title>
8256  <funcsynopsis><funcprototype>
8257   <funcdef>bool <function>keventd_up </function></funcdef>
8258   <paramdef> <parameter>void</parameter></paramdef>
8259  </funcprototype></funcsynopsis>
8260</refsynopsisdiv>
8261<refsect1>
8262 <title>Arguments</title>
8263 <variablelist>
8264  <varlistentry>
8265   <term><parameter>void</parameter></term>
8266   <listitem>
8267    <para>
8268     no arguments
8269    </para>
8270   </listitem>
8271  </varlistentry>
8272 </variablelist>
8273</refsect1>
8274</refentry>
8275
8276<!-- kernel/workqueue.c -->
8277<refentry id="API-queue-work-on">
8278<refentryinfo>
8279 <title>LINUX</title>
8280 <productname>Kernel Hackers Manual</productname>
8281 <date>July 2017</date>
8282</refentryinfo>
8283<refmeta>
8284 <refentrytitle><phrase>queue_work_on</phrase></refentrytitle>
8285 <manvolnum>9</manvolnum>
8286 <refmiscinfo class="version">4.4.14</refmiscinfo>
8287</refmeta>
8288<refnamediv>
8289 <refname>queue_work_on</refname>
8290 <refpurpose>
8291  queue work on specific cpu
8292 </refpurpose>
8293</refnamediv>
8294<refsynopsisdiv>
8295 <title>Synopsis</title>
8296  <funcsynopsis><funcprototype>
8297   <funcdef>bool <function>queue_work_on </function></funcdef>
8298   <paramdef>int <parameter>cpu</parameter></paramdef>
8299   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8300   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
8301  </funcprototype></funcsynopsis>
8302</refsynopsisdiv>
8303<refsect1>
8304 <title>Arguments</title>
8305 <variablelist>
8306  <varlistentry>
8307   <term><parameter>cpu</parameter></term>
8308   <listitem>
8309    <para>
8310     CPU number to execute work on
8311    </para>
8312   </listitem>
8313  </varlistentry>
8314  <varlistentry>
8315   <term><parameter>wq</parameter></term>
8316   <listitem>
8317    <para>
8318     workqueue to use
8319    </para>
8320   </listitem>
8321  </varlistentry>
8322  <varlistentry>
8323   <term><parameter>work</parameter></term>
8324   <listitem>
8325    <para>
8326     work to queue
8327    </para>
8328   </listitem>
8329  </varlistentry>
8330 </variablelist>
8331</refsect1>
8332<refsect1>
8333<title>Description</title>
8334<para>
8335   We queue the work to a specific CPU, the caller must ensure it
8336   can't go away.
8337</para>
8338</refsect1>
8339<refsect1>
8340<title>Return</title>
8341<para>
8342   <constant>false</constant> if <parameter>work</parameter> was already on a queue, <constant>true</constant> otherwise.
8343</para>
8344</refsect1>
8345</refentry>
8346
8347<refentry id="API-queue-delayed-work-on">
8348<refentryinfo>
8349 <title>LINUX</title>
8350 <productname>Kernel Hackers Manual</productname>
8351 <date>July 2017</date>
8352</refentryinfo>
8353<refmeta>
8354 <refentrytitle><phrase>queue_delayed_work_on</phrase></refentrytitle>
8355 <manvolnum>9</manvolnum>
8356 <refmiscinfo class="version">4.4.14</refmiscinfo>
8357</refmeta>
8358<refnamediv>
8359 <refname>queue_delayed_work_on</refname>
8360 <refpurpose>
8361     queue work on specific CPU after delay
8362 </refpurpose>
8363</refnamediv>
8364<refsynopsisdiv>
8365 <title>Synopsis</title>
8366  <funcsynopsis><funcprototype>
8367   <funcdef>bool <function>queue_delayed_work_on </function></funcdef>
8368   <paramdef>int <parameter>cpu</parameter></paramdef>
8369   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8370   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8371   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
8372  </funcprototype></funcsynopsis>
8373</refsynopsisdiv>
8374<refsect1>
8375 <title>Arguments</title>
8376 <variablelist>
8377  <varlistentry>
8378   <term><parameter>cpu</parameter></term>
8379   <listitem>
8380    <para>
8381     CPU number to execute work on
8382    </para>
8383   </listitem>
8384  </varlistentry>
8385  <varlistentry>
8386   <term><parameter>wq</parameter></term>
8387   <listitem>
8388    <para>
8389     workqueue to use
8390    </para>
8391   </listitem>
8392  </varlistentry>
8393  <varlistentry>
8394   <term><parameter>dwork</parameter></term>
8395   <listitem>
8396    <para>
8397     work to queue
8398    </para>
8399   </listitem>
8400  </varlistentry>
8401  <varlistentry>
8402   <term><parameter>delay</parameter></term>
8403   <listitem>
8404    <para>
8405     number of jiffies to wait before queueing
8406    </para>
8407   </listitem>
8408  </varlistentry>
8409 </variablelist>
8410</refsect1>
8411<refsect1>
8412<title>Return</title>
8413<para>
8414   <constant>false</constant> if <parameter>work</parameter> was already on a queue, <constant>true</constant> otherwise.  If
8415   <parameter>delay</parameter> is zero and <parameter>dwork</parameter> is idle, it will be scheduled for immediate
8416   execution.
8417</para>
8418</refsect1>
8419</refentry>
8420
8421<refentry id="API-mod-delayed-work-on">
8422<refentryinfo>
8423 <title>LINUX</title>
8424 <productname>Kernel Hackers Manual</productname>
8425 <date>July 2017</date>
8426</refentryinfo>
8427<refmeta>
8428 <refentrytitle><phrase>mod_delayed_work_on</phrase></refentrytitle>
8429 <manvolnum>9</manvolnum>
8430 <refmiscinfo class="version">4.4.14</refmiscinfo>
8431</refmeta>
8432<refnamediv>
8433 <refname>mod_delayed_work_on</refname>
8434 <refpurpose>
8435     modify delay of or queue a delayed work on specific CPU
8436 </refpurpose>
8437</refnamediv>
8438<refsynopsisdiv>
8439 <title>Synopsis</title>
8440  <funcsynopsis><funcprototype>
8441   <funcdef>bool <function>mod_delayed_work_on </function></funcdef>
8442   <paramdef>int <parameter>cpu</parameter></paramdef>
8443   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8444   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8445   <paramdef>unsigned long <parameter>delay</parameter></paramdef>
8446  </funcprototype></funcsynopsis>
8447</refsynopsisdiv>
8448<refsect1>
8449 <title>Arguments</title>
8450 <variablelist>
8451  <varlistentry>
8452   <term><parameter>cpu</parameter></term>
8453   <listitem>
8454    <para>
8455     CPU number to execute work on
8456    </para>
8457   </listitem>
8458  </varlistentry>
8459  <varlistentry>
8460   <term><parameter>wq</parameter></term>
8461   <listitem>
8462    <para>
8463     workqueue to use
8464    </para>
8465   </listitem>
8466  </varlistentry>
8467  <varlistentry>
8468   <term><parameter>dwork</parameter></term>
8469   <listitem>
8470    <para>
8471     work to queue
8472    </para>
8473   </listitem>
8474  </varlistentry>
8475  <varlistentry>
8476   <term><parameter>delay</parameter></term>
8477   <listitem>
8478    <para>
8479     number of jiffies to wait before queueing
8480    </para>
8481   </listitem>
8482  </varlistentry>
8483 </variablelist>
8484</refsect1>
8485<refsect1>
8486<title>Description</title>
8487<para>
8488   If <parameter>dwork</parameter> is idle, equivalent to <function><link linkend="API-queue-delayed-work-on">queue_delayed_work_on</link></function>; otherwise,
8489   modify <parameter>dwork</parameter>'s timer so that it expires after <parameter>delay</parameter>.  If <parameter>delay</parameter> is
8490   zero, <parameter>work</parameter> is guaranteed to be scheduled immediately regardless of its
8491   current state.
8492</para>
8493</refsect1>
8494<refsect1>
8495<title>Return</title>
8496<para>
8497   <constant>false</constant> if <parameter>dwork</parameter> was idle and queued, <constant>true</constant> if <parameter>dwork</parameter> was
8498   pending and its timer was modified.
8499   </para><para>
8500
8501   This function is safe to call from any context including IRQ handler.
8502   See <function>try_to_grab_pending</function> for details.
8503</para>
8504</refsect1>
8505</refentry>
8506
8507<refentry id="API-flush-workqueue">
8508<refentryinfo>
8509 <title>LINUX</title>
8510 <productname>Kernel Hackers Manual</productname>
8511 <date>July 2017</date>
8512</refentryinfo>
8513<refmeta>
8514 <refentrytitle><phrase>flush_workqueue</phrase></refentrytitle>
8515 <manvolnum>9</manvolnum>
8516 <refmiscinfo class="version">4.4.14</refmiscinfo>
8517</refmeta>
8518<refnamediv>
8519 <refname>flush_workqueue</refname>
8520 <refpurpose>
8521     ensure that any scheduled work has run to completion.
8522 </refpurpose>
8523</refnamediv>
8524<refsynopsisdiv>
8525 <title>Synopsis</title>
8526  <funcsynopsis><funcprototype>
8527   <funcdef>void <function>flush_workqueue </function></funcdef>
8528   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8529  </funcprototype></funcsynopsis>
8530</refsynopsisdiv>
8531<refsect1>
8532 <title>Arguments</title>
8533 <variablelist>
8534  <varlistentry>
8535   <term><parameter>wq</parameter></term>
8536   <listitem>
8537    <para>
8538     workqueue to flush
8539    </para>
8540   </listitem>
8541  </varlistentry>
8542 </variablelist>
8543</refsect1>
8544<refsect1>
8545<title>Description</title>
8546<para>
8547   This function sleeps until all work items which were queued on entry
8548   have finished execution, but it is not livelocked by new incoming ones.
8549</para>
8550</refsect1>
8551</refentry>
8552
8553<refentry id="API-drain-workqueue">
8554<refentryinfo>
8555 <title>LINUX</title>
8556 <productname>Kernel Hackers Manual</productname>
8557 <date>July 2017</date>
8558</refentryinfo>
8559<refmeta>
8560 <refentrytitle><phrase>drain_workqueue</phrase></refentrytitle>
8561 <manvolnum>9</manvolnum>
8562 <refmiscinfo class="version">4.4.14</refmiscinfo>
8563</refmeta>
8564<refnamediv>
8565 <refname>drain_workqueue</refname>
8566 <refpurpose>
8567     drain a workqueue
8568 </refpurpose>
8569</refnamediv>
8570<refsynopsisdiv>
8571 <title>Synopsis</title>
8572  <funcsynopsis><funcprototype>
8573   <funcdef>void <function>drain_workqueue </function></funcdef>
8574   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8575  </funcprototype></funcsynopsis>
8576</refsynopsisdiv>
8577<refsect1>
8578 <title>Arguments</title>
8579 <variablelist>
8580  <varlistentry>
8581   <term><parameter>wq</parameter></term>
8582   <listitem>
8583    <para>
8584     workqueue to drain
8585    </para>
8586   </listitem>
8587  </varlistentry>
8588 </variablelist>
8589</refsect1>
8590<refsect1>
8591<title>Description</title>
8592<para>
8593   Wait until the workqueue becomes empty.  While draining is in progress,
8594   only chain queueing is allowed.  IOW, only currently pending or running
8595   work items on <parameter>wq</parameter> can queue further work items on it.  <parameter>wq</parameter> is flushed
8596   repeatedly until it becomes empty.  The number of flushing is determined
8597   by the depth of chaining and should be relatively short.  Whine if it
8598   takes too long.
8599</para>
8600</refsect1>
8601</refentry>
8602
8603<refentry id="API-flush-work">
8604<refentryinfo>
8605 <title>LINUX</title>
8606 <productname>Kernel Hackers Manual</productname>
8607 <date>July 2017</date>
8608</refentryinfo>
8609<refmeta>
8610 <refentrytitle><phrase>flush_work</phrase></refentrytitle>
8611 <manvolnum>9</manvolnum>
8612 <refmiscinfo class="version">4.4.14</refmiscinfo>
8613</refmeta>
8614<refnamediv>
8615 <refname>flush_work</refname>
8616 <refpurpose>
8617     wait for a work to finish executing the last queueing instance
8618 </refpurpose>
8619</refnamediv>
8620<refsynopsisdiv>
8621 <title>Synopsis</title>
8622  <funcsynopsis><funcprototype>
8623   <funcdef>bool <function>flush_work </function></funcdef>
8624   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
8625  </funcprototype></funcsynopsis>
8626</refsynopsisdiv>
8627<refsect1>
8628 <title>Arguments</title>
8629 <variablelist>
8630  <varlistentry>
8631   <term><parameter>work</parameter></term>
8632   <listitem>
8633    <para>
8634     the work to flush
8635    </para>
8636   </listitem>
8637  </varlistentry>
8638 </variablelist>
8639</refsect1>
8640<refsect1>
8641<title>Description</title>
8642<para>
8643   Wait until <parameter>work</parameter> has finished execution.  <parameter>work</parameter> is guaranteed to be idle
8644   on return if it hasn't been requeued since flush started.
8645</para>
8646</refsect1>
8647<refsect1>
8648<title>Return</title>
8649<para>
8650   <constant>true</constant> if <function><link linkend="API-flush-work">flush_work</link></function> waited for the work to finish execution,
8651   <constant>false</constant> if it was already idle.
8652</para>
8653</refsect1>
8654</refentry>
8655
8656<refentry id="API-cancel-work-sync">
8657<refentryinfo>
8658 <title>LINUX</title>
8659 <productname>Kernel Hackers Manual</productname>
8660 <date>July 2017</date>
8661</refentryinfo>
8662<refmeta>
8663 <refentrytitle><phrase>cancel_work_sync</phrase></refentrytitle>
8664 <manvolnum>9</manvolnum>
8665 <refmiscinfo class="version">4.4.14</refmiscinfo>
8666</refmeta>
8667<refnamediv>
8668 <refname>cancel_work_sync</refname>
8669 <refpurpose>
8670     cancel a work and wait for it to finish
8671 </refpurpose>
8672</refnamediv>
8673<refsynopsisdiv>
8674 <title>Synopsis</title>
8675  <funcsynopsis><funcprototype>
8676   <funcdef>bool <function>cancel_work_sync </function></funcdef>
8677   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
8678  </funcprototype></funcsynopsis>
8679</refsynopsisdiv>
8680<refsect1>
8681 <title>Arguments</title>
8682 <variablelist>
8683  <varlistentry>
8684   <term><parameter>work</parameter></term>
8685   <listitem>
8686    <para>
8687     the work to cancel
8688    </para>
8689   </listitem>
8690  </varlistentry>
8691 </variablelist>
8692</refsect1>
8693<refsect1>
8694<title>Description</title>
8695<para>
8696   Cancel <parameter>work</parameter> and wait for its execution to finish.  This function
8697   can be used even if the work re-queues itself or migrates to
8698   another workqueue.  On return from this function, <parameter>work</parameter> is
8699   guaranteed to be not pending or executing on any CPU.
8700   </para><para>
8701
8702   cancel_work_sync(<structname>delayed_work</structname>-&gt;work) must not be used for
8703   delayed_work's.  Use <function><link linkend="API-cancel-delayed-work-sync">cancel_delayed_work_sync</link></function> instead.
8704   </para><para>
8705
8706   The caller must ensure that the workqueue on which <parameter>work</parameter> was last
8707   queued can't be destroyed before this function returns.
8708</para>
8709</refsect1>
8710<refsect1>
8711<title>Return</title>
8712<para>
8713   <constant>true</constant> if <parameter>work</parameter> was pending, <constant>false</constant> otherwise.
8714</para>
8715</refsect1>
8716</refentry>
8717
8718<refentry id="API-flush-delayed-work">
8719<refentryinfo>
8720 <title>LINUX</title>
8721 <productname>Kernel Hackers Manual</productname>
8722 <date>July 2017</date>
8723</refentryinfo>
8724<refmeta>
8725 <refentrytitle><phrase>flush_delayed_work</phrase></refentrytitle>
8726 <manvolnum>9</manvolnum>
8727 <refmiscinfo class="version">4.4.14</refmiscinfo>
8728</refmeta>
8729<refnamediv>
8730 <refname>flush_delayed_work</refname>
8731 <refpurpose>
8732     wait for a dwork to finish executing the last queueing
8733 </refpurpose>
8734</refnamediv>
8735<refsynopsisdiv>
8736 <title>Synopsis</title>
8737  <funcsynopsis><funcprototype>
8738   <funcdef>bool <function>flush_delayed_work </function></funcdef>
8739   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8740  </funcprototype></funcsynopsis>
8741</refsynopsisdiv>
8742<refsect1>
8743 <title>Arguments</title>
8744 <variablelist>
8745  <varlistentry>
8746   <term><parameter>dwork</parameter></term>
8747   <listitem>
8748    <para>
8749     the delayed work to flush
8750    </para>
8751   </listitem>
8752  </varlistentry>
8753 </variablelist>
8754</refsect1>
8755<refsect1>
8756<title>Description</title>
8757<para>
8758   Delayed timer is cancelled and the pending work is queued for
8759   immediate execution.  Like <function><link linkend="API-flush-work">flush_work</link></function>, this function only
8760   considers the last queueing instance of <parameter>dwork</parameter>.
8761</para>
8762</refsect1>
8763<refsect1>
8764<title>Return</title>
8765<para>
8766   <constant>true</constant> if <function><link linkend="API-flush-work">flush_work</link></function> waited for the work to finish execution,
8767   <constant>false</constant> if it was already idle.
8768</para>
8769</refsect1>
8770</refentry>
8771
8772<refentry id="API-cancel-delayed-work">
8773<refentryinfo>
8774 <title>LINUX</title>
8775 <productname>Kernel Hackers Manual</productname>
8776 <date>July 2017</date>
8777</refentryinfo>
8778<refmeta>
8779 <refentrytitle><phrase>cancel_delayed_work</phrase></refentrytitle>
8780 <manvolnum>9</manvolnum>
8781 <refmiscinfo class="version">4.4.14</refmiscinfo>
8782</refmeta>
8783<refnamediv>
8784 <refname>cancel_delayed_work</refname>
8785 <refpurpose>
8786     cancel a delayed work
8787 </refpurpose>
8788</refnamediv>
8789<refsynopsisdiv>
8790 <title>Synopsis</title>
8791  <funcsynopsis><funcprototype>
8792   <funcdef>bool <function>cancel_delayed_work </function></funcdef>
8793   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8794  </funcprototype></funcsynopsis>
8795</refsynopsisdiv>
8796<refsect1>
8797 <title>Arguments</title>
8798 <variablelist>
8799  <varlistentry>
8800   <term><parameter>dwork</parameter></term>
8801   <listitem>
8802    <para>
8803     delayed_work to cancel
8804    </para>
8805   </listitem>
8806  </varlistentry>
8807 </variablelist>
8808</refsect1>
8809<refsect1>
8810<title>Description</title>
8811<para>
8812   Kill off a pending delayed_work.
8813</para>
8814</refsect1>
8815<refsect1>
8816<title>Return</title>
8817<para>
8818   <constant>true</constant> if <parameter>dwork</parameter> was pending and canceled; <constant>false</constant> if it wasn't
8819   pending.
8820</para>
8821</refsect1>
8822<refsect1>
8823<title>Note</title>
8824<para>
8825   The work callback function may still be running on return, unless
8826   it returns <constant>true</constant> and the work doesn't re-arm itself.  Explicitly flush or
8827   use <function><link linkend="API-cancel-delayed-work-sync">cancel_delayed_work_sync</link></function> to wait on it.
8828   </para><para>
8829
8830   This function is safe to call from any context including IRQ handler.
8831</para>
8832</refsect1>
8833</refentry>
8834
8835<refentry id="API-cancel-delayed-work-sync">
8836<refentryinfo>
8837 <title>LINUX</title>
8838 <productname>Kernel Hackers Manual</productname>
8839 <date>July 2017</date>
8840</refentryinfo>
8841<refmeta>
8842 <refentrytitle><phrase>cancel_delayed_work_sync</phrase></refentrytitle>
8843 <manvolnum>9</manvolnum>
8844 <refmiscinfo class="version">4.4.14</refmiscinfo>
8845</refmeta>
8846<refnamediv>
8847 <refname>cancel_delayed_work_sync</refname>
8848 <refpurpose>
8849     cancel a delayed work and wait for it to finish
8850 </refpurpose>
8851</refnamediv>
8852<refsynopsisdiv>
8853 <title>Synopsis</title>
8854  <funcsynopsis><funcprototype>
8855   <funcdef>bool <function>cancel_delayed_work_sync </function></funcdef>
8856   <paramdef>struct delayed_work * <parameter>dwork</parameter></paramdef>
8857  </funcprototype></funcsynopsis>
8858</refsynopsisdiv>
8859<refsect1>
8860 <title>Arguments</title>
8861 <variablelist>
8862  <varlistentry>
8863   <term><parameter>dwork</parameter></term>
8864   <listitem>
8865    <para>
8866     the delayed work cancel
8867    </para>
8868   </listitem>
8869  </varlistentry>
8870 </variablelist>
8871</refsect1>
8872<refsect1>
8873<title>Description</title>
8874<para>
8875   This is <function><link linkend="API-cancel-work-sync">cancel_work_sync</link></function> for delayed works.
8876</para>
8877</refsect1>
8878<refsect1>
8879<title>Return</title>
8880<para>
8881   <constant>true</constant> if <parameter>dwork</parameter> was pending, <constant>false</constant> otherwise.
8882</para>
8883</refsect1>
8884</refentry>
8885
8886<refentry id="API-execute-in-process-context">
8887<refentryinfo>
8888 <title>LINUX</title>
8889 <productname>Kernel Hackers Manual</productname>
8890 <date>July 2017</date>
8891</refentryinfo>
8892<refmeta>
8893 <refentrytitle><phrase>execute_in_process_context</phrase></refentrytitle>
8894 <manvolnum>9</manvolnum>
8895 <refmiscinfo class="version">4.4.14</refmiscinfo>
8896</refmeta>
8897<refnamediv>
8898 <refname>execute_in_process_context</refname>
8899 <refpurpose>
8900     reliably execute the routine with user context
8901 </refpurpose>
8902</refnamediv>
8903<refsynopsisdiv>
8904 <title>Synopsis</title>
8905  <funcsynopsis><funcprototype>
8906   <funcdef>int <function>execute_in_process_context </function></funcdef>
8907   <paramdef>work_func_t <parameter>fn</parameter></paramdef>
8908   <paramdef>struct execute_work * <parameter>ew</parameter></paramdef>
8909  </funcprototype></funcsynopsis>
8910</refsynopsisdiv>
8911<refsect1>
8912 <title>Arguments</title>
8913 <variablelist>
8914  <varlistentry>
8915   <term><parameter>fn</parameter></term>
8916   <listitem>
8917    <para>
8918     the function to execute
8919    </para>
8920   </listitem>
8921  </varlistentry>
8922  <varlistentry>
8923   <term><parameter>ew</parameter></term>
8924   <listitem>
8925    <para>
8926     guaranteed storage for the execute work structure (must
8927     be available when the work executes)
8928    </para>
8929   </listitem>
8930  </varlistentry>
8931 </variablelist>
8932</refsect1>
8933<refsect1>
8934<title>Description</title>
8935<para>
8936   Executes the function immediately if process context is available,
8937   otherwise schedules the function for delayed execution.
8938</para>
8939</refsect1>
8940<refsect1>
8941<title>Return</title>
8942<para>
8943   0 - function was executed
8944   1 - function was scheduled for execution
8945</para>
8946</refsect1>
8947</refentry>
8948
8949<refentry id="API-destroy-workqueue">
8950<refentryinfo>
8951 <title>LINUX</title>
8952 <productname>Kernel Hackers Manual</productname>
8953 <date>July 2017</date>
8954</refentryinfo>
8955<refmeta>
8956 <refentrytitle><phrase>destroy_workqueue</phrase></refentrytitle>
8957 <manvolnum>9</manvolnum>
8958 <refmiscinfo class="version">4.4.14</refmiscinfo>
8959</refmeta>
8960<refnamediv>
8961 <refname>destroy_workqueue</refname>
8962 <refpurpose>
8963     safely terminate a workqueue
8964 </refpurpose>
8965</refnamediv>
8966<refsynopsisdiv>
8967 <title>Synopsis</title>
8968  <funcsynopsis><funcprototype>
8969   <funcdef>void <function>destroy_workqueue </function></funcdef>
8970   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
8971  </funcprototype></funcsynopsis>
8972</refsynopsisdiv>
8973<refsect1>
8974 <title>Arguments</title>
8975 <variablelist>
8976  <varlistentry>
8977   <term><parameter>wq</parameter></term>
8978   <listitem>
8979    <para>
8980     target workqueue
8981    </para>
8982   </listitem>
8983  </varlistentry>
8984 </variablelist>
8985</refsect1>
8986<refsect1>
8987<title>Description</title>
8988<para>
8989   Safely destroy a workqueue. All work currently pending will be done first.
8990</para>
8991</refsect1>
8992</refentry>
8993
8994<refentry id="API-workqueue-set-max-active">
8995<refentryinfo>
8996 <title>LINUX</title>
8997 <productname>Kernel Hackers Manual</productname>
8998 <date>July 2017</date>
8999</refentryinfo>
9000<refmeta>
9001 <refentrytitle><phrase>workqueue_set_max_active</phrase></refentrytitle>
9002 <manvolnum>9</manvolnum>
9003 <refmiscinfo class="version">4.4.14</refmiscinfo>
9004</refmeta>
9005<refnamediv>
9006 <refname>workqueue_set_max_active</refname>
9007 <refpurpose>
9008     adjust max_active of a workqueue
9009 </refpurpose>
9010</refnamediv>
9011<refsynopsisdiv>
9012 <title>Synopsis</title>
9013  <funcsynopsis><funcprototype>
9014   <funcdef>void <function>workqueue_set_max_active </function></funcdef>
9015   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
9016   <paramdef>int <parameter>max_active</parameter></paramdef>
9017  </funcprototype></funcsynopsis>
9018</refsynopsisdiv>
9019<refsect1>
9020 <title>Arguments</title>
9021 <variablelist>
9022  <varlistentry>
9023   <term><parameter>wq</parameter></term>
9024   <listitem>
9025    <para>
9026     target workqueue
9027    </para>
9028   </listitem>
9029  </varlistentry>
9030  <varlistentry>
9031   <term><parameter>max_active</parameter></term>
9032   <listitem>
9033    <para>
9034     new max_active value.
9035    </para>
9036   </listitem>
9037  </varlistentry>
9038 </variablelist>
9039</refsect1>
9040<refsect1>
9041<title>Description</title>
9042<para>
9043   Set max_active of <parameter>wq</parameter> to <parameter>max_active</parameter>.
9044</para>
9045</refsect1>
9046<refsect1>
9047<title>CONTEXT</title>
9048<para>
9049   Don't call from IRQ context.
9050</para>
9051</refsect1>
9052</refentry>
9053
9054<refentry id="API-workqueue-congested">
9055<refentryinfo>
9056 <title>LINUX</title>
9057 <productname>Kernel Hackers Manual</productname>
9058 <date>July 2017</date>
9059</refentryinfo>
9060<refmeta>
9061 <refentrytitle><phrase>workqueue_congested</phrase></refentrytitle>
9062 <manvolnum>9</manvolnum>
9063 <refmiscinfo class="version">4.4.14</refmiscinfo>
9064</refmeta>
9065<refnamediv>
9066 <refname>workqueue_congested</refname>
9067 <refpurpose>
9068     test whether a workqueue is congested
9069 </refpurpose>
9070</refnamediv>
9071<refsynopsisdiv>
9072 <title>Synopsis</title>
9073  <funcsynopsis><funcprototype>
9074   <funcdef>bool <function>workqueue_congested </function></funcdef>
9075   <paramdef>int <parameter>cpu</parameter></paramdef>
9076   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
9077  </funcprototype></funcsynopsis>
9078</refsynopsisdiv>
9079<refsect1>
9080 <title>Arguments</title>
9081 <variablelist>
9082  <varlistentry>
9083   <term><parameter>cpu</parameter></term>
9084   <listitem>
9085    <para>
9086     CPU in question
9087    </para>
9088   </listitem>
9089  </varlistentry>
9090  <varlistentry>
9091   <term><parameter>wq</parameter></term>
9092   <listitem>
9093    <para>
9094     target workqueue
9095    </para>
9096   </listitem>
9097  </varlistentry>
9098 </variablelist>
9099</refsect1>
9100<refsect1>
9101<title>Description</title>
9102<para>
9103   Test whether <parameter>wq</parameter>'s cpu workqueue for <parameter>cpu</parameter> is congested.  There is
9104   no synchronization around this function and the test result is
9105   unreliable and only useful as advisory hints or for debugging.
9106   </para><para>
9107
9108   If <parameter>cpu</parameter> is WORK_CPU_UNBOUND, the test is performed on the local CPU.
9109   Note that both per-cpu and unbound workqueues may be associated with
9110   multiple pool_workqueues which have separate congested states.  A
9111   workqueue being congested on one CPU doesn't mean the workqueue is also
9112   contested on other CPUs / NUMA nodes.
9113</para>
9114</refsect1>
9115<refsect1>
9116<title>Return</title>
9117<para>
9118   <constant>true</constant> if congested, <constant>false</constant> otherwise.
9119</para>
9120</refsect1>
9121</refentry>
9122
9123<refentry id="API-work-busy">
9124<refentryinfo>
9125 <title>LINUX</title>
9126 <productname>Kernel Hackers Manual</productname>
9127 <date>July 2017</date>
9128</refentryinfo>
9129<refmeta>
9130 <refentrytitle><phrase>work_busy</phrase></refentrytitle>
9131 <manvolnum>9</manvolnum>
9132 <refmiscinfo class="version">4.4.14</refmiscinfo>
9133</refmeta>
9134<refnamediv>
9135 <refname>work_busy</refname>
9136 <refpurpose>
9137     test whether a work is currently pending or running
9138 </refpurpose>
9139</refnamediv>
9140<refsynopsisdiv>
9141 <title>Synopsis</title>
9142  <funcsynopsis><funcprototype>
9143   <funcdef>unsigned int <function>work_busy </function></funcdef>
9144   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
9145  </funcprototype></funcsynopsis>
9146</refsynopsisdiv>
9147<refsect1>
9148 <title>Arguments</title>
9149 <variablelist>
9150  <varlistentry>
9151   <term><parameter>work</parameter></term>
9152   <listitem>
9153    <para>
9154     the work to be tested
9155    </para>
9156   </listitem>
9157  </varlistentry>
9158 </variablelist>
9159</refsect1>
9160<refsect1>
9161<title>Description</title>
9162<para>
9163   Test whether <parameter>work</parameter> is currently pending or running.  There is no
9164   synchronization around this function and the test result is
9165   unreliable and only useful as advisory hints or for debugging.
9166</para>
9167</refsect1>
9168<refsect1>
9169<title>Return</title>
9170<para>
9171   OR'd bitmask of WORK_BUSY_* bits.
9172</para>
9173</refsect1>
9174</refentry>
9175
9176<refentry id="API-work-on-cpu">
9177<refentryinfo>
9178 <title>LINUX</title>
9179 <productname>Kernel Hackers Manual</productname>
9180 <date>July 2017</date>
9181</refentryinfo>
9182<refmeta>
9183 <refentrytitle><phrase>work_on_cpu</phrase></refentrytitle>
9184 <manvolnum>9</manvolnum>
9185 <refmiscinfo class="version">4.4.14</refmiscinfo>
9186</refmeta>
9187<refnamediv>
9188 <refname>work_on_cpu</refname>
9189 <refpurpose>
9190     run a function in user context on a particular cpu
9191 </refpurpose>
9192</refnamediv>
9193<refsynopsisdiv>
9194 <title>Synopsis</title>
9195  <funcsynopsis><funcprototype>
9196   <funcdef>long <function>work_on_cpu </function></funcdef>
9197   <paramdef>int <parameter>cpu</parameter></paramdef>
9198   <paramdef>long (*<parameter>fn</parameter>)
9199     <funcparams>void *</funcparams></paramdef>
9200   <paramdef>void * <parameter>arg</parameter></paramdef>
9201  </funcprototype></funcsynopsis>
9202</refsynopsisdiv>
9203<refsect1>
9204 <title>Arguments</title>
9205 <variablelist>
9206  <varlistentry>
9207   <term><parameter>cpu</parameter></term>
9208   <listitem>
9209    <para>
9210     the cpu to run on
9211    </para>
9212   </listitem>
9213  </varlistentry>
9214  <varlistentry>
9215   <term><parameter>fn</parameter></term>
9216   <listitem>
9217    <para>
9218     the function to run
9219    </para>
9220   </listitem>
9221  </varlistentry>
9222  <varlistentry>
9223   <term><parameter>arg</parameter></term>
9224   <listitem>
9225    <para>
9226     the function arg
9227    </para>
9228   </listitem>
9229  </varlistentry>
9230 </variablelist>
9231</refsect1>
9232<refsect1>
9233<title>Description</title>
9234<para>
9235   It is up to the caller to ensure that the cpu doesn't go offline.
9236   The caller must not hold any locks which would prevent <parameter>fn</parameter> from completing.
9237</para>
9238</refsect1>
9239<refsect1>
9240<title>Return</title>
9241<para>
9242   The value <parameter>fn</parameter> returns.
9243</para>
9244</refsect1>
9245</refentry>
9246
9247     </sect1>
9248     <sect1><title>Internal Functions</title>
9249<!-- kernel/exit.c -->
9250<refentry id="API-wait-task-stopped">
9251<refentryinfo>
9252 <title>LINUX</title>
9253 <productname>Kernel Hackers Manual</productname>
9254 <date>July 2017</date>
9255</refentryinfo>
9256<refmeta>
9257 <refentrytitle><phrase>wait_task_stopped</phrase></refentrytitle>
9258 <manvolnum>9</manvolnum>
9259 <refmiscinfo class="version">4.4.14</refmiscinfo>
9260</refmeta>
9261<refnamediv>
9262 <refname>wait_task_stopped</refname>
9263 <refpurpose>
9264  Wait for <constant>TASK_STOPPED</constant> or <constant>TASK_TRACED</constant>
9265 </refpurpose>
9266</refnamediv>
9267<refsynopsisdiv>
9268 <title>Synopsis</title>
9269  <funcsynopsis><funcprototype>
9270   <funcdef>int <function>wait_task_stopped </function></funcdef>
9271   <paramdef>struct wait_opts * <parameter>wo</parameter></paramdef>
9272   <paramdef>int <parameter>ptrace</parameter></paramdef>
9273   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
9274  </funcprototype></funcsynopsis>
9275</refsynopsisdiv>
9276<refsect1>
9277 <title>Arguments</title>
9278 <variablelist>
9279  <varlistentry>
9280   <term><parameter>wo</parameter></term>
9281   <listitem>
9282    <para>
9283     wait options
9284    </para>
9285   </listitem>
9286  </varlistentry>
9287  <varlistentry>
9288   <term><parameter>ptrace</parameter></term>
9289   <listitem>
9290    <para>
9291     is the wait for ptrace
9292    </para>
9293   </listitem>
9294  </varlistentry>
9295  <varlistentry>
9296   <term><parameter>p</parameter></term>
9297   <listitem>
9298    <para>
9299     task to wait for
9300    </para>
9301   </listitem>
9302  </varlistentry>
9303 </variablelist>
9304</refsect1>
9305<refsect1>
9306<title>Description</title>
9307<para>
9308   Handle <function>sys_wait4</function> work for <constant>p</constant> in state <constant>TASK_STOPPED</constant> or <constant>TASK_TRACED</constant>.
9309</para>
9310</refsect1>
9311<refsect1>
9312<title>CONTEXT</title>
9313<para>
9314   read_lock(<structname>tasklist_lock</structname>), which is released if return value is
9315   non-zero.  Also, grabs and releases <parameter>p</parameter>-&gt;sighand-&gt;siglock.
9316</para>
9317</refsect1>
9318<refsect1>
9319<title>RETURNS</title>
9320<para>
9321   0 if wait condition didn't exist and search for other wait conditions
9322   should continue.  Non-zero return, -errno on failure and <parameter>p</parameter>'s pid on
9323   success, implies that tasklist_lock is released and wait condition
9324   search should terminate.
9325</para>
9326</refsect1>
9327</refentry>
9328
9329<!-- kernel/signal.c -->
9330<refentry id="API-task-set-jobctl-pending">
9331<refentryinfo>
9332 <title>LINUX</title>
9333 <productname>Kernel Hackers Manual</productname>
9334 <date>July 2017</date>
9335</refentryinfo>
9336<refmeta>
9337 <refentrytitle><phrase>task_set_jobctl_pending</phrase></refentrytitle>
9338 <manvolnum>9</manvolnum>
9339 <refmiscinfo class="version">4.4.14</refmiscinfo>
9340</refmeta>
9341<refnamediv>
9342 <refname>task_set_jobctl_pending</refname>
9343 <refpurpose>
9344  set jobctl pending bits
9345 </refpurpose>
9346</refnamediv>
9347<refsynopsisdiv>
9348 <title>Synopsis</title>
9349  <funcsynopsis><funcprototype>
9350   <funcdef>bool <function>task_set_jobctl_pending </function></funcdef>
9351   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
9352   <paramdef>unsigned long <parameter>mask</parameter></paramdef>
9353  </funcprototype></funcsynopsis>
9354</refsynopsisdiv>
9355<refsect1>
9356 <title>Arguments</title>
9357 <variablelist>
9358  <varlistentry>
9359   <term><parameter>task</parameter></term>
9360   <listitem>
9361    <para>
9362     target task
9363    </para>
9364   </listitem>
9365  </varlistentry>
9366  <varlistentry>
9367   <term><parameter>mask</parameter></term>
9368   <listitem>
9369    <para>
9370     pending bits to set
9371    </para>
9372   </listitem>
9373  </varlistentry>
9374 </variablelist>
9375</refsect1>
9376<refsect1>
9377<title>Description</title>
9378<para>
9379   Clear <parameter>mask</parameter> from <parameter>task</parameter>-&gt;jobctl.  <parameter>mask</parameter> must be subset of
9380   <constant>JOBCTL_PENDING_MASK</constant> | <constant>JOBCTL_STOP_CONSUME</constant> | <constant>JOBCTL_STOP_SIGMASK</constant> |
9381   <constant>JOBCTL_TRAPPING</constant>.  If stop signo is being set, the existing signo is
9382   cleared.  If <parameter>task</parameter> is already being killed or exiting, this function
9383   becomes noop.
9384</para>
9385</refsect1>
9386<refsect1>
9387<title>CONTEXT</title>
9388<para>
9389   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
9390</para>
9391</refsect1>
9392<refsect1>
9393<title>RETURNS</title>
9394<para>
9395   <constant>true</constant> if <parameter>mask</parameter> is set, <constant>false</constant> if made noop because <parameter>task</parameter> was dying.
9396</para>
9397</refsect1>
9398</refentry>
9399
9400<refentry id="API-task-clear-jobctl-trapping">
9401<refentryinfo>
9402 <title>LINUX</title>
9403 <productname>Kernel Hackers Manual</productname>
9404 <date>July 2017</date>
9405</refentryinfo>
9406<refmeta>
9407 <refentrytitle><phrase>task_clear_jobctl_trapping</phrase></refentrytitle>
9408 <manvolnum>9</manvolnum>
9409 <refmiscinfo class="version">4.4.14</refmiscinfo>
9410</refmeta>
9411<refnamediv>
9412 <refname>task_clear_jobctl_trapping</refname>
9413 <refpurpose>
9414     clear jobctl trapping bit
9415 </refpurpose>
9416</refnamediv>
9417<refsynopsisdiv>
9418 <title>Synopsis</title>
9419  <funcsynopsis><funcprototype>
9420   <funcdef>void <function>task_clear_jobctl_trapping </function></funcdef>
9421   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
9422  </funcprototype></funcsynopsis>
9423</refsynopsisdiv>
9424<refsect1>
9425 <title>Arguments</title>
9426 <variablelist>
9427  <varlistentry>
9428   <term><parameter>task</parameter></term>
9429   <listitem>
9430    <para>
9431     target task
9432    </para>
9433   </listitem>
9434  </varlistentry>
9435 </variablelist>
9436</refsect1>
9437<refsect1>
9438<title>Description</title>
9439<para>
9440   If JOBCTL_TRAPPING is set, a ptracer is waiting for us to enter TRACED.
9441   Clear it and wake up the ptracer.  Note that we don't need any further
9442   locking.  <parameter>task</parameter>-&gt;siglock guarantees that <parameter>task</parameter>-&gt;parent points to the
9443   ptracer.
9444</para>
9445</refsect1>
9446<refsect1>
9447<title>CONTEXT</title>
9448<para>
9449   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
9450</para>
9451</refsect1>
9452</refentry>
9453
9454<refentry id="API-task-clear-jobctl-pending">
9455<refentryinfo>
9456 <title>LINUX</title>
9457 <productname>Kernel Hackers Manual</productname>
9458 <date>July 2017</date>
9459</refentryinfo>
9460<refmeta>
9461 <refentrytitle><phrase>task_clear_jobctl_pending</phrase></refentrytitle>
9462 <manvolnum>9</manvolnum>
9463 <refmiscinfo class="version">4.4.14</refmiscinfo>
9464</refmeta>
9465<refnamediv>
9466 <refname>task_clear_jobctl_pending</refname>
9467 <refpurpose>
9468     clear jobctl pending bits
9469 </refpurpose>
9470</refnamediv>
9471<refsynopsisdiv>
9472 <title>Synopsis</title>
9473  <funcsynopsis><funcprototype>
9474   <funcdef>void <function>task_clear_jobctl_pending </function></funcdef>
9475   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
9476   <paramdef>unsigned long <parameter>mask</parameter></paramdef>
9477  </funcprototype></funcsynopsis>
9478</refsynopsisdiv>
9479<refsect1>
9480 <title>Arguments</title>
9481 <variablelist>
9482  <varlistentry>
9483   <term><parameter>task</parameter></term>
9484   <listitem>
9485    <para>
9486     target task
9487    </para>
9488   </listitem>
9489  </varlistentry>
9490  <varlistentry>
9491   <term><parameter>mask</parameter></term>
9492   <listitem>
9493    <para>
9494     pending bits to clear
9495    </para>
9496   </listitem>
9497  </varlistentry>
9498 </variablelist>
9499</refsect1>
9500<refsect1>
9501<title>Description</title>
9502<para>
9503   Clear <parameter>mask</parameter> from <parameter>task</parameter>-&gt;jobctl.  <parameter>mask</parameter> must be subset of
9504   <constant>JOBCTL_PENDING_MASK</constant>.  If <constant>JOBCTL_STOP_PENDING</constant> is being cleared, other
9505   STOP bits are cleared together.
9506   </para><para>
9507
9508   If clearing of <parameter>mask</parameter> leaves no stop or trap pending, this function calls
9509   <function><link linkend="API-task-clear-jobctl-trapping">task_clear_jobctl_trapping</link></function>.
9510</para>
9511</refsect1>
9512<refsect1>
9513<title>CONTEXT</title>
9514<para>
9515   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
9516</para>
9517</refsect1>
9518</refentry>
9519
9520<refentry id="API-task-participate-group-stop">
9521<refentryinfo>
9522 <title>LINUX</title>
9523 <productname>Kernel Hackers Manual</productname>
9524 <date>July 2017</date>
9525</refentryinfo>
9526<refmeta>
9527 <refentrytitle><phrase>task_participate_group_stop</phrase></refentrytitle>
9528 <manvolnum>9</manvolnum>
9529 <refmiscinfo class="version">4.4.14</refmiscinfo>
9530</refmeta>
9531<refnamediv>
9532 <refname>task_participate_group_stop</refname>
9533 <refpurpose>
9534     participate in a group stop
9535 </refpurpose>
9536</refnamediv>
9537<refsynopsisdiv>
9538 <title>Synopsis</title>
9539  <funcsynopsis><funcprototype>
9540   <funcdef>bool <function>task_participate_group_stop </function></funcdef>
9541   <paramdef>struct task_struct * <parameter>task</parameter></paramdef>
9542  </funcprototype></funcsynopsis>
9543</refsynopsisdiv>
9544<refsect1>
9545 <title>Arguments</title>
9546 <variablelist>
9547  <varlistentry>
9548   <term><parameter>task</parameter></term>
9549   <listitem>
9550    <para>
9551     task participating in a group stop
9552    </para>
9553   </listitem>
9554  </varlistentry>
9555 </variablelist>
9556</refsect1>
9557<refsect1>
9558<title>Description</title>
9559<para>
9560   <parameter>task</parameter> has <constant>JOBCTL_STOP_PENDING</constant> set and is participating in a group stop.
9561   Group stop states are cleared and the group stop count is consumed if
9562   <constant>JOBCTL_STOP_CONSUME</constant> was set.  If the consumption completes the group
9563   stop, the appropriate <constant>SIGNAL_</constant>* flags are set.
9564</para>
9565</refsect1>
9566<refsect1>
9567<title>CONTEXT</title>
9568<para>
9569   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
9570</para>
9571</refsect1>
9572<refsect1>
9573<title>RETURNS</title>
9574<para>
9575   <constant>true</constant> if group stop completion should be notified to the parent, <constant>false</constant>
9576   otherwise.
9577</para>
9578</refsect1>
9579</refentry>
9580
9581<refentry id="API-ptrace-trap-notify">
9582<refentryinfo>
9583 <title>LINUX</title>
9584 <productname>Kernel Hackers Manual</productname>
9585 <date>July 2017</date>
9586</refentryinfo>
9587<refmeta>
9588 <refentrytitle><phrase>ptrace_trap_notify</phrase></refentrytitle>
9589 <manvolnum>9</manvolnum>
9590 <refmiscinfo class="version">4.4.14</refmiscinfo>
9591</refmeta>
9592<refnamediv>
9593 <refname>ptrace_trap_notify</refname>
9594 <refpurpose>
9595     schedule trap to notify ptracer
9596 </refpurpose>
9597</refnamediv>
9598<refsynopsisdiv>
9599 <title>Synopsis</title>
9600  <funcsynopsis><funcprototype>
9601   <funcdef>void <function>ptrace_trap_notify </function></funcdef>
9602   <paramdef>struct task_struct * <parameter>t</parameter></paramdef>
9603  </funcprototype></funcsynopsis>
9604</refsynopsisdiv>
9605<refsect1>
9606 <title>Arguments</title>
9607 <variablelist>
9608  <varlistentry>
9609   <term><parameter>t</parameter></term>
9610   <listitem>
9611    <para>
9612     tracee wanting to notify tracer
9613    </para>
9614   </listitem>
9615  </varlistentry>
9616 </variablelist>
9617</refsect1>
9618<refsect1>
9619<title>Description</title>
9620<para>
9621   This function schedules sticky ptrace trap which is cleared on the next
9622   TRAP_STOP to notify ptracer of an event.  <parameter>t</parameter> must have been seized by
9623   ptracer.
9624   </para><para>
9625
9626   If <parameter>t</parameter> is running, STOP trap will be taken.  If trapped for STOP and
9627   ptracer is listening for events, tracee is woken up so that it can
9628   re-trap for the new event.  If trapped otherwise, STOP trap will be
9629   eventually taken without returning to userland after the existing traps
9630   are finished by PTRACE_CONT.
9631</para>
9632</refsect1>
9633<refsect1>
9634<title>CONTEXT</title>
9635<para>
9636   Must be called with <parameter>task</parameter>-&gt;sighand-&gt;siglock held.
9637</para>
9638</refsect1>
9639</refentry>
9640
9641<refentry id="API-do-notify-parent-cldstop">
9642<refentryinfo>
9643 <title>LINUX</title>
9644 <productname>Kernel Hackers Manual</productname>
9645 <date>July 2017</date>
9646</refentryinfo>
9647<refmeta>
9648 <refentrytitle><phrase>do_notify_parent_cldstop</phrase></refentrytitle>
9649 <manvolnum>9</manvolnum>
9650 <refmiscinfo class="version">4.4.14</refmiscinfo>
9651</refmeta>
9652<refnamediv>
9653 <refname>do_notify_parent_cldstop</refname>
9654 <refpurpose>
9655     notify parent of stopped/continued state change
9656 </refpurpose>
9657</refnamediv>
9658<refsynopsisdiv>
9659 <title>Synopsis</title>
9660  <funcsynopsis><funcprototype>
9661   <funcdef>void <function>do_notify_parent_cldstop </function></funcdef>
9662   <paramdef>struct task_struct * <parameter>tsk</parameter></paramdef>
9663   <paramdef>bool <parameter>for_ptracer</parameter></paramdef>
9664   <paramdef>int <parameter>why</parameter></paramdef>
9665  </funcprototype></funcsynopsis>
9666</refsynopsisdiv>
9667<refsect1>
9668 <title>Arguments</title>
9669 <variablelist>
9670  <varlistentry>
9671   <term><parameter>tsk</parameter></term>
9672   <listitem>
9673    <para>
9674     task reporting the state change
9675    </para>
9676   </listitem>
9677  </varlistentry>
9678  <varlistentry>
9679   <term><parameter>for_ptracer</parameter></term>
9680   <listitem>
9681    <para>
9682     the notification is for ptracer
9683    </para>
9684   </listitem>
9685  </varlistentry>
9686  <varlistentry>
9687   <term><parameter>why</parameter></term>
9688   <listitem>
9689    <para>
9690     CLD_{CONTINUED|STOPPED|TRAPPED} to report
9691    </para>
9692   </listitem>
9693  </varlistentry>
9694 </variablelist>
9695</refsect1>
9696<refsect1>
9697<title>Description</title>
9698<para>
9699   Notify <parameter>tsk</parameter>'s parent that the stopped/continued state has changed.  If
9700   <parameter>for_ptracer</parameter> is <constant>false</constant>, <parameter>tsk</parameter>'s group leader notifies to its real parent.
9701   If <constant>true</constant>, <parameter>tsk</parameter> reports to <parameter>tsk</parameter>-&gt;parent which should be the ptracer.
9702</para>
9703</refsect1>
9704<refsect1>
9705<title>CONTEXT</title>
9706<para>
9707   Must be called with tasklist_lock at least read locked.
9708</para>
9709</refsect1>
9710</refentry>
9711
9712<refentry id="API-do-signal-stop">
9713<refentryinfo>
9714 <title>LINUX</title>
9715 <productname>Kernel Hackers Manual</productname>
9716 <date>July 2017</date>
9717</refentryinfo>
9718<refmeta>
9719 <refentrytitle><phrase>do_signal_stop</phrase></refentrytitle>
9720 <manvolnum>9</manvolnum>
9721 <refmiscinfo class="version">4.4.14</refmiscinfo>
9722</refmeta>
9723<refnamediv>
9724 <refname>do_signal_stop</refname>
9725 <refpurpose>
9726     handle group stop for SIGSTOP and other stop signals
9727 </refpurpose>
9728</refnamediv>
9729<refsynopsisdiv>
9730 <title>Synopsis</title>
9731  <funcsynopsis><funcprototype>
9732   <funcdef>bool <function>do_signal_stop </function></funcdef>
9733   <paramdef>int <parameter>signr</parameter></paramdef>
9734  </funcprototype></funcsynopsis>
9735</refsynopsisdiv>
9736<refsect1>
9737 <title>Arguments</title>
9738 <variablelist>
9739  <varlistentry>
9740   <term><parameter>signr</parameter></term>
9741   <listitem>
9742    <para>
9743     signr causing group stop if initiating
9744    </para>
9745   </listitem>
9746  </varlistentry>
9747 </variablelist>
9748</refsect1>
9749<refsect1>
9750<title>Description</title>
9751<para>
9752   If <constant>JOBCTL_STOP_PENDING</constant> is not set yet, initiate group stop with <parameter>signr</parameter>
9753   and participate in it.  If already set, participate in the existing
9754   group stop.  If participated in a group stop (and thus slept), <constant>true</constant> is
9755   returned with siglock released.
9756   </para><para>
9757
9758   If ptraced, this function doesn't handle stop itself.  Instead,
9759   <constant>JOBCTL_TRAP_STOP</constant> is scheduled and <constant>false</constant> is returned with siglock
9760   untouched.  The caller must ensure that INTERRUPT trap handling takes
9761   places afterwards.
9762</para>
9763</refsect1>
9764<refsect1>
9765<title>CONTEXT</title>
9766<para>
9767   Must be called with <parameter>current</parameter>-&gt;sighand-&gt;siglock held, which is released
9768   on <constant>true</constant> return.
9769</para>
9770</refsect1>
9771<refsect1>
9772<title>RETURNS</title>
9773<para>
9774   <constant>false</constant> if group stop is already cancelled or ptrace trap is scheduled.
9775   <constant>true</constant> if participated in group stop.
9776</para>
9777</refsect1>
9778</refentry>
9779
9780<refentry id="API-do-jobctl-trap">
9781<refentryinfo>
9782 <title>LINUX</title>
9783 <productname>Kernel Hackers Manual</productname>
9784 <date>July 2017</date>
9785</refentryinfo>
9786<refmeta>
9787 <refentrytitle><phrase>do_jobctl_trap</phrase></refentrytitle>
9788 <manvolnum>9</manvolnum>
9789 <refmiscinfo class="version">4.4.14</refmiscinfo>
9790</refmeta>
9791<refnamediv>
9792 <refname>do_jobctl_trap</refname>
9793 <refpurpose>
9794     take care of ptrace jobctl traps
9795 </refpurpose>
9796</refnamediv>
9797<refsynopsisdiv>
9798 <title>Synopsis</title>
9799  <funcsynopsis><funcprototype>
9800   <funcdef>void <function>do_jobctl_trap </function></funcdef>
9801   <paramdef> <parameter>void</parameter></paramdef>
9802  </funcprototype></funcsynopsis>
9803</refsynopsisdiv>
9804<refsect1>
9805 <title>Arguments</title>
9806 <variablelist>
9807  <varlistentry>
9808   <term><parameter>void</parameter></term>
9809   <listitem>
9810    <para>
9811     no arguments
9812    </para>
9813   </listitem>
9814  </varlistentry>
9815 </variablelist>
9816</refsect1>
9817<refsect1>
9818<title>Description</title>
9819<para>
9820   </para><para>
9821
9822   When PT_SEIZED, it's used for both group stop and explicit
9823   SEIZE/INTERRUPT traps.  Both generate PTRACE_EVENT_STOP trap with
9824   accompanying siginfo.  If stopped, lower eight bits of exit_code contain
9825   the stop signal; otherwise, <constant>SIGTRAP</constant>.
9826   </para><para>
9827
9828   When !PT_SEIZED, it's used only for group stop trap with stop signal
9829   number as exit_code and no siginfo.
9830</para>
9831</refsect1>
9832<refsect1>
9833<title>CONTEXT</title>
9834<para>
9835   Must be called with <parameter>current</parameter>-&gt;sighand-&gt;siglock held, which may be
9836   released and re-acquired before returning with intervening sleep.
9837</para>
9838</refsect1>
9839</refentry>
9840
9841<refentry id="API-signal-delivered">
9842<refentryinfo>
9843 <title>LINUX</title>
9844 <productname>Kernel Hackers Manual</productname>
9845 <date>July 2017</date>
9846</refentryinfo>
9847<refmeta>
9848 <refentrytitle><phrase>signal_delivered</phrase></refentrytitle>
9849 <manvolnum>9</manvolnum>
9850 <refmiscinfo class="version">4.4.14</refmiscinfo>
9851</refmeta>
9852<refnamediv>
9853 <refname>signal_delivered</refname>
9854 <refpurpose>
9855   </refpurpose>
9856</refnamediv>
9857<refsynopsisdiv>
9858 <title>Synopsis</title>
9859  <funcsynopsis><funcprototype>
9860   <funcdef>void <function>signal_delivered </function></funcdef>
9861   <paramdef>struct ksignal * <parameter>ksig</parameter></paramdef>
9862   <paramdef>int <parameter>stepping</parameter></paramdef>
9863  </funcprototype></funcsynopsis>
9864</refsynopsisdiv>
9865<refsect1>
9866 <title>Arguments</title>
9867 <variablelist>
9868  <varlistentry>
9869   <term><parameter>ksig</parameter></term>
9870   <listitem>
9871    <para>
9872     kernel signal struct
9873    </para>
9874   </listitem>
9875  </varlistentry>
9876  <varlistentry>
9877   <term><parameter>stepping</parameter></term>
9878   <listitem>
9879    <para>
9880     nonzero if debugger single-step or block-step in use
9881    </para>
9882   </listitem>
9883  </varlistentry>
9884 </variablelist>
9885</refsect1>
9886<refsect1>
9887<title>Description</title>
9888<para>
9889   This function should be called when a signal has successfully been
9890   delivered. It updates the blocked signals accordingly (<parameter>ksig</parameter>-&gt;ka.sa.sa_mask
9891   is always blocked, and the signal itself is blocked unless <constant>SA_NODEFER</constant>
9892   is set in <parameter>ksig</parameter>-&gt;ka.sa.sa_flags.  Tracing is notified.
9893</para>
9894</refsect1>
9895</refentry>
9896
9897<refentry id="API-sys-restart-syscall">
9898<refentryinfo>
9899 <title>LINUX</title>
9900 <productname>Kernel Hackers Manual</productname>
9901 <date>July 2017</date>
9902</refentryinfo>
9903<refmeta>
9904 <refentrytitle><phrase>sys_restart_syscall</phrase></refentrytitle>
9905 <manvolnum>9</manvolnum>
9906 <refmiscinfo class="version">4.4.14</refmiscinfo>
9907</refmeta>
9908<refnamediv>
9909 <refname>sys_restart_syscall</refname>
9910 <refpurpose>
9911     restart a system call
9912 </refpurpose>
9913</refnamediv>
9914<refsynopsisdiv>
9915 <title>Synopsis</title>
9916  <funcsynopsis><funcprototype>
9917   <funcdef>long <function>sys_restart_syscall </function></funcdef>
9918   <paramdef> <parameter>void</parameter></paramdef>
9919  </funcprototype></funcsynopsis>
9920</refsynopsisdiv>
9921<refsect1>
9922 <title>Arguments</title>
9923 <variablelist>
9924  <varlistentry>
9925   <term><parameter>void</parameter></term>
9926   <listitem>
9927    <para>
9928     no arguments
9929    </para>
9930   </listitem>
9931  </varlistentry>
9932 </variablelist>
9933</refsect1>
9934</refentry>
9935
9936<refentry id="API-set-current-blocked">
9937<refentryinfo>
9938 <title>LINUX</title>
9939 <productname>Kernel Hackers Manual</productname>
9940 <date>July 2017</date>
9941</refentryinfo>
9942<refmeta>
9943 <refentrytitle><phrase>set_current_blocked</phrase></refentrytitle>
9944 <manvolnum>9</manvolnum>
9945 <refmiscinfo class="version">4.4.14</refmiscinfo>
9946</refmeta>
9947<refnamediv>
9948 <refname>set_current_blocked</refname>
9949 <refpurpose>
9950     change current-&gt;blocked mask
9951 </refpurpose>
9952</refnamediv>
9953<refsynopsisdiv>
9954 <title>Synopsis</title>
9955  <funcsynopsis><funcprototype>
9956   <funcdef>void <function>set_current_blocked </function></funcdef>
9957   <paramdef>sigset_t * <parameter>newset</parameter></paramdef>
9958  </funcprototype></funcsynopsis>
9959</refsynopsisdiv>
9960<refsect1>
9961 <title>Arguments</title>
9962 <variablelist>
9963  <varlistentry>
9964   <term><parameter>newset</parameter></term>
9965   <listitem>
9966    <para>
9967     new mask
9968    </para>
9969   </listitem>
9970  </varlistentry>
9971 </variablelist>
9972</refsect1>
9973<refsect1>
9974<title>Description</title>
9975<para>
9976   It is wrong to change -&gt;blocked directly, this helper should be used
9977   to ensure the process can't miss a shared signal we are going to block.
9978</para>
9979</refsect1>
9980</refentry>
9981
9982<refentry id="API-sys-rt-sigprocmask">
9983<refentryinfo>
9984 <title>LINUX</title>
9985 <productname>Kernel Hackers Manual</productname>
9986 <date>July 2017</date>
9987</refentryinfo>
9988<refmeta>
9989 <refentrytitle><phrase>sys_rt_sigprocmask</phrase></refentrytitle>
9990 <manvolnum>9</manvolnum>
9991 <refmiscinfo class="version">4.4.14</refmiscinfo>
9992</refmeta>
9993<refnamediv>
9994 <refname>sys_rt_sigprocmask</refname>
9995 <refpurpose>
9996     change the list of currently blocked signals
9997 </refpurpose>
9998</refnamediv>
9999<refsynopsisdiv>
10000 <title>Synopsis</title>
10001  <funcsynopsis><funcprototype>
10002   <funcdef>long <function>sys_rt_sigprocmask </function></funcdef>
10003   <paramdef>int <parameter>how</parameter></paramdef>
10004   <paramdef>sigset_t __user * <parameter>nset</parameter></paramdef>
10005   <paramdef>sigset_t __user * <parameter>oset</parameter></paramdef>
10006   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
10007  </funcprototype></funcsynopsis>
10008</refsynopsisdiv>
10009<refsect1>
10010 <title>Arguments</title>
10011 <variablelist>
10012  <varlistentry>
10013   <term><parameter>how</parameter></term>
10014   <listitem>
10015    <para>
10016     whether to add, remove, or set signals
10017    </para>
10018   </listitem>
10019  </varlistentry>
10020  <varlistentry>
10021   <term><parameter>nset</parameter></term>
10022   <listitem>
10023    <para>
10024     stores pending signals
10025    </para>
10026   </listitem>
10027  </varlistentry>
10028  <varlistentry>
10029   <term><parameter>oset</parameter></term>
10030   <listitem>
10031    <para>
10032     previous value of signal mask if non-null
10033    </para>
10034   </listitem>
10035  </varlistentry>
10036  <varlistentry>
10037   <term><parameter>sigsetsize</parameter></term>
10038   <listitem>
10039    <para>
10040     size of sigset_t type
10041    </para>
10042   </listitem>
10043  </varlistentry>
10044 </variablelist>
10045</refsect1>
10046</refentry>
10047
10048<refentry id="API-sys-rt-sigpending">
10049<refentryinfo>
10050 <title>LINUX</title>
10051 <productname>Kernel Hackers Manual</productname>
10052 <date>July 2017</date>
10053</refentryinfo>
10054<refmeta>
10055 <refentrytitle><phrase>sys_rt_sigpending</phrase></refentrytitle>
10056 <manvolnum>9</manvolnum>
10057 <refmiscinfo class="version">4.4.14</refmiscinfo>
10058</refmeta>
10059<refnamediv>
10060 <refname>sys_rt_sigpending</refname>
10061 <refpurpose>
10062     examine a pending signal that has been raised while blocked
10063 </refpurpose>
10064</refnamediv>
10065<refsynopsisdiv>
10066 <title>Synopsis</title>
10067  <funcsynopsis><funcprototype>
10068   <funcdef>long <function>sys_rt_sigpending </function></funcdef>
10069   <paramdef>sigset_t __user * <parameter>uset</parameter></paramdef>
10070   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
10071  </funcprototype></funcsynopsis>
10072</refsynopsisdiv>
10073<refsect1>
10074 <title>Arguments</title>
10075 <variablelist>
10076  <varlistentry>
10077   <term><parameter>uset</parameter></term>
10078   <listitem>
10079    <para>
10080     stores pending signals
10081    </para>
10082   </listitem>
10083  </varlistentry>
10084  <varlistentry>
10085   <term><parameter>sigsetsize</parameter></term>
10086   <listitem>
10087    <para>
10088     size of sigset_t type or larger
10089    </para>
10090   </listitem>
10091  </varlistentry>
10092 </variablelist>
10093</refsect1>
10094</refentry>
10095
10096<refentry id="API-do-sigtimedwait">
10097<refentryinfo>
10098 <title>LINUX</title>
10099 <productname>Kernel Hackers Manual</productname>
10100 <date>July 2017</date>
10101</refentryinfo>
10102<refmeta>
10103 <refentrytitle><phrase>do_sigtimedwait</phrase></refentrytitle>
10104 <manvolnum>9</manvolnum>
10105 <refmiscinfo class="version">4.4.14</refmiscinfo>
10106</refmeta>
10107<refnamediv>
10108 <refname>do_sigtimedwait</refname>
10109 <refpurpose>
10110     wait for queued signals specified in <parameter>which</parameter>
10111 </refpurpose>
10112</refnamediv>
10113<refsynopsisdiv>
10114 <title>Synopsis</title>
10115  <funcsynopsis><funcprototype>
10116   <funcdef>int <function>do_sigtimedwait </function></funcdef>
10117   <paramdef>const sigset_t * <parameter>which</parameter></paramdef>
10118   <paramdef>siginfo_t * <parameter>info</parameter></paramdef>
10119   <paramdef>const struct timespec * <parameter>ts</parameter></paramdef>
10120  </funcprototype></funcsynopsis>
10121</refsynopsisdiv>
10122<refsect1>
10123 <title>Arguments</title>
10124 <variablelist>
10125  <varlistentry>
10126   <term><parameter>which</parameter></term>
10127   <listitem>
10128    <para>
10129     queued signals to wait for
10130    </para>
10131   </listitem>
10132  </varlistentry>
10133  <varlistentry>
10134   <term><parameter>info</parameter></term>
10135   <listitem>
10136    <para>
10137     if non-null, the signal's siginfo is returned here
10138    </para>
10139   </listitem>
10140  </varlistentry>
10141  <varlistentry>
10142   <term><parameter>ts</parameter></term>
10143   <listitem>
10144    <para>
10145     upper bound on process time suspension
10146    </para>
10147   </listitem>
10148  </varlistentry>
10149 </variablelist>
10150</refsect1>
10151</refentry>
10152
10153<refentry id="API-sys-rt-sigtimedwait">
10154<refentryinfo>
10155 <title>LINUX</title>
10156 <productname>Kernel Hackers Manual</productname>
10157 <date>July 2017</date>
10158</refentryinfo>
10159<refmeta>
10160 <refentrytitle><phrase>sys_rt_sigtimedwait</phrase></refentrytitle>
10161 <manvolnum>9</manvolnum>
10162 <refmiscinfo class="version">4.4.14</refmiscinfo>
10163</refmeta>
10164<refnamediv>
10165 <refname>sys_rt_sigtimedwait</refname>
10166 <refpurpose>
10167     synchronously wait for queued signals specified in <parameter>uthese</parameter>
10168 </refpurpose>
10169</refnamediv>
10170<refsynopsisdiv>
10171 <title>Synopsis</title>
10172  <funcsynopsis><funcprototype>
10173   <funcdef>long <function>sys_rt_sigtimedwait </function></funcdef>
10174   <paramdef>const sigset_t __user * <parameter>uthese</parameter></paramdef>
10175   <paramdef>siginfo_t __user * <parameter>uinfo</parameter></paramdef>
10176   <paramdef>const struct timespec __user * <parameter>uts</parameter></paramdef>
10177   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
10178  </funcprototype></funcsynopsis>
10179</refsynopsisdiv>
10180<refsect1>
10181 <title>Arguments</title>
10182 <variablelist>
10183  <varlistentry>
10184   <term><parameter>uthese</parameter></term>
10185   <listitem>
10186    <para>
10187     queued signals to wait for
10188    </para>
10189   </listitem>
10190  </varlistentry>
10191  <varlistentry>
10192   <term><parameter>uinfo</parameter></term>
10193   <listitem>
10194    <para>
10195     if non-null, the signal's siginfo is returned here
10196    </para>
10197   </listitem>
10198  </varlistentry>
10199  <varlistentry>
10200   <term><parameter>uts</parameter></term>
10201   <listitem>
10202    <para>
10203     upper bound on process time suspension
10204    </para>
10205   </listitem>
10206  </varlistentry>
10207  <varlistentry>
10208   <term><parameter>sigsetsize</parameter></term>
10209   <listitem>
10210    <para>
10211     size of sigset_t type
10212    </para>
10213   </listitem>
10214  </varlistentry>
10215 </variablelist>
10216</refsect1>
10217</refentry>
10218
10219<refentry id="API-sys-kill">
10220<refentryinfo>
10221 <title>LINUX</title>
10222 <productname>Kernel Hackers Manual</productname>
10223 <date>July 2017</date>
10224</refentryinfo>
10225<refmeta>
10226 <refentrytitle><phrase>sys_kill</phrase></refentrytitle>
10227 <manvolnum>9</manvolnum>
10228 <refmiscinfo class="version">4.4.14</refmiscinfo>
10229</refmeta>
10230<refnamediv>
10231 <refname>sys_kill</refname>
10232 <refpurpose>
10233     send a signal to a process
10234 </refpurpose>
10235</refnamediv>
10236<refsynopsisdiv>
10237 <title>Synopsis</title>
10238  <funcsynopsis><funcprototype>
10239   <funcdef>long <function>sys_kill </function></funcdef>
10240   <paramdef>pid_t <parameter>pid</parameter></paramdef>
10241   <paramdef>int <parameter>sig</parameter></paramdef>
10242  </funcprototype></funcsynopsis>
10243</refsynopsisdiv>
10244<refsect1>
10245 <title>Arguments</title>
10246 <variablelist>
10247  <varlistentry>
10248   <term><parameter>pid</parameter></term>
10249   <listitem>
10250    <para>
10251     the PID of the process
10252    </para>
10253   </listitem>
10254  </varlistentry>
10255  <varlistentry>
10256   <term><parameter>sig</parameter></term>
10257   <listitem>
10258    <para>
10259     signal to be sent
10260    </para>
10261   </listitem>
10262  </varlistentry>
10263 </variablelist>
10264</refsect1>
10265</refentry>
10266
10267<refentry id="API-sys-tgkill">
10268<refentryinfo>
10269 <title>LINUX</title>
10270 <productname>Kernel Hackers Manual</productname>
10271 <date>July 2017</date>
10272</refentryinfo>
10273<refmeta>
10274 <refentrytitle><phrase>sys_tgkill</phrase></refentrytitle>
10275 <manvolnum>9</manvolnum>
10276 <refmiscinfo class="version">4.4.14</refmiscinfo>
10277</refmeta>
10278<refnamediv>
10279 <refname>sys_tgkill</refname>
10280 <refpurpose>
10281     send signal to one specific thread
10282 </refpurpose>
10283</refnamediv>
10284<refsynopsisdiv>
10285 <title>Synopsis</title>
10286  <funcsynopsis><funcprototype>
10287   <funcdef>long <function>sys_tgkill </function></funcdef>
10288   <paramdef>pid_t <parameter>tgid</parameter></paramdef>
10289   <paramdef>pid_t <parameter>pid</parameter></paramdef>
10290   <paramdef>int <parameter>sig</parameter></paramdef>
10291  </funcprototype></funcsynopsis>
10292</refsynopsisdiv>
10293<refsect1>
10294 <title>Arguments</title>
10295 <variablelist>
10296  <varlistentry>
10297   <term><parameter>tgid</parameter></term>
10298   <listitem>
10299    <para>
10300     the thread group ID of the thread
10301    </para>
10302   </listitem>
10303  </varlistentry>
10304  <varlistentry>
10305   <term><parameter>pid</parameter></term>
10306   <listitem>
10307    <para>
10308     the PID of the thread
10309    </para>
10310   </listitem>
10311  </varlistentry>
10312  <varlistentry>
10313   <term><parameter>sig</parameter></term>
10314   <listitem>
10315    <para>
10316     signal to be sent
10317    </para>
10318   </listitem>
10319  </varlistentry>
10320 </variablelist>
10321</refsect1>
10322<refsect1>
10323<title>Description</title>
10324<para>
10325   This syscall also checks the <parameter>tgid</parameter> and returns -ESRCH even if the PID
10326   exists but it's not belonging to the target process anymore. This
10327   method solves the problem of threads exiting and PIDs getting reused.
10328</para>
10329</refsect1>
10330</refentry>
10331
10332<refentry id="API-sys-tkill">
10333<refentryinfo>
10334 <title>LINUX</title>
10335 <productname>Kernel Hackers Manual</productname>
10336 <date>July 2017</date>
10337</refentryinfo>
10338<refmeta>
10339 <refentrytitle><phrase>sys_tkill</phrase></refentrytitle>
10340 <manvolnum>9</manvolnum>
10341 <refmiscinfo class="version">4.4.14</refmiscinfo>
10342</refmeta>
10343<refnamediv>
10344 <refname>sys_tkill</refname>
10345 <refpurpose>
10346     send signal to one specific task
10347 </refpurpose>
10348</refnamediv>
10349<refsynopsisdiv>
10350 <title>Synopsis</title>
10351  <funcsynopsis><funcprototype>
10352   <funcdef>long <function>sys_tkill </function></funcdef>
10353   <paramdef>pid_t <parameter>pid</parameter></paramdef>
10354   <paramdef>int <parameter>sig</parameter></paramdef>
10355  </funcprototype></funcsynopsis>
10356</refsynopsisdiv>
10357<refsect1>
10358 <title>Arguments</title>
10359 <variablelist>
10360  <varlistentry>
10361   <term><parameter>pid</parameter></term>
10362   <listitem>
10363    <para>
10364     the PID of the task
10365    </para>
10366   </listitem>
10367  </varlistentry>
10368  <varlistentry>
10369   <term><parameter>sig</parameter></term>
10370   <listitem>
10371    <para>
10372     signal to be sent
10373    </para>
10374   </listitem>
10375  </varlistentry>
10376 </variablelist>
10377</refsect1>
10378<refsect1>
10379<title>Description</title>
10380<para>
10381   Send a signal to only one task, even if it's a CLONE_THREAD task.
10382</para>
10383</refsect1>
10384</refentry>
10385
10386<refentry id="API-sys-rt-sigqueueinfo">
10387<refentryinfo>
10388 <title>LINUX</title>
10389 <productname>Kernel Hackers Manual</productname>
10390 <date>July 2017</date>
10391</refentryinfo>
10392<refmeta>
10393 <refentrytitle><phrase>sys_rt_sigqueueinfo</phrase></refentrytitle>
10394 <manvolnum>9</manvolnum>
10395 <refmiscinfo class="version">4.4.14</refmiscinfo>
10396</refmeta>
10397<refnamediv>
10398 <refname>sys_rt_sigqueueinfo</refname>
10399 <refpurpose>
10400     send signal information to a signal
10401 </refpurpose>
10402</refnamediv>
10403<refsynopsisdiv>
10404 <title>Synopsis</title>
10405  <funcsynopsis><funcprototype>
10406   <funcdef>long <function>sys_rt_sigqueueinfo </function></funcdef>
10407   <paramdef>pid_t <parameter>pid</parameter></paramdef>
10408   <paramdef>int <parameter>sig</parameter></paramdef>
10409   <paramdef>siginfo_t __user * <parameter>uinfo</parameter></paramdef>
10410  </funcprototype></funcsynopsis>
10411</refsynopsisdiv>
10412<refsect1>
10413 <title>Arguments</title>
10414 <variablelist>
10415  <varlistentry>
10416   <term><parameter>pid</parameter></term>
10417   <listitem>
10418    <para>
10419     the PID of the thread
10420    </para>
10421   </listitem>
10422  </varlistentry>
10423  <varlistentry>
10424   <term><parameter>sig</parameter></term>
10425   <listitem>
10426    <para>
10427     signal to be sent
10428    </para>
10429   </listitem>
10430  </varlistentry>
10431  <varlistentry>
10432   <term><parameter>uinfo</parameter></term>
10433   <listitem>
10434    <para>
10435     signal info to be sent
10436    </para>
10437   </listitem>
10438  </varlistentry>
10439 </variablelist>
10440</refsect1>
10441</refentry>
10442
10443<refentry id="API-sys-sigpending">
10444<refentryinfo>
10445 <title>LINUX</title>
10446 <productname>Kernel Hackers Manual</productname>
10447 <date>July 2017</date>
10448</refentryinfo>
10449<refmeta>
10450 <refentrytitle><phrase>sys_sigpending</phrase></refentrytitle>
10451 <manvolnum>9</manvolnum>
10452 <refmiscinfo class="version">4.4.14</refmiscinfo>
10453</refmeta>
10454<refnamediv>
10455 <refname>sys_sigpending</refname>
10456 <refpurpose>
10457     examine pending signals
10458 </refpurpose>
10459</refnamediv>
10460<refsynopsisdiv>
10461 <title>Synopsis</title>
10462  <funcsynopsis><funcprototype>
10463   <funcdef>long <function>sys_sigpending </function></funcdef>
10464   <paramdef>old_sigset_t __user * <parameter>set</parameter></paramdef>
10465  </funcprototype></funcsynopsis>
10466</refsynopsisdiv>
10467<refsect1>
10468 <title>Arguments</title>
10469 <variablelist>
10470  <varlistentry>
10471   <term><parameter>set</parameter></term>
10472   <listitem>
10473    <para>
10474     where mask of pending signal is returned
10475    </para>
10476   </listitem>
10477  </varlistentry>
10478 </variablelist>
10479</refsect1>
10480</refentry>
10481
10482<refentry id="API-sys-sigprocmask">
10483<refentryinfo>
10484 <title>LINUX</title>
10485 <productname>Kernel Hackers Manual</productname>
10486 <date>July 2017</date>
10487</refentryinfo>
10488<refmeta>
10489 <refentrytitle><phrase>sys_sigprocmask</phrase></refentrytitle>
10490 <manvolnum>9</manvolnum>
10491 <refmiscinfo class="version">4.4.14</refmiscinfo>
10492</refmeta>
10493<refnamediv>
10494 <refname>sys_sigprocmask</refname>
10495 <refpurpose>
10496     examine and change blocked signals
10497 </refpurpose>
10498</refnamediv>
10499<refsynopsisdiv>
10500 <title>Synopsis</title>
10501  <funcsynopsis><funcprototype>
10502   <funcdef>long <function>sys_sigprocmask </function></funcdef>
10503   <paramdef>int <parameter>how</parameter></paramdef>
10504   <paramdef>old_sigset_t __user * <parameter>nset</parameter></paramdef>
10505   <paramdef>old_sigset_t __user * <parameter>oset</parameter></paramdef>
10506  </funcprototype></funcsynopsis>
10507</refsynopsisdiv>
10508<refsect1>
10509 <title>Arguments</title>
10510 <variablelist>
10511  <varlistentry>
10512   <term><parameter>how</parameter></term>
10513   <listitem>
10514    <para>
10515     whether to add, remove, or set signals
10516    </para>
10517   </listitem>
10518  </varlistentry>
10519  <varlistentry>
10520   <term><parameter>nset</parameter></term>
10521   <listitem>
10522    <para>
10523     signals to add or remove (if non-null)
10524    </para>
10525   </listitem>
10526  </varlistentry>
10527  <varlistentry>
10528   <term><parameter>oset</parameter></term>
10529   <listitem>
10530    <para>
10531     previous value of signal mask if non-null
10532    </para>
10533   </listitem>
10534  </varlistentry>
10535 </variablelist>
10536</refsect1>
10537<refsect1>
10538<title>Description</title>
10539<para>
10540   Some platforms have their own version with special arguments;
10541   others support only sys_rt_sigprocmask.
10542</para>
10543</refsect1>
10544</refentry>
10545
10546<refentry id="API-sys-rt-sigaction">
10547<refentryinfo>
10548 <title>LINUX</title>
10549 <productname>Kernel Hackers Manual</productname>
10550 <date>July 2017</date>
10551</refentryinfo>
10552<refmeta>
10553 <refentrytitle><phrase>sys_rt_sigaction</phrase></refentrytitle>
10554 <manvolnum>9</manvolnum>
10555 <refmiscinfo class="version">4.4.14</refmiscinfo>
10556</refmeta>
10557<refnamediv>
10558 <refname>sys_rt_sigaction</refname>
10559 <refpurpose>
10560     alter an action taken by a process
10561 </refpurpose>
10562</refnamediv>
10563<refsynopsisdiv>
10564 <title>Synopsis</title>
10565  <funcsynopsis><funcprototype>
10566   <funcdef>long <function>sys_rt_sigaction </function></funcdef>
10567   <paramdef>int <parameter>sig</parameter></paramdef>
10568   <paramdef>const struct sigaction __user * <parameter>act</parameter></paramdef>
10569   <paramdef>struct sigaction __user * <parameter>oact</parameter></paramdef>
10570   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
10571  </funcprototype></funcsynopsis>
10572</refsynopsisdiv>
10573<refsect1>
10574 <title>Arguments</title>
10575 <variablelist>
10576  <varlistentry>
10577   <term><parameter>sig</parameter></term>
10578   <listitem>
10579    <para>
10580     signal to be sent
10581    </para>
10582   </listitem>
10583  </varlistentry>
10584  <varlistentry>
10585   <term><parameter>act</parameter></term>
10586   <listitem>
10587    <para>
10588     new sigaction
10589    </para>
10590   </listitem>
10591  </varlistentry>
10592  <varlistentry>
10593   <term><parameter>oact</parameter></term>
10594   <listitem>
10595    <para>
10596     used to save the previous sigaction
10597    </para>
10598   </listitem>
10599  </varlistentry>
10600  <varlistentry>
10601   <term><parameter>sigsetsize</parameter></term>
10602   <listitem>
10603    <para>
10604     size of sigset_t type
10605    </para>
10606   </listitem>
10607  </varlistentry>
10608 </variablelist>
10609</refsect1>
10610</refentry>
10611
10612<refentry id="API-sys-rt-sigsuspend">
10613<refentryinfo>
10614 <title>LINUX</title>
10615 <productname>Kernel Hackers Manual</productname>
10616 <date>July 2017</date>
10617</refentryinfo>
10618<refmeta>
10619 <refentrytitle><phrase>sys_rt_sigsuspend</phrase></refentrytitle>
10620 <manvolnum>9</manvolnum>
10621 <refmiscinfo class="version">4.4.14</refmiscinfo>
10622</refmeta>
10623<refnamediv>
10624 <refname>sys_rt_sigsuspend</refname>
10625 <refpurpose>
10626     replace the signal mask for a value with the <parameter>unewset</parameter> value until a signal is received
10627 </refpurpose>
10628</refnamediv>
10629<refsynopsisdiv>
10630 <title>Synopsis</title>
10631  <funcsynopsis><funcprototype>
10632   <funcdef>long <function>sys_rt_sigsuspend </function></funcdef>
10633   <paramdef>sigset_t __user * <parameter>unewset</parameter></paramdef>
10634   <paramdef>size_t <parameter>sigsetsize</parameter></paramdef>
10635  </funcprototype></funcsynopsis>
10636</refsynopsisdiv>
10637<refsect1>
10638 <title>Arguments</title>
10639 <variablelist>
10640  <varlistentry>
10641   <term><parameter>unewset</parameter></term>
10642   <listitem>
10643    <para>
10644     new signal mask value
10645    </para>
10646   </listitem>
10647  </varlistentry>
10648  <varlistentry>
10649   <term><parameter>sigsetsize</parameter></term>
10650   <listitem>
10651    <para>
10652     size of sigset_t type
10653    </para>
10654   </listitem>
10655  </varlistentry>
10656 </variablelist>
10657</refsect1>
10658</refentry>
10659
10660<!-- include/linux/kthread.h -->
10661<refentry id="API-kthread-run">
10662<refentryinfo>
10663 <title>LINUX</title>
10664 <productname>Kernel Hackers Manual</productname>
10665 <date>July 2017</date>
10666</refentryinfo>
10667<refmeta>
10668 <refentrytitle><phrase>kthread_run</phrase></refentrytitle>
10669 <manvolnum>9</manvolnum>
10670 <refmiscinfo class="version">4.4.14</refmiscinfo>
10671</refmeta>
10672<refnamediv>
10673 <refname>kthread_run</refname>
10674 <refpurpose>
10675  create and wake a thread.
10676 </refpurpose>
10677</refnamediv>
10678<refsynopsisdiv>
10679 <title>Synopsis</title>
10680  <funcsynopsis><funcprototype>
10681   <funcdef> <function>kthread_run </function></funcdef>
10682   <paramdef> <parameter>threadfn</parameter></paramdef>
10683   <paramdef> <parameter>data</parameter></paramdef>
10684   <paramdef> <parameter>namefmt</parameter></paramdef>
10685   <paramdef> <parameter>...</parameter></paramdef>
10686  </funcprototype></funcsynopsis>
10687</refsynopsisdiv>
10688<refsect1>
10689 <title>Arguments</title>
10690 <variablelist>
10691  <varlistentry>
10692   <term><parameter>threadfn</parameter></term>
10693   <listitem>
10694    <para>
10695     the function to run until signal_pending(current).
10696    </para>
10697   </listitem>
10698  </varlistentry>
10699  <varlistentry>
10700   <term><parameter>data</parameter></term>
10701   <listitem>
10702    <para>
10703     data ptr for <parameter>threadfn</parameter>.
10704    </para>
10705   </listitem>
10706  </varlistentry>
10707  <varlistentry>
10708   <term><parameter>namefmt</parameter></term>
10709   <listitem>
10710    <para>
10711     printf-style name for the thread.
10712    </para>
10713   </listitem>
10714  </varlistentry>
10715  <varlistentry>
10716   <term><parameter>...</parameter></term>
10717   <listitem>
10718    <para>
10719     variable arguments
10720    </para>
10721   </listitem>
10722  </varlistentry>
10723 </variablelist>
10724</refsect1>
10725<refsect1>
10726<title>Description</title>
10727<para>
10728   Convenient wrapper for <function>kthread_create</function> followed by
10729   <function><link linkend="API-wake-up-process">wake_up_process</link></function>.  Returns the kthread or ERR_PTR(-ENOMEM).
10730</para>
10731</refsect1>
10732</refentry>
10733
10734<!-- kernel/kthread.c -->
10735<refentry id="API-kthread-should-stop">
10736<refentryinfo>
10737 <title>LINUX</title>
10738 <productname>Kernel Hackers Manual</productname>
10739 <date>July 2017</date>
10740</refentryinfo>
10741<refmeta>
10742 <refentrytitle><phrase>kthread_should_stop</phrase></refentrytitle>
10743 <manvolnum>9</manvolnum>
10744 <refmiscinfo class="version">4.4.14</refmiscinfo>
10745</refmeta>
10746<refnamediv>
10747 <refname>kthread_should_stop</refname>
10748 <refpurpose>
10749  should this kthread return now?
10750 </refpurpose>
10751</refnamediv>
10752<refsynopsisdiv>
10753 <title>Synopsis</title>
10754  <funcsynopsis><funcprototype>
10755   <funcdef>bool <function>kthread_should_stop </function></funcdef>
10756   <paramdef> <parameter>void</parameter></paramdef>
10757  </funcprototype></funcsynopsis>
10758</refsynopsisdiv>
10759<refsect1>
10760 <title>Arguments</title>
10761 <variablelist>
10762  <varlistentry>
10763   <term><parameter>void</parameter></term>
10764   <listitem>
10765    <para>
10766     no arguments
10767    </para>
10768   </listitem>
10769  </varlistentry>
10770 </variablelist>
10771</refsect1>
10772<refsect1>
10773<title>Description</title>
10774<para>
10775   </para><para>
10776
10777   When someone calls <function><link linkend="API-kthread-stop">kthread_stop</link></function> on your kthread, it will be woken
10778   and this will return true.  You should then return, and your return
10779   value will be passed through to <function><link linkend="API-kthread-stop">kthread_stop</link></function>.
10780</para>
10781</refsect1>
10782</refentry>
10783
10784<refentry id="API-kthread-should-park">
10785<refentryinfo>
10786 <title>LINUX</title>
10787 <productname>Kernel Hackers Manual</productname>
10788 <date>July 2017</date>
10789</refentryinfo>
10790<refmeta>
10791 <refentrytitle><phrase>kthread_should_park</phrase></refentrytitle>
10792 <manvolnum>9</manvolnum>
10793 <refmiscinfo class="version">4.4.14</refmiscinfo>
10794</refmeta>
10795<refnamediv>
10796 <refname>kthread_should_park</refname>
10797 <refpurpose>
10798     should this kthread park now?
10799 </refpurpose>
10800</refnamediv>
10801<refsynopsisdiv>
10802 <title>Synopsis</title>
10803  <funcsynopsis><funcprototype>
10804   <funcdef>bool <function>kthread_should_park </function></funcdef>
10805   <paramdef> <parameter>void</parameter></paramdef>
10806  </funcprototype></funcsynopsis>
10807</refsynopsisdiv>
10808<refsect1>
10809 <title>Arguments</title>
10810 <variablelist>
10811  <varlistentry>
10812   <term><parameter>void</parameter></term>
10813   <listitem>
10814    <para>
10815     no arguments
10816    </para>
10817   </listitem>
10818  </varlistentry>
10819 </variablelist>
10820</refsect1>
10821<refsect1>
10822<title>Description</title>
10823<para>
10824   </para><para>
10825
10826   When someone calls <function><link linkend="API-kthread-park">kthread_park</link></function> on your kthread, it will be woken
10827   and this will return true.  You should then do the necessary
10828   cleanup and call <function>kthread_parkme</function>
10829   </para><para>
10830
10831   Similar to <function><link linkend="API-kthread-should-stop">kthread_should_stop</link></function>, but this keeps the thread alive
10832   and in a park position. <function><link linkend="API-kthread-unpark">kthread_unpark</link></function> <quote>restarts</quote> the thread and
10833   calls the thread function again.
10834</para>
10835</refsect1>
10836</refentry>
10837
10838<refentry id="API-kthread-freezable-should-stop">
10839<refentryinfo>
10840 <title>LINUX</title>
10841 <productname>Kernel Hackers Manual</productname>
10842 <date>July 2017</date>
10843</refentryinfo>
10844<refmeta>
10845 <refentrytitle><phrase>kthread_freezable_should_stop</phrase></refentrytitle>
10846 <manvolnum>9</manvolnum>
10847 <refmiscinfo class="version">4.4.14</refmiscinfo>
10848</refmeta>
10849<refnamediv>
10850 <refname>kthread_freezable_should_stop</refname>
10851 <refpurpose>
10852     should this freezable kthread return now?
10853 </refpurpose>
10854</refnamediv>
10855<refsynopsisdiv>
10856 <title>Synopsis</title>
10857  <funcsynopsis><funcprototype>
10858   <funcdef>bool <function>kthread_freezable_should_stop </function></funcdef>
10859   <paramdef>bool * <parameter>was_frozen</parameter></paramdef>
10860  </funcprototype></funcsynopsis>
10861</refsynopsisdiv>
10862<refsect1>
10863 <title>Arguments</title>
10864 <variablelist>
10865  <varlistentry>
10866   <term><parameter>was_frozen</parameter></term>
10867   <listitem>
10868    <para>
10869     optional out parameter, indicates whether <constant>current</constant> was frozen
10870    </para>
10871   </listitem>
10872  </varlistentry>
10873 </variablelist>
10874</refsect1>
10875<refsect1>
10876<title>Description</title>
10877<para>
10878   <function><link linkend="API-kthread-should-stop">kthread_should_stop</link></function> for freezable kthreads, which will enter
10879   refrigerator if necessary.  This function is safe from <function><link linkend="API-kthread-stop">kthread_stop</link></function> /
10880   freezer deadlock and freezable kthreads should use this function instead
10881   of calling <function>try_to_freeze</function> directly.
10882</para>
10883</refsect1>
10884</refentry>
10885
10886<refentry id="API-kthread-create-on-node">
10887<refentryinfo>
10888 <title>LINUX</title>
10889 <productname>Kernel Hackers Manual</productname>
10890 <date>July 2017</date>
10891</refentryinfo>
10892<refmeta>
10893 <refentrytitle><phrase>kthread_create_on_node</phrase></refentrytitle>
10894 <manvolnum>9</manvolnum>
10895 <refmiscinfo class="version">4.4.14</refmiscinfo>
10896</refmeta>
10897<refnamediv>
10898 <refname>kthread_create_on_node</refname>
10899 <refpurpose>
10900     create a kthread.
10901 </refpurpose>
10902</refnamediv>
10903<refsynopsisdiv>
10904 <title>Synopsis</title>
10905  <funcsynopsis><funcprototype>
10906   <funcdef>struct task_struct * <function>kthread_create_on_node </function></funcdef>
10907   <paramdef>int (*<parameter>threadfn</parameter>)
10908     <funcparams>void *data</funcparams></paramdef>
10909   <paramdef>void * <parameter>data</parameter></paramdef>
10910   <paramdef>int <parameter>node</parameter></paramdef>
10911   <paramdef>const char <parameter>namefmt[]</parameter></paramdef>
10912   <paramdef> <parameter>...</parameter></paramdef>
10913  </funcprototype></funcsynopsis>
10914</refsynopsisdiv>
10915<refsect1>
10916 <title>Arguments</title>
10917 <variablelist>
10918  <varlistentry>
10919   <term><parameter>threadfn</parameter></term>
10920   <listitem>
10921    <para>
10922     the function to run until signal_pending(current).
10923    </para>
10924   </listitem>
10925  </varlistentry>
10926  <varlistentry>
10927   <term><parameter>data</parameter></term>
10928   <listitem>
10929    <para>
10930     data ptr for <parameter>threadfn</parameter>.
10931    </para>
10932   </listitem>
10933  </varlistentry>
10934  <varlistentry>
10935   <term><parameter>node</parameter></term>
10936   <listitem>
10937    <para>
10938     task and thread structures for the thread are allocated on this node
10939    </para>
10940   </listitem>
10941  </varlistentry>
10942  <varlistentry>
10943   <term><parameter>namefmt[]</parameter></term>
10944   <listitem>
10945    <para>
10946     printf-style name for the thread.
10947    </para>
10948   </listitem>
10949  </varlistentry>
10950  <varlistentry>
10951   <term><parameter>...</parameter></term>
10952   <listitem>
10953    <para>
10954     variable arguments
10955    </para>
10956   </listitem>
10957  </varlistentry>
10958 </variablelist>
10959</refsect1>
10960<refsect1>
10961<title>Description</title>
10962<para>
10963   This helper function creates and names a kernel
10964   thread.  The thread will be stopped: use <function><link linkend="API-wake-up-process">wake_up_process</link></function> to start
10965   it.  See also <function><link linkend="API-kthread-run">kthread_run</link></function>.  The new thread has SCHED_NORMAL policy and
10966   is affine to all CPUs.
10967   </para><para>
10968
10969   If thread is going to be bound on a particular cpu, give its node
10970   in <parameter>node</parameter>, to get NUMA affinity for kthread stack, or else give NUMA_NO_NODE.
10971   When woken, the thread will run <parameter>threadfn</parameter>() with <parameter>data</parameter> as its
10972   argument. <parameter>threadfn</parameter>() can either call <function>do_exit</function> directly if it is a
10973   standalone thread for which no one will call <function><link linkend="API-kthread-stop">kthread_stop</link></function>, or
10974   return when '<function><link linkend="API-kthread-should-stop">kthread_should_stop</link></function>' is true (which means
10975   <function><link linkend="API-kthread-stop">kthread_stop</link></function> has been called).  The return value should be zero
10976   or a negative error number; it will be passed to <function><link linkend="API-kthread-stop">kthread_stop</link></function>.
10977   </para><para>
10978
10979   Returns a task_struct or ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR).
10980</para>
10981</refsect1>
10982</refentry>
10983
10984<refentry id="API-kthread-bind">
10985<refentryinfo>
10986 <title>LINUX</title>
10987 <productname>Kernel Hackers Manual</productname>
10988 <date>July 2017</date>
10989</refentryinfo>
10990<refmeta>
10991 <refentrytitle><phrase>kthread_bind</phrase></refentrytitle>
10992 <manvolnum>9</manvolnum>
10993 <refmiscinfo class="version">4.4.14</refmiscinfo>
10994</refmeta>
10995<refnamediv>
10996 <refname>kthread_bind</refname>
10997 <refpurpose>
10998     bind a just-created kthread to a cpu.
10999 </refpurpose>
11000</refnamediv>
11001<refsynopsisdiv>
11002 <title>Synopsis</title>
11003  <funcsynopsis><funcprototype>
11004   <funcdef>void <function>kthread_bind </function></funcdef>
11005   <paramdef>struct task_struct * <parameter>p</parameter></paramdef>
11006   <paramdef>unsigned int <parameter>cpu</parameter></paramdef>
11007  </funcprototype></funcsynopsis>
11008</refsynopsisdiv>
11009<refsect1>
11010 <title>Arguments</title>
11011 <variablelist>
11012  <varlistentry>
11013   <term><parameter>p</parameter></term>
11014   <listitem>
11015    <para>
11016     thread created by <function>kthread_create</function>.
11017    </para>
11018   </listitem>
11019  </varlistentry>
11020  <varlistentry>
11021   <term><parameter>cpu</parameter></term>
11022   <listitem>
11023    <para>
11024     cpu (might not be online, must be possible) for <parameter>k</parameter> to run on.
11025    </para>
11026   </listitem>
11027  </varlistentry>
11028 </variablelist>
11029</refsect1>
11030<refsect1>
11031<title>Description</title>
11032<para>
11033   This function is equivalent to <function>set_cpus_allowed</function>,
11034   except that <parameter>cpu</parameter> doesn't need to be online, and the thread must be
11035   stopped (i.e., just returned from <function>kthread_create</function>).
11036</para>
11037</refsect1>
11038</refentry>
11039
11040<refentry id="API-kthread-unpark">
11041<refentryinfo>
11042 <title>LINUX</title>
11043 <productname>Kernel Hackers Manual</productname>
11044 <date>July 2017</date>
11045</refentryinfo>
11046<refmeta>
11047 <refentrytitle><phrase>kthread_unpark</phrase></refentrytitle>
11048 <manvolnum>9</manvolnum>
11049 <refmiscinfo class="version">4.4.14</refmiscinfo>
11050</refmeta>
11051<refnamediv>
11052 <refname>kthread_unpark</refname>
11053 <refpurpose>
11054     unpark a thread created by <function>kthread_create</function>.
11055 </refpurpose>
11056</refnamediv>
11057<refsynopsisdiv>
11058 <title>Synopsis</title>
11059  <funcsynopsis><funcprototype>
11060   <funcdef>void <function>kthread_unpark </function></funcdef>
11061   <paramdef>struct task_struct * <parameter>k</parameter></paramdef>
11062  </funcprototype></funcsynopsis>
11063</refsynopsisdiv>
11064<refsect1>
11065 <title>Arguments</title>
11066 <variablelist>
11067  <varlistentry>
11068   <term><parameter>k</parameter></term>
11069   <listitem>
11070    <para>
11071     thread created by <function>kthread_create</function>.
11072    </para>
11073   </listitem>
11074  </varlistentry>
11075 </variablelist>
11076</refsect1>
11077<refsect1>
11078<title>Description</title>
11079<para>
11080   Sets <function><link linkend="API-kthread-should-park">kthread_should_park</link></function> for <parameter>k</parameter> to return false, wakes it, and
11081   waits for it to return. If the thread is marked percpu then its
11082   bound to the cpu again.
11083</para>
11084</refsect1>
11085</refentry>
11086
11087<refentry id="API-kthread-park">
11088<refentryinfo>
11089 <title>LINUX</title>
11090 <productname>Kernel Hackers Manual</productname>
11091 <date>July 2017</date>
11092</refentryinfo>
11093<refmeta>
11094 <refentrytitle><phrase>kthread_park</phrase></refentrytitle>
11095 <manvolnum>9</manvolnum>
11096 <refmiscinfo class="version">4.4.14</refmiscinfo>
11097</refmeta>
11098<refnamediv>
11099 <refname>kthread_park</refname>
11100 <refpurpose>
11101     park a thread created by <function>kthread_create</function>.
11102 </refpurpose>
11103</refnamediv>
11104<refsynopsisdiv>
11105 <title>Synopsis</title>
11106  <funcsynopsis><funcprototype>
11107   <funcdef>int <function>kthread_park </function></funcdef>
11108   <paramdef>struct task_struct * <parameter>k</parameter></paramdef>
11109  </funcprototype></funcsynopsis>
11110</refsynopsisdiv>
11111<refsect1>
11112 <title>Arguments</title>
11113 <variablelist>
11114  <varlistentry>
11115   <term><parameter>k</parameter></term>
11116   <listitem>
11117    <para>
11118     thread created by <function>kthread_create</function>.
11119    </para>
11120   </listitem>
11121  </varlistentry>
11122 </variablelist>
11123</refsect1>
11124<refsect1>
11125<title>Description</title>
11126<para>
11127   Sets <function><link linkend="API-kthread-should-park">kthread_should_park</link></function> for <parameter>k</parameter> to return true, wakes it, and
11128   waits for it to return. This can also be called after <function>kthread_create</function>
11129   instead of calling <function><link linkend="API-wake-up-process">wake_up_process</link></function>: the thread will park without
11130   calling <function>threadfn</function>.
11131   </para><para>
11132
11133   Returns 0 if the thread is parked, -ENOSYS if the thread exited.
11134   If called by the kthread itself just the park bit is set.
11135</para>
11136</refsect1>
11137</refentry>
11138
11139<refentry id="API-kthread-stop">
11140<refentryinfo>
11141 <title>LINUX</title>
11142 <productname>Kernel Hackers Manual</productname>
11143 <date>July 2017</date>
11144</refentryinfo>
11145<refmeta>
11146 <refentrytitle><phrase>kthread_stop</phrase></refentrytitle>
11147 <manvolnum>9</manvolnum>
11148 <refmiscinfo class="version">4.4.14</refmiscinfo>
11149</refmeta>
11150<refnamediv>
11151 <refname>kthread_stop</refname>
11152 <refpurpose>
11153     stop a thread created by <function>kthread_create</function>.
11154 </refpurpose>
11155</refnamediv>
11156<refsynopsisdiv>
11157 <title>Synopsis</title>
11158  <funcsynopsis><funcprototype>
11159   <funcdef>int <function>kthread_stop </function></funcdef>
11160   <paramdef>struct task_struct * <parameter>k</parameter></paramdef>
11161  </funcprototype></funcsynopsis>
11162</refsynopsisdiv>
11163<refsect1>
11164 <title>Arguments</title>
11165 <variablelist>
11166  <varlistentry>
11167   <term><parameter>k</parameter></term>
11168   <listitem>
11169    <para>
11170     thread created by <function>kthread_create</function>.
11171    </para>
11172   </listitem>
11173  </varlistentry>
11174 </variablelist>
11175</refsect1>
11176<refsect1>
11177<title>Description</title>
11178<para>
11179   Sets <function><link linkend="API-kthread-should-stop">kthread_should_stop</link></function> for <parameter>k</parameter> to return true, wakes it, and
11180   waits for it to exit. This can also be called after <function>kthread_create</function>
11181   instead of calling <function><link linkend="API-wake-up-process">wake_up_process</link></function>: the thread will exit without
11182   calling <function>threadfn</function>.
11183   </para><para>
11184
11185   If <function>threadfn</function> may call <function>do_exit</function> itself, the caller must ensure
11186   task_struct can't go away.
11187   </para><para>
11188
11189   Returns the result of <function>threadfn</function>, or <constant>-EINTR</constant> if <function><link linkend="API-wake-up-process">wake_up_process</link></function>
11190   was never called.
11191</para>
11192</refsect1>
11193</refentry>
11194
11195<refentry id="API-kthread-worker-fn">
11196<refentryinfo>
11197 <title>LINUX</title>
11198 <productname>Kernel Hackers Manual</productname>
11199 <date>July 2017</date>
11200</refentryinfo>
11201<refmeta>
11202 <refentrytitle><phrase>kthread_worker_fn</phrase></refentrytitle>
11203 <manvolnum>9</manvolnum>
11204 <refmiscinfo class="version">4.4.14</refmiscinfo>
11205</refmeta>
11206<refnamediv>
11207 <refname>kthread_worker_fn</refname>
11208 <refpurpose>
11209     kthread function to process kthread_worker
11210 </refpurpose>
11211</refnamediv>
11212<refsynopsisdiv>
11213 <title>Synopsis</title>
11214  <funcsynopsis><funcprototype>
11215   <funcdef>int <function>kthread_worker_fn </function></funcdef>
11216   <paramdef>void * <parameter>worker_ptr</parameter></paramdef>
11217  </funcprototype></funcsynopsis>
11218</refsynopsisdiv>
11219<refsect1>
11220 <title>Arguments</title>
11221 <variablelist>
11222  <varlistentry>
11223   <term><parameter>worker_ptr</parameter></term>
11224   <listitem>
11225    <para>
11226     pointer to initialized kthread_worker
11227    </para>
11228   </listitem>
11229  </varlistentry>
11230 </variablelist>
11231</refsect1>
11232<refsect1>
11233<title>Description</title>
11234<para>
11235   This function can be used as <parameter>threadfn</parameter> to <function>kthread_create</function> or
11236   <function><link linkend="API-kthread-run">kthread_run</link></function> with <parameter>worker_ptr</parameter> argument pointing to an initialized
11237   kthread_worker.  The started kthread will process work_list until
11238   the it is stopped with <function><link linkend="API-kthread-stop">kthread_stop</link></function>.  A kthread can also call
11239   this function directly after extra initialization.
11240   </para><para>
11241
11242   Different kthreads can be used for the same kthread_worker as long
11243   as there's only one kthread attached to it at any given time.  A
11244   kthread_worker without an attached kthread simply collects queued
11245   kthread_works.
11246</para>
11247</refsect1>
11248</refentry>
11249
11250<refentry id="API-queue-kthread-work">
11251<refentryinfo>
11252 <title>LINUX</title>
11253 <productname>Kernel Hackers Manual</productname>
11254 <date>July 2017</date>
11255</refentryinfo>
11256<refmeta>
11257 <refentrytitle><phrase>queue_kthread_work</phrase></refentrytitle>
11258 <manvolnum>9</manvolnum>
11259 <refmiscinfo class="version">4.4.14</refmiscinfo>
11260</refmeta>
11261<refnamediv>
11262 <refname>queue_kthread_work</refname>
11263 <refpurpose>
11264     queue a kthread_work
11265 </refpurpose>
11266</refnamediv>
11267<refsynopsisdiv>
11268 <title>Synopsis</title>
11269  <funcsynopsis><funcprototype>
11270   <funcdef>bool <function>queue_kthread_work </function></funcdef>
11271   <paramdef>struct kthread_worker * <parameter>worker</parameter></paramdef>
11272   <paramdef>struct kthread_work * <parameter>work</parameter></paramdef>
11273  </funcprototype></funcsynopsis>
11274</refsynopsisdiv>
11275<refsect1>
11276 <title>Arguments</title>
11277 <variablelist>
11278  <varlistentry>
11279   <term><parameter>worker</parameter></term>
11280   <listitem>
11281    <para>
11282     target kthread_worker
11283    </para>
11284   </listitem>
11285  </varlistentry>
11286  <varlistentry>
11287   <term><parameter>work</parameter></term>
11288   <listitem>
11289    <para>
11290     kthread_work to queue
11291    </para>
11292   </listitem>
11293  </varlistentry>
11294 </variablelist>
11295</refsect1>
11296<refsect1>
11297<title>Description</title>
11298<para>
11299   Queue <parameter>work</parameter> to work processor <parameter>task</parameter> for async execution.  <parameter>task</parameter>
11300   must have been created with <function>kthread_worker_create</function>.  Returns <constant>true</constant>
11301   if <parameter>work</parameter> was successfully queued, <constant>false</constant> if it was already pending.
11302</para>
11303</refsect1>
11304</refentry>
11305
11306<refentry id="API-flush-kthread-work">
11307<refentryinfo>
11308 <title>LINUX</title>
11309 <productname>Kernel Hackers Manual</productname>
11310 <date>July 2017</date>
11311</refentryinfo>
11312<refmeta>
11313 <refentrytitle><phrase>flush_kthread_work</phrase></refentrytitle>
11314 <manvolnum>9</manvolnum>
11315 <refmiscinfo class="version">4.4.14</refmiscinfo>
11316</refmeta>
11317<refnamediv>
11318 <refname>flush_kthread_work</refname>
11319 <refpurpose>
11320     flush a kthread_work
11321 </refpurpose>
11322</refnamediv>
11323<refsynopsisdiv>
11324 <title>Synopsis</title>
11325  <funcsynopsis><funcprototype>
11326   <funcdef>void <function>flush_kthread_work </function></funcdef>
11327   <paramdef>struct kthread_work * <parameter>work</parameter></paramdef>
11328  </funcprototype></funcsynopsis>
11329</refsynopsisdiv>
11330<refsect1>
11331 <title>Arguments</title>
11332 <variablelist>
11333  <varlistentry>
11334   <term><parameter>work</parameter></term>
11335   <listitem>
11336    <para>
11337     work to flush
11338    </para>
11339   </listitem>
11340  </varlistentry>
11341 </variablelist>
11342</refsect1>
11343<refsect1>
11344<title>Description</title>
11345<para>
11346   If <parameter>work</parameter> is queued or executing, wait for it to finish execution.
11347</para>
11348</refsect1>
11349</refentry>
11350
11351<refentry id="API-flush-kthread-worker">
11352<refentryinfo>
11353 <title>LINUX</title>
11354 <productname>Kernel Hackers Manual</productname>
11355 <date>July 2017</date>
11356</refentryinfo>
11357<refmeta>
11358 <refentrytitle><phrase>flush_kthread_worker</phrase></refentrytitle>
11359 <manvolnum>9</manvolnum>
11360 <refmiscinfo class="version">4.4.14</refmiscinfo>
11361</refmeta>
11362<refnamediv>
11363 <refname>flush_kthread_worker</refname>
11364 <refpurpose>
11365     flush all current works on a kthread_worker
11366 </refpurpose>
11367</refnamediv>
11368<refsynopsisdiv>
11369 <title>Synopsis</title>
11370  <funcsynopsis><funcprototype>
11371   <funcdef>void <function>flush_kthread_worker </function></funcdef>
11372   <paramdef>struct kthread_worker * <parameter>worker</parameter></paramdef>
11373  </funcprototype></funcsynopsis>
11374</refsynopsisdiv>
11375<refsect1>
11376 <title>Arguments</title>
11377 <variablelist>
11378  <varlistentry>
11379   <term><parameter>worker</parameter></term>
11380   <listitem>
11381    <para>
11382     worker to flush
11383    </para>
11384   </listitem>
11385  </varlistentry>
11386 </variablelist>
11387</refsect1>
11388<refsect1>
11389<title>Description</title>
11390<para>
11391   Wait until all currently executing or pending works on <parameter>worker</parameter> are
11392   finished.
11393</para>
11394</refsect1>
11395</refentry>
11396
11397     </sect1>
11398
11399     <sect1><title>Kernel objects manipulation</title>
11400<!--
11401X!Iinclude/linux/kobject.h
11402-->
11403<!-- lib/kobject.c -->
11404<refentry id="API-kobject-get-path">
11405<refentryinfo>
11406 <title>LINUX</title>
11407 <productname>Kernel Hackers Manual</productname>
11408 <date>July 2017</date>
11409</refentryinfo>
11410<refmeta>
11411 <refentrytitle><phrase>kobject_get_path</phrase></refentrytitle>
11412 <manvolnum>9</manvolnum>
11413 <refmiscinfo class="version">4.4.14</refmiscinfo>
11414</refmeta>
11415<refnamediv>
11416 <refname>kobject_get_path</refname>
11417 <refpurpose>
11418  generate and return the path associated with a given kobj and kset pair.
11419 </refpurpose>
11420</refnamediv>
11421<refsynopsisdiv>
11422 <title>Synopsis</title>
11423  <funcsynopsis><funcprototype>
11424   <funcdef>char * <function>kobject_get_path </function></funcdef>
11425   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11426   <paramdef>gfp_t <parameter>gfp_mask</parameter></paramdef>
11427  </funcprototype></funcsynopsis>
11428</refsynopsisdiv>
11429<refsect1>
11430 <title>Arguments</title>
11431 <variablelist>
11432  <varlistentry>
11433   <term><parameter>kobj</parameter></term>
11434   <listitem>
11435    <para>
11436     kobject in question, with which to build the path
11437    </para>
11438   </listitem>
11439  </varlistentry>
11440  <varlistentry>
11441   <term><parameter>gfp_mask</parameter></term>
11442   <listitem>
11443    <para>
11444     the allocation type used to allocate the path
11445    </para>
11446   </listitem>
11447  </varlistentry>
11448 </variablelist>
11449</refsect1>
11450<refsect1>
11451<title>Description</title>
11452<para>
11453   The result must be freed by the caller with <function>kfree</function>.
11454</para>
11455</refsect1>
11456</refentry>
11457
11458<refentry id="API-kobject-set-name">
11459<refentryinfo>
11460 <title>LINUX</title>
11461 <productname>Kernel Hackers Manual</productname>
11462 <date>July 2017</date>
11463</refentryinfo>
11464<refmeta>
11465 <refentrytitle><phrase>kobject_set_name</phrase></refentrytitle>
11466 <manvolnum>9</manvolnum>
11467 <refmiscinfo class="version">4.4.14</refmiscinfo>
11468</refmeta>
11469<refnamediv>
11470 <refname>kobject_set_name</refname>
11471 <refpurpose>
11472     Set the name of a kobject
11473 </refpurpose>
11474</refnamediv>
11475<refsynopsisdiv>
11476 <title>Synopsis</title>
11477  <funcsynopsis><funcprototype>
11478   <funcdef>int <function>kobject_set_name </function></funcdef>
11479   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11480   <paramdef>const char * <parameter>fmt</parameter></paramdef>
11481   <paramdef> <parameter>...</parameter></paramdef>
11482  </funcprototype></funcsynopsis>
11483</refsynopsisdiv>
11484<refsect1>
11485 <title>Arguments</title>
11486 <variablelist>
11487  <varlistentry>
11488   <term><parameter>kobj</parameter></term>
11489   <listitem>
11490    <para>
11491     struct kobject to set the name of
11492    </para>
11493   </listitem>
11494  </varlistentry>
11495  <varlistentry>
11496   <term><parameter>fmt</parameter></term>
11497   <listitem>
11498    <para>
11499     format string used to build the name
11500    </para>
11501   </listitem>
11502  </varlistentry>
11503  <varlistentry>
11504   <term><parameter>...</parameter></term>
11505   <listitem>
11506    <para>
11507     variable arguments
11508    </para>
11509   </listitem>
11510  </varlistentry>
11511 </variablelist>
11512</refsect1>
11513<refsect1>
11514<title>Description</title>
11515<para>
11516   This sets the name of the kobject.  If you have already added the
11517   kobject to the system, you must call <function><link linkend="API-kobject-rename">kobject_rename</link></function> in order to
11518   change the name of the kobject.
11519</para>
11520</refsect1>
11521</refentry>
11522
11523<refentry id="API-kobject-init">
11524<refentryinfo>
11525 <title>LINUX</title>
11526 <productname>Kernel Hackers Manual</productname>
11527 <date>July 2017</date>
11528</refentryinfo>
11529<refmeta>
11530 <refentrytitle><phrase>kobject_init</phrase></refentrytitle>
11531 <manvolnum>9</manvolnum>
11532 <refmiscinfo class="version">4.4.14</refmiscinfo>
11533</refmeta>
11534<refnamediv>
11535 <refname>kobject_init</refname>
11536 <refpurpose>
11537     initialize a kobject structure
11538 </refpurpose>
11539</refnamediv>
11540<refsynopsisdiv>
11541 <title>Synopsis</title>
11542  <funcsynopsis><funcprototype>
11543   <funcdef>void <function>kobject_init </function></funcdef>
11544   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11545   <paramdef>struct kobj_type * <parameter>ktype</parameter></paramdef>
11546  </funcprototype></funcsynopsis>
11547</refsynopsisdiv>
11548<refsect1>
11549 <title>Arguments</title>
11550 <variablelist>
11551  <varlistentry>
11552   <term><parameter>kobj</parameter></term>
11553   <listitem>
11554    <para>
11555     pointer to the kobject to initialize
11556    </para>
11557   </listitem>
11558  </varlistentry>
11559  <varlistentry>
11560   <term><parameter>ktype</parameter></term>
11561   <listitem>
11562    <para>
11563     pointer to the ktype for this kobject.
11564    </para>
11565   </listitem>
11566  </varlistentry>
11567 </variablelist>
11568</refsect1>
11569<refsect1>
11570<title>Description</title>
11571<para>
11572   This function will properly initialize a kobject such that it can then
11573   be passed to the <function><link linkend="API-kobject-add">kobject_add</link></function> call.
11574   </para><para>
11575
11576   After this function is called, the kobject MUST be cleaned up by a call
11577   to <function><link linkend="API-kobject-put">kobject_put</link></function>, not by a call to kfree directly to ensure that all of
11578   the memory is cleaned up properly.
11579</para>
11580</refsect1>
11581</refentry>
11582
11583<refentry id="API-kobject-add">
11584<refentryinfo>
11585 <title>LINUX</title>
11586 <productname>Kernel Hackers Manual</productname>
11587 <date>July 2017</date>
11588</refentryinfo>
11589<refmeta>
11590 <refentrytitle><phrase>kobject_add</phrase></refentrytitle>
11591 <manvolnum>9</manvolnum>
11592 <refmiscinfo class="version">4.4.14</refmiscinfo>
11593</refmeta>
11594<refnamediv>
11595 <refname>kobject_add</refname>
11596 <refpurpose>
11597     the main kobject add function
11598 </refpurpose>
11599</refnamediv>
11600<refsynopsisdiv>
11601 <title>Synopsis</title>
11602  <funcsynopsis><funcprototype>
11603   <funcdef>int <function>kobject_add </function></funcdef>
11604   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11605   <paramdef>struct kobject * <parameter>parent</parameter></paramdef>
11606   <paramdef>const char * <parameter>fmt</parameter></paramdef>
11607   <paramdef> <parameter>...</parameter></paramdef>
11608  </funcprototype></funcsynopsis>
11609</refsynopsisdiv>
11610<refsect1>
11611 <title>Arguments</title>
11612 <variablelist>
11613  <varlistentry>
11614   <term><parameter>kobj</parameter></term>
11615   <listitem>
11616    <para>
11617     the kobject to add
11618    </para>
11619   </listitem>
11620  </varlistentry>
11621  <varlistentry>
11622   <term><parameter>parent</parameter></term>
11623   <listitem>
11624    <para>
11625     pointer to the parent of the kobject.
11626    </para>
11627   </listitem>
11628  </varlistentry>
11629  <varlistentry>
11630   <term><parameter>fmt</parameter></term>
11631   <listitem>
11632    <para>
11633     format to name the kobject with.
11634    </para>
11635   </listitem>
11636  </varlistentry>
11637  <varlistentry>
11638   <term><parameter>...</parameter></term>
11639   <listitem>
11640    <para>
11641     variable arguments
11642    </para>
11643   </listitem>
11644  </varlistentry>
11645 </variablelist>
11646</refsect1>
11647<refsect1>
11648<title>Description</title>
11649<para>
11650   The kobject name is set and added to the kobject hierarchy in this
11651   function.
11652   </para><para>
11653
11654   If <parameter>parent</parameter> is set, then the parent of the <parameter>kobj</parameter> will be set to it.
11655   If <parameter>parent</parameter> is NULL, then the parent of the <parameter>kobj</parameter> will be set to the
11656   kobject associated with the kset assigned to this kobject.  If no kset
11657   is assigned to the kobject, then the kobject will be located in the
11658   root of the sysfs tree.
11659   </para><para>
11660
11661   If this function returns an error, <function><link linkend="API-kobject-put">kobject_put</link></function> must be called to
11662   properly clean up the memory associated with the object.
11663   Under no instance should the kobject that is passed to this function
11664   be directly freed with a call to <function>kfree</function>, that can leak memory.
11665   </para><para>
11666
11667   Note, no <quote>add</quote> uevent will be created with this call, the caller should set
11668   up all of the necessary sysfs files for the object and then call
11669   <function>kobject_uevent</function> with the UEVENT_ADD parameter to ensure that
11670   userspace is properly notified of this kobject's creation.
11671</para>
11672</refsect1>
11673</refentry>
11674
11675<refentry id="API-kobject-init-and-add">
11676<refentryinfo>
11677 <title>LINUX</title>
11678 <productname>Kernel Hackers Manual</productname>
11679 <date>July 2017</date>
11680</refentryinfo>
11681<refmeta>
11682 <refentrytitle><phrase>kobject_init_and_add</phrase></refentrytitle>
11683 <manvolnum>9</manvolnum>
11684 <refmiscinfo class="version">4.4.14</refmiscinfo>
11685</refmeta>
11686<refnamediv>
11687 <refname>kobject_init_and_add</refname>
11688 <refpurpose>
11689     initialize a kobject structure and add it to the kobject hierarchy
11690 </refpurpose>
11691</refnamediv>
11692<refsynopsisdiv>
11693 <title>Synopsis</title>
11694  <funcsynopsis><funcprototype>
11695   <funcdef>int <function>kobject_init_and_add </function></funcdef>
11696   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11697   <paramdef>struct kobj_type * <parameter>ktype</parameter></paramdef>
11698   <paramdef>struct kobject * <parameter>parent</parameter></paramdef>
11699   <paramdef>const char * <parameter>fmt</parameter></paramdef>
11700   <paramdef> <parameter>...</parameter></paramdef>
11701  </funcprototype></funcsynopsis>
11702</refsynopsisdiv>
11703<refsect1>
11704 <title>Arguments</title>
11705 <variablelist>
11706  <varlistentry>
11707   <term><parameter>kobj</parameter></term>
11708   <listitem>
11709    <para>
11710     pointer to the kobject to initialize
11711    </para>
11712   </listitem>
11713  </varlistentry>
11714  <varlistentry>
11715   <term><parameter>ktype</parameter></term>
11716   <listitem>
11717    <para>
11718     pointer to the ktype for this kobject.
11719    </para>
11720   </listitem>
11721  </varlistentry>
11722  <varlistentry>
11723   <term><parameter>parent</parameter></term>
11724   <listitem>
11725    <para>
11726     pointer to the parent of this kobject.
11727    </para>
11728   </listitem>
11729  </varlistentry>
11730  <varlistentry>
11731   <term><parameter>fmt</parameter></term>
11732   <listitem>
11733    <para>
11734     the name of the kobject.
11735    </para>
11736   </listitem>
11737  </varlistentry>
11738  <varlistentry>
11739   <term><parameter>...</parameter></term>
11740   <listitem>
11741    <para>
11742     variable arguments
11743    </para>
11744   </listitem>
11745  </varlistentry>
11746 </variablelist>
11747</refsect1>
11748<refsect1>
11749<title>Description</title>
11750<para>
11751   This function combines the call to <function><link linkend="API-kobject-init">kobject_init</link></function> and
11752   <function><link linkend="API-kobject-add">kobject_add</link></function>.  The same type of error handling after a call to
11753   <function><link linkend="API-kobject-add">kobject_add</link></function> and kobject lifetime rules are the same here.
11754</para>
11755</refsect1>
11756</refentry>
11757
11758<refentry id="API-kobject-rename">
11759<refentryinfo>
11760 <title>LINUX</title>
11761 <productname>Kernel Hackers Manual</productname>
11762 <date>July 2017</date>
11763</refentryinfo>
11764<refmeta>
11765 <refentrytitle><phrase>kobject_rename</phrase></refentrytitle>
11766 <manvolnum>9</manvolnum>
11767 <refmiscinfo class="version">4.4.14</refmiscinfo>
11768</refmeta>
11769<refnamediv>
11770 <refname>kobject_rename</refname>
11771 <refpurpose>
11772     change the name of an object
11773 </refpurpose>
11774</refnamediv>
11775<refsynopsisdiv>
11776 <title>Synopsis</title>
11777  <funcsynopsis><funcprototype>
11778   <funcdef>int <function>kobject_rename </function></funcdef>
11779   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11780   <paramdef>const char * <parameter>new_name</parameter></paramdef>
11781  </funcprototype></funcsynopsis>
11782</refsynopsisdiv>
11783<refsect1>
11784 <title>Arguments</title>
11785 <variablelist>
11786  <varlistentry>
11787   <term><parameter>kobj</parameter></term>
11788   <listitem>
11789    <para>
11790     object in question.
11791    </para>
11792   </listitem>
11793  </varlistentry>
11794  <varlistentry>
11795   <term><parameter>new_name</parameter></term>
11796   <listitem>
11797    <para>
11798     object's new name
11799    </para>
11800   </listitem>
11801  </varlistentry>
11802 </variablelist>
11803</refsect1>
11804<refsect1>
11805<title>Description</title>
11806<para>
11807   It is the responsibility of the caller to provide mutual
11808   exclusion between two different calls of kobject_rename
11809   on the same kobject and to ensure that new_name is valid and
11810   won't conflict with other kobjects.
11811</para>
11812</refsect1>
11813</refentry>
11814
11815<refentry id="API-kobject-move">
11816<refentryinfo>
11817 <title>LINUX</title>
11818 <productname>Kernel Hackers Manual</productname>
11819 <date>July 2017</date>
11820</refentryinfo>
11821<refmeta>
11822 <refentrytitle><phrase>kobject_move</phrase></refentrytitle>
11823 <manvolnum>9</manvolnum>
11824 <refmiscinfo class="version">4.4.14</refmiscinfo>
11825</refmeta>
11826<refnamediv>
11827 <refname>kobject_move</refname>
11828 <refpurpose>
11829     move object to another parent
11830 </refpurpose>
11831</refnamediv>
11832<refsynopsisdiv>
11833 <title>Synopsis</title>
11834  <funcsynopsis><funcprototype>
11835   <funcdef>int <function>kobject_move </function></funcdef>
11836   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11837   <paramdef>struct kobject * <parameter>new_parent</parameter></paramdef>
11838  </funcprototype></funcsynopsis>
11839</refsynopsisdiv>
11840<refsect1>
11841 <title>Arguments</title>
11842 <variablelist>
11843  <varlistentry>
11844   <term><parameter>kobj</parameter></term>
11845   <listitem>
11846    <para>
11847     object in question.
11848    </para>
11849   </listitem>
11850  </varlistentry>
11851  <varlistentry>
11852   <term><parameter>new_parent</parameter></term>
11853   <listitem>
11854    <para>
11855     object's new parent (can be NULL)
11856    </para>
11857   </listitem>
11858  </varlistentry>
11859 </variablelist>
11860</refsect1>
11861</refentry>
11862
11863<refentry id="API-kobject-del">
11864<refentryinfo>
11865 <title>LINUX</title>
11866 <productname>Kernel Hackers Manual</productname>
11867 <date>July 2017</date>
11868</refentryinfo>
11869<refmeta>
11870 <refentrytitle><phrase>kobject_del</phrase></refentrytitle>
11871 <manvolnum>9</manvolnum>
11872 <refmiscinfo class="version">4.4.14</refmiscinfo>
11873</refmeta>
11874<refnamediv>
11875 <refname>kobject_del</refname>
11876 <refpurpose>
11877     unlink kobject from hierarchy.
11878 </refpurpose>
11879</refnamediv>
11880<refsynopsisdiv>
11881 <title>Synopsis</title>
11882  <funcsynopsis><funcprototype>
11883   <funcdef>void <function>kobject_del </function></funcdef>
11884   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11885  </funcprototype></funcsynopsis>
11886</refsynopsisdiv>
11887<refsect1>
11888 <title>Arguments</title>
11889 <variablelist>
11890  <varlistentry>
11891   <term><parameter>kobj</parameter></term>
11892   <listitem>
11893    <para>
11894     object.
11895    </para>
11896   </listitem>
11897  </varlistentry>
11898 </variablelist>
11899</refsect1>
11900</refentry>
11901
11902<refentry id="API-kobject-get">
11903<refentryinfo>
11904 <title>LINUX</title>
11905 <productname>Kernel Hackers Manual</productname>
11906 <date>July 2017</date>
11907</refentryinfo>
11908<refmeta>
11909 <refentrytitle><phrase>kobject_get</phrase></refentrytitle>
11910 <manvolnum>9</manvolnum>
11911 <refmiscinfo class="version">4.4.14</refmiscinfo>
11912</refmeta>
11913<refnamediv>
11914 <refname>kobject_get</refname>
11915 <refpurpose>
11916     increment refcount for object.
11917 </refpurpose>
11918</refnamediv>
11919<refsynopsisdiv>
11920 <title>Synopsis</title>
11921  <funcsynopsis><funcprototype>
11922   <funcdef>struct kobject * <function>kobject_get </function></funcdef>
11923   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11924  </funcprototype></funcsynopsis>
11925</refsynopsisdiv>
11926<refsect1>
11927 <title>Arguments</title>
11928 <variablelist>
11929  <varlistentry>
11930   <term><parameter>kobj</parameter></term>
11931   <listitem>
11932    <para>
11933     object.
11934    </para>
11935   </listitem>
11936  </varlistentry>
11937 </variablelist>
11938</refsect1>
11939</refentry>
11940
11941<refentry id="API-kobject-put">
11942<refentryinfo>
11943 <title>LINUX</title>
11944 <productname>Kernel Hackers Manual</productname>
11945 <date>July 2017</date>
11946</refentryinfo>
11947<refmeta>
11948 <refentrytitle><phrase>kobject_put</phrase></refentrytitle>
11949 <manvolnum>9</manvolnum>
11950 <refmiscinfo class="version">4.4.14</refmiscinfo>
11951</refmeta>
11952<refnamediv>
11953 <refname>kobject_put</refname>
11954 <refpurpose>
11955     decrement refcount for object.
11956 </refpurpose>
11957</refnamediv>
11958<refsynopsisdiv>
11959 <title>Synopsis</title>
11960  <funcsynopsis><funcprototype>
11961   <funcdef>void <function>kobject_put </function></funcdef>
11962   <paramdef>struct kobject * <parameter>kobj</parameter></paramdef>
11963  </funcprototype></funcsynopsis>
11964</refsynopsisdiv>
11965<refsect1>
11966 <title>Arguments</title>
11967 <variablelist>
11968  <varlistentry>
11969   <term><parameter>kobj</parameter></term>
11970   <listitem>
11971    <para>
11972     object.
11973    </para>
11974   </listitem>
11975  </varlistentry>
11976 </variablelist>
11977</refsect1>
11978<refsect1>
11979<title>Description</title>
11980<para>
11981   Decrement the refcount, and if 0, call <function>kobject_cleanup</function>.
11982</para>
11983</refsect1>
11984</refentry>
11985
11986<refentry id="API-kobject-create-and-add">
11987<refentryinfo>
11988 <title>LINUX</title>
11989 <productname>Kernel Hackers Manual</productname>
11990 <date>July 2017</date>
11991</refentryinfo>
11992<refmeta>
11993 <refentrytitle><phrase>kobject_create_and_add</phrase></refentrytitle>
11994 <manvolnum>9</manvolnum>
11995 <refmiscinfo class="version">4.4.14</refmiscinfo>
11996</refmeta>
11997<refnamediv>
11998 <refname>kobject_create_and_add</refname>
11999 <refpurpose>
12000     create a struct kobject dynamically and register it with sysfs
12001 </refpurpose>
12002</refnamediv>
12003<refsynopsisdiv>
12004 <title>Synopsis</title>
12005  <funcsynopsis><funcprototype>
12006   <funcdef>struct kobject * <function>kobject_create_and_add </function></funcdef>
12007   <paramdef>const char * <parameter>name</parameter></paramdef>
12008   <paramdef>struct kobject * <parameter>parent</parameter></paramdef>
12009  </funcprototype></funcsynopsis>
12010</refsynopsisdiv>
12011<refsect1>
12012 <title>Arguments</title>
12013 <variablelist>
12014  <varlistentry>
12015   <term><parameter>name</parameter></term>
12016   <listitem>
12017    <para>
12018     the name for the kobject
12019    </para>
12020   </listitem>
12021  </varlistentry>
12022  <varlistentry>
12023   <term><parameter>parent</parameter></term>
12024   <listitem>
12025    <para>
12026     the parent kobject of this kobject, if any.
12027    </para>
12028   </listitem>
12029  </varlistentry>
12030 </variablelist>
12031</refsect1>
12032<refsect1>
12033<title>Description</title>
12034<para>
12035   This function creates a kobject structure dynamically and registers it
12036   with sysfs.  When you are finished with this structure, call
12037   <function><link linkend="API-kobject-put">kobject_put</link></function> and the structure will be dynamically freed when
12038   it is no longer being used.
12039   </para><para>
12040
12041   If the kobject was not able to be created, NULL will be returned.
12042</para>
12043</refsect1>
12044</refentry>
12045
12046<refentry id="API-kset-register">
12047<refentryinfo>
12048 <title>LINUX</title>
12049 <productname>Kernel Hackers Manual</productname>
12050 <date>July 2017</date>
12051</refentryinfo>
12052<refmeta>
12053 <refentrytitle><phrase>kset_register</phrase></refentrytitle>
12054 <manvolnum>9</manvolnum>
12055 <refmiscinfo class="version">4.4.14</refmiscinfo>
12056</refmeta>
12057<refnamediv>
12058 <refname>kset_register</refname>
12059 <refpurpose>
12060     initialize and add a kset.
12061 </refpurpose>
12062</refnamediv>
12063<refsynopsisdiv>
12064 <title>Synopsis</title>
12065  <funcsynopsis><funcprototype>
12066   <funcdef>int <function>kset_register </function></funcdef>
12067   <paramdef>struct kset * <parameter>k</parameter></paramdef>
12068  </funcprototype></funcsynopsis>
12069</refsynopsisdiv>
12070<refsect1>
12071 <title>Arguments</title>
12072 <variablelist>
12073  <varlistentry>
12074   <term><parameter>k</parameter></term>
12075   <listitem>
12076    <para>
12077     kset.
12078    </para>
12079   </listitem>
12080  </varlistentry>
12081 </variablelist>
12082</refsect1>
12083</refentry>
12084
12085<refentry id="API-kset-unregister">
12086<refentryinfo>
12087 <title>LINUX</title>
12088 <productname>Kernel Hackers Manual</productname>
12089 <date>July 2017</date>
12090</refentryinfo>
12091<refmeta>
12092 <refentrytitle><phrase>kset_unregister</phrase></refentrytitle>
12093 <manvolnum>9</manvolnum>
12094 <refmiscinfo class="version">4.4.14</refmiscinfo>
12095</refmeta>
12096<refnamediv>
12097 <refname>kset_unregister</refname>
12098 <refpurpose>
12099     remove a kset.
12100 </refpurpose>
12101</refnamediv>
12102<refsynopsisdiv>
12103 <title>Synopsis</title>
12104  <funcsynopsis><funcprototype>
12105   <funcdef>void <function>kset_unregister </function></funcdef>
12106   <paramdef>struct kset * <parameter>k</parameter></paramdef>
12107  </funcprototype></funcsynopsis>
12108</refsynopsisdiv>
12109<refsect1>
12110 <title>Arguments</title>
12111 <variablelist>
12112  <varlistentry>
12113   <term><parameter>k</parameter></term>
12114   <listitem>
12115    <para>
12116     kset.
12117    </para>
12118   </listitem>
12119  </varlistentry>
12120 </variablelist>
12121</refsect1>
12122</refentry>
12123
12124<refentry id="API-kset-create-and-add">
12125<refentryinfo>
12126 <title>LINUX</title>
12127 <productname>Kernel Hackers Manual</productname>
12128 <date>July 2017</date>
12129</refentryinfo>
12130<refmeta>
12131 <refentrytitle><phrase>kset_create_and_add</phrase></refentrytitle>
12132 <manvolnum>9</manvolnum>
12133 <refmiscinfo class="version">4.4.14</refmiscinfo>
12134</refmeta>
12135<refnamediv>
12136 <refname>kset_create_and_add</refname>
12137 <refpurpose>
12138     create a struct kset dynamically and add it to sysfs
12139 </refpurpose>
12140</refnamediv>
12141<refsynopsisdiv>
12142 <title>Synopsis</title>
12143  <funcsynopsis><funcprototype>
12144   <funcdef>struct kset * <function>kset_create_and_add </function></funcdef>
12145   <paramdef>const char * <parameter>name</parameter></paramdef>
12146   <paramdef>const struct kset_uevent_ops * <parameter>uevent_ops</parameter></paramdef>
12147   <paramdef>struct kobject * <parameter>parent_kobj</parameter></paramdef>
12148  </funcprototype></funcsynopsis>
12149</refsynopsisdiv>
12150<refsect1>
12151 <title>Arguments</title>
12152 <variablelist>
12153  <varlistentry>
12154   <term><parameter>name</parameter></term>
12155   <listitem>
12156    <para>
12157     the name for the kset
12158    </para>
12159   </listitem>
12160  </varlistentry>
12161  <varlistentry>
12162   <term><parameter>uevent_ops</parameter></term>
12163   <listitem>
12164    <para>
12165     a struct kset_uevent_ops for the kset
12166    </para>
12167   </listitem>
12168  </varlistentry>
12169  <varlistentry>
12170   <term><parameter>parent_kobj</parameter></term>
12171   <listitem>
12172    <para>
12173     the parent kobject of this kset, if any.
12174    </para>
12175   </listitem>
12176  </varlistentry>
12177 </variablelist>
12178</refsect1>
12179<refsect1>
12180<title>Description</title>
12181<para>
12182   This function creates a kset structure dynamically and registers it
12183   with sysfs.  When you are finished with this structure, call
12184   <function><link linkend="API-kset-unregister">kset_unregister</link></function> and the structure will be dynamically freed when it
12185   is no longer being used.
12186   </para><para>
12187
12188   If the kset was not able to be created, NULL will be returned.
12189</para>
12190</refsect1>
12191</refentry>
12192
12193     </sect1>
12194
12195     <sect1><title>Kernel utility functions</title>
12196<!-- include/linux/kernel.h -->
12197<refentry id="API-upper-32-bits">
12198<refentryinfo>
12199 <title>LINUX</title>
12200 <productname>Kernel Hackers Manual</productname>
12201 <date>July 2017</date>
12202</refentryinfo>
12203<refmeta>
12204 <refentrytitle><phrase>upper_32_bits</phrase></refentrytitle>
12205 <manvolnum>9</manvolnum>
12206 <refmiscinfo class="version">4.4.14</refmiscinfo>
12207</refmeta>
12208<refnamediv>
12209 <refname>upper_32_bits</refname>
12210 <refpurpose>
12211  return bits 32-63 of a number
12212 </refpurpose>
12213</refnamediv>
12214<refsynopsisdiv>
12215 <title>Synopsis</title>
12216  <funcsynopsis><funcprototype>
12217   <funcdef> <function>upper_32_bits </function></funcdef>
12218   <paramdef> <parameter>n</parameter></paramdef>
12219  </funcprototype></funcsynopsis>
12220</refsynopsisdiv>
12221<refsect1>
12222 <title>Arguments</title>
12223 <variablelist>
12224  <varlistentry>
12225   <term><parameter>n</parameter></term>
12226   <listitem>
12227    <para>
12228     the number we're accessing
12229    </para>
12230   </listitem>
12231  </varlistentry>
12232 </variablelist>
12233</refsect1>
12234<refsect1>
12235<title>Description</title>
12236<para>
12237   A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
12238   the <quote>right shift count &gt;= width of type</quote> warning when that quantity is
12239   32-bits.
12240</para>
12241</refsect1>
12242</refentry>
12243
12244<refentry id="API-lower-32-bits">
12245<refentryinfo>
12246 <title>LINUX</title>
12247 <productname>Kernel Hackers Manual</productname>
12248 <date>July 2017</date>
12249</refentryinfo>
12250<refmeta>
12251 <refentrytitle><phrase>lower_32_bits</phrase></refentrytitle>
12252 <manvolnum>9</manvolnum>
12253 <refmiscinfo class="version">4.4.14</refmiscinfo>
12254</refmeta>
12255<refnamediv>
12256 <refname>lower_32_bits</refname>
12257 <refpurpose>
12258     return bits 0-31 of a number
12259 </refpurpose>
12260</refnamediv>
12261<refsynopsisdiv>
12262 <title>Synopsis</title>
12263  <funcsynopsis><funcprototype>
12264   <funcdef> <function>lower_32_bits </function></funcdef>
12265   <paramdef> <parameter>n</parameter></paramdef>
12266  </funcprototype></funcsynopsis>
12267</refsynopsisdiv>
12268<refsect1>
12269 <title>Arguments</title>
12270 <variablelist>
12271  <varlistentry>
12272   <term><parameter>n</parameter></term>
12273   <listitem>
12274    <para>
12275     the number we're accessing
12276    </para>
12277   </listitem>
12278  </varlistentry>
12279 </variablelist>
12280</refsect1>
12281</refentry>
12282
12283<refentry id="API-might-sleep">
12284<refentryinfo>
12285 <title>LINUX</title>
12286 <productname>Kernel Hackers Manual</productname>
12287 <date>July 2017</date>
12288</refentryinfo>
12289<refmeta>
12290 <refentrytitle><phrase>might_sleep</phrase></refentrytitle>
12291 <manvolnum>9</manvolnum>
12292 <refmiscinfo class="version">4.4.14</refmiscinfo>
12293</refmeta>
12294<refnamediv>
12295 <refname>might_sleep</refname>
12296 <refpurpose>
12297     annotation for functions that can sleep
12298 </refpurpose>
12299</refnamediv>
12300<refsynopsisdiv>
12301 <title>Synopsis</title>
12302  <funcsynopsis><funcprototype>
12303   <funcdef> <function>might_sleep </function></funcdef>
12304  <void/>
12305  </funcprototype></funcsynopsis>
12306</refsynopsisdiv>
12307<refsect1>
12308 <title>Arguments</title>
12309 <para>
12310  None
12311 </para>
12312</refsect1>
12313<refsect1>
12314<title>Description</title>
12315<para>
12316   </para><para>
12317
12318   this macro will print a stack trace if it is executed in an atomic
12319   context (spinlock, irq-handler, ...).
12320   </para><para>
12321
12322   This is a useful debugging help to be able to catch problems early and not
12323   be bitten later when the calling function happens to sleep when it is not
12324   supposed to.
12325</para>
12326</refsect1>
12327</refentry>
12328
12329<refentry id="API-abs">
12330<refentryinfo>
12331 <title>LINUX</title>
12332 <productname>Kernel Hackers Manual</productname>
12333 <date>July 2017</date>
12334</refentryinfo>
12335<refmeta>
12336 <refentrytitle><phrase>abs</phrase></refentrytitle>
12337 <manvolnum>9</manvolnum>
12338 <refmiscinfo class="version">4.4.14</refmiscinfo>
12339</refmeta>
12340<refnamediv>
12341 <refname>abs</refname>
12342 <refpurpose>
12343     return absolute value of an argument
12344 </refpurpose>
12345</refnamediv>
12346<refsynopsisdiv>
12347 <title>Synopsis</title>
12348  <funcsynopsis><funcprototype>
12349   <funcdef> <function>abs </function></funcdef>
12350   <paramdef> <parameter>x</parameter></paramdef>
12351  </funcprototype></funcsynopsis>
12352</refsynopsisdiv>
12353<refsect1>
12354 <title>Arguments</title>
12355 <variablelist>
12356  <varlistentry>
12357   <term><parameter>x</parameter></term>
12358   <listitem>
12359    <para>
12360     the value.  If it is unsigned type, it is converted to signed type first
12361     (s64, long or int depending on its size).
12362    </para>
12363   </listitem>
12364  </varlistentry>
12365 </variablelist>
12366</refsect1>
12367<refsect1>
12368<title>Return</title>
12369<para>
12370   an absolute value of x.  If x is 64-bit, macro's return type is s64,
12371   otherwise it is signed long.
12372</para>
12373</refsect1>
12374</refentry>
12375
12376<refentry id="API-reciprocal-scale">
12377<refentryinfo>
12378 <title>LINUX</title>
12379 <productname>Kernel Hackers Manual</productname>
12380 <date>July 2017</date>
12381</refentryinfo>
12382<refmeta>
12383 <refentrytitle><phrase>reciprocal_scale</phrase></refentrytitle>
12384 <manvolnum>9</manvolnum>
12385 <refmiscinfo class="version">4.4.14</refmiscinfo>
12386</refmeta>
12387<refnamediv>
12388 <refname>reciprocal_scale</refname>
12389 <refpurpose>
12390     "scale" a value into range [0, ep_ro)
12391 </refpurpose>
12392</refnamediv>
12393<refsynopsisdiv>
12394 <title>Synopsis</title>
12395  <funcsynopsis><funcprototype>
12396   <funcdef>u32 <function>reciprocal_scale </function></funcdef>
12397   <paramdef>u32 <parameter>val</parameter></paramdef>
12398   <paramdef>u32 <parameter>ep_ro</parameter></paramdef>
12399  </funcprototype></funcsynopsis>
12400</refsynopsisdiv>
12401<refsect1>
12402 <title>Arguments</title>
12403 <variablelist>
12404  <varlistentry>
12405   <term><parameter>val</parameter></term>
12406   <listitem>
12407    <para>
12408     value
12409    </para>
12410   </listitem>
12411  </varlistentry>
12412  <varlistentry>
12413   <term><parameter>ep_ro</parameter></term>
12414   <listitem>
12415    <para>
12416     right open interval endpoint
12417    </para>
12418   </listitem>
12419  </varlistentry>
12420 </variablelist>
12421</refsect1>
12422<refsect1>
12423<title>Description</title>
12424<para>
12425   Perform a <quote>reciprocal multiplication</quote> in order to <quote>scale</quote> a value into
12426   range [0, ep_ro), where the upper interval endpoint is right-open.
12427   This is useful, e.g. for accessing a index of an array containing
12428   ep_ro elements, for example. Think of it as sort of modulus, only that
12429   the result isn't that of modulo. ;) Note that if initial input is a
12430   small value, then result will return 0.
12431</para>
12432</refsect1>
12433<refsect1>
12434<title>Return</title>
12435<para>
12436   a result based on val in interval [0, ep_ro).
12437</para>
12438</refsect1>
12439</refentry>
12440
12441<refentry id="API-kstrtoul">
12442<refentryinfo>
12443 <title>LINUX</title>
12444 <productname>Kernel Hackers Manual</productname>
12445 <date>July 2017</date>
12446</refentryinfo>
12447<refmeta>
12448 <refentrytitle><phrase>kstrtoul</phrase></refentrytitle>
12449 <manvolnum>9</manvolnum>
12450 <refmiscinfo class="version">4.4.14</refmiscinfo>
12451</refmeta>
12452<refnamediv>
12453 <refname>kstrtoul</refname>
12454 <refpurpose>
12455     convert a string to an unsigned long
12456 </refpurpose>
12457</refnamediv>
12458<refsynopsisdiv>
12459 <title>Synopsis</title>
12460  <funcsynopsis><funcprototype>
12461   <funcdef>int <function>kstrtoul </function></funcdef>
12462   <paramdef>const char * <parameter>s</parameter></paramdef>
12463   <paramdef>unsigned int <parameter>base</parameter></paramdef>
12464   <paramdef>unsigned long * <parameter>res</parameter></paramdef>
12465  </funcprototype></funcsynopsis>
12466</refsynopsisdiv>
12467<refsect1>
12468 <title>Arguments</title>
12469 <variablelist>
12470  <varlistentry>
12471   <term><parameter>s</parameter></term>
12472   <listitem>
12473    <para>
12474     The start of the string. The string must be null-terminated, and may also
12475     include a single newline before its terminating null. The first character
12476     may also be a plus sign, but not a minus sign.
12477    </para>
12478   </listitem>
12479  </varlistentry>
12480  <varlistentry>
12481   <term><parameter>base</parameter></term>
12482   <listitem>
12483    <para>
12484     The number base to use. The maximum supported base is 16. If base is
12485     given as 0, then the base of the string is automatically detected with the
12486     conventional semantics - If it begins with 0x the number will be parsed as a
12487     hexadecimal (case insensitive), if it otherwise begins with 0, it will be
12488     parsed as an octal number. Otherwise it will be parsed as a decimal.
12489    </para>
12490   </listitem>
12491  </varlistentry>
12492  <varlistentry>
12493   <term><parameter>res</parameter></term>
12494   <listitem>
12495    <para>
12496     Where to write the result of the conversion on success.
12497    </para>
12498   </listitem>
12499  </varlistentry>
12500 </variablelist>
12501</refsect1>
12502<refsect1>
12503<title>Description</title>
12504<para>
12505   Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
12506   Used as a replacement for the obsolete simple_strtoull. Return code must
12507   be checked.
12508</para>
12509</refsect1>
12510</refentry>
12511
12512<refentry id="API-kstrtol">
12513<refentryinfo>
12514 <title>LINUX</title>
12515 <productname>Kernel Hackers Manual</productname>
12516 <date>July 2017</date>
12517</refentryinfo>
12518<refmeta>
12519 <refentrytitle><phrase>kstrtol</phrase></refentrytitle>
12520 <manvolnum>9</manvolnum>
12521 <refmiscinfo class="version">4.4.14</refmiscinfo>
12522</refmeta>
12523<refnamediv>
12524 <refname>kstrtol</refname>
12525 <refpurpose>
12526     convert a string to a long
12527 </refpurpose>
12528</refnamediv>
12529<refsynopsisdiv>
12530 <title>Synopsis</title>
12531  <funcsynopsis><funcprototype>
12532   <funcdef>int <function>kstrtol </function></funcdef>
12533   <paramdef>const char * <parameter>s</parameter></paramdef>
12534   <paramdef>unsigned int <parameter>base</parameter></paramdef>
12535   <paramdef>long * <parameter>res</parameter></paramdef>
12536  </funcprototype></funcsynopsis>
12537</refsynopsisdiv>
12538<refsect1>
12539 <title>Arguments</title>
12540 <variablelist>
12541  <varlistentry>
12542   <term><parameter>s</parameter></term>
12543   <listitem>
12544    <para>
12545     The start of the string. The string must be null-terminated, and may also
12546     include a single newline before its terminating null. The first character
12547     may also be a plus sign or a minus sign.
12548    </para>
12549   </listitem>
12550  </varlistentry>
12551  <varlistentry>
12552   <term><parameter>base</parameter></term>
12553   <listitem>
12554    <para>
12555     The number base to use. The maximum supported base is 16. If base is
12556     given as 0, then the base of the string is automatically detected with the
12557     conventional semantics - If it begins with 0x the number will be parsed as a
12558     hexadecimal (case insensitive), if it otherwise begins with 0, it will be
12559     parsed as an octal number. Otherwise it will be parsed as a decimal.
12560    </para>
12561   </listitem>
12562  </varlistentry>
12563  <varlistentry>
12564   <term><parameter>res</parameter></term>
12565   <listitem>
12566    <para>
12567     Where to write the result of the conversion on success.
12568    </para>
12569   </listitem>
12570  </varlistentry>
12571 </variablelist>
12572</refsect1>
12573<refsect1>
12574<title>Description</title>
12575<para>
12576   Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
12577   Used as a replacement for the obsolete simple_strtoull. Return code must
12578   be checked.
12579</para>
12580</refsect1>
12581</refentry>
12582
12583<refentry id="API-trace-printk">
12584<refentryinfo>
12585 <title>LINUX</title>
12586 <productname>Kernel Hackers Manual</productname>
12587 <date>July 2017</date>
12588</refentryinfo>
12589<refmeta>
12590 <refentrytitle><phrase>trace_printk</phrase></refentrytitle>
12591 <manvolnum>9</manvolnum>
12592 <refmiscinfo class="version">4.4.14</refmiscinfo>
12593</refmeta>
12594<refnamediv>
12595 <refname>trace_printk</refname>
12596 <refpurpose>
12597     printf formatting in the ftrace buffer
12598 </refpurpose>
12599</refnamediv>
12600<refsynopsisdiv>
12601 <title>Synopsis</title>
12602  <funcsynopsis><funcprototype>
12603   <funcdef> <function>trace_printk </function></funcdef>
12604   <paramdef> <parameter>fmt</parameter></paramdef>
12605   <paramdef> <parameter>...</parameter></paramdef>
12606  </funcprototype></funcsynopsis>
12607</refsynopsisdiv>
12608<refsect1>
12609 <title>Arguments</title>
12610 <variablelist>
12611  <varlistentry>
12612   <term><parameter>fmt</parameter></term>
12613   <listitem>
12614    <para>
12615     the printf format for printing
12616    </para>
12617   </listitem>
12618  </varlistentry>
12619  <varlistentry>
12620   <term><parameter>...</parameter></term>
12621   <listitem>
12622    <para>
12623     variable arguments
12624    </para>
12625   </listitem>
12626  </varlistentry>
12627 </variablelist>
12628</refsect1>
12629<refsect1>
12630<title>Note</title>
12631<para>
12632   __trace_printk is an internal function for trace_printk and
12633   the <parameter>ip</parameter> is passed in via the trace_printk macro.
12634   </para><para>
12635
12636   This function allows a kernel developer to debug fast path sections
12637   that printk is not appropriate for. By scattering in various
12638   printk like tracing in the code, a developer can quickly see
12639   where problems are occurring.
12640   </para><para>
12641
12642   This is intended as a debugging tool for the developer only.
12643   Please refrain from leaving trace_printks scattered around in
12644   your code. (Extra memory is used for special buffers that are
12645   allocated when <function><link linkend="API-trace-printk">trace_printk</link></function> is used)
12646   </para><para>
12647
12648   A little optization trick is done here. If there's only one
12649   argument, there's no need to scan the string for printf formats.
12650   The <function><link linkend="API-trace-puts">trace_puts</link></function> will suffice. But how can we take advantage of
12651   using <function><link linkend="API-trace-puts">trace_puts</link></function> when <function><link linkend="API-trace-printk">trace_printk</link></function> has only one argument?
12652   By stringifying the args and checking the size we can tell
12653   whether or not there are args. __stringify((__VA_ARGS__)) will
12654   turn into <quote>()\0</quote> with a size of 3 when there are no args, anything
12655   else will be bigger. All we need to do is define a string to this,
12656   and then take its size and compare to 3. If it's bigger, use
12657   <function>do_trace_printk</function> otherwise, optimize it to <function><link linkend="API-trace-puts">trace_puts</link></function>. Then just
12658   let gcc optimize the rest.
12659</para>
12660</refsect1>
12661</refentry>
12662
12663<refentry id="API-trace-puts">
12664<refentryinfo>
12665 <title>LINUX</title>
12666 <productname>Kernel Hackers Manual</productname>
12667 <date>July 2017</date>
12668</refentryinfo>
12669<refmeta>
12670 <refentrytitle><phrase>trace_puts</phrase></refentrytitle>
12671 <manvolnum>9</manvolnum>
12672 <refmiscinfo class="version">4.4.14</refmiscinfo>
12673</refmeta>
12674<refnamediv>
12675 <refname>trace_puts</refname>
12676 <refpurpose>
12677     write a string into the ftrace buffer
12678 </refpurpose>
12679</refnamediv>
12680<refsynopsisdiv>
12681 <title>Synopsis</title>
12682  <funcsynopsis><funcprototype>
12683   <funcdef> <function>trace_puts </function></funcdef>
12684   <paramdef> <parameter>str</parameter></paramdef>
12685  </funcprototype></funcsynopsis>
12686</refsynopsisdiv>
12687<refsect1>
12688 <title>Arguments</title>
12689 <variablelist>
12690  <varlistentry>
12691   <term><parameter>str</parameter></term>
12692   <listitem>
12693    <para>
12694     the string to record
12695    </para>
12696   </listitem>
12697  </varlistentry>
12698 </variablelist>
12699</refsect1>
12700<refsect1>
12701<title>Note</title>
12702<para>
12703   __trace_bputs is an internal function for trace_puts and
12704   the <parameter>ip</parameter> is passed in via the trace_puts macro.
12705   </para><para>
12706
12707   This is similar to <function><link linkend="API-trace-printk">trace_printk</link></function> but is made for those really fast
12708   paths that a developer wants the least amount of <quote>Heisenbug</quote> affects,
12709   where the processing of the print format is still too much.
12710   </para><para>
12711
12712   This function allows a kernel developer to debug fast path sections
12713   that printk is not appropriate for. By scattering in various
12714   printk like tracing in the code, a developer can quickly see
12715   where problems are occurring.
12716   </para><para>
12717
12718   This is intended as a debugging tool for the developer only.
12719   Please refrain from leaving trace_puts scattered around in
12720   your code. (Extra memory is used for special buffers that are
12721   allocated when <function><link linkend="API-trace-puts">trace_puts</link></function> is used)
12722</para>
12723</refsect1>
12724<refsect1>
12725<title>Returns</title>
12726<para>
12727   0 if nothing was written, positive # if string was.
12728   (1 when __trace_bputs is used, strlen(str) when __trace_puts is used)
12729</para>
12730</refsect1>
12731</refentry>
12732
12733<refentry id="API-min-not-zero">
12734<refentryinfo>
12735 <title>LINUX</title>
12736 <productname>Kernel Hackers Manual</productname>
12737 <date>July 2017</date>
12738</refentryinfo>
12739<refmeta>
12740 <refentrytitle><phrase>min_not_zero</phrase></refentrytitle>
12741 <manvolnum>9</manvolnum>
12742 <refmiscinfo class="version">4.4.14</refmiscinfo>
12743</refmeta>
12744<refnamediv>
12745 <refname>min_not_zero</refname>
12746 <refpurpose>
12747     return the minimum that is _not_ zero, unless both are zero
12748 </refpurpose>
12749</refnamediv>
12750<refsynopsisdiv>
12751 <title>Synopsis</title>
12752  <funcsynopsis><funcprototype>
12753   <funcdef> <function>min_not_zero </function></funcdef>
12754   <paramdef> <parameter>x</parameter></paramdef>
12755   <paramdef> <parameter>y</parameter></paramdef>
12756  </funcprototype></funcsynopsis>
12757</refsynopsisdiv>
12758<refsect1>
12759 <title>Arguments</title>
12760 <variablelist>
12761  <varlistentry>
12762   <term><parameter>x</parameter></term>
12763   <listitem>
12764    <para>
12765     value1
12766    </para>
12767   </listitem>
12768  </varlistentry>
12769  <varlistentry>
12770   <term><parameter>y</parameter></term>
12771   <listitem>
12772    <para>
12773     value2
12774    </para>
12775   </listitem>
12776  </varlistentry>
12777 </variablelist>
12778</refsect1>
12779</refentry>
12780
12781<refentry id="API-clamp">
12782<refentryinfo>
12783 <title>LINUX</title>
12784 <productname>Kernel Hackers Manual</productname>
12785 <date>July 2017</date>
12786</refentryinfo>
12787<refmeta>
12788 <refentrytitle><phrase>clamp</phrase></refentrytitle>
12789 <manvolnum>9</manvolnum>
12790 <refmiscinfo class="version">4.4.14</refmiscinfo>
12791</refmeta>
12792<refnamediv>
12793 <refname>clamp</refname>
12794 <refpurpose>
12795     return a value clamped to a given range with strict typechecking
12796 </refpurpose>
12797</refnamediv>
12798<refsynopsisdiv>
12799 <title>Synopsis</title>
12800  <funcsynopsis><funcprototype>
12801   <funcdef> <function>clamp </function></funcdef>
12802   <paramdef> <parameter>val</parameter></paramdef>
12803   <paramdef> <parameter>lo</parameter></paramdef>
12804   <paramdef> <parameter>hi</parameter></paramdef>
12805  </funcprototype></funcsynopsis>
12806</refsynopsisdiv>
12807<refsect1>
12808 <title>Arguments</title>
12809 <variablelist>
12810  <varlistentry>
12811   <term><parameter>val</parameter></term>
12812   <listitem>
12813    <para>
12814     current value
12815    </para>
12816   </listitem>
12817  </varlistentry>
12818  <varlistentry>
12819   <term><parameter>lo</parameter></term>
12820   <listitem>
12821    <para>
12822     lowest allowable value
12823    </para>
12824   </listitem>
12825  </varlistentry>
12826  <varlistentry>
12827   <term><parameter>hi</parameter></term>
12828   <listitem>
12829    <para>
12830     highest allowable value
12831    </para>
12832   </listitem>
12833  </varlistentry>
12834 </variablelist>
12835</refsect1>
12836<refsect1>
12837<title>Description</title>
12838<para>
12839   This macro does strict typechecking of lo/hi to make sure they are of the
12840   same type as val.  See the unnecessary pointer comparisons.
12841</para>
12842</refsect1>
12843</refentry>
12844
12845<refentry id="API-clamp-t">
12846<refentryinfo>
12847 <title>LINUX</title>
12848 <productname>Kernel Hackers Manual</productname>
12849 <date>July 2017</date>
12850</refentryinfo>
12851<refmeta>
12852 <refentrytitle><phrase>clamp_t</phrase></refentrytitle>
12853 <manvolnum>9</manvolnum>
12854 <refmiscinfo class="version">4.4.14</refmiscinfo>
12855</refmeta>
12856<refnamediv>
12857 <refname>clamp_t</refname>
12858 <refpurpose>
12859     return a value clamped to a given range using a given type
12860 </refpurpose>
12861</refnamediv>
12862<refsynopsisdiv>
12863 <title>Synopsis</title>
12864  <funcsynopsis><funcprototype>
12865   <funcdef> <function>clamp_t </function></funcdef>
12866   <paramdef> <parameter>type</parameter></paramdef>
12867   <paramdef> <parameter>val</parameter></paramdef>
12868   <paramdef> <parameter>lo</parameter></paramdef>
12869   <paramdef> <parameter>hi</parameter></paramdef>
12870  </funcprototype></funcsynopsis>
12871</refsynopsisdiv>
12872<refsect1>
12873 <title>Arguments</title>
12874 <variablelist>
12875  <varlistentry>
12876   <term><parameter>type</parameter></term>
12877   <listitem>
12878    <para>
12879     the type of variable to use
12880    </para>
12881   </listitem>
12882  </varlistentry>
12883  <varlistentry>
12884   <term><parameter>val</parameter></term>
12885   <listitem>
12886    <para>
12887     current value
12888    </para>
12889   </listitem>
12890  </varlistentry>
12891  <varlistentry>
12892   <term><parameter>lo</parameter></term>
12893   <listitem>
12894    <para>
12895     minimum allowable value
12896    </para>
12897   </listitem>
12898  </varlistentry>
12899  <varlistentry>
12900   <term><parameter>hi</parameter></term>
12901   <listitem>
12902    <para>
12903     maximum allowable value
12904    </para>
12905   </listitem>
12906  </varlistentry>
12907 </variablelist>
12908</refsect1>
12909<refsect1>
12910<title>Description</title>
12911<para>
12912   This macro does no typechecking and uses temporary variables of type
12913   'type' to make all the comparisons.
12914</para>
12915</refsect1>
12916</refentry>
12917
12918<refentry id="API-clamp-val">
12919<refentryinfo>
12920 <title>LINUX</title>
12921 <productname>Kernel Hackers Manual</productname>
12922 <date>July 2017</date>
12923</refentryinfo>
12924<refmeta>
12925 <refentrytitle><phrase>clamp_val</phrase></refentrytitle>
12926 <manvolnum>9</manvolnum>
12927 <refmiscinfo class="version">4.4.14</refmiscinfo>
12928</refmeta>
12929<refnamediv>
12930 <refname>clamp_val</refname>
12931 <refpurpose>
12932     return a value clamped to a given range using val's type
12933 </refpurpose>
12934</refnamediv>
12935<refsynopsisdiv>
12936 <title>Synopsis</title>
12937  <funcsynopsis><funcprototype>
12938   <funcdef> <function>clamp_val </function></funcdef>
12939   <paramdef> <parameter>val</parameter></paramdef>
12940   <paramdef> <parameter>lo</parameter></paramdef>
12941   <paramdef> <parameter>hi</parameter></paramdef>
12942  </funcprototype></funcsynopsis>
12943</refsynopsisdiv>
12944<refsect1>
12945 <title>Arguments</title>
12946 <variablelist>
12947  <varlistentry>
12948   <term><parameter>val</parameter></term>
12949   <listitem>
12950    <para>
12951     current value
12952    </para>
12953   </listitem>
12954  </varlistentry>
12955  <varlistentry>
12956   <term><parameter>lo</parameter></term>
12957   <listitem>
12958    <para>
12959     minimum allowable value
12960    </para>
12961   </listitem>
12962  </varlistentry>
12963  <varlistentry>
12964   <term><parameter>hi</parameter></term>
12965   <listitem>
12966    <para>
12967     maximum allowable value
12968    </para>
12969   </listitem>
12970  </varlistentry>
12971 </variablelist>
12972</refsect1>
12973<refsect1>
12974<title>Description</title>
12975<para>
12976   This macro does no typechecking and uses temporary variables of whatever
12977   type the input argument 'val' is.  This is useful when val is an unsigned
12978   type and min and max are literals that will otherwise be assigned a signed
12979   integer type.
12980</para>
12981</refsect1>
12982</refentry>
12983
12984<refentry id="API-container-of">
12985<refentryinfo>
12986 <title>LINUX</title>
12987 <productname>Kernel Hackers Manual</productname>
12988 <date>July 2017</date>
12989</refentryinfo>
12990<refmeta>
12991 <refentrytitle><phrase>container_of</phrase></refentrytitle>
12992 <manvolnum>9</manvolnum>
12993 <refmiscinfo class="version">4.4.14</refmiscinfo>
12994</refmeta>
12995<refnamediv>
12996 <refname>container_of</refname>
12997 <refpurpose>
12998     cast a member of a structure out to the containing structure
12999 </refpurpose>
13000</refnamediv>
13001<refsynopsisdiv>
13002 <title>Synopsis</title>
13003  <funcsynopsis><funcprototype>
13004   <funcdef> <function>container_of </function></funcdef>
13005   <paramdef> <parameter>ptr</parameter></paramdef>
13006   <paramdef> <parameter>type</parameter></paramdef>
13007   <paramdef> <parameter>member</parameter></paramdef>
13008  </funcprototype></funcsynopsis>
13009</refsynopsisdiv>
13010<refsect1>
13011 <title>Arguments</title>
13012 <variablelist>
13013  <varlistentry>
13014   <term><parameter>ptr</parameter></term>
13015   <listitem>
13016    <para>
13017     the pointer to the member.
13018    </para>
13019   </listitem>
13020  </varlistentry>
13021  <varlistentry>
13022   <term><parameter>type</parameter></term>
13023   <listitem>
13024    <para>
13025     the type of the container struct this is embedded in.
13026    </para>
13027   </listitem>
13028  </varlistentry>
13029  <varlistentry>
13030   <term><parameter>member</parameter></term>
13031   <listitem>
13032    <para>
13033     the name of the member within the struct.
13034    </para>
13035   </listitem>
13036  </varlistentry>
13037 </variablelist>
13038</refsect1>
13039</refentry>
13040
13041<!-- kernel/printk/printk.c -->
13042<refentry id="API-printk">
13043<refentryinfo>
13044 <title>LINUX</title>
13045 <productname>Kernel Hackers Manual</productname>
13046 <date>July 2017</date>
13047</refentryinfo>
13048<refmeta>
13049 <refentrytitle><phrase>printk</phrase></refentrytitle>
13050 <manvolnum>9</manvolnum>
13051 <refmiscinfo class="version">4.4.14</refmiscinfo>
13052</refmeta>
13053<refnamediv>
13054 <refname>printk</refname>
13055 <refpurpose>
13056  print a kernel message
13057 </refpurpose>
13058</refnamediv>
13059<refsynopsisdiv>
13060 <title>Synopsis</title>
13061  <funcsynopsis><funcprototype>
13062   <funcdef>__visible int <function>printk </function></funcdef>
13063   <paramdef>const char * <parameter>fmt</parameter></paramdef>
13064   <paramdef> <parameter>...</parameter></paramdef>
13065  </funcprototype></funcsynopsis>
13066</refsynopsisdiv>
13067<refsect1>
13068 <title>Arguments</title>
13069 <variablelist>
13070  <varlistentry>
13071   <term><parameter>fmt</parameter></term>
13072   <listitem>
13073    <para>
13074     format string
13075    </para>
13076   </listitem>
13077  </varlistentry>
13078  <varlistentry>
13079   <term><parameter>...</parameter></term>
13080   <listitem>
13081    <para>
13082     variable arguments
13083    </para>
13084   </listitem>
13085  </varlistentry>
13086 </variablelist>
13087</refsect1>
13088<refsect1>
13089<title>Description</title>
13090<para>
13091   This is <function><link linkend="API-printk">printk</link></function>. It can be called from any context. We want it to work.
13092   </para><para>
13093
13094   We try to grab the console_lock. If we succeed, it's easy - we log the
13095   output and call the console drivers.  If we fail to get the semaphore, we
13096   place the output into the log buffer and return. The current holder of
13097   the console_sem will notice the new output in <function><link linkend="API-console-unlock">console_unlock</link></function>; and will
13098   send it to the consoles before releasing the lock.
13099   </para><para>
13100
13101   One effect of this deferred printing is that code which calls <function><link linkend="API-printk">printk</link></function> and
13102   then changes console_loglevel may break. This is because console_loglevel
13103   is inspected when the actual printing occurs.
13104</para>
13105</refsect1>
13106<refsect1>
13107<title>See also</title>
13108<para>
13109   printf(3)
13110   </para><para>
13111
13112   See the <function>vsnprintf</function> documentation for format string extensions over C99.
13113</para>
13114</refsect1>
13115</refentry>
13116
13117<refentry id="API-console-lock">
13118<refentryinfo>
13119 <title>LINUX</title>
13120 <productname>Kernel Hackers Manual</productname>
13121 <date>July 2017</date>
13122</refentryinfo>
13123<refmeta>
13124 <refentrytitle><phrase>console_lock</phrase></refentrytitle>
13125 <manvolnum>9</manvolnum>
13126 <refmiscinfo class="version">4.4.14</refmiscinfo>
13127</refmeta>
13128<refnamediv>
13129 <refname>console_lock</refname>
13130 <refpurpose>
13131     lock the console system for exclusive use.
13132 </refpurpose>
13133</refnamediv>
13134<refsynopsisdiv>
13135 <title>Synopsis</title>
13136  <funcsynopsis><funcprototype>
13137   <funcdef>void <function>console_lock </function></funcdef>
13138   <paramdef> <parameter>void</parameter></paramdef>
13139  </funcprototype></funcsynopsis>
13140</refsynopsisdiv>
13141<refsect1>
13142 <title>Arguments</title>
13143 <variablelist>
13144  <varlistentry>
13145   <term><parameter>void</parameter></term>
13146   <listitem>
13147    <para>
13148     no arguments
13149    </para>
13150   </listitem>
13151  </varlistentry>
13152 </variablelist>
13153</refsect1>
13154<refsect1>
13155<title>Description</title>
13156<para>
13157   </para><para>
13158
13159   Acquires a lock which guarantees that the caller has
13160   exclusive access to the console system and the console_drivers list.
13161   </para><para>
13162
13163   Can sleep, returns nothing.
13164</para>
13165</refsect1>
13166</refentry>
13167
13168<refentry id="API-console-trylock">
13169<refentryinfo>
13170 <title>LINUX</title>
13171 <productname>Kernel Hackers Manual</productname>
13172 <date>July 2017</date>
13173</refentryinfo>
13174<refmeta>
13175 <refentrytitle><phrase>console_trylock</phrase></refentrytitle>
13176 <manvolnum>9</manvolnum>
13177 <refmiscinfo class="version">4.4.14</refmiscinfo>
13178</refmeta>
13179<refnamediv>
13180 <refname>console_trylock</refname>
13181 <refpurpose>
13182     try to lock the console system for exclusive use.
13183 </refpurpose>
13184</refnamediv>
13185<refsynopsisdiv>
13186 <title>Synopsis</title>
13187  <funcsynopsis><funcprototype>
13188   <funcdef>int <function>console_trylock </function></funcdef>
13189   <paramdef> <parameter>void</parameter></paramdef>
13190  </funcprototype></funcsynopsis>
13191</refsynopsisdiv>
13192<refsect1>
13193 <title>Arguments</title>
13194 <variablelist>
13195  <varlistentry>
13196   <term><parameter>void</parameter></term>
13197   <listitem>
13198    <para>
13199     no arguments
13200    </para>
13201   </listitem>
13202  </varlistentry>
13203 </variablelist>
13204</refsect1>
13205<refsect1>
13206<title>Description</title>
13207<para>
13208   </para><para>
13209
13210   Try to acquire a lock which guarantees that the caller has exclusive
13211   access to the console system and the console_drivers list.
13212   </para><para>
13213
13214   returns 1 on success, and 0 on failure to acquire the lock.
13215</para>
13216</refsect1>
13217</refentry>
13218
13219<refentry id="API-console-unlock">
13220<refentryinfo>
13221 <title>LINUX</title>
13222 <productname>Kernel Hackers Manual</productname>
13223 <date>July 2017</date>
13224</refentryinfo>
13225<refmeta>
13226 <refentrytitle><phrase>console_unlock</phrase></refentrytitle>
13227 <manvolnum>9</manvolnum>
13228 <refmiscinfo class="version">4.4.14</refmiscinfo>
13229</refmeta>
13230<refnamediv>
13231 <refname>console_unlock</refname>
13232 <refpurpose>
13233     unlock the console system
13234 </refpurpose>
13235</refnamediv>
13236<refsynopsisdiv>
13237 <title>Synopsis</title>
13238  <funcsynopsis><funcprototype>
13239   <funcdef>void <function>console_unlock </function></funcdef>
13240   <paramdef> <parameter>void</parameter></paramdef>
13241  </funcprototype></funcsynopsis>
13242</refsynopsisdiv>
13243<refsect1>
13244 <title>Arguments</title>
13245 <variablelist>
13246  <varlistentry>
13247   <term><parameter>void</parameter></term>
13248   <listitem>
13249    <para>
13250     no arguments
13251    </para>
13252   </listitem>
13253  </varlistentry>
13254 </variablelist>
13255</refsect1>
13256<refsect1>
13257<title>Description</title>
13258<para>
13259   </para><para>
13260
13261   Releases the console_lock which the caller holds on the console system
13262   and the console driver list.
13263   </para><para>
13264
13265   While the console_lock was held, console output may have been buffered
13266   by <function><link linkend="API-printk">printk</link></function>.  If this is the case, <function><link linkend="API-console-unlock">console_unlock</link></function>; emits
13267   the output prior to releasing the lock.
13268   </para><para>
13269
13270   If there is output waiting, we wake /dev/kmsg and <function>syslog</function> users.
13271   </para><para>
13272
13273   <function><link linkend="API-console-unlock">console_unlock</link></function>; may be called from any context.
13274</para>
13275</refsect1>
13276</refentry>
13277
13278<refentry id="API-console-conditional-schedule">
13279<refentryinfo>
13280 <title>LINUX</title>
13281 <productname>Kernel Hackers Manual</productname>
13282 <date>July 2017</date>
13283</refentryinfo>
13284<refmeta>
13285 <refentrytitle><phrase>console_conditional_schedule</phrase></refentrytitle>
13286 <manvolnum>9</manvolnum>
13287 <refmiscinfo class="version">4.4.14</refmiscinfo>
13288</refmeta>
13289<refnamediv>
13290 <refname>console_conditional_schedule</refname>
13291 <refpurpose>
13292     yield the CPU if required
13293 </refpurpose>
13294</refnamediv>
13295<refsynopsisdiv>
13296 <title>Synopsis</title>
13297  <funcsynopsis><funcprototype>
13298   <funcdef>void __sched <function>console_conditional_schedule </function></funcdef>
13299   <paramdef> <parameter>void</parameter></paramdef>
13300  </funcprototype></funcsynopsis>
13301</refsynopsisdiv>
13302<refsect1>
13303 <title>Arguments</title>
13304 <variablelist>
13305  <varlistentry>
13306   <term><parameter>void</parameter></term>
13307   <listitem>
13308    <para>
13309     no arguments
13310    </para>
13311   </listitem>
13312  </varlistentry>
13313 </variablelist>
13314</refsect1>
13315<refsect1>
13316<title>Description</title>
13317<para>
13318   </para><para>
13319
13320   If the console code is currently allowed to sleep, and
13321   if this CPU should yield the CPU to another task, do
13322   so here.
13323   </para><para>
13324
13325   Must be called within <function><link linkend="API-console-lock">console_lock</link></function>;.
13326</para>
13327</refsect1>
13328</refentry>
13329
13330<refentry id="API-printk-timed-ratelimit">
13331<refentryinfo>
13332 <title>LINUX</title>
13333 <productname>Kernel Hackers Manual</productname>
13334 <date>July 2017</date>
13335</refentryinfo>
13336<refmeta>
13337 <refentrytitle><phrase>printk_timed_ratelimit</phrase></refentrytitle>
13338 <manvolnum>9</manvolnum>
13339 <refmiscinfo class="version">4.4.14</refmiscinfo>
13340</refmeta>
13341<refnamediv>
13342 <refname>printk_timed_ratelimit</refname>
13343 <refpurpose>
13344     caller-controlled printk ratelimiting
13345 </refpurpose>
13346</refnamediv>
13347<refsynopsisdiv>
13348 <title>Synopsis</title>
13349  <funcsynopsis><funcprototype>
13350   <funcdef>bool <function>printk_timed_ratelimit </function></funcdef>
13351   <paramdef>unsigned long * <parameter>caller_jiffies</parameter></paramdef>
13352   <paramdef>unsigned int <parameter>interval_msecs</parameter></paramdef>
13353  </funcprototype></funcsynopsis>
13354</refsynopsisdiv>
13355<refsect1>
13356 <title>Arguments</title>
13357 <variablelist>
13358  <varlistentry>
13359   <term><parameter>caller_jiffies</parameter></term>
13360   <listitem>
13361    <para>
13362     pointer to caller's state
13363    </para>
13364   </listitem>
13365  </varlistentry>
13366  <varlistentry>
13367   <term><parameter>interval_msecs</parameter></term>
13368   <listitem>
13369    <para>
13370     minimum interval between prints
13371    </para>
13372   </listitem>
13373  </varlistentry>
13374 </variablelist>
13375</refsect1>
13376<refsect1>
13377<title>Description</title>
13378<para>
13379   <function><link linkend="API-printk-timed-ratelimit">printk_timed_ratelimit</link></function> returns true if more than <parameter>interval_msecs</parameter>
13380   milliseconds have elapsed since the last time <function><link linkend="API-printk-timed-ratelimit">printk_timed_ratelimit</link></function>
13381   returned true.
13382</para>
13383</refsect1>
13384</refentry>
13385
13386<refentry id="API-kmsg-dump-register">
13387<refentryinfo>
13388 <title>LINUX</title>
13389 <productname>Kernel Hackers Manual</productname>
13390 <date>July 2017</date>
13391</refentryinfo>
13392<refmeta>
13393 <refentrytitle><phrase>kmsg_dump_register</phrase></refentrytitle>
13394 <manvolnum>9</manvolnum>
13395 <refmiscinfo class="version">4.4.14</refmiscinfo>
13396</refmeta>
13397<refnamediv>
13398 <refname>kmsg_dump_register</refname>
13399 <refpurpose>
13400     register a kernel log dumper.
13401 </refpurpose>
13402</refnamediv>
13403<refsynopsisdiv>
13404 <title>Synopsis</title>
13405  <funcsynopsis><funcprototype>
13406   <funcdef>int <function>kmsg_dump_register </function></funcdef>
13407   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
13408  </funcprototype></funcsynopsis>
13409</refsynopsisdiv>
13410<refsect1>
13411 <title>Arguments</title>
13412 <variablelist>
13413  <varlistentry>
13414   <term><parameter>dumper</parameter></term>
13415   <listitem>
13416    <para>
13417     pointer to the kmsg_dumper structure
13418    </para>
13419   </listitem>
13420  </varlistentry>
13421 </variablelist>
13422</refsect1>
13423<refsect1>
13424<title>Description</title>
13425<para>
13426   Adds a kernel log dumper to the system. The dump callback in the
13427   structure will be called when the kernel oopses or panics and must be
13428   set. Returns zero on success and <constant>-EINVAL</constant> or <constant>-EBUSY</constant> otherwise.
13429</para>
13430</refsect1>
13431</refentry>
13432
13433<refentry id="API-kmsg-dump-unregister">
13434<refentryinfo>
13435 <title>LINUX</title>
13436 <productname>Kernel Hackers Manual</productname>
13437 <date>July 2017</date>
13438</refentryinfo>
13439<refmeta>
13440 <refentrytitle><phrase>kmsg_dump_unregister</phrase></refentrytitle>
13441 <manvolnum>9</manvolnum>
13442 <refmiscinfo class="version">4.4.14</refmiscinfo>
13443</refmeta>
13444<refnamediv>
13445 <refname>kmsg_dump_unregister</refname>
13446 <refpurpose>
13447     unregister a kmsg dumper.
13448 </refpurpose>
13449</refnamediv>
13450<refsynopsisdiv>
13451 <title>Synopsis</title>
13452  <funcsynopsis><funcprototype>
13453   <funcdef>int <function>kmsg_dump_unregister </function></funcdef>
13454   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
13455  </funcprototype></funcsynopsis>
13456</refsynopsisdiv>
13457<refsect1>
13458 <title>Arguments</title>
13459 <variablelist>
13460  <varlistentry>
13461   <term><parameter>dumper</parameter></term>
13462   <listitem>
13463    <para>
13464     pointer to the kmsg_dumper structure
13465    </para>
13466   </listitem>
13467  </varlistentry>
13468 </variablelist>
13469</refsect1>
13470<refsect1>
13471<title>Description</title>
13472<para>
13473   Removes a dump device from the system. Returns zero on success and
13474   <constant>-EINVAL</constant> otherwise.
13475</para>
13476</refsect1>
13477</refentry>
13478
13479<refentry id="API-kmsg-dump-get-line">
13480<refentryinfo>
13481 <title>LINUX</title>
13482 <productname>Kernel Hackers Manual</productname>
13483 <date>July 2017</date>
13484</refentryinfo>
13485<refmeta>
13486 <refentrytitle><phrase>kmsg_dump_get_line</phrase></refentrytitle>
13487 <manvolnum>9</manvolnum>
13488 <refmiscinfo class="version">4.4.14</refmiscinfo>
13489</refmeta>
13490<refnamediv>
13491 <refname>kmsg_dump_get_line</refname>
13492 <refpurpose>
13493     retrieve one kmsg log line
13494 </refpurpose>
13495</refnamediv>
13496<refsynopsisdiv>
13497 <title>Synopsis</title>
13498  <funcsynopsis><funcprototype>
13499   <funcdef>bool <function>kmsg_dump_get_line </function></funcdef>
13500   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
13501   <paramdef>bool <parameter>syslog</parameter></paramdef>
13502   <paramdef>char * <parameter>line</parameter></paramdef>
13503   <paramdef>size_t <parameter>size</parameter></paramdef>
13504   <paramdef>size_t * <parameter>len</parameter></paramdef>
13505  </funcprototype></funcsynopsis>
13506</refsynopsisdiv>
13507<refsect1>
13508 <title>Arguments</title>
13509 <variablelist>
13510  <varlistentry>
13511   <term><parameter>dumper</parameter></term>
13512   <listitem>
13513    <para>
13514     registered kmsg dumper
13515    </para>
13516   </listitem>
13517  </varlistentry>
13518  <varlistentry>
13519   <term><parameter>syslog</parameter></term>
13520   <listitem>
13521    <para>
13522     include the <quote>&lt;4&gt;</quote> prefixes
13523    </para>
13524   </listitem>
13525  </varlistentry>
13526  <varlistentry>
13527   <term><parameter>line</parameter></term>
13528   <listitem>
13529    <para>
13530     buffer to copy the line to
13531    </para>
13532   </listitem>
13533  </varlistentry>
13534  <varlistentry>
13535   <term><parameter>size</parameter></term>
13536   <listitem>
13537    <para>
13538     maximum size of the buffer
13539    </para>
13540   </listitem>
13541  </varlistentry>
13542  <varlistentry>
13543   <term><parameter>len</parameter></term>
13544   <listitem>
13545    <para>
13546     length of line placed into buffer
13547    </para>
13548   </listitem>
13549  </varlistentry>
13550 </variablelist>
13551</refsect1>
13552<refsect1>
13553<title>Description</title>
13554<para>
13555   Start at the beginning of the kmsg buffer, with the oldest kmsg
13556   record, and copy one record into the provided buffer.
13557   </para><para>
13558
13559   Consecutive calls will return the next available record moving
13560   towards the end of the buffer with the youngest messages.
13561   </para><para>
13562
13563   A return value of FALSE indicates that there are no more records to
13564   read.
13565</para>
13566</refsect1>
13567</refentry>
13568
13569<refentry id="API-kmsg-dump-get-buffer">
13570<refentryinfo>
13571 <title>LINUX</title>
13572 <productname>Kernel Hackers Manual</productname>
13573 <date>July 2017</date>
13574</refentryinfo>
13575<refmeta>
13576 <refentrytitle><phrase>kmsg_dump_get_buffer</phrase></refentrytitle>
13577 <manvolnum>9</manvolnum>
13578 <refmiscinfo class="version">4.4.14</refmiscinfo>
13579</refmeta>
13580<refnamediv>
13581 <refname>kmsg_dump_get_buffer</refname>
13582 <refpurpose>
13583     copy kmsg log lines
13584 </refpurpose>
13585</refnamediv>
13586<refsynopsisdiv>
13587 <title>Synopsis</title>
13588  <funcsynopsis><funcprototype>
13589   <funcdef>bool <function>kmsg_dump_get_buffer </function></funcdef>
13590   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
13591   <paramdef>bool <parameter>syslog</parameter></paramdef>
13592   <paramdef>char * <parameter>buf</parameter></paramdef>
13593   <paramdef>size_t <parameter>size</parameter></paramdef>
13594   <paramdef>size_t * <parameter>len</parameter></paramdef>
13595  </funcprototype></funcsynopsis>
13596</refsynopsisdiv>
13597<refsect1>
13598 <title>Arguments</title>
13599 <variablelist>
13600  <varlistentry>
13601   <term><parameter>dumper</parameter></term>
13602   <listitem>
13603    <para>
13604     registered kmsg dumper
13605    </para>
13606   </listitem>
13607  </varlistentry>
13608  <varlistentry>
13609   <term><parameter>syslog</parameter></term>
13610   <listitem>
13611    <para>
13612     include the <quote>&lt;4&gt;</quote> prefixes
13613    </para>
13614   </listitem>
13615  </varlistentry>
13616  <varlistentry>
13617   <term><parameter>buf</parameter></term>
13618   <listitem>
13619    <para>
13620     buffer to copy the line to
13621    </para>
13622   </listitem>
13623  </varlistentry>
13624  <varlistentry>
13625   <term><parameter>size</parameter></term>
13626   <listitem>
13627    <para>
13628     maximum size of the buffer
13629    </para>
13630   </listitem>
13631  </varlistentry>
13632  <varlistentry>
13633   <term><parameter>len</parameter></term>
13634   <listitem>
13635    <para>
13636     length of line placed into buffer
13637    </para>
13638   </listitem>
13639  </varlistentry>
13640 </variablelist>
13641</refsect1>
13642<refsect1>
13643<title>Description</title>
13644<para>
13645   Start at the end of the kmsg buffer and fill the provided buffer
13646   with as many of the the *youngest* kmsg records that fit into it.
13647   If the buffer is large enough, all available kmsg records will be
13648   copied with a single call.
13649   </para><para>
13650
13651   Consecutive calls will fill the buffer with the next block of
13652   available older records, not including the earlier retrieved ones.
13653   </para><para>
13654
13655   A return value of FALSE indicates that there are no more records to
13656   read.
13657</para>
13658</refsect1>
13659</refentry>
13660
13661<refentry id="API-kmsg-dump-rewind">
13662<refentryinfo>
13663 <title>LINUX</title>
13664 <productname>Kernel Hackers Manual</productname>
13665 <date>July 2017</date>
13666</refentryinfo>
13667<refmeta>
13668 <refentrytitle><phrase>kmsg_dump_rewind</phrase></refentrytitle>
13669 <manvolnum>9</manvolnum>
13670 <refmiscinfo class="version">4.4.14</refmiscinfo>
13671</refmeta>
13672<refnamediv>
13673 <refname>kmsg_dump_rewind</refname>
13674 <refpurpose>
13675     reset the interator
13676 </refpurpose>
13677</refnamediv>
13678<refsynopsisdiv>
13679 <title>Synopsis</title>
13680  <funcsynopsis><funcprototype>
13681   <funcdef>void <function>kmsg_dump_rewind </function></funcdef>
13682   <paramdef>struct kmsg_dumper * <parameter>dumper</parameter></paramdef>
13683  </funcprototype></funcsynopsis>
13684</refsynopsisdiv>
13685<refsect1>
13686 <title>Arguments</title>
13687 <variablelist>
13688  <varlistentry>
13689   <term><parameter>dumper</parameter></term>
13690   <listitem>
13691    <para>
13692     registered kmsg dumper
13693    </para>
13694   </listitem>
13695  </varlistentry>
13696 </variablelist>
13697</refsect1>
13698<refsect1>
13699<title>Description</title>
13700<para>
13701   Reset the dumper's iterator so that <function><link linkend="API-kmsg-dump-get-line">kmsg_dump_get_line</link></function> and
13702   <function><link linkend="API-kmsg-dump-get-buffer">kmsg_dump_get_buffer</link></function> can be called again and used multiple
13703   times within the same dumper.<function>dump</function> callback.
13704</para>
13705</refsect1>
13706</refentry>
13707
13708<!-- kernel/panic.c -->
13709<refentry id="API-panic">
13710<refentryinfo>
13711 <title>LINUX</title>
13712 <productname>Kernel Hackers Manual</productname>
13713 <date>July 2017</date>
13714</refentryinfo>
13715<refmeta>
13716 <refentrytitle><phrase>panic</phrase></refentrytitle>
13717 <manvolnum>9</manvolnum>
13718 <refmiscinfo class="version">4.4.14</refmiscinfo>
13719</refmeta>
13720<refnamediv>
13721 <refname>panic</refname>
13722 <refpurpose>
13723  halt the system
13724 </refpurpose>
13725</refnamediv>
13726<refsynopsisdiv>
13727 <title>Synopsis</title>
13728  <funcsynopsis><funcprototype>
13729   <funcdef>void <function>panic </function></funcdef>
13730   <paramdef>const char * <parameter>fmt</parameter></paramdef>
13731   <paramdef> <parameter>...</parameter></paramdef>
13732  </funcprototype></funcsynopsis>
13733</refsynopsisdiv>
13734<refsect1>
13735 <title>Arguments</title>
13736 <variablelist>
13737  <varlistentry>
13738   <term><parameter>fmt</parameter></term>
13739   <listitem>
13740    <para>
13741     The text string to print
13742    </para>
13743   </listitem>
13744  </varlistentry>
13745  <varlistentry>
13746   <term><parameter>...</parameter></term>
13747   <listitem>
13748    <para>
13749     variable arguments
13750    </para>
13751   </listitem>
13752  </varlistentry>
13753 </variablelist>
13754</refsect1>
13755<refsect1>
13756<title>Description</title>
13757<para>
13758   Display a message, then perform cleanups.
13759   </para><para>
13760
13761   This function never returns.
13762</para>
13763</refsect1>
13764</refentry>
13765
13766<refentry id="API-add-taint">
13767<refentryinfo>
13768 <title>LINUX</title>
13769 <productname>Kernel Hackers Manual</productname>
13770 <date>July 2017</date>
13771</refentryinfo>
13772<refmeta>
13773 <refentrytitle><phrase>add_taint</phrase></refentrytitle>
13774 <manvolnum>9</manvolnum>
13775 <refmiscinfo class="version">4.4.14</refmiscinfo>
13776</refmeta>
13777<refnamediv>
13778 <refname>add_taint</refname>
13779 <refpurpose>
13780   </refpurpose>
13781</refnamediv>
13782<refsynopsisdiv>
13783 <title>Synopsis</title>
13784  <funcsynopsis><funcprototype>
13785   <funcdef>void <function>add_taint </function></funcdef>
13786   <paramdef>unsigned <parameter>flag</parameter></paramdef>
13787   <paramdef>enum lockdep_ok <parameter>lockdep_ok</parameter></paramdef>
13788  </funcprototype></funcsynopsis>
13789</refsynopsisdiv>
13790<refsect1>
13791 <title>Arguments</title>
13792 <variablelist>
13793  <varlistentry>
13794   <term><parameter>flag</parameter></term>
13795   <listitem>
13796    <para>
13797     one of the TAINT_* constants.
13798    </para>
13799   </listitem>
13800  </varlistentry>
13801  <varlistentry>
13802   <term><parameter>lockdep_ok</parameter></term>
13803   <listitem>
13804    <para>
13805     whether lock debugging is still OK.
13806    </para>
13807   </listitem>
13808  </varlistentry>
13809 </variablelist>
13810</refsect1>
13811<refsect1>
13812<title>Description</title>
13813<para>
13814   If something bad has gone wrong, you'll want <parameter>lockdebug_ok</parameter> = false, but for
13815   some notewortht-but-not-corrupting cases, it can be set to true.
13816</para>
13817</refsect1>
13818</refentry>
13819
13820<!-- kernel/sys.c -->
13821<refentry>
13822 <refnamediv>
13823  <refname>
13824   kernel/sys.c
13825  </refname>
13826  <refpurpose>
13827   Document generation inconsistency
13828  </refpurpose>
13829 </refnamediv>
13830 <refsect1>
13831  <title>
13832   Oops
13833  </title>
13834  <warning>
13835   <para>
13836    The template for this document tried to insert
13837    the structured comment from the file
13838    <filename>kernel/sys.c</filename> at this point,
13839    but none was found.
13840    This dummy section is inserted to allow
13841    generation to continue.
13842   </para>
13843  </warning>
13844 </refsect1>
13845</refentry>
13846<!-- kernel/rcu/srcu.c -->
13847<refentry id="API-init-srcu-struct">
13848<refentryinfo>
13849 <title>LINUX</title>
13850 <productname>Kernel Hackers Manual</productname>
13851 <date>July 2017</date>
13852</refentryinfo>
13853<refmeta>
13854 <refentrytitle><phrase>init_srcu_struct</phrase></refentrytitle>
13855 <manvolnum>9</manvolnum>
13856 <refmiscinfo class="version">4.4.14</refmiscinfo>
13857</refmeta>
13858<refnamediv>
13859 <refname>init_srcu_struct</refname>
13860 <refpurpose>
13861  initialize a sleep-RCU structure
13862 </refpurpose>
13863</refnamediv>
13864<refsynopsisdiv>
13865 <title>Synopsis</title>
13866  <funcsynopsis><funcprototype>
13867   <funcdef>int <function>init_srcu_struct </function></funcdef>
13868   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
13869  </funcprototype></funcsynopsis>
13870</refsynopsisdiv>
13871<refsect1>
13872 <title>Arguments</title>
13873 <variablelist>
13874  <varlistentry>
13875   <term><parameter>sp</parameter></term>
13876   <listitem>
13877    <para>
13878     structure to initialize.
13879    </para>
13880   </listitem>
13881  </varlistentry>
13882 </variablelist>
13883</refsect1>
13884<refsect1>
13885<title>Description</title>
13886<para>
13887   Must invoke this on a given srcu_struct before passing that srcu_struct
13888   to any other function.  Each srcu_struct represents a separate domain
13889   of SRCU protection.
13890</para>
13891</refsect1>
13892</refentry>
13893
13894<refentry id="API-cleanup-srcu-struct">
13895<refentryinfo>
13896 <title>LINUX</title>
13897 <productname>Kernel Hackers Manual</productname>
13898 <date>July 2017</date>
13899</refentryinfo>
13900<refmeta>
13901 <refentrytitle><phrase>cleanup_srcu_struct</phrase></refentrytitle>
13902 <manvolnum>9</manvolnum>
13903 <refmiscinfo class="version">4.4.14</refmiscinfo>
13904</refmeta>
13905<refnamediv>
13906 <refname>cleanup_srcu_struct</refname>
13907 <refpurpose>
13908     deconstruct a sleep-RCU structure
13909 </refpurpose>
13910</refnamediv>
13911<refsynopsisdiv>
13912 <title>Synopsis</title>
13913  <funcsynopsis><funcprototype>
13914   <funcdef>void <function>cleanup_srcu_struct </function></funcdef>
13915   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
13916  </funcprototype></funcsynopsis>
13917</refsynopsisdiv>
13918<refsect1>
13919 <title>Arguments</title>
13920 <variablelist>
13921  <varlistentry>
13922   <term><parameter>sp</parameter></term>
13923   <listitem>
13924    <para>
13925     structure to clean up.
13926    </para>
13927   </listitem>
13928  </varlistentry>
13929 </variablelist>
13930</refsect1>
13931<refsect1>
13932<title>Description</title>
13933<para>
13934   Must invoke this after you are finished using a given srcu_struct that
13935   was initialized via <function><link linkend="API-init-srcu-struct">init_srcu_struct</link></function>, else you leak memory.
13936</para>
13937</refsect1>
13938</refentry>
13939
13940<refentry id="API-synchronize-srcu">
13941<refentryinfo>
13942 <title>LINUX</title>
13943 <productname>Kernel Hackers Manual</productname>
13944 <date>July 2017</date>
13945</refentryinfo>
13946<refmeta>
13947 <refentrytitle><phrase>synchronize_srcu</phrase></refentrytitle>
13948 <manvolnum>9</manvolnum>
13949 <refmiscinfo class="version">4.4.14</refmiscinfo>
13950</refmeta>
13951<refnamediv>
13952 <refname>synchronize_srcu</refname>
13953 <refpurpose>
13954     wait for prior SRCU read-side critical-section completion
13955 </refpurpose>
13956</refnamediv>
13957<refsynopsisdiv>
13958 <title>Synopsis</title>
13959  <funcsynopsis><funcprototype>
13960   <funcdef>void <function>synchronize_srcu </function></funcdef>
13961   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
13962  </funcprototype></funcsynopsis>
13963</refsynopsisdiv>
13964<refsect1>
13965 <title>Arguments</title>
13966 <variablelist>
13967  <varlistentry>
13968   <term><parameter>sp</parameter></term>
13969   <listitem>
13970    <para>
13971     srcu_struct with which to synchronize.
13972    </para>
13973   </listitem>
13974  </varlistentry>
13975 </variablelist>
13976</refsect1>
13977<refsect1>
13978<title>Description</title>
13979<para>
13980   Wait for the count to drain to zero of both indexes. To avoid the
13981   possible starvation of <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function>, it waits for the count of
13982   the index=((-&gt;completed &amp; 1) ^ 1) to drain to zero at first,
13983   and then flip the completed and wait for the count of the other index.
13984   </para><para>
13985
13986   Can block; must be called from process context.
13987   </para><para>
13988
13989   Note that it is illegal to call <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function> from the corresponding
13990   SRCU read-side critical section; doing so will result in deadlock.
13991   However, it is perfectly legal to call <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function> on one
13992   srcu_struct from some other srcu_struct's read-side critical section,
13993   as long as the resulting graph of srcu_structs is acyclic.
13994   </para><para>
13995
13996   There are memory-ordering constraints implied by <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function>.
13997   On systems with more than one CPU, when <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function> returns,
13998   each CPU is guaranteed to have executed a full memory barrier since
13999   the end of its last corresponding SRCU-sched read-side critical section
14000   whose beginning preceded the call to <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function>.  In addition,
14001   each CPU having an SRCU read-side critical section that extends beyond
14002   the return from <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function> is guaranteed to have executed a
14003   full memory barrier after the beginning of <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function> and before
14004   the beginning of that SRCU read-side critical section.  Note that these
14005   guarantees include CPUs that are offline, idle, or executing in user mode,
14006   as well as CPUs that are executing in the kernel.
14007   </para><para>
14008
14009   Furthermore, if CPU A invoked <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function>, which returned
14010   to its caller on CPU B, then both CPU A and CPU B are guaranteed
14011   to have executed a full memory barrier during the execution of
14012   <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function>.  This guarantee applies even if CPU A and CPU B
14013   are the same CPU, but again only if the system has more than one CPU.
14014   </para><para>
14015
14016   Of course, these memory-ordering guarantees apply only when
14017   <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function>, <function>srcu_read_lock</function>, and <function>srcu_read_unlock</function> are
14018   passed the same srcu_struct structure.
14019</para>
14020</refsect1>
14021</refentry>
14022
14023<refentry id="API-synchronize-srcu-expedited">
14024<refentryinfo>
14025 <title>LINUX</title>
14026 <productname>Kernel Hackers Manual</productname>
14027 <date>July 2017</date>
14028</refentryinfo>
14029<refmeta>
14030 <refentrytitle><phrase>synchronize_srcu_expedited</phrase></refentrytitle>
14031 <manvolnum>9</manvolnum>
14032 <refmiscinfo class="version">4.4.14</refmiscinfo>
14033</refmeta>
14034<refnamediv>
14035 <refname>synchronize_srcu_expedited</refname>
14036 <refpurpose>
14037     Brute-force SRCU grace period
14038 </refpurpose>
14039</refnamediv>
14040<refsynopsisdiv>
14041 <title>Synopsis</title>
14042  <funcsynopsis><funcprototype>
14043   <funcdef>void <function>synchronize_srcu_expedited </function></funcdef>
14044   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
14045  </funcprototype></funcsynopsis>
14046</refsynopsisdiv>
14047<refsect1>
14048 <title>Arguments</title>
14049 <variablelist>
14050  <varlistentry>
14051   <term><parameter>sp</parameter></term>
14052   <listitem>
14053    <para>
14054     srcu_struct with which to synchronize.
14055    </para>
14056   </listitem>
14057  </varlistentry>
14058 </variablelist>
14059</refsect1>
14060<refsect1>
14061<title>Description</title>
14062<para>
14063   Wait for an SRCU grace period to elapse, but be more aggressive about
14064   spinning rather than blocking when waiting.
14065   </para><para>
14066
14067   Note that <function><link linkend="API-synchronize-srcu-expedited">synchronize_srcu_expedited</link></function> has the same deadlock and
14068   memory-ordering properties as does <function><link linkend="API-synchronize-srcu">synchronize_srcu</link></function>.
14069</para>
14070</refsect1>
14071</refentry>
14072
14073<refentry id="API-srcu-barrier">
14074<refentryinfo>
14075 <title>LINUX</title>
14076 <productname>Kernel Hackers Manual</productname>
14077 <date>July 2017</date>
14078</refentryinfo>
14079<refmeta>
14080 <refentrytitle><phrase>srcu_barrier</phrase></refentrytitle>
14081 <manvolnum>9</manvolnum>
14082 <refmiscinfo class="version">4.4.14</refmiscinfo>
14083</refmeta>
14084<refnamediv>
14085 <refname>srcu_barrier</refname>
14086 <refpurpose>
14087     Wait until all in-flight <function>call_srcu</function> callbacks complete.
14088 </refpurpose>
14089</refnamediv>
14090<refsynopsisdiv>
14091 <title>Synopsis</title>
14092  <funcsynopsis><funcprototype>
14093   <funcdef>void <function>srcu_barrier </function></funcdef>
14094   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
14095  </funcprototype></funcsynopsis>
14096</refsynopsisdiv>
14097<refsect1>
14098 <title>Arguments</title>
14099 <variablelist>
14100  <varlistentry>
14101   <term><parameter>sp</parameter></term>
14102   <listitem>
14103    <para>
14104     srcu_struct on which to wait for in-flight callbacks.
14105    </para>
14106   </listitem>
14107  </varlistentry>
14108 </variablelist>
14109</refsect1>
14110</refentry>
14111
14112<refentry id="API-srcu-batches-completed">
14113<refentryinfo>
14114 <title>LINUX</title>
14115 <productname>Kernel Hackers Manual</productname>
14116 <date>July 2017</date>
14117</refentryinfo>
14118<refmeta>
14119 <refentrytitle><phrase>srcu_batches_completed</phrase></refentrytitle>
14120 <manvolnum>9</manvolnum>
14121 <refmiscinfo class="version">4.4.14</refmiscinfo>
14122</refmeta>
14123<refnamediv>
14124 <refname>srcu_batches_completed</refname>
14125 <refpurpose>
14126     return batches completed.
14127 </refpurpose>
14128</refnamediv>
14129<refsynopsisdiv>
14130 <title>Synopsis</title>
14131  <funcsynopsis><funcprototype>
14132   <funcdef>unsigned long <function>srcu_batches_completed </function></funcdef>
14133   <paramdef>struct srcu_struct * <parameter>sp</parameter></paramdef>
14134  </funcprototype></funcsynopsis>
14135</refsynopsisdiv>
14136<refsect1>
14137 <title>Arguments</title>
14138 <variablelist>
14139  <varlistentry>
14140   <term><parameter>sp</parameter></term>
14141   <listitem>
14142    <para>
14143     srcu_struct on which to report batch completion.
14144    </para>
14145   </listitem>
14146  </varlistentry>
14147 </variablelist>
14148</refsect1>
14149<refsect1>
14150<title>Description</title>
14151<para>
14152   Report the number of batches, correlated with, but not necessarily
14153   precisely the same as, the number of grace periods that have elapsed.
14154</para>
14155</refsect1>
14156</refentry>
14157
14158<!-- kernel/rcu/tree.c -->
14159<refentry id="API-rcu-idle-enter">
14160<refentryinfo>
14161 <title>LINUX</title>
14162 <productname>Kernel Hackers Manual</productname>
14163 <date>July 2017</date>
14164</refentryinfo>
14165<refmeta>
14166 <refentrytitle><phrase>rcu_idle_enter</phrase></refentrytitle>
14167 <manvolnum>9</manvolnum>
14168 <refmiscinfo class="version">4.4.14</refmiscinfo>
14169</refmeta>
14170<refnamediv>
14171 <refname>rcu_idle_enter</refname>
14172 <refpurpose>
14173  inform RCU that current CPU is entering idle
14174 </refpurpose>
14175</refnamediv>
14176<refsynopsisdiv>
14177 <title>Synopsis</title>
14178  <funcsynopsis><funcprototype>
14179   <funcdef>void <function>rcu_idle_enter </function></funcdef>
14180   <paramdef> <parameter>void</parameter></paramdef>
14181  </funcprototype></funcsynopsis>
14182</refsynopsisdiv>
14183<refsect1>
14184 <title>Arguments</title>
14185 <variablelist>
14186  <varlistentry>
14187   <term><parameter>void</parameter></term>
14188   <listitem>
14189    <para>
14190     no arguments
14191    </para>
14192   </listitem>
14193  </varlistentry>
14194 </variablelist>
14195</refsect1>
14196<refsect1>
14197<title>Description</title>
14198<para>
14199   </para><para>
14200
14201   Enter idle mode, in other words, -leave- the mode in which RCU
14202   read-side critical sections can occur.  (Though RCU read-side
14203   critical sections can occur in irq handlers in idle, a possibility
14204   handled by <function>irq_enter</function> and <function>irq_exit</function>.)
14205   </para><para>
14206
14207   We crowbar the -&gt;dynticks_nesting field to zero to allow for
14208   the possibility of usermode upcalls having messed up our count
14209   of interrupt nesting level during the prior busy period.
14210</para>
14211</refsect1>
14212</refentry>
14213
14214<refentry id="API-rcu-idle-exit">
14215<refentryinfo>
14216 <title>LINUX</title>
14217 <productname>Kernel Hackers Manual</productname>
14218 <date>July 2017</date>
14219</refentryinfo>
14220<refmeta>
14221 <refentrytitle><phrase>rcu_idle_exit</phrase></refentrytitle>
14222 <manvolnum>9</manvolnum>
14223 <refmiscinfo class="version">4.4.14</refmiscinfo>
14224</refmeta>
14225<refnamediv>
14226 <refname>rcu_idle_exit</refname>
14227 <refpurpose>
14228     inform RCU that current CPU is leaving idle
14229 </refpurpose>
14230</refnamediv>
14231<refsynopsisdiv>
14232 <title>Synopsis</title>
14233  <funcsynopsis><funcprototype>
14234   <funcdef>void <function>rcu_idle_exit </function></funcdef>
14235   <paramdef> <parameter>void</parameter></paramdef>
14236  </funcprototype></funcsynopsis>
14237</refsynopsisdiv>
14238<refsect1>
14239 <title>Arguments</title>
14240 <variablelist>
14241  <varlistentry>
14242   <term><parameter>void</parameter></term>
14243   <listitem>
14244    <para>
14245     no arguments
14246    </para>
14247   </listitem>
14248  </varlistentry>
14249 </variablelist>
14250</refsect1>
14251<refsect1>
14252<title>Description</title>
14253<para>
14254   </para><para>
14255
14256   Exit idle mode, in other words, -enter- the mode in which RCU
14257   read-side critical sections can occur.
14258   </para><para>
14259
14260   We crowbar the -&gt;dynticks_nesting field to DYNTICK_TASK_NEST to
14261   allow for the possibility of usermode upcalls messing up our count
14262   of interrupt nesting level during the busy period that is just
14263   now starting.
14264</para>
14265</refsect1>
14266</refentry>
14267
14268<refentry id="API-rcu-is-watching">
14269<refentryinfo>
14270 <title>LINUX</title>
14271 <productname>Kernel Hackers Manual</productname>
14272 <date>July 2017</date>
14273</refentryinfo>
14274<refmeta>
14275 <refentrytitle><phrase>rcu_is_watching</phrase></refentrytitle>
14276 <manvolnum>9</manvolnum>
14277 <refmiscinfo class="version">4.4.14</refmiscinfo>
14278</refmeta>
14279<refnamediv>
14280 <refname>rcu_is_watching</refname>
14281 <refpurpose>
14282     see if RCU thinks that the current CPU is idle
14283 </refpurpose>
14284</refnamediv>
14285<refsynopsisdiv>
14286 <title>Synopsis</title>
14287  <funcsynopsis><funcprototype>
14288   <funcdef>bool notrace <function>rcu_is_watching </function></funcdef>
14289   <paramdef> <parameter>void</parameter></paramdef>
14290  </funcprototype></funcsynopsis>
14291</refsynopsisdiv>
14292<refsect1>
14293 <title>Arguments</title>
14294 <variablelist>
14295  <varlistentry>
14296   <term><parameter>void</parameter></term>
14297   <listitem>
14298    <para>
14299     no arguments
14300    </para>
14301   </listitem>
14302  </varlistentry>
14303 </variablelist>
14304</refsect1>
14305<refsect1>
14306<title>Description</title>
14307<para>
14308   </para><para>
14309
14310   If the current CPU is in its idle loop and is neither in an interrupt
14311   or NMI handler, return true.
14312</para>
14313</refsect1>
14314</refentry>
14315
14316<refentry id="API-synchronize-sched">
14317<refentryinfo>
14318 <title>LINUX</title>
14319 <productname>Kernel Hackers Manual</productname>
14320 <date>July 2017</date>
14321</refentryinfo>
14322<refmeta>
14323 <refentrytitle><phrase>synchronize_sched</phrase></refentrytitle>
14324 <manvolnum>9</manvolnum>
14325 <refmiscinfo class="version">4.4.14</refmiscinfo>
14326</refmeta>
14327<refnamediv>
14328 <refname>synchronize_sched</refname>
14329 <refpurpose>
14330     wait until an rcu-sched grace period has elapsed.
14331 </refpurpose>
14332</refnamediv>
14333<refsynopsisdiv>
14334 <title>Synopsis</title>
14335  <funcsynopsis><funcprototype>
14336   <funcdef>void <function>synchronize_sched </function></funcdef>
14337   <paramdef> <parameter>void</parameter></paramdef>
14338  </funcprototype></funcsynopsis>
14339</refsynopsisdiv>
14340<refsect1>
14341 <title>Arguments</title>
14342 <variablelist>
14343  <varlistentry>
14344   <term><parameter>void</parameter></term>
14345   <listitem>
14346    <para>
14347     no arguments
14348    </para>
14349   </listitem>
14350  </varlistentry>
14351 </variablelist>
14352</refsect1>
14353<refsect1>
14354<title>Description</title>
14355<para>
14356   </para><para>
14357
14358   Control will return to the caller some time after a full rcu-sched
14359   grace period has elapsed, in other words after all currently executing
14360   rcu-sched read-side critical sections have completed.   These read-side
14361   critical sections are delimited by <function>rcu_read_lock_sched</function> and
14362   <function>rcu_read_unlock_sched</function>, and may be nested.  Note that <function>preempt_disable</function>,
14363   <function>local_irq_disable</function>, and so on may be used in place of
14364   <function>rcu_read_lock_sched</function>.
14365   </para><para>
14366
14367   This means that all preempt_disable code sequences, including NMI and
14368   non-threaded hardware-interrupt handlers, in progress on entry will
14369   have completed before this primitive returns.  However, this does not
14370   guarantee that softirq handlers will have completed, since in some
14371   kernels, these handlers can run in process context, and can block.
14372   </para><para>
14373
14374   Note that this guarantee implies further memory-ordering guarantees.
14375   On systems with more than one CPU, when <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> returns,
14376   each CPU is guaranteed to have executed a full memory barrier since the
14377   end of its last RCU-sched read-side critical section whose beginning
14378   preceded the call to <function><link linkend="API-synchronize-sched">synchronize_sched</link></function>.  In addition, each CPU having
14379   an RCU read-side critical section that extends beyond the return from
14380   <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> is guaranteed to have executed a full memory barrier
14381   after the beginning of <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> and before the beginning of
14382   that RCU read-side critical section.  Note that these guarantees include
14383   CPUs that are offline, idle, or executing in user mode, as well as CPUs
14384   that are executing in the kernel.
14385   </para><para>
14386
14387   Furthermore, if CPU A invoked <function><link linkend="API-synchronize-sched">synchronize_sched</link></function>, which returned
14388   to its caller on CPU B, then both CPU A and CPU B are guaranteed
14389   to have executed a full memory barrier during the execution of
14390   <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> -- even if CPU A and CPU B are the same CPU (but
14391   again only if the system has more than one CPU).
14392   </para><para>
14393
14394   This primitive provides the guarantees made by the (now removed)
14395   <function>synchronize_kernel</function> API.  In contrast, <function><link linkend="API-synchronize-rcu">synchronize_rcu</link></function> only
14396   guarantees that <function>rcu_read_lock</function> sections will have completed.
14397   In <quote>classic RCU</quote>, these two guarantees happen to be one and
14398   the same, but can differ in realtime RCU implementations.
14399</para>
14400</refsect1>
14401</refentry>
14402
14403<refentry id="API-synchronize-rcu-bh">
14404<refentryinfo>
14405 <title>LINUX</title>
14406 <productname>Kernel Hackers Manual</productname>
14407 <date>July 2017</date>
14408</refentryinfo>
14409<refmeta>
14410 <refentrytitle><phrase>synchronize_rcu_bh</phrase></refentrytitle>
14411 <manvolnum>9</manvolnum>
14412 <refmiscinfo class="version">4.4.14</refmiscinfo>
14413</refmeta>
14414<refnamediv>
14415 <refname>synchronize_rcu_bh</refname>
14416 <refpurpose>
14417     wait until an rcu_bh grace period has elapsed.
14418 </refpurpose>
14419</refnamediv>
14420<refsynopsisdiv>
14421 <title>Synopsis</title>
14422  <funcsynopsis><funcprototype>
14423   <funcdef>void <function>synchronize_rcu_bh </function></funcdef>
14424   <paramdef> <parameter>void</parameter></paramdef>
14425  </funcprototype></funcsynopsis>
14426</refsynopsisdiv>
14427<refsect1>
14428 <title>Arguments</title>
14429 <variablelist>
14430  <varlistentry>
14431   <term><parameter>void</parameter></term>
14432   <listitem>
14433    <para>
14434     no arguments
14435    </para>
14436   </listitem>
14437  </varlistentry>
14438 </variablelist>
14439</refsect1>
14440<refsect1>
14441<title>Description</title>
14442<para>
14443   </para><para>
14444
14445   Control will return to the caller some time after a full rcu_bh grace
14446   period has elapsed, in other words after all currently executing rcu_bh
14447   read-side critical sections have completed.  RCU read-side critical
14448   sections are delimited by <function>rcu_read_lock_bh</function> and <function>rcu_read_unlock_bh</function>,
14449   and may be nested.
14450   </para><para>
14451
14452   See the description of <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> for more detailed information
14453   on memory ordering guarantees.
14454</para>
14455</refsect1>
14456</refentry>
14457
14458<refentry id="API-get-state-synchronize-rcu">
14459<refentryinfo>
14460 <title>LINUX</title>
14461 <productname>Kernel Hackers Manual</productname>
14462 <date>July 2017</date>
14463</refentryinfo>
14464<refmeta>
14465 <refentrytitle><phrase>get_state_synchronize_rcu</phrase></refentrytitle>
14466 <manvolnum>9</manvolnum>
14467 <refmiscinfo class="version">4.4.14</refmiscinfo>
14468</refmeta>
14469<refnamediv>
14470 <refname>get_state_synchronize_rcu</refname>
14471 <refpurpose>
14472     Snapshot current RCU state
14473 </refpurpose>
14474</refnamediv>
14475<refsynopsisdiv>
14476 <title>Synopsis</title>
14477  <funcsynopsis><funcprototype>
14478   <funcdef>unsigned long <function>get_state_synchronize_rcu </function></funcdef>
14479   <paramdef> <parameter>void</parameter></paramdef>
14480  </funcprototype></funcsynopsis>
14481</refsynopsisdiv>
14482<refsect1>
14483 <title>Arguments</title>
14484 <variablelist>
14485  <varlistentry>
14486   <term><parameter>void</parameter></term>
14487   <listitem>
14488    <para>
14489     no arguments
14490    </para>
14491   </listitem>
14492  </varlistentry>
14493 </variablelist>
14494</refsect1>
14495<refsect1>
14496<title>Description</title>
14497<para>
14498   </para><para>
14499
14500   Returns a cookie that is used by a later call to <function><link linkend="API-cond-synchronize-rcu">cond_synchronize_rcu</link></function>
14501   to determine whether or not a full grace period has elapsed in the
14502   meantime.
14503</para>
14504</refsect1>
14505</refentry>
14506
14507<refentry id="API-cond-synchronize-rcu">
14508<refentryinfo>
14509 <title>LINUX</title>
14510 <productname>Kernel Hackers Manual</productname>
14511 <date>July 2017</date>
14512</refentryinfo>
14513<refmeta>
14514 <refentrytitle><phrase>cond_synchronize_rcu</phrase></refentrytitle>
14515 <manvolnum>9</manvolnum>
14516 <refmiscinfo class="version">4.4.14</refmiscinfo>
14517</refmeta>
14518<refnamediv>
14519 <refname>cond_synchronize_rcu</refname>
14520 <refpurpose>
14521     Conditionally wait for an RCU grace period
14522 </refpurpose>
14523</refnamediv>
14524<refsynopsisdiv>
14525 <title>Synopsis</title>
14526  <funcsynopsis><funcprototype>
14527   <funcdef>void <function>cond_synchronize_rcu </function></funcdef>
14528   <paramdef>unsigned long <parameter>oldstate</parameter></paramdef>
14529  </funcprototype></funcsynopsis>
14530</refsynopsisdiv>
14531<refsect1>
14532 <title>Arguments</title>
14533 <variablelist>
14534  <varlistentry>
14535   <term><parameter>oldstate</parameter></term>
14536   <listitem>
14537    <para>
14538     return value from earlier call to <function><link linkend="API-get-state-synchronize-rcu">get_state_synchronize_rcu</link></function>
14539    </para>
14540   </listitem>
14541  </varlistentry>
14542 </variablelist>
14543</refsect1>
14544<refsect1>
14545<title>Description</title>
14546<para>
14547   If a full RCU grace period has elapsed since the earlier call to
14548   <function><link linkend="API-get-state-synchronize-rcu">get_state_synchronize_rcu</link></function>, just return.  Otherwise, invoke
14549   <function><link linkend="API-synchronize-rcu">synchronize_rcu</link></function> to wait for a full grace period.
14550   </para><para>
14551
14552   Yes, this function does not take counter wrap into account.  But
14553   counter wrap is harmless.  If the counter wraps, we have waited for
14554   more than 2 billion grace periods (and way more on a 64-bit system!),
14555   so waiting for one additional grace period should be just fine.
14556</para>
14557</refsect1>
14558</refentry>
14559
14560<refentry id="API-get-state-synchronize-sched">
14561<refentryinfo>
14562 <title>LINUX</title>
14563 <productname>Kernel Hackers Manual</productname>
14564 <date>July 2017</date>
14565</refentryinfo>
14566<refmeta>
14567 <refentrytitle><phrase>get_state_synchronize_sched</phrase></refentrytitle>
14568 <manvolnum>9</manvolnum>
14569 <refmiscinfo class="version">4.4.14</refmiscinfo>
14570</refmeta>
14571<refnamediv>
14572 <refname>get_state_synchronize_sched</refname>
14573 <refpurpose>
14574     Snapshot current RCU-sched state
14575 </refpurpose>
14576</refnamediv>
14577<refsynopsisdiv>
14578 <title>Synopsis</title>
14579  <funcsynopsis><funcprototype>
14580   <funcdef>unsigned long <function>get_state_synchronize_sched </function></funcdef>
14581   <paramdef> <parameter>void</parameter></paramdef>
14582  </funcprototype></funcsynopsis>
14583</refsynopsisdiv>
14584<refsect1>
14585 <title>Arguments</title>
14586 <variablelist>
14587  <varlistentry>
14588   <term><parameter>void</parameter></term>
14589   <listitem>
14590    <para>
14591     no arguments
14592    </para>
14593   </listitem>
14594  </varlistentry>
14595 </variablelist>
14596</refsect1>
14597<refsect1>
14598<title>Description</title>
14599<para>
14600   </para><para>
14601
14602   Returns a cookie that is used by a later call to <function><link linkend="API-cond-synchronize-sched">cond_synchronize_sched</link></function>
14603   to determine whether or not a full grace period has elapsed in the
14604   meantime.
14605</para>
14606</refsect1>
14607</refentry>
14608
14609<refentry id="API-cond-synchronize-sched">
14610<refentryinfo>
14611 <title>LINUX</title>
14612 <productname>Kernel Hackers Manual</productname>
14613 <date>July 2017</date>
14614</refentryinfo>
14615<refmeta>
14616 <refentrytitle><phrase>cond_synchronize_sched</phrase></refentrytitle>
14617 <manvolnum>9</manvolnum>
14618 <refmiscinfo class="version">4.4.14</refmiscinfo>
14619</refmeta>
14620<refnamediv>
14621 <refname>cond_synchronize_sched</refname>
14622 <refpurpose>
14623     Conditionally wait for an RCU-sched grace period
14624 </refpurpose>
14625</refnamediv>
14626<refsynopsisdiv>
14627 <title>Synopsis</title>
14628  <funcsynopsis><funcprototype>
14629   <funcdef>void <function>cond_synchronize_sched </function></funcdef>
14630   <paramdef>unsigned long <parameter>oldstate</parameter></paramdef>
14631  </funcprototype></funcsynopsis>
14632</refsynopsisdiv>
14633<refsect1>
14634 <title>Arguments</title>
14635 <variablelist>
14636  <varlistentry>
14637   <term><parameter>oldstate</parameter></term>
14638   <listitem>
14639    <para>
14640     return value from earlier call to <function><link linkend="API-get-state-synchronize-sched">get_state_synchronize_sched</link></function>
14641    </para>
14642   </listitem>
14643  </varlistentry>
14644 </variablelist>
14645</refsect1>
14646<refsect1>
14647<title>Description</title>
14648<para>
14649   If a full RCU-sched grace period has elapsed since the earlier call to
14650   <function><link linkend="API-get-state-synchronize-sched">get_state_synchronize_sched</link></function>, just return.  Otherwise, invoke
14651   <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> to wait for a full grace period.
14652   </para><para>
14653
14654   Yes, this function does not take counter wrap into account.  But
14655   counter wrap is harmless.  If the counter wraps, we have waited for
14656   more than 2 billion grace periods (and way more on a 64-bit system!),
14657   so waiting for one additional grace period should be just fine.
14658</para>
14659</refsect1>
14660</refentry>
14661
14662<refentry id="API-synchronize-sched-expedited">
14663<refentryinfo>
14664 <title>LINUX</title>
14665 <productname>Kernel Hackers Manual</productname>
14666 <date>July 2017</date>
14667</refentryinfo>
14668<refmeta>
14669 <refentrytitle><phrase>synchronize_sched_expedited</phrase></refentrytitle>
14670 <manvolnum>9</manvolnum>
14671 <refmiscinfo class="version">4.4.14</refmiscinfo>
14672</refmeta>
14673<refnamediv>
14674 <refname>synchronize_sched_expedited</refname>
14675 <refpurpose>
14676     Brute-force RCU-sched grace period
14677 </refpurpose>
14678</refnamediv>
14679<refsynopsisdiv>
14680 <title>Synopsis</title>
14681  <funcsynopsis><funcprototype>
14682   <funcdef>void <function>synchronize_sched_expedited </function></funcdef>
14683   <paramdef> <parameter>void</parameter></paramdef>
14684  </funcprototype></funcsynopsis>
14685</refsynopsisdiv>
14686<refsect1>
14687 <title>Arguments</title>
14688 <variablelist>
14689  <varlistentry>
14690   <term><parameter>void</parameter></term>
14691   <listitem>
14692    <para>
14693     no arguments
14694    </para>
14695   </listitem>
14696  </varlistentry>
14697 </variablelist>
14698</refsect1>
14699<refsect1>
14700<title>Description</title>
14701<para>
14702   </para><para>
14703
14704   Wait for an RCU-sched grace period to elapse, but use a <quote>big hammer</quote>
14705   approach to force the grace period to end quickly.  This consumes
14706   significant time on all CPUs and is unfriendly to real-time workloads,
14707   so is thus not recommended for any sort of common-case code.  In fact,
14708   if you are using <function><link linkend="API-synchronize-sched-expedited">synchronize_sched_expedited</link></function> in a loop, please
14709   restructure your code to batch your updates, and then use a single
14710   <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> instead.
14711   </para><para>
14712
14713   This implementation can be thought of as an application of sequence
14714   locking to expedited grace periods, but using the sequence counter to
14715   determine when someone else has already done the work instead of for
14716   retrying readers.
14717</para>
14718</refsect1>
14719</refentry>
14720
14721<refentry id="API-rcu-barrier-bh">
14722<refentryinfo>
14723 <title>LINUX</title>
14724 <productname>Kernel Hackers Manual</productname>
14725 <date>July 2017</date>
14726</refentryinfo>
14727<refmeta>
14728 <refentrytitle><phrase>rcu_barrier_bh</phrase></refentrytitle>
14729 <manvolnum>9</manvolnum>
14730 <refmiscinfo class="version">4.4.14</refmiscinfo>
14731</refmeta>
14732<refnamediv>
14733 <refname>rcu_barrier_bh</refname>
14734 <refpurpose>
14735     Wait until all in-flight <function>call_rcu_bh</function> callbacks complete.
14736 </refpurpose>
14737</refnamediv>
14738<refsynopsisdiv>
14739 <title>Synopsis</title>
14740  <funcsynopsis><funcprototype>
14741   <funcdef>void <function>rcu_barrier_bh </function></funcdef>
14742   <paramdef> <parameter>void</parameter></paramdef>
14743  </funcprototype></funcsynopsis>
14744</refsynopsisdiv>
14745<refsect1>
14746 <title>Arguments</title>
14747 <variablelist>
14748  <varlistentry>
14749   <term><parameter>void</parameter></term>
14750   <listitem>
14751    <para>
14752     no arguments
14753    </para>
14754   </listitem>
14755  </varlistentry>
14756 </variablelist>
14757</refsect1>
14758</refentry>
14759
14760<refentry id="API-rcu-barrier-sched">
14761<refentryinfo>
14762 <title>LINUX</title>
14763 <productname>Kernel Hackers Manual</productname>
14764 <date>July 2017</date>
14765</refentryinfo>
14766<refmeta>
14767 <refentrytitle><phrase>rcu_barrier_sched</phrase></refentrytitle>
14768 <manvolnum>9</manvolnum>
14769 <refmiscinfo class="version">4.4.14</refmiscinfo>
14770</refmeta>
14771<refnamediv>
14772 <refname>rcu_barrier_sched</refname>
14773 <refpurpose>
14774     Wait for in-flight <function>call_rcu_sched</function> callbacks.
14775 </refpurpose>
14776</refnamediv>
14777<refsynopsisdiv>
14778 <title>Synopsis</title>
14779  <funcsynopsis><funcprototype>
14780   <funcdef>void <function>rcu_barrier_sched </function></funcdef>
14781   <paramdef> <parameter>void</parameter></paramdef>
14782  </funcprototype></funcsynopsis>
14783</refsynopsisdiv>
14784<refsect1>
14785 <title>Arguments</title>
14786 <variablelist>
14787  <varlistentry>
14788   <term><parameter>void</parameter></term>
14789   <listitem>
14790    <para>
14791     no arguments
14792    </para>
14793   </listitem>
14794  </varlistentry>
14795 </variablelist>
14796</refsect1>
14797</refentry>
14798
14799<!-- kernel/rcu/tree_plugin.h -->
14800<refentry id="API-synchronize-rcu">
14801<refentryinfo>
14802 <title>LINUX</title>
14803 <productname>Kernel Hackers Manual</productname>
14804 <date>July 2017</date>
14805</refentryinfo>
14806<refmeta>
14807 <refentrytitle><phrase>synchronize_rcu</phrase></refentrytitle>
14808 <manvolnum>9</manvolnum>
14809 <refmiscinfo class="version">4.4.14</refmiscinfo>
14810</refmeta>
14811<refnamediv>
14812 <refname>synchronize_rcu</refname>
14813 <refpurpose>
14814  wait until a grace period has elapsed.
14815 </refpurpose>
14816</refnamediv>
14817<refsynopsisdiv>
14818 <title>Synopsis</title>
14819  <funcsynopsis><funcprototype>
14820   <funcdef>void <function>synchronize_rcu </function></funcdef>
14821   <paramdef> <parameter>void</parameter></paramdef>
14822  </funcprototype></funcsynopsis>
14823</refsynopsisdiv>
14824<refsect1>
14825 <title>Arguments</title>
14826 <variablelist>
14827  <varlistentry>
14828   <term><parameter>void</parameter></term>
14829   <listitem>
14830    <para>
14831     no arguments
14832    </para>
14833   </listitem>
14834  </varlistentry>
14835 </variablelist>
14836</refsect1>
14837<refsect1>
14838<title>Description</title>
14839<para>
14840   </para><para>
14841
14842   Control will return to the caller some time after a full grace
14843   period has elapsed, in other words after all currently executing RCU
14844   read-side critical sections have completed.  Note, however, that
14845   upon return from <function><link linkend="API-synchronize-rcu">synchronize_rcu</link></function>, the caller might well be executing
14846   concurrently with new RCU read-side critical sections that began while
14847   <function><link linkend="API-synchronize-rcu">synchronize_rcu</link></function> was waiting.  RCU read-side critical sections are
14848   delimited by <function>rcu_read_lock</function> and <function>rcu_read_unlock</function>, and may be nested.
14849   </para><para>
14850
14851   See the description of <function><link linkend="API-synchronize-sched">synchronize_sched</link></function> for more detailed information
14852   on memory ordering guarantees.
14853</para>
14854</refsect1>
14855</refentry>
14856
14857<refentry id="API-synchronize-rcu-expedited">
14858<refentryinfo>
14859 <title>LINUX</title>
14860 <productname>Kernel Hackers Manual</productname>
14861 <date>July 2017</date>
14862</refentryinfo>
14863<refmeta>
14864 <refentrytitle><phrase>synchronize_rcu_expedited</phrase></refentrytitle>
14865 <manvolnum>9</manvolnum>
14866 <refmiscinfo class="version">4.4.14</refmiscinfo>
14867</refmeta>
14868<refnamediv>
14869 <refname>synchronize_rcu_expedited</refname>
14870 <refpurpose>
14871     Brute-force RCU grace period
14872 </refpurpose>
14873</refnamediv>
14874<refsynopsisdiv>
14875 <title>Synopsis</title>
14876  <funcsynopsis><funcprototype>
14877   <funcdef>void <function>synchronize_rcu_expedited </function></funcdef>
14878   <paramdef> <parameter>void</parameter></paramdef>
14879  </funcprototype></funcsynopsis>
14880</refsynopsisdiv>
14881<refsect1>
14882 <title>Arguments</title>
14883 <variablelist>
14884  <varlistentry>
14885   <term><parameter>void</parameter></term>
14886   <listitem>
14887    <para>
14888     no arguments
14889    </para>
14890   </listitem>
14891  </varlistentry>
14892 </variablelist>
14893</refsect1>
14894<refsect1>
14895<title>Description</title>
14896<para>
14897   </para><para>
14898
14899   Wait for an RCU-preempt grace period, but expedite it.  The basic
14900   idea is to invoke <function><link linkend="API-synchronize-sched-expedited">synchronize_sched_expedited</link></function> to push all the tasks to
14901   the -&gt;blkd_tasks lists and wait for this list to drain.  This consumes
14902   significant time on all CPUs and is unfriendly to real-time workloads,
14903   so is thus not recommended for any sort of common-case code.
14904   In fact, if you are using <function><link linkend="API-synchronize-rcu-expedited">synchronize_rcu_expedited</link></function> in a loop,
14905   please restructure your code to batch your updates, and then Use a
14906   single <function><link linkend="API-synchronize-rcu">synchronize_rcu</link></function> instead.
14907</para>
14908</refsect1>
14909</refentry>
14910
14911<refentry id="API-rcu-barrier">
14912<refentryinfo>
14913 <title>LINUX</title>
14914 <productname>Kernel Hackers Manual</productname>
14915 <date>July 2017</date>
14916</refentryinfo>
14917<refmeta>
14918 <refentrytitle><phrase>rcu_barrier</phrase></refentrytitle>
14919 <manvolnum>9</manvolnum>
14920 <refmiscinfo class="version">4.4.14</refmiscinfo>
14921</refmeta>
14922<refnamediv>
14923 <refname>rcu_barrier</refname>
14924 <refpurpose>
14925     Wait until all in-flight <function>call_rcu</function> callbacks complete.
14926 </refpurpose>
14927</refnamediv>
14928<refsynopsisdiv>
14929 <title>Synopsis</title>
14930  <funcsynopsis><funcprototype>
14931   <funcdef>void <function>rcu_barrier </function></funcdef>
14932   <paramdef> <parameter>void</parameter></paramdef>
14933  </funcprototype></funcsynopsis>
14934</refsynopsisdiv>
14935<refsect1>
14936 <title>Arguments</title>
14937 <variablelist>
14938  <varlistentry>
14939   <term><parameter>void</parameter></term>
14940   <listitem>
14941    <para>
14942     no arguments
14943    </para>
14944   </listitem>
14945  </varlistentry>
14946 </variablelist>
14947</refsect1>
14948<refsect1>
14949<title>Description</title>
14950<para>
14951   </para><para>
14952
14953   Note that this primitive does not necessarily wait for an RCU grace period
14954   to complete.  For example, if there are no RCU callbacks queued anywhere
14955   in the system, then <function><link linkend="API-rcu-barrier">rcu_barrier</link></function> is within its rights to return
14956   immediately, without waiting for anything, much less an RCU grace period.
14957</para>
14958</refsect1>
14959</refentry>
14960
14961<!-- kernel/rcu/update.c -->
14962<refentry id="API-rcu-read-lock-sched-held">
14963<refentryinfo>
14964 <title>LINUX</title>
14965 <productname>Kernel Hackers Manual</productname>
14966 <date>July 2017</date>
14967</refentryinfo>
14968<refmeta>
14969 <refentrytitle><phrase>rcu_read_lock_sched_held</phrase></refentrytitle>
14970 <manvolnum>9</manvolnum>
14971 <refmiscinfo class="version">4.4.14</refmiscinfo>
14972</refmeta>
14973<refnamediv>
14974 <refname>rcu_read_lock_sched_held</refname>
14975 <refpurpose>
14976  might we be in RCU-sched read-side critical section?
14977 </refpurpose>
14978</refnamediv>
14979<refsynopsisdiv>
14980 <title>Synopsis</title>
14981  <funcsynopsis><funcprototype>
14982   <funcdef>int <function>rcu_read_lock_sched_held </function></funcdef>
14983   <paramdef> <parameter>void</parameter></paramdef>
14984  </funcprototype></funcsynopsis>
14985</refsynopsisdiv>
14986<refsect1>
14987 <title>Arguments</title>
14988 <variablelist>
14989  <varlistentry>
14990   <term><parameter>void</parameter></term>
14991   <listitem>
14992    <para>
14993     no arguments
14994    </para>
14995   </listitem>
14996  </varlistentry>
14997 </variablelist>
14998</refsect1>
14999<refsect1>
15000<title>Description</title>
15001<para>
15002   </para><para>
15003
15004   If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an
15005   RCU-sched read-side critical section.  In absence of
15006   CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side
15007   critical section unless it can prove otherwise.  Note that disabling
15008   of preemption (including disabling irqs) counts as an RCU-sched
15009   read-side critical section.  This is useful for debug checks in functions
15010   that required that they be called within an RCU-sched read-side
15011   critical section.
15012   </para><para>
15013
15014   Check <function>debug_lockdep_rcu_enabled</function> to prevent false positives during boot
15015   and while lockdep is disabled.
15016   </para><para>
15017
15018   Note that if the CPU is in the idle loop from an RCU point of
15019   view (ie: that we are in the section between <function><link linkend="API-rcu-idle-enter">rcu_idle_enter</link></function> and
15020   <function><link linkend="API-rcu-idle-exit">rcu_idle_exit</link></function>) then <function><link linkend="API-rcu-read-lock-held">rcu_read_lock_held</link></function> returns false even if the CPU
15021   did an <function>rcu_read_lock</function>.  The reason for this is that RCU ignores CPUs
15022   that are in such a section, considering these as in extended quiescent
15023   state, so such a CPU is effectively never in an RCU read-side critical
15024   section regardless of what RCU primitives it invokes.  This state of
15025   affairs is required --- we need to keep an RCU-free window in idle
15026   where the CPU may possibly enter into low power mode. This way we can
15027   notice an extended quiescent state to other CPUs that started a grace
15028   period. Otherwise we would delay any grace period as long as we run in
15029   the idle task.
15030   </para><para>
15031
15032   Similarly, we avoid claiming an SRCU read lock held if the current
15033   CPU is offline.
15034</para>
15035</refsect1>
15036</refentry>
15037
15038<refentry id="API-rcu-expedite-gp">
15039<refentryinfo>
15040 <title>LINUX</title>
15041 <productname>Kernel Hackers Manual</productname>
15042 <date>July 2017</date>
15043</refentryinfo>
15044<refmeta>
15045 <refentrytitle><phrase>rcu_expedite_gp</phrase></refentrytitle>
15046 <manvolnum>9</manvolnum>
15047 <refmiscinfo class="version">4.4.14</refmiscinfo>
15048</refmeta>
15049<refnamediv>
15050 <refname>rcu_expedite_gp</refname>
15051 <refpurpose>
15052     Expedite future RCU grace periods
15053 </refpurpose>
15054</refnamediv>
15055<refsynopsisdiv>
15056 <title>Synopsis</title>
15057  <funcsynopsis><funcprototype>
15058   <funcdef>void <function>rcu_expedite_gp </function></funcdef>
15059   <paramdef> <parameter>void</parameter></paramdef>
15060  </funcprototype></funcsynopsis>
15061</refsynopsisdiv>
15062<refsect1>
15063 <title>Arguments</title>
15064 <variablelist>
15065  <varlistentry>
15066   <term><parameter>void</parameter></term>
15067   <listitem>
15068    <para>
15069     no arguments
15070    </para>
15071   </listitem>
15072  </varlistentry>
15073 </variablelist>
15074</refsect1>
15075<refsect1>
15076<title>Description</title>
15077<para>
15078   </para><para>
15079
15080   After a call to this function, future calls to <function><link linkend="API-synchronize-rcu">synchronize_rcu</link></function> and
15081   friends act as the corresponding <function><link linkend="API-synchronize-rcu-expedited">synchronize_rcu_expedited</link></function> function
15082   had instead been called.
15083</para>
15084</refsect1>
15085</refentry>
15086
15087<refentry id="API-rcu-unexpedite-gp">
15088<refentryinfo>
15089 <title>LINUX</title>
15090 <productname>Kernel Hackers Manual</productname>
15091 <date>July 2017</date>
15092</refentryinfo>
15093<refmeta>
15094 <refentrytitle><phrase>rcu_unexpedite_gp</phrase></refentrytitle>
15095 <manvolnum>9</manvolnum>
15096 <refmiscinfo class="version">4.4.14</refmiscinfo>
15097</refmeta>
15098<refnamediv>
15099 <refname>rcu_unexpedite_gp</refname>
15100 <refpurpose>
15101     Cancel prior <function><link linkend="API-rcu-expedite-gp">rcu_expedite_gp</link></function> invocation
15102 </refpurpose>
15103</refnamediv>
15104<refsynopsisdiv>
15105 <title>Synopsis</title>
15106  <funcsynopsis><funcprototype>
15107   <funcdef>void <function>rcu_unexpedite_gp </function></funcdef>
15108   <paramdef> <parameter>void</parameter></paramdef>
15109  </funcprototype></funcsynopsis>
15110</refsynopsisdiv>
15111<refsect1>
15112 <title>Arguments</title>
15113 <variablelist>
15114  <varlistentry>
15115   <term><parameter>void</parameter></term>
15116   <listitem>
15117    <para>
15118     no arguments
15119    </para>
15120   </listitem>
15121  </varlistentry>
15122 </variablelist>
15123</refsect1>
15124<refsect1>
15125<title>Description</title>
15126<para>
15127   </para><para>
15128
15129   Undo a prior call to <function><link linkend="API-rcu-expedite-gp">rcu_expedite_gp</link></function>.  If all prior calls to
15130   <function><link linkend="API-rcu-expedite-gp">rcu_expedite_gp</link></function> are undone by a subsequent call to <function><link linkend="API-rcu-unexpedite-gp">rcu_unexpedite_gp</link></function>,
15131   and if the rcu_expedited sysfs/boot parameter is not set, then all
15132   subsequent calls to <function><link linkend="API-synchronize-rcu">synchronize_rcu</link></function> and friends will return to
15133   their normal non-expedited behavior.
15134</para>
15135</refsect1>
15136</refentry>
15137
15138<refentry id="API-rcu-read-lock-held">
15139<refentryinfo>
15140 <title>LINUX</title>
15141 <productname>Kernel Hackers Manual</productname>
15142 <date>July 2017</date>
15143</refentryinfo>
15144<refmeta>
15145 <refentrytitle><phrase>rcu_read_lock_held</phrase></refentrytitle>
15146 <manvolnum>9</manvolnum>
15147 <refmiscinfo class="version">4.4.14</refmiscinfo>
15148</refmeta>
15149<refnamediv>
15150 <refname>rcu_read_lock_held</refname>
15151 <refpurpose>
15152     might we be in RCU read-side critical section?
15153 </refpurpose>
15154</refnamediv>
15155<refsynopsisdiv>
15156 <title>Synopsis</title>
15157  <funcsynopsis><funcprototype>
15158   <funcdef>int <function>rcu_read_lock_held </function></funcdef>
15159   <paramdef> <parameter>void</parameter></paramdef>
15160  </funcprototype></funcsynopsis>
15161</refsynopsisdiv>
15162<refsect1>
15163 <title>Arguments</title>
15164 <variablelist>
15165  <varlistentry>
15166   <term><parameter>void</parameter></term>
15167   <listitem>
15168    <para>
15169     no arguments
15170    </para>
15171   </listitem>
15172  </varlistentry>
15173 </variablelist>
15174</refsect1>
15175<refsect1>
15176<title>Description</title>
15177<para>
15178   </para><para>
15179
15180   If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
15181   read-side critical section.  In absence of CONFIG_DEBUG_LOCK_ALLOC,
15182   this assumes we are in an RCU read-side critical section unless it can
15183   prove otherwise.  This is useful for debug checks in functions that
15184   require that they be called within an RCU read-side critical section.
15185   </para><para>
15186
15187   Checks <function>debug_lockdep_rcu_enabled</function> to prevent false positives during boot
15188   and while lockdep is disabled.
15189   </para><para>
15190
15191   Note that <function>rcu_read_lock</function> and the matching <function>rcu_read_unlock</function> must
15192   occur in the same context, for example, it is illegal to invoke
15193   <function>rcu_read_unlock</function> in process context if the matching <function>rcu_read_lock</function>
15194   was invoked from within an irq handler.
15195   </para><para>
15196
15197   Note that <function>rcu_read_lock</function> is disallowed if the CPU is either idle or
15198   offline from an RCU perspective, so check for those as well.
15199</para>
15200</refsect1>
15201</refentry>
15202
15203<refentry id="API-rcu-read-lock-bh-held">
15204<refentryinfo>
15205 <title>LINUX</title>
15206 <productname>Kernel Hackers Manual</productname>
15207 <date>July 2017</date>
15208</refentryinfo>
15209<refmeta>
15210 <refentrytitle><phrase>rcu_read_lock_bh_held</phrase></refentrytitle>
15211 <manvolnum>9</manvolnum>
15212 <refmiscinfo class="version">4.4.14</refmiscinfo>
15213</refmeta>
15214<refnamediv>
15215 <refname>rcu_read_lock_bh_held</refname>
15216 <refpurpose>
15217     might we be in RCU-bh read-side critical section?
15218 </refpurpose>
15219</refnamediv>
15220<refsynopsisdiv>
15221 <title>Synopsis</title>
15222  <funcsynopsis><funcprototype>
15223   <funcdef>int <function>rcu_read_lock_bh_held </function></funcdef>
15224   <paramdef> <parameter>void</parameter></paramdef>
15225  </funcprototype></funcsynopsis>
15226</refsynopsisdiv>
15227<refsect1>
15228 <title>Arguments</title>
15229 <variablelist>
15230  <varlistentry>
15231   <term><parameter>void</parameter></term>
15232   <listitem>
15233    <para>
15234     no arguments
15235    </para>
15236   </listitem>
15237  </varlistentry>
15238 </variablelist>
15239</refsect1>
15240<refsect1>
15241<title>Description</title>
15242<para>
15243   </para><para>
15244
15245   Check for bottom half being disabled, which covers both the
15246   CONFIG_PROVE_RCU and not cases.  Note that if someone uses
15247   <function>rcu_read_lock_bh</function>, but then later enables BH, lockdep (if enabled)
15248   will show the situation.  This is useful for debug checks in functions
15249   that require that they be called within an RCU read-side critical
15250   section.
15251   </para><para>
15252
15253   Check <function>debug_lockdep_rcu_enabled</function> to prevent false positives during boot.
15254   </para><para>
15255
15256   Note that <function>rcu_read_lock</function> is disallowed if the CPU is either idle or
15257   offline from an RCU perspective, so check for those as well.
15258</para>
15259</refsect1>
15260</refentry>
15261
15262<refentry id="API-wakeme-after-rcu">
15263<refentryinfo>
15264 <title>LINUX</title>
15265 <productname>Kernel Hackers Manual</productname>
15266 <date>July 2017</date>
15267</refentryinfo>
15268<refmeta>
15269 <refentrytitle><phrase>wakeme_after_rcu</phrase></refentrytitle>
15270 <manvolnum>9</manvolnum>
15271 <refmiscinfo class="version">4.4.14</refmiscinfo>
15272</refmeta>
15273<refnamediv>
15274 <refname>wakeme_after_rcu</refname>
15275 <refpurpose>
15276     Callback function to awaken a task after grace period
15277 </refpurpose>
15278</refnamediv>
15279<refsynopsisdiv>
15280 <title>Synopsis</title>
15281  <funcsynopsis><funcprototype>
15282   <funcdef>void <function>wakeme_after_rcu </function></funcdef>
15283   <paramdef>struct rcu_head * <parameter>head</parameter></paramdef>
15284  </funcprototype></funcsynopsis>
15285</refsynopsisdiv>
15286<refsect1>
15287 <title>Arguments</title>
15288 <variablelist>
15289  <varlistentry>
15290   <term><parameter>head</parameter></term>
15291   <listitem>
15292    <para>
15293     Pointer to rcu_head member within rcu_synchronize structure
15294    </para>
15295   </listitem>
15296  </varlistentry>
15297 </variablelist>
15298</refsect1>
15299<refsect1>
15300<title>Description</title>
15301<para>
15302   Awaken the corresponding task now that a grace period has elapsed.
15303</para>
15304</refsect1>
15305</refentry>
15306
15307<refentry id="API-init-rcu-head-on-stack">
15308<refentryinfo>
15309 <title>LINUX</title>
15310 <productname>Kernel Hackers Manual</productname>
15311 <date>July 2017</date>
15312</refentryinfo>
15313<refmeta>
15314 <refentrytitle><phrase>init_rcu_head_on_stack</phrase></refentrytitle>
15315 <manvolnum>9</manvolnum>
15316 <refmiscinfo class="version">4.4.14</refmiscinfo>
15317</refmeta>
15318<refnamediv>
15319 <refname>init_rcu_head_on_stack</refname>
15320 <refpurpose>
15321     initialize on-stack rcu_head for debugobjects
15322 </refpurpose>
15323</refnamediv>
15324<refsynopsisdiv>
15325 <title>Synopsis</title>
15326  <funcsynopsis><funcprototype>
15327   <funcdef>void <function>init_rcu_head_on_stack </function></funcdef>
15328   <paramdef>struct rcu_head * <parameter>head</parameter></paramdef>
15329  </funcprototype></funcsynopsis>
15330</refsynopsisdiv>
15331<refsect1>
15332 <title>Arguments</title>
15333 <variablelist>
15334  <varlistentry>
15335   <term><parameter>head</parameter></term>
15336   <listitem>
15337    <para>
15338     pointer to rcu_head structure to be initialized
15339    </para>
15340   </listitem>
15341  </varlistentry>
15342 </variablelist>
15343</refsect1>
15344<refsect1>
15345<title>Description</title>
15346<para>
15347   This function informs debugobjects of a new rcu_head structure that
15348   has been allocated as an auto variable on the stack.  This function
15349   is not required for rcu_head structures that are statically defined or
15350   that are dynamically allocated on the heap.  This function has no
15351   effect for !CONFIG_DEBUG_OBJECTS_RCU_HEAD kernel builds.
15352</para>
15353</refsect1>
15354</refentry>
15355
15356<refentry id="API-destroy-rcu-head-on-stack">
15357<refentryinfo>
15358 <title>LINUX</title>
15359 <productname>Kernel Hackers Manual</productname>
15360 <date>July 2017</date>
15361</refentryinfo>
15362<refmeta>
15363 <refentrytitle><phrase>destroy_rcu_head_on_stack</phrase></refentrytitle>
15364 <manvolnum>9</manvolnum>
15365 <refmiscinfo class="version">4.4.14</refmiscinfo>
15366</refmeta>
15367<refnamediv>
15368 <refname>destroy_rcu_head_on_stack</refname>
15369 <refpurpose>
15370     destroy on-stack rcu_head for debugobjects
15371 </refpurpose>
15372</refnamediv>
15373<refsynopsisdiv>
15374 <title>Synopsis</title>
15375  <funcsynopsis><funcprototype>
15376   <funcdef>void <function>destroy_rcu_head_on_stack </function></funcdef>
15377   <paramdef>struct rcu_head * <parameter>head</parameter></paramdef>
15378  </funcprototype></funcsynopsis>
15379</refsynopsisdiv>
15380<refsect1>
15381 <title>Arguments</title>
15382 <variablelist>
15383  <varlistentry>
15384   <term><parameter>head</parameter></term>
15385   <listitem>
15386    <para>
15387     pointer to rcu_head structure to be initialized
15388    </para>
15389   </listitem>
15390  </varlistentry>
15391 </variablelist>
15392</refsect1>
15393<refsect1>
15394<title>Description</title>
15395<para>
15396   This function informs debugobjects that an on-stack rcu_head structure
15397   is about to go out of scope.  As with <function><link linkend="API-init-rcu-head-on-stack">init_rcu_head_on_stack</link></function>, this
15398   function is not required for rcu_head structures that are statically
15399   defined or that are dynamically allocated on the heap.  Also as with
15400   <function><link linkend="API-init-rcu-head-on-stack">init_rcu_head_on_stack</link></function>, this function has no effect for
15401   !CONFIG_DEBUG_OBJECTS_RCU_HEAD kernel builds.
15402</para>
15403</refsect1>
15404</refentry>
15405
15406<refentry id="API-synchronize-rcu-tasks">
15407<refentryinfo>
15408 <title>LINUX</title>
15409 <productname>Kernel Hackers Manual</productname>
15410 <date>July 2017</date>
15411</refentryinfo>
15412<refmeta>
15413 <refentrytitle><phrase>synchronize_rcu_tasks</phrase></refentrytitle>
15414 <manvolnum>9</manvolnum>
15415 <refmiscinfo class="version">4.4.14</refmiscinfo>
15416</refmeta>
15417<refnamediv>
15418 <refname>synchronize_rcu_tasks</refname>
15419 <refpurpose>
15420     wait until an rcu-tasks grace period has elapsed.
15421 </refpurpose>
15422</refnamediv>
15423<refsynopsisdiv>
15424 <title>Synopsis</title>
15425  <funcsynopsis><funcprototype>
15426   <funcdef>void <function>synchronize_rcu_tasks </function></funcdef>
15427   <paramdef> <parameter>void</parameter></paramdef>
15428  </funcprototype></funcsynopsis>
15429</refsynopsisdiv>
15430<refsect1>
15431 <title>Arguments</title>
15432 <variablelist>
15433  <varlistentry>
15434   <term><parameter>void</parameter></term>
15435   <listitem>
15436    <para>
15437     no arguments
15438    </para>
15439   </listitem>
15440  </varlistentry>
15441 </variablelist>
15442</refsect1>
15443<refsect1>
15444<title>Description</title>
15445<para>
15446   </para><para>
15447
15448   Control will return to the caller some time after a full rcu-tasks
15449   grace period has elapsed, in other words after all currently
15450   executing rcu-tasks read-side critical sections have elapsed.  These
15451   read-side critical sections are delimited by calls to <function>schedule</function>,
15452   <function>cond_resched_rcu_qs</function>, idle execution, userspace execution, calls
15453   to <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function>, and (in theory, anyway) <function>cond_resched</function>.
15454   </para><para>
15455
15456   This is a very specialized primitive, intended only for a few uses in
15457   tracing and other situations requiring manipulation of function
15458   preambles and profiling hooks.  The <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function> function
15459   is not (yet) intended for heavy use from multiple CPUs.
15460   </para><para>
15461
15462   Note that this guarantee implies further memory-ordering guarantees.
15463   On systems with more than one CPU, when <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function> returns,
15464   each CPU is guaranteed to have executed a full memory barrier since the
15465   end of its last RCU-tasks read-side critical section whose beginning
15466   preceded the call to <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function>.  In addition, each CPU
15467   having an RCU-tasks read-side critical section that extends beyond
15468   the return from <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function> is guaranteed to have executed
15469   a full memory barrier after the beginning of <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function>
15470   and before the beginning of that RCU-tasks read-side critical section.
15471   Note that these guarantees include CPUs that are offline, idle, or
15472   executing in user mode, as well as CPUs that are executing in the kernel.
15473   </para><para>
15474
15475   Furthermore, if CPU A invoked <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function>, which returned
15476   to its caller on CPU B, then both CPU A and CPU B are guaranteed
15477   to have executed a full memory barrier during the execution of
15478   <function><link linkend="API-synchronize-rcu-tasks">synchronize_rcu_tasks</link></function> -- even if CPU A and CPU B are the same CPU
15479   (but again only if the system has more than one CPU).
15480</para>
15481</refsect1>
15482</refentry>
15483
15484<refentry id="API-rcu-barrier-tasks">
15485<refentryinfo>
15486 <title>LINUX</title>
15487 <productname>Kernel Hackers Manual</productname>
15488 <date>July 2017</date>
15489</refentryinfo>
15490<refmeta>
15491 <refentrytitle><phrase>rcu_barrier_tasks</phrase></refentrytitle>
15492 <manvolnum>9</manvolnum>
15493 <refmiscinfo class="version">4.4.14</refmiscinfo>
15494</refmeta>
15495<refnamediv>
15496 <refname>rcu_barrier_tasks</refname>
15497 <refpurpose>
15498     Wait for in-flight <function>call_rcu_tasks</function> callbacks.
15499 </refpurpose>
15500</refnamediv>
15501<refsynopsisdiv>
15502 <title>Synopsis</title>
15503  <funcsynopsis><funcprototype>
15504   <funcdef>void <function>rcu_barrier_tasks </function></funcdef>
15505   <paramdef> <parameter>void</parameter></paramdef>
15506  </funcprototype></funcsynopsis>
15507</refsynopsisdiv>
15508<refsect1>
15509 <title>Arguments</title>
15510 <variablelist>
15511  <varlistentry>
15512   <term><parameter>void</parameter></term>
15513   <listitem>
15514    <para>
15515     no arguments
15516    </para>
15517   </listitem>
15518  </varlistentry>
15519 </variablelist>
15520</refsect1>
15521<refsect1>
15522<title>Description</title>
15523<para>
15524   </para><para>
15525
15526   Although the current implementation is guaranteed to wait, it is not
15527   obligated to, for example, if there are no pending callbacks.
15528</para>
15529</refsect1>
15530</refentry>
15531
15532     </sect1>
15533
15534     <sect1><title>Device Resource Management</title>
15535<!-- drivers/base/devres.c -->
15536<refentry id="API-devres-alloc-node">
15537<refentryinfo>
15538 <title>LINUX</title>
15539 <productname>Kernel Hackers Manual</productname>
15540 <date>July 2017</date>
15541</refentryinfo>
15542<refmeta>
15543 <refentrytitle><phrase>devres_alloc_node</phrase></refentrytitle>
15544 <manvolnum>9</manvolnum>
15545 <refmiscinfo class="version">4.4.14</refmiscinfo>
15546</refmeta>
15547<refnamediv>
15548 <refname>devres_alloc_node</refname>
15549 <refpurpose>
15550  Allocate device resource data
15551 </refpurpose>
15552</refnamediv>
15553<refsynopsisdiv>
15554 <title>Synopsis</title>
15555  <funcsynopsis><funcprototype>
15556   <funcdef>void * <function>devres_alloc_node </function></funcdef>
15557   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
15558   <paramdef>size_t <parameter>size</parameter></paramdef>
15559   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
15560   <paramdef>int <parameter>nid</parameter></paramdef>
15561  </funcprototype></funcsynopsis>
15562</refsynopsisdiv>
15563<refsect1>
15564 <title>Arguments</title>
15565 <variablelist>
15566  <varlistentry>
15567   <term><parameter>release</parameter></term>
15568   <listitem>
15569    <para>
15570     Release function devres will be associated with
15571    </para>
15572   </listitem>
15573  </varlistentry>
15574  <varlistentry>
15575   <term><parameter>size</parameter></term>
15576   <listitem>
15577    <para>
15578     Allocation size
15579    </para>
15580   </listitem>
15581  </varlistentry>
15582  <varlistentry>
15583   <term><parameter>gfp</parameter></term>
15584   <listitem>
15585    <para>
15586     Allocation flags
15587    </para>
15588   </listitem>
15589  </varlistentry>
15590  <varlistentry>
15591   <term><parameter>nid</parameter></term>
15592   <listitem>
15593    <para>
15594     NUMA node
15595    </para>
15596   </listitem>
15597  </varlistentry>
15598 </variablelist>
15599</refsect1>
15600<refsect1>
15601<title>Description</title>
15602<para>
15603   Allocate devres of <parameter>size</parameter> bytes.  The allocated area is zeroed, then
15604   associated with <parameter>release</parameter>.  The returned pointer can be passed to
15605   other devres_*() functions.
15606</para>
15607</refsect1>
15608<refsect1>
15609<title>RETURNS</title>
15610<para>
15611   Pointer to allocated devres on success, NULL on failure.
15612</para>
15613</refsect1>
15614</refentry>
15615
15616<refentry id="API-devres-for-each-res">
15617<refentryinfo>
15618 <title>LINUX</title>
15619 <productname>Kernel Hackers Manual</productname>
15620 <date>July 2017</date>
15621</refentryinfo>
15622<refmeta>
15623 <refentrytitle><phrase>devres_for_each_res</phrase></refentrytitle>
15624 <manvolnum>9</manvolnum>
15625 <refmiscinfo class="version">4.4.14</refmiscinfo>
15626</refmeta>
15627<refnamediv>
15628 <refname>devres_for_each_res</refname>
15629 <refpurpose>
15630     Resource iterator
15631 </refpurpose>
15632</refnamediv>
15633<refsynopsisdiv>
15634 <title>Synopsis</title>
15635  <funcsynopsis><funcprototype>
15636   <funcdef>void <function>devres_for_each_res </function></funcdef>
15637   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
15638   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
15639   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
15640   <paramdef>void * <parameter>match_data</parameter></paramdef>
15641   <paramdef>void (*<parameter>fn</parameter>)
15642     <funcparams>struct device *, void *, void *</funcparams></paramdef>
15643   <paramdef>void * <parameter>data</parameter></paramdef>
15644  </funcprototype></funcsynopsis>
15645</refsynopsisdiv>
15646<refsect1>
15647 <title>Arguments</title>
15648 <variablelist>
15649  <varlistentry>
15650   <term><parameter>dev</parameter></term>
15651   <listitem>
15652    <para>
15653     Device to iterate resource from
15654    </para>
15655   </listitem>
15656  </varlistentry>
15657  <varlistentry>
15658   <term><parameter>release</parameter></term>
15659   <listitem>
15660    <para>
15661     Look for resources associated with this release function
15662    </para>
15663   </listitem>
15664  </varlistentry>
15665  <varlistentry>
15666   <term><parameter>match</parameter></term>
15667   <listitem>
15668    <para>
15669     Match function (optional)
15670    </para>
15671   </listitem>
15672  </varlistentry>
15673  <varlistentry>
15674   <term><parameter>match_data</parameter></term>
15675   <listitem>
15676    <para>
15677     Data for the match function
15678    </para>
15679   </listitem>
15680  </varlistentry>
15681  <varlistentry>
15682   <term><parameter>fn</parameter></term>
15683   <listitem>
15684    <para>
15685     Function to be called for each matched resource.
15686    </para>
15687   </listitem>
15688  </varlistentry>
15689  <varlistentry>
15690   <term><parameter>data</parameter></term>
15691   <listitem>
15692    <para>
15693     Data for <parameter>fn</parameter>, the 3rd parameter of <parameter>fn</parameter>
15694    </para>
15695   </listitem>
15696  </varlistentry>
15697 </variablelist>
15698</refsect1>
15699<refsect1>
15700<title>Description</title>
15701<para>
15702   Call <parameter>fn</parameter> for each devres of <parameter>dev</parameter> which is associated with <parameter>release</parameter>
15703   and for which <parameter>match</parameter> returns 1.
15704</para>
15705</refsect1>
15706<refsect1>
15707<title>RETURNS</title>
15708<para>
15709   void
15710</para>
15711</refsect1>
15712</refentry>
15713
15714<refentry id="API-devres-free">
15715<refentryinfo>
15716 <title>LINUX</title>
15717 <productname>Kernel Hackers Manual</productname>
15718 <date>July 2017</date>
15719</refentryinfo>
15720<refmeta>
15721 <refentrytitle><phrase>devres_free</phrase></refentrytitle>
15722 <manvolnum>9</manvolnum>
15723 <refmiscinfo class="version">4.4.14</refmiscinfo>
15724</refmeta>
15725<refnamediv>
15726 <refname>devres_free</refname>
15727 <refpurpose>
15728     Free device resource data
15729 </refpurpose>
15730</refnamediv>
15731<refsynopsisdiv>
15732 <title>Synopsis</title>
15733  <funcsynopsis><funcprototype>
15734   <funcdef>void <function>devres_free </function></funcdef>
15735   <paramdef>void * <parameter>res</parameter></paramdef>
15736  </funcprototype></funcsynopsis>
15737</refsynopsisdiv>
15738<refsect1>
15739 <title>Arguments</title>
15740 <variablelist>
15741  <varlistentry>
15742   <term><parameter>res</parameter></term>
15743   <listitem>
15744    <para>
15745     Pointer to devres data to free
15746    </para>
15747   </listitem>
15748  </varlistentry>
15749 </variablelist>
15750</refsect1>
15751<refsect1>
15752<title>Description</title>
15753<para>
15754   Free devres created with <function>devres_alloc</function>.
15755</para>
15756</refsect1>
15757</refentry>
15758
15759<refentry id="API-devres-add">
15760<refentryinfo>
15761 <title>LINUX</title>
15762 <productname>Kernel Hackers Manual</productname>
15763 <date>July 2017</date>
15764</refentryinfo>
15765<refmeta>
15766 <refentrytitle><phrase>devres_add</phrase></refentrytitle>
15767 <manvolnum>9</manvolnum>
15768 <refmiscinfo class="version">4.4.14</refmiscinfo>
15769</refmeta>
15770<refnamediv>
15771 <refname>devres_add</refname>
15772 <refpurpose>
15773     Register device resource
15774 </refpurpose>
15775</refnamediv>
15776<refsynopsisdiv>
15777 <title>Synopsis</title>
15778  <funcsynopsis><funcprototype>
15779   <funcdef>void <function>devres_add </function></funcdef>
15780   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
15781   <paramdef>void * <parameter>res</parameter></paramdef>
15782  </funcprototype></funcsynopsis>
15783</refsynopsisdiv>
15784<refsect1>
15785 <title>Arguments</title>
15786 <variablelist>
15787  <varlistentry>
15788   <term><parameter>dev</parameter></term>
15789   <listitem>
15790    <para>
15791     Device to add resource to
15792    </para>
15793   </listitem>
15794  </varlistentry>
15795  <varlistentry>
15796   <term><parameter>res</parameter></term>
15797   <listitem>
15798    <para>
15799     Resource to register
15800    </para>
15801   </listitem>
15802  </varlistentry>
15803 </variablelist>
15804</refsect1>
15805<refsect1>
15806<title>Description</title>
15807<para>
15808   Register devres <parameter>res</parameter> to <parameter>dev</parameter>.  <parameter>res</parameter> should have been allocated
15809   using <function>devres_alloc</function>.  On driver detach, the associated release
15810   function will be invoked and devres will be freed automatically.
15811</para>
15812</refsect1>
15813</refentry>
15814
15815<refentry id="API-devres-find">
15816<refentryinfo>
15817 <title>LINUX</title>
15818 <productname>Kernel Hackers Manual</productname>
15819 <date>July 2017</date>
15820</refentryinfo>
15821<refmeta>
15822 <refentrytitle><phrase>devres_find</phrase></refentrytitle>
15823 <manvolnum>9</manvolnum>
15824 <refmiscinfo class="version">4.4.14</refmiscinfo>
15825</refmeta>
15826<refnamediv>
15827 <refname>devres_find</refname>
15828 <refpurpose>
15829     Find device resource
15830 </refpurpose>
15831</refnamediv>
15832<refsynopsisdiv>
15833 <title>Synopsis</title>
15834  <funcsynopsis><funcprototype>
15835   <funcdef>void * <function>devres_find </function></funcdef>
15836   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
15837   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
15838   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
15839   <paramdef>void * <parameter>match_data</parameter></paramdef>
15840  </funcprototype></funcsynopsis>
15841</refsynopsisdiv>
15842<refsect1>
15843 <title>Arguments</title>
15844 <variablelist>
15845  <varlistentry>
15846   <term><parameter>dev</parameter></term>
15847   <listitem>
15848    <para>
15849     Device to lookup resource from
15850    </para>
15851   </listitem>
15852  </varlistentry>
15853  <varlistentry>
15854   <term><parameter>release</parameter></term>
15855   <listitem>
15856    <para>
15857     Look for resources associated with this release function
15858    </para>
15859   </listitem>
15860  </varlistentry>
15861  <varlistentry>
15862   <term><parameter>match</parameter></term>
15863   <listitem>
15864    <para>
15865     Match function (optional)
15866    </para>
15867   </listitem>
15868  </varlistentry>
15869  <varlistentry>
15870   <term><parameter>match_data</parameter></term>
15871   <listitem>
15872    <para>
15873     Data for the match function
15874    </para>
15875   </listitem>
15876  </varlistentry>
15877 </variablelist>
15878</refsect1>
15879<refsect1>
15880<title>Description</title>
15881<para>
15882   Find the latest devres of <parameter>dev</parameter> which is associated with <parameter>release</parameter>
15883   and for which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered
15884   to match all.
15885</para>
15886</refsect1>
15887<refsect1>
15888<title>RETURNS</title>
15889<para>
15890   Pointer to found devres, NULL if not found.
15891</para>
15892</refsect1>
15893</refentry>
15894
15895<refentry id="API-devres-get">
15896<refentryinfo>
15897 <title>LINUX</title>
15898 <productname>Kernel Hackers Manual</productname>
15899 <date>July 2017</date>
15900</refentryinfo>
15901<refmeta>
15902 <refentrytitle><phrase>devres_get</phrase></refentrytitle>
15903 <manvolnum>9</manvolnum>
15904 <refmiscinfo class="version">4.4.14</refmiscinfo>
15905</refmeta>
15906<refnamediv>
15907 <refname>devres_get</refname>
15908 <refpurpose>
15909     Find devres, if non-existent, add one atomically
15910 </refpurpose>
15911</refnamediv>
15912<refsynopsisdiv>
15913 <title>Synopsis</title>
15914  <funcsynopsis><funcprototype>
15915   <funcdef>void * <function>devres_get </function></funcdef>
15916   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
15917   <paramdef>void * <parameter>new_res</parameter></paramdef>
15918   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
15919   <paramdef>void * <parameter>match_data</parameter></paramdef>
15920  </funcprototype></funcsynopsis>
15921</refsynopsisdiv>
15922<refsect1>
15923 <title>Arguments</title>
15924 <variablelist>
15925  <varlistentry>
15926   <term><parameter>dev</parameter></term>
15927   <listitem>
15928    <para>
15929     Device to lookup or add devres for
15930    </para>
15931   </listitem>
15932  </varlistentry>
15933  <varlistentry>
15934   <term><parameter>new_res</parameter></term>
15935   <listitem>
15936    <para>
15937     Pointer to new initialized devres to add if not found
15938    </para>
15939   </listitem>
15940  </varlistentry>
15941  <varlistentry>
15942   <term><parameter>match</parameter></term>
15943   <listitem>
15944    <para>
15945     Match function (optional)
15946    </para>
15947   </listitem>
15948  </varlistentry>
15949  <varlistentry>
15950   <term><parameter>match_data</parameter></term>
15951   <listitem>
15952    <para>
15953     Data for the match function
15954    </para>
15955   </listitem>
15956  </varlistentry>
15957 </variablelist>
15958</refsect1>
15959<refsect1>
15960<title>Description</title>
15961<para>
15962   Find the latest devres of <parameter>dev</parameter> which has the same release function
15963   as <parameter>new_res</parameter> and for which <parameter>match</parameter> return 1.  If found, <parameter>new_res</parameter> is
15964   freed; otherwise, <parameter>new_res</parameter> is added atomically.
15965</para>
15966</refsect1>
15967<refsect1>
15968<title>RETURNS</title>
15969<para>
15970   Pointer to found or added devres.
15971</para>
15972</refsect1>
15973</refentry>
15974
15975<refentry id="API-devres-remove">
15976<refentryinfo>
15977 <title>LINUX</title>
15978 <productname>Kernel Hackers Manual</productname>
15979 <date>July 2017</date>
15980</refentryinfo>
15981<refmeta>
15982 <refentrytitle><phrase>devres_remove</phrase></refentrytitle>
15983 <manvolnum>9</manvolnum>
15984 <refmiscinfo class="version">4.4.14</refmiscinfo>
15985</refmeta>
15986<refnamediv>
15987 <refname>devres_remove</refname>
15988 <refpurpose>
15989     Find a device resource and remove it
15990 </refpurpose>
15991</refnamediv>
15992<refsynopsisdiv>
15993 <title>Synopsis</title>
15994  <funcsynopsis><funcprototype>
15995   <funcdef>void * <function>devres_remove </function></funcdef>
15996   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
15997   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
15998   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
15999   <paramdef>void * <parameter>match_data</parameter></paramdef>
16000  </funcprototype></funcsynopsis>
16001</refsynopsisdiv>
16002<refsect1>
16003 <title>Arguments</title>
16004 <variablelist>
16005  <varlistentry>
16006   <term><parameter>dev</parameter></term>
16007   <listitem>
16008    <para>
16009     Device to find resource from
16010    </para>
16011   </listitem>
16012  </varlistentry>
16013  <varlistentry>
16014   <term><parameter>release</parameter></term>
16015   <listitem>
16016    <para>
16017     Look for resources associated with this release function
16018    </para>
16019   </listitem>
16020  </varlistentry>
16021  <varlistentry>
16022   <term><parameter>match</parameter></term>
16023   <listitem>
16024    <para>
16025     Match function (optional)
16026    </para>
16027   </listitem>
16028  </varlistentry>
16029  <varlistentry>
16030   <term><parameter>match_data</parameter></term>
16031   <listitem>
16032    <para>
16033     Data for the match function
16034    </para>
16035   </listitem>
16036  </varlistentry>
16037 </variablelist>
16038</refsect1>
16039<refsect1>
16040<title>Description</title>
16041<para>
16042   Find the latest devres of <parameter>dev</parameter> associated with <parameter>release</parameter> and for
16043   which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered to
16044   match all.  If found, the resource is removed atomically and
16045   returned.
16046</para>
16047</refsect1>
16048<refsect1>
16049<title>RETURNS</title>
16050<para>
16051   Pointer to removed devres on success, NULL if not found.
16052</para>
16053</refsect1>
16054</refentry>
16055
16056<refentry id="API-devres-destroy">
16057<refentryinfo>
16058 <title>LINUX</title>
16059 <productname>Kernel Hackers Manual</productname>
16060 <date>July 2017</date>
16061</refentryinfo>
16062<refmeta>
16063 <refentrytitle><phrase>devres_destroy</phrase></refentrytitle>
16064 <manvolnum>9</manvolnum>
16065 <refmiscinfo class="version">4.4.14</refmiscinfo>
16066</refmeta>
16067<refnamediv>
16068 <refname>devres_destroy</refname>
16069 <refpurpose>
16070     Find a device resource and destroy it
16071 </refpurpose>
16072</refnamediv>
16073<refsynopsisdiv>
16074 <title>Synopsis</title>
16075  <funcsynopsis><funcprototype>
16076   <funcdef>int <function>devres_destroy </function></funcdef>
16077   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16078   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
16079   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
16080   <paramdef>void * <parameter>match_data</parameter></paramdef>
16081  </funcprototype></funcsynopsis>
16082</refsynopsisdiv>
16083<refsect1>
16084 <title>Arguments</title>
16085 <variablelist>
16086  <varlistentry>
16087   <term><parameter>dev</parameter></term>
16088   <listitem>
16089    <para>
16090     Device to find resource from
16091    </para>
16092   </listitem>
16093  </varlistentry>
16094  <varlistentry>
16095   <term><parameter>release</parameter></term>
16096   <listitem>
16097    <para>
16098     Look for resources associated with this release function
16099    </para>
16100   </listitem>
16101  </varlistentry>
16102  <varlistentry>
16103   <term><parameter>match</parameter></term>
16104   <listitem>
16105    <para>
16106     Match function (optional)
16107    </para>
16108   </listitem>
16109  </varlistentry>
16110  <varlistentry>
16111   <term><parameter>match_data</parameter></term>
16112   <listitem>
16113    <para>
16114     Data for the match function
16115    </para>
16116   </listitem>
16117  </varlistentry>
16118 </variablelist>
16119</refsect1>
16120<refsect1>
16121<title>Description</title>
16122<para>
16123   Find the latest devres of <parameter>dev</parameter> associated with <parameter>release</parameter> and for
16124   which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered to
16125   match all.  If found, the resource is removed atomically and freed.
16126   </para><para>
16127
16128   Note that the release function for the resource will not be called,
16129   only the devres-allocated data will be freed.  The caller becomes
16130   responsible for freeing any other data.
16131</para>
16132</refsect1>
16133<refsect1>
16134<title>RETURNS</title>
16135<para>
16136   0 if devres is found and freed, -ENOENT if not found.
16137</para>
16138</refsect1>
16139</refentry>
16140
16141<refentry id="API-devres-release">
16142<refentryinfo>
16143 <title>LINUX</title>
16144 <productname>Kernel Hackers Manual</productname>
16145 <date>July 2017</date>
16146</refentryinfo>
16147<refmeta>
16148 <refentrytitle><phrase>devres_release</phrase></refentrytitle>
16149 <manvolnum>9</manvolnum>
16150 <refmiscinfo class="version">4.4.14</refmiscinfo>
16151</refmeta>
16152<refnamediv>
16153 <refname>devres_release</refname>
16154 <refpurpose>
16155     Find a device resource and destroy it, calling release
16156 </refpurpose>
16157</refnamediv>
16158<refsynopsisdiv>
16159 <title>Synopsis</title>
16160  <funcsynopsis><funcprototype>
16161   <funcdef>int <function>devres_release </function></funcdef>
16162   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16163   <paramdef>dr_release_t <parameter>release</parameter></paramdef>
16164   <paramdef>dr_match_t <parameter>match</parameter></paramdef>
16165   <paramdef>void * <parameter>match_data</parameter></paramdef>
16166  </funcprototype></funcsynopsis>
16167</refsynopsisdiv>
16168<refsect1>
16169 <title>Arguments</title>
16170 <variablelist>
16171  <varlistentry>
16172   <term><parameter>dev</parameter></term>
16173   <listitem>
16174    <para>
16175     Device to find resource from
16176    </para>
16177   </listitem>
16178  </varlistentry>
16179  <varlistentry>
16180   <term><parameter>release</parameter></term>
16181   <listitem>
16182    <para>
16183     Look for resources associated with this release function
16184    </para>
16185   </listitem>
16186  </varlistentry>
16187  <varlistentry>
16188   <term><parameter>match</parameter></term>
16189   <listitem>
16190    <para>
16191     Match function (optional)
16192    </para>
16193   </listitem>
16194  </varlistentry>
16195  <varlistentry>
16196   <term><parameter>match_data</parameter></term>
16197   <listitem>
16198    <para>
16199     Data for the match function
16200    </para>
16201   </listitem>
16202  </varlistentry>
16203 </variablelist>
16204</refsect1>
16205<refsect1>
16206<title>Description</title>
16207<para>
16208   Find the latest devres of <parameter>dev</parameter> associated with <parameter>release</parameter> and for
16209   which <parameter>match</parameter> returns 1.  If <parameter>match</parameter> is NULL, it's considered to
16210   match all.  If found, the resource is removed atomically, the
16211   release function called and the resource freed.
16212</para>
16213</refsect1>
16214<refsect1>
16215<title>RETURNS</title>
16216<para>
16217   0 if devres is found and freed, -ENOENT if not found.
16218</para>
16219</refsect1>
16220</refentry>
16221
16222<refentry id="API-devres-open-group">
16223<refentryinfo>
16224 <title>LINUX</title>
16225 <productname>Kernel Hackers Manual</productname>
16226 <date>July 2017</date>
16227</refentryinfo>
16228<refmeta>
16229 <refentrytitle><phrase>devres_open_group</phrase></refentrytitle>
16230 <manvolnum>9</manvolnum>
16231 <refmiscinfo class="version">4.4.14</refmiscinfo>
16232</refmeta>
16233<refnamediv>
16234 <refname>devres_open_group</refname>
16235 <refpurpose>
16236     Open a new devres group
16237 </refpurpose>
16238</refnamediv>
16239<refsynopsisdiv>
16240 <title>Synopsis</title>
16241  <funcsynopsis><funcprototype>
16242   <funcdef>void * <function>devres_open_group </function></funcdef>
16243   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16244   <paramdef>void * <parameter>id</parameter></paramdef>
16245   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
16246  </funcprototype></funcsynopsis>
16247</refsynopsisdiv>
16248<refsect1>
16249 <title>Arguments</title>
16250 <variablelist>
16251  <varlistentry>
16252   <term><parameter>dev</parameter></term>
16253   <listitem>
16254    <para>
16255     Device to open devres group for
16256    </para>
16257   </listitem>
16258  </varlistentry>
16259  <varlistentry>
16260   <term><parameter>id</parameter></term>
16261   <listitem>
16262    <para>
16263     Separator ID
16264    </para>
16265   </listitem>
16266  </varlistentry>
16267  <varlistentry>
16268   <term><parameter>gfp</parameter></term>
16269   <listitem>
16270    <para>
16271     Allocation flags
16272    </para>
16273   </listitem>
16274  </varlistentry>
16275 </variablelist>
16276</refsect1>
16277<refsect1>
16278<title>Description</title>
16279<para>
16280   Open a new devres group for <parameter>dev</parameter> with <parameter>id</parameter>.  For <parameter>id</parameter>, using a
16281   pointer to an object which won't be used for another group is
16282   recommended.  If <parameter>id</parameter> is NULL, address-wise unique ID is created.
16283</para>
16284</refsect1>
16285<refsect1>
16286<title>RETURNS</title>
16287<para>
16288   ID of the new group, NULL on failure.
16289</para>
16290</refsect1>
16291</refentry>
16292
16293<refentry id="API-devres-close-group">
16294<refentryinfo>
16295 <title>LINUX</title>
16296 <productname>Kernel Hackers Manual</productname>
16297 <date>July 2017</date>
16298</refentryinfo>
16299<refmeta>
16300 <refentrytitle><phrase>devres_close_group</phrase></refentrytitle>
16301 <manvolnum>9</manvolnum>
16302 <refmiscinfo class="version">4.4.14</refmiscinfo>
16303</refmeta>
16304<refnamediv>
16305 <refname>devres_close_group</refname>
16306 <refpurpose>
16307     Close a devres group
16308 </refpurpose>
16309</refnamediv>
16310<refsynopsisdiv>
16311 <title>Synopsis</title>
16312  <funcsynopsis><funcprototype>
16313   <funcdef>void <function>devres_close_group </function></funcdef>
16314   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16315   <paramdef>void * <parameter>id</parameter></paramdef>
16316  </funcprototype></funcsynopsis>
16317</refsynopsisdiv>
16318<refsect1>
16319 <title>Arguments</title>
16320 <variablelist>
16321  <varlistentry>
16322   <term><parameter>dev</parameter></term>
16323   <listitem>
16324    <para>
16325     Device to close devres group for
16326    </para>
16327   </listitem>
16328  </varlistentry>
16329  <varlistentry>
16330   <term><parameter>id</parameter></term>
16331   <listitem>
16332    <para>
16333     ID of target group, can be NULL
16334    </para>
16335   </listitem>
16336  </varlistentry>
16337 </variablelist>
16338</refsect1>
16339<refsect1>
16340<title>Description</title>
16341<para>
16342   Close the group identified by <parameter>id</parameter>.  If <parameter>id</parameter> is NULL, the latest open
16343   group is selected.
16344</para>
16345</refsect1>
16346</refentry>
16347
16348<refentry id="API-devres-remove-group">
16349<refentryinfo>
16350 <title>LINUX</title>
16351 <productname>Kernel Hackers Manual</productname>
16352 <date>July 2017</date>
16353</refentryinfo>
16354<refmeta>
16355 <refentrytitle><phrase>devres_remove_group</phrase></refentrytitle>
16356 <manvolnum>9</manvolnum>
16357 <refmiscinfo class="version">4.4.14</refmiscinfo>
16358</refmeta>
16359<refnamediv>
16360 <refname>devres_remove_group</refname>
16361 <refpurpose>
16362     Remove a devres group
16363 </refpurpose>
16364</refnamediv>
16365<refsynopsisdiv>
16366 <title>Synopsis</title>
16367  <funcsynopsis><funcprototype>
16368   <funcdef>void <function>devres_remove_group </function></funcdef>
16369   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16370   <paramdef>void * <parameter>id</parameter></paramdef>
16371  </funcprototype></funcsynopsis>
16372</refsynopsisdiv>
16373<refsect1>
16374 <title>Arguments</title>
16375 <variablelist>
16376  <varlistentry>
16377   <term><parameter>dev</parameter></term>
16378   <listitem>
16379    <para>
16380     Device to remove group for
16381    </para>
16382   </listitem>
16383  </varlistentry>
16384  <varlistentry>
16385   <term><parameter>id</parameter></term>
16386   <listitem>
16387    <para>
16388     ID of target group, can be NULL
16389    </para>
16390   </listitem>
16391  </varlistentry>
16392 </variablelist>
16393</refsect1>
16394<refsect1>
16395<title>Description</title>
16396<para>
16397   Remove the group identified by <parameter>id</parameter>.  If <parameter>id</parameter> is NULL, the latest
16398   open group is selected.  Note that removing a group doesn't affect
16399   any other resources.
16400</para>
16401</refsect1>
16402</refentry>
16403
16404<refentry id="API-devres-release-group">
16405<refentryinfo>
16406 <title>LINUX</title>
16407 <productname>Kernel Hackers Manual</productname>
16408 <date>July 2017</date>
16409</refentryinfo>
16410<refmeta>
16411 <refentrytitle><phrase>devres_release_group</phrase></refentrytitle>
16412 <manvolnum>9</manvolnum>
16413 <refmiscinfo class="version">4.4.14</refmiscinfo>
16414</refmeta>
16415<refnamediv>
16416 <refname>devres_release_group</refname>
16417 <refpurpose>
16418     Release resources in a devres group
16419 </refpurpose>
16420</refnamediv>
16421<refsynopsisdiv>
16422 <title>Synopsis</title>
16423  <funcsynopsis><funcprototype>
16424   <funcdef>int <function>devres_release_group </function></funcdef>
16425   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16426   <paramdef>void * <parameter>id</parameter></paramdef>
16427  </funcprototype></funcsynopsis>
16428</refsynopsisdiv>
16429<refsect1>
16430 <title>Arguments</title>
16431 <variablelist>
16432  <varlistentry>
16433   <term><parameter>dev</parameter></term>
16434   <listitem>
16435    <para>
16436     Device to release group for
16437    </para>
16438   </listitem>
16439  </varlistentry>
16440  <varlistentry>
16441   <term><parameter>id</parameter></term>
16442   <listitem>
16443    <para>
16444     ID of target group, can be NULL
16445    </para>
16446   </listitem>
16447  </varlistentry>
16448 </variablelist>
16449</refsect1>
16450<refsect1>
16451<title>Description</title>
16452<para>
16453   Release all resources in the group identified by <parameter>id</parameter>.  If <parameter>id</parameter> is
16454   NULL, the latest open group is selected.  The selected group and
16455   groups properly nested inside the selected group are removed.
16456</para>
16457</refsect1>
16458<refsect1>
16459<title>RETURNS</title>
16460<para>
16461   The number of released non-group resources.
16462</para>
16463</refsect1>
16464</refentry>
16465
16466<refentry id="API-devm-add-action">
16467<refentryinfo>
16468 <title>LINUX</title>
16469 <productname>Kernel Hackers Manual</productname>
16470 <date>July 2017</date>
16471</refentryinfo>
16472<refmeta>
16473 <refentrytitle><phrase>devm_add_action</phrase></refentrytitle>
16474 <manvolnum>9</manvolnum>
16475 <refmiscinfo class="version">4.4.14</refmiscinfo>
16476</refmeta>
16477<refnamediv>
16478 <refname>devm_add_action</refname>
16479 <refpurpose>
16480     add a custom action to list of managed resources
16481 </refpurpose>
16482</refnamediv>
16483<refsynopsisdiv>
16484 <title>Synopsis</title>
16485  <funcsynopsis><funcprototype>
16486   <funcdef>int <function>devm_add_action </function></funcdef>
16487   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16488   <paramdef>void (*<parameter>action</parameter>)
16489     <funcparams>void *</funcparams></paramdef>
16490   <paramdef>void * <parameter>data</parameter></paramdef>
16491  </funcprototype></funcsynopsis>
16492</refsynopsisdiv>
16493<refsect1>
16494 <title>Arguments</title>
16495 <variablelist>
16496  <varlistentry>
16497   <term><parameter>dev</parameter></term>
16498   <listitem>
16499    <para>
16500     Device that owns the action
16501    </para>
16502   </listitem>
16503  </varlistentry>
16504  <varlistentry>
16505   <term><parameter>action</parameter></term>
16506   <listitem>
16507    <para>
16508     Function that should be called
16509    </para>
16510   </listitem>
16511  </varlistentry>
16512  <varlistentry>
16513   <term><parameter>data</parameter></term>
16514   <listitem>
16515    <para>
16516     Pointer to data passed to <parameter>action</parameter> implementation
16517    </para>
16518   </listitem>
16519  </varlistentry>
16520 </variablelist>
16521</refsect1>
16522<refsect1>
16523<title>Description</title>
16524<para>
16525   This adds a custom action to the list of managed resources so that
16526   it gets executed as part of standard resource unwinding.
16527</para>
16528</refsect1>
16529</refentry>
16530
16531<refentry id="API-devm-remove-action">
16532<refentryinfo>
16533 <title>LINUX</title>
16534 <productname>Kernel Hackers Manual</productname>
16535 <date>July 2017</date>
16536</refentryinfo>
16537<refmeta>
16538 <refentrytitle><phrase>devm_remove_action</phrase></refentrytitle>
16539 <manvolnum>9</manvolnum>
16540 <refmiscinfo class="version">4.4.14</refmiscinfo>
16541</refmeta>
16542<refnamediv>
16543 <refname>devm_remove_action</refname>
16544 <refpurpose>
16545     removes previously added custom action
16546 </refpurpose>
16547</refnamediv>
16548<refsynopsisdiv>
16549 <title>Synopsis</title>
16550  <funcsynopsis><funcprototype>
16551   <funcdef>void <function>devm_remove_action </function></funcdef>
16552   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16553   <paramdef>void (*<parameter>action</parameter>)
16554     <funcparams>void *</funcparams></paramdef>
16555   <paramdef>void * <parameter>data</parameter></paramdef>
16556  </funcprototype></funcsynopsis>
16557</refsynopsisdiv>
16558<refsect1>
16559 <title>Arguments</title>
16560 <variablelist>
16561  <varlistentry>
16562   <term><parameter>dev</parameter></term>
16563   <listitem>
16564    <para>
16565     Device that owns the action
16566    </para>
16567   </listitem>
16568  </varlistentry>
16569  <varlistentry>
16570   <term><parameter>action</parameter></term>
16571   <listitem>
16572    <para>
16573     Function implementing the action
16574    </para>
16575   </listitem>
16576  </varlistentry>
16577  <varlistentry>
16578   <term><parameter>data</parameter></term>
16579   <listitem>
16580    <para>
16581     Pointer to data passed to <parameter>action</parameter> implementation
16582    </para>
16583   </listitem>
16584  </varlistentry>
16585 </variablelist>
16586</refsect1>
16587<refsect1>
16588<title>Description</title>
16589<para>
16590   Removes instance of <parameter>action</parameter> previously added by <function><link linkend="API-devm-add-action">devm_add_action</link></function>.
16591   Both action and data should match one of the existing entries.
16592</para>
16593</refsect1>
16594</refentry>
16595
16596<refentry id="API-devm-kmalloc">
16597<refentryinfo>
16598 <title>LINUX</title>
16599 <productname>Kernel Hackers Manual</productname>
16600 <date>July 2017</date>
16601</refentryinfo>
16602<refmeta>
16603 <refentrytitle><phrase>devm_kmalloc</phrase></refentrytitle>
16604 <manvolnum>9</manvolnum>
16605 <refmiscinfo class="version">4.4.14</refmiscinfo>
16606</refmeta>
16607<refnamediv>
16608 <refname>devm_kmalloc</refname>
16609 <refpurpose>
16610     Resource-managed kmalloc
16611 </refpurpose>
16612</refnamediv>
16613<refsynopsisdiv>
16614 <title>Synopsis</title>
16615  <funcsynopsis><funcprototype>
16616   <funcdef>void * <function>devm_kmalloc </function></funcdef>
16617   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16618   <paramdef>size_t <parameter>size</parameter></paramdef>
16619   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
16620  </funcprototype></funcsynopsis>
16621</refsynopsisdiv>
16622<refsect1>
16623 <title>Arguments</title>
16624 <variablelist>
16625  <varlistentry>
16626   <term><parameter>dev</parameter></term>
16627   <listitem>
16628    <para>
16629     Device to allocate memory for
16630    </para>
16631   </listitem>
16632  </varlistentry>
16633  <varlistentry>
16634   <term><parameter>size</parameter></term>
16635   <listitem>
16636    <para>
16637     Allocation size
16638    </para>
16639   </listitem>
16640  </varlistentry>
16641  <varlistentry>
16642   <term><parameter>gfp</parameter></term>
16643   <listitem>
16644    <para>
16645     Allocation gfp flags
16646    </para>
16647   </listitem>
16648  </varlistentry>
16649 </variablelist>
16650</refsect1>
16651<refsect1>
16652<title>Description</title>
16653<para>
16654   Managed kmalloc.  Memory allocated with this function is
16655   automatically freed on driver detach.  Like all other devres
16656   resources, guaranteed alignment is unsigned long long.
16657</para>
16658</refsect1>
16659<refsect1>
16660<title>RETURNS</title>
16661<para>
16662   Pointer to allocated memory on success, NULL on failure.
16663</para>
16664</refsect1>
16665</refentry>
16666
16667<refentry id="API-devm-kstrdup">
16668<refentryinfo>
16669 <title>LINUX</title>
16670 <productname>Kernel Hackers Manual</productname>
16671 <date>July 2017</date>
16672</refentryinfo>
16673<refmeta>
16674 <refentrytitle><phrase>devm_kstrdup</phrase></refentrytitle>
16675 <manvolnum>9</manvolnum>
16676 <refmiscinfo class="version">4.4.14</refmiscinfo>
16677</refmeta>
16678<refnamediv>
16679 <refname>devm_kstrdup</refname>
16680 <refpurpose>
16681     Allocate resource managed space and copy an existing string into that.
16682 </refpurpose>
16683</refnamediv>
16684<refsynopsisdiv>
16685 <title>Synopsis</title>
16686  <funcsynopsis><funcprototype>
16687   <funcdef>char * <function>devm_kstrdup </function></funcdef>
16688   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16689   <paramdef>const char * <parameter>s</parameter></paramdef>
16690   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
16691  </funcprototype></funcsynopsis>
16692</refsynopsisdiv>
16693<refsect1>
16694 <title>Arguments</title>
16695 <variablelist>
16696  <varlistentry>
16697   <term><parameter>dev</parameter></term>
16698   <listitem>
16699    <para>
16700     Device to allocate memory for
16701    </para>
16702   </listitem>
16703  </varlistentry>
16704  <varlistentry>
16705   <term><parameter>s</parameter></term>
16706   <listitem>
16707    <para>
16708     the string to duplicate
16709    </para>
16710   </listitem>
16711  </varlistentry>
16712  <varlistentry>
16713   <term><parameter>gfp</parameter></term>
16714   <listitem>
16715    <para>
16716     the GFP mask used in the <function><link linkend="API-devm-kmalloc">devm_kmalloc</link></function> call when
16717     allocating memory
16718    </para>
16719   </listitem>
16720  </varlistentry>
16721 </variablelist>
16722</refsect1>
16723<refsect1>
16724<title>RETURNS</title>
16725<para>
16726   Pointer to allocated string on success, NULL on failure.
16727</para>
16728</refsect1>
16729</refentry>
16730
16731<refentry id="API-devm-kvasprintf">
16732<refentryinfo>
16733 <title>LINUX</title>
16734 <productname>Kernel Hackers Manual</productname>
16735 <date>July 2017</date>
16736</refentryinfo>
16737<refmeta>
16738 <refentrytitle><phrase>devm_kvasprintf</phrase></refentrytitle>
16739 <manvolnum>9</manvolnum>
16740 <refmiscinfo class="version">4.4.14</refmiscinfo>
16741</refmeta>
16742<refnamediv>
16743 <refname>devm_kvasprintf</refname>
16744 <refpurpose>
16745     Allocate resource managed space and format a string into that.
16746 </refpurpose>
16747</refnamediv>
16748<refsynopsisdiv>
16749 <title>Synopsis</title>
16750  <funcsynopsis><funcprototype>
16751   <funcdef>char * <function>devm_kvasprintf </function></funcdef>
16752   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16753   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
16754   <paramdef>const char * <parameter>fmt</parameter></paramdef>
16755   <paramdef>va_list <parameter>ap</parameter></paramdef>
16756  </funcprototype></funcsynopsis>
16757</refsynopsisdiv>
16758<refsect1>
16759 <title>Arguments</title>
16760 <variablelist>
16761  <varlistentry>
16762   <term><parameter>dev</parameter></term>
16763   <listitem>
16764    <para>
16765     Device to allocate memory for
16766    </para>
16767   </listitem>
16768  </varlistentry>
16769  <varlistentry>
16770   <term><parameter>gfp</parameter></term>
16771   <listitem>
16772    <para>
16773     the GFP mask used in the <function><link linkend="API-devm-kmalloc">devm_kmalloc</link></function> call when
16774     allocating memory
16775    </para>
16776   </listitem>
16777  </varlistentry>
16778  <varlistentry>
16779   <term><parameter>fmt</parameter></term>
16780   <listitem>
16781    <para>
16782     The <function>printf</function>-style format string
16783    </para>
16784   </listitem>
16785  </varlistentry>
16786  <varlistentry>
16787   <term><parameter>ap</parameter></term>
16788   <listitem>
16789    <para>
16790     Arguments for the format string
16791    </para>
16792   </listitem>
16793  </varlistentry>
16794 </variablelist>
16795</refsect1>
16796<refsect1>
16797<title>RETURNS</title>
16798<para>
16799   Pointer to allocated string on success, NULL on failure.
16800</para>
16801</refsect1>
16802</refentry>
16803
16804<refentry id="API-devm-kasprintf">
16805<refentryinfo>
16806 <title>LINUX</title>
16807 <productname>Kernel Hackers Manual</productname>
16808 <date>July 2017</date>
16809</refentryinfo>
16810<refmeta>
16811 <refentrytitle><phrase>devm_kasprintf</phrase></refentrytitle>
16812 <manvolnum>9</manvolnum>
16813 <refmiscinfo class="version">4.4.14</refmiscinfo>
16814</refmeta>
16815<refnamediv>
16816 <refname>devm_kasprintf</refname>
16817 <refpurpose>
16818     Allocate resource managed space and format a string into that.
16819 </refpurpose>
16820</refnamediv>
16821<refsynopsisdiv>
16822 <title>Synopsis</title>
16823  <funcsynopsis><funcprototype>
16824   <funcdef>char * <function>devm_kasprintf </function></funcdef>
16825   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16826   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
16827   <paramdef>const char * <parameter>fmt</parameter></paramdef>
16828   <paramdef> <parameter>...</parameter></paramdef>
16829  </funcprototype></funcsynopsis>
16830</refsynopsisdiv>
16831<refsect1>
16832 <title>Arguments</title>
16833 <variablelist>
16834  <varlistentry>
16835   <term><parameter>dev</parameter></term>
16836   <listitem>
16837    <para>
16838     Device to allocate memory for
16839    </para>
16840   </listitem>
16841  </varlistentry>
16842  <varlistentry>
16843   <term><parameter>gfp</parameter></term>
16844   <listitem>
16845    <para>
16846     the GFP mask used in the <function><link linkend="API-devm-kmalloc">devm_kmalloc</link></function> call when
16847     allocating memory
16848    </para>
16849   </listitem>
16850  </varlistentry>
16851  <varlistentry>
16852   <term><parameter>fmt</parameter></term>
16853   <listitem>
16854    <para>
16855     The <function>printf</function>-style format string
16856     @...: Arguments for the format string
16857    </para>
16858   </listitem>
16859  </varlistentry>
16860  <varlistentry>
16861   <term><parameter>...</parameter></term>
16862   <listitem>
16863    <para>
16864     variable arguments
16865    </para>
16866   </listitem>
16867  </varlistentry>
16868 </variablelist>
16869</refsect1>
16870<refsect1>
16871<title>RETURNS</title>
16872<para>
16873   Pointer to allocated string on success, NULL on failure.
16874</para>
16875</refsect1>
16876</refentry>
16877
16878<refentry id="API-devm-kfree">
16879<refentryinfo>
16880 <title>LINUX</title>
16881 <productname>Kernel Hackers Manual</productname>
16882 <date>July 2017</date>
16883</refentryinfo>
16884<refmeta>
16885 <refentrytitle><phrase>devm_kfree</phrase></refentrytitle>
16886 <manvolnum>9</manvolnum>
16887 <refmiscinfo class="version">4.4.14</refmiscinfo>
16888</refmeta>
16889<refnamediv>
16890 <refname>devm_kfree</refname>
16891 <refpurpose>
16892     Resource-managed kfree
16893 </refpurpose>
16894</refnamediv>
16895<refsynopsisdiv>
16896 <title>Synopsis</title>
16897  <funcsynopsis><funcprototype>
16898   <funcdef>void <function>devm_kfree </function></funcdef>
16899   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16900   <paramdef>void * <parameter>p</parameter></paramdef>
16901  </funcprototype></funcsynopsis>
16902</refsynopsisdiv>
16903<refsect1>
16904 <title>Arguments</title>
16905 <variablelist>
16906  <varlistentry>
16907   <term><parameter>dev</parameter></term>
16908   <listitem>
16909    <para>
16910     Device this memory belongs to
16911    </para>
16912   </listitem>
16913  </varlistentry>
16914  <varlistentry>
16915   <term><parameter>p</parameter></term>
16916   <listitem>
16917    <para>
16918     Memory to free
16919    </para>
16920   </listitem>
16921  </varlistentry>
16922 </variablelist>
16923</refsect1>
16924<refsect1>
16925<title>Description</title>
16926<para>
16927   Free memory allocated with <function><link linkend="API-devm-kmalloc">devm_kmalloc</link></function>.
16928</para>
16929</refsect1>
16930</refentry>
16931
16932<refentry id="API-devm-kmemdup">
16933<refentryinfo>
16934 <title>LINUX</title>
16935 <productname>Kernel Hackers Manual</productname>
16936 <date>July 2017</date>
16937</refentryinfo>
16938<refmeta>
16939 <refentrytitle><phrase>devm_kmemdup</phrase></refentrytitle>
16940 <manvolnum>9</manvolnum>
16941 <refmiscinfo class="version">4.4.14</refmiscinfo>
16942</refmeta>
16943<refnamediv>
16944 <refname>devm_kmemdup</refname>
16945 <refpurpose>
16946     Resource-managed kmemdup
16947 </refpurpose>
16948</refnamediv>
16949<refsynopsisdiv>
16950 <title>Synopsis</title>
16951  <funcsynopsis><funcprototype>
16952   <funcdef>void * <function>devm_kmemdup </function></funcdef>
16953   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
16954   <paramdef>const void * <parameter>src</parameter></paramdef>
16955   <paramdef>size_t <parameter>len</parameter></paramdef>
16956   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
16957  </funcprototype></funcsynopsis>
16958</refsynopsisdiv>
16959<refsect1>
16960 <title>Arguments</title>
16961 <variablelist>
16962  <varlistentry>
16963   <term><parameter>dev</parameter></term>
16964   <listitem>
16965    <para>
16966     Device this memory belongs to
16967    </para>
16968   </listitem>
16969  </varlistentry>
16970  <varlistentry>
16971   <term><parameter>src</parameter></term>
16972   <listitem>
16973    <para>
16974     Memory region to duplicate
16975    </para>
16976   </listitem>
16977  </varlistentry>
16978  <varlistentry>
16979   <term><parameter>len</parameter></term>
16980   <listitem>
16981    <para>
16982     Memory region length
16983    </para>
16984   </listitem>
16985  </varlistentry>
16986  <varlistentry>
16987   <term><parameter>gfp</parameter></term>
16988   <listitem>
16989    <para>
16990     GFP mask to use
16991    </para>
16992   </listitem>
16993  </varlistentry>
16994 </variablelist>
16995</refsect1>
16996<refsect1>
16997<title>Description</title>
16998<para>
16999   Duplicate region of a memory using resource managed kmalloc
17000</para>
17001</refsect1>
17002</refentry>
17003
17004<refentry id="API-devm-get-free-pages">
17005<refentryinfo>
17006 <title>LINUX</title>
17007 <productname>Kernel Hackers Manual</productname>
17008 <date>July 2017</date>
17009</refentryinfo>
17010<refmeta>
17011 <refentrytitle><phrase>devm_get_free_pages</phrase></refentrytitle>
17012 <manvolnum>9</manvolnum>
17013 <refmiscinfo class="version">4.4.14</refmiscinfo>
17014</refmeta>
17015<refnamediv>
17016 <refname>devm_get_free_pages</refname>
17017 <refpurpose>
17018     Resource-managed __get_free_pages
17019 </refpurpose>
17020</refnamediv>
17021<refsynopsisdiv>
17022 <title>Synopsis</title>
17023  <funcsynopsis><funcprototype>
17024   <funcdef>unsigned long <function>devm_get_free_pages </function></funcdef>
17025   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
17026   <paramdef>gfp_t <parameter>gfp_mask</parameter></paramdef>
17027   <paramdef>unsigned int <parameter>order</parameter></paramdef>
17028  </funcprototype></funcsynopsis>
17029</refsynopsisdiv>
17030<refsect1>
17031 <title>Arguments</title>
17032 <variablelist>
17033  <varlistentry>
17034   <term><parameter>dev</parameter></term>
17035   <listitem>
17036    <para>
17037     Device to allocate memory for
17038    </para>
17039   </listitem>
17040  </varlistentry>
17041  <varlistentry>
17042   <term><parameter>gfp_mask</parameter></term>
17043   <listitem>
17044    <para>
17045     Allocation gfp flags
17046    </para>
17047   </listitem>
17048  </varlistentry>
17049  <varlistentry>
17050   <term><parameter>order</parameter></term>
17051   <listitem>
17052    <para>
17053     Allocation size is (1 &lt;&lt; order) pages
17054    </para>
17055   </listitem>
17056  </varlistentry>
17057 </variablelist>
17058</refsect1>
17059<refsect1>
17060<title>Description</title>
17061<para>
17062   Managed get_free_pages.  Memory allocated with this function is
17063   automatically freed on driver detach.
17064</para>
17065</refsect1>
17066<refsect1>
17067<title>RETURNS</title>
17068<para>
17069   Address of allocated memory on success, 0 on failure.
17070</para>
17071</refsect1>
17072</refentry>
17073
17074<refentry id="API-devm-free-pages">
17075<refentryinfo>
17076 <title>LINUX</title>
17077 <productname>Kernel Hackers Manual</productname>
17078 <date>July 2017</date>
17079</refentryinfo>
17080<refmeta>
17081 <refentrytitle><phrase>devm_free_pages</phrase></refentrytitle>
17082 <manvolnum>9</manvolnum>
17083 <refmiscinfo class="version">4.4.14</refmiscinfo>
17084</refmeta>
17085<refnamediv>
17086 <refname>devm_free_pages</refname>
17087 <refpurpose>
17088     Resource-managed free_pages
17089 </refpurpose>
17090</refnamediv>
17091<refsynopsisdiv>
17092 <title>Synopsis</title>
17093  <funcsynopsis><funcprototype>
17094   <funcdef>void <function>devm_free_pages </function></funcdef>
17095   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
17096   <paramdef>unsigned long <parameter>addr</parameter></paramdef>
17097  </funcprototype></funcsynopsis>
17098</refsynopsisdiv>
17099<refsect1>
17100 <title>Arguments</title>
17101 <variablelist>
17102  <varlistentry>
17103   <term><parameter>dev</parameter></term>
17104   <listitem>
17105    <para>
17106     Device this memory belongs to
17107    </para>
17108   </listitem>
17109  </varlistentry>
17110  <varlistentry>
17111   <term><parameter>addr</parameter></term>
17112   <listitem>
17113    <para>
17114     Memory to free
17115    </para>
17116   </listitem>
17117  </varlistentry>
17118 </variablelist>
17119</refsect1>
17120<refsect1>
17121<title>Description</title>
17122<para>
17123   Free memory allocated with <function><link linkend="API-devm-get-free-pages">devm_get_free_pages</link></function>. Unlike free_pages,
17124   there is no need to supply the <parameter>order</parameter>.
17125</para>
17126</refsect1>
17127</refentry>
17128
17129     </sect1>
17130
17131  </chapter>
17132
17133  <chapter id="devdrivers">
17134     <title>Device drivers infrastructure</title>
17135     <sect1><title>The Basic Device Driver-Model Structures </title>
17136<!-- include/linux/device.h -->
17137<refentry id="API-struct-bus-type">
17138<refentryinfo>
17139 <title>LINUX</title>
17140 <productname>Kernel Hackers Manual</productname>
17141 <date>July 2017</date>
17142</refentryinfo>
17143<refmeta>
17144 <refentrytitle><phrase>struct bus_type</phrase></refentrytitle>
17145 <manvolnum>9</manvolnum>
17146 <refmiscinfo class="version">4.4.14</refmiscinfo>
17147</refmeta>
17148<refnamediv>
17149 <refname>struct bus_type</refname>
17150 <refpurpose>
17151  The bus type of the device
17152 </refpurpose>
17153</refnamediv>
17154<refsynopsisdiv>
17155 <title>Synopsis</title>
17156  <programlisting>
17157struct bus_type {
17158  const char * name;
17159  const char * dev_name;
17160  struct device * dev_root;
17161  struct device_attribute * dev_attrs;
17162  const struct attribute_group ** bus_groups;
17163  const struct attribute_group ** dev_groups;
17164  const struct attribute_group ** drv_groups;
17165  int (* match) (struct device *dev, struct device_driver *drv);
17166  int (* uevent) (struct device *dev, struct kobj_uevent_env *env);
17167  int (* probe) (struct device *dev);
17168  int (* remove) (struct device *dev);
17169  void (* shutdown) (struct device *dev);
17170  int (* online) (struct device *dev);
17171  int (* offline) (struct device *dev);
17172  int (* suspend) (struct device *dev, pm_message_t state);
17173  int (* resume) (struct device *dev);
17174  const struct dev_pm_ops * pm;
17175  const struct iommu_ops * iommu_ops;
17176  struct subsys_private * p;
17177  struct lock_class_key lock_key;
17178};  </programlisting>
17179</refsynopsisdiv>
17180 <refsect1>
17181  <title>Members</title>
17182  <variablelist>
17183    <varlistentry>      <term>name</term>
17184      <listitem><para>
17185The name of the bus.
17186      </para></listitem>
17187    </varlistentry>
17188    <varlistentry>      <term>dev_name</term>
17189      <listitem><para>
17190Used for subsystems to enumerate devices like (<quote>foo<constant>u</constant></quote>, dev-&gt;id).
17191      </para></listitem>
17192    </varlistentry>
17193    <varlistentry>      <term>dev_root</term>
17194      <listitem><para>
17195Default device to use as the parent.
17196      </para></listitem>
17197    </varlistentry>
17198    <varlistentry>      <term>dev_attrs</term>
17199      <listitem><para>
17200Default attributes of the devices on the bus.
17201      </para></listitem>
17202    </varlistentry>
17203    <varlistentry>      <term>bus_groups</term>
17204      <listitem><para>
17205Default attributes of the bus.
17206      </para></listitem>
17207    </varlistentry>
17208    <varlistentry>      <term>dev_groups</term>
17209      <listitem><para>
17210Default attributes of the devices on the bus.
17211      </para></listitem>
17212    </varlistentry>
17213    <varlistentry>      <term>drv_groups</term>
17214      <listitem><para>
17215Default attributes of the device drivers on the bus.
17216      </para></listitem>
17217    </varlistentry>
17218    <varlistentry>      <term>match</term>
17219      <listitem><para>
17220Called, perhaps multiple times, whenever a new device or driver
17221is added for this bus. It should return a nonzero value if the
17222given device can be handled by the given driver.
17223      </para></listitem>
17224    </varlistentry>
17225    <varlistentry>      <term>uevent</term>
17226      <listitem><para>
17227Called when a device is added, removed, or a few other things
17228that generate uevents to add the environment variables.
17229      </para></listitem>
17230    </varlistentry>
17231    <varlistentry>      <term>probe</term>
17232      <listitem><para>
17233Called when a new device or driver add to this bus, and callback
17234the specific driver's probe to initial the matched device.
17235      </para></listitem>
17236    </varlistentry>
17237    <varlistentry>      <term>remove</term>
17238      <listitem><para>
17239Called when a device removed from this bus.
17240      </para></listitem>
17241    </varlistentry>
17242    <varlistentry>      <term>shutdown</term>
17243      <listitem><para>
17244Called at shut-down time to quiesce the device.
17245      </para></listitem>
17246    </varlistentry>
17247    <varlistentry>      <term>online</term>
17248      <listitem><para>
17249Called to put the device back online (after offlining it).
17250      </para></listitem>
17251    </varlistentry>
17252    <varlistentry>      <term>offline</term>
17253      <listitem><para>
17254Called to put the device offline for hot-removal. May fail.
17255      </para></listitem>
17256    </varlistentry>
17257    <varlistentry>      <term>suspend</term>
17258      <listitem><para>
17259Called when a device on this bus wants to go to sleep mode.
17260      </para></listitem>
17261    </varlistentry>
17262    <varlistentry>      <term>resume</term>
17263      <listitem><para>
17264Called to bring a device on this bus out of sleep mode.
17265      </para></listitem>
17266    </varlistentry>
17267    <varlistentry>      <term>pm</term>
17268      <listitem><para>
17269Power management operations of this bus, callback the specific
17270device driver's pm-ops.
17271      </para></listitem>
17272    </varlistentry>
17273    <varlistentry>      <term>iommu_ops</term>
17274      <listitem><para>
17275IOMMU specific operations for this bus, used to attach IOMMU
17276driver implementations to a bus and allow the driver to do
17277bus-specific setup
17278      </para></listitem>
17279    </varlistentry>
17280    <varlistentry>      <term>p</term>
17281      <listitem><para>
17282The private data of the driver core, only the driver core can
17283touch this.
17284      </para></listitem>
17285    </varlistentry>
17286    <varlistentry>      <term>lock_key</term>
17287      <listitem><para>
17288Lock class key for use by the lock validator
17289      </para></listitem>
17290    </varlistentry>
17291  </variablelist>
17292 </refsect1>
17293<refsect1>
17294<title>Description</title>
17295<para>
17296   A bus is a channel between the processor and one or more devices. For the
17297   purposes of the device model, all devices are connected via a bus, even if
17298   it is an internal, virtual, <quote>platform</quote> bus. Buses can plug into each other.
17299   A USB controller is usually a PCI device, for example. The device model
17300   represents the actual connections between buses and the devices they control.
17301   A bus is represented by the bus_type structure. It contains the name, the
17302   default attributes, the bus' methods, PM operations, and the driver core's
17303   private data.
17304</para>
17305</refsect1>
17306</refentry>
17307
17308<refentry id="API-enum-probe-type">
17309<refentryinfo>
17310 <title>LINUX</title>
17311 <productname>Kernel Hackers Manual</productname>
17312 <date>July 2017</date>
17313</refentryinfo>
17314<refmeta>
17315 <refentrytitle><phrase>enum probe_type</phrase></refentrytitle>
17316 <manvolnum>9</manvolnum>
17317 <refmiscinfo class="version">4.4.14</refmiscinfo>
17318</refmeta>
17319<refnamediv>
17320 <refname>enum probe_type</refname>
17321 <refpurpose>
17322     device driver probe type to try Device drivers may opt in for special handling of their respective probe routines. This tells the core what to expect and prefer.
17323 </refpurpose>
17324</refnamediv>
17325<refsynopsisdiv>
17326 <title>Synopsis</title>
17327  <programlisting>
17328enum probe_type {
17329  PROBE_DEFAULT_STRATEGY,
17330  PROBE_PREFER_ASYNCHRONOUS,
17331  PROBE_FORCE_SYNCHRONOUS
17332};  </programlisting>
17333</refsynopsisdiv>
17334<refsect1>
17335 <title>Constants</title>
17336  <variablelist>
17337    <varlistentry>      <term>PROBE_DEFAULT_STRATEGY</term>
17338      <listitem><para>
17339   Used by drivers that work equally well
17340   whether probed synchronously or asynchronously.
17341      </para></listitem>
17342    </varlistentry>
17343    <varlistentry>      <term>PROBE_PREFER_ASYNCHRONOUS</term>
17344      <listitem><para>
17345   Drivers for <quote>slow</quote> devices which
17346   probing order is not essential for booting the system may
17347   opt into executing their probes asynchronously.
17348      </para></listitem>
17349    </varlistentry>
17350    <varlistentry>      <term>PROBE_FORCE_SYNCHRONOUS</term>
17351      <listitem><para>
17352   Use this to annotate drivers that need
17353   their probe routines to run synchronously with driver and
17354   device registration (with the exception of -EPROBE_DEFER
17355   handling - re-probing always ends up being done asynchronously).
17356      </para></listitem>
17357    </varlistentry>
17358  </variablelist>
17359</refsect1>
17360<refsect1>
17361<title>Description</title>
17362<para>
17363   Note that the end goal is to switch the kernel to use asynchronous
17364   probing by default, so annotating drivers with
17365   <constant>PROBE_PREFER_ASYNCHRONOUS</constant> is a temporary measure that allows us
17366   to speed up boot process while we are validating the rest of the
17367   drivers.
17368</para>
17369</refsect1>
17370</refentry>
17371
17372<refentry id="API-struct-device-driver">
17373<refentryinfo>
17374 <title>LINUX</title>
17375 <productname>Kernel Hackers Manual</productname>
17376 <date>July 2017</date>
17377</refentryinfo>
17378<refmeta>
17379 <refentrytitle><phrase>struct device_driver</phrase></refentrytitle>
17380 <manvolnum>9</manvolnum>
17381 <refmiscinfo class="version">4.4.14</refmiscinfo>
17382</refmeta>
17383<refnamediv>
17384 <refname>struct device_driver</refname>
17385 <refpurpose>
17386     The basic device driver structure
17387 </refpurpose>
17388</refnamediv>
17389<refsynopsisdiv>
17390 <title>Synopsis</title>
17391  <programlisting>
17392struct device_driver {
17393  const char * name;
17394  struct bus_type * bus;
17395  struct module * owner;
17396  const char * mod_name;
17397  bool suppress_bind_attrs;
17398  enum probe_type probe_type;
17399  const struct of_device_id * of_match_table;
17400  const struct acpi_device_id * acpi_match_table;
17401  int (* probe) (struct device *dev);
17402  int (* remove) (struct device *dev);
17403  void (* shutdown) (struct device *dev);
17404  int (* suspend) (struct device *dev, pm_message_t state);
17405  int (* resume) (struct device *dev);
17406  const struct attribute_group ** groups;
17407  const struct dev_pm_ops * pm;
17408  struct driver_private * p;
17409};  </programlisting>
17410</refsynopsisdiv>
17411 <refsect1>
17412  <title>Members</title>
17413  <variablelist>
17414    <varlistentry>      <term>name</term>
17415      <listitem><para>
17416   Name of the device driver.
17417      </para></listitem>
17418    </varlistentry>
17419    <varlistentry>      <term>bus</term>
17420      <listitem><para>
17421   The bus which the device of this driver belongs to.
17422      </para></listitem>
17423    </varlistentry>
17424    <varlistentry>      <term>owner</term>
17425      <listitem><para>
17426   The module owner.
17427      </para></listitem>
17428    </varlistentry>
17429    <varlistentry>      <term>mod_name</term>
17430      <listitem><para>
17431   Used for built-in modules.
17432      </para></listitem>
17433    </varlistentry>
17434    <varlistentry>      <term>suppress_bind_attrs</term>
17435      <listitem><para>
17436   Disables bind/unbind via sysfs.
17437      </para></listitem>
17438    </varlistentry>
17439    <varlistentry>      <term>probe_type</term>
17440      <listitem><para>
17441   Type of the probe (synchronous or asynchronous) to use.
17442      </para></listitem>
17443    </varlistentry>
17444    <varlistentry>      <term>of_match_table</term>
17445      <listitem><para>
17446   The open firmware table.
17447      </para></listitem>
17448    </varlistentry>
17449    <varlistentry>      <term>acpi_match_table</term>
17450      <listitem><para>
17451   The ACPI match table.
17452      </para></listitem>
17453    </varlistentry>
17454    <varlistentry>      <term>probe</term>
17455      <listitem><para>
17456   Called to query the existence of a specific device,
17457   whether this driver can work with it, and bind the driver
17458   to a specific device.
17459      </para></listitem>
17460    </varlistentry>
17461    <varlistentry>      <term>remove</term>
17462      <listitem><para>
17463   Called when the device is removed from the system to
17464   unbind a device from this driver.
17465      </para></listitem>
17466    </varlistentry>
17467    <varlistentry>      <term>shutdown</term>
17468      <listitem><para>
17469   Called at shut-down time to quiesce the device.
17470      </para></listitem>
17471    </varlistentry>
17472    <varlistentry>      <term>suspend</term>
17473      <listitem><para>
17474   Called to put the device to sleep mode. Usually to a
17475   low power state.
17476      </para></listitem>
17477    </varlistentry>
17478    <varlistentry>      <term>resume</term>
17479      <listitem><para>
17480   Called to bring a device from sleep mode.
17481      </para></listitem>
17482    </varlistentry>
17483    <varlistentry>      <term>groups</term>
17484      <listitem><para>
17485   Default attributes that get created by the driver core
17486   automatically.
17487      </para></listitem>
17488    </varlistentry>
17489    <varlistentry>      <term>pm</term>
17490      <listitem><para>
17491   Power management operations of the device which matched
17492   this driver.
17493      </para></listitem>
17494    </varlistentry>
17495    <varlistentry>      <term>p</term>
17496      <listitem><para>
17497   Driver core's private data, no one other than the driver
17498   core can touch this.
17499      </para></listitem>
17500    </varlistentry>
17501  </variablelist>
17502 </refsect1>
17503<refsect1>
17504<title>Description</title>
17505<para>
17506   The device driver-model tracks all of the drivers known to the system.
17507   The main reason for this tracking is to enable the driver core to match
17508   up drivers with new devices. Once drivers are known objects within the
17509   system, however, a number of other things become possible. Device drivers
17510   can export information and configuration variables that are independent
17511   of any specific device.
17512</para>
17513</refsect1>
17514</refentry>
17515
17516<refentry id="API-struct-subsys-interface">
17517<refentryinfo>
17518 <title>LINUX</title>
17519 <productname>Kernel Hackers Manual</productname>
17520 <date>July 2017</date>
17521</refentryinfo>
17522<refmeta>
17523 <refentrytitle><phrase>struct subsys_interface</phrase></refentrytitle>
17524 <manvolnum>9</manvolnum>
17525 <refmiscinfo class="version">4.4.14</refmiscinfo>
17526</refmeta>
17527<refnamediv>
17528 <refname>struct subsys_interface</refname>
17529 <refpurpose>
17530     interfaces to device functions
17531 </refpurpose>
17532</refnamediv>
17533<refsynopsisdiv>
17534 <title>Synopsis</title>
17535  <programlisting>
17536struct subsys_interface {
17537  const char * name;
17538  struct bus_type * subsys;
17539  struct list_head node;
17540  int (* add_dev) (struct device *dev, struct subsys_interface *sif);
17541  void (* remove_dev) (struct device *dev, struct subsys_interface *sif);
17542};  </programlisting>
17543</refsynopsisdiv>
17544 <refsect1>
17545  <title>Members</title>
17546  <variablelist>
17547    <varlistentry>      <term>name</term>
17548      <listitem><para>
17549   name of the device function
17550      </para></listitem>
17551    </varlistentry>
17552    <varlistentry>      <term>subsys</term>
17553      <listitem><para>
17554   subsytem of the devices to attach to
17555      </para></listitem>
17556    </varlistentry>
17557    <varlistentry>      <term>node</term>
17558      <listitem><para>
17559   the list of functions registered at the subsystem
17560      </para></listitem>
17561    </varlistentry>
17562    <varlistentry>      <term>add_dev</term>
17563      <listitem><para>
17564   device hookup to device function handler
17565      </para></listitem>
17566    </varlistentry>
17567    <varlistentry>      <term>remove_dev</term>
17568      <listitem><para>
17569   device hookup to device function handler
17570      </para></listitem>
17571    </varlistentry>
17572  </variablelist>
17573 </refsect1>
17574<refsect1>
17575<title>Description</title>
17576<para>
17577   Simple interfaces attached to a subsystem. Multiple interfaces can
17578   attach to a subsystem and its devices. Unlike drivers, they do not
17579   exclusively claim or control devices. Interfaces usually represent
17580   a specific functionality of a subsystem/class of devices.
17581</para>
17582</refsect1>
17583</refentry>
17584
17585<refentry id="API-struct-class">
17586<refentryinfo>
17587 <title>LINUX</title>
17588 <productname>Kernel Hackers Manual</productname>
17589 <date>July 2017</date>
17590</refentryinfo>
17591<refmeta>
17592 <refentrytitle><phrase>struct class</phrase></refentrytitle>
17593 <manvolnum>9</manvolnum>
17594 <refmiscinfo class="version">4.4.14</refmiscinfo>
17595</refmeta>
17596<refnamediv>
17597 <refname>struct class</refname>
17598 <refpurpose>
17599     device classes
17600 </refpurpose>
17601</refnamediv>
17602<refsynopsisdiv>
17603 <title>Synopsis</title>
17604  <programlisting>
17605struct class {
17606  const char * name;
17607  struct module * owner;
17608  struct class_attribute * class_attrs;
17609  const struct attribute_group ** dev_groups;
17610  struct kobject * dev_kobj;
17611  int (* dev_uevent) (struct device *dev, struct kobj_uevent_env *env);
17612  char *(* devnode) (struct device *dev, umode_t *mode);
17613  void (* class_release) (struct class *class);
17614  void (* dev_release) (struct device *dev);
17615  int (* suspend) (struct device *dev, pm_message_t state);
17616  int (* resume) (struct device *dev);
17617  const struct kobj_ns_type_operations * ns_type;
17618  const void *(* namespace) (struct device *dev);
17619  const struct dev_pm_ops * pm;
17620  struct subsys_private * p;
17621};  </programlisting>
17622</refsynopsisdiv>
17623 <refsect1>
17624  <title>Members</title>
17625  <variablelist>
17626    <varlistentry>      <term>name</term>
17627      <listitem><para>
17628   Name of the class.
17629      </para></listitem>
17630    </varlistentry>
17631    <varlistentry>      <term>owner</term>
17632      <listitem><para>
17633   The module owner.
17634      </para></listitem>
17635    </varlistentry>
17636    <varlistentry>      <term>class_attrs</term>
17637      <listitem><para>
17638   Default attributes of this class.
17639      </para></listitem>
17640    </varlistentry>
17641    <varlistentry>      <term>dev_groups</term>
17642      <listitem><para>
17643   Default attributes of the devices that belong to the class.
17644      </para></listitem>
17645    </varlistentry>
17646    <varlistentry>      <term>dev_kobj</term>
17647      <listitem><para>
17648   The kobject that represents this class and links it into the hierarchy.
17649      </para></listitem>
17650    </varlistentry>
17651    <varlistentry>      <term>dev_uevent</term>
17652      <listitem><para>
17653   Called when a device is added, removed from this class, or a
17654   few other things that generate uevents to add the environment
17655   variables.
17656      </para></listitem>
17657    </varlistentry>
17658    <varlistentry>      <term>devnode</term>
17659      <listitem><para>
17660   Callback to provide the devtmpfs.
17661      </para></listitem>
17662    </varlistentry>
17663    <varlistentry>      <term>class_release</term>
17664      <listitem><para>
17665   Called to release this class.
17666      </para></listitem>
17667    </varlistentry>
17668    <varlistentry>      <term>dev_release</term>
17669      <listitem><para>
17670   Called to release the device.
17671      </para></listitem>
17672    </varlistentry>
17673    <varlistentry>      <term>suspend</term>
17674      <listitem><para>
17675   Used to put the device to sleep mode, usually to a low power
17676   state.
17677      </para></listitem>
17678    </varlistentry>
17679    <varlistentry>      <term>resume</term>
17680      <listitem><para>
17681   Used to bring the device from the sleep mode.
17682      </para></listitem>
17683    </varlistentry>
17684    <varlistentry>      <term>ns_type</term>
17685      <listitem><para>
17686   Callbacks so sysfs can detemine namespaces.
17687      </para></listitem>
17688    </varlistentry>
17689    <varlistentry>      <term>namespace</term>
17690      <listitem><para>
17691   Namespace of the device belongs to this class.
17692      </para></listitem>
17693    </varlistentry>
17694    <varlistentry>      <term>pm</term>
17695      <listitem><para>
17696   The default device power management operations of this class.
17697      </para></listitem>
17698    </varlistentry>
17699    <varlistentry>      <term>p</term>
17700      <listitem><para>
17701   The private data of the driver core, no one other than the
17702   driver core can touch this.
17703      </para></listitem>
17704    </varlistentry>
17705  </variablelist>
17706 </refsect1>
17707<refsect1>
17708<title>Description</title>
17709<para>
17710   A class is a higher-level view of a device that abstracts out low-level
17711   implementation details. Drivers may see a SCSI disk or an ATA disk, but,
17712   at the class level, they are all simply disks. Classes allow user space
17713   to work with devices based on what they do, rather than how they are
17714   connected or how they work.
17715</para>
17716</refsect1>
17717</refentry>
17718
17719<refentry id="API-struct-device">
17720<refentryinfo>
17721 <title>LINUX</title>
17722 <productname>Kernel Hackers Manual</productname>
17723 <date>July 2017</date>
17724</refentryinfo>
17725<refmeta>
17726 <refentrytitle><phrase>struct device</phrase></refentrytitle>
17727 <manvolnum>9</manvolnum>
17728 <refmiscinfo class="version">4.4.14</refmiscinfo>
17729</refmeta>
17730<refnamediv>
17731 <refname>struct device</refname>
17732 <refpurpose>
17733     The basic device structure
17734 </refpurpose>
17735</refnamediv>
17736<refsynopsisdiv>
17737 <title>Synopsis</title>
17738  <programlisting>
17739struct device {
17740  struct device * parent;
17741  struct device_private * p;
17742  struct kobject kobj;
17743  const char * init_name;
17744  const struct device_type * type;
17745  struct mutex mutex;
17746  struct bus_type * bus;
17747  struct device_driver * driver;
17748  void * platform_data;
17749  void * driver_data;
17750  struct dev_pm_info power;
17751  struct dev_pm_domain * pm_domain;
17752#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
17753  struct irq_domain * msi_domain;
17754#endif
17755#ifdef CONFIG_PINCTRL
17756  struct dev_pin_info * pins;
17757#endif
17758#ifdef CONFIG_GENERIC_MSI_IRQ
17759  struct list_head msi_list;
17760#endif
17761#ifdef CONFIG_NUMA
17762  int numa_node;
17763#endif
17764  u64 * dma_mask;
17765  u64 coherent_dma_mask;
17766  unsigned long dma_pfn_offset;
17767  struct device_dma_parameters * dma_parms;
17768  struct list_head dma_pools;
17769  struct dma_coherent_mem * dma_mem;
17770#ifdef CONFIG_DMA_CMA
17771  struct cma * cma_area;
17772#endif
17773  struct dev_archdata archdata;
17774  struct device_node * of_node;
17775  struct fwnode_handle * fwnode;
17776  dev_t devt;
17777  u32 id;
17778  spinlock_t devres_lock;
17779  struct list_head devres_head;
17780  struct klist_node knode_class;
17781  struct class * class;
17782  const struct attribute_group ** groups;
17783  void (* release) (struct device *dev);
17784  struct iommu_group * iommu_group;
17785  bool offline_disabled:1;
17786  bool offline:1;
17787};  </programlisting>
17788</refsynopsisdiv>
17789 <refsect1>
17790  <title>Members</title>
17791  <variablelist>
17792    <varlistentry>      <term>parent</term>
17793      <listitem><para>
17794   The device's <quote>parent</quote> device, the device to which it is attached.
17795   In most cases, a parent device is some sort of bus or host
17796   controller. If parent is NULL, the device, is a top-level device,
17797   which is not usually what you want.
17798      </para></listitem>
17799    </varlistentry>
17800    <varlistentry>      <term>p</term>
17801      <listitem><para>
17802   Holds the private data of the driver core portions of the device.
17803   See the comment of the struct device_private for detail.
17804      </para></listitem>
17805    </varlistentry>
17806    <varlistentry>      <term>kobj</term>
17807      <listitem><para>
17808   A top-level, abstract class from which other classes are derived.
17809      </para></listitem>
17810    </varlistentry>
17811    <varlistentry>      <term>init_name</term>
17812      <listitem><para>
17813   Initial name of the device.
17814      </para></listitem>
17815    </varlistentry>
17816    <varlistentry>      <term>type</term>
17817      <listitem><para>
17818   The type of device.
17819   This identifies the device type and carries type-specific
17820   information.
17821      </para></listitem>
17822    </varlistentry>
17823    <varlistentry>      <term>mutex</term>
17824      <listitem><para>
17825   Mutex to synchronize calls to its driver.
17826      </para></listitem>
17827    </varlistentry>
17828    <varlistentry>      <term>bus</term>
17829      <listitem><para>
17830   Type of bus device is on.
17831      </para></listitem>
17832    </varlistentry>
17833    <varlistentry>      <term>driver</term>
17834      <listitem><para>
17835   Which driver has allocated this
17836      </para></listitem>
17837    </varlistentry>
17838    <varlistentry>      <term>platform_data</term>
17839      <listitem><para>
17840   Platform data specific to the device.
17841      </para></listitem>
17842    </varlistentry>
17843    <varlistentry>      <term>driver_data</term>
17844      <listitem><para>
17845   Private pointer for driver specific info.
17846      </para></listitem>
17847    </varlistentry>
17848    <varlistentry>      <term>power</term>
17849      <listitem><para>
17850   For device power management.
17851   See Documentation/power/devices.txt for details.
17852      </para></listitem>
17853    </varlistentry>
17854    <varlistentry>      <term>pm_domain</term>
17855      <listitem><para>
17856   Provide callbacks that are executed during system suspend,
17857   hibernation, system resume and during runtime PM transitions
17858   along with subsystem-level and driver-level callbacks.
17859      </para></listitem>
17860    </varlistentry>
17861    <varlistentry>      <term>msi_domain</term>
17862      <listitem><para>
17863   The generic MSI domain this device is using.
17864      </para></listitem>
17865    </varlistentry>
17866    <varlistentry>      <term>pins</term>
17867      <listitem><para>
17868   For device pin management.
17869   See Documentation/pinctrl.txt for details.
17870      </para></listitem>
17871    </varlistentry>
17872    <varlistentry>      <term>msi_list</term>
17873      <listitem><para>
17874   Hosts MSI descriptors
17875      </para></listitem>
17876    </varlistentry>
17877    <varlistentry>      <term>numa_node</term>
17878      <listitem><para>
17879   NUMA node this device is close to.
17880      </para></listitem>
17881    </varlistentry>
17882    <varlistentry>      <term>dma_mask</term>
17883      <listitem><para>
17884   Dma mask (if dma'ble device).
17885      </para></listitem>
17886    </varlistentry>
17887    <varlistentry>      <term>coherent_dma_mask</term>
17888      <listitem><para>
17889   Like dma_mask, but for alloc_coherent mapping as not all
17890   hardware supports 64-bit addresses for consistent allocations
17891   such descriptors.
17892      </para></listitem>
17893    </varlistentry>
17894    <varlistentry>      <term>dma_pfn_offset</term>
17895      <listitem><para>
17896   offset of DMA memory range relatively of RAM
17897      </para></listitem>
17898    </varlistentry>
17899    <varlistentry>      <term>dma_parms</term>
17900      <listitem><para>
17901   A low level driver may set these to teach IOMMU code about
17902   segment limitations.
17903      </para></listitem>
17904    </varlistentry>
17905    <varlistentry>      <term>dma_pools</term>
17906      <listitem><para>
17907   Dma pools (if dma'ble device).
17908      </para></listitem>
17909    </varlistentry>
17910    <varlistentry>      <term>dma_mem</term>
17911      <listitem><para>
17912   Internal for coherent mem override.
17913      </para></listitem>
17914    </varlistentry>
17915    <varlistentry>      <term>cma_area</term>
17916      <listitem><para>
17917   Contiguous memory area for dma allocations
17918      </para></listitem>
17919    </varlistentry>
17920    <varlistentry>      <term>archdata</term>
17921      <listitem><para>
17922   For arch-specific additions.
17923      </para></listitem>
17924    </varlistentry>
17925    <varlistentry>      <term>of_node</term>
17926      <listitem><para>
17927   Associated device tree node.
17928      </para></listitem>
17929    </varlistentry>
17930    <varlistentry>      <term>fwnode</term>
17931      <listitem><para>
17932   Associated device node supplied by platform firmware.
17933      </para></listitem>
17934    </varlistentry>
17935    <varlistentry>      <term>devt</term>
17936      <listitem><para>
17937   For creating the sysfs <quote>dev</quote>.
17938      </para></listitem>
17939    </varlistentry>
17940    <varlistentry>      <term>id</term>
17941      <listitem><para>
17942   device instance
17943      </para></listitem>
17944    </varlistentry>
17945    <varlistentry>      <term>devres_lock</term>
17946      <listitem><para>
17947   Spinlock to protect the resource of the device.
17948      </para></listitem>
17949    </varlistentry>
17950    <varlistentry>      <term>devres_head</term>
17951      <listitem><para>
17952   The resources list of the device.
17953      </para></listitem>
17954    </varlistentry>
17955    <varlistentry>      <term>knode_class</term>
17956      <listitem><para>
17957   The node used to add the device to the class list.
17958      </para></listitem>
17959    </varlistentry>
17960    <varlistentry>      <term>class</term>
17961      <listitem><para>
17962   The class of the device.
17963      </para></listitem>
17964    </varlistentry>
17965    <varlistentry>      <term>groups</term>
17966      <listitem><para>
17967   Optional attribute groups.
17968      </para></listitem>
17969    </varlistentry>
17970    <varlistentry>      <term>release</term>
17971      <listitem><para>
17972   Callback to free the device after all references have
17973   gone away. This should be set by the allocator of the
17974   device (i.e. the bus driver that discovered the device).
17975      </para></listitem>
17976    </varlistentry>
17977    <varlistentry>      <term>iommu_group</term>
17978      <listitem><para>
17979   IOMMU group the device belongs to.
17980      </para></listitem>
17981    </varlistentry>
17982    <varlistentry>      <term>offline_disabled</term>
17983      <listitem><para>
17984   If set, the device is permanently online.
17985      </para></listitem>
17986    </varlistentry>
17987    <varlistentry>      <term>offline</term>
17988      <listitem><para>
17989   Set after successful invocation of bus type's .<function>offline</function>.
17990      </para></listitem>
17991    </varlistentry>
17992  </variablelist>
17993 </refsect1>
17994<refsect1>
17995<title>Example</title>
17996<informalexample><programlisting>
17997   For devices on custom boards, as typical of embedded
17998   		and SOC based hardware, Linux often uses platform_data to point
17999   		to board-specific structures describing devices and how they
18000   		are wired.  That can include what ports are available, chip
18001   		variants, which GPIO pins act in what additional roles, and so
18002   		on.  This shrinks the <quote>Board Support Packages</quote> (BSPs) and
18003   		minimizes board-specific #ifdefs in drivers.
18004</programlisting></informalexample>
18005</refsect1>
18006<refsect1>
18007<title>Description</title>
18008<para>
18009   At the lowest level, every device in a Linux system is represented by an
18010   instance of struct device. The device structure contains the information
18011   that the device model core needs to model the system. Most subsystems,
18012   however, track additional information about the devices they host. As a
18013   result, it is rare for devices to be represented by bare device structures;
18014   instead, that structure, like kobject structures, is usually embedded within
18015   a higher-level representation of the device.
18016</para>
18017</refsect1>
18018</refentry>
18019
18020<refentry id="API-module-driver">
18021<refentryinfo>
18022 <title>LINUX</title>
18023 <productname>Kernel Hackers Manual</productname>
18024 <date>July 2017</date>
18025</refentryinfo>
18026<refmeta>
18027 <refentrytitle><phrase>module_driver</phrase></refentrytitle>
18028 <manvolnum>9</manvolnum>
18029 <refmiscinfo class="version">4.4.14</refmiscinfo>
18030</refmeta>
18031<refnamediv>
18032 <refname>module_driver</refname>
18033 <refpurpose>
18034     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>.
18035 </refpurpose>
18036</refnamediv>
18037<refsynopsisdiv>
18038 <title>Synopsis</title>
18039  <funcsynopsis><funcprototype>
18040   <funcdef> <function>module_driver </function></funcdef>
18041   <paramdef> <parameter>__driver</parameter></paramdef>
18042   <paramdef> <parameter>__register</parameter></paramdef>
18043   <paramdef> <parameter>__unregister</parameter></paramdef>
18044   <paramdef> <parameter>...</parameter></paramdef>
18045  </funcprototype></funcsynopsis>
18046</refsynopsisdiv>
18047<refsect1>
18048 <title>Arguments</title>
18049 <variablelist>
18050  <varlistentry>
18051   <term><parameter>__driver</parameter></term>
18052   <listitem>
18053    <para>
18054     driver name
18055    </para>
18056   </listitem>
18057  </varlistentry>
18058  <varlistentry>
18059   <term><parameter>__register</parameter></term>
18060   <listitem>
18061    <para>
18062     register function for this driver type
18063    </para>
18064   </listitem>
18065  </varlistentry>
18066  <varlistentry>
18067   <term><parameter>__unregister</parameter></term>
18068   <listitem>
18069    <para>
18070     unregister function for this driver type
18071     @...: Additional arguments to be passed to __register and __unregister.
18072    </para>
18073   </listitem>
18074  </varlistentry>
18075  <varlistentry>
18076   <term><parameter>...</parameter></term>
18077   <listitem>
18078    <para>
18079     variable arguments
18080    </para>
18081   </listitem>
18082  </varlistentry>
18083 </variablelist>
18084</refsect1>
18085<refsect1>
18086<title>Description</title>
18087<para>
18088   Use this macro to construct bus specific macros for registering
18089   drivers, and do not use it on its own.
18090</para>
18091</refsect1>
18092</refentry>
18093
18094<refentry id="API-builtin-driver">
18095<refentryinfo>
18096 <title>LINUX</title>
18097 <productname>Kernel Hackers Manual</productname>
18098 <date>July 2017</date>
18099</refentryinfo>
18100<refmeta>
18101 <refentrytitle><phrase>builtin_driver</phrase></refentrytitle>
18102 <manvolnum>9</manvolnum>
18103 <refmiscinfo class="version">4.4.14</refmiscinfo>
18104</refmeta>
18105<refnamediv>
18106 <refname>builtin_driver</refname>
18107 <refpurpose>
18108     Helper macro for drivers that don't do anything special in init and have no exit. This eliminates some boilerplate. Each driver may only use this macro once, and calling it replaces device_initcall (or in some cases, the legacy __initcall). This is meant to be a direct parallel of <function><link linkend="API-module-driver">module_driver</link></function> above but without the __exit stuff that is not used for builtin cases.
18109 </refpurpose>
18110</refnamediv>
18111<refsynopsisdiv>
18112 <title>Synopsis</title>
18113  <funcsynopsis><funcprototype>
18114   <funcdef> <function>builtin_driver </function></funcdef>
18115   <paramdef> <parameter>__driver</parameter></paramdef>
18116   <paramdef> <parameter>__register</parameter></paramdef>
18117   <paramdef> <parameter>...</parameter></paramdef>
18118  </funcprototype></funcsynopsis>
18119</refsynopsisdiv>
18120<refsect1>
18121 <title>Arguments</title>
18122 <variablelist>
18123  <varlistentry>
18124   <term><parameter>__driver</parameter></term>
18125   <listitem>
18126    <para>
18127     driver name
18128    </para>
18129   </listitem>
18130  </varlistentry>
18131  <varlistentry>
18132   <term><parameter>__register</parameter></term>
18133   <listitem>
18134    <para>
18135     register function for this driver type
18136     @...: Additional arguments to be passed to __register
18137    </para>
18138   </listitem>
18139  </varlistentry>
18140  <varlistentry>
18141   <term><parameter>...</parameter></term>
18142   <listitem>
18143    <para>
18144     variable arguments
18145    </para>
18146   </listitem>
18147  </varlistentry>
18148 </variablelist>
18149</refsect1>
18150<refsect1>
18151<title>Description</title>
18152<para>
18153   Use this macro to construct bus specific macros for registering
18154   drivers, and do not use it on its own.
18155</para>
18156</refsect1>
18157</refentry>
18158
18159     </sect1>
18160     <sect1><title>Device Drivers Base</title>
18161<!-- drivers/base/init.c -->
18162<refentry id="API-driver-init">
18163<refentryinfo>
18164 <title>LINUX</title>
18165 <productname>Kernel Hackers Manual</productname>
18166 <date>July 2017</date>
18167</refentryinfo>
18168<refmeta>
18169 <refentrytitle><phrase>driver_init</phrase></refentrytitle>
18170 <manvolnum>9</manvolnum>
18171 <refmiscinfo class="version">4.4.14</refmiscinfo>
18172</refmeta>
18173<refnamediv>
18174 <refname>driver_init</refname>
18175 <refpurpose>
18176  initialize driver model.
18177 </refpurpose>
18178</refnamediv>
18179<refsynopsisdiv>
18180 <title>Synopsis</title>
18181  <funcsynopsis><funcprototype>
18182   <funcdef>void <function>driver_init </function></funcdef>
18183   <paramdef> <parameter>void</parameter></paramdef>
18184  </funcprototype></funcsynopsis>
18185</refsynopsisdiv>
18186<refsect1>
18187 <title>Arguments</title>
18188 <variablelist>
18189  <varlistentry>
18190   <term><parameter>void</parameter></term>
18191   <listitem>
18192    <para>
18193     no arguments
18194    </para>
18195   </listitem>
18196  </varlistentry>
18197 </variablelist>
18198</refsect1>
18199<refsect1>
18200<title>Description</title>
18201<para>
18202   </para><para>
18203
18204   Call the driver model init functions to initialize their
18205   subsystems. Called early from init/main.c.
18206</para>
18207</refsect1>
18208</refentry>
18209
18210<!-- drivers/base/driver.c -->
18211<refentry id="API-driver-for-each-device">
18212<refentryinfo>
18213 <title>LINUX</title>
18214 <productname>Kernel Hackers Manual</productname>
18215 <date>July 2017</date>
18216</refentryinfo>
18217<refmeta>
18218 <refentrytitle><phrase>driver_for_each_device</phrase></refentrytitle>
18219 <manvolnum>9</manvolnum>
18220 <refmiscinfo class="version">4.4.14</refmiscinfo>
18221</refmeta>
18222<refnamediv>
18223 <refname>driver_for_each_device</refname>
18224 <refpurpose>
18225  Iterator for devices bound to a driver.
18226 </refpurpose>
18227</refnamediv>
18228<refsynopsisdiv>
18229 <title>Synopsis</title>
18230  <funcsynopsis><funcprototype>
18231   <funcdef>int <function>driver_for_each_device </function></funcdef>
18232   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>drv</parameter></paramdef>
18233   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
18234   <paramdef>void * <parameter>data</parameter></paramdef>
18235   <paramdef>int (*<parameter>fn</parameter>)
18236     <funcparams>struct device *, void *</funcparams></paramdef>
18237  </funcprototype></funcsynopsis>
18238</refsynopsisdiv>
18239<refsect1>
18240 <title>Arguments</title>
18241 <variablelist>
18242  <varlistentry>
18243   <term><parameter>drv</parameter></term>
18244   <listitem>
18245    <para>
18246     Driver we're iterating.
18247    </para>
18248   </listitem>
18249  </varlistentry>
18250  <varlistentry>
18251   <term><parameter>start</parameter></term>
18252   <listitem>
18253    <para>
18254     Device to begin with
18255    </para>
18256   </listitem>
18257  </varlistentry>
18258  <varlistentry>
18259   <term><parameter>data</parameter></term>
18260   <listitem>
18261    <para>
18262     Data to pass to the callback.
18263    </para>
18264   </listitem>
18265  </varlistentry>
18266  <varlistentry>
18267   <term><parameter>fn</parameter></term>
18268   <listitem>
18269    <para>
18270     Function to call for each device.
18271    </para>
18272   </listitem>
18273  </varlistentry>
18274 </variablelist>
18275</refsect1>
18276<refsect1>
18277<title>Description</title>
18278<para>
18279   Iterate over the <parameter>drv</parameter>'s list of devices calling <parameter>fn</parameter> for each one.
18280</para>
18281</refsect1>
18282</refentry>
18283
18284<refentry id="API-driver-find-device">
18285<refentryinfo>
18286 <title>LINUX</title>
18287 <productname>Kernel Hackers Manual</productname>
18288 <date>July 2017</date>
18289</refentryinfo>
18290<refmeta>
18291 <refentrytitle><phrase>driver_find_device</phrase></refentrytitle>
18292 <manvolnum>9</manvolnum>
18293 <refmiscinfo class="version">4.4.14</refmiscinfo>
18294</refmeta>
18295<refnamediv>
18296 <refname>driver_find_device</refname>
18297 <refpurpose>
18298     device iterator for locating a particular device.
18299 </refpurpose>
18300</refnamediv>
18301<refsynopsisdiv>
18302 <title>Synopsis</title>
18303  <funcsynopsis><funcprototype>
18304   <funcdef><link linkend="API-struct-device">struct device</link> * <function>driver_find_device </function></funcdef>
18305   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>drv</parameter></paramdef>
18306   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
18307   <paramdef>void * <parameter>data</parameter></paramdef>
18308   <paramdef>int (*<parameter>match</parameter>)
18309     <funcparams>struct device *dev, void *data</funcparams></paramdef>
18310  </funcprototype></funcsynopsis>
18311</refsynopsisdiv>
18312<refsect1>
18313 <title>Arguments</title>
18314 <variablelist>
18315  <varlistentry>
18316   <term><parameter>drv</parameter></term>
18317   <listitem>
18318    <para>
18319     The device's driver
18320    </para>
18321   </listitem>
18322  </varlistentry>
18323  <varlistentry>
18324   <term><parameter>start</parameter></term>
18325   <listitem>
18326    <para>
18327     Device to begin with
18328    </para>
18329   </listitem>
18330  </varlistentry>
18331  <varlistentry>
18332   <term><parameter>data</parameter></term>
18333   <listitem>
18334    <para>
18335     Data to pass to match function
18336    </para>
18337   </listitem>
18338  </varlistentry>
18339  <varlistentry>
18340   <term><parameter>match</parameter></term>
18341   <listitem>
18342    <para>
18343     Callback function to check device
18344    </para>
18345   </listitem>
18346  </varlistentry>
18347 </variablelist>
18348</refsect1>
18349<refsect1>
18350<title>Description</title>
18351<para>
18352   This is similar to the <function><link linkend="API-driver-for-each-device">driver_for_each_device</link></function> function above, but
18353   it returns a reference to a device that is 'found' for later use, as
18354   determined by the <parameter>match</parameter> callback.
18355   </para><para>
18356
18357   The callback should return 0 if the device doesn't match and non-zero
18358   if it does.  If the callback returns non-zero, this function will
18359   return to the caller and not iterate over any more devices.
18360</para>
18361</refsect1>
18362</refentry>
18363
18364<refentry id="API-driver-create-file">
18365<refentryinfo>
18366 <title>LINUX</title>
18367 <productname>Kernel Hackers Manual</productname>
18368 <date>July 2017</date>
18369</refentryinfo>
18370<refmeta>
18371 <refentrytitle><phrase>driver_create_file</phrase></refentrytitle>
18372 <manvolnum>9</manvolnum>
18373 <refmiscinfo class="version">4.4.14</refmiscinfo>
18374</refmeta>
18375<refnamediv>
18376 <refname>driver_create_file</refname>
18377 <refpurpose>
18378     create sysfs file for driver.
18379 </refpurpose>
18380</refnamediv>
18381<refsynopsisdiv>
18382 <title>Synopsis</title>
18383  <funcsynopsis><funcprototype>
18384   <funcdef>int <function>driver_create_file </function></funcdef>
18385   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>drv</parameter></paramdef>
18386   <paramdef>const struct driver_attribute * <parameter>attr</parameter></paramdef>
18387  </funcprototype></funcsynopsis>
18388</refsynopsisdiv>
18389<refsect1>
18390 <title>Arguments</title>
18391 <variablelist>
18392  <varlistentry>
18393   <term><parameter>drv</parameter></term>
18394   <listitem>
18395    <para>
18396     driver.
18397    </para>
18398   </listitem>
18399  </varlistentry>
18400  <varlistentry>
18401   <term><parameter>attr</parameter></term>
18402   <listitem>
18403    <para>
18404     driver attribute descriptor.
18405    </para>
18406   </listitem>
18407  </varlistentry>
18408 </variablelist>
18409</refsect1>
18410</refentry>
18411
18412<refentry id="API-driver-remove-file">
18413<refentryinfo>
18414 <title>LINUX</title>
18415 <productname>Kernel Hackers Manual</productname>
18416 <date>July 2017</date>
18417</refentryinfo>
18418<refmeta>
18419 <refentrytitle><phrase>driver_remove_file</phrase></refentrytitle>
18420 <manvolnum>9</manvolnum>
18421 <refmiscinfo class="version">4.4.14</refmiscinfo>
18422</refmeta>
18423<refnamediv>
18424 <refname>driver_remove_file</refname>
18425 <refpurpose>
18426     remove sysfs file for driver.
18427 </refpurpose>
18428</refnamediv>
18429<refsynopsisdiv>
18430 <title>Synopsis</title>
18431  <funcsynopsis><funcprototype>
18432   <funcdef>void <function>driver_remove_file </function></funcdef>
18433   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>drv</parameter></paramdef>
18434   <paramdef>const struct driver_attribute * <parameter>attr</parameter></paramdef>
18435  </funcprototype></funcsynopsis>
18436</refsynopsisdiv>
18437<refsect1>
18438 <title>Arguments</title>
18439 <variablelist>
18440  <varlistentry>
18441   <term><parameter>drv</parameter></term>
18442   <listitem>
18443    <para>
18444     driver.
18445    </para>
18446   </listitem>
18447  </varlistentry>
18448  <varlistentry>
18449   <term><parameter>attr</parameter></term>
18450   <listitem>
18451    <para>
18452     driver attribute descriptor.
18453    </para>
18454   </listitem>
18455  </varlistentry>
18456 </variablelist>
18457</refsect1>
18458</refentry>
18459
18460<refentry id="API-driver-register">
18461<refentryinfo>
18462 <title>LINUX</title>
18463 <productname>Kernel Hackers Manual</productname>
18464 <date>July 2017</date>
18465</refentryinfo>
18466<refmeta>
18467 <refentrytitle><phrase>driver_register</phrase></refentrytitle>
18468 <manvolnum>9</manvolnum>
18469 <refmiscinfo class="version">4.4.14</refmiscinfo>
18470</refmeta>
18471<refnamediv>
18472 <refname>driver_register</refname>
18473 <refpurpose>
18474     register driver with bus
18475 </refpurpose>
18476</refnamediv>
18477<refsynopsisdiv>
18478 <title>Synopsis</title>
18479  <funcsynopsis><funcprototype>
18480   <funcdef>int <function>driver_register </function></funcdef>
18481   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>drv</parameter></paramdef>
18482  </funcprototype></funcsynopsis>
18483</refsynopsisdiv>
18484<refsect1>
18485 <title>Arguments</title>
18486 <variablelist>
18487  <varlistentry>
18488   <term><parameter>drv</parameter></term>
18489   <listitem>
18490    <para>
18491     driver to register
18492    </para>
18493   </listitem>
18494  </varlistentry>
18495 </variablelist>
18496</refsect1>
18497<refsect1>
18498<title>Description</title>
18499<para>
18500   We pass off most of the work to the <function>bus_add_driver</function> call,
18501   since most of the things we have to do deal with the bus
18502   structures.
18503</para>
18504</refsect1>
18505</refentry>
18506
18507<refentry id="API-driver-unregister">
18508<refentryinfo>
18509 <title>LINUX</title>
18510 <productname>Kernel Hackers Manual</productname>
18511 <date>July 2017</date>
18512</refentryinfo>
18513<refmeta>
18514 <refentrytitle><phrase>driver_unregister</phrase></refentrytitle>
18515 <manvolnum>9</manvolnum>
18516 <refmiscinfo class="version">4.4.14</refmiscinfo>
18517</refmeta>
18518<refnamediv>
18519 <refname>driver_unregister</refname>
18520 <refpurpose>
18521     remove driver from system.
18522 </refpurpose>
18523</refnamediv>
18524<refsynopsisdiv>
18525 <title>Synopsis</title>
18526  <funcsynopsis><funcprototype>
18527   <funcdef>void <function>driver_unregister </function></funcdef>
18528   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>drv</parameter></paramdef>
18529  </funcprototype></funcsynopsis>
18530</refsynopsisdiv>
18531<refsect1>
18532 <title>Arguments</title>
18533 <variablelist>
18534  <varlistentry>
18535   <term><parameter>drv</parameter></term>
18536   <listitem>
18537    <para>
18538     driver.
18539    </para>
18540   </listitem>
18541  </varlistentry>
18542 </variablelist>
18543</refsect1>
18544<refsect1>
18545<title>Description</title>
18546<para>
18547   Again, we pass off most of the work to the bus-level call.
18548</para>
18549</refsect1>
18550</refentry>
18551
18552<refentry id="API-driver-find">
18553<refentryinfo>
18554 <title>LINUX</title>
18555 <productname>Kernel Hackers Manual</productname>
18556 <date>July 2017</date>
18557</refentryinfo>
18558<refmeta>
18559 <refentrytitle><phrase>driver_find</phrase></refentrytitle>
18560 <manvolnum>9</manvolnum>
18561 <refmiscinfo class="version">4.4.14</refmiscinfo>
18562</refmeta>
18563<refnamediv>
18564 <refname>driver_find</refname>
18565 <refpurpose>
18566     locate driver on a bus by its name.
18567 </refpurpose>
18568</refnamediv>
18569<refsynopsisdiv>
18570 <title>Synopsis</title>
18571  <funcsynopsis><funcprototype>
18572   <funcdef><link linkend="API-struct-device-driver">struct device_driver</link> * <function>driver_find </function></funcdef>
18573   <paramdef>const char * <parameter>name</parameter></paramdef>
18574   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
18575  </funcprototype></funcsynopsis>
18576</refsynopsisdiv>
18577<refsect1>
18578 <title>Arguments</title>
18579 <variablelist>
18580  <varlistentry>
18581   <term><parameter>name</parameter></term>
18582   <listitem>
18583    <para>
18584     name of the driver.
18585    </para>
18586   </listitem>
18587  </varlistentry>
18588  <varlistentry>
18589   <term><parameter>bus</parameter></term>
18590   <listitem>
18591    <para>
18592     bus to scan for the driver.
18593    </para>
18594   </listitem>
18595  </varlistentry>
18596 </variablelist>
18597</refsect1>
18598<refsect1>
18599<title>Description</title>
18600<para>
18601   Call <function>kset_find_obj</function> to iterate over list of drivers on
18602   a bus to find driver by name. Return driver if found.
18603   </para><para>
18604
18605   This routine provides no locking to prevent the driver it returns
18606   from being unregistered or unloaded while the caller is using it.
18607   The caller is responsible for preventing this.
18608</para>
18609</refsect1>
18610</refentry>
18611
18612<!-- drivers/base/core.c -->
18613<refentry id="API-dev-driver-string">
18614<refentryinfo>
18615 <title>LINUX</title>
18616 <productname>Kernel Hackers Manual</productname>
18617 <date>July 2017</date>
18618</refentryinfo>
18619<refmeta>
18620 <refentrytitle><phrase>dev_driver_string</phrase></refentrytitle>
18621 <manvolnum>9</manvolnum>
18622 <refmiscinfo class="version">4.4.14</refmiscinfo>
18623</refmeta>
18624<refnamediv>
18625 <refname>dev_driver_string</refname>
18626 <refpurpose>
18627  Return a device's driver name, if at all possible
18628 </refpurpose>
18629</refnamediv>
18630<refsynopsisdiv>
18631 <title>Synopsis</title>
18632  <funcsynopsis><funcprototype>
18633   <funcdef>const char * <function>dev_driver_string </function></funcdef>
18634   <paramdef><link linkend="API-struct-device">const struct device</link> * <parameter>dev</parameter></paramdef>
18635  </funcprototype></funcsynopsis>
18636</refsynopsisdiv>
18637<refsect1>
18638 <title>Arguments</title>
18639 <variablelist>
18640  <varlistentry>
18641   <term><parameter>dev</parameter></term>
18642   <listitem>
18643    <para>
18644     struct device to get the name of
18645    </para>
18646   </listitem>
18647  </varlistentry>
18648 </variablelist>
18649</refsect1>
18650<refsect1>
18651<title>Description</title>
18652<para>
18653   Will return the device's driver's name if it is bound to a device.  If
18654   the device is not bound to a driver, it will return the name of the bus
18655   it is attached to.  If it is not attached to a bus either, an empty
18656   string will be returned.
18657</para>
18658</refsect1>
18659</refentry>
18660
18661<refentry id="API-device-create-file">
18662<refentryinfo>
18663 <title>LINUX</title>
18664 <productname>Kernel Hackers Manual</productname>
18665 <date>July 2017</date>
18666</refentryinfo>
18667<refmeta>
18668 <refentrytitle><phrase>device_create_file</phrase></refentrytitle>
18669 <manvolnum>9</manvolnum>
18670 <refmiscinfo class="version">4.4.14</refmiscinfo>
18671</refmeta>
18672<refnamediv>
18673 <refname>device_create_file</refname>
18674 <refpurpose>
18675     create sysfs attribute file for device.
18676 </refpurpose>
18677</refnamediv>
18678<refsynopsisdiv>
18679 <title>Synopsis</title>
18680  <funcsynopsis><funcprototype>
18681   <funcdef>int <function>device_create_file </function></funcdef>
18682   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
18683   <paramdef>const struct device_attribute * <parameter>attr</parameter></paramdef>
18684  </funcprototype></funcsynopsis>
18685</refsynopsisdiv>
18686<refsect1>
18687 <title>Arguments</title>
18688 <variablelist>
18689  <varlistentry>
18690   <term><parameter>dev</parameter></term>
18691   <listitem>
18692    <para>
18693     device.
18694    </para>
18695   </listitem>
18696  </varlistentry>
18697  <varlistentry>
18698   <term><parameter>attr</parameter></term>
18699   <listitem>
18700    <para>
18701     device attribute descriptor.
18702    </para>
18703   </listitem>
18704  </varlistentry>
18705 </variablelist>
18706</refsect1>
18707</refentry>
18708
18709<refentry id="API-device-remove-file">
18710<refentryinfo>
18711 <title>LINUX</title>
18712 <productname>Kernel Hackers Manual</productname>
18713 <date>July 2017</date>
18714</refentryinfo>
18715<refmeta>
18716 <refentrytitle><phrase>device_remove_file</phrase></refentrytitle>
18717 <manvolnum>9</manvolnum>
18718 <refmiscinfo class="version">4.4.14</refmiscinfo>
18719</refmeta>
18720<refnamediv>
18721 <refname>device_remove_file</refname>
18722 <refpurpose>
18723     remove sysfs attribute file.
18724 </refpurpose>
18725</refnamediv>
18726<refsynopsisdiv>
18727 <title>Synopsis</title>
18728  <funcsynopsis><funcprototype>
18729   <funcdef>void <function>device_remove_file </function></funcdef>
18730   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
18731   <paramdef>const struct device_attribute * <parameter>attr</parameter></paramdef>
18732  </funcprototype></funcsynopsis>
18733</refsynopsisdiv>
18734<refsect1>
18735 <title>Arguments</title>
18736 <variablelist>
18737  <varlistentry>
18738   <term><parameter>dev</parameter></term>
18739   <listitem>
18740    <para>
18741     device.
18742    </para>
18743   </listitem>
18744  </varlistentry>
18745  <varlistentry>
18746   <term><parameter>attr</parameter></term>
18747   <listitem>
18748    <para>
18749     device attribute descriptor.
18750    </para>
18751   </listitem>
18752  </varlistentry>
18753 </variablelist>
18754</refsect1>
18755</refentry>
18756
18757<refentry id="API-device-remove-file-self">
18758<refentryinfo>
18759 <title>LINUX</title>
18760 <productname>Kernel Hackers Manual</productname>
18761 <date>July 2017</date>
18762</refentryinfo>
18763<refmeta>
18764 <refentrytitle><phrase>device_remove_file_self</phrase></refentrytitle>
18765 <manvolnum>9</manvolnum>
18766 <refmiscinfo class="version">4.4.14</refmiscinfo>
18767</refmeta>
18768<refnamediv>
18769 <refname>device_remove_file_self</refname>
18770 <refpurpose>
18771     remove sysfs attribute file from its own method.
18772 </refpurpose>
18773</refnamediv>
18774<refsynopsisdiv>
18775 <title>Synopsis</title>
18776  <funcsynopsis><funcprototype>
18777   <funcdef>bool <function>device_remove_file_self </function></funcdef>
18778   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
18779   <paramdef>const struct device_attribute * <parameter>attr</parameter></paramdef>
18780  </funcprototype></funcsynopsis>
18781</refsynopsisdiv>
18782<refsect1>
18783 <title>Arguments</title>
18784 <variablelist>
18785  <varlistentry>
18786   <term><parameter>dev</parameter></term>
18787   <listitem>
18788    <para>
18789     device.
18790    </para>
18791   </listitem>
18792  </varlistentry>
18793  <varlistentry>
18794   <term><parameter>attr</parameter></term>
18795   <listitem>
18796    <para>
18797     device attribute descriptor.
18798    </para>
18799   </listitem>
18800  </varlistentry>
18801 </variablelist>
18802</refsect1>
18803<refsect1>
18804<title>Description</title>
18805<para>
18806   See <function>kernfs_remove_self</function> for details.
18807</para>
18808</refsect1>
18809</refentry>
18810
18811<refentry id="API-device-create-bin-file">
18812<refentryinfo>
18813 <title>LINUX</title>
18814 <productname>Kernel Hackers Manual</productname>
18815 <date>July 2017</date>
18816</refentryinfo>
18817<refmeta>
18818 <refentrytitle><phrase>device_create_bin_file</phrase></refentrytitle>
18819 <manvolnum>9</manvolnum>
18820 <refmiscinfo class="version">4.4.14</refmiscinfo>
18821</refmeta>
18822<refnamediv>
18823 <refname>device_create_bin_file</refname>
18824 <refpurpose>
18825     create sysfs binary attribute file for device.
18826 </refpurpose>
18827</refnamediv>
18828<refsynopsisdiv>
18829 <title>Synopsis</title>
18830  <funcsynopsis><funcprototype>
18831   <funcdef>int <function>device_create_bin_file </function></funcdef>
18832   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
18833   <paramdef>const struct bin_attribute * <parameter>attr</parameter></paramdef>
18834  </funcprototype></funcsynopsis>
18835</refsynopsisdiv>
18836<refsect1>
18837 <title>Arguments</title>
18838 <variablelist>
18839  <varlistentry>
18840   <term><parameter>dev</parameter></term>
18841   <listitem>
18842    <para>
18843     device.
18844    </para>
18845   </listitem>
18846  </varlistentry>
18847  <varlistentry>
18848   <term><parameter>attr</parameter></term>
18849   <listitem>
18850    <para>
18851     device binary attribute descriptor.
18852    </para>
18853   </listitem>
18854  </varlistentry>
18855 </variablelist>
18856</refsect1>
18857</refentry>
18858
18859<refentry id="API-device-remove-bin-file">
18860<refentryinfo>
18861 <title>LINUX</title>
18862 <productname>Kernel Hackers Manual</productname>
18863 <date>July 2017</date>
18864</refentryinfo>
18865<refmeta>
18866 <refentrytitle><phrase>device_remove_bin_file</phrase></refentrytitle>
18867 <manvolnum>9</manvolnum>
18868 <refmiscinfo class="version">4.4.14</refmiscinfo>
18869</refmeta>
18870<refnamediv>
18871 <refname>device_remove_bin_file</refname>
18872 <refpurpose>
18873     remove sysfs binary attribute file
18874 </refpurpose>
18875</refnamediv>
18876<refsynopsisdiv>
18877 <title>Synopsis</title>
18878  <funcsynopsis><funcprototype>
18879   <funcdef>void <function>device_remove_bin_file </function></funcdef>
18880   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
18881   <paramdef>const struct bin_attribute * <parameter>attr</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.
18892    </para>
18893   </listitem>
18894  </varlistentry>
18895  <varlistentry>
18896   <term><parameter>attr</parameter></term>
18897   <listitem>
18898    <para>
18899     device binary attribute descriptor.
18900    </para>
18901   </listitem>
18902  </varlistentry>
18903 </variablelist>
18904</refsect1>
18905</refentry>
18906
18907<refentry id="API-device-initialize">
18908<refentryinfo>
18909 <title>LINUX</title>
18910 <productname>Kernel Hackers Manual</productname>
18911 <date>July 2017</date>
18912</refentryinfo>
18913<refmeta>
18914 <refentrytitle><phrase>device_initialize</phrase></refentrytitle>
18915 <manvolnum>9</manvolnum>
18916 <refmiscinfo class="version">4.4.14</refmiscinfo>
18917</refmeta>
18918<refnamediv>
18919 <refname>device_initialize</refname>
18920 <refpurpose>
18921     init device structure.
18922 </refpurpose>
18923</refnamediv>
18924<refsynopsisdiv>
18925 <title>Synopsis</title>
18926  <funcsynopsis><funcprototype>
18927   <funcdef>void <function>device_initialize </function></funcdef>
18928   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
18929  </funcprototype></funcsynopsis>
18930</refsynopsisdiv>
18931<refsect1>
18932 <title>Arguments</title>
18933 <variablelist>
18934  <varlistentry>
18935   <term><parameter>dev</parameter></term>
18936   <listitem>
18937    <para>
18938     device.
18939    </para>
18940   </listitem>
18941  </varlistentry>
18942 </variablelist>
18943</refsect1>
18944<refsect1>
18945<title>Description</title>
18946<para>
18947   This prepares the device for use by other layers by initializing
18948   its fields.
18949   It is the first half of <function><link linkend="API-device-register">device_register</link></function>, if called by
18950   that function, though it can also be called separately, so one
18951   may use <parameter>dev</parameter>'s fields. In particular, <function><link linkend="API-get-device">get_device</link></function>/<function><link linkend="API-put-device">put_device</link></function>
18952   may be used for reference counting of <parameter>dev</parameter> after calling this
18953   function.
18954   </para><para>
18955
18956   All fields in <parameter>dev</parameter> must be initialized by the caller to 0, except
18957   for those explicitly set to some other value.  The simplest
18958   approach is to use <function>kzalloc</function> to allocate the structure containing
18959   <parameter>dev</parameter>.
18960</para>
18961</refsect1>
18962<refsect1>
18963<title>NOTE</title>
18964<para>
18965   Use <function><link linkend="API-put-device">put_device</link></function> to give up your reference instead of freeing
18966   <parameter>dev</parameter> directly once you have called this function.
18967</para>
18968</refsect1>
18969</refentry>
18970
18971<refentry id="API-dev-set-name">
18972<refentryinfo>
18973 <title>LINUX</title>
18974 <productname>Kernel Hackers Manual</productname>
18975 <date>July 2017</date>
18976</refentryinfo>
18977<refmeta>
18978 <refentrytitle><phrase>dev_set_name</phrase></refentrytitle>
18979 <manvolnum>9</manvolnum>
18980 <refmiscinfo class="version">4.4.14</refmiscinfo>
18981</refmeta>
18982<refnamediv>
18983 <refname>dev_set_name</refname>
18984 <refpurpose>
18985     set a device name
18986 </refpurpose>
18987</refnamediv>
18988<refsynopsisdiv>
18989 <title>Synopsis</title>
18990  <funcsynopsis><funcprototype>
18991   <funcdef>int <function>dev_set_name </function></funcdef>
18992   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
18993   <paramdef>const char * <parameter>fmt</parameter></paramdef>
18994   <paramdef> <parameter>...</parameter></paramdef>
18995  </funcprototype></funcsynopsis>
18996</refsynopsisdiv>
18997<refsect1>
18998 <title>Arguments</title>
18999 <variablelist>
19000  <varlistentry>
19001   <term><parameter>dev</parameter></term>
19002   <listitem>
19003    <para>
19004     device
19005    </para>
19006   </listitem>
19007  </varlistentry>
19008  <varlistentry>
19009   <term><parameter>fmt</parameter></term>
19010   <listitem>
19011    <para>
19012     format string for the device's name
19013    </para>
19014   </listitem>
19015  </varlistentry>
19016  <varlistentry>
19017   <term><parameter>...</parameter></term>
19018   <listitem>
19019    <para>
19020     variable arguments
19021    </para>
19022   </listitem>
19023  </varlistentry>
19024 </variablelist>
19025</refsect1>
19026</refentry>
19027
19028<refentry id="API-device-add">
19029<refentryinfo>
19030 <title>LINUX</title>
19031 <productname>Kernel Hackers Manual</productname>
19032 <date>July 2017</date>
19033</refentryinfo>
19034<refmeta>
19035 <refentrytitle><phrase>device_add</phrase></refentrytitle>
19036 <manvolnum>9</manvolnum>
19037 <refmiscinfo class="version">4.4.14</refmiscinfo>
19038</refmeta>
19039<refnamediv>
19040 <refname>device_add</refname>
19041 <refpurpose>
19042     add device to device hierarchy.
19043 </refpurpose>
19044</refnamediv>
19045<refsynopsisdiv>
19046 <title>Synopsis</title>
19047  <funcsynopsis><funcprototype>
19048   <funcdef>int <function>device_add </function></funcdef>
19049   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
19050  </funcprototype></funcsynopsis>
19051</refsynopsisdiv>
19052<refsect1>
19053 <title>Arguments</title>
19054 <variablelist>
19055  <varlistentry>
19056   <term><parameter>dev</parameter></term>
19057   <listitem>
19058    <para>
19059     device.
19060    </para>
19061   </listitem>
19062  </varlistentry>
19063 </variablelist>
19064</refsect1>
19065<refsect1>
19066<title>Description</title>
19067<para>
19068   This is part 2 of <function><link linkend="API-device-register">device_register</link></function>, though may be called
19069   separately _iff_ <function><link linkend="API-device-initialize">device_initialize</link></function> has been called separately.
19070   </para><para>
19071
19072   This adds <parameter>dev</parameter> to the kobject hierarchy via <function><link linkend="API-kobject-add">kobject_add</link></function>, adds it
19073   to the global and sibling lists for the device, then
19074   adds it to the other relevant subsystems of the driver model.
19075   </para><para>
19076
19077   Do not call this routine or <function><link linkend="API-device-register">device_register</link></function> more than once for
19078   any device structure.  The driver model core is not designed to work
19079   with devices that get unregistered and then spring back to life.
19080   (Among other things, it's very hard to guarantee that all references
19081   to the previous incarnation of <parameter>dev</parameter> have been dropped.)  Allocate
19082   and register a fresh new struct device instead.
19083</para>
19084</refsect1>
19085<refsect1>
19086<title>NOTE</title>
19087<para>
19088   _Never_ directly free <parameter>dev</parameter> after calling this function, even
19089   if it returned an error! Always use <function><link linkend="API-put-device">put_device</link></function> to give up your
19090   reference instead.
19091</para>
19092</refsect1>
19093</refentry>
19094
19095<refentry id="API-device-register">
19096<refentryinfo>
19097 <title>LINUX</title>
19098 <productname>Kernel Hackers Manual</productname>
19099 <date>July 2017</date>
19100</refentryinfo>
19101<refmeta>
19102 <refentrytitle><phrase>device_register</phrase></refentrytitle>
19103 <manvolnum>9</manvolnum>
19104 <refmiscinfo class="version">4.4.14</refmiscinfo>
19105</refmeta>
19106<refnamediv>
19107 <refname>device_register</refname>
19108 <refpurpose>
19109     register a device with the system.
19110 </refpurpose>
19111</refnamediv>
19112<refsynopsisdiv>
19113 <title>Synopsis</title>
19114  <funcsynopsis><funcprototype>
19115   <funcdef>int <function>device_register </function></funcdef>
19116   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
19117  </funcprototype></funcsynopsis>
19118</refsynopsisdiv>
19119<refsect1>
19120 <title>Arguments</title>
19121 <variablelist>
19122  <varlistentry>
19123   <term><parameter>dev</parameter></term>
19124   <listitem>
19125    <para>
19126     pointer to the device structure
19127    </para>
19128   </listitem>
19129  </varlistentry>
19130 </variablelist>
19131</refsect1>
19132<refsect1>
19133<title>Description</title>
19134<para>
19135   This happens in two clean steps - initialize the device
19136   and add it to the system. The two steps can be called
19137   separately, but this is the easiest and most common.
19138   I.e. you should only call the two helpers separately if
19139   have a clearly defined need to use and refcount the device
19140   before it is added to the hierarchy.
19141   </para><para>
19142
19143   For more information, see the kerneldoc for <function><link linkend="API-device-initialize">device_initialize</link></function>
19144   and <function><link linkend="API-device-add">device_add</link></function>.
19145</para>
19146</refsect1>
19147<refsect1>
19148<title>NOTE</title>
19149<para>
19150   _Never_ directly free <parameter>dev</parameter> after calling this function, even
19151   if it returned an error! Always use <function><link linkend="API-put-device">put_device</link></function> to give up the
19152   reference initialized in this function instead.
19153</para>
19154</refsect1>
19155</refentry>
19156
19157<refentry id="API-get-device">
19158<refentryinfo>
19159 <title>LINUX</title>
19160 <productname>Kernel Hackers Manual</productname>
19161 <date>July 2017</date>
19162</refentryinfo>
19163<refmeta>
19164 <refentrytitle><phrase>get_device</phrase></refentrytitle>
19165 <manvolnum>9</manvolnum>
19166 <refmiscinfo class="version">4.4.14</refmiscinfo>
19167</refmeta>
19168<refnamediv>
19169 <refname>get_device</refname>
19170 <refpurpose>
19171     increment reference count for device.
19172 </refpurpose>
19173</refnamediv>
19174<refsynopsisdiv>
19175 <title>Synopsis</title>
19176  <funcsynopsis><funcprototype>
19177   <funcdef><link linkend="API-struct-device">struct device</link> * <function>get_device </function></funcdef>
19178   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
19179  </funcprototype></funcsynopsis>
19180</refsynopsisdiv>
19181<refsect1>
19182 <title>Arguments</title>
19183 <variablelist>
19184  <varlistentry>
19185   <term><parameter>dev</parameter></term>
19186   <listitem>
19187    <para>
19188     device.
19189    </para>
19190   </listitem>
19191  </varlistentry>
19192 </variablelist>
19193</refsect1>
19194<refsect1>
19195<title>Description</title>
19196<para>
19197   This simply forwards the call to <function><link linkend="API-kobject-get">kobject_get</link></function>, though
19198   we do take care to provide for the case that we get a NULL
19199   pointer passed in.
19200</para>
19201</refsect1>
19202</refentry>
19203
19204<refentry id="API-put-device">
19205<refentryinfo>
19206 <title>LINUX</title>
19207 <productname>Kernel Hackers Manual</productname>
19208 <date>July 2017</date>
19209</refentryinfo>
19210<refmeta>
19211 <refentrytitle><phrase>put_device</phrase></refentrytitle>
19212 <manvolnum>9</manvolnum>
19213 <refmiscinfo class="version">4.4.14</refmiscinfo>
19214</refmeta>
19215<refnamediv>
19216 <refname>put_device</refname>
19217 <refpurpose>
19218     decrement reference count.
19219 </refpurpose>
19220</refnamediv>
19221<refsynopsisdiv>
19222 <title>Synopsis</title>
19223  <funcsynopsis><funcprototype>
19224   <funcdef>void <function>put_device </function></funcdef>
19225   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
19226  </funcprototype></funcsynopsis>
19227</refsynopsisdiv>
19228<refsect1>
19229 <title>Arguments</title>
19230 <variablelist>
19231  <varlistentry>
19232   <term><parameter>dev</parameter></term>
19233   <listitem>
19234    <para>
19235     device in question.
19236    </para>
19237   </listitem>
19238  </varlistentry>
19239 </variablelist>
19240</refsect1>
19241</refentry>
19242
19243<refentry id="API-device-del">
19244<refentryinfo>
19245 <title>LINUX</title>
19246 <productname>Kernel Hackers Manual</productname>
19247 <date>July 2017</date>
19248</refentryinfo>
19249<refmeta>
19250 <refentrytitle><phrase>device_del</phrase></refentrytitle>
19251 <manvolnum>9</manvolnum>
19252 <refmiscinfo class="version">4.4.14</refmiscinfo>
19253</refmeta>
19254<refnamediv>
19255 <refname>device_del</refname>
19256 <refpurpose>
19257     delete device from system.
19258 </refpurpose>
19259</refnamediv>
19260<refsynopsisdiv>
19261 <title>Synopsis</title>
19262  <funcsynopsis><funcprototype>
19263   <funcdef>void <function>device_del </function></funcdef>
19264   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
19265  </funcprototype></funcsynopsis>
19266</refsynopsisdiv>
19267<refsect1>
19268 <title>Arguments</title>
19269 <variablelist>
19270  <varlistentry>
19271   <term><parameter>dev</parameter></term>
19272   <listitem>
19273    <para>
19274     device.
19275    </para>
19276   </listitem>
19277  </varlistentry>
19278 </variablelist>
19279</refsect1>
19280<refsect1>
19281<title>Description</title>
19282<para>
19283   This is the first part of the device unregistration
19284   sequence. This removes the device from the lists we control
19285   from here, has it removed from the other driver model
19286   subsystems it was added to in <function><link linkend="API-device-add">device_add</link></function>, and removes it
19287   from the kobject hierarchy.
19288</para>
19289</refsect1>
19290<refsect1>
19291<title>NOTE</title>
19292<para>
19293   this should be called manually _iff_ <function><link linkend="API-device-add">device_add</link></function> was
19294   also called manually.
19295</para>
19296</refsect1>
19297</refentry>
19298
19299<refentry id="API-device-unregister">
19300<refentryinfo>
19301 <title>LINUX</title>
19302 <productname>Kernel Hackers Manual</productname>
19303 <date>July 2017</date>
19304</refentryinfo>
19305<refmeta>
19306 <refentrytitle><phrase>device_unregister</phrase></refentrytitle>
19307 <manvolnum>9</manvolnum>
19308 <refmiscinfo class="version">4.4.14</refmiscinfo>
19309</refmeta>
19310<refnamediv>
19311 <refname>device_unregister</refname>
19312 <refpurpose>
19313     unregister device from system.
19314 </refpurpose>
19315</refnamediv>
19316<refsynopsisdiv>
19317 <title>Synopsis</title>
19318  <funcsynopsis><funcprototype>
19319   <funcdef>void <function>device_unregister </function></funcdef>
19320   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
19321  </funcprototype></funcsynopsis>
19322</refsynopsisdiv>
19323<refsect1>
19324 <title>Arguments</title>
19325 <variablelist>
19326  <varlistentry>
19327   <term><parameter>dev</parameter></term>
19328   <listitem>
19329    <para>
19330     device going away.
19331    </para>
19332   </listitem>
19333  </varlistentry>
19334 </variablelist>
19335</refsect1>
19336<refsect1>
19337<title>Description</title>
19338<para>
19339   We do this in two parts, like we do <function><link linkend="API-device-register">device_register</link></function>. First,
19340   we remove it from all the subsystems with <function><link linkend="API-device-del">device_del</link></function>, then
19341   we decrement the reference count via <function><link linkend="API-put-device">put_device</link></function>. If that
19342   is the final reference count, the device will be cleaned up
19343   via <function>device_release</function> above. Otherwise, the structure will
19344   stick around until the final reference to the device is dropped.
19345</para>
19346</refsect1>
19347</refentry>
19348
19349<refentry id="API-device-for-each-child">
19350<refentryinfo>
19351 <title>LINUX</title>
19352 <productname>Kernel Hackers Manual</productname>
19353 <date>July 2017</date>
19354</refentryinfo>
19355<refmeta>
19356 <refentrytitle><phrase>device_for_each_child</phrase></refentrytitle>
19357 <manvolnum>9</manvolnum>
19358 <refmiscinfo class="version">4.4.14</refmiscinfo>
19359</refmeta>
19360<refnamediv>
19361 <refname>device_for_each_child</refname>
19362 <refpurpose>
19363     device child iterator.
19364 </refpurpose>
19365</refnamediv>
19366<refsynopsisdiv>
19367 <title>Synopsis</title>
19368  <funcsynopsis><funcprototype>
19369   <funcdef>int <function>device_for_each_child </function></funcdef>
19370   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
19371   <paramdef>void * <parameter>data</parameter></paramdef>
19372   <paramdef>int (*<parameter>fn</parameter>)
19373     <funcparams>struct device *dev, void *data</funcparams></paramdef>
19374  </funcprototype></funcsynopsis>
19375</refsynopsisdiv>
19376<refsect1>
19377 <title>Arguments</title>
19378 <variablelist>
19379  <varlistentry>
19380   <term><parameter>parent</parameter></term>
19381   <listitem>
19382    <para>
19383     parent struct device.
19384    </para>
19385   </listitem>
19386  </varlistentry>
19387  <varlistentry>
19388   <term><parameter>data</parameter></term>
19389   <listitem>
19390    <para>
19391     data for the callback.
19392    </para>
19393   </listitem>
19394  </varlistentry>
19395  <varlistentry>
19396   <term><parameter>fn</parameter></term>
19397   <listitem>
19398    <para>
19399     function to be called for each device.
19400    </para>
19401   </listitem>
19402  </varlistentry>
19403 </variablelist>
19404</refsect1>
19405<refsect1>
19406<title>Description</title>
19407<para>
19408   Iterate over <parameter>parent</parameter>'s child devices, and call <parameter>fn</parameter> for each,
19409   passing it <parameter>data</parameter>.
19410   </para><para>
19411
19412   We check the return of <parameter>fn</parameter> each time. If it returns anything
19413   other than 0, we break out and return that value.
19414</para>
19415</refsect1>
19416</refentry>
19417
19418<refentry id="API-device-for-each-child-reverse">
19419<refentryinfo>
19420 <title>LINUX</title>
19421 <productname>Kernel Hackers Manual</productname>
19422 <date>July 2017</date>
19423</refentryinfo>
19424<refmeta>
19425 <refentrytitle><phrase>device_for_each_child_reverse</phrase></refentrytitle>
19426 <manvolnum>9</manvolnum>
19427 <refmiscinfo class="version">4.4.14</refmiscinfo>
19428</refmeta>
19429<refnamediv>
19430 <refname>device_for_each_child_reverse</refname>
19431 <refpurpose>
19432     device child iterator in reversed order.
19433 </refpurpose>
19434</refnamediv>
19435<refsynopsisdiv>
19436 <title>Synopsis</title>
19437  <funcsynopsis><funcprototype>
19438   <funcdef>int <function>device_for_each_child_reverse </function></funcdef>
19439   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
19440   <paramdef>void * <parameter>data</parameter></paramdef>
19441   <paramdef>int (*<parameter>fn</parameter>)
19442     <funcparams>struct device *dev, void *data</funcparams></paramdef>
19443  </funcprototype></funcsynopsis>
19444</refsynopsisdiv>
19445<refsect1>
19446 <title>Arguments</title>
19447 <variablelist>
19448  <varlistentry>
19449   <term><parameter>parent</parameter></term>
19450   <listitem>
19451    <para>
19452     parent struct device.
19453    </para>
19454   </listitem>
19455  </varlistentry>
19456  <varlistentry>
19457   <term><parameter>data</parameter></term>
19458   <listitem>
19459    <para>
19460     data for the callback.
19461    </para>
19462   </listitem>
19463  </varlistentry>
19464  <varlistentry>
19465   <term><parameter>fn</parameter></term>
19466   <listitem>
19467    <para>
19468     function to be called for each device.
19469    </para>
19470   </listitem>
19471  </varlistentry>
19472 </variablelist>
19473</refsect1>
19474<refsect1>
19475<title>Description</title>
19476<para>
19477   Iterate over <parameter>parent</parameter>'s child devices, and call <parameter>fn</parameter> for each,
19478   passing it <parameter>data</parameter>.
19479   </para><para>
19480
19481   We check the return of <parameter>fn</parameter> each time. If it returns anything
19482   other than 0, we break out and return that value.
19483</para>
19484</refsect1>
19485</refentry>
19486
19487<refentry id="API-device-find-child">
19488<refentryinfo>
19489 <title>LINUX</title>
19490 <productname>Kernel Hackers Manual</productname>
19491 <date>July 2017</date>
19492</refentryinfo>
19493<refmeta>
19494 <refentrytitle><phrase>device_find_child</phrase></refentrytitle>
19495 <manvolnum>9</manvolnum>
19496 <refmiscinfo class="version">4.4.14</refmiscinfo>
19497</refmeta>
19498<refnamediv>
19499 <refname>device_find_child</refname>
19500 <refpurpose>
19501     device iterator for locating a particular device.
19502 </refpurpose>
19503</refnamediv>
19504<refsynopsisdiv>
19505 <title>Synopsis</title>
19506  <funcsynopsis><funcprototype>
19507   <funcdef><link linkend="API-struct-device">struct device</link> * <function>device_find_child </function></funcdef>
19508   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
19509   <paramdef>void * <parameter>data</parameter></paramdef>
19510   <paramdef>int (*<parameter>match</parameter>)
19511     <funcparams>struct device *dev, void *data</funcparams></paramdef>
19512  </funcprototype></funcsynopsis>
19513</refsynopsisdiv>
19514<refsect1>
19515 <title>Arguments</title>
19516 <variablelist>
19517  <varlistentry>
19518   <term><parameter>parent</parameter></term>
19519   <listitem>
19520    <para>
19521     parent struct device
19522    </para>
19523   </listitem>
19524  </varlistentry>
19525  <varlistentry>
19526   <term><parameter>data</parameter></term>
19527   <listitem>
19528    <para>
19529     Data to pass to match function
19530    </para>
19531   </listitem>
19532  </varlistentry>
19533  <varlistentry>
19534   <term><parameter>match</parameter></term>
19535   <listitem>
19536    <para>
19537     Callback function to check device
19538    </para>
19539   </listitem>
19540  </varlistentry>
19541 </variablelist>
19542</refsect1>
19543<refsect1>
19544<title>Description</title>
19545<para>
19546   This is similar to the <function><link linkend="API-device-for-each-child">device_for_each_child</link></function> function above, but it
19547   returns a reference to a device that is 'found' for later use, as
19548   determined by the <parameter>match</parameter> callback.
19549   </para><para>
19550
19551   The callback should return 0 if the device doesn't match and non-zero
19552   if it does.  If the callback returns non-zero and a reference to the
19553   current device can be obtained, this function will return to the caller
19554   and not iterate over any more devices.
19555</para>
19556</refsect1>
19557<refsect1>
19558<title>NOTE</title>
19559<para>
19560   you will need to drop the reference with <function><link linkend="API-put-device">put_device</link></function> after use.
19561</para>
19562</refsect1>
19563</refentry>
19564
19565<refentry id="API---root-device-register">
19566<refentryinfo>
19567 <title>LINUX</title>
19568 <productname>Kernel Hackers Manual</productname>
19569 <date>July 2017</date>
19570</refentryinfo>
19571<refmeta>
19572 <refentrytitle><phrase>__root_device_register</phrase></refentrytitle>
19573 <manvolnum>9</manvolnum>
19574 <refmiscinfo class="version">4.4.14</refmiscinfo>
19575</refmeta>
19576<refnamediv>
19577 <refname>__root_device_register</refname>
19578 <refpurpose>
19579     allocate and register a root device
19580 </refpurpose>
19581</refnamediv>
19582<refsynopsisdiv>
19583 <title>Synopsis</title>
19584  <funcsynopsis><funcprototype>
19585   <funcdef><link linkend="API-struct-device">struct device</link> * <function>__root_device_register </function></funcdef>
19586   <paramdef>const char * <parameter>name</parameter></paramdef>
19587   <paramdef>struct module * <parameter>owner</parameter></paramdef>
19588  </funcprototype></funcsynopsis>
19589</refsynopsisdiv>
19590<refsect1>
19591 <title>Arguments</title>
19592 <variablelist>
19593  <varlistentry>
19594   <term><parameter>name</parameter></term>
19595   <listitem>
19596    <para>
19597     root device name
19598    </para>
19599   </listitem>
19600  </varlistentry>
19601  <varlistentry>
19602   <term><parameter>owner</parameter></term>
19603   <listitem>
19604    <para>
19605     owner module of the root device, usually THIS_MODULE
19606    </para>
19607   </listitem>
19608  </varlistentry>
19609 </variablelist>
19610</refsect1>
19611<refsect1>
19612<title>Description</title>
19613<para>
19614   This function allocates a root device and registers it
19615   using <function><link linkend="API-device-register">device_register</link></function>. In order to free the returned
19616   device, use <function><link linkend="API-root-device-unregister">root_device_unregister</link></function>.
19617   </para><para>
19618
19619   Root devices are dummy devices which allow other devices
19620   to be grouped under /sys/devices. Use this function to
19621   allocate a root device and then use it as the parent of
19622   any device which should appear under /sys/devices/{name}
19623   </para><para>
19624
19625   The /sys/devices/{name} directory will also contain a
19626   'module' symlink which points to the <parameter>owner</parameter> directory
19627   in sysfs.
19628   </para><para>
19629
19630   Returns <structname><link linkend="API-struct-device">struct device</link></structname> pointer on success, or <function>ERR_PTR</function> on error.
19631</para>
19632</refsect1>
19633<refsect1>
19634<title>Note</title>
19635<para>
19636   You probably want to use <function>root_device_register</function>.
19637</para>
19638</refsect1>
19639</refentry>
19640
19641<refentry id="API-root-device-unregister">
19642<refentryinfo>
19643 <title>LINUX</title>
19644 <productname>Kernel Hackers Manual</productname>
19645 <date>July 2017</date>
19646</refentryinfo>
19647<refmeta>
19648 <refentrytitle><phrase>root_device_unregister</phrase></refentrytitle>
19649 <manvolnum>9</manvolnum>
19650 <refmiscinfo class="version">4.4.14</refmiscinfo>
19651</refmeta>
19652<refnamediv>
19653 <refname>root_device_unregister</refname>
19654 <refpurpose>
19655     unregister and free a root device
19656 </refpurpose>
19657</refnamediv>
19658<refsynopsisdiv>
19659 <title>Synopsis</title>
19660  <funcsynopsis><funcprototype>
19661   <funcdef>void <function>root_device_unregister </function></funcdef>
19662   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
19663  </funcprototype></funcsynopsis>
19664</refsynopsisdiv>
19665<refsect1>
19666 <title>Arguments</title>
19667 <variablelist>
19668  <varlistentry>
19669   <term><parameter>dev</parameter></term>
19670   <listitem>
19671    <para>
19672     device going away
19673    </para>
19674   </listitem>
19675  </varlistentry>
19676 </variablelist>
19677</refsect1>
19678<refsect1>
19679<title>Description</title>
19680<para>
19681   This function unregisters and cleans up a device that was created by
19682   <function>root_device_register</function>.
19683</para>
19684</refsect1>
19685</refentry>
19686
19687<refentry id="API-device-create-vargs">
19688<refentryinfo>
19689 <title>LINUX</title>
19690 <productname>Kernel Hackers Manual</productname>
19691 <date>July 2017</date>
19692</refentryinfo>
19693<refmeta>
19694 <refentrytitle><phrase>device_create_vargs</phrase></refentrytitle>
19695 <manvolnum>9</manvolnum>
19696 <refmiscinfo class="version">4.4.14</refmiscinfo>
19697</refmeta>
19698<refnamediv>
19699 <refname>device_create_vargs</refname>
19700 <refpurpose>
19701     creates a device and registers it with sysfs
19702 </refpurpose>
19703</refnamediv>
19704<refsynopsisdiv>
19705 <title>Synopsis</title>
19706  <funcsynopsis><funcprototype>
19707   <funcdef><link linkend="API-struct-device">struct device</link> * <function>device_create_vargs </function></funcdef>
19708   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>class</parameter></paramdef>
19709   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
19710   <paramdef>dev_t <parameter>devt</parameter></paramdef>
19711   <paramdef>void * <parameter>drvdata</parameter></paramdef>
19712   <paramdef>const char * <parameter>fmt</parameter></paramdef>
19713   <paramdef>va_list <parameter>args</parameter></paramdef>
19714  </funcprototype></funcsynopsis>
19715</refsynopsisdiv>
19716<refsect1>
19717 <title>Arguments</title>
19718 <variablelist>
19719  <varlistentry>
19720   <term><parameter>class</parameter></term>
19721   <listitem>
19722    <para>
19723     pointer to the struct class that this device should be registered to
19724    </para>
19725   </listitem>
19726  </varlistentry>
19727  <varlistentry>
19728   <term><parameter>parent</parameter></term>
19729   <listitem>
19730    <para>
19731     pointer to the parent struct device of this new device, if any
19732    </para>
19733   </listitem>
19734  </varlistentry>
19735  <varlistentry>
19736   <term><parameter>devt</parameter></term>
19737   <listitem>
19738    <para>
19739     the dev_t for the char device to be added
19740    </para>
19741   </listitem>
19742  </varlistentry>
19743  <varlistentry>
19744   <term><parameter>drvdata</parameter></term>
19745   <listitem>
19746    <para>
19747     the data to be added to the device for callbacks
19748    </para>
19749   </listitem>
19750  </varlistentry>
19751  <varlistentry>
19752   <term><parameter>fmt</parameter></term>
19753   <listitem>
19754    <para>
19755     string for the device's name
19756    </para>
19757   </listitem>
19758  </varlistentry>
19759  <varlistentry>
19760   <term><parameter>args</parameter></term>
19761   <listitem>
19762    <para>
19763     va_list for the device's name
19764    </para>
19765   </listitem>
19766  </varlistentry>
19767 </variablelist>
19768</refsect1>
19769<refsect1>
19770<title>Description</title>
19771<para>
19772   This function can be used by char device classes.  A struct device
19773   will be created in sysfs, registered to the specified class.
19774   </para><para>
19775
19776   A <quote>dev</quote> file will be created, showing the dev_t for the device, if
19777   the dev_t is not 0,0.
19778   If a pointer to a parent struct device is passed in, the newly created
19779   struct device will be a child of that device in sysfs.
19780   The pointer to the struct device will be returned from the call.
19781   Any further sysfs files that might be required can be created using this
19782   pointer.
19783   </para><para>
19784
19785   Returns <structname><link linkend="API-struct-device">struct device</link></structname> pointer on success, or <function>ERR_PTR</function> on error.
19786</para>
19787</refsect1>
19788<refsect1>
19789<title>Note</title>
19790<para>
19791   the struct class passed to this function must have previously
19792   been created with a call to <function>class_create</function>.
19793</para>
19794</refsect1>
19795</refentry>
19796
19797<refentry id="API-device-create">
19798<refentryinfo>
19799 <title>LINUX</title>
19800 <productname>Kernel Hackers Manual</productname>
19801 <date>July 2017</date>
19802</refentryinfo>
19803<refmeta>
19804 <refentrytitle><phrase>device_create</phrase></refentrytitle>
19805 <manvolnum>9</manvolnum>
19806 <refmiscinfo class="version">4.4.14</refmiscinfo>
19807</refmeta>
19808<refnamediv>
19809 <refname>device_create</refname>
19810 <refpurpose>
19811     creates a device and registers it with sysfs
19812 </refpurpose>
19813</refnamediv>
19814<refsynopsisdiv>
19815 <title>Synopsis</title>
19816  <funcsynopsis><funcprototype>
19817   <funcdef><link linkend="API-struct-device">struct device</link> * <function>device_create </function></funcdef>
19818   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>class</parameter></paramdef>
19819   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
19820   <paramdef>dev_t <parameter>devt</parameter></paramdef>
19821   <paramdef>void * <parameter>drvdata</parameter></paramdef>
19822   <paramdef>const char * <parameter>fmt</parameter></paramdef>
19823   <paramdef> <parameter>...</parameter></paramdef>
19824  </funcprototype></funcsynopsis>
19825</refsynopsisdiv>
19826<refsect1>
19827 <title>Arguments</title>
19828 <variablelist>
19829  <varlistentry>
19830   <term><parameter>class</parameter></term>
19831   <listitem>
19832    <para>
19833     pointer to the struct class that this device should be registered to
19834    </para>
19835   </listitem>
19836  </varlistentry>
19837  <varlistentry>
19838   <term><parameter>parent</parameter></term>
19839   <listitem>
19840    <para>
19841     pointer to the parent struct device of this new device, if any
19842    </para>
19843   </listitem>
19844  </varlistentry>
19845  <varlistentry>
19846   <term><parameter>devt</parameter></term>
19847   <listitem>
19848    <para>
19849     the dev_t for the char device to be added
19850    </para>
19851   </listitem>
19852  </varlistentry>
19853  <varlistentry>
19854   <term><parameter>drvdata</parameter></term>
19855   <listitem>
19856    <para>
19857     the data to be added to the device for callbacks
19858    </para>
19859   </listitem>
19860  </varlistentry>
19861  <varlistentry>
19862   <term><parameter>fmt</parameter></term>
19863   <listitem>
19864    <para>
19865     string for the device's name
19866    </para>
19867   </listitem>
19868  </varlistentry>
19869  <varlistentry>
19870   <term><parameter>...</parameter></term>
19871   <listitem>
19872    <para>
19873     variable arguments
19874    </para>
19875   </listitem>
19876  </varlistentry>
19877 </variablelist>
19878</refsect1>
19879<refsect1>
19880<title>Description</title>
19881<para>
19882   This function can be used by char device classes.  A struct device
19883   will be created in sysfs, registered to the specified class.
19884   </para><para>
19885
19886   A <quote>dev</quote> file will be created, showing the dev_t for the device, if
19887   the dev_t is not 0,0.
19888   If a pointer to a parent struct device is passed in, the newly created
19889   struct device will be a child of that device in sysfs.
19890   The pointer to the struct device will be returned from the call.
19891   Any further sysfs files that might be required can be created using this
19892   pointer.
19893   </para><para>
19894
19895   Returns <structname><link linkend="API-struct-device">struct device</link></structname> pointer on success, or <function>ERR_PTR</function> on error.
19896</para>
19897</refsect1>
19898<refsect1>
19899<title>Note</title>
19900<para>
19901   the struct class passed to this function must have previously
19902   been created with a call to <function>class_create</function>.
19903</para>
19904</refsect1>
19905</refentry>
19906
19907<refentry id="API-device-create-with-groups">
19908<refentryinfo>
19909 <title>LINUX</title>
19910 <productname>Kernel Hackers Manual</productname>
19911 <date>July 2017</date>
19912</refentryinfo>
19913<refmeta>
19914 <refentrytitle><phrase>device_create_with_groups</phrase></refentrytitle>
19915 <manvolnum>9</manvolnum>
19916 <refmiscinfo class="version">4.4.14</refmiscinfo>
19917</refmeta>
19918<refnamediv>
19919 <refname>device_create_with_groups</refname>
19920 <refpurpose>
19921     creates a device and registers it with sysfs
19922 </refpurpose>
19923</refnamediv>
19924<refsynopsisdiv>
19925 <title>Synopsis</title>
19926  <funcsynopsis><funcprototype>
19927   <funcdef><link linkend="API-struct-device">struct device</link> * <function>device_create_with_groups </function></funcdef>
19928   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>class</parameter></paramdef>
19929   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
19930   <paramdef>dev_t <parameter>devt</parameter></paramdef>
19931   <paramdef>void * <parameter>drvdata</parameter></paramdef>
19932   <paramdef>const struct attribute_group ** <parameter>groups</parameter></paramdef>
19933   <paramdef>const char * <parameter>fmt</parameter></paramdef>
19934   <paramdef> <parameter>...</parameter></paramdef>
19935  </funcprototype></funcsynopsis>
19936</refsynopsisdiv>
19937<refsect1>
19938 <title>Arguments</title>
19939 <variablelist>
19940  <varlistentry>
19941   <term><parameter>class</parameter></term>
19942   <listitem>
19943    <para>
19944     pointer to the struct class that this device should be registered to
19945    </para>
19946   </listitem>
19947  </varlistentry>
19948  <varlistentry>
19949   <term><parameter>parent</parameter></term>
19950   <listitem>
19951    <para>
19952     pointer to the parent struct device of this new device, if any
19953    </para>
19954   </listitem>
19955  </varlistentry>
19956  <varlistentry>
19957   <term><parameter>devt</parameter></term>
19958   <listitem>
19959    <para>
19960     the dev_t for the char device to be added
19961    </para>
19962   </listitem>
19963  </varlistentry>
19964  <varlistentry>
19965   <term><parameter>drvdata</parameter></term>
19966   <listitem>
19967    <para>
19968     the data to be added to the device for callbacks
19969    </para>
19970   </listitem>
19971  </varlistentry>
19972  <varlistentry>
19973   <term><parameter>groups</parameter></term>
19974   <listitem>
19975    <para>
19976     NULL-terminated list of attribute groups to be created
19977    </para>
19978   </listitem>
19979  </varlistentry>
19980  <varlistentry>
19981   <term><parameter>fmt</parameter></term>
19982   <listitem>
19983    <para>
19984     string for the device's name
19985    </para>
19986   </listitem>
19987  </varlistentry>
19988  <varlistentry>
19989   <term><parameter>...</parameter></term>
19990   <listitem>
19991    <para>
19992     variable arguments
19993    </para>
19994   </listitem>
19995  </varlistentry>
19996 </variablelist>
19997</refsect1>
19998<refsect1>
19999<title>Description</title>
20000<para>
20001   This function can be used by char device classes.  A struct device
20002   will be created in sysfs, registered to the specified class.
20003   Additional attributes specified in the groups parameter will also
20004   be created automatically.
20005   </para><para>
20006
20007   A <quote>dev</quote> file will be created, showing the dev_t for the device, if
20008   the dev_t is not 0,0.
20009   If a pointer to a parent struct device is passed in, the newly created
20010   struct device will be a child of that device in sysfs.
20011   The pointer to the struct device will be returned from the call.
20012   Any further sysfs files that might be required can be created using this
20013   pointer.
20014   </para><para>
20015
20016   Returns <structname><link linkend="API-struct-device">struct device</link></structname> pointer on success, or <function>ERR_PTR</function> on error.
20017</para>
20018</refsect1>
20019<refsect1>
20020<title>Note</title>
20021<para>
20022   the struct class passed to this function must have previously
20023   been created with a call to <function>class_create</function>.
20024</para>
20025</refsect1>
20026</refentry>
20027
20028<refentry id="API-device-destroy">
20029<refentryinfo>
20030 <title>LINUX</title>
20031 <productname>Kernel Hackers Manual</productname>
20032 <date>July 2017</date>
20033</refentryinfo>
20034<refmeta>
20035 <refentrytitle><phrase>device_destroy</phrase></refentrytitle>
20036 <manvolnum>9</manvolnum>
20037 <refmiscinfo class="version">4.4.14</refmiscinfo>
20038</refmeta>
20039<refnamediv>
20040 <refname>device_destroy</refname>
20041 <refpurpose>
20042     removes a device that was created with <function><link linkend="API-device-create">device_create</link></function>
20043 </refpurpose>
20044</refnamediv>
20045<refsynopsisdiv>
20046 <title>Synopsis</title>
20047  <funcsynopsis><funcprototype>
20048   <funcdef>void <function>device_destroy </function></funcdef>
20049   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>class</parameter></paramdef>
20050   <paramdef>dev_t <parameter>devt</parameter></paramdef>
20051  </funcprototype></funcsynopsis>
20052</refsynopsisdiv>
20053<refsect1>
20054 <title>Arguments</title>
20055 <variablelist>
20056  <varlistentry>
20057   <term><parameter>class</parameter></term>
20058   <listitem>
20059    <para>
20060     pointer to the struct class that this device was registered with
20061    </para>
20062   </listitem>
20063  </varlistentry>
20064  <varlistentry>
20065   <term><parameter>devt</parameter></term>
20066   <listitem>
20067    <para>
20068     the dev_t of the device that was previously registered
20069    </para>
20070   </listitem>
20071  </varlistentry>
20072 </variablelist>
20073</refsect1>
20074<refsect1>
20075<title>Description</title>
20076<para>
20077   This call unregisters and cleans up a device that was created with a
20078   call to <function><link linkend="API-device-create">device_create</link></function>.
20079</para>
20080</refsect1>
20081</refentry>
20082
20083<refentry id="API-device-rename">
20084<refentryinfo>
20085 <title>LINUX</title>
20086 <productname>Kernel Hackers Manual</productname>
20087 <date>July 2017</date>
20088</refentryinfo>
20089<refmeta>
20090 <refentrytitle><phrase>device_rename</phrase></refentrytitle>
20091 <manvolnum>9</manvolnum>
20092 <refmiscinfo class="version">4.4.14</refmiscinfo>
20093</refmeta>
20094<refnamediv>
20095 <refname>device_rename</refname>
20096 <refpurpose>
20097     renames a device
20098 </refpurpose>
20099</refnamediv>
20100<refsynopsisdiv>
20101 <title>Synopsis</title>
20102  <funcsynopsis><funcprototype>
20103   <funcdef>int <function>device_rename </function></funcdef>
20104   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
20105   <paramdef>const char * <parameter>new_name</parameter></paramdef>
20106  </funcprototype></funcsynopsis>
20107</refsynopsisdiv>
20108<refsect1>
20109 <title>Arguments</title>
20110 <variablelist>
20111  <varlistentry>
20112   <term><parameter>dev</parameter></term>
20113   <listitem>
20114    <para>
20115     the pointer to the struct device to be renamed
20116    </para>
20117   </listitem>
20118  </varlistentry>
20119  <varlistentry>
20120   <term><parameter>new_name</parameter></term>
20121   <listitem>
20122    <para>
20123     the new name of the device
20124    </para>
20125   </listitem>
20126  </varlistentry>
20127 </variablelist>
20128</refsect1>
20129<refsect1>
20130<title>Description</title>
20131<para>
20132   It is the responsibility of the caller to provide mutual
20133   exclusion between two different calls of device_rename
20134   on the same device to ensure that new_name is valid and
20135   won't conflict with other devices.
20136</para>
20137</refsect1>
20138<refsect1>
20139<title>Note</title>
20140<para>
20141   Don't call this function.  Currently, the networking layer calls this
20142   function, but that will change.  The following text from Kay Sievers offers
20143</para>
20144</refsect1>
20145<refsect1>
20146<title>some insight</title>
20147<para>
20148   </para><para>
20149
20150   Renaming devices is racy at many levels, symlinks and other stuff are not
20151   replaced atomically, and you get a <quote>move</quote> uevent, but it's not easy to
20152   connect the event to the old and new device. Device nodes are not renamed at
20153   all, there isn't even support for that in the kernel now.
20154   </para><para>
20155
20156   In the meantime, during renaming, your target name might be taken by another
20157   driver, creating conflicts. Or the old name is taken directly after you
20158   renamed it -- then you get events for the same DEVPATH, before you even see
20159   the <quote>move</quote> event. It's just a mess, and nothing new should ever rely on
20160   kernel device renaming. Besides that, it's not even implemented now for
20161   other things than (driver-core wise very simple) network devices.
20162   </para><para>
20163
20164   We are currently about to change network renaming in udev to completely
20165   disallow renaming of devices in the same namespace as the kernel uses,
20166   because we can't solve the problems properly, that arise with swapping names
20167   of multiple interfaces without races. Means, renaming of eth[0-9]* will only
20168   be allowed to some other name than eth[0-9]*, for the aforementioned
20169   reasons.
20170   </para><para>
20171
20172   Make up a <quote>real</quote> name in the driver before you register anything, or add
20173   some other attributes for userspace to find the device, or use udev to add
20174   symlinks -- but never rename kernel devices later, it's a complete mess. We
20175   don't even want to get into that and try to implement the missing pieces in
20176   the core. We really have other pieces to fix in the driver core mess. :)
20177</para>
20178</refsect1>
20179</refentry>
20180
20181<refentry id="API-device-move">
20182<refentryinfo>
20183 <title>LINUX</title>
20184 <productname>Kernel Hackers Manual</productname>
20185 <date>July 2017</date>
20186</refentryinfo>
20187<refmeta>
20188 <refentrytitle><phrase>device_move</phrase></refentrytitle>
20189 <manvolnum>9</manvolnum>
20190 <refmiscinfo class="version">4.4.14</refmiscinfo>
20191</refmeta>
20192<refnamediv>
20193 <refname>device_move</refname>
20194 <refpurpose>
20195     moves a device to a new parent
20196 </refpurpose>
20197</refnamediv>
20198<refsynopsisdiv>
20199 <title>Synopsis</title>
20200  <funcsynopsis><funcprototype>
20201   <funcdef>int <function>device_move </function></funcdef>
20202   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
20203   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>new_parent</parameter></paramdef>
20204   <paramdef>enum dpm_order <parameter>dpm_order</parameter></paramdef>
20205  </funcprototype></funcsynopsis>
20206</refsynopsisdiv>
20207<refsect1>
20208 <title>Arguments</title>
20209 <variablelist>
20210  <varlistentry>
20211   <term><parameter>dev</parameter></term>
20212   <listitem>
20213    <para>
20214     the pointer to the struct device to be moved
20215    </para>
20216   </listitem>
20217  </varlistentry>
20218  <varlistentry>
20219   <term><parameter>new_parent</parameter></term>
20220   <listitem>
20221    <para>
20222     the new parent of the device (can by NULL)
20223    </para>
20224   </listitem>
20225  </varlistentry>
20226  <varlistentry>
20227   <term><parameter>dpm_order</parameter></term>
20228   <listitem>
20229    <para>
20230     how to reorder the dpm_list
20231    </para>
20232   </listitem>
20233  </varlistentry>
20234 </variablelist>
20235</refsect1>
20236</refentry>
20237
20238<refentry id="API-set-primary-fwnode">
20239<refentryinfo>
20240 <title>LINUX</title>
20241 <productname>Kernel Hackers Manual</productname>
20242 <date>July 2017</date>
20243</refentryinfo>
20244<refmeta>
20245 <refentrytitle><phrase>set_primary_fwnode</phrase></refentrytitle>
20246 <manvolnum>9</manvolnum>
20247 <refmiscinfo class="version">4.4.14</refmiscinfo>
20248</refmeta>
20249<refnamediv>
20250 <refname>set_primary_fwnode</refname>
20251 <refpurpose>
20252     Change the primary firmware node of a given device.
20253 </refpurpose>
20254</refnamediv>
20255<refsynopsisdiv>
20256 <title>Synopsis</title>
20257  <funcsynopsis><funcprototype>
20258   <funcdef>void <function>set_primary_fwnode </function></funcdef>
20259   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
20260   <paramdef>struct fwnode_handle * <parameter>fwnode</parameter></paramdef>
20261  </funcprototype></funcsynopsis>
20262</refsynopsisdiv>
20263<refsect1>
20264 <title>Arguments</title>
20265 <variablelist>
20266  <varlistentry>
20267   <term><parameter>dev</parameter></term>
20268   <listitem>
20269    <para>
20270     Device to handle.
20271    </para>
20272   </listitem>
20273  </varlistentry>
20274  <varlistentry>
20275   <term><parameter>fwnode</parameter></term>
20276   <listitem>
20277    <para>
20278     New primary firmware node of the device.
20279    </para>
20280   </listitem>
20281  </varlistentry>
20282 </variablelist>
20283</refsect1>
20284<refsect1>
20285<title>Description</title>
20286<para>
20287   Set the device's firmware node pointer to <parameter>fwnode</parameter>, but if a secondary
20288   firmware node of the device is present, preserve it.
20289</para>
20290</refsect1>
20291</refentry>
20292
20293<!-- drivers/base/syscore.c -->
20294<refentry id="API-register-syscore-ops">
20295<refentryinfo>
20296 <title>LINUX</title>
20297 <productname>Kernel Hackers Manual</productname>
20298 <date>July 2017</date>
20299</refentryinfo>
20300<refmeta>
20301 <refentrytitle><phrase>register_syscore_ops</phrase></refentrytitle>
20302 <manvolnum>9</manvolnum>
20303 <refmiscinfo class="version">4.4.14</refmiscinfo>
20304</refmeta>
20305<refnamediv>
20306 <refname>register_syscore_ops</refname>
20307 <refpurpose>
20308  Register a set of system core operations.
20309 </refpurpose>
20310</refnamediv>
20311<refsynopsisdiv>
20312 <title>Synopsis</title>
20313  <funcsynopsis><funcprototype>
20314   <funcdef>void <function>register_syscore_ops </function></funcdef>
20315   <paramdef>struct syscore_ops * <parameter>ops</parameter></paramdef>
20316  </funcprototype></funcsynopsis>
20317</refsynopsisdiv>
20318<refsect1>
20319 <title>Arguments</title>
20320 <variablelist>
20321  <varlistentry>
20322   <term><parameter>ops</parameter></term>
20323   <listitem>
20324    <para>
20325     System core operations to register.
20326    </para>
20327   </listitem>
20328  </varlistentry>
20329 </variablelist>
20330</refsect1>
20331</refentry>
20332
20333<refentry id="API-unregister-syscore-ops">
20334<refentryinfo>
20335 <title>LINUX</title>
20336 <productname>Kernel Hackers Manual</productname>
20337 <date>July 2017</date>
20338</refentryinfo>
20339<refmeta>
20340 <refentrytitle><phrase>unregister_syscore_ops</phrase></refentrytitle>
20341 <manvolnum>9</manvolnum>
20342 <refmiscinfo class="version">4.4.14</refmiscinfo>
20343</refmeta>
20344<refnamediv>
20345 <refname>unregister_syscore_ops</refname>
20346 <refpurpose>
20347     Unregister a set of system core operations.
20348 </refpurpose>
20349</refnamediv>
20350<refsynopsisdiv>
20351 <title>Synopsis</title>
20352  <funcsynopsis><funcprototype>
20353   <funcdef>void <function>unregister_syscore_ops </function></funcdef>
20354   <paramdef>struct syscore_ops * <parameter>ops</parameter></paramdef>
20355  </funcprototype></funcsynopsis>
20356</refsynopsisdiv>
20357<refsect1>
20358 <title>Arguments</title>
20359 <variablelist>
20360  <varlistentry>
20361   <term><parameter>ops</parameter></term>
20362   <listitem>
20363    <para>
20364     System core operations to unregister.
20365    </para>
20366   </listitem>
20367  </varlistentry>
20368 </variablelist>
20369</refsect1>
20370</refentry>
20371
20372<refentry id="API-syscore-suspend">
20373<refentryinfo>
20374 <title>LINUX</title>
20375 <productname>Kernel Hackers Manual</productname>
20376 <date>July 2017</date>
20377</refentryinfo>
20378<refmeta>
20379 <refentrytitle><phrase>syscore_suspend</phrase></refentrytitle>
20380 <manvolnum>9</manvolnum>
20381 <refmiscinfo class="version">4.4.14</refmiscinfo>
20382</refmeta>
20383<refnamediv>
20384 <refname>syscore_suspend</refname>
20385 <refpurpose>
20386     Execute all the registered system core suspend callbacks.
20387 </refpurpose>
20388</refnamediv>
20389<refsynopsisdiv>
20390 <title>Synopsis</title>
20391  <funcsynopsis><funcprototype>
20392   <funcdef>int <function>syscore_suspend </function></funcdef>
20393   <paramdef> <parameter>void</parameter></paramdef>
20394  </funcprototype></funcsynopsis>
20395</refsynopsisdiv>
20396<refsect1>
20397 <title>Arguments</title>
20398 <variablelist>
20399  <varlistentry>
20400   <term><parameter>void</parameter></term>
20401   <listitem>
20402    <para>
20403     no arguments
20404    </para>
20405   </listitem>
20406  </varlistentry>
20407 </variablelist>
20408</refsect1>
20409<refsect1>
20410<title>Description</title>
20411<para>
20412   </para><para>
20413
20414   This function is executed with one CPU on-line and disabled interrupts.
20415</para>
20416</refsect1>
20417</refentry>
20418
20419<refentry id="API-syscore-resume">
20420<refentryinfo>
20421 <title>LINUX</title>
20422 <productname>Kernel Hackers Manual</productname>
20423 <date>July 2017</date>
20424</refentryinfo>
20425<refmeta>
20426 <refentrytitle><phrase>syscore_resume</phrase></refentrytitle>
20427 <manvolnum>9</manvolnum>
20428 <refmiscinfo class="version">4.4.14</refmiscinfo>
20429</refmeta>
20430<refnamediv>
20431 <refname>syscore_resume</refname>
20432 <refpurpose>
20433     Execute all the registered system core resume callbacks.
20434 </refpurpose>
20435</refnamediv>
20436<refsynopsisdiv>
20437 <title>Synopsis</title>
20438  <funcsynopsis><funcprototype>
20439   <funcdef>void <function>syscore_resume </function></funcdef>
20440   <paramdef> <parameter>void</parameter></paramdef>
20441  </funcprototype></funcsynopsis>
20442</refsynopsisdiv>
20443<refsect1>
20444 <title>Arguments</title>
20445 <variablelist>
20446  <varlistentry>
20447   <term><parameter>void</parameter></term>
20448   <listitem>
20449    <para>
20450     no arguments
20451    </para>
20452   </listitem>
20453  </varlistentry>
20454 </variablelist>
20455</refsect1>
20456<refsect1>
20457<title>Description</title>
20458<para>
20459   </para><para>
20460
20461   This function is executed with one CPU on-line and disabled interrupts.
20462</para>
20463</refsect1>
20464</refentry>
20465
20466<!-- drivers/base/class.c -->
20467<refentry id="API---class-create">
20468<refentryinfo>
20469 <title>LINUX</title>
20470 <productname>Kernel Hackers Manual</productname>
20471 <date>July 2017</date>
20472</refentryinfo>
20473<refmeta>
20474 <refentrytitle><phrase>__class_create</phrase></refentrytitle>
20475 <manvolnum>9</manvolnum>
20476 <refmiscinfo class="version">4.4.14</refmiscinfo>
20477</refmeta>
20478<refnamediv>
20479 <refname>__class_create</refname>
20480 <refpurpose>
20481  create a struct class structure
20482 </refpurpose>
20483</refnamediv>
20484<refsynopsisdiv>
20485 <title>Synopsis</title>
20486  <funcsynopsis><funcprototype>
20487   <funcdef><link linkend="API-struct-class">struct class</link> * <function>__class_create </function></funcdef>
20488   <paramdef>struct module * <parameter>owner</parameter></paramdef>
20489   <paramdef>const char * <parameter>name</parameter></paramdef>
20490   <paramdef>struct lock_class_key * <parameter>key</parameter></paramdef>
20491  </funcprototype></funcsynopsis>
20492</refsynopsisdiv>
20493<refsect1>
20494 <title>Arguments</title>
20495 <variablelist>
20496  <varlistentry>
20497   <term><parameter>owner</parameter></term>
20498   <listitem>
20499    <para>
20500     pointer to the module that is to <quote>own</quote> this struct class
20501    </para>
20502   </listitem>
20503  </varlistentry>
20504  <varlistentry>
20505   <term><parameter>name</parameter></term>
20506   <listitem>
20507    <para>
20508     pointer to a string for the name of this class.
20509    </para>
20510   </listitem>
20511  </varlistentry>
20512  <varlistentry>
20513   <term><parameter>key</parameter></term>
20514   <listitem>
20515    <para>
20516     the lock_class_key for this class; used by mutex lock debugging
20517    </para>
20518   </listitem>
20519  </varlistentry>
20520 </variablelist>
20521</refsect1>
20522<refsect1>
20523<title>Description</title>
20524<para>
20525   This is used to create a struct class pointer that can then be used
20526   in calls to <function><link linkend="API-device-create">device_create</link></function>.
20527   </para><para>
20528
20529   Returns <structname><link linkend="API-struct-class">struct class</link></structname> pointer on success, or <function>ERR_PTR</function> on error.
20530   </para><para>
20531
20532   Note, the pointer created here is to be destroyed when finished by
20533   making a call to <function><link linkend="API-class-destroy">class_destroy</link></function>.
20534</para>
20535</refsect1>
20536</refentry>
20537
20538<refentry id="API-class-destroy">
20539<refentryinfo>
20540 <title>LINUX</title>
20541 <productname>Kernel Hackers Manual</productname>
20542 <date>July 2017</date>
20543</refentryinfo>
20544<refmeta>
20545 <refentrytitle><phrase>class_destroy</phrase></refentrytitle>
20546 <manvolnum>9</manvolnum>
20547 <refmiscinfo class="version">4.4.14</refmiscinfo>
20548</refmeta>
20549<refnamediv>
20550 <refname>class_destroy</refname>
20551 <refpurpose>
20552     destroys a struct class structure
20553 </refpurpose>
20554</refnamediv>
20555<refsynopsisdiv>
20556 <title>Synopsis</title>
20557  <funcsynopsis><funcprototype>
20558   <funcdef>void <function>class_destroy </function></funcdef>
20559   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>cls</parameter></paramdef>
20560  </funcprototype></funcsynopsis>
20561</refsynopsisdiv>
20562<refsect1>
20563 <title>Arguments</title>
20564 <variablelist>
20565  <varlistentry>
20566   <term><parameter>cls</parameter></term>
20567   <listitem>
20568    <para>
20569     pointer to the struct class that is to be destroyed
20570    </para>
20571   </listitem>
20572  </varlistentry>
20573 </variablelist>
20574</refsect1>
20575<refsect1>
20576<title>Description</title>
20577<para>
20578   Note, the pointer to be destroyed must have been created with a call
20579   to <function>class_create</function>.
20580</para>
20581</refsect1>
20582</refentry>
20583
20584<refentry id="API-class-dev-iter-init">
20585<refentryinfo>
20586 <title>LINUX</title>
20587 <productname>Kernel Hackers Manual</productname>
20588 <date>July 2017</date>
20589</refentryinfo>
20590<refmeta>
20591 <refentrytitle><phrase>class_dev_iter_init</phrase></refentrytitle>
20592 <manvolnum>9</manvolnum>
20593 <refmiscinfo class="version">4.4.14</refmiscinfo>
20594</refmeta>
20595<refnamediv>
20596 <refname>class_dev_iter_init</refname>
20597 <refpurpose>
20598     initialize class device iterator
20599 </refpurpose>
20600</refnamediv>
20601<refsynopsisdiv>
20602 <title>Synopsis</title>
20603  <funcsynopsis><funcprototype>
20604   <funcdef>void <function>class_dev_iter_init </function></funcdef>
20605   <paramdef>struct class_dev_iter * <parameter>iter</parameter></paramdef>
20606   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>class</parameter></paramdef>
20607   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
20608   <paramdef>const struct device_type * <parameter>type</parameter></paramdef>
20609  </funcprototype></funcsynopsis>
20610</refsynopsisdiv>
20611<refsect1>
20612 <title>Arguments</title>
20613 <variablelist>
20614  <varlistentry>
20615   <term><parameter>iter</parameter></term>
20616   <listitem>
20617    <para>
20618     class iterator to initialize
20619    </para>
20620   </listitem>
20621  </varlistentry>
20622  <varlistentry>
20623   <term><parameter>class</parameter></term>
20624   <listitem>
20625    <para>
20626     the class we wanna iterate over
20627    </para>
20628   </listitem>
20629  </varlistentry>
20630  <varlistentry>
20631   <term><parameter>start</parameter></term>
20632   <listitem>
20633    <para>
20634     the device to start iterating from, if any
20635    </para>
20636   </listitem>
20637  </varlistentry>
20638  <varlistentry>
20639   <term><parameter>type</parameter></term>
20640   <listitem>
20641    <para>
20642     device_type of the devices to iterate over, NULL for all
20643    </para>
20644   </listitem>
20645  </varlistentry>
20646 </variablelist>
20647</refsect1>
20648<refsect1>
20649<title>Description</title>
20650<para>
20651   Initialize class iterator <parameter>iter</parameter> such that it iterates over devices
20652   of <parameter>class</parameter>.  If <parameter>start</parameter> is set, the list iteration will start there,
20653   otherwise if it is NULL, the iteration starts at the beginning of
20654   the list.
20655</para>
20656</refsect1>
20657</refentry>
20658
20659<refentry id="API-class-dev-iter-next">
20660<refentryinfo>
20661 <title>LINUX</title>
20662 <productname>Kernel Hackers Manual</productname>
20663 <date>July 2017</date>
20664</refentryinfo>
20665<refmeta>
20666 <refentrytitle><phrase>class_dev_iter_next</phrase></refentrytitle>
20667 <manvolnum>9</manvolnum>
20668 <refmiscinfo class="version">4.4.14</refmiscinfo>
20669</refmeta>
20670<refnamediv>
20671 <refname>class_dev_iter_next</refname>
20672 <refpurpose>
20673     iterate to the next device
20674 </refpurpose>
20675</refnamediv>
20676<refsynopsisdiv>
20677 <title>Synopsis</title>
20678  <funcsynopsis><funcprototype>
20679   <funcdef><link linkend="API-struct-device">struct device</link> * <function>class_dev_iter_next </function></funcdef>
20680   <paramdef>struct class_dev_iter * <parameter>iter</parameter></paramdef>
20681  </funcprototype></funcsynopsis>
20682</refsynopsisdiv>
20683<refsect1>
20684 <title>Arguments</title>
20685 <variablelist>
20686  <varlistentry>
20687   <term><parameter>iter</parameter></term>
20688   <listitem>
20689    <para>
20690     class iterator to proceed
20691    </para>
20692   </listitem>
20693  </varlistentry>
20694 </variablelist>
20695</refsect1>
20696<refsect1>
20697<title>Description</title>
20698<para>
20699   Proceed <parameter>iter</parameter> to the next device and return it.  Returns NULL if
20700   iteration is complete.
20701   </para><para>
20702
20703   The returned device is referenced and won't be released till
20704   iterator is proceed to the next device or exited.  The caller is
20705   free to do whatever it wants to do with the device including
20706   calling back into class code.
20707</para>
20708</refsect1>
20709</refentry>
20710
20711<refentry id="API-class-dev-iter-exit">
20712<refentryinfo>
20713 <title>LINUX</title>
20714 <productname>Kernel Hackers Manual</productname>
20715 <date>July 2017</date>
20716</refentryinfo>
20717<refmeta>
20718 <refentrytitle><phrase>class_dev_iter_exit</phrase></refentrytitle>
20719 <manvolnum>9</manvolnum>
20720 <refmiscinfo class="version">4.4.14</refmiscinfo>
20721</refmeta>
20722<refnamediv>
20723 <refname>class_dev_iter_exit</refname>
20724 <refpurpose>
20725     finish iteration
20726 </refpurpose>
20727</refnamediv>
20728<refsynopsisdiv>
20729 <title>Synopsis</title>
20730  <funcsynopsis><funcprototype>
20731   <funcdef>void <function>class_dev_iter_exit </function></funcdef>
20732   <paramdef>struct class_dev_iter * <parameter>iter</parameter></paramdef>
20733  </funcprototype></funcsynopsis>
20734</refsynopsisdiv>
20735<refsect1>
20736 <title>Arguments</title>
20737 <variablelist>
20738  <varlistentry>
20739   <term><parameter>iter</parameter></term>
20740   <listitem>
20741    <para>
20742     class iterator to finish
20743    </para>
20744   </listitem>
20745  </varlistentry>
20746 </variablelist>
20747</refsect1>
20748<refsect1>
20749<title>Description</title>
20750<para>
20751   Finish an iteration.  Always call this function after iteration is
20752   complete whether the iteration ran till the end or not.
20753</para>
20754</refsect1>
20755</refentry>
20756
20757<refentry id="API-class-for-each-device">
20758<refentryinfo>
20759 <title>LINUX</title>
20760 <productname>Kernel Hackers Manual</productname>
20761 <date>July 2017</date>
20762</refentryinfo>
20763<refmeta>
20764 <refentrytitle><phrase>class_for_each_device</phrase></refentrytitle>
20765 <manvolnum>9</manvolnum>
20766 <refmiscinfo class="version">4.4.14</refmiscinfo>
20767</refmeta>
20768<refnamediv>
20769 <refname>class_for_each_device</refname>
20770 <refpurpose>
20771     device iterator
20772 </refpurpose>
20773</refnamediv>
20774<refsynopsisdiv>
20775 <title>Synopsis</title>
20776  <funcsynopsis><funcprototype>
20777   <funcdef>int <function>class_for_each_device </function></funcdef>
20778   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>class</parameter></paramdef>
20779   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
20780   <paramdef>void * <parameter>data</parameter></paramdef>
20781   <paramdef>int (*<parameter>fn</parameter>)
20782     <funcparams>struct device *, void *</funcparams></paramdef>
20783  </funcprototype></funcsynopsis>
20784</refsynopsisdiv>
20785<refsect1>
20786 <title>Arguments</title>
20787 <variablelist>
20788  <varlistentry>
20789   <term><parameter>class</parameter></term>
20790   <listitem>
20791    <para>
20792     the class we're iterating
20793    </para>
20794   </listitem>
20795  </varlistentry>
20796  <varlistentry>
20797   <term><parameter>start</parameter></term>
20798   <listitem>
20799    <para>
20800     the device to start with in the list, if any.
20801    </para>
20802   </listitem>
20803  </varlistentry>
20804  <varlistentry>
20805   <term><parameter>data</parameter></term>
20806   <listitem>
20807    <para>
20808     data for the callback
20809    </para>
20810   </listitem>
20811  </varlistentry>
20812  <varlistentry>
20813   <term><parameter>fn</parameter></term>
20814   <listitem>
20815    <para>
20816     function to be called for each device
20817    </para>
20818   </listitem>
20819  </varlistentry>
20820 </variablelist>
20821</refsect1>
20822<refsect1>
20823<title>Description</title>
20824<para>
20825   Iterate over <parameter>class</parameter>'s list of devices, and call <parameter>fn</parameter> for each,
20826   passing it <parameter>data</parameter>.  If <parameter>start</parameter> is set, the list iteration will start
20827   there, otherwise if it is NULL, the iteration starts at the
20828   beginning of the list.
20829   </para><para>
20830
20831   We check the return of <parameter>fn</parameter> each time. If it returns anything
20832   other than 0, we break out and return that value.
20833   </para><para>
20834
20835   <parameter>fn</parameter> is allowed to do anything including calling back into class
20836   code.  There's no locking restriction.
20837</para>
20838</refsect1>
20839</refentry>
20840
20841<refentry id="API-class-find-device">
20842<refentryinfo>
20843 <title>LINUX</title>
20844 <productname>Kernel Hackers Manual</productname>
20845 <date>July 2017</date>
20846</refentryinfo>
20847<refmeta>
20848 <refentrytitle><phrase>class_find_device</phrase></refentrytitle>
20849 <manvolnum>9</manvolnum>
20850 <refmiscinfo class="version">4.4.14</refmiscinfo>
20851</refmeta>
20852<refnamediv>
20853 <refname>class_find_device</refname>
20854 <refpurpose>
20855     device iterator for locating a particular device
20856 </refpurpose>
20857</refnamediv>
20858<refsynopsisdiv>
20859 <title>Synopsis</title>
20860  <funcsynopsis><funcprototype>
20861   <funcdef><link linkend="API-struct-device">struct device</link> * <function>class_find_device </function></funcdef>
20862   <paramdef><link linkend="API-struct-class">struct class</link> * <parameter>class</parameter></paramdef>
20863   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
20864   <paramdef>const void * <parameter>data</parameter></paramdef>
20865   <paramdef>int (*<parameter>match</parameter>)
20866     <funcparams>struct device *, const void *</funcparams></paramdef>
20867  </funcprototype></funcsynopsis>
20868</refsynopsisdiv>
20869<refsect1>
20870 <title>Arguments</title>
20871 <variablelist>
20872  <varlistentry>
20873   <term><parameter>class</parameter></term>
20874   <listitem>
20875    <para>
20876     the class we're iterating
20877    </para>
20878   </listitem>
20879  </varlistentry>
20880  <varlistentry>
20881   <term><parameter>start</parameter></term>
20882   <listitem>
20883    <para>
20884     Device to begin with
20885    </para>
20886   </listitem>
20887  </varlistentry>
20888  <varlistentry>
20889   <term><parameter>data</parameter></term>
20890   <listitem>
20891    <para>
20892     data for the match function
20893    </para>
20894   </listitem>
20895  </varlistentry>
20896  <varlistentry>
20897   <term><parameter>match</parameter></term>
20898   <listitem>
20899    <para>
20900     function to check device
20901    </para>
20902   </listitem>
20903  </varlistentry>
20904 </variablelist>
20905</refsect1>
20906<refsect1>
20907<title>Description</title>
20908<para>
20909   This is similar to the <function>class_for_each_dev</function> function above, but it
20910   returns a reference to a device that is 'found' for later use, as
20911   determined by the <parameter>match</parameter> callback.
20912   </para><para>
20913
20914   The callback should return 0 if the device doesn't match and non-zero
20915   if it does.  If the callback returns non-zero, this function will
20916   return to the caller and not iterate over any more devices.
20917   </para><para>
20918
20919   Note, you will need to drop the reference with <function><link linkend="API-put-device">put_device</link></function> after use.
20920   </para><para>
20921
20922   <parameter>match</parameter> is allowed to do anything including calling back into class
20923   code.  There's no locking restriction.
20924</para>
20925</refsect1>
20926</refentry>
20927
20928<refentry id="API-class-compat-register">
20929<refentryinfo>
20930 <title>LINUX</title>
20931 <productname>Kernel Hackers Manual</productname>
20932 <date>July 2017</date>
20933</refentryinfo>
20934<refmeta>
20935 <refentrytitle><phrase>class_compat_register</phrase></refentrytitle>
20936 <manvolnum>9</manvolnum>
20937 <refmiscinfo class="version">4.4.14</refmiscinfo>
20938</refmeta>
20939<refnamediv>
20940 <refname>class_compat_register</refname>
20941 <refpurpose>
20942     register a compatibility class
20943 </refpurpose>
20944</refnamediv>
20945<refsynopsisdiv>
20946 <title>Synopsis</title>
20947  <funcsynopsis><funcprototype>
20948   <funcdef>struct class_compat * <function>class_compat_register </function></funcdef>
20949   <paramdef>const char * <parameter>name</parameter></paramdef>
20950  </funcprototype></funcsynopsis>
20951</refsynopsisdiv>
20952<refsect1>
20953 <title>Arguments</title>
20954 <variablelist>
20955  <varlistentry>
20956   <term><parameter>name</parameter></term>
20957   <listitem>
20958    <para>
20959     the name of the class
20960    </para>
20961   </listitem>
20962  </varlistentry>
20963 </variablelist>
20964</refsect1>
20965<refsect1>
20966<title>Description</title>
20967<para>
20968   Compatibility class are meant as a temporary user-space compatibility
20969   workaround when converting a family of class devices to a bus devices.
20970</para>
20971</refsect1>
20972</refentry>
20973
20974<refentry id="API-class-compat-unregister">
20975<refentryinfo>
20976 <title>LINUX</title>
20977 <productname>Kernel Hackers Manual</productname>
20978 <date>July 2017</date>
20979</refentryinfo>
20980<refmeta>
20981 <refentrytitle><phrase>class_compat_unregister</phrase></refentrytitle>
20982 <manvolnum>9</manvolnum>
20983 <refmiscinfo class="version">4.4.14</refmiscinfo>
20984</refmeta>
20985<refnamediv>
20986 <refname>class_compat_unregister</refname>
20987 <refpurpose>
20988     unregister a compatibility class
20989 </refpurpose>
20990</refnamediv>
20991<refsynopsisdiv>
20992 <title>Synopsis</title>
20993  <funcsynopsis><funcprototype>
20994   <funcdef>void <function>class_compat_unregister </function></funcdef>
20995   <paramdef>struct class_compat * <parameter>cls</parameter></paramdef>
20996  </funcprototype></funcsynopsis>
20997</refsynopsisdiv>
20998<refsect1>
20999 <title>Arguments</title>
21000 <variablelist>
21001  <varlistentry>
21002   <term><parameter>cls</parameter></term>
21003   <listitem>
21004    <para>
21005     the class to unregister
21006    </para>
21007   </listitem>
21008  </varlistentry>
21009 </variablelist>
21010</refsect1>
21011</refentry>
21012
21013<refentry id="API-class-compat-create-link">
21014<refentryinfo>
21015 <title>LINUX</title>
21016 <productname>Kernel Hackers Manual</productname>
21017 <date>July 2017</date>
21018</refentryinfo>
21019<refmeta>
21020 <refentrytitle><phrase>class_compat_create_link</phrase></refentrytitle>
21021 <manvolnum>9</manvolnum>
21022 <refmiscinfo class="version">4.4.14</refmiscinfo>
21023</refmeta>
21024<refnamediv>
21025 <refname>class_compat_create_link</refname>
21026 <refpurpose>
21027     create a compatibility class device link to a bus device
21028 </refpurpose>
21029</refnamediv>
21030<refsynopsisdiv>
21031 <title>Synopsis</title>
21032  <funcsynopsis><funcprototype>
21033   <funcdef>int <function>class_compat_create_link </function></funcdef>
21034   <paramdef>struct class_compat * <parameter>cls</parameter></paramdef>
21035   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21036   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device_link</parameter></paramdef>
21037  </funcprototype></funcsynopsis>
21038</refsynopsisdiv>
21039<refsect1>
21040 <title>Arguments</title>
21041 <variablelist>
21042  <varlistentry>
21043   <term><parameter>cls</parameter></term>
21044   <listitem>
21045    <para>
21046     the compatibility class
21047    </para>
21048   </listitem>
21049  </varlistentry>
21050  <varlistentry>
21051   <term><parameter>dev</parameter></term>
21052   <listitem>
21053    <para>
21054     the target bus device
21055    </para>
21056   </listitem>
21057  </varlistentry>
21058  <varlistentry>
21059   <term><parameter>device_link</parameter></term>
21060   <listitem>
21061    <para>
21062     an optional device to which a <quote>device</quote> link should be created
21063    </para>
21064   </listitem>
21065  </varlistentry>
21066 </variablelist>
21067</refsect1>
21068</refentry>
21069
21070<refentry id="API-class-compat-remove-link">
21071<refentryinfo>
21072 <title>LINUX</title>
21073 <productname>Kernel Hackers Manual</productname>
21074 <date>July 2017</date>
21075</refentryinfo>
21076<refmeta>
21077 <refentrytitle><phrase>class_compat_remove_link</phrase></refentrytitle>
21078 <manvolnum>9</manvolnum>
21079 <refmiscinfo class="version">4.4.14</refmiscinfo>
21080</refmeta>
21081<refnamediv>
21082 <refname>class_compat_remove_link</refname>
21083 <refpurpose>
21084     remove a compatibility class device link to a bus device
21085 </refpurpose>
21086</refnamediv>
21087<refsynopsisdiv>
21088 <title>Synopsis</title>
21089  <funcsynopsis><funcprototype>
21090   <funcdef>void <function>class_compat_remove_link </function></funcdef>
21091   <paramdef>struct class_compat * <parameter>cls</parameter></paramdef>
21092   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21093   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device_link</parameter></paramdef>
21094  </funcprototype></funcsynopsis>
21095</refsynopsisdiv>
21096<refsect1>
21097 <title>Arguments</title>
21098 <variablelist>
21099  <varlistentry>
21100   <term><parameter>cls</parameter></term>
21101   <listitem>
21102    <para>
21103     the compatibility class
21104    </para>
21105   </listitem>
21106  </varlistentry>
21107  <varlistentry>
21108   <term><parameter>dev</parameter></term>
21109   <listitem>
21110    <para>
21111     the target bus device
21112    </para>
21113   </listitem>
21114  </varlistentry>
21115  <varlistentry>
21116   <term><parameter>device_link</parameter></term>
21117   <listitem>
21118    <para>
21119     an optional device to which a <quote>device</quote> link was previously
21120     created
21121    </para>
21122   </listitem>
21123  </varlistentry>
21124 </variablelist>
21125</refsect1>
21126</refentry>
21127
21128<!-- drivers/base/node.c -->
21129<refentry id="API-unregister-node">
21130<refentryinfo>
21131 <title>LINUX</title>
21132 <productname>Kernel Hackers Manual</productname>
21133 <date>July 2017</date>
21134</refentryinfo>
21135<refmeta>
21136 <refentrytitle><phrase>unregister_node</phrase></refentrytitle>
21137 <manvolnum>9</manvolnum>
21138 <refmiscinfo class="version">4.4.14</refmiscinfo>
21139</refmeta>
21140<refnamediv>
21141 <refname>unregister_node</refname>
21142 <refpurpose>
21143  unregister a node device
21144 </refpurpose>
21145</refnamediv>
21146<refsynopsisdiv>
21147 <title>Synopsis</title>
21148  <funcsynopsis><funcprototype>
21149   <funcdef>void <function>unregister_node </function></funcdef>
21150   <paramdef>struct node * <parameter>node</parameter></paramdef>
21151  </funcprototype></funcsynopsis>
21152</refsynopsisdiv>
21153<refsect1>
21154 <title>Arguments</title>
21155 <variablelist>
21156  <varlistentry>
21157   <term><parameter>node</parameter></term>
21158   <listitem>
21159    <para>
21160     node going away
21161    </para>
21162   </listitem>
21163  </varlistentry>
21164 </variablelist>
21165</refsect1>
21166<refsect1>
21167<title>Description</title>
21168<para>
21169   Unregisters a node device <parameter>node</parameter>.  All the devices on the node must be
21170   unregistered before calling this function.
21171</para>
21172</refsect1>
21173</refentry>
21174
21175<!-- drivers/base/firmware_class.c -->
21176<refentry id="API-request-firmware">
21177<refentryinfo>
21178 <title>LINUX</title>
21179 <productname>Kernel Hackers Manual</productname>
21180 <date>July 2017</date>
21181</refentryinfo>
21182<refmeta>
21183 <refentrytitle><phrase>request_firmware</phrase></refentrytitle>
21184 <manvolnum>9</manvolnum>
21185 <refmiscinfo class="version">4.4.14</refmiscinfo>
21186</refmeta>
21187<refnamediv>
21188 <refname>request_firmware</refname>
21189 <refpurpose>
21190  send firmware request and wait for it
21191 </refpurpose>
21192</refnamediv>
21193<refsynopsisdiv>
21194 <title>Synopsis</title>
21195  <funcsynopsis><funcprototype>
21196   <funcdef>int <function>request_firmware </function></funcdef>
21197   <paramdef>const struct firmware ** <parameter>firmware_p</parameter></paramdef>
21198   <paramdef>const char * <parameter>name</parameter></paramdef>
21199   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device</parameter></paramdef>
21200  </funcprototype></funcsynopsis>
21201</refsynopsisdiv>
21202<refsect1>
21203 <title>Arguments</title>
21204 <variablelist>
21205  <varlistentry>
21206   <term><parameter>firmware_p</parameter></term>
21207   <listitem>
21208    <para>
21209     pointer to firmware image
21210    </para>
21211   </listitem>
21212  </varlistentry>
21213  <varlistentry>
21214   <term><parameter>name</parameter></term>
21215   <listitem>
21216    <para>
21217     name of firmware file
21218    </para>
21219   </listitem>
21220  </varlistentry>
21221  <varlistentry>
21222   <term><parameter>device</parameter></term>
21223   <listitem>
21224    <para>
21225     device for which firmware is being loaded
21226    </para>
21227   </listitem>
21228  </varlistentry>
21229 </variablelist>
21230</refsect1>
21231<refsect1>
21232<title>Description</title>
21233<para>
21234   <parameter>firmware_p</parameter> will be used to return a firmware image by the name
21235   of <parameter>name</parameter> for device <parameter>device</parameter>.
21236   </para><para>
21237
21238   Should be called from user context where sleeping is allowed.
21239   </para><para>
21240
21241   <parameter>name</parameter> will be used as <envar>$FIRMWARE</envar> in the uevent environment and
21242   should be distinctive enough not to be confused with any other
21243   firmware image for this or any other device.
21244   </para><para>
21245
21246   Caller must hold the reference count of <parameter>device</parameter>.
21247   </para><para>
21248
21249   The function can be called safely inside device's suspend and
21250   resume callback.
21251</para>
21252</refsect1>
21253</refentry>
21254
21255<refentry id="API-request-firmware-direct">
21256<refentryinfo>
21257 <title>LINUX</title>
21258 <productname>Kernel Hackers Manual</productname>
21259 <date>July 2017</date>
21260</refentryinfo>
21261<refmeta>
21262 <refentrytitle><phrase>request_firmware_direct</phrase></refentrytitle>
21263 <manvolnum>9</manvolnum>
21264 <refmiscinfo class="version">4.4.14</refmiscinfo>
21265</refmeta>
21266<refnamediv>
21267 <refname>request_firmware_direct</refname>
21268 <refpurpose>
21269     load firmware directly without usermode helper
21270 </refpurpose>
21271</refnamediv>
21272<refsynopsisdiv>
21273 <title>Synopsis</title>
21274  <funcsynopsis><funcprototype>
21275   <funcdef>int <function>request_firmware_direct </function></funcdef>
21276   <paramdef>const struct firmware ** <parameter>firmware_p</parameter></paramdef>
21277   <paramdef>const char * <parameter>name</parameter></paramdef>
21278   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device</parameter></paramdef>
21279  </funcprototype></funcsynopsis>
21280</refsynopsisdiv>
21281<refsect1>
21282 <title>Arguments</title>
21283 <variablelist>
21284  <varlistentry>
21285   <term><parameter>firmware_p</parameter></term>
21286   <listitem>
21287    <para>
21288     pointer to firmware image
21289    </para>
21290   </listitem>
21291  </varlistentry>
21292  <varlistentry>
21293   <term><parameter>name</parameter></term>
21294   <listitem>
21295    <para>
21296     name of firmware file
21297    </para>
21298   </listitem>
21299  </varlistentry>
21300  <varlistentry>
21301   <term><parameter>device</parameter></term>
21302   <listitem>
21303    <para>
21304     device for which firmware is being loaded
21305    </para>
21306   </listitem>
21307  </varlistentry>
21308 </variablelist>
21309</refsect1>
21310<refsect1>
21311<title>Description</title>
21312<para>
21313   This function works pretty much like <function><link linkend="API-request-firmware">request_firmware</link></function>, but this doesn't
21314   fall back to usermode helper even if the firmware couldn't be loaded
21315   directly from fs.  Hence it's useful for loading optional firmwares, which
21316   aren't always present, without extra long timeouts of udev.
21317</para>
21318</refsect1>
21319</refentry>
21320
21321<refentry id="API-release-firmware">
21322<refentryinfo>
21323 <title>LINUX</title>
21324 <productname>Kernel Hackers Manual</productname>
21325 <date>July 2017</date>
21326</refentryinfo>
21327<refmeta>
21328 <refentrytitle><phrase>release_firmware</phrase></refentrytitle>
21329 <manvolnum>9</manvolnum>
21330 <refmiscinfo class="version">4.4.14</refmiscinfo>
21331</refmeta>
21332<refnamediv>
21333 <refname>release_firmware</refname>
21334 <refpurpose>
21335     release the resource associated with a firmware image
21336 </refpurpose>
21337</refnamediv>
21338<refsynopsisdiv>
21339 <title>Synopsis</title>
21340  <funcsynopsis><funcprototype>
21341   <funcdef>void <function>release_firmware </function></funcdef>
21342   <paramdef>const struct firmware * <parameter>fw</parameter></paramdef>
21343  </funcprototype></funcsynopsis>
21344</refsynopsisdiv>
21345<refsect1>
21346 <title>Arguments</title>
21347 <variablelist>
21348  <varlistentry>
21349   <term><parameter>fw</parameter></term>
21350   <listitem>
21351    <para>
21352     firmware resource to release
21353    </para>
21354   </listitem>
21355  </varlistentry>
21356 </variablelist>
21357</refsect1>
21358</refentry>
21359
21360<refentry id="API-request-firmware-nowait">
21361<refentryinfo>
21362 <title>LINUX</title>
21363 <productname>Kernel Hackers Manual</productname>
21364 <date>July 2017</date>
21365</refentryinfo>
21366<refmeta>
21367 <refentrytitle><phrase>request_firmware_nowait</phrase></refentrytitle>
21368 <manvolnum>9</manvolnum>
21369 <refmiscinfo class="version">4.4.14</refmiscinfo>
21370</refmeta>
21371<refnamediv>
21372 <refname>request_firmware_nowait</refname>
21373 <refpurpose>
21374     asynchronous version of request_firmware
21375 </refpurpose>
21376</refnamediv>
21377<refsynopsisdiv>
21378 <title>Synopsis</title>
21379  <funcsynopsis><funcprototype>
21380   <funcdef>int <function>request_firmware_nowait </function></funcdef>
21381   <paramdef>struct module * <parameter>module</parameter></paramdef>
21382   <paramdef>bool <parameter>uevent</parameter></paramdef>
21383   <paramdef>const char * <parameter>name</parameter></paramdef>
21384   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device</parameter></paramdef>
21385   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
21386   <paramdef>void * <parameter>context</parameter></paramdef>
21387   <paramdef>void (*<parameter>cont</parameter>)
21388     <funcparams>const struct firmware *fw, void *context</funcparams></paramdef>
21389  </funcprototype></funcsynopsis>
21390</refsynopsisdiv>
21391<refsect1>
21392 <title>Arguments</title>
21393 <variablelist>
21394  <varlistentry>
21395   <term><parameter>module</parameter></term>
21396   <listitem>
21397    <para>
21398     module requesting the firmware
21399    </para>
21400   </listitem>
21401  </varlistentry>
21402  <varlistentry>
21403   <term><parameter>uevent</parameter></term>
21404   <listitem>
21405    <para>
21406     sends uevent to copy the firmware image if this flag
21407     is non-zero else the firmware copy must be done manually.
21408    </para>
21409   </listitem>
21410  </varlistentry>
21411  <varlistentry>
21412   <term><parameter>name</parameter></term>
21413   <listitem>
21414    <para>
21415     name of firmware file
21416    </para>
21417   </listitem>
21418  </varlistentry>
21419  <varlistentry>
21420   <term><parameter>device</parameter></term>
21421   <listitem>
21422    <para>
21423     device for which firmware is being loaded
21424    </para>
21425   </listitem>
21426  </varlistentry>
21427  <varlistentry>
21428   <term><parameter>gfp</parameter></term>
21429   <listitem>
21430    <para>
21431     allocation flags
21432    </para>
21433   </listitem>
21434  </varlistentry>
21435  <varlistentry>
21436   <term><parameter>context</parameter></term>
21437   <listitem>
21438    <para>
21439     will be passed over to <parameter>cont</parameter>, and
21440     <parameter>fw</parameter> may be <constant>NULL</constant> if firmware request fails.
21441    </para>
21442   </listitem>
21443  </varlistentry>
21444  <varlistentry>
21445   <term><parameter>cont</parameter></term>
21446   <listitem>
21447    <para>
21448     function will be called asynchronously when the firmware
21449     request is over.
21450    </para>
21451   </listitem>
21452  </varlistentry>
21453 </variablelist>
21454</refsect1>
21455<refsect1>
21456<title>Description</title>
21457<para>
21458   Caller must hold the reference count of <parameter>device</parameter>.
21459   </para><para>
21460
21461   Asynchronous variant of <function><link linkend="API-request-firmware">request_firmware</link></function> for user contexts:
21462   - sleep for as small periods as possible since it may
21463   increase kernel boot time of built-in device drivers
21464   requesting firmware in their -&gt;<function>probe</function> methods, if
21465   <parameter>gfp</parameter> is GFP_KERNEL.
21466   </para><para>
21467
21468   - can't sleep at all if <parameter>gfp</parameter> is GFP_ATOMIC.
21469</para>
21470</refsect1>
21471</refentry>
21472
21473<!-- drivers/base/transport_class.c -->
21474<refentry id="API-transport-class-register">
21475<refentryinfo>
21476 <title>LINUX</title>
21477 <productname>Kernel Hackers Manual</productname>
21478 <date>July 2017</date>
21479</refentryinfo>
21480<refmeta>
21481 <refentrytitle><phrase>transport_class_register</phrase></refentrytitle>
21482 <manvolnum>9</manvolnum>
21483 <refmiscinfo class="version">4.4.14</refmiscinfo>
21484</refmeta>
21485<refnamediv>
21486 <refname>transport_class_register</refname>
21487 <refpurpose>
21488  register an initial transport class
21489 </refpurpose>
21490</refnamediv>
21491<refsynopsisdiv>
21492 <title>Synopsis</title>
21493  <funcsynopsis><funcprototype>
21494   <funcdef>int <function>transport_class_register </function></funcdef>
21495   <paramdef>struct transport_class * <parameter>tclass</parameter></paramdef>
21496  </funcprototype></funcsynopsis>
21497</refsynopsisdiv>
21498<refsect1>
21499 <title>Arguments</title>
21500 <variablelist>
21501  <varlistentry>
21502   <term><parameter>tclass</parameter></term>
21503   <listitem>
21504    <para>
21505     a pointer to the transport class structure to be initialised
21506    </para>
21507   </listitem>
21508  </varlistentry>
21509 </variablelist>
21510</refsect1>
21511<refsect1>
21512<title>Description</title>
21513<para>
21514   The transport class contains an embedded class which is used to
21515   identify it.  The caller should initialise this structure with
21516   zeros and then generic class must have been initialised with the
21517   actual transport class unique name.  There's a macro
21518   <function>DECLARE_TRANSPORT_CLASS</function> to do this (declared classes still must
21519   be registered).
21520   </para><para>
21521
21522   Returns 0 on success or error on failure.
21523</para>
21524</refsect1>
21525</refentry>
21526
21527<refentry id="API-transport-class-unregister">
21528<refentryinfo>
21529 <title>LINUX</title>
21530 <productname>Kernel Hackers Manual</productname>
21531 <date>July 2017</date>
21532</refentryinfo>
21533<refmeta>
21534 <refentrytitle><phrase>transport_class_unregister</phrase></refentrytitle>
21535 <manvolnum>9</manvolnum>
21536 <refmiscinfo class="version">4.4.14</refmiscinfo>
21537</refmeta>
21538<refnamediv>
21539 <refname>transport_class_unregister</refname>
21540 <refpurpose>
21541     unregister a previously registered class
21542 </refpurpose>
21543</refnamediv>
21544<refsynopsisdiv>
21545 <title>Synopsis</title>
21546  <funcsynopsis><funcprototype>
21547   <funcdef>void <function>transport_class_unregister </function></funcdef>
21548   <paramdef>struct transport_class * <parameter>tclass</parameter></paramdef>
21549  </funcprototype></funcsynopsis>
21550</refsynopsisdiv>
21551<refsect1>
21552 <title>Arguments</title>
21553 <variablelist>
21554  <varlistentry>
21555   <term><parameter>tclass</parameter></term>
21556   <listitem>
21557    <para>
21558     The transport class to unregister
21559    </para>
21560   </listitem>
21561  </varlistentry>
21562 </variablelist>
21563</refsect1>
21564<refsect1>
21565<title>Description</title>
21566<para>
21567   Must be called prior to deallocating the memory for the transport
21568   class.
21569</para>
21570</refsect1>
21571</refentry>
21572
21573<refentry id="API-anon-transport-class-register">
21574<refentryinfo>
21575 <title>LINUX</title>
21576 <productname>Kernel Hackers Manual</productname>
21577 <date>July 2017</date>
21578</refentryinfo>
21579<refmeta>
21580 <refentrytitle><phrase>anon_transport_class_register</phrase></refentrytitle>
21581 <manvolnum>9</manvolnum>
21582 <refmiscinfo class="version">4.4.14</refmiscinfo>
21583</refmeta>
21584<refnamediv>
21585 <refname>anon_transport_class_register</refname>
21586 <refpurpose>
21587     register an anonymous class
21588 </refpurpose>
21589</refnamediv>
21590<refsynopsisdiv>
21591 <title>Synopsis</title>
21592  <funcsynopsis><funcprototype>
21593   <funcdef>int <function>anon_transport_class_register </function></funcdef>
21594   <paramdef>struct anon_transport_class * <parameter>atc</parameter></paramdef>
21595  </funcprototype></funcsynopsis>
21596</refsynopsisdiv>
21597<refsect1>
21598 <title>Arguments</title>
21599 <variablelist>
21600  <varlistentry>
21601   <term><parameter>atc</parameter></term>
21602   <listitem>
21603    <para>
21604     The anon transport class to register
21605    </para>
21606   </listitem>
21607  </varlistentry>
21608 </variablelist>
21609</refsect1>
21610<refsect1>
21611<title>Description</title>
21612<para>
21613   The anonymous transport class contains both a transport class and a
21614   container.  The idea of an anonymous class is that it never
21615   actually has any device attributes associated with it (and thus
21616   saves on container storage).  So it can only be used for triggering
21617   events.  Use prezero and then use <function>DECLARE_ANON_TRANSPORT_CLASS</function> to
21618   initialise the anon transport class storage.
21619</para>
21620</refsect1>
21621</refentry>
21622
21623<refentry id="API-anon-transport-class-unregister">
21624<refentryinfo>
21625 <title>LINUX</title>
21626 <productname>Kernel Hackers Manual</productname>
21627 <date>July 2017</date>
21628</refentryinfo>
21629<refmeta>
21630 <refentrytitle><phrase>anon_transport_class_unregister</phrase></refentrytitle>
21631 <manvolnum>9</manvolnum>
21632 <refmiscinfo class="version">4.4.14</refmiscinfo>
21633</refmeta>
21634<refnamediv>
21635 <refname>anon_transport_class_unregister</refname>
21636 <refpurpose>
21637     unregister an anon class
21638 </refpurpose>
21639</refnamediv>
21640<refsynopsisdiv>
21641 <title>Synopsis</title>
21642  <funcsynopsis><funcprototype>
21643   <funcdef>void <function>anon_transport_class_unregister </function></funcdef>
21644   <paramdef>struct anon_transport_class * <parameter>atc</parameter></paramdef>
21645  </funcprototype></funcsynopsis>
21646</refsynopsisdiv>
21647<refsect1>
21648 <title>Arguments</title>
21649 <variablelist>
21650  <varlistentry>
21651   <term><parameter>atc</parameter></term>
21652   <listitem>
21653    <para>
21654     Pointer to the anon transport class to unregister
21655    </para>
21656   </listitem>
21657  </varlistentry>
21658 </variablelist>
21659</refsect1>
21660<refsect1>
21661<title>Description</title>
21662<para>
21663   Must be called prior to deallocating the memory for the anon
21664   transport class.
21665</para>
21666</refsect1>
21667</refentry>
21668
21669<refentry id="API-transport-setup-device">
21670<refentryinfo>
21671 <title>LINUX</title>
21672 <productname>Kernel Hackers Manual</productname>
21673 <date>July 2017</date>
21674</refentryinfo>
21675<refmeta>
21676 <refentrytitle><phrase>transport_setup_device</phrase></refentrytitle>
21677 <manvolnum>9</manvolnum>
21678 <refmiscinfo class="version">4.4.14</refmiscinfo>
21679</refmeta>
21680<refnamediv>
21681 <refname>transport_setup_device</refname>
21682 <refpurpose>
21683     declare a new dev for transport class association but don't make it visible yet.
21684 </refpurpose>
21685</refnamediv>
21686<refsynopsisdiv>
21687 <title>Synopsis</title>
21688  <funcsynopsis><funcprototype>
21689   <funcdef>void <function>transport_setup_device </function></funcdef>
21690   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21691  </funcprototype></funcsynopsis>
21692</refsynopsisdiv>
21693<refsect1>
21694 <title>Arguments</title>
21695 <variablelist>
21696  <varlistentry>
21697   <term><parameter>dev</parameter></term>
21698   <listitem>
21699    <para>
21700     the generic device representing the entity being added
21701    </para>
21702   </listitem>
21703  </varlistentry>
21704 </variablelist>
21705</refsect1>
21706<refsect1>
21707<title>Description</title>
21708<para>
21709   Usually, dev represents some component in the HBA system (either
21710   the HBA itself or a device remote across the HBA bus).  This
21711   routine is simply a trigger point to see if any set of transport
21712   classes wishes to associate with the added device.  This allocates
21713   storage for the class device and initialises it, but does not yet
21714   add it to the system or add attributes to it (you do this with
21715   transport_add_device).  If you have no need for a separate setup
21716   and add operations, use transport_register_device (see
21717   transport_class.h).
21718</para>
21719</refsect1>
21720</refentry>
21721
21722<refentry id="API-transport-add-device">
21723<refentryinfo>
21724 <title>LINUX</title>
21725 <productname>Kernel Hackers Manual</productname>
21726 <date>July 2017</date>
21727</refentryinfo>
21728<refmeta>
21729 <refentrytitle><phrase>transport_add_device</phrase></refentrytitle>
21730 <manvolnum>9</manvolnum>
21731 <refmiscinfo class="version">4.4.14</refmiscinfo>
21732</refmeta>
21733<refnamediv>
21734 <refname>transport_add_device</refname>
21735 <refpurpose>
21736     declare a new dev for transport class association
21737 </refpurpose>
21738</refnamediv>
21739<refsynopsisdiv>
21740 <title>Synopsis</title>
21741  <funcsynopsis><funcprototype>
21742   <funcdef>void <function>transport_add_device </function></funcdef>
21743   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21744  </funcprototype></funcsynopsis>
21745</refsynopsisdiv>
21746<refsect1>
21747 <title>Arguments</title>
21748 <variablelist>
21749  <varlistentry>
21750   <term><parameter>dev</parameter></term>
21751   <listitem>
21752    <para>
21753     the generic device representing the entity being added
21754    </para>
21755   </listitem>
21756  </varlistentry>
21757 </variablelist>
21758</refsect1>
21759<refsect1>
21760<title>Description</title>
21761<para>
21762   Usually, dev represents some component in the HBA system (either
21763   the HBA itself or a device remote across the HBA bus).  This
21764   routine is simply a trigger point used to add the device to the
21765   system and register attributes for it.
21766</para>
21767</refsect1>
21768</refentry>
21769
21770<refentry id="API-transport-configure-device">
21771<refentryinfo>
21772 <title>LINUX</title>
21773 <productname>Kernel Hackers Manual</productname>
21774 <date>July 2017</date>
21775</refentryinfo>
21776<refmeta>
21777 <refentrytitle><phrase>transport_configure_device</phrase></refentrytitle>
21778 <manvolnum>9</manvolnum>
21779 <refmiscinfo class="version">4.4.14</refmiscinfo>
21780</refmeta>
21781<refnamediv>
21782 <refname>transport_configure_device</refname>
21783 <refpurpose>
21784     configure an already set up device
21785 </refpurpose>
21786</refnamediv>
21787<refsynopsisdiv>
21788 <title>Synopsis</title>
21789  <funcsynopsis><funcprototype>
21790   <funcdef>void <function>transport_configure_device </function></funcdef>
21791   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21792  </funcprototype></funcsynopsis>
21793</refsynopsisdiv>
21794<refsect1>
21795 <title>Arguments</title>
21796 <variablelist>
21797  <varlistentry>
21798   <term><parameter>dev</parameter></term>
21799   <listitem>
21800    <para>
21801     generic device representing device to be configured
21802    </para>
21803   </listitem>
21804  </varlistentry>
21805 </variablelist>
21806</refsect1>
21807<refsect1>
21808<title>Description</title>
21809<para>
21810   The idea of configure is simply to provide a point within the setup
21811   process to allow the transport class to extract information from a
21812   device after it has been setup.  This is used in SCSI because we
21813   have to have a setup device to begin using the HBA, but after we
21814   send the initial inquiry, we use configure to extract the device
21815   parameters.  The device need not have been added to be configured.
21816</para>
21817</refsect1>
21818</refentry>
21819
21820<refentry id="API-transport-remove-device">
21821<refentryinfo>
21822 <title>LINUX</title>
21823 <productname>Kernel Hackers Manual</productname>
21824 <date>July 2017</date>
21825</refentryinfo>
21826<refmeta>
21827 <refentrytitle><phrase>transport_remove_device</phrase></refentrytitle>
21828 <manvolnum>9</manvolnum>
21829 <refmiscinfo class="version">4.4.14</refmiscinfo>
21830</refmeta>
21831<refnamediv>
21832 <refname>transport_remove_device</refname>
21833 <refpurpose>
21834     remove the visibility of a device
21835 </refpurpose>
21836</refnamediv>
21837<refsynopsisdiv>
21838 <title>Synopsis</title>
21839  <funcsynopsis><funcprototype>
21840   <funcdef>void <function>transport_remove_device </function></funcdef>
21841   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21842  </funcprototype></funcsynopsis>
21843</refsynopsisdiv>
21844<refsect1>
21845 <title>Arguments</title>
21846 <variablelist>
21847  <varlistentry>
21848   <term><parameter>dev</parameter></term>
21849   <listitem>
21850    <para>
21851     generic device to remove
21852    </para>
21853   </listitem>
21854  </varlistentry>
21855 </variablelist>
21856</refsect1>
21857<refsect1>
21858<title>Description</title>
21859<para>
21860   This call removes the visibility of the device (to the user from
21861   sysfs), but does not destroy it.  To eliminate a device entirely
21862   you must also call transport_destroy_device.  If you don't need to
21863   do remove and destroy as separate operations, use
21864   <function>transport_unregister_device</function> (see transport_class.h) which will
21865   perform both calls for you.
21866</para>
21867</refsect1>
21868</refentry>
21869
21870<refentry id="API-transport-destroy-device">
21871<refentryinfo>
21872 <title>LINUX</title>
21873 <productname>Kernel Hackers Manual</productname>
21874 <date>July 2017</date>
21875</refentryinfo>
21876<refmeta>
21877 <refentrytitle><phrase>transport_destroy_device</phrase></refentrytitle>
21878 <manvolnum>9</manvolnum>
21879 <refmiscinfo class="version">4.4.14</refmiscinfo>
21880</refmeta>
21881<refnamediv>
21882 <refname>transport_destroy_device</refname>
21883 <refpurpose>
21884     destroy a removed device
21885 </refpurpose>
21886</refnamediv>
21887<refsynopsisdiv>
21888 <title>Synopsis</title>
21889  <funcsynopsis><funcprototype>
21890   <funcdef>void <function>transport_destroy_device </function></funcdef>
21891   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21892  </funcprototype></funcsynopsis>
21893</refsynopsisdiv>
21894<refsect1>
21895 <title>Arguments</title>
21896 <variablelist>
21897  <varlistentry>
21898   <term><parameter>dev</parameter></term>
21899   <listitem>
21900    <para>
21901     device to eliminate from the transport class.
21902    </para>
21903   </listitem>
21904  </varlistentry>
21905 </variablelist>
21906</refsect1>
21907<refsect1>
21908<title>Description</title>
21909<para>
21910   This call triggers the elimination of storage associated with the
21911   transport classdev.  Note: all it really does is relinquish a
21912   reference to the classdev.  The memory will not be freed until the
21913   last reference goes to zero.  Note also that the classdev retains a
21914   reference count on dev, so dev too will remain for as long as the
21915   transport class device remains around.
21916</para>
21917</refsect1>
21918</refentry>
21919
21920<!-- Cannot be included, because
21921     attribute_container_add_class_device_adapter
21922 and attribute_container_classdev_to_container
21923     exceed allowed 44 characters maximum
21924X!Edrivers/base/attribute_container.c
21925-->
21926<!-- drivers/base/dd.c -->
21927<refentry id="API-device-bind-driver">
21928<refentryinfo>
21929 <title>LINUX</title>
21930 <productname>Kernel Hackers Manual</productname>
21931 <date>July 2017</date>
21932</refentryinfo>
21933<refmeta>
21934 <refentrytitle><phrase>device_bind_driver</phrase></refentrytitle>
21935 <manvolnum>9</manvolnum>
21936 <refmiscinfo class="version">4.4.14</refmiscinfo>
21937</refmeta>
21938<refnamediv>
21939 <refname>device_bind_driver</refname>
21940 <refpurpose>
21941  bind a driver to one device.
21942 </refpurpose>
21943</refnamediv>
21944<refsynopsisdiv>
21945 <title>Synopsis</title>
21946  <funcsynopsis><funcprototype>
21947   <funcdef>int <function>device_bind_driver </function></funcdef>
21948   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
21949  </funcprototype></funcsynopsis>
21950</refsynopsisdiv>
21951<refsect1>
21952 <title>Arguments</title>
21953 <variablelist>
21954  <varlistentry>
21955   <term><parameter>dev</parameter></term>
21956   <listitem>
21957    <para>
21958     device.
21959    </para>
21960   </listitem>
21961  </varlistentry>
21962 </variablelist>
21963</refsect1>
21964<refsect1>
21965<title>Description</title>
21966<para>
21967   Allow manual attachment of a driver to a device.
21968   Caller must have already set <parameter>dev</parameter>-&gt;driver.
21969   </para><para>
21970
21971   Note that this does not modify the bus reference count
21972   nor take the bus's rwsem. Please verify those are accounted
21973   for before calling this. (It is ok to call with no other effort
21974   from a driver's <function>probe</function> method.)
21975   </para><para>
21976
21977   This function must be called with the device lock held.
21978</para>
21979</refsect1>
21980</refentry>
21981
21982<refentry id="API-wait-for-device-probe">
21983<refentryinfo>
21984 <title>LINUX</title>
21985 <productname>Kernel Hackers Manual</productname>
21986 <date>July 2017</date>
21987</refentryinfo>
21988<refmeta>
21989 <refentrytitle><phrase>wait_for_device_probe</phrase></refentrytitle>
21990 <manvolnum>9</manvolnum>
21991 <refmiscinfo class="version">4.4.14</refmiscinfo>
21992</refmeta>
21993<refnamediv>
21994 <refname>wait_for_device_probe</refname>
21995 <refpurpose>
21996   </refpurpose>
21997</refnamediv>
21998<refsynopsisdiv>
21999 <title>Synopsis</title>
22000  <funcsynopsis><funcprototype>
22001   <funcdef>void <function>wait_for_device_probe </function></funcdef>
22002   <paramdef> <parameter>void</parameter></paramdef>
22003  </funcprototype></funcsynopsis>
22004</refsynopsisdiv>
22005<refsect1>
22006 <title>Arguments</title>
22007 <variablelist>
22008  <varlistentry>
22009   <term><parameter>void</parameter></term>
22010   <listitem>
22011    <para>
22012     no arguments
22013    </para>
22014   </listitem>
22015  </varlistentry>
22016 </variablelist>
22017</refsect1>
22018<refsect1>
22019<title>Description</title>
22020<para>
22021   Wait for device probing to be completed.
22022</para>
22023</refsect1>
22024</refentry>
22025
22026<refentry id="API-device-attach">
22027<refentryinfo>
22028 <title>LINUX</title>
22029 <productname>Kernel Hackers Manual</productname>
22030 <date>July 2017</date>
22031</refentryinfo>
22032<refmeta>
22033 <refentrytitle><phrase>device_attach</phrase></refentrytitle>
22034 <manvolnum>9</manvolnum>
22035 <refmiscinfo class="version">4.4.14</refmiscinfo>
22036</refmeta>
22037<refnamediv>
22038 <refname>device_attach</refname>
22039 <refpurpose>
22040     try to attach device to a driver.
22041 </refpurpose>
22042</refnamediv>
22043<refsynopsisdiv>
22044 <title>Synopsis</title>
22045  <funcsynopsis><funcprototype>
22046   <funcdef>int <function>device_attach </function></funcdef>
22047   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
22048  </funcprototype></funcsynopsis>
22049</refsynopsisdiv>
22050<refsect1>
22051 <title>Arguments</title>
22052 <variablelist>
22053  <varlistentry>
22054   <term><parameter>dev</parameter></term>
22055   <listitem>
22056    <para>
22057     device.
22058    </para>
22059   </listitem>
22060  </varlistentry>
22061 </variablelist>
22062</refsect1>
22063<refsect1>
22064<title>Description</title>
22065<para>
22066   Walk the list of drivers that the bus has and call
22067   <function>driver_probe_device</function> for each pair. If a compatible
22068   pair is found, break out and return.
22069   </para><para>
22070
22071   Returns 1 if the device was bound to a driver;
22072   0 if no matching driver was found;
22073   -ENODEV if the device is not registered.
22074   </para><para>
22075
22076   When called for a USB interface, <parameter>dev</parameter>-&gt;parent lock must be held.
22077</para>
22078</refsect1>
22079</refentry>
22080
22081<refentry id="API-driver-attach">
22082<refentryinfo>
22083 <title>LINUX</title>
22084 <productname>Kernel Hackers Manual</productname>
22085 <date>July 2017</date>
22086</refentryinfo>
22087<refmeta>
22088 <refentrytitle><phrase>driver_attach</phrase></refentrytitle>
22089 <manvolnum>9</manvolnum>
22090 <refmiscinfo class="version">4.4.14</refmiscinfo>
22091</refmeta>
22092<refnamediv>
22093 <refname>driver_attach</refname>
22094 <refpurpose>
22095     try to bind driver to devices.
22096 </refpurpose>
22097</refnamediv>
22098<refsynopsisdiv>
22099 <title>Synopsis</title>
22100  <funcsynopsis><funcprototype>
22101   <funcdef>int <function>driver_attach </function></funcdef>
22102   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>drv</parameter></paramdef>
22103  </funcprototype></funcsynopsis>
22104</refsynopsisdiv>
22105<refsect1>
22106 <title>Arguments</title>
22107 <variablelist>
22108  <varlistentry>
22109   <term><parameter>drv</parameter></term>
22110   <listitem>
22111    <para>
22112     driver.
22113    </para>
22114   </listitem>
22115  </varlistentry>
22116 </variablelist>
22117</refsect1>
22118<refsect1>
22119<title>Description</title>
22120<para>
22121   Walk the list of devices that the bus has on it and try to
22122   match the driver with each one.  If <function>driver_probe_device</function>
22123   returns 0 and the <parameter>dev</parameter>-&gt;driver is set, we've found a
22124   compatible pair.
22125</para>
22126</refsect1>
22127</refentry>
22128
22129<refentry id="API-device-release-driver">
22130<refentryinfo>
22131 <title>LINUX</title>
22132 <productname>Kernel Hackers Manual</productname>
22133 <date>July 2017</date>
22134</refentryinfo>
22135<refmeta>
22136 <refentrytitle><phrase>device_release_driver</phrase></refentrytitle>
22137 <manvolnum>9</manvolnum>
22138 <refmiscinfo class="version">4.4.14</refmiscinfo>
22139</refmeta>
22140<refnamediv>
22141 <refname>device_release_driver</refname>
22142 <refpurpose>
22143     manually detach device from driver.
22144 </refpurpose>
22145</refnamediv>
22146<refsynopsisdiv>
22147 <title>Synopsis</title>
22148  <funcsynopsis><funcprototype>
22149   <funcdef>void <function>device_release_driver </function></funcdef>
22150   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
22151  </funcprototype></funcsynopsis>
22152</refsynopsisdiv>
22153<refsect1>
22154 <title>Arguments</title>
22155 <variablelist>
22156  <varlistentry>
22157   <term><parameter>dev</parameter></term>
22158   <listitem>
22159    <para>
22160     device.
22161    </para>
22162   </listitem>
22163  </varlistentry>
22164 </variablelist>
22165</refsect1>
22166<refsect1>
22167<title>Description</title>
22168<para>
22169   Manually detach device from driver.
22170   When called for a USB interface, <parameter>dev</parameter>-&gt;parent lock must be held.
22171</para>
22172</refsect1>
22173</refentry>
22174
22175<!--
22176X!Edrivers/base/interface.c
22177-->
22178<!-- include/linux/platform_device.h -->
22179<refentry id="API-platform-device-register-resndata">
22180<refentryinfo>
22181 <title>LINUX</title>
22182 <productname>Kernel Hackers Manual</productname>
22183 <date>July 2017</date>
22184</refentryinfo>
22185<refmeta>
22186 <refentrytitle><phrase>platform_device_register_resndata</phrase></refentrytitle>
22187 <manvolnum>9</manvolnum>
22188 <refmiscinfo class="version">4.4.14</refmiscinfo>
22189</refmeta>
22190<refnamediv>
22191 <refname>platform_device_register_resndata</refname>
22192 <refpurpose>
22193  add a platform-level device with resources and platform-specific data
22194 </refpurpose>
22195</refnamediv>
22196<refsynopsisdiv>
22197 <title>Synopsis</title>
22198  <funcsynopsis><funcprototype>
22199   <funcdef>struct platform_device * <function>platform_device_register_resndata </function></funcdef>
22200   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
22201   <paramdef>const char * <parameter>name</parameter></paramdef>
22202   <paramdef>int <parameter>id</parameter></paramdef>
22203   <paramdef>const struct resource * <parameter>res</parameter></paramdef>
22204   <paramdef>unsigned int <parameter>num</parameter></paramdef>
22205   <paramdef>const void * <parameter>data</parameter></paramdef>
22206   <paramdef>size_t <parameter>size</parameter></paramdef>
22207  </funcprototype></funcsynopsis>
22208</refsynopsisdiv>
22209<refsect1>
22210 <title>Arguments</title>
22211 <variablelist>
22212  <varlistentry>
22213   <term><parameter>parent</parameter></term>
22214   <listitem>
22215    <para>
22216     parent device for the device we're adding
22217    </para>
22218   </listitem>
22219  </varlistentry>
22220  <varlistentry>
22221   <term><parameter>name</parameter></term>
22222   <listitem>
22223    <para>
22224     base name of the device we're adding
22225    </para>
22226   </listitem>
22227  </varlistentry>
22228  <varlistentry>
22229   <term><parameter>id</parameter></term>
22230   <listitem>
22231    <para>
22232     instance id
22233    </para>
22234   </listitem>
22235  </varlistentry>
22236  <varlistentry>
22237   <term><parameter>res</parameter></term>
22238   <listitem>
22239    <para>
22240     set of resources that needs to be allocated for the device
22241    </para>
22242   </listitem>
22243  </varlistentry>
22244  <varlistentry>
22245   <term><parameter>num</parameter></term>
22246   <listitem>
22247    <para>
22248     number of resources
22249    </para>
22250   </listitem>
22251  </varlistentry>
22252  <varlistentry>
22253   <term><parameter>data</parameter></term>
22254   <listitem>
22255    <para>
22256     platform specific data for this platform device
22257    </para>
22258   </listitem>
22259  </varlistentry>
22260  <varlistentry>
22261   <term><parameter>size</parameter></term>
22262   <listitem>
22263    <para>
22264     size of platform specific data
22265    </para>
22266   </listitem>
22267  </varlistentry>
22268 </variablelist>
22269</refsect1>
22270<refsect1>
22271<title>Description</title>
22272<para>
22273   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
22274</para>
22275</refsect1>
22276</refentry>
22277
22278<refentry id="API-platform-device-register-simple">
22279<refentryinfo>
22280 <title>LINUX</title>
22281 <productname>Kernel Hackers Manual</productname>
22282 <date>July 2017</date>
22283</refentryinfo>
22284<refmeta>
22285 <refentrytitle><phrase>platform_device_register_simple</phrase></refentrytitle>
22286 <manvolnum>9</manvolnum>
22287 <refmiscinfo class="version">4.4.14</refmiscinfo>
22288</refmeta>
22289<refnamediv>
22290 <refname>platform_device_register_simple</refname>
22291 <refpurpose>
22292     add a platform-level device and its resources
22293 </refpurpose>
22294</refnamediv>
22295<refsynopsisdiv>
22296 <title>Synopsis</title>
22297  <funcsynopsis><funcprototype>
22298   <funcdef>struct platform_device * <function>platform_device_register_simple </function></funcdef>
22299   <paramdef>const char * <parameter>name</parameter></paramdef>
22300   <paramdef>int <parameter>id</parameter></paramdef>
22301   <paramdef>const struct resource * <parameter>res</parameter></paramdef>
22302   <paramdef>unsigned int <parameter>num</parameter></paramdef>
22303  </funcprototype></funcsynopsis>
22304</refsynopsisdiv>
22305<refsect1>
22306 <title>Arguments</title>
22307 <variablelist>
22308  <varlistentry>
22309   <term><parameter>name</parameter></term>
22310   <listitem>
22311    <para>
22312     base name of the device we're adding
22313    </para>
22314   </listitem>
22315  </varlistentry>
22316  <varlistentry>
22317   <term><parameter>id</parameter></term>
22318   <listitem>
22319    <para>
22320     instance id
22321    </para>
22322   </listitem>
22323  </varlistentry>
22324  <varlistentry>
22325   <term><parameter>res</parameter></term>
22326   <listitem>
22327    <para>
22328     set of resources that needs to be allocated for the device
22329    </para>
22330   </listitem>
22331  </varlistentry>
22332  <varlistentry>
22333   <term><parameter>num</parameter></term>
22334   <listitem>
22335    <para>
22336     number of resources
22337    </para>
22338   </listitem>
22339  </varlistentry>
22340 </variablelist>
22341</refsect1>
22342<refsect1>
22343<title>Description</title>
22344<para>
22345   This function creates a simple platform device that requires minimal
22346   resource and memory management. Canned release function freeing memory
22347   allocated for the device allows drivers using such devices to be
22348   unloaded without waiting for the last reference to the device to be
22349   dropped.
22350   </para><para>
22351
22352   This interface is primarily intended for use with legacy drivers which
22353   probe hardware directly.  Because such drivers create sysfs device nodes
22354   themselves, rather than letting system infrastructure handle such device
22355   enumeration tasks, they don't fully conform to the Linux driver model.
22356   In particular, when such drivers are built as modules, they can't be
22357   <quote>hotplugged</quote>.
22358   </para><para>
22359
22360   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
22361</para>
22362</refsect1>
22363</refentry>
22364
22365<refentry id="API-platform-device-register-data">
22366<refentryinfo>
22367 <title>LINUX</title>
22368 <productname>Kernel Hackers Manual</productname>
22369 <date>July 2017</date>
22370</refentryinfo>
22371<refmeta>
22372 <refentrytitle><phrase>platform_device_register_data</phrase></refentrytitle>
22373 <manvolnum>9</manvolnum>
22374 <refmiscinfo class="version">4.4.14</refmiscinfo>
22375</refmeta>
22376<refnamediv>
22377 <refname>platform_device_register_data</refname>
22378 <refpurpose>
22379     add a platform-level device with platform-specific data
22380 </refpurpose>
22381</refnamediv>
22382<refsynopsisdiv>
22383 <title>Synopsis</title>
22384  <funcsynopsis><funcprototype>
22385   <funcdef>struct platform_device * <function>platform_device_register_data </function></funcdef>
22386   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
22387   <paramdef>const char * <parameter>name</parameter></paramdef>
22388   <paramdef>int <parameter>id</parameter></paramdef>
22389   <paramdef>const void * <parameter>data</parameter></paramdef>
22390   <paramdef>size_t <parameter>size</parameter></paramdef>
22391  </funcprototype></funcsynopsis>
22392</refsynopsisdiv>
22393<refsect1>
22394 <title>Arguments</title>
22395 <variablelist>
22396  <varlistentry>
22397   <term><parameter>parent</parameter></term>
22398   <listitem>
22399    <para>
22400     parent device for the device we're adding
22401    </para>
22402   </listitem>
22403  </varlistentry>
22404  <varlistentry>
22405   <term><parameter>name</parameter></term>
22406   <listitem>
22407    <para>
22408     base name of the device we're adding
22409    </para>
22410   </listitem>
22411  </varlistentry>
22412  <varlistentry>
22413   <term><parameter>id</parameter></term>
22414   <listitem>
22415    <para>
22416     instance id
22417    </para>
22418   </listitem>
22419  </varlistentry>
22420  <varlistentry>
22421   <term><parameter>data</parameter></term>
22422   <listitem>
22423    <para>
22424     platform specific data for this platform device
22425    </para>
22426   </listitem>
22427  </varlistentry>
22428  <varlistentry>
22429   <term><parameter>size</parameter></term>
22430   <listitem>
22431    <para>
22432     size of platform specific data
22433    </para>
22434   </listitem>
22435  </varlistentry>
22436 </variablelist>
22437</refsect1>
22438<refsect1>
22439<title>Description</title>
22440<para>
22441   This function creates a simple platform device that requires minimal
22442   resource and memory management. Canned release function freeing memory
22443   allocated for the device allows drivers using such devices to be
22444   unloaded without waiting for the last reference to the device to be
22445   dropped.
22446   </para><para>
22447
22448   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
22449</para>
22450</refsect1>
22451</refentry>
22452
22453<!-- drivers/base/platform.c -->
22454<refentry id="API-platform-get-resource">
22455<refentryinfo>
22456 <title>LINUX</title>
22457 <productname>Kernel Hackers Manual</productname>
22458 <date>July 2017</date>
22459</refentryinfo>
22460<refmeta>
22461 <refentrytitle><phrase>platform_get_resource</phrase></refentrytitle>
22462 <manvolnum>9</manvolnum>
22463 <refmiscinfo class="version">4.4.14</refmiscinfo>
22464</refmeta>
22465<refnamediv>
22466 <refname>platform_get_resource</refname>
22467 <refpurpose>
22468  get a resource for a device
22469 </refpurpose>
22470</refnamediv>
22471<refsynopsisdiv>
22472 <title>Synopsis</title>
22473  <funcsynopsis><funcprototype>
22474   <funcdef>struct resource * <function>platform_get_resource </function></funcdef>
22475   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
22476   <paramdef>unsigned int <parameter>type</parameter></paramdef>
22477   <paramdef>unsigned int <parameter>num</parameter></paramdef>
22478  </funcprototype></funcsynopsis>
22479</refsynopsisdiv>
22480<refsect1>
22481 <title>Arguments</title>
22482 <variablelist>
22483  <varlistentry>
22484   <term><parameter>dev</parameter></term>
22485   <listitem>
22486    <para>
22487     platform device
22488    </para>
22489   </listitem>
22490  </varlistentry>
22491  <varlistentry>
22492   <term><parameter>type</parameter></term>
22493   <listitem>
22494    <para>
22495     resource type
22496    </para>
22497   </listitem>
22498  </varlistentry>
22499  <varlistentry>
22500   <term><parameter>num</parameter></term>
22501   <listitem>
22502    <para>
22503     resource index
22504    </para>
22505   </listitem>
22506  </varlistentry>
22507 </variablelist>
22508</refsect1>
22509</refentry>
22510
22511<refentry id="API-platform-get-irq">
22512<refentryinfo>
22513 <title>LINUX</title>
22514 <productname>Kernel Hackers Manual</productname>
22515 <date>July 2017</date>
22516</refentryinfo>
22517<refmeta>
22518 <refentrytitle><phrase>platform_get_irq</phrase></refentrytitle>
22519 <manvolnum>9</manvolnum>
22520 <refmiscinfo class="version">4.4.14</refmiscinfo>
22521</refmeta>
22522<refnamediv>
22523 <refname>platform_get_irq</refname>
22524 <refpurpose>
22525     get an IRQ for a device
22526 </refpurpose>
22527</refnamediv>
22528<refsynopsisdiv>
22529 <title>Synopsis</title>
22530  <funcsynopsis><funcprototype>
22531   <funcdef>int <function>platform_get_irq </function></funcdef>
22532   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
22533   <paramdef>unsigned int <parameter>num</parameter></paramdef>
22534  </funcprototype></funcsynopsis>
22535</refsynopsisdiv>
22536<refsect1>
22537 <title>Arguments</title>
22538 <variablelist>
22539  <varlistentry>
22540   <term><parameter>dev</parameter></term>
22541   <listitem>
22542    <para>
22543     platform device
22544    </para>
22545   </listitem>
22546  </varlistentry>
22547  <varlistentry>
22548   <term><parameter>num</parameter></term>
22549   <listitem>
22550    <para>
22551     IRQ number index
22552    </para>
22553   </listitem>
22554  </varlistentry>
22555 </variablelist>
22556</refsect1>
22557</refentry>
22558
22559<refentry id="API-platform-get-resource-byname">
22560<refentryinfo>
22561 <title>LINUX</title>
22562 <productname>Kernel Hackers Manual</productname>
22563 <date>July 2017</date>
22564</refentryinfo>
22565<refmeta>
22566 <refentrytitle><phrase>platform_get_resource_byname</phrase></refentrytitle>
22567 <manvolnum>9</manvolnum>
22568 <refmiscinfo class="version">4.4.14</refmiscinfo>
22569</refmeta>
22570<refnamediv>
22571 <refname>platform_get_resource_byname</refname>
22572 <refpurpose>
22573     get a resource for a device by name
22574 </refpurpose>
22575</refnamediv>
22576<refsynopsisdiv>
22577 <title>Synopsis</title>
22578  <funcsynopsis><funcprototype>
22579   <funcdef>struct resource * <function>platform_get_resource_byname </function></funcdef>
22580   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
22581   <paramdef>unsigned int <parameter>type</parameter></paramdef>
22582   <paramdef>const char * <parameter>name</parameter></paramdef>
22583  </funcprototype></funcsynopsis>
22584</refsynopsisdiv>
22585<refsect1>
22586 <title>Arguments</title>
22587 <variablelist>
22588  <varlistentry>
22589   <term><parameter>dev</parameter></term>
22590   <listitem>
22591    <para>
22592     platform device
22593    </para>
22594   </listitem>
22595  </varlistentry>
22596  <varlistentry>
22597   <term><parameter>type</parameter></term>
22598   <listitem>
22599    <para>
22600     resource type
22601    </para>
22602   </listitem>
22603  </varlistentry>
22604  <varlistentry>
22605   <term><parameter>name</parameter></term>
22606   <listitem>
22607    <para>
22608     resource name
22609    </para>
22610   </listitem>
22611  </varlistentry>
22612 </variablelist>
22613</refsect1>
22614</refentry>
22615
22616<refentry id="API-platform-get-irq-byname">
22617<refentryinfo>
22618 <title>LINUX</title>
22619 <productname>Kernel Hackers Manual</productname>
22620 <date>July 2017</date>
22621</refentryinfo>
22622<refmeta>
22623 <refentrytitle><phrase>platform_get_irq_byname</phrase></refentrytitle>
22624 <manvolnum>9</manvolnum>
22625 <refmiscinfo class="version">4.4.14</refmiscinfo>
22626</refmeta>
22627<refnamediv>
22628 <refname>platform_get_irq_byname</refname>
22629 <refpurpose>
22630     get an IRQ for a device by name
22631 </refpurpose>
22632</refnamediv>
22633<refsynopsisdiv>
22634 <title>Synopsis</title>
22635  <funcsynopsis><funcprototype>
22636   <funcdef>int <function>platform_get_irq_byname </function></funcdef>
22637   <paramdef>struct platform_device * <parameter>dev</parameter></paramdef>
22638   <paramdef>const char * <parameter>name</parameter></paramdef>
22639  </funcprototype></funcsynopsis>
22640</refsynopsisdiv>
22641<refsect1>
22642 <title>Arguments</title>
22643 <variablelist>
22644  <varlistentry>
22645   <term><parameter>dev</parameter></term>
22646   <listitem>
22647    <para>
22648     platform device
22649    </para>
22650   </listitem>
22651  </varlistentry>
22652  <varlistentry>
22653   <term><parameter>name</parameter></term>
22654   <listitem>
22655    <para>
22656     IRQ name
22657    </para>
22658   </listitem>
22659  </varlistentry>
22660 </variablelist>
22661</refsect1>
22662</refentry>
22663
22664<refentry id="API-platform-add-devices">
22665<refentryinfo>
22666 <title>LINUX</title>
22667 <productname>Kernel Hackers Manual</productname>
22668 <date>July 2017</date>
22669</refentryinfo>
22670<refmeta>
22671 <refentrytitle><phrase>platform_add_devices</phrase></refentrytitle>
22672 <manvolnum>9</manvolnum>
22673 <refmiscinfo class="version">4.4.14</refmiscinfo>
22674</refmeta>
22675<refnamediv>
22676 <refname>platform_add_devices</refname>
22677 <refpurpose>
22678     add a numbers of platform devices
22679 </refpurpose>
22680</refnamediv>
22681<refsynopsisdiv>
22682 <title>Synopsis</title>
22683  <funcsynopsis><funcprototype>
22684   <funcdef>int <function>platform_add_devices </function></funcdef>
22685   <paramdef>struct platform_device ** <parameter>devs</parameter></paramdef>
22686   <paramdef>int <parameter>num</parameter></paramdef>
22687  </funcprototype></funcsynopsis>
22688</refsynopsisdiv>
22689<refsect1>
22690 <title>Arguments</title>
22691 <variablelist>
22692  <varlistentry>
22693   <term><parameter>devs</parameter></term>
22694   <listitem>
22695    <para>
22696     array of platform devices to add
22697    </para>
22698   </listitem>
22699  </varlistentry>
22700  <varlistentry>
22701   <term><parameter>num</parameter></term>
22702   <listitem>
22703    <para>
22704     number of platform devices in array
22705    </para>
22706   </listitem>
22707  </varlistentry>
22708 </variablelist>
22709</refsect1>
22710</refentry>
22711
22712<refentry id="API-platform-device-put">
22713<refentryinfo>
22714 <title>LINUX</title>
22715 <productname>Kernel Hackers Manual</productname>
22716 <date>July 2017</date>
22717</refentryinfo>
22718<refmeta>
22719 <refentrytitle><phrase>platform_device_put</phrase></refentrytitle>
22720 <manvolnum>9</manvolnum>
22721 <refmiscinfo class="version">4.4.14</refmiscinfo>
22722</refmeta>
22723<refnamediv>
22724 <refname>platform_device_put</refname>
22725 <refpurpose>
22726     destroy a platform device
22727 </refpurpose>
22728</refnamediv>
22729<refsynopsisdiv>
22730 <title>Synopsis</title>
22731  <funcsynopsis><funcprototype>
22732   <funcdef>void <function>platform_device_put </function></funcdef>
22733   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
22734  </funcprototype></funcsynopsis>
22735</refsynopsisdiv>
22736<refsect1>
22737 <title>Arguments</title>
22738 <variablelist>
22739  <varlistentry>
22740   <term><parameter>pdev</parameter></term>
22741   <listitem>
22742    <para>
22743     platform device to free
22744    </para>
22745   </listitem>
22746  </varlistentry>
22747 </variablelist>
22748</refsect1>
22749<refsect1>
22750<title>Description</title>
22751<para>
22752   Free all memory associated with a platform device.  This function must
22753   _only_ be externally called in error cases.  All other usage is a bug.
22754</para>
22755</refsect1>
22756</refentry>
22757
22758<refentry id="API-platform-device-alloc">
22759<refentryinfo>
22760 <title>LINUX</title>
22761 <productname>Kernel Hackers Manual</productname>
22762 <date>July 2017</date>
22763</refentryinfo>
22764<refmeta>
22765 <refentrytitle><phrase>platform_device_alloc</phrase></refentrytitle>
22766 <manvolnum>9</manvolnum>
22767 <refmiscinfo class="version">4.4.14</refmiscinfo>
22768</refmeta>
22769<refnamediv>
22770 <refname>platform_device_alloc</refname>
22771 <refpurpose>
22772     create a platform device
22773 </refpurpose>
22774</refnamediv>
22775<refsynopsisdiv>
22776 <title>Synopsis</title>
22777  <funcsynopsis><funcprototype>
22778   <funcdef>struct platform_device * <function>platform_device_alloc </function></funcdef>
22779   <paramdef>const char * <parameter>name</parameter></paramdef>
22780   <paramdef>int <parameter>id</parameter></paramdef>
22781  </funcprototype></funcsynopsis>
22782</refsynopsisdiv>
22783<refsect1>
22784 <title>Arguments</title>
22785 <variablelist>
22786  <varlistentry>
22787   <term><parameter>name</parameter></term>
22788   <listitem>
22789    <para>
22790     base name of the device we're adding
22791    </para>
22792   </listitem>
22793  </varlistentry>
22794  <varlistentry>
22795   <term><parameter>id</parameter></term>
22796   <listitem>
22797    <para>
22798     instance id
22799    </para>
22800   </listitem>
22801  </varlistentry>
22802 </variablelist>
22803</refsect1>
22804<refsect1>
22805<title>Description</title>
22806<para>
22807   Create a platform device object which can have other objects attached
22808   to it, and which will have attached objects freed when it is released.
22809</para>
22810</refsect1>
22811</refentry>
22812
22813<refentry id="API-platform-device-add-resources">
22814<refentryinfo>
22815 <title>LINUX</title>
22816 <productname>Kernel Hackers Manual</productname>
22817 <date>July 2017</date>
22818</refentryinfo>
22819<refmeta>
22820 <refentrytitle><phrase>platform_device_add_resources</phrase></refentrytitle>
22821 <manvolnum>9</manvolnum>
22822 <refmiscinfo class="version">4.4.14</refmiscinfo>
22823</refmeta>
22824<refnamediv>
22825 <refname>platform_device_add_resources</refname>
22826 <refpurpose>
22827     add resources to a platform device
22828 </refpurpose>
22829</refnamediv>
22830<refsynopsisdiv>
22831 <title>Synopsis</title>
22832  <funcsynopsis><funcprototype>
22833   <funcdef>int <function>platform_device_add_resources </function></funcdef>
22834   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
22835   <paramdef>const struct resource * <parameter>res</parameter></paramdef>
22836   <paramdef>unsigned int <parameter>num</parameter></paramdef>
22837  </funcprototype></funcsynopsis>
22838</refsynopsisdiv>
22839<refsect1>
22840 <title>Arguments</title>
22841 <variablelist>
22842  <varlistentry>
22843   <term><parameter>pdev</parameter></term>
22844   <listitem>
22845    <para>
22846     platform device allocated by platform_device_alloc to add resources to
22847    </para>
22848   </listitem>
22849  </varlistentry>
22850  <varlistentry>
22851   <term><parameter>res</parameter></term>
22852   <listitem>
22853    <para>
22854     set of resources that needs to be allocated for the device
22855    </para>
22856   </listitem>
22857  </varlistentry>
22858  <varlistentry>
22859   <term><parameter>num</parameter></term>
22860   <listitem>
22861    <para>
22862     number of resources
22863    </para>
22864   </listitem>
22865  </varlistentry>
22866 </variablelist>
22867</refsect1>
22868<refsect1>
22869<title>Description</title>
22870<para>
22871   Add a copy of the resources to the platform device.  The memory
22872   associated with the resources will be freed when the platform device is
22873   released.
22874</para>
22875</refsect1>
22876</refentry>
22877
22878<refentry id="API-platform-device-add-data">
22879<refentryinfo>
22880 <title>LINUX</title>
22881 <productname>Kernel Hackers Manual</productname>
22882 <date>July 2017</date>
22883</refentryinfo>
22884<refmeta>
22885 <refentrytitle><phrase>platform_device_add_data</phrase></refentrytitle>
22886 <manvolnum>9</manvolnum>
22887 <refmiscinfo class="version">4.4.14</refmiscinfo>
22888</refmeta>
22889<refnamediv>
22890 <refname>platform_device_add_data</refname>
22891 <refpurpose>
22892     add platform-specific data to a platform device
22893 </refpurpose>
22894</refnamediv>
22895<refsynopsisdiv>
22896 <title>Synopsis</title>
22897  <funcsynopsis><funcprototype>
22898   <funcdef>int <function>platform_device_add_data </function></funcdef>
22899   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
22900   <paramdef>const void * <parameter>data</parameter></paramdef>
22901   <paramdef>size_t <parameter>size</parameter></paramdef>
22902  </funcprototype></funcsynopsis>
22903</refsynopsisdiv>
22904<refsect1>
22905 <title>Arguments</title>
22906 <variablelist>
22907  <varlistentry>
22908   <term><parameter>pdev</parameter></term>
22909   <listitem>
22910    <para>
22911     platform device allocated by platform_device_alloc to add resources to
22912    </para>
22913   </listitem>
22914  </varlistentry>
22915  <varlistentry>
22916   <term><parameter>data</parameter></term>
22917   <listitem>
22918    <para>
22919     platform specific data for this platform device
22920    </para>
22921   </listitem>
22922  </varlistentry>
22923  <varlistentry>
22924   <term><parameter>size</parameter></term>
22925   <listitem>
22926    <para>
22927     size of platform specific data
22928    </para>
22929   </listitem>
22930  </varlistentry>
22931 </variablelist>
22932</refsect1>
22933<refsect1>
22934<title>Description</title>
22935<para>
22936   Add a copy of platform specific data to the platform device's
22937   platform_data pointer.  The memory associated with the platform data
22938   will be freed when the platform device is released.
22939</para>
22940</refsect1>
22941</refentry>
22942
22943<refentry id="API-platform-device-add">
22944<refentryinfo>
22945 <title>LINUX</title>
22946 <productname>Kernel Hackers Manual</productname>
22947 <date>July 2017</date>
22948</refentryinfo>
22949<refmeta>
22950 <refentrytitle><phrase>platform_device_add</phrase></refentrytitle>
22951 <manvolnum>9</manvolnum>
22952 <refmiscinfo class="version">4.4.14</refmiscinfo>
22953</refmeta>
22954<refnamediv>
22955 <refname>platform_device_add</refname>
22956 <refpurpose>
22957     add a platform device to device hierarchy
22958 </refpurpose>
22959</refnamediv>
22960<refsynopsisdiv>
22961 <title>Synopsis</title>
22962  <funcsynopsis><funcprototype>
22963   <funcdef>int <function>platform_device_add </function></funcdef>
22964   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
22965  </funcprototype></funcsynopsis>
22966</refsynopsisdiv>
22967<refsect1>
22968 <title>Arguments</title>
22969 <variablelist>
22970  <varlistentry>
22971   <term><parameter>pdev</parameter></term>
22972   <listitem>
22973    <para>
22974     platform device we're adding
22975    </para>
22976   </listitem>
22977  </varlistentry>
22978 </variablelist>
22979</refsect1>
22980<refsect1>
22981<title>Description</title>
22982<para>
22983   This is part 2 of <function><link linkend="API-platform-device-register">platform_device_register</link></function>, though may be called
22984   separately _iff_ pdev was allocated by <function><link linkend="API-platform-device-alloc">platform_device_alloc</link></function>.
22985</para>
22986</refsect1>
22987</refentry>
22988
22989<refentry id="API-platform-device-del">
22990<refentryinfo>
22991 <title>LINUX</title>
22992 <productname>Kernel Hackers Manual</productname>
22993 <date>July 2017</date>
22994</refentryinfo>
22995<refmeta>
22996 <refentrytitle><phrase>platform_device_del</phrase></refentrytitle>
22997 <manvolnum>9</manvolnum>
22998 <refmiscinfo class="version">4.4.14</refmiscinfo>
22999</refmeta>
23000<refnamediv>
23001 <refname>platform_device_del</refname>
23002 <refpurpose>
23003     remove a platform-level device
23004 </refpurpose>
23005</refnamediv>
23006<refsynopsisdiv>
23007 <title>Synopsis</title>
23008  <funcsynopsis><funcprototype>
23009   <funcdef>void <function>platform_device_del </function></funcdef>
23010   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
23011  </funcprototype></funcsynopsis>
23012</refsynopsisdiv>
23013<refsect1>
23014 <title>Arguments</title>
23015 <variablelist>
23016  <varlistentry>
23017   <term><parameter>pdev</parameter></term>
23018   <listitem>
23019    <para>
23020     platform device we're removing
23021    </para>
23022   </listitem>
23023  </varlistentry>
23024 </variablelist>
23025</refsect1>
23026<refsect1>
23027<title>Description</title>
23028<para>
23029   Note that this function will also release all memory- and port-based
23030   resources owned by the device (<parameter>dev</parameter>-&gt;resource).  This function must
23031   _only_ be externally called in error cases.  All other usage is a bug.
23032</para>
23033</refsect1>
23034</refentry>
23035
23036<refentry id="API-platform-device-register">
23037<refentryinfo>
23038 <title>LINUX</title>
23039 <productname>Kernel Hackers Manual</productname>
23040 <date>July 2017</date>
23041</refentryinfo>
23042<refmeta>
23043 <refentrytitle><phrase>platform_device_register</phrase></refentrytitle>
23044 <manvolnum>9</manvolnum>
23045 <refmiscinfo class="version">4.4.14</refmiscinfo>
23046</refmeta>
23047<refnamediv>
23048 <refname>platform_device_register</refname>
23049 <refpurpose>
23050     add a platform-level device
23051 </refpurpose>
23052</refnamediv>
23053<refsynopsisdiv>
23054 <title>Synopsis</title>
23055  <funcsynopsis><funcprototype>
23056   <funcdef>int <function>platform_device_register </function></funcdef>
23057   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
23058  </funcprototype></funcsynopsis>
23059</refsynopsisdiv>
23060<refsect1>
23061 <title>Arguments</title>
23062 <variablelist>
23063  <varlistentry>
23064   <term><parameter>pdev</parameter></term>
23065   <listitem>
23066    <para>
23067     platform device we're adding
23068    </para>
23069   </listitem>
23070  </varlistentry>
23071 </variablelist>
23072</refsect1>
23073</refentry>
23074
23075<refentry id="API-platform-device-unregister">
23076<refentryinfo>
23077 <title>LINUX</title>
23078 <productname>Kernel Hackers Manual</productname>
23079 <date>July 2017</date>
23080</refentryinfo>
23081<refmeta>
23082 <refentrytitle><phrase>platform_device_unregister</phrase></refentrytitle>
23083 <manvolnum>9</manvolnum>
23084 <refmiscinfo class="version">4.4.14</refmiscinfo>
23085</refmeta>
23086<refnamediv>
23087 <refname>platform_device_unregister</refname>
23088 <refpurpose>
23089     unregister a platform-level device
23090 </refpurpose>
23091</refnamediv>
23092<refsynopsisdiv>
23093 <title>Synopsis</title>
23094  <funcsynopsis><funcprototype>
23095   <funcdef>void <function>platform_device_unregister </function></funcdef>
23096   <paramdef>struct platform_device * <parameter>pdev</parameter></paramdef>
23097  </funcprototype></funcsynopsis>
23098</refsynopsisdiv>
23099<refsect1>
23100 <title>Arguments</title>
23101 <variablelist>
23102  <varlistentry>
23103   <term><parameter>pdev</parameter></term>
23104   <listitem>
23105    <para>
23106     platform device we're unregistering
23107    </para>
23108   </listitem>
23109  </varlistentry>
23110 </variablelist>
23111</refsect1>
23112<refsect1>
23113<title>Description</title>
23114<para>
23115   Unregistration is done in 2 steps. First we release all resources
23116   and remove it from the subsystem, then we drop reference count by
23117   calling <function><link linkend="API-platform-device-put">platform_device_put</link></function>.
23118</para>
23119</refsect1>
23120</refentry>
23121
23122<refentry id="API-platform-device-register-full">
23123<refentryinfo>
23124 <title>LINUX</title>
23125 <productname>Kernel Hackers Manual</productname>
23126 <date>July 2017</date>
23127</refentryinfo>
23128<refmeta>
23129 <refentrytitle><phrase>platform_device_register_full</phrase></refentrytitle>
23130 <manvolnum>9</manvolnum>
23131 <refmiscinfo class="version">4.4.14</refmiscinfo>
23132</refmeta>
23133<refnamediv>
23134 <refname>platform_device_register_full</refname>
23135 <refpurpose>
23136     add a platform-level device with resources and platform-specific data
23137 </refpurpose>
23138</refnamediv>
23139<refsynopsisdiv>
23140 <title>Synopsis</title>
23141  <funcsynopsis><funcprototype>
23142   <funcdef>struct platform_device * <function>platform_device_register_full </function></funcdef>
23143   <paramdef>const struct platform_device_info * <parameter>pdevinfo</parameter></paramdef>
23144  </funcprototype></funcsynopsis>
23145</refsynopsisdiv>
23146<refsect1>
23147 <title>Arguments</title>
23148 <variablelist>
23149  <varlistentry>
23150   <term><parameter>pdevinfo</parameter></term>
23151   <listitem>
23152    <para>
23153     data used to create device
23154    </para>
23155   </listitem>
23156  </varlistentry>
23157 </variablelist>
23158</refsect1>
23159<refsect1>
23160<title>Description</title>
23161<para>
23162   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
23163</para>
23164</refsect1>
23165</refentry>
23166
23167<refentry id="API---platform-driver-register">
23168<refentryinfo>
23169 <title>LINUX</title>
23170 <productname>Kernel Hackers Manual</productname>
23171 <date>July 2017</date>
23172</refentryinfo>
23173<refmeta>
23174 <refentrytitle><phrase>__platform_driver_register</phrase></refentrytitle>
23175 <manvolnum>9</manvolnum>
23176 <refmiscinfo class="version">4.4.14</refmiscinfo>
23177</refmeta>
23178<refnamediv>
23179 <refname>__platform_driver_register</refname>
23180 <refpurpose>
23181     register a driver for platform-level devices
23182 </refpurpose>
23183</refnamediv>
23184<refsynopsisdiv>
23185 <title>Synopsis</title>
23186  <funcsynopsis><funcprototype>
23187   <funcdef>int <function>__platform_driver_register </function></funcdef>
23188   <paramdef>struct platform_driver * <parameter>drv</parameter></paramdef>
23189   <paramdef>struct module * <parameter>owner</parameter></paramdef>
23190  </funcprototype></funcsynopsis>
23191</refsynopsisdiv>
23192<refsect1>
23193 <title>Arguments</title>
23194 <variablelist>
23195  <varlistentry>
23196   <term><parameter>drv</parameter></term>
23197   <listitem>
23198    <para>
23199     platform driver structure
23200    </para>
23201   </listitem>
23202  </varlistentry>
23203  <varlistentry>
23204   <term><parameter>owner</parameter></term>
23205   <listitem>
23206    <para>
23207     owning module/driver
23208    </para>
23209   </listitem>
23210  </varlistentry>
23211 </variablelist>
23212</refsect1>
23213</refentry>
23214
23215<refentry id="API-platform-driver-unregister">
23216<refentryinfo>
23217 <title>LINUX</title>
23218 <productname>Kernel Hackers Manual</productname>
23219 <date>July 2017</date>
23220</refentryinfo>
23221<refmeta>
23222 <refentrytitle><phrase>platform_driver_unregister</phrase></refentrytitle>
23223 <manvolnum>9</manvolnum>
23224 <refmiscinfo class="version">4.4.14</refmiscinfo>
23225</refmeta>
23226<refnamediv>
23227 <refname>platform_driver_unregister</refname>
23228 <refpurpose>
23229     unregister a driver for platform-level devices
23230 </refpurpose>
23231</refnamediv>
23232<refsynopsisdiv>
23233 <title>Synopsis</title>
23234  <funcsynopsis><funcprototype>
23235   <funcdef>void <function>platform_driver_unregister </function></funcdef>
23236   <paramdef>struct platform_driver * <parameter>drv</parameter></paramdef>
23237  </funcprototype></funcsynopsis>
23238</refsynopsisdiv>
23239<refsect1>
23240 <title>Arguments</title>
23241 <variablelist>
23242  <varlistentry>
23243   <term><parameter>drv</parameter></term>
23244   <listitem>
23245    <para>
23246     platform driver structure
23247    </para>
23248   </listitem>
23249  </varlistentry>
23250 </variablelist>
23251</refsect1>
23252</refentry>
23253
23254<refentry id="API---platform-driver-probe">
23255<refentryinfo>
23256 <title>LINUX</title>
23257 <productname>Kernel Hackers Manual</productname>
23258 <date>July 2017</date>
23259</refentryinfo>
23260<refmeta>
23261 <refentrytitle><phrase>__platform_driver_probe</phrase></refentrytitle>
23262 <manvolnum>9</manvolnum>
23263 <refmiscinfo class="version">4.4.14</refmiscinfo>
23264</refmeta>
23265<refnamediv>
23266 <refname>__platform_driver_probe</refname>
23267 <refpurpose>
23268     register driver for non-hotpluggable device
23269 </refpurpose>
23270</refnamediv>
23271<refsynopsisdiv>
23272 <title>Synopsis</title>
23273  <funcsynopsis><funcprototype>
23274   <funcdef>int <function>__platform_driver_probe </function></funcdef>
23275   <paramdef>struct platform_driver * <parameter>drv</parameter></paramdef>
23276   <paramdef>int (*<parameter>probe</parameter>)
23277     <funcparams>struct platform_device *</funcparams></paramdef>
23278   <paramdef>struct module * <parameter>module</parameter></paramdef>
23279  </funcprototype></funcsynopsis>
23280</refsynopsisdiv>
23281<refsect1>
23282 <title>Arguments</title>
23283 <variablelist>
23284  <varlistentry>
23285   <term><parameter>drv</parameter></term>
23286   <listitem>
23287    <para>
23288     platform driver structure
23289    </para>
23290   </listitem>
23291  </varlistentry>
23292  <varlistentry>
23293   <term><parameter>probe</parameter></term>
23294   <listitem>
23295    <para>
23296     the driver probe routine, probably from an __init section
23297    </para>
23298   </listitem>
23299  </varlistentry>
23300  <varlistentry>
23301   <term><parameter>module</parameter></term>
23302   <listitem>
23303    <para>
23304     module which will be the owner of the driver
23305    </para>
23306   </listitem>
23307  </varlistentry>
23308 </variablelist>
23309</refsect1>
23310<refsect1>
23311<title>Description</title>
23312<para>
23313   Use this instead of <function>platform_driver_register</function> when you know the device
23314   is not hotpluggable and has already been registered, and you want to
23315   remove its run-once <function>probe</function> infrastructure from memory after the driver
23316   has bound to the device.
23317   </para><para>
23318
23319   One typical use for this would be with drivers for controllers integrated
23320   into system-on-chip processors, where the controller devices have been
23321   configured as part of board setup.
23322   </para><para>
23323
23324   Note that this is incompatible with deferred probing.
23325   </para><para>
23326
23327   Returns zero if the driver registered and bound to a device, else returns
23328   a negative error code and with the driver not registered.
23329</para>
23330</refsect1>
23331</refentry>
23332
23333<refentry id="API---platform-create-bundle">
23334<refentryinfo>
23335 <title>LINUX</title>
23336 <productname>Kernel Hackers Manual</productname>
23337 <date>July 2017</date>
23338</refentryinfo>
23339<refmeta>
23340 <refentrytitle><phrase>__platform_create_bundle</phrase></refentrytitle>
23341 <manvolnum>9</manvolnum>
23342 <refmiscinfo class="version">4.4.14</refmiscinfo>
23343</refmeta>
23344<refnamediv>
23345 <refname>__platform_create_bundle</refname>
23346 <refpurpose>
23347     register driver and create corresponding device
23348 </refpurpose>
23349</refnamediv>
23350<refsynopsisdiv>
23351 <title>Synopsis</title>
23352  <funcsynopsis><funcprototype>
23353   <funcdef>struct platform_device * <function>__platform_create_bundle </function></funcdef>
23354   <paramdef>struct platform_driver * <parameter>driver</parameter></paramdef>
23355   <paramdef>int (*<parameter>probe</parameter>)
23356     <funcparams>struct platform_device *</funcparams></paramdef>
23357   <paramdef>struct resource * <parameter>res</parameter></paramdef>
23358   <paramdef>unsigned int <parameter>n_res</parameter></paramdef>
23359   <paramdef>const void * <parameter>data</parameter></paramdef>
23360   <paramdef>size_t <parameter>size</parameter></paramdef>
23361   <paramdef>struct module * <parameter>module</parameter></paramdef>
23362  </funcprototype></funcsynopsis>
23363</refsynopsisdiv>
23364<refsect1>
23365 <title>Arguments</title>
23366 <variablelist>
23367  <varlistentry>
23368   <term><parameter>driver</parameter></term>
23369   <listitem>
23370    <para>
23371     platform driver structure
23372    </para>
23373   </listitem>
23374  </varlistentry>
23375  <varlistentry>
23376   <term><parameter>probe</parameter></term>
23377   <listitem>
23378    <para>
23379     the driver probe routine, probably from an __init section
23380    </para>
23381   </listitem>
23382  </varlistentry>
23383  <varlistentry>
23384   <term><parameter>res</parameter></term>
23385   <listitem>
23386    <para>
23387     set of resources that needs to be allocated for the device
23388    </para>
23389   </listitem>
23390  </varlistentry>
23391  <varlistentry>
23392   <term><parameter>n_res</parameter></term>
23393   <listitem>
23394    <para>
23395     number of resources
23396    </para>
23397   </listitem>
23398  </varlistentry>
23399  <varlistentry>
23400   <term><parameter>data</parameter></term>
23401   <listitem>
23402    <para>
23403     platform specific data for this platform device
23404    </para>
23405   </listitem>
23406  </varlistentry>
23407  <varlistentry>
23408   <term><parameter>size</parameter></term>
23409   <listitem>
23410    <para>
23411     size of platform specific data
23412    </para>
23413   </listitem>
23414  </varlistentry>
23415  <varlistentry>
23416   <term><parameter>module</parameter></term>
23417   <listitem>
23418    <para>
23419     module which will be the owner of the driver
23420    </para>
23421   </listitem>
23422  </varlistentry>
23423 </variablelist>
23424</refsect1>
23425<refsect1>
23426<title>Description</title>
23427<para>
23428   Use this in legacy-style modules that probe hardware directly and
23429   register a single platform device and corresponding platform driver.
23430   </para><para>
23431
23432   Returns <structname>struct platform_device</structname> pointer on success, or <function>ERR_PTR</function> on error.
23433</para>
23434</refsect1>
23435</refentry>
23436
23437<refentry id="API---platform-register-drivers">
23438<refentryinfo>
23439 <title>LINUX</title>
23440 <productname>Kernel Hackers Manual</productname>
23441 <date>July 2017</date>
23442</refentryinfo>
23443<refmeta>
23444 <refentrytitle><phrase>__platform_register_drivers</phrase></refentrytitle>
23445 <manvolnum>9</manvolnum>
23446 <refmiscinfo class="version">4.4.14</refmiscinfo>
23447</refmeta>
23448<refnamediv>
23449 <refname>__platform_register_drivers</refname>
23450 <refpurpose>
23451     register an array of platform drivers
23452 </refpurpose>
23453</refnamediv>
23454<refsynopsisdiv>
23455 <title>Synopsis</title>
23456  <funcsynopsis><funcprototype>
23457   <funcdef>int <function>__platform_register_drivers </function></funcdef>
23458   <paramdef>struct platform_driver *const * <parameter>drivers</parameter></paramdef>
23459   <paramdef>unsigned int <parameter>count</parameter></paramdef>
23460   <paramdef>struct module * <parameter>owner</parameter></paramdef>
23461  </funcprototype></funcsynopsis>
23462</refsynopsisdiv>
23463<refsect1>
23464 <title>Arguments</title>
23465 <variablelist>
23466  <varlistentry>
23467   <term><parameter>drivers</parameter></term>
23468   <listitem>
23469    <para>
23470     an array of drivers to register
23471    </para>
23472   </listitem>
23473  </varlistentry>
23474  <varlistentry>
23475   <term><parameter>count</parameter></term>
23476   <listitem>
23477    <para>
23478     the number of drivers to register
23479    </para>
23480   </listitem>
23481  </varlistentry>
23482  <varlistentry>
23483   <term><parameter>owner</parameter></term>
23484   <listitem>
23485    <para>
23486     module owning the drivers
23487    </para>
23488   </listitem>
23489  </varlistentry>
23490 </variablelist>
23491</refsect1>
23492<refsect1>
23493<title>Description</title>
23494<para>
23495   Registers platform drivers specified by an array. On failure to register a
23496   driver, all previously registered drivers will be unregistered. Callers of
23497   this API should use <function><link linkend="API-platform-unregister-drivers">platform_unregister_drivers</link></function> to unregister drivers in
23498   the reverse order.
23499</para>
23500</refsect1>
23501<refsect1>
23502<title>Returns</title>
23503<para>
23504   0 on success or a negative error code on failure.
23505</para>
23506</refsect1>
23507</refentry>
23508
23509<refentry id="API-platform-unregister-drivers">
23510<refentryinfo>
23511 <title>LINUX</title>
23512 <productname>Kernel Hackers Manual</productname>
23513 <date>July 2017</date>
23514</refentryinfo>
23515<refmeta>
23516 <refentrytitle><phrase>platform_unregister_drivers</phrase></refentrytitle>
23517 <manvolnum>9</manvolnum>
23518 <refmiscinfo class="version">4.4.14</refmiscinfo>
23519</refmeta>
23520<refnamediv>
23521 <refname>platform_unregister_drivers</refname>
23522 <refpurpose>
23523     unregister an array of platform drivers
23524 </refpurpose>
23525</refnamediv>
23526<refsynopsisdiv>
23527 <title>Synopsis</title>
23528  <funcsynopsis><funcprototype>
23529   <funcdef>void <function>platform_unregister_drivers </function></funcdef>
23530   <paramdef>struct platform_driver *const * <parameter>drivers</parameter></paramdef>
23531   <paramdef>unsigned int <parameter>count</parameter></paramdef>
23532  </funcprototype></funcsynopsis>
23533</refsynopsisdiv>
23534<refsect1>
23535 <title>Arguments</title>
23536 <variablelist>
23537  <varlistentry>
23538   <term><parameter>drivers</parameter></term>
23539   <listitem>
23540    <para>
23541     an array of drivers to unregister
23542    </para>
23543   </listitem>
23544  </varlistentry>
23545  <varlistentry>
23546   <term><parameter>count</parameter></term>
23547   <listitem>
23548    <para>
23549     the number of drivers to unregister
23550    </para>
23551   </listitem>
23552  </varlistentry>
23553 </variablelist>
23554</refsect1>
23555<refsect1>
23556<title>Description</title>
23557<para>
23558   Unegisters platform drivers specified by an array. This is typically used
23559   to complement an earlier call to <function>platform_register_drivers</function>. Drivers are
23560   unregistered in the reverse order in which they were registered.
23561</para>
23562</refsect1>
23563</refentry>
23564
23565<!-- drivers/base/bus.c -->
23566<refentry id="API-bus-for-each-dev">
23567<refentryinfo>
23568 <title>LINUX</title>
23569 <productname>Kernel Hackers Manual</productname>
23570 <date>July 2017</date>
23571</refentryinfo>
23572<refmeta>
23573 <refentrytitle><phrase>bus_for_each_dev</phrase></refentrytitle>
23574 <manvolnum>9</manvolnum>
23575 <refmiscinfo class="version">4.4.14</refmiscinfo>
23576</refmeta>
23577<refnamediv>
23578 <refname>bus_for_each_dev</refname>
23579 <refpurpose>
23580  device iterator.
23581 </refpurpose>
23582</refnamediv>
23583<refsynopsisdiv>
23584 <title>Synopsis</title>
23585  <funcsynopsis><funcprototype>
23586   <funcdef>int <function>bus_for_each_dev </function></funcdef>
23587   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
23588   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
23589   <paramdef>void * <parameter>data</parameter></paramdef>
23590   <paramdef>int (*<parameter>fn</parameter>)
23591     <funcparams>struct device *, void *</funcparams></paramdef>
23592  </funcprototype></funcsynopsis>
23593</refsynopsisdiv>
23594<refsect1>
23595 <title>Arguments</title>
23596 <variablelist>
23597  <varlistentry>
23598   <term><parameter>bus</parameter></term>
23599   <listitem>
23600    <para>
23601     bus type.
23602    </para>
23603   </listitem>
23604  </varlistentry>
23605  <varlistentry>
23606   <term><parameter>start</parameter></term>
23607   <listitem>
23608    <para>
23609     device to start iterating from.
23610    </para>
23611   </listitem>
23612  </varlistentry>
23613  <varlistentry>
23614   <term><parameter>data</parameter></term>
23615   <listitem>
23616    <para>
23617     data for the callback.
23618    </para>
23619   </listitem>
23620  </varlistentry>
23621  <varlistentry>
23622   <term><parameter>fn</parameter></term>
23623   <listitem>
23624    <para>
23625     function to be called for each device.
23626    </para>
23627   </listitem>
23628  </varlistentry>
23629 </variablelist>
23630</refsect1>
23631<refsect1>
23632<title>Description</title>
23633<para>
23634   Iterate over <parameter>bus</parameter>'s list of devices, and call <parameter>fn</parameter> for each,
23635   passing it <parameter>data</parameter>. If <parameter>start</parameter> is not NULL, we use that device to
23636   begin iterating from.
23637   </para><para>
23638
23639   We check the return of <parameter>fn</parameter> each time. If it returns anything
23640   other than 0, we break out and return that value.
23641</para>
23642</refsect1>
23643<refsect1>
23644<title>NOTE</title>
23645<para>
23646   The device that returns a non-zero value is not retained
23647   in any way, nor is its refcount incremented. If the caller needs
23648   to retain this data, it should do so, and increment the reference
23649   count in the supplied callback.
23650</para>
23651</refsect1>
23652</refentry>
23653
23654<refentry id="API-bus-find-device">
23655<refentryinfo>
23656 <title>LINUX</title>
23657 <productname>Kernel Hackers Manual</productname>
23658 <date>July 2017</date>
23659</refentryinfo>
23660<refmeta>
23661 <refentrytitle><phrase>bus_find_device</phrase></refentrytitle>
23662 <manvolnum>9</manvolnum>
23663 <refmiscinfo class="version">4.4.14</refmiscinfo>
23664</refmeta>
23665<refnamediv>
23666 <refname>bus_find_device</refname>
23667 <refpurpose>
23668     device iterator for locating a particular device.
23669 </refpurpose>
23670</refnamediv>
23671<refsynopsisdiv>
23672 <title>Synopsis</title>
23673  <funcsynopsis><funcprototype>
23674   <funcdef><link linkend="API-struct-device">struct device</link> * <function>bus_find_device </function></funcdef>
23675   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
23676   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
23677   <paramdef>void * <parameter>data</parameter></paramdef>
23678   <paramdef>int (*<parameter>match</parameter>)
23679     <funcparams>struct device *dev, void *data</funcparams></paramdef>
23680  </funcprototype></funcsynopsis>
23681</refsynopsisdiv>
23682<refsect1>
23683 <title>Arguments</title>
23684 <variablelist>
23685  <varlistentry>
23686   <term><parameter>bus</parameter></term>
23687   <listitem>
23688    <para>
23689     bus type
23690    </para>
23691   </listitem>
23692  </varlistentry>
23693  <varlistentry>
23694   <term><parameter>start</parameter></term>
23695   <listitem>
23696    <para>
23697     Device to begin with
23698    </para>
23699   </listitem>
23700  </varlistentry>
23701  <varlistentry>
23702   <term><parameter>data</parameter></term>
23703   <listitem>
23704    <para>
23705     Data to pass to match function
23706    </para>
23707   </listitem>
23708  </varlistentry>
23709  <varlistentry>
23710   <term><parameter>match</parameter></term>
23711   <listitem>
23712    <para>
23713     Callback function to check device
23714    </para>
23715   </listitem>
23716  </varlistentry>
23717 </variablelist>
23718</refsect1>
23719<refsect1>
23720<title>Description</title>
23721<para>
23722   This is similar to the <function><link linkend="API-bus-for-each-dev">bus_for_each_dev</link></function> function above, but it
23723   returns a reference to a device that is 'found' for later use, as
23724   determined by the <parameter>match</parameter> callback.
23725   </para><para>
23726
23727   The callback should return 0 if the device doesn't match and non-zero
23728   if it does.  If the callback returns non-zero, this function will
23729   return to the caller and not iterate over any more devices.
23730</para>
23731</refsect1>
23732</refentry>
23733
23734<refentry id="API-bus-find-device-by-name">
23735<refentryinfo>
23736 <title>LINUX</title>
23737 <productname>Kernel Hackers Manual</productname>
23738 <date>July 2017</date>
23739</refentryinfo>
23740<refmeta>
23741 <refentrytitle><phrase>bus_find_device_by_name</phrase></refentrytitle>
23742 <manvolnum>9</manvolnum>
23743 <refmiscinfo class="version">4.4.14</refmiscinfo>
23744</refmeta>
23745<refnamediv>
23746 <refname>bus_find_device_by_name</refname>
23747 <refpurpose>
23748     device iterator for locating a particular device of a specific name
23749 </refpurpose>
23750</refnamediv>
23751<refsynopsisdiv>
23752 <title>Synopsis</title>
23753  <funcsynopsis><funcprototype>
23754   <funcdef><link linkend="API-struct-device">struct device</link> * <function>bus_find_device_by_name </function></funcdef>
23755   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
23756   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
23757   <paramdef>const char * <parameter>name</parameter></paramdef>
23758  </funcprototype></funcsynopsis>
23759</refsynopsisdiv>
23760<refsect1>
23761 <title>Arguments</title>
23762 <variablelist>
23763  <varlistentry>
23764   <term><parameter>bus</parameter></term>
23765   <listitem>
23766    <para>
23767     bus type
23768    </para>
23769   </listitem>
23770  </varlistentry>
23771  <varlistentry>
23772   <term><parameter>start</parameter></term>
23773   <listitem>
23774    <para>
23775     Device to begin with
23776    </para>
23777   </listitem>
23778  </varlistentry>
23779  <varlistentry>
23780   <term><parameter>name</parameter></term>
23781   <listitem>
23782    <para>
23783     name of the device to match
23784    </para>
23785   </listitem>
23786  </varlistentry>
23787 </variablelist>
23788</refsect1>
23789<refsect1>
23790<title>Description</title>
23791<para>
23792   This is similar to the <function><link linkend="API-bus-find-device">bus_find_device</link></function> function above, but it handles
23793   searching by a name automatically, no need to write another strcmp matching
23794   function.
23795</para>
23796</refsect1>
23797</refentry>
23798
23799<refentry id="API-subsys-find-device-by-id">
23800<refentryinfo>
23801 <title>LINUX</title>
23802 <productname>Kernel Hackers Manual</productname>
23803 <date>July 2017</date>
23804</refentryinfo>
23805<refmeta>
23806 <refentrytitle><phrase>subsys_find_device_by_id</phrase></refentrytitle>
23807 <manvolnum>9</manvolnum>
23808 <refmiscinfo class="version">4.4.14</refmiscinfo>
23809</refmeta>
23810<refnamediv>
23811 <refname>subsys_find_device_by_id</refname>
23812 <refpurpose>
23813     find a device with a specific enumeration number
23814 </refpurpose>
23815</refnamediv>
23816<refsynopsisdiv>
23817 <title>Synopsis</title>
23818  <funcsynopsis><funcprototype>
23819   <funcdef><link linkend="API-struct-device">struct device</link> * <function>subsys_find_device_by_id </function></funcdef>
23820   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>subsys</parameter></paramdef>
23821   <paramdef>unsigned int <parameter>id</parameter></paramdef>
23822   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>hint</parameter></paramdef>
23823  </funcprototype></funcsynopsis>
23824</refsynopsisdiv>
23825<refsect1>
23826 <title>Arguments</title>
23827 <variablelist>
23828  <varlistentry>
23829   <term><parameter>subsys</parameter></term>
23830   <listitem>
23831    <para>
23832     subsystem
23833    </para>
23834   </listitem>
23835  </varlistentry>
23836  <varlistentry>
23837   <term><parameter>id</parameter></term>
23838   <listitem>
23839    <para>
23840     index 'id' in struct device
23841    </para>
23842   </listitem>
23843  </varlistentry>
23844  <varlistentry>
23845   <term><parameter>hint</parameter></term>
23846   <listitem>
23847    <para>
23848     device to check first
23849    </para>
23850   </listitem>
23851  </varlistentry>
23852 </variablelist>
23853</refsect1>
23854<refsect1>
23855<title>Description</title>
23856<para>
23857   Check the hint's next object and if it is a match return it directly,
23858   otherwise, fall back to a full list search. Either way a reference for
23859   the returned object is taken.
23860</para>
23861</refsect1>
23862</refentry>
23863
23864<refentry id="API-bus-for-each-drv">
23865<refentryinfo>
23866 <title>LINUX</title>
23867 <productname>Kernel Hackers Manual</productname>
23868 <date>July 2017</date>
23869</refentryinfo>
23870<refmeta>
23871 <refentrytitle><phrase>bus_for_each_drv</phrase></refentrytitle>
23872 <manvolnum>9</manvolnum>
23873 <refmiscinfo class="version">4.4.14</refmiscinfo>
23874</refmeta>
23875<refnamediv>
23876 <refname>bus_for_each_drv</refname>
23877 <refpurpose>
23878     driver iterator
23879 </refpurpose>
23880</refnamediv>
23881<refsynopsisdiv>
23882 <title>Synopsis</title>
23883  <funcsynopsis><funcprototype>
23884   <funcdef>int <function>bus_for_each_drv </function></funcdef>
23885   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
23886   <paramdef><link linkend="API-struct-device-driver">struct device_driver</link> * <parameter>start</parameter></paramdef>
23887   <paramdef>void * <parameter>data</parameter></paramdef>
23888   <paramdef>int (*<parameter>fn</parameter>)
23889     <funcparams>struct device_driver *, void *</funcparams></paramdef>
23890  </funcprototype></funcsynopsis>
23891</refsynopsisdiv>
23892<refsect1>
23893 <title>Arguments</title>
23894 <variablelist>
23895  <varlistentry>
23896   <term><parameter>bus</parameter></term>
23897   <listitem>
23898    <para>
23899     bus we're dealing with.
23900    </para>
23901   </listitem>
23902  </varlistentry>
23903  <varlistentry>
23904   <term><parameter>start</parameter></term>
23905   <listitem>
23906    <para>
23907     driver to start iterating on.
23908    </para>
23909   </listitem>
23910  </varlistentry>
23911  <varlistentry>
23912   <term><parameter>data</parameter></term>
23913   <listitem>
23914    <para>
23915     data to pass to the callback.
23916    </para>
23917   </listitem>
23918  </varlistentry>
23919  <varlistentry>
23920   <term><parameter>fn</parameter></term>
23921   <listitem>
23922    <para>
23923     function to call for each driver.
23924    </para>
23925   </listitem>
23926  </varlistentry>
23927 </variablelist>
23928</refsect1>
23929<refsect1>
23930<title>Description</title>
23931<para>
23932   This is nearly identical to the device iterator above.
23933   We iterate over each driver that belongs to <parameter>bus</parameter>, and call
23934   <parameter>fn</parameter> for each. If <parameter>fn</parameter> returns anything but 0, we break out
23935   and return it. If <parameter>start</parameter> is not NULL, we use it as the head
23936   of the list.
23937</para>
23938</refsect1>
23939<refsect1>
23940<title>NOTE</title>
23941<para>
23942   we don't return the driver that returns a non-zero
23943   value, nor do we leave the reference count incremented for that
23944   driver. If the caller needs to know that info, it must set it
23945   in the callback. It must also be sure to increment the refcount
23946   so it doesn't disappear before returning to the caller.
23947</para>
23948</refsect1>
23949</refentry>
23950
23951<refentry id="API-bus-rescan-devices">
23952<refentryinfo>
23953 <title>LINUX</title>
23954 <productname>Kernel Hackers Manual</productname>
23955 <date>July 2017</date>
23956</refentryinfo>
23957<refmeta>
23958 <refentrytitle><phrase>bus_rescan_devices</phrase></refentrytitle>
23959 <manvolnum>9</manvolnum>
23960 <refmiscinfo class="version">4.4.14</refmiscinfo>
23961</refmeta>
23962<refnamediv>
23963 <refname>bus_rescan_devices</refname>
23964 <refpurpose>
23965     rescan devices on the bus for possible drivers
23966 </refpurpose>
23967</refnamediv>
23968<refsynopsisdiv>
23969 <title>Synopsis</title>
23970  <funcsynopsis><funcprototype>
23971   <funcdef>int <function>bus_rescan_devices </function></funcdef>
23972   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
23973  </funcprototype></funcsynopsis>
23974</refsynopsisdiv>
23975<refsect1>
23976 <title>Arguments</title>
23977 <variablelist>
23978  <varlistentry>
23979   <term><parameter>bus</parameter></term>
23980   <listitem>
23981    <para>
23982     the bus to scan.
23983    </para>
23984   </listitem>
23985  </varlistentry>
23986 </variablelist>
23987</refsect1>
23988<refsect1>
23989<title>Description</title>
23990<para>
23991   This function will look for devices on the bus with no driver
23992   attached and rescan it against existing drivers to see if it matches
23993   any by calling <function><link linkend="API-device-attach">device_attach</link></function> for the unbound devices.
23994</para>
23995</refsect1>
23996</refentry>
23997
23998<refentry id="API-device-reprobe">
23999<refentryinfo>
24000 <title>LINUX</title>
24001 <productname>Kernel Hackers Manual</productname>
24002 <date>July 2017</date>
24003</refentryinfo>
24004<refmeta>
24005 <refentrytitle><phrase>device_reprobe</phrase></refentrytitle>
24006 <manvolnum>9</manvolnum>
24007 <refmiscinfo class="version">4.4.14</refmiscinfo>
24008</refmeta>
24009<refnamediv>
24010 <refname>device_reprobe</refname>
24011 <refpurpose>
24012     remove driver for a device and probe for a new driver
24013 </refpurpose>
24014</refnamediv>
24015<refsynopsisdiv>
24016 <title>Synopsis</title>
24017  <funcsynopsis><funcprototype>
24018   <funcdef>int <function>device_reprobe </function></funcdef>
24019   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
24020  </funcprototype></funcsynopsis>
24021</refsynopsisdiv>
24022<refsect1>
24023 <title>Arguments</title>
24024 <variablelist>
24025  <varlistentry>
24026   <term><parameter>dev</parameter></term>
24027   <listitem>
24028    <para>
24029     the device to reprobe
24030    </para>
24031   </listitem>
24032  </varlistentry>
24033 </variablelist>
24034</refsect1>
24035<refsect1>
24036<title>Description</title>
24037<para>
24038   This function detaches the attached driver (if any) for the given
24039   device and restarts the driver probing process.  It is intended
24040   to use if probing criteria changed during a devices lifetime and
24041   driver attachment should change accordingly.
24042</para>
24043</refsect1>
24044</refentry>
24045
24046<refentry id="API-bus-register">
24047<refentryinfo>
24048 <title>LINUX</title>
24049 <productname>Kernel Hackers Manual</productname>
24050 <date>July 2017</date>
24051</refentryinfo>
24052<refmeta>
24053 <refentrytitle><phrase>bus_register</phrase></refentrytitle>
24054 <manvolnum>9</manvolnum>
24055 <refmiscinfo class="version">4.4.14</refmiscinfo>
24056</refmeta>
24057<refnamediv>
24058 <refname>bus_register</refname>
24059 <refpurpose>
24060     register a driver-core subsystem
24061 </refpurpose>
24062</refnamediv>
24063<refsynopsisdiv>
24064 <title>Synopsis</title>
24065  <funcsynopsis><funcprototype>
24066   <funcdef>int <function>bus_register </function></funcdef>
24067   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
24068  </funcprototype></funcsynopsis>
24069</refsynopsisdiv>
24070<refsect1>
24071 <title>Arguments</title>
24072 <variablelist>
24073  <varlistentry>
24074   <term><parameter>bus</parameter></term>
24075   <listitem>
24076    <para>
24077     bus to register
24078    </para>
24079   </listitem>
24080  </varlistentry>
24081 </variablelist>
24082</refsect1>
24083<refsect1>
24084<title>Description</title>
24085<para>
24086   Once we have that, we register the bus with the kobject
24087   infrastructure, then register the children subsystems it has:
24088   the devices and drivers that belong to the subsystem.
24089</para>
24090</refsect1>
24091</refentry>
24092
24093<refentry id="API-bus-unregister">
24094<refentryinfo>
24095 <title>LINUX</title>
24096 <productname>Kernel Hackers Manual</productname>
24097 <date>July 2017</date>
24098</refentryinfo>
24099<refmeta>
24100 <refentrytitle><phrase>bus_unregister</phrase></refentrytitle>
24101 <manvolnum>9</manvolnum>
24102 <refmiscinfo class="version">4.4.14</refmiscinfo>
24103</refmeta>
24104<refnamediv>
24105 <refname>bus_unregister</refname>
24106 <refpurpose>
24107     remove a bus from the system
24108 </refpurpose>
24109</refnamediv>
24110<refsynopsisdiv>
24111 <title>Synopsis</title>
24112  <funcsynopsis><funcprototype>
24113   <funcdef>void <function>bus_unregister </function></funcdef>
24114   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>bus</parameter></paramdef>
24115  </funcprototype></funcsynopsis>
24116</refsynopsisdiv>
24117<refsect1>
24118 <title>Arguments</title>
24119 <variablelist>
24120  <varlistentry>
24121   <term><parameter>bus</parameter></term>
24122   <listitem>
24123    <para>
24124     bus.
24125    </para>
24126   </listitem>
24127  </varlistentry>
24128 </variablelist>
24129</refsect1>
24130<refsect1>
24131<title>Description</title>
24132<para>
24133   Unregister the child subsystems and the bus itself.
24134   Finally, we call <function>bus_put</function> to release the refcount
24135</para>
24136</refsect1>
24137</refentry>
24138
24139<refentry id="API-subsys-dev-iter-init">
24140<refentryinfo>
24141 <title>LINUX</title>
24142 <productname>Kernel Hackers Manual</productname>
24143 <date>July 2017</date>
24144</refentryinfo>
24145<refmeta>
24146 <refentrytitle><phrase>subsys_dev_iter_init</phrase></refentrytitle>
24147 <manvolnum>9</manvolnum>
24148 <refmiscinfo class="version">4.4.14</refmiscinfo>
24149</refmeta>
24150<refnamediv>
24151 <refname>subsys_dev_iter_init</refname>
24152 <refpurpose>
24153     initialize subsys device iterator
24154 </refpurpose>
24155</refnamediv>
24156<refsynopsisdiv>
24157 <title>Synopsis</title>
24158  <funcsynopsis><funcprototype>
24159   <funcdef>void <function>subsys_dev_iter_init </function></funcdef>
24160   <paramdef>struct subsys_dev_iter * <parameter>iter</parameter></paramdef>
24161   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>subsys</parameter></paramdef>
24162   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>start</parameter></paramdef>
24163   <paramdef>const struct device_type * <parameter>type</parameter></paramdef>
24164  </funcprototype></funcsynopsis>
24165</refsynopsisdiv>
24166<refsect1>
24167 <title>Arguments</title>
24168 <variablelist>
24169  <varlistentry>
24170   <term><parameter>iter</parameter></term>
24171   <listitem>
24172    <para>
24173     subsys iterator to initialize
24174    </para>
24175   </listitem>
24176  </varlistentry>
24177  <varlistentry>
24178   <term><parameter>subsys</parameter></term>
24179   <listitem>
24180    <para>
24181     the subsys we wanna iterate over
24182    </para>
24183   </listitem>
24184  </varlistentry>
24185  <varlistentry>
24186   <term><parameter>start</parameter></term>
24187   <listitem>
24188    <para>
24189     the device to start iterating from, if any
24190    </para>
24191   </listitem>
24192  </varlistentry>
24193  <varlistentry>
24194   <term><parameter>type</parameter></term>
24195   <listitem>
24196    <para>
24197     device_type of the devices to iterate over, NULL for all
24198    </para>
24199   </listitem>
24200  </varlistentry>
24201 </variablelist>
24202</refsect1>
24203<refsect1>
24204<title>Description</title>
24205<para>
24206   Initialize subsys iterator <parameter>iter</parameter> such that it iterates over devices
24207   of <parameter>subsys</parameter>.  If <parameter>start</parameter> is set, the list iteration will start there,
24208   otherwise if it is NULL, the iteration starts at the beginning of
24209   the list.
24210</para>
24211</refsect1>
24212</refentry>
24213
24214<refentry id="API-subsys-dev-iter-next">
24215<refentryinfo>
24216 <title>LINUX</title>
24217 <productname>Kernel Hackers Manual</productname>
24218 <date>July 2017</date>
24219</refentryinfo>
24220<refmeta>
24221 <refentrytitle><phrase>subsys_dev_iter_next</phrase></refentrytitle>
24222 <manvolnum>9</manvolnum>
24223 <refmiscinfo class="version">4.4.14</refmiscinfo>
24224</refmeta>
24225<refnamediv>
24226 <refname>subsys_dev_iter_next</refname>
24227 <refpurpose>
24228     iterate to the next device
24229 </refpurpose>
24230</refnamediv>
24231<refsynopsisdiv>
24232 <title>Synopsis</title>
24233  <funcsynopsis><funcprototype>
24234   <funcdef><link linkend="API-struct-device">struct device</link> * <function>subsys_dev_iter_next </function></funcdef>
24235   <paramdef>struct subsys_dev_iter * <parameter>iter</parameter></paramdef>
24236  </funcprototype></funcsynopsis>
24237</refsynopsisdiv>
24238<refsect1>
24239 <title>Arguments</title>
24240 <variablelist>
24241  <varlistentry>
24242   <term><parameter>iter</parameter></term>
24243   <listitem>
24244    <para>
24245     subsys iterator to proceed
24246    </para>
24247   </listitem>
24248  </varlistentry>
24249 </variablelist>
24250</refsect1>
24251<refsect1>
24252<title>Description</title>
24253<para>
24254   Proceed <parameter>iter</parameter> to the next device and return it.  Returns NULL if
24255   iteration is complete.
24256   </para><para>
24257
24258   The returned device is referenced and won't be released till
24259   iterator is proceed to the next device or exited.  The caller is
24260   free to do whatever it wants to do with the device including
24261   calling back into subsys code.
24262</para>
24263</refsect1>
24264</refentry>
24265
24266<refentry id="API-subsys-dev-iter-exit">
24267<refentryinfo>
24268 <title>LINUX</title>
24269 <productname>Kernel Hackers Manual</productname>
24270 <date>July 2017</date>
24271</refentryinfo>
24272<refmeta>
24273 <refentrytitle><phrase>subsys_dev_iter_exit</phrase></refentrytitle>
24274 <manvolnum>9</manvolnum>
24275 <refmiscinfo class="version">4.4.14</refmiscinfo>
24276</refmeta>
24277<refnamediv>
24278 <refname>subsys_dev_iter_exit</refname>
24279 <refpurpose>
24280     finish iteration
24281 </refpurpose>
24282</refnamediv>
24283<refsynopsisdiv>
24284 <title>Synopsis</title>
24285  <funcsynopsis><funcprototype>
24286   <funcdef>void <function>subsys_dev_iter_exit </function></funcdef>
24287   <paramdef>struct subsys_dev_iter * <parameter>iter</parameter></paramdef>
24288  </funcprototype></funcsynopsis>
24289</refsynopsisdiv>
24290<refsect1>
24291 <title>Arguments</title>
24292 <variablelist>
24293  <varlistentry>
24294   <term><parameter>iter</parameter></term>
24295   <listitem>
24296    <para>
24297     subsys iterator to finish
24298    </para>
24299   </listitem>
24300  </varlistentry>
24301 </variablelist>
24302</refsect1>
24303<refsect1>
24304<title>Description</title>
24305<para>
24306   Finish an iteration.  Always call this function after iteration is
24307   complete whether the iteration ran till the end or not.
24308</para>
24309</refsect1>
24310</refentry>
24311
24312<refentry id="API-subsys-system-register">
24313<refentryinfo>
24314 <title>LINUX</title>
24315 <productname>Kernel Hackers Manual</productname>
24316 <date>July 2017</date>
24317</refentryinfo>
24318<refmeta>
24319 <refentrytitle><phrase>subsys_system_register</phrase></refentrytitle>
24320 <manvolnum>9</manvolnum>
24321 <refmiscinfo class="version">4.4.14</refmiscinfo>
24322</refmeta>
24323<refnamediv>
24324 <refname>subsys_system_register</refname>
24325 <refpurpose>
24326     register a subsystem at /sys/devices/system/
24327 </refpurpose>
24328</refnamediv>
24329<refsynopsisdiv>
24330 <title>Synopsis</title>
24331  <funcsynopsis><funcprototype>
24332   <funcdef>int <function>subsys_system_register </function></funcdef>
24333   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>subsys</parameter></paramdef>
24334   <paramdef>const struct attribute_group ** <parameter>groups</parameter></paramdef>
24335  </funcprototype></funcsynopsis>
24336</refsynopsisdiv>
24337<refsect1>
24338 <title>Arguments</title>
24339 <variablelist>
24340  <varlistentry>
24341   <term><parameter>subsys</parameter></term>
24342   <listitem>
24343    <para>
24344     system subsystem
24345    </para>
24346   </listitem>
24347  </varlistentry>
24348  <varlistentry>
24349   <term><parameter>groups</parameter></term>
24350   <listitem>
24351    <para>
24352     default attributes for the root device
24353    </para>
24354   </listitem>
24355  </varlistentry>
24356 </variablelist>
24357</refsect1>
24358<refsect1>
24359<title>Description</title>
24360<para>
24361   All 'system' subsystems have a /sys/devices/system/&lt;name&gt; root device
24362   with the name of the subsystem. The root device can carry subsystem-
24363   wide attributes. All registered devices are below this single root
24364   device and are named after the subsystem with a simple enumeration
24365   number appended. The registered devices are not explicitly named;
24366   only 'id' in the device needs to be set.
24367   </para><para>
24368
24369   Do not use this interface for anything new, it exists for compatibility
24370   with bad ideas only. New subsystems should use plain subsystems; and
24371   add the subsystem-wide attributes should be added to the subsystem
24372   directory itself and not some create fake root-device placed in
24373   /sys/devices/system/&lt;name&gt;.
24374</para>
24375</refsect1>
24376</refentry>
24377
24378<refentry id="API-subsys-virtual-register">
24379<refentryinfo>
24380 <title>LINUX</title>
24381 <productname>Kernel Hackers Manual</productname>
24382 <date>July 2017</date>
24383</refentryinfo>
24384<refmeta>
24385 <refentrytitle><phrase>subsys_virtual_register</phrase></refentrytitle>
24386 <manvolnum>9</manvolnum>
24387 <refmiscinfo class="version">4.4.14</refmiscinfo>
24388</refmeta>
24389<refnamediv>
24390 <refname>subsys_virtual_register</refname>
24391 <refpurpose>
24392     register a subsystem at /sys/devices/virtual/
24393 </refpurpose>
24394</refnamediv>
24395<refsynopsisdiv>
24396 <title>Synopsis</title>
24397  <funcsynopsis><funcprototype>
24398   <funcdef>int <function>subsys_virtual_register </function></funcdef>
24399   <paramdef><link linkend="API-struct-bus-type">struct bus_type</link> * <parameter>subsys</parameter></paramdef>
24400   <paramdef>const struct attribute_group ** <parameter>groups</parameter></paramdef>
24401  </funcprototype></funcsynopsis>
24402</refsynopsisdiv>
24403<refsect1>
24404 <title>Arguments</title>
24405 <variablelist>
24406  <varlistentry>
24407   <term><parameter>subsys</parameter></term>
24408   <listitem>
24409    <para>
24410     virtual subsystem
24411    </para>
24412   </listitem>
24413  </varlistentry>
24414  <varlistentry>
24415   <term><parameter>groups</parameter></term>
24416   <listitem>
24417    <para>
24418     default attributes for the root device
24419    </para>
24420   </listitem>
24421  </varlistentry>
24422 </variablelist>
24423</refsect1>
24424<refsect1>
24425<title>Description</title>
24426<para>
24427   All 'virtual' subsystems have a /sys/devices/system/&lt;name&gt; root device
24428   with the name of the subystem.  The root device can carry subsystem-wide
24429   attributes.  All registered devices are below this single root device.
24430   There's no restriction on device naming.  This is for kernel software
24431   constructs which need sysfs interface.
24432</para>
24433</refsect1>
24434</refentry>
24435
24436     </sect1>
24437     <sect1><title>Device Drivers DMA Management</title>
24438<!-- drivers/dma-buf/dma-buf.c -->
24439<refentry id="API-dma-buf-export">
24440<refentryinfo>
24441 <title>LINUX</title>
24442 <productname>Kernel Hackers Manual</productname>
24443 <date>July 2017</date>
24444</refentryinfo>
24445<refmeta>
24446 <refentrytitle><phrase>dma_buf_export</phrase></refentrytitle>
24447 <manvolnum>9</manvolnum>
24448 <refmiscinfo class="version">4.4.14</refmiscinfo>
24449</refmeta>
24450<refnamediv>
24451 <refname>dma_buf_export</refname>
24452 <refpurpose>
24453  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.
24454 </refpurpose>
24455</refnamediv>
24456<refsynopsisdiv>
24457 <title>Synopsis</title>
24458  <funcsynopsis><funcprototype>
24459   <funcdef>struct dma_buf * <function>dma_buf_export </function></funcdef>
24460   <paramdef>const struct dma_buf_export_info * <parameter>exp_info</parameter></paramdef>
24461  </funcprototype></funcsynopsis>
24462</refsynopsisdiv>
24463<refsect1>
24464 <title>Arguments</title>
24465 <variablelist>
24466  <varlistentry>
24467   <term><parameter>exp_info</parameter></term>
24468   <listitem>
24469    <para>
24470     [in]	holds all the export related information provided
24471     by the exporter. see struct dma_buf_export_info
24472     for further details.
24473    </para>
24474   </listitem>
24475  </varlistentry>
24476 </variablelist>
24477</refsect1>
24478<refsect1>
24479<title>Description</title>
24480<para>
24481   Returns, on success, a newly created dma_buf object, which wraps the
24482   supplied private data and operations for dma_buf_ops. On either missing
24483   ops, or error in allocating struct dma_buf, will return negative error.
24484</para>
24485</refsect1>
24486</refentry>
24487
24488<refentry id="API-dma-buf-fd">
24489<refentryinfo>
24490 <title>LINUX</title>
24491 <productname>Kernel Hackers Manual</productname>
24492 <date>July 2017</date>
24493</refentryinfo>
24494<refmeta>
24495 <refentrytitle><phrase>dma_buf_fd</phrase></refentrytitle>
24496 <manvolnum>9</manvolnum>
24497 <refmiscinfo class="version">4.4.14</refmiscinfo>
24498</refmeta>
24499<refnamediv>
24500 <refname>dma_buf_fd</refname>
24501 <refpurpose>
24502     returns a file descriptor for the given dma_buf
24503 </refpurpose>
24504</refnamediv>
24505<refsynopsisdiv>
24506 <title>Synopsis</title>
24507  <funcsynopsis><funcprototype>
24508   <funcdef>int <function>dma_buf_fd </function></funcdef>
24509   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
24510   <paramdef>int <parameter>flags</parameter></paramdef>
24511  </funcprototype></funcsynopsis>
24512</refsynopsisdiv>
24513<refsect1>
24514 <title>Arguments</title>
24515 <variablelist>
24516  <varlistentry>
24517   <term><parameter>dmabuf</parameter></term>
24518   <listitem>
24519    <para>
24520     [in]	pointer to dma_buf for which fd is required.
24521    </para>
24522   </listitem>
24523  </varlistentry>
24524  <varlistentry>
24525   <term><parameter>flags</parameter></term>
24526   <listitem>
24527    <para>
24528     [in]    flags to give to fd
24529    </para>
24530   </listitem>
24531  </varlistentry>
24532 </variablelist>
24533</refsect1>
24534<refsect1>
24535<title>Description</title>
24536<para>
24537   On success, returns an associated 'fd'. Else, returns error.
24538</para>
24539</refsect1>
24540</refentry>
24541
24542<refentry id="API-dma-buf-get">
24543<refentryinfo>
24544 <title>LINUX</title>
24545 <productname>Kernel Hackers Manual</productname>
24546 <date>July 2017</date>
24547</refentryinfo>
24548<refmeta>
24549 <refentrytitle><phrase>dma_buf_get</phrase></refentrytitle>
24550 <manvolnum>9</manvolnum>
24551 <refmiscinfo class="version">4.4.14</refmiscinfo>
24552</refmeta>
24553<refnamediv>
24554 <refname>dma_buf_get</refname>
24555 <refpurpose>
24556     returns the dma_buf structure related to an fd
24557 </refpurpose>
24558</refnamediv>
24559<refsynopsisdiv>
24560 <title>Synopsis</title>
24561  <funcsynopsis><funcprototype>
24562   <funcdef>struct dma_buf * <function>dma_buf_get </function></funcdef>
24563   <paramdef>int <parameter>fd</parameter></paramdef>
24564  </funcprototype></funcsynopsis>
24565</refsynopsisdiv>
24566<refsect1>
24567 <title>Arguments</title>
24568 <variablelist>
24569  <varlistentry>
24570   <term><parameter>fd</parameter></term>
24571   <listitem>
24572    <para>
24573     [in]	fd associated with the dma_buf to be returned
24574    </para>
24575   </listitem>
24576  </varlistentry>
24577 </variablelist>
24578</refsect1>
24579<refsect1>
24580<title>Description</title>
24581<para>
24582   On success, returns the dma_buf structure associated with an fd; uses
24583   file's refcounting done by fget to increase refcount. returns ERR_PTR
24584   otherwise.
24585</para>
24586</refsect1>
24587</refentry>
24588
24589<refentry id="API-dma-buf-put">
24590<refentryinfo>
24591 <title>LINUX</title>
24592 <productname>Kernel Hackers Manual</productname>
24593 <date>July 2017</date>
24594</refentryinfo>
24595<refmeta>
24596 <refentrytitle><phrase>dma_buf_put</phrase></refentrytitle>
24597 <manvolnum>9</manvolnum>
24598 <refmiscinfo class="version">4.4.14</refmiscinfo>
24599</refmeta>
24600<refnamediv>
24601 <refname>dma_buf_put</refname>
24602 <refpurpose>
24603     decreases refcount of the buffer
24604 </refpurpose>
24605</refnamediv>
24606<refsynopsisdiv>
24607 <title>Synopsis</title>
24608  <funcsynopsis><funcprototype>
24609   <funcdef>void <function>dma_buf_put </function></funcdef>
24610   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
24611  </funcprototype></funcsynopsis>
24612</refsynopsisdiv>
24613<refsect1>
24614 <title>Arguments</title>
24615 <variablelist>
24616  <varlistentry>
24617   <term><parameter>dmabuf</parameter></term>
24618   <listitem>
24619    <para>
24620     [in]	buffer to reduce refcount of
24621    </para>
24622   </listitem>
24623  </varlistentry>
24624 </variablelist>
24625</refsect1>
24626<refsect1>
24627<title>Description</title>
24628<para>
24629   Uses file's refcounting done implicitly by <function>fput</function>
24630</para>
24631</refsect1>
24632</refentry>
24633
24634<refentry id="API-dma-buf-attach">
24635<refentryinfo>
24636 <title>LINUX</title>
24637 <productname>Kernel Hackers Manual</productname>
24638 <date>July 2017</date>
24639</refentryinfo>
24640<refmeta>
24641 <refentrytitle><phrase>dma_buf_attach</phrase></refentrytitle>
24642 <manvolnum>9</manvolnum>
24643 <refmiscinfo class="version">4.4.14</refmiscinfo>
24644</refmeta>
24645<refnamediv>
24646 <refname>dma_buf_attach</refname>
24647 <refpurpose>
24648     Add the device to dma_buf's attachments list; optionally, calls <function>attach</function> of dma_buf_ops to allow device-specific attach functionality
24649 </refpurpose>
24650</refnamediv>
24651<refsynopsisdiv>
24652 <title>Synopsis</title>
24653  <funcsynopsis><funcprototype>
24654   <funcdef>struct dma_buf_attachment * <function>dma_buf_attach </function></funcdef>
24655   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
24656   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
24657  </funcprototype></funcsynopsis>
24658</refsynopsisdiv>
24659<refsect1>
24660 <title>Arguments</title>
24661 <variablelist>
24662  <varlistentry>
24663   <term><parameter>dmabuf</parameter></term>
24664   <listitem>
24665    <para>
24666     [in]	buffer to attach device to.
24667    </para>
24668   </listitem>
24669  </varlistentry>
24670  <varlistentry>
24671   <term><parameter>dev</parameter></term>
24672   <listitem>
24673    <para>
24674     [in]	device to be attached.
24675    </para>
24676   </listitem>
24677  </varlistentry>
24678 </variablelist>
24679</refsect1>
24680<refsect1>
24681<title>Description</title>
24682<para>
24683   Returns struct dma_buf_attachment * for this attachment; returns ERR_PTR on
24684   error.
24685</para>
24686</refsect1>
24687</refentry>
24688
24689<refentry id="API-dma-buf-detach">
24690<refentryinfo>
24691 <title>LINUX</title>
24692 <productname>Kernel Hackers Manual</productname>
24693 <date>July 2017</date>
24694</refentryinfo>
24695<refmeta>
24696 <refentrytitle><phrase>dma_buf_detach</phrase></refentrytitle>
24697 <manvolnum>9</manvolnum>
24698 <refmiscinfo class="version">4.4.14</refmiscinfo>
24699</refmeta>
24700<refnamediv>
24701 <refname>dma_buf_detach</refname>
24702 <refpurpose>
24703     Remove the given attachment from dmabuf's attachments list; optionally calls <function>detach</function> of dma_buf_ops for device-specific detach
24704 </refpurpose>
24705</refnamediv>
24706<refsynopsisdiv>
24707 <title>Synopsis</title>
24708  <funcsynopsis><funcprototype>
24709   <funcdef>void <function>dma_buf_detach </function></funcdef>
24710   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
24711   <paramdef>struct dma_buf_attachment * <parameter>attach</parameter></paramdef>
24712  </funcprototype></funcsynopsis>
24713</refsynopsisdiv>
24714<refsect1>
24715 <title>Arguments</title>
24716 <variablelist>
24717  <varlistentry>
24718   <term><parameter>dmabuf</parameter></term>
24719   <listitem>
24720    <para>
24721     [in]	buffer to detach from.
24722    </para>
24723   </listitem>
24724  </varlistentry>
24725  <varlistentry>
24726   <term><parameter>attach</parameter></term>
24727   <listitem>
24728    <para>
24729     [in]	attachment to be detached; is free'd after this call.
24730    </para>
24731   </listitem>
24732  </varlistentry>
24733 </variablelist>
24734</refsect1>
24735</refentry>
24736
24737<refentry id="API-dma-buf-map-attachment">
24738<refentryinfo>
24739 <title>LINUX</title>
24740 <productname>Kernel Hackers Manual</productname>
24741 <date>July 2017</date>
24742</refentryinfo>
24743<refmeta>
24744 <refentrytitle><phrase>dma_buf_map_attachment</phrase></refentrytitle>
24745 <manvolnum>9</manvolnum>
24746 <refmiscinfo class="version">4.4.14</refmiscinfo>
24747</refmeta>
24748<refnamediv>
24749 <refname>dma_buf_map_attachment</refname>
24750 <refpurpose>
24751     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.
24752 </refpurpose>
24753</refnamediv>
24754<refsynopsisdiv>
24755 <title>Synopsis</title>
24756  <funcsynopsis><funcprototype>
24757   <funcdef>struct sg_table * <function>dma_buf_map_attachment </function></funcdef>
24758   <paramdef>struct dma_buf_attachment * <parameter>attach</parameter></paramdef>
24759   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
24760  </funcprototype></funcsynopsis>
24761</refsynopsisdiv>
24762<refsect1>
24763 <title>Arguments</title>
24764 <variablelist>
24765  <varlistentry>
24766   <term><parameter>attach</parameter></term>
24767   <listitem>
24768    <para>
24769     [in]	attachment whose scatterlist is to be returned
24770    </para>
24771   </listitem>
24772  </varlistentry>
24773  <varlistentry>
24774   <term><parameter>direction</parameter></term>
24775   <listitem>
24776    <para>
24777     [in]	direction of DMA transfer
24778    </para>
24779   </listitem>
24780  </varlistentry>
24781 </variablelist>
24782</refsect1>
24783<refsect1>
24784<title>Description</title>
24785<para>
24786   Returns sg_table containing the scatterlist to be returned; returns ERR_PTR
24787   on error.
24788</para>
24789</refsect1>
24790</refentry>
24791
24792<refentry id="API-dma-buf-unmap-attachment">
24793<refentryinfo>
24794 <title>LINUX</title>
24795 <productname>Kernel Hackers Manual</productname>
24796 <date>July 2017</date>
24797</refentryinfo>
24798<refmeta>
24799 <refentrytitle><phrase>dma_buf_unmap_attachment</phrase></refentrytitle>
24800 <manvolnum>9</manvolnum>
24801 <refmiscinfo class="version">4.4.14</refmiscinfo>
24802</refmeta>
24803<refnamediv>
24804 <refname>dma_buf_unmap_attachment</refname>
24805 <refpurpose>
24806     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.
24807 </refpurpose>
24808</refnamediv>
24809<refsynopsisdiv>
24810 <title>Synopsis</title>
24811  <funcsynopsis><funcprototype>
24812   <funcdef>void <function>dma_buf_unmap_attachment </function></funcdef>
24813   <paramdef>struct dma_buf_attachment * <parameter>attach</parameter></paramdef>
24814   <paramdef>struct sg_table * <parameter>sg_table</parameter></paramdef>
24815   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
24816  </funcprototype></funcsynopsis>
24817</refsynopsisdiv>
24818<refsect1>
24819 <title>Arguments</title>
24820 <variablelist>
24821  <varlistentry>
24822   <term><parameter>attach</parameter></term>
24823   <listitem>
24824    <para>
24825     [in]	attachment to unmap buffer from
24826    </para>
24827   </listitem>
24828  </varlistentry>
24829  <varlistentry>
24830   <term><parameter>sg_table</parameter></term>
24831   <listitem>
24832    <para>
24833     [in]	scatterlist info of the buffer to unmap
24834    </para>
24835   </listitem>
24836  </varlistentry>
24837  <varlistentry>
24838   <term><parameter>direction</parameter></term>
24839   <listitem>
24840    <para>
24841     [in]    direction of DMA transfer
24842    </para>
24843   </listitem>
24844  </varlistentry>
24845 </variablelist>
24846</refsect1>
24847</refentry>
24848
24849<refentry id="API-dma-buf-begin-cpu-access">
24850<refentryinfo>
24851 <title>LINUX</title>
24852 <productname>Kernel Hackers Manual</productname>
24853 <date>July 2017</date>
24854</refentryinfo>
24855<refmeta>
24856 <refentrytitle><phrase>dma_buf_begin_cpu_access</phrase></refentrytitle>
24857 <manvolnum>9</manvolnum>
24858 <refmiscinfo class="version">4.4.14</refmiscinfo>
24859</refmeta>
24860<refnamediv>
24861 <refname>dma_buf_begin_cpu_access</refname>
24862 <refpurpose>
24863     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.
24864 </refpurpose>
24865</refnamediv>
24866<refsynopsisdiv>
24867 <title>Synopsis</title>
24868  <funcsynopsis><funcprototype>
24869   <funcdef>int <function>dma_buf_begin_cpu_access </function></funcdef>
24870   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
24871   <paramdef>size_t <parameter>start</parameter></paramdef>
24872   <paramdef>size_t <parameter>len</parameter></paramdef>
24873   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
24874  </funcprototype></funcsynopsis>
24875</refsynopsisdiv>
24876<refsect1>
24877 <title>Arguments</title>
24878 <variablelist>
24879  <varlistentry>
24880   <term><parameter>dmabuf</parameter></term>
24881   <listitem>
24882    <para>
24883     [in]	buffer to prepare cpu access for.
24884    </para>
24885   </listitem>
24886  </varlistentry>
24887  <varlistentry>
24888   <term><parameter>start</parameter></term>
24889   <listitem>
24890    <para>
24891     [in]	start of range for cpu access.
24892    </para>
24893   </listitem>
24894  </varlistentry>
24895  <varlistentry>
24896   <term><parameter>len</parameter></term>
24897   <listitem>
24898    <para>
24899     [in]	length of range for cpu access.
24900    </para>
24901   </listitem>
24902  </varlistentry>
24903  <varlistentry>
24904   <term><parameter>direction</parameter></term>
24905   <listitem>
24906    <para>
24907     [in]	length of range for cpu access.
24908    </para>
24909   </listitem>
24910  </varlistentry>
24911 </variablelist>
24912</refsect1>
24913<refsect1>
24914<title>Description</title>
24915<para>
24916   Can return negative error values, returns 0 on success.
24917</para>
24918</refsect1>
24919</refentry>
24920
24921<refentry id="API-dma-buf-end-cpu-access">
24922<refentryinfo>
24923 <title>LINUX</title>
24924 <productname>Kernel Hackers Manual</productname>
24925 <date>July 2017</date>
24926</refentryinfo>
24927<refmeta>
24928 <refentrytitle><phrase>dma_buf_end_cpu_access</phrase></refentrytitle>
24929 <manvolnum>9</manvolnum>
24930 <refmiscinfo class="version">4.4.14</refmiscinfo>
24931</refmeta>
24932<refnamediv>
24933 <refname>dma_buf_end_cpu_access</refname>
24934 <refpurpose>
24935     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.
24936 </refpurpose>
24937</refnamediv>
24938<refsynopsisdiv>
24939 <title>Synopsis</title>
24940  <funcsynopsis><funcprototype>
24941   <funcdef>void <function>dma_buf_end_cpu_access </function></funcdef>
24942   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
24943   <paramdef>size_t <parameter>start</parameter></paramdef>
24944   <paramdef>size_t <parameter>len</parameter></paramdef>
24945   <paramdef>enum dma_data_direction <parameter>direction</parameter></paramdef>
24946  </funcprototype></funcsynopsis>
24947</refsynopsisdiv>
24948<refsect1>
24949 <title>Arguments</title>
24950 <variablelist>
24951  <varlistentry>
24952   <term><parameter>dmabuf</parameter></term>
24953   <listitem>
24954    <para>
24955     [in]	buffer to complete cpu access for.
24956    </para>
24957   </listitem>
24958  </varlistentry>
24959  <varlistentry>
24960   <term><parameter>start</parameter></term>
24961   <listitem>
24962    <para>
24963     [in]	start of range for cpu access.
24964    </para>
24965   </listitem>
24966  </varlistentry>
24967  <varlistentry>
24968   <term><parameter>len</parameter></term>
24969   <listitem>
24970    <para>
24971     [in]	length of range for cpu access.
24972    </para>
24973   </listitem>
24974  </varlistentry>
24975  <varlistentry>
24976   <term><parameter>direction</parameter></term>
24977   <listitem>
24978    <para>
24979     [in]	length of range for cpu access.
24980    </para>
24981   </listitem>
24982  </varlistentry>
24983 </variablelist>
24984</refsect1>
24985<refsect1>
24986<title>Description</title>
24987<para>
24988   This call must always succeed.
24989</para>
24990</refsect1>
24991</refentry>
24992
24993<refentry id="API-dma-buf-kmap-atomic">
24994<refentryinfo>
24995 <title>LINUX</title>
24996 <productname>Kernel Hackers Manual</productname>
24997 <date>July 2017</date>
24998</refentryinfo>
24999<refmeta>
25000 <refentrytitle><phrase>dma_buf_kmap_atomic</phrase></refentrytitle>
25001 <manvolnum>9</manvolnum>
25002 <refmiscinfo class="version">4.4.14</refmiscinfo>
25003</refmeta>
25004<refnamediv>
25005 <refname>dma_buf_kmap_atomic</refname>
25006 <refpurpose>
25007     Map a page of the buffer object into kernel address space. The same restrictions as for kmap_atomic and friends apply.
25008 </refpurpose>
25009</refnamediv>
25010<refsynopsisdiv>
25011 <title>Synopsis</title>
25012  <funcsynopsis><funcprototype>
25013   <funcdef>void * <function>dma_buf_kmap_atomic </function></funcdef>
25014   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
25015   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
25016  </funcprototype></funcsynopsis>
25017</refsynopsisdiv>
25018<refsect1>
25019 <title>Arguments</title>
25020 <variablelist>
25021  <varlistentry>
25022   <term><parameter>dmabuf</parameter></term>
25023   <listitem>
25024    <para>
25025     [in]	buffer to map page from.
25026    </para>
25027   </listitem>
25028  </varlistentry>
25029  <varlistentry>
25030   <term><parameter>page_num</parameter></term>
25031   <listitem>
25032    <para>
25033     [in]	page in PAGE_SIZE units to map.
25034    </para>
25035   </listitem>
25036  </varlistentry>
25037 </variablelist>
25038</refsect1>
25039<refsect1>
25040<title>Description</title>
25041<para>
25042   This call must always succeed, any necessary preparations that might fail
25043   need to be done in begin_cpu_access.
25044</para>
25045</refsect1>
25046</refentry>
25047
25048<refentry id="API-dma-buf-kunmap-atomic">
25049<refentryinfo>
25050 <title>LINUX</title>
25051 <productname>Kernel Hackers Manual</productname>
25052 <date>July 2017</date>
25053</refentryinfo>
25054<refmeta>
25055 <refentrytitle><phrase>dma_buf_kunmap_atomic</phrase></refentrytitle>
25056 <manvolnum>9</manvolnum>
25057 <refmiscinfo class="version">4.4.14</refmiscinfo>
25058</refmeta>
25059<refnamediv>
25060 <refname>dma_buf_kunmap_atomic</refname>
25061 <refpurpose>
25062     Unmap a page obtained by dma_buf_kmap_atomic.
25063 </refpurpose>
25064</refnamediv>
25065<refsynopsisdiv>
25066 <title>Synopsis</title>
25067  <funcsynopsis><funcprototype>
25068   <funcdef>void <function>dma_buf_kunmap_atomic </function></funcdef>
25069   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
25070   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
25071   <paramdef>void * <parameter>vaddr</parameter></paramdef>
25072  </funcprototype></funcsynopsis>
25073</refsynopsisdiv>
25074<refsect1>
25075 <title>Arguments</title>
25076 <variablelist>
25077  <varlistentry>
25078   <term><parameter>dmabuf</parameter></term>
25079   <listitem>
25080    <para>
25081     [in]	buffer to unmap page from.
25082    </para>
25083   </listitem>
25084  </varlistentry>
25085  <varlistentry>
25086   <term><parameter>page_num</parameter></term>
25087   <listitem>
25088    <para>
25089     [in]	page in PAGE_SIZE units to unmap.
25090    </para>
25091   </listitem>
25092  </varlistentry>
25093  <varlistentry>
25094   <term><parameter>vaddr</parameter></term>
25095   <listitem>
25096    <para>
25097     [in]	kernel space pointer obtained from dma_buf_kmap_atomic.
25098    </para>
25099   </listitem>
25100  </varlistentry>
25101 </variablelist>
25102</refsect1>
25103<refsect1>
25104<title>Description</title>
25105<para>
25106   This call must always succeed.
25107</para>
25108</refsect1>
25109</refentry>
25110
25111<refentry id="API-dma-buf-kmap">
25112<refentryinfo>
25113 <title>LINUX</title>
25114 <productname>Kernel Hackers Manual</productname>
25115 <date>July 2017</date>
25116</refentryinfo>
25117<refmeta>
25118 <refentrytitle><phrase>dma_buf_kmap</phrase></refentrytitle>
25119 <manvolnum>9</manvolnum>
25120 <refmiscinfo class="version">4.4.14</refmiscinfo>
25121</refmeta>
25122<refnamediv>
25123 <refname>dma_buf_kmap</refname>
25124 <refpurpose>
25125     Map a page of the buffer object into kernel address space. The same restrictions as for kmap and friends apply.
25126 </refpurpose>
25127</refnamediv>
25128<refsynopsisdiv>
25129 <title>Synopsis</title>
25130  <funcsynopsis><funcprototype>
25131   <funcdef>void * <function>dma_buf_kmap </function></funcdef>
25132   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
25133   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
25134  </funcprototype></funcsynopsis>
25135</refsynopsisdiv>
25136<refsect1>
25137 <title>Arguments</title>
25138 <variablelist>
25139  <varlistentry>
25140   <term><parameter>dmabuf</parameter></term>
25141   <listitem>
25142    <para>
25143     [in]	buffer to map page from.
25144    </para>
25145   </listitem>
25146  </varlistentry>
25147  <varlistentry>
25148   <term><parameter>page_num</parameter></term>
25149   <listitem>
25150    <para>
25151     [in]	page in PAGE_SIZE units to map.
25152    </para>
25153   </listitem>
25154  </varlistentry>
25155 </variablelist>
25156</refsect1>
25157<refsect1>
25158<title>Description</title>
25159<para>
25160   This call must always succeed, any necessary preparations that might fail
25161   need to be done in begin_cpu_access.
25162</para>
25163</refsect1>
25164</refentry>
25165
25166<refentry id="API-dma-buf-kunmap">
25167<refentryinfo>
25168 <title>LINUX</title>
25169 <productname>Kernel Hackers Manual</productname>
25170 <date>July 2017</date>
25171</refentryinfo>
25172<refmeta>
25173 <refentrytitle><phrase>dma_buf_kunmap</phrase></refentrytitle>
25174 <manvolnum>9</manvolnum>
25175 <refmiscinfo class="version">4.4.14</refmiscinfo>
25176</refmeta>
25177<refnamediv>
25178 <refname>dma_buf_kunmap</refname>
25179 <refpurpose>
25180     Unmap a page obtained by dma_buf_kmap.
25181 </refpurpose>
25182</refnamediv>
25183<refsynopsisdiv>
25184 <title>Synopsis</title>
25185  <funcsynopsis><funcprototype>
25186   <funcdef>void <function>dma_buf_kunmap </function></funcdef>
25187   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
25188   <paramdef>unsigned long <parameter>page_num</parameter></paramdef>
25189   <paramdef>void * <parameter>vaddr</parameter></paramdef>
25190  </funcprototype></funcsynopsis>
25191</refsynopsisdiv>
25192<refsect1>
25193 <title>Arguments</title>
25194 <variablelist>
25195  <varlistentry>
25196   <term><parameter>dmabuf</parameter></term>
25197   <listitem>
25198    <para>
25199     [in]	buffer to unmap page from.
25200    </para>
25201   </listitem>
25202  </varlistentry>
25203  <varlistentry>
25204   <term><parameter>page_num</parameter></term>
25205   <listitem>
25206    <para>
25207     [in]	page in PAGE_SIZE units to unmap.
25208    </para>
25209   </listitem>
25210  </varlistentry>
25211  <varlistentry>
25212   <term><parameter>vaddr</parameter></term>
25213   <listitem>
25214    <para>
25215     [in]	kernel space pointer obtained from dma_buf_kmap.
25216    </para>
25217   </listitem>
25218  </varlistentry>
25219 </variablelist>
25220</refsect1>
25221<refsect1>
25222<title>Description</title>
25223<para>
25224   This call must always succeed.
25225</para>
25226</refsect1>
25227</refentry>
25228
25229<refentry id="API-dma-buf-mmap">
25230<refentryinfo>
25231 <title>LINUX</title>
25232 <productname>Kernel Hackers Manual</productname>
25233 <date>July 2017</date>
25234</refentryinfo>
25235<refmeta>
25236 <refentrytitle><phrase>dma_buf_mmap</phrase></refentrytitle>
25237 <manvolnum>9</manvolnum>
25238 <refmiscinfo class="version">4.4.14</refmiscinfo>
25239</refmeta>
25240<refnamediv>
25241 <refname>dma_buf_mmap</refname>
25242 <refpurpose>
25243     Setup up a userspace mmap with the given vma
25244 </refpurpose>
25245</refnamediv>
25246<refsynopsisdiv>
25247 <title>Synopsis</title>
25248  <funcsynopsis><funcprototype>
25249   <funcdef>int <function>dma_buf_mmap </function></funcdef>
25250   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
25251   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
25252   <paramdef>unsigned long <parameter>pgoff</parameter></paramdef>
25253  </funcprototype></funcsynopsis>
25254</refsynopsisdiv>
25255<refsect1>
25256 <title>Arguments</title>
25257 <variablelist>
25258  <varlistentry>
25259   <term><parameter>dmabuf</parameter></term>
25260   <listitem>
25261    <para>
25262     [in]	buffer that should back the vma
25263    </para>
25264   </listitem>
25265  </varlistentry>
25266  <varlistentry>
25267   <term><parameter>vma</parameter></term>
25268   <listitem>
25269    <para>
25270     [in]	vma for the mmap
25271    </para>
25272   </listitem>
25273  </varlistentry>
25274  <varlistentry>
25275   <term><parameter>pgoff</parameter></term>
25276   <listitem>
25277    <para>
25278     [in]	offset in pages where this mmap should start within the
25279     dma-buf buffer.
25280    </para>
25281   </listitem>
25282  </varlistentry>
25283 </variablelist>
25284</refsect1>
25285<refsect1>
25286<title>Description</title>
25287<para>
25288   This function adjusts the passed in vma so that it points at the file of the
25289   dma_buf operation. It also adjusts the starting pgoff and does bounds
25290   checking on the size of the vma. Then it calls the exporters mmap function to
25291   set up the mapping.
25292   </para><para>
25293
25294   Can return negative error values, returns 0 on success.
25295</para>
25296</refsect1>
25297</refentry>
25298
25299<refentry id="API-dma-buf-vmap">
25300<refentryinfo>
25301 <title>LINUX</title>
25302 <productname>Kernel Hackers Manual</productname>
25303 <date>July 2017</date>
25304</refentryinfo>
25305<refmeta>
25306 <refentrytitle><phrase>dma_buf_vmap</phrase></refentrytitle>
25307 <manvolnum>9</manvolnum>
25308 <refmiscinfo class="version">4.4.14</refmiscinfo>
25309</refmeta>
25310<refnamediv>
25311 <refname>dma_buf_vmap</refname>
25312 <refpurpose>
25313     Create virtual mapping for the buffer object into kernel address space. Same restrictions as for vmap and friends apply.
25314 </refpurpose>
25315</refnamediv>
25316<refsynopsisdiv>
25317 <title>Synopsis</title>
25318  <funcsynopsis><funcprototype>
25319   <funcdef>void * <function>dma_buf_vmap </function></funcdef>
25320   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
25321  </funcprototype></funcsynopsis>
25322</refsynopsisdiv>
25323<refsect1>
25324 <title>Arguments</title>
25325 <variablelist>
25326  <varlistentry>
25327   <term><parameter>dmabuf</parameter></term>
25328   <listitem>
25329    <para>
25330     [in]	buffer to vmap
25331    </para>
25332   </listitem>
25333  </varlistentry>
25334 </variablelist>
25335</refsect1>
25336<refsect1>
25337<title>Description</title>
25338<para>
25339   This call may fail due to lack of virtual mapping address space.
25340   These calls are optional in drivers. The intended use for them
25341   is for mapping objects linear in kernel space for high use objects.
25342   Please attempt to use kmap/kunmap before thinking about these interfaces.
25343   </para><para>
25344
25345   Returns NULL on error.
25346</para>
25347</refsect1>
25348</refentry>
25349
25350<refentry id="API-dma-buf-vunmap">
25351<refentryinfo>
25352 <title>LINUX</title>
25353 <productname>Kernel Hackers Manual</productname>
25354 <date>July 2017</date>
25355</refentryinfo>
25356<refmeta>
25357 <refentrytitle><phrase>dma_buf_vunmap</phrase></refentrytitle>
25358 <manvolnum>9</manvolnum>
25359 <refmiscinfo class="version">4.4.14</refmiscinfo>
25360</refmeta>
25361<refnamediv>
25362 <refname>dma_buf_vunmap</refname>
25363 <refpurpose>
25364     Unmap a vmap obtained by dma_buf_vmap.
25365 </refpurpose>
25366</refnamediv>
25367<refsynopsisdiv>
25368 <title>Synopsis</title>
25369  <funcsynopsis><funcprototype>
25370   <funcdef>void <function>dma_buf_vunmap </function></funcdef>
25371   <paramdef>struct dma_buf * <parameter>dmabuf</parameter></paramdef>
25372   <paramdef>void * <parameter>vaddr</parameter></paramdef>
25373  </funcprototype></funcsynopsis>
25374</refsynopsisdiv>
25375<refsect1>
25376 <title>Arguments</title>
25377 <variablelist>
25378  <varlistentry>
25379   <term><parameter>dmabuf</parameter></term>
25380   <listitem>
25381    <para>
25382     [in]	buffer to vunmap
25383    </para>
25384   </listitem>
25385  </varlistentry>
25386  <varlistentry>
25387   <term><parameter>vaddr</parameter></term>
25388   <listitem>
25389    <para>
25390     [in]	vmap to vunmap
25391    </para>
25392   </listitem>
25393  </varlistentry>
25394 </variablelist>
25395</refsect1>
25396</refentry>
25397
25398<!-- drivers/dma-buf/fence.c -->
25399<refentry id="API-fence-context-alloc">
25400<refentryinfo>
25401 <title>LINUX</title>
25402 <productname>Kernel Hackers Manual</productname>
25403 <date>July 2017</date>
25404</refentryinfo>
25405<refmeta>
25406 <refentrytitle><phrase>fence_context_alloc</phrase></refentrytitle>
25407 <manvolnum>9</manvolnum>
25408 <refmiscinfo class="version">4.4.14</refmiscinfo>
25409</refmeta>
25410<refnamediv>
25411 <refname>fence_context_alloc</refname>
25412 <refpurpose>
25413  allocate an array of fence contexts
25414 </refpurpose>
25415</refnamediv>
25416<refsynopsisdiv>
25417 <title>Synopsis</title>
25418  <funcsynopsis><funcprototype>
25419   <funcdef>unsigned <function>fence_context_alloc </function></funcdef>
25420   <paramdef>unsigned <parameter>num</parameter></paramdef>
25421  </funcprototype></funcsynopsis>
25422</refsynopsisdiv>
25423<refsect1>
25424 <title>Arguments</title>
25425 <variablelist>
25426  <varlistentry>
25427   <term><parameter>num</parameter></term>
25428   <listitem>
25429    <para>
25430     [in]	amount of contexts to allocate
25431    </para>
25432   </listitem>
25433  </varlistentry>
25434 </variablelist>
25435</refsect1>
25436<refsect1>
25437<title>Description</title>
25438<para>
25439   This function will return the first index of the number of fences allocated.
25440   The fence context is used for setting fence-&gt;context to a unique number.
25441</para>
25442</refsect1>
25443</refentry>
25444
25445<refentry id="API-fence-signal-locked">
25446<refentryinfo>
25447 <title>LINUX</title>
25448 <productname>Kernel Hackers Manual</productname>
25449 <date>July 2017</date>
25450</refentryinfo>
25451<refmeta>
25452 <refentrytitle><phrase>fence_signal_locked</phrase></refentrytitle>
25453 <manvolnum>9</manvolnum>
25454 <refmiscinfo class="version">4.4.14</refmiscinfo>
25455</refmeta>
25456<refnamediv>
25457 <refname>fence_signal_locked</refname>
25458 <refpurpose>
25459     signal completion of a fence
25460 </refpurpose>
25461</refnamediv>
25462<refsynopsisdiv>
25463 <title>Synopsis</title>
25464  <funcsynopsis><funcprototype>
25465   <funcdef>int <function>fence_signal_locked </function></funcdef>
25466   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25467  </funcprototype></funcsynopsis>
25468</refsynopsisdiv>
25469<refsect1>
25470 <title>Arguments</title>
25471 <variablelist>
25472  <varlistentry>
25473   <term><parameter>fence</parameter></term>
25474   <listitem>
25475    <para>
25476     the fence to signal
25477    </para>
25478   </listitem>
25479  </varlistentry>
25480 </variablelist>
25481</refsect1>
25482<refsect1>
25483<title>Description</title>
25484<para>
25485   Signal completion for software callbacks on a fence, this will unblock
25486   <function><link linkend="API-fence-wait">fence_wait</link></function> calls and run all the callbacks added with
25487   <function><link linkend="API-fence-add-callback">fence_add_callback</link></function>. Can be called multiple times, but since a fence
25488   can only go from unsignaled to signaled state, it will only be effective
25489   the first time.
25490   </para><para>
25491
25492   Unlike fence_signal, this function must be called with fence-&gt;lock held.
25493</para>
25494</refsect1>
25495</refentry>
25496
25497<refentry id="API-fence-signal">
25498<refentryinfo>
25499 <title>LINUX</title>
25500 <productname>Kernel Hackers Manual</productname>
25501 <date>July 2017</date>
25502</refentryinfo>
25503<refmeta>
25504 <refentrytitle><phrase>fence_signal</phrase></refentrytitle>
25505 <manvolnum>9</manvolnum>
25506 <refmiscinfo class="version">4.4.14</refmiscinfo>
25507</refmeta>
25508<refnamediv>
25509 <refname>fence_signal</refname>
25510 <refpurpose>
25511     signal completion of a fence
25512 </refpurpose>
25513</refnamediv>
25514<refsynopsisdiv>
25515 <title>Synopsis</title>
25516  <funcsynopsis><funcprototype>
25517   <funcdef>int <function>fence_signal </function></funcdef>
25518   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25519  </funcprototype></funcsynopsis>
25520</refsynopsisdiv>
25521<refsect1>
25522 <title>Arguments</title>
25523 <variablelist>
25524  <varlistentry>
25525   <term><parameter>fence</parameter></term>
25526   <listitem>
25527    <para>
25528     the fence to signal
25529    </para>
25530   </listitem>
25531  </varlistentry>
25532 </variablelist>
25533</refsect1>
25534<refsect1>
25535<title>Description</title>
25536<para>
25537   Signal completion for software callbacks on a fence, this will unblock
25538   <function><link linkend="API-fence-wait">fence_wait</link></function> calls and run all the callbacks added with
25539   <function><link linkend="API-fence-add-callback">fence_add_callback</link></function>. Can be called multiple times, but since a fence
25540   can only go from unsignaled to signaled state, it will only be effective
25541   the first time.
25542</para>
25543</refsect1>
25544</refentry>
25545
25546<refentry id="API-fence-wait-timeout">
25547<refentryinfo>
25548 <title>LINUX</title>
25549 <productname>Kernel Hackers Manual</productname>
25550 <date>July 2017</date>
25551</refentryinfo>
25552<refmeta>
25553 <refentrytitle><phrase>fence_wait_timeout</phrase></refentrytitle>
25554 <manvolnum>9</manvolnum>
25555 <refmiscinfo class="version">4.4.14</refmiscinfo>
25556</refmeta>
25557<refnamediv>
25558 <refname>fence_wait_timeout</refname>
25559 <refpurpose>
25560     sleep until the fence gets signaled or until timeout elapses
25561 </refpurpose>
25562</refnamediv>
25563<refsynopsisdiv>
25564 <title>Synopsis</title>
25565  <funcsynopsis><funcprototype>
25566   <funcdef>signed long <function>fence_wait_timeout </function></funcdef>
25567   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25568   <paramdef>bool <parameter>intr</parameter></paramdef>
25569   <paramdef>signed long <parameter>timeout</parameter></paramdef>
25570  </funcprototype></funcsynopsis>
25571</refsynopsisdiv>
25572<refsect1>
25573 <title>Arguments</title>
25574 <variablelist>
25575  <varlistentry>
25576   <term><parameter>fence</parameter></term>
25577   <listitem>
25578    <para>
25579     [in]	the fence to wait on
25580    </para>
25581   </listitem>
25582  </varlistentry>
25583  <varlistentry>
25584   <term><parameter>intr</parameter></term>
25585   <listitem>
25586    <para>
25587     [in]	if true, do an interruptible wait
25588    </para>
25589   </listitem>
25590  </varlistentry>
25591  <varlistentry>
25592   <term><parameter>timeout</parameter></term>
25593   <listitem>
25594    <para>
25595     [in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
25596    </para>
25597   </listitem>
25598  </varlistentry>
25599 </variablelist>
25600</refsect1>
25601<refsect1>
25602<title>Description</title>
25603<para>
25604   Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
25605   remaining timeout in jiffies on success. Other error values may be
25606   returned on custom implementations.
25607   </para><para>
25608
25609   Performs a synchronous wait on this fence. It is assumed the caller
25610   directly or indirectly (buf-mgr between reservation and committing)
25611   holds a reference to the fence, otherwise the fence might be
25612   freed before return, resulting in undefined behavior.
25613</para>
25614</refsect1>
25615</refentry>
25616
25617<refentry id="API-fence-enable-sw-signaling">
25618<refentryinfo>
25619 <title>LINUX</title>
25620 <productname>Kernel Hackers Manual</productname>
25621 <date>July 2017</date>
25622</refentryinfo>
25623<refmeta>
25624 <refentrytitle><phrase>fence_enable_sw_signaling</phrase></refentrytitle>
25625 <manvolnum>9</manvolnum>
25626 <refmiscinfo class="version">4.4.14</refmiscinfo>
25627</refmeta>
25628<refnamediv>
25629 <refname>fence_enable_sw_signaling</refname>
25630 <refpurpose>
25631     enable signaling on fence
25632 </refpurpose>
25633</refnamediv>
25634<refsynopsisdiv>
25635 <title>Synopsis</title>
25636  <funcsynopsis><funcprototype>
25637   <funcdef>void <function>fence_enable_sw_signaling </function></funcdef>
25638   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25639  </funcprototype></funcsynopsis>
25640</refsynopsisdiv>
25641<refsect1>
25642 <title>Arguments</title>
25643 <variablelist>
25644  <varlistentry>
25645   <term><parameter>fence</parameter></term>
25646   <listitem>
25647    <para>
25648     [in]	the fence to enable
25649    </para>
25650   </listitem>
25651  </varlistentry>
25652 </variablelist>
25653</refsect1>
25654<refsect1>
25655<title>Description</title>
25656<para>
25657   this will request for sw signaling to be enabled, to make the fence
25658   complete as soon as possible
25659</para>
25660</refsect1>
25661</refentry>
25662
25663<refentry id="API-fence-add-callback">
25664<refentryinfo>
25665 <title>LINUX</title>
25666 <productname>Kernel Hackers Manual</productname>
25667 <date>July 2017</date>
25668</refentryinfo>
25669<refmeta>
25670 <refentrytitle><phrase>fence_add_callback</phrase></refentrytitle>
25671 <manvolnum>9</manvolnum>
25672 <refmiscinfo class="version">4.4.14</refmiscinfo>
25673</refmeta>
25674<refnamediv>
25675 <refname>fence_add_callback</refname>
25676 <refpurpose>
25677     add a callback to be called when the fence is signaled
25678 </refpurpose>
25679</refnamediv>
25680<refsynopsisdiv>
25681 <title>Synopsis</title>
25682  <funcsynopsis><funcprototype>
25683   <funcdef>int <function>fence_add_callback </function></funcdef>
25684   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25685   <paramdef><link linkend="API-struct-fence-cb">struct fence_cb</link> * <parameter>cb</parameter></paramdef>
25686   <paramdef>fence_func_t <parameter>func</parameter></paramdef>
25687  </funcprototype></funcsynopsis>
25688</refsynopsisdiv>
25689<refsect1>
25690 <title>Arguments</title>
25691 <variablelist>
25692  <varlistentry>
25693   <term><parameter>fence</parameter></term>
25694   <listitem>
25695    <para>
25696     [in]	the fence to wait on
25697    </para>
25698   </listitem>
25699  </varlistentry>
25700  <varlistentry>
25701   <term><parameter>cb</parameter></term>
25702   <listitem>
25703    <para>
25704     [in]	the callback to register
25705    </para>
25706   </listitem>
25707  </varlistentry>
25708  <varlistentry>
25709   <term><parameter>func</parameter></term>
25710   <listitem>
25711    <para>
25712     [in]	the function to call
25713    </para>
25714   </listitem>
25715  </varlistentry>
25716 </variablelist>
25717</refsect1>
25718<refsect1>
25719<title>Description</title>
25720<para>
25721   cb will be initialized by fence_add_callback, no initialization
25722   by the caller is required. Any number of callbacks can be registered
25723   to a fence, but a callback can only be registered to one fence at a time.
25724   </para><para>
25725
25726   Note that the callback can be called from an atomic context.  If
25727   fence is already signaled, this function will return -ENOENT (and
25728   *not* call the callback)
25729   </para><para>
25730
25731   Add a software callback to the fence. Same restrictions apply to
25732   refcount as it does to fence_wait, however the caller doesn't need to
25733</para>
25734</refsect1>
25735<refsect1>
25736<title>keep a refcount to fence afterwards</title>
25737<para>
25738   when software access is enabled,
25739   the creator of the fence is required to keep the fence alive until
25740   after it signals with fence_signal. The callback itself can be called
25741   from irq context.
25742</para>
25743</refsect1>
25744</refentry>
25745
25746<refentry id="API-fence-remove-callback">
25747<refentryinfo>
25748 <title>LINUX</title>
25749 <productname>Kernel Hackers Manual</productname>
25750 <date>July 2017</date>
25751</refentryinfo>
25752<refmeta>
25753 <refentrytitle><phrase>fence_remove_callback</phrase></refentrytitle>
25754 <manvolnum>9</manvolnum>
25755 <refmiscinfo class="version">4.4.14</refmiscinfo>
25756</refmeta>
25757<refnamediv>
25758 <refname>fence_remove_callback</refname>
25759 <refpurpose>
25760     remove a callback from the signaling list
25761 </refpurpose>
25762</refnamediv>
25763<refsynopsisdiv>
25764 <title>Synopsis</title>
25765  <funcsynopsis><funcprototype>
25766   <funcdef>bool <function>fence_remove_callback </function></funcdef>
25767   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25768   <paramdef><link linkend="API-struct-fence-cb">struct fence_cb</link> * <parameter>cb</parameter></paramdef>
25769  </funcprototype></funcsynopsis>
25770</refsynopsisdiv>
25771<refsect1>
25772 <title>Arguments</title>
25773 <variablelist>
25774  <varlistentry>
25775   <term><parameter>fence</parameter></term>
25776   <listitem>
25777    <para>
25778     [in]	the fence to wait on
25779    </para>
25780   </listitem>
25781  </varlistentry>
25782  <varlistentry>
25783   <term><parameter>cb</parameter></term>
25784   <listitem>
25785    <para>
25786     [in]	the callback to remove
25787    </para>
25788   </listitem>
25789  </varlistentry>
25790 </variablelist>
25791</refsect1>
25792<refsect1>
25793<title>Description</title>
25794<para>
25795   Remove a previously queued callback from the fence. This function returns
25796   true if the callback is successfully removed, or false if the fence has
25797   already been signaled.
25798   </para><para>
25799
25800   *WARNING*:
25801   Cancelling a callback should only be done if you really know what you're
25802   doing, since deadlocks and race conditions could occur all too easily. For
25803   this reason, it should only ever be done on hardware lockup recovery,
25804   with a reference held to the fence.
25805</para>
25806</refsect1>
25807</refentry>
25808
25809<refentry id="API-fence-default-wait">
25810<refentryinfo>
25811 <title>LINUX</title>
25812 <productname>Kernel Hackers Manual</productname>
25813 <date>July 2017</date>
25814</refentryinfo>
25815<refmeta>
25816 <refentrytitle><phrase>fence_default_wait</phrase></refentrytitle>
25817 <manvolnum>9</manvolnum>
25818 <refmiscinfo class="version">4.4.14</refmiscinfo>
25819</refmeta>
25820<refnamediv>
25821 <refname>fence_default_wait</refname>
25822 <refpurpose>
25823     default sleep until the fence gets signaled or until timeout elapses
25824 </refpurpose>
25825</refnamediv>
25826<refsynopsisdiv>
25827 <title>Synopsis</title>
25828  <funcsynopsis><funcprototype>
25829   <funcdef>signed long <function>fence_default_wait </function></funcdef>
25830   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25831   <paramdef>bool <parameter>intr</parameter></paramdef>
25832   <paramdef>signed long <parameter>timeout</parameter></paramdef>
25833  </funcprototype></funcsynopsis>
25834</refsynopsisdiv>
25835<refsect1>
25836 <title>Arguments</title>
25837 <variablelist>
25838  <varlistentry>
25839   <term><parameter>fence</parameter></term>
25840   <listitem>
25841    <para>
25842     [in]	the fence to wait on
25843    </para>
25844   </listitem>
25845  </varlistentry>
25846  <varlistentry>
25847   <term><parameter>intr</parameter></term>
25848   <listitem>
25849    <para>
25850     [in]	if true, do an interruptible wait
25851    </para>
25852   </listitem>
25853  </varlistentry>
25854  <varlistentry>
25855   <term><parameter>timeout</parameter></term>
25856   <listitem>
25857    <para>
25858     [in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
25859    </para>
25860   </listitem>
25861  </varlistentry>
25862 </variablelist>
25863</refsect1>
25864<refsect1>
25865<title>Description</title>
25866<para>
25867   Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
25868   remaining timeout in jiffies on success.
25869</para>
25870</refsect1>
25871</refentry>
25872
25873<refentry id="API-fence-wait-any-timeout">
25874<refentryinfo>
25875 <title>LINUX</title>
25876 <productname>Kernel Hackers Manual</productname>
25877 <date>July 2017</date>
25878</refentryinfo>
25879<refmeta>
25880 <refentrytitle><phrase>fence_wait_any_timeout</phrase></refentrytitle>
25881 <manvolnum>9</manvolnum>
25882 <refmiscinfo class="version">4.4.14</refmiscinfo>
25883</refmeta>
25884<refnamediv>
25885 <refname>fence_wait_any_timeout</refname>
25886 <refpurpose>
25887     sleep until any fence gets signaled or until timeout elapses
25888 </refpurpose>
25889</refnamediv>
25890<refsynopsisdiv>
25891 <title>Synopsis</title>
25892  <funcsynopsis><funcprototype>
25893   <funcdef>signed long <function>fence_wait_any_timeout </function></funcdef>
25894   <paramdef>struct fence ** <parameter>fences</parameter></paramdef>
25895   <paramdef>uint32_t <parameter>count</parameter></paramdef>
25896   <paramdef>bool <parameter>intr</parameter></paramdef>
25897   <paramdef>signed long <parameter>timeout</parameter></paramdef>
25898  </funcprototype></funcsynopsis>
25899</refsynopsisdiv>
25900<refsect1>
25901 <title>Arguments</title>
25902 <variablelist>
25903  <varlistentry>
25904   <term><parameter>fences</parameter></term>
25905   <listitem>
25906    <para>
25907     [in]	array of fences to wait on
25908    </para>
25909   </listitem>
25910  </varlistentry>
25911  <varlistentry>
25912   <term><parameter>count</parameter></term>
25913   <listitem>
25914    <para>
25915     [in]	number of fences to wait on
25916    </para>
25917   </listitem>
25918  </varlistentry>
25919  <varlistentry>
25920   <term><parameter>intr</parameter></term>
25921   <listitem>
25922    <para>
25923     [in]	if true, do an interruptible wait
25924    </para>
25925   </listitem>
25926  </varlistentry>
25927  <varlistentry>
25928   <term><parameter>timeout</parameter></term>
25929   <listitem>
25930    <para>
25931     [in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
25932    </para>
25933   </listitem>
25934  </varlistentry>
25935 </variablelist>
25936</refsect1>
25937<refsect1>
25938<title>Description</title>
25939<para>
25940   Returns -EINVAL on custom fence wait implementation, -ERESTARTSYS if
25941   interrupted, 0 if the wait timed out, or the remaining timeout in jiffies
25942   on success.
25943   </para><para>
25944
25945   Synchronous waits for the first fence in the array to be signaled. The
25946   caller needs to hold a reference to all fences in the array, otherwise a
25947   fence might be freed before return, resulting in undefined behavior.
25948</para>
25949</refsect1>
25950</refentry>
25951
25952<refentry id="API-fence-init">
25953<refentryinfo>
25954 <title>LINUX</title>
25955 <productname>Kernel Hackers Manual</productname>
25956 <date>July 2017</date>
25957</refentryinfo>
25958<refmeta>
25959 <refentrytitle><phrase>fence_init</phrase></refentrytitle>
25960 <manvolnum>9</manvolnum>
25961 <refmiscinfo class="version">4.4.14</refmiscinfo>
25962</refmeta>
25963<refnamediv>
25964 <refname>fence_init</refname>
25965 <refpurpose>
25966     Initialize a custom fence.
25967 </refpurpose>
25968</refnamediv>
25969<refsynopsisdiv>
25970 <title>Synopsis</title>
25971  <funcsynopsis><funcprototype>
25972   <funcdef>void <function>fence_init </function></funcdef>
25973   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
25974   <paramdef><link linkend="API-struct-fence-ops">const struct fence_ops</link> * <parameter>ops</parameter></paramdef>
25975   <paramdef>spinlock_t * <parameter>lock</parameter></paramdef>
25976   <paramdef>unsigned <parameter>context</parameter></paramdef>
25977   <paramdef>unsigned <parameter>seqno</parameter></paramdef>
25978  </funcprototype></funcsynopsis>
25979</refsynopsisdiv>
25980<refsect1>
25981 <title>Arguments</title>
25982 <variablelist>
25983  <varlistentry>
25984   <term><parameter>fence</parameter></term>
25985   <listitem>
25986    <para>
25987     [in]	the fence to initialize
25988    </para>
25989   </listitem>
25990  </varlistentry>
25991  <varlistentry>
25992   <term><parameter>ops</parameter></term>
25993   <listitem>
25994    <para>
25995     [in]	the fence_ops for operations on this fence
25996    </para>
25997   </listitem>
25998  </varlistentry>
25999  <varlistentry>
26000   <term><parameter>lock</parameter></term>
26001   <listitem>
26002    <para>
26003     [in]	the irqsafe spinlock to use for locking this fence
26004    </para>
26005   </listitem>
26006  </varlistentry>
26007  <varlistentry>
26008   <term><parameter>context</parameter></term>
26009   <listitem>
26010    <para>
26011     [in]	the execution context this fence is run on
26012    </para>
26013   </listitem>
26014  </varlistentry>
26015  <varlistentry>
26016   <term><parameter>seqno</parameter></term>
26017   <listitem>
26018    <para>
26019     [in]	a linear increasing sequence number for this context
26020    </para>
26021   </listitem>
26022  </varlistentry>
26023 </variablelist>
26024</refsect1>
26025<refsect1>
26026<title>Description</title>
26027<para>
26028   Initializes an allocated fence, the caller doesn't have to keep its
26029   refcount after committing with this fence, but it will need to hold a
26030   refcount again if fence_ops.enable_signaling gets called. This can
26031   be used for other implementing other types of fence.
26032   </para><para>
26033
26034   context and seqno are used for easy comparison between fences, allowing
26035   to check which fence is later by simply using fence_later.
26036</para>
26037</refsect1>
26038</refentry>
26039
26040<!-- drivers/dma-buf/seqno-fence.c -->
26041<refentry>
26042 <refnamediv>
26043  <refname>
26044   drivers/dma-buf/seqno-fence.c
26045  </refname>
26046  <refpurpose>
26047   Document generation inconsistency
26048  </refpurpose>
26049 </refnamediv>
26050 <refsect1>
26051  <title>
26052   Oops
26053  </title>
26054  <warning>
26055   <para>
26056    The template for this document tried to insert
26057    the structured comment from the file
26058    <filename>drivers/dma-buf/seqno-fence.c</filename> at this point,
26059    but none was found.
26060    This dummy section is inserted to allow
26061    generation to continue.
26062   </para>
26063  </warning>
26064 </refsect1>
26065</refentry>
26066<!-- include/linux/fence.h -->
26067<refentry id="API-struct-fence">
26068<refentryinfo>
26069 <title>LINUX</title>
26070 <productname>Kernel Hackers Manual</productname>
26071 <date>July 2017</date>
26072</refentryinfo>
26073<refmeta>
26074 <refentrytitle><phrase>struct fence</phrase></refentrytitle>
26075 <manvolnum>9</manvolnum>
26076 <refmiscinfo class="version">4.4.14</refmiscinfo>
26077</refmeta>
26078<refnamediv>
26079 <refname>struct fence</refname>
26080 <refpurpose>
26081  software synchronization primitive
26082 </refpurpose>
26083</refnamediv>
26084<refsynopsisdiv>
26085 <title>Synopsis</title>
26086  <programlisting>
26087struct fence {
26088  struct kref refcount;
26089  const struct fence_ops * ops;
26090  struct rcu_head rcu;
26091  struct list_head cb_list;
26092  spinlock_t * lock;
26093  unsigned context;
26094  unsigned seqno;
26095  unsigned long flags;
26096  ktime_t timestamp;
26097  int status;
26098};  </programlisting>
26099</refsynopsisdiv>
26100 <refsect1>
26101  <title>Members</title>
26102  <variablelist>
26103    <varlistentry>      <term>refcount</term>
26104      <listitem><para>
26105refcount for this fence
26106      </para></listitem>
26107    </varlistentry>
26108    <varlistentry>      <term>ops</term>
26109      <listitem><para>
26110fence_ops associated with this fence
26111      </para></listitem>
26112    </varlistentry>
26113    <varlistentry>      <term>rcu</term>
26114      <listitem><para>
26115used for releasing fence with kfree_rcu
26116      </para></listitem>
26117    </varlistentry>
26118    <varlistentry>      <term>cb_list</term>
26119      <listitem><para>
26120list of all callbacks to call
26121      </para></listitem>
26122    </varlistentry>
26123    <varlistentry>      <term>lock</term>
26124      <listitem><para>
26125spin_lock_irqsave used for locking
26126      </para></listitem>
26127    </varlistentry>
26128    <varlistentry>      <term>context</term>
26129      <listitem><para>
26130execution context this fence belongs to, returned by
26131<function><link linkend="API-fence-context-alloc">fence_context_alloc</link></function>
26132      </para></listitem>
26133    </varlistentry>
26134    <varlistentry>      <term>seqno</term>
26135      <listitem><para>
26136the sequence number of this fence inside the execution context,
26137can be compared to decide which fence would be signaled later.
26138      </para></listitem>
26139    </varlistentry>
26140    <varlistentry>      <term>flags</term>
26141      <listitem><para>
26142A mask of FENCE_FLAG_* defined below
26143      </para></listitem>
26144    </varlistentry>
26145    <varlistentry>      <term>timestamp</term>
26146      <listitem><para>
26147Timestamp when the fence was signaled.
26148      </para></listitem>
26149    </varlistentry>
26150    <varlistentry>      <term>status</term>
26151      <listitem><para>
26152Optional, only valid if &lt; 0, must be set before calling
26153fence_signal, indicates that the fence has completed with an error.
26154      </para></listitem>
26155    </varlistentry>
26156  </variablelist>
26157 </refsect1>
26158<refsect1>
26159<title>Description</title>
26160<para>
26161   the flags member must be manipulated and read using the appropriate
26162   atomic ops (bit_*), so taking the spinlock will not be needed most
26163   of the time.
26164   </para><para>
26165
26166   FENCE_FLAG_SIGNALED_BIT - fence is already signaled
26167   FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called*
26168   FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the
26169   implementer of the fence for its own purposes. Can be used in different
26170   ways by different fence implementers, so do not rely on this.
26171   </para><para>
26172
26173   *) Since atomic bitops are used, this is not guaranteed to be the case.
26174   Particularly, if the bit was set, but fence_signal was called right
26175   before this bit was set, it would have been able to set the
26176   FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called.
26177   Adding a check for FENCE_FLAG_SIGNALED_BIT after setting
26178   FENCE_FLAG_ENABLE_SIGNAL_BIT closes this race, and makes sure that
26179   after fence_signal was called, any enable_signaling call will have either
26180   been completed, or never called at all.
26181</para>
26182</refsect1>
26183</refentry>
26184
26185<refentry id="API-struct-fence-cb">
26186<refentryinfo>
26187 <title>LINUX</title>
26188 <productname>Kernel Hackers Manual</productname>
26189 <date>July 2017</date>
26190</refentryinfo>
26191<refmeta>
26192 <refentrytitle><phrase>struct fence_cb</phrase></refentrytitle>
26193 <manvolnum>9</manvolnum>
26194 <refmiscinfo class="version">4.4.14</refmiscinfo>
26195</refmeta>
26196<refnamediv>
26197 <refname>struct fence_cb</refname>
26198 <refpurpose>
26199     callback for fence_add_callback
26200 </refpurpose>
26201</refnamediv>
26202<refsynopsisdiv>
26203 <title>Synopsis</title>
26204  <programlisting>
26205struct fence_cb {
26206  struct list_head node;
26207  fence_func_t func;
26208};  </programlisting>
26209</refsynopsisdiv>
26210 <refsect1>
26211  <title>Members</title>
26212  <variablelist>
26213    <varlistentry>      <term>node</term>
26214      <listitem><para>
26215   used by fence_add_callback to append this struct to fence::cb_list
26216      </para></listitem>
26217    </varlistentry>
26218    <varlistentry>      <term>func</term>
26219      <listitem><para>
26220   fence_func_t to call
26221      </para></listitem>
26222    </varlistentry>
26223  </variablelist>
26224 </refsect1>
26225<refsect1>
26226<title>Description</title>
26227<para>
26228   This struct will be initialized by fence_add_callback, additional
26229   data can be passed along by embedding fence_cb in another struct.
26230</para>
26231</refsect1>
26232</refentry>
26233
26234<refentry id="API-struct-fence-ops">
26235<refentryinfo>
26236 <title>LINUX</title>
26237 <productname>Kernel Hackers Manual</productname>
26238 <date>July 2017</date>
26239</refentryinfo>
26240<refmeta>
26241 <refentrytitle><phrase>struct fence_ops</phrase></refentrytitle>
26242 <manvolnum>9</manvolnum>
26243 <refmiscinfo class="version">4.4.14</refmiscinfo>
26244</refmeta>
26245<refnamediv>
26246 <refname>struct fence_ops</refname>
26247 <refpurpose>
26248     operations implemented for fence
26249 </refpurpose>
26250</refnamediv>
26251<refsynopsisdiv>
26252 <title>Synopsis</title>
26253  <programlisting>
26254struct fence_ops {
26255  const char * (* get_driver_name) (struct fence *fence);
26256  const char * (* get_timeline_name) (struct fence *fence);
26257  bool (* enable_signaling) (struct fence *fence);
26258  bool (* signaled) (struct fence *fence);
26259  signed long (* wait) (struct fence *fence, bool intr, signed long timeout);
26260  void (* release) (struct fence *fence);
26261  int (* fill_driver_data) (struct fence *fence, void *data, int size);
26262  void (* fence_value_str) (struct fence *fence, char *str, int size);
26263  void (* timeline_value_str) (struct fence *fence, char *str, int size);
26264};  </programlisting>
26265</refsynopsisdiv>
26266 <refsect1>
26267  <title>Members</title>
26268  <variablelist>
26269    <varlistentry>      <term>get_driver_name</term>
26270      <listitem><para>
26271   returns the driver name.
26272      </para></listitem>
26273    </varlistentry>
26274    <varlistentry>      <term>get_timeline_name</term>
26275      <listitem><para>
26276   return the name of the context this fence belongs to.
26277      </para></listitem>
26278    </varlistentry>
26279    <varlistentry>      <term>enable_signaling</term>
26280      <listitem><para>
26281   enable software signaling of fence.
26282      </para></listitem>
26283    </varlistentry>
26284    <varlistentry>      <term>signaled</term>
26285      <listitem><para>
26286   [optional] peek whether the fence is signaled, can be null.
26287      </para></listitem>
26288    </varlistentry>
26289    <varlistentry>      <term>wait</term>
26290      <listitem><para>
26291   custom wait implementation, or fence_default_wait.
26292      </para></listitem>
26293    </varlistentry>
26294    <varlistentry>      <term>release</term>
26295      <listitem><para>
26296   [optional] called on destruction of fence, can be null
26297      </para></listitem>
26298    </varlistentry>
26299    <varlistentry>      <term>fill_driver_data</term>
26300      <listitem><para>
26301   [optional] callback to fill in free-form debug info
26302   Returns amount of bytes filled, or -errno.
26303      </para></listitem>
26304    </varlistentry>
26305    <varlistentry>      <term>fence_value_str</term>
26306      <listitem><para>
26307   [optional] fills in the value of the fence as a string
26308      </para></listitem>
26309    </varlistentry>
26310    <varlistentry>      <term>timeline_value_str</term>
26311      <listitem><para>
26312   [optional] fills in the current value of the timeline
26313   as a string
26314      </para></listitem>
26315    </varlistentry>
26316  </variablelist>
26317 </refsect1>
26318<refsect1>
26319<title>Notes on enable_signaling</title>
26320<para>
26321   For fence implementations that have the capability for hw-&gt;hw
26322   signaling, they can implement this op to enable the necessary
26323   irqs, or insert commands into cmdstream, etc.  This is called
26324   in the first <function>wait</function> or <function>add_callback</function> path to let the fence
26325   implementation know that there is another driver waiting on
26326   the signal (ie. hw-&gt;sw case).
26327   </para><para>
26328
26329   This function can be called called from atomic context, but not
26330   from irq context, so normal spinlocks can be used.
26331   </para><para>
26332
26333   A return value of false indicates the fence already passed,
26334   or some failure occurred that made it impossible to enable
26335   signaling. True indicates successful enabling.
26336   </para><para>
26337
26338   fence-&gt;status may be set in enable_signaling, but only when false is
26339   returned.
26340   </para><para>
26341
26342   Calling fence_signal before enable_signaling is called allows
26343   for a tiny race window in which enable_signaling is called during,
26344   before, or after fence_signal. To fight this, it is recommended
26345   that before enable_signaling returns true an extra reference is
26346   taken on the fence, to be released when the fence is signaled.
26347   This will mean fence_signal will still be called twice, but
26348   the second time will be a noop since it was already signaled.
26349</para>
26350</refsect1>
26351<refsect1>
26352<title>Notes on signaled</title>
26353<para>
26354   May set fence-&gt;status if returning true.
26355</para>
26356</refsect1>
26357<refsect1>
26358<title>Notes on wait</title>
26359<para>
26360   Must not be NULL, set to fence_default_wait for default implementation.
26361   the fence_default_wait implementation should work for any fence, as long
26362   as enable_signaling works correctly.
26363   </para><para>
26364
26365   Must return -ERESTARTSYS if the wait is intr = true and the wait was
26366   interrupted, and remaining jiffies if fence has signaled, or 0 if wait
26367   timed out. Can also return other error values on custom implementations,
26368   which should be treated as if the fence is signaled. For example a hardware
26369   lockup could be reported like that.
26370</para>
26371</refsect1>
26372<refsect1>
26373<title>Notes on release</title>
26374<para>
26375   Can be NULL, this function allows additional commands to run on
26376   destruction of the fence. Can be called from irq context.
26377   If pointer is set to NULL, kfree will get called instead.
26378</para>
26379</refsect1>
26380</refentry>
26381
26382<refentry id="API-fence-get">
26383<refentryinfo>
26384 <title>LINUX</title>
26385 <productname>Kernel Hackers Manual</productname>
26386 <date>July 2017</date>
26387</refentryinfo>
26388<refmeta>
26389 <refentrytitle><phrase>fence_get</phrase></refentrytitle>
26390 <manvolnum>9</manvolnum>
26391 <refmiscinfo class="version">4.4.14</refmiscinfo>
26392</refmeta>
26393<refnamediv>
26394 <refname>fence_get</refname>
26395 <refpurpose>
26396     increases refcount of the fence
26397 </refpurpose>
26398</refnamediv>
26399<refsynopsisdiv>
26400 <title>Synopsis</title>
26401  <funcsynopsis><funcprototype>
26402   <funcdef><link linkend="API-struct-fence">struct fence</link> * <function>fence_get </function></funcdef>
26403   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
26404  </funcprototype></funcsynopsis>
26405</refsynopsisdiv>
26406<refsect1>
26407 <title>Arguments</title>
26408 <variablelist>
26409  <varlistentry>
26410   <term><parameter>fence</parameter></term>
26411   <listitem>
26412    <para>
26413     [in]	fence to increase refcount of
26414    </para>
26415   </listitem>
26416  </varlistentry>
26417 </variablelist>
26418</refsect1>
26419<refsect1>
26420<title>Description</title>
26421<para>
26422   Returns the same fence, with refcount increased by 1.
26423</para>
26424</refsect1>
26425</refentry>
26426
26427<refentry id="API-fence-get-rcu">
26428<refentryinfo>
26429 <title>LINUX</title>
26430 <productname>Kernel Hackers Manual</productname>
26431 <date>July 2017</date>
26432</refentryinfo>
26433<refmeta>
26434 <refentrytitle><phrase>fence_get_rcu</phrase></refentrytitle>
26435 <manvolnum>9</manvolnum>
26436 <refmiscinfo class="version">4.4.14</refmiscinfo>
26437</refmeta>
26438<refnamediv>
26439 <refname>fence_get_rcu</refname>
26440 <refpurpose>
26441     get a fence from a reservation_object_list with rcu read lock
26442 </refpurpose>
26443</refnamediv>
26444<refsynopsisdiv>
26445 <title>Synopsis</title>
26446  <funcsynopsis><funcprototype>
26447   <funcdef><link linkend="API-struct-fence">struct fence</link> * <function>fence_get_rcu </function></funcdef>
26448   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
26449  </funcprototype></funcsynopsis>
26450</refsynopsisdiv>
26451<refsect1>
26452 <title>Arguments</title>
26453 <variablelist>
26454  <varlistentry>
26455   <term><parameter>fence</parameter></term>
26456   <listitem>
26457    <para>
26458     [in]	fence to increase refcount of
26459    </para>
26460   </listitem>
26461  </varlistentry>
26462 </variablelist>
26463</refsect1>
26464<refsect1>
26465<title>Description</title>
26466<para>
26467   Function returns NULL if no refcount could be obtained, or the fence.
26468</para>
26469</refsect1>
26470</refentry>
26471
26472<refentry id="API-fence-put">
26473<refentryinfo>
26474 <title>LINUX</title>
26475 <productname>Kernel Hackers Manual</productname>
26476 <date>July 2017</date>
26477</refentryinfo>
26478<refmeta>
26479 <refentrytitle><phrase>fence_put</phrase></refentrytitle>
26480 <manvolnum>9</manvolnum>
26481 <refmiscinfo class="version">4.4.14</refmiscinfo>
26482</refmeta>
26483<refnamediv>
26484 <refname>fence_put</refname>
26485 <refpurpose>
26486     decreases refcount of the fence
26487 </refpurpose>
26488</refnamediv>
26489<refsynopsisdiv>
26490 <title>Synopsis</title>
26491  <funcsynopsis><funcprototype>
26492   <funcdef>void <function>fence_put </function></funcdef>
26493   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
26494  </funcprototype></funcsynopsis>
26495</refsynopsisdiv>
26496<refsect1>
26497 <title>Arguments</title>
26498 <variablelist>
26499  <varlistentry>
26500   <term><parameter>fence</parameter></term>
26501   <listitem>
26502    <para>
26503     [in]	fence to reduce refcount of
26504    </para>
26505   </listitem>
26506  </varlistentry>
26507 </variablelist>
26508</refsect1>
26509</refentry>
26510
26511<refentry id="API-fence-is-signaled-locked">
26512<refentryinfo>
26513 <title>LINUX</title>
26514 <productname>Kernel Hackers Manual</productname>
26515 <date>July 2017</date>
26516</refentryinfo>
26517<refmeta>
26518 <refentrytitle><phrase>fence_is_signaled_locked</phrase></refentrytitle>
26519 <manvolnum>9</manvolnum>
26520 <refmiscinfo class="version">4.4.14</refmiscinfo>
26521</refmeta>
26522<refnamediv>
26523 <refname>fence_is_signaled_locked</refname>
26524 <refpurpose>
26525     Return an indication if the fence is signaled yet.
26526 </refpurpose>
26527</refnamediv>
26528<refsynopsisdiv>
26529 <title>Synopsis</title>
26530  <funcsynopsis><funcprototype>
26531   <funcdef>bool <function>fence_is_signaled_locked </function></funcdef>
26532   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
26533  </funcprototype></funcsynopsis>
26534</refsynopsisdiv>
26535<refsect1>
26536 <title>Arguments</title>
26537 <variablelist>
26538  <varlistentry>
26539   <term><parameter>fence</parameter></term>
26540   <listitem>
26541    <para>
26542     [in]	the fence to check
26543    </para>
26544   </listitem>
26545  </varlistentry>
26546 </variablelist>
26547</refsect1>
26548<refsect1>
26549<title>Description</title>
26550<para>
26551   Returns true if the fence was already signaled, false if not. Since this
26552   function doesn't enable signaling, it is not guaranteed to ever return
26553   true if fence_add_callback, fence_wait or fence_enable_sw_signaling
26554   haven't been called before.
26555   </para><para>
26556
26557   This function requires fence-&gt;lock to be held.
26558</para>
26559</refsect1>
26560</refentry>
26561
26562<refentry id="API-fence-is-signaled">
26563<refentryinfo>
26564 <title>LINUX</title>
26565 <productname>Kernel Hackers Manual</productname>
26566 <date>July 2017</date>
26567</refentryinfo>
26568<refmeta>
26569 <refentrytitle><phrase>fence_is_signaled</phrase></refentrytitle>
26570 <manvolnum>9</manvolnum>
26571 <refmiscinfo class="version">4.4.14</refmiscinfo>
26572</refmeta>
26573<refnamediv>
26574 <refname>fence_is_signaled</refname>
26575 <refpurpose>
26576     Return an indication if the fence is signaled yet.
26577 </refpurpose>
26578</refnamediv>
26579<refsynopsisdiv>
26580 <title>Synopsis</title>
26581  <funcsynopsis><funcprototype>
26582   <funcdef>bool <function>fence_is_signaled </function></funcdef>
26583   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
26584  </funcprototype></funcsynopsis>
26585</refsynopsisdiv>
26586<refsect1>
26587 <title>Arguments</title>
26588 <variablelist>
26589  <varlistentry>
26590   <term><parameter>fence</parameter></term>
26591   <listitem>
26592    <para>
26593     [in]	the fence to check
26594    </para>
26595   </listitem>
26596  </varlistentry>
26597 </variablelist>
26598</refsect1>
26599<refsect1>
26600<title>Description</title>
26601<para>
26602   Returns true if the fence was already signaled, false if not. Since this
26603   function doesn't enable signaling, it is not guaranteed to ever return
26604   true if fence_add_callback, fence_wait or fence_enable_sw_signaling
26605   haven't been called before.
26606   </para><para>
26607
26608   It's recommended for seqno fences to call fence_signal when the
26609   operation is complete, it makes it possible to prevent issues from
26610   wraparound between time of issue and time of use by checking the return
26611   value of this function before calling hardware-specific wait instructions.
26612</para>
26613</refsect1>
26614</refentry>
26615
26616<refentry id="API-fence-is-later">
26617<refentryinfo>
26618 <title>LINUX</title>
26619 <productname>Kernel Hackers Manual</productname>
26620 <date>July 2017</date>
26621</refentryinfo>
26622<refmeta>
26623 <refentrytitle><phrase>fence_is_later</phrase></refentrytitle>
26624 <manvolnum>9</manvolnum>
26625 <refmiscinfo class="version">4.4.14</refmiscinfo>
26626</refmeta>
26627<refnamediv>
26628 <refname>fence_is_later</refname>
26629 <refpurpose>
26630     return if f1 is chronologically later than f2
26631 </refpurpose>
26632</refnamediv>
26633<refsynopsisdiv>
26634 <title>Synopsis</title>
26635  <funcsynopsis><funcprototype>
26636   <funcdef>bool <function>fence_is_later </function></funcdef>
26637   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>f1</parameter></paramdef>
26638   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>f2</parameter></paramdef>
26639  </funcprototype></funcsynopsis>
26640</refsynopsisdiv>
26641<refsect1>
26642 <title>Arguments</title>
26643 <variablelist>
26644  <varlistentry>
26645   <term><parameter>f1</parameter></term>
26646   <listitem>
26647    <para>
26648     [in]	the first fence from the same context
26649    </para>
26650   </listitem>
26651  </varlistentry>
26652  <varlistentry>
26653   <term><parameter>f2</parameter></term>
26654   <listitem>
26655    <para>
26656     [in]	the second fence from the same context
26657    </para>
26658   </listitem>
26659  </varlistentry>
26660 </variablelist>
26661</refsect1>
26662<refsect1>
26663<title>Description</title>
26664<para>
26665   Returns true if f1 is chronologically later than f2. Both fences must be
26666   from the same context, since a seqno is not re-used across contexts.
26667</para>
26668</refsect1>
26669</refentry>
26670
26671<refentry id="API-fence-later">
26672<refentryinfo>
26673 <title>LINUX</title>
26674 <productname>Kernel Hackers Manual</productname>
26675 <date>July 2017</date>
26676</refentryinfo>
26677<refmeta>
26678 <refentrytitle><phrase>fence_later</phrase></refentrytitle>
26679 <manvolnum>9</manvolnum>
26680 <refmiscinfo class="version">4.4.14</refmiscinfo>
26681</refmeta>
26682<refnamediv>
26683 <refname>fence_later</refname>
26684 <refpurpose>
26685     return the chronologically later fence
26686 </refpurpose>
26687</refnamediv>
26688<refsynopsisdiv>
26689 <title>Synopsis</title>
26690  <funcsynopsis><funcprototype>
26691   <funcdef><link linkend="API-struct-fence">struct fence</link> * <function>fence_later </function></funcdef>
26692   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>f1</parameter></paramdef>
26693   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>f2</parameter></paramdef>
26694  </funcprototype></funcsynopsis>
26695</refsynopsisdiv>
26696<refsect1>
26697 <title>Arguments</title>
26698 <variablelist>
26699  <varlistentry>
26700   <term><parameter>f1</parameter></term>
26701   <listitem>
26702    <para>
26703     [in]	the first fence from the same context
26704    </para>
26705   </listitem>
26706  </varlistentry>
26707  <varlistentry>
26708   <term><parameter>f2</parameter></term>
26709   <listitem>
26710    <para>
26711     [in]	the second fence from the same context
26712    </para>
26713   </listitem>
26714  </varlistentry>
26715 </variablelist>
26716</refsect1>
26717<refsect1>
26718<title>Description</title>
26719<para>
26720   Returns NULL if both fences are signaled, otherwise the fence that would be
26721   signaled last. Both fences must be from the same context, since a seqno is
26722   not re-used across contexts.
26723</para>
26724</refsect1>
26725</refentry>
26726
26727<refentry id="API-fence-wait">
26728<refentryinfo>
26729 <title>LINUX</title>
26730 <productname>Kernel Hackers Manual</productname>
26731 <date>July 2017</date>
26732</refentryinfo>
26733<refmeta>
26734 <refentrytitle><phrase>fence_wait</phrase></refentrytitle>
26735 <manvolnum>9</manvolnum>
26736 <refmiscinfo class="version">4.4.14</refmiscinfo>
26737</refmeta>
26738<refnamediv>
26739 <refname>fence_wait</refname>
26740 <refpurpose>
26741     sleep until the fence gets signaled
26742 </refpurpose>
26743</refnamediv>
26744<refsynopsisdiv>
26745 <title>Synopsis</title>
26746  <funcsynopsis><funcprototype>
26747   <funcdef>signed long <function>fence_wait </function></funcdef>
26748   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
26749   <paramdef>bool <parameter>intr</parameter></paramdef>
26750  </funcprototype></funcsynopsis>
26751</refsynopsisdiv>
26752<refsect1>
26753 <title>Arguments</title>
26754 <variablelist>
26755  <varlistentry>
26756   <term><parameter>fence</parameter></term>
26757   <listitem>
26758    <para>
26759     [in]	the fence to wait on
26760    </para>
26761   </listitem>
26762  </varlistentry>
26763  <varlistentry>
26764   <term><parameter>intr</parameter></term>
26765   <listitem>
26766    <para>
26767     [in]	if true, do an interruptible wait
26768    </para>
26769   </listitem>
26770  </varlistentry>
26771 </variablelist>
26772</refsect1>
26773<refsect1>
26774<title>Description</title>
26775<para>
26776   This function will return -ERESTARTSYS if interrupted by a signal,
26777   or 0 if the fence was signaled. Other error values may be
26778   returned on custom implementations.
26779   </para><para>
26780
26781   Performs a synchronous wait on this fence. It is assumed the caller
26782   directly or indirectly holds a reference to the fence, otherwise the
26783   fence might be freed before return, resulting in undefined behavior.
26784</para>
26785</refsect1>
26786</refentry>
26787
26788<!-- include/linux/seqno-fence.h -->
26789<refentry id="API-to-seqno-fence">
26790<refentryinfo>
26791 <title>LINUX</title>
26792 <productname>Kernel Hackers Manual</productname>
26793 <date>July 2017</date>
26794</refentryinfo>
26795<refmeta>
26796 <refentrytitle><phrase>to_seqno_fence</phrase></refentrytitle>
26797 <manvolnum>9</manvolnum>
26798 <refmiscinfo class="version">4.4.14</refmiscinfo>
26799</refmeta>
26800<refnamediv>
26801 <refname>to_seqno_fence</refname>
26802 <refpurpose>
26803  cast a fence to a seqno_fence
26804 </refpurpose>
26805</refnamediv>
26806<refsynopsisdiv>
26807 <title>Synopsis</title>
26808  <funcsynopsis><funcprototype>
26809   <funcdef>struct seqno_fence * <function>to_seqno_fence </function></funcdef>
26810   <paramdef><link linkend="API-struct-fence">struct fence</link> * <parameter>fence</parameter></paramdef>
26811  </funcprototype></funcsynopsis>
26812</refsynopsisdiv>
26813<refsect1>
26814 <title>Arguments</title>
26815 <variablelist>
26816  <varlistentry>
26817   <term><parameter>fence</parameter></term>
26818   <listitem>
26819    <para>
26820     fence to cast to a seqno_fence
26821    </para>
26822   </listitem>
26823  </varlistentry>
26824 </variablelist>
26825</refsect1>
26826<refsect1>
26827<title>Description</title>
26828<para>
26829   Returns NULL if the fence is not a seqno_fence,
26830   or the seqno_fence otherwise.
26831</para>
26832</refsect1>
26833</refentry>
26834
26835<refentry id="API-seqno-fence-init">
26836<refentryinfo>
26837 <title>LINUX</title>
26838 <productname>Kernel Hackers Manual</productname>
26839 <date>July 2017</date>
26840</refentryinfo>
26841<refmeta>
26842 <refentrytitle><phrase>seqno_fence_init</phrase></refentrytitle>
26843 <manvolnum>9</manvolnum>
26844 <refmiscinfo class="version">4.4.14</refmiscinfo>
26845</refmeta>
26846<refnamediv>
26847 <refname>seqno_fence_init</refname>
26848 <refpurpose>
26849     initialize a seqno fence
26850 </refpurpose>
26851</refnamediv>
26852<refsynopsisdiv>
26853 <title>Synopsis</title>
26854  <funcsynopsis><funcprototype>
26855   <funcdef>void <function>seqno_fence_init </function></funcdef>
26856   <paramdef>struct seqno_fence * <parameter>fence</parameter></paramdef>
26857   <paramdef>spinlock_t * <parameter>lock</parameter></paramdef>
26858   <paramdef>struct dma_buf * <parameter>sync_buf</parameter></paramdef>
26859   <paramdef>uint32_t <parameter>context</parameter></paramdef>
26860   <paramdef>uint32_t <parameter>seqno_ofs</parameter></paramdef>
26861   <paramdef>uint32_t <parameter>seqno</parameter></paramdef>
26862   <paramdef>enum seqno_fence_condition <parameter>cond</parameter></paramdef>
26863   <paramdef><link linkend="API-struct-fence-ops">const struct fence_ops</link> * <parameter>ops</parameter></paramdef>
26864  </funcprototype></funcsynopsis>
26865</refsynopsisdiv>
26866<refsect1>
26867 <title>Arguments</title>
26868 <variablelist>
26869  <varlistentry>
26870   <term><parameter>fence</parameter></term>
26871   <listitem>
26872    <para>
26873     seqno_fence to initialize
26874    </para>
26875   </listitem>
26876  </varlistentry>
26877  <varlistentry>
26878   <term><parameter>lock</parameter></term>
26879   <listitem>
26880    <para>
26881     pointer to spinlock to use for fence
26882    </para>
26883   </listitem>
26884  </varlistentry>
26885  <varlistentry>
26886   <term><parameter>sync_buf</parameter></term>
26887   <listitem>
26888    <para>
26889     buffer containing the memory location to signal on
26890    </para>
26891   </listitem>
26892  </varlistentry>
26893  <varlistentry>
26894   <term><parameter>context</parameter></term>
26895   <listitem>
26896    <para>
26897     the execution context this fence is a part of
26898    </para>
26899   </listitem>
26900  </varlistentry>
26901  <varlistentry>
26902   <term><parameter>seqno_ofs</parameter></term>
26903   <listitem>
26904    <para>
26905     the offset within <parameter>sync_buf</parameter>
26906    </para>
26907   </listitem>
26908  </varlistentry>
26909  <varlistentry>
26910   <term><parameter>seqno</parameter></term>
26911   <listitem>
26912    <para>
26913     the sequence # to signal on
26914    </para>
26915   </listitem>
26916  </varlistentry>
26917  <varlistentry>
26918   <term><parameter>cond</parameter></term>
26919   <listitem>
26920    <para>
26921     fence wait condition
26922    </para>
26923   </listitem>
26924  </varlistentry>
26925  <varlistentry>
26926   <term><parameter>ops</parameter></term>
26927   <listitem>
26928    <para>
26929     the fence_ops for operations on this seqno fence
26930    </para>
26931   </listitem>
26932  </varlistentry>
26933 </variablelist>
26934</refsect1>
26935<refsect1>
26936<title>Description</title>
26937<para>
26938   This function initializes a struct seqno_fence with passed parameters,
26939   and takes a reference on sync_buf which is released on fence destruction.
26940   </para><para>
26941
26942   A seqno_fence is a dma_fence which can complete in software when
26943   enable_signaling is called, but it also completes when
26944   (s32)((sync_buf)[seqno_ofs] - seqno) &gt;= 0 is true
26945   </para><para>
26946
26947   The seqno_fence will take a refcount on the sync_buf until it's
26948   destroyed, but actual lifetime of sync_buf may be longer if one of the
26949   callers take a reference to it.
26950   </para><para>
26951
26952   Certain hardware have instructions to insert this type of wait condition
26953   in the command stream, so no intervention from software would be needed.
26954   This type of fence can be destroyed before completed, however a reference
26955   on the sync_buf dma-buf can be taken. It is encouraged to re-use the same
26956   dma-buf for sync_buf, since mapping or unmapping the sync_buf to the
26957   device's vm can be expensive.
26958   </para><para>
26959
26960   It is recommended for creators of seqno_fence to call fence_signal
26961   before destruction. This will prevent possible issues from wraparound at
26962   time of issue vs time of check, since users can check fence_is_signaled
26963   before submitting instructions for the hardware to wait on the fence.
26964   However, when ops.enable_signaling is not called, it doesn't have to be
26965   done as soon as possible, just before there's any real danger of seqno
26966   wraparound.
26967</para>
26968</refsect1>
26969</refentry>
26970
26971<!-- drivers/dma-buf/reservation.c -->
26972<refentry>
26973 <refnamediv>
26974  <refname>
26975   drivers/dma-buf/reservation.c
26976  </refname>
26977  <refpurpose>
26978   Document generation inconsistency
26979  </refpurpose>
26980 </refnamediv>
26981 <refsect1>
26982  <title>
26983   Oops
26984  </title>
26985  <warning>
26986   <para>
26987    The template for this document tried to insert
26988    the structured comment from the file
26989    <filename>drivers/dma-buf/reservation.c</filename> at this point,
26990    but none was found.
26991    This dummy section is inserted to allow
26992    generation to continue.
26993   </para>
26994  </warning>
26995 </refsect1>
26996</refentry>
26997<!-- include/linux/reservation.h -->
26998<refentry>
26999 <refnamediv>
27000  <refname>
27001   include/linux/reservation.h
27002  </refname>
27003  <refpurpose>
27004   Document generation inconsistency
27005  </refpurpose>
27006 </refnamediv>
27007 <refsect1>
27008  <title>
27009   Oops
27010  </title>
27011  <warning>
27012   <para>
27013    The template for this document tried to insert
27014    the structured comment from the file
27015    <filename>include/linux/reservation.h</filename> at this point,
27016    but none was found.
27017    This dummy section is inserted to allow
27018    generation to continue.
27019   </para>
27020  </warning>
27021 </refsect1>
27022</refentry>
27023<!-- drivers/base/dma-coherent.c -->
27024<refentry id="API-dma-alloc-from-coherent">
27025<refentryinfo>
27026 <title>LINUX</title>
27027 <productname>Kernel Hackers Manual</productname>
27028 <date>July 2017</date>
27029</refentryinfo>
27030<refmeta>
27031 <refentrytitle><phrase>dma_alloc_from_coherent</phrase></refentrytitle>
27032 <manvolnum>9</manvolnum>
27033 <refmiscinfo class="version">4.4.14</refmiscinfo>
27034</refmeta>
27035<refnamediv>
27036 <refname>dma_alloc_from_coherent</refname>
27037 <refpurpose>
27038  try to allocate memory from the per-device coherent area
27039 </refpurpose>
27040</refnamediv>
27041<refsynopsisdiv>
27042 <title>Synopsis</title>
27043  <funcsynopsis><funcprototype>
27044   <funcdef>int <function>dma_alloc_from_coherent </function></funcdef>
27045   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27046   <paramdef>ssize_t <parameter>size</parameter></paramdef>
27047   <paramdef>dma_addr_t * <parameter>dma_handle</parameter></paramdef>
27048   <paramdef>void ** <parameter>ret</parameter></paramdef>
27049  </funcprototype></funcsynopsis>
27050</refsynopsisdiv>
27051<refsect1>
27052 <title>Arguments</title>
27053 <variablelist>
27054  <varlistentry>
27055   <term><parameter>dev</parameter></term>
27056   <listitem>
27057    <para>
27058     device from which we allocate memory
27059    </para>
27060   </listitem>
27061  </varlistentry>
27062  <varlistentry>
27063   <term><parameter>size</parameter></term>
27064   <listitem>
27065    <para>
27066     size of requested memory area
27067    </para>
27068   </listitem>
27069  </varlistentry>
27070  <varlistentry>
27071   <term><parameter>dma_handle</parameter></term>
27072   <listitem>
27073    <para>
27074     This will be filled with the correct dma handle
27075    </para>
27076   </listitem>
27077  </varlistentry>
27078  <varlistentry>
27079   <term><parameter>ret</parameter></term>
27080   <listitem>
27081    <para>
27082     This pointer will be filled with the virtual address
27083     to allocated area.
27084    </para>
27085   </listitem>
27086  </varlistentry>
27087 </variablelist>
27088</refsect1>
27089<refsect1>
27090<title>Description</title>
27091<para>
27092   This function should be only called from per-arch <function>dma_alloc_coherent</function>
27093   to support allocation from per-device coherent memory pools.
27094   </para><para>
27095
27096   Returns 0 if dma_alloc_coherent should continue with allocating from
27097   generic memory areas, or !0 if dma_alloc_coherent should return <parameter>ret</parameter>.
27098</para>
27099</refsect1>
27100</refentry>
27101
27102<refentry id="API-dma-release-from-coherent">
27103<refentryinfo>
27104 <title>LINUX</title>
27105 <productname>Kernel Hackers Manual</productname>
27106 <date>July 2017</date>
27107</refentryinfo>
27108<refmeta>
27109 <refentrytitle><phrase>dma_release_from_coherent</phrase></refentrytitle>
27110 <manvolnum>9</manvolnum>
27111 <refmiscinfo class="version">4.4.14</refmiscinfo>
27112</refmeta>
27113<refnamediv>
27114 <refname>dma_release_from_coherent</refname>
27115 <refpurpose>
27116     try to free the memory allocated from per-device coherent memory pool
27117 </refpurpose>
27118</refnamediv>
27119<refsynopsisdiv>
27120 <title>Synopsis</title>
27121  <funcsynopsis><funcprototype>
27122   <funcdef>int <function>dma_release_from_coherent </function></funcdef>
27123   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27124   <paramdef>int <parameter>order</parameter></paramdef>
27125   <paramdef>void * <parameter>vaddr</parameter></paramdef>
27126  </funcprototype></funcsynopsis>
27127</refsynopsisdiv>
27128<refsect1>
27129 <title>Arguments</title>
27130 <variablelist>
27131  <varlistentry>
27132   <term><parameter>dev</parameter></term>
27133   <listitem>
27134    <para>
27135     device from which the memory was allocated
27136    </para>
27137   </listitem>
27138  </varlistentry>
27139  <varlistentry>
27140   <term><parameter>order</parameter></term>
27141   <listitem>
27142    <para>
27143     the order of pages allocated
27144    </para>
27145   </listitem>
27146  </varlistentry>
27147  <varlistentry>
27148   <term><parameter>vaddr</parameter></term>
27149   <listitem>
27150    <para>
27151     virtual address of allocated pages
27152    </para>
27153   </listitem>
27154  </varlistentry>
27155 </variablelist>
27156</refsect1>
27157<refsect1>
27158<title>Description</title>
27159<para>
27160   This checks whether the memory was allocated from the per-device
27161   coherent memory pool and if so, releases that memory.
27162   </para><para>
27163
27164   Returns 1 if we correctly released the memory, or 0 if
27165   <function>dma_release_coherent</function> should proceed with releasing memory from
27166   generic pools.
27167</para>
27168</refsect1>
27169</refentry>
27170
27171<refentry id="API-dma-mmap-from-coherent">
27172<refentryinfo>
27173 <title>LINUX</title>
27174 <productname>Kernel Hackers Manual</productname>
27175 <date>July 2017</date>
27176</refentryinfo>
27177<refmeta>
27178 <refentrytitle><phrase>dma_mmap_from_coherent</phrase></refentrytitle>
27179 <manvolnum>9</manvolnum>
27180 <refmiscinfo class="version">4.4.14</refmiscinfo>
27181</refmeta>
27182<refnamediv>
27183 <refname>dma_mmap_from_coherent</refname>
27184 <refpurpose>
27185     try to mmap the memory allocated from per-device coherent memory pool to userspace
27186 </refpurpose>
27187</refnamediv>
27188<refsynopsisdiv>
27189 <title>Synopsis</title>
27190  <funcsynopsis><funcprototype>
27191   <funcdef>int <function>dma_mmap_from_coherent </function></funcdef>
27192   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27193   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
27194   <paramdef>void * <parameter>vaddr</parameter></paramdef>
27195   <paramdef>size_t <parameter>size</parameter></paramdef>
27196   <paramdef>int * <parameter>ret</parameter></paramdef>
27197  </funcprototype></funcsynopsis>
27198</refsynopsisdiv>
27199<refsect1>
27200 <title>Arguments</title>
27201 <variablelist>
27202  <varlistentry>
27203   <term><parameter>dev</parameter></term>
27204   <listitem>
27205    <para>
27206     device from which the memory was allocated
27207    </para>
27208   </listitem>
27209  </varlistentry>
27210  <varlistentry>
27211   <term><parameter>vma</parameter></term>
27212   <listitem>
27213    <para>
27214     vm_area for the userspace memory
27215    </para>
27216   </listitem>
27217  </varlistentry>
27218  <varlistentry>
27219   <term><parameter>vaddr</parameter></term>
27220   <listitem>
27221    <para>
27222     cpu address returned by dma_alloc_from_coherent
27223    </para>
27224   </listitem>
27225  </varlistentry>
27226  <varlistentry>
27227   <term><parameter>size</parameter></term>
27228   <listitem>
27229    <para>
27230     size of the memory buffer allocated by dma_alloc_from_coherent
27231    </para>
27232   </listitem>
27233  </varlistentry>
27234  <varlistentry>
27235   <term><parameter>ret</parameter></term>
27236   <listitem>
27237    <para>
27238     result from <function>remap_pfn_range</function>
27239    </para>
27240   </listitem>
27241  </varlistentry>
27242 </variablelist>
27243</refsect1>
27244<refsect1>
27245<title>Description</title>
27246<para>
27247   This checks whether the memory was allocated from the per-device
27248   coherent memory pool and if so, maps that memory to the provided vma.
27249   </para><para>
27250
27251   Returns 1 if we correctly mapped the memory, or 0 if the caller should
27252   proceed with mapping memory from generic pools.
27253</para>
27254</refsect1>
27255</refentry>
27256
27257<!-- drivers/base/dma-mapping.c -->
27258<refentry id="API-dmam-alloc-coherent">
27259<refentryinfo>
27260 <title>LINUX</title>
27261 <productname>Kernel Hackers Manual</productname>
27262 <date>July 2017</date>
27263</refentryinfo>
27264<refmeta>
27265 <refentrytitle><phrase>dmam_alloc_coherent</phrase></refentrytitle>
27266 <manvolnum>9</manvolnum>
27267 <refmiscinfo class="version">4.4.14</refmiscinfo>
27268</refmeta>
27269<refnamediv>
27270 <refname>dmam_alloc_coherent</refname>
27271 <refpurpose>
27272  Managed <function>dma_alloc_coherent</function>
27273 </refpurpose>
27274</refnamediv>
27275<refsynopsisdiv>
27276 <title>Synopsis</title>
27277  <funcsynopsis><funcprototype>
27278   <funcdef>void * <function>dmam_alloc_coherent </function></funcdef>
27279   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27280   <paramdef>size_t <parameter>size</parameter></paramdef>
27281   <paramdef>dma_addr_t * <parameter>dma_handle</parameter></paramdef>
27282   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
27283  </funcprototype></funcsynopsis>
27284</refsynopsisdiv>
27285<refsect1>
27286 <title>Arguments</title>
27287 <variablelist>
27288  <varlistentry>
27289   <term><parameter>dev</parameter></term>
27290   <listitem>
27291    <para>
27292     Device to allocate coherent memory for
27293    </para>
27294   </listitem>
27295  </varlistentry>
27296  <varlistentry>
27297   <term><parameter>size</parameter></term>
27298   <listitem>
27299    <para>
27300     Size of allocation
27301    </para>
27302   </listitem>
27303  </varlistentry>
27304  <varlistentry>
27305   <term><parameter>dma_handle</parameter></term>
27306   <listitem>
27307    <para>
27308     Out argument for allocated DMA handle
27309    </para>
27310   </listitem>
27311  </varlistentry>
27312  <varlistentry>
27313   <term><parameter>gfp</parameter></term>
27314   <listitem>
27315    <para>
27316     Allocation flags
27317    </para>
27318   </listitem>
27319  </varlistentry>
27320 </variablelist>
27321</refsect1>
27322<refsect1>
27323<title>Description</title>
27324<para>
27325   Managed <function>dma_alloc_coherent</function>.  Memory allocated using this function
27326   will be automatically released on driver detach.
27327</para>
27328</refsect1>
27329<refsect1>
27330<title>RETURNS</title>
27331<para>
27332   Pointer to allocated memory on success, NULL on failure.
27333</para>
27334</refsect1>
27335</refentry>
27336
27337<refentry id="API-dmam-free-coherent">
27338<refentryinfo>
27339 <title>LINUX</title>
27340 <productname>Kernel Hackers Manual</productname>
27341 <date>July 2017</date>
27342</refentryinfo>
27343<refmeta>
27344 <refentrytitle><phrase>dmam_free_coherent</phrase></refentrytitle>
27345 <manvolnum>9</manvolnum>
27346 <refmiscinfo class="version">4.4.14</refmiscinfo>
27347</refmeta>
27348<refnamediv>
27349 <refname>dmam_free_coherent</refname>
27350 <refpurpose>
27351     Managed <function>dma_free_coherent</function>
27352 </refpurpose>
27353</refnamediv>
27354<refsynopsisdiv>
27355 <title>Synopsis</title>
27356  <funcsynopsis><funcprototype>
27357   <funcdef>void <function>dmam_free_coherent </function></funcdef>
27358   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27359   <paramdef>size_t <parameter>size</parameter></paramdef>
27360   <paramdef>void * <parameter>vaddr</parameter></paramdef>
27361   <paramdef>dma_addr_t <parameter>dma_handle</parameter></paramdef>
27362  </funcprototype></funcsynopsis>
27363</refsynopsisdiv>
27364<refsect1>
27365 <title>Arguments</title>
27366 <variablelist>
27367  <varlistentry>
27368   <term><parameter>dev</parameter></term>
27369   <listitem>
27370    <para>
27371     Device to free coherent memory for
27372    </para>
27373   </listitem>
27374  </varlistentry>
27375  <varlistentry>
27376   <term><parameter>size</parameter></term>
27377   <listitem>
27378    <para>
27379     Size of allocation
27380    </para>
27381   </listitem>
27382  </varlistentry>
27383  <varlistentry>
27384   <term><parameter>vaddr</parameter></term>
27385   <listitem>
27386    <para>
27387     Virtual address of the memory to free
27388    </para>
27389   </listitem>
27390  </varlistentry>
27391  <varlistentry>
27392   <term><parameter>dma_handle</parameter></term>
27393   <listitem>
27394    <para>
27395     DMA handle of the memory to free
27396    </para>
27397   </listitem>
27398  </varlistentry>
27399 </variablelist>
27400</refsect1>
27401<refsect1>
27402<title>Description</title>
27403<para>
27404   Managed <function>dma_free_coherent</function>.
27405</para>
27406</refsect1>
27407</refentry>
27408
27409<refentry id="API-dmam-alloc-noncoherent">
27410<refentryinfo>
27411 <title>LINUX</title>
27412 <productname>Kernel Hackers Manual</productname>
27413 <date>July 2017</date>
27414</refentryinfo>
27415<refmeta>
27416 <refentrytitle><phrase>dmam_alloc_noncoherent</phrase></refentrytitle>
27417 <manvolnum>9</manvolnum>
27418 <refmiscinfo class="version">4.4.14</refmiscinfo>
27419</refmeta>
27420<refnamediv>
27421 <refname>dmam_alloc_noncoherent</refname>
27422 <refpurpose>
27423     Managed <function>dma_alloc_non_coherent</function>
27424 </refpurpose>
27425</refnamediv>
27426<refsynopsisdiv>
27427 <title>Synopsis</title>
27428  <funcsynopsis><funcprototype>
27429   <funcdef>void * <function>dmam_alloc_noncoherent </function></funcdef>
27430   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27431   <paramdef>size_t <parameter>size</parameter></paramdef>
27432   <paramdef>dma_addr_t * <parameter>dma_handle</parameter></paramdef>
27433   <paramdef>gfp_t <parameter>gfp</parameter></paramdef>
27434  </funcprototype></funcsynopsis>
27435</refsynopsisdiv>
27436<refsect1>
27437 <title>Arguments</title>
27438 <variablelist>
27439  <varlistentry>
27440   <term><parameter>dev</parameter></term>
27441   <listitem>
27442    <para>
27443     Device to allocate non_coherent memory for
27444    </para>
27445   </listitem>
27446  </varlistentry>
27447  <varlistentry>
27448   <term><parameter>size</parameter></term>
27449   <listitem>
27450    <para>
27451     Size of allocation
27452    </para>
27453   </listitem>
27454  </varlistentry>
27455  <varlistentry>
27456   <term><parameter>dma_handle</parameter></term>
27457   <listitem>
27458    <para>
27459     Out argument for allocated DMA handle
27460    </para>
27461   </listitem>
27462  </varlistentry>
27463  <varlistentry>
27464   <term><parameter>gfp</parameter></term>
27465   <listitem>
27466    <para>
27467     Allocation flags
27468    </para>
27469   </listitem>
27470  </varlistentry>
27471 </variablelist>
27472</refsect1>
27473<refsect1>
27474<title>Description</title>
27475<para>
27476   Managed <function>dma_alloc_non_coherent</function>.  Memory allocated using this
27477   function will be automatically released on driver detach.
27478</para>
27479</refsect1>
27480<refsect1>
27481<title>RETURNS</title>
27482<para>
27483   Pointer to allocated memory on success, NULL on failure.
27484</para>
27485</refsect1>
27486</refentry>
27487
27488<refentry id="API-dmam-free-noncoherent">
27489<refentryinfo>
27490 <title>LINUX</title>
27491 <productname>Kernel Hackers Manual</productname>
27492 <date>July 2017</date>
27493</refentryinfo>
27494<refmeta>
27495 <refentrytitle><phrase>dmam_free_noncoherent</phrase></refentrytitle>
27496 <manvolnum>9</manvolnum>
27497 <refmiscinfo class="version">4.4.14</refmiscinfo>
27498</refmeta>
27499<refnamediv>
27500 <refname>dmam_free_noncoherent</refname>
27501 <refpurpose>
27502     Managed <function>dma_free_noncoherent</function>
27503 </refpurpose>
27504</refnamediv>
27505<refsynopsisdiv>
27506 <title>Synopsis</title>
27507  <funcsynopsis><funcprototype>
27508   <funcdef>void <function>dmam_free_noncoherent </function></funcdef>
27509   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27510   <paramdef>size_t <parameter>size</parameter></paramdef>
27511   <paramdef>void * <parameter>vaddr</parameter></paramdef>
27512   <paramdef>dma_addr_t <parameter>dma_handle</parameter></paramdef>
27513  </funcprototype></funcsynopsis>
27514</refsynopsisdiv>
27515<refsect1>
27516 <title>Arguments</title>
27517 <variablelist>
27518  <varlistentry>
27519   <term><parameter>dev</parameter></term>
27520   <listitem>
27521    <para>
27522     Device to free noncoherent memory for
27523    </para>
27524   </listitem>
27525  </varlistentry>
27526  <varlistentry>
27527   <term><parameter>size</parameter></term>
27528   <listitem>
27529    <para>
27530     Size of allocation
27531    </para>
27532   </listitem>
27533  </varlistentry>
27534  <varlistentry>
27535   <term><parameter>vaddr</parameter></term>
27536   <listitem>
27537    <para>
27538     Virtual address of the memory to free
27539    </para>
27540   </listitem>
27541  </varlistentry>
27542  <varlistentry>
27543   <term><parameter>dma_handle</parameter></term>
27544   <listitem>
27545    <para>
27546     DMA handle of the memory to free
27547    </para>
27548   </listitem>
27549  </varlistentry>
27550 </variablelist>
27551</refsect1>
27552<refsect1>
27553<title>Description</title>
27554<para>
27555   Managed <function>dma_free_noncoherent</function>.
27556</para>
27557</refsect1>
27558</refentry>
27559
27560<refentry id="API-dmam-declare-coherent-memory">
27561<refentryinfo>
27562 <title>LINUX</title>
27563 <productname>Kernel Hackers Manual</productname>
27564 <date>July 2017</date>
27565</refentryinfo>
27566<refmeta>
27567 <refentrytitle><phrase>dmam_declare_coherent_memory</phrase></refentrytitle>
27568 <manvolnum>9</manvolnum>
27569 <refmiscinfo class="version">4.4.14</refmiscinfo>
27570</refmeta>
27571<refnamediv>
27572 <refname>dmam_declare_coherent_memory</refname>
27573 <refpurpose>
27574     Managed <function>dma_declare_coherent_memory</function>
27575 </refpurpose>
27576</refnamediv>
27577<refsynopsisdiv>
27578 <title>Synopsis</title>
27579  <funcsynopsis><funcprototype>
27580   <funcdef>int <function>dmam_declare_coherent_memory </function></funcdef>
27581   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27582   <paramdef>phys_addr_t <parameter>phys_addr</parameter></paramdef>
27583   <paramdef>dma_addr_t <parameter>device_addr</parameter></paramdef>
27584   <paramdef>size_t <parameter>size</parameter></paramdef>
27585   <paramdef>int <parameter>flags</parameter></paramdef>
27586  </funcprototype></funcsynopsis>
27587</refsynopsisdiv>
27588<refsect1>
27589 <title>Arguments</title>
27590 <variablelist>
27591  <varlistentry>
27592   <term><parameter>dev</parameter></term>
27593   <listitem>
27594    <para>
27595     Device to declare coherent memory for
27596    </para>
27597   </listitem>
27598  </varlistentry>
27599  <varlistentry>
27600   <term><parameter>phys_addr</parameter></term>
27601   <listitem>
27602    <para>
27603     Physical address of coherent memory to be declared
27604    </para>
27605   </listitem>
27606  </varlistentry>
27607  <varlistentry>
27608   <term><parameter>device_addr</parameter></term>
27609   <listitem>
27610    <para>
27611     Device address of coherent memory to be declared
27612    </para>
27613   </listitem>
27614  </varlistentry>
27615  <varlistentry>
27616   <term><parameter>size</parameter></term>
27617   <listitem>
27618    <para>
27619     Size of coherent memory to be declared
27620    </para>
27621   </listitem>
27622  </varlistentry>
27623  <varlistentry>
27624   <term><parameter>flags</parameter></term>
27625   <listitem>
27626    <para>
27627     Flags
27628    </para>
27629   </listitem>
27630  </varlistentry>
27631 </variablelist>
27632</refsect1>
27633<refsect1>
27634<title>Description</title>
27635<para>
27636   Managed <function>dma_declare_coherent_memory</function>.
27637</para>
27638</refsect1>
27639<refsect1>
27640<title>RETURNS</title>
27641<para>
27642   0 on success, -errno on failure.
27643</para>
27644</refsect1>
27645</refentry>
27646
27647<refentry id="API-dmam-release-declared-memory">
27648<refentryinfo>
27649 <title>LINUX</title>
27650 <productname>Kernel Hackers Manual</productname>
27651 <date>July 2017</date>
27652</refentryinfo>
27653<refmeta>
27654 <refentrytitle><phrase>dmam_release_declared_memory</phrase></refentrytitle>
27655 <manvolnum>9</manvolnum>
27656 <refmiscinfo class="version">4.4.14</refmiscinfo>
27657</refmeta>
27658<refnamediv>
27659 <refname>dmam_release_declared_memory</refname>
27660 <refpurpose>
27661     Managed <function>dma_release_declared_memory</function>.
27662 </refpurpose>
27663</refnamediv>
27664<refsynopsisdiv>
27665 <title>Synopsis</title>
27666  <funcsynopsis><funcprototype>
27667   <funcdef>void <function>dmam_release_declared_memory </function></funcdef>
27668   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27669  </funcprototype></funcsynopsis>
27670</refsynopsisdiv>
27671<refsect1>
27672 <title>Arguments</title>
27673 <variablelist>
27674  <varlistentry>
27675   <term><parameter>dev</parameter></term>
27676   <listitem>
27677    <para>
27678     Device to release declared coherent memory for
27679    </para>
27680   </listitem>
27681  </varlistentry>
27682 </variablelist>
27683</refsect1>
27684<refsect1>
27685<title>Description</title>
27686<para>
27687   Managed <function><link linkend="API-dmam-release-declared-memory">dmam_release_declared_memory</link></function>.
27688</para>
27689</refsect1>
27690</refentry>
27691
27692     </sect1>
27693     <sect1><title>Device Drivers Power Management</title>
27694<!-- drivers/base/power/main.c -->
27695<refentry id="API-dpm-resume-start">
27696<refentryinfo>
27697 <title>LINUX</title>
27698 <productname>Kernel Hackers Manual</productname>
27699 <date>July 2017</date>
27700</refentryinfo>
27701<refmeta>
27702 <refentrytitle><phrase>dpm_resume_start</phrase></refentrytitle>
27703 <manvolnum>9</manvolnum>
27704 <refmiscinfo class="version">4.4.14</refmiscinfo>
27705</refmeta>
27706<refnamediv>
27707 <refname>dpm_resume_start</refname>
27708 <refpurpose>
27709  Execute <quote>noirq</quote> and <quote>early</quote> device callbacks.
27710 </refpurpose>
27711</refnamediv>
27712<refsynopsisdiv>
27713 <title>Synopsis</title>
27714  <funcsynopsis><funcprototype>
27715   <funcdef>void <function>dpm_resume_start </function></funcdef>
27716   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
27717  </funcprototype></funcsynopsis>
27718</refsynopsisdiv>
27719<refsect1>
27720 <title>Arguments</title>
27721 <variablelist>
27722  <varlistentry>
27723   <term><parameter>state</parameter></term>
27724   <listitem>
27725    <para>
27726     PM transition of the system being carried out.
27727    </para>
27728   </listitem>
27729  </varlistentry>
27730 </variablelist>
27731</refsect1>
27732</refentry>
27733
27734<refentry id="API-dpm-resume-end">
27735<refentryinfo>
27736 <title>LINUX</title>
27737 <productname>Kernel Hackers Manual</productname>
27738 <date>July 2017</date>
27739</refentryinfo>
27740<refmeta>
27741 <refentrytitle><phrase>dpm_resume_end</phrase></refentrytitle>
27742 <manvolnum>9</manvolnum>
27743 <refmiscinfo class="version">4.4.14</refmiscinfo>
27744</refmeta>
27745<refnamediv>
27746 <refname>dpm_resume_end</refname>
27747 <refpurpose>
27748     Execute <quote>resume</quote> callbacks and complete system transition.
27749 </refpurpose>
27750</refnamediv>
27751<refsynopsisdiv>
27752 <title>Synopsis</title>
27753  <funcsynopsis><funcprototype>
27754   <funcdef>void <function>dpm_resume_end </function></funcdef>
27755   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
27756  </funcprototype></funcsynopsis>
27757</refsynopsisdiv>
27758<refsect1>
27759 <title>Arguments</title>
27760 <variablelist>
27761  <varlistentry>
27762   <term><parameter>state</parameter></term>
27763   <listitem>
27764    <para>
27765     PM transition of the system being carried out.
27766    </para>
27767   </listitem>
27768  </varlistentry>
27769 </variablelist>
27770</refsect1>
27771<refsect1>
27772<title>Description</title>
27773<para>
27774   Execute <quote>resume</quote> callbacks for all devices and complete the PM transition of
27775   the system.
27776</para>
27777</refsect1>
27778</refentry>
27779
27780<refentry id="API-dpm-suspend-end">
27781<refentryinfo>
27782 <title>LINUX</title>
27783 <productname>Kernel Hackers Manual</productname>
27784 <date>July 2017</date>
27785</refentryinfo>
27786<refmeta>
27787 <refentrytitle><phrase>dpm_suspend_end</phrase></refentrytitle>
27788 <manvolnum>9</manvolnum>
27789 <refmiscinfo class="version">4.4.14</refmiscinfo>
27790</refmeta>
27791<refnamediv>
27792 <refname>dpm_suspend_end</refname>
27793 <refpurpose>
27794     Execute <quote>late</quote> and <quote>noirq</quote> device suspend callbacks.
27795 </refpurpose>
27796</refnamediv>
27797<refsynopsisdiv>
27798 <title>Synopsis</title>
27799  <funcsynopsis><funcprototype>
27800   <funcdef>int <function>dpm_suspend_end </function></funcdef>
27801   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
27802  </funcprototype></funcsynopsis>
27803</refsynopsisdiv>
27804<refsect1>
27805 <title>Arguments</title>
27806 <variablelist>
27807  <varlistentry>
27808   <term><parameter>state</parameter></term>
27809   <listitem>
27810    <para>
27811     PM transition of the system being carried out.
27812    </para>
27813   </listitem>
27814  </varlistentry>
27815 </variablelist>
27816</refsect1>
27817</refentry>
27818
27819<refentry id="API-dpm-suspend-start">
27820<refentryinfo>
27821 <title>LINUX</title>
27822 <productname>Kernel Hackers Manual</productname>
27823 <date>July 2017</date>
27824</refentryinfo>
27825<refmeta>
27826 <refentrytitle><phrase>dpm_suspend_start</phrase></refentrytitle>
27827 <manvolnum>9</manvolnum>
27828 <refmiscinfo class="version">4.4.14</refmiscinfo>
27829</refmeta>
27830<refnamediv>
27831 <refname>dpm_suspend_start</refname>
27832 <refpurpose>
27833     Prepare devices for PM transition and suspend them.
27834 </refpurpose>
27835</refnamediv>
27836<refsynopsisdiv>
27837 <title>Synopsis</title>
27838  <funcsynopsis><funcprototype>
27839   <funcdef>int <function>dpm_suspend_start </function></funcdef>
27840   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
27841  </funcprototype></funcsynopsis>
27842</refsynopsisdiv>
27843<refsect1>
27844 <title>Arguments</title>
27845 <variablelist>
27846  <varlistentry>
27847   <term><parameter>state</parameter></term>
27848   <listitem>
27849    <para>
27850     PM transition of the system being carried out.
27851    </para>
27852   </listitem>
27853  </varlistentry>
27854 </variablelist>
27855</refsect1>
27856<refsect1>
27857<title>Description</title>
27858<para>
27859   Prepare all non-sysdev devices for system PM transition and execute <quote>suspend</quote>
27860   callbacks for them.
27861</para>
27862</refsect1>
27863</refentry>
27864
27865<refentry id="API-device-pm-wait-for-dev">
27866<refentryinfo>
27867 <title>LINUX</title>
27868 <productname>Kernel Hackers Manual</productname>
27869 <date>July 2017</date>
27870</refentryinfo>
27871<refmeta>
27872 <refentrytitle><phrase>device_pm_wait_for_dev</phrase></refentrytitle>
27873 <manvolnum>9</manvolnum>
27874 <refmiscinfo class="version">4.4.14</refmiscinfo>
27875</refmeta>
27876<refnamediv>
27877 <refname>device_pm_wait_for_dev</refname>
27878 <refpurpose>
27879     Wait for suspend/resume of a device to complete.
27880 </refpurpose>
27881</refnamediv>
27882<refsynopsisdiv>
27883 <title>Synopsis</title>
27884  <funcsynopsis><funcprototype>
27885   <funcdef>int <function>device_pm_wait_for_dev </function></funcdef>
27886   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>subordinate</parameter></paramdef>
27887   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
27888  </funcprototype></funcsynopsis>
27889</refsynopsisdiv>
27890<refsect1>
27891 <title>Arguments</title>
27892 <variablelist>
27893  <varlistentry>
27894   <term><parameter>subordinate</parameter></term>
27895   <listitem>
27896    <para>
27897     Device that needs to wait for <parameter>dev</parameter>.
27898    </para>
27899   </listitem>
27900  </varlistentry>
27901  <varlistentry>
27902   <term><parameter>dev</parameter></term>
27903   <listitem>
27904    <para>
27905     Device to wait for.
27906    </para>
27907   </listitem>
27908  </varlistentry>
27909 </variablelist>
27910</refsect1>
27911</refentry>
27912
27913<refentry id="API-dpm-for-each-dev">
27914<refentryinfo>
27915 <title>LINUX</title>
27916 <productname>Kernel Hackers Manual</productname>
27917 <date>July 2017</date>
27918</refentryinfo>
27919<refmeta>
27920 <refentrytitle><phrase>dpm_for_each_dev</phrase></refentrytitle>
27921 <manvolnum>9</manvolnum>
27922 <refmiscinfo class="version">4.4.14</refmiscinfo>
27923</refmeta>
27924<refnamediv>
27925 <refname>dpm_for_each_dev</refname>
27926 <refpurpose>
27927     device iterator.
27928 </refpurpose>
27929</refnamediv>
27930<refsynopsisdiv>
27931 <title>Synopsis</title>
27932  <funcsynopsis><funcprototype>
27933   <funcdef>void <function>dpm_for_each_dev </function></funcdef>
27934   <paramdef>void * <parameter>data</parameter></paramdef>
27935   <paramdef>void (*<parameter>fn</parameter>)
27936     <funcparams>struct device *, void *</funcparams></paramdef>
27937  </funcprototype></funcsynopsis>
27938</refsynopsisdiv>
27939<refsect1>
27940 <title>Arguments</title>
27941 <variablelist>
27942  <varlistentry>
27943   <term><parameter>data</parameter></term>
27944   <listitem>
27945    <para>
27946     data for the callback.
27947    </para>
27948   </listitem>
27949  </varlistentry>
27950  <varlistentry>
27951   <term><parameter>fn</parameter></term>
27952   <listitem>
27953    <para>
27954     function to be called for each device.
27955    </para>
27956   </listitem>
27957  </varlistentry>
27958 </variablelist>
27959</refsect1>
27960<refsect1>
27961<title>Description</title>
27962<para>
27963   Iterate over devices in dpm_list, and call <parameter>fn</parameter> for each device,
27964   passing it <parameter>data</parameter>.
27965</para>
27966</refsect1>
27967</refentry>
27968
27969     </sect1>
27970     <sect1><title>Device Drivers ACPI Support</title>
27971<!-- Internal functions only
27972X!Edrivers/acpi/sleep/main.c
27973X!Edrivers/acpi/sleep/wakeup.c
27974X!Edrivers/acpi/motherboard.c
27975X!Edrivers/acpi/bus.c
27976-->
27977<!-- drivers/acpi/scan.c -->
27978<refentry id="API-acpi-bus-scan">
27979<refentryinfo>
27980 <title>LINUX</title>
27981 <productname>Kernel Hackers Manual</productname>
27982 <date>July 2017</date>
27983</refentryinfo>
27984<refmeta>
27985 <refentrytitle><phrase>acpi_bus_scan</phrase></refentrytitle>
27986 <manvolnum>9</manvolnum>
27987 <refmiscinfo class="version">4.4.14</refmiscinfo>
27988</refmeta>
27989<refnamediv>
27990 <refname>acpi_bus_scan</refname>
27991 <refpurpose>
27992  Add ACPI device node objects in a given namespace scope.
27993 </refpurpose>
27994</refnamediv>
27995<refsynopsisdiv>
27996 <title>Synopsis</title>
27997  <funcsynopsis><funcprototype>
27998   <funcdef>int <function>acpi_bus_scan </function></funcdef>
27999   <paramdef>acpi_handle <parameter>handle</parameter></paramdef>
28000  </funcprototype></funcsynopsis>
28001</refsynopsisdiv>
28002<refsect1>
28003 <title>Arguments</title>
28004 <variablelist>
28005  <varlistentry>
28006   <term><parameter>handle</parameter></term>
28007   <listitem>
28008    <para>
28009     Root of the namespace scope to scan.
28010    </para>
28011   </listitem>
28012  </varlistentry>
28013 </variablelist>
28014</refsect1>
28015<refsect1>
28016<title>Description</title>
28017<para>
28018   Scan a given ACPI tree (probably recently hot-plugged) and create and add
28019   found devices.
28020   </para><para>
28021
28022   If no devices were found, -ENODEV is returned, but it does not mean that
28023   there has been a real error.  There just have been no suitable ACPI objects
28024   in the table trunk from which the kernel could create a device and add an
28025   appropriate driver.
28026   </para><para>
28027
28028   Must be called under acpi_scan_lock.
28029</para>
28030</refsect1>
28031</refentry>
28032
28033<refentry id="API-acpi-bus-trim">
28034<refentryinfo>
28035 <title>LINUX</title>
28036 <productname>Kernel Hackers Manual</productname>
28037 <date>July 2017</date>
28038</refentryinfo>
28039<refmeta>
28040 <refentrytitle><phrase>acpi_bus_trim</phrase></refentrytitle>
28041 <manvolnum>9</manvolnum>
28042 <refmiscinfo class="version">4.4.14</refmiscinfo>
28043</refmeta>
28044<refnamediv>
28045 <refname>acpi_bus_trim</refname>
28046 <refpurpose>
28047     Detach scan handlers and drivers from ACPI device objects.
28048 </refpurpose>
28049</refnamediv>
28050<refsynopsisdiv>
28051 <title>Synopsis</title>
28052  <funcsynopsis><funcprototype>
28053   <funcdef>void <function>acpi_bus_trim </function></funcdef>
28054   <paramdef>struct acpi_device * <parameter>adev</parameter></paramdef>
28055  </funcprototype></funcsynopsis>
28056</refsynopsisdiv>
28057<refsect1>
28058 <title>Arguments</title>
28059 <variablelist>
28060  <varlistentry>
28061   <term><parameter>adev</parameter></term>
28062   <listitem>
28063    <para>
28064     Root of the ACPI namespace scope to walk.
28065    </para>
28066   </listitem>
28067  </varlistentry>
28068 </variablelist>
28069</refsect1>
28070<refsect1>
28071<title>Description</title>
28072<para>
28073   Must be called under acpi_scan_lock.
28074</para>
28075</refsect1>
28076</refentry>
28077
28078<!-- drivers/acpi/scan.c -->
28079<refentry id="API-acpi-scan-drop-device">
28080<refentryinfo>
28081 <title>LINUX</title>
28082 <productname>Kernel Hackers Manual</productname>
28083 <date>July 2017</date>
28084</refentryinfo>
28085<refmeta>
28086 <refentrytitle><phrase>acpi_scan_drop_device</phrase></refentrytitle>
28087 <manvolnum>9</manvolnum>
28088 <refmiscinfo class="version">4.4.14</refmiscinfo>
28089</refmeta>
28090<refnamediv>
28091 <refname>acpi_scan_drop_device</refname>
28092 <refpurpose>
28093  Drop an ACPI device object.
28094 </refpurpose>
28095</refnamediv>
28096<refsynopsisdiv>
28097 <title>Synopsis</title>
28098  <funcsynopsis><funcprototype>
28099   <funcdef>void <function>acpi_scan_drop_device </function></funcdef>
28100   <paramdef>acpi_handle <parameter>handle</parameter></paramdef>
28101   <paramdef>void * <parameter>context</parameter></paramdef>
28102  </funcprototype></funcsynopsis>
28103</refsynopsisdiv>
28104<refsect1>
28105 <title>Arguments</title>
28106 <variablelist>
28107  <varlistentry>
28108   <term><parameter>handle</parameter></term>
28109   <listitem>
28110    <para>
28111     Handle of an ACPI namespace node, not used.
28112    </para>
28113   </listitem>
28114  </varlistentry>
28115  <varlistentry>
28116   <term><parameter>context</parameter></term>
28117   <listitem>
28118    <para>
28119     Address of the ACPI device object to drop.
28120    </para>
28121   </listitem>
28122  </varlistentry>
28123 </variablelist>
28124</refsect1>
28125<refsect1>
28126<title>Description</title>
28127<para>
28128   This is invoked by <function>acpi_ns_delete_node</function> during the removal of the ACPI
28129   namespace node the device object pointed to by <parameter>context</parameter> is attached to.
28130   </para><para>
28131
28132   The unregistration is carried out asynchronously to avoid running
28133   <function>acpi_device_del</function> under the ACPICA's namespace mutex and the list is used to
28134   ensure the correct ordering (the device objects must be unregistered in the
28135   same order in which the corresponding namespace nodes are deleted).
28136</para>
28137</refsect1>
28138</refentry>
28139
28140<refentry id="API-acpi-dma-supported">
28141<refentryinfo>
28142 <title>LINUX</title>
28143 <productname>Kernel Hackers Manual</productname>
28144 <date>July 2017</date>
28145</refentryinfo>
28146<refmeta>
28147 <refentrytitle><phrase>acpi_dma_supported</phrase></refentrytitle>
28148 <manvolnum>9</manvolnum>
28149 <refmiscinfo class="version">4.4.14</refmiscinfo>
28150</refmeta>
28151<refnamediv>
28152 <refname>acpi_dma_supported</refname>
28153 <refpurpose>
28154     Check DMA support for the specified device.
28155 </refpurpose>
28156</refnamediv>
28157<refsynopsisdiv>
28158 <title>Synopsis</title>
28159  <funcsynopsis><funcprototype>
28160   <funcdef>bool <function>acpi_dma_supported </function></funcdef>
28161   <paramdef>struct acpi_device * <parameter>adev</parameter></paramdef>
28162  </funcprototype></funcsynopsis>
28163</refsynopsisdiv>
28164<refsect1>
28165 <title>Arguments</title>
28166 <variablelist>
28167  <varlistentry>
28168   <term><parameter>adev</parameter></term>
28169   <listitem>
28170    <para>
28171     The pointer to acpi device
28172    </para>
28173   </listitem>
28174  </varlistentry>
28175 </variablelist>
28176</refsect1>
28177<refsect1>
28178<title>Description</title>
28179<para>
28180   Return false if DMA is not supported. Otherwise, return true
28181</para>
28182</refsect1>
28183</refentry>
28184
28185<refentry id="API-acpi-get-dma-attr">
28186<refentryinfo>
28187 <title>LINUX</title>
28188 <productname>Kernel Hackers Manual</productname>
28189 <date>July 2017</date>
28190</refentryinfo>
28191<refmeta>
28192 <refentrytitle><phrase>acpi_get_dma_attr</phrase></refentrytitle>
28193 <manvolnum>9</manvolnum>
28194 <refmiscinfo class="version">4.4.14</refmiscinfo>
28195</refmeta>
28196<refnamediv>
28197 <refname>acpi_get_dma_attr</refname>
28198 <refpurpose>
28199     Check the supported DMA attr for the specified device.
28200 </refpurpose>
28201</refnamediv>
28202<refsynopsisdiv>
28203 <title>Synopsis</title>
28204  <funcsynopsis><funcprototype>
28205   <funcdef>enum dev_dma_attr <function>acpi_get_dma_attr </function></funcdef>
28206   <paramdef>struct acpi_device * <parameter>adev</parameter></paramdef>
28207  </funcprototype></funcsynopsis>
28208</refsynopsisdiv>
28209<refsect1>
28210 <title>Arguments</title>
28211 <variablelist>
28212  <varlistentry>
28213   <term><parameter>adev</parameter></term>
28214   <listitem>
28215    <para>
28216     The pointer to acpi device
28217    </para>
28218   </listitem>
28219  </varlistentry>
28220 </variablelist>
28221</refsect1>
28222<refsect1>
28223<title>Description</title>
28224<para>
28225   Return enum dev_dma_attr.
28226</para>
28227</refsect1>
28228</refentry>
28229
28230<!-- No correct structured comments
28231X!Edrivers/acpi/pci_bind.c
28232-->
28233     </sect1>
28234     <sect1><title>Device drivers PnP support</title>
28235<!-- drivers/pnp/core.c -->
28236<refentry id="API-pnp-register-protocol">
28237<refentryinfo>
28238 <title>LINUX</title>
28239 <productname>Kernel Hackers Manual</productname>
28240 <date>July 2017</date>
28241</refentryinfo>
28242<refmeta>
28243 <refentrytitle><phrase>pnp_register_protocol</phrase></refentrytitle>
28244 <manvolnum>9</manvolnum>
28245 <refmiscinfo class="version">4.4.14</refmiscinfo>
28246</refmeta>
28247<refnamediv>
28248 <refname>pnp_register_protocol</refname>
28249 <refpurpose>
28250  adds a pnp protocol to the pnp layer
28251 </refpurpose>
28252</refnamediv>
28253<refsynopsisdiv>
28254 <title>Synopsis</title>
28255  <funcsynopsis><funcprototype>
28256   <funcdef>int <function>pnp_register_protocol </function></funcdef>
28257   <paramdef>struct pnp_protocol * <parameter>protocol</parameter></paramdef>
28258  </funcprototype></funcsynopsis>
28259</refsynopsisdiv>
28260<refsect1>
28261 <title>Arguments</title>
28262 <variablelist>
28263  <varlistentry>
28264   <term><parameter>protocol</parameter></term>
28265   <listitem>
28266    <para>
28267     pointer to the corresponding pnp_protocol structure
28268    </para>
28269   </listitem>
28270  </varlistentry>
28271 </variablelist>
28272</refsect1>
28273<refsect1>
28274<title>Ex protocols</title>
28275<para>
28276   ISAPNP, PNPBIOS, etc
28277</para>
28278</refsect1>
28279</refentry>
28280
28281<refentry id="API-pnp-unregister-protocol">
28282<refentryinfo>
28283 <title>LINUX</title>
28284 <productname>Kernel Hackers Manual</productname>
28285 <date>July 2017</date>
28286</refentryinfo>
28287<refmeta>
28288 <refentrytitle><phrase>pnp_unregister_protocol</phrase></refentrytitle>
28289 <manvolnum>9</manvolnum>
28290 <refmiscinfo class="version">4.4.14</refmiscinfo>
28291</refmeta>
28292<refnamediv>
28293 <refname>pnp_unregister_protocol</refname>
28294 <refpurpose>
28295     removes a pnp protocol from the pnp layer
28296 </refpurpose>
28297</refnamediv>
28298<refsynopsisdiv>
28299 <title>Synopsis</title>
28300  <funcsynopsis><funcprototype>
28301   <funcdef>void <function>pnp_unregister_protocol </function></funcdef>
28302   <paramdef>struct pnp_protocol * <parameter>protocol</parameter></paramdef>
28303  </funcprototype></funcsynopsis>
28304</refsynopsisdiv>
28305<refsect1>
28306 <title>Arguments</title>
28307 <variablelist>
28308  <varlistentry>
28309   <term><parameter>protocol</parameter></term>
28310   <listitem>
28311    <para>
28312     pointer to the corresponding pnp_protocol structure
28313    </para>
28314   </listitem>
28315  </varlistentry>
28316 </variablelist>
28317</refsect1>
28318</refentry>
28319
28320<!-- No correct structured comments
28321X!Edrivers/pnp/system.c
28322 -->
28323<!-- drivers/pnp/card.c -->
28324<refentry id="API-pnp-request-card-device">
28325<refentryinfo>
28326 <title>LINUX</title>
28327 <productname>Kernel Hackers Manual</productname>
28328 <date>July 2017</date>
28329</refentryinfo>
28330<refmeta>
28331 <refentrytitle><phrase>pnp_request_card_device</phrase></refentrytitle>
28332 <manvolnum>9</manvolnum>
28333 <refmiscinfo class="version">4.4.14</refmiscinfo>
28334</refmeta>
28335<refnamediv>
28336 <refname>pnp_request_card_device</refname>
28337 <refpurpose>
28338  Searches for a PnP device under the specified card
28339 </refpurpose>
28340</refnamediv>
28341<refsynopsisdiv>
28342 <title>Synopsis</title>
28343  <funcsynopsis><funcprototype>
28344   <funcdef>struct pnp_dev * <function>pnp_request_card_device </function></funcdef>
28345   <paramdef>struct pnp_card_link * <parameter>clink</parameter></paramdef>
28346   <paramdef>const char * <parameter>id</parameter></paramdef>
28347   <paramdef>struct pnp_dev * <parameter>from</parameter></paramdef>
28348  </funcprototype></funcsynopsis>
28349</refsynopsisdiv>
28350<refsect1>
28351 <title>Arguments</title>
28352 <variablelist>
28353  <varlistentry>
28354   <term><parameter>clink</parameter></term>
28355   <listitem>
28356    <para>
28357     pointer to the card link, cannot be NULL
28358    </para>
28359   </listitem>
28360  </varlistentry>
28361  <varlistentry>
28362   <term><parameter>id</parameter></term>
28363   <listitem>
28364    <para>
28365     pointer to a PnP ID structure that explains the rules for finding the device
28366    </para>
28367   </listitem>
28368  </varlistentry>
28369  <varlistentry>
28370   <term><parameter>from</parameter></term>
28371   <listitem>
28372    <para>
28373     Starting place to search from. If NULL it will start from the beginning.
28374    </para>
28375   </listitem>
28376  </varlistentry>
28377 </variablelist>
28378</refsect1>
28379</refentry>
28380
28381<refentry id="API-pnp-release-card-device">
28382<refentryinfo>
28383 <title>LINUX</title>
28384 <productname>Kernel Hackers Manual</productname>
28385 <date>July 2017</date>
28386</refentryinfo>
28387<refmeta>
28388 <refentrytitle><phrase>pnp_release_card_device</phrase></refentrytitle>
28389 <manvolnum>9</manvolnum>
28390 <refmiscinfo class="version">4.4.14</refmiscinfo>
28391</refmeta>
28392<refnamediv>
28393 <refname>pnp_release_card_device</refname>
28394 <refpurpose>
28395     call this when the driver no longer needs the device
28396 </refpurpose>
28397</refnamediv>
28398<refsynopsisdiv>
28399 <title>Synopsis</title>
28400  <funcsynopsis><funcprototype>
28401   <funcdef>void <function>pnp_release_card_device </function></funcdef>
28402   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
28403  </funcprototype></funcsynopsis>
28404</refsynopsisdiv>
28405<refsect1>
28406 <title>Arguments</title>
28407 <variablelist>
28408  <varlistentry>
28409   <term><parameter>dev</parameter></term>
28410   <listitem>
28411    <para>
28412     pointer to the PnP device structure
28413    </para>
28414   </listitem>
28415  </varlistentry>
28416 </variablelist>
28417</refsect1>
28418</refentry>
28419
28420<refentry id="API-pnp-register-card-driver">
28421<refentryinfo>
28422 <title>LINUX</title>
28423 <productname>Kernel Hackers Manual</productname>
28424 <date>July 2017</date>
28425</refentryinfo>
28426<refmeta>
28427 <refentrytitle><phrase>pnp_register_card_driver</phrase></refentrytitle>
28428 <manvolnum>9</manvolnum>
28429 <refmiscinfo class="version">4.4.14</refmiscinfo>
28430</refmeta>
28431<refnamediv>
28432 <refname>pnp_register_card_driver</refname>
28433 <refpurpose>
28434     registers a PnP card driver with the PnP Layer
28435 </refpurpose>
28436</refnamediv>
28437<refsynopsisdiv>
28438 <title>Synopsis</title>
28439  <funcsynopsis><funcprototype>
28440   <funcdef>int <function>pnp_register_card_driver </function></funcdef>
28441   <paramdef>struct pnp_card_driver * <parameter>drv</parameter></paramdef>
28442  </funcprototype></funcsynopsis>
28443</refsynopsisdiv>
28444<refsect1>
28445 <title>Arguments</title>
28446 <variablelist>
28447  <varlistentry>
28448   <term><parameter>drv</parameter></term>
28449   <listitem>
28450    <para>
28451     pointer to the driver to register
28452    </para>
28453   </listitem>
28454  </varlistentry>
28455 </variablelist>
28456</refsect1>
28457</refentry>
28458
28459<refentry id="API-pnp-unregister-card-driver">
28460<refentryinfo>
28461 <title>LINUX</title>
28462 <productname>Kernel Hackers Manual</productname>
28463 <date>July 2017</date>
28464</refentryinfo>
28465<refmeta>
28466 <refentrytitle><phrase>pnp_unregister_card_driver</phrase></refentrytitle>
28467 <manvolnum>9</manvolnum>
28468 <refmiscinfo class="version">4.4.14</refmiscinfo>
28469</refmeta>
28470<refnamediv>
28471 <refname>pnp_unregister_card_driver</refname>
28472 <refpurpose>
28473     unregisters a PnP card driver from the PnP Layer
28474 </refpurpose>
28475</refnamediv>
28476<refsynopsisdiv>
28477 <title>Synopsis</title>
28478  <funcsynopsis><funcprototype>
28479   <funcdef>void <function>pnp_unregister_card_driver </function></funcdef>
28480   <paramdef>struct pnp_card_driver * <parameter>drv</parameter></paramdef>
28481  </funcprototype></funcsynopsis>
28482</refsynopsisdiv>
28483<refsect1>
28484 <title>Arguments</title>
28485 <variablelist>
28486  <varlistentry>
28487   <term><parameter>drv</parameter></term>
28488   <listitem>
28489    <para>
28490     pointer to the driver to unregister
28491    </para>
28492   </listitem>
28493  </varlistentry>
28494 </variablelist>
28495</refsect1>
28496</refentry>
28497
28498<!-- drivers/pnp/driver.c -->
28499<refentry id="API-pnp-add-id">
28500<refentryinfo>
28501 <title>LINUX</title>
28502 <productname>Kernel Hackers Manual</productname>
28503 <date>July 2017</date>
28504</refentryinfo>
28505<refmeta>
28506 <refentrytitle><phrase>pnp_add_id</phrase></refentrytitle>
28507 <manvolnum>9</manvolnum>
28508 <refmiscinfo class="version">4.4.14</refmiscinfo>
28509</refmeta>
28510<refnamediv>
28511 <refname>pnp_add_id</refname>
28512 <refpurpose>
28513  adds an EISA id to the specified device
28514 </refpurpose>
28515</refnamediv>
28516<refsynopsisdiv>
28517 <title>Synopsis</title>
28518  <funcsynopsis><funcprototype>
28519   <funcdef>struct pnp_id * <function>pnp_add_id </function></funcdef>
28520   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
28521   <paramdef>const char * <parameter>id</parameter></paramdef>
28522  </funcprototype></funcsynopsis>
28523</refsynopsisdiv>
28524<refsect1>
28525 <title>Arguments</title>
28526 <variablelist>
28527  <varlistentry>
28528   <term><parameter>dev</parameter></term>
28529   <listitem>
28530    <para>
28531     pointer to the desired device
28532    </para>
28533   </listitem>
28534  </varlistentry>
28535  <varlistentry>
28536   <term><parameter>id</parameter></term>
28537   <listitem>
28538    <para>
28539     pointer to an EISA id string
28540    </para>
28541   </listitem>
28542  </varlistentry>
28543 </variablelist>
28544</refsect1>
28545</refentry>
28546
28547<!-- drivers/pnp/manager.c -->
28548<refentry id="API-pnp-start-dev">
28549<refentryinfo>
28550 <title>LINUX</title>
28551 <productname>Kernel Hackers Manual</productname>
28552 <date>July 2017</date>
28553</refentryinfo>
28554<refmeta>
28555 <refentrytitle><phrase>pnp_start_dev</phrase></refentrytitle>
28556 <manvolnum>9</manvolnum>
28557 <refmiscinfo class="version">4.4.14</refmiscinfo>
28558</refmeta>
28559<refnamediv>
28560 <refname>pnp_start_dev</refname>
28561 <refpurpose>
28562  low-level start of the PnP device
28563 </refpurpose>
28564</refnamediv>
28565<refsynopsisdiv>
28566 <title>Synopsis</title>
28567  <funcsynopsis><funcprototype>
28568   <funcdef>int <function>pnp_start_dev </function></funcdef>
28569   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
28570  </funcprototype></funcsynopsis>
28571</refsynopsisdiv>
28572<refsect1>
28573 <title>Arguments</title>
28574 <variablelist>
28575  <varlistentry>
28576   <term><parameter>dev</parameter></term>
28577   <listitem>
28578    <para>
28579     pointer to the desired device
28580    </para>
28581   </listitem>
28582  </varlistentry>
28583 </variablelist>
28584</refsect1>
28585<refsect1>
28586<title>Description</title>
28587<para>
28588   assumes that resources have already been allocated
28589</para>
28590</refsect1>
28591</refentry>
28592
28593<refentry id="API-pnp-stop-dev">
28594<refentryinfo>
28595 <title>LINUX</title>
28596 <productname>Kernel Hackers Manual</productname>
28597 <date>July 2017</date>
28598</refentryinfo>
28599<refmeta>
28600 <refentrytitle><phrase>pnp_stop_dev</phrase></refentrytitle>
28601 <manvolnum>9</manvolnum>
28602 <refmiscinfo class="version">4.4.14</refmiscinfo>
28603</refmeta>
28604<refnamediv>
28605 <refname>pnp_stop_dev</refname>
28606 <refpurpose>
28607     low-level disable of the PnP device
28608 </refpurpose>
28609</refnamediv>
28610<refsynopsisdiv>
28611 <title>Synopsis</title>
28612  <funcsynopsis><funcprototype>
28613   <funcdef>int <function>pnp_stop_dev </function></funcdef>
28614   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
28615  </funcprototype></funcsynopsis>
28616</refsynopsisdiv>
28617<refsect1>
28618 <title>Arguments</title>
28619 <variablelist>
28620  <varlistentry>
28621   <term><parameter>dev</parameter></term>
28622   <listitem>
28623    <para>
28624     pointer to the desired device
28625    </para>
28626   </listitem>
28627  </varlistentry>
28628 </variablelist>
28629</refsect1>
28630<refsect1>
28631<title>Description</title>
28632<para>
28633   does not free resources
28634</para>
28635</refsect1>
28636</refentry>
28637
28638<refentry id="API-pnp-activate-dev">
28639<refentryinfo>
28640 <title>LINUX</title>
28641 <productname>Kernel Hackers Manual</productname>
28642 <date>July 2017</date>
28643</refentryinfo>
28644<refmeta>
28645 <refentrytitle><phrase>pnp_activate_dev</phrase></refentrytitle>
28646 <manvolnum>9</manvolnum>
28647 <refmiscinfo class="version">4.4.14</refmiscinfo>
28648</refmeta>
28649<refnamediv>
28650 <refname>pnp_activate_dev</refname>
28651 <refpurpose>
28652     activates a PnP device for use
28653 </refpurpose>
28654</refnamediv>
28655<refsynopsisdiv>
28656 <title>Synopsis</title>
28657  <funcsynopsis><funcprototype>
28658   <funcdef>int <function>pnp_activate_dev </function></funcdef>
28659   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
28660  </funcprototype></funcsynopsis>
28661</refsynopsisdiv>
28662<refsect1>
28663 <title>Arguments</title>
28664 <variablelist>
28665  <varlistentry>
28666   <term><parameter>dev</parameter></term>
28667   <listitem>
28668    <para>
28669     pointer to the desired device
28670    </para>
28671   </listitem>
28672  </varlistentry>
28673 </variablelist>
28674</refsect1>
28675<refsect1>
28676<title>Description</title>
28677<para>
28678   does not validate or set resources so be careful.
28679</para>
28680</refsect1>
28681</refentry>
28682
28683<refentry id="API-pnp-disable-dev">
28684<refentryinfo>
28685 <title>LINUX</title>
28686 <productname>Kernel Hackers Manual</productname>
28687 <date>July 2017</date>
28688</refentryinfo>
28689<refmeta>
28690 <refentrytitle><phrase>pnp_disable_dev</phrase></refentrytitle>
28691 <manvolnum>9</manvolnum>
28692 <refmiscinfo class="version">4.4.14</refmiscinfo>
28693</refmeta>
28694<refnamediv>
28695 <refname>pnp_disable_dev</refname>
28696 <refpurpose>
28697     disables device
28698 </refpurpose>
28699</refnamediv>
28700<refsynopsisdiv>
28701 <title>Synopsis</title>
28702  <funcsynopsis><funcprototype>
28703   <funcdef>int <function>pnp_disable_dev </function></funcdef>
28704   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
28705  </funcprototype></funcsynopsis>
28706</refsynopsisdiv>
28707<refsect1>
28708 <title>Arguments</title>
28709 <variablelist>
28710  <varlistentry>
28711   <term><parameter>dev</parameter></term>
28712   <listitem>
28713    <para>
28714     pointer to the desired device
28715    </para>
28716   </listitem>
28717  </varlistentry>
28718 </variablelist>
28719</refsect1>
28720<refsect1>
28721<title>Description</title>
28722<para>
28723   inform the correct pnp protocol so that resources can be used by other devices
28724</para>
28725</refsect1>
28726</refentry>
28727
28728<!-- drivers/pnp/support.c -->
28729<refentry id="API-pnp-is-active">
28730<refentryinfo>
28731 <title>LINUX</title>
28732 <productname>Kernel Hackers Manual</productname>
28733 <date>July 2017</date>
28734</refentryinfo>
28735<refmeta>
28736 <refentrytitle><phrase>pnp_is_active</phrase></refentrytitle>
28737 <manvolnum>9</manvolnum>
28738 <refmiscinfo class="version">4.4.14</refmiscinfo>
28739</refmeta>
28740<refnamediv>
28741 <refname>pnp_is_active</refname>
28742 <refpurpose>
28743  Determines if a device is active based on its current resources
28744 </refpurpose>
28745</refnamediv>
28746<refsynopsisdiv>
28747 <title>Synopsis</title>
28748  <funcsynopsis><funcprototype>
28749   <funcdef>int <function>pnp_is_active </function></funcdef>
28750   <paramdef>struct pnp_dev * <parameter>dev</parameter></paramdef>
28751  </funcprototype></funcsynopsis>
28752</refsynopsisdiv>
28753<refsect1>
28754 <title>Arguments</title>
28755 <variablelist>
28756  <varlistentry>
28757   <term><parameter>dev</parameter></term>
28758   <listitem>
28759    <para>
28760     pointer to the desired PnP device
28761    </para>
28762   </listitem>
28763  </varlistentry>
28764 </variablelist>
28765</refsect1>
28766</refentry>
28767
28768     </sect1>
28769     <sect1><title>Userspace IO devices</title>
28770<!-- drivers/uio/uio.c -->
28771<refentry id="API-uio-event-notify">
28772<refentryinfo>
28773 <title>LINUX</title>
28774 <productname>Kernel Hackers Manual</productname>
28775 <date>July 2017</date>
28776</refentryinfo>
28777<refmeta>
28778 <refentrytitle><phrase>uio_event_notify</phrase></refentrytitle>
28779 <manvolnum>9</manvolnum>
28780 <refmiscinfo class="version">4.4.14</refmiscinfo>
28781</refmeta>
28782<refnamediv>
28783 <refname>uio_event_notify</refname>
28784 <refpurpose>
28785  trigger an interrupt event
28786 </refpurpose>
28787</refnamediv>
28788<refsynopsisdiv>
28789 <title>Synopsis</title>
28790  <funcsynopsis><funcprototype>
28791   <funcdef>void <function>uio_event_notify </function></funcdef>
28792   <paramdef><link linkend="API-struct-uio-info">struct uio_info</link> * <parameter>info</parameter></paramdef>
28793  </funcprototype></funcsynopsis>
28794</refsynopsisdiv>
28795<refsect1>
28796 <title>Arguments</title>
28797 <variablelist>
28798  <varlistentry>
28799   <term><parameter>info</parameter></term>
28800   <listitem>
28801    <para>
28802     UIO device capabilities
28803    </para>
28804   </listitem>
28805  </varlistentry>
28806 </variablelist>
28807</refsect1>
28808</refentry>
28809
28810<refentry id="API---uio-register-device">
28811<refentryinfo>
28812 <title>LINUX</title>
28813 <productname>Kernel Hackers Manual</productname>
28814 <date>July 2017</date>
28815</refentryinfo>
28816<refmeta>
28817 <refentrytitle><phrase>__uio_register_device</phrase></refentrytitle>
28818 <manvolnum>9</manvolnum>
28819 <refmiscinfo class="version">4.4.14</refmiscinfo>
28820</refmeta>
28821<refnamediv>
28822 <refname>__uio_register_device</refname>
28823 <refpurpose>
28824     register a new userspace IO device
28825 </refpurpose>
28826</refnamediv>
28827<refsynopsisdiv>
28828 <title>Synopsis</title>
28829  <funcsynopsis><funcprototype>
28830   <funcdef>int <function>__uio_register_device </function></funcdef>
28831   <paramdef>struct module * <parameter>owner</parameter></paramdef>
28832   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
28833   <paramdef><link linkend="API-struct-uio-info">struct uio_info</link> * <parameter>info</parameter></paramdef>
28834  </funcprototype></funcsynopsis>
28835</refsynopsisdiv>
28836<refsect1>
28837 <title>Arguments</title>
28838 <variablelist>
28839  <varlistentry>
28840   <term><parameter>owner</parameter></term>
28841   <listitem>
28842    <para>
28843     module that creates the new device
28844    </para>
28845   </listitem>
28846  </varlistentry>
28847  <varlistentry>
28848   <term><parameter>parent</parameter></term>
28849   <listitem>
28850    <para>
28851     parent device
28852    </para>
28853   </listitem>
28854  </varlistentry>
28855  <varlistentry>
28856   <term><parameter>info</parameter></term>
28857   <listitem>
28858    <para>
28859     UIO device capabilities
28860    </para>
28861   </listitem>
28862  </varlistentry>
28863 </variablelist>
28864</refsect1>
28865<refsect1>
28866<title>Description</title>
28867<para>
28868   returns zero on success or a negative error code.
28869</para>
28870</refsect1>
28871</refentry>
28872
28873<refentry id="API-uio-unregister-device">
28874<refentryinfo>
28875 <title>LINUX</title>
28876 <productname>Kernel Hackers Manual</productname>
28877 <date>July 2017</date>
28878</refentryinfo>
28879<refmeta>
28880 <refentrytitle><phrase>uio_unregister_device</phrase></refentrytitle>
28881 <manvolnum>9</manvolnum>
28882 <refmiscinfo class="version">4.4.14</refmiscinfo>
28883</refmeta>
28884<refnamediv>
28885 <refname>uio_unregister_device</refname>
28886 <refpurpose>
28887     unregister a industrial IO device
28888 </refpurpose>
28889</refnamediv>
28890<refsynopsisdiv>
28891 <title>Synopsis</title>
28892  <funcsynopsis><funcprototype>
28893   <funcdef>void <function>uio_unregister_device </function></funcdef>
28894   <paramdef><link linkend="API-struct-uio-info">struct uio_info</link> * <parameter>info</parameter></paramdef>
28895  </funcprototype></funcsynopsis>
28896</refsynopsisdiv>
28897<refsect1>
28898 <title>Arguments</title>
28899 <variablelist>
28900  <varlistentry>
28901   <term><parameter>info</parameter></term>
28902   <listitem>
28903    <para>
28904     UIO device capabilities
28905    </para>
28906   </listitem>
28907  </varlistentry>
28908 </variablelist>
28909</refsect1>
28910</refentry>
28911
28912<!-- include/linux/uio_driver.h -->
28913<refentry id="API-struct-uio-mem">
28914<refentryinfo>
28915 <title>LINUX</title>
28916 <productname>Kernel Hackers Manual</productname>
28917 <date>July 2017</date>
28918</refentryinfo>
28919<refmeta>
28920 <refentrytitle><phrase>struct uio_mem</phrase></refentrytitle>
28921 <manvolnum>9</manvolnum>
28922 <refmiscinfo class="version">4.4.14</refmiscinfo>
28923</refmeta>
28924<refnamediv>
28925 <refname>struct uio_mem</refname>
28926 <refpurpose>
28927  description of a UIO memory region
28928 </refpurpose>
28929</refnamediv>
28930<refsynopsisdiv>
28931 <title>Synopsis</title>
28932  <programlisting>
28933struct uio_mem {
28934  const char * name;
28935  phys_addr_t addr;
28936  resource_size_t size;
28937  int memtype;
28938  void __iomem * internal_addr;
28939  struct uio_map * map;
28940};  </programlisting>
28941</refsynopsisdiv>
28942 <refsect1>
28943  <title>Members</title>
28944  <variablelist>
28945    <varlistentry>      <term>name</term>
28946      <listitem><para>
28947name of the memory region for identification
28948      </para></listitem>
28949    </varlistentry>
28950    <varlistentry>      <term>addr</term>
28951      <listitem><para>
28952address of the device's memory (phys_addr is used since
28953addr can be logical, virtual, or physical &amp; phys_addr_t
28954should always be large enough to handle any of the
28955address types)
28956      </para></listitem>
28957    </varlistentry>
28958    <varlistentry>      <term>size</term>
28959      <listitem><para>
28960size of IO
28961      </para></listitem>
28962    </varlistentry>
28963    <varlistentry>      <term>memtype</term>
28964      <listitem><para>
28965type of memory addr points to
28966      </para></listitem>
28967    </varlistentry>
28968    <varlistentry>      <term>internal_addr</term>
28969      <listitem><para>
28970ioremap-ped version of addr, for driver internal use
28971      </para></listitem>
28972    </varlistentry>
28973    <varlistentry>      <term>map</term>
28974      <listitem><para>
28975for use by the UIO core only.
28976      </para></listitem>
28977    </varlistentry>
28978  </variablelist>
28979 </refsect1>
28980</refentry>
28981
28982<refentry id="API-struct-uio-port">
28983<refentryinfo>
28984 <title>LINUX</title>
28985 <productname>Kernel Hackers Manual</productname>
28986 <date>July 2017</date>
28987</refentryinfo>
28988<refmeta>
28989 <refentrytitle><phrase>struct uio_port</phrase></refentrytitle>
28990 <manvolnum>9</manvolnum>
28991 <refmiscinfo class="version">4.4.14</refmiscinfo>
28992</refmeta>
28993<refnamediv>
28994 <refname>struct uio_port</refname>
28995 <refpurpose>
28996     description of a UIO port region
28997 </refpurpose>
28998</refnamediv>
28999<refsynopsisdiv>
29000 <title>Synopsis</title>
29001  <programlisting>
29002struct uio_port {
29003  const char * name;
29004  unsigned long start;
29005  unsigned long size;
29006  int porttype;
29007  struct uio_portio * portio;
29008};  </programlisting>
29009</refsynopsisdiv>
29010 <refsect1>
29011  <title>Members</title>
29012  <variablelist>
29013    <varlistentry>      <term>name</term>
29014      <listitem><para>
29015   name of the port region for identification
29016      </para></listitem>
29017    </varlistentry>
29018    <varlistentry>      <term>start</term>
29019      <listitem><para>
29020   start of port region
29021      </para></listitem>
29022    </varlistentry>
29023    <varlistentry>      <term>size</term>
29024      <listitem><para>
29025   size of port region
29026      </para></listitem>
29027    </varlistentry>
29028    <varlistentry>      <term>porttype</term>
29029      <listitem><para>
29030   type of port (see UIO_PORT_* below)
29031      </para></listitem>
29032    </varlistentry>
29033    <varlistentry>      <term>portio</term>
29034      <listitem><para>
29035   for use by the UIO core only.
29036      </para></listitem>
29037    </varlistentry>
29038  </variablelist>
29039 </refsect1>
29040</refentry>
29041
29042<refentry id="API-struct-uio-info">
29043<refentryinfo>
29044 <title>LINUX</title>
29045 <productname>Kernel Hackers Manual</productname>
29046 <date>July 2017</date>
29047</refentryinfo>
29048<refmeta>
29049 <refentrytitle><phrase>struct uio_info</phrase></refentrytitle>
29050 <manvolnum>9</manvolnum>
29051 <refmiscinfo class="version">4.4.14</refmiscinfo>
29052</refmeta>
29053<refnamediv>
29054 <refname>struct uio_info</refname>
29055 <refpurpose>
29056     UIO device capabilities
29057 </refpurpose>
29058</refnamediv>
29059<refsynopsisdiv>
29060 <title>Synopsis</title>
29061  <programlisting>
29062struct uio_info {
29063  struct uio_device * uio_dev;
29064  const char * name;
29065  const char * version;
29066  struct uio_mem mem[MAX_UIO_MAPS];
29067  struct uio_port port[MAX_UIO_PORT_REGIONS];
29068  long irq;
29069  unsigned long irq_flags;
29070  void * priv;
29071  irqreturn_t (* handler) (int irq, struct uio_info *dev_info);
29072  int (* mmap) (struct uio_info *info, struct vm_area_struct *vma);
29073  int (* open) (struct uio_info *info, struct inode *inode);
29074  int (* release) (struct uio_info *info, struct inode *inode);
29075  int (* irqcontrol) (struct uio_info *info, s32 irq_on);
29076};  </programlisting>
29077</refsynopsisdiv>
29078 <refsect1>
29079  <title>Members</title>
29080  <variablelist>
29081    <varlistentry>      <term>uio_dev</term>
29082      <listitem><para>
29083   the UIO device this info belongs to
29084      </para></listitem>
29085    </varlistentry>
29086    <varlistentry>      <term>name</term>
29087      <listitem><para>
29088   device name
29089      </para></listitem>
29090    </varlistentry>
29091    <varlistentry>      <term>version</term>
29092      <listitem><para>
29093   device driver version
29094      </para></listitem>
29095    </varlistentry>
29096    <varlistentry>      <term>mem[MAX_UIO_MAPS]</term>
29097      <listitem><para>
29098   list of mappable memory regions, size==0 for end of list
29099      </para></listitem>
29100    </varlistentry>
29101    <varlistentry>      <term>port[MAX_UIO_PORT_REGIONS]</term>
29102      <listitem><para>
29103   list of port regions, size==0 for end of list
29104      </para></listitem>
29105    </varlistentry>
29106    <varlistentry>      <term>irq</term>
29107      <listitem><para>
29108   interrupt number or UIO_IRQ_CUSTOM
29109      </para></listitem>
29110    </varlistentry>
29111    <varlistentry>      <term>irq_flags</term>
29112      <listitem><para>
29113   flags for <function>request_irq</function>
29114      </para></listitem>
29115    </varlistentry>
29116    <varlistentry>      <term>priv</term>
29117      <listitem><para>
29118   optional private data
29119      </para></listitem>
29120    </varlistentry>
29121    <varlistentry>      <term>handler</term>
29122      <listitem><para>
29123   the device's irq handler
29124      </para></listitem>
29125    </varlistentry>
29126    <varlistentry>      <term>mmap</term>
29127      <listitem><para>
29128   mmap operation for this uio device
29129      </para></listitem>
29130    </varlistentry>
29131    <varlistentry>      <term>open</term>
29132      <listitem><para>
29133   open operation for this uio device
29134      </para></listitem>
29135    </varlistentry>
29136    <varlistentry>      <term>release</term>
29137      <listitem><para>
29138   release operation for this uio device
29139      </para></listitem>
29140    </varlistentry>
29141    <varlistentry>      <term>irqcontrol</term>
29142      <listitem><para>
29143   disable/enable irqs when 0/1 is written to /dev/uioX
29144      </para></listitem>
29145    </varlistentry>
29146  </variablelist>
29147 </refsect1>
29148</refentry>
29149
29150     </sect1>
29151  </chapter>
29152
29153  <chapter id="parportdev">
29154     <title>Parallel Port Devices</title>
29155<!-- include/linux/parport.h -->
29156<refentry id="API-parport-yield">
29157<refentryinfo>
29158 <title>LINUX</title>
29159 <productname>Kernel Hackers Manual</productname>
29160 <date>July 2017</date>
29161</refentryinfo>
29162<refmeta>
29163 <refentrytitle><phrase>parport_yield</phrase></refentrytitle>
29164 <manvolnum>9</manvolnum>
29165 <refmiscinfo class="version">4.4.14</refmiscinfo>
29166</refmeta>
29167<refnamediv>
29168 <refname>parport_yield</refname>
29169 <refpurpose>
29170  relinquish a parallel port temporarily
29171 </refpurpose>
29172</refnamediv>
29173<refsynopsisdiv>
29174 <title>Synopsis</title>
29175  <funcsynopsis><funcprototype>
29176   <funcdef>int <function>parport_yield </function></funcdef>
29177   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
29178  </funcprototype></funcsynopsis>
29179</refsynopsisdiv>
29180<refsect1>
29181 <title>Arguments</title>
29182 <variablelist>
29183  <varlistentry>
29184   <term><parameter>dev</parameter></term>
29185   <listitem>
29186    <para>
29187     a device on the parallel port
29188    </para>
29189   </listitem>
29190  </varlistentry>
29191 </variablelist>
29192</refsect1>
29193<refsect1>
29194<title>Description</title>
29195<para>
29196   This function relinquishes the port if it would be helpful to other
29197   drivers to do so.  Afterwards it tries to reclaim the port using
29198   <function><link linkend="API-parport-claim">parport_claim</link></function>, and the return value is the same as for
29199   <function><link linkend="API-parport-claim">parport_claim</link></function>.  If it fails, the port is left unclaimed and it is
29200   the driver's responsibility to reclaim the port.
29201   </para><para>
29202
29203   The <function><link linkend="API-parport-yield">parport_yield</link></function> and <function><link linkend="API-parport-yield-blocking">parport_yield_blocking</link></function> functions are for
29204   marking points in the driver at which other drivers may claim the
29205   port and use their devices.  Yielding the port is similar to
29206   releasing it and reclaiming it, but is more efficient because no
29207   action is taken if there are no other devices needing the port.  In
29208   fact, nothing is done even if there are other devices waiting but
29209   the current device is still within its <quote>timeslice</quote>.  The default
29210   timeslice is half a second, but it can be adjusted via the /proc
29211   interface.
29212</para>
29213</refsect1>
29214</refentry>
29215
29216<refentry id="API-parport-yield-blocking">
29217<refentryinfo>
29218 <title>LINUX</title>
29219 <productname>Kernel Hackers Manual</productname>
29220 <date>July 2017</date>
29221</refentryinfo>
29222<refmeta>
29223 <refentrytitle><phrase>parport_yield_blocking</phrase></refentrytitle>
29224 <manvolnum>9</manvolnum>
29225 <refmiscinfo class="version">4.4.14</refmiscinfo>
29226</refmeta>
29227<refnamediv>
29228 <refname>parport_yield_blocking</refname>
29229 <refpurpose>
29230     relinquish a parallel port temporarily
29231 </refpurpose>
29232</refnamediv>
29233<refsynopsisdiv>
29234 <title>Synopsis</title>
29235  <funcsynopsis><funcprototype>
29236   <funcdef>int <function>parport_yield_blocking </function></funcdef>
29237   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
29238  </funcprototype></funcsynopsis>
29239</refsynopsisdiv>
29240<refsect1>
29241 <title>Arguments</title>
29242 <variablelist>
29243  <varlistentry>
29244   <term><parameter>dev</parameter></term>
29245   <listitem>
29246    <para>
29247     a device on the parallel port
29248    </para>
29249   </listitem>
29250  </varlistentry>
29251 </variablelist>
29252</refsect1>
29253<refsect1>
29254<title>Description</title>
29255<para>
29256   This function relinquishes the port if it would be helpful to other
29257   drivers to do so.  Afterwards it tries to reclaim the port using
29258   <function><link linkend="API-parport-claim-or-block">parport_claim_or_block</link></function>, and the return value is the same as for
29259   <function><link linkend="API-parport-claim-or-block">parport_claim_or_block</link></function>.
29260</para>
29261</refsect1>
29262</refentry>
29263
29264<!-- drivers/parport/ieee1284.c -->
29265<refentry id="API-parport-wait-event">
29266<refentryinfo>
29267 <title>LINUX</title>
29268 <productname>Kernel Hackers Manual</productname>
29269 <date>July 2017</date>
29270</refentryinfo>
29271<refmeta>
29272 <refentrytitle><phrase>parport_wait_event</phrase></refentrytitle>
29273 <manvolnum>9</manvolnum>
29274 <refmiscinfo class="version">4.4.14</refmiscinfo>
29275</refmeta>
29276<refnamediv>
29277 <refname>parport_wait_event</refname>
29278 <refpurpose>
29279  wait for an event on a parallel port
29280 </refpurpose>
29281</refnamediv>
29282<refsynopsisdiv>
29283 <title>Synopsis</title>
29284  <funcsynopsis><funcprototype>
29285   <funcdef>int <function>parport_wait_event </function></funcdef>
29286   <paramdef>struct parport * <parameter>port</parameter></paramdef>
29287   <paramdef>signed long <parameter>timeout</parameter></paramdef>
29288  </funcprototype></funcsynopsis>
29289</refsynopsisdiv>
29290<refsect1>
29291 <title>Arguments</title>
29292 <variablelist>
29293  <varlistentry>
29294   <term><parameter>port</parameter></term>
29295   <listitem>
29296    <para>
29297     port to wait on
29298    </para>
29299   </listitem>
29300  </varlistentry>
29301  <varlistentry>
29302   <term><parameter>timeout</parameter></term>
29303   <listitem>
29304    <para>
29305     time to wait (in jiffies)
29306    </para>
29307   </listitem>
29308  </varlistentry>
29309 </variablelist>
29310</refsect1>
29311<refsect1>
29312<title>Description</title>
29313<para>
29314   This function waits for up to <parameter>timeout</parameter> jiffies for an
29315   interrupt to occur on a parallel port.  If the port timeout is
29316   set to zero, it returns immediately.
29317   </para><para>
29318
29319   If an interrupt occurs before the timeout period elapses, this
29320   function returns zero immediately.  If it times out, it returns
29321   one.  An error code less than zero indicates an error (most
29322   likely a pending signal), and the calling code should finish
29323   what it's doing as soon as it can.
29324</para>
29325</refsect1>
29326</refentry>
29327
29328<refentry id="API-parport-wait-peripheral">
29329<refentryinfo>
29330 <title>LINUX</title>
29331 <productname>Kernel Hackers Manual</productname>
29332 <date>July 2017</date>
29333</refentryinfo>
29334<refmeta>
29335 <refentrytitle><phrase>parport_wait_peripheral</phrase></refentrytitle>
29336 <manvolnum>9</manvolnum>
29337 <refmiscinfo class="version">4.4.14</refmiscinfo>
29338</refmeta>
29339<refnamediv>
29340 <refname>parport_wait_peripheral</refname>
29341 <refpurpose>
29342     wait for status lines to change in 35ms
29343 </refpurpose>
29344</refnamediv>
29345<refsynopsisdiv>
29346 <title>Synopsis</title>
29347  <funcsynopsis><funcprototype>
29348   <funcdef>int <function>parport_wait_peripheral </function></funcdef>
29349   <paramdef>struct parport * <parameter>port</parameter></paramdef>
29350   <paramdef>unsigned char <parameter>mask</parameter></paramdef>
29351   <paramdef>unsigned char <parameter>result</parameter></paramdef>
29352  </funcprototype></funcsynopsis>
29353</refsynopsisdiv>
29354<refsect1>
29355 <title>Arguments</title>
29356 <variablelist>
29357  <varlistentry>
29358   <term><parameter>port</parameter></term>
29359   <listitem>
29360    <para>
29361     port to watch
29362    </para>
29363   </listitem>
29364  </varlistentry>
29365  <varlistentry>
29366   <term><parameter>mask</parameter></term>
29367   <listitem>
29368    <para>
29369     status lines to watch
29370    </para>
29371   </listitem>
29372  </varlistentry>
29373  <varlistentry>
29374   <term><parameter>result</parameter></term>
29375   <listitem>
29376    <para>
29377     desired values of chosen status lines
29378    </para>
29379   </listitem>
29380  </varlistentry>
29381 </variablelist>
29382</refsect1>
29383<refsect1>
29384<title>Description</title>
29385<para>
29386   This function waits until the masked status lines have the
29387   desired values, or until 35ms have elapsed (see IEEE 1284-1994
29388   page 24 to 25 for why this value in particular is hardcoded).
29389   The <parameter>mask</parameter> and <parameter>result</parameter> parameters are bitmasks, with the bits
29390   defined by the constants in parport.h: <constant>PARPORT_STATUS_BUSY</constant>,
29391   and so on.
29392   </para><para>
29393
29394   The port is polled quickly to start off with, in anticipation
29395   of a fast response from the peripheral.  This fast polling
29396   time is configurable (using /proc), and defaults to 500usec.
29397   If the timeout for this port (see <function><link linkend="API-parport-set-timeout">parport_set_timeout</link></function>) is
29398   zero, the fast polling time is 35ms, and this function does
29399   not call <function>schedule</function>.
29400   </para><para>
29401
29402   If the timeout for this port is non-zero, after the fast
29403   polling fails it uses <function><link linkend="API-parport-wait-event">parport_wait_event</link></function> to wait for up to
29404   10ms, waking up if an interrupt occurs.
29405</para>
29406</refsect1>
29407</refentry>
29408
29409<refentry id="API-parport-negotiate">
29410<refentryinfo>
29411 <title>LINUX</title>
29412 <productname>Kernel Hackers Manual</productname>
29413 <date>July 2017</date>
29414</refentryinfo>
29415<refmeta>
29416 <refentrytitle><phrase>parport_negotiate</phrase></refentrytitle>
29417 <manvolnum>9</manvolnum>
29418 <refmiscinfo class="version">4.4.14</refmiscinfo>
29419</refmeta>
29420<refnamediv>
29421 <refname>parport_negotiate</refname>
29422 <refpurpose>
29423     negotiate an IEEE 1284 mode
29424 </refpurpose>
29425</refnamediv>
29426<refsynopsisdiv>
29427 <title>Synopsis</title>
29428  <funcsynopsis><funcprototype>
29429   <funcdef>int <function>parport_negotiate </function></funcdef>
29430   <paramdef>struct parport * <parameter>port</parameter></paramdef>
29431   <paramdef>int <parameter>mode</parameter></paramdef>
29432  </funcprototype></funcsynopsis>
29433</refsynopsisdiv>
29434<refsect1>
29435 <title>Arguments</title>
29436 <variablelist>
29437  <varlistentry>
29438   <term><parameter>port</parameter></term>
29439   <listitem>
29440    <para>
29441     port to use
29442    </para>
29443   </listitem>
29444  </varlistentry>
29445  <varlistentry>
29446   <term><parameter>mode</parameter></term>
29447   <listitem>
29448    <para>
29449     mode to negotiate to
29450    </para>
29451   </listitem>
29452  </varlistentry>
29453 </variablelist>
29454</refsect1>
29455<refsect1>
29456<title>Description</title>
29457<para>
29458   Use this to negotiate to a particular IEEE 1284 transfer mode.
29459   The <parameter>mode</parameter> parameter should be one of the constants in
29460   parport.h starting <constant>IEEE1284_MODE_xxx</constant>.
29461   </para><para>
29462
29463   The return value is 0 if the peripheral has accepted the
29464   negotiation to the mode specified, -1 if the peripheral is not
29465   IEEE 1284 compliant (or not present), or 1 if the peripheral
29466   has rejected the negotiation.
29467</para>
29468</refsect1>
29469</refentry>
29470
29471<refentry id="API-parport-write">
29472<refentryinfo>
29473 <title>LINUX</title>
29474 <productname>Kernel Hackers Manual</productname>
29475 <date>July 2017</date>
29476</refentryinfo>
29477<refmeta>
29478 <refentrytitle><phrase>parport_write</phrase></refentrytitle>
29479 <manvolnum>9</manvolnum>
29480 <refmiscinfo class="version">4.4.14</refmiscinfo>
29481</refmeta>
29482<refnamediv>
29483 <refname>parport_write</refname>
29484 <refpurpose>
29485     write a block of data to a parallel port
29486 </refpurpose>
29487</refnamediv>
29488<refsynopsisdiv>
29489 <title>Synopsis</title>
29490  <funcsynopsis><funcprototype>
29491   <funcdef>ssize_t <function>parport_write </function></funcdef>
29492   <paramdef>struct parport * <parameter>port</parameter></paramdef>
29493   <paramdef>const void * <parameter>buffer</parameter></paramdef>
29494   <paramdef>size_t <parameter>len</parameter></paramdef>
29495  </funcprototype></funcsynopsis>
29496</refsynopsisdiv>
29497<refsect1>
29498 <title>Arguments</title>
29499 <variablelist>
29500  <varlistentry>
29501   <term><parameter>port</parameter></term>
29502   <listitem>
29503    <para>
29504     port to write to
29505    </para>
29506   </listitem>
29507  </varlistentry>
29508  <varlistentry>
29509   <term><parameter>buffer</parameter></term>
29510   <listitem>
29511    <para>
29512     data buffer (in kernel space)
29513    </para>
29514   </listitem>
29515  </varlistentry>
29516  <varlistentry>
29517   <term><parameter>len</parameter></term>
29518   <listitem>
29519    <para>
29520     number of bytes of data to transfer
29521    </para>
29522   </listitem>
29523  </varlistentry>
29524 </variablelist>
29525</refsect1>
29526<refsect1>
29527<title>Description</title>
29528<para>
29529   This will write up to <parameter>len</parameter> bytes of <parameter>buffer</parameter> to the port
29530   specified, using the IEEE 1284 transfer mode most recently
29531   negotiated to (using <function><link linkend="API-parport-negotiate">parport_negotiate</link></function>), as long as that
29532   mode supports forward transfers (host to peripheral).
29533   </para><para>
29534
29535   It is the caller's responsibility to ensure that the first
29536   <parameter>len</parameter> bytes of <parameter>buffer</parameter> are valid.
29537   </para><para>
29538
29539   This function returns the number of bytes transferred (if zero
29540   or positive), or else an error code.
29541</para>
29542</refsect1>
29543</refentry>
29544
29545<refentry id="API-parport-read">
29546<refentryinfo>
29547 <title>LINUX</title>
29548 <productname>Kernel Hackers Manual</productname>
29549 <date>July 2017</date>
29550</refentryinfo>
29551<refmeta>
29552 <refentrytitle><phrase>parport_read</phrase></refentrytitle>
29553 <manvolnum>9</manvolnum>
29554 <refmiscinfo class="version">4.4.14</refmiscinfo>
29555</refmeta>
29556<refnamediv>
29557 <refname>parport_read</refname>
29558 <refpurpose>
29559     read a block of data from a parallel port
29560 </refpurpose>
29561</refnamediv>
29562<refsynopsisdiv>
29563 <title>Synopsis</title>
29564  <funcsynopsis><funcprototype>
29565   <funcdef>ssize_t <function>parport_read </function></funcdef>
29566   <paramdef>struct parport * <parameter>port</parameter></paramdef>
29567   <paramdef>void * <parameter>buffer</parameter></paramdef>
29568   <paramdef>size_t <parameter>len</parameter></paramdef>
29569  </funcprototype></funcsynopsis>
29570</refsynopsisdiv>
29571<refsect1>
29572 <title>Arguments</title>
29573 <variablelist>
29574  <varlistentry>
29575   <term><parameter>port</parameter></term>
29576   <listitem>
29577    <para>
29578     port to read from
29579    </para>
29580   </listitem>
29581  </varlistentry>
29582  <varlistentry>
29583   <term><parameter>buffer</parameter></term>
29584   <listitem>
29585    <para>
29586     data buffer (in kernel space)
29587    </para>
29588   </listitem>
29589  </varlistentry>
29590  <varlistentry>
29591   <term><parameter>len</parameter></term>
29592   <listitem>
29593    <para>
29594     number of bytes of data to transfer
29595    </para>
29596   </listitem>
29597  </varlistentry>
29598 </variablelist>
29599</refsect1>
29600<refsect1>
29601<title>Description</title>
29602<para>
29603   This will read up to <parameter>len</parameter> bytes of <parameter>buffer</parameter> to the port
29604   specified, using the IEEE 1284 transfer mode most recently
29605   negotiated to (using <function><link linkend="API-parport-negotiate">parport_negotiate</link></function>), as long as that
29606   mode supports reverse transfers (peripheral to host).
29607   </para><para>
29608
29609   It is the caller's responsibility to ensure that the first
29610   <parameter>len</parameter> bytes of <parameter>buffer</parameter> are available to write to.
29611   </para><para>
29612
29613   This function returns the number of bytes transferred (if zero
29614   or positive), or else an error code.
29615</para>
29616</refsect1>
29617</refentry>
29618
29619<refentry id="API-parport-set-timeout">
29620<refentryinfo>
29621 <title>LINUX</title>
29622 <productname>Kernel Hackers Manual</productname>
29623 <date>July 2017</date>
29624</refentryinfo>
29625<refmeta>
29626 <refentrytitle><phrase>parport_set_timeout</phrase></refentrytitle>
29627 <manvolnum>9</manvolnum>
29628 <refmiscinfo class="version">4.4.14</refmiscinfo>
29629</refmeta>
29630<refnamediv>
29631 <refname>parport_set_timeout</refname>
29632 <refpurpose>
29633     set the inactivity timeout for a device
29634 </refpurpose>
29635</refnamediv>
29636<refsynopsisdiv>
29637 <title>Synopsis</title>
29638  <funcsynopsis><funcprototype>
29639   <funcdef>long <function>parport_set_timeout </function></funcdef>
29640   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
29641   <paramdef>long <parameter>inactivity</parameter></paramdef>
29642  </funcprototype></funcsynopsis>
29643</refsynopsisdiv>
29644<refsect1>
29645 <title>Arguments</title>
29646 <variablelist>
29647  <varlistentry>
29648   <term><parameter>dev</parameter></term>
29649   <listitem>
29650    <para>
29651     device on a port
29652    </para>
29653   </listitem>
29654  </varlistentry>
29655  <varlistentry>
29656   <term><parameter>inactivity</parameter></term>
29657   <listitem>
29658    <para>
29659     inactivity timeout (in jiffies)
29660    </para>
29661   </listitem>
29662  </varlistentry>
29663 </variablelist>
29664</refsect1>
29665<refsect1>
29666<title>Description</title>
29667<para>
29668   This sets the inactivity timeout for a particular device on a
29669   port.  This affects functions like <function><link linkend="API-parport-wait-peripheral">parport_wait_peripheral</link></function>.
29670   The special value 0 means not to call <function>schedule</function> while dealing
29671   with this device.
29672   </para><para>
29673
29674   The return value is the previous inactivity timeout.
29675   </para><para>
29676
29677   Any callers of <function><link linkend="API-parport-wait-event">parport_wait_event</link></function> for this device are woken
29678   up.
29679</para>
29680</refsect1>
29681</refentry>
29682
29683<!-- drivers/parport/share.c -->
29684<refentry id="API---parport-register-driver">
29685<refentryinfo>
29686 <title>LINUX</title>
29687 <productname>Kernel Hackers Manual</productname>
29688 <date>July 2017</date>
29689</refentryinfo>
29690<refmeta>
29691 <refentrytitle><phrase>__parport_register_driver</phrase></refentrytitle>
29692 <manvolnum>9</manvolnum>
29693 <refmiscinfo class="version">4.4.14</refmiscinfo>
29694</refmeta>
29695<refnamediv>
29696 <refname>__parport_register_driver</refname>
29697 <refpurpose>
29698  register a parallel port device driver
29699 </refpurpose>
29700</refnamediv>
29701<refsynopsisdiv>
29702 <title>Synopsis</title>
29703  <funcsynopsis><funcprototype>
29704   <funcdef>int <function>__parport_register_driver </function></funcdef>
29705   <paramdef>struct parport_driver * <parameter>drv</parameter></paramdef>
29706   <paramdef>struct module * <parameter>owner</parameter></paramdef>
29707   <paramdef>const char * <parameter>mod_name</parameter></paramdef>
29708  </funcprototype></funcsynopsis>
29709</refsynopsisdiv>
29710<refsect1>
29711 <title>Arguments</title>
29712 <variablelist>
29713  <varlistentry>
29714   <term><parameter>drv</parameter></term>
29715   <listitem>
29716    <para>
29717     structure describing the driver
29718    </para>
29719   </listitem>
29720  </varlistentry>
29721  <varlistentry>
29722   <term><parameter>owner</parameter></term>
29723   <listitem>
29724    <para>
29725     owner module of drv
29726    </para>
29727   </listitem>
29728  </varlistentry>
29729  <varlistentry>
29730   <term><parameter>mod_name</parameter></term>
29731   <listitem>
29732    <para>
29733     module name string
29734    </para>
29735   </listitem>
29736  </varlistentry>
29737 </variablelist>
29738</refsect1>
29739<refsect1>
29740<title>Description</title>
29741<para>
29742   This can be called by a parallel port device driver in order
29743   to receive notifications about ports being found in the
29744   system, as well as ports no longer available.
29745   </para><para>
29746
29747   If devmodel is true then the new device model is used
29748   for registration.
29749   </para><para>
29750
29751   The <parameter>drv</parameter> structure is allocated by the caller and must not be
29752   deallocated until after calling <function><link linkend="API-parport-unregister-driver">parport_unregister_driver</link></function>.
29753</para>
29754</refsect1>
29755<refsect1>
29756<title>If using the non device model</title>
29757<para>
29758   The driver's <function>attach</function> function may block.  The port that
29759   <function>attach</function> is given will be valid for the duration of the
29760   callback, but if the driver wants to take a copy of the
29761   pointer it must call <function><link linkend="API-parport-get-port">parport_get_port</link></function> to do so.  Calling
29762   <function><link linkend="API-parport-register-device">parport_register_device</link></function> on that port will do this for you.
29763   </para><para>
29764
29765   The driver's <function>detach</function> function may block.  The port that
29766   <function>detach</function> is given will be valid for the duration of the
29767   callback, but if the driver wants to take a copy of the
29768   pointer it must call <function><link linkend="API-parport-get-port">parport_get_port</link></function> to do so.
29769   </para><para>
29770
29771   </para><para>
29772
29773   Returns 0 on success. The non device model will always succeeds.
29774   but the new device model can fail and will return the error code.
29775</para>
29776</refsect1>
29777</refentry>
29778
29779<refentry id="API-parport-unregister-driver">
29780<refentryinfo>
29781 <title>LINUX</title>
29782 <productname>Kernel Hackers Manual</productname>
29783 <date>July 2017</date>
29784</refentryinfo>
29785<refmeta>
29786 <refentrytitle><phrase>parport_unregister_driver</phrase></refentrytitle>
29787 <manvolnum>9</manvolnum>
29788 <refmiscinfo class="version">4.4.14</refmiscinfo>
29789</refmeta>
29790<refnamediv>
29791 <refname>parport_unregister_driver</refname>
29792 <refpurpose>
29793     deregister a parallel port device driver
29794 </refpurpose>
29795</refnamediv>
29796<refsynopsisdiv>
29797 <title>Synopsis</title>
29798  <funcsynopsis><funcprototype>
29799   <funcdef>void <function>parport_unregister_driver </function></funcdef>
29800   <paramdef>struct parport_driver * <parameter>drv</parameter></paramdef>
29801  </funcprototype></funcsynopsis>
29802</refsynopsisdiv>
29803<refsect1>
29804 <title>Arguments</title>
29805 <variablelist>
29806  <varlistentry>
29807   <term><parameter>drv</parameter></term>
29808   <listitem>
29809    <para>
29810     structure describing the driver that was given to
29811     <function>parport_register_driver</function>
29812    </para>
29813   </listitem>
29814  </varlistentry>
29815 </variablelist>
29816</refsect1>
29817<refsect1>
29818<title>Description</title>
29819<para>
29820   This should be called by a parallel port device driver that
29821   has registered itself using <function>parport_register_driver</function> when it
29822   is about to be unloaded.
29823   </para><para>
29824
29825   When it returns, the driver's <function>attach</function> routine will no longer
29826   be called, and for each port that <function>attach</function> was called for, the
29827   <function>detach</function> routine will have been called.
29828   </para><para>
29829
29830   All the driver's <function>attach</function> and <function>detach</function> calls are guaranteed to have
29831   finished by the time this function returns.
29832</para>
29833</refsect1>
29834</refentry>
29835
29836<refentry id="API-parport-get-port">
29837<refentryinfo>
29838 <title>LINUX</title>
29839 <productname>Kernel Hackers Manual</productname>
29840 <date>July 2017</date>
29841</refentryinfo>
29842<refmeta>
29843 <refentrytitle><phrase>parport_get_port</phrase></refentrytitle>
29844 <manvolnum>9</manvolnum>
29845 <refmiscinfo class="version">4.4.14</refmiscinfo>
29846</refmeta>
29847<refnamediv>
29848 <refname>parport_get_port</refname>
29849 <refpurpose>
29850     increment a port's reference count
29851 </refpurpose>
29852</refnamediv>
29853<refsynopsisdiv>
29854 <title>Synopsis</title>
29855  <funcsynopsis><funcprototype>
29856   <funcdef>struct parport * <function>parport_get_port </function></funcdef>
29857   <paramdef>struct parport * <parameter>port</parameter></paramdef>
29858  </funcprototype></funcsynopsis>
29859</refsynopsisdiv>
29860<refsect1>
29861 <title>Arguments</title>
29862 <variablelist>
29863  <varlistentry>
29864   <term><parameter>port</parameter></term>
29865   <listitem>
29866    <para>
29867     the port
29868    </para>
29869   </listitem>
29870  </varlistentry>
29871 </variablelist>
29872</refsect1>
29873<refsect1>
29874<title>Description</title>
29875<para>
29876   This ensures that a struct parport pointer remains valid
29877   until the matching <function><link linkend="API-parport-put-port">parport_put_port</link></function> call.
29878</para>
29879</refsect1>
29880</refentry>
29881
29882<refentry id="API-parport-put-port">
29883<refentryinfo>
29884 <title>LINUX</title>
29885 <productname>Kernel Hackers Manual</productname>
29886 <date>July 2017</date>
29887</refentryinfo>
29888<refmeta>
29889 <refentrytitle><phrase>parport_put_port</phrase></refentrytitle>
29890 <manvolnum>9</manvolnum>
29891 <refmiscinfo class="version">4.4.14</refmiscinfo>
29892</refmeta>
29893<refnamediv>
29894 <refname>parport_put_port</refname>
29895 <refpurpose>
29896     decrement a port's reference count
29897 </refpurpose>
29898</refnamediv>
29899<refsynopsisdiv>
29900 <title>Synopsis</title>
29901  <funcsynopsis><funcprototype>
29902   <funcdef>void <function>parport_put_port </function></funcdef>
29903   <paramdef>struct parport * <parameter>port</parameter></paramdef>
29904  </funcprototype></funcsynopsis>
29905</refsynopsisdiv>
29906<refsect1>
29907 <title>Arguments</title>
29908 <variablelist>
29909  <varlistentry>
29910   <term><parameter>port</parameter></term>
29911   <listitem>
29912    <para>
29913     the port
29914    </para>
29915   </listitem>
29916  </varlistentry>
29917 </variablelist>
29918</refsect1>
29919<refsect1>
29920<title>Description</title>
29921<para>
29922   This should be called once for each call to <function><link linkend="API-parport-get-port">parport_get_port</link></function>,
29923   once the port is no longer needed. When the reference count reaches
29924   zero (port is no longer used), free_port is called.
29925</para>
29926</refsect1>
29927</refentry>
29928
29929<refentry id="API-parport-register-port">
29930<refentryinfo>
29931 <title>LINUX</title>
29932 <productname>Kernel Hackers Manual</productname>
29933 <date>July 2017</date>
29934</refentryinfo>
29935<refmeta>
29936 <refentrytitle><phrase>parport_register_port</phrase></refentrytitle>
29937 <manvolnum>9</manvolnum>
29938 <refmiscinfo class="version">4.4.14</refmiscinfo>
29939</refmeta>
29940<refnamediv>
29941 <refname>parport_register_port</refname>
29942 <refpurpose>
29943     register a parallel port
29944 </refpurpose>
29945</refnamediv>
29946<refsynopsisdiv>
29947 <title>Synopsis</title>
29948  <funcsynopsis><funcprototype>
29949   <funcdef>struct parport * <function>parport_register_port </function></funcdef>
29950   <paramdef>unsigned long <parameter>base</parameter></paramdef>
29951   <paramdef>int <parameter>irq</parameter></paramdef>
29952   <paramdef>int <parameter>dma</parameter></paramdef>
29953   <paramdef>struct parport_operations * <parameter>ops</parameter></paramdef>
29954  </funcprototype></funcsynopsis>
29955</refsynopsisdiv>
29956<refsect1>
29957 <title>Arguments</title>
29958 <variablelist>
29959  <varlistentry>
29960   <term><parameter>base</parameter></term>
29961   <listitem>
29962    <para>
29963     base I/O address
29964    </para>
29965   </listitem>
29966  </varlistentry>
29967  <varlistentry>
29968   <term><parameter>irq</parameter></term>
29969   <listitem>
29970    <para>
29971     IRQ line
29972    </para>
29973   </listitem>
29974  </varlistentry>
29975  <varlistentry>
29976   <term><parameter>dma</parameter></term>
29977   <listitem>
29978    <para>
29979     DMA channel
29980    </para>
29981   </listitem>
29982  </varlistentry>
29983  <varlistentry>
29984   <term><parameter>ops</parameter></term>
29985   <listitem>
29986    <para>
29987     pointer to the port driver's port operations structure
29988    </para>
29989   </listitem>
29990  </varlistentry>
29991 </variablelist>
29992</refsect1>
29993<refsect1>
29994<title>Description</title>
29995<para>
29996   When a parallel port (lowlevel) driver finds a port that
29997   should be made available to parallel port device drivers, it
29998   should call <function><link linkend="API-parport-register-port">parport_register_port</link></function>.  The <parameter>base</parameter>, <parameter>irq</parameter>, and
29999   <parameter>dma</parameter> parameters are for the convenience of port drivers, and
30000   for ports where they aren't meaningful needn't be set to
30001   anything special.  They can be altered afterwards by adjusting
30002   the relevant members of the parport structure that is returned
30003   and represents the port.  They should not be tampered with
30004   after calling parport_announce_port, however.
30005   </para><para>
30006
30007   If there are parallel port device drivers in the system that
30008   have registered themselves using <function>parport_register_driver</function>,
30009   they are not told about the port at this time; that is done by
30010   <function><link linkend="API-parport-announce-port">parport_announce_port</link></function>.
30011   </para><para>
30012
30013   The <parameter>ops</parameter> structure is allocated by the caller, and must not be
30014   deallocated before calling <function><link linkend="API-parport-remove-port">parport_remove_port</link></function>.
30015   </para><para>
30016
30017   If there is no memory to allocate a new parport structure,
30018   this function will return <constant>NULL</constant>.
30019</para>
30020</refsect1>
30021</refentry>
30022
30023<refentry id="API-parport-announce-port">
30024<refentryinfo>
30025 <title>LINUX</title>
30026 <productname>Kernel Hackers Manual</productname>
30027 <date>July 2017</date>
30028</refentryinfo>
30029<refmeta>
30030 <refentrytitle><phrase>parport_announce_port</phrase></refentrytitle>
30031 <manvolnum>9</manvolnum>
30032 <refmiscinfo class="version">4.4.14</refmiscinfo>
30033</refmeta>
30034<refnamediv>
30035 <refname>parport_announce_port</refname>
30036 <refpurpose>
30037     tell device drivers about a parallel port
30038 </refpurpose>
30039</refnamediv>
30040<refsynopsisdiv>
30041 <title>Synopsis</title>
30042  <funcsynopsis><funcprototype>
30043   <funcdef>void <function>parport_announce_port </function></funcdef>
30044   <paramdef>struct parport * <parameter>port</parameter></paramdef>
30045  </funcprototype></funcsynopsis>
30046</refsynopsisdiv>
30047<refsect1>
30048 <title>Arguments</title>
30049 <variablelist>
30050  <varlistentry>
30051   <term><parameter>port</parameter></term>
30052   <listitem>
30053    <para>
30054     parallel port to announce
30055    </para>
30056   </listitem>
30057  </varlistentry>
30058 </variablelist>
30059</refsect1>
30060<refsect1>
30061<title>Description</title>
30062<para>
30063   After a port driver has registered a parallel port with
30064   parport_register_port, and performed any necessary
30065   initialisation or adjustments, it should call
30066   <function><link linkend="API-parport-announce-port">parport_announce_port</link></function> in order to notify all device drivers
30067   that have called <function>parport_register_driver</function>.  Their <function>attach</function>
30068   functions will be called, with <parameter>port</parameter> as the parameter.
30069</para>
30070</refsect1>
30071</refentry>
30072
30073<refentry id="API-parport-remove-port">
30074<refentryinfo>
30075 <title>LINUX</title>
30076 <productname>Kernel Hackers Manual</productname>
30077 <date>July 2017</date>
30078</refentryinfo>
30079<refmeta>
30080 <refentrytitle><phrase>parport_remove_port</phrase></refentrytitle>
30081 <manvolnum>9</manvolnum>
30082 <refmiscinfo class="version">4.4.14</refmiscinfo>
30083</refmeta>
30084<refnamediv>
30085 <refname>parport_remove_port</refname>
30086 <refpurpose>
30087     deregister a parallel port
30088 </refpurpose>
30089</refnamediv>
30090<refsynopsisdiv>
30091 <title>Synopsis</title>
30092  <funcsynopsis><funcprototype>
30093   <funcdef>void <function>parport_remove_port </function></funcdef>
30094   <paramdef>struct parport * <parameter>port</parameter></paramdef>
30095  </funcprototype></funcsynopsis>
30096</refsynopsisdiv>
30097<refsect1>
30098 <title>Arguments</title>
30099 <variablelist>
30100  <varlistentry>
30101   <term><parameter>port</parameter></term>
30102   <listitem>
30103    <para>
30104     parallel port to deregister
30105    </para>
30106   </listitem>
30107  </varlistentry>
30108 </variablelist>
30109</refsect1>
30110<refsect1>
30111<title>Description</title>
30112<para>
30113   When a parallel port driver is forcibly unloaded, or a
30114   parallel port becomes inaccessible, the port driver must call
30115   this function in order to deal with device drivers that still
30116   want to use it.
30117   </para><para>
30118
30119   The parport structure associated with the port has its
30120   operations structure replaced with one containing 'null'
30121   operations that return errors or just don't do anything.
30122   </para><para>
30123
30124   Any drivers that have registered themselves using
30125   <function>parport_register_driver</function> are notified that the port is no
30126   longer accessible by having their <function>detach</function> routines called
30127   with <parameter>port</parameter> as the parameter.
30128</para>
30129</refsect1>
30130</refentry>
30131
30132<refentry id="API-parport-register-device">
30133<refentryinfo>
30134 <title>LINUX</title>
30135 <productname>Kernel Hackers Manual</productname>
30136 <date>July 2017</date>
30137</refentryinfo>
30138<refmeta>
30139 <refentrytitle><phrase>parport_register_device</phrase></refentrytitle>
30140 <manvolnum>9</manvolnum>
30141 <refmiscinfo class="version">4.4.14</refmiscinfo>
30142</refmeta>
30143<refnamediv>
30144 <refname>parport_register_device</refname>
30145 <refpurpose>
30146     register a device on a parallel port
30147 </refpurpose>
30148</refnamediv>
30149<refsynopsisdiv>
30150 <title>Synopsis</title>
30151  <funcsynopsis><funcprototype>
30152   <funcdef>struct pardevice * <function>parport_register_device </function></funcdef>
30153   <paramdef>struct parport * <parameter>port</parameter></paramdef>
30154   <paramdef>const char * <parameter>name</parameter></paramdef>
30155   <paramdef>int (*<parameter>pf</parameter>)
30156     <funcparams>void *</funcparams></paramdef>
30157   <paramdef>void (*<parameter>kf</parameter>)
30158     <funcparams>void *</funcparams></paramdef>
30159   <paramdef>void (*<parameter>irq_func</parameter>)
30160     <funcparams>void *</funcparams></paramdef>
30161   <paramdef>int <parameter>flags</parameter></paramdef>
30162   <paramdef>void * <parameter>handle</parameter></paramdef>
30163  </funcprototype></funcsynopsis>
30164</refsynopsisdiv>
30165<refsect1>
30166 <title>Arguments</title>
30167 <variablelist>
30168  <varlistentry>
30169   <term><parameter>port</parameter></term>
30170   <listitem>
30171    <para>
30172     port to which the device is attached
30173    </para>
30174   </listitem>
30175  </varlistentry>
30176  <varlistentry>
30177   <term><parameter>name</parameter></term>
30178   <listitem>
30179    <para>
30180     a name to refer to the device
30181    </para>
30182   </listitem>
30183  </varlistentry>
30184  <varlistentry>
30185   <term><parameter>pf</parameter></term>
30186   <listitem>
30187    <para>
30188     preemption callback
30189    </para>
30190   </listitem>
30191  </varlistentry>
30192  <varlistentry>
30193   <term><parameter>kf</parameter></term>
30194   <listitem>
30195    <para>
30196     kick callback (wake-up)
30197    </para>
30198   </listitem>
30199  </varlistentry>
30200  <varlistentry>
30201   <term><parameter>irq_func</parameter></term>
30202   <listitem>
30203    <para>
30204     interrupt handler
30205    </para>
30206   </listitem>
30207  </varlistentry>
30208  <varlistentry>
30209   <term><parameter>flags</parameter></term>
30210   <listitem>
30211    <para>
30212     registration flags
30213    </para>
30214   </listitem>
30215  </varlistentry>
30216  <varlistentry>
30217   <term><parameter>handle</parameter></term>
30218   <listitem>
30219    <para>
30220     data for callback functions
30221    </para>
30222   </listitem>
30223  </varlistentry>
30224 </variablelist>
30225</refsect1>
30226<refsect1>
30227<title>Description</title>
30228<para>
30229   This function, called by parallel port device drivers,
30230   declares that a device is connected to a port, and tells the
30231   system all it needs to know.
30232   </para><para>
30233
30234   The <parameter>name</parameter> is allocated by the caller and must not be
30235   deallocated until the caller calls <parameter>parport_unregister_device</parameter>
30236   for that device.
30237   </para><para>
30238
30239   The preemption callback function, <parameter>pf</parameter>, is called when this
30240   device driver has claimed access to the port but another
30241   device driver wants to use it.  It is given <parameter>handle</parameter> as its
30242   parameter, and should return zero if it is willing for the
30243   system to release the port to another driver on its behalf.
30244   If it wants to keep control of the port it should return
30245   non-zero, and no action will be taken.  It is good manners for
30246   the driver to try to release the port at the earliest
30247   opportunity after its preemption callback rejects a preemption
30248   attempt.  Note that if a preemption callback is happy for
30249   preemption to go ahead, there is no need to release the port;
30250   it is done automatically.  This function may not block, as it
30251   may be called from interrupt context.  If the device driver
30252   does not support preemption, <parameter>pf</parameter> can be <constant>NULL</constant>.
30253   </para><para>
30254
30255   The wake-up (<quote>kick</quote>) callback function, <parameter>kf</parameter>, is called when
30256   the port is available to be claimed for exclusive access; that
30257   is, <function><link linkend="API-parport-claim">parport_claim</link></function> is guaranteed to succeed when called from
30258   inside the wake-up callback function.  If the driver wants to
30259   claim the port it should do so; otherwise, it need not take
30260   any action.  This function may not block, as it may be called
30261   from interrupt context.  If the device driver does not want to
30262   be explicitly invited to claim the port in this way, <parameter>kf</parameter> can
30263   be <constant>NULL</constant>.
30264   </para><para>
30265
30266   The interrupt handler, <parameter>irq_func</parameter>, is called when an interrupt
30267   arrives from the parallel port.  Note that if a device driver
30268   wants to use interrupts it should use <function>parport_enable_irq</function>,
30269   and can also check the irq member of the parport structure
30270   representing the port.
30271   </para><para>
30272
30273   The parallel port (lowlevel) driver is the one that has called
30274   <function>request_irq</function> and whose interrupt handler is called first.
30275   This handler does whatever needs to be done to the hardware to
30276   acknowledge the interrupt (for PC-style ports there is nothing
30277   special to be done).  It then tells the IEEE 1284 code about
30278   the interrupt, which may involve reacting to an IEEE 1284
30279   event depending on the current IEEE 1284 phase.  After this,
30280   it calls <parameter>irq_func</parameter>.  Needless to say, <parameter>irq_func</parameter> will be called
30281   from interrupt context, and may not block.
30282   </para><para>
30283
30284   The <constant>PARPORT_DEV_EXCL</constant> flag is for preventing port sharing, and
30285   so should only be used when sharing the port with other device
30286   drivers is impossible and would lead to incorrect behaviour.
30287   Use it sparingly!  Normally, <parameter>flags</parameter> will be zero.
30288   </para><para>
30289
30290   This function returns a pointer to a structure that represents
30291   the device on the port, or <constant>NULL</constant> if there is not enough memory
30292   to allocate space for that structure.
30293</para>
30294</refsect1>
30295</refentry>
30296
30297<refentry id="API-parport-unregister-device">
30298<refentryinfo>
30299 <title>LINUX</title>
30300 <productname>Kernel Hackers Manual</productname>
30301 <date>July 2017</date>
30302</refentryinfo>
30303<refmeta>
30304 <refentrytitle><phrase>parport_unregister_device</phrase></refentrytitle>
30305 <manvolnum>9</manvolnum>
30306 <refmiscinfo class="version">4.4.14</refmiscinfo>
30307</refmeta>
30308<refnamediv>
30309 <refname>parport_unregister_device</refname>
30310 <refpurpose>
30311     deregister a device on a parallel port
30312 </refpurpose>
30313</refnamediv>
30314<refsynopsisdiv>
30315 <title>Synopsis</title>
30316  <funcsynopsis><funcprototype>
30317   <funcdef>void <function>parport_unregister_device </function></funcdef>
30318   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
30319  </funcprototype></funcsynopsis>
30320</refsynopsisdiv>
30321<refsect1>
30322 <title>Arguments</title>
30323 <variablelist>
30324  <varlistentry>
30325   <term><parameter>dev</parameter></term>
30326   <listitem>
30327    <para>
30328     pointer to structure representing device
30329    </para>
30330   </listitem>
30331  </varlistentry>
30332 </variablelist>
30333</refsect1>
30334<refsect1>
30335<title>Description</title>
30336<para>
30337   This undoes the effect of <function><link linkend="API-parport-register-device">parport_register_device</link></function>.
30338</para>
30339</refsect1>
30340</refentry>
30341
30342<refentry id="API-parport-find-number">
30343<refentryinfo>
30344 <title>LINUX</title>
30345 <productname>Kernel Hackers Manual</productname>
30346 <date>July 2017</date>
30347</refentryinfo>
30348<refmeta>
30349 <refentrytitle><phrase>parport_find_number</phrase></refentrytitle>
30350 <manvolnum>9</manvolnum>
30351 <refmiscinfo class="version">4.4.14</refmiscinfo>
30352</refmeta>
30353<refnamediv>
30354 <refname>parport_find_number</refname>
30355 <refpurpose>
30356     find a parallel port by number
30357 </refpurpose>
30358</refnamediv>
30359<refsynopsisdiv>
30360 <title>Synopsis</title>
30361  <funcsynopsis><funcprototype>
30362   <funcdef>struct parport * <function>parport_find_number </function></funcdef>
30363   <paramdef>int <parameter>number</parameter></paramdef>
30364  </funcprototype></funcsynopsis>
30365</refsynopsisdiv>
30366<refsect1>
30367 <title>Arguments</title>
30368 <variablelist>
30369  <varlistentry>
30370   <term><parameter>number</parameter></term>
30371   <listitem>
30372    <para>
30373     parallel port number
30374    </para>
30375   </listitem>
30376  </varlistentry>
30377 </variablelist>
30378</refsect1>
30379<refsect1>
30380<title>Description</title>
30381<para>
30382   This returns the parallel port with the specified number, or
30383   <constant>NULL</constant> if there is none.
30384   </para><para>
30385
30386   There is an implicit <function><link linkend="API-parport-get-port">parport_get_port</link></function> done already; to throw
30387   away the reference to the port that <function><link linkend="API-parport-find-number">parport_find_number</link></function>
30388   gives you, use <function><link linkend="API-parport-put-port">parport_put_port</link></function>.
30389</para>
30390</refsect1>
30391</refentry>
30392
30393<refentry id="API-parport-find-base">
30394<refentryinfo>
30395 <title>LINUX</title>
30396 <productname>Kernel Hackers Manual</productname>
30397 <date>July 2017</date>
30398</refentryinfo>
30399<refmeta>
30400 <refentrytitle><phrase>parport_find_base</phrase></refentrytitle>
30401 <manvolnum>9</manvolnum>
30402 <refmiscinfo class="version">4.4.14</refmiscinfo>
30403</refmeta>
30404<refnamediv>
30405 <refname>parport_find_base</refname>
30406 <refpurpose>
30407     find a parallel port by base address
30408 </refpurpose>
30409</refnamediv>
30410<refsynopsisdiv>
30411 <title>Synopsis</title>
30412  <funcsynopsis><funcprototype>
30413   <funcdef>struct parport * <function>parport_find_base </function></funcdef>
30414   <paramdef>unsigned long <parameter>base</parameter></paramdef>
30415  </funcprototype></funcsynopsis>
30416</refsynopsisdiv>
30417<refsect1>
30418 <title>Arguments</title>
30419 <variablelist>
30420  <varlistentry>
30421   <term><parameter>base</parameter></term>
30422   <listitem>
30423    <para>
30424     base I/O address
30425    </para>
30426   </listitem>
30427  </varlistentry>
30428 </variablelist>
30429</refsect1>
30430<refsect1>
30431<title>Description</title>
30432<para>
30433   This returns the parallel port with the specified base
30434   address, or <constant>NULL</constant> if there is none.
30435   </para><para>
30436
30437   There is an implicit <function><link linkend="API-parport-get-port">parport_get_port</link></function> done already; to throw
30438   away the reference to the port that <function><link linkend="API-parport-find-base">parport_find_base</link></function>
30439   gives you, use <function><link linkend="API-parport-put-port">parport_put_port</link></function>.
30440</para>
30441</refsect1>
30442</refentry>
30443
30444<refentry id="API-parport-claim">
30445<refentryinfo>
30446 <title>LINUX</title>
30447 <productname>Kernel Hackers Manual</productname>
30448 <date>July 2017</date>
30449</refentryinfo>
30450<refmeta>
30451 <refentrytitle><phrase>parport_claim</phrase></refentrytitle>
30452 <manvolnum>9</manvolnum>
30453 <refmiscinfo class="version">4.4.14</refmiscinfo>
30454</refmeta>
30455<refnamediv>
30456 <refname>parport_claim</refname>
30457 <refpurpose>
30458     claim access to a parallel port device
30459 </refpurpose>
30460</refnamediv>
30461<refsynopsisdiv>
30462 <title>Synopsis</title>
30463  <funcsynopsis><funcprototype>
30464   <funcdef>int <function>parport_claim </function></funcdef>
30465   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
30466  </funcprototype></funcsynopsis>
30467</refsynopsisdiv>
30468<refsect1>
30469 <title>Arguments</title>
30470 <variablelist>
30471  <varlistentry>
30472   <term><parameter>dev</parameter></term>
30473   <listitem>
30474    <para>
30475     pointer to structure representing a device on the port
30476    </para>
30477   </listitem>
30478  </varlistentry>
30479 </variablelist>
30480</refsect1>
30481<refsect1>
30482<title>Description</title>
30483<para>
30484   This function will not block and so can be used from interrupt
30485   context.  If <function><link linkend="API-parport-claim">parport_claim</link></function> succeeds in claiming access to
30486   the port it returns zero and the port is available to use.  It
30487   may fail (returning non-zero) if the port is in use by another
30488   driver and that driver is not willing to relinquish control of
30489   the port.
30490</para>
30491</refsect1>
30492</refentry>
30493
30494<refentry id="API-parport-claim-or-block">
30495<refentryinfo>
30496 <title>LINUX</title>
30497 <productname>Kernel Hackers Manual</productname>
30498 <date>July 2017</date>
30499</refentryinfo>
30500<refmeta>
30501 <refentrytitle><phrase>parport_claim_or_block</phrase></refentrytitle>
30502 <manvolnum>9</manvolnum>
30503 <refmiscinfo class="version">4.4.14</refmiscinfo>
30504</refmeta>
30505<refnamediv>
30506 <refname>parport_claim_or_block</refname>
30507 <refpurpose>
30508     claim access to a parallel port device
30509 </refpurpose>
30510</refnamediv>
30511<refsynopsisdiv>
30512 <title>Synopsis</title>
30513  <funcsynopsis><funcprototype>
30514   <funcdef>int <function>parport_claim_or_block </function></funcdef>
30515   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
30516  </funcprototype></funcsynopsis>
30517</refsynopsisdiv>
30518<refsect1>
30519 <title>Arguments</title>
30520 <variablelist>
30521  <varlistentry>
30522   <term><parameter>dev</parameter></term>
30523   <listitem>
30524    <para>
30525     pointer to structure representing a device on the port
30526    </para>
30527   </listitem>
30528  </varlistentry>
30529 </variablelist>
30530</refsect1>
30531<refsect1>
30532<title>Description</title>
30533<para>
30534   This behaves like <function><link linkend="API-parport-claim">parport_claim</link></function>, but will block if necessary
30535   to wait for the port to be free.  A return value of 1
30536   indicates that it slept; 0 means that it succeeded without
30537   needing to sleep.  A negative error code indicates failure.
30538</para>
30539</refsect1>
30540</refentry>
30541
30542<refentry id="API-parport-release">
30543<refentryinfo>
30544 <title>LINUX</title>
30545 <productname>Kernel Hackers Manual</productname>
30546 <date>July 2017</date>
30547</refentryinfo>
30548<refmeta>
30549 <refentrytitle><phrase>parport_release</phrase></refentrytitle>
30550 <manvolnum>9</manvolnum>
30551 <refmiscinfo class="version">4.4.14</refmiscinfo>
30552</refmeta>
30553<refnamediv>
30554 <refname>parport_release</refname>
30555 <refpurpose>
30556     give up access to a parallel port device
30557 </refpurpose>
30558</refnamediv>
30559<refsynopsisdiv>
30560 <title>Synopsis</title>
30561  <funcsynopsis><funcprototype>
30562   <funcdef>void <function>parport_release </function></funcdef>
30563   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
30564  </funcprototype></funcsynopsis>
30565</refsynopsisdiv>
30566<refsect1>
30567 <title>Arguments</title>
30568 <variablelist>
30569  <varlistentry>
30570   <term><parameter>dev</parameter></term>
30571   <listitem>
30572    <para>
30573     pointer to structure representing parallel port device
30574    </para>
30575   </listitem>
30576  </varlistentry>
30577 </variablelist>
30578</refsect1>
30579<refsect1>
30580<title>Description</title>
30581<para>
30582   This function cannot fail, but it should not be called without
30583   the port claimed.  Similarly, if the port is already claimed
30584   you should not try claiming it again.
30585</para>
30586</refsect1>
30587</refentry>
30588
30589<!-- drivers/parport/daisy.c -->
30590<refentry id="API-parport-open">
30591<refentryinfo>
30592 <title>LINUX</title>
30593 <productname>Kernel Hackers Manual</productname>
30594 <date>July 2017</date>
30595</refentryinfo>
30596<refmeta>
30597 <refentrytitle><phrase>parport_open</phrase></refentrytitle>
30598 <manvolnum>9</manvolnum>
30599 <refmiscinfo class="version">4.4.14</refmiscinfo>
30600</refmeta>
30601<refnamediv>
30602 <refname>parport_open</refname>
30603 <refpurpose>
30604  find a device by canonical device number
30605 </refpurpose>
30606</refnamediv>
30607<refsynopsisdiv>
30608 <title>Synopsis</title>
30609  <funcsynopsis><funcprototype>
30610   <funcdef>struct pardevice * <function>parport_open </function></funcdef>
30611   <paramdef>int <parameter>devnum</parameter></paramdef>
30612   <paramdef>const char * <parameter>name</parameter></paramdef>
30613  </funcprototype></funcsynopsis>
30614</refsynopsisdiv>
30615<refsect1>
30616 <title>Arguments</title>
30617 <variablelist>
30618  <varlistentry>
30619   <term><parameter>devnum</parameter></term>
30620   <listitem>
30621    <para>
30622     canonical device number
30623    </para>
30624   </listitem>
30625  </varlistentry>
30626  <varlistentry>
30627   <term><parameter>name</parameter></term>
30628   <listitem>
30629    <para>
30630     name to associate with the device
30631    </para>
30632   </listitem>
30633  </varlistentry>
30634 </variablelist>
30635</refsect1>
30636<refsect1>
30637<title>Description</title>
30638<para>
30639   This function is similar to <function><link linkend="API-parport-register-device">parport_register_device</link></function>, except
30640   that it locates a device by its number rather than by the port
30641   it is attached to.
30642   </para><para>
30643
30644   All parameters except for <parameter>devnum</parameter> are the same as for
30645   <function><link linkend="API-parport-register-device">parport_register_device</link></function>.  The return value is the same as
30646   for <function><link linkend="API-parport-register-device">parport_register_device</link></function>.
30647</para>
30648</refsect1>
30649</refentry>
30650
30651<refentry id="API-parport-close">
30652<refentryinfo>
30653 <title>LINUX</title>
30654 <productname>Kernel Hackers Manual</productname>
30655 <date>July 2017</date>
30656</refentryinfo>
30657<refmeta>
30658 <refentrytitle><phrase>parport_close</phrase></refentrytitle>
30659 <manvolnum>9</manvolnum>
30660 <refmiscinfo class="version">4.4.14</refmiscinfo>
30661</refmeta>
30662<refnamediv>
30663 <refname>parport_close</refname>
30664 <refpurpose>
30665     close a device opened with <function><link linkend="API-parport-open">parport_open</link></function>
30666 </refpurpose>
30667</refnamediv>
30668<refsynopsisdiv>
30669 <title>Synopsis</title>
30670  <funcsynopsis><funcprototype>
30671   <funcdef>void <function>parport_close </function></funcdef>
30672   <paramdef>struct pardevice * <parameter>dev</parameter></paramdef>
30673  </funcprototype></funcsynopsis>
30674</refsynopsisdiv>
30675<refsect1>
30676 <title>Arguments</title>
30677 <variablelist>
30678  <varlistentry>
30679   <term><parameter>dev</parameter></term>
30680   <listitem>
30681    <para>
30682     device to close
30683    </para>
30684   </listitem>
30685  </varlistentry>
30686 </variablelist>
30687</refsect1>
30688<refsect1>
30689<title>Description</title>
30690<para>
30691   This is to <function><link linkend="API-parport-open">parport_open</link></function> as <function><link linkend="API-parport-unregister-device">parport_unregister_device</link></function> is to
30692   <function><link linkend="API-parport-register-device">parport_register_device</link></function>.
30693</para>
30694</refsect1>
30695</refentry>
30696
30697  </chapter>
30698
30699  <chapter id="message_devices">
30700	<title>Message-based devices</title>
30701     <sect1><title>Fusion message devices</title>
30702<!-- drivers/message/fusion/mptbase.c -->
30703<refentry id="API-mpt-register">
30704<refentryinfo>
30705 <title>LINUX</title>
30706 <productname>Kernel Hackers Manual</productname>
30707 <date>July 2017</date>
30708</refentryinfo>
30709<refmeta>
30710 <refentrytitle><phrase>mpt_register</phrase></refentrytitle>
30711 <manvolnum>9</manvolnum>
30712 <refmiscinfo class="version">4.4.14</refmiscinfo>
30713</refmeta>
30714<refnamediv>
30715 <refname>mpt_register</refname>
30716 <refpurpose>
30717  Register protocol-specific main callback handler.
30718 </refpurpose>
30719</refnamediv>
30720<refsynopsisdiv>
30721 <title>Synopsis</title>
30722  <funcsynopsis><funcprototype>
30723   <funcdef>u8 <function>mpt_register </function></funcdef>
30724   <paramdef>MPT_CALLBACK <parameter>cbfunc</parameter></paramdef>
30725   <paramdef>MPT_DRIVER_CLASS <parameter>dclass</parameter></paramdef>
30726   <paramdef>char * <parameter>func_name</parameter></paramdef>
30727  </funcprototype></funcsynopsis>
30728</refsynopsisdiv>
30729<refsect1>
30730 <title>Arguments</title>
30731 <variablelist>
30732  <varlistentry>
30733   <term><parameter>cbfunc</parameter></term>
30734   <listitem>
30735    <para>
30736     callback function pointer
30737    </para>
30738   </listitem>
30739  </varlistentry>
30740  <varlistentry>
30741   <term><parameter>dclass</parameter></term>
30742   <listitem>
30743    <para>
30744     Protocol driver's class (<constant>MPT_DRIVER_CLASS</constant> enum value)
30745    </para>
30746   </listitem>
30747  </varlistentry>
30748  <varlistentry>
30749   <term><parameter>func_name</parameter></term>
30750   <listitem>
30751    <para>
30752     call function's name
30753    </para>
30754   </listitem>
30755  </varlistentry>
30756 </variablelist>
30757</refsect1>
30758<refsect1>
30759<title>Description</title>
30760<para>
30761   This routine is called by a protocol-specific driver (SCSI host,
30762   LAN, SCSI target) to register its reply callback routine.  Each
30763   protocol-specific driver must do this before it will be able to
30764   use any IOC resources, such as obtaining request frames.
30765</para>
30766</refsect1>
30767<refsect1>
30768<title>NOTES</title>
30769<para>
30770   The SCSI protocol driver currently calls this routine thrice
30771   in order to register separate callbacks; one for <quote>normal</quote> SCSI IO;
30772   one for MptScsiTaskMgmt requests; one for Scan/DV requests.
30773   </para><para>
30774
30775   Returns u8 valued <quote>handle</quote> in the range (and S.O.D. order)
30776   {N,...,7,6,5,...,1} if successful.
30777   A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be
30778   considered an error by the caller.
30779</para>
30780</refsect1>
30781</refentry>
30782
30783<refentry id="API-mpt-deregister">
30784<refentryinfo>
30785 <title>LINUX</title>
30786 <productname>Kernel Hackers Manual</productname>
30787 <date>July 2017</date>
30788</refentryinfo>
30789<refmeta>
30790 <refentrytitle><phrase>mpt_deregister</phrase></refentrytitle>
30791 <manvolnum>9</manvolnum>
30792 <refmiscinfo class="version">4.4.14</refmiscinfo>
30793</refmeta>
30794<refnamediv>
30795 <refname>mpt_deregister</refname>
30796 <refpurpose>
30797     Deregister a protocol drivers resources.
30798 </refpurpose>
30799</refnamediv>
30800<refsynopsisdiv>
30801 <title>Synopsis</title>
30802  <funcsynopsis><funcprototype>
30803   <funcdef>void <function>mpt_deregister </function></funcdef>
30804   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
30805  </funcprototype></funcsynopsis>
30806</refsynopsisdiv>
30807<refsect1>
30808 <title>Arguments</title>
30809 <variablelist>
30810  <varlistentry>
30811   <term><parameter>cb_idx</parameter></term>
30812   <listitem>
30813    <para>
30814     previously registered callback handle
30815    </para>
30816   </listitem>
30817  </varlistentry>
30818 </variablelist>
30819</refsect1>
30820<refsect1>
30821<title>Description</title>
30822<para>
30823   Each protocol-specific driver should call this routine when its
30824   module is unloaded.
30825</para>
30826</refsect1>
30827</refentry>
30828
30829<refentry id="API-mpt-event-register">
30830<refentryinfo>
30831 <title>LINUX</title>
30832 <productname>Kernel Hackers Manual</productname>
30833 <date>July 2017</date>
30834</refentryinfo>
30835<refmeta>
30836 <refentrytitle><phrase>mpt_event_register</phrase></refentrytitle>
30837 <manvolnum>9</manvolnum>
30838 <refmiscinfo class="version">4.4.14</refmiscinfo>
30839</refmeta>
30840<refnamediv>
30841 <refname>mpt_event_register</refname>
30842 <refpurpose>
30843     Register protocol-specific event callback handler.
30844 </refpurpose>
30845</refnamediv>
30846<refsynopsisdiv>
30847 <title>Synopsis</title>
30848  <funcsynopsis><funcprototype>
30849   <funcdef>int <function>mpt_event_register </function></funcdef>
30850   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
30851   <paramdef>MPT_EVHANDLER <parameter>ev_cbfunc</parameter></paramdef>
30852  </funcprototype></funcsynopsis>
30853</refsynopsisdiv>
30854<refsect1>
30855 <title>Arguments</title>
30856 <variablelist>
30857  <varlistentry>
30858   <term><parameter>cb_idx</parameter></term>
30859   <listitem>
30860    <para>
30861     previously registered (via mpt_register) callback handle
30862    </para>
30863   </listitem>
30864  </varlistentry>
30865  <varlistentry>
30866   <term><parameter>ev_cbfunc</parameter></term>
30867   <listitem>
30868    <para>
30869     callback function
30870    </para>
30871   </listitem>
30872  </varlistentry>
30873 </variablelist>
30874</refsect1>
30875<refsect1>
30876<title>Description</title>
30877<para>
30878   This routine can be called by one or more protocol-specific drivers
30879   if/when they choose to be notified of MPT events.
30880   </para><para>
30881
30882   Returns 0 for success.
30883</para>
30884</refsect1>
30885</refentry>
30886
30887<refentry id="API-mpt-event-deregister">
30888<refentryinfo>
30889 <title>LINUX</title>
30890 <productname>Kernel Hackers Manual</productname>
30891 <date>July 2017</date>
30892</refentryinfo>
30893<refmeta>
30894 <refentrytitle><phrase>mpt_event_deregister</phrase></refentrytitle>
30895 <manvolnum>9</manvolnum>
30896 <refmiscinfo class="version">4.4.14</refmiscinfo>
30897</refmeta>
30898<refnamediv>
30899 <refname>mpt_event_deregister</refname>
30900 <refpurpose>
30901     Deregister protocol-specific event callback handler
30902 </refpurpose>
30903</refnamediv>
30904<refsynopsisdiv>
30905 <title>Synopsis</title>
30906  <funcsynopsis><funcprototype>
30907   <funcdef>void <function>mpt_event_deregister </function></funcdef>
30908   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
30909  </funcprototype></funcsynopsis>
30910</refsynopsisdiv>
30911<refsect1>
30912 <title>Arguments</title>
30913 <variablelist>
30914  <varlistentry>
30915   <term><parameter>cb_idx</parameter></term>
30916   <listitem>
30917    <para>
30918     previously registered callback handle
30919    </para>
30920   </listitem>
30921  </varlistentry>
30922 </variablelist>
30923</refsect1>
30924<refsect1>
30925<title>Description</title>
30926<para>
30927   Each protocol-specific driver should call this routine
30928   when it does not (or can no longer) handle events,
30929   or when its module is unloaded.
30930</para>
30931</refsect1>
30932</refentry>
30933
30934<refentry id="API-mpt-reset-register">
30935<refentryinfo>
30936 <title>LINUX</title>
30937 <productname>Kernel Hackers Manual</productname>
30938 <date>July 2017</date>
30939</refentryinfo>
30940<refmeta>
30941 <refentrytitle><phrase>mpt_reset_register</phrase></refentrytitle>
30942 <manvolnum>9</manvolnum>
30943 <refmiscinfo class="version">4.4.14</refmiscinfo>
30944</refmeta>
30945<refnamediv>
30946 <refname>mpt_reset_register</refname>
30947 <refpurpose>
30948     Register protocol-specific IOC reset handler.
30949 </refpurpose>
30950</refnamediv>
30951<refsynopsisdiv>
30952 <title>Synopsis</title>
30953  <funcsynopsis><funcprototype>
30954   <funcdef>int <function>mpt_reset_register </function></funcdef>
30955   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
30956   <paramdef>MPT_RESETHANDLER <parameter>reset_func</parameter></paramdef>
30957  </funcprototype></funcsynopsis>
30958</refsynopsisdiv>
30959<refsect1>
30960 <title>Arguments</title>
30961 <variablelist>
30962  <varlistentry>
30963   <term><parameter>cb_idx</parameter></term>
30964   <listitem>
30965    <para>
30966     previously registered (via mpt_register) callback handle
30967    </para>
30968   </listitem>
30969  </varlistentry>
30970  <varlistentry>
30971   <term><parameter>reset_func</parameter></term>
30972   <listitem>
30973    <para>
30974     reset function
30975    </para>
30976   </listitem>
30977  </varlistentry>
30978 </variablelist>
30979</refsect1>
30980<refsect1>
30981<title>Description</title>
30982<para>
30983   This routine can be called by one or more protocol-specific drivers
30984   if/when they choose to be notified of IOC resets.
30985   </para><para>
30986
30987   Returns 0 for success.
30988</para>
30989</refsect1>
30990</refentry>
30991
30992<refentry id="API-mpt-reset-deregister">
30993<refentryinfo>
30994 <title>LINUX</title>
30995 <productname>Kernel Hackers Manual</productname>
30996 <date>July 2017</date>
30997</refentryinfo>
30998<refmeta>
30999 <refentrytitle><phrase>mpt_reset_deregister</phrase></refentrytitle>
31000 <manvolnum>9</manvolnum>
31001 <refmiscinfo class="version">4.4.14</refmiscinfo>
31002</refmeta>
31003<refnamediv>
31004 <refname>mpt_reset_deregister</refname>
31005 <refpurpose>
31006     Deregister protocol-specific IOC reset handler.
31007 </refpurpose>
31008</refnamediv>
31009<refsynopsisdiv>
31010 <title>Synopsis</title>
31011  <funcsynopsis><funcprototype>
31012   <funcdef>void <function>mpt_reset_deregister </function></funcdef>
31013   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
31014  </funcprototype></funcsynopsis>
31015</refsynopsisdiv>
31016<refsect1>
31017 <title>Arguments</title>
31018 <variablelist>
31019  <varlistentry>
31020   <term><parameter>cb_idx</parameter></term>
31021   <listitem>
31022    <para>
31023     previously registered callback handle
31024    </para>
31025   </listitem>
31026  </varlistentry>
31027 </variablelist>
31028</refsect1>
31029<refsect1>
31030<title>Description</title>
31031<para>
31032   Each protocol-specific driver should call this routine
31033   when it does not (or can no longer) handle IOC reset handling,
31034   or when its module is unloaded.
31035</para>
31036</refsect1>
31037</refentry>
31038
31039<refentry id="API-mpt-device-driver-register">
31040<refentryinfo>
31041 <title>LINUX</title>
31042 <productname>Kernel Hackers Manual</productname>
31043 <date>July 2017</date>
31044</refentryinfo>
31045<refmeta>
31046 <refentrytitle><phrase>mpt_device_driver_register</phrase></refentrytitle>
31047 <manvolnum>9</manvolnum>
31048 <refmiscinfo class="version">4.4.14</refmiscinfo>
31049</refmeta>
31050<refnamediv>
31051 <refname>mpt_device_driver_register</refname>
31052 <refpurpose>
31053     Register device driver hooks
31054 </refpurpose>
31055</refnamediv>
31056<refsynopsisdiv>
31057 <title>Synopsis</title>
31058  <funcsynopsis><funcprototype>
31059   <funcdef>int <function>mpt_device_driver_register </function></funcdef>
31060   <paramdef>struct mpt_pci_driver * <parameter>dd_cbfunc</parameter></paramdef>
31061   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
31062  </funcprototype></funcsynopsis>
31063</refsynopsisdiv>
31064<refsect1>
31065 <title>Arguments</title>
31066 <variablelist>
31067  <varlistentry>
31068   <term><parameter>dd_cbfunc</parameter></term>
31069   <listitem>
31070    <para>
31071     driver callbacks struct
31072    </para>
31073   </listitem>
31074  </varlistentry>
31075  <varlistentry>
31076   <term><parameter>cb_idx</parameter></term>
31077   <listitem>
31078    <para>
31079     MPT protocol driver index
31080    </para>
31081   </listitem>
31082  </varlistentry>
31083 </variablelist>
31084</refsect1>
31085</refentry>
31086
31087<refentry id="API-mpt-device-driver-deregister">
31088<refentryinfo>
31089 <title>LINUX</title>
31090 <productname>Kernel Hackers Manual</productname>
31091 <date>July 2017</date>
31092</refentryinfo>
31093<refmeta>
31094 <refentrytitle><phrase>mpt_device_driver_deregister</phrase></refentrytitle>
31095 <manvolnum>9</manvolnum>
31096 <refmiscinfo class="version">4.4.14</refmiscinfo>
31097</refmeta>
31098<refnamediv>
31099 <refname>mpt_device_driver_deregister</refname>
31100 <refpurpose>
31101     DeRegister device driver hooks
31102 </refpurpose>
31103</refnamediv>
31104<refsynopsisdiv>
31105 <title>Synopsis</title>
31106  <funcsynopsis><funcprototype>
31107   <funcdef>void <function>mpt_device_driver_deregister </function></funcdef>
31108   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
31109  </funcprototype></funcsynopsis>
31110</refsynopsisdiv>
31111<refsect1>
31112 <title>Arguments</title>
31113 <variablelist>
31114  <varlistentry>
31115   <term><parameter>cb_idx</parameter></term>
31116   <listitem>
31117    <para>
31118     MPT protocol driver index
31119    </para>
31120   </listitem>
31121  </varlistentry>
31122 </variablelist>
31123</refsect1>
31124</refentry>
31125
31126<refentry id="API-mpt-get-msg-frame">
31127<refentryinfo>
31128 <title>LINUX</title>
31129 <productname>Kernel Hackers Manual</productname>
31130 <date>July 2017</date>
31131</refentryinfo>
31132<refmeta>
31133 <refentrytitle><phrase>mpt_get_msg_frame</phrase></refentrytitle>
31134 <manvolnum>9</manvolnum>
31135 <refmiscinfo class="version">4.4.14</refmiscinfo>
31136</refmeta>
31137<refnamediv>
31138 <refname>mpt_get_msg_frame</refname>
31139 <refpurpose>
31140     Obtain an MPT request frame from the pool
31141 </refpurpose>
31142</refnamediv>
31143<refsynopsisdiv>
31144 <title>Synopsis</title>
31145  <funcsynopsis><funcprototype>
31146   <funcdef>MPT_FRAME_HDR* <function>mpt_get_msg_frame </function></funcdef>
31147   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
31148   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31149  </funcprototype></funcsynopsis>
31150</refsynopsisdiv>
31151<refsect1>
31152 <title>Arguments</title>
31153 <variablelist>
31154  <varlistentry>
31155   <term><parameter>cb_idx</parameter></term>
31156   <listitem>
31157    <para>
31158     Handle of registered MPT protocol driver
31159    </para>
31160   </listitem>
31161  </varlistentry>
31162  <varlistentry>
31163   <term><parameter>ioc</parameter></term>
31164   <listitem>
31165    <para>
31166     Pointer to MPT adapter structure
31167    </para>
31168   </listitem>
31169  </varlistentry>
31170 </variablelist>
31171</refsect1>
31172<refsect1>
31173<title>Description</title>
31174<para>
31175   Obtain an MPT request frame from the pool (of 1024) that are
31176   allocated per MPT adapter.
31177   </para><para>
31178
31179   Returns pointer to a MPT request frame or <constant>NULL</constant> if none are available
31180   or IOC is not active.
31181</para>
31182</refsect1>
31183</refentry>
31184
31185<refentry id="API-mpt-put-msg-frame">
31186<refentryinfo>
31187 <title>LINUX</title>
31188 <productname>Kernel Hackers Manual</productname>
31189 <date>July 2017</date>
31190</refentryinfo>
31191<refmeta>
31192 <refentrytitle><phrase>mpt_put_msg_frame</phrase></refentrytitle>
31193 <manvolnum>9</manvolnum>
31194 <refmiscinfo class="version">4.4.14</refmiscinfo>
31195</refmeta>
31196<refnamediv>
31197 <refname>mpt_put_msg_frame</refname>
31198 <refpurpose>
31199     Send a protocol-specific MPT request frame to an IOC
31200 </refpurpose>
31201</refnamediv>
31202<refsynopsisdiv>
31203 <title>Synopsis</title>
31204  <funcsynopsis><funcprototype>
31205   <funcdef>void <function>mpt_put_msg_frame </function></funcdef>
31206   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
31207   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31208   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
31209  </funcprototype></funcsynopsis>
31210</refsynopsisdiv>
31211<refsect1>
31212 <title>Arguments</title>
31213 <variablelist>
31214  <varlistentry>
31215   <term><parameter>cb_idx</parameter></term>
31216   <listitem>
31217    <para>
31218     Handle of registered MPT protocol driver
31219    </para>
31220   </listitem>
31221  </varlistentry>
31222  <varlistentry>
31223   <term><parameter>ioc</parameter></term>
31224   <listitem>
31225    <para>
31226     Pointer to MPT adapter structure
31227    </para>
31228   </listitem>
31229  </varlistentry>
31230  <varlistentry>
31231   <term><parameter>mf</parameter></term>
31232   <listitem>
31233    <para>
31234     Pointer to MPT request frame
31235    </para>
31236   </listitem>
31237  </varlistentry>
31238 </variablelist>
31239</refsect1>
31240<refsect1>
31241<title>Description</title>
31242<para>
31243   This routine posts an MPT request frame to the request post FIFO of a
31244   specific MPT adapter.
31245</para>
31246</refsect1>
31247</refentry>
31248
31249<refentry id="API-mpt-put-msg-frame-hi-pri">
31250<refentryinfo>
31251 <title>LINUX</title>
31252 <productname>Kernel Hackers Manual</productname>
31253 <date>July 2017</date>
31254</refentryinfo>
31255<refmeta>
31256 <refentrytitle><phrase>mpt_put_msg_frame_hi_pri</phrase></refentrytitle>
31257 <manvolnum>9</manvolnum>
31258 <refmiscinfo class="version">4.4.14</refmiscinfo>
31259</refmeta>
31260<refnamediv>
31261 <refname>mpt_put_msg_frame_hi_pri</refname>
31262 <refpurpose>
31263     Send a hi-pri protocol-specific MPT request frame
31264 </refpurpose>
31265</refnamediv>
31266<refsynopsisdiv>
31267 <title>Synopsis</title>
31268  <funcsynopsis><funcprototype>
31269   <funcdef>void <function>mpt_put_msg_frame_hi_pri </function></funcdef>
31270   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
31271   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31272   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
31273  </funcprototype></funcsynopsis>
31274</refsynopsisdiv>
31275<refsect1>
31276 <title>Arguments</title>
31277 <variablelist>
31278  <varlistentry>
31279   <term><parameter>cb_idx</parameter></term>
31280   <listitem>
31281    <para>
31282     Handle of registered MPT protocol driver
31283    </para>
31284   </listitem>
31285  </varlistentry>
31286  <varlistentry>
31287   <term><parameter>ioc</parameter></term>
31288   <listitem>
31289    <para>
31290     Pointer to MPT adapter structure
31291    </para>
31292   </listitem>
31293  </varlistentry>
31294  <varlistentry>
31295   <term><parameter>mf</parameter></term>
31296   <listitem>
31297    <para>
31298     Pointer to MPT request frame
31299    </para>
31300   </listitem>
31301  </varlistentry>
31302 </variablelist>
31303</refsect1>
31304<refsect1>
31305<title>Description</title>
31306<para>
31307   Send a protocol-specific MPT request frame to an IOC using
31308   hi-priority request queue.
31309   </para><para>
31310
31311   This routine posts an MPT request frame to the request post FIFO of a
31312   specific MPT adapter.
31313</para>
31314</refsect1>
31315</refentry>
31316
31317<refentry id="API-mpt-free-msg-frame">
31318<refentryinfo>
31319 <title>LINUX</title>
31320 <productname>Kernel Hackers Manual</productname>
31321 <date>July 2017</date>
31322</refentryinfo>
31323<refmeta>
31324 <refentrytitle><phrase>mpt_free_msg_frame</phrase></refentrytitle>
31325 <manvolnum>9</manvolnum>
31326 <refmiscinfo class="version">4.4.14</refmiscinfo>
31327</refmeta>
31328<refnamediv>
31329 <refname>mpt_free_msg_frame</refname>
31330 <refpurpose>
31331     Place MPT request frame back on FreeQ.
31332 </refpurpose>
31333</refnamediv>
31334<refsynopsisdiv>
31335 <title>Synopsis</title>
31336  <funcsynopsis><funcprototype>
31337   <funcdef>void <function>mpt_free_msg_frame </function></funcdef>
31338   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31339   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
31340  </funcprototype></funcsynopsis>
31341</refsynopsisdiv>
31342<refsect1>
31343 <title>Arguments</title>
31344 <variablelist>
31345  <varlistentry>
31346   <term><parameter>ioc</parameter></term>
31347   <listitem>
31348    <para>
31349     Pointer to MPT adapter structure
31350    </para>
31351   </listitem>
31352  </varlistentry>
31353  <varlistentry>
31354   <term><parameter>mf</parameter></term>
31355   <listitem>
31356    <para>
31357     Pointer to MPT request frame
31358    </para>
31359   </listitem>
31360  </varlistentry>
31361 </variablelist>
31362</refsect1>
31363<refsect1>
31364<title>Description</title>
31365<para>
31366   This routine places a MPT request frame back on the MPT adapter's
31367   FreeQ.
31368</para>
31369</refsect1>
31370</refentry>
31371
31372<refentry id="API-mpt-send-handshake-request">
31373<refentryinfo>
31374 <title>LINUX</title>
31375 <productname>Kernel Hackers Manual</productname>
31376 <date>July 2017</date>
31377</refentryinfo>
31378<refmeta>
31379 <refentrytitle><phrase>mpt_send_handshake_request</phrase></refentrytitle>
31380 <manvolnum>9</manvolnum>
31381 <refmiscinfo class="version">4.4.14</refmiscinfo>
31382</refmeta>
31383<refnamediv>
31384 <refname>mpt_send_handshake_request</refname>
31385 <refpurpose>
31386     Send MPT request via doorbell handshake method.
31387 </refpurpose>
31388</refnamediv>
31389<refsynopsisdiv>
31390 <title>Synopsis</title>
31391  <funcsynopsis><funcprototype>
31392   <funcdef>int <function>mpt_send_handshake_request </function></funcdef>
31393   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
31394   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31395   <paramdef>int <parameter>reqBytes</parameter></paramdef>
31396   <paramdef>u32 * <parameter>req</parameter></paramdef>
31397   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
31398  </funcprototype></funcsynopsis>
31399</refsynopsisdiv>
31400<refsect1>
31401 <title>Arguments</title>
31402 <variablelist>
31403  <varlistentry>
31404   <term><parameter>cb_idx</parameter></term>
31405   <listitem>
31406    <para>
31407     Handle of registered MPT protocol driver
31408    </para>
31409   </listitem>
31410  </varlistentry>
31411  <varlistentry>
31412   <term><parameter>ioc</parameter></term>
31413   <listitem>
31414    <para>
31415     Pointer to MPT adapter structure
31416    </para>
31417   </listitem>
31418  </varlistentry>
31419  <varlistentry>
31420   <term><parameter>reqBytes</parameter></term>
31421   <listitem>
31422    <para>
31423     Size of the request in bytes
31424    </para>
31425   </listitem>
31426  </varlistentry>
31427  <varlistentry>
31428   <term><parameter>req</parameter></term>
31429   <listitem>
31430    <para>
31431     Pointer to MPT request frame
31432    </para>
31433   </listitem>
31434  </varlistentry>
31435  <varlistentry>
31436   <term><parameter>sleepFlag</parameter></term>
31437   <listitem>
31438    <para>
31439     Use schedule if CAN_SLEEP else use udelay.
31440    </para>
31441   </listitem>
31442  </varlistentry>
31443 </variablelist>
31444</refsect1>
31445<refsect1>
31446<title>Description</title>
31447<para>
31448   This routine is used exclusively to send MptScsiTaskMgmt
31449   requests since they are required to be sent via doorbell handshake.
31450</para>
31451</refsect1>
31452<refsect1>
31453<title>NOTE</title>
31454<para>
31455   It is the callers responsibility to byte-swap fields in the
31456   request which are greater than 1 byte in size.
31457   </para><para>
31458
31459   Returns 0 for success, non-zero for failure.
31460</para>
31461</refsect1>
31462</refentry>
31463
31464<refentry id="API-mpt-verify-adapter">
31465<refentryinfo>
31466 <title>LINUX</title>
31467 <productname>Kernel Hackers Manual</productname>
31468 <date>July 2017</date>
31469</refentryinfo>
31470<refmeta>
31471 <refentrytitle><phrase>mpt_verify_adapter</phrase></refentrytitle>
31472 <manvolnum>9</manvolnum>
31473 <refmiscinfo class="version">4.4.14</refmiscinfo>
31474</refmeta>
31475<refnamediv>
31476 <refname>mpt_verify_adapter</refname>
31477 <refpurpose>
31478     Given IOC identifier, set pointer to its adapter structure.
31479 </refpurpose>
31480</refnamediv>
31481<refsynopsisdiv>
31482 <title>Synopsis</title>
31483  <funcsynopsis><funcprototype>
31484   <funcdef>int <function>mpt_verify_adapter </function></funcdef>
31485   <paramdef>int <parameter>iocid</parameter></paramdef>
31486   <paramdef>MPT_ADAPTER ** <parameter>iocpp</parameter></paramdef>
31487  </funcprototype></funcsynopsis>
31488</refsynopsisdiv>
31489<refsect1>
31490 <title>Arguments</title>
31491 <variablelist>
31492  <varlistentry>
31493   <term><parameter>iocid</parameter></term>
31494   <listitem>
31495    <para>
31496     IOC unique identifier (integer)
31497    </para>
31498   </listitem>
31499  </varlistentry>
31500  <varlistentry>
31501   <term><parameter>iocpp</parameter></term>
31502   <listitem>
31503    <para>
31504     Pointer to pointer to IOC adapter
31505    </para>
31506   </listitem>
31507  </varlistentry>
31508 </variablelist>
31509</refsect1>
31510<refsect1>
31511<title>Description</title>
31512<para>
31513   Given a unique IOC identifier, set pointer to the associated MPT
31514   adapter structure.
31515   </para><para>
31516
31517   Returns iocid and sets iocpp if iocid is found.
31518   Returns -1 if iocid is not found.
31519</para>
31520</refsect1>
31521</refentry>
31522
31523<refentry id="API-mpt-attach">
31524<refentryinfo>
31525 <title>LINUX</title>
31526 <productname>Kernel Hackers Manual</productname>
31527 <date>July 2017</date>
31528</refentryinfo>
31529<refmeta>
31530 <refentrytitle><phrase>mpt_attach</phrase></refentrytitle>
31531 <manvolnum>9</manvolnum>
31532 <refmiscinfo class="version">4.4.14</refmiscinfo>
31533</refmeta>
31534<refnamediv>
31535 <refname>mpt_attach</refname>
31536 <refpurpose>
31537     Install a PCI intelligent MPT adapter.
31538 </refpurpose>
31539</refnamediv>
31540<refsynopsisdiv>
31541 <title>Synopsis</title>
31542  <funcsynopsis><funcprototype>
31543   <funcdef>int <function>mpt_attach </function></funcdef>
31544   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
31545   <paramdef>const struct pci_device_id * <parameter>id</parameter></paramdef>
31546  </funcprototype></funcsynopsis>
31547</refsynopsisdiv>
31548<refsect1>
31549 <title>Arguments</title>
31550 <variablelist>
31551  <varlistentry>
31552   <term><parameter>pdev</parameter></term>
31553   <listitem>
31554    <para>
31555     Pointer to pci_dev structure
31556    </para>
31557   </listitem>
31558  </varlistentry>
31559  <varlistentry>
31560   <term><parameter>id</parameter></term>
31561   <listitem>
31562    <para>
31563     PCI device ID information
31564    </para>
31565   </listitem>
31566  </varlistentry>
31567 </variablelist>
31568</refsect1>
31569<refsect1>
31570<title>Description</title>
31571<para>
31572   This routine performs all the steps necessary to bring the IOC of
31573   a MPT adapter to a OPERATIONAL state.  This includes registering
31574   memory regions, registering the interrupt, and allocating request
31575   and reply memory pools.
31576   </para><para>
31577
31578   This routine also pre-fetches the LAN MAC address of a Fibre Channel
31579   MPT adapter.
31580   </para><para>
31581
31582   Returns 0 for success, non-zero for failure.
31583</para>
31584</refsect1>
31585<refsect1>
31586<title>TODO</title>
31587<para>
31588   Add support for polled controllers
31589</para>
31590</refsect1>
31591</refentry>
31592
31593<refentry id="API-mpt-detach">
31594<refentryinfo>
31595 <title>LINUX</title>
31596 <productname>Kernel Hackers Manual</productname>
31597 <date>July 2017</date>
31598</refentryinfo>
31599<refmeta>
31600 <refentrytitle><phrase>mpt_detach</phrase></refentrytitle>
31601 <manvolnum>9</manvolnum>
31602 <refmiscinfo class="version">4.4.14</refmiscinfo>
31603</refmeta>
31604<refnamediv>
31605 <refname>mpt_detach</refname>
31606 <refpurpose>
31607     Remove a PCI intelligent MPT adapter.
31608 </refpurpose>
31609</refnamediv>
31610<refsynopsisdiv>
31611 <title>Synopsis</title>
31612  <funcsynopsis><funcprototype>
31613   <funcdef>void <function>mpt_detach </function></funcdef>
31614   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
31615  </funcprototype></funcsynopsis>
31616</refsynopsisdiv>
31617<refsect1>
31618 <title>Arguments</title>
31619 <variablelist>
31620  <varlistentry>
31621   <term><parameter>pdev</parameter></term>
31622   <listitem>
31623    <para>
31624     Pointer to pci_dev structure
31625    </para>
31626   </listitem>
31627  </varlistentry>
31628 </variablelist>
31629</refsect1>
31630</refentry>
31631
31632<refentry id="API-mpt-suspend">
31633<refentryinfo>
31634 <title>LINUX</title>
31635 <productname>Kernel Hackers Manual</productname>
31636 <date>July 2017</date>
31637</refentryinfo>
31638<refmeta>
31639 <refentrytitle><phrase>mpt_suspend</phrase></refentrytitle>
31640 <manvolnum>9</manvolnum>
31641 <refmiscinfo class="version">4.4.14</refmiscinfo>
31642</refmeta>
31643<refnamediv>
31644 <refname>mpt_suspend</refname>
31645 <refpurpose>
31646     Fusion MPT base driver suspend routine.
31647 </refpurpose>
31648</refnamediv>
31649<refsynopsisdiv>
31650 <title>Synopsis</title>
31651  <funcsynopsis><funcprototype>
31652   <funcdef>int <function>mpt_suspend </function></funcdef>
31653   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
31654   <paramdef>pm_message_t <parameter>state</parameter></paramdef>
31655  </funcprototype></funcsynopsis>
31656</refsynopsisdiv>
31657<refsect1>
31658 <title>Arguments</title>
31659 <variablelist>
31660  <varlistentry>
31661   <term><parameter>pdev</parameter></term>
31662   <listitem>
31663    <para>
31664     Pointer to pci_dev structure
31665    </para>
31666   </listitem>
31667  </varlistentry>
31668  <varlistentry>
31669   <term><parameter>state</parameter></term>
31670   <listitem>
31671    <para>
31672     new state to enter
31673    </para>
31674   </listitem>
31675  </varlistentry>
31676 </variablelist>
31677</refsect1>
31678</refentry>
31679
31680<refentry id="API-mpt-resume">
31681<refentryinfo>
31682 <title>LINUX</title>
31683 <productname>Kernel Hackers Manual</productname>
31684 <date>July 2017</date>
31685</refentryinfo>
31686<refmeta>
31687 <refentrytitle><phrase>mpt_resume</phrase></refentrytitle>
31688 <manvolnum>9</manvolnum>
31689 <refmiscinfo class="version">4.4.14</refmiscinfo>
31690</refmeta>
31691<refnamediv>
31692 <refname>mpt_resume</refname>
31693 <refpurpose>
31694     Fusion MPT base driver resume routine.
31695 </refpurpose>
31696</refnamediv>
31697<refsynopsisdiv>
31698 <title>Synopsis</title>
31699  <funcsynopsis><funcprototype>
31700   <funcdef>int <function>mpt_resume </function></funcdef>
31701   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
31702  </funcprototype></funcsynopsis>
31703</refsynopsisdiv>
31704<refsect1>
31705 <title>Arguments</title>
31706 <variablelist>
31707  <varlistentry>
31708   <term><parameter>pdev</parameter></term>
31709   <listitem>
31710    <para>
31711     Pointer to pci_dev structure
31712    </para>
31713   </listitem>
31714  </varlistentry>
31715 </variablelist>
31716</refsect1>
31717</refentry>
31718
31719<refentry id="API-mpt-GetIocState">
31720<refentryinfo>
31721 <title>LINUX</title>
31722 <productname>Kernel Hackers Manual</productname>
31723 <date>July 2017</date>
31724</refentryinfo>
31725<refmeta>
31726 <refentrytitle><phrase>mpt_GetIocState</phrase></refentrytitle>
31727 <manvolnum>9</manvolnum>
31728 <refmiscinfo class="version">4.4.14</refmiscinfo>
31729</refmeta>
31730<refnamediv>
31731 <refname>mpt_GetIocState</refname>
31732 <refpurpose>
31733     Get the current state of a MPT adapter.
31734 </refpurpose>
31735</refnamediv>
31736<refsynopsisdiv>
31737 <title>Synopsis</title>
31738  <funcsynopsis><funcprototype>
31739   <funcdef>u32 <function>mpt_GetIocState </function></funcdef>
31740   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31741   <paramdef>int <parameter>cooked</parameter></paramdef>
31742  </funcprototype></funcsynopsis>
31743</refsynopsisdiv>
31744<refsect1>
31745 <title>Arguments</title>
31746 <variablelist>
31747  <varlistentry>
31748   <term><parameter>ioc</parameter></term>
31749   <listitem>
31750    <para>
31751     Pointer to MPT_ADAPTER structure
31752    </para>
31753   </listitem>
31754  </varlistentry>
31755  <varlistentry>
31756   <term><parameter>cooked</parameter></term>
31757   <listitem>
31758    <para>
31759     Request raw or cooked IOC state
31760    </para>
31761   </listitem>
31762  </varlistentry>
31763 </variablelist>
31764</refsect1>
31765<refsect1>
31766<title>Description</title>
31767<para>
31768   Returns all IOC Doorbell register bits if cooked==0, else just the
31769   Doorbell bits in MPI_IOC_STATE_MASK.
31770</para>
31771</refsect1>
31772</refentry>
31773
31774<refentry id="API-mpt-alloc-fw-memory">
31775<refentryinfo>
31776 <title>LINUX</title>
31777 <productname>Kernel Hackers Manual</productname>
31778 <date>July 2017</date>
31779</refentryinfo>
31780<refmeta>
31781 <refentrytitle><phrase>mpt_alloc_fw_memory</phrase></refentrytitle>
31782 <manvolnum>9</manvolnum>
31783 <refmiscinfo class="version">4.4.14</refmiscinfo>
31784</refmeta>
31785<refnamediv>
31786 <refname>mpt_alloc_fw_memory</refname>
31787 <refpurpose>
31788     allocate firmware memory
31789 </refpurpose>
31790</refnamediv>
31791<refsynopsisdiv>
31792 <title>Synopsis</title>
31793  <funcsynopsis><funcprototype>
31794   <funcdef>int <function>mpt_alloc_fw_memory </function></funcdef>
31795   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31796   <paramdef>int <parameter>size</parameter></paramdef>
31797  </funcprototype></funcsynopsis>
31798</refsynopsisdiv>
31799<refsect1>
31800 <title>Arguments</title>
31801 <variablelist>
31802  <varlistentry>
31803   <term><parameter>ioc</parameter></term>
31804   <listitem>
31805    <para>
31806     Pointer to MPT_ADAPTER structure
31807    </para>
31808   </listitem>
31809  </varlistentry>
31810  <varlistentry>
31811   <term><parameter>size</parameter></term>
31812   <listitem>
31813    <para>
31814     total FW bytes
31815    </para>
31816   </listitem>
31817  </varlistentry>
31818 </variablelist>
31819</refsect1>
31820<refsect1>
31821<title>Description</title>
31822<para>
31823   If memory has already been allocated, the same (cached) value
31824   is returned.
31825   </para><para>
31826
31827   Return 0 if successful, or non-zero for failure
31828</para>
31829</refsect1>
31830</refentry>
31831
31832<refentry id="API-mpt-free-fw-memory">
31833<refentryinfo>
31834 <title>LINUX</title>
31835 <productname>Kernel Hackers Manual</productname>
31836 <date>July 2017</date>
31837</refentryinfo>
31838<refmeta>
31839 <refentrytitle><phrase>mpt_free_fw_memory</phrase></refentrytitle>
31840 <manvolnum>9</manvolnum>
31841 <refmiscinfo class="version">4.4.14</refmiscinfo>
31842</refmeta>
31843<refnamediv>
31844 <refname>mpt_free_fw_memory</refname>
31845 <refpurpose>
31846     free firmware memory
31847 </refpurpose>
31848</refnamediv>
31849<refsynopsisdiv>
31850 <title>Synopsis</title>
31851  <funcsynopsis><funcprototype>
31852   <funcdef>void <function>mpt_free_fw_memory </function></funcdef>
31853   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31854  </funcprototype></funcsynopsis>
31855</refsynopsisdiv>
31856<refsect1>
31857 <title>Arguments</title>
31858 <variablelist>
31859  <varlistentry>
31860   <term><parameter>ioc</parameter></term>
31861   <listitem>
31862    <para>
31863     Pointer to MPT_ADAPTER structure
31864    </para>
31865   </listitem>
31866  </varlistentry>
31867 </variablelist>
31868</refsect1>
31869<refsect1>
31870<title>Description</title>
31871<para>
31872   If alt_img is NULL, delete from ioc structure.
31873   Else, delete a secondary image in same format.
31874</para>
31875</refsect1>
31876</refentry>
31877
31878<refentry id="API-mptbase-sas-persist-operation">
31879<refentryinfo>
31880 <title>LINUX</title>
31881 <productname>Kernel Hackers Manual</productname>
31882 <date>July 2017</date>
31883</refentryinfo>
31884<refmeta>
31885 <refentrytitle><phrase>mptbase_sas_persist_operation</phrase></refentrytitle>
31886 <manvolnum>9</manvolnum>
31887 <refmiscinfo class="version">4.4.14</refmiscinfo>
31888</refmeta>
31889<refnamediv>
31890 <refname>mptbase_sas_persist_operation</refname>
31891 <refpurpose>
31892     Perform operation on SAS Persistent Table
31893 </refpurpose>
31894</refnamediv>
31895<refsynopsisdiv>
31896 <title>Synopsis</title>
31897  <funcsynopsis><funcprototype>
31898   <funcdef>int <function>mptbase_sas_persist_operation </function></funcdef>
31899   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31900   <paramdef>u8 <parameter>persist_opcode</parameter></paramdef>
31901  </funcprototype></funcsynopsis>
31902</refsynopsisdiv>
31903<refsect1>
31904 <title>Arguments</title>
31905 <variablelist>
31906  <varlistentry>
31907   <term><parameter>ioc</parameter></term>
31908   <listitem>
31909    <para>
31910     Pointer to MPT_ADAPTER structure
31911    </para>
31912   </listitem>
31913  </varlistentry>
31914  <varlistentry>
31915   <term><parameter>persist_opcode</parameter></term>
31916   <listitem>
31917    <para>
31918     see below
31919    </para>
31920   </listitem>
31921  </varlistentry>
31922 </variablelist>
31923</refsect1>
31924<refsect1>
31925<title>Description</title>
31926<para>
31927   MPI_SAS_OP_CLEAR_NOT_PRESENT - Free all persist TargetID mappings for
31928   devices not currently present.
31929   MPI_SAS_OP_CLEAR_ALL_PERSISTENT - Clear al persist TargetID mappings
31930</para>
31931</refsect1>
31932<refsect1>
31933<title>NOTE</title>
31934<para>
31935   Don't use not this function during interrupt time.
31936   </para><para>
31937
31938   Returns 0 for success, non-zero error
31939</para>
31940</refsect1>
31941</refentry>
31942
31943<refentry id="API-mpt-raid-phys-disk-pg0">
31944<refentryinfo>
31945 <title>LINUX</title>
31946 <productname>Kernel Hackers Manual</productname>
31947 <date>July 2017</date>
31948</refentryinfo>
31949<refmeta>
31950 <refentrytitle><phrase>mpt_raid_phys_disk_pg0</phrase></refentrytitle>
31951 <manvolnum>9</manvolnum>
31952 <refmiscinfo class="version">4.4.14</refmiscinfo>
31953</refmeta>
31954<refnamediv>
31955 <refname>mpt_raid_phys_disk_pg0</refname>
31956 <refpurpose>
31957     returns phys disk page zero
31958 </refpurpose>
31959</refnamediv>
31960<refsynopsisdiv>
31961 <title>Synopsis</title>
31962  <funcsynopsis><funcprototype>
31963   <funcdef>int <function>mpt_raid_phys_disk_pg0 </function></funcdef>
31964   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
31965   <paramdef>u8 <parameter>phys_disk_num</parameter></paramdef>
31966   <paramdef>RaidPhysDiskPage0_t * <parameter>phys_disk</parameter></paramdef>
31967  </funcprototype></funcsynopsis>
31968</refsynopsisdiv>
31969<refsect1>
31970 <title>Arguments</title>
31971 <variablelist>
31972  <varlistentry>
31973   <term><parameter>ioc</parameter></term>
31974   <listitem>
31975    <para>
31976     Pointer to a Adapter Structure
31977    </para>
31978   </listitem>
31979  </varlistentry>
31980  <varlistentry>
31981   <term><parameter>phys_disk_num</parameter></term>
31982   <listitem>
31983    <para>
31984     io unit unique phys disk num generated by the ioc
31985    </para>
31986   </listitem>
31987  </varlistentry>
31988  <varlistentry>
31989   <term><parameter>phys_disk</parameter></term>
31990   <listitem>
31991    <para>
31992     requested payload data returned
31993    </para>
31994   </listitem>
31995  </varlistentry>
31996 </variablelist>
31997</refsect1>
31998<refsect1>
31999<title>Return</title>
32000<para>
32001   0 on success
32002   -EFAULT if read of config page header fails or data pointer not NULL
32003   -ENOMEM if pci_alloc failed
32004</para>
32005</refsect1>
32006</refentry>
32007
32008<refentry id="API-mpt-raid-phys-disk-get-num-paths">
32009<refentryinfo>
32010 <title>LINUX</title>
32011 <productname>Kernel Hackers Manual</productname>
32012 <date>July 2017</date>
32013</refentryinfo>
32014<refmeta>
32015 <refentrytitle><phrase>mpt_raid_phys_disk_get_num_paths</phrase></refentrytitle>
32016 <manvolnum>9</manvolnum>
32017 <refmiscinfo class="version">4.4.14</refmiscinfo>
32018</refmeta>
32019<refnamediv>
32020 <refname>mpt_raid_phys_disk_get_num_paths</refname>
32021 <refpurpose>
32022     returns number paths associated to this phys_num
32023 </refpurpose>
32024</refnamediv>
32025<refsynopsisdiv>
32026 <title>Synopsis</title>
32027  <funcsynopsis><funcprototype>
32028   <funcdef>int <function>mpt_raid_phys_disk_get_num_paths </function></funcdef>
32029   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32030   <paramdef>u8 <parameter>phys_disk_num</parameter></paramdef>
32031  </funcprototype></funcsynopsis>
32032</refsynopsisdiv>
32033<refsect1>
32034 <title>Arguments</title>
32035 <variablelist>
32036  <varlistentry>
32037   <term><parameter>ioc</parameter></term>
32038   <listitem>
32039    <para>
32040     Pointer to a Adapter Structure
32041    </para>
32042   </listitem>
32043  </varlistentry>
32044  <varlistentry>
32045   <term><parameter>phys_disk_num</parameter></term>
32046   <listitem>
32047    <para>
32048     io unit unique phys disk num generated by the ioc
32049    </para>
32050   </listitem>
32051  </varlistentry>
32052 </variablelist>
32053</refsect1>
32054<refsect1>
32055<title>Return</title>
32056<para>
32057   returns number paths
32058</para>
32059</refsect1>
32060</refentry>
32061
32062<refentry id="API-mpt-raid-phys-disk-pg1">
32063<refentryinfo>
32064 <title>LINUX</title>
32065 <productname>Kernel Hackers Manual</productname>
32066 <date>July 2017</date>
32067</refentryinfo>
32068<refmeta>
32069 <refentrytitle><phrase>mpt_raid_phys_disk_pg1</phrase></refentrytitle>
32070 <manvolnum>9</manvolnum>
32071 <refmiscinfo class="version">4.4.14</refmiscinfo>
32072</refmeta>
32073<refnamediv>
32074 <refname>mpt_raid_phys_disk_pg1</refname>
32075 <refpurpose>
32076     returns phys disk page 1
32077 </refpurpose>
32078</refnamediv>
32079<refsynopsisdiv>
32080 <title>Synopsis</title>
32081  <funcsynopsis><funcprototype>
32082   <funcdef>int <function>mpt_raid_phys_disk_pg1 </function></funcdef>
32083   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32084   <paramdef>u8 <parameter>phys_disk_num</parameter></paramdef>
32085   <paramdef>RaidPhysDiskPage1_t * <parameter>phys_disk</parameter></paramdef>
32086  </funcprototype></funcsynopsis>
32087</refsynopsisdiv>
32088<refsect1>
32089 <title>Arguments</title>
32090 <variablelist>
32091  <varlistentry>
32092   <term><parameter>ioc</parameter></term>
32093   <listitem>
32094    <para>
32095     Pointer to a Adapter Structure
32096    </para>
32097   </listitem>
32098  </varlistentry>
32099  <varlistentry>
32100   <term><parameter>phys_disk_num</parameter></term>
32101   <listitem>
32102    <para>
32103     io unit unique phys disk num generated by the ioc
32104    </para>
32105   </listitem>
32106  </varlistentry>
32107  <varlistentry>
32108   <term><parameter>phys_disk</parameter></term>
32109   <listitem>
32110    <para>
32111     requested payload data returned
32112    </para>
32113   </listitem>
32114  </varlistentry>
32115 </variablelist>
32116</refsect1>
32117<refsect1>
32118<title>Return</title>
32119<para>
32120   0 on success
32121   -EFAULT if read of config page header fails or data pointer not NULL
32122   -ENOMEM if pci_alloc failed
32123</para>
32124</refsect1>
32125</refentry>
32126
32127<refentry id="API-mpt-findImVolumes">
32128<refentryinfo>
32129 <title>LINUX</title>
32130 <productname>Kernel Hackers Manual</productname>
32131 <date>July 2017</date>
32132</refentryinfo>
32133<refmeta>
32134 <refentrytitle><phrase>mpt_findImVolumes</phrase></refentrytitle>
32135 <manvolnum>9</manvolnum>
32136 <refmiscinfo class="version">4.4.14</refmiscinfo>
32137</refmeta>
32138<refnamediv>
32139 <refname>mpt_findImVolumes</refname>
32140 <refpurpose>
32141     Identify IDs of hidden disks and RAID Volumes
32142 </refpurpose>
32143</refnamediv>
32144<refsynopsisdiv>
32145 <title>Synopsis</title>
32146  <funcsynopsis><funcprototype>
32147   <funcdef>int <function>mpt_findImVolumes </function></funcdef>
32148   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32149  </funcprototype></funcsynopsis>
32150</refsynopsisdiv>
32151<refsect1>
32152 <title>Arguments</title>
32153 <variablelist>
32154  <varlistentry>
32155   <term><parameter>ioc</parameter></term>
32156   <listitem>
32157    <para>
32158     Pointer to a Adapter Strucutre
32159    </para>
32160   </listitem>
32161  </varlistentry>
32162 </variablelist>
32163</refsect1>
32164<refsect1>
32165<title>Return</title>
32166<para>
32167   0 on success
32168   -EFAULT if read of config page header fails or data pointer not NULL
32169   -ENOMEM if pci_alloc failed
32170</para>
32171</refsect1>
32172</refentry>
32173
32174<refentry id="API-mpt-config">
32175<refentryinfo>
32176 <title>LINUX</title>
32177 <productname>Kernel Hackers Manual</productname>
32178 <date>July 2017</date>
32179</refentryinfo>
32180<refmeta>
32181 <refentrytitle><phrase>mpt_config</phrase></refentrytitle>
32182 <manvolnum>9</manvolnum>
32183 <refmiscinfo class="version">4.4.14</refmiscinfo>
32184</refmeta>
32185<refnamediv>
32186 <refname>mpt_config</refname>
32187 <refpurpose>
32188     Generic function to issue config message
32189 </refpurpose>
32190</refnamediv>
32191<refsynopsisdiv>
32192 <title>Synopsis</title>
32193  <funcsynopsis><funcprototype>
32194   <funcdef>int <function>mpt_config </function></funcdef>
32195   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32196   <paramdef>CONFIGPARMS * <parameter>pCfg</parameter></paramdef>
32197  </funcprototype></funcsynopsis>
32198</refsynopsisdiv>
32199<refsect1>
32200 <title>Arguments</title>
32201 <variablelist>
32202  <varlistentry>
32203   <term><parameter>ioc</parameter></term>
32204   <listitem>
32205    <para>
32206     Pointer to an adapter structure
32207    </para>
32208   </listitem>
32209  </varlistentry>
32210  <varlistentry>
32211   <term><parameter>pCfg</parameter></term>
32212   <listitem>
32213    <para>
32214     Pointer to a configuration structure. Struct contains
32215     action, page address, direction, physical address
32216     and pointer to a configuration page header
32217     Page header is updated.
32218    </para>
32219   </listitem>
32220  </varlistentry>
32221 </variablelist>
32222</refsect1>
32223<refsect1>
32224<title>Description</title>
32225<para>
32226   Returns 0 for success
32227   -EPERM if not allowed due to ISR context
32228   -EAGAIN if no msg frames currently available
32229   -EFAULT for non-successful reply or no reply (timeout)
32230</para>
32231</refsect1>
32232</refentry>
32233
32234<refentry id="API-mpt-print-ioc-summary">
32235<refentryinfo>
32236 <title>LINUX</title>
32237 <productname>Kernel Hackers Manual</productname>
32238 <date>July 2017</date>
32239</refentryinfo>
32240<refmeta>
32241 <refentrytitle><phrase>mpt_print_ioc_summary</phrase></refentrytitle>
32242 <manvolnum>9</manvolnum>
32243 <refmiscinfo class="version">4.4.14</refmiscinfo>
32244</refmeta>
32245<refnamediv>
32246 <refname>mpt_print_ioc_summary</refname>
32247 <refpurpose>
32248     Write ASCII summary of IOC to a buffer.
32249 </refpurpose>
32250</refnamediv>
32251<refsynopsisdiv>
32252 <title>Synopsis</title>
32253  <funcsynopsis><funcprototype>
32254   <funcdef>void <function>mpt_print_ioc_summary </function></funcdef>
32255   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32256   <paramdef>char * <parameter>buffer</parameter></paramdef>
32257   <paramdef>int * <parameter>size</parameter></paramdef>
32258   <paramdef>int <parameter>len</parameter></paramdef>
32259   <paramdef>int <parameter>showlan</parameter></paramdef>
32260  </funcprototype></funcsynopsis>
32261</refsynopsisdiv>
32262<refsect1>
32263 <title>Arguments</title>
32264 <variablelist>
32265  <varlistentry>
32266   <term><parameter>ioc</parameter></term>
32267   <listitem>
32268    <para>
32269     Pointer to MPT_ADAPTER structure
32270    </para>
32271   </listitem>
32272  </varlistentry>
32273  <varlistentry>
32274   <term><parameter>buffer</parameter></term>
32275   <listitem>
32276    <para>
32277     Pointer to buffer where IOC summary info should be written
32278    </para>
32279   </listitem>
32280  </varlistentry>
32281  <varlistentry>
32282   <term><parameter>size</parameter></term>
32283   <listitem>
32284    <para>
32285     Pointer to number of bytes we wrote (set by this routine)
32286    </para>
32287   </listitem>
32288  </varlistentry>
32289  <varlistentry>
32290   <term><parameter>len</parameter></term>
32291   <listitem>
32292    <para>
32293     Offset at which to start writing in buffer
32294    </para>
32295   </listitem>
32296  </varlistentry>
32297  <varlistentry>
32298   <term><parameter>showlan</parameter></term>
32299   <listitem>
32300    <para>
32301     Display LAN stuff?
32302    </para>
32303   </listitem>
32304  </varlistentry>
32305 </variablelist>
32306</refsect1>
32307<refsect1>
32308<title>Description</title>
32309<para>
32310   This routine writes (english readable) ASCII text, which represents
32311   a summary of IOC information, to a buffer.
32312</para>
32313</refsect1>
32314</refentry>
32315
32316<refentry id="API-mpt-set-taskmgmt-in-progress-flag">
32317<refentryinfo>
32318 <title>LINUX</title>
32319 <productname>Kernel Hackers Manual</productname>
32320 <date>July 2017</date>
32321</refentryinfo>
32322<refmeta>
32323 <refentrytitle><phrase>mpt_set_taskmgmt_in_progress_flag</phrase></refentrytitle>
32324 <manvolnum>9</manvolnum>
32325 <refmiscinfo class="version">4.4.14</refmiscinfo>
32326</refmeta>
32327<refnamediv>
32328 <refname>mpt_set_taskmgmt_in_progress_flag</refname>
32329 <refpurpose>
32330     set flags associated with task management
32331 </refpurpose>
32332</refnamediv>
32333<refsynopsisdiv>
32334 <title>Synopsis</title>
32335  <funcsynopsis><funcprototype>
32336   <funcdef>int <function>mpt_set_taskmgmt_in_progress_flag </function></funcdef>
32337   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32338  </funcprototype></funcsynopsis>
32339</refsynopsisdiv>
32340<refsect1>
32341 <title>Arguments</title>
32342 <variablelist>
32343  <varlistentry>
32344   <term><parameter>ioc</parameter></term>
32345   <listitem>
32346    <para>
32347     Pointer to MPT_ADAPTER structure
32348    </para>
32349   </listitem>
32350  </varlistentry>
32351 </variablelist>
32352</refsect1>
32353<refsect1>
32354<title>Description</title>
32355<para>
32356   Returns 0 for SUCCESS or -1 if FAILED.
32357   </para><para>
32358
32359   If -1 is return, then it was not possible to set the flags
32360</para>
32361</refsect1>
32362</refentry>
32363
32364<refentry id="API-mpt-clear-taskmgmt-in-progress-flag">
32365<refentryinfo>
32366 <title>LINUX</title>
32367 <productname>Kernel Hackers Manual</productname>
32368 <date>July 2017</date>
32369</refentryinfo>
32370<refmeta>
32371 <refentrytitle><phrase>mpt_clear_taskmgmt_in_progress_flag</phrase></refentrytitle>
32372 <manvolnum>9</manvolnum>
32373 <refmiscinfo class="version">4.4.14</refmiscinfo>
32374</refmeta>
32375<refnamediv>
32376 <refname>mpt_clear_taskmgmt_in_progress_flag</refname>
32377 <refpurpose>
32378     clear flags associated with task management
32379 </refpurpose>
32380</refnamediv>
32381<refsynopsisdiv>
32382 <title>Synopsis</title>
32383  <funcsynopsis><funcprototype>
32384   <funcdef>void <function>mpt_clear_taskmgmt_in_progress_flag </function></funcdef>
32385   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32386  </funcprototype></funcsynopsis>
32387</refsynopsisdiv>
32388<refsect1>
32389 <title>Arguments</title>
32390 <variablelist>
32391  <varlistentry>
32392   <term><parameter>ioc</parameter></term>
32393   <listitem>
32394    <para>
32395     Pointer to MPT_ADAPTER structure
32396    </para>
32397   </listitem>
32398  </varlistentry>
32399 </variablelist>
32400</refsect1>
32401</refentry>
32402
32403<refentry id="API-mpt-halt-firmware">
32404<refentryinfo>
32405 <title>LINUX</title>
32406 <productname>Kernel Hackers Manual</productname>
32407 <date>July 2017</date>
32408</refentryinfo>
32409<refmeta>
32410 <refentrytitle><phrase>mpt_halt_firmware</phrase></refentrytitle>
32411 <manvolnum>9</manvolnum>
32412 <refmiscinfo class="version">4.4.14</refmiscinfo>
32413</refmeta>
32414<refnamediv>
32415 <refname>mpt_halt_firmware</refname>
32416 <refpurpose>
32417     Halts the firmware if it is operational and panic the kernel
32418 </refpurpose>
32419</refnamediv>
32420<refsynopsisdiv>
32421 <title>Synopsis</title>
32422  <funcsynopsis><funcprototype>
32423   <funcdef>void <function>mpt_halt_firmware </function></funcdef>
32424   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32425  </funcprototype></funcsynopsis>
32426</refsynopsisdiv>
32427<refsect1>
32428 <title>Arguments</title>
32429 <variablelist>
32430  <varlistentry>
32431   <term><parameter>ioc</parameter></term>
32432   <listitem>
32433    <para>
32434     Pointer to MPT_ADAPTER structure
32435    </para>
32436   </listitem>
32437  </varlistentry>
32438 </variablelist>
32439</refsect1>
32440</refentry>
32441
32442<refentry id="API-mpt-Soft-Hard-ResetHandler">
32443<refentryinfo>
32444 <title>LINUX</title>
32445 <productname>Kernel Hackers Manual</productname>
32446 <date>July 2017</date>
32447</refentryinfo>
32448<refmeta>
32449 <refentrytitle><phrase>mpt_Soft_Hard_ResetHandler</phrase></refentrytitle>
32450 <manvolnum>9</manvolnum>
32451 <refmiscinfo class="version">4.4.14</refmiscinfo>
32452</refmeta>
32453<refnamediv>
32454 <refname>mpt_Soft_Hard_ResetHandler</refname>
32455 <refpurpose>
32456     Try less expensive reset
32457 </refpurpose>
32458</refnamediv>
32459<refsynopsisdiv>
32460 <title>Synopsis</title>
32461  <funcsynopsis><funcprototype>
32462   <funcdef>int <function>mpt_Soft_Hard_ResetHandler </function></funcdef>
32463   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32464   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32465  </funcprototype></funcsynopsis>
32466</refsynopsisdiv>
32467<refsect1>
32468 <title>Arguments</title>
32469 <variablelist>
32470  <varlistentry>
32471   <term><parameter>ioc</parameter></term>
32472   <listitem>
32473    <para>
32474     Pointer to MPT_ADAPTER structure
32475    </para>
32476   </listitem>
32477  </varlistentry>
32478  <varlistentry>
32479   <term><parameter>sleepFlag</parameter></term>
32480   <listitem>
32481    <para>
32482     Indicates if sleep or schedule must be called.
32483    </para>
32484   </listitem>
32485  </varlistentry>
32486 </variablelist>
32487</refsect1>
32488<refsect1>
32489<title>Description</title>
32490<para>
32491   Returns 0 for SUCCESS or -1 if FAILED.
32492   Try for softreset first, only if it fails go for expensive
32493   HardReset.
32494</para>
32495</refsect1>
32496</refentry>
32497
32498<refentry id="API-mpt-HardResetHandler">
32499<refentryinfo>
32500 <title>LINUX</title>
32501 <productname>Kernel Hackers Manual</productname>
32502 <date>July 2017</date>
32503</refentryinfo>
32504<refmeta>
32505 <refentrytitle><phrase>mpt_HardResetHandler</phrase></refentrytitle>
32506 <manvolnum>9</manvolnum>
32507 <refmiscinfo class="version">4.4.14</refmiscinfo>
32508</refmeta>
32509<refnamediv>
32510 <refname>mpt_HardResetHandler</refname>
32511 <refpurpose>
32512     Generic reset handler
32513 </refpurpose>
32514</refnamediv>
32515<refsynopsisdiv>
32516 <title>Synopsis</title>
32517  <funcsynopsis><funcprototype>
32518   <funcdef>int <function>mpt_HardResetHandler </function></funcdef>
32519   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32520   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
32521  </funcprototype></funcsynopsis>
32522</refsynopsisdiv>
32523<refsect1>
32524 <title>Arguments</title>
32525 <variablelist>
32526  <varlistentry>
32527   <term><parameter>ioc</parameter></term>
32528   <listitem>
32529    <para>
32530     Pointer to MPT_ADAPTER structure
32531    </para>
32532   </listitem>
32533  </varlistentry>
32534  <varlistentry>
32535   <term><parameter>sleepFlag</parameter></term>
32536   <listitem>
32537    <para>
32538     Indicates if sleep or schedule must be called.
32539    </para>
32540   </listitem>
32541  </varlistentry>
32542 </variablelist>
32543</refsect1>
32544<refsect1>
32545<title>Description</title>
32546<para>
32547   Issues SCSI Task Management call based on input arg values.
32548   If TaskMgmt fails, returns associated SCSI request.
32549</para>
32550</refsect1>
32551<refsect1>
32552<title>Remark</title>
32553<para>
32554   _HardResetHandler can be invoked from an interrupt thread (timer)
32555   or a non-interrupt thread.  In the former, must not call <function>schedule</function>.
32556</para>
32557</refsect1>
32558<refsect1>
32559<title>Note</title>
32560<para>
32561   A return of -1 is a FATAL error case, as it means a
32562   FW reload/initialization failed.
32563   </para><para>
32564
32565   Returns 0 for SUCCESS or -1 if FAILED.
32566</para>
32567</refsect1>
32568</refentry>
32569
32570<!-- drivers/message/fusion/mptbase.c -->
32571<refentry id="API-mpt-get-cb-idx">
32572<refentryinfo>
32573 <title>LINUX</title>
32574 <productname>Kernel Hackers Manual</productname>
32575 <date>July 2017</date>
32576</refentryinfo>
32577<refmeta>
32578 <refentrytitle><phrase>mpt_get_cb_idx</phrase></refentrytitle>
32579 <manvolnum>9</manvolnum>
32580 <refmiscinfo class="version">4.4.14</refmiscinfo>
32581</refmeta>
32582<refnamediv>
32583 <refname>mpt_get_cb_idx</refname>
32584 <refpurpose>
32585  obtain cb_idx for registered driver
32586 </refpurpose>
32587</refnamediv>
32588<refsynopsisdiv>
32589 <title>Synopsis</title>
32590  <funcsynopsis><funcprototype>
32591   <funcdef>u8 <function>mpt_get_cb_idx </function></funcdef>
32592   <paramdef>MPT_DRIVER_CLASS <parameter>dclass</parameter></paramdef>
32593  </funcprototype></funcsynopsis>
32594</refsynopsisdiv>
32595<refsect1>
32596 <title>Arguments</title>
32597 <variablelist>
32598  <varlistentry>
32599   <term><parameter>dclass</parameter></term>
32600   <listitem>
32601    <para>
32602     class driver enum
32603    </para>
32604   </listitem>
32605  </varlistentry>
32606 </variablelist>
32607</refsect1>
32608<refsect1>
32609<title>Description</title>
32610<para>
32611   Returns cb_idx, or zero means it wasn't found
32612</para>
32613</refsect1>
32614</refentry>
32615
32616<refentry id="API-mpt-is-discovery-complete">
32617<refentryinfo>
32618 <title>LINUX</title>
32619 <productname>Kernel Hackers Manual</productname>
32620 <date>July 2017</date>
32621</refentryinfo>
32622<refmeta>
32623 <refentrytitle><phrase>mpt_is_discovery_complete</phrase></refentrytitle>
32624 <manvolnum>9</manvolnum>
32625 <refmiscinfo class="version">4.4.14</refmiscinfo>
32626</refmeta>
32627<refnamediv>
32628 <refname>mpt_is_discovery_complete</refname>
32629 <refpurpose>
32630     determine if discovery has completed
32631 </refpurpose>
32632</refnamediv>
32633<refsynopsisdiv>
32634 <title>Synopsis</title>
32635  <funcsynopsis><funcprototype>
32636   <funcdef>int <function>mpt_is_discovery_complete </function></funcdef>
32637   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32638  </funcprototype></funcsynopsis>
32639</refsynopsisdiv>
32640<refsect1>
32641 <title>Arguments</title>
32642 <variablelist>
32643  <varlistentry>
32644   <term><parameter>ioc</parameter></term>
32645   <listitem>
32646    <para>
32647     per adatper instance
32648    </para>
32649   </listitem>
32650  </varlistentry>
32651 </variablelist>
32652</refsect1>
32653<refsect1>
32654<title>Description</title>
32655<para>
32656   Returns 1 when discovery completed, else zero.
32657</para>
32658</refsect1>
32659</refentry>
32660
32661<refentry id="API-mpt-remove-dead-ioc-func">
32662<refentryinfo>
32663 <title>LINUX</title>
32664 <productname>Kernel Hackers Manual</productname>
32665 <date>July 2017</date>
32666</refentryinfo>
32667<refmeta>
32668 <refentrytitle><phrase>mpt_remove_dead_ioc_func</phrase></refentrytitle>
32669 <manvolnum>9</manvolnum>
32670 <refmiscinfo class="version">4.4.14</refmiscinfo>
32671</refmeta>
32672<refnamediv>
32673 <refname>mpt_remove_dead_ioc_func</refname>
32674 <refpurpose>
32675     kthread context to remove dead ioc
32676 </refpurpose>
32677</refnamediv>
32678<refsynopsisdiv>
32679 <title>Synopsis</title>
32680  <funcsynopsis><funcprototype>
32681   <funcdef>int <function>mpt_remove_dead_ioc_func </function></funcdef>
32682   <paramdef>void * <parameter>arg</parameter></paramdef>
32683  </funcprototype></funcsynopsis>
32684</refsynopsisdiv>
32685<refsect1>
32686 <title>Arguments</title>
32687 <variablelist>
32688  <varlistentry>
32689   <term><parameter>arg</parameter></term>
32690   <listitem>
32691    <para>
32692     input argument, used to derive ioc
32693    </para>
32694   </listitem>
32695  </varlistentry>
32696 </variablelist>
32697</refsect1>
32698<refsect1>
32699<title>Description</title>
32700<para>
32701   Return 0 if controller is removed from pci subsystem.
32702   Return -1 for other case.
32703</para>
32704</refsect1>
32705</refentry>
32706
32707<refentry id="API-mpt-fault-reset-work">
32708<refentryinfo>
32709 <title>LINUX</title>
32710 <productname>Kernel Hackers Manual</productname>
32711 <date>July 2017</date>
32712</refentryinfo>
32713<refmeta>
32714 <refentrytitle><phrase>mpt_fault_reset_work</phrase></refentrytitle>
32715 <manvolnum>9</manvolnum>
32716 <refmiscinfo class="version">4.4.14</refmiscinfo>
32717</refmeta>
32718<refnamediv>
32719 <refname>mpt_fault_reset_work</refname>
32720 <refpurpose>
32721     work performed on workq after ioc fault
32722 </refpurpose>
32723</refnamediv>
32724<refsynopsisdiv>
32725 <title>Synopsis</title>
32726  <funcsynopsis><funcprototype>
32727   <funcdef>void <function>mpt_fault_reset_work </function></funcdef>
32728   <paramdef>struct work_struct * <parameter>work</parameter></paramdef>
32729  </funcprototype></funcsynopsis>
32730</refsynopsisdiv>
32731<refsect1>
32732 <title>Arguments</title>
32733 <variablelist>
32734  <varlistentry>
32735   <term><parameter>work</parameter></term>
32736   <listitem>
32737    <para>
32738     input argument, used to derive ioc
32739    </para>
32740   </listitem>
32741  </varlistentry>
32742 </variablelist>
32743</refsect1>
32744</refentry>
32745
32746<refentry id="API-mpt-interrupt">
32747<refentryinfo>
32748 <title>LINUX</title>
32749 <productname>Kernel Hackers Manual</productname>
32750 <date>July 2017</date>
32751</refentryinfo>
32752<refmeta>
32753 <refentrytitle><phrase>mpt_interrupt</phrase></refentrytitle>
32754 <manvolnum>9</manvolnum>
32755 <refmiscinfo class="version">4.4.14</refmiscinfo>
32756</refmeta>
32757<refnamediv>
32758 <refname>mpt_interrupt</refname>
32759 <refpurpose>
32760     MPT adapter (IOC) specific interrupt handler.
32761 </refpurpose>
32762</refnamediv>
32763<refsynopsisdiv>
32764 <title>Synopsis</title>
32765  <funcsynopsis><funcprototype>
32766   <funcdef>irqreturn_t <function>mpt_interrupt </function></funcdef>
32767   <paramdef>int <parameter>irq</parameter></paramdef>
32768   <paramdef>void * <parameter>bus_id</parameter></paramdef>
32769  </funcprototype></funcsynopsis>
32770</refsynopsisdiv>
32771<refsect1>
32772 <title>Arguments</title>
32773 <variablelist>
32774  <varlistentry>
32775   <term><parameter>irq</parameter></term>
32776   <listitem>
32777    <para>
32778     irq number (not used)
32779    </para>
32780   </listitem>
32781  </varlistentry>
32782  <varlistentry>
32783   <term><parameter>bus_id</parameter></term>
32784   <listitem>
32785    <para>
32786     bus identifier cookie == pointer to MPT_ADAPTER structure
32787    </para>
32788   </listitem>
32789  </varlistentry>
32790 </variablelist>
32791</refsect1>
32792<refsect1>
32793<title>Description</title>
32794<para>
32795   This routine is registered via the <function>request_irq</function> kernel API call,
32796   and handles all interrupts generated from a specific MPT adapter
32797   (also referred to as a IO Controller or IOC).
32798   This routine must clear the interrupt from the adapter and does
32799   so by reading the reply FIFO.  Multiple replies may be processed
32800   per single call to this routine.
32801   </para><para>
32802
32803   This routine handles register-level access of the adapter but
32804   dispatches (calls) a protocol-specific callback routine to handle
32805   the protocol-specific details of the MPT request completion.
32806</para>
32807</refsect1>
32808</refentry>
32809
32810<refentry id="API-mptbase-reply">
32811<refentryinfo>
32812 <title>LINUX</title>
32813 <productname>Kernel Hackers Manual</productname>
32814 <date>July 2017</date>
32815</refentryinfo>
32816<refmeta>
32817 <refentrytitle><phrase>mptbase_reply</phrase></refentrytitle>
32818 <manvolnum>9</manvolnum>
32819 <refmiscinfo class="version">4.4.14</refmiscinfo>
32820</refmeta>
32821<refnamediv>
32822 <refname>mptbase_reply</refname>
32823 <refpurpose>
32824     MPT base driver's callback routine
32825 </refpurpose>
32826</refnamediv>
32827<refsynopsisdiv>
32828 <title>Synopsis</title>
32829  <funcsynopsis><funcprototype>
32830   <funcdef>int <function>mptbase_reply </function></funcdef>
32831   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
32832   <paramdef>MPT_FRAME_HDR * <parameter>req</parameter></paramdef>
32833   <paramdef>MPT_FRAME_HDR * <parameter>reply</parameter></paramdef>
32834  </funcprototype></funcsynopsis>
32835</refsynopsisdiv>
32836<refsect1>
32837 <title>Arguments</title>
32838 <variablelist>
32839  <varlistentry>
32840   <term><parameter>ioc</parameter></term>
32841   <listitem>
32842    <para>
32843     Pointer to MPT_ADAPTER structure
32844    </para>
32845   </listitem>
32846  </varlistentry>
32847  <varlistentry>
32848   <term><parameter>req</parameter></term>
32849   <listitem>
32850    <para>
32851     Pointer to original MPT request frame
32852    </para>
32853   </listitem>
32854  </varlistentry>
32855  <varlistentry>
32856   <term><parameter>reply</parameter></term>
32857   <listitem>
32858    <para>
32859     Pointer to MPT reply frame (NULL if TurboReply)
32860    </para>
32861   </listitem>
32862  </varlistentry>
32863 </variablelist>
32864</refsect1>
32865<refsect1>
32866<title>Description</title>
32867<para>
32868   MPT base driver's callback routine; all base driver
32869   <quote>internal</quote> request/reply processing is routed here.
32870   Currently used for EventNotification and EventAck handling.
32871   </para><para>
32872
32873   Returns 1 indicating original alloc'd request frame ptr
32874   should be freed, or 0 if it shouldn't.
32875</para>
32876</refsect1>
32877</refentry>
32878
32879<refentry id="API-mpt-add-sge">
32880<refentryinfo>
32881 <title>LINUX</title>
32882 <productname>Kernel Hackers Manual</productname>
32883 <date>July 2017</date>
32884</refentryinfo>
32885<refmeta>
32886 <refentrytitle><phrase>mpt_add_sge</phrase></refentrytitle>
32887 <manvolnum>9</manvolnum>
32888 <refmiscinfo class="version">4.4.14</refmiscinfo>
32889</refmeta>
32890<refnamediv>
32891 <refname>mpt_add_sge</refname>
32892 <refpurpose>
32893     Place a simple 32 bit SGE at address pAddr.
32894 </refpurpose>
32895</refnamediv>
32896<refsynopsisdiv>
32897 <title>Synopsis</title>
32898  <funcsynopsis><funcprototype>
32899   <funcdef>void <function>mpt_add_sge </function></funcdef>
32900   <paramdef>void * <parameter>pAddr</parameter></paramdef>
32901   <paramdef>u32 <parameter>flagslength</parameter></paramdef>
32902   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
32903  </funcprototype></funcsynopsis>
32904</refsynopsisdiv>
32905<refsect1>
32906 <title>Arguments</title>
32907 <variablelist>
32908  <varlistentry>
32909   <term><parameter>pAddr</parameter></term>
32910   <listitem>
32911    <para>
32912     virtual address for SGE
32913    </para>
32914   </listitem>
32915  </varlistentry>
32916  <varlistentry>
32917   <term><parameter>flagslength</parameter></term>
32918   <listitem>
32919    <para>
32920     SGE flags and data transfer length
32921    </para>
32922   </listitem>
32923  </varlistentry>
32924  <varlistentry>
32925   <term><parameter>dma_addr</parameter></term>
32926   <listitem>
32927    <para>
32928     Physical address
32929    </para>
32930   </listitem>
32931  </varlistentry>
32932 </variablelist>
32933</refsect1>
32934<refsect1>
32935<title>Description</title>
32936<para>
32937   This routine places a MPT request frame back on the MPT adapter's
32938   FreeQ.
32939</para>
32940</refsect1>
32941</refentry>
32942
32943<refentry id="API-mpt-add-sge-64bit">
32944<refentryinfo>
32945 <title>LINUX</title>
32946 <productname>Kernel Hackers Manual</productname>
32947 <date>July 2017</date>
32948</refentryinfo>
32949<refmeta>
32950 <refentrytitle><phrase>mpt_add_sge_64bit</phrase></refentrytitle>
32951 <manvolnum>9</manvolnum>
32952 <refmiscinfo class="version">4.4.14</refmiscinfo>
32953</refmeta>
32954<refnamediv>
32955 <refname>mpt_add_sge_64bit</refname>
32956 <refpurpose>
32957     Place a simple 64 bit SGE at address pAddr.
32958 </refpurpose>
32959</refnamediv>
32960<refsynopsisdiv>
32961 <title>Synopsis</title>
32962  <funcsynopsis><funcprototype>
32963   <funcdef>void <function>mpt_add_sge_64bit </function></funcdef>
32964   <paramdef>void * <parameter>pAddr</parameter></paramdef>
32965   <paramdef>u32 <parameter>flagslength</parameter></paramdef>
32966   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
32967  </funcprototype></funcsynopsis>
32968</refsynopsisdiv>
32969<refsect1>
32970 <title>Arguments</title>
32971 <variablelist>
32972  <varlistentry>
32973   <term><parameter>pAddr</parameter></term>
32974   <listitem>
32975    <para>
32976     virtual address for SGE
32977    </para>
32978   </listitem>
32979  </varlistentry>
32980  <varlistentry>
32981   <term><parameter>flagslength</parameter></term>
32982   <listitem>
32983    <para>
32984     SGE flags and data transfer length
32985    </para>
32986   </listitem>
32987  </varlistentry>
32988  <varlistentry>
32989   <term><parameter>dma_addr</parameter></term>
32990   <listitem>
32991    <para>
32992     Physical address
32993    </para>
32994   </listitem>
32995  </varlistentry>
32996 </variablelist>
32997</refsect1>
32998<refsect1>
32999<title>Description</title>
33000<para>
33001   This routine places a MPT request frame back on the MPT adapter's
33002   FreeQ.
33003</para>
33004</refsect1>
33005</refentry>
33006
33007<refentry id="API-mpt-add-sge-64bit-1078">
33008<refentryinfo>
33009 <title>LINUX</title>
33010 <productname>Kernel Hackers Manual</productname>
33011 <date>July 2017</date>
33012</refentryinfo>
33013<refmeta>
33014 <refentrytitle><phrase>mpt_add_sge_64bit_1078</phrase></refentrytitle>
33015 <manvolnum>9</manvolnum>
33016 <refmiscinfo class="version">4.4.14</refmiscinfo>
33017</refmeta>
33018<refnamediv>
33019 <refname>mpt_add_sge_64bit_1078</refname>
33020 <refpurpose>
33021     Place a simple 64 bit SGE at address pAddr (1078 workaround).
33022 </refpurpose>
33023</refnamediv>
33024<refsynopsisdiv>
33025 <title>Synopsis</title>
33026  <funcsynopsis><funcprototype>
33027   <funcdef>void <function>mpt_add_sge_64bit_1078 </function></funcdef>
33028   <paramdef>void * <parameter>pAddr</parameter></paramdef>
33029   <paramdef>u32 <parameter>flagslength</parameter></paramdef>
33030   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
33031  </funcprototype></funcsynopsis>
33032</refsynopsisdiv>
33033<refsect1>
33034 <title>Arguments</title>
33035 <variablelist>
33036  <varlistentry>
33037   <term><parameter>pAddr</parameter></term>
33038   <listitem>
33039    <para>
33040     virtual address for SGE
33041    </para>
33042   </listitem>
33043  </varlistentry>
33044  <varlistentry>
33045   <term><parameter>flagslength</parameter></term>
33046   <listitem>
33047    <para>
33048     SGE flags and data transfer length
33049    </para>
33050   </listitem>
33051  </varlistentry>
33052  <varlistentry>
33053   <term><parameter>dma_addr</parameter></term>
33054   <listitem>
33055    <para>
33056     Physical address
33057    </para>
33058   </listitem>
33059  </varlistentry>
33060 </variablelist>
33061</refsect1>
33062<refsect1>
33063<title>Description</title>
33064<para>
33065   This routine places a MPT request frame back on the MPT adapter's
33066   FreeQ.
33067</para>
33068</refsect1>
33069</refentry>
33070
33071<refentry id="API-mpt-add-chain">
33072<refentryinfo>
33073 <title>LINUX</title>
33074 <productname>Kernel Hackers Manual</productname>
33075 <date>July 2017</date>
33076</refentryinfo>
33077<refmeta>
33078 <refentrytitle><phrase>mpt_add_chain</phrase></refentrytitle>
33079 <manvolnum>9</manvolnum>
33080 <refmiscinfo class="version">4.4.14</refmiscinfo>
33081</refmeta>
33082<refnamediv>
33083 <refname>mpt_add_chain</refname>
33084 <refpurpose>
33085     Place a 32 bit chain SGE at address pAddr.
33086 </refpurpose>
33087</refnamediv>
33088<refsynopsisdiv>
33089 <title>Synopsis</title>
33090  <funcsynopsis><funcprototype>
33091   <funcdef>void <function>mpt_add_chain </function></funcdef>
33092   <paramdef>void * <parameter>pAddr</parameter></paramdef>
33093   <paramdef>u8 <parameter>next</parameter></paramdef>
33094   <paramdef>u16 <parameter>length</parameter></paramdef>
33095   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
33096  </funcprototype></funcsynopsis>
33097</refsynopsisdiv>
33098<refsect1>
33099 <title>Arguments</title>
33100 <variablelist>
33101  <varlistentry>
33102   <term><parameter>pAddr</parameter></term>
33103   <listitem>
33104    <para>
33105     virtual address for SGE
33106    </para>
33107   </listitem>
33108  </varlistentry>
33109  <varlistentry>
33110   <term><parameter>next</parameter></term>
33111   <listitem>
33112    <para>
33113     nextChainOffset value (u32's)
33114    </para>
33115   </listitem>
33116  </varlistentry>
33117  <varlistentry>
33118   <term><parameter>length</parameter></term>
33119   <listitem>
33120    <para>
33121     length of next SGL segment
33122    </para>
33123   </listitem>
33124  </varlistentry>
33125  <varlistentry>
33126   <term><parameter>dma_addr</parameter></term>
33127   <listitem>
33128    <para>
33129     Physical address
33130    </para>
33131   </listitem>
33132  </varlistentry>
33133 </variablelist>
33134</refsect1>
33135</refentry>
33136
33137<refentry id="API-mpt-add-chain-64bit">
33138<refentryinfo>
33139 <title>LINUX</title>
33140 <productname>Kernel Hackers Manual</productname>
33141 <date>July 2017</date>
33142</refentryinfo>
33143<refmeta>
33144 <refentrytitle><phrase>mpt_add_chain_64bit</phrase></refentrytitle>
33145 <manvolnum>9</manvolnum>
33146 <refmiscinfo class="version">4.4.14</refmiscinfo>
33147</refmeta>
33148<refnamediv>
33149 <refname>mpt_add_chain_64bit</refname>
33150 <refpurpose>
33151     Place a 64 bit chain SGE at address pAddr.
33152 </refpurpose>
33153</refnamediv>
33154<refsynopsisdiv>
33155 <title>Synopsis</title>
33156  <funcsynopsis><funcprototype>
33157   <funcdef>void <function>mpt_add_chain_64bit </function></funcdef>
33158   <paramdef>void * <parameter>pAddr</parameter></paramdef>
33159   <paramdef>u8 <parameter>next</parameter></paramdef>
33160   <paramdef>u16 <parameter>length</parameter></paramdef>
33161   <paramdef>dma_addr_t <parameter>dma_addr</parameter></paramdef>
33162  </funcprototype></funcsynopsis>
33163</refsynopsisdiv>
33164<refsect1>
33165 <title>Arguments</title>
33166 <variablelist>
33167  <varlistentry>
33168   <term><parameter>pAddr</parameter></term>
33169   <listitem>
33170    <para>
33171     virtual address for SGE
33172    </para>
33173   </listitem>
33174  </varlistentry>
33175  <varlistentry>
33176   <term><parameter>next</parameter></term>
33177   <listitem>
33178    <para>
33179     nextChainOffset value (u32's)
33180    </para>
33181   </listitem>
33182  </varlistentry>
33183  <varlistentry>
33184   <term><parameter>length</parameter></term>
33185   <listitem>
33186    <para>
33187     length of next SGL segment
33188    </para>
33189   </listitem>
33190  </varlistentry>
33191  <varlistentry>
33192   <term><parameter>dma_addr</parameter></term>
33193   <listitem>
33194    <para>
33195     Physical address
33196    </para>
33197   </listitem>
33198  </varlistentry>
33199 </variablelist>
33200</refsect1>
33201</refentry>
33202
33203<refentry id="API-mpt-host-page-access-control">
33204<refentryinfo>
33205 <title>LINUX</title>
33206 <productname>Kernel Hackers Manual</productname>
33207 <date>July 2017</date>
33208</refentryinfo>
33209<refmeta>
33210 <refentrytitle><phrase>mpt_host_page_access_control</phrase></refentrytitle>
33211 <manvolnum>9</manvolnum>
33212 <refmiscinfo class="version">4.4.14</refmiscinfo>
33213</refmeta>
33214<refnamediv>
33215 <refname>mpt_host_page_access_control</refname>
33216 <refpurpose>
33217     control the IOC's Host Page Buffer access
33218 </refpurpose>
33219</refnamediv>
33220<refsynopsisdiv>
33221 <title>Synopsis</title>
33222  <funcsynopsis><funcprototype>
33223   <funcdef>int <function>mpt_host_page_access_control </function></funcdef>
33224   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33225   <paramdef>u8 <parameter>access_control_value</parameter></paramdef>
33226   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33227  </funcprototype></funcsynopsis>
33228</refsynopsisdiv>
33229<refsect1>
33230 <title>Arguments</title>
33231 <variablelist>
33232  <varlistentry>
33233   <term><parameter>ioc</parameter></term>
33234   <listitem>
33235    <para>
33236     Pointer to MPT adapter structure
33237    </para>
33238   </listitem>
33239  </varlistentry>
33240  <varlistentry>
33241   <term><parameter>access_control_value</parameter></term>
33242   <listitem>
33243    <para>
33244     define bits below
33245    </para>
33246   </listitem>
33247  </varlistentry>
33248  <varlistentry>
33249   <term><parameter>sleepFlag</parameter></term>
33250   <listitem>
33251    <para>
33252     Specifies whether the process can sleep
33253    </para>
33254   </listitem>
33255  </varlistentry>
33256 </variablelist>
33257</refsect1>
33258<refsect1>
33259<title>Description</title>
33260<para>
33261   Provides mechanism for the host driver to control the IOC's
33262   Host Page Buffer access.
33263   </para><para>
33264
33265   Access Control Value - bits[15:12]
33266   0h Reserved
33267   1h Enable Access { MPI_DB_HPBAC_ENABLE_ACCESS }
33268   2h Disable Access { MPI_DB_HPBAC_DISABLE_ACCESS }
33269   3h Free Buffer { MPI_DB_HPBAC_FREE_BUFFER }
33270   </para><para>
33271
33272   Returns 0 for success, non-zero for failure.
33273</para>
33274</refsect1>
33275</refentry>
33276
33277<refentry id="API-mpt-host-page-alloc">
33278<refentryinfo>
33279 <title>LINUX</title>
33280 <productname>Kernel Hackers Manual</productname>
33281 <date>July 2017</date>
33282</refentryinfo>
33283<refmeta>
33284 <refentrytitle><phrase>mpt_host_page_alloc</phrase></refentrytitle>
33285 <manvolnum>9</manvolnum>
33286 <refmiscinfo class="version">4.4.14</refmiscinfo>
33287</refmeta>
33288<refnamediv>
33289 <refname>mpt_host_page_alloc</refname>
33290 <refpurpose>
33291     allocate system memory for the fw
33292 </refpurpose>
33293</refnamediv>
33294<refsynopsisdiv>
33295 <title>Synopsis</title>
33296  <funcsynopsis><funcprototype>
33297   <funcdef>int <function>mpt_host_page_alloc </function></funcdef>
33298   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33299   <paramdef>pIOCInit_t <parameter>ioc_init</parameter></paramdef>
33300  </funcprototype></funcsynopsis>
33301</refsynopsisdiv>
33302<refsect1>
33303 <title>Arguments</title>
33304 <variablelist>
33305  <varlistentry>
33306   <term><parameter>ioc</parameter></term>
33307   <listitem>
33308    <para>
33309     Pointer to pointer to IOC adapter
33310    </para>
33311   </listitem>
33312  </varlistentry>
33313  <varlistentry>
33314   <term><parameter>ioc_init</parameter></term>
33315   <listitem>
33316    <para>
33317     Pointer to ioc init config page
33318    </para>
33319   </listitem>
33320  </varlistentry>
33321 </variablelist>
33322</refsect1>
33323<refsect1>
33324<title>Description</title>
33325<para>
33326   If we already allocated memory in past, then resend the same pointer.
33327   Returns 0 for success, non-zero for failure.
33328</para>
33329</refsect1>
33330</refentry>
33331
33332<refentry id="API-mpt-get-product-name">
33333<refentryinfo>
33334 <title>LINUX</title>
33335 <productname>Kernel Hackers Manual</productname>
33336 <date>July 2017</date>
33337</refentryinfo>
33338<refmeta>
33339 <refentrytitle><phrase>mpt_get_product_name</phrase></refentrytitle>
33340 <manvolnum>9</manvolnum>
33341 <refmiscinfo class="version">4.4.14</refmiscinfo>
33342</refmeta>
33343<refnamediv>
33344 <refname>mpt_get_product_name</refname>
33345 <refpurpose>
33346     returns product string
33347 </refpurpose>
33348</refnamediv>
33349<refsynopsisdiv>
33350 <title>Synopsis</title>
33351  <funcsynopsis><funcprototype>
33352   <funcdef>const char* <function>mpt_get_product_name </function></funcdef>
33353   <paramdef>u16 <parameter>vendor</parameter></paramdef>
33354   <paramdef>u16 <parameter>device</parameter></paramdef>
33355   <paramdef>u8 <parameter>revision</parameter></paramdef>
33356  </funcprototype></funcsynopsis>
33357</refsynopsisdiv>
33358<refsect1>
33359 <title>Arguments</title>
33360 <variablelist>
33361  <varlistentry>
33362   <term><parameter>vendor</parameter></term>
33363   <listitem>
33364    <para>
33365     pci vendor id
33366    </para>
33367   </listitem>
33368  </varlistentry>
33369  <varlistentry>
33370   <term><parameter>device</parameter></term>
33371   <listitem>
33372    <para>
33373     pci device id
33374    </para>
33375   </listitem>
33376  </varlistentry>
33377  <varlistentry>
33378   <term><parameter>revision</parameter></term>
33379   <listitem>
33380    <para>
33381     pci revision id
33382    </para>
33383   </listitem>
33384  </varlistentry>
33385 </variablelist>
33386</refsect1>
33387<refsect1>
33388<title>Description</title>
33389<para>
33390   Returns product string displayed when driver loads,
33391   in /proc/mpt/summary and /sysfs/class/scsi_host/host&lt;X&gt;/version_product
33392</para>
33393</refsect1>
33394</refentry>
33395
33396<refentry id="API-mpt-mapresources">
33397<refentryinfo>
33398 <title>LINUX</title>
33399 <productname>Kernel Hackers Manual</productname>
33400 <date>July 2017</date>
33401</refentryinfo>
33402<refmeta>
33403 <refentrytitle><phrase>mpt_mapresources</phrase></refentrytitle>
33404 <manvolnum>9</manvolnum>
33405 <refmiscinfo class="version">4.4.14</refmiscinfo>
33406</refmeta>
33407<refnamediv>
33408 <refname>mpt_mapresources</refname>
33409 <refpurpose>
33410     map in memory mapped io
33411 </refpurpose>
33412</refnamediv>
33413<refsynopsisdiv>
33414 <title>Synopsis</title>
33415  <funcsynopsis><funcprototype>
33416   <funcdef>int <function>mpt_mapresources </function></funcdef>
33417   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33418  </funcprototype></funcsynopsis>
33419</refsynopsisdiv>
33420<refsect1>
33421 <title>Arguments</title>
33422 <variablelist>
33423  <varlistentry>
33424   <term><parameter>ioc</parameter></term>
33425   <listitem>
33426    <para>
33427     Pointer to pointer to IOC adapter
33428    </para>
33429   </listitem>
33430  </varlistentry>
33431 </variablelist>
33432</refsect1>
33433</refentry>
33434
33435<refentry id="API-mpt-do-ioc-recovery">
33436<refentryinfo>
33437 <title>LINUX</title>
33438 <productname>Kernel Hackers Manual</productname>
33439 <date>July 2017</date>
33440</refentryinfo>
33441<refmeta>
33442 <refentrytitle><phrase>mpt_do_ioc_recovery</phrase></refentrytitle>
33443 <manvolnum>9</manvolnum>
33444 <refmiscinfo class="version">4.4.14</refmiscinfo>
33445</refmeta>
33446<refnamediv>
33447 <refname>mpt_do_ioc_recovery</refname>
33448 <refpurpose>
33449     Initialize or recover MPT adapter.
33450 </refpurpose>
33451</refnamediv>
33452<refsynopsisdiv>
33453 <title>Synopsis</title>
33454  <funcsynopsis><funcprototype>
33455   <funcdef>int <function>mpt_do_ioc_recovery </function></funcdef>
33456   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33457   <paramdef>u32 <parameter>reason</parameter></paramdef>
33458   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33459  </funcprototype></funcsynopsis>
33460</refsynopsisdiv>
33461<refsect1>
33462 <title>Arguments</title>
33463 <variablelist>
33464  <varlistentry>
33465   <term><parameter>ioc</parameter></term>
33466   <listitem>
33467    <para>
33468     Pointer to MPT adapter structure
33469    </para>
33470   </listitem>
33471  </varlistentry>
33472  <varlistentry>
33473   <term><parameter>reason</parameter></term>
33474   <listitem>
33475    <para>
33476     Event word / reason
33477    </para>
33478   </listitem>
33479  </varlistentry>
33480  <varlistentry>
33481   <term><parameter>sleepFlag</parameter></term>
33482   <listitem>
33483    <para>
33484     Use schedule if CAN_SLEEP else use udelay.
33485    </para>
33486   </listitem>
33487  </varlistentry>
33488 </variablelist>
33489</refsect1>
33490<refsect1>
33491<title>Description</title>
33492<para>
33493   This routine performs all the steps necessary to bring the IOC
33494   to a OPERATIONAL state.
33495   </para><para>
33496
33497   This routine also pre-fetches the LAN MAC address of a Fibre Channel
33498   MPT adapter.
33499</para>
33500</refsect1>
33501<refsect1>
33502<title>Returns</title>
33503<para>
33504   0 for success
33505   -1 if failed to get board READY
33506   -2 if READY but IOCFacts Failed
33507   -3 if READY but PrimeIOCFifos Failed
33508   -4 if READY but IOCInit Failed
33509   -5 if failed to enable_device and/or request_selected_regions
33510   -6 if failed to upload firmware
33511</para>
33512</refsect1>
33513</refentry>
33514
33515<refentry id="API-mpt-detect-bound-ports">
33516<refentryinfo>
33517 <title>LINUX</title>
33518 <productname>Kernel Hackers Manual</productname>
33519 <date>July 2017</date>
33520</refentryinfo>
33521<refmeta>
33522 <refentrytitle><phrase>mpt_detect_bound_ports</phrase></refentrytitle>
33523 <manvolnum>9</manvolnum>
33524 <refmiscinfo class="version">4.4.14</refmiscinfo>
33525</refmeta>
33526<refnamediv>
33527 <refname>mpt_detect_bound_ports</refname>
33528 <refpurpose>
33529     Search for matching PCI bus/dev_function
33530 </refpurpose>
33531</refnamediv>
33532<refsynopsisdiv>
33533 <title>Synopsis</title>
33534  <funcsynopsis><funcprototype>
33535   <funcdef>void <function>mpt_detect_bound_ports </function></funcdef>
33536   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33537   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
33538  </funcprototype></funcsynopsis>
33539</refsynopsisdiv>
33540<refsect1>
33541 <title>Arguments</title>
33542 <variablelist>
33543  <varlistentry>
33544   <term><parameter>ioc</parameter></term>
33545   <listitem>
33546    <para>
33547     Pointer to MPT adapter structure
33548    </para>
33549   </listitem>
33550  </varlistentry>
33551  <varlistentry>
33552   <term><parameter>pdev</parameter></term>
33553   <listitem>
33554    <para>
33555     Pointer to (struct pci_dev) structure
33556    </para>
33557   </listitem>
33558  </varlistentry>
33559 </variablelist>
33560</refsect1>
33561<refsect1>
33562<title>Description</title>
33563<para>
33564   Search for PCI bus/dev_function which matches
33565   PCI bus/dev_function (+/-1) for newly discovered 929,
33566   929X, 1030 or 1035.
33567   </para><para>
33568
33569   If match on PCI dev_function +/-1 is found, bind the two MPT adapters
33570   using alt_ioc pointer fields in their <constant>MPT_ADAPTER</constant> structures.
33571</para>
33572</refsect1>
33573</refentry>
33574
33575<refentry id="API-mpt-adapter-disable">
33576<refentryinfo>
33577 <title>LINUX</title>
33578 <productname>Kernel Hackers Manual</productname>
33579 <date>July 2017</date>
33580</refentryinfo>
33581<refmeta>
33582 <refentrytitle><phrase>mpt_adapter_disable</phrase></refentrytitle>
33583 <manvolnum>9</manvolnum>
33584 <refmiscinfo class="version">4.4.14</refmiscinfo>
33585</refmeta>
33586<refnamediv>
33587 <refname>mpt_adapter_disable</refname>
33588 <refpurpose>
33589     Disable misbehaving MPT adapter.
33590 </refpurpose>
33591</refnamediv>
33592<refsynopsisdiv>
33593 <title>Synopsis</title>
33594  <funcsynopsis><funcprototype>
33595   <funcdef>void <function>mpt_adapter_disable </function></funcdef>
33596   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33597  </funcprototype></funcsynopsis>
33598</refsynopsisdiv>
33599<refsect1>
33600 <title>Arguments</title>
33601 <variablelist>
33602  <varlistentry>
33603   <term><parameter>ioc</parameter></term>
33604   <listitem>
33605    <para>
33606     Pointer to MPT adapter structure
33607    </para>
33608   </listitem>
33609  </varlistentry>
33610 </variablelist>
33611</refsect1>
33612</refentry>
33613
33614<refentry id="API-mpt-adapter-dispose">
33615<refentryinfo>
33616 <title>LINUX</title>
33617 <productname>Kernel Hackers Manual</productname>
33618 <date>July 2017</date>
33619</refentryinfo>
33620<refmeta>
33621 <refentrytitle><phrase>mpt_adapter_dispose</phrase></refentrytitle>
33622 <manvolnum>9</manvolnum>
33623 <refmiscinfo class="version">4.4.14</refmiscinfo>
33624</refmeta>
33625<refnamediv>
33626 <refname>mpt_adapter_dispose</refname>
33627 <refpurpose>
33628     Free all resources associated with an MPT adapter
33629 </refpurpose>
33630</refnamediv>
33631<refsynopsisdiv>
33632 <title>Synopsis</title>
33633  <funcsynopsis><funcprototype>
33634   <funcdef>void <function>mpt_adapter_dispose </function></funcdef>
33635   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33636  </funcprototype></funcsynopsis>
33637</refsynopsisdiv>
33638<refsect1>
33639 <title>Arguments</title>
33640 <variablelist>
33641  <varlistentry>
33642   <term><parameter>ioc</parameter></term>
33643   <listitem>
33644    <para>
33645     Pointer to MPT adapter structure
33646    </para>
33647   </listitem>
33648  </varlistentry>
33649 </variablelist>
33650</refsect1>
33651<refsect1>
33652<title>Description</title>
33653<para>
33654   This routine unregisters h/w resources and frees all alloc'd memory
33655   associated with a MPT adapter structure.
33656</para>
33657</refsect1>
33658</refentry>
33659
33660<refentry id="API-MptDisplayIocCapabilities">
33661<refentryinfo>
33662 <title>LINUX</title>
33663 <productname>Kernel Hackers Manual</productname>
33664 <date>July 2017</date>
33665</refentryinfo>
33666<refmeta>
33667 <refentrytitle><phrase>MptDisplayIocCapabilities</phrase></refentrytitle>
33668 <manvolnum>9</manvolnum>
33669 <refmiscinfo class="version">4.4.14</refmiscinfo>
33670</refmeta>
33671<refnamediv>
33672 <refname>MptDisplayIocCapabilities</refname>
33673 <refpurpose>
33674     Disply IOC's capabilities.
33675 </refpurpose>
33676</refnamediv>
33677<refsynopsisdiv>
33678 <title>Synopsis</title>
33679  <funcsynopsis><funcprototype>
33680   <funcdef>void <function>MptDisplayIocCapabilities </function></funcdef>
33681   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33682  </funcprototype></funcsynopsis>
33683</refsynopsisdiv>
33684<refsect1>
33685 <title>Arguments</title>
33686 <variablelist>
33687  <varlistentry>
33688   <term><parameter>ioc</parameter></term>
33689   <listitem>
33690    <para>
33691     Pointer to MPT adapter structure
33692    </para>
33693   </listitem>
33694  </varlistentry>
33695 </variablelist>
33696</refsect1>
33697</refentry>
33698
33699<refentry id="API-MakeIocReady">
33700<refentryinfo>
33701 <title>LINUX</title>
33702 <productname>Kernel Hackers Manual</productname>
33703 <date>July 2017</date>
33704</refentryinfo>
33705<refmeta>
33706 <refentrytitle><phrase>MakeIocReady</phrase></refentrytitle>
33707 <manvolnum>9</manvolnum>
33708 <refmiscinfo class="version">4.4.14</refmiscinfo>
33709</refmeta>
33710<refnamediv>
33711 <refname>MakeIocReady</refname>
33712 <refpurpose>
33713     Get IOC to a READY state, using KickStart if needed.
33714 </refpurpose>
33715</refnamediv>
33716<refsynopsisdiv>
33717 <title>Synopsis</title>
33718  <funcsynopsis><funcprototype>
33719   <funcdef>int <function>MakeIocReady </function></funcdef>
33720   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33721   <paramdef>int <parameter>force</parameter></paramdef>
33722   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33723  </funcprototype></funcsynopsis>
33724</refsynopsisdiv>
33725<refsect1>
33726 <title>Arguments</title>
33727 <variablelist>
33728  <varlistentry>
33729   <term><parameter>ioc</parameter></term>
33730   <listitem>
33731    <para>
33732     Pointer to MPT_ADAPTER structure
33733    </para>
33734   </listitem>
33735  </varlistentry>
33736  <varlistentry>
33737   <term><parameter>force</parameter></term>
33738   <listitem>
33739    <para>
33740     Force hard KickStart of IOC
33741    </para>
33742   </listitem>
33743  </varlistentry>
33744  <varlistentry>
33745   <term><parameter>sleepFlag</parameter></term>
33746   <listitem>
33747    <para>
33748     Specifies whether the process can sleep
33749    </para>
33750   </listitem>
33751  </varlistentry>
33752 </variablelist>
33753</refsect1>
33754<refsect1>
33755<title>Returns</title>
33756<para>
33757   1 - DIAG reset and READY
33758   0 - READY initially OR soft reset and READY
33759   -1 - Any failure on KickStart
33760   -2 - Msg Unit Reset Failed
33761   -3 - IO Unit Reset Failed
33762   -4 - IOC owned by a PEER
33763</para>
33764</refsect1>
33765</refentry>
33766
33767<refentry id="API-GetIocFacts">
33768<refentryinfo>
33769 <title>LINUX</title>
33770 <productname>Kernel Hackers Manual</productname>
33771 <date>July 2017</date>
33772</refentryinfo>
33773<refmeta>
33774 <refentrytitle><phrase>GetIocFacts</phrase></refentrytitle>
33775 <manvolnum>9</manvolnum>
33776 <refmiscinfo class="version">4.4.14</refmiscinfo>
33777</refmeta>
33778<refnamediv>
33779 <refname>GetIocFacts</refname>
33780 <refpurpose>
33781     Send IOCFacts request to MPT adapter.
33782 </refpurpose>
33783</refnamediv>
33784<refsynopsisdiv>
33785 <title>Synopsis</title>
33786  <funcsynopsis><funcprototype>
33787   <funcdef>int <function>GetIocFacts </function></funcdef>
33788   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33789   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33790   <paramdef>int <parameter>reason</parameter></paramdef>
33791  </funcprototype></funcsynopsis>
33792</refsynopsisdiv>
33793<refsect1>
33794 <title>Arguments</title>
33795 <variablelist>
33796  <varlistentry>
33797   <term><parameter>ioc</parameter></term>
33798   <listitem>
33799    <para>
33800     Pointer to MPT_ADAPTER structure
33801    </para>
33802   </listitem>
33803  </varlistentry>
33804  <varlistentry>
33805   <term><parameter>sleepFlag</parameter></term>
33806   <listitem>
33807    <para>
33808     Specifies whether the process can sleep
33809    </para>
33810   </listitem>
33811  </varlistentry>
33812  <varlistentry>
33813   <term><parameter>reason</parameter></term>
33814   <listitem>
33815    <para>
33816     If recovery, only update facts.
33817    </para>
33818   </listitem>
33819  </varlistentry>
33820 </variablelist>
33821</refsect1>
33822<refsect1>
33823<title>Description</title>
33824<para>
33825   Returns 0 for success, non-zero for failure.
33826</para>
33827</refsect1>
33828</refentry>
33829
33830<refentry id="API-GetPortFacts">
33831<refentryinfo>
33832 <title>LINUX</title>
33833 <productname>Kernel Hackers Manual</productname>
33834 <date>July 2017</date>
33835</refentryinfo>
33836<refmeta>
33837 <refentrytitle><phrase>GetPortFacts</phrase></refentrytitle>
33838 <manvolnum>9</manvolnum>
33839 <refmiscinfo class="version">4.4.14</refmiscinfo>
33840</refmeta>
33841<refnamediv>
33842 <refname>GetPortFacts</refname>
33843 <refpurpose>
33844     Send PortFacts request to MPT adapter.
33845 </refpurpose>
33846</refnamediv>
33847<refsynopsisdiv>
33848 <title>Synopsis</title>
33849  <funcsynopsis><funcprototype>
33850   <funcdef>int <function>GetPortFacts </function></funcdef>
33851   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33852   <paramdef>int <parameter>portnum</parameter></paramdef>
33853   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33854  </funcprototype></funcsynopsis>
33855</refsynopsisdiv>
33856<refsect1>
33857 <title>Arguments</title>
33858 <variablelist>
33859  <varlistentry>
33860   <term><parameter>ioc</parameter></term>
33861   <listitem>
33862    <para>
33863     Pointer to MPT_ADAPTER structure
33864    </para>
33865   </listitem>
33866  </varlistentry>
33867  <varlistentry>
33868   <term><parameter>portnum</parameter></term>
33869   <listitem>
33870    <para>
33871     Port number
33872    </para>
33873   </listitem>
33874  </varlistentry>
33875  <varlistentry>
33876   <term><parameter>sleepFlag</parameter></term>
33877   <listitem>
33878    <para>
33879     Specifies whether the process can sleep
33880    </para>
33881   </listitem>
33882  </varlistentry>
33883 </variablelist>
33884</refsect1>
33885<refsect1>
33886<title>Description</title>
33887<para>
33888   Returns 0 for success, non-zero for failure.
33889</para>
33890</refsect1>
33891</refentry>
33892
33893<refentry id="API-SendIocInit">
33894<refentryinfo>
33895 <title>LINUX</title>
33896 <productname>Kernel Hackers Manual</productname>
33897 <date>July 2017</date>
33898</refentryinfo>
33899<refmeta>
33900 <refentrytitle><phrase>SendIocInit</phrase></refentrytitle>
33901 <manvolnum>9</manvolnum>
33902 <refmiscinfo class="version">4.4.14</refmiscinfo>
33903</refmeta>
33904<refnamediv>
33905 <refname>SendIocInit</refname>
33906 <refpurpose>
33907     Send IOCInit request to MPT adapter.
33908 </refpurpose>
33909</refnamediv>
33910<refsynopsisdiv>
33911 <title>Synopsis</title>
33912  <funcsynopsis><funcprototype>
33913   <funcdef>int <function>SendIocInit </function></funcdef>
33914   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33915   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33916  </funcprototype></funcsynopsis>
33917</refsynopsisdiv>
33918<refsect1>
33919 <title>Arguments</title>
33920 <variablelist>
33921  <varlistentry>
33922   <term><parameter>ioc</parameter></term>
33923   <listitem>
33924    <para>
33925     Pointer to MPT_ADAPTER structure
33926    </para>
33927   </listitem>
33928  </varlistentry>
33929  <varlistentry>
33930   <term><parameter>sleepFlag</parameter></term>
33931   <listitem>
33932    <para>
33933     Specifies whether the process can sleep
33934    </para>
33935   </listitem>
33936  </varlistentry>
33937 </variablelist>
33938</refsect1>
33939<refsect1>
33940<title>Description</title>
33941<para>
33942   Send IOCInit followed by PortEnable to bring IOC to OPERATIONAL state.
33943   </para><para>
33944
33945   Returns 0 for success, non-zero for failure.
33946</para>
33947</refsect1>
33948</refentry>
33949
33950<refentry id="API-SendPortEnable">
33951<refentryinfo>
33952 <title>LINUX</title>
33953 <productname>Kernel Hackers Manual</productname>
33954 <date>July 2017</date>
33955</refentryinfo>
33956<refmeta>
33957 <refentrytitle><phrase>SendPortEnable</phrase></refentrytitle>
33958 <manvolnum>9</manvolnum>
33959 <refmiscinfo class="version">4.4.14</refmiscinfo>
33960</refmeta>
33961<refnamediv>
33962 <refname>SendPortEnable</refname>
33963 <refpurpose>
33964     Send PortEnable request to MPT adapter port.
33965 </refpurpose>
33966</refnamediv>
33967<refsynopsisdiv>
33968 <title>Synopsis</title>
33969  <funcsynopsis><funcprototype>
33970   <funcdef>int <function>SendPortEnable </function></funcdef>
33971   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
33972   <paramdef>int <parameter>portnum</parameter></paramdef>
33973   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
33974  </funcprototype></funcsynopsis>
33975</refsynopsisdiv>
33976<refsect1>
33977 <title>Arguments</title>
33978 <variablelist>
33979  <varlistentry>
33980   <term><parameter>ioc</parameter></term>
33981   <listitem>
33982    <para>
33983     Pointer to MPT_ADAPTER structure
33984    </para>
33985   </listitem>
33986  </varlistentry>
33987  <varlistentry>
33988   <term><parameter>portnum</parameter></term>
33989   <listitem>
33990    <para>
33991     Port number to enable
33992    </para>
33993   </listitem>
33994  </varlistentry>
33995  <varlistentry>
33996   <term><parameter>sleepFlag</parameter></term>
33997   <listitem>
33998    <para>
33999     Specifies whether the process can sleep
34000    </para>
34001   </listitem>
34002  </varlistentry>
34003 </variablelist>
34004</refsect1>
34005<refsect1>
34006<title>Description</title>
34007<para>
34008   Send PortEnable to bring IOC to OPERATIONAL state.
34009   </para><para>
34010
34011   Returns 0 for success, non-zero for failure.
34012</para>
34013</refsect1>
34014</refentry>
34015
34016<refentry id="API-mpt-do-upload">
34017<refentryinfo>
34018 <title>LINUX</title>
34019 <productname>Kernel Hackers Manual</productname>
34020 <date>July 2017</date>
34021</refentryinfo>
34022<refmeta>
34023 <refentrytitle><phrase>mpt_do_upload</phrase></refentrytitle>
34024 <manvolnum>9</manvolnum>
34025 <refmiscinfo class="version">4.4.14</refmiscinfo>
34026</refmeta>
34027<refnamediv>
34028 <refname>mpt_do_upload</refname>
34029 <refpurpose>
34030     Construct and Send FWUpload request to MPT adapter port.
34031 </refpurpose>
34032</refnamediv>
34033<refsynopsisdiv>
34034 <title>Synopsis</title>
34035  <funcsynopsis><funcprototype>
34036   <funcdef>int <function>mpt_do_upload </function></funcdef>
34037   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34038   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34039  </funcprototype></funcsynopsis>
34040</refsynopsisdiv>
34041<refsect1>
34042 <title>Arguments</title>
34043 <variablelist>
34044  <varlistentry>
34045   <term><parameter>ioc</parameter></term>
34046   <listitem>
34047    <para>
34048     Pointer to MPT_ADAPTER structure
34049    </para>
34050   </listitem>
34051  </varlistentry>
34052  <varlistentry>
34053   <term><parameter>sleepFlag</parameter></term>
34054   <listitem>
34055    <para>
34056     Specifies whether the process can sleep
34057    </para>
34058   </listitem>
34059  </varlistentry>
34060 </variablelist>
34061</refsect1>
34062<refsect1>
34063<title>Description</title>
34064<para>
34065   Returns 0 for success, &gt;0 for handshake failure
34066   &lt;0 for fw upload failure.
34067</para>
34068</refsect1>
34069<refsect1>
34070<title>Remark</title>
34071<para>
34072   If bound IOC and a successful FWUpload was performed
34073   on the bound IOC, the second image is discarded
34074   and memory is free'd. Both channels must upload to prevent
34075   IOC from running in degraded mode.
34076</para>
34077</refsect1>
34078</refentry>
34079
34080<refentry id="API-mpt-downloadboot">
34081<refentryinfo>
34082 <title>LINUX</title>
34083 <productname>Kernel Hackers Manual</productname>
34084 <date>July 2017</date>
34085</refentryinfo>
34086<refmeta>
34087 <refentrytitle><phrase>mpt_downloadboot</phrase></refentrytitle>
34088 <manvolnum>9</manvolnum>
34089 <refmiscinfo class="version">4.4.14</refmiscinfo>
34090</refmeta>
34091<refnamediv>
34092 <refname>mpt_downloadboot</refname>
34093 <refpurpose>
34094     DownloadBoot code
34095 </refpurpose>
34096</refnamediv>
34097<refsynopsisdiv>
34098 <title>Synopsis</title>
34099  <funcsynopsis><funcprototype>
34100   <funcdef>int <function>mpt_downloadboot </function></funcdef>
34101   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34102   <paramdef>MpiFwHeader_t * <parameter>pFwHeader</parameter></paramdef>
34103   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34104  </funcprototype></funcsynopsis>
34105</refsynopsisdiv>
34106<refsect1>
34107 <title>Arguments</title>
34108 <variablelist>
34109  <varlistentry>
34110   <term><parameter>ioc</parameter></term>
34111   <listitem>
34112    <para>
34113     Pointer to MPT_ADAPTER structure
34114    </para>
34115   </listitem>
34116  </varlistentry>
34117  <varlistentry>
34118   <term><parameter>pFwHeader</parameter></term>
34119   <listitem>
34120    <para>
34121     Pointer to firmware header info
34122    </para>
34123   </listitem>
34124  </varlistentry>
34125  <varlistentry>
34126   <term><parameter>sleepFlag</parameter></term>
34127   <listitem>
34128    <para>
34129     Specifies whether the process can sleep
34130    </para>
34131   </listitem>
34132  </varlistentry>
34133 </variablelist>
34134</refsect1>
34135<refsect1>
34136<title>Description</title>
34137<para>
34138   FwDownloadBoot requires Programmed IO access.
34139   </para><para>
34140
34141   Returns 0 for success
34142   -1 FW Image size is 0
34143   -2 No valid cached_fw Pointer
34144   &lt;0 for fw upload failure.
34145</para>
34146</refsect1>
34147</refentry>
34148
34149<refentry id="API-KickStart">
34150<refentryinfo>
34151 <title>LINUX</title>
34152 <productname>Kernel Hackers Manual</productname>
34153 <date>July 2017</date>
34154</refentryinfo>
34155<refmeta>
34156 <refentrytitle><phrase>KickStart</phrase></refentrytitle>
34157 <manvolnum>9</manvolnum>
34158 <refmiscinfo class="version">4.4.14</refmiscinfo>
34159</refmeta>
34160<refnamediv>
34161 <refname>KickStart</refname>
34162 <refpurpose>
34163     Perform hard reset of MPT adapter.
34164 </refpurpose>
34165</refnamediv>
34166<refsynopsisdiv>
34167 <title>Synopsis</title>
34168  <funcsynopsis><funcprototype>
34169   <funcdef>int <function>KickStart </function></funcdef>
34170   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34171   <paramdef>int <parameter>force</parameter></paramdef>
34172   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34173  </funcprototype></funcsynopsis>
34174</refsynopsisdiv>
34175<refsect1>
34176 <title>Arguments</title>
34177 <variablelist>
34178  <varlistentry>
34179   <term><parameter>ioc</parameter></term>
34180   <listitem>
34181    <para>
34182     Pointer to MPT_ADAPTER structure
34183    </para>
34184   </listitem>
34185  </varlistentry>
34186  <varlistentry>
34187   <term><parameter>force</parameter></term>
34188   <listitem>
34189    <para>
34190     Force hard reset
34191    </para>
34192   </listitem>
34193  </varlistentry>
34194  <varlistentry>
34195   <term><parameter>sleepFlag</parameter></term>
34196   <listitem>
34197    <para>
34198     Specifies whether the process can sleep
34199    </para>
34200   </listitem>
34201  </varlistentry>
34202 </variablelist>
34203</refsect1>
34204<refsect1>
34205<title>Description</title>
34206<para>
34207   This routine places MPT adapter in diagnostic mode via the
34208   WriteSequence register, and then performs a hard reset of adapter
34209   via the Diagnostic register.
34210</para>
34211</refsect1>
34212<refsect1>
34213<title>Inputs</title>
34214<para>
34215   sleepflag - CAN_SLEEP (non-interrupt thread)
34216   or NO_SLEEP (interrupt thread, use mdelay)
34217   force - 1 if doorbell active, board fault state
34218   board operational, IOC_RECOVERY or
34219   IOC_BRINGUP and there is an alt_ioc.
34220   0 else
34221</para>
34222</refsect1>
34223<refsect1>
34224<title>Returns</title>
34225<para>
34226   1 - hard reset, READY
34227   0 - no reset due to History bit, READY
34228   -1 - no reset due to History bit but not READY
34229   OR reset but failed to come READY
34230   -2 - no reset, could not enter DIAG mode
34231   -3 - reset but bad FW bit
34232</para>
34233</refsect1>
34234</refentry>
34235
34236<refentry id="API-mpt-diag-reset">
34237<refentryinfo>
34238 <title>LINUX</title>
34239 <productname>Kernel Hackers Manual</productname>
34240 <date>July 2017</date>
34241</refentryinfo>
34242<refmeta>
34243 <refentrytitle><phrase>mpt_diag_reset</phrase></refentrytitle>
34244 <manvolnum>9</manvolnum>
34245 <refmiscinfo class="version">4.4.14</refmiscinfo>
34246</refmeta>
34247<refnamediv>
34248 <refname>mpt_diag_reset</refname>
34249 <refpurpose>
34250     Perform hard reset of the adapter.
34251 </refpurpose>
34252</refnamediv>
34253<refsynopsisdiv>
34254 <title>Synopsis</title>
34255  <funcsynopsis><funcprototype>
34256   <funcdef>int <function>mpt_diag_reset </function></funcdef>
34257   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34258   <paramdef>int <parameter>ignore</parameter></paramdef>
34259   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34260  </funcprototype></funcsynopsis>
34261</refsynopsisdiv>
34262<refsect1>
34263 <title>Arguments</title>
34264 <variablelist>
34265  <varlistentry>
34266   <term><parameter>ioc</parameter></term>
34267   <listitem>
34268    <para>
34269     Pointer to MPT_ADAPTER structure
34270    </para>
34271   </listitem>
34272  </varlistentry>
34273  <varlistentry>
34274   <term><parameter>ignore</parameter></term>
34275   <listitem>
34276    <para>
34277     Set if to honor and clear to ignore
34278     the reset history bit
34279    </para>
34280   </listitem>
34281  </varlistentry>
34282  <varlistentry>
34283   <term><parameter>sleepFlag</parameter></term>
34284   <listitem>
34285    <para>
34286     CAN_SLEEP if called in a non-interrupt thread,
34287     else set to NO_SLEEP (use mdelay instead)
34288    </para>
34289   </listitem>
34290  </varlistentry>
34291 </variablelist>
34292</refsect1>
34293<refsect1>
34294<title>Description</title>
34295<para>
34296   This routine places the adapter in diagnostic mode via the
34297   WriteSequence register and then performs a hard reset of adapter
34298   via the Diagnostic register. Adapter should be in ready state
34299   upon successful completion.
34300</para>
34301</refsect1>
34302<refsect1>
34303<title>Returns</title>
34304<para>
34305   1  hard reset successful
34306   0  no reset performed because reset history bit set
34307   -2  enabling diagnostic mode failed
34308   -3  diagnostic reset failed
34309</para>
34310</refsect1>
34311</refentry>
34312
34313<refentry id="API-SendIocReset">
34314<refentryinfo>
34315 <title>LINUX</title>
34316 <productname>Kernel Hackers Manual</productname>
34317 <date>July 2017</date>
34318</refentryinfo>
34319<refmeta>
34320 <refentrytitle><phrase>SendIocReset</phrase></refentrytitle>
34321 <manvolnum>9</manvolnum>
34322 <refmiscinfo class="version">4.4.14</refmiscinfo>
34323</refmeta>
34324<refnamediv>
34325 <refname>SendIocReset</refname>
34326 <refpurpose>
34327     Send IOCReset request to MPT adapter.
34328 </refpurpose>
34329</refnamediv>
34330<refsynopsisdiv>
34331 <title>Synopsis</title>
34332  <funcsynopsis><funcprototype>
34333   <funcdef>int <function>SendIocReset </function></funcdef>
34334   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34335   <paramdef>u8 <parameter>reset_type</parameter></paramdef>
34336   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34337  </funcprototype></funcsynopsis>
34338</refsynopsisdiv>
34339<refsect1>
34340 <title>Arguments</title>
34341 <variablelist>
34342  <varlistentry>
34343   <term><parameter>ioc</parameter></term>
34344   <listitem>
34345    <para>
34346     Pointer to MPT_ADAPTER structure
34347    </para>
34348   </listitem>
34349  </varlistentry>
34350  <varlistentry>
34351   <term><parameter>reset_type</parameter></term>
34352   <listitem>
34353    <para>
34354     reset type, expected values are
34355     <constant>MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET</constant> or <constant>MPI_FUNCTION_IO_UNIT_RESET</constant>
34356    </para>
34357   </listitem>
34358  </varlistentry>
34359  <varlistentry>
34360   <term><parameter>sleepFlag</parameter></term>
34361   <listitem>
34362    <para>
34363     Specifies whether the process can sleep
34364    </para>
34365   </listitem>
34366  </varlistentry>
34367 </variablelist>
34368</refsect1>
34369<refsect1>
34370<title>Description</title>
34371<para>
34372   Send IOCReset request to the MPT adapter.
34373   </para><para>
34374
34375   Returns 0 for success, non-zero for failure.
34376</para>
34377</refsect1>
34378</refentry>
34379
34380<refentry id="API-initChainBuffers">
34381<refentryinfo>
34382 <title>LINUX</title>
34383 <productname>Kernel Hackers Manual</productname>
34384 <date>July 2017</date>
34385</refentryinfo>
34386<refmeta>
34387 <refentrytitle><phrase>initChainBuffers</phrase></refentrytitle>
34388 <manvolnum>9</manvolnum>
34389 <refmiscinfo class="version">4.4.14</refmiscinfo>
34390</refmeta>
34391<refnamediv>
34392 <refname>initChainBuffers</refname>
34393 <refpurpose>
34394     Allocate memory for and initialize chain buffers
34395 </refpurpose>
34396</refnamediv>
34397<refsynopsisdiv>
34398 <title>Synopsis</title>
34399  <funcsynopsis><funcprototype>
34400   <funcdef>int <function>initChainBuffers </function></funcdef>
34401   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34402  </funcprototype></funcsynopsis>
34403</refsynopsisdiv>
34404<refsect1>
34405 <title>Arguments</title>
34406 <variablelist>
34407  <varlistentry>
34408   <term><parameter>ioc</parameter></term>
34409   <listitem>
34410    <para>
34411     Pointer to MPT_ADAPTER structure
34412    </para>
34413   </listitem>
34414  </varlistentry>
34415 </variablelist>
34416</refsect1>
34417<refsect1>
34418<title>Description</title>
34419<para>
34420   Allocates memory for and initializes chain buffers,
34421   chain buffer control arrays and spinlock.
34422</para>
34423</refsect1>
34424</refentry>
34425
34426<refentry id="API-PrimeIocFifos">
34427<refentryinfo>
34428 <title>LINUX</title>
34429 <productname>Kernel Hackers Manual</productname>
34430 <date>July 2017</date>
34431</refentryinfo>
34432<refmeta>
34433 <refentrytitle><phrase>PrimeIocFifos</phrase></refentrytitle>
34434 <manvolnum>9</manvolnum>
34435 <refmiscinfo class="version">4.4.14</refmiscinfo>
34436</refmeta>
34437<refnamediv>
34438 <refname>PrimeIocFifos</refname>
34439 <refpurpose>
34440     Initialize IOC request and reply FIFOs.
34441 </refpurpose>
34442</refnamediv>
34443<refsynopsisdiv>
34444 <title>Synopsis</title>
34445  <funcsynopsis><funcprototype>
34446   <funcdef>int <function>PrimeIocFifos </function></funcdef>
34447   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34448  </funcprototype></funcsynopsis>
34449</refsynopsisdiv>
34450<refsect1>
34451 <title>Arguments</title>
34452 <variablelist>
34453  <varlistentry>
34454   <term><parameter>ioc</parameter></term>
34455   <listitem>
34456    <para>
34457     Pointer to MPT_ADAPTER structure
34458    </para>
34459   </listitem>
34460  </varlistentry>
34461 </variablelist>
34462</refsect1>
34463<refsect1>
34464<title>Description</title>
34465<para>
34466   This routine allocates memory for the MPT reply and request frame
34467   pools (if necessary), and primes the IOC reply FIFO with
34468   reply frames.
34469   </para><para>
34470
34471   Returns 0 for success, non-zero for failure.
34472</para>
34473</refsect1>
34474</refentry>
34475
34476<refentry id="API-mpt-handshake-req-reply-wait">
34477<refentryinfo>
34478 <title>LINUX</title>
34479 <productname>Kernel Hackers Manual</productname>
34480 <date>July 2017</date>
34481</refentryinfo>
34482<refmeta>
34483 <refentrytitle><phrase>mpt_handshake_req_reply_wait</phrase></refentrytitle>
34484 <manvolnum>9</manvolnum>
34485 <refmiscinfo class="version">4.4.14</refmiscinfo>
34486</refmeta>
34487<refnamediv>
34488 <refname>mpt_handshake_req_reply_wait</refname>
34489 <refpurpose>
34490     Send MPT request to and receive reply from IOC via doorbell handshake method.
34491 </refpurpose>
34492</refnamediv>
34493<refsynopsisdiv>
34494 <title>Synopsis</title>
34495  <funcsynopsis><funcprototype>
34496   <funcdef>int <function>mpt_handshake_req_reply_wait </function></funcdef>
34497   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34498   <paramdef>int <parameter>reqBytes</parameter></paramdef>
34499   <paramdef>u32 * <parameter>req</parameter></paramdef>
34500   <paramdef>int <parameter>replyBytes</parameter></paramdef>
34501   <paramdef>u16 * <parameter>u16reply</parameter></paramdef>
34502   <paramdef>int <parameter>maxwait</parameter></paramdef>
34503   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34504  </funcprototype></funcsynopsis>
34505</refsynopsisdiv>
34506<refsect1>
34507 <title>Arguments</title>
34508 <variablelist>
34509  <varlistentry>
34510   <term><parameter>ioc</parameter></term>
34511   <listitem>
34512    <para>
34513     Pointer to MPT_ADAPTER structure
34514    </para>
34515   </listitem>
34516  </varlistentry>
34517  <varlistentry>
34518   <term><parameter>reqBytes</parameter></term>
34519   <listitem>
34520    <para>
34521     Size of the request in bytes
34522    </para>
34523   </listitem>
34524  </varlistentry>
34525  <varlistentry>
34526   <term><parameter>req</parameter></term>
34527   <listitem>
34528    <para>
34529     Pointer to MPT request frame
34530    </para>
34531   </listitem>
34532  </varlistentry>
34533  <varlistentry>
34534   <term><parameter>replyBytes</parameter></term>
34535   <listitem>
34536    <para>
34537     Expected size of the reply in bytes
34538    </para>
34539   </listitem>
34540  </varlistentry>
34541  <varlistentry>
34542   <term><parameter>u16reply</parameter></term>
34543   <listitem>
34544    <para>
34545     Pointer to area where reply should be written
34546    </para>
34547   </listitem>
34548  </varlistentry>
34549  <varlistentry>
34550   <term><parameter>maxwait</parameter></term>
34551   <listitem>
34552    <para>
34553     Max wait time for a reply (in seconds)
34554    </para>
34555   </listitem>
34556  </varlistentry>
34557  <varlistentry>
34558   <term><parameter>sleepFlag</parameter></term>
34559   <listitem>
34560    <para>
34561     Specifies whether the process can sleep
34562    </para>
34563   </listitem>
34564  </varlistentry>
34565 </variablelist>
34566</refsect1>
34567<refsect1>
34568<title>NOTES</title>
34569<para>
34570   It is the callers responsibility to byte-swap fields in the
34571   request which are greater than 1 byte in size.  It is also the
34572   callers responsibility to byte-swap response fields which are
34573   greater than 1 byte in size.
34574   </para><para>
34575
34576   Returns 0 for success, non-zero for failure.
34577</para>
34578</refsect1>
34579</refentry>
34580
34581<refentry id="API-WaitForDoorbellAck">
34582<refentryinfo>
34583 <title>LINUX</title>
34584 <productname>Kernel Hackers Manual</productname>
34585 <date>July 2017</date>
34586</refentryinfo>
34587<refmeta>
34588 <refentrytitle><phrase>WaitForDoorbellAck</phrase></refentrytitle>
34589 <manvolnum>9</manvolnum>
34590 <refmiscinfo class="version">4.4.14</refmiscinfo>
34591</refmeta>
34592<refnamediv>
34593 <refname>WaitForDoorbellAck</refname>
34594 <refpurpose>
34595     Wait for IOC doorbell handshake acknowledge
34596 </refpurpose>
34597</refnamediv>
34598<refsynopsisdiv>
34599 <title>Synopsis</title>
34600  <funcsynopsis><funcprototype>
34601   <funcdef>int <function>WaitForDoorbellAck </function></funcdef>
34602   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34603   <paramdef>int <parameter>howlong</parameter></paramdef>
34604   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34605  </funcprototype></funcsynopsis>
34606</refsynopsisdiv>
34607<refsect1>
34608 <title>Arguments</title>
34609 <variablelist>
34610  <varlistentry>
34611   <term><parameter>ioc</parameter></term>
34612   <listitem>
34613    <para>
34614     Pointer to MPT_ADAPTER structure
34615    </para>
34616   </listitem>
34617  </varlistentry>
34618  <varlistentry>
34619   <term><parameter>howlong</parameter></term>
34620   <listitem>
34621    <para>
34622     How long to wait (in seconds)
34623    </para>
34624   </listitem>
34625  </varlistentry>
34626  <varlistentry>
34627   <term><parameter>sleepFlag</parameter></term>
34628   <listitem>
34629    <para>
34630     Specifies whether the process can sleep
34631    </para>
34632   </listitem>
34633  </varlistentry>
34634 </variablelist>
34635</refsect1>
34636<refsect1>
34637<title>Description</title>
34638<para>
34639   This routine waits (up to ~2 seconds max) for IOC doorbell
34640   handshake ACKnowledge, indicated by the IOP_DOORBELL_STATUS
34641   bit in its IntStatus register being clear.
34642   </para><para>
34643
34644   Returns a negative value on failure, else wait loop count.
34645</para>
34646</refsect1>
34647</refentry>
34648
34649<refentry id="API-WaitForDoorbellInt">
34650<refentryinfo>
34651 <title>LINUX</title>
34652 <productname>Kernel Hackers Manual</productname>
34653 <date>July 2017</date>
34654</refentryinfo>
34655<refmeta>
34656 <refentrytitle><phrase>WaitForDoorbellInt</phrase></refentrytitle>
34657 <manvolnum>9</manvolnum>
34658 <refmiscinfo class="version">4.4.14</refmiscinfo>
34659</refmeta>
34660<refnamediv>
34661 <refname>WaitForDoorbellInt</refname>
34662 <refpurpose>
34663     Wait for IOC to set its doorbell interrupt bit
34664 </refpurpose>
34665</refnamediv>
34666<refsynopsisdiv>
34667 <title>Synopsis</title>
34668  <funcsynopsis><funcprototype>
34669   <funcdef>int <function>WaitForDoorbellInt </function></funcdef>
34670   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34671   <paramdef>int <parameter>howlong</parameter></paramdef>
34672   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34673  </funcprototype></funcsynopsis>
34674</refsynopsisdiv>
34675<refsect1>
34676 <title>Arguments</title>
34677 <variablelist>
34678  <varlistentry>
34679   <term><parameter>ioc</parameter></term>
34680   <listitem>
34681    <para>
34682     Pointer to MPT_ADAPTER structure
34683    </para>
34684   </listitem>
34685  </varlistentry>
34686  <varlistentry>
34687   <term><parameter>howlong</parameter></term>
34688   <listitem>
34689    <para>
34690     How long to wait (in seconds)
34691    </para>
34692   </listitem>
34693  </varlistentry>
34694  <varlistentry>
34695   <term><parameter>sleepFlag</parameter></term>
34696   <listitem>
34697    <para>
34698     Specifies whether the process can sleep
34699    </para>
34700   </listitem>
34701  </varlistentry>
34702 </variablelist>
34703</refsect1>
34704<refsect1>
34705<title>Description</title>
34706<para>
34707   This routine waits (up to ~2 seconds max) for IOC doorbell interrupt
34708   (MPI_HIS_DOORBELL_INTERRUPT) to be set in the IntStatus register.
34709   </para><para>
34710
34711   Returns a negative value on failure, else wait loop count.
34712</para>
34713</refsect1>
34714</refentry>
34715
34716<refentry id="API-WaitForDoorbellReply">
34717<refentryinfo>
34718 <title>LINUX</title>
34719 <productname>Kernel Hackers Manual</productname>
34720 <date>July 2017</date>
34721</refentryinfo>
34722<refmeta>
34723 <refentrytitle><phrase>WaitForDoorbellReply</phrase></refentrytitle>
34724 <manvolnum>9</manvolnum>
34725 <refmiscinfo class="version">4.4.14</refmiscinfo>
34726</refmeta>
34727<refnamediv>
34728 <refname>WaitForDoorbellReply</refname>
34729 <refpurpose>
34730     Wait for and capture an IOC handshake reply.
34731 </refpurpose>
34732</refnamediv>
34733<refsynopsisdiv>
34734 <title>Synopsis</title>
34735  <funcsynopsis><funcprototype>
34736   <funcdef>int <function>WaitForDoorbellReply </function></funcdef>
34737   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34738   <paramdef>int <parameter>howlong</parameter></paramdef>
34739   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
34740  </funcprototype></funcsynopsis>
34741</refsynopsisdiv>
34742<refsect1>
34743 <title>Arguments</title>
34744 <variablelist>
34745  <varlistentry>
34746   <term><parameter>ioc</parameter></term>
34747   <listitem>
34748    <para>
34749     Pointer to MPT_ADAPTER structure
34750    </para>
34751   </listitem>
34752  </varlistentry>
34753  <varlistentry>
34754   <term><parameter>howlong</parameter></term>
34755   <listitem>
34756    <para>
34757     How long to wait (in seconds)
34758    </para>
34759   </listitem>
34760  </varlistentry>
34761  <varlistentry>
34762   <term><parameter>sleepFlag</parameter></term>
34763   <listitem>
34764    <para>
34765     Specifies whether the process can sleep
34766    </para>
34767   </listitem>
34768  </varlistentry>
34769 </variablelist>
34770</refsect1>
34771<refsect1>
34772<title>Description</title>
34773<para>
34774   This routine polls the IOC for a handshake reply, 16 bits at a time.
34775   Reply is cached to IOC private area large enough to hold a maximum
34776   of 128 bytes of reply data.
34777   </para><para>
34778
34779   Returns a negative value on failure, else size of reply in WORDS.
34780</para>
34781</refsect1>
34782</refentry>
34783
34784<refentry id="API-GetLanConfigPages">
34785<refentryinfo>
34786 <title>LINUX</title>
34787 <productname>Kernel Hackers Manual</productname>
34788 <date>July 2017</date>
34789</refentryinfo>
34790<refmeta>
34791 <refentrytitle><phrase>GetLanConfigPages</phrase></refentrytitle>
34792 <manvolnum>9</manvolnum>
34793 <refmiscinfo class="version">4.4.14</refmiscinfo>
34794</refmeta>
34795<refnamediv>
34796 <refname>GetLanConfigPages</refname>
34797 <refpurpose>
34798     Fetch LANConfig pages.
34799 </refpurpose>
34800</refnamediv>
34801<refsynopsisdiv>
34802 <title>Synopsis</title>
34803  <funcsynopsis><funcprototype>
34804   <funcdef>int <function>GetLanConfigPages </function></funcdef>
34805   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34806  </funcprototype></funcsynopsis>
34807</refsynopsisdiv>
34808<refsect1>
34809 <title>Arguments</title>
34810 <variablelist>
34811  <varlistentry>
34812   <term><parameter>ioc</parameter></term>
34813   <listitem>
34814    <para>
34815     Pointer to MPT_ADAPTER structure
34816    </para>
34817   </listitem>
34818  </varlistentry>
34819 </variablelist>
34820</refsect1>
34821<refsect1>
34822<title>Return</title>
34823<para>
34824   0 for success
34825   -ENOMEM if no memory available
34826   -EPERM if not allowed due to ISR context
34827   -EAGAIN if no msg frames currently available
34828   -EFAULT for non-successful reply or no reply (timeout)
34829</para>
34830</refsect1>
34831</refentry>
34832
34833<refentry id="API-GetIoUnitPage2">
34834<refentryinfo>
34835 <title>LINUX</title>
34836 <productname>Kernel Hackers Manual</productname>
34837 <date>July 2017</date>
34838</refentryinfo>
34839<refmeta>
34840 <refentrytitle><phrase>GetIoUnitPage2</phrase></refentrytitle>
34841 <manvolnum>9</manvolnum>
34842 <refmiscinfo class="version">4.4.14</refmiscinfo>
34843</refmeta>
34844<refnamediv>
34845 <refname>GetIoUnitPage2</refname>
34846 <refpurpose>
34847     Retrieve BIOS version and boot order information.
34848 </refpurpose>
34849</refnamediv>
34850<refsynopsisdiv>
34851 <title>Synopsis</title>
34852  <funcsynopsis><funcprototype>
34853   <funcdef>int <function>GetIoUnitPage2 </function></funcdef>
34854   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34855  </funcprototype></funcsynopsis>
34856</refsynopsisdiv>
34857<refsect1>
34858 <title>Arguments</title>
34859 <variablelist>
34860  <varlistentry>
34861   <term><parameter>ioc</parameter></term>
34862   <listitem>
34863    <para>
34864     Pointer to MPT_ADAPTER structure
34865    </para>
34866   </listitem>
34867  </varlistentry>
34868 </variablelist>
34869</refsect1>
34870<refsect1>
34871<title>Returns</title>
34872<para>
34873   0 for success
34874   -ENOMEM if no memory available
34875   -EPERM if not allowed due to ISR context
34876   -EAGAIN if no msg frames currently available
34877   -EFAULT for non-successful reply or no reply (timeout)
34878</para>
34879</refsect1>
34880</refentry>
34881
34882<refentry id="API-mpt-GetScsiPortSettings">
34883<refentryinfo>
34884 <title>LINUX</title>
34885 <productname>Kernel Hackers Manual</productname>
34886 <date>July 2017</date>
34887</refentryinfo>
34888<refmeta>
34889 <refentrytitle><phrase>mpt_GetScsiPortSettings</phrase></refentrytitle>
34890 <manvolnum>9</manvolnum>
34891 <refmiscinfo class="version">4.4.14</refmiscinfo>
34892</refmeta>
34893<refnamediv>
34894 <refname>mpt_GetScsiPortSettings</refname>
34895 <refpurpose>
34896     read SCSI Port Page 0 and 2
34897 </refpurpose>
34898</refnamediv>
34899<refsynopsisdiv>
34900 <title>Synopsis</title>
34901  <funcsynopsis><funcprototype>
34902   <funcdef>int <function>mpt_GetScsiPortSettings </function></funcdef>
34903   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34904   <paramdef>int <parameter>portnum</parameter></paramdef>
34905  </funcprototype></funcsynopsis>
34906</refsynopsisdiv>
34907<refsect1>
34908 <title>Arguments</title>
34909 <variablelist>
34910  <varlistentry>
34911   <term><parameter>ioc</parameter></term>
34912   <listitem>
34913    <para>
34914     Pointer to a Adapter Strucutre
34915    </para>
34916   </listitem>
34917  </varlistentry>
34918  <varlistentry>
34919   <term><parameter>portnum</parameter></term>
34920   <listitem>
34921    <para>
34922     IOC port number
34923    </para>
34924   </listitem>
34925  </varlistentry>
34926 </variablelist>
34927</refsect1>
34928<refsect1>
34929<title>Return</title>
34930<para>
34931   -EFAULT if read of config page header fails
34932   or if no nvram
34933   If read of SCSI Port Page 0 fails,
34934   NVRAM = MPT_HOST_NVRAM_INVALID  (0xFFFFFFFF)
34935</para>
34936</refsect1>
34937<refsect1>
34938<title>Adapter settings</title>
34939<para>
34940   async, narrow
34941   Return 1
34942   If read of SCSI Port Page 2 fails,
34943   Adapter settings valid
34944   NVRAM = MPT_HOST_NVRAM_INVALID  (0xFFFFFFFF)
34945   Return 1
34946   Else
34947   Both valid
34948   Return 0
34949   CHECK - what type of locking mechanisms should be used????
34950</para>
34951</refsect1>
34952</refentry>
34953
34954<refentry id="API-mpt-readScsiDevicePageHeaders">
34955<refentryinfo>
34956 <title>LINUX</title>
34957 <productname>Kernel Hackers Manual</productname>
34958 <date>July 2017</date>
34959</refentryinfo>
34960<refmeta>
34961 <refentrytitle><phrase>mpt_readScsiDevicePageHeaders</phrase></refentrytitle>
34962 <manvolnum>9</manvolnum>
34963 <refmiscinfo class="version">4.4.14</refmiscinfo>
34964</refmeta>
34965<refnamediv>
34966 <refname>mpt_readScsiDevicePageHeaders</refname>
34967 <refpurpose>
34968     save version and length of SDP1
34969 </refpurpose>
34970</refnamediv>
34971<refsynopsisdiv>
34972 <title>Synopsis</title>
34973  <funcsynopsis><funcprototype>
34974   <funcdef>int <function>mpt_readScsiDevicePageHeaders </function></funcdef>
34975   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
34976   <paramdef>int <parameter>portnum</parameter></paramdef>
34977  </funcprototype></funcsynopsis>
34978</refsynopsisdiv>
34979<refsect1>
34980 <title>Arguments</title>
34981 <variablelist>
34982  <varlistentry>
34983   <term><parameter>ioc</parameter></term>
34984   <listitem>
34985    <para>
34986     Pointer to a Adapter Strucutre
34987    </para>
34988   </listitem>
34989  </varlistentry>
34990  <varlistentry>
34991   <term><parameter>portnum</parameter></term>
34992   <listitem>
34993    <para>
34994     IOC port number
34995    </para>
34996   </listitem>
34997  </varlistentry>
34998 </variablelist>
34999</refsect1>
35000<refsect1>
35001<title>Return</title>
35002<para>
35003   -EFAULT if read of config page header fails
35004   or 0 if success.
35005</para>
35006</refsect1>
35007</refentry>
35008
35009<refentry id="API-mpt-inactive-raid-list-free">
35010<refentryinfo>
35011 <title>LINUX</title>
35012 <productname>Kernel Hackers Manual</productname>
35013 <date>July 2017</date>
35014</refentryinfo>
35015<refmeta>
35016 <refentrytitle><phrase>mpt_inactive_raid_list_free</phrase></refentrytitle>
35017 <manvolnum>9</manvolnum>
35018 <refmiscinfo class="version">4.4.14</refmiscinfo>
35019</refmeta>
35020<refnamediv>
35021 <refname>mpt_inactive_raid_list_free</refname>
35022 <refpurpose>
35023     This clears this link list.
35024 </refpurpose>
35025</refnamediv>
35026<refsynopsisdiv>
35027 <title>Synopsis</title>
35028  <funcsynopsis><funcprototype>
35029   <funcdef>void <function>mpt_inactive_raid_list_free </function></funcdef>
35030   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35031  </funcprototype></funcsynopsis>
35032</refsynopsisdiv>
35033<refsect1>
35034 <title>Arguments</title>
35035 <variablelist>
35036  <varlistentry>
35037   <term><parameter>ioc</parameter></term>
35038   <listitem>
35039    <para>
35040     pointer to per adapter structure
35041    </para>
35042   </listitem>
35043  </varlistentry>
35044 </variablelist>
35045</refsect1>
35046</refentry>
35047
35048<refentry id="API-mpt-inactive-raid-volumes">
35049<refentryinfo>
35050 <title>LINUX</title>
35051 <productname>Kernel Hackers Manual</productname>
35052 <date>July 2017</date>
35053</refentryinfo>
35054<refmeta>
35055 <refentrytitle><phrase>mpt_inactive_raid_volumes</phrase></refentrytitle>
35056 <manvolnum>9</manvolnum>
35057 <refmiscinfo class="version">4.4.14</refmiscinfo>
35058</refmeta>
35059<refnamediv>
35060 <refname>mpt_inactive_raid_volumes</refname>
35061 <refpurpose>
35062     sets up link list of phy_disk_nums for devices belonging in an inactive volume
35063 </refpurpose>
35064</refnamediv>
35065<refsynopsisdiv>
35066 <title>Synopsis</title>
35067  <funcsynopsis><funcprototype>
35068   <funcdef>void <function>mpt_inactive_raid_volumes </function></funcdef>
35069   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35070   <paramdef>u8 <parameter>channel</parameter></paramdef>
35071   <paramdef>u8 <parameter>id</parameter></paramdef>
35072  </funcprototype></funcsynopsis>
35073</refsynopsisdiv>
35074<refsect1>
35075 <title>Arguments</title>
35076 <variablelist>
35077  <varlistentry>
35078   <term><parameter>ioc</parameter></term>
35079   <listitem>
35080    <para>
35081     pointer to per adapter structure
35082    </para>
35083   </listitem>
35084  </varlistentry>
35085  <varlistentry>
35086   <term><parameter>channel</parameter></term>
35087   <listitem>
35088    <para>
35089     volume channel
35090    </para>
35091   </listitem>
35092  </varlistentry>
35093  <varlistentry>
35094   <term><parameter>id</parameter></term>
35095   <listitem>
35096    <para>
35097     volume target id
35098    </para>
35099   </listitem>
35100  </varlistentry>
35101 </variablelist>
35102</refsect1>
35103</refentry>
35104
35105<refentry id="API-SendEventNotification">
35106<refentryinfo>
35107 <title>LINUX</title>
35108 <productname>Kernel Hackers Manual</productname>
35109 <date>July 2017</date>
35110</refentryinfo>
35111<refmeta>
35112 <refentrytitle><phrase>SendEventNotification</phrase></refentrytitle>
35113 <manvolnum>9</manvolnum>
35114 <refmiscinfo class="version">4.4.14</refmiscinfo>
35115</refmeta>
35116<refnamediv>
35117 <refname>SendEventNotification</refname>
35118 <refpurpose>
35119     Send EventNotification (on or off) request to adapter
35120 </refpurpose>
35121</refnamediv>
35122<refsynopsisdiv>
35123 <title>Synopsis</title>
35124  <funcsynopsis><funcprototype>
35125   <funcdef>int <function>SendEventNotification </function></funcdef>
35126   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35127   <paramdef>u8 <parameter>EvSwitch</parameter></paramdef>
35128   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
35129  </funcprototype></funcsynopsis>
35130</refsynopsisdiv>
35131<refsect1>
35132 <title>Arguments</title>
35133 <variablelist>
35134  <varlistentry>
35135   <term><parameter>ioc</parameter></term>
35136   <listitem>
35137    <para>
35138     Pointer to MPT_ADAPTER structure
35139    </para>
35140   </listitem>
35141  </varlistentry>
35142  <varlistentry>
35143   <term><parameter>EvSwitch</parameter></term>
35144   <listitem>
35145    <para>
35146     Event switch flags
35147    </para>
35148   </listitem>
35149  </varlistentry>
35150  <varlistentry>
35151   <term><parameter>sleepFlag</parameter></term>
35152   <listitem>
35153    <para>
35154     Specifies whether the process can sleep
35155    </para>
35156   </listitem>
35157  </varlistentry>
35158 </variablelist>
35159</refsect1>
35160</refentry>
35161
35162<refentry id="API-SendEventAck">
35163<refentryinfo>
35164 <title>LINUX</title>
35165 <productname>Kernel Hackers Manual</productname>
35166 <date>July 2017</date>
35167</refentryinfo>
35168<refmeta>
35169 <refentrytitle><phrase>SendEventAck</phrase></refentrytitle>
35170 <manvolnum>9</manvolnum>
35171 <refmiscinfo class="version">4.4.14</refmiscinfo>
35172</refmeta>
35173<refnamediv>
35174 <refname>SendEventAck</refname>
35175 <refpurpose>
35176     Send EventAck request to MPT adapter.
35177 </refpurpose>
35178</refnamediv>
35179<refsynopsisdiv>
35180 <title>Synopsis</title>
35181  <funcsynopsis><funcprototype>
35182   <funcdef>int <function>SendEventAck </function></funcdef>
35183   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35184   <paramdef>EventNotificationReply_t * <parameter>evnp</parameter></paramdef>
35185  </funcprototype></funcsynopsis>
35186</refsynopsisdiv>
35187<refsect1>
35188 <title>Arguments</title>
35189 <variablelist>
35190  <varlistentry>
35191   <term><parameter>ioc</parameter></term>
35192   <listitem>
35193    <para>
35194     Pointer to MPT_ADAPTER structure
35195    </para>
35196   </listitem>
35197  </varlistentry>
35198  <varlistentry>
35199   <term><parameter>evnp</parameter></term>
35200   <listitem>
35201    <para>
35202     Pointer to original EventNotification request
35203    </para>
35204   </listitem>
35205  </varlistentry>
35206 </variablelist>
35207</refsect1>
35208</refentry>
35209
35210<refentry id="API-mpt-ioc-reset">
35211<refentryinfo>
35212 <title>LINUX</title>
35213 <productname>Kernel Hackers Manual</productname>
35214 <date>July 2017</date>
35215</refentryinfo>
35216<refmeta>
35217 <refentrytitle><phrase>mpt_ioc_reset</phrase></refentrytitle>
35218 <manvolnum>9</manvolnum>
35219 <refmiscinfo class="version">4.4.14</refmiscinfo>
35220</refmeta>
35221<refnamediv>
35222 <refname>mpt_ioc_reset</refname>
35223 <refpurpose>
35224     Base cleanup for hard reset
35225 </refpurpose>
35226</refnamediv>
35227<refsynopsisdiv>
35228 <title>Synopsis</title>
35229  <funcsynopsis><funcprototype>
35230   <funcdef>int <function>mpt_ioc_reset </function></funcdef>
35231   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35232   <paramdef>int <parameter>reset_phase</parameter></paramdef>
35233  </funcprototype></funcsynopsis>
35234</refsynopsisdiv>
35235<refsect1>
35236 <title>Arguments</title>
35237 <variablelist>
35238  <varlistentry>
35239   <term><parameter>ioc</parameter></term>
35240   <listitem>
35241    <para>
35242     Pointer to the adapter structure
35243    </para>
35244   </listitem>
35245  </varlistentry>
35246  <varlistentry>
35247   <term><parameter>reset_phase</parameter></term>
35248   <listitem>
35249    <para>
35250     Indicates pre- or post-reset functionality
35251    </para>
35252   </listitem>
35253  </varlistentry>
35254 </variablelist>
35255</refsect1>
35256<refsect1>
35257<title>Remark</title>
35258<para>
35259   Frees resources with internally generated commands.
35260</para>
35261</refsect1>
35262</refentry>
35263
35264<refentry id="API-procmpt-create">
35265<refentryinfo>
35266 <title>LINUX</title>
35267 <productname>Kernel Hackers Manual</productname>
35268 <date>July 2017</date>
35269</refentryinfo>
35270<refmeta>
35271 <refentrytitle><phrase>procmpt_create</phrase></refentrytitle>
35272 <manvolnum>9</manvolnum>
35273 <refmiscinfo class="version">4.4.14</refmiscinfo>
35274</refmeta>
35275<refnamediv>
35276 <refname>procmpt_create</refname>
35277 <refpurpose>
35278     Create <constant>MPT_PROCFS_MPTBASEDIR</constant> entries.
35279 </refpurpose>
35280</refnamediv>
35281<refsynopsisdiv>
35282 <title>Synopsis</title>
35283  <funcsynopsis><funcprototype>
35284   <funcdef>int <function>procmpt_create </function></funcdef>
35285   <paramdef> <parameter>void</parameter></paramdef>
35286  </funcprototype></funcsynopsis>
35287</refsynopsisdiv>
35288<refsect1>
35289 <title>Arguments</title>
35290 <variablelist>
35291  <varlistentry>
35292   <term><parameter>void</parameter></term>
35293   <listitem>
35294    <para>
35295     no arguments
35296    </para>
35297   </listitem>
35298  </varlistentry>
35299 </variablelist>
35300</refsect1>
35301<refsect1>
35302<title>Description</title>
35303<para>
35304   </para><para>
35305
35306   Returns 0 for success, non-zero for failure.
35307</para>
35308</refsect1>
35309</refentry>
35310
35311<refentry id="API-procmpt-destroy">
35312<refentryinfo>
35313 <title>LINUX</title>
35314 <productname>Kernel Hackers Manual</productname>
35315 <date>July 2017</date>
35316</refentryinfo>
35317<refmeta>
35318 <refentrytitle><phrase>procmpt_destroy</phrase></refentrytitle>
35319 <manvolnum>9</manvolnum>
35320 <refmiscinfo class="version">4.4.14</refmiscinfo>
35321</refmeta>
35322<refnamediv>
35323 <refname>procmpt_destroy</refname>
35324 <refpurpose>
35325     Tear down <constant>MPT_PROCFS_MPTBASEDIR</constant> entries.
35326 </refpurpose>
35327</refnamediv>
35328<refsynopsisdiv>
35329 <title>Synopsis</title>
35330  <funcsynopsis><funcprototype>
35331   <funcdef>void <function>procmpt_destroy </function></funcdef>
35332   <paramdef> <parameter>void</parameter></paramdef>
35333  </funcprototype></funcsynopsis>
35334</refsynopsisdiv>
35335<refsect1>
35336 <title>Arguments</title>
35337 <variablelist>
35338  <varlistentry>
35339   <term><parameter>void</parameter></term>
35340   <listitem>
35341    <para>
35342     no arguments
35343    </para>
35344   </listitem>
35345  </varlistentry>
35346 </variablelist>
35347</refsect1>
35348<refsect1>
35349<title>Description</title>
35350<para>
35351   </para><para>
35352
35353   Returns 0 for success, non-zero for failure.
35354</para>
35355</refsect1>
35356</refentry>
35357
35358<refentry id="API-mpt-SoftResetHandler">
35359<refentryinfo>
35360 <title>LINUX</title>
35361 <productname>Kernel Hackers Manual</productname>
35362 <date>July 2017</date>
35363</refentryinfo>
35364<refmeta>
35365 <refentrytitle><phrase>mpt_SoftResetHandler</phrase></refentrytitle>
35366 <manvolnum>9</manvolnum>
35367 <refmiscinfo class="version">4.4.14</refmiscinfo>
35368</refmeta>
35369<refnamediv>
35370 <refname>mpt_SoftResetHandler</refname>
35371 <refpurpose>
35372     Issues a less expensive reset
35373 </refpurpose>
35374</refnamediv>
35375<refsynopsisdiv>
35376 <title>Synopsis</title>
35377  <funcsynopsis><funcprototype>
35378   <funcdef>int <function>mpt_SoftResetHandler </function></funcdef>
35379   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35380   <paramdef>int <parameter>sleepFlag</parameter></paramdef>
35381  </funcprototype></funcsynopsis>
35382</refsynopsisdiv>
35383<refsect1>
35384 <title>Arguments</title>
35385 <variablelist>
35386  <varlistentry>
35387   <term><parameter>ioc</parameter></term>
35388   <listitem>
35389    <para>
35390     Pointer to MPT_ADAPTER structure
35391    </para>
35392   </listitem>
35393  </varlistentry>
35394  <varlistentry>
35395   <term><parameter>sleepFlag</parameter></term>
35396   <listitem>
35397    <para>
35398     Indicates if sleep or schedule must be called.
35399    </para>
35400   </listitem>
35401  </varlistentry>
35402 </variablelist>
35403</refsect1>
35404<refsect1>
35405<title>Description</title>
35406<para>
35407   Returns 0 for SUCCESS or -1 if FAILED.
35408   </para><para>
35409
35410   Message Unit Reset - instructs the IOC to reset the Reply Post and
35411   Free FIFO's. All the Message Frames on Reply Free FIFO are discarded.
35412   All posted buffers are freed, and event notification is turned off.
35413   IOC doesn't reply to any outstanding request. This will transfer IOC
35414   to READY state.
35415</para>
35416</refsect1>
35417</refentry>
35418
35419<refentry id="API-ProcessEventNotification">
35420<refentryinfo>
35421 <title>LINUX</title>
35422 <productname>Kernel Hackers Manual</productname>
35423 <date>July 2017</date>
35424</refentryinfo>
35425<refmeta>
35426 <refentrytitle><phrase>ProcessEventNotification</phrase></refentrytitle>
35427 <manvolnum>9</manvolnum>
35428 <refmiscinfo class="version">4.4.14</refmiscinfo>
35429</refmeta>
35430<refnamediv>
35431 <refname>ProcessEventNotification</refname>
35432 <refpurpose>
35433     Route EventNotificationReply to all event handlers
35434 </refpurpose>
35435</refnamediv>
35436<refsynopsisdiv>
35437 <title>Synopsis</title>
35438  <funcsynopsis><funcprototype>
35439   <funcdef>int <function>ProcessEventNotification </function></funcdef>
35440   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35441   <paramdef>EventNotificationReply_t * <parameter>pEventReply</parameter></paramdef>
35442   <paramdef>int * <parameter>evHandlers</parameter></paramdef>
35443  </funcprototype></funcsynopsis>
35444</refsynopsisdiv>
35445<refsect1>
35446 <title>Arguments</title>
35447 <variablelist>
35448  <varlistentry>
35449   <term><parameter>ioc</parameter></term>
35450   <listitem>
35451    <para>
35452     Pointer to MPT_ADAPTER structure
35453    </para>
35454   </listitem>
35455  </varlistentry>
35456  <varlistentry>
35457   <term><parameter>pEventReply</parameter></term>
35458   <listitem>
35459    <para>
35460     Pointer to EventNotification reply frame
35461    </para>
35462   </listitem>
35463  </varlistentry>
35464  <varlistentry>
35465   <term><parameter>evHandlers</parameter></term>
35466   <listitem>
35467    <para>
35468     Pointer to integer, number of event handlers
35469    </para>
35470   </listitem>
35471  </varlistentry>
35472 </variablelist>
35473</refsect1>
35474<refsect1>
35475<title>Description</title>
35476<para>
35477   Routes a received EventNotificationReply to all currently registered
35478   event handlers.
35479   Returns sum of event handlers return values.
35480</para>
35481</refsect1>
35482</refentry>
35483
35484<refentry id="API-mpt-fc-log-info">
35485<refentryinfo>
35486 <title>LINUX</title>
35487 <productname>Kernel Hackers Manual</productname>
35488 <date>July 2017</date>
35489</refentryinfo>
35490<refmeta>
35491 <refentrytitle><phrase>mpt_fc_log_info</phrase></refentrytitle>
35492 <manvolnum>9</manvolnum>
35493 <refmiscinfo class="version">4.4.14</refmiscinfo>
35494</refmeta>
35495<refnamediv>
35496 <refname>mpt_fc_log_info</refname>
35497 <refpurpose>
35498     Log information returned from Fibre Channel IOC.
35499 </refpurpose>
35500</refnamediv>
35501<refsynopsisdiv>
35502 <title>Synopsis</title>
35503  <funcsynopsis><funcprototype>
35504   <funcdef>void <function>mpt_fc_log_info </function></funcdef>
35505   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35506   <paramdef>u32 <parameter>log_info</parameter></paramdef>
35507  </funcprototype></funcsynopsis>
35508</refsynopsisdiv>
35509<refsect1>
35510 <title>Arguments</title>
35511 <variablelist>
35512  <varlistentry>
35513   <term><parameter>ioc</parameter></term>
35514   <listitem>
35515    <para>
35516     Pointer to MPT_ADAPTER structure
35517    </para>
35518   </listitem>
35519  </varlistentry>
35520  <varlistentry>
35521   <term><parameter>log_info</parameter></term>
35522   <listitem>
35523    <para>
35524     U32 LogInfo reply word from the IOC
35525    </para>
35526   </listitem>
35527  </varlistentry>
35528 </variablelist>
35529</refsect1>
35530<refsect1>
35531<title>Description</title>
35532<para>
35533   Refer to lsi/mpi_log_fc.h.
35534</para>
35535</refsect1>
35536</refentry>
35537
35538<refentry id="API-mpt-spi-log-info">
35539<refentryinfo>
35540 <title>LINUX</title>
35541 <productname>Kernel Hackers Manual</productname>
35542 <date>July 2017</date>
35543</refentryinfo>
35544<refmeta>
35545 <refentrytitle><phrase>mpt_spi_log_info</phrase></refentrytitle>
35546 <manvolnum>9</manvolnum>
35547 <refmiscinfo class="version">4.4.14</refmiscinfo>
35548</refmeta>
35549<refnamediv>
35550 <refname>mpt_spi_log_info</refname>
35551 <refpurpose>
35552     Log information returned from SCSI Parallel IOC.
35553 </refpurpose>
35554</refnamediv>
35555<refsynopsisdiv>
35556 <title>Synopsis</title>
35557  <funcsynopsis><funcprototype>
35558   <funcdef>void <function>mpt_spi_log_info </function></funcdef>
35559   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35560   <paramdef>u32 <parameter>log_info</parameter></paramdef>
35561  </funcprototype></funcsynopsis>
35562</refsynopsisdiv>
35563<refsect1>
35564 <title>Arguments</title>
35565 <variablelist>
35566  <varlistentry>
35567   <term><parameter>ioc</parameter></term>
35568   <listitem>
35569    <para>
35570     Pointer to MPT_ADAPTER structure
35571    </para>
35572   </listitem>
35573  </varlistentry>
35574  <varlistentry>
35575   <term><parameter>log_info</parameter></term>
35576   <listitem>
35577    <para>
35578     U32 LogInfo word from the IOC
35579    </para>
35580   </listitem>
35581  </varlistentry>
35582 </variablelist>
35583</refsect1>
35584<refsect1>
35585<title>Description</title>
35586<para>
35587   Refer to lsi/sp_log.h.
35588</para>
35589</refsect1>
35590</refentry>
35591
35592<refentry id="API-mpt-sas-log-info">
35593<refentryinfo>
35594 <title>LINUX</title>
35595 <productname>Kernel Hackers Manual</productname>
35596 <date>July 2017</date>
35597</refentryinfo>
35598<refmeta>
35599 <refentrytitle><phrase>mpt_sas_log_info</phrase></refentrytitle>
35600 <manvolnum>9</manvolnum>
35601 <refmiscinfo class="version">4.4.14</refmiscinfo>
35602</refmeta>
35603<refnamediv>
35604 <refname>mpt_sas_log_info</refname>
35605 <refpurpose>
35606     Log information returned from SAS IOC.
35607 </refpurpose>
35608</refnamediv>
35609<refsynopsisdiv>
35610 <title>Synopsis</title>
35611  <funcsynopsis><funcprototype>
35612   <funcdef>void <function>mpt_sas_log_info </function></funcdef>
35613   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35614   <paramdef>u32 <parameter>log_info</parameter></paramdef>
35615   <paramdef>u8 <parameter>cb_idx</parameter></paramdef>
35616  </funcprototype></funcsynopsis>
35617</refsynopsisdiv>
35618<refsect1>
35619 <title>Arguments</title>
35620 <variablelist>
35621  <varlistentry>
35622   <term><parameter>ioc</parameter></term>
35623   <listitem>
35624    <para>
35625     Pointer to MPT_ADAPTER structure
35626    </para>
35627   </listitem>
35628  </varlistentry>
35629  <varlistentry>
35630   <term><parameter>log_info</parameter></term>
35631   <listitem>
35632    <para>
35633     U32 LogInfo reply word from the IOC
35634    </para>
35635   </listitem>
35636  </varlistentry>
35637  <varlistentry>
35638   <term><parameter>cb_idx</parameter></term>
35639   <listitem>
35640    <para>
35641     callback function's handle
35642    </para>
35643   </listitem>
35644  </varlistentry>
35645 </variablelist>
35646</refsect1>
35647<refsect1>
35648<title>Description</title>
35649<para>
35650   Refer to lsi/mpi_log_sas.h.
35651</para>
35652</refsect1>
35653</refentry>
35654
35655<refentry id="API-mpt-iocstatus-info-config">
35656<refentryinfo>
35657 <title>LINUX</title>
35658 <productname>Kernel Hackers Manual</productname>
35659 <date>July 2017</date>
35660</refentryinfo>
35661<refmeta>
35662 <refentrytitle><phrase>mpt_iocstatus_info_config</phrase></refentrytitle>
35663 <manvolnum>9</manvolnum>
35664 <refmiscinfo class="version">4.4.14</refmiscinfo>
35665</refmeta>
35666<refnamediv>
35667 <refname>mpt_iocstatus_info_config</refname>
35668 <refpurpose>
35669     IOCSTATUS information for config pages
35670 </refpurpose>
35671</refnamediv>
35672<refsynopsisdiv>
35673 <title>Synopsis</title>
35674  <funcsynopsis><funcprototype>
35675   <funcdef>void <function>mpt_iocstatus_info_config </function></funcdef>
35676   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35677   <paramdef>u32 <parameter>ioc_status</parameter></paramdef>
35678   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
35679  </funcprototype></funcsynopsis>
35680</refsynopsisdiv>
35681<refsect1>
35682 <title>Arguments</title>
35683 <variablelist>
35684  <varlistentry>
35685   <term><parameter>ioc</parameter></term>
35686   <listitem>
35687    <para>
35688     Pointer to MPT_ADAPTER structure
35689    </para>
35690   </listitem>
35691  </varlistentry>
35692  <varlistentry>
35693   <term><parameter>ioc_status</parameter></term>
35694   <listitem>
35695    <para>
35696     U32 IOCStatus word from IOC
35697    </para>
35698   </listitem>
35699  </varlistentry>
35700  <varlistentry>
35701   <term><parameter>mf</parameter></term>
35702   <listitem>
35703    <para>
35704     Pointer to MPT request frame
35705    </para>
35706   </listitem>
35707  </varlistentry>
35708 </variablelist>
35709</refsect1>
35710<refsect1>
35711<title>Description</title>
35712<para>
35713   Refer to lsi/mpi.h.
35714</para>
35715</refsect1>
35716</refentry>
35717
35718<refentry id="API-mpt-iocstatus-info">
35719<refentryinfo>
35720 <title>LINUX</title>
35721 <productname>Kernel Hackers Manual</productname>
35722 <date>July 2017</date>
35723</refentryinfo>
35724<refmeta>
35725 <refentrytitle><phrase>mpt_iocstatus_info</phrase></refentrytitle>
35726 <manvolnum>9</manvolnum>
35727 <refmiscinfo class="version">4.4.14</refmiscinfo>
35728</refmeta>
35729<refnamediv>
35730 <refname>mpt_iocstatus_info</refname>
35731 <refpurpose>
35732     IOCSTATUS information returned from IOC.
35733 </refpurpose>
35734</refnamediv>
35735<refsynopsisdiv>
35736 <title>Synopsis</title>
35737  <funcsynopsis><funcprototype>
35738   <funcdef>void <function>mpt_iocstatus_info </function></funcdef>
35739   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
35740   <paramdef>u32 <parameter>ioc_status</parameter></paramdef>
35741   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
35742  </funcprototype></funcsynopsis>
35743</refsynopsisdiv>
35744<refsect1>
35745 <title>Arguments</title>
35746 <variablelist>
35747  <varlistentry>
35748   <term><parameter>ioc</parameter></term>
35749   <listitem>
35750    <para>
35751     Pointer to MPT_ADAPTER structure
35752    </para>
35753   </listitem>
35754  </varlistentry>
35755  <varlistentry>
35756   <term><parameter>ioc_status</parameter></term>
35757   <listitem>
35758    <para>
35759     U32 IOCStatus word from IOC
35760    </para>
35761   </listitem>
35762  </varlistentry>
35763  <varlistentry>
35764   <term><parameter>mf</parameter></term>
35765   <listitem>
35766    <para>
35767     Pointer to MPT request frame
35768    </para>
35769   </listitem>
35770  </varlistentry>
35771 </variablelist>
35772</refsect1>
35773<refsect1>
35774<title>Description</title>
35775<para>
35776   Refer to lsi/mpi.h.
35777</para>
35778</refsect1>
35779</refentry>
35780
35781<refentry id="API-fusion-init">
35782<refentryinfo>
35783 <title>LINUX</title>
35784 <productname>Kernel Hackers Manual</productname>
35785 <date>July 2017</date>
35786</refentryinfo>
35787<refmeta>
35788 <refentrytitle><phrase>fusion_init</phrase></refentrytitle>
35789 <manvolnum>9</manvolnum>
35790 <refmiscinfo class="version">4.4.14</refmiscinfo>
35791</refmeta>
35792<refnamediv>
35793 <refname>fusion_init</refname>
35794 <refpurpose>
35795     Fusion MPT base driver initialization routine.
35796 </refpurpose>
35797</refnamediv>
35798<refsynopsisdiv>
35799 <title>Synopsis</title>
35800  <funcsynopsis><funcprototype>
35801   <funcdef>int <function>fusion_init </function></funcdef>
35802   <paramdef> <parameter>void</parameter></paramdef>
35803  </funcprototype></funcsynopsis>
35804</refsynopsisdiv>
35805<refsect1>
35806 <title>Arguments</title>
35807 <variablelist>
35808  <varlistentry>
35809   <term><parameter>void</parameter></term>
35810   <listitem>
35811    <para>
35812     no arguments
35813    </para>
35814   </listitem>
35815  </varlistentry>
35816 </variablelist>
35817</refsect1>
35818<refsect1>
35819<title>Description</title>
35820<para>
35821   </para><para>
35822
35823   Returns 0 for success, non-zero for failure.
35824</para>
35825</refsect1>
35826</refentry>
35827
35828<refentry id="API-fusion-exit">
35829<refentryinfo>
35830 <title>LINUX</title>
35831 <productname>Kernel Hackers Manual</productname>
35832 <date>July 2017</date>
35833</refentryinfo>
35834<refmeta>
35835 <refentrytitle><phrase>fusion_exit</phrase></refentrytitle>
35836 <manvolnum>9</manvolnum>
35837 <refmiscinfo class="version">4.4.14</refmiscinfo>
35838</refmeta>
35839<refnamediv>
35840 <refname>fusion_exit</refname>
35841 <refpurpose>
35842     Perform driver unload cleanup.
35843 </refpurpose>
35844</refnamediv>
35845<refsynopsisdiv>
35846 <title>Synopsis</title>
35847  <funcsynopsis><funcprototype>
35848   <funcdef>void __exit <function>fusion_exit </function></funcdef>
35849   <paramdef> <parameter>void</parameter></paramdef>
35850  </funcprototype></funcsynopsis>
35851</refsynopsisdiv>
35852<refsect1>
35853 <title>Arguments</title>
35854 <variablelist>
35855  <varlistentry>
35856   <term><parameter>void</parameter></term>
35857   <listitem>
35858    <para>
35859     no arguments
35860    </para>
35861   </listitem>
35862  </varlistentry>
35863 </variablelist>
35864</refsect1>
35865<refsect1>
35866<title>Description</title>
35867<para>
35868   </para><para>
35869
35870   This routine frees all resources associated with each MPT adapter
35871   and removes all <constant>MPT_PROCFS_MPTBASEDIR</constant> entries.
35872</para>
35873</refsect1>
35874</refentry>
35875
35876<!-- drivers/message/fusion/mptscsih.c -->
35877<refentry id="API-mptscsih-info">
35878<refentryinfo>
35879 <title>LINUX</title>
35880 <productname>Kernel Hackers Manual</productname>
35881 <date>July 2017</date>
35882</refentryinfo>
35883<refmeta>
35884 <refentrytitle><phrase>mptscsih_info</phrase></refentrytitle>
35885 <manvolnum>9</manvolnum>
35886 <refmiscinfo class="version">4.4.14</refmiscinfo>
35887</refmeta>
35888<refnamediv>
35889 <refname>mptscsih_info</refname>
35890 <refpurpose>
35891  Return information about MPT adapter
35892 </refpurpose>
35893</refnamediv>
35894<refsynopsisdiv>
35895 <title>Synopsis</title>
35896  <funcsynopsis><funcprototype>
35897   <funcdef>const char * <function>mptscsih_info </function></funcdef>
35898   <paramdef>struct Scsi_Host * <parameter>SChost</parameter></paramdef>
35899  </funcprototype></funcsynopsis>
35900</refsynopsisdiv>
35901<refsect1>
35902 <title>Arguments</title>
35903 <variablelist>
35904  <varlistentry>
35905   <term><parameter>SChost</parameter></term>
35906   <listitem>
35907    <para>
35908     Pointer to Scsi_Host structure
35909    </para>
35910   </listitem>
35911  </varlistentry>
35912 </variablelist>
35913</refsect1>
35914<refsect1>
35915<title>Description</title>
35916<para>
35917   (linux scsi_host_template.info routine)
35918   </para><para>
35919
35920   Returns pointer to buffer where information was written.
35921</para>
35922</refsect1>
35923</refentry>
35924
35925<refentry id="API-mptscsih-qcmd">
35926<refentryinfo>
35927 <title>LINUX</title>
35928 <productname>Kernel Hackers Manual</productname>
35929 <date>July 2017</date>
35930</refentryinfo>
35931<refmeta>
35932 <refentrytitle><phrase>mptscsih_qcmd</phrase></refentrytitle>
35933 <manvolnum>9</manvolnum>
35934 <refmiscinfo class="version">4.4.14</refmiscinfo>
35935</refmeta>
35936<refnamediv>
35937 <refname>mptscsih_qcmd</refname>
35938 <refpurpose>
35939     Primary Fusion MPT SCSI initiator IO start routine.
35940 </refpurpose>
35941</refnamediv>
35942<refsynopsisdiv>
35943 <title>Synopsis</title>
35944  <funcsynopsis><funcprototype>
35945   <funcdef>int <function>mptscsih_qcmd </function></funcdef>
35946   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
35947  </funcprototype></funcsynopsis>
35948</refsynopsisdiv>
35949<refsect1>
35950 <title>Arguments</title>
35951 <variablelist>
35952  <varlistentry>
35953   <term><parameter>SCpnt</parameter></term>
35954   <listitem>
35955    <para>
35956     Pointer to scsi_cmnd structure
35957    </para>
35958   </listitem>
35959  </varlistentry>
35960 </variablelist>
35961</refsect1>
35962<refsect1>
35963<title>Description</title>
35964<para>
35965   (linux scsi_host_template.queuecommand routine)
35966   This is the primary SCSI IO start routine.  Create a MPI SCSIIORequest
35967   from a linux scsi_cmnd request and send it to the IOC.
35968   </para><para>
35969
35970   Returns 0. (rtn value discarded by linux scsi mid-layer)
35971</para>
35972</refsect1>
35973</refentry>
35974
35975<refentry id="API-mptscsih-IssueTaskMgmt">
35976<refentryinfo>
35977 <title>LINUX</title>
35978 <productname>Kernel Hackers Manual</productname>
35979 <date>July 2017</date>
35980</refentryinfo>
35981<refmeta>
35982 <refentrytitle><phrase>mptscsih_IssueTaskMgmt</phrase></refentrytitle>
35983 <manvolnum>9</manvolnum>
35984 <refmiscinfo class="version">4.4.14</refmiscinfo>
35985</refmeta>
35986<refnamediv>
35987 <refname>mptscsih_IssueTaskMgmt</refname>
35988 <refpurpose>
35989     Generic send Task Management function.
35990 </refpurpose>
35991</refnamediv>
35992<refsynopsisdiv>
35993 <title>Synopsis</title>
35994  <funcsynopsis><funcprototype>
35995   <funcdef>int <function>mptscsih_IssueTaskMgmt </function></funcdef>
35996   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
35997   <paramdef>u8 <parameter>type</parameter></paramdef>
35998   <paramdef>u8 <parameter>channel</parameter></paramdef>
35999   <paramdef>u8 <parameter>id</parameter></paramdef>
36000   <paramdef>u64 <parameter>lun</parameter></paramdef>
36001   <paramdef>int <parameter>ctx2abort</parameter></paramdef>
36002   <paramdef>ulong <parameter>timeout</parameter></paramdef>
36003  </funcprototype></funcsynopsis>
36004</refsynopsisdiv>
36005<refsect1>
36006 <title>Arguments</title>
36007 <variablelist>
36008  <varlistentry>
36009   <term><parameter>hd</parameter></term>
36010   <listitem>
36011    <para>
36012     Pointer to MPT_SCSI_HOST structure
36013    </para>
36014   </listitem>
36015  </varlistentry>
36016  <varlistentry>
36017   <term><parameter>type</parameter></term>
36018   <listitem>
36019    <para>
36020     Task Management type
36021    </para>
36022   </listitem>
36023  </varlistentry>
36024  <varlistentry>
36025   <term><parameter>channel</parameter></term>
36026   <listitem>
36027    <para>
36028     channel number for task management
36029    </para>
36030   </listitem>
36031  </varlistentry>
36032  <varlistentry>
36033   <term><parameter>id</parameter></term>
36034   <listitem>
36035    <para>
36036     Logical Target ID for reset (if appropriate)
36037    </para>
36038   </listitem>
36039  </varlistentry>
36040  <varlistentry>
36041   <term><parameter>lun</parameter></term>
36042   <listitem>
36043    <para>
36044     Logical Unit for reset (if appropriate)
36045    </para>
36046   </listitem>
36047  </varlistentry>
36048  <varlistentry>
36049   <term><parameter>ctx2abort</parameter></term>
36050   <listitem>
36051    <para>
36052     Context for the task to be aborted (if appropriate)
36053    </para>
36054   </listitem>
36055  </varlistentry>
36056  <varlistentry>
36057   <term><parameter>timeout</parameter></term>
36058   <listitem>
36059    <para>
36060     timeout for task management control
36061    </para>
36062   </listitem>
36063  </varlistentry>
36064 </variablelist>
36065</refsect1>
36066<refsect1>
36067<title>Remark</title>
36068<para>
36069   _HardResetHandler can be invoked from an interrupt thread (timer)
36070   or a non-interrupt thread.  In the former, must not call <function>schedule</function>.
36071   </para><para>
36072
36073   Not all fields are meaningfull for all task types.
36074   </para><para>
36075
36076   Returns 0 for SUCCESS, or FAILED.
36077</para>
36078</refsect1>
36079</refentry>
36080
36081<refentry id="API-mptscsih-abort">
36082<refentryinfo>
36083 <title>LINUX</title>
36084 <productname>Kernel Hackers Manual</productname>
36085 <date>July 2017</date>
36086</refentryinfo>
36087<refmeta>
36088 <refentrytitle><phrase>mptscsih_abort</phrase></refentrytitle>
36089 <manvolnum>9</manvolnum>
36090 <refmiscinfo class="version">4.4.14</refmiscinfo>
36091</refmeta>
36092<refnamediv>
36093 <refname>mptscsih_abort</refname>
36094 <refpurpose>
36095     Abort linux scsi_cmnd routine, new_eh variant
36096 </refpurpose>
36097</refnamediv>
36098<refsynopsisdiv>
36099 <title>Synopsis</title>
36100  <funcsynopsis><funcprototype>
36101   <funcdef>int <function>mptscsih_abort </function></funcdef>
36102   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
36103  </funcprototype></funcsynopsis>
36104</refsynopsisdiv>
36105<refsect1>
36106 <title>Arguments</title>
36107 <variablelist>
36108  <varlistentry>
36109   <term><parameter>SCpnt</parameter></term>
36110   <listitem>
36111    <para>
36112     Pointer to scsi_cmnd structure, IO to be aborted
36113    </para>
36114   </listitem>
36115  </varlistentry>
36116 </variablelist>
36117</refsect1>
36118<refsect1>
36119<title>Description</title>
36120<para>
36121   (linux scsi_host_template.eh_abort_handler routine)
36122   </para><para>
36123
36124   Returns SUCCESS or FAILED.
36125</para>
36126</refsect1>
36127</refentry>
36128
36129<refentry id="API-mptscsih-dev-reset">
36130<refentryinfo>
36131 <title>LINUX</title>
36132 <productname>Kernel Hackers Manual</productname>
36133 <date>July 2017</date>
36134</refentryinfo>
36135<refmeta>
36136 <refentrytitle><phrase>mptscsih_dev_reset</phrase></refentrytitle>
36137 <manvolnum>9</manvolnum>
36138 <refmiscinfo class="version">4.4.14</refmiscinfo>
36139</refmeta>
36140<refnamediv>
36141 <refname>mptscsih_dev_reset</refname>
36142 <refpurpose>
36143     Perform a SCSI TARGET_RESET! new_eh variant
36144 </refpurpose>
36145</refnamediv>
36146<refsynopsisdiv>
36147 <title>Synopsis</title>
36148  <funcsynopsis><funcprototype>
36149   <funcdef>int <function>mptscsih_dev_reset </function></funcdef>
36150   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
36151  </funcprototype></funcsynopsis>
36152</refsynopsisdiv>
36153<refsect1>
36154 <title>Arguments</title>
36155 <variablelist>
36156  <varlistentry>
36157   <term><parameter>SCpnt</parameter></term>
36158   <listitem>
36159    <para>
36160     Pointer to scsi_cmnd structure, IO which reset is due to
36161    </para>
36162   </listitem>
36163  </varlistentry>
36164 </variablelist>
36165</refsect1>
36166<refsect1>
36167<title>Description</title>
36168<para>
36169   (linux scsi_host_template.eh_dev_reset_handler routine)
36170   </para><para>
36171
36172   Returns SUCCESS or FAILED.
36173</para>
36174</refsect1>
36175</refentry>
36176
36177<refentry id="API-mptscsih-bus-reset">
36178<refentryinfo>
36179 <title>LINUX</title>
36180 <productname>Kernel Hackers Manual</productname>
36181 <date>July 2017</date>
36182</refentryinfo>
36183<refmeta>
36184 <refentrytitle><phrase>mptscsih_bus_reset</phrase></refentrytitle>
36185 <manvolnum>9</manvolnum>
36186 <refmiscinfo class="version">4.4.14</refmiscinfo>
36187</refmeta>
36188<refnamediv>
36189 <refname>mptscsih_bus_reset</refname>
36190 <refpurpose>
36191     Perform a SCSI BUS_RESET! new_eh variant
36192 </refpurpose>
36193</refnamediv>
36194<refsynopsisdiv>
36195 <title>Synopsis</title>
36196  <funcsynopsis><funcprototype>
36197   <funcdef>int <function>mptscsih_bus_reset </function></funcdef>
36198   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
36199  </funcprototype></funcsynopsis>
36200</refsynopsisdiv>
36201<refsect1>
36202 <title>Arguments</title>
36203 <variablelist>
36204  <varlistentry>
36205   <term><parameter>SCpnt</parameter></term>
36206   <listitem>
36207    <para>
36208     Pointer to scsi_cmnd structure, IO which reset is due to
36209    </para>
36210   </listitem>
36211  </varlistentry>
36212 </variablelist>
36213</refsect1>
36214<refsect1>
36215<title>Description</title>
36216<para>
36217   (linux scsi_host_template.eh_bus_reset_handler routine)
36218   </para><para>
36219
36220   Returns SUCCESS or FAILED.
36221</para>
36222</refsect1>
36223</refentry>
36224
36225<refentry id="API-mptscsih-host-reset">
36226<refentryinfo>
36227 <title>LINUX</title>
36228 <productname>Kernel Hackers Manual</productname>
36229 <date>July 2017</date>
36230</refentryinfo>
36231<refmeta>
36232 <refentrytitle><phrase>mptscsih_host_reset</phrase></refentrytitle>
36233 <manvolnum>9</manvolnum>
36234 <refmiscinfo class="version">4.4.14</refmiscinfo>
36235</refmeta>
36236<refnamediv>
36237 <refname>mptscsih_host_reset</refname>
36238 <refpurpose>
36239     Perform a SCSI host adapter RESET (new_eh variant)
36240 </refpurpose>
36241</refnamediv>
36242<refsynopsisdiv>
36243 <title>Synopsis</title>
36244  <funcsynopsis><funcprototype>
36245   <funcdef>int <function>mptscsih_host_reset </function></funcdef>
36246   <paramdef>struct scsi_cmnd * <parameter>SCpnt</parameter></paramdef>
36247  </funcprototype></funcsynopsis>
36248</refsynopsisdiv>
36249<refsect1>
36250 <title>Arguments</title>
36251 <variablelist>
36252  <varlistentry>
36253   <term><parameter>SCpnt</parameter></term>
36254   <listitem>
36255    <para>
36256     Pointer to scsi_cmnd structure, IO which reset is due to
36257    </para>
36258   </listitem>
36259  </varlistentry>
36260 </variablelist>
36261</refsect1>
36262<refsect1>
36263<title>Description</title>
36264<para>
36265   (linux scsi_host_template.eh_host_reset_handler routine)
36266   </para><para>
36267
36268   Returns SUCCESS or FAILED.
36269</para>
36270</refsect1>
36271</refentry>
36272
36273<refentry id="API-mptscsih-taskmgmt-complete">
36274<refentryinfo>
36275 <title>LINUX</title>
36276 <productname>Kernel Hackers Manual</productname>
36277 <date>July 2017</date>
36278</refentryinfo>
36279<refmeta>
36280 <refentrytitle><phrase>mptscsih_taskmgmt_complete</phrase></refentrytitle>
36281 <manvolnum>9</manvolnum>
36282 <refmiscinfo class="version">4.4.14</refmiscinfo>
36283</refmeta>
36284<refnamediv>
36285 <refname>mptscsih_taskmgmt_complete</refname>
36286 <refpurpose>
36287     Registered with Fusion MPT base driver
36288 </refpurpose>
36289</refnamediv>
36290<refsynopsisdiv>
36291 <title>Synopsis</title>
36292  <funcsynopsis><funcprototype>
36293   <funcdef>int <function>mptscsih_taskmgmt_complete </function></funcdef>
36294   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36295   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
36296   <paramdef>MPT_FRAME_HDR * <parameter>mr</parameter></paramdef>
36297  </funcprototype></funcsynopsis>
36298</refsynopsisdiv>
36299<refsect1>
36300 <title>Arguments</title>
36301 <variablelist>
36302  <varlistentry>
36303   <term><parameter>ioc</parameter></term>
36304   <listitem>
36305    <para>
36306     Pointer to MPT_ADAPTER structure
36307    </para>
36308   </listitem>
36309  </varlistentry>
36310  <varlistentry>
36311   <term><parameter>mf</parameter></term>
36312   <listitem>
36313    <para>
36314     Pointer to SCSI task mgmt request frame
36315    </para>
36316   </listitem>
36317  </varlistentry>
36318  <varlistentry>
36319   <term><parameter>mr</parameter></term>
36320   <listitem>
36321    <para>
36322     Pointer to SCSI task mgmt reply frame
36323    </para>
36324   </listitem>
36325  </varlistentry>
36326 </variablelist>
36327</refsect1>
36328<refsect1>
36329<title>Description</title>
36330<para>
36331   This routine is called from mptbase.c::<function><link linkend="API-mpt-interrupt">mpt_interrupt</link></function> at the completion
36332   of any SCSI task management request.
36333   This routine is registered with the MPT (base) driver at driver
36334   load/init time via the <function><link linkend="API-mpt-register">mpt_register</link></function> API call.
36335   </para><para>
36336
36337   Returns 1 indicating alloc'd request frame ptr should be freed.
36338</para>
36339</refsect1>
36340</refentry>
36341
36342<refentry id="API-mptscsih-get-scsi-lookup">
36343<refentryinfo>
36344 <title>LINUX</title>
36345 <productname>Kernel Hackers Manual</productname>
36346 <date>July 2017</date>
36347</refentryinfo>
36348<refmeta>
36349 <refentrytitle><phrase>mptscsih_get_scsi_lookup</phrase></refentrytitle>
36350 <manvolnum>9</manvolnum>
36351 <refmiscinfo class="version">4.4.14</refmiscinfo>
36352</refmeta>
36353<refnamediv>
36354 <refname>mptscsih_get_scsi_lookup</refname>
36355 <refpurpose>
36356     retrieves scmd entry
36357 </refpurpose>
36358</refnamediv>
36359<refsynopsisdiv>
36360 <title>Synopsis</title>
36361  <funcsynopsis><funcprototype>
36362   <funcdef>struct scsi_cmnd * <function>mptscsih_get_scsi_lookup </function></funcdef>
36363   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36364   <paramdef>int <parameter>i</parameter></paramdef>
36365  </funcprototype></funcsynopsis>
36366</refsynopsisdiv>
36367<refsect1>
36368 <title>Arguments</title>
36369 <variablelist>
36370  <varlistentry>
36371   <term><parameter>ioc</parameter></term>
36372   <listitem>
36373    <para>
36374     Pointer to MPT_ADAPTER structure
36375    </para>
36376   </listitem>
36377  </varlistentry>
36378  <varlistentry>
36379   <term><parameter>i</parameter></term>
36380   <listitem>
36381    <para>
36382     index into the array
36383    </para>
36384   </listitem>
36385  </varlistentry>
36386 </variablelist>
36387</refsect1>
36388<refsect1>
36389<title>Description</title>
36390<para>
36391   Returns the scsi_cmd pointer
36392</para>
36393</refsect1>
36394</refentry>
36395
36396<!-- drivers/message/fusion/mptscsih.c -->
36397<refentry id="API-mptscsih-info-scsiio">
36398<refentryinfo>
36399 <title>LINUX</title>
36400 <productname>Kernel Hackers Manual</productname>
36401 <date>July 2017</date>
36402</refentryinfo>
36403<refmeta>
36404 <refentrytitle><phrase>mptscsih_info_scsiio</phrase></refentrytitle>
36405 <manvolnum>9</manvolnum>
36406 <refmiscinfo class="version">4.4.14</refmiscinfo>
36407</refmeta>
36408<refnamediv>
36409 <refname>mptscsih_info_scsiio</refname>
36410 <refpurpose>
36411  debug print info on reply frame
36412 </refpurpose>
36413</refnamediv>
36414<refsynopsisdiv>
36415 <title>Synopsis</title>
36416  <funcsynopsis><funcprototype>
36417   <funcdef>void <function>mptscsih_info_scsiio </function></funcdef>
36418   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36419   <paramdef>struct scsi_cmnd * <parameter>sc</parameter></paramdef>
36420   <paramdef>SCSIIOReply_t * <parameter>pScsiReply</parameter></paramdef>
36421  </funcprototype></funcsynopsis>
36422</refsynopsisdiv>
36423<refsect1>
36424 <title>Arguments</title>
36425 <variablelist>
36426  <varlistentry>
36427   <term><parameter>ioc</parameter></term>
36428   <listitem>
36429    <para>
36430     Pointer to MPT_ADAPTER structure
36431    </para>
36432   </listitem>
36433  </varlistentry>
36434  <varlistentry>
36435   <term><parameter>sc</parameter></term>
36436   <listitem>
36437    <para>
36438     original scsi cmnd pointer
36439    </para>
36440   </listitem>
36441  </varlistentry>
36442  <varlistentry>
36443   <term><parameter>pScsiReply</parameter></term>
36444   <listitem>
36445    <para>
36446     Pointer to MPT reply frame
36447    </para>
36448   </listitem>
36449  </varlistentry>
36450 </variablelist>
36451</refsect1>
36452<refsect1>
36453<title>Description</title>
36454<para>
36455   MPT_DEBUG_REPLY needs to be enabled to obtain this info
36456   </para><para>
36457
36458   Refer to lsi/mpi.h.
36459</para>
36460</refsect1>
36461</refentry>
36462
36463<refentry id="API-mptscsih-getclear-scsi-lookup">
36464<refentryinfo>
36465 <title>LINUX</title>
36466 <productname>Kernel Hackers Manual</productname>
36467 <date>July 2017</date>
36468</refentryinfo>
36469<refmeta>
36470 <refentrytitle><phrase>mptscsih_getclear_scsi_lookup</phrase></refentrytitle>
36471 <manvolnum>9</manvolnum>
36472 <refmiscinfo class="version">4.4.14</refmiscinfo>
36473</refmeta>
36474<refnamediv>
36475 <refname>mptscsih_getclear_scsi_lookup</refname>
36476 <refpurpose>
36477     retrieves and clears scmd entry from ScsiLookup[] array list
36478 </refpurpose>
36479</refnamediv>
36480<refsynopsisdiv>
36481 <title>Synopsis</title>
36482  <funcsynopsis><funcprototype>
36483   <funcdef>struct scsi_cmnd * <function>mptscsih_getclear_scsi_lookup </function></funcdef>
36484   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36485   <paramdef>int <parameter>i</parameter></paramdef>
36486  </funcprototype></funcsynopsis>
36487</refsynopsisdiv>
36488<refsect1>
36489 <title>Arguments</title>
36490 <variablelist>
36491  <varlistentry>
36492   <term><parameter>ioc</parameter></term>
36493   <listitem>
36494    <para>
36495     Pointer to MPT_ADAPTER structure
36496    </para>
36497   </listitem>
36498  </varlistentry>
36499  <varlistentry>
36500   <term><parameter>i</parameter></term>
36501   <listitem>
36502    <para>
36503     index into the array
36504    </para>
36505   </listitem>
36506  </varlistentry>
36507 </variablelist>
36508</refsect1>
36509<refsect1>
36510<title>Description</title>
36511<para>
36512   Returns the scsi_cmd pointer
36513</para>
36514</refsect1>
36515</refentry>
36516
36517<refentry id="API-mptscsih-set-scsi-lookup">
36518<refentryinfo>
36519 <title>LINUX</title>
36520 <productname>Kernel Hackers Manual</productname>
36521 <date>July 2017</date>
36522</refentryinfo>
36523<refmeta>
36524 <refentrytitle><phrase>mptscsih_set_scsi_lookup</phrase></refentrytitle>
36525 <manvolnum>9</manvolnum>
36526 <refmiscinfo class="version">4.4.14</refmiscinfo>
36527</refmeta>
36528<refnamediv>
36529 <refname>mptscsih_set_scsi_lookup</refname>
36530 <refpurpose>
36531     write a scmd entry into the ScsiLookup[] array list
36532 </refpurpose>
36533</refnamediv>
36534<refsynopsisdiv>
36535 <title>Synopsis</title>
36536  <funcsynopsis><funcprototype>
36537   <funcdef>void <function>mptscsih_set_scsi_lookup </function></funcdef>
36538   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36539   <paramdef>int <parameter>i</parameter></paramdef>
36540   <paramdef>struct scsi_cmnd * <parameter>scmd</parameter></paramdef>
36541  </funcprototype></funcsynopsis>
36542</refsynopsisdiv>
36543<refsect1>
36544 <title>Arguments</title>
36545 <variablelist>
36546  <varlistentry>
36547   <term><parameter>ioc</parameter></term>
36548   <listitem>
36549    <para>
36550     Pointer to MPT_ADAPTER structure
36551    </para>
36552   </listitem>
36553  </varlistentry>
36554  <varlistentry>
36555   <term><parameter>i</parameter></term>
36556   <listitem>
36557    <para>
36558     index into the array
36559    </para>
36560   </listitem>
36561  </varlistentry>
36562  <varlistentry>
36563   <term><parameter>scmd</parameter></term>
36564   <listitem>
36565    <para>
36566     scsi_cmnd pointer
36567    </para>
36568   </listitem>
36569  </varlistentry>
36570 </variablelist>
36571</refsect1>
36572</refentry>
36573
36574<refentry id="API-SCPNT-TO-LOOKUP-IDX">
36575<refentryinfo>
36576 <title>LINUX</title>
36577 <productname>Kernel Hackers Manual</productname>
36578 <date>July 2017</date>
36579</refentryinfo>
36580<refmeta>
36581 <refentrytitle><phrase>SCPNT_TO_LOOKUP_IDX</phrase></refentrytitle>
36582 <manvolnum>9</manvolnum>
36583 <refmiscinfo class="version">4.4.14</refmiscinfo>
36584</refmeta>
36585<refnamediv>
36586 <refname>SCPNT_TO_LOOKUP_IDX</refname>
36587 <refpurpose>
36588     searches for a given scmd in the ScsiLookup[] array list
36589 </refpurpose>
36590</refnamediv>
36591<refsynopsisdiv>
36592 <title>Synopsis</title>
36593  <funcsynopsis><funcprototype>
36594   <funcdef>int <function>SCPNT_TO_LOOKUP_IDX </function></funcdef>
36595   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36596   <paramdef>struct scsi_cmnd * <parameter>sc</parameter></paramdef>
36597  </funcprototype></funcsynopsis>
36598</refsynopsisdiv>
36599<refsect1>
36600 <title>Arguments</title>
36601 <variablelist>
36602  <varlistentry>
36603   <term><parameter>ioc</parameter></term>
36604   <listitem>
36605    <para>
36606     Pointer to MPT_ADAPTER structure
36607    </para>
36608   </listitem>
36609  </varlistentry>
36610  <varlistentry>
36611   <term><parameter>sc</parameter></term>
36612   <listitem>
36613    <para>
36614     scsi_cmnd pointer
36615    </para>
36616   </listitem>
36617  </varlistentry>
36618 </variablelist>
36619</refsect1>
36620</refentry>
36621
36622<refentry id="API-mptscsih-get-completion-code">
36623<refentryinfo>
36624 <title>LINUX</title>
36625 <productname>Kernel Hackers Manual</productname>
36626 <date>July 2017</date>
36627</refentryinfo>
36628<refmeta>
36629 <refentrytitle><phrase>mptscsih_get_completion_code</phrase></refentrytitle>
36630 <manvolnum>9</manvolnum>
36631 <refmiscinfo class="version">4.4.14</refmiscinfo>
36632</refmeta>
36633<refnamediv>
36634 <refname>mptscsih_get_completion_code</refname>
36635 <refpurpose>
36636     get completion code from MPT request
36637 </refpurpose>
36638</refnamediv>
36639<refsynopsisdiv>
36640 <title>Synopsis</title>
36641  <funcsynopsis><funcprototype>
36642   <funcdef>int <function>mptscsih_get_completion_code </function></funcdef>
36643   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36644   <paramdef>MPT_FRAME_HDR * <parameter>req</parameter></paramdef>
36645   <paramdef>MPT_FRAME_HDR * <parameter>reply</parameter></paramdef>
36646  </funcprototype></funcsynopsis>
36647</refsynopsisdiv>
36648<refsect1>
36649 <title>Arguments</title>
36650 <variablelist>
36651  <varlistentry>
36652   <term><parameter>ioc</parameter></term>
36653   <listitem>
36654    <para>
36655     Pointer to MPT_ADAPTER structure
36656    </para>
36657   </listitem>
36658  </varlistentry>
36659  <varlistentry>
36660   <term><parameter>req</parameter></term>
36661   <listitem>
36662    <para>
36663     Pointer to original MPT request frame
36664    </para>
36665   </listitem>
36666  </varlistentry>
36667  <varlistentry>
36668   <term><parameter>reply</parameter></term>
36669   <listitem>
36670    <para>
36671     Pointer to MPT reply frame (NULL if TurboReply)
36672    </para>
36673   </listitem>
36674  </varlistentry>
36675 </variablelist>
36676</refsect1>
36677</refentry>
36678
36679<refentry id="API-mptscsih-do-cmd">
36680<refentryinfo>
36681 <title>LINUX</title>
36682 <productname>Kernel Hackers Manual</productname>
36683 <date>July 2017</date>
36684</refentryinfo>
36685<refmeta>
36686 <refentrytitle><phrase>mptscsih_do_cmd</phrase></refentrytitle>
36687 <manvolnum>9</manvolnum>
36688 <refmiscinfo class="version">4.4.14</refmiscinfo>
36689</refmeta>
36690<refnamediv>
36691 <refname>mptscsih_do_cmd</refname>
36692 <refpurpose>
36693     Do internal command.
36694 </refpurpose>
36695</refnamediv>
36696<refsynopsisdiv>
36697 <title>Synopsis</title>
36698  <funcsynopsis><funcprototype>
36699   <funcdef>int <function>mptscsih_do_cmd </function></funcdef>
36700   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
36701   <paramdef>INTERNAL_CMD * <parameter>io</parameter></paramdef>
36702  </funcprototype></funcsynopsis>
36703</refsynopsisdiv>
36704<refsect1>
36705 <title>Arguments</title>
36706 <variablelist>
36707  <varlistentry>
36708   <term><parameter>hd</parameter></term>
36709   <listitem>
36710    <para>
36711     MPT_SCSI_HOST pointer
36712    </para>
36713   </listitem>
36714  </varlistentry>
36715  <varlistentry>
36716   <term><parameter>io</parameter></term>
36717   <listitem>
36718    <para>
36719     INTERNAL_CMD pointer.
36720    </para>
36721   </listitem>
36722  </varlistentry>
36723 </variablelist>
36724</refsect1>
36725<refsect1>
36726<title>Description</title>
36727<para>
36728   Issue the specified internally generated command and do command
36729   specific cleanup. For bus scan / DV only.
36730</para>
36731</refsect1>
36732<refsect1>
36733<title>NOTES</title>
36734<para>
36735   If command is Inquiry and status is good,
36736   initialize a target structure, save the data
36737</para>
36738</refsect1>
36739<refsect1>
36740<title>Remark</title>
36741<para>
36742   Single threaded access only.
36743</para>
36744</refsect1>
36745<refsect1>
36746<title>Return</title>
36747<para>
36748   &lt; 0 if an illegal command or no resources
36749   </para><para>
36750
36751   0 if good
36752   </para><para>
36753
36754   &gt; 0 if command complete but some type of completion error.
36755</para>
36756</refsect1>
36757</refentry>
36758
36759<refentry id="API-mptscsih-synchronize-cache">
36760<refentryinfo>
36761 <title>LINUX</title>
36762 <productname>Kernel Hackers Manual</productname>
36763 <date>July 2017</date>
36764</refentryinfo>
36765<refmeta>
36766 <refentrytitle><phrase>mptscsih_synchronize_cache</phrase></refentrytitle>
36767 <manvolnum>9</manvolnum>
36768 <refmiscinfo class="version">4.4.14</refmiscinfo>
36769</refmeta>
36770<refnamediv>
36771 <refname>mptscsih_synchronize_cache</refname>
36772 <refpurpose>
36773     Send SYNCHRONIZE_CACHE to all disks.
36774 </refpurpose>
36775</refnamediv>
36776<refsynopsisdiv>
36777 <title>Synopsis</title>
36778  <funcsynopsis><funcprototype>
36779   <funcdef>void <function>mptscsih_synchronize_cache </function></funcdef>
36780   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
36781   <paramdef>VirtDevice * <parameter>vdevice</parameter></paramdef>
36782  </funcprototype></funcsynopsis>
36783</refsynopsisdiv>
36784<refsect1>
36785 <title>Arguments</title>
36786 <variablelist>
36787  <varlistentry>
36788   <term><parameter>hd</parameter></term>
36789   <listitem>
36790    <para>
36791     Pointer to a SCSI HOST structure
36792    </para>
36793   </listitem>
36794  </varlistentry>
36795  <varlistentry>
36796   <term><parameter>vdevice</parameter></term>
36797   <listitem>
36798    <para>
36799     virtual target device
36800    </para>
36801   </listitem>
36802  </varlistentry>
36803 </variablelist>
36804</refsect1>
36805<refsect1>
36806<title>Description</title>
36807<para>
36808   Uses the ISR, but with special processing.
36809   MUST be single-threaded.
36810</para>
36811</refsect1>
36812</refentry>
36813
36814<!-- drivers/message/fusion/mptctl.c -->
36815<refentry id="API-mptctl-syscall-down">
36816<refentryinfo>
36817 <title>LINUX</title>
36818 <productname>Kernel Hackers Manual</productname>
36819 <date>July 2017</date>
36820</refentryinfo>
36821<refmeta>
36822 <refentrytitle><phrase>mptctl_syscall_down</phrase></refentrytitle>
36823 <manvolnum>9</manvolnum>
36824 <refmiscinfo class="version">4.4.14</refmiscinfo>
36825</refmeta>
36826<refnamediv>
36827 <refname>mptctl_syscall_down</refname>
36828 <refpurpose>
36829  Down the MPT adapter syscall semaphore.
36830 </refpurpose>
36831</refnamediv>
36832<refsynopsisdiv>
36833 <title>Synopsis</title>
36834  <funcsynopsis><funcprototype>
36835   <funcdef>int <function>mptctl_syscall_down </function></funcdef>
36836   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
36837   <paramdef>int <parameter>nonblock</parameter></paramdef>
36838  </funcprototype></funcsynopsis>
36839</refsynopsisdiv>
36840<refsect1>
36841 <title>Arguments</title>
36842 <variablelist>
36843  <varlistentry>
36844   <term><parameter>ioc</parameter></term>
36845   <listitem>
36846    <para>
36847     Pointer to MPT adapter
36848    </para>
36849   </listitem>
36850  </varlistentry>
36851  <varlistentry>
36852   <term><parameter>nonblock</parameter></term>
36853   <listitem>
36854    <para>
36855     boolean, non-zero if O_NONBLOCK is set
36856    </para>
36857   </listitem>
36858  </varlistentry>
36859 </variablelist>
36860</refsect1>
36861<refsect1>
36862<title>Description</title>
36863<para>
36864   All of the ioctl commands can potentially sleep, which is illegal
36865   with a spinlock held, thus we perform mutual exclusion here.
36866   </para><para>
36867
36868   Returns negative errno on error, or zero for success.
36869</para>
36870</refsect1>
36871</refentry>
36872
36873<!-- drivers/message/fusion/mptspi.c -->
36874<refentry id="API-mptspi-setTargetNegoParms">
36875<refentryinfo>
36876 <title>LINUX</title>
36877 <productname>Kernel Hackers Manual</productname>
36878 <date>July 2017</date>
36879</refentryinfo>
36880<refmeta>
36881 <refentrytitle><phrase>mptspi_setTargetNegoParms</phrase></refentrytitle>
36882 <manvolnum>9</manvolnum>
36883 <refmiscinfo class="version">4.4.14</refmiscinfo>
36884</refmeta>
36885<refnamediv>
36886 <refname>mptspi_setTargetNegoParms</refname>
36887 <refpurpose>
36888  Update the target negotiation parameters
36889 </refpurpose>
36890</refnamediv>
36891<refsynopsisdiv>
36892 <title>Synopsis</title>
36893  <funcsynopsis><funcprototype>
36894   <funcdef>void <function>mptspi_setTargetNegoParms </function></funcdef>
36895   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
36896   <paramdef>VirtTarget * <parameter>target</parameter></paramdef>
36897   <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef>
36898  </funcprototype></funcsynopsis>
36899</refsynopsisdiv>
36900<refsect1>
36901 <title>Arguments</title>
36902 <variablelist>
36903  <varlistentry>
36904   <term><parameter>hd</parameter></term>
36905   <listitem>
36906    <para>
36907     Pointer to a SCSI Host Structure
36908    </para>
36909   </listitem>
36910  </varlistentry>
36911  <varlistentry>
36912   <term><parameter>target</parameter></term>
36913   <listitem>
36914    <para>
36915     per target private data
36916    </para>
36917   </listitem>
36918  </varlistentry>
36919  <varlistentry>
36920   <term><parameter>sdev</parameter></term>
36921   <listitem>
36922    <para>
36923     SCSI device
36924    </para>
36925   </listitem>
36926  </varlistentry>
36927 </variablelist>
36928</refsect1>
36929<refsect1>
36930<title>Description</title>
36931<para>
36932   Update the target negotiation parameters based on the the Inquiry
36933   data, adapter capabilities, and NVRAM settings.
36934</para>
36935</refsect1>
36936</refentry>
36937
36938<refentry id="API-mptspi-writeIOCPage4">
36939<refentryinfo>
36940 <title>LINUX</title>
36941 <productname>Kernel Hackers Manual</productname>
36942 <date>July 2017</date>
36943</refentryinfo>
36944<refmeta>
36945 <refentrytitle><phrase>mptspi_writeIOCPage4</phrase></refentrytitle>
36946 <manvolnum>9</manvolnum>
36947 <refmiscinfo class="version">4.4.14</refmiscinfo>
36948</refmeta>
36949<refnamediv>
36950 <refname>mptspi_writeIOCPage4</refname>
36951 <refpurpose>
36952     write IOC Page 4
36953 </refpurpose>
36954</refnamediv>
36955<refsynopsisdiv>
36956 <title>Synopsis</title>
36957  <funcsynopsis><funcprototype>
36958   <funcdef>int <function>mptspi_writeIOCPage4 </function></funcdef>
36959   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
36960   <paramdef>u8 <parameter>channel</parameter></paramdef>
36961   <paramdef>u8 <parameter>id</parameter></paramdef>
36962  </funcprototype></funcsynopsis>
36963</refsynopsisdiv>
36964<refsect1>
36965 <title>Arguments</title>
36966 <variablelist>
36967  <varlistentry>
36968   <term><parameter>hd</parameter></term>
36969   <listitem>
36970    <para>
36971     Pointer to a SCSI Host Structure
36972    </para>
36973   </listitem>
36974  </varlistentry>
36975  <varlistentry>
36976   <term><parameter>channel</parameter></term>
36977   <listitem>
36978    <para>
36979     channel number
36980    </para>
36981   </listitem>
36982  </varlistentry>
36983  <varlistentry>
36984   <term><parameter>id</parameter></term>
36985   <listitem>
36986    <para>
36987     write IOC Page4 for this ID &amp; Bus
36988    </para>
36989   </listitem>
36990  </varlistentry>
36991 </variablelist>
36992</refsect1>
36993<refsect1>
36994<title>Return</title>
36995<para>
36996   -EAGAIN if unable to obtain a Message Frame
36997   or 0 if success.
36998</para>
36999</refsect1>
37000<refsect1>
37001<title>Remark</title>
37002<para>
37003   We do not wait for a return, write pages sequentially.
37004</para>
37005</refsect1>
37006</refentry>
37007
37008<refentry id="API-mptspi-initTarget">
37009<refentryinfo>
37010 <title>LINUX</title>
37011 <productname>Kernel Hackers Manual</productname>
37012 <date>July 2017</date>
37013</refentryinfo>
37014<refmeta>
37015 <refentrytitle><phrase>mptspi_initTarget</phrase></refentrytitle>
37016 <manvolnum>9</manvolnum>
37017 <refmiscinfo class="version">4.4.14</refmiscinfo>
37018</refmeta>
37019<refnamediv>
37020 <refname>mptspi_initTarget</refname>
37021 <refpurpose>
37022     Target, LUN alloc/free functionality.
37023 </refpurpose>
37024</refnamediv>
37025<refsynopsisdiv>
37026 <title>Synopsis</title>
37027  <funcsynopsis><funcprototype>
37028   <funcdef>void <function>mptspi_initTarget </function></funcdef>
37029   <paramdef>MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
37030   <paramdef>VirtTarget * <parameter>vtarget</parameter></paramdef>
37031   <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef>
37032  </funcprototype></funcsynopsis>
37033</refsynopsisdiv>
37034<refsect1>
37035 <title>Arguments</title>
37036 <variablelist>
37037  <varlistentry>
37038   <term><parameter>hd</parameter></term>
37039   <listitem>
37040    <para>
37041     Pointer to MPT_SCSI_HOST structure
37042    </para>
37043   </listitem>
37044  </varlistentry>
37045  <varlistentry>
37046   <term><parameter>vtarget</parameter></term>
37047   <listitem>
37048    <para>
37049     per target private data
37050    </para>
37051   </listitem>
37052  </varlistentry>
37053  <varlistentry>
37054   <term><parameter>sdev</parameter></term>
37055   <listitem>
37056    <para>
37057     SCSI device
37058    </para>
37059   </listitem>
37060  </varlistentry>
37061 </variablelist>
37062</refsect1>
37063<refsect1>
37064<title>NOTE</title>
37065<para>
37066   It's only SAFE to call this routine if data points to
37067   sane &amp; valid STANDARD INQUIRY data!
37068   </para><para>
37069
37070   Allocate and initialize memory for this target.
37071   Save inquiry data.
37072</para>
37073</refsect1>
37074</refentry>
37075
37076<refentry id="API-mptspi-is-raid">
37077<refentryinfo>
37078 <title>LINUX</title>
37079 <productname>Kernel Hackers Manual</productname>
37080 <date>July 2017</date>
37081</refentryinfo>
37082<refmeta>
37083 <refentrytitle><phrase>mptspi_is_raid</phrase></refentrytitle>
37084 <manvolnum>9</manvolnum>
37085 <refmiscinfo class="version">4.4.14</refmiscinfo>
37086</refmeta>
37087<refnamediv>
37088 <refname>mptspi_is_raid</refname>
37089 <refpurpose>
37090     Determines whether target is belonging to volume
37091 </refpurpose>
37092</refnamediv>
37093<refsynopsisdiv>
37094 <title>Synopsis</title>
37095  <funcsynopsis><funcprototype>
37096   <funcdef>int <function>mptspi_is_raid </function></funcdef>
37097   <paramdef>struct _MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
37098   <paramdef>u32 <parameter>id</parameter></paramdef>
37099  </funcprototype></funcsynopsis>
37100</refsynopsisdiv>
37101<refsect1>
37102 <title>Arguments</title>
37103 <variablelist>
37104  <varlistentry>
37105   <term><parameter>hd</parameter></term>
37106   <listitem>
37107    <para>
37108     Pointer to a SCSI HOST structure
37109    </para>
37110   </listitem>
37111  </varlistentry>
37112  <varlistentry>
37113   <term><parameter>id</parameter></term>
37114   <listitem>
37115    <para>
37116     target device id
37117    </para>
37118   </listitem>
37119  </varlistentry>
37120 </variablelist>
37121</refsect1>
37122<refsect1>
37123<title>Return</title>
37124<para>
37125   non-zero = true
37126   zero = false
37127</para>
37128</refsect1>
37129</refentry>
37130
37131<refentry id="API-mptspi-print-write-nego">
37132<refentryinfo>
37133 <title>LINUX</title>
37134 <productname>Kernel Hackers Manual</productname>
37135 <date>July 2017</date>
37136</refentryinfo>
37137<refmeta>
37138 <refentrytitle><phrase>mptspi_print_write_nego</phrase></refentrytitle>
37139 <manvolnum>9</manvolnum>
37140 <refmiscinfo class="version">4.4.14</refmiscinfo>
37141</refmeta>
37142<refnamediv>
37143 <refname>mptspi_print_write_nego</refname>
37144 <refpurpose>
37145     negotiation parameters debug info that is being sent
37146 </refpurpose>
37147</refnamediv>
37148<refsynopsisdiv>
37149 <title>Synopsis</title>
37150  <funcsynopsis><funcprototype>
37151   <funcdef>void <function>mptspi_print_write_nego </function></funcdef>
37152   <paramdef>struct _MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
37153   <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef>
37154   <paramdef>u32 <parameter>ii</parameter></paramdef>
37155  </funcprototype></funcsynopsis>
37156</refsynopsisdiv>
37157<refsect1>
37158 <title>Arguments</title>
37159 <variablelist>
37160  <varlistentry>
37161   <term><parameter>hd</parameter></term>
37162   <listitem>
37163    <para>
37164     Pointer to a SCSI HOST structure
37165    </para>
37166   </listitem>
37167  </varlistentry>
37168  <varlistentry>
37169   <term><parameter>starget</parameter></term>
37170   <listitem>
37171    <para>
37172     SCSI target
37173    </para>
37174   </listitem>
37175  </varlistentry>
37176  <varlistentry>
37177   <term><parameter>ii</parameter></term>
37178   <listitem>
37179    <para>
37180     negotiation parameters
37181    </para>
37182   </listitem>
37183  </varlistentry>
37184 </variablelist>
37185</refsect1>
37186</refentry>
37187
37188<refentry id="API-mptspi-print-read-nego">
37189<refentryinfo>
37190 <title>LINUX</title>
37191 <productname>Kernel Hackers Manual</productname>
37192 <date>July 2017</date>
37193</refentryinfo>
37194<refmeta>
37195 <refentrytitle><phrase>mptspi_print_read_nego</phrase></refentrytitle>
37196 <manvolnum>9</manvolnum>
37197 <refmiscinfo class="version">4.4.14</refmiscinfo>
37198</refmeta>
37199<refnamediv>
37200 <refname>mptspi_print_read_nego</refname>
37201 <refpurpose>
37202     negotiation parameters debug info that is being read
37203 </refpurpose>
37204</refnamediv>
37205<refsynopsisdiv>
37206 <title>Synopsis</title>
37207  <funcsynopsis><funcprototype>
37208   <funcdef>void <function>mptspi_print_read_nego </function></funcdef>
37209   <paramdef>struct _MPT_SCSI_HOST * <parameter>hd</parameter></paramdef>
37210   <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef>
37211   <paramdef>u32 <parameter>ii</parameter></paramdef>
37212  </funcprototype></funcsynopsis>
37213</refsynopsisdiv>
37214<refsect1>
37215 <title>Arguments</title>
37216 <variablelist>
37217  <varlistentry>
37218   <term><parameter>hd</parameter></term>
37219   <listitem>
37220    <para>
37221     Pointer to a SCSI HOST structure
37222    </para>
37223   </listitem>
37224  </varlistentry>
37225  <varlistentry>
37226   <term><parameter>starget</parameter></term>
37227   <listitem>
37228    <para>
37229     SCSI target
37230    </para>
37231   </listitem>
37232  </varlistentry>
37233  <varlistentry>
37234   <term><parameter>ii</parameter></term>
37235   <listitem>
37236    <para>
37237     negotiation parameters
37238    </para>
37239   </listitem>
37240  </varlistentry>
37241 </variablelist>
37242</refsect1>
37243</refentry>
37244
37245<refentry id="API-mptspi-init">
37246<refentryinfo>
37247 <title>LINUX</title>
37248 <productname>Kernel Hackers Manual</productname>
37249 <date>July 2017</date>
37250</refentryinfo>
37251<refmeta>
37252 <refentrytitle><phrase>mptspi_init</phrase></refentrytitle>
37253 <manvolnum>9</manvolnum>
37254 <refmiscinfo class="version">4.4.14</refmiscinfo>
37255</refmeta>
37256<refnamediv>
37257 <refname>mptspi_init</refname>
37258 <refpurpose>
37259     Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
37260 </refpurpose>
37261</refnamediv>
37262<refsynopsisdiv>
37263 <title>Synopsis</title>
37264  <funcsynopsis><funcprototype>
37265   <funcdef>int <function>mptspi_init </function></funcdef>
37266   <paramdef> <parameter>void</parameter></paramdef>
37267  </funcprototype></funcsynopsis>
37268</refsynopsisdiv>
37269<refsect1>
37270 <title>Arguments</title>
37271 <variablelist>
37272  <varlistentry>
37273   <term><parameter>void</parameter></term>
37274   <listitem>
37275    <para>
37276     no arguments
37277    </para>
37278   </listitem>
37279  </varlistentry>
37280 </variablelist>
37281</refsect1>
37282<refsect1>
37283<title>Description</title>
37284<para>
37285   </para><para>
37286
37287   Returns 0 for success, non-zero for failure.
37288</para>
37289</refsect1>
37290</refentry>
37291
37292<refentry id="API-mptspi-exit">
37293<refentryinfo>
37294 <title>LINUX</title>
37295 <productname>Kernel Hackers Manual</productname>
37296 <date>July 2017</date>
37297</refentryinfo>
37298<refmeta>
37299 <refentrytitle><phrase>mptspi_exit</phrase></refentrytitle>
37300 <manvolnum>9</manvolnum>
37301 <refmiscinfo class="version">4.4.14</refmiscinfo>
37302</refmeta>
37303<refnamediv>
37304 <refname>mptspi_exit</refname>
37305 <refpurpose>
37306     Unregisters MPT adapter(s)
37307 </refpurpose>
37308</refnamediv>
37309<refsynopsisdiv>
37310 <title>Synopsis</title>
37311  <funcsynopsis><funcprototype>
37312   <funcdef>void __exit <function>mptspi_exit </function></funcdef>
37313   <paramdef> <parameter>void</parameter></paramdef>
37314  </funcprototype></funcsynopsis>
37315</refsynopsisdiv>
37316<refsect1>
37317 <title>Arguments</title>
37318 <variablelist>
37319  <varlistentry>
37320   <term><parameter>void</parameter></term>
37321   <listitem>
37322    <para>
37323     no arguments
37324    </para>
37325   </listitem>
37326  </varlistentry>
37327 </variablelist>
37328</refsect1>
37329</refentry>
37330
37331<!-- drivers/message/fusion/mptfc.c -->
37332<refentry id="API-mptfc-init">
37333<refentryinfo>
37334 <title>LINUX</title>
37335 <productname>Kernel Hackers Manual</productname>
37336 <date>July 2017</date>
37337</refentryinfo>
37338<refmeta>
37339 <refentrytitle><phrase>mptfc_init</phrase></refentrytitle>
37340 <manvolnum>9</manvolnum>
37341 <refmiscinfo class="version">4.4.14</refmiscinfo>
37342</refmeta>
37343<refnamediv>
37344 <refname>mptfc_init</refname>
37345 <refpurpose>
37346  Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
37347 </refpurpose>
37348</refnamediv>
37349<refsynopsisdiv>
37350 <title>Synopsis</title>
37351  <funcsynopsis><funcprototype>
37352   <funcdef>int <function>mptfc_init </function></funcdef>
37353   <paramdef> <parameter>void</parameter></paramdef>
37354  </funcprototype></funcsynopsis>
37355</refsynopsisdiv>
37356<refsect1>
37357 <title>Arguments</title>
37358 <variablelist>
37359  <varlistentry>
37360   <term><parameter>void</parameter></term>
37361   <listitem>
37362    <para>
37363     no arguments
37364    </para>
37365   </listitem>
37366  </varlistentry>
37367 </variablelist>
37368</refsect1>
37369<refsect1>
37370<title>Description</title>
37371<para>
37372   </para><para>
37373
37374   Returns 0 for success, non-zero for failure.
37375</para>
37376</refsect1>
37377</refentry>
37378
37379<refentry id="API-mptfc-remove">
37380<refentryinfo>
37381 <title>LINUX</title>
37382 <productname>Kernel Hackers Manual</productname>
37383 <date>July 2017</date>
37384</refentryinfo>
37385<refmeta>
37386 <refentrytitle><phrase>mptfc_remove</phrase></refentrytitle>
37387 <manvolnum>9</manvolnum>
37388 <refmiscinfo class="version">4.4.14</refmiscinfo>
37389</refmeta>
37390<refnamediv>
37391 <refname>mptfc_remove</refname>
37392 <refpurpose>
37393     Remove fc infrastructure for devices
37394 </refpurpose>
37395</refnamediv>
37396<refsynopsisdiv>
37397 <title>Synopsis</title>
37398  <funcsynopsis><funcprototype>
37399   <funcdef>void <function>mptfc_remove </function></funcdef>
37400   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
37401  </funcprototype></funcsynopsis>
37402</refsynopsisdiv>
37403<refsect1>
37404 <title>Arguments</title>
37405 <variablelist>
37406  <varlistentry>
37407   <term><parameter>pdev</parameter></term>
37408   <listitem>
37409    <para>
37410     Pointer to pci_dev structure
37411    </para>
37412   </listitem>
37413  </varlistentry>
37414 </variablelist>
37415</refsect1>
37416</refentry>
37417
37418<refentry id="API-mptfc-exit">
37419<refentryinfo>
37420 <title>LINUX</title>
37421 <productname>Kernel Hackers Manual</productname>
37422 <date>July 2017</date>
37423</refentryinfo>
37424<refmeta>
37425 <refentrytitle><phrase>mptfc_exit</phrase></refentrytitle>
37426 <manvolnum>9</manvolnum>
37427 <refmiscinfo class="version">4.4.14</refmiscinfo>
37428</refmeta>
37429<refnamediv>
37430 <refname>mptfc_exit</refname>
37431 <refpurpose>
37432     Unregisters MPT adapter(s)
37433 </refpurpose>
37434</refnamediv>
37435<refsynopsisdiv>
37436 <title>Synopsis</title>
37437  <funcsynopsis><funcprototype>
37438   <funcdef>void __exit <function>mptfc_exit </function></funcdef>
37439   <paramdef> <parameter>void</parameter></paramdef>
37440  </funcprototype></funcsynopsis>
37441</refsynopsisdiv>
37442<refsect1>
37443 <title>Arguments</title>
37444 <variablelist>
37445  <varlistentry>
37446   <term><parameter>void</parameter></term>
37447   <listitem>
37448    <para>
37449     no arguments
37450    </para>
37451   </listitem>
37452  </varlistentry>
37453 </variablelist>
37454</refsect1>
37455</refentry>
37456
37457<!-- drivers/message/fusion/mptlan.c -->
37458<refentry id="API-lan-reply">
37459<refentryinfo>
37460 <title>LINUX</title>
37461 <productname>Kernel Hackers Manual</productname>
37462 <date>July 2017</date>
37463</refentryinfo>
37464<refmeta>
37465 <refentrytitle><phrase>lan_reply</phrase></refentrytitle>
37466 <manvolnum>9</manvolnum>
37467 <refmiscinfo class="version">4.4.14</refmiscinfo>
37468</refmeta>
37469<refnamediv>
37470 <refname>lan_reply</refname>
37471 <refpurpose>
37472  Handle all data sent from the hardware.
37473 </refpurpose>
37474</refnamediv>
37475<refsynopsisdiv>
37476 <title>Synopsis</title>
37477  <funcsynopsis><funcprototype>
37478   <funcdef>int <function>lan_reply </function></funcdef>
37479   <paramdef>MPT_ADAPTER * <parameter>ioc</parameter></paramdef>
37480   <paramdef>MPT_FRAME_HDR * <parameter>mf</parameter></paramdef>
37481   <paramdef>MPT_FRAME_HDR * <parameter>reply</parameter></paramdef>
37482  </funcprototype></funcsynopsis>
37483</refsynopsisdiv>
37484<refsect1>
37485 <title>Arguments</title>
37486 <variablelist>
37487  <varlistentry>
37488   <term><parameter>ioc</parameter></term>
37489   <listitem>
37490    <para>
37491     Pointer to MPT_ADAPTER structure
37492    </para>
37493   </listitem>
37494  </varlistentry>
37495  <varlistentry>
37496   <term><parameter>mf</parameter></term>
37497   <listitem>
37498    <para>
37499     Pointer to original MPT request frame (NULL if TurboReply)
37500    </para>
37501   </listitem>
37502  </varlistentry>
37503  <varlistentry>
37504   <term><parameter>reply</parameter></term>
37505   <listitem>
37506    <para>
37507     Pointer to MPT reply frame
37508    </para>
37509   </listitem>
37510  </varlistentry>
37511 </variablelist>
37512</refsect1>
37513<refsect1>
37514<title>Description</title>
37515<para>
37516   Returns 1 indicating original alloc'd request frame ptr
37517   should be freed, or 0 if it shouldn't.
37518</para>
37519</refsect1>
37520</refentry>
37521
37522     </sect1>
37523  </chapter>
37524
37525  <chapter id="snddev">
37526     <title>Sound Devices</title>
37527<!-- include/sound/core.h -->
37528<refentry id="API-snd-printk">
37529<refentryinfo>
37530 <title>LINUX</title>
37531 <productname>Kernel Hackers Manual</productname>
37532 <date>July 2017</date>
37533</refentryinfo>
37534<refmeta>
37535 <refentrytitle><phrase>snd_printk</phrase></refentrytitle>
37536 <manvolnum>9</manvolnum>
37537 <refmiscinfo class="version">4.4.14</refmiscinfo>
37538</refmeta>
37539<refnamediv>
37540 <refname>snd_printk</refname>
37541 <refpurpose>
37542  printk wrapper
37543 </refpurpose>
37544</refnamediv>
37545<refsynopsisdiv>
37546 <title>Synopsis</title>
37547  <funcsynopsis><funcprototype>
37548   <funcdef> <function>snd_printk </function></funcdef>
37549   <paramdef> <parameter>fmt</parameter></paramdef>
37550   <paramdef> <parameter>args...</parameter></paramdef>
37551  </funcprototype></funcsynopsis>
37552</refsynopsisdiv>
37553<refsect1>
37554 <title>Arguments</title>
37555 <variablelist>
37556  <varlistentry>
37557   <term><parameter>fmt</parameter></term>
37558   <listitem>
37559    <para>
37560     format string
37561    </para>
37562   </listitem>
37563  </varlistentry>
37564  <varlistentry>
37565   <term><parameter>args...</parameter></term>
37566   <listitem>
37567    <para>
37568     variable arguments
37569    </para>
37570   </listitem>
37571  </varlistentry>
37572 </variablelist>
37573</refsect1>
37574<refsect1>
37575<title>Description</title>
37576<para>
37577   Works like <function><link linkend="API-printk">printk</link></function> but prints the file and the line of the caller
37578   when configured with CONFIG_SND_VERBOSE_PRINTK.
37579</para>
37580</refsect1>
37581</refentry>
37582
37583<refentry id="API-snd-printd">
37584<refentryinfo>
37585 <title>LINUX</title>
37586 <productname>Kernel Hackers Manual</productname>
37587 <date>July 2017</date>
37588</refentryinfo>
37589<refmeta>
37590 <refentrytitle><phrase>snd_printd</phrase></refentrytitle>
37591 <manvolnum>9</manvolnum>
37592 <refmiscinfo class="version">4.4.14</refmiscinfo>
37593</refmeta>
37594<refnamediv>
37595 <refname>snd_printd</refname>
37596 <refpurpose>
37597     debug printk
37598 </refpurpose>
37599</refnamediv>
37600<refsynopsisdiv>
37601 <title>Synopsis</title>
37602  <funcsynopsis><funcprototype>
37603   <funcdef> <function>snd_printd </function></funcdef>
37604   <paramdef> <parameter>fmt</parameter></paramdef>
37605   <paramdef> <parameter>args...</parameter></paramdef>
37606  </funcprototype></funcsynopsis>
37607</refsynopsisdiv>
37608<refsect1>
37609 <title>Arguments</title>
37610 <variablelist>
37611  <varlistentry>
37612   <term><parameter>fmt</parameter></term>
37613   <listitem>
37614    <para>
37615     format string
37616    </para>
37617   </listitem>
37618  </varlistentry>
37619  <varlistentry>
37620   <term><parameter>args...</parameter></term>
37621   <listitem>
37622    <para>
37623     variable arguments
37624    </para>
37625   </listitem>
37626  </varlistentry>
37627 </variablelist>
37628</refsect1>
37629<refsect1>
37630<title>Description</title>
37631<para>
37632   Works like <function><link linkend="API-snd-printk">snd_printk</link></function> for debugging purposes.
37633   Ignored when CONFIG_SND_DEBUG is not set.
37634</para>
37635</refsect1>
37636</refentry>
37637
37638<refentry id="API-snd-BUG">
37639<refentryinfo>
37640 <title>LINUX</title>
37641 <productname>Kernel Hackers Manual</productname>
37642 <date>July 2017</date>
37643</refentryinfo>
37644<refmeta>
37645 <refentrytitle><phrase>snd_BUG</phrase></refentrytitle>
37646 <manvolnum>9</manvolnum>
37647 <refmiscinfo class="version">4.4.14</refmiscinfo>
37648</refmeta>
37649<refnamediv>
37650 <refname>snd_BUG</refname>
37651 <refpurpose>
37652     give a BUG warning message and stack trace
37653 </refpurpose>
37654</refnamediv>
37655<refsynopsisdiv>
37656 <title>Synopsis</title>
37657  <funcsynopsis><funcprototype>
37658   <funcdef> <function>snd_BUG </function></funcdef>
37659  <void/>
37660  </funcprototype></funcsynopsis>
37661</refsynopsisdiv>
37662<refsect1>
37663 <title>Arguments</title>
37664 <para>
37665  None
37666 </para>
37667</refsect1>
37668<refsect1>
37669<title>Description</title>
37670<para>
37671   </para><para>
37672
37673   Calls <function>WARN</function> if CONFIG_SND_DEBUG is set.
37674   Ignored when CONFIG_SND_DEBUG is not set.
37675</para>
37676</refsect1>
37677</refentry>
37678
37679<refentry id="API-snd-printd-ratelimit">
37680<refentryinfo>
37681 <title>LINUX</title>
37682 <productname>Kernel Hackers Manual</productname>
37683 <date>July 2017</date>
37684</refentryinfo>
37685<refmeta>
37686 <refentrytitle><phrase>snd_printd_ratelimit</phrase></refentrytitle>
37687 <manvolnum>9</manvolnum>
37688 <refmiscinfo class="version">4.4.14</refmiscinfo>
37689</refmeta>
37690<refnamediv>
37691 <refname>snd_printd_ratelimit</refname>
37692 <refpurpose>
37693   </refpurpose>
37694</refnamediv>
37695<refsynopsisdiv>
37696 <title>Synopsis</title>
37697  <funcsynopsis><funcprototype>
37698   <funcdef> <function>snd_printd_ratelimit </function></funcdef>
37699  <void/>
37700  </funcprototype></funcsynopsis>
37701</refsynopsisdiv>
37702<refsect1>
37703 <title>Arguments</title>
37704 <para>
37705  None
37706 </para>
37707</refsect1>
37708</refentry>
37709
37710<refentry id="API-snd-BUG-ON">
37711<refentryinfo>
37712 <title>LINUX</title>
37713 <productname>Kernel Hackers Manual</productname>
37714 <date>July 2017</date>
37715</refentryinfo>
37716<refmeta>
37717 <refentrytitle><phrase>snd_BUG_ON</phrase></refentrytitle>
37718 <manvolnum>9</manvolnum>
37719 <refmiscinfo class="version">4.4.14</refmiscinfo>
37720</refmeta>
37721<refnamediv>
37722 <refname>snd_BUG_ON</refname>
37723 <refpurpose>
37724     debugging check macro
37725 </refpurpose>
37726</refnamediv>
37727<refsynopsisdiv>
37728 <title>Synopsis</title>
37729  <funcsynopsis><funcprototype>
37730   <funcdef> <function>snd_BUG_ON </function></funcdef>
37731   <paramdef> <parameter>cond</parameter></paramdef>
37732  </funcprototype></funcsynopsis>
37733</refsynopsisdiv>
37734<refsect1>
37735 <title>Arguments</title>
37736 <variablelist>
37737  <varlistentry>
37738   <term><parameter>cond</parameter></term>
37739   <listitem>
37740    <para>
37741     condition to evaluate
37742    </para>
37743   </listitem>
37744  </varlistentry>
37745 </variablelist>
37746</refsect1>
37747<refsect1>
37748<title>Description</title>
37749<para>
37750   Has the same behavior as WARN_ON when CONFIG_SND_DEBUG is set,
37751   otherwise just evaluates the conditional and returns the value.
37752</para>
37753</refsect1>
37754</refentry>
37755
37756<refentry id="API-snd-printdd">
37757<refentryinfo>
37758 <title>LINUX</title>
37759 <productname>Kernel Hackers Manual</productname>
37760 <date>July 2017</date>
37761</refentryinfo>
37762<refmeta>
37763 <refentrytitle><phrase>snd_printdd</phrase></refentrytitle>
37764 <manvolnum>9</manvolnum>
37765 <refmiscinfo class="version">4.4.14</refmiscinfo>
37766</refmeta>
37767<refnamediv>
37768 <refname>snd_printdd</refname>
37769 <refpurpose>
37770     debug printk
37771 </refpurpose>
37772</refnamediv>
37773<refsynopsisdiv>
37774 <title>Synopsis</title>
37775  <funcsynopsis><funcprototype>
37776   <funcdef> <function>snd_printdd </function></funcdef>
37777   <paramdef> <parameter>format</parameter></paramdef>
37778   <paramdef> <parameter>args...</parameter></paramdef>
37779  </funcprototype></funcsynopsis>
37780</refsynopsisdiv>
37781<refsect1>
37782 <title>Arguments</title>
37783 <variablelist>
37784  <varlistentry>
37785   <term><parameter>format</parameter></term>
37786   <listitem>
37787    <para>
37788     format string
37789    </para>
37790   </listitem>
37791  </varlistentry>
37792  <varlistentry>
37793   <term><parameter>args...</parameter></term>
37794   <listitem>
37795    <para>
37796     variable arguments
37797    </para>
37798   </listitem>
37799  </varlistentry>
37800 </variablelist>
37801</refsect1>
37802<refsect1>
37803<title>Description</title>
37804<para>
37805   Works like <function><link linkend="API-snd-printk">snd_printk</link></function> for debugging purposes.
37806   Ignored when CONFIG_SND_DEBUG_VERBOSE is not set.
37807</para>
37808</refsect1>
37809</refentry>
37810
37811<!-- sound/sound_core.c -->
37812<refentry id="API-register-sound-special-device">
37813<refentryinfo>
37814 <title>LINUX</title>
37815 <productname>Kernel Hackers Manual</productname>
37816 <date>July 2017</date>
37817</refentryinfo>
37818<refmeta>
37819 <refentrytitle><phrase>register_sound_special_device</phrase></refentrytitle>
37820 <manvolnum>9</manvolnum>
37821 <refmiscinfo class="version">4.4.14</refmiscinfo>
37822</refmeta>
37823<refnamediv>
37824 <refname>register_sound_special_device</refname>
37825 <refpurpose>
37826  register a special sound node
37827 </refpurpose>
37828</refnamediv>
37829<refsynopsisdiv>
37830 <title>Synopsis</title>
37831  <funcsynopsis><funcprototype>
37832   <funcdef>int <function>register_sound_special_device </function></funcdef>
37833   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
37834   <paramdef>int <parameter>unit</parameter></paramdef>
37835   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
37836  </funcprototype></funcsynopsis>
37837</refsynopsisdiv>
37838<refsect1>
37839 <title>Arguments</title>
37840 <variablelist>
37841  <varlistentry>
37842   <term><parameter>fops</parameter></term>
37843   <listitem>
37844    <para>
37845     File operations for the driver
37846    </para>
37847   </listitem>
37848  </varlistentry>
37849  <varlistentry>
37850   <term><parameter>unit</parameter></term>
37851   <listitem>
37852    <para>
37853     Unit number to allocate
37854    </para>
37855   </listitem>
37856  </varlistentry>
37857  <varlistentry>
37858   <term><parameter>dev</parameter></term>
37859   <listitem>
37860    <para>
37861     device pointer
37862    </para>
37863   </listitem>
37864  </varlistentry>
37865 </variablelist>
37866</refsect1>
37867<refsect1>
37868<title>Description</title>
37869<para>
37870   Allocate a special sound device by minor number from the sound
37871   subsystem.
37872</para>
37873</refsect1>
37874<refsect1>
37875<title>Return</title>
37876<para>
37877   The allocated number is returned on success. On failure,
37878   a negative error code is returned.
37879</para>
37880</refsect1>
37881</refentry>
37882
37883<refentry id="API-register-sound-mixer">
37884<refentryinfo>
37885 <title>LINUX</title>
37886 <productname>Kernel Hackers Manual</productname>
37887 <date>July 2017</date>
37888</refentryinfo>
37889<refmeta>
37890 <refentrytitle><phrase>register_sound_mixer</phrase></refentrytitle>
37891 <manvolnum>9</manvolnum>
37892 <refmiscinfo class="version">4.4.14</refmiscinfo>
37893</refmeta>
37894<refnamediv>
37895 <refname>register_sound_mixer</refname>
37896 <refpurpose>
37897     register a mixer device
37898 </refpurpose>
37899</refnamediv>
37900<refsynopsisdiv>
37901 <title>Synopsis</title>
37902  <funcsynopsis><funcprototype>
37903   <funcdef>int <function>register_sound_mixer </function></funcdef>
37904   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
37905   <paramdef>int <parameter>dev</parameter></paramdef>
37906  </funcprototype></funcsynopsis>
37907</refsynopsisdiv>
37908<refsect1>
37909 <title>Arguments</title>
37910 <variablelist>
37911  <varlistentry>
37912   <term><parameter>fops</parameter></term>
37913   <listitem>
37914    <para>
37915     File operations for the driver
37916    </para>
37917   </listitem>
37918  </varlistentry>
37919  <varlistentry>
37920   <term><parameter>dev</parameter></term>
37921   <listitem>
37922    <para>
37923     Unit number to allocate
37924    </para>
37925   </listitem>
37926  </varlistentry>
37927 </variablelist>
37928</refsect1>
37929<refsect1>
37930<title>Description</title>
37931<para>
37932   Allocate a mixer device. Unit is the number of the mixer requested.
37933   Pass -1 to request the next free mixer unit.
37934</para>
37935</refsect1>
37936<refsect1>
37937<title>Return</title>
37938<para>
37939   On success, the allocated number is returned. On failure,
37940   a negative error code is returned.
37941</para>
37942</refsect1>
37943</refentry>
37944
37945<refentry id="API-register-sound-midi">
37946<refentryinfo>
37947 <title>LINUX</title>
37948 <productname>Kernel Hackers Manual</productname>
37949 <date>July 2017</date>
37950</refentryinfo>
37951<refmeta>
37952 <refentrytitle><phrase>register_sound_midi</phrase></refentrytitle>
37953 <manvolnum>9</manvolnum>
37954 <refmiscinfo class="version">4.4.14</refmiscinfo>
37955</refmeta>
37956<refnamediv>
37957 <refname>register_sound_midi</refname>
37958 <refpurpose>
37959     register a midi device
37960 </refpurpose>
37961</refnamediv>
37962<refsynopsisdiv>
37963 <title>Synopsis</title>
37964  <funcsynopsis><funcprototype>
37965   <funcdef>int <function>register_sound_midi </function></funcdef>
37966   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
37967   <paramdef>int <parameter>dev</parameter></paramdef>
37968  </funcprototype></funcsynopsis>
37969</refsynopsisdiv>
37970<refsect1>
37971 <title>Arguments</title>
37972 <variablelist>
37973  <varlistentry>
37974   <term><parameter>fops</parameter></term>
37975   <listitem>
37976    <para>
37977     File operations for the driver
37978    </para>
37979   </listitem>
37980  </varlistentry>
37981  <varlistentry>
37982   <term><parameter>dev</parameter></term>
37983   <listitem>
37984    <para>
37985     Unit number to allocate
37986    </para>
37987   </listitem>
37988  </varlistentry>
37989 </variablelist>
37990</refsect1>
37991<refsect1>
37992<title>Description</title>
37993<para>
37994   Allocate a midi device. Unit is the number of the midi device requested.
37995   Pass -1 to request the next free midi unit.
37996</para>
37997</refsect1>
37998<refsect1>
37999<title>Return</title>
38000<para>
38001   On success, the allocated number is returned. On failure,
38002   a negative error code is returned.
38003</para>
38004</refsect1>
38005</refentry>
38006
38007<refentry id="API-register-sound-dsp">
38008<refentryinfo>
38009 <title>LINUX</title>
38010 <productname>Kernel Hackers Manual</productname>
38011 <date>July 2017</date>
38012</refentryinfo>
38013<refmeta>
38014 <refentrytitle><phrase>register_sound_dsp</phrase></refentrytitle>
38015 <manvolnum>9</manvolnum>
38016 <refmiscinfo class="version">4.4.14</refmiscinfo>
38017</refmeta>
38018<refnamediv>
38019 <refname>register_sound_dsp</refname>
38020 <refpurpose>
38021     register a DSP device
38022 </refpurpose>
38023</refnamediv>
38024<refsynopsisdiv>
38025 <title>Synopsis</title>
38026  <funcsynopsis><funcprototype>
38027   <funcdef>int <function>register_sound_dsp </function></funcdef>
38028   <paramdef>const struct file_operations * <parameter>fops</parameter></paramdef>
38029   <paramdef>int <parameter>dev</parameter></paramdef>
38030  </funcprototype></funcsynopsis>
38031</refsynopsisdiv>
38032<refsect1>
38033 <title>Arguments</title>
38034 <variablelist>
38035  <varlistentry>
38036   <term><parameter>fops</parameter></term>
38037   <listitem>
38038    <para>
38039     File operations for the driver
38040    </para>
38041   </listitem>
38042  </varlistentry>
38043  <varlistentry>
38044   <term><parameter>dev</parameter></term>
38045   <listitem>
38046    <para>
38047     Unit number to allocate
38048    </para>
38049   </listitem>
38050  </varlistentry>
38051 </variablelist>
38052</refsect1>
38053<refsect1>
38054<title>Description</title>
38055<para>
38056   Allocate a DSP device. Unit is the number of the DSP requested.
38057   Pass -1 to request the next free DSP unit.
38058   </para><para>
38059
38060   This function allocates both the audio and dsp device entries together
38061   and will always allocate them as a matching pair - eg dsp3/audio3
38062</para>
38063</refsect1>
38064<refsect1>
38065<title>Return</title>
38066<para>
38067   On success, the allocated number is returned. On failure,
38068   a negative error code is returned.
38069</para>
38070</refsect1>
38071</refentry>
38072
38073<refentry id="API-unregister-sound-special">
38074<refentryinfo>
38075 <title>LINUX</title>
38076 <productname>Kernel Hackers Manual</productname>
38077 <date>July 2017</date>
38078</refentryinfo>
38079<refmeta>
38080 <refentrytitle><phrase>unregister_sound_special</phrase></refentrytitle>
38081 <manvolnum>9</manvolnum>
38082 <refmiscinfo class="version">4.4.14</refmiscinfo>
38083</refmeta>
38084<refnamediv>
38085 <refname>unregister_sound_special</refname>
38086 <refpurpose>
38087     unregister a special sound device
38088 </refpurpose>
38089</refnamediv>
38090<refsynopsisdiv>
38091 <title>Synopsis</title>
38092  <funcsynopsis><funcprototype>
38093   <funcdef>void <function>unregister_sound_special </function></funcdef>
38094   <paramdef>int <parameter>unit</parameter></paramdef>
38095  </funcprototype></funcsynopsis>
38096</refsynopsisdiv>
38097<refsect1>
38098 <title>Arguments</title>
38099 <variablelist>
38100  <varlistentry>
38101   <term><parameter>unit</parameter></term>
38102   <listitem>
38103    <para>
38104     unit number to allocate
38105    </para>
38106   </listitem>
38107  </varlistentry>
38108 </variablelist>
38109</refsect1>
38110<refsect1>
38111<title>Description</title>
38112<para>
38113   Release a sound device that was allocated with
38114   <function>register_sound_special</function>. The unit passed is the return value from
38115   the register function.
38116</para>
38117</refsect1>
38118</refentry>
38119
38120<refentry id="API-unregister-sound-mixer">
38121<refentryinfo>
38122 <title>LINUX</title>
38123 <productname>Kernel Hackers Manual</productname>
38124 <date>July 2017</date>
38125</refentryinfo>
38126<refmeta>
38127 <refentrytitle><phrase>unregister_sound_mixer</phrase></refentrytitle>
38128 <manvolnum>9</manvolnum>
38129 <refmiscinfo class="version">4.4.14</refmiscinfo>
38130</refmeta>
38131<refnamediv>
38132 <refname>unregister_sound_mixer</refname>
38133 <refpurpose>
38134     unregister a mixer
38135 </refpurpose>
38136</refnamediv>
38137<refsynopsisdiv>
38138 <title>Synopsis</title>
38139  <funcsynopsis><funcprototype>
38140   <funcdef>void <function>unregister_sound_mixer </function></funcdef>
38141   <paramdef>int <parameter>unit</parameter></paramdef>
38142  </funcprototype></funcsynopsis>
38143</refsynopsisdiv>
38144<refsect1>
38145 <title>Arguments</title>
38146 <variablelist>
38147  <varlistentry>
38148   <term><parameter>unit</parameter></term>
38149   <listitem>
38150    <para>
38151     unit number to allocate
38152    </para>
38153   </listitem>
38154  </varlistentry>
38155 </variablelist>
38156</refsect1>
38157<refsect1>
38158<title>Description</title>
38159<para>
38160   Release a sound device that was allocated with <function><link linkend="API-register-sound-mixer">register_sound_mixer</link></function>.
38161   The unit passed is the return value from the register function.
38162</para>
38163</refsect1>
38164</refentry>
38165
38166<refentry id="API-unregister-sound-midi">
38167<refentryinfo>
38168 <title>LINUX</title>
38169 <productname>Kernel Hackers Manual</productname>
38170 <date>July 2017</date>
38171</refentryinfo>
38172<refmeta>
38173 <refentrytitle><phrase>unregister_sound_midi</phrase></refentrytitle>
38174 <manvolnum>9</manvolnum>
38175 <refmiscinfo class="version">4.4.14</refmiscinfo>
38176</refmeta>
38177<refnamediv>
38178 <refname>unregister_sound_midi</refname>
38179 <refpurpose>
38180     unregister a midi device
38181 </refpurpose>
38182</refnamediv>
38183<refsynopsisdiv>
38184 <title>Synopsis</title>
38185  <funcsynopsis><funcprototype>
38186   <funcdef>void <function>unregister_sound_midi </function></funcdef>
38187   <paramdef>int <parameter>unit</parameter></paramdef>
38188  </funcprototype></funcsynopsis>
38189</refsynopsisdiv>
38190<refsect1>
38191 <title>Arguments</title>
38192 <variablelist>
38193  <varlistentry>
38194   <term><parameter>unit</parameter></term>
38195   <listitem>
38196    <para>
38197     unit number to allocate
38198    </para>
38199   </listitem>
38200  </varlistentry>
38201 </variablelist>
38202</refsect1>
38203<refsect1>
38204<title>Description</title>
38205<para>
38206   Release a sound device that was allocated with <function><link linkend="API-register-sound-midi">register_sound_midi</link></function>.
38207   The unit passed is the return value from the register function.
38208</para>
38209</refsect1>
38210</refentry>
38211
38212<refentry id="API-unregister-sound-dsp">
38213<refentryinfo>
38214 <title>LINUX</title>
38215 <productname>Kernel Hackers Manual</productname>
38216 <date>July 2017</date>
38217</refentryinfo>
38218<refmeta>
38219 <refentrytitle><phrase>unregister_sound_dsp</phrase></refentrytitle>
38220 <manvolnum>9</manvolnum>
38221 <refmiscinfo class="version">4.4.14</refmiscinfo>
38222</refmeta>
38223<refnamediv>
38224 <refname>unregister_sound_dsp</refname>
38225 <refpurpose>
38226     unregister a DSP device
38227 </refpurpose>
38228</refnamediv>
38229<refsynopsisdiv>
38230 <title>Synopsis</title>
38231  <funcsynopsis><funcprototype>
38232   <funcdef>void <function>unregister_sound_dsp </function></funcdef>
38233   <paramdef>int <parameter>unit</parameter></paramdef>
38234  </funcprototype></funcsynopsis>
38235</refsynopsisdiv>
38236<refsect1>
38237 <title>Arguments</title>
38238 <variablelist>
38239  <varlistentry>
38240   <term><parameter>unit</parameter></term>
38241   <listitem>
38242    <para>
38243     unit number to allocate
38244    </para>
38245   </listitem>
38246  </varlistentry>
38247 </variablelist>
38248</refsect1>
38249<refsect1>
38250<title>Description</title>
38251<para>
38252   Release a sound device that was allocated with <function><link linkend="API-register-sound-dsp">register_sound_dsp</link></function>.
38253   The unit passed is the return value from the register function.
38254   </para><para>
38255
38256   Both of the allocated units are released together automatically.
38257</para>
38258</refsect1>
38259</refentry>
38260
38261<!-- include/sound/pcm.h -->
38262<refentry id="API-snd-pcm-stream-linked">
38263<refentryinfo>
38264 <title>LINUX</title>
38265 <productname>Kernel Hackers Manual</productname>
38266 <date>July 2017</date>
38267</refentryinfo>
38268<refmeta>
38269 <refentrytitle><phrase>snd_pcm_stream_linked</phrase></refentrytitle>
38270 <manvolnum>9</manvolnum>
38271 <refmiscinfo class="version">4.4.14</refmiscinfo>
38272</refmeta>
38273<refnamediv>
38274 <refname>snd_pcm_stream_linked</refname>
38275 <refpurpose>
38276  Check whether the substream is linked with others
38277 </refpurpose>
38278</refnamediv>
38279<refsynopsisdiv>
38280 <title>Synopsis</title>
38281  <funcsynopsis><funcprototype>
38282   <funcdef>int <function>snd_pcm_stream_linked </function></funcdef>
38283   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38284  </funcprototype></funcsynopsis>
38285</refsynopsisdiv>
38286<refsect1>
38287 <title>Arguments</title>
38288 <variablelist>
38289  <varlistentry>
38290   <term><parameter>substream</parameter></term>
38291   <listitem>
38292    <para>
38293     substream to check
38294    </para>
38295   </listitem>
38296  </varlistentry>
38297 </variablelist>
38298</refsect1>
38299<refsect1>
38300<title>Description</title>
38301<para>
38302   Returns true if the given substream is being linked with others.
38303</para>
38304</refsect1>
38305</refentry>
38306
38307<refentry id="API-snd-pcm-stream-lock-irqsave">
38308<refentryinfo>
38309 <title>LINUX</title>
38310 <productname>Kernel Hackers Manual</productname>
38311 <date>July 2017</date>
38312</refentryinfo>
38313<refmeta>
38314 <refentrytitle><phrase>snd_pcm_stream_lock_irqsave</phrase></refentrytitle>
38315 <manvolnum>9</manvolnum>
38316 <refmiscinfo class="version">4.4.14</refmiscinfo>
38317</refmeta>
38318<refnamediv>
38319 <refname>snd_pcm_stream_lock_irqsave</refname>
38320 <refpurpose>
38321     Lock the PCM stream
38322 </refpurpose>
38323</refnamediv>
38324<refsynopsisdiv>
38325 <title>Synopsis</title>
38326  <funcsynopsis><funcprototype>
38327   <funcdef> <function>snd_pcm_stream_lock_irqsave </function></funcdef>
38328   <paramdef> <parameter>substream</parameter></paramdef>
38329   <paramdef> <parameter>flags</parameter></paramdef>
38330  </funcprototype></funcsynopsis>
38331</refsynopsisdiv>
38332<refsect1>
38333 <title>Arguments</title>
38334 <variablelist>
38335  <varlistentry>
38336   <term><parameter>substream</parameter></term>
38337   <listitem>
38338    <para>
38339     PCM substream
38340    </para>
38341   </listitem>
38342  </varlistentry>
38343  <varlistentry>
38344   <term><parameter>flags</parameter></term>
38345   <listitem>
38346    <para>
38347     irq flags
38348    </para>
38349   </listitem>
38350  </varlistentry>
38351 </variablelist>
38352</refsect1>
38353<refsect1>
38354<title>Description</title>
38355<para>
38356   This locks the PCM stream like <function><link linkend="API-snd-pcm-stream-lock">snd_pcm_stream_lock</link></function> but with the local
38357   IRQ (only when nonatomic is false).  In nonatomic case, this is identical
38358   as <function><link linkend="API-snd-pcm-stream-lock">snd_pcm_stream_lock</link></function>.
38359</para>
38360</refsect1>
38361</refentry>
38362
38363<refentry id="API-snd-pcm-group-for-each-entry">
38364<refentryinfo>
38365 <title>LINUX</title>
38366 <productname>Kernel Hackers Manual</productname>
38367 <date>July 2017</date>
38368</refentryinfo>
38369<refmeta>
38370 <refentrytitle><phrase>snd_pcm_group_for_each_entry</phrase></refentrytitle>
38371 <manvolnum>9</manvolnum>
38372 <refmiscinfo class="version">4.4.14</refmiscinfo>
38373</refmeta>
38374<refnamediv>
38375 <refname>snd_pcm_group_for_each_entry</refname>
38376 <refpurpose>
38377     iterate over the linked substreams
38378 </refpurpose>
38379</refnamediv>
38380<refsynopsisdiv>
38381 <title>Synopsis</title>
38382  <funcsynopsis><funcprototype>
38383   <funcdef> <function>snd_pcm_group_for_each_entry </function></funcdef>
38384   <paramdef> <parameter>s</parameter></paramdef>
38385   <paramdef> <parameter>substream</parameter></paramdef>
38386  </funcprototype></funcsynopsis>
38387</refsynopsisdiv>
38388<refsect1>
38389 <title>Arguments</title>
38390 <variablelist>
38391  <varlistentry>
38392   <term><parameter>s</parameter></term>
38393   <listitem>
38394    <para>
38395     the iterator
38396    </para>
38397   </listitem>
38398  </varlistentry>
38399  <varlistentry>
38400   <term><parameter>substream</parameter></term>
38401   <listitem>
38402    <para>
38403     the substream
38404    </para>
38405   </listitem>
38406  </varlistentry>
38407 </variablelist>
38408</refsect1>
38409<refsect1>
38410<title>Description</title>
38411<para>
38412   Iterate over the all linked substreams to the given <parameter>substream</parameter>.
38413   When <parameter>substream</parameter> isn't linked with any others, this gives returns <parameter>substream</parameter>
38414   itself once.
38415</para>
38416</refsect1>
38417</refentry>
38418
38419<refentry id="API-snd-pcm-running">
38420<refentryinfo>
38421 <title>LINUX</title>
38422 <productname>Kernel Hackers Manual</productname>
38423 <date>July 2017</date>
38424</refentryinfo>
38425<refmeta>
38426 <refentrytitle><phrase>snd_pcm_running</phrase></refentrytitle>
38427 <manvolnum>9</manvolnum>
38428 <refmiscinfo class="version">4.4.14</refmiscinfo>
38429</refmeta>
38430<refnamediv>
38431 <refname>snd_pcm_running</refname>
38432 <refpurpose>
38433     Check whether the substream is in a running state
38434 </refpurpose>
38435</refnamediv>
38436<refsynopsisdiv>
38437 <title>Synopsis</title>
38438  <funcsynopsis><funcprototype>
38439   <funcdef>int <function>snd_pcm_running </function></funcdef>
38440   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38441  </funcprototype></funcsynopsis>
38442</refsynopsisdiv>
38443<refsect1>
38444 <title>Arguments</title>
38445 <variablelist>
38446  <varlistentry>
38447   <term><parameter>substream</parameter></term>
38448   <listitem>
38449    <para>
38450     substream to check
38451    </para>
38452   </listitem>
38453  </varlistentry>
38454 </variablelist>
38455</refsect1>
38456<refsect1>
38457<title>Description</title>
38458<para>
38459   Returns true if the given substream is in the state RUNNING, or in the
38460   state DRAINING for playback.
38461</para>
38462</refsect1>
38463</refentry>
38464
38465<refentry id="API-bytes-to-samples">
38466<refentryinfo>
38467 <title>LINUX</title>
38468 <productname>Kernel Hackers Manual</productname>
38469 <date>July 2017</date>
38470</refentryinfo>
38471<refmeta>
38472 <refentrytitle><phrase>bytes_to_samples</phrase></refentrytitle>
38473 <manvolnum>9</manvolnum>
38474 <refmiscinfo class="version">4.4.14</refmiscinfo>
38475</refmeta>
38476<refnamediv>
38477 <refname>bytes_to_samples</refname>
38478 <refpurpose>
38479     Unit conversion of the size from bytes to samples
38480 </refpurpose>
38481</refnamediv>
38482<refsynopsisdiv>
38483 <title>Synopsis</title>
38484  <funcsynopsis><funcprototype>
38485   <funcdef>ssize_t <function>bytes_to_samples </function></funcdef>
38486   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38487   <paramdef>ssize_t <parameter>size</parameter></paramdef>
38488  </funcprototype></funcsynopsis>
38489</refsynopsisdiv>
38490<refsect1>
38491 <title>Arguments</title>
38492 <variablelist>
38493  <varlistentry>
38494   <term><parameter>runtime</parameter></term>
38495   <listitem>
38496    <para>
38497     PCM runtime instance
38498    </para>
38499   </listitem>
38500  </varlistentry>
38501  <varlistentry>
38502   <term><parameter>size</parameter></term>
38503   <listitem>
38504    <para>
38505     size in bytes
38506    </para>
38507   </listitem>
38508  </varlistentry>
38509 </variablelist>
38510</refsect1>
38511</refentry>
38512
38513<refentry id="API-bytes-to-frames">
38514<refentryinfo>
38515 <title>LINUX</title>
38516 <productname>Kernel Hackers Manual</productname>
38517 <date>July 2017</date>
38518</refentryinfo>
38519<refmeta>
38520 <refentrytitle><phrase>bytes_to_frames</phrase></refentrytitle>
38521 <manvolnum>9</manvolnum>
38522 <refmiscinfo class="version">4.4.14</refmiscinfo>
38523</refmeta>
38524<refnamediv>
38525 <refname>bytes_to_frames</refname>
38526 <refpurpose>
38527     Unit conversion of the size from bytes to frames
38528 </refpurpose>
38529</refnamediv>
38530<refsynopsisdiv>
38531 <title>Synopsis</title>
38532  <funcsynopsis><funcprototype>
38533   <funcdef>snd_pcm_sframes_t <function>bytes_to_frames </function></funcdef>
38534   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38535   <paramdef>ssize_t <parameter>size</parameter></paramdef>
38536  </funcprototype></funcsynopsis>
38537</refsynopsisdiv>
38538<refsect1>
38539 <title>Arguments</title>
38540 <variablelist>
38541  <varlistentry>
38542   <term><parameter>runtime</parameter></term>
38543   <listitem>
38544    <para>
38545     PCM runtime instance
38546    </para>
38547   </listitem>
38548  </varlistentry>
38549  <varlistentry>
38550   <term><parameter>size</parameter></term>
38551   <listitem>
38552    <para>
38553     size in bytes
38554    </para>
38555   </listitem>
38556  </varlistentry>
38557 </variablelist>
38558</refsect1>
38559</refentry>
38560
38561<refentry id="API-samples-to-bytes">
38562<refentryinfo>
38563 <title>LINUX</title>
38564 <productname>Kernel Hackers Manual</productname>
38565 <date>July 2017</date>
38566</refentryinfo>
38567<refmeta>
38568 <refentrytitle><phrase>samples_to_bytes</phrase></refentrytitle>
38569 <manvolnum>9</manvolnum>
38570 <refmiscinfo class="version">4.4.14</refmiscinfo>
38571</refmeta>
38572<refnamediv>
38573 <refname>samples_to_bytes</refname>
38574 <refpurpose>
38575     Unit conversion of the size from samples to bytes
38576 </refpurpose>
38577</refnamediv>
38578<refsynopsisdiv>
38579 <title>Synopsis</title>
38580  <funcsynopsis><funcprototype>
38581   <funcdef>ssize_t <function>samples_to_bytes </function></funcdef>
38582   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38583   <paramdef>ssize_t <parameter>size</parameter></paramdef>
38584  </funcprototype></funcsynopsis>
38585</refsynopsisdiv>
38586<refsect1>
38587 <title>Arguments</title>
38588 <variablelist>
38589  <varlistentry>
38590   <term><parameter>runtime</parameter></term>
38591   <listitem>
38592    <para>
38593     PCM runtime instance
38594    </para>
38595   </listitem>
38596  </varlistentry>
38597  <varlistentry>
38598   <term><parameter>size</parameter></term>
38599   <listitem>
38600    <para>
38601     size in samples
38602    </para>
38603   </listitem>
38604  </varlistentry>
38605 </variablelist>
38606</refsect1>
38607</refentry>
38608
38609<refentry id="API-frames-to-bytes">
38610<refentryinfo>
38611 <title>LINUX</title>
38612 <productname>Kernel Hackers Manual</productname>
38613 <date>July 2017</date>
38614</refentryinfo>
38615<refmeta>
38616 <refentrytitle><phrase>frames_to_bytes</phrase></refentrytitle>
38617 <manvolnum>9</manvolnum>
38618 <refmiscinfo class="version">4.4.14</refmiscinfo>
38619</refmeta>
38620<refnamediv>
38621 <refname>frames_to_bytes</refname>
38622 <refpurpose>
38623     Unit conversion of the size from frames to bytes
38624 </refpurpose>
38625</refnamediv>
38626<refsynopsisdiv>
38627 <title>Synopsis</title>
38628  <funcsynopsis><funcprototype>
38629   <funcdef>ssize_t <function>frames_to_bytes </function></funcdef>
38630   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38631   <paramdef>snd_pcm_sframes_t <parameter>size</parameter></paramdef>
38632  </funcprototype></funcsynopsis>
38633</refsynopsisdiv>
38634<refsect1>
38635 <title>Arguments</title>
38636 <variablelist>
38637  <varlistentry>
38638   <term><parameter>runtime</parameter></term>
38639   <listitem>
38640    <para>
38641     PCM runtime instance
38642    </para>
38643   </listitem>
38644  </varlistentry>
38645  <varlistentry>
38646   <term><parameter>size</parameter></term>
38647   <listitem>
38648    <para>
38649     size in frames
38650    </para>
38651   </listitem>
38652  </varlistentry>
38653 </variablelist>
38654</refsect1>
38655</refentry>
38656
38657<refentry id="API-frame-aligned">
38658<refentryinfo>
38659 <title>LINUX</title>
38660 <productname>Kernel Hackers Manual</productname>
38661 <date>July 2017</date>
38662</refentryinfo>
38663<refmeta>
38664 <refentrytitle><phrase>frame_aligned</phrase></refentrytitle>
38665 <manvolnum>9</manvolnum>
38666 <refmiscinfo class="version">4.4.14</refmiscinfo>
38667</refmeta>
38668<refnamediv>
38669 <refname>frame_aligned</refname>
38670 <refpurpose>
38671     Check whether the byte size is aligned to frames
38672 </refpurpose>
38673</refnamediv>
38674<refsynopsisdiv>
38675 <title>Synopsis</title>
38676  <funcsynopsis><funcprototype>
38677   <funcdef>int <function>frame_aligned </function></funcdef>
38678   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38679   <paramdef>ssize_t <parameter>bytes</parameter></paramdef>
38680  </funcprototype></funcsynopsis>
38681</refsynopsisdiv>
38682<refsect1>
38683 <title>Arguments</title>
38684 <variablelist>
38685  <varlistentry>
38686   <term><parameter>runtime</parameter></term>
38687   <listitem>
38688    <para>
38689     PCM runtime instance
38690    </para>
38691   </listitem>
38692  </varlistentry>
38693  <varlistentry>
38694   <term><parameter>bytes</parameter></term>
38695   <listitem>
38696    <para>
38697     size in bytes
38698    </para>
38699   </listitem>
38700  </varlistentry>
38701 </variablelist>
38702</refsect1>
38703</refentry>
38704
38705<refentry id="API-snd-pcm-lib-buffer-bytes">
38706<refentryinfo>
38707 <title>LINUX</title>
38708 <productname>Kernel Hackers Manual</productname>
38709 <date>July 2017</date>
38710</refentryinfo>
38711<refmeta>
38712 <refentrytitle><phrase>snd_pcm_lib_buffer_bytes</phrase></refentrytitle>
38713 <manvolnum>9</manvolnum>
38714 <refmiscinfo class="version">4.4.14</refmiscinfo>
38715</refmeta>
38716<refnamediv>
38717 <refname>snd_pcm_lib_buffer_bytes</refname>
38718 <refpurpose>
38719     Get the buffer size of the current PCM in bytes
38720 </refpurpose>
38721</refnamediv>
38722<refsynopsisdiv>
38723 <title>Synopsis</title>
38724  <funcsynopsis><funcprototype>
38725   <funcdef>size_t <function>snd_pcm_lib_buffer_bytes </function></funcdef>
38726   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38727  </funcprototype></funcsynopsis>
38728</refsynopsisdiv>
38729<refsect1>
38730 <title>Arguments</title>
38731 <variablelist>
38732  <varlistentry>
38733   <term><parameter>substream</parameter></term>
38734   <listitem>
38735    <para>
38736     PCM substream
38737    </para>
38738   </listitem>
38739  </varlistentry>
38740 </variablelist>
38741</refsect1>
38742</refentry>
38743
38744<refentry id="API-snd-pcm-lib-period-bytes">
38745<refentryinfo>
38746 <title>LINUX</title>
38747 <productname>Kernel Hackers Manual</productname>
38748 <date>July 2017</date>
38749</refentryinfo>
38750<refmeta>
38751 <refentrytitle><phrase>snd_pcm_lib_period_bytes</phrase></refentrytitle>
38752 <manvolnum>9</manvolnum>
38753 <refmiscinfo class="version">4.4.14</refmiscinfo>
38754</refmeta>
38755<refnamediv>
38756 <refname>snd_pcm_lib_period_bytes</refname>
38757 <refpurpose>
38758     Get the period size of the current PCM in bytes
38759 </refpurpose>
38760</refnamediv>
38761<refsynopsisdiv>
38762 <title>Synopsis</title>
38763  <funcsynopsis><funcprototype>
38764   <funcdef>size_t <function>snd_pcm_lib_period_bytes </function></funcdef>
38765   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38766  </funcprototype></funcsynopsis>
38767</refsynopsisdiv>
38768<refsect1>
38769 <title>Arguments</title>
38770 <variablelist>
38771  <varlistentry>
38772   <term><parameter>substream</parameter></term>
38773   <listitem>
38774    <para>
38775     PCM substream
38776    </para>
38777   </listitem>
38778  </varlistentry>
38779 </variablelist>
38780</refsect1>
38781</refentry>
38782
38783<refentry id="API-snd-pcm-playback-avail">
38784<refentryinfo>
38785 <title>LINUX</title>
38786 <productname>Kernel Hackers Manual</productname>
38787 <date>July 2017</date>
38788</refentryinfo>
38789<refmeta>
38790 <refentrytitle><phrase>snd_pcm_playback_avail</phrase></refentrytitle>
38791 <manvolnum>9</manvolnum>
38792 <refmiscinfo class="version">4.4.14</refmiscinfo>
38793</refmeta>
38794<refnamediv>
38795 <refname>snd_pcm_playback_avail</refname>
38796 <refpurpose>
38797     Get the available (writable) space for playback
38798 </refpurpose>
38799</refnamediv>
38800<refsynopsisdiv>
38801 <title>Synopsis</title>
38802  <funcsynopsis><funcprototype>
38803   <funcdef>snd_pcm_uframes_t <function>snd_pcm_playback_avail </function></funcdef>
38804   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38805  </funcprototype></funcsynopsis>
38806</refsynopsisdiv>
38807<refsect1>
38808 <title>Arguments</title>
38809 <variablelist>
38810  <varlistentry>
38811   <term><parameter>runtime</parameter></term>
38812   <listitem>
38813    <para>
38814     PCM runtime instance
38815    </para>
38816   </listitem>
38817  </varlistentry>
38818 </variablelist>
38819</refsect1>
38820<refsect1>
38821<title>Description</title>
38822<para>
38823   Result is between 0 ... (boundary - 1)
38824</para>
38825</refsect1>
38826</refentry>
38827
38828<refentry id="API-snd-pcm-capture-avail">
38829<refentryinfo>
38830 <title>LINUX</title>
38831 <productname>Kernel Hackers Manual</productname>
38832 <date>July 2017</date>
38833</refentryinfo>
38834<refmeta>
38835 <refentrytitle><phrase>snd_pcm_capture_avail</phrase></refentrytitle>
38836 <manvolnum>9</manvolnum>
38837 <refmiscinfo class="version">4.4.14</refmiscinfo>
38838</refmeta>
38839<refnamediv>
38840 <refname>snd_pcm_capture_avail</refname>
38841 <refpurpose>
38842     Get the available (readable) space for capture
38843 </refpurpose>
38844</refnamediv>
38845<refsynopsisdiv>
38846 <title>Synopsis</title>
38847  <funcsynopsis><funcprototype>
38848   <funcdef>snd_pcm_uframes_t <function>snd_pcm_capture_avail </function></funcdef>
38849   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38850  </funcprototype></funcsynopsis>
38851</refsynopsisdiv>
38852<refsect1>
38853 <title>Arguments</title>
38854 <variablelist>
38855  <varlistentry>
38856   <term><parameter>runtime</parameter></term>
38857   <listitem>
38858    <para>
38859     PCM runtime instance
38860    </para>
38861   </listitem>
38862  </varlistentry>
38863 </variablelist>
38864</refsect1>
38865<refsect1>
38866<title>Description</title>
38867<para>
38868   Result is between 0 ... (boundary - 1)
38869</para>
38870</refsect1>
38871</refentry>
38872
38873<refentry id="API-snd-pcm-playback-hw-avail">
38874<refentryinfo>
38875 <title>LINUX</title>
38876 <productname>Kernel Hackers Manual</productname>
38877 <date>July 2017</date>
38878</refentryinfo>
38879<refmeta>
38880 <refentrytitle><phrase>snd_pcm_playback_hw_avail</phrase></refentrytitle>
38881 <manvolnum>9</manvolnum>
38882 <refmiscinfo class="version">4.4.14</refmiscinfo>
38883</refmeta>
38884<refnamediv>
38885 <refname>snd_pcm_playback_hw_avail</refname>
38886 <refpurpose>
38887     Get the queued space for playback
38888 </refpurpose>
38889</refnamediv>
38890<refsynopsisdiv>
38891 <title>Synopsis</title>
38892  <funcsynopsis><funcprototype>
38893   <funcdef>snd_pcm_sframes_t <function>snd_pcm_playback_hw_avail </function></funcdef>
38894   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38895  </funcprototype></funcsynopsis>
38896</refsynopsisdiv>
38897<refsect1>
38898 <title>Arguments</title>
38899 <variablelist>
38900  <varlistentry>
38901   <term><parameter>runtime</parameter></term>
38902   <listitem>
38903    <para>
38904     PCM runtime instance
38905    </para>
38906   </listitem>
38907  </varlistentry>
38908 </variablelist>
38909</refsect1>
38910</refentry>
38911
38912<refentry id="API-snd-pcm-capture-hw-avail">
38913<refentryinfo>
38914 <title>LINUX</title>
38915 <productname>Kernel Hackers Manual</productname>
38916 <date>July 2017</date>
38917</refentryinfo>
38918<refmeta>
38919 <refentrytitle><phrase>snd_pcm_capture_hw_avail</phrase></refentrytitle>
38920 <manvolnum>9</manvolnum>
38921 <refmiscinfo class="version">4.4.14</refmiscinfo>
38922</refmeta>
38923<refnamediv>
38924 <refname>snd_pcm_capture_hw_avail</refname>
38925 <refpurpose>
38926     Get the free space for capture
38927 </refpurpose>
38928</refnamediv>
38929<refsynopsisdiv>
38930 <title>Synopsis</title>
38931  <funcsynopsis><funcprototype>
38932   <funcdef>snd_pcm_sframes_t <function>snd_pcm_capture_hw_avail </function></funcdef>
38933   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
38934  </funcprototype></funcsynopsis>
38935</refsynopsisdiv>
38936<refsect1>
38937 <title>Arguments</title>
38938 <variablelist>
38939  <varlistentry>
38940   <term><parameter>runtime</parameter></term>
38941   <listitem>
38942    <para>
38943     PCM runtime instance
38944    </para>
38945   </listitem>
38946  </varlistentry>
38947 </variablelist>
38948</refsect1>
38949</refentry>
38950
38951<refentry id="API-snd-pcm-playback-ready">
38952<refentryinfo>
38953 <title>LINUX</title>
38954 <productname>Kernel Hackers Manual</productname>
38955 <date>July 2017</date>
38956</refentryinfo>
38957<refmeta>
38958 <refentrytitle><phrase>snd_pcm_playback_ready</phrase></refentrytitle>
38959 <manvolnum>9</manvolnum>
38960 <refmiscinfo class="version">4.4.14</refmiscinfo>
38961</refmeta>
38962<refnamediv>
38963 <refname>snd_pcm_playback_ready</refname>
38964 <refpurpose>
38965     check whether the playback buffer is available
38966 </refpurpose>
38967</refnamediv>
38968<refsynopsisdiv>
38969 <title>Synopsis</title>
38970  <funcsynopsis><funcprototype>
38971   <funcdef>int <function>snd_pcm_playback_ready </function></funcdef>
38972   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
38973  </funcprototype></funcsynopsis>
38974</refsynopsisdiv>
38975<refsect1>
38976 <title>Arguments</title>
38977 <variablelist>
38978  <varlistentry>
38979   <term><parameter>substream</parameter></term>
38980   <listitem>
38981    <para>
38982     the pcm substream instance
38983    </para>
38984   </listitem>
38985  </varlistentry>
38986 </variablelist>
38987</refsect1>
38988<refsect1>
38989<title>Description</title>
38990<para>
38991   Checks whether enough free space is available on the playback buffer.
38992</para>
38993</refsect1>
38994<refsect1>
38995<title>Return</title>
38996<para>
38997   Non-zero if available, or zero if not.
38998</para>
38999</refsect1>
39000</refentry>
39001
39002<refentry id="API-snd-pcm-capture-ready">
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_capture_ready</phrase></refentrytitle>
39010 <manvolnum>9</manvolnum>
39011 <refmiscinfo class="version">4.4.14</refmiscinfo>
39012</refmeta>
39013<refnamediv>
39014 <refname>snd_pcm_capture_ready</refname>
39015 <refpurpose>
39016     check whether the capture buffer is available
39017 </refpurpose>
39018</refnamediv>
39019<refsynopsisdiv>
39020 <title>Synopsis</title>
39021  <funcsynopsis><funcprototype>
39022   <funcdef>int <function>snd_pcm_capture_ready </function></funcdef>
39023   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39024  </funcprototype></funcsynopsis>
39025</refsynopsisdiv>
39026<refsect1>
39027 <title>Arguments</title>
39028 <variablelist>
39029  <varlistentry>
39030   <term><parameter>substream</parameter></term>
39031   <listitem>
39032    <para>
39033     the pcm substream instance
39034    </para>
39035   </listitem>
39036  </varlistentry>
39037 </variablelist>
39038</refsect1>
39039<refsect1>
39040<title>Description</title>
39041<para>
39042   Checks whether enough capture data is available on the capture buffer.
39043</para>
39044</refsect1>
39045<refsect1>
39046<title>Return</title>
39047<para>
39048   Non-zero if available, or zero if not.
39049</para>
39050</refsect1>
39051</refentry>
39052
39053<refentry id="API-snd-pcm-playback-data">
39054<refentryinfo>
39055 <title>LINUX</title>
39056 <productname>Kernel Hackers Manual</productname>
39057 <date>July 2017</date>
39058</refentryinfo>
39059<refmeta>
39060 <refentrytitle><phrase>snd_pcm_playback_data</phrase></refentrytitle>
39061 <manvolnum>9</manvolnum>
39062 <refmiscinfo class="version">4.4.14</refmiscinfo>
39063</refmeta>
39064<refnamediv>
39065 <refname>snd_pcm_playback_data</refname>
39066 <refpurpose>
39067     check whether any data exists on the playback buffer
39068 </refpurpose>
39069</refnamediv>
39070<refsynopsisdiv>
39071 <title>Synopsis</title>
39072  <funcsynopsis><funcprototype>
39073   <funcdef>int <function>snd_pcm_playback_data </function></funcdef>
39074   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39075  </funcprototype></funcsynopsis>
39076</refsynopsisdiv>
39077<refsect1>
39078 <title>Arguments</title>
39079 <variablelist>
39080  <varlistentry>
39081   <term><parameter>substream</parameter></term>
39082   <listitem>
39083    <para>
39084     the pcm substream instance
39085    </para>
39086   </listitem>
39087  </varlistentry>
39088 </variablelist>
39089</refsect1>
39090<refsect1>
39091<title>Description</title>
39092<para>
39093   Checks whether any data exists on the playback buffer.
39094</para>
39095</refsect1>
39096<refsect1>
39097<title>Return</title>
39098<para>
39099   Non-zero if any data exists, or zero if not. If stop_threshold
39100   is bigger or equal to boundary, then this function returns always non-zero.
39101</para>
39102</refsect1>
39103</refentry>
39104
39105<refentry id="API-snd-pcm-playback-empty">
39106<refentryinfo>
39107 <title>LINUX</title>
39108 <productname>Kernel Hackers Manual</productname>
39109 <date>July 2017</date>
39110</refentryinfo>
39111<refmeta>
39112 <refentrytitle><phrase>snd_pcm_playback_empty</phrase></refentrytitle>
39113 <manvolnum>9</manvolnum>
39114 <refmiscinfo class="version">4.4.14</refmiscinfo>
39115</refmeta>
39116<refnamediv>
39117 <refname>snd_pcm_playback_empty</refname>
39118 <refpurpose>
39119     check whether the playback buffer is empty
39120 </refpurpose>
39121</refnamediv>
39122<refsynopsisdiv>
39123 <title>Synopsis</title>
39124  <funcsynopsis><funcprototype>
39125   <funcdef>int <function>snd_pcm_playback_empty </function></funcdef>
39126   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39127  </funcprototype></funcsynopsis>
39128</refsynopsisdiv>
39129<refsect1>
39130 <title>Arguments</title>
39131 <variablelist>
39132  <varlistentry>
39133   <term><parameter>substream</parameter></term>
39134   <listitem>
39135    <para>
39136     the pcm substream instance
39137    </para>
39138   </listitem>
39139  </varlistentry>
39140 </variablelist>
39141</refsect1>
39142<refsect1>
39143<title>Description</title>
39144<para>
39145   Checks whether the playback buffer is empty.
39146</para>
39147</refsect1>
39148<refsect1>
39149<title>Return</title>
39150<para>
39151   Non-zero if empty, or zero if not.
39152</para>
39153</refsect1>
39154</refentry>
39155
39156<refentry id="API-snd-pcm-capture-empty">
39157<refentryinfo>
39158 <title>LINUX</title>
39159 <productname>Kernel Hackers Manual</productname>
39160 <date>July 2017</date>
39161</refentryinfo>
39162<refmeta>
39163 <refentrytitle><phrase>snd_pcm_capture_empty</phrase></refentrytitle>
39164 <manvolnum>9</manvolnum>
39165 <refmiscinfo class="version">4.4.14</refmiscinfo>
39166</refmeta>
39167<refnamediv>
39168 <refname>snd_pcm_capture_empty</refname>
39169 <refpurpose>
39170     check whether the capture buffer is empty
39171 </refpurpose>
39172</refnamediv>
39173<refsynopsisdiv>
39174 <title>Synopsis</title>
39175  <funcsynopsis><funcprototype>
39176   <funcdef>int <function>snd_pcm_capture_empty </function></funcdef>
39177   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39178  </funcprototype></funcsynopsis>
39179</refsynopsisdiv>
39180<refsect1>
39181 <title>Arguments</title>
39182 <variablelist>
39183  <varlistentry>
39184   <term><parameter>substream</parameter></term>
39185   <listitem>
39186    <para>
39187     the pcm substream instance
39188    </para>
39189   </listitem>
39190  </varlistentry>
39191 </variablelist>
39192</refsect1>
39193<refsect1>
39194<title>Description</title>
39195<para>
39196   Checks whether the capture buffer is empty.
39197</para>
39198</refsect1>
39199<refsect1>
39200<title>Return</title>
39201<para>
39202   Non-zero if empty, or zero if not.
39203</para>
39204</refsect1>
39205</refentry>
39206
39207<refentry id="API-snd-pcm-trigger-done">
39208<refentryinfo>
39209 <title>LINUX</title>
39210 <productname>Kernel Hackers Manual</productname>
39211 <date>July 2017</date>
39212</refentryinfo>
39213<refmeta>
39214 <refentrytitle><phrase>snd_pcm_trigger_done</phrase></refentrytitle>
39215 <manvolnum>9</manvolnum>
39216 <refmiscinfo class="version">4.4.14</refmiscinfo>
39217</refmeta>
39218<refnamediv>
39219 <refname>snd_pcm_trigger_done</refname>
39220 <refpurpose>
39221     Mark the master substream
39222 </refpurpose>
39223</refnamediv>
39224<refsynopsisdiv>
39225 <title>Synopsis</title>
39226  <funcsynopsis><funcprototype>
39227   <funcdef>void <function>snd_pcm_trigger_done </function></funcdef>
39228   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39229   <paramdef>struct snd_pcm_substream * <parameter>master</parameter></paramdef>
39230  </funcprototype></funcsynopsis>
39231</refsynopsisdiv>
39232<refsect1>
39233 <title>Arguments</title>
39234 <variablelist>
39235  <varlistentry>
39236   <term><parameter>substream</parameter></term>
39237   <listitem>
39238    <para>
39239     the pcm substream instance
39240    </para>
39241   </listitem>
39242  </varlistentry>
39243  <varlistentry>
39244   <term><parameter>master</parameter></term>
39245   <listitem>
39246    <para>
39247     the linked master substream
39248    </para>
39249   </listitem>
39250  </varlistentry>
39251 </variablelist>
39252</refsect1>
39253<refsect1>
39254<title>Description</title>
39255<para>
39256   When multiple substreams of the same card are linked and the hardware
39257   supports the single-shot operation, the driver calls this in the loop
39258   in <function><link linkend="API-snd-pcm-group-for-each-entry">snd_pcm_group_for_each_entry</link></function> for marking the substream as <quote>done</quote>.
39259   Then most of trigger operations are performed only to the given master
39260   substream.
39261   </para><para>
39262
39263   The trigger_master mark is cleared at timestamp updates at the end
39264   of trigger operations.
39265</para>
39266</refsect1>
39267</refentry>
39268
39269<refentry id="API-params-channels">
39270<refentryinfo>
39271 <title>LINUX</title>
39272 <productname>Kernel Hackers Manual</productname>
39273 <date>July 2017</date>
39274</refentryinfo>
39275<refmeta>
39276 <refentrytitle><phrase>params_channels</phrase></refentrytitle>
39277 <manvolnum>9</manvolnum>
39278 <refmiscinfo class="version">4.4.14</refmiscinfo>
39279</refmeta>
39280<refnamediv>
39281 <refname>params_channels</refname>
39282 <refpurpose>
39283     Get the number of channels from the hw params
39284 </refpurpose>
39285</refnamediv>
39286<refsynopsisdiv>
39287 <title>Synopsis</title>
39288  <funcsynopsis><funcprototype>
39289   <funcdef>unsigned int <function>params_channels </function></funcdef>
39290   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
39291  </funcprototype></funcsynopsis>
39292</refsynopsisdiv>
39293<refsect1>
39294 <title>Arguments</title>
39295 <variablelist>
39296  <varlistentry>
39297   <term><parameter>p</parameter></term>
39298   <listitem>
39299    <para>
39300     hw params
39301    </para>
39302   </listitem>
39303  </varlistentry>
39304 </variablelist>
39305</refsect1>
39306</refentry>
39307
39308<refentry id="API-params-rate">
39309<refentryinfo>
39310 <title>LINUX</title>
39311 <productname>Kernel Hackers Manual</productname>
39312 <date>July 2017</date>
39313</refentryinfo>
39314<refmeta>
39315 <refentrytitle><phrase>params_rate</phrase></refentrytitle>
39316 <manvolnum>9</manvolnum>
39317 <refmiscinfo class="version">4.4.14</refmiscinfo>
39318</refmeta>
39319<refnamediv>
39320 <refname>params_rate</refname>
39321 <refpurpose>
39322     Get the sample rate from the hw params
39323 </refpurpose>
39324</refnamediv>
39325<refsynopsisdiv>
39326 <title>Synopsis</title>
39327  <funcsynopsis><funcprototype>
39328   <funcdef>unsigned int <function>params_rate </function></funcdef>
39329   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
39330  </funcprototype></funcsynopsis>
39331</refsynopsisdiv>
39332<refsect1>
39333 <title>Arguments</title>
39334 <variablelist>
39335  <varlistentry>
39336   <term><parameter>p</parameter></term>
39337   <listitem>
39338    <para>
39339     hw params
39340    </para>
39341   </listitem>
39342  </varlistentry>
39343 </variablelist>
39344</refsect1>
39345</refentry>
39346
39347<refentry id="API-params-period-size">
39348<refentryinfo>
39349 <title>LINUX</title>
39350 <productname>Kernel Hackers Manual</productname>
39351 <date>July 2017</date>
39352</refentryinfo>
39353<refmeta>
39354 <refentrytitle><phrase>params_period_size</phrase></refentrytitle>
39355 <manvolnum>9</manvolnum>
39356 <refmiscinfo class="version">4.4.14</refmiscinfo>
39357</refmeta>
39358<refnamediv>
39359 <refname>params_period_size</refname>
39360 <refpurpose>
39361     Get the period size (in frames) from the hw params
39362 </refpurpose>
39363</refnamediv>
39364<refsynopsisdiv>
39365 <title>Synopsis</title>
39366  <funcsynopsis><funcprototype>
39367   <funcdef>unsigned int <function>params_period_size </function></funcdef>
39368   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
39369  </funcprototype></funcsynopsis>
39370</refsynopsisdiv>
39371<refsect1>
39372 <title>Arguments</title>
39373 <variablelist>
39374  <varlistentry>
39375   <term><parameter>p</parameter></term>
39376   <listitem>
39377    <para>
39378     hw params
39379    </para>
39380   </listitem>
39381  </varlistentry>
39382 </variablelist>
39383</refsect1>
39384</refentry>
39385
39386<refentry id="API-params-periods">
39387<refentryinfo>
39388 <title>LINUX</title>
39389 <productname>Kernel Hackers Manual</productname>
39390 <date>July 2017</date>
39391</refentryinfo>
39392<refmeta>
39393 <refentrytitle><phrase>params_periods</phrase></refentrytitle>
39394 <manvolnum>9</manvolnum>
39395 <refmiscinfo class="version">4.4.14</refmiscinfo>
39396</refmeta>
39397<refnamediv>
39398 <refname>params_periods</refname>
39399 <refpurpose>
39400     Get the number of periods from the hw params
39401 </refpurpose>
39402</refnamediv>
39403<refsynopsisdiv>
39404 <title>Synopsis</title>
39405  <funcsynopsis><funcprototype>
39406   <funcdef>unsigned int <function>params_periods </function></funcdef>
39407   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
39408  </funcprototype></funcsynopsis>
39409</refsynopsisdiv>
39410<refsect1>
39411 <title>Arguments</title>
39412 <variablelist>
39413  <varlistentry>
39414   <term><parameter>p</parameter></term>
39415   <listitem>
39416    <para>
39417     hw params
39418    </para>
39419   </listitem>
39420  </varlistentry>
39421 </variablelist>
39422</refsect1>
39423</refentry>
39424
39425<refentry id="API-params-buffer-size">
39426<refentryinfo>
39427 <title>LINUX</title>
39428 <productname>Kernel Hackers Manual</productname>
39429 <date>July 2017</date>
39430</refentryinfo>
39431<refmeta>
39432 <refentrytitle><phrase>params_buffer_size</phrase></refentrytitle>
39433 <manvolnum>9</manvolnum>
39434 <refmiscinfo class="version">4.4.14</refmiscinfo>
39435</refmeta>
39436<refnamediv>
39437 <refname>params_buffer_size</refname>
39438 <refpurpose>
39439     Get the buffer size (in frames) from the hw params
39440 </refpurpose>
39441</refnamediv>
39442<refsynopsisdiv>
39443 <title>Synopsis</title>
39444  <funcsynopsis><funcprototype>
39445   <funcdef>unsigned int <function>params_buffer_size </function></funcdef>
39446   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
39447  </funcprototype></funcsynopsis>
39448</refsynopsisdiv>
39449<refsect1>
39450 <title>Arguments</title>
39451 <variablelist>
39452  <varlistentry>
39453   <term><parameter>p</parameter></term>
39454   <listitem>
39455    <para>
39456     hw params
39457    </para>
39458   </listitem>
39459  </varlistentry>
39460 </variablelist>
39461</refsect1>
39462</refentry>
39463
39464<refentry id="API-params-buffer-bytes">
39465<refentryinfo>
39466 <title>LINUX</title>
39467 <productname>Kernel Hackers Manual</productname>
39468 <date>July 2017</date>
39469</refentryinfo>
39470<refmeta>
39471 <refentrytitle><phrase>params_buffer_bytes</phrase></refentrytitle>
39472 <manvolnum>9</manvolnum>
39473 <refmiscinfo class="version">4.4.14</refmiscinfo>
39474</refmeta>
39475<refnamediv>
39476 <refname>params_buffer_bytes</refname>
39477 <refpurpose>
39478     Get the buffer size (in bytes) from the hw params
39479 </refpurpose>
39480</refnamediv>
39481<refsynopsisdiv>
39482 <title>Synopsis</title>
39483  <funcsynopsis><funcprototype>
39484   <funcdef>unsigned int <function>params_buffer_bytes </function></funcdef>
39485   <paramdef>const struct snd_pcm_hw_params * <parameter>p</parameter></paramdef>
39486  </funcprototype></funcsynopsis>
39487</refsynopsisdiv>
39488<refsect1>
39489 <title>Arguments</title>
39490 <variablelist>
39491  <varlistentry>
39492   <term><parameter>p</parameter></term>
39493   <listitem>
39494    <para>
39495     hw params
39496    </para>
39497   </listitem>
39498  </varlistentry>
39499 </variablelist>
39500</refsect1>
39501</refentry>
39502
39503<refentry id="API-snd-pcm-hw-constraint-single">
39504<refentryinfo>
39505 <title>LINUX</title>
39506 <productname>Kernel Hackers Manual</productname>
39507 <date>July 2017</date>
39508</refentryinfo>
39509<refmeta>
39510 <refentrytitle><phrase>snd_pcm_hw_constraint_single</phrase></refentrytitle>
39511 <manvolnum>9</manvolnum>
39512 <refmiscinfo class="version">4.4.14</refmiscinfo>
39513</refmeta>
39514<refnamediv>
39515 <refname>snd_pcm_hw_constraint_single</refname>
39516 <refpurpose>
39517     Constrain parameter to a single value
39518 </refpurpose>
39519</refnamediv>
39520<refsynopsisdiv>
39521 <title>Synopsis</title>
39522  <funcsynopsis><funcprototype>
39523   <funcdef>int <function>snd_pcm_hw_constraint_single </function></funcdef>
39524   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
39525   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
39526   <paramdef>unsigned int <parameter>val</parameter></paramdef>
39527  </funcprototype></funcsynopsis>
39528</refsynopsisdiv>
39529<refsect1>
39530 <title>Arguments</title>
39531 <variablelist>
39532  <varlistentry>
39533   <term><parameter>runtime</parameter></term>
39534   <listitem>
39535    <para>
39536     PCM runtime instance
39537    </para>
39538   </listitem>
39539  </varlistentry>
39540  <varlistentry>
39541   <term><parameter>var</parameter></term>
39542   <listitem>
39543    <para>
39544     The hw_params variable to constrain
39545    </para>
39546   </listitem>
39547  </varlistentry>
39548  <varlistentry>
39549   <term><parameter>val</parameter></term>
39550   <listitem>
39551    <para>
39552     The value to constrain to
39553    </para>
39554   </listitem>
39555  </varlistentry>
39556 </variablelist>
39557</refsect1>
39558<refsect1>
39559<title>Return</title>
39560<para>
39561   Positive if the value is changed, zero if it's not changed, or a
39562   negative error code.
39563</para>
39564</refsect1>
39565</refentry>
39566
39567<refentry id="API-snd-pcm-format-cpu-endian">
39568<refentryinfo>
39569 <title>LINUX</title>
39570 <productname>Kernel Hackers Manual</productname>
39571 <date>July 2017</date>
39572</refentryinfo>
39573<refmeta>
39574 <refentrytitle><phrase>snd_pcm_format_cpu_endian</phrase></refentrytitle>
39575 <manvolnum>9</manvolnum>
39576 <refmiscinfo class="version">4.4.14</refmiscinfo>
39577</refmeta>
39578<refnamediv>
39579 <refname>snd_pcm_format_cpu_endian</refname>
39580 <refpurpose>
39581     Check the PCM format is CPU-endian
39582 </refpurpose>
39583</refnamediv>
39584<refsynopsisdiv>
39585 <title>Synopsis</title>
39586  <funcsynopsis><funcprototype>
39587   <funcdef>int <function>snd_pcm_format_cpu_endian </function></funcdef>
39588   <paramdef>snd_pcm_format_t <parameter>format</parameter></paramdef>
39589  </funcprototype></funcsynopsis>
39590</refsynopsisdiv>
39591<refsect1>
39592 <title>Arguments</title>
39593 <variablelist>
39594  <varlistentry>
39595   <term><parameter>format</parameter></term>
39596   <listitem>
39597    <para>
39598     the format to check
39599    </para>
39600   </listitem>
39601  </varlistentry>
39602 </variablelist>
39603</refsect1>
39604<refsect1>
39605<title>Return</title>
39606<para>
39607   1 if the given PCM format is CPU-endian, 0 if
39608   opposite, or a negative error code if endian not specified.
39609</para>
39610</refsect1>
39611</refentry>
39612
39613<refentry id="API-snd-pcm-set-runtime-buffer">
39614<refentryinfo>
39615 <title>LINUX</title>
39616 <productname>Kernel Hackers Manual</productname>
39617 <date>July 2017</date>
39618</refentryinfo>
39619<refmeta>
39620 <refentrytitle><phrase>snd_pcm_set_runtime_buffer</phrase></refentrytitle>
39621 <manvolnum>9</manvolnum>
39622 <refmiscinfo class="version">4.4.14</refmiscinfo>
39623</refmeta>
39624<refnamediv>
39625 <refname>snd_pcm_set_runtime_buffer</refname>
39626 <refpurpose>
39627     Set the PCM runtime buffer
39628 </refpurpose>
39629</refnamediv>
39630<refsynopsisdiv>
39631 <title>Synopsis</title>
39632  <funcsynopsis><funcprototype>
39633   <funcdef>void <function>snd_pcm_set_runtime_buffer </function></funcdef>
39634   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39635   <paramdef>struct snd_dma_buffer * <parameter>bufp</parameter></paramdef>
39636  </funcprototype></funcsynopsis>
39637</refsynopsisdiv>
39638<refsect1>
39639 <title>Arguments</title>
39640 <variablelist>
39641  <varlistentry>
39642   <term><parameter>substream</parameter></term>
39643   <listitem>
39644    <para>
39645     PCM substream to set
39646    </para>
39647   </listitem>
39648  </varlistentry>
39649  <varlistentry>
39650   <term><parameter>bufp</parameter></term>
39651   <listitem>
39652    <para>
39653     the buffer information, NULL to clear
39654    </para>
39655   </listitem>
39656  </varlistentry>
39657 </variablelist>
39658</refsect1>
39659<refsect1>
39660<title>Description</title>
39661<para>
39662   Copy the buffer information to runtime-&gt;dma_buffer when <parameter>bufp</parameter> is non-NULL.
39663   Otherwise it clears the current buffer information.
39664</para>
39665</refsect1>
39666</refentry>
39667
39668<refentry id="API-snd-pcm-gettime">
39669<refentryinfo>
39670 <title>LINUX</title>
39671 <productname>Kernel Hackers Manual</productname>
39672 <date>July 2017</date>
39673</refentryinfo>
39674<refmeta>
39675 <refentrytitle><phrase>snd_pcm_gettime</phrase></refentrytitle>
39676 <manvolnum>9</manvolnum>
39677 <refmiscinfo class="version">4.4.14</refmiscinfo>
39678</refmeta>
39679<refnamediv>
39680 <refname>snd_pcm_gettime</refname>
39681 <refpurpose>
39682     Fill the timespec depending on the timestamp mode
39683 </refpurpose>
39684</refnamediv>
39685<refsynopsisdiv>
39686 <title>Synopsis</title>
39687  <funcsynopsis><funcprototype>
39688   <funcdef>void <function>snd_pcm_gettime </function></funcdef>
39689   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
39690   <paramdef>struct timespec * <parameter>tv</parameter></paramdef>
39691  </funcprototype></funcsynopsis>
39692</refsynopsisdiv>
39693<refsect1>
39694 <title>Arguments</title>
39695 <variablelist>
39696  <varlistentry>
39697   <term><parameter>runtime</parameter></term>
39698   <listitem>
39699    <para>
39700     PCM runtime instance
39701    </para>
39702   </listitem>
39703  </varlistentry>
39704  <varlistentry>
39705   <term><parameter>tv</parameter></term>
39706   <listitem>
39707    <para>
39708     timespec to fill
39709    </para>
39710   </listitem>
39711  </varlistentry>
39712 </variablelist>
39713</refsect1>
39714</refentry>
39715
39716<refentry id="API-snd-pcm-lib-alloc-vmalloc-buffer">
39717<refentryinfo>
39718 <title>LINUX</title>
39719 <productname>Kernel Hackers Manual</productname>
39720 <date>July 2017</date>
39721</refentryinfo>
39722<refmeta>
39723 <refentrytitle><phrase>snd_pcm_lib_alloc_vmalloc_buffer</phrase></refentrytitle>
39724 <manvolnum>9</manvolnum>
39725 <refmiscinfo class="version">4.4.14</refmiscinfo>
39726</refmeta>
39727<refnamediv>
39728 <refname>snd_pcm_lib_alloc_vmalloc_buffer</refname>
39729 <refpurpose>
39730     allocate virtual DMA buffer
39731 </refpurpose>
39732</refnamediv>
39733<refsynopsisdiv>
39734 <title>Synopsis</title>
39735  <funcsynopsis><funcprototype>
39736   <funcdef>int <function>snd_pcm_lib_alloc_vmalloc_buffer </function></funcdef>
39737   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39738   <paramdef>size_t <parameter>size</parameter></paramdef>
39739  </funcprototype></funcsynopsis>
39740</refsynopsisdiv>
39741<refsect1>
39742 <title>Arguments</title>
39743 <variablelist>
39744  <varlistentry>
39745   <term><parameter>substream</parameter></term>
39746   <listitem>
39747    <para>
39748     the substream to allocate the buffer to
39749    </para>
39750   </listitem>
39751  </varlistentry>
39752  <varlistentry>
39753   <term><parameter>size</parameter></term>
39754   <listitem>
39755    <para>
39756     the requested buffer size, in bytes
39757    </para>
39758   </listitem>
39759  </varlistentry>
39760 </variablelist>
39761</refsect1>
39762<refsect1>
39763<title>Description</title>
39764<para>
39765   Allocates the PCM substream buffer using <function>vmalloc</function>, i.e., the memory is
39766   contiguous in kernel virtual space, but not in physical memory.  Use this
39767   if the buffer is accessed by kernel code but not by device DMA.
39768</para>
39769</refsect1>
39770<refsect1>
39771<title>Return</title>
39772<para>
39773   1 if the buffer was changed, 0 if not changed, or a negative error
39774   code.
39775</para>
39776</refsect1>
39777</refentry>
39778
39779<refentry id="API-snd-pcm-lib-alloc-vmalloc-32-buffer">
39780<refentryinfo>
39781 <title>LINUX</title>
39782 <productname>Kernel Hackers Manual</productname>
39783 <date>July 2017</date>
39784</refentryinfo>
39785<refmeta>
39786 <refentrytitle><phrase>snd_pcm_lib_alloc_vmalloc_32_buffer</phrase></refentrytitle>
39787 <manvolnum>9</manvolnum>
39788 <refmiscinfo class="version">4.4.14</refmiscinfo>
39789</refmeta>
39790<refnamediv>
39791 <refname>snd_pcm_lib_alloc_vmalloc_32_buffer</refname>
39792 <refpurpose>
39793     allocate 32-bit-addressable buffer
39794 </refpurpose>
39795</refnamediv>
39796<refsynopsisdiv>
39797 <title>Synopsis</title>
39798  <funcsynopsis><funcprototype>
39799   <funcdef>int <function>snd_pcm_lib_alloc_vmalloc_32_buffer </function></funcdef>
39800   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39801   <paramdef>size_t <parameter>size</parameter></paramdef>
39802  </funcprototype></funcsynopsis>
39803</refsynopsisdiv>
39804<refsect1>
39805 <title>Arguments</title>
39806 <variablelist>
39807  <varlistentry>
39808   <term><parameter>substream</parameter></term>
39809   <listitem>
39810    <para>
39811     the substream to allocate the buffer to
39812    </para>
39813   </listitem>
39814  </varlistentry>
39815  <varlistentry>
39816   <term><parameter>size</parameter></term>
39817   <listitem>
39818    <para>
39819     the requested buffer size, in bytes
39820    </para>
39821   </listitem>
39822  </varlistentry>
39823 </variablelist>
39824</refsect1>
39825<refsect1>
39826<title>Description</title>
39827<para>
39828   This function works like <function><link linkend="API-snd-pcm-lib-alloc-vmalloc-buffer">snd_pcm_lib_alloc_vmalloc_buffer</link></function>, but uses
39829   <function>vmalloc_32</function>, i.e., the pages are allocated from 32-bit-addressable memory.
39830</para>
39831</refsect1>
39832<refsect1>
39833<title>Return</title>
39834<para>
39835   1 if the buffer was changed, 0 if not changed, or a negative error
39836   code.
39837</para>
39838</refsect1>
39839</refentry>
39840
39841<refentry id="API-snd-pcm-sgbuf-get-addr">
39842<refentryinfo>
39843 <title>LINUX</title>
39844 <productname>Kernel Hackers Manual</productname>
39845 <date>July 2017</date>
39846</refentryinfo>
39847<refmeta>
39848 <refentrytitle><phrase>snd_pcm_sgbuf_get_addr</phrase></refentrytitle>
39849 <manvolnum>9</manvolnum>
39850 <refmiscinfo class="version">4.4.14</refmiscinfo>
39851</refmeta>
39852<refnamediv>
39853 <refname>snd_pcm_sgbuf_get_addr</refname>
39854 <refpurpose>
39855     Get the DMA address at the corresponding offset
39856 </refpurpose>
39857</refnamediv>
39858<refsynopsisdiv>
39859 <title>Synopsis</title>
39860  <funcsynopsis><funcprototype>
39861   <funcdef>dma_addr_t <function>snd_pcm_sgbuf_get_addr </function></funcdef>
39862   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39863   <paramdef>unsigned int <parameter>ofs</parameter></paramdef>
39864  </funcprototype></funcsynopsis>
39865</refsynopsisdiv>
39866<refsect1>
39867 <title>Arguments</title>
39868 <variablelist>
39869  <varlistentry>
39870   <term><parameter>substream</parameter></term>
39871   <listitem>
39872    <para>
39873     PCM substream
39874    </para>
39875   </listitem>
39876  </varlistentry>
39877  <varlistentry>
39878   <term><parameter>ofs</parameter></term>
39879   <listitem>
39880    <para>
39881     byte offset
39882    </para>
39883   </listitem>
39884  </varlistentry>
39885 </variablelist>
39886</refsect1>
39887</refentry>
39888
39889<refentry id="API-snd-pcm-sgbuf-get-ptr">
39890<refentryinfo>
39891 <title>LINUX</title>
39892 <productname>Kernel Hackers Manual</productname>
39893 <date>July 2017</date>
39894</refentryinfo>
39895<refmeta>
39896 <refentrytitle><phrase>snd_pcm_sgbuf_get_ptr</phrase></refentrytitle>
39897 <manvolnum>9</manvolnum>
39898 <refmiscinfo class="version">4.4.14</refmiscinfo>
39899</refmeta>
39900<refnamediv>
39901 <refname>snd_pcm_sgbuf_get_ptr</refname>
39902 <refpurpose>
39903     Get the virtual address at the corresponding offset
39904 </refpurpose>
39905</refnamediv>
39906<refsynopsisdiv>
39907 <title>Synopsis</title>
39908  <funcsynopsis><funcprototype>
39909   <funcdef>void * <function>snd_pcm_sgbuf_get_ptr </function></funcdef>
39910   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39911   <paramdef>unsigned int <parameter>ofs</parameter></paramdef>
39912  </funcprototype></funcsynopsis>
39913</refsynopsisdiv>
39914<refsect1>
39915 <title>Arguments</title>
39916 <variablelist>
39917  <varlistentry>
39918   <term><parameter>substream</parameter></term>
39919   <listitem>
39920    <para>
39921     PCM substream
39922    </para>
39923   </listitem>
39924  </varlistentry>
39925  <varlistentry>
39926   <term><parameter>ofs</parameter></term>
39927   <listitem>
39928    <para>
39929     byte offset
39930    </para>
39931   </listitem>
39932  </varlistentry>
39933 </variablelist>
39934</refsect1>
39935</refentry>
39936
39937<refentry id="API-snd-pcm-sgbuf-get-chunk-size">
39938<refentryinfo>
39939 <title>LINUX</title>
39940 <productname>Kernel Hackers Manual</productname>
39941 <date>July 2017</date>
39942</refentryinfo>
39943<refmeta>
39944 <refentrytitle><phrase>snd_pcm_sgbuf_get_chunk_size</phrase></refentrytitle>
39945 <manvolnum>9</manvolnum>
39946 <refmiscinfo class="version">4.4.14</refmiscinfo>
39947</refmeta>
39948<refnamediv>
39949 <refname>snd_pcm_sgbuf_get_chunk_size</refname>
39950 <refpurpose>
39951     Compute the max size that fits within the contig. page from the given size
39952 </refpurpose>
39953</refnamediv>
39954<refsynopsisdiv>
39955 <title>Synopsis</title>
39956  <funcsynopsis><funcprototype>
39957   <funcdef>unsigned int <function>snd_pcm_sgbuf_get_chunk_size </function></funcdef>
39958   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
39959   <paramdef>unsigned int <parameter>ofs</parameter></paramdef>
39960   <paramdef>unsigned int <parameter>size</parameter></paramdef>
39961  </funcprototype></funcsynopsis>
39962</refsynopsisdiv>
39963<refsect1>
39964 <title>Arguments</title>
39965 <variablelist>
39966  <varlistentry>
39967   <term><parameter>substream</parameter></term>
39968   <listitem>
39969    <para>
39970     PCM substream
39971    </para>
39972   </listitem>
39973  </varlistentry>
39974  <varlistentry>
39975   <term><parameter>ofs</parameter></term>
39976   <listitem>
39977    <para>
39978     byte offset
39979    </para>
39980   </listitem>
39981  </varlistentry>
39982  <varlistentry>
39983   <term><parameter>size</parameter></term>
39984   <listitem>
39985    <para>
39986     byte size to examine
39987    </para>
39988   </listitem>
39989  </varlistentry>
39990 </variablelist>
39991</refsect1>
39992</refentry>
39993
39994<refentry id="API-snd-pcm-mmap-data-open">
39995<refentryinfo>
39996 <title>LINUX</title>
39997 <productname>Kernel Hackers Manual</productname>
39998 <date>July 2017</date>
39999</refentryinfo>
40000<refmeta>
40001 <refentrytitle><phrase>snd_pcm_mmap_data_open</phrase></refentrytitle>
40002 <manvolnum>9</manvolnum>
40003 <refmiscinfo class="version">4.4.14</refmiscinfo>
40004</refmeta>
40005<refnamediv>
40006 <refname>snd_pcm_mmap_data_open</refname>
40007 <refpurpose>
40008     increase the mmap counter
40009 </refpurpose>
40010</refnamediv>
40011<refsynopsisdiv>
40012 <title>Synopsis</title>
40013  <funcsynopsis><funcprototype>
40014   <funcdef>void <function>snd_pcm_mmap_data_open </function></funcdef>
40015   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
40016  </funcprototype></funcsynopsis>
40017</refsynopsisdiv>
40018<refsect1>
40019 <title>Arguments</title>
40020 <variablelist>
40021  <varlistentry>
40022   <term><parameter>area</parameter></term>
40023   <listitem>
40024    <para>
40025     VMA
40026    </para>
40027   </listitem>
40028  </varlistentry>
40029 </variablelist>
40030</refsect1>
40031<refsect1>
40032<title>Description</title>
40033<para>
40034   PCM mmap callback should handle this counter properly
40035</para>
40036</refsect1>
40037</refentry>
40038
40039<refentry id="API-snd-pcm-mmap-data-close">
40040<refentryinfo>
40041 <title>LINUX</title>
40042 <productname>Kernel Hackers Manual</productname>
40043 <date>July 2017</date>
40044</refentryinfo>
40045<refmeta>
40046 <refentrytitle><phrase>snd_pcm_mmap_data_close</phrase></refentrytitle>
40047 <manvolnum>9</manvolnum>
40048 <refmiscinfo class="version">4.4.14</refmiscinfo>
40049</refmeta>
40050<refnamediv>
40051 <refname>snd_pcm_mmap_data_close</refname>
40052 <refpurpose>
40053     decrease the mmap counter
40054 </refpurpose>
40055</refnamediv>
40056<refsynopsisdiv>
40057 <title>Synopsis</title>
40058  <funcsynopsis><funcprototype>
40059   <funcdef>void <function>snd_pcm_mmap_data_close </function></funcdef>
40060   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
40061  </funcprototype></funcsynopsis>
40062</refsynopsisdiv>
40063<refsect1>
40064 <title>Arguments</title>
40065 <variablelist>
40066  <varlistentry>
40067   <term><parameter>area</parameter></term>
40068   <listitem>
40069    <para>
40070     VMA
40071    </para>
40072   </listitem>
40073  </varlistentry>
40074 </variablelist>
40075</refsect1>
40076<refsect1>
40077<title>Description</title>
40078<para>
40079   PCM mmap callback should handle this counter properly
40080</para>
40081</refsect1>
40082</refentry>
40083
40084<refentry id="API-snd-pcm-limit-isa-dma-size">
40085<refentryinfo>
40086 <title>LINUX</title>
40087 <productname>Kernel Hackers Manual</productname>
40088 <date>July 2017</date>
40089</refentryinfo>
40090<refmeta>
40091 <refentrytitle><phrase>snd_pcm_limit_isa_dma_size</phrase></refentrytitle>
40092 <manvolnum>9</manvolnum>
40093 <refmiscinfo class="version">4.4.14</refmiscinfo>
40094</refmeta>
40095<refnamediv>
40096 <refname>snd_pcm_limit_isa_dma_size</refname>
40097 <refpurpose>
40098     Get the max size fitting with ISA DMA transfer
40099 </refpurpose>
40100</refnamediv>
40101<refsynopsisdiv>
40102 <title>Synopsis</title>
40103  <funcsynopsis><funcprototype>
40104   <funcdef>void <function>snd_pcm_limit_isa_dma_size </function></funcdef>
40105   <paramdef>int <parameter>dma</parameter></paramdef>
40106   <paramdef>size_t * <parameter>max</parameter></paramdef>
40107  </funcprototype></funcsynopsis>
40108</refsynopsisdiv>
40109<refsect1>
40110 <title>Arguments</title>
40111 <variablelist>
40112  <varlistentry>
40113   <term><parameter>dma</parameter></term>
40114   <listitem>
40115    <para>
40116     DMA number
40117    </para>
40118   </listitem>
40119  </varlistentry>
40120  <varlistentry>
40121   <term><parameter>max</parameter></term>
40122   <listitem>
40123    <para>
40124     pointer to store the max size
40125    </para>
40126   </listitem>
40127  </varlistentry>
40128 </variablelist>
40129</refsect1>
40130</refentry>
40131
40132<refentry id="API-snd-pcm-stream-str">
40133<refentryinfo>
40134 <title>LINUX</title>
40135 <productname>Kernel Hackers Manual</productname>
40136 <date>July 2017</date>
40137</refentryinfo>
40138<refmeta>
40139 <refentrytitle><phrase>snd_pcm_stream_str</phrase></refentrytitle>
40140 <manvolnum>9</manvolnum>
40141 <refmiscinfo class="version">4.4.14</refmiscinfo>
40142</refmeta>
40143<refnamediv>
40144 <refname>snd_pcm_stream_str</refname>
40145 <refpurpose>
40146     Get a string naming the direction of a stream
40147 </refpurpose>
40148</refnamediv>
40149<refsynopsisdiv>
40150 <title>Synopsis</title>
40151  <funcsynopsis><funcprototype>
40152   <funcdef>const char * <function>snd_pcm_stream_str </function></funcdef>
40153   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
40154  </funcprototype></funcsynopsis>
40155</refsynopsisdiv>
40156<refsect1>
40157 <title>Arguments</title>
40158 <variablelist>
40159  <varlistentry>
40160   <term><parameter>substream</parameter></term>
40161   <listitem>
40162    <para>
40163     the pcm substream instance
40164    </para>
40165   </listitem>
40166  </varlistentry>
40167 </variablelist>
40168</refsect1>
40169<refsect1>
40170<title>Return</title>
40171<para>
40172   A string naming the direction of the stream.
40173</para>
40174</refsect1>
40175</refentry>
40176
40177<refentry id="API-snd-pcm-chmap-substream">
40178<refentryinfo>
40179 <title>LINUX</title>
40180 <productname>Kernel Hackers Manual</productname>
40181 <date>July 2017</date>
40182</refentryinfo>
40183<refmeta>
40184 <refentrytitle><phrase>snd_pcm_chmap_substream</phrase></refentrytitle>
40185 <manvolnum>9</manvolnum>
40186 <refmiscinfo class="version">4.4.14</refmiscinfo>
40187</refmeta>
40188<refnamediv>
40189 <refname>snd_pcm_chmap_substream</refname>
40190 <refpurpose>
40191     get the PCM substream assigned to the given chmap info
40192 </refpurpose>
40193</refnamediv>
40194<refsynopsisdiv>
40195 <title>Synopsis</title>
40196  <funcsynopsis><funcprototype>
40197   <funcdef>struct snd_pcm_substream * <function>snd_pcm_chmap_substream </function></funcdef>
40198   <paramdef>struct snd_pcm_chmap * <parameter>info</parameter></paramdef>
40199   <paramdef>unsigned int <parameter>idx</parameter></paramdef>
40200  </funcprototype></funcsynopsis>
40201</refsynopsisdiv>
40202<refsect1>
40203 <title>Arguments</title>
40204 <variablelist>
40205  <varlistentry>
40206   <term><parameter>info</parameter></term>
40207   <listitem>
40208    <para>
40209     chmap information
40210    </para>
40211   </listitem>
40212  </varlistentry>
40213  <varlistentry>
40214   <term><parameter>idx</parameter></term>
40215   <listitem>
40216    <para>
40217     the substream number index
40218    </para>
40219   </listitem>
40220  </varlistentry>
40221 </variablelist>
40222</refsect1>
40223</refentry>
40224
40225<refentry id="API-pcm-format-to-bits">
40226<refentryinfo>
40227 <title>LINUX</title>
40228 <productname>Kernel Hackers Manual</productname>
40229 <date>July 2017</date>
40230</refentryinfo>
40231<refmeta>
40232 <refentrytitle><phrase>pcm_format_to_bits</phrase></refentrytitle>
40233 <manvolnum>9</manvolnum>
40234 <refmiscinfo class="version">4.4.14</refmiscinfo>
40235</refmeta>
40236<refnamediv>
40237 <refname>pcm_format_to_bits</refname>
40238 <refpurpose>
40239     Strong-typed conversion of pcm_format to bitwise
40240 </refpurpose>
40241</refnamediv>
40242<refsynopsisdiv>
40243 <title>Synopsis</title>
40244  <funcsynopsis><funcprototype>
40245   <funcdef>u64 <function>pcm_format_to_bits </function></funcdef>
40246   <paramdef>snd_pcm_format_t <parameter>pcm_format</parameter></paramdef>
40247  </funcprototype></funcsynopsis>
40248</refsynopsisdiv>
40249<refsect1>
40250 <title>Arguments</title>
40251 <variablelist>
40252  <varlistentry>
40253   <term><parameter>pcm_format</parameter></term>
40254   <listitem>
40255    <para>
40256     PCM format
40257    </para>
40258   </listitem>
40259  </varlistentry>
40260 </variablelist>
40261</refsect1>
40262</refentry>
40263
40264<!-- sound/core/pcm.c -->
40265<refentry id="API-snd-pcm-format-name">
40266<refentryinfo>
40267 <title>LINUX</title>
40268 <productname>Kernel Hackers Manual</productname>
40269 <date>July 2017</date>
40270</refentryinfo>
40271<refmeta>
40272 <refentrytitle><phrase>snd_pcm_format_name</phrase></refentrytitle>
40273 <manvolnum>9</manvolnum>
40274 <refmiscinfo class="version">4.4.14</refmiscinfo>
40275</refmeta>
40276<refnamediv>
40277 <refname>snd_pcm_format_name</refname>
40278 <refpurpose>
40279  Return a name string for the given PCM format
40280 </refpurpose>
40281</refnamediv>
40282<refsynopsisdiv>
40283 <title>Synopsis</title>
40284  <funcsynopsis><funcprototype>
40285   <funcdef>const char * <function>snd_pcm_format_name </function></funcdef>
40286   <paramdef>snd_pcm_format_t <parameter>format</parameter></paramdef>
40287  </funcprototype></funcsynopsis>
40288</refsynopsisdiv>
40289<refsect1>
40290 <title>Arguments</title>
40291 <variablelist>
40292  <varlistentry>
40293   <term><parameter>format</parameter></term>
40294   <listitem>
40295    <para>
40296     PCM format
40297    </para>
40298   </listitem>
40299  </varlistentry>
40300 </variablelist>
40301</refsect1>
40302</refentry>
40303
40304<refentry id="API-snd-pcm-new-stream">
40305<refentryinfo>
40306 <title>LINUX</title>
40307 <productname>Kernel Hackers Manual</productname>
40308 <date>July 2017</date>
40309</refentryinfo>
40310<refmeta>
40311 <refentrytitle><phrase>snd_pcm_new_stream</phrase></refentrytitle>
40312 <manvolnum>9</manvolnum>
40313 <refmiscinfo class="version">4.4.14</refmiscinfo>
40314</refmeta>
40315<refnamediv>
40316 <refname>snd_pcm_new_stream</refname>
40317 <refpurpose>
40318     create a new PCM stream
40319 </refpurpose>
40320</refnamediv>
40321<refsynopsisdiv>
40322 <title>Synopsis</title>
40323  <funcsynopsis><funcprototype>
40324   <funcdef>int <function>snd_pcm_new_stream </function></funcdef>
40325   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
40326   <paramdef>int <parameter>stream</parameter></paramdef>
40327   <paramdef>int <parameter>substream_count</parameter></paramdef>
40328  </funcprototype></funcsynopsis>
40329</refsynopsisdiv>
40330<refsect1>
40331 <title>Arguments</title>
40332 <variablelist>
40333  <varlistentry>
40334   <term><parameter>pcm</parameter></term>
40335   <listitem>
40336    <para>
40337     the pcm instance
40338    </para>
40339   </listitem>
40340  </varlistentry>
40341  <varlistentry>
40342   <term><parameter>stream</parameter></term>
40343   <listitem>
40344    <para>
40345     the stream direction, SNDRV_PCM_STREAM_XXX
40346    </para>
40347   </listitem>
40348  </varlistentry>
40349  <varlistentry>
40350   <term><parameter>substream_count</parameter></term>
40351   <listitem>
40352    <para>
40353     the number of substreams
40354    </para>
40355   </listitem>
40356  </varlistentry>
40357 </variablelist>
40358</refsect1>
40359<refsect1>
40360<title>Description</title>
40361<para>
40362   Creates a new stream for the pcm.
40363   The corresponding stream on the pcm must have been empty before
40364   calling this, i.e. zero must be given to the argument of
40365   <function><link linkend="API-snd-pcm-new">snd_pcm_new</link></function>.
40366</para>
40367</refsect1>
40368<refsect1>
40369<title>Return</title>
40370<para>
40371   Zero if successful, or a negative error code on failure.
40372</para>
40373</refsect1>
40374</refentry>
40375
40376<refentry id="API-snd-pcm-new">
40377<refentryinfo>
40378 <title>LINUX</title>
40379 <productname>Kernel Hackers Manual</productname>
40380 <date>July 2017</date>
40381</refentryinfo>
40382<refmeta>
40383 <refentrytitle><phrase>snd_pcm_new</phrase></refentrytitle>
40384 <manvolnum>9</manvolnum>
40385 <refmiscinfo class="version">4.4.14</refmiscinfo>
40386</refmeta>
40387<refnamediv>
40388 <refname>snd_pcm_new</refname>
40389 <refpurpose>
40390     create a new PCM instance
40391 </refpurpose>
40392</refnamediv>
40393<refsynopsisdiv>
40394 <title>Synopsis</title>
40395  <funcsynopsis><funcprototype>
40396   <funcdef>int <function>snd_pcm_new </function></funcdef>
40397   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40398   <paramdef>const char * <parameter>id</parameter></paramdef>
40399   <paramdef>int <parameter>device</parameter></paramdef>
40400   <paramdef>int <parameter>playback_count</parameter></paramdef>
40401   <paramdef>int <parameter>capture_count</parameter></paramdef>
40402   <paramdef>struct snd_pcm ** <parameter>rpcm</parameter></paramdef>
40403  </funcprototype></funcsynopsis>
40404</refsynopsisdiv>
40405<refsect1>
40406 <title>Arguments</title>
40407 <variablelist>
40408  <varlistentry>
40409   <term><parameter>card</parameter></term>
40410   <listitem>
40411    <para>
40412     the card instance
40413    </para>
40414   </listitem>
40415  </varlistentry>
40416  <varlistentry>
40417   <term><parameter>id</parameter></term>
40418   <listitem>
40419    <para>
40420     the id string
40421    </para>
40422   </listitem>
40423  </varlistentry>
40424  <varlistentry>
40425   <term><parameter>device</parameter></term>
40426   <listitem>
40427    <para>
40428     the device index (zero based)
40429    </para>
40430   </listitem>
40431  </varlistentry>
40432  <varlistentry>
40433   <term><parameter>playback_count</parameter></term>
40434   <listitem>
40435    <para>
40436     the number of substreams for playback
40437    </para>
40438   </listitem>
40439  </varlistentry>
40440  <varlistentry>
40441   <term><parameter>capture_count</parameter></term>
40442   <listitem>
40443    <para>
40444     the number of substreams for capture
40445    </para>
40446   </listitem>
40447  </varlistentry>
40448  <varlistentry>
40449   <term><parameter>rpcm</parameter></term>
40450   <listitem>
40451    <para>
40452     the pointer to store the new pcm instance
40453    </para>
40454   </listitem>
40455  </varlistentry>
40456 </variablelist>
40457</refsect1>
40458<refsect1>
40459<title>Description</title>
40460<para>
40461   Creates a new PCM instance.
40462   </para><para>
40463
40464   The pcm operators have to be set afterwards to the new instance
40465   via <function><link linkend="API-snd-pcm-set-ops">snd_pcm_set_ops</link></function>.
40466</para>
40467</refsect1>
40468<refsect1>
40469<title>Return</title>
40470<para>
40471   Zero if successful, or a negative error code on failure.
40472</para>
40473</refsect1>
40474</refentry>
40475
40476<refentry id="API-snd-pcm-new-internal">
40477<refentryinfo>
40478 <title>LINUX</title>
40479 <productname>Kernel Hackers Manual</productname>
40480 <date>July 2017</date>
40481</refentryinfo>
40482<refmeta>
40483 <refentrytitle><phrase>snd_pcm_new_internal</phrase></refentrytitle>
40484 <manvolnum>9</manvolnum>
40485 <refmiscinfo class="version">4.4.14</refmiscinfo>
40486</refmeta>
40487<refnamediv>
40488 <refname>snd_pcm_new_internal</refname>
40489 <refpurpose>
40490     create a new internal PCM instance
40491 </refpurpose>
40492</refnamediv>
40493<refsynopsisdiv>
40494 <title>Synopsis</title>
40495  <funcsynopsis><funcprototype>
40496   <funcdef>int <function>snd_pcm_new_internal </function></funcdef>
40497   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40498   <paramdef>const char * <parameter>id</parameter></paramdef>
40499   <paramdef>int <parameter>device</parameter></paramdef>
40500   <paramdef>int <parameter>playback_count</parameter></paramdef>
40501   <paramdef>int <parameter>capture_count</parameter></paramdef>
40502   <paramdef>struct snd_pcm ** <parameter>rpcm</parameter></paramdef>
40503  </funcprototype></funcsynopsis>
40504</refsynopsisdiv>
40505<refsect1>
40506 <title>Arguments</title>
40507 <variablelist>
40508  <varlistentry>
40509   <term><parameter>card</parameter></term>
40510   <listitem>
40511    <para>
40512     the card instance
40513    </para>
40514   </listitem>
40515  </varlistentry>
40516  <varlistentry>
40517   <term><parameter>id</parameter></term>
40518   <listitem>
40519    <para>
40520     the id string
40521    </para>
40522   </listitem>
40523  </varlistentry>
40524  <varlistentry>
40525   <term><parameter>device</parameter></term>
40526   <listitem>
40527    <para>
40528     the device index (zero based - shared with normal PCMs)
40529    </para>
40530   </listitem>
40531  </varlistentry>
40532  <varlistentry>
40533   <term><parameter>playback_count</parameter></term>
40534   <listitem>
40535    <para>
40536     the number of substreams for playback
40537    </para>
40538   </listitem>
40539  </varlistentry>
40540  <varlistentry>
40541   <term><parameter>capture_count</parameter></term>
40542   <listitem>
40543    <para>
40544     the number of substreams for capture
40545    </para>
40546   </listitem>
40547  </varlistentry>
40548  <varlistentry>
40549   <term><parameter>rpcm</parameter></term>
40550   <listitem>
40551    <para>
40552     the pointer to store the new pcm instance
40553    </para>
40554   </listitem>
40555  </varlistentry>
40556 </variablelist>
40557</refsect1>
40558<refsect1>
40559<title>Description</title>
40560<para>
40561   Creates a new internal PCM instance with no userspace device or procfs
40562   entries. This is used by ASoC Back End PCMs in order to create a PCM that
40563   will only be used internally by kernel drivers. i.e. it cannot be opened
40564   by userspace. It provides existing ASoC components drivers with a substream
40565   and access to any private data.
40566   </para><para>
40567
40568   The pcm operators have to be set afterwards to the new instance
40569   via <function><link linkend="API-snd-pcm-set-ops">snd_pcm_set_ops</link></function>.
40570</para>
40571</refsect1>
40572<refsect1>
40573<title>Return</title>
40574<para>
40575   Zero if successful, or a negative error code on failure.
40576</para>
40577</refsect1>
40578</refentry>
40579
40580<refentry id="API-snd-pcm-notify">
40581<refentryinfo>
40582 <title>LINUX</title>
40583 <productname>Kernel Hackers Manual</productname>
40584 <date>July 2017</date>
40585</refentryinfo>
40586<refmeta>
40587 <refentrytitle><phrase>snd_pcm_notify</phrase></refentrytitle>
40588 <manvolnum>9</manvolnum>
40589 <refmiscinfo class="version">4.4.14</refmiscinfo>
40590</refmeta>
40591<refnamediv>
40592 <refname>snd_pcm_notify</refname>
40593 <refpurpose>
40594     Add/remove the notify list
40595 </refpurpose>
40596</refnamediv>
40597<refsynopsisdiv>
40598 <title>Synopsis</title>
40599  <funcsynopsis><funcprototype>
40600   <funcdef>int <function>snd_pcm_notify </function></funcdef>
40601   <paramdef>struct snd_pcm_notify * <parameter>notify</parameter></paramdef>
40602   <paramdef>int <parameter>nfree</parameter></paramdef>
40603  </funcprototype></funcsynopsis>
40604</refsynopsisdiv>
40605<refsect1>
40606 <title>Arguments</title>
40607 <variablelist>
40608  <varlistentry>
40609   <term><parameter>notify</parameter></term>
40610   <listitem>
40611    <para>
40612     PCM notify list
40613    </para>
40614   </listitem>
40615  </varlistentry>
40616  <varlistentry>
40617   <term><parameter>nfree</parameter></term>
40618   <listitem>
40619    <para>
40620     0 = register, 1 = unregister
40621    </para>
40622   </listitem>
40623  </varlistentry>
40624 </variablelist>
40625</refsect1>
40626<refsect1>
40627<title>Description</title>
40628<para>
40629   This adds the given notifier to the global list so that the callback is
40630   called for each registered PCM devices.  This exists only for PCM OSS
40631   emulation, so far.
40632</para>
40633</refsect1>
40634</refentry>
40635
40636<!-- sound/core/device.c -->
40637<refentry id="API-snd-device-new">
40638<refentryinfo>
40639 <title>LINUX</title>
40640 <productname>Kernel Hackers Manual</productname>
40641 <date>July 2017</date>
40642</refentryinfo>
40643<refmeta>
40644 <refentrytitle><phrase>snd_device_new</phrase></refentrytitle>
40645 <manvolnum>9</manvolnum>
40646 <refmiscinfo class="version">4.4.14</refmiscinfo>
40647</refmeta>
40648<refnamediv>
40649 <refname>snd_device_new</refname>
40650 <refpurpose>
40651  create an ALSA device component
40652 </refpurpose>
40653</refnamediv>
40654<refsynopsisdiv>
40655 <title>Synopsis</title>
40656  <funcsynopsis><funcprototype>
40657   <funcdef>int <function>snd_device_new </function></funcdef>
40658   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40659   <paramdef>enum snd_device_type <parameter>type</parameter></paramdef>
40660   <paramdef>void * <parameter>device_data</parameter></paramdef>
40661   <paramdef>struct snd_device_ops * <parameter>ops</parameter></paramdef>
40662  </funcprototype></funcsynopsis>
40663</refsynopsisdiv>
40664<refsect1>
40665 <title>Arguments</title>
40666 <variablelist>
40667  <varlistentry>
40668   <term><parameter>card</parameter></term>
40669   <listitem>
40670    <para>
40671     the card instance
40672    </para>
40673   </listitem>
40674  </varlistentry>
40675  <varlistentry>
40676   <term><parameter>type</parameter></term>
40677   <listitem>
40678    <para>
40679     the device type, SNDRV_DEV_XXX
40680    </para>
40681   </listitem>
40682  </varlistentry>
40683  <varlistentry>
40684   <term><parameter>device_data</parameter></term>
40685   <listitem>
40686    <para>
40687     the data pointer of this device
40688    </para>
40689   </listitem>
40690  </varlistentry>
40691  <varlistentry>
40692   <term><parameter>ops</parameter></term>
40693   <listitem>
40694    <para>
40695     the operator table
40696    </para>
40697   </listitem>
40698  </varlistentry>
40699 </variablelist>
40700</refsect1>
40701<refsect1>
40702<title>Description</title>
40703<para>
40704   Creates a new device component for the given data pointer.
40705   The device will be assigned to the card and managed together
40706   by the card.
40707   </para><para>
40708
40709   The data pointer plays a role as the identifier, too, so the
40710   pointer address must be unique and unchanged.
40711</para>
40712</refsect1>
40713<refsect1>
40714<title>Return</title>
40715<para>
40716   Zero if successful, or a negative error code on failure.
40717</para>
40718</refsect1>
40719</refentry>
40720
40721<refentry id="API-snd-device-disconnect">
40722<refentryinfo>
40723 <title>LINUX</title>
40724 <productname>Kernel Hackers Manual</productname>
40725 <date>July 2017</date>
40726</refentryinfo>
40727<refmeta>
40728 <refentrytitle><phrase>snd_device_disconnect</phrase></refentrytitle>
40729 <manvolnum>9</manvolnum>
40730 <refmiscinfo class="version">4.4.14</refmiscinfo>
40731</refmeta>
40732<refnamediv>
40733 <refname>snd_device_disconnect</refname>
40734 <refpurpose>
40735     disconnect the device
40736 </refpurpose>
40737</refnamediv>
40738<refsynopsisdiv>
40739 <title>Synopsis</title>
40740  <funcsynopsis><funcprototype>
40741   <funcdef>void <function>snd_device_disconnect </function></funcdef>
40742   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40743   <paramdef>void * <parameter>device_data</parameter></paramdef>
40744  </funcprototype></funcsynopsis>
40745</refsynopsisdiv>
40746<refsect1>
40747 <title>Arguments</title>
40748 <variablelist>
40749  <varlistentry>
40750   <term><parameter>card</parameter></term>
40751   <listitem>
40752    <para>
40753     the card instance
40754    </para>
40755   </listitem>
40756  </varlistentry>
40757  <varlistentry>
40758   <term><parameter>device_data</parameter></term>
40759   <listitem>
40760    <para>
40761     the data pointer to disconnect
40762    </para>
40763   </listitem>
40764  </varlistentry>
40765 </variablelist>
40766</refsect1>
40767<refsect1>
40768<title>Description</title>
40769<para>
40770   Turns the device into the disconnection state, invoking
40771   dev_disconnect callback, if the device was already registered.
40772   </para><para>
40773
40774   Usually called from <function><link linkend="API-snd-card-disconnect">snd_card_disconnect</link></function>.
40775</para>
40776</refsect1>
40777<refsect1>
40778<title>Return</title>
40779<para>
40780   Zero if successful, or a negative error code on failure or if the
40781   device not found.
40782</para>
40783</refsect1>
40784</refentry>
40785
40786<refentry id="API-snd-device-free">
40787<refentryinfo>
40788 <title>LINUX</title>
40789 <productname>Kernel Hackers Manual</productname>
40790 <date>July 2017</date>
40791</refentryinfo>
40792<refmeta>
40793 <refentrytitle><phrase>snd_device_free</phrase></refentrytitle>
40794 <manvolnum>9</manvolnum>
40795 <refmiscinfo class="version">4.4.14</refmiscinfo>
40796</refmeta>
40797<refnamediv>
40798 <refname>snd_device_free</refname>
40799 <refpurpose>
40800     release the device from the card
40801 </refpurpose>
40802</refnamediv>
40803<refsynopsisdiv>
40804 <title>Synopsis</title>
40805  <funcsynopsis><funcprototype>
40806   <funcdef>void <function>snd_device_free </function></funcdef>
40807   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40808   <paramdef>void * <parameter>device_data</parameter></paramdef>
40809  </funcprototype></funcsynopsis>
40810</refsynopsisdiv>
40811<refsect1>
40812 <title>Arguments</title>
40813 <variablelist>
40814  <varlistentry>
40815   <term><parameter>card</parameter></term>
40816   <listitem>
40817    <para>
40818     the card instance
40819    </para>
40820   </listitem>
40821  </varlistentry>
40822  <varlistentry>
40823   <term><parameter>device_data</parameter></term>
40824   <listitem>
40825    <para>
40826     the data pointer to release
40827    </para>
40828   </listitem>
40829  </varlistentry>
40830 </variablelist>
40831</refsect1>
40832<refsect1>
40833<title>Description</title>
40834<para>
40835   Removes the device from the list on the card and invokes the
40836   callbacks, dev_disconnect and dev_free, corresponding to the state.
40837   Then release the device.
40838</para>
40839</refsect1>
40840</refentry>
40841
40842<refentry id="API-snd-device-register">
40843<refentryinfo>
40844 <title>LINUX</title>
40845 <productname>Kernel Hackers Manual</productname>
40846 <date>July 2017</date>
40847</refentryinfo>
40848<refmeta>
40849 <refentrytitle><phrase>snd_device_register</phrase></refentrytitle>
40850 <manvolnum>9</manvolnum>
40851 <refmiscinfo class="version">4.4.14</refmiscinfo>
40852</refmeta>
40853<refnamediv>
40854 <refname>snd_device_register</refname>
40855 <refpurpose>
40856     register the device
40857 </refpurpose>
40858</refnamediv>
40859<refsynopsisdiv>
40860 <title>Synopsis</title>
40861  <funcsynopsis><funcprototype>
40862   <funcdef>int <function>snd_device_register </function></funcdef>
40863   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
40864   <paramdef>void * <parameter>device_data</parameter></paramdef>
40865  </funcprototype></funcsynopsis>
40866</refsynopsisdiv>
40867<refsect1>
40868 <title>Arguments</title>
40869 <variablelist>
40870  <varlistentry>
40871   <term><parameter>card</parameter></term>
40872   <listitem>
40873    <para>
40874     the card instance
40875    </para>
40876   </listitem>
40877  </varlistentry>
40878  <varlistentry>
40879   <term><parameter>device_data</parameter></term>
40880   <listitem>
40881    <para>
40882     the data pointer to register
40883    </para>
40884   </listitem>
40885  </varlistentry>
40886 </variablelist>
40887</refsect1>
40888<refsect1>
40889<title>Description</title>
40890<para>
40891   Registers the device which was already created via
40892   <function><link linkend="API-snd-device-new">snd_device_new</link></function>.  Usually this is called from <function><link linkend="API-snd-card-register">snd_card_register</link></function>,
40893   but it can be called later if any new devices are created after
40894   invocation of <function><link linkend="API-snd-card-register">snd_card_register</link></function>.
40895</para>
40896</refsect1>
40897<refsect1>
40898<title>Return</title>
40899<para>
40900   Zero if successful, or a negative error code on failure or if the
40901   device not found.
40902</para>
40903</refsect1>
40904</refentry>
40905
40906<!-- sound/core/info.c -->
40907<refentry id="API-snd-info-get-line">
40908<refentryinfo>
40909 <title>LINUX</title>
40910 <productname>Kernel Hackers Manual</productname>
40911 <date>July 2017</date>
40912</refentryinfo>
40913<refmeta>
40914 <refentrytitle><phrase>snd_info_get_line</phrase></refentrytitle>
40915 <manvolnum>9</manvolnum>
40916 <refmiscinfo class="version">4.4.14</refmiscinfo>
40917</refmeta>
40918<refnamediv>
40919 <refname>snd_info_get_line</refname>
40920 <refpurpose>
40921  read one line from the procfs buffer
40922 </refpurpose>
40923</refnamediv>
40924<refsynopsisdiv>
40925 <title>Synopsis</title>
40926  <funcsynopsis><funcprototype>
40927   <funcdef>int <function>snd_info_get_line </function></funcdef>
40928   <paramdef>struct snd_info_buffer * <parameter>buffer</parameter></paramdef>
40929   <paramdef>char * <parameter>line</parameter></paramdef>
40930   <paramdef>int <parameter>len</parameter></paramdef>
40931  </funcprototype></funcsynopsis>
40932</refsynopsisdiv>
40933<refsect1>
40934 <title>Arguments</title>
40935 <variablelist>
40936  <varlistentry>
40937   <term><parameter>buffer</parameter></term>
40938   <listitem>
40939    <para>
40940     the procfs buffer
40941    </para>
40942   </listitem>
40943  </varlistentry>
40944  <varlistentry>
40945   <term><parameter>line</parameter></term>
40946   <listitem>
40947    <para>
40948     the buffer to store
40949    </para>
40950   </listitem>
40951  </varlistentry>
40952  <varlistentry>
40953   <term><parameter>len</parameter></term>
40954   <listitem>
40955    <para>
40956     the max. buffer size
40957    </para>
40958   </listitem>
40959  </varlistentry>
40960 </variablelist>
40961</refsect1>
40962<refsect1>
40963<title>Description</title>
40964<para>
40965   Reads one line from the buffer and stores the string.
40966</para>
40967</refsect1>
40968<refsect1>
40969<title>Return</title>
40970<para>
40971   Zero if successful, or 1 if error or EOF.
40972</para>
40973</refsect1>
40974</refentry>
40975
40976<refentry id="API-snd-info-get-str">
40977<refentryinfo>
40978 <title>LINUX</title>
40979 <productname>Kernel Hackers Manual</productname>
40980 <date>July 2017</date>
40981</refentryinfo>
40982<refmeta>
40983 <refentrytitle><phrase>snd_info_get_str</phrase></refentrytitle>
40984 <manvolnum>9</manvolnum>
40985 <refmiscinfo class="version">4.4.14</refmiscinfo>
40986</refmeta>
40987<refnamediv>
40988 <refname>snd_info_get_str</refname>
40989 <refpurpose>
40990     parse a string token
40991 </refpurpose>
40992</refnamediv>
40993<refsynopsisdiv>
40994 <title>Synopsis</title>
40995  <funcsynopsis><funcprototype>
40996   <funcdef>const char * <function>snd_info_get_str </function></funcdef>
40997   <paramdef>char * <parameter>dest</parameter></paramdef>
40998   <paramdef>const char * <parameter>src</parameter></paramdef>
40999   <paramdef>int <parameter>len</parameter></paramdef>
41000  </funcprototype></funcsynopsis>
41001</refsynopsisdiv>
41002<refsect1>
41003 <title>Arguments</title>
41004 <variablelist>
41005  <varlistentry>
41006   <term><parameter>dest</parameter></term>
41007   <listitem>
41008    <para>
41009     the buffer to store the string token
41010    </para>
41011   </listitem>
41012  </varlistentry>
41013  <varlistentry>
41014   <term><parameter>src</parameter></term>
41015   <listitem>
41016    <para>
41017     the original string
41018    </para>
41019   </listitem>
41020  </varlistentry>
41021  <varlistentry>
41022   <term><parameter>len</parameter></term>
41023   <listitem>
41024    <para>
41025     the max. length of token - 1
41026    </para>
41027   </listitem>
41028  </varlistentry>
41029 </variablelist>
41030</refsect1>
41031<refsect1>
41032<title>Description</title>
41033<para>
41034   Parses the original string and copy a token to the given
41035   string buffer.
41036</para>
41037</refsect1>
41038<refsect1>
41039<title>Return</title>
41040<para>
41041   The updated pointer of the original string so that
41042   it can be used for the next call.
41043</para>
41044</refsect1>
41045</refentry>
41046
41047<refentry id="API-snd-info-create-module-entry">
41048<refentryinfo>
41049 <title>LINUX</title>
41050 <productname>Kernel Hackers Manual</productname>
41051 <date>July 2017</date>
41052</refentryinfo>
41053<refmeta>
41054 <refentrytitle><phrase>snd_info_create_module_entry</phrase></refentrytitle>
41055 <manvolnum>9</manvolnum>
41056 <refmiscinfo class="version">4.4.14</refmiscinfo>
41057</refmeta>
41058<refnamediv>
41059 <refname>snd_info_create_module_entry</refname>
41060 <refpurpose>
41061     create an info entry for the given module
41062 </refpurpose>
41063</refnamediv>
41064<refsynopsisdiv>
41065 <title>Synopsis</title>
41066  <funcsynopsis><funcprototype>
41067   <funcdef>struct snd_info_entry * <function>snd_info_create_module_entry </function></funcdef>
41068   <paramdef>struct module * <parameter>module</parameter></paramdef>
41069   <paramdef>const char * <parameter>name</parameter></paramdef>
41070   <paramdef>struct snd_info_entry * <parameter>parent</parameter></paramdef>
41071  </funcprototype></funcsynopsis>
41072</refsynopsisdiv>
41073<refsect1>
41074 <title>Arguments</title>
41075 <variablelist>
41076  <varlistentry>
41077   <term><parameter>module</parameter></term>
41078   <listitem>
41079    <para>
41080     the module pointer
41081    </para>
41082   </listitem>
41083  </varlistentry>
41084  <varlistentry>
41085   <term><parameter>name</parameter></term>
41086   <listitem>
41087    <para>
41088     the file name
41089    </para>
41090   </listitem>
41091  </varlistentry>
41092  <varlistentry>
41093   <term><parameter>parent</parameter></term>
41094   <listitem>
41095    <para>
41096     the parent directory
41097    </para>
41098   </listitem>
41099  </varlistentry>
41100 </variablelist>
41101</refsect1>
41102<refsect1>
41103<title>Description</title>
41104<para>
41105   Creates a new info entry and assigns it to the given module.
41106</para>
41107</refsect1>
41108<refsect1>
41109<title>Return</title>
41110<para>
41111   The pointer of the new instance, or <constant>NULL</constant> on failure.
41112</para>
41113</refsect1>
41114</refentry>
41115
41116<refentry id="API-snd-info-create-card-entry">
41117<refentryinfo>
41118 <title>LINUX</title>
41119 <productname>Kernel Hackers Manual</productname>
41120 <date>July 2017</date>
41121</refentryinfo>
41122<refmeta>
41123 <refentrytitle><phrase>snd_info_create_card_entry</phrase></refentrytitle>
41124 <manvolnum>9</manvolnum>
41125 <refmiscinfo class="version">4.4.14</refmiscinfo>
41126</refmeta>
41127<refnamediv>
41128 <refname>snd_info_create_card_entry</refname>
41129 <refpurpose>
41130     create an info entry for the given card
41131 </refpurpose>
41132</refnamediv>
41133<refsynopsisdiv>
41134 <title>Synopsis</title>
41135  <funcsynopsis><funcprototype>
41136   <funcdef>struct snd_info_entry * <function>snd_info_create_card_entry </function></funcdef>
41137   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41138   <paramdef>const char * <parameter>name</parameter></paramdef>
41139   <paramdef>struct snd_info_entry * <parameter>parent</parameter></paramdef>
41140  </funcprototype></funcsynopsis>
41141</refsynopsisdiv>
41142<refsect1>
41143 <title>Arguments</title>
41144 <variablelist>
41145  <varlistentry>
41146   <term><parameter>card</parameter></term>
41147   <listitem>
41148    <para>
41149     the card instance
41150    </para>
41151   </listitem>
41152  </varlistentry>
41153  <varlistentry>
41154   <term><parameter>name</parameter></term>
41155   <listitem>
41156    <para>
41157     the file name
41158    </para>
41159   </listitem>
41160  </varlistentry>
41161  <varlistentry>
41162   <term><parameter>parent</parameter></term>
41163   <listitem>
41164    <para>
41165     the parent directory
41166    </para>
41167   </listitem>
41168  </varlistentry>
41169 </variablelist>
41170</refsect1>
41171<refsect1>
41172<title>Description</title>
41173<para>
41174   Creates a new info entry and assigns it to the given card.
41175</para>
41176</refsect1>
41177<refsect1>
41178<title>Return</title>
41179<para>
41180   The pointer of the new instance, or <constant>NULL</constant> on failure.
41181</para>
41182</refsect1>
41183</refentry>
41184
41185<refentry id="API-snd-info-free-entry">
41186<refentryinfo>
41187 <title>LINUX</title>
41188 <productname>Kernel Hackers Manual</productname>
41189 <date>July 2017</date>
41190</refentryinfo>
41191<refmeta>
41192 <refentrytitle><phrase>snd_info_free_entry</phrase></refentrytitle>
41193 <manvolnum>9</manvolnum>
41194 <refmiscinfo class="version">4.4.14</refmiscinfo>
41195</refmeta>
41196<refnamediv>
41197 <refname>snd_info_free_entry</refname>
41198 <refpurpose>
41199     release the info entry
41200 </refpurpose>
41201</refnamediv>
41202<refsynopsisdiv>
41203 <title>Synopsis</title>
41204  <funcsynopsis><funcprototype>
41205   <funcdef>void <function>snd_info_free_entry </function></funcdef>
41206   <paramdef>struct snd_info_entry * <parameter>entry</parameter></paramdef>
41207  </funcprototype></funcsynopsis>
41208</refsynopsisdiv>
41209<refsect1>
41210 <title>Arguments</title>
41211 <variablelist>
41212  <varlistentry>
41213   <term><parameter>entry</parameter></term>
41214   <listitem>
41215    <para>
41216     the info entry
41217    </para>
41218   </listitem>
41219  </varlistentry>
41220 </variablelist>
41221</refsect1>
41222<refsect1>
41223<title>Description</title>
41224<para>
41225   Releases the info entry.
41226</para>
41227</refsect1>
41228</refentry>
41229
41230<refentry id="API-snd-info-register">
41231<refentryinfo>
41232 <title>LINUX</title>
41233 <productname>Kernel Hackers Manual</productname>
41234 <date>July 2017</date>
41235</refentryinfo>
41236<refmeta>
41237 <refentrytitle><phrase>snd_info_register</phrase></refentrytitle>
41238 <manvolnum>9</manvolnum>
41239 <refmiscinfo class="version">4.4.14</refmiscinfo>
41240</refmeta>
41241<refnamediv>
41242 <refname>snd_info_register</refname>
41243 <refpurpose>
41244     register the info entry
41245 </refpurpose>
41246</refnamediv>
41247<refsynopsisdiv>
41248 <title>Synopsis</title>
41249  <funcsynopsis><funcprototype>
41250   <funcdef>int <function>snd_info_register </function></funcdef>
41251   <paramdef>struct snd_info_entry * <parameter>entry</parameter></paramdef>
41252  </funcprototype></funcsynopsis>
41253</refsynopsisdiv>
41254<refsect1>
41255 <title>Arguments</title>
41256 <variablelist>
41257  <varlistentry>
41258   <term><parameter>entry</parameter></term>
41259   <listitem>
41260    <para>
41261     the info entry
41262    </para>
41263   </listitem>
41264  </varlistentry>
41265 </variablelist>
41266</refsect1>
41267<refsect1>
41268<title>Description</title>
41269<para>
41270   Registers the proc info entry.
41271</para>
41272</refsect1>
41273<refsect1>
41274<title>Return</title>
41275<para>
41276   Zero if successful, or a negative error code on failure.
41277</para>
41278</refsect1>
41279</refentry>
41280
41281<!-- sound/core/rawmidi.c -->
41282<refentry id="API-snd-rawmidi-receive">
41283<refentryinfo>
41284 <title>LINUX</title>
41285 <productname>Kernel Hackers Manual</productname>
41286 <date>July 2017</date>
41287</refentryinfo>
41288<refmeta>
41289 <refentrytitle><phrase>snd_rawmidi_receive</phrase></refentrytitle>
41290 <manvolnum>9</manvolnum>
41291 <refmiscinfo class="version">4.4.14</refmiscinfo>
41292</refmeta>
41293<refnamediv>
41294 <refname>snd_rawmidi_receive</refname>
41295 <refpurpose>
41296  receive the input data from the device
41297 </refpurpose>
41298</refnamediv>
41299<refsynopsisdiv>
41300 <title>Synopsis</title>
41301  <funcsynopsis><funcprototype>
41302   <funcdef>int <function>snd_rawmidi_receive </function></funcdef>
41303   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
41304   <paramdef>const unsigned char * <parameter>buffer</parameter></paramdef>
41305   <paramdef>int <parameter>count</parameter></paramdef>
41306  </funcprototype></funcsynopsis>
41307</refsynopsisdiv>
41308<refsect1>
41309 <title>Arguments</title>
41310 <variablelist>
41311  <varlistentry>
41312   <term><parameter>substream</parameter></term>
41313   <listitem>
41314    <para>
41315     the rawmidi substream
41316    </para>
41317   </listitem>
41318  </varlistentry>
41319  <varlistentry>
41320   <term><parameter>buffer</parameter></term>
41321   <listitem>
41322    <para>
41323     the buffer pointer
41324    </para>
41325   </listitem>
41326  </varlistentry>
41327  <varlistentry>
41328   <term><parameter>count</parameter></term>
41329   <listitem>
41330    <para>
41331     the data size to read
41332    </para>
41333   </listitem>
41334  </varlistentry>
41335 </variablelist>
41336</refsect1>
41337<refsect1>
41338<title>Description</title>
41339<para>
41340   Reads the data from the internal buffer.
41341</para>
41342</refsect1>
41343<refsect1>
41344<title>Return</title>
41345<para>
41346   The size of read data, or a negative error code on failure.
41347</para>
41348</refsect1>
41349</refentry>
41350
41351<refentry id="API-snd-rawmidi-transmit-empty">
41352<refentryinfo>
41353 <title>LINUX</title>
41354 <productname>Kernel Hackers Manual</productname>
41355 <date>July 2017</date>
41356</refentryinfo>
41357<refmeta>
41358 <refentrytitle><phrase>snd_rawmidi_transmit_empty</phrase></refentrytitle>
41359 <manvolnum>9</manvolnum>
41360 <refmiscinfo class="version">4.4.14</refmiscinfo>
41361</refmeta>
41362<refnamediv>
41363 <refname>snd_rawmidi_transmit_empty</refname>
41364 <refpurpose>
41365     check whether the output buffer is empty
41366 </refpurpose>
41367</refnamediv>
41368<refsynopsisdiv>
41369 <title>Synopsis</title>
41370  <funcsynopsis><funcprototype>
41371   <funcdef>int <function>snd_rawmidi_transmit_empty </function></funcdef>
41372   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
41373  </funcprototype></funcsynopsis>
41374</refsynopsisdiv>
41375<refsect1>
41376 <title>Arguments</title>
41377 <variablelist>
41378  <varlistentry>
41379   <term><parameter>substream</parameter></term>
41380   <listitem>
41381    <para>
41382     the rawmidi substream
41383    </para>
41384   </listitem>
41385  </varlistentry>
41386 </variablelist>
41387</refsect1>
41388<refsect1>
41389<title>Return</title>
41390<para>
41391   1 if the internal output buffer is empty, 0 if not.
41392</para>
41393</refsect1>
41394</refentry>
41395
41396<refentry id="API---snd-rawmidi-transmit-peek">
41397<refentryinfo>
41398 <title>LINUX</title>
41399 <productname>Kernel Hackers Manual</productname>
41400 <date>July 2017</date>
41401</refentryinfo>
41402<refmeta>
41403 <refentrytitle><phrase>__snd_rawmidi_transmit_peek</phrase></refentrytitle>
41404 <manvolnum>9</manvolnum>
41405 <refmiscinfo class="version">4.4.14</refmiscinfo>
41406</refmeta>
41407<refnamediv>
41408 <refname>__snd_rawmidi_transmit_peek</refname>
41409 <refpurpose>
41410     copy data from the internal buffer
41411 </refpurpose>
41412</refnamediv>
41413<refsynopsisdiv>
41414 <title>Synopsis</title>
41415  <funcsynopsis><funcprototype>
41416   <funcdef>int <function>__snd_rawmidi_transmit_peek </function></funcdef>
41417   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
41418   <paramdef>unsigned char * <parameter>buffer</parameter></paramdef>
41419   <paramdef>int <parameter>count</parameter></paramdef>
41420  </funcprototype></funcsynopsis>
41421</refsynopsisdiv>
41422<refsect1>
41423 <title>Arguments</title>
41424 <variablelist>
41425  <varlistentry>
41426   <term><parameter>substream</parameter></term>
41427   <listitem>
41428    <para>
41429     the rawmidi substream
41430    </para>
41431   </listitem>
41432  </varlistentry>
41433  <varlistentry>
41434   <term><parameter>buffer</parameter></term>
41435   <listitem>
41436    <para>
41437     the buffer pointer
41438    </para>
41439   </listitem>
41440  </varlistentry>
41441  <varlistentry>
41442   <term><parameter>count</parameter></term>
41443   <listitem>
41444    <para>
41445     data size to transfer
41446    </para>
41447   </listitem>
41448  </varlistentry>
41449 </variablelist>
41450</refsect1>
41451<refsect1>
41452<title>Description</title>
41453<para>
41454   This is a variant of <function><link linkend="API-snd-rawmidi-transmit-peek">snd_rawmidi_transmit_peek</link></function> without spinlock.
41455</para>
41456</refsect1>
41457</refentry>
41458
41459<refentry id="API-snd-rawmidi-transmit-peek">
41460<refentryinfo>
41461 <title>LINUX</title>
41462 <productname>Kernel Hackers Manual</productname>
41463 <date>July 2017</date>
41464</refentryinfo>
41465<refmeta>
41466 <refentrytitle><phrase>snd_rawmidi_transmit_peek</phrase></refentrytitle>
41467 <manvolnum>9</manvolnum>
41468 <refmiscinfo class="version">4.4.14</refmiscinfo>
41469</refmeta>
41470<refnamediv>
41471 <refname>snd_rawmidi_transmit_peek</refname>
41472 <refpurpose>
41473     copy data from the internal buffer
41474 </refpurpose>
41475</refnamediv>
41476<refsynopsisdiv>
41477 <title>Synopsis</title>
41478  <funcsynopsis><funcprototype>
41479   <funcdef>int <function>snd_rawmidi_transmit_peek </function></funcdef>
41480   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
41481   <paramdef>unsigned char * <parameter>buffer</parameter></paramdef>
41482   <paramdef>int <parameter>count</parameter></paramdef>
41483  </funcprototype></funcsynopsis>
41484</refsynopsisdiv>
41485<refsect1>
41486 <title>Arguments</title>
41487 <variablelist>
41488  <varlistentry>
41489   <term><parameter>substream</parameter></term>
41490   <listitem>
41491    <para>
41492     the rawmidi substream
41493    </para>
41494   </listitem>
41495  </varlistentry>
41496  <varlistentry>
41497   <term><parameter>buffer</parameter></term>
41498   <listitem>
41499    <para>
41500     the buffer pointer
41501    </para>
41502   </listitem>
41503  </varlistentry>
41504  <varlistentry>
41505   <term><parameter>count</parameter></term>
41506   <listitem>
41507    <para>
41508     data size to transfer
41509    </para>
41510   </listitem>
41511  </varlistentry>
41512 </variablelist>
41513</refsect1>
41514<refsect1>
41515<title>Description</title>
41516<para>
41517   Copies data from the internal output buffer to the given buffer.
41518   </para><para>
41519
41520   Call this in the interrupt handler when the midi output is ready,
41521   and call <function><link linkend="API-snd-rawmidi-transmit-ack">snd_rawmidi_transmit_ack</link></function> after the transmission is
41522   finished.
41523</para>
41524</refsect1>
41525<refsect1>
41526<title>Return</title>
41527<para>
41528   The size of copied data, or a negative error code on failure.
41529</para>
41530</refsect1>
41531</refentry>
41532
41533<refentry id="API---snd-rawmidi-transmit-ack">
41534<refentryinfo>
41535 <title>LINUX</title>
41536 <productname>Kernel Hackers Manual</productname>
41537 <date>July 2017</date>
41538</refentryinfo>
41539<refmeta>
41540 <refentrytitle><phrase>__snd_rawmidi_transmit_ack</phrase></refentrytitle>
41541 <manvolnum>9</manvolnum>
41542 <refmiscinfo class="version">4.4.14</refmiscinfo>
41543</refmeta>
41544<refnamediv>
41545 <refname>__snd_rawmidi_transmit_ack</refname>
41546 <refpurpose>
41547     acknowledge the transmission
41548 </refpurpose>
41549</refnamediv>
41550<refsynopsisdiv>
41551 <title>Synopsis</title>
41552  <funcsynopsis><funcprototype>
41553   <funcdef>int <function>__snd_rawmidi_transmit_ack </function></funcdef>
41554   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
41555   <paramdef>int <parameter>count</parameter></paramdef>
41556  </funcprototype></funcsynopsis>
41557</refsynopsisdiv>
41558<refsect1>
41559 <title>Arguments</title>
41560 <variablelist>
41561  <varlistentry>
41562   <term><parameter>substream</parameter></term>
41563   <listitem>
41564    <para>
41565     the rawmidi substream
41566    </para>
41567   </listitem>
41568  </varlistentry>
41569  <varlistentry>
41570   <term><parameter>count</parameter></term>
41571   <listitem>
41572    <para>
41573     the transferred count
41574    </para>
41575   </listitem>
41576  </varlistentry>
41577 </variablelist>
41578</refsect1>
41579<refsect1>
41580<title>Description</title>
41581<para>
41582   This is a variant of <function><link linkend="API---snd-rawmidi-transmit-ack">__snd_rawmidi_transmit_ack</link></function> without spinlock.
41583</para>
41584</refsect1>
41585</refentry>
41586
41587<refentry id="API-snd-rawmidi-transmit-ack">
41588<refentryinfo>
41589 <title>LINUX</title>
41590 <productname>Kernel Hackers Manual</productname>
41591 <date>July 2017</date>
41592</refentryinfo>
41593<refmeta>
41594 <refentrytitle><phrase>snd_rawmidi_transmit_ack</phrase></refentrytitle>
41595 <manvolnum>9</manvolnum>
41596 <refmiscinfo class="version">4.4.14</refmiscinfo>
41597</refmeta>
41598<refnamediv>
41599 <refname>snd_rawmidi_transmit_ack</refname>
41600 <refpurpose>
41601     acknowledge the transmission
41602 </refpurpose>
41603</refnamediv>
41604<refsynopsisdiv>
41605 <title>Synopsis</title>
41606  <funcsynopsis><funcprototype>
41607   <funcdef>int <function>snd_rawmidi_transmit_ack </function></funcdef>
41608   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
41609   <paramdef>int <parameter>count</parameter></paramdef>
41610  </funcprototype></funcsynopsis>
41611</refsynopsisdiv>
41612<refsect1>
41613 <title>Arguments</title>
41614 <variablelist>
41615  <varlistentry>
41616   <term><parameter>substream</parameter></term>
41617   <listitem>
41618    <para>
41619     the rawmidi substream
41620    </para>
41621   </listitem>
41622  </varlistentry>
41623  <varlistentry>
41624   <term><parameter>count</parameter></term>
41625   <listitem>
41626    <para>
41627     the transferred count
41628    </para>
41629   </listitem>
41630  </varlistentry>
41631 </variablelist>
41632</refsect1>
41633<refsect1>
41634<title>Description</title>
41635<para>
41636   Advances the hardware pointer for the internal output buffer with
41637   the given size and updates the condition.
41638   Call after the transmission is finished.
41639</para>
41640</refsect1>
41641<refsect1>
41642<title>Return</title>
41643<para>
41644   The advanced size if successful, or a negative error code on failure.
41645</para>
41646</refsect1>
41647</refentry>
41648
41649<refentry id="API-snd-rawmidi-transmit">
41650<refentryinfo>
41651 <title>LINUX</title>
41652 <productname>Kernel Hackers Manual</productname>
41653 <date>July 2017</date>
41654</refentryinfo>
41655<refmeta>
41656 <refentrytitle><phrase>snd_rawmidi_transmit</phrase></refentrytitle>
41657 <manvolnum>9</manvolnum>
41658 <refmiscinfo class="version">4.4.14</refmiscinfo>
41659</refmeta>
41660<refnamediv>
41661 <refname>snd_rawmidi_transmit</refname>
41662 <refpurpose>
41663     copy from the buffer to the device
41664 </refpurpose>
41665</refnamediv>
41666<refsynopsisdiv>
41667 <title>Synopsis</title>
41668  <funcsynopsis><funcprototype>
41669   <funcdef>int <function>snd_rawmidi_transmit </function></funcdef>
41670   <paramdef>struct snd_rawmidi_substream * <parameter>substream</parameter></paramdef>
41671   <paramdef>unsigned char * <parameter>buffer</parameter></paramdef>
41672   <paramdef>int <parameter>count</parameter></paramdef>
41673  </funcprototype></funcsynopsis>
41674</refsynopsisdiv>
41675<refsect1>
41676 <title>Arguments</title>
41677 <variablelist>
41678  <varlistentry>
41679   <term><parameter>substream</parameter></term>
41680   <listitem>
41681    <para>
41682     the rawmidi substream
41683    </para>
41684   </listitem>
41685  </varlistentry>
41686  <varlistentry>
41687   <term><parameter>buffer</parameter></term>
41688   <listitem>
41689    <para>
41690     the buffer pointer
41691    </para>
41692   </listitem>
41693  </varlistentry>
41694  <varlistentry>
41695   <term><parameter>count</parameter></term>
41696   <listitem>
41697    <para>
41698     the data size to transfer
41699    </para>
41700   </listitem>
41701  </varlistentry>
41702 </variablelist>
41703</refsect1>
41704<refsect1>
41705<title>Description</title>
41706<para>
41707   Copies data from the buffer to the device and advances the pointer.
41708</para>
41709</refsect1>
41710<refsect1>
41711<title>Return</title>
41712<para>
41713   The copied size if successful, or a negative error code on failure.
41714</para>
41715</refsect1>
41716</refentry>
41717
41718<refentry id="API-snd-rawmidi-new">
41719<refentryinfo>
41720 <title>LINUX</title>
41721 <productname>Kernel Hackers Manual</productname>
41722 <date>July 2017</date>
41723</refentryinfo>
41724<refmeta>
41725 <refentrytitle><phrase>snd_rawmidi_new</phrase></refentrytitle>
41726 <manvolnum>9</manvolnum>
41727 <refmiscinfo class="version">4.4.14</refmiscinfo>
41728</refmeta>
41729<refnamediv>
41730 <refname>snd_rawmidi_new</refname>
41731 <refpurpose>
41732     create a rawmidi instance
41733 </refpurpose>
41734</refnamediv>
41735<refsynopsisdiv>
41736 <title>Synopsis</title>
41737  <funcsynopsis><funcprototype>
41738   <funcdef>int <function>snd_rawmidi_new </function></funcdef>
41739   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
41740   <paramdef>char * <parameter>id</parameter></paramdef>
41741   <paramdef>int <parameter>device</parameter></paramdef>
41742   <paramdef>int <parameter>output_count</parameter></paramdef>
41743   <paramdef>int <parameter>input_count</parameter></paramdef>
41744   <paramdef>struct snd_rawmidi ** <parameter>rrawmidi</parameter></paramdef>
41745  </funcprototype></funcsynopsis>
41746</refsynopsisdiv>
41747<refsect1>
41748 <title>Arguments</title>
41749 <variablelist>
41750  <varlistentry>
41751   <term><parameter>card</parameter></term>
41752   <listitem>
41753    <para>
41754     the card instance
41755    </para>
41756   </listitem>
41757  </varlistentry>
41758  <varlistentry>
41759   <term><parameter>id</parameter></term>
41760   <listitem>
41761    <para>
41762     the id string
41763    </para>
41764   </listitem>
41765  </varlistentry>
41766  <varlistentry>
41767   <term><parameter>device</parameter></term>
41768   <listitem>
41769    <para>
41770     the device index
41771    </para>
41772   </listitem>
41773  </varlistentry>
41774  <varlistentry>
41775   <term><parameter>output_count</parameter></term>
41776   <listitem>
41777    <para>
41778     the number of output streams
41779    </para>
41780   </listitem>
41781  </varlistentry>
41782  <varlistentry>
41783   <term><parameter>input_count</parameter></term>
41784   <listitem>
41785    <para>
41786     the number of input streams
41787    </para>
41788   </listitem>
41789  </varlistentry>
41790  <varlistentry>
41791   <term><parameter>rrawmidi</parameter></term>
41792   <listitem>
41793    <para>
41794     the pointer to store the new rawmidi instance
41795    </para>
41796   </listitem>
41797  </varlistentry>
41798 </variablelist>
41799</refsect1>
41800<refsect1>
41801<title>Description</title>
41802<para>
41803   Creates a new rawmidi instance.
41804   Use <function><link linkend="API-snd-rawmidi-set-ops">snd_rawmidi_set_ops</link></function> to set the operators to the new instance.
41805</para>
41806</refsect1>
41807<refsect1>
41808<title>Return</title>
41809<para>
41810   Zero if successful, or a negative error code on failure.
41811</para>
41812</refsect1>
41813</refentry>
41814
41815<refentry id="API-snd-rawmidi-set-ops">
41816<refentryinfo>
41817 <title>LINUX</title>
41818 <productname>Kernel Hackers Manual</productname>
41819 <date>July 2017</date>
41820</refentryinfo>
41821<refmeta>
41822 <refentrytitle><phrase>snd_rawmidi_set_ops</phrase></refentrytitle>
41823 <manvolnum>9</manvolnum>
41824 <refmiscinfo class="version">4.4.14</refmiscinfo>
41825</refmeta>
41826<refnamediv>
41827 <refname>snd_rawmidi_set_ops</refname>
41828 <refpurpose>
41829     set the rawmidi operators
41830 </refpurpose>
41831</refnamediv>
41832<refsynopsisdiv>
41833 <title>Synopsis</title>
41834  <funcsynopsis><funcprototype>
41835   <funcdef>void <function>snd_rawmidi_set_ops </function></funcdef>
41836   <paramdef>struct snd_rawmidi * <parameter>rmidi</parameter></paramdef>
41837   <paramdef>int <parameter>stream</parameter></paramdef>
41838   <paramdef>struct snd_rawmidi_ops * <parameter>ops</parameter></paramdef>
41839  </funcprototype></funcsynopsis>
41840</refsynopsisdiv>
41841<refsect1>
41842 <title>Arguments</title>
41843 <variablelist>
41844  <varlistentry>
41845   <term><parameter>rmidi</parameter></term>
41846   <listitem>
41847    <para>
41848     the rawmidi instance
41849    </para>
41850   </listitem>
41851  </varlistentry>
41852  <varlistentry>
41853   <term><parameter>stream</parameter></term>
41854   <listitem>
41855    <para>
41856     the stream direction, SNDRV_RAWMIDI_STREAM_XXX
41857    </para>
41858   </listitem>
41859  </varlistentry>
41860  <varlistentry>
41861   <term><parameter>ops</parameter></term>
41862   <listitem>
41863    <para>
41864     the operator table
41865    </para>
41866   </listitem>
41867  </varlistentry>
41868 </variablelist>
41869</refsect1>
41870<refsect1>
41871<title>Description</title>
41872<para>
41873   Sets the rawmidi operators for the given stream direction.
41874</para>
41875</refsect1>
41876</refentry>
41877
41878<!-- sound/core/sound.c -->
41879<refentry id="API-snd-request-card">
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_request_card</phrase></refentrytitle>
41887 <manvolnum>9</manvolnum>
41888 <refmiscinfo class="version">4.4.14</refmiscinfo>
41889</refmeta>
41890<refnamediv>
41891 <refname>snd_request_card</refname>
41892 <refpurpose>
41893  try to load the card module
41894 </refpurpose>
41895</refnamediv>
41896<refsynopsisdiv>
41897 <title>Synopsis</title>
41898  <funcsynopsis><funcprototype>
41899   <funcdef>void <function>snd_request_card </function></funcdef>
41900   <paramdef>int <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     the card number
41911    </para>
41912   </listitem>
41913  </varlistentry>
41914 </variablelist>
41915</refsect1>
41916<refsect1>
41917<title>Description</title>
41918<para>
41919   Tries to load the module <quote>snd-card-X</quote> for the given card number
41920   via request_module.  Returns immediately if already loaded.
41921</para>
41922</refsect1>
41923</refentry>
41924
41925<refentry id="API-snd-lookup-minor-data">
41926<refentryinfo>
41927 <title>LINUX</title>
41928 <productname>Kernel Hackers Manual</productname>
41929 <date>July 2017</date>
41930</refentryinfo>
41931<refmeta>
41932 <refentrytitle><phrase>snd_lookup_minor_data</phrase></refentrytitle>
41933 <manvolnum>9</manvolnum>
41934 <refmiscinfo class="version">4.4.14</refmiscinfo>
41935</refmeta>
41936<refnamediv>
41937 <refname>snd_lookup_minor_data</refname>
41938 <refpurpose>
41939     get user data of a registered device
41940 </refpurpose>
41941</refnamediv>
41942<refsynopsisdiv>
41943 <title>Synopsis</title>
41944  <funcsynopsis><funcprototype>
41945   <funcdef>void * <function>snd_lookup_minor_data </function></funcdef>
41946   <paramdef>unsigned int <parameter>minor</parameter></paramdef>
41947   <paramdef>int <parameter>type</parameter></paramdef>
41948  </funcprototype></funcsynopsis>
41949</refsynopsisdiv>
41950<refsect1>
41951 <title>Arguments</title>
41952 <variablelist>
41953  <varlistentry>
41954   <term><parameter>minor</parameter></term>
41955   <listitem>
41956    <para>
41957     the minor number
41958    </para>
41959   </listitem>
41960  </varlistentry>
41961  <varlistentry>
41962   <term><parameter>type</parameter></term>
41963   <listitem>
41964    <para>
41965     device type (SNDRV_DEVICE_TYPE_XXX)
41966    </para>
41967   </listitem>
41968  </varlistentry>
41969 </variablelist>
41970</refsect1>
41971<refsect1>
41972<title>Description</title>
41973<para>
41974   Checks that a minor device with the specified type is registered, and returns
41975   its user data pointer.
41976   </para><para>
41977
41978   This function increments the reference counter of the card instance
41979   if an associated instance with the given minor number and type is found.
41980   The caller must call <function>snd_card_unref</function> appropriately later.
41981</para>
41982</refsect1>
41983<refsect1>
41984<title>Return</title>
41985<para>
41986   The user data pointer if the specified device is found. <constant>NULL</constant>
41987   otherwise.
41988</para>
41989</refsect1>
41990</refentry>
41991
41992<refentry id="API-snd-register-device">
41993<refentryinfo>
41994 <title>LINUX</title>
41995 <productname>Kernel Hackers Manual</productname>
41996 <date>July 2017</date>
41997</refentryinfo>
41998<refmeta>
41999 <refentrytitle><phrase>snd_register_device</phrase></refentrytitle>
42000 <manvolnum>9</manvolnum>
42001 <refmiscinfo class="version">4.4.14</refmiscinfo>
42002</refmeta>
42003<refnamediv>
42004 <refname>snd_register_device</refname>
42005 <refpurpose>
42006     Register the ALSA device file for the card
42007 </refpurpose>
42008</refnamediv>
42009<refsynopsisdiv>
42010 <title>Synopsis</title>
42011  <funcsynopsis><funcprototype>
42012   <funcdef>int <function>snd_register_device </function></funcdef>
42013   <paramdef>int <parameter>type</parameter></paramdef>
42014   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42015   <paramdef>int <parameter>dev</parameter></paramdef>
42016   <paramdef>const struct file_operations * <parameter>f_ops</parameter></paramdef>
42017   <paramdef>void * <parameter>private_data</parameter></paramdef>
42018   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device</parameter></paramdef>
42019  </funcprototype></funcsynopsis>
42020</refsynopsisdiv>
42021<refsect1>
42022 <title>Arguments</title>
42023 <variablelist>
42024  <varlistentry>
42025   <term><parameter>type</parameter></term>
42026   <listitem>
42027    <para>
42028     the device type, SNDRV_DEVICE_TYPE_XXX
42029    </para>
42030   </listitem>
42031  </varlistentry>
42032  <varlistentry>
42033   <term><parameter>card</parameter></term>
42034   <listitem>
42035    <para>
42036     the card instance
42037    </para>
42038   </listitem>
42039  </varlistentry>
42040  <varlistentry>
42041   <term><parameter>dev</parameter></term>
42042   <listitem>
42043    <para>
42044     the device index
42045    </para>
42046   </listitem>
42047  </varlistentry>
42048  <varlistentry>
42049   <term><parameter>f_ops</parameter></term>
42050   <listitem>
42051    <para>
42052     the file operations
42053    </para>
42054   </listitem>
42055  </varlistentry>
42056  <varlistentry>
42057   <term><parameter>private_data</parameter></term>
42058   <listitem>
42059    <para>
42060     user pointer for f_ops-&gt;<function>open</function>
42061    </para>
42062   </listitem>
42063  </varlistentry>
42064  <varlistentry>
42065   <term><parameter>device</parameter></term>
42066   <listitem>
42067    <para>
42068     the device to register
42069    </para>
42070   </listitem>
42071  </varlistentry>
42072 </variablelist>
42073</refsect1>
42074<refsect1>
42075<title>Description</title>
42076<para>
42077   Registers an ALSA device file for the given card.
42078   The operators have to be set in reg parameter.
42079</para>
42080</refsect1>
42081<refsect1>
42082<title>Return</title>
42083<para>
42084   Zero if successful, or a negative error code on failure.
42085</para>
42086</refsect1>
42087</refentry>
42088
42089<refentry id="API-snd-unregister-device">
42090<refentryinfo>
42091 <title>LINUX</title>
42092 <productname>Kernel Hackers Manual</productname>
42093 <date>July 2017</date>
42094</refentryinfo>
42095<refmeta>
42096 <refentrytitle><phrase>snd_unregister_device</phrase></refentrytitle>
42097 <manvolnum>9</manvolnum>
42098 <refmiscinfo class="version">4.4.14</refmiscinfo>
42099</refmeta>
42100<refnamediv>
42101 <refname>snd_unregister_device</refname>
42102 <refpurpose>
42103     unregister the device on the given card
42104 </refpurpose>
42105</refnamediv>
42106<refsynopsisdiv>
42107 <title>Synopsis</title>
42108  <funcsynopsis><funcprototype>
42109   <funcdef>int <function>snd_unregister_device </function></funcdef>
42110   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
42111  </funcprototype></funcsynopsis>
42112</refsynopsisdiv>
42113<refsect1>
42114 <title>Arguments</title>
42115 <variablelist>
42116  <varlistentry>
42117   <term><parameter>dev</parameter></term>
42118   <listitem>
42119    <para>
42120     the device instance
42121    </para>
42122   </listitem>
42123  </varlistentry>
42124 </variablelist>
42125</refsect1>
42126<refsect1>
42127<title>Description</title>
42128<para>
42129   Unregisters the device file already registered via
42130   <function><link linkend="API-snd-register-device">snd_register_device</link></function>.
42131</para>
42132</refsect1>
42133<refsect1>
42134<title>Return</title>
42135<para>
42136   Zero if successful, or a negative error code on failure.
42137</para>
42138</refsect1>
42139</refentry>
42140
42141<!-- sound/core/memory.c -->
42142<refentry id="API-copy-to-user-fromio">
42143<refentryinfo>
42144 <title>LINUX</title>
42145 <productname>Kernel Hackers Manual</productname>
42146 <date>July 2017</date>
42147</refentryinfo>
42148<refmeta>
42149 <refentrytitle><phrase>copy_to_user_fromio</phrase></refentrytitle>
42150 <manvolnum>9</manvolnum>
42151 <refmiscinfo class="version">4.4.14</refmiscinfo>
42152</refmeta>
42153<refnamediv>
42154 <refname>copy_to_user_fromio</refname>
42155 <refpurpose>
42156  copy data from mmio-space to user-space
42157 </refpurpose>
42158</refnamediv>
42159<refsynopsisdiv>
42160 <title>Synopsis</title>
42161  <funcsynopsis><funcprototype>
42162   <funcdef>int <function>copy_to_user_fromio </function></funcdef>
42163   <paramdef>void __user * <parameter>dst</parameter></paramdef>
42164   <paramdef>const volatile void __iomem * <parameter>src</parameter></paramdef>
42165   <paramdef>size_t <parameter>count</parameter></paramdef>
42166  </funcprototype></funcsynopsis>
42167</refsynopsisdiv>
42168<refsect1>
42169 <title>Arguments</title>
42170 <variablelist>
42171  <varlistentry>
42172   <term><parameter>dst</parameter></term>
42173   <listitem>
42174    <para>
42175     the destination pointer on user-space
42176    </para>
42177   </listitem>
42178  </varlistentry>
42179  <varlistentry>
42180   <term><parameter>src</parameter></term>
42181   <listitem>
42182    <para>
42183     the source pointer on mmio
42184    </para>
42185   </listitem>
42186  </varlistentry>
42187  <varlistentry>
42188   <term><parameter>count</parameter></term>
42189   <listitem>
42190    <para>
42191     the data size to copy in bytes
42192    </para>
42193   </listitem>
42194  </varlistentry>
42195 </variablelist>
42196</refsect1>
42197<refsect1>
42198<title>Description</title>
42199<para>
42200   Copies the data from mmio-space to user-space.
42201</para>
42202</refsect1>
42203<refsect1>
42204<title>Return</title>
42205<para>
42206   Zero if successful, or non-zero on failure.
42207</para>
42208</refsect1>
42209</refentry>
42210
42211<refentry id="API-copy-from-user-toio">
42212<refentryinfo>
42213 <title>LINUX</title>
42214 <productname>Kernel Hackers Manual</productname>
42215 <date>July 2017</date>
42216</refentryinfo>
42217<refmeta>
42218 <refentrytitle><phrase>copy_from_user_toio</phrase></refentrytitle>
42219 <manvolnum>9</manvolnum>
42220 <refmiscinfo class="version">4.4.14</refmiscinfo>
42221</refmeta>
42222<refnamediv>
42223 <refname>copy_from_user_toio</refname>
42224 <refpurpose>
42225     copy data from user-space to mmio-space
42226 </refpurpose>
42227</refnamediv>
42228<refsynopsisdiv>
42229 <title>Synopsis</title>
42230  <funcsynopsis><funcprototype>
42231   <funcdef>int <function>copy_from_user_toio </function></funcdef>
42232   <paramdef>volatile void __iomem * <parameter>dst</parameter></paramdef>
42233   <paramdef>const void __user * <parameter>src</parameter></paramdef>
42234   <paramdef>size_t <parameter>count</parameter></paramdef>
42235  </funcprototype></funcsynopsis>
42236</refsynopsisdiv>
42237<refsect1>
42238 <title>Arguments</title>
42239 <variablelist>
42240  <varlistentry>
42241   <term><parameter>dst</parameter></term>
42242   <listitem>
42243    <para>
42244     the destination pointer on mmio-space
42245    </para>
42246   </listitem>
42247  </varlistentry>
42248  <varlistentry>
42249   <term><parameter>src</parameter></term>
42250   <listitem>
42251    <para>
42252     the source pointer on user-space
42253    </para>
42254   </listitem>
42255  </varlistentry>
42256  <varlistentry>
42257   <term><parameter>count</parameter></term>
42258   <listitem>
42259    <para>
42260     the data size to copy in bytes
42261    </para>
42262   </listitem>
42263  </varlistentry>
42264 </variablelist>
42265</refsect1>
42266<refsect1>
42267<title>Description</title>
42268<para>
42269   Copies the data from user-space to mmio-space.
42270</para>
42271</refsect1>
42272<refsect1>
42273<title>Return</title>
42274<para>
42275   Zero if successful, or non-zero on failure.
42276</para>
42277</refsect1>
42278</refentry>
42279
42280<!-- sound/core/pcm_memory.c -->
42281<refentry id="API-snd-pcm-lib-preallocate-free-for-all">
42282<refentryinfo>
42283 <title>LINUX</title>
42284 <productname>Kernel Hackers Manual</productname>
42285 <date>July 2017</date>
42286</refentryinfo>
42287<refmeta>
42288 <refentrytitle><phrase>snd_pcm_lib_preallocate_free_for_all</phrase></refentrytitle>
42289 <manvolnum>9</manvolnum>
42290 <refmiscinfo class="version">4.4.14</refmiscinfo>
42291</refmeta>
42292<refnamediv>
42293 <refname>snd_pcm_lib_preallocate_free_for_all</refname>
42294 <refpurpose>
42295  release all pre-allocated buffers on the pcm
42296 </refpurpose>
42297</refnamediv>
42298<refsynopsisdiv>
42299 <title>Synopsis</title>
42300  <funcsynopsis><funcprototype>
42301   <funcdef>int <function>snd_pcm_lib_preallocate_free_for_all </function></funcdef>
42302   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
42303  </funcprototype></funcsynopsis>
42304</refsynopsisdiv>
42305<refsect1>
42306 <title>Arguments</title>
42307 <variablelist>
42308  <varlistentry>
42309   <term><parameter>pcm</parameter></term>
42310   <listitem>
42311    <para>
42312     the pcm instance
42313    </para>
42314   </listitem>
42315  </varlistentry>
42316 </variablelist>
42317</refsect1>
42318<refsect1>
42319<title>Description</title>
42320<para>
42321   Releases all the pre-allocated buffers on the given pcm.
42322</para>
42323</refsect1>
42324<refsect1>
42325<title>Return</title>
42326<para>
42327   Zero if successful, or a negative error code on failure.
42328</para>
42329</refsect1>
42330</refentry>
42331
42332<refentry id="API-snd-pcm-lib-preallocate-pages">
42333<refentryinfo>
42334 <title>LINUX</title>
42335 <productname>Kernel Hackers Manual</productname>
42336 <date>July 2017</date>
42337</refentryinfo>
42338<refmeta>
42339 <refentrytitle><phrase>snd_pcm_lib_preallocate_pages</phrase></refentrytitle>
42340 <manvolnum>9</manvolnum>
42341 <refmiscinfo class="version">4.4.14</refmiscinfo>
42342</refmeta>
42343<refnamediv>
42344 <refname>snd_pcm_lib_preallocate_pages</refname>
42345 <refpurpose>
42346     pre-allocation for the given DMA type
42347 </refpurpose>
42348</refnamediv>
42349<refsynopsisdiv>
42350 <title>Synopsis</title>
42351  <funcsynopsis><funcprototype>
42352   <funcdef>int <function>snd_pcm_lib_preallocate_pages </function></funcdef>
42353   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
42354   <paramdef>int <parameter>type</parameter></paramdef>
42355   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>data</parameter></paramdef>
42356   <paramdef>size_t <parameter>size</parameter></paramdef>
42357   <paramdef>size_t <parameter>max</parameter></paramdef>
42358  </funcprototype></funcsynopsis>
42359</refsynopsisdiv>
42360<refsect1>
42361 <title>Arguments</title>
42362 <variablelist>
42363  <varlistentry>
42364   <term><parameter>substream</parameter></term>
42365   <listitem>
42366    <para>
42367     the pcm substream instance
42368    </para>
42369   </listitem>
42370  </varlistentry>
42371  <varlistentry>
42372   <term><parameter>type</parameter></term>
42373   <listitem>
42374    <para>
42375     DMA type (SNDRV_DMA_TYPE_*)
42376    </para>
42377   </listitem>
42378  </varlistentry>
42379  <varlistentry>
42380   <term><parameter>data</parameter></term>
42381   <listitem>
42382    <para>
42383     DMA type dependent data
42384    </para>
42385   </listitem>
42386  </varlistentry>
42387  <varlistentry>
42388   <term><parameter>size</parameter></term>
42389   <listitem>
42390    <para>
42391     the requested pre-allocation size in bytes
42392    </para>
42393   </listitem>
42394  </varlistentry>
42395  <varlistentry>
42396   <term><parameter>max</parameter></term>
42397   <listitem>
42398    <para>
42399     the max. allowed pre-allocation size
42400    </para>
42401   </listitem>
42402  </varlistentry>
42403 </variablelist>
42404</refsect1>
42405<refsect1>
42406<title>Description</title>
42407<para>
42408   Do pre-allocation for the given DMA buffer type.
42409</para>
42410</refsect1>
42411<refsect1>
42412<title>Return</title>
42413<para>
42414   Zero if successful, or a negative error code on failure.
42415</para>
42416</refsect1>
42417</refentry>
42418
42419<refentry id="API-snd-pcm-lib-preallocate-pages-for-all">
42420<refentryinfo>
42421 <title>LINUX</title>
42422 <productname>Kernel Hackers Manual</productname>
42423 <date>July 2017</date>
42424</refentryinfo>
42425<refmeta>
42426 <refentrytitle><phrase>snd_pcm_lib_preallocate_pages_for_all</phrase></refentrytitle>
42427 <manvolnum>9</manvolnum>
42428 <refmiscinfo class="version">4.4.14</refmiscinfo>
42429</refmeta>
42430<refnamediv>
42431 <refname>snd_pcm_lib_preallocate_pages_for_all</refname>
42432 <refpurpose>
42433     pre-allocation for continuous memory type (all substreams)
42434 </refpurpose>
42435</refnamediv>
42436<refsynopsisdiv>
42437 <title>Synopsis</title>
42438  <funcsynopsis><funcprototype>
42439   <funcdef>int <function>snd_pcm_lib_preallocate_pages_for_all </function></funcdef>
42440   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
42441   <paramdef>int <parameter>type</parameter></paramdef>
42442   <paramdef>void * <parameter>data</parameter></paramdef>
42443   <paramdef>size_t <parameter>size</parameter></paramdef>
42444   <paramdef>size_t <parameter>max</parameter></paramdef>
42445  </funcprototype></funcsynopsis>
42446</refsynopsisdiv>
42447<refsect1>
42448 <title>Arguments</title>
42449 <variablelist>
42450  <varlistentry>
42451   <term><parameter>pcm</parameter></term>
42452   <listitem>
42453    <para>
42454     the pcm instance
42455    </para>
42456   </listitem>
42457  </varlistentry>
42458  <varlistentry>
42459   <term><parameter>type</parameter></term>
42460   <listitem>
42461    <para>
42462     DMA type (SNDRV_DMA_TYPE_*)
42463    </para>
42464   </listitem>
42465  </varlistentry>
42466  <varlistentry>
42467   <term><parameter>data</parameter></term>
42468   <listitem>
42469    <para>
42470     DMA type dependent data
42471    </para>
42472   </listitem>
42473  </varlistentry>
42474  <varlistentry>
42475   <term><parameter>size</parameter></term>
42476   <listitem>
42477    <para>
42478     the requested pre-allocation size in bytes
42479    </para>
42480   </listitem>
42481  </varlistentry>
42482  <varlistentry>
42483   <term><parameter>max</parameter></term>
42484   <listitem>
42485    <para>
42486     the max. allowed pre-allocation size
42487    </para>
42488   </listitem>
42489  </varlistentry>
42490 </variablelist>
42491</refsect1>
42492<refsect1>
42493<title>Description</title>
42494<para>
42495   Do pre-allocation to all substreams of the given pcm for the
42496   specified DMA type.
42497</para>
42498</refsect1>
42499<refsect1>
42500<title>Return</title>
42501<para>
42502   Zero if successful, or a negative error code on failure.
42503</para>
42504</refsect1>
42505</refentry>
42506
42507<refentry id="API-snd-pcm-sgbuf-ops-page">
42508<refentryinfo>
42509 <title>LINUX</title>
42510 <productname>Kernel Hackers Manual</productname>
42511 <date>July 2017</date>
42512</refentryinfo>
42513<refmeta>
42514 <refentrytitle><phrase>snd_pcm_sgbuf_ops_page</phrase></refentrytitle>
42515 <manvolnum>9</manvolnum>
42516 <refmiscinfo class="version">4.4.14</refmiscinfo>
42517</refmeta>
42518<refnamediv>
42519 <refname>snd_pcm_sgbuf_ops_page</refname>
42520 <refpurpose>
42521     get the page struct at the given offset
42522 </refpurpose>
42523</refnamediv>
42524<refsynopsisdiv>
42525 <title>Synopsis</title>
42526  <funcsynopsis><funcprototype>
42527   <funcdef>struct page * <function>snd_pcm_sgbuf_ops_page </function></funcdef>
42528   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
42529   <paramdef>unsigned long <parameter>offset</parameter></paramdef>
42530  </funcprototype></funcsynopsis>
42531</refsynopsisdiv>
42532<refsect1>
42533 <title>Arguments</title>
42534 <variablelist>
42535  <varlistentry>
42536   <term><parameter>substream</parameter></term>
42537   <listitem>
42538    <para>
42539     the pcm substream instance
42540    </para>
42541   </listitem>
42542  </varlistentry>
42543  <varlistentry>
42544   <term><parameter>offset</parameter></term>
42545   <listitem>
42546    <para>
42547     the buffer offset
42548    </para>
42549   </listitem>
42550  </varlistentry>
42551 </variablelist>
42552</refsect1>
42553<refsect1>
42554<title>Description</title>
42555<para>
42556   Used as the page callback of PCM ops.
42557</para>
42558</refsect1>
42559<refsect1>
42560<title>Return</title>
42561<para>
42562   The page struct at the given buffer offset. <constant>NULL</constant> on failure.
42563</para>
42564</refsect1>
42565</refentry>
42566
42567<refentry id="API-snd-pcm-lib-malloc-pages">
42568<refentryinfo>
42569 <title>LINUX</title>
42570 <productname>Kernel Hackers Manual</productname>
42571 <date>July 2017</date>
42572</refentryinfo>
42573<refmeta>
42574 <refentrytitle><phrase>snd_pcm_lib_malloc_pages</phrase></refentrytitle>
42575 <manvolnum>9</manvolnum>
42576 <refmiscinfo class="version">4.4.14</refmiscinfo>
42577</refmeta>
42578<refnamediv>
42579 <refname>snd_pcm_lib_malloc_pages</refname>
42580 <refpurpose>
42581     allocate the DMA buffer
42582 </refpurpose>
42583</refnamediv>
42584<refsynopsisdiv>
42585 <title>Synopsis</title>
42586  <funcsynopsis><funcprototype>
42587   <funcdef>int <function>snd_pcm_lib_malloc_pages </function></funcdef>
42588   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
42589   <paramdef>size_t <parameter>size</parameter></paramdef>
42590  </funcprototype></funcsynopsis>
42591</refsynopsisdiv>
42592<refsect1>
42593 <title>Arguments</title>
42594 <variablelist>
42595  <varlistentry>
42596   <term><parameter>substream</parameter></term>
42597   <listitem>
42598    <para>
42599     the substream to allocate the DMA buffer to
42600    </para>
42601   </listitem>
42602  </varlistentry>
42603  <varlistentry>
42604   <term><parameter>size</parameter></term>
42605   <listitem>
42606    <para>
42607     the requested buffer size in bytes
42608    </para>
42609   </listitem>
42610  </varlistentry>
42611 </variablelist>
42612</refsect1>
42613<refsect1>
42614<title>Description</title>
42615<para>
42616   Allocates the DMA buffer on the BUS type given earlier to
42617   <function>snd_pcm_lib_preallocate_xxx_pages</function>.
42618</para>
42619</refsect1>
42620<refsect1>
42621<title>Return</title>
42622<para>
42623   1 if the buffer is changed, 0 if not changed, or a negative
42624   code on failure.
42625</para>
42626</refsect1>
42627</refentry>
42628
42629<refentry id="API-snd-pcm-lib-free-pages">
42630<refentryinfo>
42631 <title>LINUX</title>
42632 <productname>Kernel Hackers Manual</productname>
42633 <date>July 2017</date>
42634</refentryinfo>
42635<refmeta>
42636 <refentrytitle><phrase>snd_pcm_lib_free_pages</phrase></refentrytitle>
42637 <manvolnum>9</manvolnum>
42638 <refmiscinfo class="version">4.4.14</refmiscinfo>
42639</refmeta>
42640<refnamediv>
42641 <refname>snd_pcm_lib_free_pages</refname>
42642 <refpurpose>
42643     release the allocated DMA buffer.
42644 </refpurpose>
42645</refnamediv>
42646<refsynopsisdiv>
42647 <title>Synopsis</title>
42648  <funcsynopsis><funcprototype>
42649   <funcdef>int <function>snd_pcm_lib_free_pages </function></funcdef>
42650   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
42651  </funcprototype></funcsynopsis>
42652</refsynopsisdiv>
42653<refsect1>
42654 <title>Arguments</title>
42655 <variablelist>
42656  <varlistentry>
42657   <term><parameter>substream</parameter></term>
42658   <listitem>
42659    <para>
42660     the substream to release the DMA buffer
42661    </para>
42662   </listitem>
42663  </varlistentry>
42664 </variablelist>
42665</refsect1>
42666<refsect1>
42667<title>Description</title>
42668<para>
42669   Releases the DMA buffer allocated via <function><link linkend="API-snd-pcm-lib-malloc-pages">snd_pcm_lib_malloc_pages</link></function>.
42670</para>
42671</refsect1>
42672<refsect1>
42673<title>Return</title>
42674<para>
42675   Zero if successful, or a negative error code on failure.
42676</para>
42677</refsect1>
42678</refentry>
42679
42680<refentry id="API-snd-pcm-lib-free-vmalloc-buffer">
42681<refentryinfo>
42682 <title>LINUX</title>
42683 <productname>Kernel Hackers Manual</productname>
42684 <date>July 2017</date>
42685</refentryinfo>
42686<refmeta>
42687 <refentrytitle><phrase>snd_pcm_lib_free_vmalloc_buffer</phrase></refentrytitle>
42688 <manvolnum>9</manvolnum>
42689 <refmiscinfo class="version">4.4.14</refmiscinfo>
42690</refmeta>
42691<refnamediv>
42692 <refname>snd_pcm_lib_free_vmalloc_buffer</refname>
42693 <refpurpose>
42694     free vmalloc buffer
42695 </refpurpose>
42696</refnamediv>
42697<refsynopsisdiv>
42698 <title>Synopsis</title>
42699  <funcsynopsis><funcprototype>
42700   <funcdef>int <function>snd_pcm_lib_free_vmalloc_buffer </function></funcdef>
42701   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
42702  </funcprototype></funcsynopsis>
42703</refsynopsisdiv>
42704<refsect1>
42705 <title>Arguments</title>
42706 <variablelist>
42707  <varlistentry>
42708   <term><parameter>substream</parameter></term>
42709   <listitem>
42710    <para>
42711     the substream with a buffer allocated by
42712     <function><link linkend="API-snd-pcm-lib-alloc-vmalloc-buffer">snd_pcm_lib_alloc_vmalloc_buffer</link></function>
42713    </para>
42714   </listitem>
42715  </varlistentry>
42716 </variablelist>
42717</refsect1>
42718<refsect1>
42719<title>Return</title>
42720<para>
42721   Zero if successful, or a negative error code on failure.
42722</para>
42723</refsect1>
42724</refentry>
42725
42726<refentry id="API-snd-pcm-lib-get-vmalloc-page">
42727<refentryinfo>
42728 <title>LINUX</title>
42729 <productname>Kernel Hackers Manual</productname>
42730 <date>July 2017</date>
42731</refentryinfo>
42732<refmeta>
42733 <refentrytitle><phrase>snd_pcm_lib_get_vmalloc_page</phrase></refentrytitle>
42734 <manvolnum>9</manvolnum>
42735 <refmiscinfo class="version">4.4.14</refmiscinfo>
42736</refmeta>
42737<refnamediv>
42738 <refname>snd_pcm_lib_get_vmalloc_page</refname>
42739 <refpurpose>
42740     map vmalloc buffer offset to page struct
42741 </refpurpose>
42742</refnamediv>
42743<refsynopsisdiv>
42744 <title>Synopsis</title>
42745  <funcsynopsis><funcprototype>
42746   <funcdef>struct page * <function>snd_pcm_lib_get_vmalloc_page </function></funcdef>
42747   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
42748   <paramdef>unsigned long <parameter>offset</parameter></paramdef>
42749  </funcprototype></funcsynopsis>
42750</refsynopsisdiv>
42751<refsect1>
42752 <title>Arguments</title>
42753 <variablelist>
42754  <varlistentry>
42755   <term><parameter>substream</parameter></term>
42756   <listitem>
42757    <para>
42758     the substream with a buffer allocated by
42759     <function><link linkend="API-snd-pcm-lib-alloc-vmalloc-buffer">snd_pcm_lib_alloc_vmalloc_buffer</link></function>
42760    </para>
42761   </listitem>
42762  </varlistentry>
42763  <varlistentry>
42764   <term><parameter>offset</parameter></term>
42765   <listitem>
42766    <para>
42767     offset in the buffer
42768    </para>
42769   </listitem>
42770  </varlistentry>
42771 </variablelist>
42772</refsect1>
42773<refsect1>
42774<title>Description</title>
42775<para>
42776   This function is to be used as the page callback in the PCM ops.
42777</para>
42778</refsect1>
42779<refsect1>
42780<title>Return</title>
42781<para>
42782   The page struct, or <constant>NULL</constant> on failure.
42783</para>
42784</refsect1>
42785</refentry>
42786
42787<!-- sound/core/init.c -->
42788<refentry id="API-snd-device-initialize">
42789<refentryinfo>
42790 <title>LINUX</title>
42791 <productname>Kernel Hackers Manual</productname>
42792 <date>July 2017</date>
42793</refentryinfo>
42794<refmeta>
42795 <refentrytitle><phrase>snd_device_initialize</phrase></refentrytitle>
42796 <manvolnum>9</manvolnum>
42797 <refmiscinfo class="version">4.4.14</refmiscinfo>
42798</refmeta>
42799<refnamediv>
42800 <refname>snd_device_initialize</refname>
42801 <refpurpose>
42802  Initialize struct device for sound devices
42803 </refpurpose>
42804</refnamediv>
42805<refsynopsisdiv>
42806 <title>Synopsis</title>
42807  <funcsynopsis><funcprototype>
42808   <funcdef>void <function>snd_device_initialize </function></funcdef>
42809   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
42810   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
42811  </funcprototype></funcsynopsis>
42812</refsynopsisdiv>
42813<refsect1>
42814 <title>Arguments</title>
42815 <variablelist>
42816  <varlistentry>
42817   <term><parameter>dev</parameter></term>
42818   <listitem>
42819    <para>
42820     device to initialize
42821    </para>
42822   </listitem>
42823  </varlistentry>
42824  <varlistentry>
42825   <term><parameter>card</parameter></term>
42826   <listitem>
42827    <para>
42828     card to assign, optional
42829    </para>
42830   </listitem>
42831  </varlistentry>
42832 </variablelist>
42833</refsect1>
42834</refentry>
42835
42836<refentry id="API-snd-card-new">
42837<refentryinfo>
42838 <title>LINUX</title>
42839 <productname>Kernel Hackers Manual</productname>
42840 <date>July 2017</date>
42841</refentryinfo>
42842<refmeta>
42843 <refentrytitle><phrase>snd_card_new</phrase></refentrytitle>
42844 <manvolnum>9</manvolnum>
42845 <refmiscinfo class="version">4.4.14</refmiscinfo>
42846</refmeta>
42847<refnamediv>
42848 <refname>snd_card_new</refname>
42849 <refpurpose>
42850     create and initialize a soundcard structure
42851 </refpurpose>
42852</refnamediv>
42853<refsynopsisdiv>
42854 <title>Synopsis</title>
42855  <funcsynopsis><funcprototype>
42856   <funcdef>int <function>snd_card_new </function></funcdef>
42857   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>parent</parameter></paramdef>
42858   <paramdef>int <parameter>idx</parameter></paramdef>
42859   <paramdef>const char * <parameter>xid</parameter></paramdef>
42860   <paramdef>struct module * <parameter>module</parameter></paramdef>
42861   <paramdef>int <parameter>extra_size</parameter></paramdef>
42862   <paramdef>struct snd_card ** <parameter>card_ret</parameter></paramdef>
42863  </funcprototype></funcsynopsis>
42864</refsynopsisdiv>
42865<refsect1>
42866 <title>Arguments</title>
42867 <variablelist>
42868  <varlistentry>
42869   <term><parameter>parent</parameter></term>
42870   <listitem>
42871    <para>
42872     the parent device object
42873    </para>
42874   </listitem>
42875  </varlistentry>
42876  <varlistentry>
42877   <term><parameter>idx</parameter></term>
42878   <listitem>
42879    <para>
42880     card index (address) [0 ... (SNDRV_CARDS-1)]
42881    </para>
42882   </listitem>
42883  </varlistentry>
42884  <varlistentry>
42885   <term><parameter>xid</parameter></term>
42886   <listitem>
42887    <para>
42888     card identification (ASCII string)
42889    </para>
42890   </listitem>
42891  </varlistentry>
42892  <varlistentry>
42893   <term><parameter>module</parameter></term>
42894   <listitem>
42895    <para>
42896     top level module for locking
42897    </para>
42898   </listitem>
42899  </varlistentry>
42900  <varlistentry>
42901   <term><parameter>extra_size</parameter></term>
42902   <listitem>
42903    <para>
42904     allocate this extra size after the main soundcard structure
42905    </para>
42906   </listitem>
42907  </varlistentry>
42908  <varlistentry>
42909   <term><parameter>card_ret</parameter></term>
42910   <listitem>
42911    <para>
42912     the pointer to store the created card instance
42913    </para>
42914   </listitem>
42915  </varlistentry>
42916 </variablelist>
42917</refsect1>
42918<refsect1>
42919<title>Description</title>
42920<para>
42921   Creates and initializes a soundcard structure.
42922   </para><para>
42923
42924   The function allocates snd_card instance via kzalloc with the given
42925   space for the driver to use freely.  The allocated struct is stored
42926   in the given card_ret pointer.
42927</para>
42928</refsect1>
42929<refsect1>
42930<title>Return</title>
42931<para>
42932   Zero if successful or a negative error code.
42933</para>
42934</refsect1>
42935</refentry>
42936
42937<refentry id="API-snd-card-disconnect">
42938<refentryinfo>
42939 <title>LINUX</title>
42940 <productname>Kernel Hackers Manual</productname>
42941 <date>July 2017</date>
42942</refentryinfo>
42943<refmeta>
42944 <refentrytitle><phrase>snd_card_disconnect</phrase></refentrytitle>
42945 <manvolnum>9</manvolnum>
42946 <refmiscinfo class="version">4.4.14</refmiscinfo>
42947</refmeta>
42948<refnamediv>
42949 <refname>snd_card_disconnect</refname>
42950 <refpurpose>
42951     disconnect all APIs from the file-operations (user space)
42952 </refpurpose>
42953</refnamediv>
42954<refsynopsisdiv>
42955 <title>Synopsis</title>
42956  <funcsynopsis><funcprototype>
42957   <funcdef>int <function>snd_card_disconnect </function></funcdef>
42958   <paramdef>struct snd_card * <parameter>card</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     soundcard structure
42969    </para>
42970   </listitem>
42971  </varlistentry>
42972 </variablelist>
42973</refsect1>
42974<refsect1>
42975<title>Description</title>
42976<para>
42977   Disconnects all APIs from the file-operations (user space).
42978</para>
42979</refsect1>
42980<refsect1>
42981<title>Return</title>
42982<para>
42983   Zero, otherwise a negative error code.
42984</para>
42985</refsect1>
42986<refsect1>
42987<title>Note</title>
42988<para>
42989   The current implementation replaces all active file-&gt;f_op with special
42990   dummy file operations (they do nothing except release).
42991</para>
42992</refsect1>
42993</refentry>
42994
42995<refentry id="API-snd-card-free-when-closed">
42996<refentryinfo>
42997 <title>LINUX</title>
42998 <productname>Kernel Hackers Manual</productname>
42999 <date>July 2017</date>
43000</refentryinfo>
43001<refmeta>
43002 <refentrytitle><phrase>snd_card_free_when_closed</phrase></refentrytitle>
43003 <manvolnum>9</manvolnum>
43004 <refmiscinfo class="version">4.4.14</refmiscinfo>
43005</refmeta>
43006<refnamediv>
43007 <refname>snd_card_free_when_closed</refname>
43008 <refpurpose>
43009     Disconnect the card, free it later eventually
43010 </refpurpose>
43011</refnamediv>
43012<refsynopsisdiv>
43013 <title>Synopsis</title>
43014  <funcsynopsis><funcprototype>
43015   <funcdef>int <function>snd_card_free_when_closed </function></funcdef>
43016   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43017  </funcprototype></funcsynopsis>
43018</refsynopsisdiv>
43019<refsect1>
43020 <title>Arguments</title>
43021 <variablelist>
43022  <varlistentry>
43023   <term><parameter>card</parameter></term>
43024   <listitem>
43025    <para>
43026     soundcard structure
43027    </para>
43028   </listitem>
43029  </varlistentry>
43030 </variablelist>
43031</refsect1>
43032<refsect1>
43033<title>Description</title>
43034<para>
43035   Unlike <function><link linkend="API-snd-card-free">snd_card_free</link></function>, this function doesn't try to release the card
43036   resource immediately, but tries to disconnect at first.  When the card
43037   is still in use, the function returns before freeing the resources.
43038   The card resources will be freed when the refcount gets to zero.
43039</para>
43040</refsect1>
43041</refentry>
43042
43043<refentry id="API-snd-card-free">
43044<refentryinfo>
43045 <title>LINUX</title>
43046 <productname>Kernel Hackers Manual</productname>
43047 <date>July 2017</date>
43048</refentryinfo>
43049<refmeta>
43050 <refentrytitle><phrase>snd_card_free</phrase></refentrytitle>
43051 <manvolnum>9</manvolnum>
43052 <refmiscinfo class="version">4.4.14</refmiscinfo>
43053</refmeta>
43054<refnamediv>
43055 <refname>snd_card_free</refname>
43056 <refpurpose>
43057     frees given soundcard structure
43058 </refpurpose>
43059</refnamediv>
43060<refsynopsisdiv>
43061 <title>Synopsis</title>
43062  <funcsynopsis><funcprototype>
43063   <funcdef>int <function>snd_card_free </function></funcdef>
43064   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43065  </funcprototype></funcsynopsis>
43066</refsynopsisdiv>
43067<refsect1>
43068 <title>Arguments</title>
43069 <variablelist>
43070  <varlistentry>
43071   <term><parameter>card</parameter></term>
43072   <listitem>
43073    <para>
43074     soundcard structure
43075    </para>
43076   </listitem>
43077  </varlistentry>
43078 </variablelist>
43079</refsect1>
43080<refsect1>
43081<title>Description</title>
43082<para>
43083   This function releases the soundcard structure and the all assigned
43084   devices automatically.  That is, you don't have to release the devices
43085   by yourself.
43086   </para><para>
43087
43088   This function waits until the all resources are properly released.
43089</para>
43090</refsect1>
43091<refsect1>
43092<title>Return</title>
43093<para>
43094   Zero. Frees all associated devices and frees the control
43095   interface associated to given soundcard.
43096</para>
43097</refsect1>
43098</refentry>
43099
43100<refentry id="API-snd-card-set-id">
43101<refentryinfo>
43102 <title>LINUX</title>
43103 <productname>Kernel Hackers Manual</productname>
43104 <date>July 2017</date>
43105</refentryinfo>
43106<refmeta>
43107 <refentrytitle><phrase>snd_card_set_id</phrase></refentrytitle>
43108 <manvolnum>9</manvolnum>
43109 <refmiscinfo class="version">4.4.14</refmiscinfo>
43110</refmeta>
43111<refnamediv>
43112 <refname>snd_card_set_id</refname>
43113 <refpurpose>
43114     set card identification name
43115 </refpurpose>
43116</refnamediv>
43117<refsynopsisdiv>
43118 <title>Synopsis</title>
43119  <funcsynopsis><funcprototype>
43120   <funcdef>void <function>snd_card_set_id </function></funcdef>
43121   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43122   <paramdef>const char * <parameter>nid</parameter></paramdef>
43123  </funcprototype></funcsynopsis>
43124</refsynopsisdiv>
43125<refsect1>
43126 <title>Arguments</title>
43127 <variablelist>
43128  <varlistentry>
43129   <term><parameter>card</parameter></term>
43130   <listitem>
43131    <para>
43132     soundcard structure
43133    </para>
43134   </listitem>
43135  </varlistentry>
43136  <varlistentry>
43137   <term><parameter>nid</parameter></term>
43138   <listitem>
43139    <para>
43140     new identification string
43141    </para>
43142   </listitem>
43143  </varlistentry>
43144 </variablelist>
43145</refsect1>
43146<refsect1>
43147<title>Description</title>
43148<para>
43149   This function sets the card identification and checks for name
43150   collisions.
43151</para>
43152</refsect1>
43153</refentry>
43154
43155<refentry id="API-snd-card-add-dev-attr">
43156<refentryinfo>
43157 <title>LINUX</title>
43158 <productname>Kernel Hackers Manual</productname>
43159 <date>July 2017</date>
43160</refentryinfo>
43161<refmeta>
43162 <refentrytitle><phrase>snd_card_add_dev_attr</phrase></refentrytitle>
43163 <manvolnum>9</manvolnum>
43164 <refmiscinfo class="version">4.4.14</refmiscinfo>
43165</refmeta>
43166<refnamediv>
43167 <refname>snd_card_add_dev_attr</refname>
43168 <refpurpose>
43169     Append a new sysfs attribute group to card
43170 </refpurpose>
43171</refnamediv>
43172<refsynopsisdiv>
43173 <title>Synopsis</title>
43174  <funcsynopsis><funcprototype>
43175   <funcdef>int <function>snd_card_add_dev_attr </function></funcdef>
43176   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43177   <paramdef>const struct attribute_group * <parameter>group</parameter></paramdef>
43178  </funcprototype></funcsynopsis>
43179</refsynopsisdiv>
43180<refsect1>
43181 <title>Arguments</title>
43182 <variablelist>
43183  <varlistentry>
43184   <term><parameter>card</parameter></term>
43185   <listitem>
43186    <para>
43187     card instance
43188    </para>
43189   </listitem>
43190  </varlistentry>
43191  <varlistentry>
43192   <term><parameter>group</parameter></term>
43193   <listitem>
43194    <para>
43195     attribute group to append
43196    </para>
43197   </listitem>
43198  </varlistentry>
43199 </variablelist>
43200</refsect1>
43201</refentry>
43202
43203<refentry id="API-snd-card-register">
43204<refentryinfo>
43205 <title>LINUX</title>
43206 <productname>Kernel Hackers Manual</productname>
43207 <date>July 2017</date>
43208</refentryinfo>
43209<refmeta>
43210 <refentrytitle><phrase>snd_card_register</phrase></refentrytitle>
43211 <manvolnum>9</manvolnum>
43212 <refmiscinfo class="version">4.4.14</refmiscinfo>
43213</refmeta>
43214<refnamediv>
43215 <refname>snd_card_register</refname>
43216 <refpurpose>
43217     register the soundcard
43218 </refpurpose>
43219</refnamediv>
43220<refsynopsisdiv>
43221 <title>Synopsis</title>
43222  <funcsynopsis><funcprototype>
43223   <funcdef>int <function>snd_card_register </function></funcdef>
43224   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43225  </funcprototype></funcsynopsis>
43226</refsynopsisdiv>
43227<refsect1>
43228 <title>Arguments</title>
43229 <variablelist>
43230  <varlistentry>
43231   <term><parameter>card</parameter></term>
43232   <listitem>
43233    <para>
43234     soundcard structure
43235    </para>
43236   </listitem>
43237  </varlistentry>
43238 </variablelist>
43239</refsect1>
43240<refsect1>
43241<title>Description</title>
43242<para>
43243   This function registers all the devices assigned to the soundcard.
43244   Until calling this, the ALSA control interface is blocked from the
43245   external accesses.  Thus, you should call this function at the end
43246   of the initialization of the card.
43247</para>
43248</refsect1>
43249<refsect1>
43250<title>Return</title>
43251<para>
43252   Zero otherwise a negative error code if the registration failed.
43253</para>
43254</refsect1>
43255</refentry>
43256
43257<refentry id="API-snd-component-add">
43258<refentryinfo>
43259 <title>LINUX</title>
43260 <productname>Kernel Hackers Manual</productname>
43261 <date>July 2017</date>
43262</refentryinfo>
43263<refmeta>
43264 <refentrytitle><phrase>snd_component_add</phrase></refentrytitle>
43265 <manvolnum>9</manvolnum>
43266 <refmiscinfo class="version">4.4.14</refmiscinfo>
43267</refmeta>
43268<refnamediv>
43269 <refname>snd_component_add</refname>
43270 <refpurpose>
43271     add a component string
43272 </refpurpose>
43273</refnamediv>
43274<refsynopsisdiv>
43275 <title>Synopsis</title>
43276  <funcsynopsis><funcprototype>
43277   <funcdef>int <function>snd_component_add </function></funcdef>
43278   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43279   <paramdef>const char * <parameter>component</parameter></paramdef>
43280  </funcprototype></funcsynopsis>
43281</refsynopsisdiv>
43282<refsect1>
43283 <title>Arguments</title>
43284 <variablelist>
43285  <varlistentry>
43286   <term><parameter>card</parameter></term>
43287   <listitem>
43288    <para>
43289     soundcard structure
43290    </para>
43291   </listitem>
43292  </varlistentry>
43293  <varlistentry>
43294   <term><parameter>component</parameter></term>
43295   <listitem>
43296    <para>
43297     the component id string
43298    </para>
43299   </listitem>
43300  </varlistentry>
43301 </variablelist>
43302</refsect1>
43303<refsect1>
43304<title>Description</title>
43305<para>
43306   This function adds the component id string to the supported list.
43307   The component can be referred from the alsa-lib.
43308</para>
43309</refsect1>
43310<refsect1>
43311<title>Return</title>
43312<para>
43313   Zero otherwise a negative error code.
43314</para>
43315</refsect1>
43316</refentry>
43317
43318<refentry id="API-snd-card-file-add">
43319<refentryinfo>
43320 <title>LINUX</title>
43321 <productname>Kernel Hackers Manual</productname>
43322 <date>July 2017</date>
43323</refentryinfo>
43324<refmeta>
43325 <refentrytitle><phrase>snd_card_file_add</phrase></refentrytitle>
43326 <manvolnum>9</manvolnum>
43327 <refmiscinfo class="version">4.4.14</refmiscinfo>
43328</refmeta>
43329<refnamediv>
43330 <refname>snd_card_file_add</refname>
43331 <refpurpose>
43332     add the file to the file list of the card
43333 </refpurpose>
43334</refnamediv>
43335<refsynopsisdiv>
43336 <title>Synopsis</title>
43337  <funcsynopsis><funcprototype>
43338   <funcdef>int <function>snd_card_file_add </function></funcdef>
43339   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43340   <paramdef>struct file * <parameter>file</parameter></paramdef>
43341  </funcprototype></funcsynopsis>
43342</refsynopsisdiv>
43343<refsect1>
43344 <title>Arguments</title>
43345 <variablelist>
43346  <varlistentry>
43347   <term><parameter>card</parameter></term>
43348   <listitem>
43349    <para>
43350     soundcard structure
43351    </para>
43352   </listitem>
43353  </varlistentry>
43354  <varlistentry>
43355   <term><parameter>file</parameter></term>
43356   <listitem>
43357    <para>
43358     file pointer
43359    </para>
43360   </listitem>
43361  </varlistentry>
43362 </variablelist>
43363</refsect1>
43364<refsect1>
43365<title>Description</title>
43366<para>
43367   This function adds the file to the file linked-list of the card.
43368   This linked-list is used to keep tracking the connection state,
43369   and to avoid the release of busy resources by hotplug.
43370</para>
43371</refsect1>
43372<refsect1>
43373<title>Return</title>
43374<para>
43375   zero or a negative error code.
43376</para>
43377</refsect1>
43378</refentry>
43379
43380<refentry id="API-snd-card-file-remove">
43381<refentryinfo>
43382 <title>LINUX</title>
43383 <productname>Kernel Hackers Manual</productname>
43384 <date>July 2017</date>
43385</refentryinfo>
43386<refmeta>
43387 <refentrytitle><phrase>snd_card_file_remove</phrase></refentrytitle>
43388 <manvolnum>9</manvolnum>
43389 <refmiscinfo class="version">4.4.14</refmiscinfo>
43390</refmeta>
43391<refnamediv>
43392 <refname>snd_card_file_remove</refname>
43393 <refpurpose>
43394     remove the file from the file list
43395 </refpurpose>
43396</refnamediv>
43397<refsynopsisdiv>
43398 <title>Synopsis</title>
43399  <funcsynopsis><funcprototype>
43400   <funcdef>int <function>snd_card_file_remove </function></funcdef>
43401   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43402   <paramdef>struct file * <parameter>file</parameter></paramdef>
43403  </funcprototype></funcsynopsis>
43404</refsynopsisdiv>
43405<refsect1>
43406 <title>Arguments</title>
43407 <variablelist>
43408  <varlistentry>
43409   <term><parameter>card</parameter></term>
43410   <listitem>
43411    <para>
43412     soundcard structure
43413    </para>
43414   </listitem>
43415  </varlistentry>
43416  <varlistentry>
43417   <term><parameter>file</parameter></term>
43418   <listitem>
43419    <para>
43420     file pointer
43421    </para>
43422   </listitem>
43423  </varlistentry>
43424 </variablelist>
43425</refsect1>
43426<refsect1>
43427<title>Description</title>
43428<para>
43429   This function removes the file formerly added to the card via
43430   <function><link linkend="API-snd-card-file-add">snd_card_file_add</link></function> function.
43431   If all files are removed and <function><link linkend="API-snd-card-free-when-closed">snd_card_free_when_closed</link></function> was
43432   called beforehand, it processes the pending release of
43433   resources.
43434</para>
43435</refsect1>
43436<refsect1>
43437<title>Return</title>
43438<para>
43439   Zero or a negative error code.
43440</para>
43441</refsect1>
43442</refentry>
43443
43444<refentry id="API-snd-power-wait">
43445<refentryinfo>
43446 <title>LINUX</title>
43447 <productname>Kernel Hackers Manual</productname>
43448 <date>July 2017</date>
43449</refentryinfo>
43450<refmeta>
43451 <refentrytitle><phrase>snd_power_wait</phrase></refentrytitle>
43452 <manvolnum>9</manvolnum>
43453 <refmiscinfo class="version">4.4.14</refmiscinfo>
43454</refmeta>
43455<refnamediv>
43456 <refname>snd_power_wait</refname>
43457 <refpurpose>
43458     wait until the power-state is changed.
43459 </refpurpose>
43460</refnamediv>
43461<refsynopsisdiv>
43462 <title>Synopsis</title>
43463  <funcsynopsis><funcprototype>
43464   <funcdef>int <function>snd_power_wait </function></funcdef>
43465   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43466   <paramdef>unsigned int <parameter>power_state</parameter></paramdef>
43467  </funcprototype></funcsynopsis>
43468</refsynopsisdiv>
43469<refsect1>
43470 <title>Arguments</title>
43471 <variablelist>
43472  <varlistentry>
43473   <term><parameter>card</parameter></term>
43474   <listitem>
43475    <para>
43476     soundcard structure
43477    </para>
43478   </listitem>
43479  </varlistentry>
43480  <varlistentry>
43481   <term><parameter>power_state</parameter></term>
43482   <listitem>
43483    <para>
43484     expected power state
43485    </para>
43486   </listitem>
43487  </varlistentry>
43488 </variablelist>
43489</refsect1>
43490<refsect1>
43491<title>Description</title>
43492<para>
43493   Waits until the power-state is changed.
43494</para>
43495</refsect1>
43496<refsect1>
43497<title>Return</title>
43498<para>
43499   Zero if successful, or a negative error code.
43500</para>
43501</refsect1>
43502<refsect1>
43503<title>Note</title>
43504<para>
43505   the power lock must be active before call.
43506</para>
43507</refsect1>
43508</refentry>
43509
43510<!-- sound/core/isadma.c -->
43511<refentry id="API-snd-dma-program">
43512<refentryinfo>
43513 <title>LINUX</title>
43514 <productname>Kernel Hackers Manual</productname>
43515 <date>July 2017</date>
43516</refentryinfo>
43517<refmeta>
43518 <refentrytitle><phrase>snd_dma_program</phrase></refentrytitle>
43519 <manvolnum>9</manvolnum>
43520 <refmiscinfo class="version">4.4.14</refmiscinfo>
43521</refmeta>
43522<refnamediv>
43523 <refname>snd_dma_program</refname>
43524 <refpurpose>
43525  program an ISA DMA transfer
43526 </refpurpose>
43527</refnamediv>
43528<refsynopsisdiv>
43529 <title>Synopsis</title>
43530  <funcsynopsis><funcprototype>
43531   <funcdef>void <function>snd_dma_program </function></funcdef>
43532   <paramdef>unsigned long <parameter>dma</parameter></paramdef>
43533   <paramdef>unsigned long <parameter>addr</parameter></paramdef>
43534   <paramdef>unsigned int <parameter>size</parameter></paramdef>
43535   <paramdef>unsigned short <parameter>mode</parameter></paramdef>
43536  </funcprototype></funcsynopsis>
43537</refsynopsisdiv>
43538<refsect1>
43539 <title>Arguments</title>
43540 <variablelist>
43541  <varlistentry>
43542   <term><parameter>dma</parameter></term>
43543   <listitem>
43544    <para>
43545     the dma number
43546    </para>
43547   </listitem>
43548  </varlistentry>
43549  <varlistentry>
43550   <term><parameter>addr</parameter></term>
43551   <listitem>
43552    <para>
43553     the physical address of the buffer
43554    </para>
43555   </listitem>
43556  </varlistentry>
43557  <varlistentry>
43558   <term><parameter>size</parameter></term>
43559   <listitem>
43560    <para>
43561     the DMA transfer size
43562    </para>
43563   </listitem>
43564  </varlistentry>
43565  <varlistentry>
43566   <term><parameter>mode</parameter></term>
43567   <listitem>
43568    <para>
43569     the DMA transfer mode, DMA_MODE_XXX
43570    </para>
43571   </listitem>
43572  </varlistentry>
43573 </variablelist>
43574</refsect1>
43575<refsect1>
43576<title>Description</title>
43577<para>
43578   Programs an ISA DMA transfer for the given buffer.
43579</para>
43580</refsect1>
43581</refentry>
43582
43583<refentry id="API-snd-dma-disable">
43584<refentryinfo>
43585 <title>LINUX</title>
43586 <productname>Kernel Hackers Manual</productname>
43587 <date>July 2017</date>
43588</refentryinfo>
43589<refmeta>
43590 <refentrytitle><phrase>snd_dma_disable</phrase></refentrytitle>
43591 <manvolnum>9</manvolnum>
43592 <refmiscinfo class="version">4.4.14</refmiscinfo>
43593</refmeta>
43594<refnamediv>
43595 <refname>snd_dma_disable</refname>
43596 <refpurpose>
43597     stop the ISA DMA transfer
43598 </refpurpose>
43599</refnamediv>
43600<refsynopsisdiv>
43601 <title>Synopsis</title>
43602  <funcsynopsis><funcprototype>
43603   <funcdef>void <function>snd_dma_disable </function></funcdef>
43604   <paramdef>unsigned long <parameter>dma</parameter></paramdef>
43605  </funcprototype></funcsynopsis>
43606</refsynopsisdiv>
43607<refsect1>
43608 <title>Arguments</title>
43609 <variablelist>
43610  <varlistentry>
43611   <term><parameter>dma</parameter></term>
43612   <listitem>
43613    <para>
43614     the dma number
43615    </para>
43616   </listitem>
43617  </varlistentry>
43618 </variablelist>
43619</refsect1>
43620<refsect1>
43621<title>Description</title>
43622<para>
43623   Stops the ISA DMA transfer.
43624</para>
43625</refsect1>
43626</refentry>
43627
43628<refentry id="API-snd-dma-pointer">
43629<refentryinfo>
43630 <title>LINUX</title>
43631 <productname>Kernel Hackers Manual</productname>
43632 <date>July 2017</date>
43633</refentryinfo>
43634<refmeta>
43635 <refentrytitle><phrase>snd_dma_pointer</phrase></refentrytitle>
43636 <manvolnum>9</manvolnum>
43637 <refmiscinfo class="version">4.4.14</refmiscinfo>
43638</refmeta>
43639<refnamediv>
43640 <refname>snd_dma_pointer</refname>
43641 <refpurpose>
43642     return the current pointer to DMA transfer buffer in bytes
43643 </refpurpose>
43644</refnamediv>
43645<refsynopsisdiv>
43646 <title>Synopsis</title>
43647  <funcsynopsis><funcprototype>
43648   <funcdef>unsigned int <function>snd_dma_pointer </function></funcdef>
43649   <paramdef>unsigned long <parameter>dma</parameter></paramdef>
43650   <paramdef>unsigned int <parameter>size</parameter></paramdef>
43651  </funcprototype></funcsynopsis>
43652</refsynopsisdiv>
43653<refsect1>
43654 <title>Arguments</title>
43655 <variablelist>
43656  <varlistentry>
43657   <term><parameter>dma</parameter></term>
43658   <listitem>
43659    <para>
43660     the dma number
43661    </para>
43662   </listitem>
43663  </varlistentry>
43664  <varlistentry>
43665   <term><parameter>size</parameter></term>
43666   <listitem>
43667    <para>
43668     the dma transfer size
43669    </para>
43670   </listitem>
43671  </varlistentry>
43672 </variablelist>
43673</refsect1>
43674<refsect1>
43675<title>Return</title>
43676<para>
43677   The current pointer in DMA transfer buffer in bytes.
43678</para>
43679</refsect1>
43680</refentry>
43681
43682<!-- sound/core/control.c -->
43683<refentry id="API-snd-ctl-notify">
43684<refentryinfo>
43685 <title>LINUX</title>
43686 <productname>Kernel Hackers Manual</productname>
43687 <date>July 2017</date>
43688</refentryinfo>
43689<refmeta>
43690 <refentrytitle><phrase>snd_ctl_notify</phrase></refentrytitle>
43691 <manvolnum>9</manvolnum>
43692 <refmiscinfo class="version">4.4.14</refmiscinfo>
43693</refmeta>
43694<refnamediv>
43695 <refname>snd_ctl_notify</refname>
43696 <refpurpose>
43697  Send notification to user-space for a control change
43698 </refpurpose>
43699</refnamediv>
43700<refsynopsisdiv>
43701 <title>Synopsis</title>
43702  <funcsynopsis><funcprototype>
43703   <funcdef>void <function>snd_ctl_notify </function></funcdef>
43704   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43705   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
43706   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
43707  </funcprototype></funcsynopsis>
43708</refsynopsisdiv>
43709<refsect1>
43710 <title>Arguments</title>
43711 <variablelist>
43712  <varlistentry>
43713   <term><parameter>card</parameter></term>
43714   <listitem>
43715    <para>
43716     the card to send notification
43717    </para>
43718   </listitem>
43719  </varlistentry>
43720  <varlistentry>
43721   <term><parameter>mask</parameter></term>
43722   <listitem>
43723    <para>
43724     the event mask, SNDRV_CTL_EVENT_*
43725    </para>
43726   </listitem>
43727  </varlistentry>
43728  <varlistentry>
43729   <term><parameter>id</parameter></term>
43730   <listitem>
43731    <para>
43732     the ctl element id to send notification
43733    </para>
43734   </listitem>
43735  </varlistentry>
43736 </variablelist>
43737</refsect1>
43738<refsect1>
43739<title>Description</title>
43740<para>
43741   This function adds an event record with the given id and mask, appends
43742   to the list and wakes up the user-space for notification.  This can be
43743   called in the atomic context.
43744</para>
43745</refsect1>
43746</refentry>
43747
43748<refentry id="API-snd-ctl-new1">
43749<refentryinfo>
43750 <title>LINUX</title>
43751 <productname>Kernel Hackers Manual</productname>
43752 <date>July 2017</date>
43753</refentryinfo>
43754<refmeta>
43755 <refentrytitle><phrase>snd_ctl_new1</phrase></refentrytitle>
43756 <manvolnum>9</manvolnum>
43757 <refmiscinfo class="version">4.4.14</refmiscinfo>
43758</refmeta>
43759<refnamediv>
43760 <refname>snd_ctl_new1</refname>
43761 <refpurpose>
43762     create a control instance from the template
43763 </refpurpose>
43764</refnamediv>
43765<refsynopsisdiv>
43766 <title>Synopsis</title>
43767  <funcsynopsis><funcprototype>
43768   <funcdef>struct snd_kcontrol * <function>snd_ctl_new1 </function></funcdef>
43769   <paramdef>const struct snd_kcontrol_new * <parameter>ncontrol</parameter></paramdef>
43770   <paramdef>void * <parameter>private_data</parameter></paramdef>
43771  </funcprototype></funcsynopsis>
43772</refsynopsisdiv>
43773<refsect1>
43774 <title>Arguments</title>
43775 <variablelist>
43776  <varlistentry>
43777   <term><parameter>ncontrol</parameter></term>
43778   <listitem>
43779    <para>
43780     the initialization record
43781    </para>
43782   </listitem>
43783  </varlistentry>
43784  <varlistentry>
43785   <term><parameter>private_data</parameter></term>
43786   <listitem>
43787    <para>
43788     the private data to set
43789    </para>
43790   </listitem>
43791  </varlistentry>
43792 </variablelist>
43793</refsect1>
43794<refsect1>
43795<title>Description</title>
43796<para>
43797   Allocates a new struct snd_kcontrol instance and initialize from the given 
43798   template.  When the access field of ncontrol is 0, it's assumed as
43799   READWRITE access. When the count field is 0, it's assumes as one.
43800</para>
43801</refsect1>
43802<refsect1>
43803<title>Return</title>
43804<para>
43805   The pointer of the newly generated instance, or <constant>NULL</constant> on failure.
43806</para>
43807</refsect1>
43808</refentry>
43809
43810<refentry id="API-snd-ctl-free-one">
43811<refentryinfo>
43812 <title>LINUX</title>
43813 <productname>Kernel Hackers Manual</productname>
43814 <date>July 2017</date>
43815</refentryinfo>
43816<refmeta>
43817 <refentrytitle><phrase>snd_ctl_free_one</phrase></refentrytitle>
43818 <manvolnum>9</manvolnum>
43819 <refmiscinfo class="version">4.4.14</refmiscinfo>
43820</refmeta>
43821<refnamediv>
43822 <refname>snd_ctl_free_one</refname>
43823 <refpurpose>
43824     release the control instance
43825 </refpurpose>
43826</refnamediv>
43827<refsynopsisdiv>
43828 <title>Synopsis</title>
43829  <funcsynopsis><funcprototype>
43830   <funcdef>void <function>snd_ctl_free_one </function></funcdef>
43831   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
43832  </funcprototype></funcsynopsis>
43833</refsynopsisdiv>
43834<refsect1>
43835 <title>Arguments</title>
43836 <variablelist>
43837  <varlistentry>
43838   <term><parameter>kcontrol</parameter></term>
43839   <listitem>
43840    <para>
43841     the control instance
43842    </para>
43843   </listitem>
43844  </varlistentry>
43845 </variablelist>
43846</refsect1>
43847<refsect1>
43848<title>Description</title>
43849<para>
43850   Releases the control instance created via <function>snd_ctl_new</function>
43851   or <function><link linkend="API-snd-ctl-new1">snd_ctl_new1</link></function>.
43852   Don't call this after the control was added to the card.
43853</para>
43854</refsect1>
43855</refentry>
43856
43857<refentry id="API-snd-ctl-add">
43858<refentryinfo>
43859 <title>LINUX</title>
43860 <productname>Kernel Hackers Manual</productname>
43861 <date>July 2017</date>
43862</refentryinfo>
43863<refmeta>
43864 <refentrytitle><phrase>snd_ctl_add</phrase></refentrytitle>
43865 <manvolnum>9</manvolnum>
43866 <refmiscinfo class="version">4.4.14</refmiscinfo>
43867</refmeta>
43868<refnamediv>
43869 <refname>snd_ctl_add</refname>
43870 <refpurpose>
43871     add the control instance to the card
43872 </refpurpose>
43873</refnamediv>
43874<refsynopsisdiv>
43875 <title>Synopsis</title>
43876  <funcsynopsis><funcprototype>
43877   <funcdef>int <function>snd_ctl_add </function></funcdef>
43878   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43879   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
43880  </funcprototype></funcsynopsis>
43881</refsynopsisdiv>
43882<refsect1>
43883 <title>Arguments</title>
43884 <variablelist>
43885  <varlistentry>
43886   <term><parameter>card</parameter></term>
43887   <listitem>
43888    <para>
43889     the card instance
43890    </para>
43891   </listitem>
43892  </varlistentry>
43893  <varlistentry>
43894   <term><parameter>kcontrol</parameter></term>
43895   <listitem>
43896    <para>
43897     the control instance to add
43898    </para>
43899   </listitem>
43900  </varlistentry>
43901 </variablelist>
43902</refsect1>
43903<refsect1>
43904<title>Description</title>
43905<para>
43906   Adds the control instance created via <function>snd_ctl_new</function> or
43907   <function><link linkend="API-snd-ctl-new1">snd_ctl_new1</link></function> to the given card. Assigns also an unique
43908   numid used for fast search.
43909   </para><para>
43910
43911   It frees automatically the control which cannot be added.
43912</para>
43913</refsect1>
43914<refsect1>
43915<title>Return</title>
43916<para>
43917   Zero if successful, or a negative error code on failure.
43918</para>
43919</refsect1>
43920</refentry>
43921
43922<refentry id="API-snd-ctl-replace">
43923<refentryinfo>
43924 <title>LINUX</title>
43925 <productname>Kernel Hackers Manual</productname>
43926 <date>July 2017</date>
43927</refentryinfo>
43928<refmeta>
43929 <refentrytitle><phrase>snd_ctl_replace</phrase></refentrytitle>
43930 <manvolnum>9</manvolnum>
43931 <refmiscinfo class="version">4.4.14</refmiscinfo>
43932</refmeta>
43933<refnamediv>
43934 <refname>snd_ctl_replace</refname>
43935 <refpurpose>
43936     replace the control instance of the card
43937 </refpurpose>
43938</refnamediv>
43939<refsynopsisdiv>
43940 <title>Synopsis</title>
43941  <funcsynopsis><funcprototype>
43942   <funcdef>int <function>snd_ctl_replace </function></funcdef>
43943   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
43944   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
43945   <paramdef>bool <parameter>add_on_replace</parameter></paramdef>
43946  </funcprototype></funcsynopsis>
43947</refsynopsisdiv>
43948<refsect1>
43949 <title>Arguments</title>
43950 <variablelist>
43951  <varlistentry>
43952   <term><parameter>card</parameter></term>
43953   <listitem>
43954    <para>
43955     the card instance
43956    </para>
43957   </listitem>
43958  </varlistentry>
43959  <varlistentry>
43960   <term><parameter>kcontrol</parameter></term>
43961   <listitem>
43962    <para>
43963     the control instance to replace
43964    </para>
43965   </listitem>
43966  </varlistentry>
43967  <varlistentry>
43968   <term><parameter>add_on_replace</parameter></term>
43969   <listitem>
43970    <para>
43971     add the control if not already added
43972    </para>
43973   </listitem>
43974  </varlistentry>
43975 </variablelist>
43976</refsect1>
43977<refsect1>
43978<title>Description</title>
43979<para>
43980   Replaces the given control.  If the given control does not exist
43981   and the add_on_replace flag is set, the control is added.  If the
43982   control exists, it is destroyed first.
43983   </para><para>
43984
43985   It frees automatically the control which cannot be added or replaced.
43986</para>
43987</refsect1>
43988<refsect1>
43989<title>Return</title>
43990<para>
43991   Zero if successful, or a negative error code on failure.
43992</para>
43993</refsect1>
43994</refentry>
43995
43996<refentry id="API-snd-ctl-remove">
43997<refentryinfo>
43998 <title>LINUX</title>
43999 <productname>Kernel Hackers Manual</productname>
44000 <date>July 2017</date>
44001</refentryinfo>
44002<refmeta>
44003 <refentrytitle><phrase>snd_ctl_remove</phrase></refentrytitle>
44004 <manvolnum>9</manvolnum>
44005 <refmiscinfo class="version">4.4.14</refmiscinfo>
44006</refmeta>
44007<refnamediv>
44008 <refname>snd_ctl_remove</refname>
44009 <refpurpose>
44010     remove the control from the card and release it
44011 </refpurpose>
44012</refnamediv>
44013<refsynopsisdiv>
44014 <title>Synopsis</title>
44015  <funcsynopsis><funcprototype>
44016   <funcdef>int <function>snd_ctl_remove </function></funcdef>
44017   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
44018   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
44019  </funcprototype></funcsynopsis>
44020</refsynopsisdiv>
44021<refsect1>
44022 <title>Arguments</title>
44023 <variablelist>
44024  <varlistentry>
44025   <term><parameter>card</parameter></term>
44026   <listitem>
44027    <para>
44028     the card instance
44029    </para>
44030   </listitem>
44031  </varlistentry>
44032  <varlistentry>
44033   <term><parameter>kcontrol</parameter></term>
44034   <listitem>
44035    <para>
44036     the control instance to remove
44037    </para>
44038   </listitem>
44039  </varlistentry>
44040 </variablelist>
44041</refsect1>
44042<refsect1>
44043<title>Description</title>
44044<para>
44045   Removes the control from the card and then releases the instance.
44046   You don't need to call <function><link linkend="API-snd-ctl-free-one">snd_ctl_free_one</link></function>. You must be in
44047   the write lock - down_write(<structname>card</structname>-&gt;controls_rwsem).
44048</para>
44049</refsect1>
44050<refsect1>
44051<title>Return</title>
44052<para>
44053   0 if successful, or a negative error code on failure.
44054</para>
44055</refsect1>
44056</refentry>
44057
44058<refentry id="API-snd-ctl-remove-id">
44059<refentryinfo>
44060 <title>LINUX</title>
44061 <productname>Kernel Hackers Manual</productname>
44062 <date>July 2017</date>
44063</refentryinfo>
44064<refmeta>
44065 <refentrytitle><phrase>snd_ctl_remove_id</phrase></refentrytitle>
44066 <manvolnum>9</manvolnum>
44067 <refmiscinfo class="version">4.4.14</refmiscinfo>
44068</refmeta>
44069<refnamediv>
44070 <refname>snd_ctl_remove_id</refname>
44071 <refpurpose>
44072     remove the control of the given id and release it
44073 </refpurpose>
44074</refnamediv>
44075<refsynopsisdiv>
44076 <title>Synopsis</title>
44077  <funcsynopsis><funcprototype>
44078   <funcdef>int <function>snd_ctl_remove_id </function></funcdef>
44079   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
44080   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
44081  </funcprototype></funcsynopsis>
44082</refsynopsisdiv>
44083<refsect1>
44084 <title>Arguments</title>
44085 <variablelist>
44086  <varlistentry>
44087   <term><parameter>card</parameter></term>
44088   <listitem>
44089    <para>
44090     the card instance
44091    </para>
44092   </listitem>
44093  </varlistentry>
44094  <varlistentry>
44095   <term><parameter>id</parameter></term>
44096   <listitem>
44097    <para>
44098     the control id to remove
44099    </para>
44100   </listitem>
44101  </varlistentry>
44102 </variablelist>
44103</refsect1>
44104<refsect1>
44105<title>Description</title>
44106<para>
44107   Finds the control instance with the given id, removes it from the
44108   card list and releases it.
44109</para>
44110</refsect1>
44111<refsect1>
44112<title>Return</title>
44113<para>
44114   0 if successful, or a negative error code on failure.
44115</para>
44116</refsect1>
44117</refentry>
44118
44119<refentry id="API-snd-ctl-activate-id">
44120<refentryinfo>
44121 <title>LINUX</title>
44122 <productname>Kernel Hackers Manual</productname>
44123 <date>July 2017</date>
44124</refentryinfo>
44125<refmeta>
44126 <refentrytitle><phrase>snd_ctl_activate_id</phrase></refentrytitle>
44127 <manvolnum>9</manvolnum>
44128 <refmiscinfo class="version">4.4.14</refmiscinfo>
44129</refmeta>
44130<refnamediv>
44131 <refname>snd_ctl_activate_id</refname>
44132 <refpurpose>
44133     activate/inactivate the control of the given id
44134 </refpurpose>
44135</refnamediv>
44136<refsynopsisdiv>
44137 <title>Synopsis</title>
44138  <funcsynopsis><funcprototype>
44139   <funcdef>int <function>snd_ctl_activate_id </function></funcdef>
44140   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
44141   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
44142   <paramdef>int <parameter>active</parameter></paramdef>
44143  </funcprototype></funcsynopsis>
44144</refsynopsisdiv>
44145<refsect1>
44146 <title>Arguments</title>
44147 <variablelist>
44148  <varlistentry>
44149   <term><parameter>card</parameter></term>
44150   <listitem>
44151    <para>
44152     the card instance
44153    </para>
44154   </listitem>
44155  </varlistentry>
44156  <varlistentry>
44157   <term><parameter>id</parameter></term>
44158   <listitem>
44159    <para>
44160     the control id to activate/inactivate
44161    </para>
44162   </listitem>
44163  </varlistentry>
44164  <varlistentry>
44165   <term><parameter>active</parameter></term>
44166   <listitem>
44167    <para>
44168     non-zero to activate
44169    </para>
44170   </listitem>
44171  </varlistentry>
44172 </variablelist>
44173</refsect1>
44174<refsect1>
44175<title>Description</title>
44176<para>
44177   Finds the control instance with the given id, and activate or
44178   inactivate the control together with notification, if changed.
44179   The given ID data is filled with full information.
44180</para>
44181</refsect1>
44182<refsect1>
44183<title>Return</title>
44184<para>
44185   0 if unchanged, 1 if changed, or a negative error code on failure.
44186</para>
44187</refsect1>
44188</refentry>
44189
44190<refentry id="API-snd-ctl-rename-id">
44191<refentryinfo>
44192 <title>LINUX</title>
44193 <productname>Kernel Hackers Manual</productname>
44194 <date>July 2017</date>
44195</refentryinfo>
44196<refmeta>
44197 <refentrytitle><phrase>snd_ctl_rename_id</phrase></refentrytitle>
44198 <manvolnum>9</manvolnum>
44199 <refmiscinfo class="version">4.4.14</refmiscinfo>
44200</refmeta>
44201<refnamediv>
44202 <refname>snd_ctl_rename_id</refname>
44203 <refpurpose>
44204     replace the id of a control on the card
44205 </refpurpose>
44206</refnamediv>
44207<refsynopsisdiv>
44208 <title>Synopsis</title>
44209  <funcsynopsis><funcprototype>
44210   <funcdef>int <function>snd_ctl_rename_id </function></funcdef>
44211   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
44212   <paramdef>struct snd_ctl_elem_id * <parameter>src_id</parameter></paramdef>
44213   <paramdef>struct snd_ctl_elem_id * <parameter>dst_id</parameter></paramdef>
44214  </funcprototype></funcsynopsis>
44215</refsynopsisdiv>
44216<refsect1>
44217 <title>Arguments</title>
44218 <variablelist>
44219  <varlistentry>
44220   <term><parameter>card</parameter></term>
44221   <listitem>
44222    <para>
44223     the card instance
44224    </para>
44225   </listitem>
44226  </varlistentry>
44227  <varlistentry>
44228   <term><parameter>src_id</parameter></term>
44229   <listitem>
44230    <para>
44231     the old id
44232    </para>
44233   </listitem>
44234  </varlistentry>
44235  <varlistentry>
44236   <term><parameter>dst_id</parameter></term>
44237   <listitem>
44238    <para>
44239     the new id
44240    </para>
44241   </listitem>
44242  </varlistentry>
44243 </variablelist>
44244</refsect1>
44245<refsect1>
44246<title>Description</title>
44247<para>
44248   Finds the control with the old id from the card, and replaces the
44249   id with the new one.
44250</para>
44251</refsect1>
44252<refsect1>
44253<title>Return</title>
44254<para>
44255   Zero if successful, or a negative error code on failure.
44256</para>
44257</refsect1>
44258</refentry>
44259
44260<refentry id="API-snd-ctl-find-numid">
44261<refentryinfo>
44262 <title>LINUX</title>
44263 <productname>Kernel Hackers Manual</productname>
44264 <date>July 2017</date>
44265</refentryinfo>
44266<refmeta>
44267 <refentrytitle><phrase>snd_ctl_find_numid</phrase></refentrytitle>
44268 <manvolnum>9</manvolnum>
44269 <refmiscinfo class="version">4.4.14</refmiscinfo>
44270</refmeta>
44271<refnamediv>
44272 <refname>snd_ctl_find_numid</refname>
44273 <refpurpose>
44274     find the control instance with the given number-id
44275 </refpurpose>
44276</refnamediv>
44277<refsynopsisdiv>
44278 <title>Synopsis</title>
44279  <funcsynopsis><funcprototype>
44280   <funcdef>struct snd_kcontrol * <function>snd_ctl_find_numid </function></funcdef>
44281   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
44282   <paramdef>unsigned int <parameter>numid</parameter></paramdef>
44283  </funcprototype></funcsynopsis>
44284</refsynopsisdiv>
44285<refsect1>
44286 <title>Arguments</title>
44287 <variablelist>
44288  <varlistentry>
44289   <term><parameter>card</parameter></term>
44290   <listitem>
44291    <para>
44292     the card instance
44293    </para>
44294   </listitem>
44295  </varlistentry>
44296  <varlistentry>
44297   <term><parameter>numid</parameter></term>
44298   <listitem>
44299    <para>
44300     the number-id to search
44301    </para>
44302   </listitem>
44303  </varlistentry>
44304 </variablelist>
44305</refsect1>
44306<refsect1>
44307<title>Description</title>
44308<para>
44309   Finds the control instance with the given number-id from the card.
44310   </para><para>
44311
44312   The caller must down card-&gt;controls_rwsem before calling this function
44313   (if the race condition can happen).
44314</para>
44315</refsect1>
44316<refsect1>
44317<title>Return</title>
44318<para>
44319   The pointer of the instance if found, or <constant>NULL</constant> if not.
44320</para>
44321</refsect1>
44322</refentry>
44323
44324<refentry id="API-snd-ctl-find-id">
44325<refentryinfo>
44326 <title>LINUX</title>
44327 <productname>Kernel Hackers Manual</productname>
44328 <date>July 2017</date>
44329</refentryinfo>
44330<refmeta>
44331 <refentrytitle><phrase>snd_ctl_find_id</phrase></refentrytitle>
44332 <manvolnum>9</manvolnum>
44333 <refmiscinfo class="version">4.4.14</refmiscinfo>
44334</refmeta>
44335<refnamediv>
44336 <refname>snd_ctl_find_id</refname>
44337 <refpurpose>
44338     find the control instance with the given id
44339 </refpurpose>
44340</refnamediv>
44341<refsynopsisdiv>
44342 <title>Synopsis</title>
44343  <funcsynopsis><funcprototype>
44344   <funcdef>struct snd_kcontrol * <function>snd_ctl_find_id </function></funcdef>
44345   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
44346   <paramdef>struct snd_ctl_elem_id * <parameter>id</parameter></paramdef>
44347  </funcprototype></funcsynopsis>
44348</refsynopsisdiv>
44349<refsect1>
44350 <title>Arguments</title>
44351 <variablelist>
44352  <varlistentry>
44353   <term><parameter>card</parameter></term>
44354   <listitem>
44355    <para>
44356     the card instance
44357    </para>
44358   </listitem>
44359  </varlistentry>
44360  <varlistentry>
44361   <term><parameter>id</parameter></term>
44362   <listitem>
44363    <para>
44364     the id to search
44365    </para>
44366   </listitem>
44367  </varlistentry>
44368 </variablelist>
44369</refsect1>
44370<refsect1>
44371<title>Description</title>
44372<para>
44373   Finds the control instance with the given id from the card.
44374   </para><para>
44375
44376   The caller must down card-&gt;controls_rwsem before calling this function
44377   (if the race condition can happen).
44378</para>
44379</refsect1>
44380<refsect1>
44381<title>Return</title>
44382<para>
44383   The pointer of the instance if found, or <constant>NULL</constant> if not.
44384</para>
44385</refsect1>
44386</refentry>
44387
44388<refentry id="API-snd-ctl-register-ioctl">
44389<refentryinfo>
44390 <title>LINUX</title>
44391 <productname>Kernel Hackers Manual</productname>
44392 <date>July 2017</date>
44393</refentryinfo>
44394<refmeta>
44395 <refentrytitle><phrase>snd_ctl_register_ioctl</phrase></refentrytitle>
44396 <manvolnum>9</manvolnum>
44397 <refmiscinfo class="version">4.4.14</refmiscinfo>
44398</refmeta>
44399<refnamediv>
44400 <refname>snd_ctl_register_ioctl</refname>
44401 <refpurpose>
44402     register the device-specific control-ioctls
44403 </refpurpose>
44404</refnamediv>
44405<refsynopsisdiv>
44406 <title>Synopsis</title>
44407  <funcsynopsis><funcprototype>
44408   <funcdef>int <function>snd_ctl_register_ioctl </function></funcdef>
44409   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
44410  </funcprototype></funcsynopsis>
44411</refsynopsisdiv>
44412<refsect1>
44413 <title>Arguments</title>
44414 <variablelist>
44415  <varlistentry>
44416   <term><parameter>fcn</parameter></term>
44417   <listitem>
44418    <para>
44419     ioctl callback function
44420    </para>
44421   </listitem>
44422  </varlistentry>
44423 </variablelist>
44424</refsect1>
44425<refsect1>
44426<title>Description</title>
44427<para>
44428   called from each device manager like pcm.c, hwdep.c, etc.
44429</para>
44430</refsect1>
44431</refentry>
44432
44433<refentry id="API-snd-ctl-register-ioctl-compat">
44434<refentryinfo>
44435 <title>LINUX</title>
44436 <productname>Kernel Hackers Manual</productname>
44437 <date>July 2017</date>
44438</refentryinfo>
44439<refmeta>
44440 <refentrytitle><phrase>snd_ctl_register_ioctl_compat</phrase></refentrytitle>
44441 <manvolnum>9</manvolnum>
44442 <refmiscinfo class="version">4.4.14</refmiscinfo>
44443</refmeta>
44444<refnamediv>
44445 <refname>snd_ctl_register_ioctl_compat</refname>
44446 <refpurpose>
44447     register the device-specific 32bit compat control-ioctls
44448 </refpurpose>
44449</refnamediv>
44450<refsynopsisdiv>
44451 <title>Synopsis</title>
44452  <funcsynopsis><funcprototype>
44453   <funcdef>int <function>snd_ctl_register_ioctl_compat </function></funcdef>
44454   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
44455  </funcprototype></funcsynopsis>
44456</refsynopsisdiv>
44457<refsect1>
44458 <title>Arguments</title>
44459 <variablelist>
44460  <varlistentry>
44461   <term><parameter>fcn</parameter></term>
44462   <listitem>
44463    <para>
44464     ioctl callback function
44465    </para>
44466   </listitem>
44467  </varlistentry>
44468 </variablelist>
44469</refsect1>
44470</refentry>
44471
44472<refentry id="API-snd-ctl-unregister-ioctl">
44473<refentryinfo>
44474 <title>LINUX</title>
44475 <productname>Kernel Hackers Manual</productname>
44476 <date>July 2017</date>
44477</refentryinfo>
44478<refmeta>
44479 <refentrytitle><phrase>snd_ctl_unregister_ioctl</phrase></refentrytitle>
44480 <manvolnum>9</manvolnum>
44481 <refmiscinfo class="version">4.4.14</refmiscinfo>
44482</refmeta>
44483<refnamediv>
44484 <refname>snd_ctl_unregister_ioctl</refname>
44485 <refpurpose>
44486     de-register the device-specific control-ioctls
44487 </refpurpose>
44488</refnamediv>
44489<refsynopsisdiv>
44490 <title>Synopsis</title>
44491  <funcsynopsis><funcprototype>
44492   <funcdef>int <function>snd_ctl_unregister_ioctl </function></funcdef>
44493   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
44494  </funcprototype></funcsynopsis>
44495</refsynopsisdiv>
44496<refsect1>
44497 <title>Arguments</title>
44498 <variablelist>
44499  <varlistentry>
44500   <term><parameter>fcn</parameter></term>
44501   <listitem>
44502    <para>
44503     ioctl callback function to unregister
44504    </para>
44505   </listitem>
44506  </varlistentry>
44507 </variablelist>
44508</refsect1>
44509</refentry>
44510
44511<refentry id="API-snd-ctl-unregister-ioctl-compat">
44512<refentryinfo>
44513 <title>LINUX</title>
44514 <productname>Kernel Hackers Manual</productname>
44515 <date>July 2017</date>
44516</refentryinfo>
44517<refmeta>
44518 <refentrytitle><phrase>snd_ctl_unregister_ioctl_compat</phrase></refentrytitle>
44519 <manvolnum>9</manvolnum>
44520 <refmiscinfo class="version">4.4.14</refmiscinfo>
44521</refmeta>
44522<refnamediv>
44523 <refname>snd_ctl_unregister_ioctl_compat</refname>
44524 <refpurpose>
44525     de-register the device-specific compat 32bit control-ioctls
44526 </refpurpose>
44527</refnamediv>
44528<refsynopsisdiv>
44529 <title>Synopsis</title>
44530  <funcsynopsis><funcprototype>
44531   <funcdef>int <function>snd_ctl_unregister_ioctl_compat </function></funcdef>
44532   <paramdef>snd_kctl_ioctl_func_t <parameter>fcn</parameter></paramdef>
44533  </funcprototype></funcsynopsis>
44534</refsynopsisdiv>
44535<refsect1>
44536 <title>Arguments</title>
44537 <variablelist>
44538  <varlistentry>
44539   <term><parameter>fcn</parameter></term>
44540   <listitem>
44541    <para>
44542     ioctl callback function to unregister
44543    </para>
44544   </listitem>
44545  </varlistentry>
44546 </variablelist>
44547</refsect1>
44548</refentry>
44549
44550<refentry id="API-snd-ctl-boolean-mono-info">
44551<refentryinfo>
44552 <title>LINUX</title>
44553 <productname>Kernel Hackers Manual</productname>
44554 <date>July 2017</date>
44555</refentryinfo>
44556<refmeta>
44557 <refentrytitle><phrase>snd_ctl_boolean_mono_info</phrase></refentrytitle>
44558 <manvolnum>9</manvolnum>
44559 <refmiscinfo class="version">4.4.14</refmiscinfo>
44560</refmeta>
44561<refnamediv>
44562 <refname>snd_ctl_boolean_mono_info</refname>
44563 <refpurpose>
44564     Helper function for a standard boolean info callback with a mono channel
44565 </refpurpose>
44566</refnamediv>
44567<refsynopsisdiv>
44568 <title>Synopsis</title>
44569  <funcsynopsis><funcprototype>
44570   <funcdef>int <function>snd_ctl_boolean_mono_info </function></funcdef>
44571   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
44572   <paramdef>struct snd_ctl_elem_info * <parameter>uinfo</parameter></paramdef>
44573  </funcprototype></funcsynopsis>
44574</refsynopsisdiv>
44575<refsect1>
44576 <title>Arguments</title>
44577 <variablelist>
44578  <varlistentry>
44579   <term><parameter>kcontrol</parameter></term>
44580   <listitem>
44581    <para>
44582     the kcontrol instance
44583    </para>
44584   </listitem>
44585  </varlistentry>
44586  <varlistentry>
44587   <term><parameter>uinfo</parameter></term>
44588   <listitem>
44589    <para>
44590     info to store
44591    </para>
44592   </listitem>
44593  </varlistentry>
44594 </variablelist>
44595</refsect1>
44596<refsect1>
44597<title>Description</title>
44598<para>
44599   This is a function that can be used as info callback for a standard
44600   boolean control with a single mono channel.
44601</para>
44602</refsect1>
44603</refentry>
44604
44605<refentry id="API-snd-ctl-boolean-stereo-info">
44606<refentryinfo>
44607 <title>LINUX</title>
44608 <productname>Kernel Hackers Manual</productname>
44609 <date>July 2017</date>
44610</refentryinfo>
44611<refmeta>
44612 <refentrytitle><phrase>snd_ctl_boolean_stereo_info</phrase></refentrytitle>
44613 <manvolnum>9</manvolnum>
44614 <refmiscinfo class="version">4.4.14</refmiscinfo>
44615</refmeta>
44616<refnamediv>
44617 <refname>snd_ctl_boolean_stereo_info</refname>
44618 <refpurpose>
44619     Helper function for a standard boolean info callback with stereo two channels
44620 </refpurpose>
44621</refnamediv>
44622<refsynopsisdiv>
44623 <title>Synopsis</title>
44624  <funcsynopsis><funcprototype>
44625   <funcdef>int <function>snd_ctl_boolean_stereo_info </function></funcdef>
44626   <paramdef>struct snd_kcontrol * <parameter>kcontrol</parameter></paramdef>
44627   <paramdef>struct snd_ctl_elem_info * <parameter>uinfo</parameter></paramdef>
44628  </funcprototype></funcsynopsis>
44629</refsynopsisdiv>
44630<refsect1>
44631 <title>Arguments</title>
44632 <variablelist>
44633  <varlistentry>
44634   <term><parameter>kcontrol</parameter></term>
44635   <listitem>
44636    <para>
44637     the kcontrol instance
44638    </para>
44639   </listitem>
44640  </varlistentry>
44641  <varlistentry>
44642   <term><parameter>uinfo</parameter></term>
44643   <listitem>
44644    <para>
44645     info to store
44646    </para>
44647   </listitem>
44648  </varlistentry>
44649 </variablelist>
44650</refsect1>
44651<refsect1>
44652<title>Description</title>
44653<para>
44654   This is a function that can be used as info callback for a standard
44655   boolean control with stereo two channels.
44656</para>
44657</refsect1>
44658</refentry>
44659
44660<refentry id="API-snd-ctl-enum-info">
44661<refentryinfo>
44662 <title>LINUX</title>
44663 <productname>Kernel Hackers Manual</productname>
44664 <date>July 2017</date>
44665</refentryinfo>
44666<refmeta>
44667 <refentrytitle><phrase>snd_ctl_enum_info</phrase></refentrytitle>
44668 <manvolnum>9</manvolnum>
44669 <refmiscinfo class="version">4.4.14</refmiscinfo>
44670</refmeta>
44671<refnamediv>
44672 <refname>snd_ctl_enum_info</refname>
44673 <refpurpose>
44674     fills the info structure for an enumerated control
44675 </refpurpose>
44676</refnamediv>
44677<refsynopsisdiv>
44678 <title>Synopsis</title>
44679  <funcsynopsis><funcprototype>
44680   <funcdef>int <function>snd_ctl_enum_info </function></funcdef>
44681   <paramdef>struct snd_ctl_elem_info * <parameter>info</parameter></paramdef>
44682   <paramdef>unsigned int <parameter>channels</parameter></paramdef>
44683   <paramdef>unsigned int <parameter>items</parameter></paramdef>
44684   <paramdef>const char *const <parameter>names[]</parameter></paramdef>
44685  </funcprototype></funcsynopsis>
44686</refsynopsisdiv>
44687<refsect1>
44688 <title>Arguments</title>
44689 <variablelist>
44690  <varlistentry>
44691   <term><parameter>info</parameter></term>
44692   <listitem>
44693    <para>
44694     the structure to be filled
44695    </para>
44696   </listitem>
44697  </varlistentry>
44698  <varlistentry>
44699   <term><parameter>channels</parameter></term>
44700   <listitem>
44701    <para>
44702     the number of the control's channels; often one
44703    </para>
44704   </listitem>
44705  </varlistentry>
44706  <varlistentry>
44707   <term><parameter>items</parameter></term>
44708   <listitem>
44709    <para>
44710     the number of control values; also the size of <parameter>names</parameter>
44711    </para>
44712   </listitem>
44713  </varlistentry>
44714  <varlistentry>
44715   <term><parameter>names[]</parameter></term>
44716   <listitem>
44717    <para>
44718     an array containing the names of all control values
44719    </para>
44720   </listitem>
44721  </varlistentry>
44722 </variablelist>
44723</refsect1>
44724<refsect1>
44725<title>Description</title>
44726<para>
44727   Sets all required fields in <parameter>info</parameter> to their appropriate values.
44728   If the control's accessibility is not the default (readable and writable),
44729   the caller has to fill <parameter>info</parameter>-&gt;access.
44730</para>
44731</refsect1>
44732<refsect1>
44733<title>Return</title>
44734<para>
44735   Zero.
44736</para>
44737</refsect1>
44738</refentry>
44739
44740<!-- sound/core/pcm_lib.c -->
44741<refentry id="API-snd-pcm-set-ops">
44742<refentryinfo>
44743 <title>LINUX</title>
44744 <productname>Kernel Hackers Manual</productname>
44745 <date>July 2017</date>
44746</refentryinfo>
44747<refmeta>
44748 <refentrytitle><phrase>snd_pcm_set_ops</phrase></refentrytitle>
44749 <manvolnum>9</manvolnum>
44750 <refmiscinfo class="version">4.4.14</refmiscinfo>
44751</refmeta>
44752<refnamediv>
44753 <refname>snd_pcm_set_ops</refname>
44754 <refpurpose>
44755  set the PCM operators
44756 </refpurpose>
44757</refnamediv>
44758<refsynopsisdiv>
44759 <title>Synopsis</title>
44760  <funcsynopsis><funcprototype>
44761   <funcdef>void <function>snd_pcm_set_ops </function></funcdef>
44762   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
44763   <paramdef>int <parameter>direction</parameter></paramdef>
44764   <paramdef>const struct snd_pcm_ops * <parameter>ops</parameter></paramdef>
44765  </funcprototype></funcsynopsis>
44766</refsynopsisdiv>
44767<refsect1>
44768 <title>Arguments</title>
44769 <variablelist>
44770  <varlistentry>
44771   <term><parameter>pcm</parameter></term>
44772   <listitem>
44773    <para>
44774     the pcm instance
44775    </para>
44776   </listitem>
44777  </varlistentry>
44778  <varlistentry>
44779   <term><parameter>direction</parameter></term>
44780   <listitem>
44781    <para>
44782     stream direction, SNDRV_PCM_STREAM_XXX
44783    </para>
44784   </listitem>
44785  </varlistentry>
44786  <varlistentry>
44787   <term><parameter>ops</parameter></term>
44788   <listitem>
44789    <para>
44790     the operator table
44791    </para>
44792   </listitem>
44793  </varlistentry>
44794 </variablelist>
44795</refsect1>
44796<refsect1>
44797<title>Description</title>
44798<para>
44799   Sets the given PCM operators to the pcm instance.
44800</para>
44801</refsect1>
44802</refentry>
44803
44804<refentry id="API-snd-pcm-set-sync">
44805<refentryinfo>
44806 <title>LINUX</title>
44807 <productname>Kernel Hackers Manual</productname>
44808 <date>July 2017</date>
44809</refentryinfo>
44810<refmeta>
44811 <refentrytitle><phrase>snd_pcm_set_sync</phrase></refentrytitle>
44812 <manvolnum>9</manvolnum>
44813 <refmiscinfo class="version">4.4.14</refmiscinfo>
44814</refmeta>
44815<refnamediv>
44816 <refname>snd_pcm_set_sync</refname>
44817 <refpurpose>
44818     set the PCM sync id
44819 </refpurpose>
44820</refnamediv>
44821<refsynopsisdiv>
44822 <title>Synopsis</title>
44823  <funcsynopsis><funcprototype>
44824   <funcdef>void <function>snd_pcm_set_sync </function></funcdef>
44825   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
44826  </funcprototype></funcsynopsis>
44827</refsynopsisdiv>
44828<refsect1>
44829 <title>Arguments</title>
44830 <variablelist>
44831  <varlistentry>
44832   <term><parameter>substream</parameter></term>
44833   <listitem>
44834    <para>
44835     the pcm substream
44836    </para>
44837   </listitem>
44838  </varlistentry>
44839 </variablelist>
44840</refsect1>
44841<refsect1>
44842<title>Description</title>
44843<para>
44844   Sets the PCM sync identifier for the card.
44845</para>
44846</refsect1>
44847</refentry>
44848
44849<refentry id="API-snd-interval-refine">
44850<refentryinfo>
44851 <title>LINUX</title>
44852 <productname>Kernel Hackers Manual</productname>
44853 <date>July 2017</date>
44854</refentryinfo>
44855<refmeta>
44856 <refentrytitle><phrase>snd_interval_refine</phrase></refentrytitle>
44857 <manvolnum>9</manvolnum>
44858 <refmiscinfo class="version">4.4.14</refmiscinfo>
44859</refmeta>
44860<refnamediv>
44861 <refname>snd_interval_refine</refname>
44862 <refpurpose>
44863     refine the interval value of configurator
44864 </refpurpose>
44865</refnamediv>
44866<refsynopsisdiv>
44867 <title>Synopsis</title>
44868  <funcsynopsis><funcprototype>
44869   <funcdef>int <function>snd_interval_refine </function></funcdef>
44870   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
44871   <paramdef>const struct snd_interval * <parameter>v</parameter></paramdef>
44872  </funcprototype></funcsynopsis>
44873</refsynopsisdiv>
44874<refsect1>
44875 <title>Arguments</title>
44876 <variablelist>
44877  <varlistentry>
44878   <term><parameter>i</parameter></term>
44879   <listitem>
44880    <para>
44881     the interval value to refine
44882    </para>
44883   </listitem>
44884  </varlistentry>
44885  <varlistentry>
44886   <term><parameter>v</parameter></term>
44887   <listitem>
44888    <para>
44889     the interval value to refer to
44890    </para>
44891   </listitem>
44892  </varlistentry>
44893 </variablelist>
44894</refsect1>
44895<refsect1>
44896<title>Description</title>
44897<para>
44898   Refines the interval value with the reference value.
44899   The interval is changed to the range satisfying both intervals.
44900   The interval status (min, max, integer, etc.) are evaluated.
44901</para>
44902</refsect1>
44903<refsect1>
44904<title>Return</title>
44905<para>
44906   Positive if the value is changed, zero if it's not changed, or a
44907   negative error code.
44908</para>
44909</refsect1>
44910</refentry>
44911
44912<refentry id="API-snd-interval-ratnum">
44913<refentryinfo>
44914 <title>LINUX</title>
44915 <productname>Kernel Hackers Manual</productname>
44916 <date>July 2017</date>
44917</refentryinfo>
44918<refmeta>
44919 <refentrytitle><phrase>snd_interval_ratnum</phrase></refentrytitle>
44920 <manvolnum>9</manvolnum>
44921 <refmiscinfo class="version">4.4.14</refmiscinfo>
44922</refmeta>
44923<refnamediv>
44924 <refname>snd_interval_ratnum</refname>
44925 <refpurpose>
44926     refine the interval value
44927 </refpurpose>
44928</refnamediv>
44929<refsynopsisdiv>
44930 <title>Synopsis</title>
44931  <funcsynopsis><funcprototype>
44932   <funcdef>int <function>snd_interval_ratnum </function></funcdef>
44933   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
44934   <paramdef>unsigned int <parameter>rats_count</parameter></paramdef>
44935   <paramdef>const struct snd_ratnum * <parameter>rats</parameter></paramdef>
44936   <paramdef>unsigned int * <parameter>nump</parameter></paramdef>
44937   <paramdef>unsigned int * <parameter>denp</parameter></paramdef>
44938  </funcprototype></funcsynopsis>
44939</refsynopsisdiv>
44940<refsect1>
44941 <title>Arguments</title>
44942 <variablelist>
44943  <varlistentry>
44944   <term><parameter>i</parameter></term>
44945   <listitem>
44946    <para>
44947     interval to refine
44948    </para>
44949   </listitem>
44950  </varlistentry>
44951  <varlistentry>
44952   <term><parameter>rats_count</parameter></term>
44953   <listitem>
44954    <para>
44955     number of ratnum_t 
44956    </para>
44957   </listitem>
44958  </varlistentry>
44959  <varlistentry>
44960   <term><parameter>rats</parameter></term>
44961   <listitem>
44962    <para>
44963     ratnum_t array
44964    </para>
44965   </listitem>
44966  </varlistentry>
44967  <varlistentry>
44968   <term><parameter>nump</parameter></term>
44969   <listitem>
44970    <para>
44971     pointer to store the resultant numerator
44972    </para>
44973   </listitem>
44974  </varlistentry>
44975  <varlistentry>
44976   <term><parameter>denp</parameter></term>
44977   <listitem>
44978    <para>
44979     pointer to store the resultant denominator
44980    </para>
44981   </listitem>
44982  </varlistentry>
44983 </variablelist>
44984</refsect1>
44985<refsect1>
44986<title>Return</title>
44987<para>
44988   Positive if the value is changed, zero if it's not changed, or a
44989   negative error code.
44990</para>
44991</refsect1>
44992</refentry>
44993
44994<refentry id="API-snd-interval-list">
44995<refentryinfo>
44996 <title>LINUX</title>
44997 <productname>Kernel Hackers Manual</productname>
44998 <date>July 2017</date>
44999</refentryinfo>
45000<refmeta>
45001 <refentrytitle><phrase>snd_interval_list</phrase></refentrytitle>
45002 <manvolnum>9</manvolnum>
45003 <refmiscinfo class="version">4.4.14</refmiscinfo>
45004</refmeta>
45005<refnamediv>
45006 <refname>snd_interval_list</refname>
45007 <refpurpose>
45008     refine the interval value from the list
45009 </refpurpose>
45010</refnamediv>
45011<refsynopsisdiv>
45012 <title>Synopsis</title>
45013  <funcsynopsis><funcprototype>
45014   <funcdef>int <function>snd_interval_list </function></funcdef>
45015   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
45016   <paramdef>unsigned int <parameter>count</parameter></paramdef>
45017   <paramdef>const unsigned int * <parameter>list</parameter></paramdef>
45018   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
45019  </funcprototype></funcsynopsis>
45020</refsynopsisdiv>
45021<refsect1>
45022 <title>Arguments</title>
45023 <variablelist>
45024  <varlistentry>
45025   <term><parameter>i</parameter></term>
45026   <listitem>
45027    <para>
45028     the interval value to refine
45029    </para>
45030   </listitem>
45031  </varlistentry>
45032  <varlistentry>
45033   <term><parameter>count</parameter></term>
45034   <listitem>
45035    <para>
45036     the number of elements in the list
45037    </para>
45038   </listitem>
45039  </varlistentry>
45040  <varlistentry>
45041   <term><parameter>list</parameter></term>
45042   <listitem>
45043    <para>
45044     the value list
45045    </para>
45046   </listitem>
45047  </varlistentry>
45048  <varlistentry>
45049   <term><parameter>mask</parameter></term>
45050   <listitem>
45051    <para>
45052     the bit-mask to evaluate
45053    </para>
45054   </listitem>
45055  </varlistentry>
45056 </variablelist>
45057</refsect1>
45058<refsect1>
45059<title>Description</title>
45060<para>
45061   Refines the interval value from the list.
45062   When mask is non-zero, only the elements corresponding to bit 1 are
45063   evaluated.
45064</para>
45065</refsect1>
45066<refsect1>
45067<title>Return</title>
45068<para>
45069   Positive if the value is changed, zero if it's not changed, or a
45070   negative error code.
45071</para>
45072</refsect1>
45073</refentry>
45074
45075<refentry id="API-snd-interval-ranges">
45076<refentryinfo>
45077 <title>LINUX</title>
45078 <productname>Kernel Hackers Manual</productname>
45079 <date>July 2017</date>
45080</refentryinfo>
45081<refmeta>
45082 <refentrytitle><phrase>snd_interval_ranges</phrase></refentrytitle>
45083 <manvolnum>9</manvolnum>
45084 <refmiscinfo class="version">4.4.14</refmiscinfo>
45085</refmeta>
45086<refnamediv>
45087 <refname>snd_interval_ranges</refname>
45088 <refpurpose>
45089     refine the interval value from the list of ranges
45090 </refpurpose>
45091</refnamediv>
45092<refsynopsisdiv>
45093 <title>Synopsis</title>
45094  <funcsynopsis><funcprototype>
45095   <funcdef>int <function>snd_interval_ranges </function></funcdef>
45096   <paramdef>struct snd_interval * <parameter>i</parameter></paramdef>
45097   <paramdef>unsigned int <parameter>count</parameter></paramdef>
45098   <paramdef>const struct snd_interval * <parameter>ranges</parameter></paramdef>
45099   <paramdef>unsigned int <parameter>mask</parameter></paramdef>
45100  </funcprototype></funcsynopsis>
45101</refsynopsisdiv>
45102<refsect1>
45103 <title>Arguments</title>
45104 <variablelist>
45105  <varlistentry>
45106   <term><parameter>i</parameter></term>
45107   <listitem>
45108    <para>
45109     the interval value to refine
45110    </para>
45111   </listitem>
45112  </varlistentry>
45113  <varlistentry>
45114   <term><parameter>count</parameter></term>
45115   <listitem>
45116    <para>
45117     the number of elements in the list of ranges
45118    </para>
45119   </listitem>
45120  </varlistentry>
45121  <varlistentry>
45122   <term><parameter>ranges</parameter></term>
45123   <listitem>
45124    <para>
45125     the ranges list
45126    </para>
45127   </listitem>
45128  </varlistentry>
45129  <varlistentry>
45130   <term><parameter>mask</parameter></term>
45131   <listitem>
45132    <para>
45133     the bit-mask to evaluate
45134    </para>
45135   </listitem>
45136  </varlistentry>
45137 </variablelist>
45138</refsect1>
45139<refsect1>
45140<title>Description</title>
45141<para>
45142   Refines the interval value from the list of ranges.
45143   When mask is non-zero, only the elements corresponding to bit 1 are
45144   evaluated.
45145</para>
45146</refsect1>
45147<refsect1>
45148<title>Return</title>
45149<para>
45150   Positive if the value is changed, zero if it's not changed, or a
45151   negative error code.
45152</para>
45153</refsect1>
45154</refentry>
45155
45156<refentry id="API-snd-pcm-hw-rule-add">
45157<refentryinfo>
45158 <title>LINUX</title>
45159 <productname>Kernel Hackers Manual</productname>
45160 <date>July 2017</date>
45161</refentryinfo>
45162<refmeta>
45163 <refentrytitle><phrase>snd_pcm_hw_rule_add</phrase></refentrytitle>
45164 <manvolnum>9</manvolnum>
45165 <refmiscinfo class="version">4.4.14</refmiscinfo>
45166</refmeta>
45167<refnamediv>
45168 <refname>snd_pcm_hw_rule_add</refname>
45169 <refpurpose>
45170     add the hw-constraint rule
45171 </refpurpose>
45172</refnamediv>
45173<refsynopsisdiv>
45174 <title>Synopsis</title>
45175  <funcsynopsis><funcprototype>
45176   <funcdef>int <function>snd_pcm_hw_rule_add </function></funcdef>
45177   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45178   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45179   <paramdef>int <parameter>var</parameter></paramdef>
45180   <paramdef>snd_pcm_hw_rule_func_t <parameter>func</parameter></paramdef>
45181   <paramdef>void * <parameter>private</parameter></paramdef>
45182   <paramdef>int <parameter>dep</parameter></paramdef>
45183   <paramdef> <parameter>...</parameter></paramdef>
45184  </funcprototype></funcsynopsis>
45185</refsynopsisdiv>
45186<refsect1>
45187 <title>Arguments</title>
45188 <variablelist>
45189  <varlistentry>
45190   <term><parameter>runtime</parameter></term>
45191   <listitem>
45192    <para>
45193     the pcm runtime instance
45194    </para>
45195   </listitem>
45196  </varlistentry>
45197  <varlistentry>
45198   <term><parameter>cond</parameter></term>
45199   <listitem>
45200    <para>
45201     condition bits
45202    </para>
45203   </listitem>
45204  </varlistentry>
45205  <varlistentry>
45206   <term><parameter>var</parameter></term>
45207   <listitem>
45208    <para>
45209     the variable to evaluate
45210    </para>
45211   </listitem>
45212  </varlistentry>
45213  <varlistentry>
45214   <term><parameter>func</parameter></term>
45215   <listitem>
45216    <para>
45217     the evaluation function
45218    </para>
45219   </listitem>
45220  </varlistentry>
45221  <varlistentry>
45222   <term><parameter>private</parameter></term>
45223   <listitem>
45224    <para>
45225     the private data pointer passed to function
45226    </para>
45227   </listitem>
45228  </varlistentry>
45229  <varlistentry>
45230   <term><parameter>dep</parameter></term>
45231   <listitem>
45232    <para>
45233     the dependent variables
45234    </para>
45235   </listitem>
45236  </varlistentry>
45237  <varlistentry>
45238   <term><parameter>...</parameter></term>
45239   <listitem>
45240    <para>
45241     variable arguments
45242    </para>
45243   </listitem>
45244  </varlistentry>
45245 </variablelist>
45246</refsect1>
45247<refsect1>
45248<title>Return</title>
45249<para>
45250   Zero if successful, or a negative error code on failure.
45251</para>
45252</refsect1>
45253</refentry>
45254
45255<refentry id="API-snd-pcm-hw-constraint-mask64">
45256<refentryinfo>
45257 <title>LINUX</title>
45258 <productname>Kernel Hackers Manual</productname>
45259 <date>July 2017</date>
45260</refentryinfo>
45261<refmeta>
45262 <refentrytitle><phrase>snd_pcm_hw_constraint_mask64</phrase></refentrytitle>
45263 <manvolnum>9</manvolnum>
45264 <refmiscinfo class="version">4.4.14</refmiscinfo>
45265</refmeta>
45266<refnamediv>
45267 <refname>snd_pcm_hw_constraint_mask64</refname>
45268 <refpurpose>
45269     apply the given bitmap mask constraint
45270 </refpurpose>
45271</refnamediv>
45272<refsynopsisdiv>
45273 <title>Synopsis</title>
45274  <funcsynopsis><funcprototype>
45275   <funcdef>int <function>snd_pcm_hw_constraint_mask64 </function></funcdef>
45276   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45277   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45278   <paramdef>u_int64_t <parameter>mask</parameter></paramdef>
45279  </funcprototype></funcsynopsis>
45280</refsynopsisdiv>
45281<refsect1>
45282 <title>Arguments</title>
45283 <variablelist>
45284  <varlistentry>
45285   <term><parameter>runtime</parameter></term>
45286   <listitem>
45287    <para>
45288     PCM runtime instance
45289    </para>
45290   </listitem>
45291  </varlistentry>
45292  <varlistentry>
45293   <term><parameter>var</parameter></term>
45294   <listitem>
45295    <para>
45296     hw_params variable to apply the mask
45297    </para>
45298   </listitem>
45299  </varlistentry>
45300  <varlistentry>
45301   <term><parameter>mask</parameter></term>
45302   <listitem>
45303    <para>
45304     the 64bit bitmap mask
45305    </para>
45306   </listitem>
45307  </varlistentry>
45308 </variablelist>
45309</refsect1>
45310<refsect1>
45311<title>Description</title>
45312<para>
45313   Apply the constraint of the given bitmap mask to a 64-bit mask parameter.
45314</para>
45315</refsect1>
45316<refsect1>
45317<title>Return</title>
45318<para>
45319   Zero if successful, or a negative error code on failure.
45320</para>
45321</refsect1>
45322</refentry>
45323
45324<refentry id="API-snd-pcm-hw-constraint-integer">
45325<refentryinfo>
45326 <title>LINUX</title>
45327 <productname>Kernel Hackers Manual</productname>
45328 <date>July 2017</date>
45329</refentryinfo>
45330<refmeta>
45331 <refentrytitle><phrase>snd_pcm_hw_constraint_integer</phrase></refentrytitle>
45332 <manvolnum>9</manvolnum>
45333 <refmiscinfo class="version">4.4.14</refmiscinfo>
45334</refmeta>
45335<refnamediv>
45336 <refname>snd_pcm_hw_constraint_integer</refname>
45337 <refpurpose>
45338     apply an integer constraint to an interval
45339 </refpurpose>
45340</refnamediv>
45341<refsynopsisdiv>
45342 <title>Synopsis</title>
45343  <funcsynopsis><funcprototype>
45344   <funcdef>int <function>snd_pcm_hw_constraint_integer </function></funcdef>
45345   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45346   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45347  </funcprototype></funcsynopsis>
45348</refsynopsisdiv>
45349<refsect1>
45350 <title>Arguments</title>
45351 <variablelist>
45352  <varlistentry>
45353   <term><parameter>runtime</parameter></term>
45354   <listitem>
45355    <para>
45356     PCM runtime instance
45357    </para>
45358   </listitem>
45359  </varlistentry>
45360  <varlistentry>
45361   <term><parameter>var</parameter></term>
45362   <listitem>
45363    <para>
45364     hw_params variable to apply the integer constraint
45365    </para>
45366   </listitem>
45367  </varlistentry>
45368 </variablelist>
45369</refsect1>
45370<refsect1>
45371<title>Description</title>
45372<para>
45373   Apply the constraint of integer to an interval parameter.
45374</para>
45375</refsect1>
45376<refsect1>
45377<title>Return</title>
45378<para>
45379   Positive if the value is changed, zero if it's not changed, or a
45380   negative error code.
45381</para>
45382</refsect1>
45383</refentry>
45384
45385<refentry id="API-snd-pcm-hw-constraint-minmax">
45386<refentryinfo>
45387 <title>LINUX</title>
45388 <productname>Kernel Hackers Manual</productname>
45389 <date>July 2017</date>
45390</refentryinfo>
45391<refmeta>
45392 <refentrytitle><phrase>snd_pcm_hw_constraint_minmax</phrase></refentrytitle>
45393 <manvolnum>9</manvolnum>
45394 <refmiscinfo class="version">4.4.14</refmiscinfo>
45395</refmeta>
45396<refnamediv>
45397 <refname>snd_pcm_hw_constraint_minmax</refname>
45398 <refpurpose>
45399     apply a min/max range constraint to an interval
45400 </refpurpose>
45401</refnamediv>
45402<refsynopsisdiv>
45403 <title>Synopsis</title>
45404  <funcsynopsis><funcprototype>
45405   <funcdef>int <function>snd_pcm_hw_constraint_minmax </function></funcdef>
45406   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45407   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45408   <paramdef>unsigned int <parameter>min</parameter></paramdef>
45409   <paramdef>unsigned int <parameter>max</parameter></paramdef>
45410  </funcprototype></funcsynopsis>
45411</refsynopsisdiv>
45412<refsect1>
45413 <title>Arguments</title>
45414 <variablelist>
45415  <varlistentry>
45416   <term><parameter>runtime</parameter></term>
45417   <listitem>
45418    <para>
45419     PCM runtime instance
45420    </para>
45421   </listitem>
45422  </varlistentry>
45423  <varlistentry>
45424   <term><parameter>var</parameter></term>
45425   <listitem>
45426    <para>
45427     hw_params variable to apply the range
45428    </para>
45429   </listitem>
45430  </varlistentry>
45431  <varlistentry>
45432   <term><parameter>min</parameter></term>
45433   <listitem>
45434    <para>
45435     the minimal value
45436    </para>
45437   </listitem>
45438  </varlistentry>
45439  <varlistentry>
45440   <term><parameter>max</parameter></term>
45441   <listitem>
45442    <para>
45443     the maximal value
45444    </para>
45445   </listitem>
45446  </varlistentry>
45447 </variablelist>
45448</refsect1>
45449<refsect1>
45450<title>Description</title>
45451<para>
45452   Apply the min/max range constraint to an interval parameter.
45453</para>
45454</refsect1>
45455<refsect1>
45456<title>Return</title>
45457<para>
45458   Positive if the value is changed, zero if it's not changed, or a
45459   negative error code.
45460</para>
45461</refsect1>
45462</refentry>
45463
45464<refentry id="API-snd-pcm-hw-constraint-list">
45465<refentryinfo>
45466 <title>LINUX</title>
45467 <productname>Kernel Hackers Manual</productname>
45468 <date>July 2017</date>
45469</refentryinfo>
45470<refmeta>
45471 <refentrytitle><phrase>snd_pcm_hw_constraint_list</phrase></refentrytitle>
45472 <manvolnum>9</manvolnum>
45473 <refmiscinfo class="version">4.4.14</refmiscinfo>
45474</refmeta>
45475<refnamediv>
45476 <refname>snd_pcm_hw_constraint_list</refname>
45477 <refpurpose>
45478     apply a list of constraints to a parameter
45479 </refpurpose>
45480</refnamediv>
45481<refsynopsisdiv>
45482 <title>Synopsis</title>
45483  <funcsynopsis><funcprototype>
45484   <funcdef>int <function>snd_pcm_hw_constraint_list </function></funcdef>
45485   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45486   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45487   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45488   <paramdef>const struct snd_pcm_hw_constraint_list * <parameter>l</parameter></paramdef>
45489  </funcprototype></funcsynopsis>
45490</refsynopsisdiv>
45491<refsect1>
45492 <title>Arguments</title>
45493 <variablelist>
45494  <varlistentry>
45495   <term><parameter>runtime</parameter></term>
45496   <listitem>
45497    <para>
45498     PCM runtime instance
45499    </para>
45500   </listitem>
45501  </varlistentry>
45502  <varlistentry>
45503   <term><parameter>cond</parameter></term>
45504   <listitem>
45505    <para>
45506     condition bits
45507    </para>
45508   </listitem>
45509  </varlistentry>
45510  <varlistentry>
45511   <term><parameter>var</parameter></term>
45512   <listitem>
45513    <para>
45514     hw_params variable to apply the list constraint
45515    </para>
45516   </listitem>
45517  </varlistentry>
45518  <varlistentry>
45519   <term><parameter>l</parameter></term>
45520   <listitem>
45521    <para>
45522     list
45523    </para>
45524   </listitem>
45525  </varlistentry>
45526 </variablelist>
45527</refsect1>
45528<refsect1>
45529<title>Description</title>
45530<para>
45531   Apply the list of constraints to an interval parameter.
45532</para>
45533</refsect1>
45534<refsect1>
45535<title>Return</title>
45536<para>
45537   Zero if successful, or a negative error code on failure.
45538</para>
45539</refsect1>
45540</refentry>
45541
45542<refentry id="API-snd-pcm-hw-constraint-ranges">
45543<refentryinfo>
45544 <title>LINUX</title>
45545 <productname>Kernel Hackers Manual</productname>
45546 <date>July 2017</date>
45547</refentryinfo>
45548<refmeta>
45549 <refentrytitle><phrase>snd_pcm_hw_constraint_ranges</phrase></refentrytitle>
45550 <manvolnum>9</manvolnum>
45551 <refmiscinfo class="version">4.4.14</refmiscinfo>
45552</refmeta>
45553<refnamediv>
45554 <refname>snd_pcm_hw_constraint_ranges</refname>
45555 <refpurpose>
45556     apply list of range constraints to a parameter
45557 </refpurpose>
45558</refnamediv>
45559<refsynopsisdiv>
45560 <title>Synopsis</title>
45561  <funcsynopsis><funcprototype>
45562   <funcdef>int <function>snd_pcm_hw_constraint_ranges </function></funcdef>
45563   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45564   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45565   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45566   <paramdef>const struct snd_pcm_hw_constraint_ranges * <parameter>r</parameter></paramdef>
45567  </funcprototype></funcsynopsis>
45568</refsynopsisdiv>
45569<refsect1>
45570 <title>Arguments</title>
45571 <variablelist>
45572  <varlistentry>
45573   <term><parameter>runtime</parameter></term>
45574   <listitem>
45575    <para>
45576     PCM runtime instance
45577    </para>
45578   </listitem>
45579  </varlistentry>
45580  <varlistentry>
45581   <term><parameter>cond</parameter></term>
45582   <listitem>
45583    <para>
45584     condition bits
45585    </para>
45586   </listitem>
45587  </varlistentry>
45588  <varlistentry>
45589   <term><parameter>var</parameter></term>
45590   <listitem>
45591    <para>
45592     hw_params variable to apply the list of range constraints
45593    </para>
45594   </listitem>
45595  </varlistentry>
45596  <varlistentry>
45597   <term><parameter>r</parameter></term>
45598   <listitem>
45599    <para>
45600     ranges
45601    </para>
45602   </listitem>
45603  </varlistentry>
45604 </variablelist>
45605</refsect1>
45606<refsect1>
45607<title>Description</title>
45608<para>
45609   Apply the list of range constraints to an interval parameter.
45610</para>
45611</refsect1>
45612<refsect1>
45613<title>Return</title>
45614<para>
45615   Zero if successful, or a negative error code on failure.
45616</para>
45617</refsect1>
45618</refentry>
45619
45620<refentry id="API-snd-pcm-hw-constraint-ratnums">
45621<refentryinfo>
45622 <title>LINUX</title>
45623 <productname>Kernel Hackers Manual</productname>
45624 <date>July 2017</date>
45625</refentryinfo>
45626<refmeta>
45627 <refentrytitle><phrase>snd_pcm_hw_constraint_ratnums</phrase></refentrytitle>
45628 <manvolnum>9</manvolnum>
45629 <refmiscinfo class="version">4.4.14</refmiscinfo>
45630</refmeta>
45631<refnamediv>
45632 <refname>snd_pcm_hw_constraint_ratnums</refname>
45633 <refpurpose>
45634     apply ratnums constraint to a parameter
45635 </refpurpose>
45636</refnamediv>
45637<refsynopsisdiv>
45638 <title>Synopsis</title>
45639  <funcsynopsis><funcprototype>
45640   <funcdef>int <function>snd_pcm_hw_constraint_ratnums </function></funcdef>
45641   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45642   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45643   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45644   <paramdef>const struct snd_pcm_hw_constraint_ratnums * <parameter>r</parameter></paramdef>
45645  </funcprototype></funcsynopsis>
45646</refsynopsisdiv>
45647<refsect1>
45648 <title>Arguments</title>
45649 <variablelist>
45650  <varlistentry>
45651   <term><parameter>runtime</parameter></term>
45652   <listitem>
45653    <para>
45654     PCM runtime instance
45655    </para>
45656   </listitem>
45657  </varlistentry>
45658  <varlistentry>
45659   <term><parameter>cond</parameter></term>
45660   <listitem>
45661    <para>
45662     condition bits
45663    </para>
45664   </listitem>
45665  </varlistentry>
45666  <varlistentry>
45667   <term><parameter>var</parameter></term>
45668   <listitem>
45669    <para>
45670     hw_params variable to apply the ratnums constraint
45671    </para>
45672   </listitem>
45673  </varlistentry>
45674  <varlistentry>
45675   <term><parameter>r</parameter></term>
45676   <listitem>
45677    <para>
45678     struct snd_ratnums constriants
45679    </para>
45680   </listitem>
45681  </varlistentry>
45682 </variablelist>
45683</refsect1>
45684<refsect1>
45685<title>Return</title>
45686<para>
45687   Zero if successful, or a negative error code on failure.
45688</para>
45689</refsect1>
45690</refentry>
45691
45692<refentry id="API-snd-pcm-hw-constraint-ratdens">
45693<refentryinfo>
45694 <title>LINUX</title>
45695 <productname>Kernel Hackers Manual</productname>
45696 <date>July 2017</date>
45697</refentryinfo>
45698<refmeta>
45699 <refentrytitle><phrase>snd_pcm_hw_constraint_ratdens</phrase></refentrytitle>
45700 <manvolnum>9</manvolnum>
45701 <refmiscinfo class="version">4.4.14</refmiscinfo>
45702</refmeta>
45703<refnamediv>
45704 <refname>snd_pcm_hw_constraint_ratdens</refname>
45705 <refpurpose>
45706     apply ratdens constraint to a parameter
45707 </refpurpose>
45708</refnamediv>
45709<refsynopsisdiv>
45710 <title>Synopsis</title>
45711  <funcsynopsis><funcprototype>
45712   <funcdef>int <function>snd_pcm_hw_constraint_ratdens </function></funcdef>
45713   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45714   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45715   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45716   <paramdef>const struct snd_pcm_hw_constraint_ratdens * <parameter>r</parameter></paramdef>
45717  </funcprototype></funcsynopsis>
45718</refsynopsisdiv>
45719<refsect1>
45720 <title>Arguments</title>
45721 <variablelist>
45722  <varlistentry>
45723   <term><parameter>runtime</parameter></term>
45724   <listitem>
45725    <para>
45726     PCM runtime instance
45727    </para>
45728   </listitem>
45729  </varlistentry>
45730  <varlistentry>
45731   <term><parameter>cond</parameter></term>
45732   <listitem>
45733    <para>
45734     condition bits
45735    </para>
45736   </listitem>
45737  </varlistentry>
45738  <varlistentry>
45739   <term><parameter>var</parameter></term>
45740   <listitem>
45741    <para>
45742     hw_params variable to apply the ratdens constraint
45743    </para>
45744   </listitem>
45745  </varlistentry>
45746  <varlistentry>
45747   <term><parameter>r</parameter></term>
45748   <listitem>
45749    <para>
45750     struct snd_ratdens constriants
45751    </para>
45752   </listitem>
45753  </varlistentry>
45754 </variablelist>
45755</refsect1>
45756<refsect1>
45757<title>Return</title>
45758<para>
45759   Zero if successful, or a negative error code on failure.
45760</para>
45761</refsect1>
45762</refentry>
45763
45764<refentry id="API-snd-pcm-hw-constraint-msbits">
45765<refentryinfo>
45766 <title>LINUX</title>
45767 <productname>Kernel Hackers Manual</productname>
45768 <date>July 2017</date>
45769</refentryinfo>
45770<refmeta>
45771 <refentrytitle><phrase>snd_pcm_hw_constraint_msbits</phrase></refentrytitle>
45772 <manvolnum>9</manvolnum>
45773 <refmiscinfo class="version">4.4.14</refmiscinfo>
45774</refmeta>
45775<refnamediv>
45776 <refname>snd_pcm_hw_constraint_msbits</refname>
45777 <refpurpose>
45778     add a hw constraint msbits rule
45779 </refpurpose>
45780</refnamediv>
45781<refsynopsisdiv>
45782 <title>Synopsis</title>
45783  <funcsynopsis><funcprototype>
45784   <funcdef>int <function>snd_pcm_hw_constraint_msbits </function></funcdef>
45785   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45786   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45787   <paramdef>unsigned int <parameter>width</parameter></paramdef>
45788   <paramdef>unsigned int <parameter>msbits</parameter></paramdef>
45789  </funcprototype></funcsynopsis>
45790</refsynopsisdiv>
45791<refsect1>
45792 <title>Arguments</title>
45793 <variablelist>
45794  <varlistentry>
45795   <term><parameter>runtime</parameter></term>
45796   <listitem>
45797    <para>
45798     PCM runtime instance
45799    </para>
45800   </listitem>
45801  </varlistentry>
45802  <varlistentry>
45803   <term><parameter>cond</parameter></term>
45804   <listitem>
45805    <para>
45806     condition bits
45807    </para>
45808   </listitem>
45809  </varlistentry>
45810  <varlistentry>
45811   <term><parameter>width</parameter></term>
45812   <listitem>
45813    <para>
45814     sample bits width
45815    </para>
45816   </listitem>
45817  </varlistentry>
45818  <varlistentry>
45819   <term><parameter>msbits</parameter></term>
45820   <listitem>
45821    <para>
45822     msbits width
45823    </para>
45824   </listitem>
45825  </varlistentry>
45826 </variablelist>
45827</refsect1>
45828<refsect1>
45829<title>Description</title>
45830<para>
45831   This constraint will set the number of most significant bits (msbits) if a
45832   sample format with the specified width has been select. If width is set to 0
45833   the msbits will be set for any sample format with a width larger than the
45834   specified msbits.
45835</para>
45836</refsect1>
45837<refsect1>
45838<title>Return</title>
45839<para>
45840   Zero if successful, or a negative error code on failure.
45841</para>
45842</refsect1>
45843</refentry>
45844
45845<refentry id="API-snd-pcm-hw-constraint-step">
45846<refentryinfo>
45847 <title>LINUX</title>
45848 <productname>Kernel Hackers Manual</productname>
45849 <date>July 2017</date>
45850</refentryinfo>
45851<refmeta>
45852 <refentrytitle><phrase>snd_pcm_hw_constraint_step</phrase></refentrytitle>
45853 <manvolnum>9</manvolnum>
45854 <refmiscinfo class="version">4.4.14</refmiscinfo>
45855</refmeta>
45856<refnamediv>
45857 <refname>snd_pcm_hw_constraint_step</refname>
45858 <refpurpose>
45859     add a hw constraint step rule
45860 </refpurpose>
45861</refnamediv>
45862<refsynopsisdiv>
45863 <title>Synopsis</title>
45864  <funcsynopsis><funcprototype>
45865   <funcdef>int <function>snd_pcm_hw_constraint_step </function></funcdef>
45866   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45867   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45868   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45869   <paramdef>unsigned long <parameter>step</parameter></paramdef>
45870  </funcprototype></funcsynopsis>
45871</refsynopsisdiv>
45872<refsect1>
45873 <title>Arguments</title>
45874 <variablelist>
45875  <varlistentry>
45876   <term><parameter>runtime</parameter></term>
45877   <listitem>
45878    <para>
45879     PCM runtime instance
45880    </para>
45881   </listitem>
45882  </varlistentry>
45883  <varlistentry>
45884   <term><parameter>cond</parameter></term>
45885   <listitem>
45886    <para>
45887     condition bits
45888    </para>
45889   </listitem>
45890  </varlistentry>
45891  <varlistentry>
45892   <term><parameter>var</parameter></term>
45893   <listitem>
45894    <para>
45895     hw_params variable to apply the step constraint
45896    </para>
45897   </listitem>
45898  </varlistentry>
45899  <varlistentry>
45900   <term><parameter>step</parameter></term>
45901   <listitem>
45902    <para>
45903     step size
45904    </para>
45905   </listitem>
45906  </varlistentry>
45907 </variablelist>
45908</refsect1>
45909<refsect1>
45910<title>Return</title>
45911<para>
45912   Zero if successful, or a negative error code on failure.
45913</para>
45914</refsect1>
45915</refentry>
45916
45917<refentry id="API-snd-pcm-hw-constraint-pow2">
45918<refentryinfo>
45919 <title>LINUX</title>
45920 <productname>Kernel Hackers Manual</productname>
45921 <date>July 2017</date>
45922</refentryinfo>
45923<refmeta>
45924 <refentrytitle><phrase>snd_pcm_hw_constraint_pow2</phrase></refentrytitle>
45925 <manvolnum>9</manvolnum>
45926 <refmiscinfo class="version">4.4.14</refmiscinfo>
45927</refmeta>
45928<refnamediv>
45929 <refname>snd_pcm_hw_constraint_pow2</refname>
45930 <refpurpose>
45931     add a hw constraint power-of-2 rule
45932 </refpurpose>
45933</refnamediv>
45934<refsynopsisdiv>
45935 <title>Synopsis</title>
45936  <funcsynopsis><funcprototype>
45937   <funcdef>int <function>snd_pcm_hw_constraint_pow2 </function></funcdef>
45938   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
45939   <paramdef>unsigned int <parameter>cond</parameter></paramdef>
45940   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
45941  </funcprototype></funcsynopsis>
45942</refsynopsisdiv>
45943<refsect1>
45944 <title>Arguments</title>
45945 <variablelist>
45946  <varlistentry>
45947   <term><parameter>runtime</parameter></term>
45948   <listitem>
45949    <para>
45950     PCM runtime instance
45951    </para>
45952   </listitem>
45953  </varlistentry>
45954  <varlistentry>
45955   <term><parameter>cond</parameter></term>
45956   <listitem>
45957    <para>
45958     condition bits
45959    </para>
45960   </listitem>
45961  </varlistentry>
45962  <varlistentry>
45963   <term><parameter>var</parameter></term>
45964   <listitem>
45965    <para>
45966     hw_params variable to apply the power-of-2 constraint
45967    </para>
45968   </listitem>
45969  </varlistentry>
45970 </variablelist>
45971</refsect1>
45972<refsect1>
45973<title>Return</title>
45974<para>
45975   Zero if successful, or a negative error code on failure.
45976</para>
45977</refsect1>
45978</refentry>
45979
45980<refentry id="API-snd-pcm-hw-rule-noresample">
45981<refentryinfo>
45982 <title>LINUX</title>
45983 <productname>Kernel Hackers Manual</productname>
45984 <date>July 2017</date>
45985</refentryinfo>
45986<refmeta>
45987 <refentrytitle><phrase>snd_pcm_hw_rule_noresample</phrase></refentrytitle>
45988 <manvolnum>9</manvolnum>
45989 <refmiscinfo class="version">4.4.14</refmiscinfo>
45990</refmeta>
45991<refnamediv>
45992 <refname>snd_pcm_hw_rule_noresample</refname>
45993 <refpurpose>
45994     add a rule to allow disabling hw resampling
45995 </refpurpose>
45996</refnamediv>
45997<refsynopsisdiv>
45998 <title>Synopsis</title>
45999  <funcsynopsis><funcprototype>
46000   <funcdef>int <function>snd_pcm_hw_rule_noresample </function></funcdef>
46001   <paramdef>struct snd_pcm_runtime * <parameter>runtime</parameter></paramdef>
46002   <paramdef>unsigned int <parameter>base_rate</parameter></paramdef>
46003  </funcprototype></funcsynopsis>
46004</refsynopsisdiv>
46005<refsect1>
46006 <title>Arguments</title>
46007 <variablelist>
46008  <varlistentry>
46009   <term><parameter>runtime</parameter></term>
46010   <listitem>
46011    <para>
46012     PCM runtime instance
46013    </para>
46014   </listitem>
46015  </varlistentry>
46016  <varlistentry>
46017   <term><parameter>base_rate</parameter></term>
46018   <listitem>
46019    <para>
46020     the rate at which the hardware does not resample
46021    </para>
46022   </listitem>
46023  </varlistentry>
46024 </variablelist>
46025</refsect1>
46026<refsect1>
46027<title>Return</title>
46028<para>
46029   Zero if successful, or a negative error code on failure.
46030</para>
46031</refsect1>
46032</refentry>
46033
46034<refentry id="API-snd-pcm-hw-param-value">
46035<refentryinfo>
46036 <title>LINUX</title>
46037 <productname>Kernel Hackers Manual</productname>
46038 <date>July 2017</date>
46039</refentryinfo>
46040<refmeta>
46041 <refentrytitle><phrase>snd_pcm_hw_param_value</phrase></refentrytitle>
46042 <manvolnum>9</manvolnum>
46043 <refmiscinfo class="version">4.4.14</refmiscinfo>
46044</refmeta>
46045<refnamediv>
46046 <refname>snd_pcm_hw_param_value</refname>
46047 <refpurpose>
46048     return <parameter>params</parameter> field <parameter>var</parameter> value
46049 </refpurpose>
46050</refnamediv>
46051<refsynopsisdiv>
46052 <title>Synopsis</title>
46053  <funcsynopsis><funcprototype>
46054   <funcdef>int <function>snd_pcm_hw_param_value </function></funcdef>
46055   <paramdef>const struct snd_pcm_hw_params * <parameter>params</parameter></paramdef>
46056   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
46057   <paramdef>int * <parameter>dir</parameter></paramdef>
46058  </funcprototype></funcsynopsis>
46059</refsynopsisdiv>
46060<refsect1>
46061 <title>Arguments</title>
46062 <variablelist>
46063  <varlistentry>
46064   <term><parameter>params</parameter></term>
46065   <listitem>
46066    <para>
46067     the hw_params instance
46068    </para>
46069   </listitem>
46070  </varlistentry>
46071  <varlistentry>
46072   <term><parameter>var</parameter></term>
46073   <listitem>
46074    <para>
46075     parameter to retrieve
46076    </para>
46077   </listitem>
46078  </varlistentry>
46079  <varlistentry>
46080   <term><parameter>dir</parameter></term>
46081   <listitem>
46082    <para>
46083     pointer to the direction (-1,0,1) or <constant>NULL</constant>
46084    </para>
46085   </listitem>
46086  </varlistentry>
46087 </variablelist>
46088</refsect1>
46089<refsect1>
46090<title>Return</title>
46091<para>
46092   The value for field <parameter>var</parameter> if it's fixed in configuration space
46093   defined by <parameter>params</parameter>. -<constant>EINVAL</constant> otherwise.
46094</para>
46095</refsect1>
46096</refentry>
46097
46098<refentry id="API-snd-pcm-hw-param-first">
46099<refentryinfo>
46100 <title>LINUX</title>
46101 <productname>Kernel Hackers Manual</productname>
46102 <date>July 2017</date>
46103</refentryinfo>
46104<refmeta>
46105 <refentrytitle><phrase>snd_pcm_hw_param_first</phrase></refentrytitle>
46106 <manvolnum>9</manvolnum>
46107 <refmiscinfo class="version">4.4.14</refmiscinfo>
46108</refmeta>
46109<refnamediv>
46110 <refname>snd_pcm_hw_param_first</refname>
46111 <refpurpose>
46112     refine config space and return minimum value
46113 </refpurpose>
46114</refnamediv>
46115<refsynopsisdiv>
46116 <title>Synopsis</title>
46117  <funcsynopsis><funcprototype>
46118   <funcdef>int <function>snd_pcm_hw_param_first </function></funcdef>
46119   <paramdef>struct snd_pcm_substream * <parameter>pcm</parameter></paramdef>
46120   <paramdef>struct snd_pcm_hw_params * <parameter>params</parameter></paramdef>
46121   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
46122   <paramdef>int * <parameter>dir</parameter></paramdef>
46123  </funcprototype></funcsynopsis>
46124</refsynopsisdiv>
46125<refsect1>
46126 <title>Arguments</title>
46127 <variablelist>
46128  <varlistentry>
46129   <term><parameter>pcm</parameter></term>
46130   <listitem>
46131    <para>
46132     PCM instance
46133    </para>
46134   </listitem>
46135  </varlistentry>
46136  <varlistentry>
46137   <term><parameter>params</parameter></term>
46138   <listitem>
46139    <para>
46140     the hw_params instance
46141    </para>
46142   </listitem>
46143  </varlistentry>
46144  <varlistentry>
46145   <term><parameter>var</parameter></term>
46146   <listitem>
46147    <para>
46148     parameter to retrieve
46149    </para>
46150   </listitem>
46151  </varlistentry>
46152  <varlistentry>
46153   <term><parameter>dir</parameter></term>
46154   <listitem>
46155    <para>
46156     pointer to the direction (-1,0,1) or <constant>NULL</constant>
46157    </para>
46158   </listitem>
46159  </varlistentry>
46160 </variablelist>
46161</refsect1>
46162<refsect1>
46163<title>Description</title>
46164<para>
46165   Inside configuration space defined by <parameter>params</parameter> remove from <parameter>var</parameter> all
46166   values &gt; minimum. Reduce configuration space accordingly.
46167</para>
46168</refsect1>
46169<refsect1>
46170<title>Return</title>
46171<para>
46172   The minimum, or a negative error code on failure.
46173</para>
46174</refsect1>
46175</refentry>
46176
46177<refentry id="API-snd-pcm-hw-param-last">
46178<refentryinfo>
46179 <title>LINUX</title>
46180 <productname>Kernel Hackers Manual</productname>
46181 <date>July 2017</date>
46182</refentryinfo>
46183<refmeta>
46184 <refentrytitle><phrase>snd_pcm_hw_param_last</phrase></refentrytitle>
46185 <manvolnum>9</manvolnum>
46186 <refmiscinfo class="version">4.4.14</refmiscinfo>
46187</refmeta>
46188<refnamediv>
46189 <refname>snd_pcm_hw_param_last</refname>
46190 <refpurpose>
46191     refine config space and return maximum value
46192 </refpurpose>
46193</refnamediv>
46194<refsynopsisdiv>
46195 <title>Synopsis</title>
46196  <funcsynopsis><funcprototype>
46197   <funcdef>int <function>snd_pcm_hw_param_last </function></funcdef>
46198   <paramdef>struct snd_pcm_substream * <parameter>pcm</parameter></paramdef>
46199   <paramdef>struct snd_pcm_hw_params * <parameter>params</parameter></paramdef>
46200   <paramdef>snd_pcm_hw_param_t <parameter>var</parameter></paramdef>
46201   <paramdef>int * <parameter>dir</parameter></paramdef>
46202  </funcprototype></funcsynopsis>
46203</refsynopsisdiv>
46204<refsect1>
46205 <title>Arguments</title>
46206 <variablelist>
46207  <varlistentry>
46208   <term><parameter>pcm</parameter></term>
46209   <listitem>
46210    <para>
46211     PCM instance
46212    </para>
46213   </listitem>
46214  </varlistentry>
46215  <varlistentry>
46216   <term><parameter>params</parameter></term>
46217   <listitem>
46218    <para>
46219     the hw_params instance
46220    </para>
46221   </listitem>
46222  </varlistentry>
46223  <varlistentry>
46224   <term><parameter>var</parameter></term>
46225   <listitem>
46226    <para>
46227     parameter to retrieve
46228    </para>
46229   </listitem>
46230  </varlistentry>
46231  <varlistentry>
46232   <term><parameter>dir</parameter></term>
46233   <listitem>
46234    <para>
46235     pointer to the direction (-1,0,1) or <constant>NULL</constant>
46236    </para>
46237   </listitem>
46238  </varlistentry>
46239 </variablelist>
46240</refsect1>
46241<refsect1>
46242<title>Description</title>
46243<para>
46244   Inside configuration space defined by <parameter>params</parameter> remove from <parameter>var</parameter> all
46245   values &lt; maximum. Reduce configuration space accordingly.
46246</para>
46247</refsect1>
46248<refsect1>
46249<title>Return</title>
46250<para>
46251   The maximum, or a negative error code on failure.
46252</para>
46253</refsect1>
46254</refentry>
46255
46256<refentry id="API-snd-pcm-lib-ioctl">
46257<refentryinfo>
46258 <title>LINUX</title>
46259 <productname>Kernel Hackers Manual</productname>
46260 <date>July 2017</date>
46261</refentryinfo>
46262<refmeta>
46263 <refentrytitle><phrase>snd_pcm_lib_ioctl</phrase></refentrytitle>
46264 <manvolnum>9</manvolnum>
46265 <refmiscinfo class="version">4.4.14</refmiscinfo>
46266</refmeta>
46267<refnamediv>
46268 <refname>snd_pcm_lib_ioctl</refname>
46269 <refpurpose>
46270     a generic PCM ioctl callback
46271 </refpurpose>
46272</refnamediv>
46273<refsynopsisdiv>
46274 <title>Synopsis</title>
46275  <funcsynopsis><funcprototype>
46276   <funcdef>int <function>snd_pcm_lib_ioctl </function></funcdef>
46277   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46278   <paramdef>unsigned int <parameter>cmd</parameter></paramdef>
46279   <paramdef>void * <parameter>arg</parameter></paramdef>
46280  </funcprototype></funcsynopsis>
46281</refsynopsisdiv>
46282<refsect1>
46283 <title>Arguments</title>
46284 <variablelist>
46285  <varlistentry>
46286   <term><parameter>substream</parameter></term>
46287   <listitem>
46288    <para>
46289     the pcm substream instance
46290    </para>
46291   </listitem>
46292  </varlistentry>
46293  <varlistentry>
46294   <term><parameter>cmd</parameter></term>
46295   <listitem>
46296    <para>
46297     ioctl command
46298    </para>
46299   </listitem>
46300  </varlistentry>
46301  <varlistentry>
46302   <term><parameter>arg</parameter></term>
46303   <listitem>
46304    <para>
46305     ioctl argument
46306    </para>
46307   </listitem>
46308  </varlistentry>
46309 </variablelist>
46310</refsect1>
46311<refsect1>
46312<title>Description</title>
46313<para>
46314   Processes the generic ioctl commands for PCM.
46315   Can be passed as the ioctl callback for PCM ops.
46316</para>
46317</refsect1>
46318<refsect1>
46319<title>Return</title>
46320<para>
46321   Zero if successful, or a negative error code on failure.
46322</para>
46323</refsect1>
46324</refentry>
46325
46326<refentry id="API-snd-pcm-period-elapsed">
46327<refentryinfo>
46328 <title>LINUX</title>
46329 <productname>Kernel Hackers Manual</productname>
46330 <date>July 2017</date>
46331</refentryinfo>
46332<refmeta>
46333 <refentrytitle><phrase>snd_pcm_period_elapsed</phrase></refentrytitle>
46334 <manvolnum>9</manvolnum>
46335 <refmiscinfo class="version">4.4.14</refmiscinfo>
46336</refmeta>
46337<refnamediv>
46338 <refname>snd_pcm_period_elapsed</refname>
46339 <refpurpose>
46340     update the pcm status for the next period
46341 </refpurpose>
46342</refnamediv>
46343<refsynopsisdiv>
46344 <title>Synopsis</title>
46345  <funcsynopsis><funcprototype>
46346   <funcdef>void <function>snd_pcm_period_elapsed </function></funcdef>
46347   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46348  </funcprototype></funcsynopsis>
46349</refsynopsisdiv>
46350<refsect1>
46351 <title>Arguments</title>
46352 <variablelist>
46353  <varlistentry>
46354   <term><parameter>substream</parameter></term>
46355   <listitem>
46356    <para>
46357     the pcm substream instance
46358    </para>
46359   </listitem>
46360  </varlistentry>
46361 </variablelist>
46362</refsect1>
46363<refsect1>
46364<title>Description</title>
46365<para>
46366   This function is called from the interrupt handler when the
46367   PCM has processed the period size.  It will update the current
46368   pointer, wake up sleepers, etc.
46369   </para><para>
46370
46371   Even if more than one periods have elapsed since the last call, you
46372   have to call this only once.
46373</para>
46374</refsect1>
46375</refentry>
46376
46377<refentry id="API-snd-pcm-add-chmap-ctls">
46378<refentryinfo>
46379 <title>LINUX</title>
46380 <productname>Kernel Hackers Manual</productname>
46381 <date>July 2017</date>
46382</refentryinfo>
46383<refmeta>
46384 <refentrytitle><phrase>snd_pcm_add_chmap_ctls</phrase></refentrytitle>
46385 <manvolnum>9</manvolnum>
46386 <refmiscinfo class="version">4.4.14</refmiscinfo>
46387</refmeta>
46388<refnamediv>
46389 <refname>snd_pcm_add_chmap_ctls</refname>
46390 <refpurpose>
46391     create channel-mapping control elements
46392 </refpurpose>
46393</refnamediv>
46394<refsynopsisdiv>
46395 <title>Synopsis</title>
46396  <funcsynopsis><funcprototype>
46397   <funcdef>int <function>snd_pcm_add_chmap_ctls </function></funcdef>
46398   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
46399   <paramdef>int <parameter>stream</parameter></paramdef>
46400   <paramdef>const struct snd_pcm_chmap_elem * <parameter>chmap</parameter></paramdef>
46401   <paramdef>int <parameter>max_channels</parameter></paramdef>
46402   <paramdef>unsigned long <parameter>private_value</parameter></paramdef>
46403   <paramdef>struct snd_pcm_chmap ** <parameter>info_ret</parameter></paramdef>
46404  </funcprototype></funcsynopsis>
46405</refsynopsisdiv>
46406<refsect1>
46407 <title>Arguments</title>
46408 <variablelist>
46409  <varlistentry>
46410   <term><parameter>pcm</parameter></term>
46411   <listitem>
46412    <para>
46413     the assigned PCM instance
46414    </para>
46415   </listitem>
46416  </varlistentry>
46417  <varlistentry>
46418   <term><parameter>stream</parameter></term>
46419   <listitem>
46420    <para>
46421     stream direction
46422    </para>
46423   </listitem>
46424  </varlistentry>
46425  <varlistentry>
46426   <term><parameter>chmap</parameter></term>
46427   <listitem>
46428    <para>
46429     channel map elements (for query)
46430    </para>
46431   </listitem>
46432  </varlistentry>
46433  <varlistentry>
46434   <term><parameter>max_channels</parameter></term>
46435   <listitem>
46436    <para>
46437     the max number of channels for the stream
46438    </para>
46439   </listitem>
46440  </varlistentry>
46441  <varlistentry>
46442   <term><parameter>private_value</parameter></term>
46443   <listitem>
46444    <para>
46445     the value passed to each kcontrol's private_value field
46446    </para>
46447   </listitem>
46448  </varlistentry>
46449  <varlistentry>
46450   <term><parameter>info_ret</parameter></term>
46451   <listitem>
46452    <para>
46453     store struct snd_pcm_chmap instance if non-NULL
46454    </para>
46455   </listitem>
46456  </varlistentry>
46457 </variablelist>
46458</refsect1>
46459<refsect1>
46460<title>Description</title>
46461<para>
46462   Create channel-mapping control elements assigned to the given PCM stream(s).
46463</para>
46464</refsect1>
46465<refsect1>
46466<title>Return</title>
46467<para>
46468   Zero if successful, or a negative error value.
46469</para>
46470</refsect1>
46471</refentry>
46472
46473<!-- sound/core/hwdep.c -->
46474<refentry id="API-snd-hwdep-new">
46475<refentryinfo>
46476 <title>LINUX</title>
46477 <productname>Kernel Hackers Manual</productname>
46478 <date>July 2017</date>
46479</refentryinfo>
46480<refmeta>
46481 <refentrytitle><phrase>snd_hwdep_new</phrase></refentrytitle>
46482 <manvolnum>9</manvolnum>
46483 <refmiscinfo class="version">4.4.14</refmiscinfo>
46484</refmeta>
46485<refnamediv>
46486 <refname>snd_hwdep_new</refname>
46487 <refpurpose>
46488  create a new hwdep instance
46489 </refpurpose>
46490</refnamediv>
46491<refsynopsisdiv>
46492 <title>Synopsis</title>
46493  <funcsynopsis><funcprototype>
46494   <funcdef>int <function>snd_hwdep_new </function></funcdef>
46495   <paramdef>struct snd_card * <parameter>card</parameter></paramdef>
46496   <paramdef>char * <parameter>id</parameter></paramdef>
46497   <paramdef>int <parameter>device</parameter></paramdef>
46498   <paramdef>struct snd_hwdep ** <parameter>rhwdep</parameter></paramdef>
46499  </funcprototype></funcsynopsis>
46500</refsynopsisdiv>
46501<refsect1>
46502 <title>Arguments</title>
46503 <variablelist>
46504  <varlistentry>
46505   <term><parameter>card</parameter></term>
46506   <listitem>
46507    <para>
46508     the card instance
46509    </para>
46510   </listitem>
46511  </varlistentry>
46512  <varlistentry>
46513   <term><parameter>id</parameter></term>
46514   <listitem>
46515    <para>
46516     the id string
46517    </para>
46518   </listitem>
46519  </varlistentry>
46520  <varlistentry>
46521   <term><parameter>device</parameter></term>
46522   <listitem>
46523    <para>
46524     the device index (zero-based)
46525    </para>
46526   </listitem>
46527  </varlistentry>
46528  <varlistentry>
46529   <term><parameter>rhwdep</parameter></term>
46530   <listitem>
46531    <para>
46532     the pointer to store the new hwdep instance
46533    </para>
46534   </listitem>
46535  </varlistentry>
46536 </variablelist>
46537</refsect1>
46538<refsect1>
46539<title>Description</title>
46540<para>
46541   Creates a new hwdep instance with the given index on the card.
46542   The callbacks (hwdep-&gt;ops) must be set on the returned instance
46543   after this call manually by the caller.
46544</para>
46545</refsect1>
46546<refsect1>
46547<title>Return</title>
46548<para>
46549   Zero if successful, or a negative error code on failure.
46550</para>
46551</refsect1>
46552</refentry>
46553
46554<!-- sound/core/pcm_native.c -->
46555<refentry id="API-snd-pcm-stream-lock">
46556<refentryinfo>
46557 <title>LINUX</title>
46558 <productname>Kernel Hackers Manual</productname>
46559 <date>July 2017</date>
46560</refentryinfo>
46561<refmeta>
46562 <refentrytitle><phrase>snd_pcm_stream_lock</phrase></refentrytitle>
46563 <manvolnum>9</manvolnum>
46564 <refmiscinfo class="version">4.4.14</refmiscinfo>
46565</refmeta>
46566<refnamediv>
46567 <refname>snd_pcm_stream_lock</refname>
46568 <refpurpose>
46569  Lock the PCM stream
46570 </refpurpose>
46571</refnamediv>
46572<refsynopsisdiv>
46573 <title>Synopsis</title>
46574  <funcsynopsis><funcprototype>
46575   <funcdef>void <function>snd_pcm_stream_lock </function></funcdef>
46576   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46577  </funcprototype></funcsynopsis>
46578</refsynopsisdiv>
46579<refsect1>
46580 <title>Arguments</title>
46581 <variablelist>
46582  <varlistentry>
46583   <term><parameter>substream</parameter></term>
46584   <listitem>
46585    <para>
46586     PCM substream
46587    </para>
46588   </listitem>
46589  </varlistentry>
46590 </variablelist>
46591</refsect1>
46592<refsect1>
46593<title>Description</title>
46594<para>
46595   This locks the PCM stream's spinlock or mutex depending on the nonatomic
46596   flag of the given substream.  This also takes the global link rw lock
46597   (or rw sem), too, for avoiding the race with linked streams.
46598</para>
46599</refsect1>
46600</refentry>
46601
46602<refentry id="API-snd-pcm-stream-unlock">
46603<refentryinfo>
46604 <title>LINUX</title>
46605 <productname>Kernel Hackers Manual</productname>
46606 <date>July 2017</date>
46607</refentryinfo>
46608<refmeta>
46609 <refentrytitle><phrase>snd_pcm_stream_unlock</phrase></refentrytitle>
46610 <manvolnum>9</manvolnum>
46611 <refmiscinfo class="version">4.4.14</refmiscinfo>
46612</refmeta>
46613<refnamediv>
46614 <refname>snd_pcm_stream_unlock</refname>
46615 <refpurpose>
46616     Unlock the PCM stream
46617 </refpurpose>
46618</refnamediv>
46619<refsynopsisdiv>
46620 <title>Synopsis</title>
46621  <funcsynopsis><funcprototype>
46622   <funcdef>void <function>snd_pcm_stream_unlock </function></funcdef>
46623   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46624  </funcprototype></funcsynopsis>
46625</refsynopsisdiv>
46626<refsect1>
46627 <title>Arguments</title>
46628 <variablelist>
46629  <varlistentry>
46630   <term><parameter>substream</parameter></term>
46631   <listitem>
46632    <para>
46633     PCM substream
46634    </para>
46635   </listitem>
46636  </varlistentry>
46637 </variablelist>
46638</refsect1>
46639<refsect1>
46640<title>Description</title>
46641<para>
46642   This unlocks the PCM stream that has been locked via <function><link linkend="API-snd-pcm-stream-lock">snd_pcm_stream_lock</link></function>.
46643</para>
46644</refsect1>
46645</refentry>
46646
46647<refentry id="API-snd-pcm-stream-lock-irq">
46648<refentryinfo>
46649 <title>LINUX</title>
46650 <productname>Kernel Hackers Manual</productname>
46651 <date>July 2017</date>
46652</refentryinfo>
46653<refmeta>
46654 <refentrytitle><phrase>snd_pcm_stream_lock_irq</phrase></refentrytitle>
46655 <manvolnum>9</manvolnum>
46656 <refmiscinfo class="version">4.4.14</refmiscinfo>
46657</refmeta>
46658<refnamediv>
46659 <refname>snd_pcm_stream_lock_irq</refname>
46660 <refpurpose>
46661     Lock the PCM stream
46662 </refpurpose>
46663</refnamediv>
46664<refsynopsisdiv>
46665 <title>Synopsis</title>
46666  <funcsynopsis><funcprototype>
46667   <funcdef>void <function>snd_pcm_stream_lock_irq </function></funcdef>
46668   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46669  </funcprototype></funcsynopsis>
46670</refsynopsisdiv>
46671<refsect1>
46672 <title>Arguments</title>
46673 <variablelist>
46674  <varlistentry>
46675   <term><parameter>substream</parameter></term>
46676   <listitem>
46677    <para>
46678     PCM substream
46679    </para>
46680   </listitem>
46681  </varlistentry>
46682 </variablelist>
46683</refsect1>
46684<refsect1>
46685<title>Description</title>
46686<para>
46687   This locks the PCM stream like <function><link linkend="API-snd-pcm-stream-lock">snd_pcm_stream_lock</link></function> and disables the local
46688   IRQ (only when nonatomic is false).  In nonatomic case, this is identical
46689   as <function><link linkend="API-snd-pcm-stream-lock">snd_pcm_stream_lock</link></function>.
46690</para>
46691</refsect1>
46692</refentry>
46693
46694<refentry id="API-snd-pcm-stream-unlock-irq">
46695<refentryinfo>
46696 <title>LINUX</title>
46697 <productname>Kernel Hackers Manual</productname>
46698 <date>July 2017</date>
46699</refentryinfo>
46700<refmeta>
46701 <refentrytitle><phrase>snd_pcm_stream_unlock_irq</phrase></refentrytitle>
46702 <manvolnum>9</manvolnum>
46703 <refmiscinfo class="version">4.4.14</refmiscinfo>
46704</refmeta>
46705<refnamediv>
46706 <refname>snd_pcm_stream_unlock_irq</refname>
46707 <refpurpose>
46708     Unlock the PCM stream
46709 </refpurpose>
46710</refnamediv>
46711<refsynopsisdiv>
46712 <title>Synopsis</title>
46713  <funcsynopsis><funcprototype>
46714   <funcdef>void <function>snd_pcm_stream_unlock_irq </function></funcdef>
46715   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46716  </funcprototype></funcsynopsis>
46717</refsynopsisdiv>
46718<refsect1>
46719 <title>Arguments</title>
46720 <variablelist>
46721  <varlistentry>
46722   <term><parameter>substream</parameter></term>
46723   <listitem>
46724    <para>
46725     PCM substream
46726    </para>
46727   </listitem>
46728  </varlistentry>
46729 </variablelist>
46730</refsect1>
46731<refsect1>
46732<title>Description</title>
46733<para>
46734   This is a counter-part of <function><link linkend="API-snd-pcm-stream-lock-irq">snd_pcm_stream_lock_irq</link></function>.
46735</para>
46736</refsect1>
46737</refentry>
46738
46739<refentry id="API-snd-pcm-stream-unlock-irqrestore">
46740<refentryinfo>
46741 <title>LINUX</title>
46742 <productname>Kernel Hackers Manual</productname>
46743 <date>July 2017</date>
46744</refentryinfo>
46745<refmeta>
46746 <refentrytitle><phrase>snd_pcm_stream_unlock_irqrestore</phrase></refentrytitle>
46747 <manvolnum>9</manvolnum>
46748 <refmiscinfo class="version">4.4.14</refmiscinfo>
46749</refmeta>
46750<refnamediv>
46751 <refname>snd_pcm_stream_unlock_irqrestore</refname>
46752 <refpurpose>
46753     Unlock the PCM stream
46754 </refpurpose>
46755</refnamediv>
46756<refsynopsisdiv>
46757 <title>Synopsis</title>
46758  <funcsynopsis><funcprototype>
46759   <funcdef>void <function>snd_pcm_stream_unlock_irqrestore </function></funcdef>
46760   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46761   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
46762  </funcprototype></funcsynopsis>
46763</refsynopsisdiv>
46764<refsect1>
46765 <title>Arguments</title>
46766 <variablelist>
46767  <varlistentry>
46768   <term><parameter>substream</parameter></term>
46769   <listitem>
46770    <para>
46771     PCM substream
46772    </para>
46773   </listitem>
46774  </varlistentry>
46775  <varlistentry>
46776   <term><parameter>flags</parameter></term>
46777   <listitem>
46778    <para>
46779     irq flags
46780    </para>
46781   </listitem>
46782  </varlistentry>
46783 </variablelist>
46784</refsect1>
46785<refsect1>
46786<title>Description</title>
46787<para>
46788   This is a counter-part of <function><link linkend="API-snd-pcm-stream-lock-irqsave">snd_pcm_stream_lock_irqsave</link></function>.
46789</para>
46790</refsect1>
46791</refentry>
46792
46793<refentry id="API-snd-pcm-stop">
46794<refentryinfo>
46795 <title>LINUX</title>
46796 <productname>Kernel Hackers Manual</productname>
46797 <date>July 2017</date>
46798</refentryinfo>
46799<refmeta>
46800 <refentrytitle><phrase>snd_pcm_stop</phrase></refentrytitle>
46801 <manvolnum>9</manvolnum>
46802 <refmiscinfo class="version">4.4.14</refmiscinfo>
46803</refmeta>
46804<refnamediv>
46805 <refname>snd_pcm_stop</refname>
46806 <refpurpose>
46807     try to stop all running streams in the substream group
46808 </refpurpose>
46809</refnamediv>
46810<refsynopsisdiv>
46811 <title>Synopsis</title>
46812  <funcsynopsis><funcprototype>
46813   <funcdef>int <function>snd_pcm_stop </function></funcdef>
46814   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46815   <paramdef>snd_pcm_state_t <parameter>state</parameter></paramdef>
46816  </funcprototype></funcsynopsis>
46817</refsynopsisdiv>
46818<refsect1>
46819 <title>Arguments</title>
46820 <variablelist>
46821  <varlistentry>
46822   <term><parameter>substream</parameter></term>
46823   <listitem>
46824    <para>
46825     the PCM substream instance
46826    </para>
46827   </listitem>
46828  </varlistentry>
46829  <varlistentry>
46830   <term><parameter>state</parameter></term>
46831   <listitem>
46832    <para>
46833     PCM state after stopping the stream
46834    </para>
46835   </listitem>
46836  </varlistentry>
46837 </variablelist>
46838</refsect1>
46839<refsect1>
46840<title>Description</title>
46841<para>
46842   The state of each stream is then changed to the given state unconditionally.
46843</para>
46844</refsect1>
46845<refsect1>
46846<title>Return</title>
46847<para>
46848   Zero if successful, or a negative error code.
46849</para>
46850</refsect1>
46851</refentry>
46852
46853<refentry id="API-snd-pcm-stop-xrun">
46854<refentryinfo>
46855 <title>LINUX</title>
46856 <productname>Kernel Hackers Manual</productname>
46857 <date>July 2017</date>
46858</refentryinfo>
46859<refmeta>
46860 <refentrytitle><phrase>snd_pcm_stop_xrun</phrase></refentrytitle>
46861 <manvolnum>9</manvolnum>
46862 <refmiscinfo class="version">4.4.14</refmiscinfo>
46863</refmeta>
46864<refnamediv>
46865 <refname>snd_pcm_stop_xrun</refname>
46866 <refpurpose>
46867     stop the running streams as XRUN
46868 </refpurpose>
46869</refnamediv>
46870<refsynopsisdiv>
46871 <title>Synopsis</title>
46872  <funcsynopsis><funcprototype>
46873   <funcdef>int <function>snd_pcm_stop_xrun </function></funcdef>
46874   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46875  </funcprototype></funcsynopsis>
46876</refsynopsisdiv>
46877<refsect1>
46878 <title>Arguments</title>
46879 <variablelist>
46880  <varlistentry>
46881   <term><parameter>substream</parameter></term>
46882   <listitem>
46883    <para>
46884     the PCM substream instance
46885    </para>
46886   </listitem>
46887  </varlistentry>
46888 </variablelist>
46889</refsect1>
46890<refsect1>
46891<title>Description</title>
46892<para>
46893   This stops the given running substream (and all linked substreams) as XRUN.
46894   Unlike <function><link linkend="API-snd-pcm-stop">snd_pcm_stop</link></function>, this function takes the substream lock by itself.
46895</para>
46896</refsect1>
46897<refsect1>
46898<title>Return</title>
46899<para>
46900   Zero if successful, or a negative error code.
46901</para>
46902</refsect1>
46903</refentry>
46904
46905<refentry id="API-snd-pcm-suspend">
46906<refentryinfo>
46907 <title>LINUX</title>
46908 <productname>Kernel Hackers Manual</productname>
46909 <date>July 2017</date>
46910</refentryinfo>
46911<refmeta>
46912 <refentrytitle><phrase>snd_pcm_suspend</phrase></refentrytitle>
46913 <manvolnum>9</manvolnum>
46914 <refmiscinfo class="version">4.4.14</refmiscinfo>
46915</refmeta>
46916<refnamediv>
46917 <refname>snd_pcm_suspend</refname>
46918 <refpurpose>
46919     trigger SUSPEND to all linked streams
46920 </refpurpose>
46921</refnamediv>
46922<refsynopsisdiv>
46923 <title>Synopsis</title>
46924  <funcsynopsis><funcprototype>
46925   <funcdef>int <function>snd_pcm_suspend </function></funcdef>
46926   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
46927  </funcprototype></funcsynopsis>
46928</refsynopsisdiv>
46929<refsect1>
46930 <title>Arguments</title>
46931 <variablelist>
46932  <varlistentry>
46933   <term><parameter>substream</parameter></term>
46934   <listitem>
46935    <para>
46936     the PCM substream
46937    </para>
46938   </listitem>
46939  </varlistentry>
46940 </variablelist>
46941</refsect1>
46942<refsect1>
46943<title>Description</title>
46944<para>
46945   After this call, all streams are changed to SUSPENDED state.
46946</para>
46947</refsect1>
46948<refsect1>
46949<title>Return</title>
46950<para>
46951   Zero if successful (or <parameter>substream</parameter> is <constant>NULL</constant>), or a negative error
46952   code.
46953</para>
46954</refsect1>
46955</refentry>
46956
46957<refentry id="API-snd-pcm-suspend-all">
46958<refentryinfo>
46959 <title>LINUX</title>
46960 <productname>Kernel Hackers Manual</productname>
46961 <date>July 2017</date>
46962</refentryinfo>
46963<refmeta>
46964 <refentrytitle><phrase>snd_pcm_suspend_all</phrase></refentrytitle>
46965 <manvolnum>9</manvolnum>
46966 <refmiscinfo class="version">4.4.14</refmiscinfo>
46967</refmeta>
46968<refnamediv>
46969 <refname>snd_pcm_suspend_all</refname>
46970 <refpurpose>
46971     trigger SUSPEND to all substreams in the given pcm
46972 </refpurpose>
46973</refnamediv>
46974<refsynopsisdiv>
46975 <title>Synopsis</title>
46976  <funcsynopsis><funcprototype>
46977   <funcdef>int <function>snd_pcm_suspend_all </function></funcdef>
46978   <paramdef>struct snd_pcm * <parameter>pcm</parameter></paramdef>
46979  </funcprototype></funcsynopsis>
46980</refsynopsisdiv>
46981<refsect1>
46982 <title>Arguments</title>
46983 <variablelist>
46984  <varlistentry>
46985   <term><parameter>pcm</parameter></term>
46986   <listitem>
46987    <para>
46988     the PCM instance
46989    </para>
46990   </listitem>
46991  </varlistentry>
46992 </variablelist>
46993</refsect1>
46994<refsect1>
46995<title>Description</title>
46996<para>
46997   After this call, all streams are changed to SUSPENDED state.
46998</para>
46999</refsect1>
47000<refsect1>
47001<title>Return</title>
47002<para>
47003   Zero if successful (or <parameter>pcm</parameter> is <constant>NULL</constant>), or a negative error code.
47004</para>
47005</refsect1>
47006</refentry>
47007
47008<refentry id="API-snd-pcm-lib-default-mmap">
47009<refentryinfo>
47010 <title>LINUX</title>
47011 <productname>Kernel Hackers Manual</productname>
47012 <date>July 2017</date>
47013</refentryinfo>
47014<refmeta>
47015 <refentrytitle><phrase>snd_pcm_lib_default_mmap</phrase></refentrytitle>
47016 <manvolnum>9</manvolnum>
47017 <refmiscinfo class="version">4.4.14</refmiscinfo>
47018</refmeta>
47019<refnamediv>
47020 <refname>snd_pcm_lib_default_mmap</refname>
47021 <refpurpose>
47022     Default PCM data mmap function
47023 </refpurpose>
47024</refnamediv>
47025<refsynopsisdiv>
47026 <title>Synopsis</title>
47027  <funcsynopsis><funcprototype>
47028   <funcdef>int <function>snd_pcm_lib_default_mmap </function></funcdef>
47029   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
47030   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
47031  </funcprototype></funcsynopsis>
47032</refsynopsisdiv>
47033<refsect1>
47034 <title>Arguments</title>
47035 <variablelist>
47036  <varlistentry>
47037   <term><parameter>substream</parameter></term>
47038   <listitem>
47039    <para>
47040     PCM substream
47041    </para>
47042   </listitem>
47043  </varlistentry>
47044  <varlistentry>
47045   <term><parameter>area</parameter></term>
47046   <listitem>
47047    <para>
47048     VMA
47049    </para>
47050   </listitem>
47051  </varlistentry>
47052 </variablelist>
47053</refsect1>
47054<refsect1>
47055<title>Description</title>
47056<para>
47057   This is the default mmap handler for PCM data.  When mmap pcm_ops is NULL,
47058   this function is invoked implicitly.
47059</para>
47060</refsect1>
47061</refentry>
47062
47063<refentry id="API-snd-pcm-lib-mmap-iomem">
47064<refentryinfo>
47065 <title>LINUX</title>
47066 <productname>Kernel Hackers Manual</productname>
47067 <date>July 2017</date>
47068</refentryinfo>
47069<refmeta>
47070 <refentrytitle><phrase>snd_pcm_lib_mmap_iomem</phrase></refentrytitle>
47071 <manvolnum>9</manvolnum>
47072 <refmiscinfo class="version">4.4.14</refmiscinfo>
47073</refmeta>
47074<refnamediv>
47075 <refname>snd_pcm_lib_mmap_iomem</refname>
47076 <refpurpose>
47077     Default PCM data mmap function for I/O mem
47078 </refpurpose>
47079</refnamediv>
47080<refsynopsisdiv>
47081 <title>Synopsis</title>
47082  <funcsynopsis><funcprototype>
47083   <funcdef>int <function>snd_pcm_lib_mmap_iomem </function></funcdef>
47084   <paramdef>struct snd_pcm_substream * <parameter>substream</parameter></paramdef>
47085   <paramdef>struct vm_area_struct * <parameter>area</parameter></paramdef>
47086  </funcprototype></funcsynopsis>
47087</refsynopsisdiv>
47088<refsect1>
47089 <title>Arguments</title>
47090 <variablelist>
47091  <varlistentry>
47092   <term><parameter>substream</parameter></term>
47093   <listitem>
47094    <para>
47095     PCM substream
47096    </para>
47097   </listitem>
47098  </varlistentry>
47099  <varlistentry>
47100   <term><parameter>area</parameter></term>
47101   <listitem>
47102    <para>
47103     VMA
47104    </para>
47105   </listitem>
47106  </varlistentry>
47107 </variablelist>
47108</refsect1>
47109<refsect1>
47110<title>Description</title>
47111<para>
47112   When your hardware uses the iomapped pages as the hardware buffer and
47113   wants to mmap it, pass this function as mmap pcm_ops.  Note that this
47114   is supposed to work only on limited architectures.
47115</para>
47116</refsect1>
47117</refentry>
47118
47119<!-- sound/core/memalloc.c -->
47120<refentry id="API-snd-malloc-pages">
47121<refentryinfo>
47122 <title>LINUX</title>
47123 <productname>Kernel Hackers Manual</productname>
47124 <date>July 2017</date>
47125</refentryinfo>
47126<refmeta>
47127 <refentrytitle><phrase>snd_malloc_pages</phrase></refentrytitle>
47128 <manvolnum>9</manvolnum>
47129 <refmiscinfo class="version">4.4.14</refmiscinfo>
47130</refmeta>
47131<refnamediv>
47132 <refname>snd_malloc_pages</refname>
47133 <refpurpose>
47134  allocate pages with the given size
47135 </refpurpose>
47136</refnamediv>
47137<refsynopsisdiv>
47138 <title>Synopsis</title>
47139  <funcsynopsis><funcprototype>
47140   <funcdef>void * <function>snd_malloc_pages </function></funcdef>
47141   <paramdef>size_t <parameter>size</parameter></paramdef>
47142   <paramdef>gfp_t <parameter>gfp_flags</parameter></paramdef>
47143  </funcprototype></funcsynopsis>
47144</refsynopsisdiv>
47145<refsect1>
47146 <title>Arguments</title>
47147 <variablelist>
47148  <varlistentry>
47149   <term><parameter>size</parameter></term>
47150   <listitem>
47151    <para>
47152     the size to allocate in bytes
47153    </para>
47154   </listitem>
47155  </varlistentry>
47156  <varlistentry>
47157   <term><parameter>gfp_flags</parameter></term>
47158   <listitem>
47159    <para>
47160     the allocation conditions, GFP_XXX
47161    </para>
47162   </listitem>
47163  </varlistentry>
47164 </variablelist>
47165</refsect1>
47166<refsect1>
47167<title>Description</title>
47168<para>
47169   Allocates the physically contiguous pages with the given size.
47170</para>
47171</refsect1>
47172<refsect1>
47173<title>Return</title>
47174<para>
47175   The pointer of the buffer, or <constant>NULL</constant> if no enough memory.
47176</para>
47177</refsect1>
47178</refentry>
47179
47180<refentry id="API-snd-free-pages">
47181<refentryinfo>
47182 <title>LINUX</title>
47183 <productname>Kernel Hackers Manual</productname>
47184 <date>July 2017</date>
47185</refentryinfo>
47186<refmeta>
47187 <refentrytitle><phrase>snd_free_pages</phrase></refentrytitle>
47188 <manvolnum>9</manvolnum>
47189 <refmiscinfo class="version">4.4.14</refmiscinfo>
47190</refmeta>
47191<refnamediv>
47192 <refname>snd_free_pages</refname>
47193 <refpurpose>
47194     release the pages
47195 </refpurpose>
47196</refnamediv>
47197<refsynopsisdiv>
47198 <title>Synopsis</title>
47199  <funcsynopsis><funcprototype>
47200   <funcdef>void <function>snd_free_pages </function></funcdef>
47201   <paramdef>void * <parameter>ptr</parameter></paramdef>
47202   <paramdef>size_t <parameter>size</parameter></paramdef>
47203  </funcprototype></funcsynopsis>
47204</refsynopsisdiv>
47205<refsect1>
47206 <title>Arguments</title>
47207 <variablelist>
47208  <varlistentry>
47209   <term><parameter>ptr</parameter></term>
47210   <listitem>
47211    <para>
47212     the buffer pointer to release
47213    </para>
47214   </listitem>
47215  </varlistentry>
47216  <varlistentry>
47217   <term><parameter>size</parameter></term>
47218   <listitem>
47219    <para>
47220     the allocated buffer size
47221    </para>
47222   </listitem>
47223  </varlistentry>
47224 </variablelist>
47225</refsect1>
47226<refsect1>
47227<title>Description</title>
47228<para>
47229   Releases the buffer allocated via <function><link linkend="API-snd-malloc-pages">snd_malloc_pages</link></function>.
47230</para>
47231</refsect1>
47232</refentry>
47233
47234<refentry id="API-snd-dma-alloc-pages">
47235<refentryinfo>
47236 <title>LINUX</title>
47237 <productname>Kernel Hackers Manual</productname>
47238 <date>July 2017</date>
47239</refentryinfo>
47240<refmeta>
47241 <refentrytitle><phrase>snd_dma_alloc_pages</phrase></refentrytitle>
47242 <manvolnum>9</manvolnum>
47243 <refmiscinfo class="version">4.4.14</refmiscinfo>
47244</refmeta>
47245<refnamediv>
47246 <refname>snd_dma_alloc_pages</refname>
47247 <refpurpose>
47248     allocate the buffer area according to the given type
47249 </refpurpose>
47250</refnamediv>
47251<refsynopsisdiv>
47252 <title>Synopsis</title>
47253  <funcsynopsis><funcprototype>
47254   <funcdef>int <function>snd_dma_alloc_pages </function></funcdef>
47255   <paramdef>int <parameter>type</parameter></paramdef>
47256   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device</parameter></paramdef>
47257   <paramdef>size_t <parameter>size</parameter></paramdef>
47258   <paramdef>struct snd_dma_buffer * <parameter>dmab</parameter></paramdef>
47259  </funcprototype></funcsynopsis>
47260</refsynopsisdiv>
47261<refsect1>
47262 <title>Arguments</title>
47263 <variablelist>
47264  <varlistentry>
47265   <term><parameter>type</parameter></term>
47266   <listitem>
47267    <para>
47268     the DMA buffer type
47269    </para>
47270   </listitem>
47271  </varlistentry>
47272  <varlistentry>
47273   <term><parameter>device</parameter></term>
47274   <listitem>
47275    <para>
47276     the device pointer
47277    </para>
47278   </listitem>
47279  </varlistentry>
47280  <varlistentry>
47281   <term><parameter>size</parameter></term>
47282   <listitem>
47283    <para>
47284     the buffer size to allocate
47285    </para>
47286   </listitem>
47287  </varlistentry>
47288  <varlistentry>
47289   <term><parameter>dmab</parameter></term>
47290   <listitem>
47291    <para>
47292     buffer allocation record to store the allocated data
47293    </para>
47294   </listitem>
47295  </varlistentry>
47296 </variablelist>
47297</refsect1>
47298<refsect1>
47299<title>Description</title>
47300<para>
47301   Calls the memory-allocator function for the corresponding
47302   buffer type.
47303</para>
47304</refsect1>
47305<refsect1>
47306<title>Return</title>
47307<para>
47308   Zero if the buffer with the given size is allocated successfully,
47309   otherwise a negative value on error.
47310</para>
47311</refsect1>
47312</refentry>
47313
47314<refentry id="API-snd-dma-alloc-pages-fallback">
47315<refentryinfo>
47316 <title>LINUX</title>
47317 <productname>Kernel Hackers Manual</productname>
47318 <date>July 2017</date>
47319</refentryinfo>
47320<refmeta>
47321 <refentrytitle><phrase>snd_dma_alloc_pages_fallback</phrase></refentrytitle>
47322 <manvolnum>9</manvolnum>
47323 <refmiscinfo class="version">4.4.14</refmiscinfo>
47324</refmeta>
47325<refnamediv>
47326 <refname>snd_dma_alloc_pages_fallback</refname>
47327 <refpurpose>
47328     allocate the buffer area according to the given type with fallback
47329 </refpurpose>
47330</refnamediv>
47331<refsynopsisdiv>
47332 <title>Synopsis</title>
47333  <funcsynopsis><funcprototype>
47334   <funcdef>int <function>snd_dma_alloc_pages_fallback </function></funcdef>
47335   <paramdef>int <parameter>type</parameter></paramdef>
47336   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device</parameter></paramdef>
47337   <paramdef>size_t <parameter>size</parameter></paramdef>
47338   <paramdef>struct snd_dma_buffer * <parameter>dmab</parameter></paramdef>
47339  </funcprototype></funcsynopsis>
47340</refsynopsisdiv>
47341<refsect1>
47342 <title>Arguments</title>
47343 <variablelist>
47344  <varlistentry>
47345   <term><parameter>type</parameter></term>
47346   <listitem>
47347    <para>
47348     the DMA buffer type
47349    </para>
47350   </listitem>
47351  </varlistentry>
47352  <varlistentry>
47353   <term><parameter>device</parameter></term>
47354   <listitem>
47355    <para>
47356     the device pointer
47357    </para>
47358   </listitem>
47359  </varlistentry>
47360  <varlistentry>
47361   <term><parameter>size</parameter></term>
47362   <listitem>
47363    <para>
47364     the buffer size to allocate
47365    </para>
47366   </listitem>
47367  </varlistentry>
47368  <varlistentry>
47369   <term><parameter>dmab</parameter></term>
47370   <listitem>
47371    <para>
47372     buffer allocation record to store the allocated data
47373    </para>
47374   </listitem>
47375  </varlistentry>
47376 </variablelist>
47377</refsect1>
47378<refsect1>
47379<title>Description</title>
47380<para>
47381   Calls the memory-allocator function for the corresponding
47382   buffer type.  When no space is left, this function reduces the size and
47383   tries to allocate again.  The size actually allocated is stored in
47384   res_size argument.
47385</para>
47386</refsect1>
47387<refsect1>
47388<title>Return</title>
47389<para>
47390   Zero if the buffer with the given size is allocated successfully,
47391   otherwise a negative value on error.
47392</para>
47393</refsect1>
47394</refentry>
47395
47396<refentry id="API-snd-dma-free-pages">
47397<refentryinfo>
47398 <title>LINUX</title>
47399 <productname>Kernel Hackers Manual</productname>
47400 <date>July 2017</date>
47401</refentryinfo>
47402<refmeta>
47403 <refentrytitle><phrase>snd_dma_free_pages</phrase></refentrytitle>
47404 <manvolnum>9</manvolnum>
47405 <refmiscinfo class="version">4.4.14</refmiscinfo>
47406</refmeta>
47407<refnamediv>
47408 <refname>snd_dma_free_pages</refname>
47409 <refpurpose>
47410     release the allocated buffer
47411 </refpurpose>
47412</refnamediv>
47413<refsynopsisdiv>
47414 <title>Synopsis</title>
47415  <funcsynopsis><funcprototype>
47416   <funcdef>void <function>snd_dma_free_pages </function></funcdef>
47417   <paramdef>struct snd_dma_buffer * <parameter>dmab</parameter></paramdef>
47418  </funcprototype></funcsynopsis>
47419</refsynopsisdiv>
47420<refsect1>
47421 <title>Arguments</title>
47422 <variablelist>
47423  <varlistentry>
47424   <term><parameter>dmab</parameter></term>
47425   <listitem>
47426    <para>
47427     the buffer allocation record to release
47428    </para>
47429   </listitem>
47430  </varlistentry>
47431 </variablelist>
47432</refsect1>
47433<refsect1>
47434<title>Description</title>
47435<para>
47436   Releases the allocated buffer via <function><link linkend="API-snd-dma-alloc-pages">snd_dma_alloc_pages</link></function>.
47437</para>
47438</refsect1>
47439</refentry>
47440
47441<!-- FIXME: Removed for now since no structured comments in source
47442X!Isound/sound_firmware.c
47443-->
47444  </chapter>
47445
47446  <chapter id="mediadev">
47447     <title>Media Devices</title>
47448
47449     <sect1><title>Video2Linux devices</title>
47450<!-- include/media/tuner.h -->
47451<refentry id="API-enum-tuner-mode">
47452<refentryinfo>
47453 <title>LINUX</title>
47454 <productname>Kernel Hackers Manual</productname>
47455 <date>July 2017</date>
47456</refentryinfo>
47457<refmeta>
47458 <refentrytitle><phrase>enum tuner_mode</phrase></refentrytitle>
47459 <manvolnum>9</manvolnum>
47460 <refmiscinfo class="version">4.4.14</refmiscinfo>
47461</refmeta>
47462<refnamediv>
47463 <refname>enum tuner_mode</refname>
47464 <refpurpose>
47465  Mode of the tuner
47466 </refpurpose>
47467</refnamediv>
47468<refsynopsisdiv>
47469 <title>Synopsis</title>
47470  <programlisting>
47471enum tuner_mode {
47472  T_RADIO,
47473  T_ANALOG_TV
47474};  </programlisting>
47475</refsynopsisdiv>
47476<refsect1>
47477 <title>Constants</title>
47478  <variablelist>
47479    <varlistentry>      <term>T_RADIO</term>
47480      <listitem><para>
47481Tuner core will work in radio mode
47482      </para></listitem>
47483    </varlistentry>
47484    <varlistentry>      <term>T_ANALOG_TV</term>
47485      <listitem><para>
47486Tuner core will work in analog TV mode
47487      </para></listitem>
47488    </varlistentry>
47489  </variablelist>
47490</refsect1>
47491<refsect1>
47492<title>Description</title>
47493<para>
47494   Older boards only had a single tuner device, but some devices have a
47495   separate tuner for radio. In any case, the tuner-core needs to know if
47496   the tuner chip(s) will be used in radio mode or analog TV mode, as, on
47497   radio mode, frequencies are specified on a different range than on TV
47498   mode. This enum is used by the tuner core in order to work with the
47499   proper tuner range and eventually use a different tuner chip while in
47500   radio mode.
47501</para>
47502</refsect1>
47503</refentry>
47504
47505<refentry id="API-struct-tuner-setup">
47506<refentryinfo>
47507 <title>LINUX</title>
47508 <productname>Kernel Hackers Manual</productname>
47509 <date>July 2017</date>
47510</refentryinfo>
47511<refmeta>
47512 <refentrytitle><phrase>struct tuner_setup</phrase></refentrytitle>
47513 <manvolnum>9</manvolnum>
47514 <refmiscinfo class="version">4.4.14</refmiscinfo>
47515</refmeta>
47516<refnamediv>
47517 <refname>struct tuner_setup</refname>
47518 <refpurpose>
47519     setup the tuner chipsets
47520 </refpurpose>
47521</refnamediv>
47522<refsynopsisdiv>
47523 <title>Synopsis</title>
47524  <programlisting>
47525struct tuner_setup {
47526  unsigned short addr;
47527  unsigned int type;
47528  unsigned int mode_mask;
47529  void * config;
47530  int (* tuner_callback) (void *dev, int component, int cmd, int arg);
47531};  </programlisting>
47532</refsynopsisdiv>
47533 <refsect1>
47534  <title>Members</title>
47535  <variablelist>
47536    <varlistentry>      <term>addr</term>
47537      <listitem><para>
47538   I2C address used to control the tuner device/chipset
47539      </para></listitem>
47540    </varlistentry>
47541    <varlistentry>      <term>type</term>
47542      <listitem><para>
47543   Type of the tuner, as defined at the TUNER_* macros.
47544   Each different tuner model should have an unique
47545   identifier.
47546      </para></listitem>
47547    </varlistentry>
47548    <varlistentry>      <term>mode_mask</term>
47549      <listitem><para>
47550   Mask with the allowed tuner modes: V4L2_TUNER_RADIO,
47551   V4L2_TUNER_ANALOG_TV and/or V4L2_TUNER_DIGITAL_TV,
47552   describing if the tuner should be used to support
47553   Radio, analog TV and/or digital TV.
47554      </para></listitem>
47555    </varlistentry>
47556    <varlistentry>      <term>config</term>
47557      <listitem><para>
47558   Used to send tuner-specific configuration for complex
47559   tuners that require extra parameters to be set.
47560   Only a very few tuners require it and its usage on
47561   newer tuners should be avoided.
47562      </para></listitem>
47563    </varlistentry>
47564    <varlistentry>      <term>tuner_callback</term>
47565      <listitem><para>
47566   Some tuners require to call back the bridge driver,
47567   in order to do some tasks like rising a GPIO at the
47568   bridge chipset, in order to do things like resetting
47569   the device.
47570      </para></listitem>
47571    </varlistentry>
47572  </variablelist>
47573 </refsect1>
47574<refsect1>
47575<title>Description</title>
47576<para>
47577   Older boards only had a single tuner device. Nowadays multiple tuner
47578   devices may be present on a single board. Using TUNER_SET_TYPE_ADDR
47579   to pass the tuner_setup structure it is possible to setup each tuner
47580   device in turn.
47581   </para><para>
47582
47583   Since multiple devices may be present it is no longer sufficient to
47584   send a command to a single i2c device. Instead you should broadcast
47585   the command to all i2c devices.
47586   </para><para>
47587
47588   By setting the mode_mask correctly you can select which commands are
47589   accepted by a specific tuner device. For example, set mode_mask to
47590   T_RADIO if the device is a radio-only tuner. That specific tuner will
47591   only accept commands when the tuner is in radio mode and ignore them
47592   when the tuner is set to TV mode.
47593</para>
47594</refsect1>
47595</refentry>
47596
47597<!-- include/media/tuner-types.h -->
47598<refentry id="API-enum-param-type">
47599<refentryinfo>
47600 <title>LINUX</title>
47601 <productname>Kernel Hackers Manual</productname>
47602 <date>July 2017</date>
47603</refentryinfo>
47604<refmeta>
47605 <refentrytitle><phrase>enum param_type</phrase></refentrytitle>
47606 <manvolnum>9</manvolnum>
47607 <refmiscinfo class="version">4.4.14</refmiscinfo>
47608</refmeta>
47609<refnamediv>
47610 <refname>enum param_type</refname>
47611 <refpurpose>
47612  type of the tuner pameters
47613 </refpurpose>
47614</refnamediv>
47615<refsynopsisdiv>
47616 <title>Synopsis</title>
47617  <programlisting>
47618enum param_type {
47619  TUNER_PARAM_TYPE_RADIO,
47620  TUNER_PARAM_TYPE_PAL,
47621  TUNER_PARAM_TYPE_SECAM,
47622  TUNER_PARAM_TYPE_NTSC,
47623  TUNER_PARAM_TYPE_DIGITAL
47624};  </programlisting>
47625</refsynopsisdiv>
47626<refsect1>
47627 <title>Constants</title>
47628  <variablelist>
47629    <varlistentry>      <term>TUNER_PARAM_TYPE_RADIO</term>
47630      <listitem><para>
47631Tuner params are for FM and/or AM radio
47632      </para></listitem>
47633    </varlistentry>
47634    <varlistentry>      <term>TUNER_PARAM_TYPE_PAL</term>
47635      <listitem><para>
47636Tuner params are for PAL color TV standard
47637      </para></listitem>
47638    </varlistentry>
47639    <varlistentry>      <term>TUNER_PARAM_TYPE_SECAM</term>
47640      <listitem><para>
47641Tuner params are for SECAM color TV standard
47642      </para></listitem>
47643    </varlistentry>
47644    <varlistentry>      <term>TUNER_PARAM_TYPE_NTSC</term>
47645      <listitem><para>
47646Tuner params are for NTSC color TV standard
47647      </para></listitem>
47648    </varlistentry>
47649    <varlistentry>      <term>TUNER_PARAM_TYPE_DIGITAL</term>
47650      <listitem><para>
47651Tuner params are for digital TV
47652      </para></listitem>
47653    </varlistentry>
47654  </variablelist>
47655</refsect1>
47656</refentry>
47657
47658<refentry id="API-struct-tuner-range">
47659<refentryinfo>
47660 <title>LINUX</title>
47661 <productname>Kernel Hackers Manual</productname>
47662 <date>July 2017</date>
47663</refentryinfo>
47664<refmeta>
47665 <refentrytitle><phrase>struct tuner_range</phrase></refentrytitle>
47666 <manvolnum>9</manvolnum>
47667 <refmiscinfo class="version">4.4.14</refmiscinfo>
47668</refmeta>
47669<refnamediv>
47670 <refname>struct tuner_range</refname>
47671 <refpurpose>
47672     define the frequencies supported by the tuner
47673 </refpurpose>
47674</refnamediv>
47675<refsynopsisdiv>
47676 <title>Synopsis</title>
47677  <programlisting>
47678struct tuner_range {
47679  unsigned short limit;
47680  unsigned char config;
47681  unsigned char cb;
47682};  </programlisting>
47683</refsynopsisdiv>
47684 <refsect1>
47685  <title>Members</title>
47686  <variablelist>
47687    <varlistentry>      <term>limit</term>
47688      <listitem><para>
47689   Max frequency supported by that range, in 62.5 kHz
47690   (TV) or 62.5 Hz (Radio), as defined by
47691   V4L2_TUNER_CAP_LOW.
47692      </para></listitem>
47693    </varlistentry>
47694    <varlistentry>      <term>config</term>
47695      <listitem><para>
47696   Value of the band switch byte (BB) to setup this mode.
47697      </para></listitem>
47698    </varlistentry>
47699    <varlistentry>      <term>cb</term>
47700      <listitem><para>
47701   Value of the CB byte to setup this mode.
47702      </para></listitem>
47703    </varlistentry>
47704  </variablelist>
47705 </refsect1>
47706<refsect1>
47707<title>Description</title>
47708<para>
47709   Please notice that digital tuners like xc3028/xc4000/xc5000 don't use
47710   those ranges, as they're defined inside the driver. This is used by
47711   analog tuners that are compatible with the <quote>Philips way</quote> to setup the
47712   tuners. On those devices, the tuner set is done via 4 bytes:
47713   divider byte1 (DB1), divider byte 2 (DB2), Control byte (CB) and
47714   band switch byte (BB).
47715   Some tuners also have an additional optional Auxiliary byte (AB).
47716</para>
47717</refsect1>
47718</refentry>
47719
47720<refentry id="API-struct-tuner-params">
47721<refentryinfo>
47722 <title>LINUX</title>
47723 <productname>Kernel Hackers Manual</productname>
47724 <date>July 2017</date>
47725</refentryinfo>
47726<refmeta>
47727 <refentrytitle><phrase>struct tuner_params</phrase></refentrytitle>
47728 <manvolnum>9</manvolnum>
47729 <refmiscinfo class="version">4.4.14</refmiscinfo>
47730</refmeta>
47731<refnamediv>
47732 <refname>struct tuner_params</refname>
47733 <refpurpose>
47734     Parameters to be used to setup the tuner. Those are used by drivers/media/tuners/tuner-types.c in order to specify the tuner properties. Most of the parameters are for tuners based on tda9887 IF-PLL multi-standard analog TV/Radio demodulator, with is very common on legacy analog tuners.
47735 </refpurpose>
47736</refnamediv>
47737<refsynopsisdiv>
47738 <title>Synopsis</title>
47739  <programlisting>
47740struct tuner_params {
47741  enum param_type type;
47742  unsigned int cb_first_if_lower_freq:1;
47743  unsigned int has_tda9887:1;
47744  unsigned int port1_fm_high_sensitivity:1;
47745  unsigned int port2_fm_high_sensitivity:1;
47746  unsigned int fm_gain_normal:1;
47747  unsigned int intercarrier_mode:1;
47748  unsigned int port1_active:1;
47749  unsigned int port2_active:1;
47750  unsigned int port1_invert_for_secam_lc:1;
47751  unsigned int port2_invert_for_secam_lc:1;
47752  unsigned int port1_set_for_fm_mono:1;
47753  unsigned int default_pll_gating_18:1;
47754  unsigned int radio_if:2;
47755  signed int default_top_low:5;
47756  signed int default_top_mid:5;
47757  signed int default_top_high:5;
47758  signed int default_top_secam_low:5;
47759  signed int default_top_secam_mid:5;
47760  signed int default_top_secam_high:5;
47761  u16 iffreq;
47762  unsigned int count;
47763  struct tuner_range * ranges;
47764};  </programlisting>
47765</refsynopsisdiv>
47766 <refsect1>
47767  <title>Members</title>
47768  <variablelist>
47769    <varlistentry>      <term>type</term>
47770      <listitem><para>
47771   Type of the tuner parameters, as defined at
47772   enum param_type. If the tuner supports multiple
47773   standards, an array should be used, with one
47774   row per different standard.
47775      </para></listitem>
47776    </varlistentry>
47777    <varlistentry>      <term>cb_first_if_lower_freq</term>
47778      <listitem><para>
47779   Many Philips-based tuners have a comment in
47780   their datasheet like
47781   <quote>For channel selection involving band
47782   switching, and to ensure smooth tuning to the
47783   desired channel without causing unnecessary
47784   charge pump action, it is recommended to
47785   consider the difference between wanted channel
47786   frequency and the current channel frequency.
47787   Unnecessary charge pump action will result
47788   in very low tuning voltage which may drive the
47789   oscillator to extreme conditions</quote>.
47790   Set cb_first_if_lower_freq to 1, if this check
47791   is required for this tuner. I tested this for
47792   PAL by first setting the TV frequency to
47793   203 MHz and then switching to 96.6 MHz FM
47794   radio. The result was static unless the
47795   control byte was sent first.
47796      </para></listitem>
47797    </varlistentry>
47798    <varlistentry>      <term>has_tda9887</term>
47799      <listitem><para>
47800   Set to 1 if this tuner uses a tda9887
47801      </para></listitem>
47802    </varlistentry>
47803    <varlistentry>      <term>port1_fm_high_sensitivity</term>
47804      <listitem><para>
47805   Many Philips tuners use tda9887 PORT1 to select
47806   the FM radio sensitivity. If this setting is 1,
47807   then set PORT1 to 1 to get proper FM reception.
47808      </para></listitem>
47809    </varlistentry>
47810    <varlistentry>      <term>port2_fm_high_sensitivity</term>
47811      <listitem><para>
47812   Some Philips tuners use tda9887 PORT2 to select
47813   the FM radio sensitivity. If this setting is 1,
47814   then set PORT2 to 1 to get proper FM reception.
47815      </para></listitem>
47816    </varlistentry>
47817    <varlistentry>      <term>fm_gain_normal</term>
47818      <listitem><para>
47819   Some Philips tuners use tda9887 cGainNormal to
47820   select the FM radio sensitivity. If this
47821   setting is 1, e register will use cGainNormal
47822   instead of cGainLow.
47823      </para></listitem>
47824    </varlistentry>
47825    <varlistentry>      <term>intercarrier_mode</term>
47826      <listitem><para>
47827   Most tuners with a tda9887 use QSS mode.
47828   Some (cheaper) tuners use Intercarrier mode.
47829   If this setting is 1, then the tuner needs to
47830   be set to intercarrier mode.
47831      </para></listitem>
47832    </varlistentry>
47833    <varlistentry>      <term>port1_active</term>
47834      <listitem><para>
47835   This setting sets the default value for PORT1.
47836   0 means inactive, 1 means active. Note: the
47837   actual bit value written to the tda9887 is
47838   inverted. So a 0 here means a 1 in the B6 bit.
47839      </para></listitem>
47840    </varlistentry>
47841    <varlistentry>      <term>port2_active</term>
47842      <listitem><para>
47843   This setting sets the default value for PORT2.
47844   0 means inactive, 1 means active. Note: the
47845   actual bit value written to the tda9887 is
47846   inverted. So a 0 here means a 1 in the B7 bit.
47847      </para></listitem>
47848    </varlistentry>
47849    <varlistentry>      <term>port1_invert_for_secam_lc</term>
47850      <listitem><para>
47851   Sometimes PORT1 is inverted when the SECAM-L'
47852   standard is selected. Set this bit to 1 if this
47853   is needed.
47854      </para></listitem>
47855    </varlistentry>
47856    <varlistentry>      <term>port2_invert_for_secam_lc</term>
47857      <listitem><para>
47858   Sometimes PORT2 is inverted when the SECAM-L'
47859   standard is selected. Set this bit to 1 if this
47860   is needed.
47861      </para></listitem>
47862    </varlistentry>
47863    <varlistentry>      <term>port1_set_for_fm_mono</term>
47864      <listitem><para>
47865   Some cards require PORT1 to be 1 for mono Radio
47866   FM and 0 for stereo.
47867      </para></listitem>
47868    </varlistentry>
47869    <varlistentry>      <term>default_pll_gating_18</term>
47870      <listitem><para>
47871   Select 18% (or according to datasheet 0%)
47872   L standard PLL gating, vs the driver default
47873   of 36%.
47874      </para></listitem>
47875    </varlistentry>
47876    <varlistentry>      <term>radio_if</term>
47877      <listitem><para>
47878   IF to use in radio mode.  Tuners with a
47879   separate radio IF filter seem to use 10.7,
47880   while those without use 33.3 for PAL/SECAM
47881   tuners and 41.3 for NTSC tuners.
47882   0 = 10.7, 1 = 33.3, 2 = 41.3
47883      </para></listitem>
47884    </varlistentry>
47885    <varlistentry>      <term>default_top_low</term>
47886      <listitem><para>
47887   Default tda9887 TOP value in dB for the low
47888   band. Default is 0. Range: -16:+15
47889      </para></listitem>
47890    </varlistentry>
47891    <varlistentry>      <term>default_top_mid</term>
47892      <listitem><para>
47893   Default tda9887 TOP value in dB for the mid
47894   band. Default is 0. Range: -16:+15
47895      </para></listitem>
47896    </varlistentry>
47897    <varlistentry>      <term>default_top_high</term>
47898      <listitem><para>
47899   Default tda9887 TOP value in dB for the high
47900   band. Default is 0. Range: -16:+15
47901      </para></listitem>
47902    </varlistentry>
47903    <varlistentry>      <term>default_top_secam_low</term>
47904      <listitem><para>
47905   Default tda9887 TOP value in dB for SECAM-L/L'
47906   for the low band. Default is 0. Several tuners
47907   require a different TOP value for the
47908   SECAM-L/L' standards. Range: -16:+15
47909      </para></listitem>
47910    </varlistentry>
47911    <varlistentry>      <term>default_top_secam_mid</term>
47912      <listitem><para>
47913   Default tda9887 TOP value in dB for SECAM-L/L'
47914   for the mid band. Default is 0. Several tuners
47915   require a different TOP value for the
47916   SECAM-L/L' standards. Range: -16:+15
47917      </para></listitem>
47918    </varlistentry>
47919    <varlistentry>      <term>default_top_secam_high</term>
47920      <listitem><para>
47921   Default tda9887 TOP value in dB for SECAM-L/L'
47922   for the high band. Default is 0. Several tuners
47923   require a different TOP value for the
47924   SECAM-L/L' standards. Range: -16:+15
47925      </para></listitem>
47926    </varlistentry>
47927    <varlistentry>      <term>iffreq</term>
47928      <listitem><para>
47929   Intermediate frequency (IF) used by the tuner
47930   on digital mode.
47931      </para></listitem>
47932    </varlistentry>
47933    <varlistentry>      <term>count</term>
47934      <listitem><para>
47935   Size of the ranges array.
47936      </para></listitem>
47937    </varlistentry>
47938    <varlistentry>      <term>ranges</term>
47939      <listitem><para>
47940   Array with the frequency ranges supported by
47941   the tuner.
47942      </para></listitem>
47943    </varlistentry>
47944  </variablelist>
47945 </refsect1>
47946</refentry>
47947
47948<!-- include/media/tveeprom.h -->
47949<refentry id="API-enum-tveeprom-audio-processor">
47950<refentryinfo>
47951 <title>LINUX</title>
47952 <productname>Kernel Hackers Manual</productname>
47953 <date>July 2017</date>
47954</refentryinfo>
47955<refmeta>
47956 <refentrytitle><phrase>enum tveeprom_audio_processor</phrase></refentrytitle>
47957 <manvolnum>9</manvolnum>
47958 <refmiscinfo class="version">4.4.14</refmiscinfo>
47959</refmeta>
47960<refnamediv>
47961 <refname>enum tveeprom_audio_processor</refname>
47962 <refpurpose>
47963  Specifies the type of audio processor used on a Hauppauge device.
47964 </refpurpose>
47965</refnamediv>
47966<refsynopsisdiv>
47967 <title>Synopsis</title>
47968  <programlisting>
47969enum tveeprom_audio_processor {
47970  TVEEPROM_AUDPROC_NONE,
47971  TVEEPROM_AUDPROC_INTERNAL,
47972  TVEEPROM_AUDPROC_MSP,
47973  TVEEPROM_AUDPROC_OTHER
47974};  </programlisting>
47975</refsynopsisdiv>
47976<refsect1>
47977 <title>Constants</title>
47978  <variablelist>
47979    <varlistentry>      <term>TVEEPROM_AUDPROC_NONE</term>
47980      <listitem><para>
47981No audio processor present
47982      </para></listitem>
47983    </varlistentry>
47984    <varlistentry>      <term>TVEEPROM_AUDPROC_INTERNAL</term>
47985      <listitem><para>
47986The audio processor is internal to the
47987video processor
47988      </para></listitem>
47989    </varlistentry>
47990    <varlistentry>      <term>TVEEPROM_AUDPROC_MSP</term>
47991      <listitem><para>
47992The audio processor is a MSPXXXX device
47993      </para></listitem>
47994    </varlistentry>
47995    <varlistentry>      <term>TVEEPROM_AUDPROC_OTHER</term>
47996      <listitem><para>
47997The audio processor is another device
47998      </para></listitem>
47999    </varlistentry>
48000  </variablelist>
48001</refsect1>
48002</refentry>
48003
48004<refentry id="API-struct-tveeprom">
48005<refentryinfo>
48006 <title>LINUX</title>
48007 <productname>Kernel Hackers Manual</productname>
48008 <date>July 2017</date>
48009</refentryinfo>
48010<refmeta>
48011 <refentrytitle><phrase>struct tveeprom</phrase></refentrytitle>
48012 <manvolnum>9</manvolnum>
48013 <refmiscinfo class="version">4.4.14</refmiscinfo>
48014</refmeta>
48015<refnamediv>
48016 <refname>struct tveeprom</refname>
48017 <refpurpose>
48018     Contains the fields parsed from Hauppauge eeproms
48019 </refpurpose>
48020</refnamediv>
48021<refsynopsisdiv>
48022 <title>Synopsis</title>
48023  <programlisting>
48024struct tveeprom {
48025  u32 has_radio;
48026  u32 has_ir;
48027  u32 has_MAC_address;
48028  u32 tuner_type;
48029  u32 tuner_formats;
48030  u32 tuner_hauppauge_model;
48031  u32 tuner2_type;
48032  u32 tuner2_formats;
48033  u32 tuner2_hauppauge_model;
48034  u32 audio_processor;
48035  u32 decoder_processor;
48036  u32 model;
48037  u32 revision;
48038  u32 serial_number;
48039  char rev_str[5];
48040  u8 MAC_address[ETH_ALEN];
48041};  </programlisting>
48042</refsynopsisdiv>
48043 <refsect1>
48044  <title>Members</title>
48045  <variablelist>
48046    <varlistentry>      <term>has_radio</term>
48047      <listitem><para>
48048   1 if the device has radio; 0 otherwise.
48049      </para></listitem>
48050    </varlistentry>
48051    <varlistentry>      <term>has_ir</term>
48052      <listitem><para>
48053   If has_ir == 0, then it is unknown what the IR
48054   capabilities are. Otherwise:
48055   bit 0) 1 (= IR capabilities are known);
48056   bit 1) IR receiver present;
48057   bit 2) IR transmitter (blaster) present.
48058      </para></listitem>
48059    </varlistentry>
48060    <varlistentry>      <term>has_MAC_address</term>
48061      <listitem><para>
48062   0: no MAC, 1: MAC present, 2: unknown.
48063      </para></listitem>
48064    </varlistentry>
48065    <varlistentry>      <term>tuner_type</term>
48066      <listitem><para>
48067   type of the tuner (TUNER_*, as defined at
48068   include/media/tuner.h).
48069      </para></listitem>
48070    </varlistentry>
48071    <varlistentry>      <term>tuner_formats</term>
48072      <listitem><para>
48073   Supported analog TV standards (V4L2_STD_*).
48074      </para></listitem>
48075    </varlistentry>
48076    <varlistentry>      <term>tuner_hauppauge_model</term>
48077      <listitem><para>
48078   Hauppauge's code for the device model number.
48079      </para></listitem>
48080    </varlistentry>
48081    <varlistentry>      <term>tuner2_type</term>
48082      <listitem><para>
48083   type of the second tuner (TUNER_*, as defined
48084   at include/media/tuner.h).
48085      </para></listitem>
48086    </varlistentry>
48087    <varlistentry>      <term>tuner2_formats</term>
48088      <listitem><para>
48089   Tuner 2 supported analog TV standards
48090   (V4L2_STD_*).
48091      </para></listitem>
48092    </varlistentry>
48093    <varlistentry>      <term>tuner2_hauppauge_model</term>
48094      <listitem><para>
48095   tuner 2 Hauppauge's code for the device model
48096   number.
48097      </para></listitem>
48098    </varlistentry>
48099    <varlistentry>      <term>audio_processor</term>
48100      <listitem><para>
48101   analog audio decoder, as defined by enum
48102   tveeprom_audio_processor.
48103      </para></listitem>
48104    </varlistentry>
48105    <varlistentry>      <term>decoder_processor</term>
48106      <listitem><para>
48107   Hauppauge's code for the decoder chipset.
48108   Unused by the drivers, as they probe the
48109   decoder based on the PCI or USB ID.
48110      </para></listitem>
48111    </varlistentry>
48112    <varlistentry>      <term>model</term>
48113      <listitem><para>
48114   Hauppauge's model number
48115      </para></listitem>
48116    </varlistentry>
48117    <varlistentry>      <term>revision</term>
48118      <listitem><para>
48119   Card revision number
48120      </para></listitem>
48121    </varlistentry>
48122    <varlistentry>      <term>serial_number</term>
48123      <listitem><para>
48124   Card's serial number
48125      </para></listitem>
48126    </varlistentry>
48127    <varlistentry>      <term>rev_str[5]</term>
48128      <listitem><para>
48129   Card revision converted to number
48130      </para></listitem>
48131    </varlistentry>
48132    <varlistentry>      <term>MAC_address[ETH_ALEN]</term>
48133      <listitem><para>
48134   MAC address for the network interface
48135      </para></listitem>
48136    </varlistentry>
48137  </variablelist>
48138 </refsect1>
48139</refentry>
48140
48141<refentry id="API-tveeprom-hauppauge-analog">
48142<refentryinfo>
48143 <title>LINUX</title>
48144 <productname>Kernel Hackers Manual</productname>
48145 <date>July 2017</date>
48146</refentryinfo>
48147<refmeta>
48148 <refentrytitle><phrase>tveeprom_hauppauge_analog</phrase></refentrytitle>
48149 <manvolnum>9</manvolnum>
48150 <refmiscinfo class="version">4.4.14</refmiscinfo>
48151</refmeta>
48152<refnamediv>
48153 <refname>tveeprom_hauppauge_analog</refname>
48154 <refpurpose>
48155     Fill struct tveeprom using the contents of the eeprom previously filled at <parameter>eeprom_data</parameter> field.
48156 </refpurpose>
48157</refnamediv>
48158<refsynopsisdiv>
48159 <title>Synopsis</title>
48160  <funcsynopsis><funcprototype>
48161   <funcdef>void <function>tveeprom_hauppauge_analog </function></funcdef>
48162   <paramdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <parameter>c</parameter></paramdef>
48163   <paramdef><link linkend="API-struct-tveeprom">struct tveeprom</link> * <parameter>tvee</parameter></paramdef>
48164   <paramdef>unsigned char * <parameter>eeprom_data</parameter></paramdef>
48165  </funcprototype></funcsynopsis>
48166</refsynopsisdiv>
48167<refsect1>
48168 <title>Arguments</title>
48169 <variablelist>
48170  <varlistentry>
48171   <term><parameter>c</parameter></term>
48172   <listitem>
48173    <para>
48174     I2C client struct
48175    </para>
48176   </listitem>
48177  </varlistentry>
48178  <varlistentry>
48179   <term><parameter>tvee</parameter></term>
48180   <listitem>
48181    <para>
48182     Struct to where the eeprom parsed data will be filled;
48183    </para>
48184   </listitem>
48185  </varlistentry>
48186  <varlistentry>
48187   <term><parameter>eeprom_data</parameter></term>
48188   <listitem>
48189    <para>
48190     Array with the contents of the eeprom_data. It should
48191     contain 256 bytes filled with the contents of the
48192     eeprom read from the Hauppauge device.
48193    </para>
48194   </listitem>
48195  </varlistentry>
48196 </variablelist>
48197</refsect1>
48198</refentry>
48199
48200<refentry id="API-tveeprom-read">
48201<refentryinfo>
48202 <title>LINUX</title>
48203 <productname>Kernel Hackers Manual</productname>
48204 <date>July 2017</date>
48205</refentryinfo>
48206<refmeta>
48207 <refentrytitle><phrase>tveeprom_read</phrase></refentrytitle>
48208 <manvolnum>9</manvolnum>
48209 <refmiscinfo class="version">4.4.14</refmiscinfo>
48210</refmeta>
48211<refnamediv>
48212 <refname>tveeprom_read</refname>
48213 <refpurpose>
48214     Reads the contents of the eeprom found at the Hauppauge devices.
48215 </refpurpose>
48216</refnamediv>
48217<refsynopsisdiv>
48218 <title>Synopsis</title>
48219  <funcsynopsis><funcprototype>
48220   <funcdef>int <function>tveeprom_read </function></funcdef>
48221   <paramdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <parameter>c</parameter></paramdef>
48222   <paramdef>unsigned char * <parameter>eedata</parameter></paramdef>
48223   <paramdef>int <parameter>len</parameter></paramdef>
48224  </funcprototype></funcsynopsis>
48225</refsynopsisdiv>
48226<refsect1>
48227 <title>Arguments</title>
48228 <variablelist>
48229  <varlistentry>
48230   <term><parameter>c</parameter></term>
48231   <listitem>
48232    <para>
48233     I2C client struct
48234    </para>
48235   </listitem>
48236  </varlistentry>
48237  <varlistentry>
48238   <term><parameter>eedata</parameter></term>
48239   <listitem>
48240    <para>
48241     Array where the eeprom content will be stored.
48242    </para>
48243   </listitem>
48244  </varlistentry>
48245  <varlistentry>
48246   <term><parameter>len</parameter></term>
48247   <listitem>
48248    <para>
48249     Size of <parameter>eedata</parameter> array. If the eeprom content will be latter
48250     be parsed by <function><link linkend="API-tveeprom-hauppauge-analog">tveeprom_hauppauge_analog</link></function>, len should be, at
48251     least, 256.
48252    </para>
48253   </listitem>
48254  </varlistentry>
48255 </variablelist>
48256</refsect1>
48257</refentry>
48258
48259<!-- include/media/v4l2-async.h -->
48260<refentry id="API-struct-v4l2-async-subdev">
48261<refentryinfo>
48262 <title>LINUX</title>
48263 <productname>Kernel Hackers Manual</productname>
48264 <date>July 2017</date>
48265</refentryinfo>
48266<refmeta>
48267 <refentrytitle><phrase>struct v4l2_async_subdev</phrase></refentrytitle>
48268 <manvolnum>9</manvolnum>
48269 <refmiscinfo class="version">4.4.14</refmiscinfo>
48270</refmeta>
48271<refnamediv>
48272 <refname>struct v4l2_async_subdev</refname>
48273 <refpurpose>
48274  sub-device descriptor, as known to a bridge
48275 </refpurpose>
48276</refnamediv>
48277<refsynopsisdiv>
48278 <title>Synopsis</title>
48279  <programlisting>
48280struct v4l2_async_subdev {
48281  enum v4l2_async_match_type match_type;
48282  union match;
48283  struct list_head list;
48284};  </programlisting>
48285</refsynopsisdiv>
48286 <refsect1>
48287  <title>Members</title>
48288  <variablelist>
48289    <varlistentry>      <term>match_type</term>
48290      <listitem><para>
48291type of match that will be used
48292      </para></listitem>
48293    </varlistentry>
48294    <varlistentry>      <term>match</term>
48295      <listitem><para>
48296union of per-bus type matching data sets
48297      </para></listitem>
48298    </varlistentry>
48299    <varlistentry>      <term>list</term>
48300      <listitem><para>
48301used to link struct v4l2_async_subdev objects, waiting to be
48302probed, to a notifier-&gt;waiting list
48303      </para></listitem>
48304    </varlistentry>
48305  </variablelist>
48306 </refsect1>
48307</refentry>
48308
48309<refentry id="API-struct-v4l2-async-notifier">
48310<refentryinfo>
48311 <title>LINUX</title>
48312 <productname>Kernel Hackers Manual</productname>
48313 <date>July 2017</date>
48314</refentryinfo>
48315<refmeta>
48316 <refentrytitle><phrase>struct v4l2_async_notifier</phrase></refentrytitle>
48317 <manvolnum>9</manvolnum>
48318 <refmiscinfo class="version">4.4.14</refmiscinfo>
48319</refmeta>
48320<refnamediv>
48321 <refname>struct v4l2_async_notifier</refname>
48322 <refpurpose>
48323     v4l2_device notifier data
48324 </refpurpose>
48325</refnamediv>
48326<refsynopsisdiv>
48327 <title>Synopsis</title>
48328  <programlisting>
48329struct v4l2_async_notifier {
48330  unsigned int num_subdevs;
48331  struct v4l2_async_subdev ** subdevs;
48332  struct v4l2_device * v4l2_dev;
48333  struct list_head waiting;
48334  struct list_head done;
48335  struct list_head list;
48336  int (* bound) (struct v4l2_async_notifier *notifier,struct v4l2_subdev *subdev,struct v4l2_async_subdev *asd);
48337  int (* complete) (struct v4l2_async_notifier *notifier);
48338  void (* unbind) (struct v4l2_async_notifier *notifier,struct v4l2_subdev *subdev,struct v4l2_async_subdev *asd);
48339};  </programlisting>
48340</refsynopsisdiv>
48341 <refsect1>
48342  <title>Members</title>
48343  <variablelist>
48344    <varlistentry>      <term>num_subdevs</term>
48345      <listitem><para>
48346   number of subdevices
48347      </para></listitem>
48348    </varlistentry>
48349    <varlistentry>      <term>subdevs</term>
48350      <listitem><para>
48351   array of pointers to subdevice descriptors
48352      </para></listitem>
48353    </varlistentry>
48354    <varlistentry>      <term>v4l2_dev</term>
48355      <listitem><para>
48356   pointer to struct v4l2_device
48357      </para></listitem>
48358    </varlistentry>
48359    <varlistentry>      <term>waiting</term>
48360      <listitem><para>
48361   list of struct v4l2_async_subdev, waiting for their drivers
48362      </para></listitem>
48363    </varlistentry>
48364    <varlistentry>      <term>done</term>
48365      <listitem><para>
48366   list of struct v4l2_subdev, already probed
48367      </para></listitem>
48368    </varlistentry>
48369    <varlistentry>      <term>list</term>
48370      <listitem><para>
48371   member in a global list of notifiers
48372      </para></listitem>
48373    </varlistentry>
48374    <varlistentry>      <term>bound</term>
48375      <listitem><para>
48376   a subdevice driver has successfully probed one of subdevices
48377      </para></listitem>
48378    </varlistentry>
48379    <varlistentry>      <term>complete</term>
48380      <listitem><para>
48381   all subdevices have been probed successfully
48382      </para></listitem>
48383    </varlistentry>
48384    <varlistentry>      <term>unbind</term>
48385      <listitem><para>
48386   a subdevice is leaving
48387      </para></listitem>
48388    </varlistentry>
48389  </variablelist>
48390 </refsect1>
48391</refentry>
48392
48393<!-- include/media/v4l2-ctrls.h -->
48394<refentry id="API-struct-v4l2-ctrl-ptr">
48395<refentryinfo>
48396 <title>LINUX</title>
48397 <productname>Kernel Hackers Manual</productname>
48398 <date>July 2017</date>
48399</refentryinfo>
48400<refmeta>
48401 <refentrytitle><phrase>union v4l2_ctrl_ptr</phrase></refentrytitle>
48402 <manvolnum>9</manvolnum>
48403 <refmiscinfo class="version">4.4.14</refmiscinfo>
48404</refmeta>
48405<refnamediv>
48406 <refname>union v4l2_ctrl_ptr</refname>
48407 <refpurpose>
48408  A pointer to a control value.
48409 </refpurpose>
48410</refnamediv>
48411<refsynopsisdiv>
48412 <title>Synopsis</title>
48413  <programlisting>
48414union v4l2_ctrl_ptr {
48415  s32 * p_s32;
48416  s64 * p_s64;
48417  u8 * p_u8;
48418  u16 * p_u16;
48419  u32 * p_u32;
48420  char * p_char;
48421  void * p;
48422};  </programlisting>
48423</refsynopsisdiv>
48424 <refsect1>
48425  <title>Members</title>
48426  <variablelist>
48427    <varlistentry>      <term>p_s32</term>
48428      <listitem><para>
48429Pointer to a 32-bit signed value.
48430      </para></listitem>
48431    </varlistentry>
48432    <varlistentry>      <term>p_s64</term>
48433      <listitem><para>
48434Pointer to a 64-bit signed value.
48435      </para></listitem>
48436    </varlistentry>
48437    <varlistentry>      <term>p_u8</term>
48438      <listitem><para>
48439Pointer to a 8-bit unsigned value.
48440      </para></listitem>
48441    </varlistentry>
48442    <varlistentry>      <term>p_u16</term>
48443      <listitem><para>
48444Pointer to a 16-bit unsigned value.
48445      </para></listitem>
48446    </varlistentry>
48447    <varlistentry>      <term>p_u32</term>
48448      <listitem><para>
48449Pointer to a 32-bit unsigned value.
48450      </para></listitem>
48451    </varlistentry>
48452    <varlistentry>      <term>p_char</term>
48453      <listitem><para>
48454Pointer to a string.
48455      </para></listitem>
48456    </varlistentry>
48457    <varlistentry>      <term>p</term>
48458      <listitem><para>
48459Pointer to a compound value.
48460      </para></listitem>
48461    </varlistentry>
48462  </variablelist>
48463 </refsect1>
48464</refentry>
48465
48466<refentry id="API-struct-v4l2-ctrl-ops">
48467<refentryinfo>
48468 <title>LINUX</title>
48469 <productname>Kernel Hackers Manual</productname>
48470 <date>July 2017</date>
48471</refentryinfo>
48472<refmeta>
48473 <refentrytitle><phrase>struct v4l2_ctrl_ops</phrase></refentrytitle>
48474 <manvolnum>9</manvolnum>
48475 <refmiscinfo class="version">4.4.14</refmiscinfo>
48476</refmeta>
48477<refnamediv>
48478 <refname>struct v4l2_ctrl_ops</refname>
48479 <refpurpose>
48480     The control operations that the driver has to provide.
48481 </refpurpose>
48482</refnamediv>
48483<refsynopsisdiv>
48484 <title>Synopsis</title>
48485  <programlisting>
48486struct v4l2_ctrl_ops {
48487  int (* g_volatile_ctrl) (struct v4l2_ctrl *ctrl);
48488  int (* try_ctrl) (struct v4l2_ctrl *ctrl);
48489  int (* s_ctrl) (struct v4l2_ctrl *ctrl);
48490};  </programlisting>
48491</refsynopsisdiv>
48492 <refsect1>
48493  <title>Members</title>
48494  <variablelist>
48495    <varlistentry>      <term>g_volatile_ctrl</term>
48496      <listitem><para>
48497   Get a new value for this control. Generally only relevant
48498   for volatile (and usually read-only) controls such as a control
48499   that returns the current signal strength which changes
48500   continuously.
48501   If not set, then the currently cached value will be returned.
48502      </para></listitem>
48503    </varlistentry>
48504    <varlistentry>      <term>try_ctrl</term>
48505      <listitem><para>
48506   Test whether the control's value is valid. Only relevant when
48507   the usual min/max/step checks are not sufficient.
48508      </para></listitem>
48509    </varlistentry>
48510    <varlistentry>      <term>s_ctrl</term>
48511      <listitem><para>
48512   Actually set the new control value. s_ctrl is compulsory. The
48513   ctrl-&gt;handler-&gt;lock is held when these ops are called, so no
48514   one else can access controls owned by that handler.
48515      </para></listitem>
48516    </varlistentry>
48517  </variablelist>
48518 </refsect1>
48519</refentry>
48520
48521<refentry id="API-struct-v4l2-ctrl-type-ops">
48522<refentryinfo>
48523 <title>LINUX</title>
48524 <productname>Kernel Hackers Manual</productname>
48525 <date>July 2017</date>
48526</refentryinfo>
48527<refmeta>
48528 <refentrytitle><phrase>struct v4l2_ctrl_type_ops</phrase></refentrytitle>
48529 <manvolnum>9</manvolnum>
48530 <refmiscinfo class="version">4.4.14</refmiscinfo>
48531</refmeta>
48532<refnamediv>
48533 <refname>struct v4l2_ctrl_type_ops</refname>
48534 <refpurpose>
48535     The control type operations that the driver has to provide.
48536 </refpurpose>
48537</refnamediv>
48538<refsynopsisdiv>
48539 <title>Synopsis</title>
48540  <programlisting>
48541struct v4l2_ctrl_type_ops {
48542  bool (* equal) (const struct v4l2_ctrl *ctrl, u32 idx,union v4l2_ctrl_ptr ptr1,union v4l2_ctrl_ptr ptr2);
48543  void (* init) (const struct v4l2_ctrl *ctrl, u32 idx,union v4l2_ctrl_ptr ptr);
48544  void (* log) (const struct v4l2_ctrl *ctrl);
48545  int (* validate) (const struct v4l2_ctrl *ctrl, u32 idx,union v4l2_ctrl_ptr ptr);
48546};  </programlisting>
48547</refsynopsisdiv>
48548 <refsect1>
48549  <title>Members</title>
48550  <variablelist>
48551    <varlistentry>      <term>equal</term>
48552      <listitem><para>
48553   return true if both values are equal.
48554      </para></listitem>
48555    </varlistentry>
48556    <varlistentry>      <term>init</term>
48557      <listitem><para>
48558   initialize the value.
48559      </para></listitem>
48560    </varlistentry>
48561    <varlistentry>      <term>log</term>
48562      <listitem><para>
48563   log the value.
48564      </para></listitem>
48565    </varlistentry>
48566    <varlistentry>      <term>validate</term>
48567      <listitem><para>
48568   validate the value. Return 0 on success and a negative value otherwise.
48569      </para></listitem>
48570    </varlistentry>
48571  </variablelist>
48572 </refsect1>
48573</refentry>
48574
48575<refentry id="API-struct-v4l2-ctrl">
48576<refentryinfo>
48577 <title>LINUX</title>
48578 <productname>Kernel Hackers Manual</productname>
48579 <date>July 2017</date>
48580</refentryinfo>
48581<refmeta>
48582 <refentrytitle><phrase>struct v4l2_ctrl</phrase></refentrytitle>
48583 <manvolnum>9</manvolnum>
48584 <refmiscinfo class="version">4.4.14</refmiscinfo>
48585</refmeta>
48586<refnamediv>
48587 <refname>struct v4l2_ctrl</refname>
48588 <refpurpose>
48589     The control structure.
48590 </refpurpose>
48591</refnamediv>
48592<refsynopsisdiv>
48593 <title>Synopsis</title>
48594  <programlisting>
48595struct v4l2_ctrl {
48596  struct list_head node;
48597  struct list_head ev_subs;
48598  struct v4l2_ctrl_handler * handler;
48599  struct v4l2_ctrl ** cluster;
48600  unsigned ncontrols;
48601  unsigned int done:1;
48602  unsigned int is_new:1;
48603  unsigned int has_changed:1;
48604  unsigned int is_private:1;
48605  unsigned int is_auto:1;
48606  unsigned int is_int:1;
48607  unsigned int is_string:1;
48608  unsigned int is_ptr:1;
48609  unsigned int is_array:1;
48610  unsigned int has_volatiles:1;
48611  unsigned int call_notify:1;
48612  unsigned int manual_mode_value:8;
48613  const struct v4l2_ctrl_ops * ops;
48614  const struct v4l2_ctrl_type_ops * type_ops;
48615  u32 id;
48616  const char * name;
48617  enum v4l2_ctrl_type type;
48618  s64 minimum;
48619  s64 maximum;
48620  s64 default_value;
48621  u32 elems;
48622  u32 elem_size;
48623  u32 dims[V4L2_CTRL_MAX_DIMS];
48624  u32 nr_of_dims;
48625  union cur;
48626  union v4l2_ctrl_ptr p_new;
48627  union v4l2_ctrl_ptr p_cur;
48628};  </programlisting>
48629</refsynopsisdiv>
48630 <refsect1>
48631  <title>Members</title>
48632  <variablelist>
48633    <varlistentry>      <term>node</term>
48634      <listitem><para>
48635   The list node.
48636      </para></listitem>
48637    </varlistentry>
48638    <varlistentry>      <term>ev_subs</term>
48639      <listitem><para>
48640   The list of control event subscriptions.
48641      </para></listitem>
48642    </varlistentry>
48643    <varlistentry>      <term>handler</term>
48644      <listitem><para>
48645   The handler that owns the control.
48646      </para></listitem>
48647    </varlistentry>
48648    <varlistentry>      <term>cluster</term>
48649      <listitem><para>
48650   Point to start of cluster array.
48651      </para></listitem>
48652    </varlistentry>
48653    <varlistentry>      <term>ncontrols</term>
48654      <listitem><para>
48655   Number of controls in cluster array.
48656      </para></listitem>
48657    </varlistentry>
48658    <varlistentry>      <term>done</term>
48659      <listitem><para>
48660   Internal flag: set for each processed control.
48661      </para></listitem>
48662    </varlistentry>
48663    <varlistentry>      <term>is_new</term>
48664      <listitem><para>
48665   Set when the user specified a new value for this control. It
48666   is also set when called from v4l2_ctrl_handler_setup. Drivers
48667   should never set this flag.
48668      </para></listitem>
48669    </varlistentry>
48670    <varlistentry>      <term>has_changed</term>
48671      <listitem><para>
48672   Set when the current value differs from the new value. Drivers
48673   should never use this flag.
48674      </para></listitem>
48675    </varlistentry>
48676    <varlistentry>      <term>is_private</term>
48677      <listitem><para>
48678   If set, then this control is private to its handler and it
48679   will not be added to any other handlers. Drivers can set
48680   this flag.
48681      </para></listitem>
48682    </varlistentry>
48683    <varlistentry>      <term>is_auto</term>
48684      <listitem><para>
48685   If set, then this control selects whether the other cluster
48686   members are in 'automatic' mode or 'manual' mode. This is
48687   used for autogain/gain type clusters. Drivers should never
48688   set this flag directly.
48689      </para></listitem>
48690    </varlistentry>
48691    <varlistentry>      <term>is_int</term>
48692      <listitem><para>
48693   If set, then this control has a simple integer value (i.e. it
48694   uses ctrl-&gt;val).
48695      </para></listitem>
48696    </varlistentry>
48697    <varlistentry>      <term>is_string</term>
48698      <listitem><para>
48699   If set, then this control has type V4L2_CTRL_TYPE_STRING.
48700      </para></listitem>
48701    </varlistentry>
48702    <varlistentry>      <term>is_ptr</term>
48703      <listitem><para>
48704   If set, then this control is an array and/or has type &gt;= V4L2_CTRL_COMPOUND_TYPES
48705   and/or has type V4L2_CTRL_TYPE_STRING. In other words, struct
48706   v4l2_ext_control uses field p to point to the data.
48707      </para></listitem>
48708    </varlistentry>
48709    <varlistentry>      <term>is_array</term>
48710      <listitem><para>
48711   If set, then this control contains an N-dimensional array.
48712      </para></listitem>
48713    </varlistentry>
48714    <varlistentry>      <term>has_volatiles</term>
48715      <listitem><para>
48716   If set, then one or more members of the cluster are volatile.
48717   Drivers should never touch this flag.
48718      </para></listitem>
48719    </varlistentry>
48720    <varlistentry>      <term>call_notify</term>
48721      <listitem><para>
48722   If set, then call the handler's notify function whenever the
48723   control's value changes.
48724      </para></listitem>
48725    </varlistentry>
48726    <varlistentry>      <term>manual_mode_value</term>
48727      <listitem><para>
48728   If the is_auto flag is set, then this is the value
48729   of the auto control that determines if that control is in
48730   manual mode. So if the value of the auto control equals this
48731   value, then the whole cluster is in manual mode. Drivers should
48732   never set this flag directly.
48733      </para></listitem>
48734    </varlistentry>
48735    <varlistentry>      <term>ops</term>
48736      <listitem><para>
48737   The control ops.
48738      </para></listitem>
48739    </varlistentry>
48740    <varlistentry>      <term>type_ops</term>
48741      <listitem><para>
48742   The control type ops.
48743      </para></listitem>
48744    </varlistentry>
48745    <varlistentry>      <term>id</term>
48746      <listitem><para>
48747   The control ID.
48748      </para></listitem>
48749    </varlistentry>
48750    <varlistentry>      <term>name</term>
48751      <listitem><para>
48752   The control name.
48753      </para></listitem>
48754    </varlistentry>
48755    <varlistentry>      <term>type</term>
48756      <listitem><para>
48757   The control type.
48758      </para></listitem>
48759    </varlistentry>
48760    <varlistentry>      <term>minimum</term>
48761      <listitem><para>
48762   The control's minimum value.
48763      </para></listitem>
48764    </varlistentry>
48765    <varlistentry>      <term>maximum</term>
48766      <listitem><para>
48767   The control's maximum value.
48768      </para></listitem>
48769    </varlistentry>
48770    <varlistentry>      <term>default_value</term>
48771      <listitem><para>
48772   The control's default value.
48773      </para></listitem>
48774    </varlistentry>
48775    <varlistentry>      <term>elems</term>
48776      <listitem><para>
48777   The number of elements in the N-dimensional array.
48778      </para></listitem>
48779    </varlistentry>
48780    <varlistentry>      <term>elem_size</term>
48781      <listitem><para>
48782   The size in bytes of the control.
48783      </para></listitem>
48784    </varlistentry>
48785    <varlistentry>      <term>dims[V4L2_CTRL_MAX_DIMS]</term>
48786      <listitem><para>
48787   The size of each dimension.
48788      </para></listitem>
48789    </varlistentry>
48790    <varlistentry>      <term>nr_of_dims</term>
48791      <listitem><para>
48792   The number of dimensions in <parameter>dims</parameter>.
48793      </para></listitem>
48794    </varlistentry>
48795    <varlistentry>      <term>cur</term>
48796      <listitem><para>
48797   The control's current value.
48798      </para></listitem>
48799    </varlistentry>
48800    <varlistentry>      <term>p_new</term>
48801      <listitem><para>
48802   The control's new value represented via an union with provides
48803   a standard way of accessing control types
48804   through a pointer.
48805      </para></listitem>
48806    </varlistentry>
48807    <varlistentry>      <term>p_cur</term>
48808      <listitem><para>
48809   The control's current value represented via an union with
48810   provides a standard way of accessing control types
48811   through a pointer.
48812      </para></listitem>
48813    </varlistentry>
48814  </variablelist>
48815 </refsect1>
48816</refentry>
48817
48818<refentry id="API-struct-v4l2-ctrl-ref">
48819<refentryinfo>
48820 <title>LINUX</title>
48821 <productname>Kernel Hackers Manual</productname>
48822 <date>July 2017</date>
48823</refentryinfo>
48824<refmeta>
48825 <refentrytitle><phrase>struct v4l2_ctrl_ref</phrase></refentrytitle>
48826 <manvolnum>9</manvolnum>
48827 <refmiscinfo class="version">4.4.14</refmiscinfo>
48828</refmeta>
48829<refnamediv>
48830 <refname>struct v4l2_ctrl_ref</refname>
48831 <refpurpose>
48832     The control reference.
48833 </refpurpose>
48834</refnamediv>
48835<refsynopsisdiv>
48836 <title>Synopsis</title>
48837  <programlisting>
48838struct v4l2_ctrl_ref {
48839  struct list_head node;
48840  struct v4l2_ctrl_ref * next;
48841  struct v4l2_ctrl * ctrl;
48842  struct v4l2_ctrl_helper * helper;
48843};  </programlisting>
48844</refsynopsisdiv>
48845 <refsect1>
48846  <title>Members</title>
48847  <variablelist>
48848    <varlistentry>      <term>node</term>
48849      <listitem><para>
48850   List node for the sorted list.
48851      </para></listitem>
48852    </varlistentry>
48853    <varlistentry>      <term>next</term>
48854      <listitem><para>
48855   Single-link list node for the hash.
48856      </para></listitem>
48857    </varlistentry>
48858    <varlistentry>      <term>ctrl</term>
48859      <listitem><para>
48860   The actual control information.
48861      </para></listitem>
48862    </varlistentry>
48863    <varlistentry>      <term>helper</term>
48864      <listitem><para>
48865   Pointer to helper struct. Used internally in <function>prepare_ext_ctrls</function>.
48866      </para></listitem>
48867    </varlistentry>
48868  </variablelist>
48869 </refsect1>
48870<refsect1>
48871<title>Description</title>
48872<para>
48873   Each control handler has a list of these refs. The list_head is used to
48874   keep a sorted-by-control-ID list of all controls, while the next pointer
48875   is used to link the control in the hash's bucket.
48876</para>
48877</refsect1>
48878</refentry>
48879
48880<refentry id="API-struct-v4l2-ctrl-handler">
48881<refentryinfo>
48882 <title>LINUX</title>
48883 <productname>Kernel Hackers Manual</productname>
48884 <date>July 2017</date>
48885</refentryinfo>
48886<refmeta>
48887 <refentrytitle><phrase>struct v4l2_ctrl_handler</phrase></refentrytitle>
48888 <manvolnum>9</manvolnum>
48889 <refmiscinfo class="version">4.4.14</refmiscinfo>
48890</refmeta>
48891<refnamediv>
48892 <refname>struct v4l2_ctrl_handler</refname>
48893 <refpurpose>
48894     The control handler keeps track of all the
48895 </refpurpose>
48896</refnamediv>
48897<refsynopsisdiv>
48898 <title>Synopsis</title>
48899  <programlisting>
48900struct v4l2_ctrl_handler {
48901  struct mutex _lock;
48902  struct mutex * lock;
48903  struct list_head ctrls;
48904  struct list_head ctrl_refs;
48905  struct v4l2_ctrl_ref * cached;
48906  struct v4l2_ctrl_ref ** buckets;
48907  v4l2_ctrl_notify_fnc notify;
48908  void * notify_priv;
48909  u16 nr_of_buckets;
48910  int error;
48911};  </programlisting>
48912</refsynopsisdiv>
48913 <refsect1>
48914  <title>Members</title>
48915  <variablelist>
48916    <varlistentry>      <term>_lock</term>
48917      <listitem><para>
48918   Default for <quote>lock</quote>.
48919      </para></listitem>
48920    </varlistentry>
48921    <varlistentry>      <term>lock</term>
48922      <listitem><para>
48923   Lock to control access to this handler and its controls.
48924   May be replaced by the user right after init.
48925      </para></listitem>
48926    </varlistentry>
48927    <varlistentry>      <term>ctrls</term>
48928      <listitem><para>
48929   The list of controls owned by this handler.
48930      </para></listitem>
48931    </varlistentry>
48932    <varlistentry>      <term>ctrl_refs</term>
48933      <listitem><para>
48934   The list of control references.
48935      </para></listitem>
48936    </varlistentry>
48937    <varlistentry>      <term>cached</term>
48938      <listitem><para>
48939   The last found control reference. It is common that the same
48940   control is needed multiple times, so this is a simple
48941   optimization.
48942      </para></listitem>
48943    </varlistentry>
48944    <varlistentry>      <term>buckets</term>
48945      <listitem><para>
48946   Buckets for the hashing. Allows for quick control lookup.
48947      </para></listitem>
48948    </varlistentry>
48949    <varlistentry>      <term>notify</term>
48950      <listitem><para>
48951   A notify callback that is called whenever the control changes value.
48952   Note that the handler's lock is held when the notify function
48953   is called!
48954      </para></listitem>
48955    </varlistentry>
48956    <varlistentry>      <term>notify_priv</term>
48957      <listitem><para>
48958   Passed as argument to the v4l2_ctrl notify callback.
48959      </para></listitem>
48960    </varlistentry>
48961    <varlistentry>      <term>nr_of_buckets</term>
48962      <listitem><para>
48963   Total number of buckets in the array.
48964      </para></listitem>
48965    </varlistentry>
48966    <varlistentry>      <term>error</term>
48967      <listitem><para>
48968   The error code of the first failed control addition.
48969      </para></listitem>
48970    </varlistentry>
48971  </variablelist>
48972 </refsect1>
48973<refsect1>
48974<title>controls</title>
48975<para>
48976   both the controls owned by the handler and those inherited
48977   from other handlers.
48978</para>
48979</refsect1>
48980</refentry>
48981
48982<refentry id="API-struct-v4l2-ctrl-config">
48983<refentryinfo>
48984 <title>LINUX</title>
48985 <productname>Kernel Hackers Manual</productname>
48986 <date>July 2017</date>
48987</refentryinfo>
48988<refmeta>
48989 <refentrytitle><phrase>struct v4l2_ctrl_config</phrase></refentrytitle>
48990 <manvolnum>9</manvolnum>
48991 <refmiscinfo class="version">4.4.14</refmiscinfo>
48992</refmeta>
48993<refnamediv>
48994 <refname>struct v4l2_ctrl_config</refname>
48995 <refpurpose>
48996     Control configuration structure.
48997 </refpurpose>
48998</refnamediv>
48999<refsynopsisdiv>
49000 <title>Synopsis</title>
49001  <programlisting>
49002struct v4l2_ctrl_config {
49003  const struct v4l2_ctrl_ops * ops;
49004  const struct v4l2_ctrl_type_ops * type_ops;
49005  u32 id;
49006  const char * name;
49007  enum v4l2_ctrl_type type;
49008  s64 min;
49009  s64 max;
49010  u64 step;
49011  s64 def;
49012  u32 dims[V4L2_CTRL_MAX_DIMS];
49013  u32 elem_size;
49014  u32 flags;
49015  u64 menu_skip_mask;
49016  const char *const * qmenu;
49017  const s64 * qmenu_int;
49018  unsigned int is_private:1;
49019};  </programlisting>
49020</refsynopsisdiv>
49021 <refsect1>
49022  <title>Members</title>
49023  <variablelist>
49024    <varlistentry>      <term>ops</term>
49025      <listitem><para>
49026   The control ops.
49027      </para></listitem>
49028    </varlistentry>
49029    <varlistentry>      <term>type_ops</term>
49030      <listitem><para>
49031   The control type ops. Only needed for compound controls.
49032      </para></listitem>
49033    </varlistentry>
49034    <varlistentry>      <term>id</term>
49035      <listitem><para>
49036   The control ID.
49037      </para></listitem>
49038    </varlistentry>
49039    <varlistentry>      <term>name</term>
49040      <listitem><para>
49041   The control name.
49042      </para></listitem>
49043    </varlistentry>
49044    <varlistentry>      <term>type</term>
49045      <listitem><para>
49046   The control type.
49047      </para></listitem>
49048    </varlistentry>
49049    <varlistentry>      <term>min</term>
49050      <listitem><para>
49051   The control's minimum value.
49052      </para></listitem>
49053    </varlistentry>
49054    <varlistentry>      <term>max</term>
49055      <listitem><para>
49056   The control's maximum value.
49057      </para></listitem>
49058    </varlistentry>
49059    <varlistentry>      <term>step</term>
49060      <listitem><para>
49061   The control's step value for non-menu controls.
49062      </para></listitem>
49063    </varlistentry>
49064    <varlistentry>      <term>def</term>
49065      <listitem><para>
49066   The control's default value.
49067      </para></listitem>
49068    </varlistentry>
49069    <varlistentry>      <term>dims[V4L2_CTRL_MAX_DIMS]</term>
49070      <listitem><para>
49071   The size of each dimension.
49072      </para></listitem>
49073    </varlistentry>
49074    <varlistentry>      <term>elem_size</term>
49075      <listitem><para>
49076   The size in bytes of the control.
49077      </para></listitem>
49078    </varlistentry>
49079    <varlistentry>      <term>flags</term>
49080      <listitem><para>
49081   The control's flags.
49082      </para></listitem>
49083    </varlistentry>
49084    <varlistentry>      <term>menu_skip_mask</term>
49085      <listitem><para>
49086   The control's skip mask for menu controls. This makes it
49087   easy to skip menu items that are not valid. If bit X is set,
49088   then menu item X is skipped. Of course, this only works for
49089   menus with &lt;= 64 menu items. There are no menus that come
49090   close to that number, so this is OK. Should we ever need more,
49091   then this will have to be extended to a bit array.
49092      </para></listitem>
49093    </varlistentry>
49094    <varlistentry>      <term>qmenu</term>
49095      <listitem><para>
49096   A const char * array for all menu items. Array entries that are
49097   empty strings ("") correspond to non-existing menu items (this
49098   is in addition to the menu_skip_mask above). The last entry
49099   must be NULL.
49100      </para></listitem>
49101    </varlistentry>
49102    <varlistentry>      <term>qmenu_int</term>
49103      <listitem><para>
49104   A const s64 integer array for all menu items of the type
49105   V4L2_CTRL_TYPE_INTEGER_MENU.
49106      </para></listitem>
49107    </varlistentry>
49108    <varlistentry>      <term>is_private</term>
49109      <listitem><para>
49110   If set, then this control is private to its handler and it
49111   will not be added to any other handlers.
49112      </para></listitem>
49113    </varlistentry>
49114  </variablelist>
49115 </refsect1>
49116</refentry>
49117
49118<refentry id="API-v4l2-ctrl-handler-init-class">
49119<refentryinfo>
49120 <title>LINUX</title>
49121 <productname>Kernel Hackers Manual</productname>
49122 <date>July 2017</date>
49123</refentryinfo>
49124<refmeta>
49125 <refentrytitle><phrase>v4l2_ctrl_handler_init_class</phrase></refentrytitle>
49126 <manvolnum>9</manvolnum>
49127 <refmiscinfo class="version">4.4.14</refmiscinfo>
49128</refmeta>
49129<refnamediv>
49130 <refname>v4l2_ctrl_handler_init_class</refname>
49131 <refpurpose>
49132     Initialize the control handler.
49133 </refpurpose>
49134</refnamediv>
49135<refsynopsisdiv>
49136 <title>Synopsis</title>
49137  <funcsynopsis><funcprototype>
49138   <funcdef>int <function>v4l2_ctrl_handler_init_class </function></funcdef>
49139   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49140   <paramdef>unsigned <parameter>nr_of_controls_hint</parameter></paramdef>
49141   <paramdef>struct lock_class_key * <parameter>key</parameter></paramdef>
49142   <paramdef>const char * <parameter>name</parameter></paramdef>
49143  </funcprototype></funcsynopsis>
49144</refsynopsisdiv>
49145<refsect1>
49146 <title>Arguments</title>
49147 <variablelist>
49148  <varlistentry>
49149   <term><parameter>hdl</parameter></term>
49150   <listitem>
49151    <para>
49152     The control handler.
49153    </para>
49154   </listitem>
49155  </varlistentry>
49156  <varlistentry>
49157   <term><parameter>nr_of_controls_hint</parameter></term>
49158   <listitem>
49159    <para>
49160     A hint of how many controls this handler is
49161     expected to refer to. This is the total number, so including
49162     any inherited controls. It doesn't have to be precise, but if
49163     it is way off, then you either waste memory (too many buckets
49164     are allocated) or the control lookup becomes slower (not enough
49165     buckets are allocated, so there are more slow list lookups).
49166     It will always work, though.
49167    </para>
49168   </listitem>
49169  </varlistentry>
49170  <varlistentry>
49171   <term><parameter>key</parameter></term>
49172   <listitem>
49173    <para>
49174     Used by the lock validator if CONFIG_LOCKDEP is set.
49175    </para>
49176   </listitem>
49177  </varlistentry>
49178  <varlistentry>
49179   <term><parameter>name</parameter></term>
49180   <listitem>
49181    <para>
49182     Used by the lock validator if CONFIG_LOCKDEP is set.
49183    </para>
49184   </listitem>
49185  </varlistentry>
49186 </variablelist>
49187</refsect1>
49188<refsect1>
49189<title>Description</title>
49190<para>
49191   Returns an error if the buckets could not be allocated. This error will
49192   also be stored in <parameter>hdl</parameter>-&gt;error.
49193   </para><para>
49194
49195   Never use this call directly, always use the v4l2_ctrl_handler_init
49196   macro that hides the <parameter>key</parameter> and <parameter>name</parameter> arguments.
49197</para>
49198</refsect1>
49199</refentry>
49200
49201<refentry id="API-v4l2-ctrl-handler-free">
49202<refentryinfo>
49203 <title>LINUX</title>
49204 <productname>Kernel Hackers Manual</productname>
49205 <date>July 2017</date>
49206</refentryinfo>
49207<refmeta>
49208 <refentrytitle><phrase>v4l2_ctrl_handler_free</phrase></refentrytitle>
49209 <manvolnum>9</manvolnum>
49210 <refmiscinfo class="version">4.4.14</refmiscinfo>
49211</refmeta>
49212<refnamediv>
49213 <refname>v4l2_ctrl_handler_free</refname>
49214 <refpurpose>
49215     Free all controls owned by the handler and free the control list.
49216 </refpurpose>
49217</refnamediv>
49218<refsynopsisdiv>
49219 <title>Synopsis</title>
49220  <funcsynopsis><funcprototype>
49221   <funcdef>void <function>v4l2_ctrl_handler_free </function></funcdef>
49222   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49223  </funcprototype></funcsynopsis>
49224</refsynopsisdiv>
49225<refsect1>
49226 <title>Arguments</title>
49227 <variablelist>
49228  <varlistentry>
49229   <term><parameter>hdl</parameter></term>
49230   <listitem>
49231    <para>
49232     The control handler.
49233    </para>
49234   </listitem>
49235  </varlistentry>
49236 </variablelist>
49237</refsect1>
49238<refsect1>
49239<title>Description</title>
49240<para>
49241   Does nothing if <parameter>hdl</parameter> == NULL.
49242</para>
49243</refsect1>
49244</refentry>
49245
49246<refentry id="API-v4l2-ctrl-lock">
49247<refentryinfo>
49248 <title>LINUX</title>
49249 <productname>Kernel Hackers Manual</productname>
49250 <date>July 2017</date>
49251</refentryinfo>
49252<refmeta>
49253 <refentrytitle><phrase>v4l2_ctrl_lock</phrase></refentrytitle>
49254 <manvolnum>9</manvolnum>
49255 <refmiscinfo class="version">4.4.14</refmiscinfo>
49256</refmeta>
49257<refnamediv>
49258 <refname>v4l2_ctrl_lock</refname>
49259 <refpurpose>
49260     Helper function to lock the handler associated with the control.
49261 </refpurpose>
49262</refnamediv>
49263<refsynopsisdiv>
49264 <title>Synopsis</title>
49265  <funcsynopsis><funcprototype>
49266   <funcdef>void <function>v4l2_ctrl_lock </function></funcdef>
49267   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
49268  </funcprototype></funcsynopsis>
49269</refsynopsisdiv>
49270<refsect1>
49271 <title>Arguments</title>
49272 <variablelist>
49273  <varlistentry>
49274   <term><parameter>ctrl</parameter></term>
49275   <listitem>
49276    <para>
49277     The control to lock.
49278    </para>
49279   </listitem>
49280  </varlistentry>
49281 </variablelist>
49282</refsect1>
49283</refentry>
49284
49285<refentry id="API-v4l2-ctrl-unlock">
49286<refentryinfo>
49287 <title>LINUX</title>
49288 <productname>Kernel Hackers Manual</productname>
49289 <date>July 2017</date>
49290</refentryinfo>
49291<refmeta>
49292 <refentrytitle><phrase>v4l2_ctrl_unlock</phrase></refentrytitle>
49293 <manvolnum>9</manvolnum>
49294 <refmiscinfo class="version">4.4.14</refmiscinfo>
49295</refmeta>
49296<refnamediv>
49297 <refname>v4l2_ctrl_unlock</refname>
49298 <refpurpose>
49299     Helper function to unlock the handler associated with the control.
49300 </refpurpose>
49301</refnamediv>
49302<refsynopsisdiv>
49303 <title>Synopsis</title>
49304  <funcsynopsis><funcprototype>
49305   <funcdef>void <function>v4l2_ctrl_unlock </function></funcdef>
49306   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
49307  </funcprototype></funcsynopsis>
49308</refsynopsisdiv>
49309<refsect1>
49310 <title>Arguments</title>
49311 <variablelist>
49312  <varlistentry>
49313   <term><parameter>ctrl</parameter></term>
49314   <listitem>
49315    <para>
49316     The control to unlock.
49317    </para>
49318   </listitem>
49319  </varlistentry>
49320 </variablelist>
49321</refsect1>
49322</refentry>
49323
49324<refentry id="API-v4l2-ctrl-handler-setup">
49325<refentryinfo>
49326 <title>LINUX</title>
49327 <productname>Kernel Hackers Manual</productname>
49328 <date>July 2017</date>
49329</refentryinfo>
49330<refmeta>
49331 <refentrytitle><phrase>v4l2_ctrl_handler_setup</phrase></refentrytitle>
49332 <manvolnum>9</manvolnum>
49333 <refmiscinfo class="version">4.4.14</refmiscinfo>
49334</refmeta>
49335<refnamediv>
49336 <refname>v4l2_ctrl_handler_setup</refname>
49337 <refpurpose>
49338     Call the s_ctrl op for all controls belonging to the handler to initialize the hardware to the current control values.
49339 </refpurpose>
49340</refnamediv>
49341<refsynopsisdiv>
49342 <title>Synopsis</title>
49343  <funcsynopsis><funcprototype>
49344   <funcdef>int <function>v4l2_ctrl_handler_setup </function></funcdef>
49345   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49346  </funcprototype></funcsynopsis>
49347</refsynopsisdiv>
49348<refsect1>
49349 <title>Arguments</title>
49350 <variablelist>
49351  <varlistentry>
49352   <term><parameter>hdl</parameter></term>
49353   <listitem>
49354    <para>
49355     The control handler.
49356    </para>
49357   </listitem>
49358  </varlistentry>
49359 </variablelist>
49360</refsect1>
49361<refsect1>
49362<title>Description</title>
49363<para>
49364   Button controls will be skipped, as are read-only controls.
49365   </para><para>
49366
49367   If <parameter>hdl</parameter> == NULL, then this just returns 0.
49368</para>
49369</refsect1>
49370</refentry>
49371
49372<refentry id="API-v4l2-ctrl-handler-log-status">
49373<refentryinfo>
49374 <title>LINUX</title>
49375 <productname>Kernel Hackers Manual</productname>
49376 <date>July 2017</date>
49377</refentryinfo>
49378<refmeta>
49379 <refentrytitle><phrase>v4l2_ctrl_handler_log_status</phrase></refentrytitle>
49380 <manvolnum>9</manvolnum>
49381 <refmiscinfo class="version">4.4.14</refmiscinfo>
49382</refmeta>
49383<refnamediv>
49384 <refname>v4l2_ctrl_handler_log_status</refname>
49385 <refpurpose>
49386     Log all controls owned by the handler.
49387 </refpurpose>
49388</refnamediv>
49389<refsynopsisdiv>
49390 <title>Synopsis</title>
49391  <funcsynopsis><funcprototype>
49392   <funcdef>void <function>v4l2_ctrl_handler_log_status </function></funcdef>
49393   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49394   <paramdef>const char * <parameter>prefix</parameter></paramdef>
49395  </funcprototype></funcsynopsis>
49396</refsynopsisdiv>
49397<refsect1>
49398 <title>Arguments</title>
49399 <variablelist>
49400  <varlistentry>
49401   <term><parameter>hdl</parameter></term>
49402   <listitem>
49403    <para>
49404     The control handler.
49405    </para>
49406   </listitem>
49407  </varlistentry>
49408  <varlistentry>
49409   <term><parameter>prefix</parameter></term>
49410   <listitem>
49411    <para>
49412     The prefix to use when logging the control values. If the
49413     prefix does not end with a space, then <quote>: </quote> will be added
49414     after the prefix. If <parameter>prefix</parameter> == NULL, then no prefix will be
49415     used.
49416    </para>
49417   </listitem>
49418  </varlistentry>
49419 </variablelist>
49420</refsect1>
49421<refsect1>
49422<title>Description</title>
49423<para>
49424   For use with VIDIOC_LOG_STATUS.
49425   </para><para>
49426
49427   Does nothing if <parameter>hdl</parameter> == NULL.
49428</para>
49429</refsect1>
49430</refentry>
49431
49432<refentry id="API-v4l2-ctrl-new-custom">
49433<refentryinfo>
49434 <title>LINUX</title>
49435 <productname>Kernel Hackers Manual</productname>
49436 <date>July 2017</date>
49437</refentryinfo>
49438<refmeta>
49439 <refentrytitle><phrase>v4l2_ctrl_new_custom</phrase></refentrytitle>
49440 <manvolnum>9</manvolnum>
49441 <refmiscinfo class="version">4.4.14</refmiscinfo>
49442</refmeta>
49443<refnamediv>
49444 <refname>v4l2_ctrl_new_custom</refname>
49445 <refpurpose>
49446     Allocate and initialize a new custom V4L2 control.
49447 </refpurpose>
49448</refnamediv>
49449<refsynopsisdiv>
49450 <title>Synopsis</title>
49451  <funcsynopsis><funcprototype>
49452   <funcdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <function>v4l2_ctrl_new_custom </function></funcdef>
49453   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49454   <paramdef><link linkend="API-struct-v4l2-ctrl-config">const struct v4l2_ctrl_config</link> * <parameter>cfg</parameter></paramdef>
49455   <paramdef>void * <parameter>priv</parameter></paramdef>
49456  </funcprototype></funcsynopsis>
49457</refsynopsisdiv>
49458<refsect1>
49459 <title>Arguments</title>
49460 <variablelist>
49461  <varlistentry>
49462   <term><parameter>hdl</parameter></term>
49463   <listitem>
49464    <para>
49465     The control handler.
49466    </para>
49467   </listitem>
49468  </varlistentry>
49469  <varlistentry>
49470   <term><parameter>cfg</parameter></term>
49471   <listitem>
49472    <para>
49473     The control's configuration data.
49474    </para>
49475   </listitem>
49476  </varlistentry>
49477  <varlistentry>
49478   <term><parameter>priv</parameter></term>
49479   <listitem>
49480    <para>
49481     The control's driver-specific private data.
49482    </para>
49483   </listitem>
49484  </varlistentry>
49485 </variablelist>
49486</refsect1>
49487<refsect1>
49488<title>Description</title>
49489<para>
49490   If the <structname><link linkend="API-struct-v4l2-ctrl">v4l2_ctrl</link></structname> struct could not be allocated then NULL is returned
49491   and <parameter>hdl</parameter>-&gt;error is set to the error code (if it wasn't set already).
49492</para>
49493</refsect1>
49494</refentry>
49495
49496<refentry id="API-v4l2-ctrl-new-std">
49497<refentryinfo>
49498 <title>LINUX</title>
49499 <productname>Kernel Hackers Manual</productname>
49500 <date>July 2017</date>
49501</refentryinfo>
49502<refmeta>
49503 <refentrytitle><phrase>v4l2_ctrl_new_std</phrase></refentrytitle>
49504 <manvolnum>9</manvolnum>
49505 <refmiscinfo class="version">4.4.14</refmiscinfo>
49506</refmeta>
49507<refnamediv>
49508 <refname>v4l2_ctrl_new_std</refname>
49509 <refpurpose>
49510     Allocate and initialize a new standard V4L2 non-menu control.
49511 </refpurpose>
49512</refnamediv>
49513<refsynopsisdiv>
49514 <title>Synopsis</title>
49515  <funcsynopsis><funcprototype>
49516   <funcdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <function>v4l2_ctrl_new_std </function></funcdef>
49517   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49518   <paramdef><link linkend="API-struct-v4l2-ctrl-ops">const struct v4l2_ctrl_ops</link> * <parameter>ops</parameter></paramdef>
49519   <paramdef>u32 <parameter>id</parameter></paramdef>
49520   <paramdef>s64 <parameter>min</parameter></paramdef>
49521   <paramdef>s64 <parameter>max</parameter></paramdef>
49522   <paramdef>u64 <parameter>step</parameter></paramdef>
49523   <paramdef>s64 <parameter>def</parameter></paramdef>
49524  </funcprototype></funcsynopsis>
49525</refsynopsisdiv>
49526<refsect1>
49527 <title>Arguments</title>
49528 <variablelist>
49529  <varlistentry>
49530   <term><parameter>hdl</parameter></term>
49531   <listitem>
49532    <para>
49533     The control handler.
49534    </para>
49535   </listitem>
49536  </varlistentry>
49537  <varlistentry>
49538   <term><parameter>ops</parameter></term>
49539   <listitem>
49540    <para>
49541     The control ops.
49542    </para>
49543   </listitem>
49544  </varlistentry>
49545  <varlistentry>
49546   <term><parameter>id</parameter></term>
49547   <listitem>
49548    <para>
49549     The control ID.
49550    </para>
49551   </listitem>
49552  </varlistentry>
49553  <varlistentry>
49554   <term><parameter>min</parameter></term>
49555   <listitem>
49556    <para>
49557     The control's minimum value.
49558    </para>
49559   </listitem>
49560  </varlistentry>
49561  <varlistentry>
49562   <term><parameter>max</parameter></term>
49563   <listitem>
49564    <para>
49565     The control's maximum value.
49566    </para>
49567   </listitem>
49568  </varlistentry>
49569  <varlistentry>
49570   <term><parameter>step</parameter></term>
49571   <listitem>
49572    <para>
49573     The control's step value
49574    </para>
49575   </listitem>
49576  </varlistentry>
49577  <varlistentry>
49578   <term><parameter>def</parameter></term>
49579   <listitem>
49580    <para>
49581     The control's default value.
49582    </para>
49583   </listitem>
49584  </varlistentry>
49585 </variablelist>
49586</refsect1>
49587<refsect1>
49588<title>Description</title>
49589<para>
49590   If the <structname><link linkend="API-struct-v4l2-ctrl">v4l2_ctrl</link></structname> struct could not be allocated, or the control
49591   ID is not known, then NULL is returned and <parameter>hdl</parameter>-&gt;error is set to the
49592   appropriate error code (if it wasn't set already).
49593   </para><para>
49594
49595   If <parameter>id</parameter> refers to a menu control, then this function will return NULL.
49596   </para><para>
49597
49598   Use <function><link linkend="API-v4l2-ctrl-new-std-menu">v4l2_ctrl_new_std_menu</link></function> when adding menu controls.
49599</para>
49600</refsect1>
49601</refentry>
49602
49603<refentry id="API-v4l2-ctrl-new-std-menu">
49604<refentryinfo>
49605 <title>LINUX</title>
49606 <productname>Kernel Hackers Manual</productname>
49607 <date>July 2017</date>
49608</refentryinfo>
49609<refmeta>
49610 <refentrytitle><phrase>v4l2_ctrl_new_std_menu</phrase></refentrytitle>
49611 <manvolnum>9</manvolnum>
49612 <refmiscinfo class="version">4.4.14</refmiscinfo>
49613</refmeta>
49614<refnamediv>
49615 <refname>v4l2_ctrl_new_std_menu</refname>
49616 <refpurpose>
49617     Allocate and initialize a new standard V4L2 menu control.
49618 </refpurpose>
49619</refnamediv>
49620<refsynopsisdiv>
49621 <title>Synopsis</title>
49622  <funcsynopsis><funcprototype>
49623   <funcdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <function>v4l2_ctrl_new_std_menu </function></funcdef>
49624   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49625   <paramdef><link linkend="API-struct-v4l2-ctrl-ops">const struct v4l2_ctrl_ops</link> * <parameter>ops</parameter></paramdef>
49626   <paramdef>u32 <parameter>id</parameter></paramdef>
49627   <paramdef>u8 <parameter>max</parameter></paramdef>
49628   <paramdef>u64 <parameter>mask</parameter></paramdef>
49629   <paramdef>u8 <parameter>def</parameter></paramdef>
49630  </funcprototype></funcsynopsis>
49631</refsynopsisdiv>
49632<refsect1>
49633 <title>Arguments</title>
49634 <variablelist>
49635  <varlistentry>
49636   <term><parameter>hdl</parameter></term>
49637   <listitem>
49638    <para>
49639     The control handler.
49640    </para>
49641   </listitem>
49642  </varlistentry>
49643  <varlistentry>
49644   <term><parameter>ops</parameter></term>
49645   <listitem>
49646    <para>
49647     The control ops.
49648    </para>
49649   </listitem>
49650  </varlistentry>
49651  <varlistentry>
49652   <term><parameter>id</parameter></term>
49653   <listitem>
49654    <para>
49655     The control ID.
49656    </para>
49657   </listitem>
49658  </varlistentry>
49659  <varlistentry>
49660   <term><parameter>max</parameter></term>
49661   <listitem>
49662    <para>
49663     The control's maximum value.
49664    </para>
49665   </listitem>
49666  </varlistentry>
49667  <varlistentry>
49668   <term><parameter>mask</parameter></term>
49669   <listitem>
49670    <para>
49671     The control's skip mask for menu controls. This makes it
49672     easy to skip menu items that are not valid. If bit X is set,
49673     then menu item X is skipped. Of course, this only works for
49674     menus with &lt;= 64 menu items. There are no menus that come
49675     close to that number, so this is OK. Should we ever need more,
49676     then this will have to be extended to a bit array.
49677    </para>
49678   </listitem>
49679  </varlistentry>
49680  <varlistentry>
49681   <term><parameter>def</parameter></term>
49682   <listitem>
49683    <para>
49684     The control's default value.
49685    </para>
49686   </listitem>
49687  </varlistentry>
49688 </variablelist>
49689</refsect1>
49690<refsect1>
49691<title>Description</title>
49692<para>
49693   Same as <function><link linkend="API-v4l2-ctrl-new-std">v4l2_ctrl_new_std</link></function>, but <parameter>min</parameter> is set to 0 and the <parameter>mask</parameter> value
49694   determines which menu items are to be skipped.
49695   </para><para>
49696
49697   If <parameter>id</parameter> refers to a non-menu control, then this function will return NULL.
49698</para>
49699</refsect1>
49700</refentry>
49701
49702<refentry id="API-v4l2-ctrl-new-std-menu-items">
49703<refentryinfo>
49704 <title>LINUX</title>
49705 <productname>Kernel Hackers Manual</productname>
49706 <date>July 2017</date>
49707</refentryinfo>
49708<refmeta>
49709 <refentrytitle><phrase>v4l2_ctrl_new_std_menu_items</phrase></refentrytitle>
49710 <manvolnum>9</manvolnum>
49711 <refmiscinfo class="version">4.4.14</refmiscinfo>
49712</refmeta>
49713<refnamediv>
49714 <refname>v4l2_ctrl_new_std_menu_items</refname>
49715 <refpurpose>
49716     Create a new standard V4L2 menu control with driver specific menu.
49717 </refpurpose>
49718</refnamediv>
49719<refsynopsisdiv>
49720 <title>Synopsis</title>
49721  <funcsynopsis><funcprototype>
49722   <funcdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <function>v4l2_ctrl_new_std_menu_items </function></funcdef>
49723   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49724   <paramdef><link linkend="API-struct-v4l2-ctrl-ops">const struct v4l2_ctrl_ops</link> * <parameter>ops</parameter></paramdef>
49725   <paramdef>u32 <parameter>id</parameter></paramdef>
49726   <paramdef>u8 <parameter>max</parameter></paramdef>
49727   <paramdef>u64 <parameter>mask</parameter></paramdef>
49728   <paramdef>u8 <parameter>def</parameter></paramdef>
49729   <paramdef>const char *const * <parameter>qmenu</parameter></paramdef>
49730  </funcprototype></funcsynopsis>
49731</refsynopsisdiv>
49732<refsect1>
49733 <title>Arguments</title>
49734 <variablelist>
49735  <varlistentry>
49736   <term><parameter>hdl</parameter></term>
49737   <listitem>
49738    <para>
49739     The control handler.
49740    </para>
49741   </listitem>
49742  </varlistentry>
49743  <varlistentry>
49744   <term><parameter>ops</parameter></term>
49745   <listitem>
49746    <para>
49747     The control ops.
49748    </para>
49749   </listitem>
49750  </varlistentry>
49751  <varlistentry>
49752   <term><parameter>id</parameter></term>
49753   <listitem>
49754    <para>
49755     The control ID.
49756    </para>
49757   </listitem>
49758  </varlistentry>
49759  <varlistentry>
49760   <term><parameter>max</parameter></term>
49761   <listitem>
49762    <para>
49763     The control's maximum value.
49764    </para>
49765   </listitem>
49766  </varlistentry>
49767  <varlistentry>
49768   <term><parameter>mask</parameter></term>
49769   <listitem>
49770    <para>
49771     The control's skip mask for menu controls. This makes it
49772     easy to skip menu items that are not valid. If bit X is set,
49773     then menu item X is skipped. Of course, this only works for
49774     menus with &lt;= 64 menu items. There are no menus that come
49775     close to that number, so this is OK. Should we ever need more,
49776     then this will have to be extended to a bit array.
49777    </para>
49778   </listitem>
49779  </varlistentry>
49780  <varlistentry>
49781   <term><parameter>def</parameter></term>
49782   <listitem>
49783    <para>
49784     The control's default value.
49785    </para>
49786   </listitem>
49787  </varlistentry>
49788  <varlistentry>
49789   <term><parameter>qmenu</parameter></term>
49790   <listitem>
49791    <para>
49792     The new menu.
49793    </para>
49794   </listitem>
49795  </varlistentry>
49796 </variablelist>
49797</refsect1>
49798<refsect1>
49799<title>Description</title>
49800<para>
49801   Same as <function><link linkend="API-v4l2-ctrl-new-std-menu">v4l2_ctrl_new_std_menu</link></function>, but <parameter>qmenu</parameter> will be the driver specific
49802   menu of this control.
49803</para>
49804</refsect1>
49805</refentry>
49806
49807<refentry id="API-v4l2-ctrl-new-int-menu">
49808<refentryinfo>
49809 <title>LINUX</title>
49810 <productname>Kernel Hackers Manual</productname>
49811 <date>July 2017</date>
49812</refentryinfo>
49813<refmeta>
49814 <refentrytitle><phrase>v4l2_ctrl_new_int_menu</phrase></refentrytitle>
49815 <manvolnum>9</manvolnum>
49816 <refmiscinfo class="version">4.4.14</refmiscinfo>
49817</refmeta>
49818<refnamediv>
49819 <refname>v4l2_ctrl_new_int_menu</refname>
49820 <refpurpose>
49821     Create a new standard V4L2 integer menu control.
49822 </refpurpose>
49823</refnamediv>
49824<refsynopsisdiv>
49825 <title>Synopsis</title>
49826  <funcsynopsis><funcprototype>
49827   <funcdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <function>v4l2_ctrl_new_int_menu </function></funcdef>
49828   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49829   <paramdef><link linkend="API-struct-v4l2-ctrl-ops">const struct v4l2_ctrl_ops</link> * <parameter>ops</parameter></paramdef>
49830   <paramdef>u32 <parameter>id</parameter></paramdef>
49831   <paramdef>u8 <parameter>max</parameter></paramdef>
49832   <paramdef>u8 <parameter>def</parameter></paramdef>
49833   <paramdef>const s64 * <parameter>qmenu_int</parameter></paramdef>
49834  </funcprototype></funcsynopsis>
49835</refsynopsisdiv>
49836<refsect1>
49837 <title>Arguments</title>
49838 <variablelist>
49839  <varlistentry>
49840   <term><parameter>hdl</parameter></term>
49841   <listitem>
49842    <para>
49843     The control handler.
49844    </para>
49845   </listitem>
49846  </varlistentry>
49847  <varlistentry>
49848   <term><parameter>ops</parameter></term>
49849   <listitem>
49850    <para>
49851     The control ops.
49852    </para>
49853   </listitem>
49854  </varlistentry>
49855  <varlistentry>
49856   <term><parameter>id</parameter></term>
49857   <listitem>
49858    <para>
49859     The control ID.
49860    </para>
49861   </listitem>
49862  </varlistentry>
49863  <varlistentry>
49864   <term><parameter>max</parameter></term>
49865   <listitem>
49866    <para>
49867     The control's maximum value.
49868    </para>
49869   </listitem>
49870  </varlistentry>
49871  <varlistentry>
49872   <term><parameter>def</parameter></term>
49873   <listitem>
49874    <para>
49875     The control's default value.
49876    </para>
49877   </listitem>
49878  </varlistentry>
49879  <varlistentry>
49880   <term><parameter>qmenu_int</parameter></term>
49881   <listitem>
49882    <para>
49883     The control's menu entries.
49884    </para>
49885   </listitem>
49886  </varlistentry>
49887 </variablelist>
49888</refsect1>
49889<refsect1>
49890<title>Description</title>
49891<para>
49892   Same as <function><link linkend="API-v4l2-ctrl-new-std-menu">v4l2_ctrl_new_std_menu</link></function>, but <parameter>mask</parameter> is set to 0 and it additionaly
49893   takes as an argument an array of integers determining the menu items.
49894   </para><para>
49895
49896   If <parameter>id</parameter> refers to a non-integer-menu control, then this function will return NULL.
49897</para>
49898</refsect1>
49899</refentry>
49900
49901<refentry id="API-v4l2-ctrl-add-ctrl">
49902<refentryinfo>
49903 <title>LINUX</title>
49904 <productname>Kernel Hackers Manual</productname>
49905 <date>July 2017</date>
49906</refentryinfo>
49907<refmeta>
49908 <refentrytitle><phrase>v4l2_ctrl_add_ctrl</phrase></refentrytitle>
49909 <manvolnum>9</manvolnum>
49910 <refmiscinfo class="version">4.4.14</refmiscinfo>
49911</refmeta>
49912<refnamediv>
49913 <refname>v4l2_ctrl_add_ctrl</refname>
49914 <refpurpose>
49915     Add a control from another handler to this handler.
49916 </refpurpose>
49917</refnamediv>
49918<refsynopsisdiv>
49919 <title>Synopsis</title>
49920  <funcsynopsis><funcprototype>
49921   <funcdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <function>v4l2_ctrl_add_ctrl </function></funcdef>
49922   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49923   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
49924  </funcprototype></funcsynopsis>
49925</refsynopsisdiv>
49926<refsect1>
49927 <title>Arguments</title>
49928 <variablelist>
49929  <varlistentry>
49930   <term><parameter>hdl</parameter></term>
49931   <listitem>
49932    <para>
49933     The control handler.
49934    </para>
49935   </listitem>
49936  </varlistentry>
49937  <varlistentry>
49938   <term><parameter>ctrl</parameter></term>
49939   <listitem>
49940    <para>
49941     The control to add.
49942    </para>
49943   </listitem>
49944  </varlistentry>
49945 </variablelist>
49946</refsect1>
49947<refsect1>
49948<title>Description</title>
49949<para>
49950   It will return NULL if it was unable to add the control reference.
49951   If the control already belonged to the handler, then it will do
49952   nothing and just return <parameter>ctrl</parameter>.
49953</para>
49954</refsect1>
49955</refentry>
49956
49957<refentry id="API-v4l2-ctrl-add-handler">
49958<refentryinfo>
49959 <title>LINUX</title>
49960 <productname>Kernel Hackers Manual</productname>
49961 <date>July 2017</date>
49962</refentryinfo>
49963<refmeta>
49964 <refentrytitle><phrase>v4l2_ctrl_add_handler</phrase></refentrytitle>
49965 <manvolnum>9</manvolnum>
49966 <refmiscinfo class="version">4.4.14</refmiscinfo>
49967</refmeta>
49968<refnamediv>
49969 <refname>v4l2_ctrl_add_handler</refname>
49970 <refpurpose>
49971     Add all controls from handler <parameter>add</parameter> to handler <parameter>hdl</parameter>.
49972 </refpurpose>
49973</refnamediv>
49974<refsynopsisdiv>
49975 <title>Synopsis</title>
49976  <funcsynopsis><funcprototype>
49977   <funcdef>int <function>v4l2_ctrl_add_handler </function></funcdef>
49978   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
49979   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>add</parameter></paramdef>
49980   <paramdef>bool (*<parameter>filter</parameter>)
49981     <funcparams>const struct v4l2_ctrl *ctrl</funcparams></paramdef>
49982  </funcprototype></funcsynopsis>
49983</refsynopsisdiv>
49984<refsect1>
49985 <title>Arguments</title>
49986 <variablelist>
49987  <varlistentry>
49988   <term><parameter>hdl</parameter></term>
49989   <listitem>
49990    <para>
49991     The control handler.
49992    </para>
49993   </listitem>
49994  </varlistentry>
49995  <varlistentry>
49996   <term><parameter>add</parameter></term>
49997   <listitem>
49998    <para>
49999     The control handler whose controls you want to add to
50000     the <parameter>hdl</parameter> control handler.
50001    </para>
50002   </listitem>
50003  </varlistentry>
50004  <varlistentry>
50005   <term><parameter>filter</parameter></term>
50006   <listitem>
50007    <para>
50008     This function will filter which controls should be added.
50009    </para>
50010   </listitem>
50011  </varlistentry>
50012 </variablelist>
50013</refsect1>
50014<refsect1>
50015<title>Description</title>
50016<para>
50017   Does nothing if either of the two handlers is a NULL pointer.
50018   If <parameter>filter</parameter> is NULL, then all controls are added. Otherwise only those
50019   controls for which <parameter>filter</parameter> returns true will be added.
50020   In case of an error <parameter>hdl</parameter>-&gt;error will be set to the error code (if it
50021   wasn't set already).
50022</para>
50023</refsect1>
50024</refentry>
50025
50026<refentry id="API-v4l2-ctrl-radio-filter">
50027<refentryinfo>
50028 <title>LINUX</title>
50029 <productname>Kernel Hackers Manual</productname>
50030 <date>July 2017</date>
50031</refentryinfo>
50032<refmeta>
50033 <refentrytitle><phrase>v4l2_ctrl_radio_filter</phrase></refentrytitle>
50034 <manvolnum>9</manvolnum>
50035 <refmiscinfo class="version">4.4.14</refmiscinfo>
50036</refmeta>
50037<refnamediv>
50038 <refname>v4l2_ctrl_radio_filter</refname>
50039 <refpurpose>
50040     Standard filter for radio controls.
50041 </refpurpose>
50042</refnamediv>
50043<refsynopsisdiv>
50044 <title>Synopsis</title>
50045  <funcsynopsis><funcprototype>
50046   <funcdef>bool <function>v4l2_ctrl_radio_filter </function></funcdef>
50047   <paramdef><link linkend="API-struct-v4l2-ctrl">const struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50048  </funcprototype></funcsynopsis>
50049</refsynopsisdiv>
50050<refsect1>
50051 <title>Arguments</title>
50052 <variablelist>
50053  <varlistentry>
50054   <term><parameter>ctrl</parameter></term>
50055   <listitem>
50056    <para>
50057     The control that is filtered.
50058    </para>
50059   </listitem>
50060  </varlistentry>
50061 </variablelist>
50062</refsect1>
50063<refsect1>
50064<title>Description</title>
50065<para>
50066   This will return true for any controls that are valid for radio device
50067   nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
50068   transmitter class controls.
50069   </para><para>
50070
50071   This function is to be used with <function><link linkend="API-v4l2-ctrl-add-handler">v4l2_ctrl_add_handler</link></function>.
50072</para>
50073</refsect1>
50074</refentry>
50075
50076<refentry id="API-v4l2-ctrl-cluster">
50077<refentryinfo>
50078 <title>LINUX</title>
50079 <productname>Kernel Hackers Manual</productname>
50080 <date>July 2017</date>
50081</refentryinfo>
50082<refmeta>
50083 <refentrytitle><phrase>v4l2_ctrl_cluster</phrase></refentrytitle>
50084 <manvolnum>9</manvolnum>
50085 <refmiscinfo class="version">4.4.14</refmiscinfo>
50086</refmeta>
50087<refnamediv>
50088 <refname>v4l2_ctrl_cluster</refname>
50089 <refpurpose>
50090     Mark all controls in the cluster as belonging to that cluster.
50091 </refpurpose>
50092</refnamediv>
50093<refsynopsisdiv>
50094 <title>Synopsis</title>
50095  <funcsynopsis><funcprototype>
50096   <funcdef>void <function>v4l2_ctrl_cluster </function></funcdef>
50097   <paramdef>unsigned <parameter>ncontrols</parameter></paramdef>
50098   <paramdef>struct v4l2_ctrl ** <parameter>controls</parameter></paramdef>
50099  </funcprototype></funcsynopsis>
50100</refsynopsisdiv>
50101<refsect1>
50102 <title>Arguments</title>
50103 <variablelist>
50104  <varlistentry>
50105   <term><parameter>ncontrols</parameter></term>
50106   <listitem>
50107    <para>
50108     The number of controls in this cluster.
50109    </para>
50110   </listitem>
50111  </varlistentry>
50112  <varlistentry>
50113   <term><parameter>controls</parameter></term>
50114   <listitem>
50115    <para>
50116     The cluster control array of size <parameter>ncontrols</parameter>.
50117    </para>
50118   </listitem>
50119  </varlistentry>
50120 </variablelist>
50121</refsect1>
50122</refentry>
50123
50124<refentry id="API-v4l2-ctrl-auto-cluster">
50125<refentryinfo>
50126 <title>LINUX</title>
50127 <productname>Kernel Hackers Manual</productname>
50128 <date>July 2017</date>
50129</refentryinfo>
50130<refmeta>
50131 <refentrytitle><phrase>v4l2_ctrl_auto_cluster</phrase></refentrytitle>
50132 <manvolnum>9</manvolnum>
50133 <refmiscinfo class="version">4.4.14</refmiscinfo>
50134</refmeta>
50135<refnamediv>
50136 <refname>v4l2_ctrl_auto_cluster</refname>
50137 <refpurpose>
50138     Mark all controls in the cluster as belonging to that cluster and set it up for autofoo/foo-type handling.
50139 </refpurpose>
50140</refnamediv>
50141<refsynopsisdiv>
50142 <title>Synopsis</title>
50143  <funcsynopsis><funcprototype>
50144   <funcdef>void <function>v4l2_ctrl_auto_cluster </function></funcdef>
50145   <paramdef>unsigned <parameter>ncontrols</parameter></paramdef>
50146   <paramdef>struct v4l2_ctrl ** <parameter>controls</parameter></paramdef>
50147   <paramdef>u8 <parameter>manual_val</parameter></paramdef>
50148   <paramdef>bool <parameter>set_volatile</parameter></paramdef>
50149  </funcprototype></funcsynopsis>
50150</refsynopsisdiv>
50151<refsect1>
50152 <title>Arguments</title>
50153 <variablelist>
50154  <varlistentry>
50155   <term><parameter>ncontrols</parameter></term>
50156   <listitem>
50157    <para>
50158     The number of controls in this cluster.
50159    </para>
50160   </listitem>
50161  </varlistentry>
50162  <varlistentry>
50163   <term><parameter>controls</parameter></term>
50164   <listitem>
50165    <para>
50166     The cluster control array of size <parameter>ncontrols</parameter>. The first control
50167     must be the 'auto' control (e.g. autogain, autoexposure, etc.)
50168    </para>
50169   </listitem>
50170  </varlistentry>
50171  <varlistentry>
50172   <term><parameter>manual_val</parameter></term>
50173   <listitem>
50174    <para>
50175     The value for the first control in the cluster that equals the
50176     manual setting.
50177    </para>
50178   </listitem>
50179  </varlistentry>
50180  <varlistentry>
50181   <term><parameter>set_volatile</parameter></term>
50182   <listitem>
50183    <para>
50184     If true, then all controls except the first auto control will
50185     be volatile.
50186    </para>
50187   </listitem>
50188  </varlistentry>
50189 </variablelist>
50190</refsect1>
50191<refsect1>
50192<title>Description</title>
50193<para>
50194   Use for control groups where one control selects some automatic feature and
50195   the other controls are only active whenever the automatic feature is turned
50196   off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
50197   red and blue balance, etc.
50198</para>
50199</refsect1>
50200<refsect1>
50201<title>The behavior of such controls is as follows</title>
50202<para>
50203   </para><para>
50204
50205   When the autofoo control is set to automatic, then any manual controls
50206   are set to inactive and any reads will call g_volatile_ctrl (if the control
50207   was marked volatile).
50208   </para><para>
50209
50210   When the autofoo control is set to manual, then any manual controls will
50211   be marked active, and any reads will just return the current value without
50212   going through g_volatile_ctrl.
50213   </para><para>
50214
50215   In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag
50216   on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
50217   if autofoo is in auto mode.
50218</para>
50219</refsect1>
50220</refentry>
50221
50222<refentry id="API-v4l2-ctrl-find">
50223<refentryinfo>
50224 <title>LINUX</title>
50225 <productname>Kernel Hackers Manual</productname>
50226 <date>July 2017</date>
50227</refentryinfo>
50228<refmeta>
50229 <refentrytitle><phrase>v4l2_ctrl_find</phrase></refentrytitle>
50230 <manvolnum>9</manvolnum>
50231 <refmiscinfo class="version">4.4.14</refmiscinfo>
50232</refmeta>
50233<refnamediv>
50234 <refname>v4l2_ctrl_find</refname>
50235 <refpurpose>
50236     Find a control with the given ID.
50237 </refpurpose>
50238</refnamediv>
50239<refsynopsisdiv>
50240 <title>Synopsis</title>
50241  <funcsynopsis><funcprototype>
50242   <funcdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <function>v4l2_ctrl_find </function></funcdef>
50243   <paramdef><link linkend="API-struct-v4l2-ctrl-handler">struct v4l2_ctrl_handler</link> * <parameter>hdl</parameter></paramdef>
50244   <paramdef>u32 <parameter>id</parameter></paramdef>
50245  </funcprototype></funcsynopsis>
50246</refsynopsisdiv>
50247<refsect1>
50248 <title>Arguments</title>
50249 <variablelist>
50250  <varlistentry>
50251   <term><parameter>hdl</parameter></term>
50252   <listitem>
50253    <para>
50254     The control handler.
50255    </para>
50256   </listitem>
50257  </varlistentry>
50258  <varlistentry>
50259   <term><parameter>id</parameter></term>
50260   <listitem>
50261    <para>
50262     The control ID to find.
50263    </para>
50264   </listitem>
50265  </varlistentry>
50266 </variablelist>
50267</refsect1>
50268<refsect1>
50269<title>Description</title>
50270<para>
50271   If <parameter>hdl</parameter> == NULL this will return NULL as well. Will lock the handler so
50272   do not use from inside <structname><link linkend="API-struct-v4l2-ctrl-ops">v4l2_ctrl_ops</link></structname>.
50273</para>
50274</refsect1>
50275</refentry>
50276
50277<refentry id="API-v4l2-ctrl-activate">
50278<refentryinfo>
50279 <title>LINUX</title>
50280 <productname>Kernel Hackers Manual</productname>
50281 <date>July 2017</date>
50282</refentryinfo>
50283<refmeta>
50284 <refentrytitle><phrase>v4l2_ctrl_activate</phrase></refentrytitle>
50285 <manvolnum>9</manvolnum>
50286 <refmiscinfo class="version">4.4.14</refmiscinfo>
50287</refmeta>
50288<refnamediv>
50289 <refname>v4l2_ctrl_activate</refname>
50290 <refpurpose>
50291     Make the control active or inactive.
50292 </refpurpose>
50293</refnamediv>
50294<refsynopsisdiv>
50295 <title>Synopsis</title>
50296  <funcsynopsis><funcprototype>
50297   <funcdef>void <function>v4l2_ctrl_activate </function></funcdef>
50298   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50299   <paramdef>bool <parameter>active</parameter></paramdef>
50300  </funcprototype></funcsynopsis>
50301</refsynopsisdiv>
50302<refsect1>
50303 <title>Arguments</title>
50304 <variablelist>
50305  <varlistentry>
50306   <term><parameter>ctrl</parameter></term>
50307   <listitem>
50308    <para>
50309     The control to (de)activate.
50310    </para>
50311   </listitem>
50312  </varlistentry>
50313  <varlistentry>
50314   <term><parameter>active</parameter></term>
50315   <listitem>
50316    <para>
50317     True if the control should become active.
50318    </para>
50319   </listitem>
50320  </varlistentry>
50321 </variablelist>
50322</refsect1>
50323<refsect1>
50324<title>Description</title>
50325<para>
50326   This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
50327   Does nothing if <parameter>ctrl</parameter> == NULL.
50328   This will usually be called from within the s_ctrl op.
50329   The V4L2_EVENT_CTRL event will be generated afterwards.
50330   </para><para>
50331
50332   This function assumes that the control handler is locked.
50333</para>
50334</refsect1>
50335</refentry>
50336
50337<refentry id="API-v4l2-ctrl-grab">
50338<refentryinfo>
50339 <title>LINUX</title>
50340 <productname>Kernel Hackers Manual</productname>
50341 <date>July 2017</date>
50342</refentryinfo>
50343<refmeta>
50344 <refentrytitle><phrase>v4l2_ctrl_grab</phrase></refentrytitle>
50345 <manvolnum>9</manvolnum>
50346 <refmiscinfo class="version">4.4.14</refmiscinfo>
50347</refmeta>
50348<refnamediv>
50349 <refname>v4l2_ctrl_grab</refname>
50350 <refpurpose>
50351     Mark the control as grabbed or not grabbed.
50352 </refpurpose>
50353</refnamediv>
50354<refsynopsisdiv>
50355 <title>Synopsis</title>
50356  <funcsynopsis><funcprototype>
50357   <funcdef>void <function>v4l2_ctrl_grab </function></funcdef>
50358   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50359   <paramdef>bool <parameter>grabbed</parameter></paramdef>
50360  </funcprototype></funcsynopsis>
50361</refsynopsisdiv>
50362<refsect1>
50363 <title>Arguments</title>
50364 <variablelist>
50365  <varlistentry>
50366   <term><parameter>ctrl</parameter></term>
50367   <listitem>
50368    <para>
50369     The control to (de)activate.
50370    </para>
50371   </listitem>
50372  </varlistentry>
50373  <varlistentry>
50374   <term><parameter>grabbed</parameter></term>
50375   <listitem>
50376    <para>
50377     True if the control should become grabbed.
50378    </para>
50379   </listitem>
50380  </varlistentry>
50381 </variablelist>
50382</refsect1>
50383<refsect1>
50384<title>Description</title>
50385<para>
50386   This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
50387   Does nothing if <parameter>ctrl</parameter> == NULL.
50388   The V4L2_EVENT_CTRL event will be generated afterwards.
50389   This will usually be called when starting or stopping streaming in the
50390   driver.
50391   </para><para>
50392
50393   This function assumes that the control handler is not locked and will
50394   take the lock itself.
50395</para>
50396</refsect1>
50397</refentry>
50398
50399<refentry id="API---v4l2-ctrl-modify-range">
50400<refentryinfo>
50401 <title>LINUX</title>
50402 <productname>Kernel Hackers Manual</productname>
50403 <date>July 2017</date>
50404</refentryinfo>
50405<refmeta>
50406 <refentrytitle><phrase>__v4l2_ctrl_modify_range</phrase></refentrytitle>
50407 <manvolnum>9</manvolnum>
50408 <refmiscinfo class="version">4.4.14</refmiscinfo>
50409</refmeta>
50410<refnamediv>
50411 <refname>__v4l2_ctrl_modify_range</refname>
50412 <refpurpose>
50413     Unlocked variant of <function><link linkend="API-v4l2-ctrl-modify-range">v4l2_ctrl_modify_range</link></function>
50414 </refpurpose>
50415</refnamediv>
50416<refsynopsisdiv>
50417 <title>Synopsis</title>
50418  <funcsynopsis><funcprototype>
50419   <funcdef>int <function>__v4l2_ctrl_modify_range </function></funcdef>
50420   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50421   <paramdef>s64 <parameter>min</parameter></paramdef>
50422   <paramdef>s64 <parameter>max</parameter></paramdef>
50423   <paramdef>u64 <parameter>step</parameter></paramdef>
50424   <paramdef>s64 <parameter>def</parameter></paramdef>
50425  </funcprototype></funcsynopsis>
50426</refsynopsisdiv>
50427<refsect1>
50428 <title>Arguments</title>
50429 <variablelist>
50430  <varlistentry>
50431   <term><parameter>ctrl</parameter></term>
50432   <listitem>
50433    <para>
50434     The control to update.
50435    </para>
50436   </listitem>
50437  </varlistentry>
50438  <varlistentry>
50439   <term><parameter>min</parameter></term>
50440   <listitem>
50441    <para>
50442     The control's minimum value.
50443    </para>
50444   </listitem>
50445  </varlistentry>
50446  <varlistentry>
50447   <term><parameter>max</parameter></term>
50448   <listitem>
50449    <para>
50450     The control's maximum value.
50451    </para>
50452   </listitem>
50453  </varlistentry>
50454  <varlistentry>
50455   <term><parameter>step</parameter></term>
50456   <listitem>
50457    <para>
50458     The control's step value
50459    </para>
50460   </listitem>
50461  </varlistentry>
50462  <varlistentry>
50463   <term><parameter>def</parameter></term>
50464   <listitem>
50465    <para>
50466     The control's default value.
50467    </para>
50468   </listitem>
50469  </varlistentry>
50470 </variablelist>
50471</refsect1>
50472<refsect1>
50473<title>Description</title>
50474<para>
50475   Update the range of a control on the fly. This works for control types
50476   INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
50477   <parameter>step</parameter> value is interpreted as a menu_skip_mask.
50478   </para><para>
50479
50480   An error is returned if one of the range arguments is invalid for this
50481   control type.
50482   </para><para>
50483
50484   This function assumes that the control handler is not locked and will
50485   take the lock itself.
50486</para>
50487</refsect1>
50488</refentry>
50489
50490<refentry id="API-v4l2-ctrl-modify-range">
50491<refentryinfo>
50492 <title>LINUX</title>
50493 <productname>Kernel Hackers Manual</productname>
50494 <date>July 2017</date>
50495</refentryinfo>
50496<refmeta>
50497 <refentrytitle><phrase>v4l2_ctrl_modify_range</phrase></refentrytitle>
50498 <manvolnum>9</manvolnum>
50499 <refmiscinfo class="version">4.4.14</refmiscinfo>
50500</refmeta>
50501<refnamediv>
50502 <refname>v4l2_ctrl_modify_range</refname>
50503 <refpurpose>
50504     Update the range of a control.
50505 </refpurpose>
50506</refnamediv>
50507<refsynopsisdiv>
50508 <title>Synopsis</title>
50509  <funcsynopsis><funcprototype>
50510   <funcdef>int <function>v4l2_ctrl_modify_range </function></funcdef>
50511   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50512   <paramdef>s64 <parameter>min</parameter></paramdef>
50513   <paramdef>s64 <parameter>max</parameter></paramdef>
50514   <paramdef>u64 <parameter>step</parameter></paramdef>
50515   <paramdef>s64 <parameter>def</parameter></paramdef>
50516  </funcprototype></funcsynopsis>
50517</refsynopsisdiv>
50518<refsect1>
50519 <title>Arguments</title>
50520 <variablelist>
50521  <varlistentry>
50522   <term><parameter>ctrl</parameter></term>
50523   <listitem>
50524    <para>
50525     The control to update.
50526    </para>
50527   </listitem>
50528  </varlistentry>
50529  <varlistentry>
50530   <term><parameter>min</parameter></term>
50531   <listitem>
50532    <para>
50533     The control's minimum value.
50534    </para>
50535   </listitem>
50536  </varlistentry>
50537  <varlistentry>
50538   <term><parameter>max</parameter></term>
50539   <listitem>
50540    <para>
50541     The control's maximum value.
50542    </para>
50543   </listitem>
50544  </varlistentry>
50545  <varlistentry>
50546   <term><parameter>step</parameter></term>
50547   <listitem>
50548    <para>
50549     The control's step value
50550    </para>
50551   </listitem>
50552  </varlistentry>
50553  <varlistentry>
50554   <term><parameter>def</parameter></term>
50555   <listitem>
50556    <para>
50557     The control's default value.
50558    </para>
50559   </listitem>
50560  </varlistentry>
50561 </variablelist>
50562</refsect1>
50563<refsect1>
50564<title>Description</title>
50565<para>
50566   Update the range of a control on the fly. This works for control types
50567   INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
50568   <parameter>step</parameter> value is interpreted as a menu_skip_mask.
50569   </para><para>
50570
50571   An error is returned if one of the range arguments is invalid for this
50572   control type.
50573   </para><para>
50574
50575   This function assumes that the control handler is not locked and will
50576   take the lock itself.
50577</para>
50578</refsect1>
50579</refentry>
50580
50581<refentry id="API-v4l2-ctrl-notify">
50582<refentryinfo>
50583 <title>LINUX</title>
50584 <productname>Kernel Hackers Manual</productname>
50585 <date>July 2017</date>
50586</refentryinfo>
50587<refmeta>
50588 <refentrytitle><phrase>v4l2_ctrl_notify</phrase></refentrytitle>
50589 <manvolnum>9</manvolnum>
50590 <refmiscinfo class="version">4.4.14</refmiscinfo>
50591</refmeta>
50592<refnamediv>
50593 <refname>v4l2_ctrl_notify</refname>
50594 <refpurpose>
50595     Function to set a notify callback for a control.
50596 </refpurpose>
50597</refnamediv>
50598<refsynopsisdiv>
50599 <title>Synopsis</title>
50600  <funcsynopsis><funcprototype>
50601   <funcdef>void <function>v4l2_ctrl_notify </function></funcdef>
50602   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50603   <paramdef>v4l2_ctrl_notify_fnc <parameter>notify</parameter></paramdef>
50604   <paramdef>void * <parameter>priv</parameter></paramdef>
50605  </funcprototype></funcsynopsis>
50606</refsynopsisdiv>
50607<refsect1>
50608 <title>Arguments</title>
50609 <variablelist>
50610  <varlistentry>
50611   <term><parameter>ctrl</parameter></term>
50612   <listitem>
50613    <para>
50614     The control.
50615    </para>
50616   </listitem>
50617  </varlistentry>
50618  <varlistentry>
50619   <term><parameter>notify</parameter></term>
50620   <listitem>
50621    <para>
50622     The callback function.
50623    </para>
50624   </listitem>
50625  </varlistentry>
50626  <varlistentry>
50627   <term><parameter>priv</parameter></term>
50628   <listitem>
50629    <para>
50630     The callback private handle, passed as argument to the callback.
50631    </para>
50632   </listitem>
50633  </varlistentry>
50634 </variablelist>
50635</refsect1>
50636<refsect1>
50637<title>Description</title>
50638<para>
50639   This function sets a callback function for the control. If <parameter>ctrl</parameter> is NULL,
50640   then it will do nothing. If <parameter>notify</parameter> is NULL, then the notify callback will
50641   be removed.
50642   </para><para>
50643
50644   There can be only one notify. If another already exists, then a WARN_ON
50645   will be issued and the function will do nothing.
50646</para>
50647</refsect1>
50648</refentry>
50649
50650<refentry id="API-v4l2-ctrl-get-name">
50651<refentryinfo>
50652 <title>LINUX</title>
50653 <productname>Kernel Hackers Manual</productname>
50654 <date>July 2017</date>
50655</refentryinfo>
50656<refmeta>
50657 <refentrytitle><phrase>v4l2_ctrl_get_name</phrase></refentrytitle>
50658 <manvolnum>9</manvolnum>
50659 <refmiscinfo class="version">4.4.14</refmiscinfo>
50660</refmeta>
50661<refnamediv>
50662 <refname>v4l2_ctrl_get_name</refname>
50663 <refpurpose>
50664     Get the name of the control
50665 </refpurpose>
50666</refnamediv>
50667<refsynopsisdiv>
50668 <title>Synopsis</title>
50669  <funcsynopsis><funcprototype>
50670   <funcdef>const char * <function>v4l2_ctrl_get_name </function></funcdef>
50671   <paramdef>u32 <parameter>id</parameter></paramdef>
50672  </funcprototype></funcsynopsis>
50673</refsynopsisdiv>
50674<refsect1>
50675 <title>Arguments</title>
50676 <variablelist>
50677  <varlistentry>
50678   <term><parameter>id</parameter></term>
50679   <listitem>
50680    <para>
50681     The control ID.
50682    </para>
50683   </listitem>
50684  </varlistentry>
50685 </variablelist>
50686</refsect1>
50687<refsect1>
50688<title>Description</title>
50689<para>
50690   This function returns the name of the given control ID or NULL if it isn't
50691   a known control.
50692</para>
50693</refsect1>
50694</refentry>
50695
50696<refentry id="API-v4l2-ctrl-get-menu">
50697<refentryinfo>
50698 <title>LINUX</title>
50699 <productname>Kernel Hackers Manual</productname>
50700 <date>July 2017</date>
50701</refentryinfo>
50702<refmeta>
50703 <refentrytitle><phrase>v4l2_ctrl_get_menu</phrase></refentrytitle>
50704 <manvolnum>9</manvolnum>
50705 <refmiscinfo class="version">4.4.14</refmiscinfo>
50706</refmeta>
50707<refnamediv>
50708 <refname>v4l2_ctrl_get_menu</refname>
50709 <refpurpose>
50710     Get the menu string array of the control
50711 </refpurpose>
50712</refnamediv>
50713<refsynopsisdiv>
50714 <title>Synopsis</title>
50715  <funcsynopsis><funcprototype>
50716   <funcdef>const char * const * <function>v4l2_ctrl_get_menu </function></funcdef>
50717   <paramdef>u32 <parameter>id</parameter></paramdef>
50718  </funcprototype></funcsynopsis>
50719</refsynopsisdiv>
50720<refsect1>
50721 <title>Arguments</title>
50722 <variablelist>
50723  <varlistentry>
50724   <term><parameter>id</parameter></term>
50725   <listitem>
50726    <para>
50727     The control ID.
50728    </para>
50729   </listitem>
50730  </varlistentry>
50731 </variablelist>
50732</refsect1>
50733<refsect1>
50734<title>Description</title>
50735<para>
50736   This function returns the NULL-terminated menu string array name of the
50737   given control ID or NULL if it isn't a known menu control.
50738</para>
50739</refsect1>
50740</refentry>
50741
50742<refentry id="API-v4l2-ctrl-get-int-menu">
50743<refentryinfo>
50744 <title>LINUX</title>
50745 <productname>Kernel Hackers Manual</productname>
50746 <date>July 2017</date>
50747</refentryinfo>
50748<refmeta>
50749 <refentrytitle><phrase>v4l2_ctrl_get_int_menu</phrase></refentrytitle>
50750 <manvolnum>9</manvolnum>
50751 <refmiscinfo class="version">4.4.14</refmiscinfo>
50752</refmeta>
50753<refnamediv>
50754 <refname>v4l2_ctrl_get_int_menu</refname>
50755 <refpurpose>
50756     Get the integer menu array of the control
50757 </refpurpose>
50758</refnamediv>
50759<refsynopsisdiv>
50760 <title>Synopsis</title>
50761  <funcsynopsis><funcprototype>
50762   <funcdef>const s64 * <function>v4l2_ctrl_get_int_menu </function></funcdef>
50763   <paramdef>u32 <parameter>id</parameter></paramdef>
50764   <paramdef>u32 * <parameter>len</parameter></paramdef>
50765  </funcprototype></funcsynopsis>
50766</refsynopsisdiv>
50767<refsect1>
50768 <title>Arguments</title>
50769 <variablelist>
50770  <varlistentry>
50771   <term><parameter>id</parameter></term>
50772   <listitem>
50773    <para>
50774     The control ID.
50775    </para>
50776   </listitem>
50777  </varlistentry>
50778  <varlistentry>
50779   <term><parameter>len</parameter></term>
50780   <listitem>
50781    <para>
50782     The size of the integer array.
50783    </para>
50784   </listitem>
50785  </varlistentry>
50786 </variablelist>
50787</refsect1>
50788<refsect1>
50789<title>Description</title>
50790<para>
50791   This function returns the integer array of the given control ID or NULL if it
50792   if it isn't a known integer menu control.
50793</para>
50794</refsect1>
50795</refentry>
50796
50797<refentry id="API-v4l2-ctrl-g-ctrl">
50798<refentryinfo>
50799 <title>LINUX</title>
50800 <productname>Kernel Hackers Manual</productname>
50801 <date>July 2017</date>
50802</refentryinfo>
50803<refmeta>
50804 <refentrytitle><phrase>v4l2_ctrl_g_ctrl</phrase></refentrytitle>
50805 <manvolnum>9</manvolnum>
50806 <refmiscinfo class="version">4.4.14</refmiscinfo>
50807</refmeta>
50808<refnamediv>
50809 <refname>v4l2_ctrl_g_ctrl</refname>
50810 <refpurpose>
50811     Helper function to get the control's value from within a driver.
50812 </refpurpose>
50813</refnamediv>
50814<refsynopsisdiv>
50815 <title>Synopsis</title>
50816  <funcsynopsis><funcprototype>
50817   <funcdef>s32 <function>v4l2_ctrl_g_ctrl </function></funcdef>
50818   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50819  </funcprototype></funcsynopsis>
50820</refsynopsisdiv>
50821<refsect1>
50822 <title>Arguments</title>
50823 <variablelist>
50824  <varlistentry>
50825   <term><parameter>ctrl</parameter></term>
50826   <listitem>
50827    <para>
50828     The control.
50829    </para>
50830   </listitem>
50831  </varlistentry>
50832 </variablelist>
50833</refsect1>
50834<refsect1>
50835<title>Description</title>
50836<para>
50837   This returns the control's value safely by going through the control
50838   framework. This function will lock the control's handler, so it cannot be
50839   used from within the <structname><link linkend="API-struct-v4l2-ctrl-ops">v4l2_ctrl_ops</link></structname> functions.
50840   </para><para>
50841
50842   This function is for integer type controls only.
50843</para>
50844</refsect1>
50845</refentry>
50846
50847<refentry id="API---v4l2-ctrl-s-ctrl">
50848<refentryinfo>
50849 <title>LINUX</title>
50850 <productname>Kernel Hackers Manual</productname>
50851 <date>July 2017</date>
50852</refentryinfo>
50853<refmeta>
50854 <refentrytitle><phrase>__v4l2_ctrl_s_ctrl</phrase></refentrytitle>
50855 <manvolnum>9</manvolnum>
50856 <refmiscinfo class="version">4.4.14</refmiscinfo>
50857</refmeta>
50858<refnamediv>
50859 <refname>__v4l2_ctrl_s_ctrl</refname>
50860 <refpurpose>
50861     Unlocked variant of <function>v4l2_ctrl_s_ctrl</function>.
50862 </refpurpose>
50863</refnamediv>
50864<refsynopsisdiv>
50865 <title>Synopsis</title>
50866  <funcsynopsis><funcprototype>
50867   <funcdef>int <function>__v4l2_ctrl_s_ctrl </function></funcdef>
50868   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50869   <paramdef>s32 <parameter>val</parameter></paramdef>
50870  </funcprototype></funcsynopsis>
50871</refsynopsisdiv>
50872<refsect1>
50873 <title>Arguments</title>
50874 <variablelist>
50875  <varlistentry>
50876   <term><parameter>ctrl</parameter></term>
50877   <listitem>
50878    <para>
50879     The control.
50880    </para>
50881   </listitem>
50882  </varlistentry>
50883  <varlistentry>
50884   <term><parameter>val</parameter></term>
50885   <listitem>
50886    <para>
50887     The new value.
50888    </para>
50889   </listitem>
50890  </varlistentry>
50891 </variablelist>
50892</refsect1>
50893<refsect1>
50894<title>Description</title>
50895<para>
50896   This set the control's new value safely by going through the control
50897   framework. This function will lock the control's handler, so it cannot be
50898   used from within the <structname><link linkend="API-struct-v4l2-ctrl-ops">v4l2_ctrl_ops</link></structname> functions.
50899   </para><para>
50900
50901   This function is for integer type controls only.
50902</para>
50903</refsect1>
50904</refentry>
50905
50906<refentry id="API-v4l2-ctrl-g-ctrl-int64">
50907<refentryinfo>
50908 <title>LINUX</title>
50909 <productname>Kernel Hackers Manual</productname>
50910 <date>July 2017</date>
50911</refentryinfo>
50912<refmeta>
50913 <refentrytitle><phrase>v4l2_ctrl_g_ctrl_int64</phrase></refentrytitle>
50914 <manvolnum>9</manvolnum>
50915 <refmiscinfo class="version">4.4.14</refmiscinfo>
50916</refmeta>
50917<refnamediv>
50918 <refname>v4l2_ctrl_g_ctrl_int64</refname>
50919 <refpurpose>
50920     Helper function to get a 64-bit control's value from within a driver.
50921 </refpurpose>
50922</refnamediv>
50923<refsynopsisdiv>
50924 <title>Synopsis</title>
50925  <funcsynopsis><funcprototype>
50926   <funcdef>s64 <function>v4l2_ctrl_g_ctrl_int64 </function></funcdef>
50927   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50928  </funcprototype></funcsynopsis>
50929</refsynopsisdiv>
50930<refsect1>
50931 <title>Arguments</title>
50932 <variablelist>
50933  <varlistentry>
50934   <term><parameter>ctrl</parameter></term>
50935   <listitem>
50936    <para>
50937     The control.
50938    </para>
50939   </listitem>
50940  </varlistentry>
50941 </variablelist>
50942</refsect1>
50943<refsect1>
50944<title>Description</title>
50945<para>
50946   This returns the control's value safely by going through the control
50947   framework. This function will lock the control's handler, so it cannot be
50948   used from within the <structname><link linkend="API-struct-v4l2-ctrl-ops">v4l2_ctrl_ops</link></structname> functions.
50949   </para><para>
50950
50951   This function is for 64-bit integer type controls only.
50952</para>
50953</refsect1>
50954</refentry>
50955
50956<refentry id="API---v4l2-ctrl-s-ctrl-int64">
50957<refentryinfo>
50958 <title>LINUX</title>
50959 <productname>Kernel Hackers Manual</productname>
50960 <date>July 2017</date>
50961</refentryinfo>
50962<refmeta>
50963 <refentrytitle><phrase>__v4l2_ctrl_s_ctrl_int64</phrase></refentrytitle>
50964 <manvolnum>9</manvolnum>
50965 <refmiscinfo class="version">4.4.14</refmiscinfo>
50966</refmeta>
50967<refnamediv>
50968 <refname>__v4l2_ctrl_s_ctrl_int64</refname>
50969 <refpurpose>
50970     Unlocked variant of <function>v4l2_ctrl_s_ctrl_int64</function>.
50971 </refpurpose>
50972</refnamediv>
50973<refsynopsisdiv>
50974 <title>Synopsis</title>
50975  <funcsynopsis><funcprototype>
50976   <funcdef>int <function>__v4l2_ctrl_s_ctrl_int64 </function></funcdef>
50977   <paramdef><link linkend="API-struct-v4l2-ctrl">struct v4l2_ctrl</link> * <parameter>ctrl</parameter></paramdef>
50978   <paramdef>s64 <parameter>val</parameter></paramdef>
50979  </funcprototype></funcsynopsis>
50980</refsynopsisdiv>
50981<refsect1>
50982 <title>Arguments</title>
50983 <variablelist>
50984  <varlistentry>
50985   <term><parameter>ctrl</parameter></term>
50986   <listitem>
50987    <para>
50988     The control.
50989    </para>
50990   </listitem>
50991  </varlistentry>
50992  <varlistentry>
50993   <term><parameter>val</parameter></term>
50994   <listitem>
50995    <para>
50996     The new value.
50997    </para>
50998   </listitem>
50999  </varlistentry>
51000 </variablelist>
51001</refsect1>
51002<refsect1>
51003<title>Description</title>
51004<para>
51005   This set the control's new value safely by going through the control
51006   framework. This function will lock the control's handler, so it cannot be
51007   used from within the <structname><link linkend="API-struct-v4l2-ctrl-ops">v4l2_ctrl_ops</link></structname> functions.
51008   </para><para>
51009
51010   This function is for 64-bit integer type controls only.
51011</para>
51012</refsect1>
51013</refentry>
51014
51015<!-- include/media/v4l2-dv-timings.h -->
51016<refentry id="API-v4l2-check-dv-timings-fnc">
51017<refentryinfo>
51018 <title>LINUX</title>
51019 <productname>Kernel Hackers Manual</productname>
51020 <date>July 2017</date>
51021</refentryinfo>
51022<refmeta>
51023 <refentrytitle><phrase>v4l2_check_dv_timings_fnc</phrase></refentrytitle>
51024 <manvolnum>9</manvolnum>
51025 <refmiscinfo class="version">4.4.14</refmiscinfo>
51026</refmeta>
51027<refnamediv>
51028 <refname>v4l2_check_dv_timings_fnc</refname>
51029 <refpurpose>
51030  timings check callback
51031 </refpurpose>
51032</refnamediv>
51033<refsynopsisdiv>
51034 <title>Synopsis</title>
51035  <funcsynopsis><funcprototype>
51036   <funcdef>typedef bool <function>v4l2_check_dv_timings_fnc </function></funcdef>
51037   <paramdef>const struct v4l2_dv_timings * <parameter>t</parameter></paramdef>
51038   <paramdef>void * <parameter>handle</parameter></paramdef>
51039  </funcprototype></funcsynopsis>
51040</refsynopsisdiv>
51041<refsect1>
51042 <title>Arguments</title>
51043 <variablelist>
51044  <varlistentry>
51045   <term><parameter>t</parameter></term>
51046   <listitem>
51047    <para>
51048     the v4l2_dv_timings struct.
51049    </para>
51050   </listitem>
51051  </varlistentry>
51052  <varlistentry>
51053   <term><parameter>handle</parameter></term>
51054   <listitem>
51055    <para>
51056     a handle from the driver.
51057    </para>
51058   </listitem>
51059  </varlistentry>
51060 </variablelist>
51061</refsect1>
51062<refsect1>
51063<title>Description</title>
51064<para>
51065   Returns true if the given timings are valid.
51066</para>
51067</refsect1>
51068</refentry>
51069
51070<refentry id="API-v4l2-valid-dv-timings">
51071<refentryinfo>
51072 <title>LINUX</title>
51073 <productname>Kernel Hackers Manual</productname>
51074 <date>July 2017</date>
51075</refentryinfo>
51076<refmeta>
51077 <refentrytitle><phrase>v4l2_valid_dv_timings</phrase></refentrytitle>
51078 <manvolnum>9</manvolnum>
51079 <refmiscinfo class="version">4.4.14</refmiscinfo>
51080</refmeta>
51081<refnamediv>
51082 <refname>v4l2_valid_dv_timings</refname>
51083 <refpurpose>
51084     are these timings valid?
51085 </refpurpose>
51086</refnamediv>
51087<refsynopsisdiv>
51088 <title>Synopsis</title>
51089  <funcsynopsis><funcprototype>
51090   <funcdef>bool <function>v4l2_valid_dv_timings </function></funcdef>
51091   <paramdef>const struct v4l2_dv_timings * <parameter>t</parameter></paramdef>
51092   <paramdef>const struct v4l2_dv_timings_cap * <parameter>cap</parameter></paramdef>
51093   <paramdef><link linkend="API-v4l2-check-dv-timings-fnc">v4l2_check_dv_timings_fnc </link><parameter>fnc</parameter></paramdef>
51094   <paramdef>void * <parameter>fnc_handle</parameter></paramdef>
51095  </funcprototype></funcsynopsis>
51096</refsynopsisdiv>
51097<refsect1>
51098 <title>Arguments</title>
51099 <variablelist>
51100  <varlistentry>
51101   <term><parameter>t</parameter></term>
51102   <listitem>
51103    <para>
51104     the v4l2_dv_timings struct.
51105    </para>
51106   </listitem>
51107  </varlistentry>
51108  <varlistentry>
51109   <term><parameter>cap</parameter></term>
51110   <listitem>
51111    <para>
51112     the v4l2_dv_timings_cap capabilities.
51113    </para>
51114   </listitem>
51115  </varlistentry>
51116  <varlistentry>
51117   <term><parameter>fnc</parameter></term>
51118   <listitem>
51119    <para>
51120     callback to check if this timing is OK. May be NULL.
51121    </para>
51122   </listitem>
51123  </varlistentry>
51124  <varlistentry>
51125   <term><parameter>fnc_handle</parameter></term>
51126   <listitem>
51127    <para>
51128     a handle that is passed on to <parameter>fnc</parameter>.
51129    </para>
51130   </listitem>
51131  </varlistentry>
51132 </variablelist>
51133</refsect1>
51134<refsect1>
51135<title>Description</title>
51136<para>
51137   Returns true if the given dv_timings struct is supported by the
51138   hardware capabilities and the callback function (if non-NULL), returns
51139   false otherwise.
51140</para>
51141</refsect1>
51142</refentry>
51143
51144<refentry id="API-v4l2-enum-dv-timings-cap">
51145<refentryinfo>
51146 <title>LINUX</title>
51147 <productname>Kernel Hackers Manual</productname>
51148 <date>July 2017</date>
51149</refentryinfo>
51150<refmeta>
51151 <refentrytitle><phrase>v4l2_enum_dv_timings_cap</phrase></refentrytitle>
51152 <manvolnum>9</manvolnum>
51153 <refmiscinfo class="version">4.4.14</refmiscinfo>
51154</refmeta>
51155<refnamediv>
51156 <refname>v4l2_enum_dv_timings_cap</refname>
51157 <refpurpose>
51158     Helper function to enumerate possible DV timings based on capabilities
51159 </refpurpose>
51160</refnamediv>
51161<refsynopsisdiv>
51162 <title>Synopsis</title>
51163  <funcsynopsis><funcprototype>
51164   <funcdef>int <function>v4l2_enum_dv_timings_cap </function></funcdef>
51165   <paramdef>struct v4l2_enum_dv_timings * <parameter>t</parameter></paramdef>
51166   <paramdef>const struct v4l2_dv_timings_cap * <parameter>cap</parameter></paramdef>
51167   <paramdef><link linkend="API-v4l2-check-dv-timings-fnc">v4l2_check_dv_timings_fnc </link><parameter>fnc</parameter></paramdef>
51168   <paramdef>void * <parameter>fnc_handle</parameter></paramdef>
51169  </funcprototype></funcsynopsis>
51170</refsynopsisdiv>
51171<refsect1>
51172 <title>Arguments</title>
51173 <variablelist>
51174  <varlistentry>
51175   <term><parameter>t</parameter></term>
51176   <listitem>
51177    <para>
51178     the v4l2_enum_dv_timings struct.
51179    </para>
51180   </listitem>
51181  </varlistentry>
51182  <varlistentry>
51183   <term><parameter>cap</parameter></term>
51184   <listitem>
51185    <para>
51186     the v4l2_dv_timings_cap capabilities.
51187    </para>
51188   </listitem>
51189  </varlistentry>
51190  <varlistentry>
51191   <term><parameter>fnc</parameter></term>
51192   <listitem>
51193    <para>
51194     callback to check if this timing is OK. May be NULL.
51195    </para>
51196   </listitem>
51197  </varlistentry>
51198  <varlistentry>
51199   <term><parameter>fnc_handle</parameter></term>
51200   <listitem>
51201    <para>
51202     a handle that is passed on to <parameter>fnc</parameter>.
51203    </para>
51204   </listitem>
51205  </varlistentry>
51206 </variablelist>
51207</refsect1>
51208<refsect1>
51209<title>Description</title>
51210<para>
51211   This enumerates dv_timings using the full list of possible CEA-861 and DMT
51212   timings, filtering out any timings that are not supported based on the
51213   hardware capabilities and the callback function (if non-NULL).
51214   </para><para>
51215
51216   If a valid timing for the given index is found, it will fill in <parameter>t</parameter> and
51217   return 0, otherwise it returns -EINVAL.
51218</para>
51219</refsect1>
51220</refentry>
51221
51222<refentry id="API-v4l2-find-dv-timings-cap">
51223<refentryinfo>
51224 <title>LINUX</title>
51225 <productname>Kernel Hackers Manual</productname>
51226 <date>July 2017</date>
51227</refentryinfo>
51228<refmeta>
51229 <refentrytitle><phrase>v4l2_find_dv_timings_cap</phrase></refentrytitle>
51230 <manvolnum>9</manvolnum>
51231 <refmiscinfo class="version">4.4.14</refmiscinfo>
51232</refmeta>
51233<refnamediv>
51234 <refname>v4l2_find_dv_timings_cap</refname>
51235 <refpurpose>
51236     Find the closest timings struct
51237 </refpurpose>
51238</refnamediv>
51239<refsynopsisdiv>
51240 <title>Synopsis</title>
51241  <funcsynopsis><funcprototype>
51242   <funcdef>bool <function>v4l2_find_dv_timings_cap </function></funcdef>
51243   <paramdef>struct v4l2_dv_timings * <parameter>t</parameter></paramdef>
51244   <paramdef>const struct v4l2_dv_timings_cap * <parameter>cap</parameter></paramdef>
51245   <paramdef>unsigned <parameter>pclock_delta</parameter></paramdef>
51246   <paramdef><link linkend="API-v4l2-check-dv-timings-fnc">v4l2_check_dv_timings_fnc </link><parameter>fnc</parameter></paramdef>
51247   <paramdef>void * <parameter>fnc_handle</parameter></paramdef>
51248  </funcprototype></funcsynopsis>
51249</refsynopsisdiv>
51250<refsect1>
51251 <title>Arguments</title>
51252 <variablelist>
51253  <varlistentry>
51254   <term><parameter>t</parameter></term>
51255   <listitem>
51256    <para>
51257     the v4l2_enum_dv_timings struct.
51258    </para>
51259   </listitem>
51260  </varlistentry>
51261  <varlistentry>
51262   <term><parameter>cap</parameter></term>
51263   <listitem>
51264    <para>
51265     the v4l2_dv_timings_cap capabilities.
51266    </para>
51267   </listitem>
51268  </varlistentry>
51269  <varlistentry>
51270   <term><parameter>pclock_delta</parameter></term>
51271   <listitem>
51272    <para>
51273     maximum delta between t-&gt;pixelclock and the timing struct
51274     under consideration.
51275    </para>
51276   </listitem>
51277  </varlistentry>
51278  <varlistentry>
51279   <term><parameter>fnc</parameter></term>
51280   <listitem>
51281    <para>
51282     callback to check if a given timings struct is OK. May be NULL.
51283    </para>
51284   </listitem>
51285  </varlistentry>
51286  <varlistentry>
51287   <term><parameter>fnc_handle</parameter></term>
51288   <listitem>
51289    <para>
51290     a handle that is passed on to <parameter>fnc</parameter>.
51291    </para>
51292   </listitem>
51293  </varlistentry>
51294 </variablelist>
51295</refsect1>
51296<refsect1>
51297<title>Description</title>
51298<para>
51299   This function tries to map the given timings to an entry in the
51300   full list of possible CEA-861 and DMT timings, filtering out any timings
51301   that are not supported based on the hardware capabilities and the callback
51302   function (if non-NULL).
51303   </para><para>
51304
51305   On success it will fill in <parameter>t</parameter> with the found timings and it returns true.
51306   On failure it will return false.
51307</para>
51308</refsect1>
51309</refentry>
51310
51311<refentry id="API-v4l2-match-dv-timings">
51312<refentryinfo>
51313 <title>LINUX</title>
51314 <productname>Kernel Hackers Manual</productname>
51315 <date>July 2017</date>
51316</refentryinfo>
51317<refmeta>
51318 <refentrytitle><phrase>v4l2_match_dv_timings</phrase></refentrytitle>
51319 <manvolnum>9</manvolnum>
51320 <refmiscinfo class="version">4.4.14</refmiscinfo>
51321</refmeta>
51322<refnamediv>
51323 <refname>v4l2_match_dv_timings</refname>
51324 <refpurpose>
51325     do two timings match?
51326 </refpurpose>
51327</refnamediv>
51328<refsynopsisdiv>
51329 <title>Synopsis</title>
51330  <funcsynopsis><funcprototype>
51331   <funcdef>bool <function>v4l2_match_dv_timings </function></funcdef>
51332   <paramdef>const struct v4l2_dv_timings * <parameter>measured</parameter></paramdef>
51333   <paramdef>const struct v4l2_dv_timings * <parameter>standard</parameter></paramdef>
51334   <paramdef>unsigned <parameter>pclock_delta</parameter></paramdef>
51335  </funcprototype></funcsynopsis>
51336</refsynopsisdiv>
51337<refsect1>
51338 <title>Arguments</title>
51339 <variablelist>
51340  <varlistentry>
51341   <term><parameter>measured</parameter></term>
51342   <listitem>
51343    <para>
51344     the measured timings data.
51345    </para>
51346   </listitem>
51347  </varlistentry>
51348  <varlistentry>
51349   <term><parameter>standard</parameter></term>
51350   <listitem>
51351    <para>
51352     the timings according to the standard.
51353    </para>
51354   </listitem>
51355  </varlistentry>
51356  <varlistentry>
51357   <term><parameter>pclock_delta</parameter></term>
51358   <listitem>
51359    <para>
51360     maximum delta in Hz between standard-&gt;pixelclock and
51361     the measured timings.
51362    </para>
51363   </listitem>
51364  </varlistentry>
51365 </variablelist>
51366</refsect1>
51367<refsect1>
51368<title>Description</title>
51369<para>
51370   Returns true if the two timings match, returns false otherwise.
51371</para>
51372</refsect1>
51373</refentry>
51374
51375<refentry id="API-v4l2-print-dv-timings">
51376<refentryinfo>
51377 <title>LINUX</title>
51378 <productname>Kernel Hackers Manual</productname>
51379 <date>July 2017</date>
51380</refentryinfo>
51381<refmeta>
51382 <refentrytitle><phrase>v4l2_print_dv_timings</phrase></refentrytitle>
51383 <manvolnum>9</manvolnum>
51384 <refmiscinfo class="version">4.4.14</refmiscinfo>
51385</refmeta>
51386<refnamediv>
51387 <refname>v4l2_print_dv_timings</refname>
51388 <refpurpose>
51389     log the contents of a dv_timings struct
51390 </refpurpose>
51391</refnamediv>
51392<refsynopsisdiv>
51393 <title>Synopsis</title>
51394  <funcsynopsis><funcprototype>
51395   <funcdef>void <function>v4l2_print_dv_timings </function></funcdef>
51396   <paramdef>const char * <parameter>dev_prefix</parameter></paramdef>
51397   <paramdef>const char * <parameter>prefix</parameter></paramdef>
51398   <paramdef>const struct v4l2_dv_timings * <parameter>t</parameter></paramdef>
51399   <paramdef>bool <parameter>detailed</parameter></paramdef>
51400  </funcprototype></funcsynopsis>
51401</refsynopsisdiv>
51402<refsect1>
51403 <title>Arguments</title>
51404 <variablelist>
51405  <varlistentry>
51406   <term><parameter>dev_prefix</parameter></term>
51407   <listitem>
51408    <para>
51409     device prefix for each log line.
51410    </para>
51411   </listitem>
51412  </varlistentry>
51413  <varlistentry>
51414   <term><parameter>prefix</parameter></term>
51415   <listitem>
51416    <para>
51417     additional prefix for each log line, may be NULL.
51418    </para>
51419   </listitem>
51420  </varlistentry>
51421  <varlistentry>
51422   <term><parameter>t</parameter></term>
51423   <listitem>
51424    <para>
51425     the timings data.
51426    </para>
51427   </listitem>
51428  </varlistentry>
51429  <varlistentry>
51430   <term><parameter>detailed</parameter></term>
51431   <listitem>
51432    <para>
51433     if true, give a detailed log.
51434    </para>
51435   </listitem>
51436  </varlistentry>
51437 </variablelist>
51438</refsect1>
51439</refentry>
51440
51441<refentry id="API-v4l2-detect-cvt">
51442<refentryinfo>
51443 <title>LINUX</title>
51444 <productname>Kernel Hackers Manual</productname>
51445 <date>July 2017</date>
51446</refentryinfo>
51447<refmeta>
51448 <refentrytitle><phrase>v4l2_detect_cvt</phrase></refentrytitle>
51449 <manvolnum>9</manvolnum>
51450 <refmiscinfo class="version">4.4.14</refmiscinfo>
51451</refmeta>
51452<refnamediv>
51453 <refname>v4l2_detect_cvt</refname>
51454 <refpurpose>
51455     detect if the given timings follow the CVT standard
51456 </refpurpose>
51457</refnamediv>
51458<refsynopsisdiv>
51459 <title>Synopsis</title>
51460  <funcsynopsis><funcprototype>
51461   <funcdef>bool <function>v4l2_detect_cvt </function></funcdef>
51462   <paramdef>unsigned <parameter>frame_height</parameter></paramdef>
51463   <paramdef>unsigned <parameter>hfreq</parameter></paramdef>
51464   <paramdef>unsigned <parameter>vsync</parameter></paramdef>
51465   <paramdef>unsigned <parameter>active_width</parameter></paramdef>
51466   <paramdef>u32 <parameter>polarities</parameter></paramdef>
51467   <paramdef>bool <parameter>interlaced</parameter></paramdef>
51468   <paramdef>struct v4l2_dv_timings * <parameter>fmt</parameter></paramdef>
51469  </funcprototype></funcsynopsis>
51470</refsynopsisdiv>
51471<refsect1>
51472 <title>Arguments</title>
51473 <variablelist>
51474  <varlistentry>
51475   <term><parameter>frame_height</parameter></term>
51476   <listitem>
51477    <para>
51478     the total height of the frame (including blanking) in lines.
51479    </para>
51480   </listitem>
51481  </varlistentry>
51482  <varlistentry>
51483   <term><parameter>hfreq</parameter></term>
51484   <listitem>
51485    <para>
51486     the horizontal frequency in Hz.
51487    </para>
51488   </listitem>
51489  </varlistentry>
51490  <varlistentry>
51491   <term><parameter>vsync</parameter></term>
51492   <listitem>
51493    <para>
51494     the height of the vertical sync in lines.
51495    </para>
51496   </listitem>
51497  </varlistentry>
51498  <varlistentry>
51499   <term><parameter>active_width</parameter></term>
51500   <listitem>
51501    <para>
51502     active width of image (does not include blanking). This
51503     information is needed only in case of version 2 of reduced blanking.
51504     In other cases, this parameter does not have any effect on timings.
51505    </para>
51506   </listitem>
51507  </varlistentry>
51508  <varlistentry>
51509   <term><parameter>polarities</parameter></term>
51510   <listitem>
51511    <para>
51512     the horizontal and vertical polarities (same as struct
51513     v4l2_bt_timings polarities).
51514    </para>
51515   </listitem>
51516  </varlistentry>
51517  <varlistentry>
51518   <term><parameter>interlaced</parameter></term>
51519   <listitem>
51520    <para>
51521     if this flag is true, it indicates interlaced format
51522    </para>
51523   </listitem>
51524  </varlistentry>
51525  <varlistentry>
51526   <term><parameter>fmt</parameter></term>
51527   <listitem>
51528    <para>
51529     the resulting timings.
51530    </para>
51531   </listitem>
51532  </varlistentry>
51533 </variablelist>
51534</refsect1>
51535<refsect1>
51536<title>Description</title>
51537<para>
51538   This function will attempt to detect if the given values correspond to a
51539   valid CVT format. If so, then it will return true, and fmt will be filled
51540   in with the found CVT timings.
51541</para>
51542</refsect1>
51543</refentry>
51544
51545<refentry id="API-v4l2-detect-gtf">
51546<refentryinfo>
51547 <title>LINUX</title>
51548 <productname>Kernel Hackers Manual</productname>
51549 <date>July 2017</date>
51550</refentryinfo>
51551<refmeta>
51552 <refentrytitle><phrase>v4l2_detect_gtf</phrase></refentrytitle>
51553 <manvolnum>9</manvolnum>
51554 <refmiscinfo class="version">4.4.14</refmiscinfo>
51555</refmeta>
51556<refnamediv>
51557 <refname>v4l2_detect_gtf</refname>
51558 <refpurpose>
51559     detect if the given timings follow the GTF standard
51560 </refpurpose>
51561</refnamediv>
51562<refsynopsisdiv>
51563 <title>Synopsis</title>
51564  <funcsynopsis><funcprototype>
51565   <funcdef>bool <function>v4l2_detect_gtf </function></funcdef>
51566   <paramdef>unsigned <parameter>frame_height</parameter></paramdef>
51567   <paramdef>unsigned <parameter>hfreq</parameter></paramdef>
51568   <paramdef>unsigned <parameter>vsync</parameter></paramdef>
51569   <paramdef>u32 <parameter>polarities</parameter></paramdef>
51570   <paramdef>bool <parameter>interlaced</parameter></paramdef>
51571   <paramdef>struct v4l2_fract <parameter>aspect</parameter></paramdef>
51572   <paramdef>struct v4l2_dv_timings * <parameter>fmt</parameter></paramdef>
51573  </funcprototype></funcsynopsis>
51574</refsynopsisdiv>
51575<refsect1>
51576 <title>Arguments</title>
51577 <variablelist>
51578  <varlistentry>
51579   <term><parameter>frame_height</parameter></term>
51580   <listitem>
51581    <para>
51582     the total height of the frame (including blanking) in lines.
51583    </para>
51584   </listitem>
51585  </varlistentry>
51586  <varlistentry>
51587   <term><parameter>hfreq</parameter></term>
51588   <listitem>
51589    <para>
51590     the horizontal frequency in Hz.
51591    </para>
51592   </listitem>
51593  </varlistentry>
51594  <varlistentry>
51595   <term><parameter>vsync</parameter></term>
51596   <listitem>
51597    <para>
51598     the height of the vertical sync in lines.
51599    </para>
51600   </listitem>
51601  </varlistentry>
51602  <varlistentry>
51603   <term><parameter>polarities</parameter></term>
51604   <listitem>
51605    <para>
51606     the horizontal and vertical polarities (same as struct
51607     v4l2_bt_timings polarities).
51608    </para>
51609   </listitem>
51610  </varlistentry>
51611  <varlistentry>
51612   <term><parameter>interlaced</parameter></term>
51613   <listitem>
51614    <para>
51615     if this flag is true, it indicates interlaced format
51616    </para>
51617   </listitem>
51618  </varlistentry>
51619  <varlistentry>
51620   <term><parameter>aspect</parameter></term>
51621   <listitem>
51622    <para>
51623     preferred aspect ratio. GTF has no method of determining the
51624     aspect ratio in order to derive the image width from the
51625     image height, so it has to be passed explicitly. Usually
51626     the native screen aspect ratio is used for this. If it
51627     is not filled in correctly, then 16:9 will be assumed.
51628    </para>
51629   </listitem>
51630  </varlistentry>
51631  <varlistentry>
51632   <term><parameter>fmt</parameter></term>
51633   <listitem>
51634    <para>
51635     the resulting timings.
51636    </para>
51637   </listitem>
51638  </varlistentry>
51639 </variablelist>
51640</refsect1>
51641<refsect1>
51642<title>Description</title>
51643<para>
51644   This function will attempt to detect if the given values correspond to a
51645   valid GTF format. If so, then it will return true, and fmt will be filled
51646   in with the found GTF timings.
51647</para>
51648</refsect1>
51649</refentry>
51650
51651<refentry id="API-v4l2-calc-aspect-ratio">
51652<refentryinfo>
51653 <title>LINUX</title>
51654 <productname>Kernel Hackers Manual</productname>
51655 <date>July 2017</date>
51656</refentryinfo>
51657<refmeta>
51658 <refentrytitle><phrase>v4l2_calc_aspect_ratio</phrase></refentrytitle>
51659 <manvolnum>9</manvolnum>
51660 <refmiscinfo class="version">4.4.14</refmiscinfo>
51661</refmeta>
51662<refnamediv>
51663 <refname>v4l2_calc_aspect_ratio</refname>
51664 <refpurpose>
51665     calculate the aspect ratio based on bytes 0x15 and 0x16 from the EDID.
51666 </refpurpose>
51667</refnamediv>
51668<refsynopsisdiv>
51669 <title>Synopsis</title>
51670  <funcsynopsis><funcprototype>
51671   <funcdef>struct v4l2_fract <function>v4l2_calc_aspect_ratio </function></funcdef>
51672   <paramdef>u8 <parameter>hor_landscape</parameter></paramdef>
51673   <paramdef>u8 <parameter>vert_portrait</parameter></paramdef>
51674  </funcprototype></funcsynopsis>
51675</refsynopsisdiv>
51676<refsect1>
51677 <title>Arguments</title>
51678 <variablelist>
51679  <varlistentry>
51680   <term><parameter>hor_landscape</parameter></term>
51681   <listitem>
51682    <para>
51683     byte 0x15 from the EDID.
51684    </para>
51685   </listitem>
51686  </varlistentry>
51687  <varlistentry>
51688   <term><parameter>vert_portrait</parameter></term>
51689   <listitem>
51690    <para>
51691     byte 0x16 from the EDID.
51692    </para>
51693   </listitem>
51694  </varlistentry>
51695 </variablelist>
51696</refsect1>
51697<refsect1>
51698<title>Description</title>
51699<para>
51700   Determines the aspect ratio from the EDID.
51701   See VESA Enhanced EDID standard, release A, rev 2, section 3.6.2:
51702   <quote>Horizontal and Vertical Screen Size or Aspect Ratio</quote>
51703</para>
51704</refsect1>
51705</refentry>
51706
51707<!-- include/media/v4l2-event.h -->
51708<refentry id="API-struct-v4l2-kevent">
51709<refentryinfo>
51710 <title>LINUX</title>
51711 <productname>Kernel Hackers Manual</productname>
51712 <date>July 2017</date>
51713</refentryinfo>
51714<refmeta>
51715 <refentrytitle><phrase>struct v4l2_kevent</phrase></refentrytitle>
51716 <manvolnum>9</manvolnum>
51717 <refmiscinfo class="version">4.4.14</refmiscinfo>
51718</refmeta>
51719<refnamediv>
51720 <refname>struct v4l2_kevent</refname>
51721 <refpurpose>
51722  Internal kernel event struct.
51723 </refpurpose>
51724</refnamediv>
51725<refsynopsisdiv>
51726 <title>Synopsis</title>
51727  <programlisting>
51728struct v4l2_kevent {
51729  struct list_head list;
51730  struct v4l2_subscribed_event * sev;
51731  struct v4l2_event event;
51732};  </programlisting>
51733</refsynopsisdiv>
51734 <refsect1>
51735  <title>Members</title>
51736  <variablelist>
51737    <varlistentry>      <term>list</term>
51738      <listitem><para>
51739List node for the v4l2_fh-&gt;available list.
51740      </para></listitem>
51741    </varlistentry>
51742    <varlistentry>      <term>sev</term>
51743      <listitem><para>
51744Pointer to parent v4l2_subscribed_event.
51745      </para></listitem>
51746    </varlistentry>
51747    <varlistentry>      <term>event</term>
51748      <listitem><para>
51749The event itself.
51750      </para></listitem>
51751    </varlistentry>
51752  </variablelist>
51753 </refsect1>
51754</refentry>
51755
51756<refentry id="API-struct-v4l2-subscribed-event">
51757<refentryinfo>
51758 <title>LINUX</title>
51759 <productname>Kernel Hackers Manual</productname>
51760 <date>July 2017</date>
51761</refentryinfo>
51762<refmeta>
51763 <refentrytitle><phrase>struct v4l2_subscribed_event</phrase></refentrytitle>
51764 <manvolnum>9</manvolnum>
51765 <refmiscinfo class="version">4.4.14</refmiscinfo>
51766</refmeta>
51767<refnamediv>
51768 <refname>struct v4l2_subscribed_event</refname>
51769 <refpurpose>
51770     Internal struct representing a subscribed event.
51771 </refpurpose>
51772</refnamediv>
51773<refsynopsisdiv>
51774 <title>Synopsis</title>
51775  <programlisting>
51776struct v4l2_subscribed_event {
51777  struct list_head list;
51778  u32 type;
51779  u32 id;
51780  u32 flags;
51781  struct v4l2_fh * fh;
51782  struct list_head node;
51783  const struct v4l2_subscribed_event_ops * ops;
51784  unsigned elems;
51785  unsigned first;
51786  unsigned in_use;
51787  struct v4l2_kevent events[];
51788};  </programlisting>
51789</refsynopsisdiv>
51790 <refsect1>
51791  <title>Members</title>
51792  <variablelist>
51793    <varlistentry>      <term>list</term>
51794      <listitem><para>
51795   List node for the v4l2_fh-&gt;subscribed list.
51796      </para></listitem>
51797    </varlistentry>
51798    <varlistentry>      <term>type</term>
51799      <listitem><para>
51800   Event type.
51801      </para></listitem>
51802    </varlistentry>
51803    <varlistentry>      <term>id</term>
51804      <listitem><para>
51805   Associated object ID (e.g. control ID). 0 if there isn't any.
51806      </para></listitem>
51807    </varlistentry>
51808    <varlistentry>      <term>flags</term>
51809      <listitem><para>
51810   Copy of v4l2_event_subscription-&gt;flags.
51811      </para></listitem>
51812    </varlistentry>
51813    <varlistentry>      <term>fh</term>
51814      <listitem><para>
51815   Filehandle that subscribed to this event.
51816      </para></listitem>
51817    </varlistentry>
51818    <varlistentry>      <term>node</term>
51819      <listitem><para>
51820   List node that hooks into the object's event list (if there is one).
51821      </para></listitem>
51822    </varlistentry>
51823    <varlistentry>      <term>ops</term>
51824      <listitem><para>
51825   v4l2_subscribed_event_ops
51826      </para></listitem>
51827    </varlistentry>
51828    <varlistentry>      <term>elems</term>
51829      <listitem><para>
51830   The number of elements in the events array.
51831      </para></listitem>
51832    </varlistentry>
51833    <varlistentry>      <term>first</term>
51834      <listitem><para>
51835   The index of the events containing the oldest available event.
51836      </para></listitem>
51837    </varlistentry>
51838    <varlistentry>      <term>in_use</term>
51839      <listitem><para>
51840   The number of queued events.
51841      </para></listitem>
51842    </varlistentry>
51843    <varlistentry>      <term>events[]</term>
51844      <listitem><para>
51845   An array of <parameter>elems</parameter> events.
51846      </para></listitem>
51847    </varlistentry>
51848  </variablelist>
51849 </refsect1>
51850</refentry>
51851
51852<!-- include/media/v4l2-flash-led-class.h -->
51853<refentry id="API-struct-v4l2-flash-config">
51854<refentryinfo>
51855 <title>LINUX</title>
51856 <productname>Kernel Hackers Manual</productname>
51857 <date>July 2017</date>
51858</refentryinfo>
51859<refmeta>
51860 <refentrytitle><phrase>struct v4l2_flash_config</phrase></refentrytitle>
51861 <manvolnum>9</manvolnum>
51862 <refmiscinfo class="version">4.4.14</refmiscinfo>
51863</refmeta>
51864<refnamediv>
51865 <refname>struct v4l2_flash_config</refname>
51866 <refpurpose>
51867  V4L2 Flash sub-device initialization data
51868 </refpurpose>
51869</refnamediv>
51870<refsynopsisdiv>
51871 <title>Synopsis</title>
51872  <programlisting>
51873struct v4l2_flash_config {
51874  char dev_name[32];
51875  struct led_flash_setting torch_intensity;
51876  struct led_flash_setting indicator_intensity;
51877  u32 flash_faults;
51878  unsigned int has_external_strobe:1;
51879};  </programlisting>
51880</refsynopsisdiv>
51881 <refsect1>
51882  <title>Members</title>
51883  <variablelist>
51884    <varlistentry>      <term>dev_name[32]</term>
51885      <listitem><para>
51886the name of the media entity,
51887unique in the system
51888      </para></listitem>
51889    </varlistentry>
51890    <varlistentry>      <term>torch_intensity</term>
51891      <listitem><para>
51892constraints for the LED in torch mode
51893      </para></listitem>
51894    </varlistentry>
51895    <varlistentry>      <term>indicator_intensity</term>
51896      <listitem><para>
51897constraints for the indicator LED
51898      </para></listitem>
51899    </varlistentry>
51900    <varlistentry>      <term>flash_faults</term>
51901      <listitem><para>
51902bitmask of flash faults that the LED flash class
51903device can report; corresponding LED_FAULT* bit
51904definitions are available in the header file
51905&lt;linux/led-class-flash.h&gt;
51906      </para></listitem>
51907    </varlistentry>
51908    <varlistentry>      <term>has_external_strobe</term>
51909      <listitem><para>
51910external strobe capability
51911      </para></listitem>
51912    </varlistentry>
51913  </variablelist>
51914 </refsect1>
51915</refentry>
51916
51917<refentry id="API-struct-v4l2-flash">
51918<refentryinfo>
51919 <title>LINUX</title>
51920 <productname>Kernel Hackers Manual</productname>
51921 <date>July 2017</date>
51922</refentryinfo>
51923<refmeta>
51924 <refentrytitle><phrase>struct v4l2_flash</phrase></refentrytitle>
51925 <manvolnum>9</manvolnum>
51926 <refmiscinfo class="version">4.4.14</refmiscinfo>
51927</refmeta>
51928<refnamediv>
51929 <refname>struct v4l2_flash</refname>
51930 <refpurpose>
51931     Flash sub-device context
51932 </refpurpose>
51933</refnamediv>
51934<refsynopsisdiv>
51935 <title>Synopsis</title>
51936  <programlisting>
51937struct v4l2_flash {
51938  struct led_classdev_flash * fled_cdev;
51939  struct led_classdev_flash * iled_cdev;
51940  const struct v4l2_flash_ops * ops;
51941  struct v4l2_subdev sd;
51942  struct v4l2_ctrl_handler hdl;
51943  struct v4l2_ctrl ** ctrls;
51944};  </programlisting>
51945</refsynopsisdiv>
51946 <refsect1>
51947  <title>Members</title>
51948  <variablelist>
51949    <varlistentry>      <term>fled_cdev</term>
51950      <listitem><para>
51951   LED flash class device controlled by this sub-device
51952      </para></listitem>
51953    </varlistentry>
51954    <varlistentry>      <term>iled_cdev</term>
51955      <listitem><para>
51956   LED class device representing indicator LED associated
51957   with the LED flash class device
51958      </para></listitem>
51959    </varlistentry>
51960    <varlistentry>      <term>ops</term>
51961      <listitem><para>
51962   V4L2 specific flash ops
51963      </para></listitem>
51964    </varlistentry>
51965    <varlistentry>      <term>sd</term>
51966      <listitem><para>
51967   V4L2 sub-device
51968      </para></listitem>
51969    </varlistentry>
51970    <varlistentry>      <term>hdl</term>
51971      <listitem><para>
51972   flash controls handler
51973      </para></listitem>
51974    </varlistentry>
51975    <varlistentry>      <term>ctrls</term>
51976      <listitem><para>
51977   array of pointers to controls, whose values define
51978   the sub-device state
51979      </para></listitem>
51980    </varlistentry>
51981  </variablelist>
51982 </refsect1>
51983</refentry>
51984
51985<refentry id="API-v4l2-flash-init">
51986<refentryinfo>
51987 <title>LINUX</title>
51988 <productname>Kernel Hackers Manual</productname>
51989 <date>July 2017</date>
51990</refentryinfo>
51991<refmeta>
51992 <refentrytitle><phrase>v4l2_flash_init</phrase></refentrytitle>
51993 <manvolnum>9</manvolnum>
51994 <refmiscinfo class="version">4.4.14</refmiscinfo>
51995</refmeta>
51996<refnamediv>
51997 <refname>v4l2_flash_init</refname>
51998 <refpurpose>
51999     initialize V4L2 flash led sub-device
52000 </refpurpose>
52001</refnamediv>
52002<refsynopsisdiv>
52003 <title>Synopsis</title>
52004  <funcsynopsis><funcprototype>
52005   <funcdef><link linkend="API-struct-v4l2-flash">struct v4l2_flash</link> * <function>v4l2_flash_init </function></funcdef>
52006   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
52007   <paramdef>struct device_node * <parameter>of_node</parameter></paramdef>
52008   <paramdef>struct led_classdev_flash * <parameter>fled_cdev</parameter></paramdef>
52009   <paramdef>struct led_classdev_flash * <parameter>iled_cdev</parameter></paramdef>
52010   <paramdef>const struct v4l2_flash_ops * <parameter>ops</parameter></paramdef>
52011   <paramdef><link linkend="API-struct-v4l2-flash-config">struct v4l2_flash_config</link> * <parameter>config</parameter></paramdef>
52012  </funcprototype></funcsynopsis>
52013</refsynopsisdiv>
52014<refsect1>
52015 <title>Arguments</title>
52016 <variablelist>
52017  <varlistentry>
52018   <term><parameter>dev</parameter></term>
52019   <listitem>
52020    <para>
52021     flash device, e.g. an I2C device
52022    </para>
52023   </listitem>
52024  </varlistentry>
52025  <varlistentry>
52026   <term><parameter>of_node</parameter></term>
52027   <listitem>
52028    <para>
52029     of_node of the LED, may be NULL if the same as device's
52030    </para>
52031   </listitem>
52032  </varlistentry>
52033  <varlistentry>
52034   <term><parameter>fled_cdev</parameter></term>
52035   <listitem>
52036    <para>
52037     LED flash class device to wrap
52038    </para>
52039   </listitem>
52040  </varlistentry>
52041  <varlistentry>
52042   <term><parameter>iled_cdev</parameter></term>
52043   <listitem>
52044    <para>
52045     LED flash class device representing indicator LED associated
52046     with fled_cdev, may be NULL
52047    </para>
52048   </listitem>
52049  </varlistentry>
52050  <varlistentry>
52051   <term><parameter>ops</parameter></term>
52052   <listitem>
52053    <para>
52054     V4L2 Flash device ops
52055    </para>
52056   </listitem>
52057  </varlistentry>
52058  <varlistentry>
52059   <term><parameter>config</parameter></term>
52060   <listitem>
52061    <para>
52062     initialization data for V4L2 Flash sub-device
52063    </para>
52064   </listitem>
52065  </varlistentry>
52066 </variablelist>
52067</refsect1>
52068<refsect1>
52069<title>Description</title>
52070<para>
52071   Create V4L2 Flash sub-device wrapping given LED subsystem device.
52072</para>
52073</refsect1>
52074<refsect1>
52075<title>Returns</title>
52076<para>
52077   A valid pointer, or, when an error occurs, the return
52078   value is encoded using <function>ERR_PTR</function>. Use <function>IS_ERR</function> to check and
52079   <function>PTR_ERR</function> to obtain the numeric return value.
52080</para>
52081</refsect1>
52082</refentry>
52083
52084<refentry id="API-v4l2-flash-release">
52085<refentryinfo>
52086 <title>LINUX</title>
52087 <productname>Kernel Hackers Manual</productname>
52088 <date>July 2017</date>
52089</refentryinfo>
52090<refmeta>
52091 <refentrytitle><phrase>v4l2_flash_release</phrase></refentrytitle>
52092 <manvolnum>9</manvolnum>
52093 <refmiscinfo class="version">4.4.14</refmiscinfo>
52094</refmeta>
52095<refnamediv>
52096 <refname>v4l2_flash_release</refname>
52097 <refpurpose>
52098     release V4L2 Flash sub-device
52099 </refpurpose>
52100</refnamediv>
52101<refsynopsisdiv>
52102 <title>Synopsis</title>
52103  <funcsynopsis><funcprototype>
52104   <funcdef>void <function>v4l2_flash_release </function></funcdef>
52105   <paramdef><link linkend="API-struct-v4l2-flash">struct v4l2_flash</link> * <parameter>v4l2_flash</parameter></paramdef>
52106  </funcprototype></funcsynopsis>
52107</refsynopsisdiv>
52108<refsect1>
52109 <title>Arguments</title>
52110 <variablelist>
52111  <varlistentry>
52112   <term><parameter>v4l2_flash</parameter></term>
52113   <listitem>
52114    <para>
52115     the V4L2 Flash sub-device to release
52116    </para>
52117   </listitem>
52118  </varlistentry>
52119 </variablelist>
52120</refsect1>
52121<refsect1>
52122<title>Description</title>
52123<para>
52124   Release V4L2 Flash sub-device.
52125</para>
52126</refsect1>
52127</refentry>
52128
52129<!-- include/media/v4l2-mediabus.h -->
52130<refentry id="API-enum-v4l2-mbus-type">
52131<refentryinfo>
52132 <title>LINUX</title>
52133 <productname>Kernel Hackers Manual</productname>
52134 <date>July 2017</date>
52135</refentryinfo>
52136<refmeta>
52137 <refentrytitle><phrase>enum v4l2_mbus_type</phrase></refentrytitle>
52138 <manvolnum>9</manvolnum>
52139 <refmiscinfo class="version">4.4.14</refmiscinfo>
52140</refmeta>
52141<refnamediv>
52142 <refname>enum v4l2_mbus_type</refname>
52143 <refpurpose>
52144  media bus type
52145 </refpurpose>
52146</refnamediv>
52147<refsynopsisdiv>
52148 <title>Synopsis</title>
52149  <programlisting>
52150enum v4l2_mbus_type {
52151  V4L2_MBUS_PARALLEL,
52152  V4L2_MBUS_BT656,
52153  V4L2_MBUS_CSI2
52154};  </programlisting>
52155</refsynopsisdiv>
52156<refsect1>
52157 <title>Constants</title>
52158  <variablelist>
52159    <varlistentry>      <term>V4L2_MBUS_PARALLEL</term>
52160      <listitem><para>
52161parallel interface with hsync and vsync
52162      </para></listitem>
52163    </varlistentry>
52164    <varlistentry>      <term>V4L2_MBUS_BT656</term>
52165      <listitem><para>
52166parallel interface with embedded synchronisation, can
52167also be used for BT.1120
52168      </para></listitem>
52169    </varlistentry>
52170    <varlistentry>      <term>V4L2_MBUS_CSI2</term>
52171      <listitem><para>
52172MIPI CSI-2 serial interface
52173      </para></listitem>
52174    </varlistentry>
52175  </variablelist>
52176</refsect1>
52177</refentry>
52178
52179<refentry id="API-struct-v4l2-mbus-config">
52180<refentryinfo>
52181 <title>LINUX</title>
52182 <productname>Kernel Hackers Manual</productname>
52183 <date>July 2017</date>
52184</refentryinfo>
52185<refmeta>
52186 <refentrytitle><phrase>struct v4l2_mbus_config</phrase></refentrytitle>
52187 <manvolnum>9</manvolnum>
52188 <refmiscinfo class="version">4.4.14</refmiscinfo>
52189</refmeta>
52190<refnamediv>
52191 <refname>struct v4l2_mbus_config</refname>
52192 <refpurpose>
52193     media bus configuration
52194 </refpurpose>
52195</refnamediv>
52196<refsynopsisdiv>
52197 <title>Synopsis</title>
52198  <programlisting>
52199struct v4l2_mbus_config {
52200  enum v4l2_mbus_type type;
52201  unsigned int flags;
52202};  </programlisting>
52203</refsynopsisdiv>
52204 <refsect1>
52205  <title>Members</title>
52206  <variablelist>
52207    <varlistentry>      <term>type</term>
52208      <listitem><para>
52209   in: interface type
52210      </para></listitem>
52211    </varlistentry>
52212    <varlistentry>      <term>flags</term>
52213      <listitem><para>
52214   in / out: configuration flags, depending on <parameter>type</parameter>
52215      </para></listitem>
52216    </varlistentry>
52217  </variablelist>
52218 </refsect1>
52219</refentry>
52220
52221<!-- include/media/v4l2-mem2mem.h -->
52222<refentry id="API-struct-v4l2-m2m-ops">
52223<refentryinfo>
52224 <title>LINUX</title>
52225 <productname>Kernel Hackers Manual</productname>
52226 <date>July 2017</date>
52227</refentryinfo>
52228<refmeta>
52229 <refentrytitle><phrase>struct v4l2_m2m_ops</phrase></refentrytitle>
52230 <manvolnum>9</manvolnum>
52231 <refmiscinfo class="version">4.4.14</refmiscinfo>
52232</refmeta>
52233<refnamediv>
52234 <refname>struct v4l2_m2m_ops</refname>
52235 <refpurpose>
52236  mem-to-mem device driver callbacks
52237 </refpurpose>
52238</refnamediv>
52239<refsynopsisdiv>
52240 <title>Synopsis</title>
52241  <programlisting>
52242struct v4l2_m2m_ops {
52243  void (* device_run) (void *priv);
52244  int (* job_ready) (void *priv);
52245  void (* job_abort) (void *priv);
52246  void (* lock) (void *priv);
52247  void (* unlock) (void *priv);
52248};  </programlisting>
52249</refsynopsisdiv>
52250 <refsect1>
52251  <title>Members</title>
52252  <variablelist>
52253    <varlistentry>      <term>device_run</term>
52254      <listitem><para>
52255required. Begin the actual job (transaction) inside this
52256callback.
52257The job does NOT have to end before this callback returns
52258(and it will be the usual case). When the job finishes,
52259<function>v4l2_m2m_job_finish</function> has to be called.
52260      </para></listitem>
52261    </varlistentry>
52262    <varlistentry>      <term>job_ready</term>
52263      <listitem><para>
52264optional. Should return 0 if the driver does not have a job
52265fully prepared to run yet (i.e. it will not be able to finish a
52266transaction without sleeping). If not provided, it will be
52267assumed that one source and one destination buffer are all
52268that is required for the driver to perform one full transaction.
52269This method may not sleep.
52270      </para></listitem>
52271    </varlistentry>
52272    <varlistentry>      <term>job_abort</term>
52273      <listitem><para>
52274required. Informs the driver that it has to abort the currently
52275running transaction as soon as possible (i.e. as soon as it can
52276stop the device safely; e.g. in the next interrupt handler),
52277even if the transaction would not have been finished by then.
52278After the driver performs the necessary steps, it has to call
52279<function>v4l2_m2m_job_finish</function> (as if the transaction ended normally).
52280This function does not have to (and will usually not) wait
52281until the device enters a state when it can be stopped.
52282      </para></listitem>
52283    </varlistentry>
52284    <varlistentry>      <term>lock</term>
52285      <listitem><para>
52286optional. Define a driver's own lock callback, instead of using
52287m2m_ctx-&gt;q_lock.
52288      </para></listitem>
52289    </varlistentry>
52290    <varlistentry>      <term>unlock</term>
52291      <listitem><para>
52292optional. Define a driver's own unlock callback, instead of
52293using m2m_ctx-&gt;q_lock.
52294      </para></listitem>
52295    </varlistentry>
52296  </variablelist>
52297 </refsect1>
52298</refentry>
52299
52300<refentry id="API-v4l2-m2m-num-src-bufs-ready">
52301<refentryinfo>
52302 <title>LINUX</title>
52303 <productname>Kernel Hackers Manual</productname>
52304 <date>July 2017</date>
52305</refentryinfo>
52306<refmeta>
52307 <refentrytitle><phrase>v4l2_m2m_num_src_bufs_ready</phrase></refentrytitle>
52308 <manvolnum>9</manvolnum>
52309 <refmiscinfo class="version">4.4.14</refmiscinfo>
52310</refmeta>
52311<refnamediv>
52312 <refname>v4l2_m2m_num_src_bufs_ready</refname>
52313 <refpurpose>
52314     return the number of source buffers ready for use
52315 </refpurpose>
52316</refnamediv>
52317<refsynopsisdiv>
52318 <title>Synopsis</title>
52319  <funcsynopsis><funcprototype>
52320   <funcdef>unsigned int <function>v4l2_m2m_num_src_bufs_ready </function></funcdef>
52321   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52322  </funcprototype></funcsynopsis>
52323</refsynopsisdiv>
52324<refsect1>
52325 <title>Arguments</title>
52326 <variablelist>
52327  <varlistentry>
52328   <term><parameter>m2m_ctx</parameter></term>
52329   <listitem>
52330    <para>
52331     pointer to struct v4l2_m2m_ctx
52332    </para>
52333   </listitem>
52334  </varlistentry>
52335 </variablelist>
52336</refsect1>
52337</refentry>
52338
52339<refentry id="API-v4l2-m2m-num-dst-bufs-ready">
52340<refentryinfo>
52341 <title>LINUX</title>
52342 <productname>Kernel Hackers Manual</productname>
52343 <date>July 2017</date>
52344</refentryinfo>
52345<refmeta>
52346 <refentrytitle><phrase>v4l2_m2m_num_dst_bufs_ready</phrase></refentrytitle>
52347 <manvolnum>9</manvolnum>
52348 <refmiscinfo class="version">4.4.14</refmiscinfo>
52349</refmeta>
52350<refnamediv>
52351 <refname>v4l2_m2m_num_dst_bufs_ready</refname>
52352 <refpurpose>
52353     return the number of destination buffers ready for use
52354 </refpurpose>
52355</refnamediv>
52356<refsynopsisdiv>
52357 <title>Synopsis</title>
52358  <funcsynopsis><funcprototype>
52359   <funcdef>unsigned int <function>v4l2_m2m_num_dst_bufs_ready </function></funcdef>
52360   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52361  </funcprototype></funcsynopsis>
52362</refsynopsisdiv>
52363<refsect1>
52364 <title>Arguments</title>
52365 <variablelist>
52366  <varlistentry>
52367   <term><parameter>m2m_ctx</parameter></term>
52368   <listitem>
52369    <para>
52370     pointer to struct v4l2_m2m_ctx
52371    </para>
52372   </listitem>
52373  </varlistentry>
52374 </variablelist>
52375</refsect1>
52376</refentry>
52377
52378<refentry id="API-v4l2-m2m-next-src-buf">
52379<refentryinfo>
52380 <title>LINUX</title>
52381 <productname>Kernel Hackers Manual</productname>
52382 <date>July 2017</date>
52383</refentryinfo>
52384<refmeta>
52385 <refentrytitle><phrase>v4l2_m2m_next_src_buf</phrase></refentrytitle>
52386 <manvolnum>9</manvolnum>
52387 <refmiscinfo class="version">4.4.14</refmiscinfo>
52388</refmeta>
52389<refnamediv>
52390 <refname>v4l2_m2m_next_src_buf</refname>
52391 <refpurpose>
52392     return next source buffer from the list of ready buffers
52393 </refpurpose>
52394</refnamediv>
52395<refsynopsisdiv>
52396 <title>Synopsis</title>
52397  <funcsynopsis><funcprototype>
52398   <funcdef>void * <function>v4l2_m2m_next_src_buf </function></funcdef>
52399   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52400  </funcprototype></funcsynopsis>
52401</refsynopsisdiv>
52402<refsect1>
52403 <title>Arguments</title>
52404 <variablelist>
52405  <varlistentry>
52406   <term><parameter>m2m_ctx</parameter></term>
52407   <listitem>
52408    <para>
52409     pointer to struct v4l2_m2m_ctx
52410    </para>
52411   </listitem>
52412  </varlistentry>
52413 </variablelist>
52414</refsect1>
52415</refentry>
52416
52417<refentry id="API-v4l2-m2m-next-dst-buf">
52418<refentryinfo>
52419 <title>LINUX</title>
52420 <productname>Kernel Hackers Manual</productname>
52421 <date>July 2017</date>
52422</refentryinfo>
52423<refmeta>
52424 <refentrytitle><phrase>v4l2_m2m_next_dst_buf</phrase></refentrytitle>
52425 <manvolnum>9</manvolnum>
52426 <refmiscinfo class="version">4.4.14</refmiscinfo>
52427</refmeta>
52428<refnamediv>
52429 <refname>v4l2_m2m_next_dst_buf</refname>
52430 <refpurpose>
52431     return next destination buffer from the list of ready buffers
52432 </refpurpose>
52433</refnamediv>
52434<refsynopsisdiv>
52435 <title>Synopsis</title>
52436  <funcsynopsis><funcprototype>
52437   <funcdef>void * <function>v4l2_m2m_next_dst_buf </function></funcdef>
52438   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52439  </funcprototype></funcsynopsis>
52440</refsynopsisdiv>
52441<refsect1>
52442 <title>Arguments</title>
52443 <variablelist>
52444  <varlistentry>
52445   <term><parameter>m2m_ctx</parameter></term>
52446   <listitem>
52447    <para>
52448     pointer to struct v4l2_m2m_ctx
52449    </para>
52450   </listitem>
52451  </varlistentry>
52452 </variablelist>
52453</refsect1>
52454</refentry>
52455
52456<refentry id="API-v4l2-m2m-get-src-vq">
52457<refentryinfo>
52458 <title>LINUX</title>
52459 <productname>Kernel Hackers Manual</productname>
52460 <date>July 2017</date>
52461</refentryinfo>
52462<refmeta>
52463 <refentrytitle><phrase>v4l2_m2m_get_src_vq</phrase></refentrytitle>
52464 <manvolnum>9</manvolnum>
52465 <refmiscinfo class="version">4.4.14</refmiscinfo>
52466</refmeta>
52467<refnamediv>
52468 <refname>v4l2_m2m_get_src_vq</refname>
52469 <refpurpose>
52470     return vb2_queue for source buffers
52471 </refpurpose>
52472</refnamediv>
52473<refsynopsisdiv>
52474 <title>Synopsis</title>
52475  <funcsynopsis><funcprototype>
52476   <funcdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <function>v4l2_m2m_get_src_vq </function></funcdef>
52477   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52478  </funcprototype></funcsynopsis>
52479</refsynopsisdiv>
52480<refsect1>
52481 <title>Arguments</title>
52482 <variablelist>
52483  <varlistentry>
52484   <term><parameter>m2m_ctx</parameter></term>
52485   <listitem>
52486    <para>
52487     pointer to struct v4l2_m2m_ctx
52488    </para>
52489   </listitem>
52490  </varlistentry>
52491 </variablelist>
52492</refsect1>
52493</refentry>
52494
52495<refentry id="API-v4l2-m2m-get-dst-vq">
52496<refentryinfo>
52497 <title>LINUX</title>
52498 <productname>Kernel Hackers Manual</productname>
52499 <date>July 2017</date>
52500</refentryinfo>
52501<refmeta>
52502 <refentrytitle><phrase>v4l2_m2m_get_dst_vq</phrase></refentrytitle>
52503 <manvolnum>9</manvolnum>
52504 <refmiscinfo class="version">4.4.14</refmiscinfo>
52505</refmeta>
52506<refnamediv>
52507 <refname>v4l2_m2m_get_dst_vq</refname>
52508 <refpurpose>
52509     return vb2_queue for destination buffers
52510 </refpurpose>
52511</refnamediv>
52512<refsynopsisdiv>
52513 <title>Synopsis</title>
52514  <funcsynopsis><funcprototype>
52515   <funcdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <function>v4l2_m2m_get_dst_vq </function></funcdef>
52516   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52517  </funcprototype></funcsynopsis>
52518</refsynopsisdiv>
52519<refsect1>
52520 <title>Arguments</title>
52521 <variablelist>
52522  <varlistentry>
52523   <term><parameter>m2m_ctx</parameter></term>
52524   <listitem>
52525    <para>
52526     pointer to struct v4l2_m2m_ctx
52527    </para>
52528   </listitem>
52529  </varlistentry>
52530 </variablelist>
52531</refsect1>
52532</refentry>
52533
52534<refentry id="API-v4l2-m2m-src-buf-remove">
52535<refentryinfo>
52536 <title>LINUX</title>
52537 <productname>Kernel Hackers Manual</productname>
52538 <date>July 2017</date>
52539</refentryinfo>
52540<refmeta>
52541 <refentrytitle><phrase>v4l2_m2m_src_buf_remove</phrase></refentrytitle>
52542 <manvolnum>9</manvolnum>
52543 <refmiscinfo class="version">4.4.14</refmiscinfo>
52544</refmeta>
52545<refnamediv>
52546 <refname>v4l2_m2m_src_buf_remove</refname>
52547 <refpurpose>
52548     take off a source buffer from the list of ready buffers and return it
52549 </refpurpose>
52550</refnamediv>
52551<refsynopsisdiv>
52552 <title>Synopsis</title>
52553  <funcsynopsis><funcprototype>
52554   <funcdef>void * <function>v4l2_m2m_src_buf_remove </function></funcdef>
52555   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52556  </funcprototype></funcsynopsis>
52557</refsynopsisdiv>
52558<refsect1>
52559 <title>Arguments</title>
52560 <variablelist>
52561  <varlistentry>
52562   <term><parameter>m2m_ctx</parameter></term>
52563   <listitem>
52564    <para>
52565     pointer to struct v4l2_m2m_ctx
52566    </para>
52567   </listitem>
52568  </varlistentry>
52569 </variablelist>
52570</refsect1>
52571</refentry>
52572
52573<refentry id="API-v4l2-m2m-dst-buf-remove">
52574<refentryinfo>
52575 <title>LINUX</title>
52576 <productname>Kernel Hackers Manual</productname>
52577 <date>July 2017</date>
52578</refentryinfo>
52579<refmeta>
52580 <refentrytitle><phrase>v4l2_m2m_dst_buf_remove</phrase></refentrytitle>
52581 <manvolnum>9</manvolnum>
52582 <refmiscinfo class="version">4.4.14</refmiscinfo>
52583</refmeta>
52584<refnamediv>
52585 <refname>v4l2_m2m_dst_buf_remove</refname>
52586 <refpurpose>
52587     take off a destination buffer from the list of ready buffers and return it
52588 </refpurpose>
52589</refnamediv>
52590<refsynopsisdiv>
52591 <title>Synopsis</title>
52592  <funcsynopsis><funcprototype>
52593   <funcdef>void * <function>v4l2_m2m_dst_buf_remove </function></funcdef>
52594   <paramdef>struct v4l2_m2m_ctx * <parameter>m2m_ctx</parameter></paramdef>
52595  </funcprototype></funcsynopsis>
52596</refsynopsisdiv>
52597<refsect1>
52598 <title>Arguments</title>
52599 <variablelist>
52600  <varlistentry>
52601   <term><parameter>m2m_ctx</parameter></term>
52602   <listitem>
52603    <para>
52604     pointer to struct v4l2_m2m_ctx
52605    </para>
52606   </listitem>
52607  </varlistentry>
52608 </variablelist>
52609</refsect1>
52610</refentry>
52611
52612<!-- include/media/v4l2-of.h -->
52613<refentry id="API-struct-v4l2-of-bus-mipi-csi2">
52614<refentryinfo>
52615 <title>LINUX</title>
52616 <productname>Kernel Hackers Manual</productname>
52617 <date>July 2017</date>
52618</refentryinfo>
52619<refmeta>
52620 <refentrytitle><phrase>struct v4l2_of_bus_mipi_csi2</phrase></refentrytitle>
52621 <manvolnum>9</manvolnum>
52622 <refmiscinfo class="version">4.4.14</refmiscinfo>
52623</refmeta>
52624<refnamediv>
52625 <refname>struct v4l2_of_bus_mipi_csi2</refname>
52626 <refpurpose>
52627  MIPI CSI-2 bus data structure
52628 </refpurpose>
52629</refnamediv>
52630<refsynopsisdiv>
52631 <title>Synopsis</title>
52632  <programlisting>
52633struct v4l2_of_bus_mipi_csi2 {
52634  unsigned int flags;
52635  unsigned char data_lanes[4];
52636  unsigned char clock_lane;
52637  unsigned short num_data_lanes;
52638  bool lane_polarities[5];
52639};  </programlisting>
52640</refsynopsisdiv>
52641 <refsect1>
52642  <title>Members</title>
52643  <variablelist>
52644    <varlistentry>      <term>flags</term>
52645      <listitem><para>
52646media bus (V4L2_MBUS_*) flags
52647      </para></listitem>
52648    </varlistentry>
52649    <varlistentry>      <term>data_lanes[4]</term>
52650      <listitem><para>
52651an array of physical data lane indexes
52652      </para></listitem>
52653    </varlistentry>
52654    <varlistentry>      <term>clock_lane</term>
52655      <listitem><para>
52656physical lane index of the clock lane
52657      </para></listitem>
52658    </varlistentry>
52659    <varlistentry>      <term>num_data_lanes</term>
52660      <listitem><para>
52661number of data lanes
52662      </para></listitem>
52663    </varlistentry>
52664    <varlistentry>      <term>lane_polarities[5]</term>
52665      <listitem><para>
52666polarity of the lanes. The order is the same of
52667the physical lanes.
52668      </para></listitem>
52669    </varlistentry>
52670  </variablelist>
52671 </refsect1>
52672</refentry>
52673
52674<refentry id="API-struct-v4l2-of-bus-parallel">
52675<refentryinfo>
52676 <title>LINUX</title>
52677 <productname>Kernel Hackers Manual</productname>
52678 <date>July 2017</date>
52679</refentryinfo>
52680<refmeta>
52681 <refentrytitle><phrase>struct v4l2_of_bus_parallel</phrase></refentrytitle>
52682 <manvolnum>9</manvolnum>
52683 <refmiscinfo class="version">4.4.14</refmiscinfo>
52684</refmeta>
52685<refnamediv>
52686 <refname>struct v4l2_of_bus_parallel</refname>
52687 <refpurpose>
52688     parallel data bus data structure
52689 </refpurpose>
52690</refnamediv>
52691<refsynopsisdiv>
52692 <title>Synopsis</title>
52693  <programlisting>
52694struct v4l2_of_bus_parallel {
52695  unsigned int flags;
52696  unsigned char bus_width;
52697  unsigned char data_shift;
52698};  </programlisting>
52699</refsynopsisdiv>
52700 <refsect1>
52701  <title>Members</title>
52702  <variablelist>
52703    <varlistentry>      <term>flags</term>
52704      <listitem><para>
52705   media bus (V4L2_MBUS_*) flags
52706      </para></listitem>
52707    </varlistentry>
52708    <varlistentry>      <term>bus_width</term>
52709      <listitem><para>
52710   bus width in bits
52711      </para></listitem>
52712    </varlistentry>
52713    <varlistentry>      <term>data_shift</term>
52714      <listitem><para>
52715   data shift in bits
52716      </para></listitem>
52717    </varlistentry>
52718  </variablelist>
52719 </refsect1>
52720</refentry>
52721
52722<refentry id="API-struct-v4l2-of-endpoint">
52723<refentryinfo>
52724 <title>LINUX</title>
52725 <productname>Kernel Hackers Manual</productname>
52726 <date>July 2017</date>
52727</refentryinfo>
52728<refmeta>
52729 <refentrytitle><phrase>struct v4l2_of_endpoint</phrase></refentrytitle>
52730 <manvolnum>9</manvolnum>
52731 <refmiscinfo class="version">4.4.14</refmiscinfo>
52732</refmeta>
52733<refnamediv>
52734 <refname>struct v4l2_of_endpoint</refname>
52735 <refpurpose>
52736     the endpoint data structure
52737 </refpurpose>
52738</refnamediv>
52739<refsynopsisdiv>
52740 <title>Synopsis</title>
52741  <programlisting>
52742struct v4l2_of_endpoint {
52743  struct of_endpoint base;
52744  enum v4l2_mbus_type bus_type;
52745  union bus;
52746  u64 * link_frequencies;
52747  unsigned int nr_of_link_frequencies;
52748};  </programlisting>
52749</refsynopsisdiv>
52750 <refsect1>
52751  <title>Members</title>
52752  <variablelist>
52753    <varlistentry>      <term>base</term>
52754      <listitem><para>
52755   struct of_endpoint containing port, id, and local of_node
52756      </para></listitem>
52757    </varlistentry>
52758    <varlistentry>      <term>bus_type</term>
52759      <listitem><para>
52760   bus type
52761      </para></listitem>
52762    </varlistentry>
52763    <varlistentry>      <term>bus</term>
52764      <listitem><para>
52765   bus configuration data structure
52766      </para></listitem>
52767    </varlistentry>
52768    <varlistentry>      <term>link_frequencies</term>
52769      <listitem><para>
52770   array of supported link frequencies
52771      </para></listitem>
52772    </varlistentry>
52773    <varlistentry>      <term>nr_of_link_frequencies</term>
52774      <listitem><para>
52775   number of elements in link_frequenccies array
52776      </para></listitem>
52777    </varlistentry>
52778  </variablelist>
52779 </refsect1>
52780</refentry>
52781
52782<refentry id="API-struct-v4l2-of-link">
52783<refentryinfo>
52784 <title>LINUX</title>
52785 <productname>Kernel Hackers Manual</productname>
52786 <date>July 2017</date>
52787</refentryinfo>
52788<refmeta>
52789 <refentrytitle><phrase>struct v4l2_of_link</phrase></refentrytitle>
52790 <manvolnum>9</manvolnum>
52791 <refmiscinfo class="version">4.4.14</refmiscinfo>
52792</refmeta>
52793<refnamediv>
52794 <refname>struct v4l2_of_link</refname>
52795 <refpurpose>
52796     a link between two endpoints
52797 </refpurpose>
52798</refnamediv>
52799<refsynopsisdiv>
52800 <title>Synopsis</title>
52801  <programlisting>
52802struct v4l2_of_link {
52803  struct device_node * local_node;
52804  unsigned int local_port;
52805  struct device_node * remote_node;
52806  unsigned int remote_port;
52807};  </programlisting>
52808</refsynopsisdiv>
52809 <refsect1>
52810  <title>Members</title>
52811  <variablelist>
52812    <varlistentry>      <term>local_node</term>
52813      <listitem><para>
52814   pointer to device_node of this endpoint
52815      </para></listitem>
52816    </varlistentry>
52817    <varlistentry>      <term>local_port</term>
52818      <listitem><para>
52819   identifier of the port this endpoint belongs to
52820      </para></listitem>
52821    </varlistentry>
52822    <varlistentry>      <term>remote_node</term>
52823      <listitem><para>
52824   pointer to device_node of the remote endpoint
52825      </para></listitem>
52826    </varlistentry>
52827    <varlistentry>      <term>remote_port</term>
52828      <listitem><para>
52829   identifier of the port the remote endpoint belongs to
52830      </para></listitem>
52831    </varlistentry>
52832  </variablelist>
52833 </refsect1>
52834</refentry>
52835
52836<!-- include/media/v4l2-subdev.h -->
52837<refentry id="API-struct-v4l2-subdev-core-ops">
52838<refentryinfo>
52839 <title>LINUX</title>
52840 <productname>Kernel Hackers Manual</productname>
52841 <date>July 2017</date>
52842</refentryinfo>
52843<refmeta>
52844 <refentrytitle><phrase>struct v4l2_subdev_core_ops</phrase></refentrytitle>
52845 <manvolnum>9</manvolnum>
52846 <refmiscinfo class="version">4.4.14</refmiscinfo>
52847</refmeta>
52848<refnamediv>
52849 <refname>struct v4l2_subdev_core_ops</refname>
52850 <refpurpose>
52851  Define core ops callbacks for subdevs
52852 </refpurpose>
52853</refnamediv>
52854<refsynopsisdiv>
52855 <title>Synopsis</title>
52856  <programlisting>
52857struct v4l2_subdev_core_ops {
52858  int (* log_status) (struct v4l2_subdev *sd);
52859  int (* s_io_pin_config) (struct v4l2_subdev *sd, size_t n,struct v4l2_subdev_io_pin_config *pincfg);
52860  int (* init) (struct v4l2_subdev *sd, u32 val);
52861  int (* load_fw) (struct v4l2_subdev *sd);
52862  int (* reset) (struct v4l2_subdev *sd, u32 val);
52863  int (* s_gpio) (struct v4l2_subdev *sd, u32 val);
52864  int (* queryctrl) (struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
52865  int (* g_ctrl) (struct v4l2_subdev *sd, struct v4l2_control *ctrl);
52866  int (* s_ctrl) (struct v4l2_subdev *sd, struct v4l2_control *ctrl);
52867  int (* g_ext_ctrls) (struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
52868  int (* s_ext_ctrls) (struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
52869  int (* try_ext_ctrls) (struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
52870  int (* querymenu) (struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
52871  long (* ioctl) (struct v4l2_subdev *sd, unsigned int cmd, void *arg);
52872#ifdef CONFIG_COMPAT
52873  long (* compat_ioctl32) (struct v4l2_subdev *sd, unsigned int cmd,unsigned long arg);
52874#endif
52875#ifdef CONFIG_VIDEO_ADV_DEBUG
52876  int (* g_register) (struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
52877  int (* s_register) (struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
52878#endif
52879  int (* s_power) (struct v4l2_subdev *sd, int on);
52880  int (* interrupt_service_routine) (struct v4l2_subdev *sd,u32 status, bool *handled);
52881  int (* subscribe_event) (struct v4l2_subdev *sd, struct v4l2_fh *fh,struct v4l2_event_subscription *sub);
52882  int (* unsubscribe_event) (struct v4l2_subdev *sd, struct v4l2_fh *fh,struct v4l2_event_subscription *sub);
52883};  </programlisting>
52884</refsynopsisdiv>
52885 <refsect1>
52886  <title>Members</title>
52887  <variablelist>
52888    <varlistentry>      <term>log_status</term>
52889      <listitem><para>
52890callback for VIDIOC_LOG_STATUS ioctl handler code.
52891      </para></listitem>
52892    </varlistentry>
52893    <varlistentry>      <term>s_io_pin_config</term>
52894      <listitem><para>
52895configure one or more chip I/O pins for chips that
52896multiplex different internal signal pads out to IO pins.  This function
52897takes a pointer to an array of 'n' pin configuration entries, one for
52898each pin being configured.  This function could be called at times
52899other than just subdevice initialization.
52900      </para></listitem>
52901    </varlistentry>
52902    <varlistentry>      <term>init</term>
52903      <listitem><para>
52904initialize the sensor registers to some sort of reasonable default
52905values. Do not use for new drivers and should be removed in existing
52906drivers.
52907      </para></listitem>
52908    </varlistentry>
52909    <varlistentry>      <term>load_fw</term>
52910      <listitem><para>
52911load firmware.
52912      </para></listitem>
52913    </varlistentry>
52914    <varlistentry>      <term>reset</term>
52915      <listitem><para>
52916generic reset command. The argument selects which subsystems to
52917reset. Passing 0 will always reset the whole chip. Do not use for new
52918drivers without discussing this first on the linux-media mailinglist.
52919There should be no reason normally to reset a device.
52920      </para></listitem>
52921    </varlistentry>
52922    <varlistentry>      <term>s_gpio</term>
52923      <listitem><para>
52924set GPIO pins. Very simple right now, might need to be extended with
52925a direction argument if needed.
52926      </para></listitem>
52927    </varlistentry>
52928    <varlistentry>      <term>queryctrl</term>
52929      <listitem><para>
52930callback for VIDIOC_QUERYCTL ioctl handler code.
52931      </para></listitem>
52932    </varlistentry>
52933    <varlistentry>      <term>g_ctrl</term>
52934      <listitem><para>
52935callback for VIDIOC_G_CTRL ioctl handler code.
52936      </para></listitem>
52937    </varlistentry>
52938    <varlistentry>      <term>s_ctrl</term>
52939      <listitem><para>
52940callback for VIDIOC_S_CTRL ioctl handler code.
52941      </para></listitem>
52942    </varlistentry>
52943    <varlistentry>      <term>g_ext_ctrls</term>
52944      <listitem><para>
52945callback for VIDIOC_G_EXT_CTRLS ioctl handler code.
52946      </para></listitem>
52947    </varlistentry>
52948    <varlistentry>      <term>s_ext_ctrls</term>
52949      <listitem><para>
52950callback for VIDIOC_S_EXT_CTRLS ioctl handler code.
52951      </para></listitem>
52952    </varlistentry>
52953    <varlistentry>      <term>try_ext_ctrls</term>
52954      <listitem><para>
52955callback for VIDIOC_TRY_EXT_CTRLS ioctl handler code.
52956      </para></listitem>
52957    </varlistentry>
52958    <varlistentry>      <term>querymenu</term>
52959      <listitem><para>
52960callback for VIDIOC_QUERYMENU ioctl handler code.
52961      </para></listitem>
52962    </varlistentry>
52963    <varlistentry>      <term>ioctl</term>
52964      <listitem><para>
52965called at the end of <function>ioctl</function> syscall handler at the V4L2 core.
52966used to provide support for private ioctls used on the driver.
52967      </para></listitem>
52968    </varlistentry>
52969    <varlistentry>      <term>compat_ioctl32</term>
52970      <listitem><para>
52971called when a 32 bits application uses a 64 bits Kernel,
52972in order to fix data passed from/to userspace.
52973      </para></listitem>
52974    </varlistentry>
52975    <varlistentry>      <term>g_register</term>
52976      <listitem><para>
52977callback for VIDIOC_G_REGISTER ioctl handler code.
52978      </para></listitem>
52979    </varlistentry>
52980    <varlistentry>      <term>s_register</term>
52981      <listitem><para>
52982callback for VIDIOC_G_REGISTER ioctl handler code.
52983      </para></listitem>
52984    </varlistentry>
52985    <varlistentry>      <term>s_power</term>
52986      <listitem><para>
52987puts subdevice in power saving mode (on == 0) or normal operation
52988mode (on == 1).
52989      </para></listitem>
52990    </varlistentry>
52991    <varlistentry>      <term>interrupt_service_routine</term>
52992      <listitem><para>
52993Called by the bridge chip's interrupt service
52994handler, when an interrupt status has be raised due to this subdev,
52995so that this subdev can handle the details.  It may schedule work to be
52996performed later.  It must not sleep.  *Called from an IRQ context*.
52997      </para></listitem>
52998    </varlistentry>
52999    <varlistentry>      <term>subscribe_event</term>
53000      <listitem><para>
53001used by the drivers to request the control framework that
53002for it to be warned when the value of a control changes.
53003      </para></listitem>
53004    </varlistentry>
53005    <varlistentry>      <term>unsubscribe_event</term>
53006      <listitem><para>
53007remove event subscription from the control framework.
53008      </para></listitem>
53009    </varlistentry>
53010  </variablelist>
53011 </refsect1>
53012</refentry>
53013
53014<refentry id="API-struct-v4l2-subdev-tuner-ops">
53015<refentryinfo>
53016 <title>LINUX</title>
53017 <productname>Kernel Hackers Manual</productname>
53018 <date>July 2017</date>
53019</refentryinfo>
53020<refmeta>
53021 <refentrytitle><phrase>struct v4l2_subdev_tuner_ops</phrase></refentrytitle>
53022 <manvolnum>9</manvolnum>
53023 <refmiscinfo class="version">4.4.14</refmiscinfo>
53024</refmeta>
53025<refnamediv>
53026 <refname>struct v4l2_subdev_tuner_ops</refname>
53027 <refpurpose>
53028     Callbacks used when v4l device was opened in radio mode.
53029 </refpurpose>
53030</refnamediv>
53031<refsynopsisdiv>
53032 <title>Synopsis</title>
53033  <programlisting>
53034struct v4l2_subdev_tuner_ops {
53035  int (* s_radio) (struct v4l2_subdev *sd);
53036  int (* s_frequency) (struct v4l2_subdev *sd, const struct v4l2_frequency *freq);
53037  int (* g_frequency) (struct v4l2_subdev *sd, struct v4l2_frequency *freq);
53038  int (* enum_freq_bands) (struct v4l2_subdev *sd, struct v4l2_frequency_band *band);
53039  int (* g_tuner) (struct v4l2_subdev *sd, struct v4l2_tuner *vt);
53040  int (* s_tuner) (struct v4l2_subdev *sd, const struct v4l2_tuner *vt);
53041  int (* g_modulator) (struct v4l2_subdev *sd, struct v4l2_modulator *vm);
53042  int (* s_modulator) (struct v4l2_subdev *sd, const struct v4l2_modulator *vm);
53043  int (* s_type_addr) (struct v4l2_subdev *sd, struct tuner_setup *type);
53044  int (* s_config) (struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
53045};  </programlisting>
53046</refsynopsisdiv>
53047 <refsect1>
53048  <title>Members</title>
53049  <variablelist>
53050    <varlistentry>      <term>s_radio</term>
53051      <listitem><para>
53052   callback for VIDIOC_S_RADIO ioctl handler code.
53053      </para></listitem>
53054    </varlistentry>
53055    <varlistentry>      <term>s_frequency</term>
53056      <listitem><para>
53057   callback for VIDIOC_S_FREQUENCY ioctl handler code.
53058      </para></listitem>
53059    </varlistentry>
53060    <varlistentry>      <term>g_frequency</term>
53061      <listitem><para>
53062   callback for VIDIOC_G_FREQUENCY ioctl handler code.
53063   freq-&gt;type must be filled in. Normally done by video_ioctl2
53064   or the bridge driver.
53065      </para></listitem>
53066    </varlistentry>
53067    <varlistentry>      <term>enum_freq_bands</term>
53068      <listitem><para>
53069   callback for VIDIOC_ENUM_FREQ_BANDS ioctl handler code.
53070      </para></listitem>
53071    </varlistentry>
53072    <varlistentry>      <term>g_tuner</term>
53073      <listitem><para>
53074   callback for VIDIOC_G_TUNER ioctl handler code.
53075      </para></listitem>
53076    </varlistentry>
53077    <varlistentry>      <term>s_tuner</term>
53078      <listitem><para>
53079   callback for VIDIOC_S_TUNER ioctl handler code. vt-&gt;type must be
53080   filled in. Normally done by video_ioctl2 or the
53081   bridge driver.
53082      </para></listitem>
53083    </varlistentry>
53084    <varlistentry>      <term>g_modulator</term>
53085      <listitem><para>
53086   callback for VIDIOC_G_MODULATOR ioctl handler code.
53087      </para></listitem>
53088    </varlistentry>
53089    <varlistentry>      <term>s_modulator</term>
53090      <listitem><para>
53091   callback for VIDIOC_S_MODULATOR ioctl handler code.
53092      </para></listitem>
53093    </varlistentry>
53094    <varlistentry>      <term>s_type_addr</term>
53095      <listitem><para>
53096   sets tuner type and its I2C addr.
53097      </para></listitem>
53098    </varlistentry>
53099    <varlistentry>      <term>s_config</term>
53100      <listitem><para>
53101   sets tda9887 specific stuff, like port1, port2 and qss
53102      </para></listitem>
53103    </varlistentry>
53104  </variablelist>
53105 </refsect1>
53106</refentry>
53107
53108<refentry id="API-struct-v4l2-subdev-audio-ops">
53109<refentryinfo>
53110 <title>LINUX</title>
53111 <productname>Kernel Hackers Manual</productname>
53112 <date>July 2017</date>
53113</refentryinfo>
53114<refmeta>
53115 <refentrytitle><phrase>struct v4l2_subdev_audio_ops</phrase></refentrytitle>
53116 <manvolnum>9</manvolnum>
53117 <refmiscinfo class="version">4.4.14</refmiscinfo>
53118</refmeta>
53119<refnamediv>
53120 <refname>struct v4l2_subdev_audio_ops</refname>
53121 <refpurpose>
53122     Callbacks used for audio-related settings
53123 </refpurpose>
53124</refnamediv>
53125<refsynopsisdiv>
53126 <title>Synopsis</title>
53127  <programlisting>
53128struct v4l2_subdev_audio_ops {
53129  int (* s_clock_freq) (struct v4l2_subdev *sd, u32 freq);
53130  int (* s_i2s_clock_freq) (struct v4l2_subdev *sd, u32 freq);
53131  int (* s_routing) (struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
53132  int (* s_stream) (struct v4l2_subdev *sd, int enable);
53133};  </programlisting>
53134</refsynopsisdiv>
53135 <refsect1>
53136  <title>Members</title>
53137  <variablelist>
53138    <varlistentry>      <term>s_clock_freq</term>
53139      <listitem><para>
53140   set the frequency (in Hz) of the audio clock output.
53141   Used to slave an audio processor to the video decoder, ensuring that
53142   audio and video remain synchronized. Usual values for the frequency
53143   are 48000, 44100 or 32000 Hz. If the frequency is not supported, then
53144   -EINVAL is returned.
53145      </para></listitem>
53146    </varlistentry>
53147    <varlistentry>      <term>s_i2s_clock_freq</term>
53148      <listitem><para>
53149   sets I2S speed in bps. This is used to provide a standard
53150   way to select I2S clock used by driving digital audio streams at some
53151   board designs. Usual values for the frequency are 1024000 and 2048000.
53152   If the frequency is not supported, then -EINVAL is returned.
53153      </para></listitem>
53154    </varlistentry>
53155    <varlistentry>      <term>s_routing</term>
53156      <listitem><para>
53157   used to define the input and/or output pins of an audio chip,
53158   and any additional configuration data.
53159   Never attempt to use user-level input IDs (e.g. Composite, S-Video,
53160   Tuner) at this level. An i2c device shouldn't know about whether an
53161   input pin is connected to a Composite connector, become on another
53162   board or platform it might be connected to something else entirely.
53163   The calling driver is responsible for mapping a user-level input to
53164   the right pins on the i2c device.
53165      </para></listitem>
53166    </varlistentry>
53167    <varlistentry>      <term>s_stream</term>
53168      <listitem><para>
53169   used to notify the audio code that stream will start or has
53170   stopped.
53171      </para></listitem>
53172    </varlistentry>
53173  </variablelist>
53174 </refsect1>
53175</refentry>
53176
53177<refentry id="API-struct-v4l2-mbus-frame-desc-entry">
53178<refentryinfo>
53179 <title>LINUX</title>
53180 <productname>Kernel Hackers Manual</productname>
53181 <date>July 2017</date>
53182</refentryinfo>
53183<refmeta>
53184 <refentrytitle><phrase>struct v4l2_mbus_frame_desc_entry</phrase></refentrytitle>
53185 <manvolnum>9</manvolnum>
53186 <refmiscinfo class="version">4.4.14</refmiscinfo>
53187</refmeta>
53188<refnamediv>
53189 <refname>struct v4l2_mbus_frame_desc_entry</refname>
53190 <refpurpose>
53191     media bus frame description structure
53192 </refpurpose>
53193</refnamediv>
53194<refsynopsisdiv>
53195 <title>Synopsis</title>
53196  <programlisting>
53197struct v4l2_mbus_frame_desc_entry {
53198  u16 flags;
53199  u32 pixelcode;
53200  u32 length;
53201};  </programlisting>
53202</refsynopsisdiv>
53203 <refsect1>
53204  <title>Members</title>
53205  <variablelist>
53206    <varlistentry>      <term>flags</term>
53207      <listitem><para>
53208   V4L2_MBUS_FRAME_DESC_FL_* flags
53209      </para></listitem>
53210    </varlistentry>
53211    <varlistentry>      <term>pixelcode</term>
53212      <listitem><para>
53213   media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set
53214      </para></listitem>
53215    </varlistentry>
53216    <varlistentry>      <term>length</term>
53217      <listitem><para>
53218   number of octets per frame, valid if V4L2_MBUS_FRAME_DESC_FL_BLOB
53219   is set
53220      </para></listitem>
53221    </varlistentry>
53222  </variablelist>
53223 </refsect1>
53224</refentry>
53225
53226<refentry id="API-struct-v4l2-mbus-frame-desc">
53227<refentryinfo>
53228 <title>LINUX</title>
53229 <productname>Kernel Hackers Manual</productname>
53230 <date>July 2017</date>
53231</refentryinfo>
53232<refmeta>
53233 <refentrytitle><phrase>struct v4l2_mbus_frame_desc</phrase></refentrytitle>
53234 <manvolnum>9</manvolnum>
53235 <refmiscinfo class="version">4.4.14</refmiscinfo>
53236</refmeta>
53237<refnamediv>
53238 <refname>struct v4l2_mbus_frame_desc</refname>
53239 <refpurpose>
53240     media bus data frame description
53241 </refpurpose>
53242</refnamediv>
53243<refsynopsisdiv>
53244 <title>Synopsis</title>
53245  <programlisting>
53246struct v4l2_mbus_frame_desc {
53247  struct v4l2_mbus_frame_desc_entry entry[V4L2_FRAME_DESC_ENTRY_MAX];
53248  unsigned short num_entries;
53249};  </programlisting>
53250</refsynopsisdiv>
53251 <refsect1>
53252  <title>Members</title>
53253  <variablelist>
53254    <varlistentry>      <term>entry[V4L2_FRAME_DESC_ENTRY_MAX]</term>
53255      <listitem><para>
53256   frame descriptors array
53257      </para></listitem>
53258    </varlistentry>
53259    <varlistentry>      <term>num_entries</term>
53260      <listitem><para>
53261   number of entries in <parameter>entry</parameter> array
53262      </para></listitem>
53263    </varlistentry>
53264  </variablelist>
53265 </refsect1>
53266</refentry>
53267
53268<refentry id="API-struct-v4l2-subdev-video-ops">
53269<refentryinfo>
53270 <title>LINUX</title>
53271 <productname>Kernel Hackers Manual</productname>
53272 <date>July 2017</date>
53273</refentryinfo>
53274<refmeta>
53275 <refentrytitle><phrase>struct v4l2_subdev_video_ops</phrase></refentrytitle>
53276 <manvolnum>9</manvolnum>
53277 <refmiscinfo class="version">4.4.14</refmiscinfo>
53278</refmeta>
53279<refnamediv>
53280 <refname>struct v4l2_subdev_video_ops</refname>
53281 <refpurpose>
53282     Callbacks used when v4l device was opened in video mode.
53283 </refpurpose>
53284</refnamediv>
53285<refsynopsisdiv>
53286 <title>Synopsis</title>
53287  <programlisting>
53288struct v4l2_subdev_video_ops {
53289  int (* s_routing) (struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
53290  int (* s_crystal_freq) (struct v4l2_subdev *sd, u32 freq, u32 flags);
53291  int (* g_std) (struct v4l2_subdev *sd, v4l2_std_id *norm);
53292  int (* s_std) (struct v4l2_subdev *sd, v4l2_std_id norm);
53293  int (* s_std_output) (struct v4l2_subdev *sd, v4l2_std_id std);
53294  int (* g_std_output) (struct v4l2_subdev *sd, v4l2_std_id *std);
53295  int (* querystd) (struct v4l2_subdev *sd, v4l2_std_id *std);
53296  int (* g_tvnorms) (struct v4l2_subdev *sd, v4l2_std_id *std);
53297  int (* g_tvnorms_output) (struct v4l2_subdev *sd, v4l2_std_id *std);
53298  int (* g_input_status) (struct v4l2_subdev *sd, u32 *status);
53299  int (* s_stream) (struct v4l2_subdev *sd, int enable);
53300  int (* cropcap) (struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
53301  int (* g_crop) (struct v4l2_subdev *sd, struct v4l2_crop *crop);
53302  int (* s_crop) (struct v4l2_subdev *sd, const struct v4l2_crop *crop);
53303  int (* g_parm) (struct v4l2_subdev *sd, struct v4l2_streamparm *param);
53304  int (* s_parm) (struct v4l2_subdev *sd, struct v4l2_streamparm *param);
53305  int (* g_frame_interval) (struct v4l2_subdev *sd,struct v4l2_subdev_frame_interval *interval);
53306  int (* s_frame_interval) (struct v4l2_subdev *sd,struct v4l2_subdev_frame_interval *interval);
53307  int (* s_dv_timings) (struct v4l2_subdev *sd,struct v4l2_dv_timings *timings);
53308  int (* g_dv_timings) (struct v4l2_subdev *sd,struct v4l2_dv_timings *timings);
53309  int (* query_dv_timings) (struct v4l2_subdev *sd,struct v4l2_dv_timings *timings);
53310  int (* g_mbus_config) (struct v4l2_subdev *sd,struct v4l2_mbus_config *cfg);
53311  int (* s_mbus_config) (struct v4l2_subdev *sd,const struct v4l2_mbus_config *cfg);
53312  int (* s_rx_buffer) (struct v4l2_subdev *sd, void *buf,unsigned int *size);
53313};  </programlisting>
53314</refsynopsisdiv>
53315 <refsect1>
53316  <title>Members</title>
53317  <variablelist>
53318    <varlistentry>      <term>s_routing</term>
53319      <listitem><para>
53320   see s_routing in audio_ops, except this version is for video
53321   devices.
53322      </para></listitem>
53323    </varlistentry>
53324    <varlistentry>      <term>s_crystal_freq</term>
53325      <listitem><para>
53326   sets the frequency of the crystal used to generate the
53327   clocks in Hz. An extra flags field allows device specific configuration
53328   regarding clock frequency dividers, etc. If not used, then set flags
53329   to 0. If the frequency is not supported, then -EINVAL is returned.
53330      </para></listitem>
53331    </varlistentry>
53332    <varlistentry>      <term>g_std</term>
53333      <listitem><para>
53334   callback for VIDIOC_G_STD ioctl handler code.
53335      </para></listitem>
53336    </varlistentry>
53337    <varlistentry>      <term>s_std</term>
53338      <listitem><para>
53339   callback for VIDIOC_S_STD ioctl handler code.
53340      </para></listitem>
53341    </varlistentry>
53342    <varlistentry>      <term>s_std_output</term>
53343      <listitem><para>
53344   set v4l2_std_id for video OUTPUT devices. This is ignored by
53345   video input devices.
53346      </para></listitem>
53347    </varlistentry>
53348    <varlistentry>      <term>g_std_output</term>
53349      <listitem><para>
53350   get current standard for video OUTPUT devices. This is ignored
53351   by video input devices.
53352      </para></listitem>
53353    </varlistentry>
53354    <varlistentry>      <term>querystd</term>
53355      <listitem><para>
53356   callback for VIDIOC_QUERYSTD ioctl handler code.
53357      </para></listitem>
53358    </varlistentry>
53359    <varlistentry>      <term>g_tvnorms</term>
53360      <listitem><para>
53361   get v4l2_std_id with all standards supported by the video
53362   CAPTURE device. This is ignored by video output devices.
53363      </para></listitem>
53364    </varlistentry>
53365    <varlistentry>      <term>g_tvnorms_output</term>
53366      <listitem><para>
53367   get v4l2_std_id with all standards supported by the video
53368   OUTPUT device. This is ignored by video capture devices.
53369      </para></listitem>
53370    </varlistentry>
53371    <varlistentry>      <term>g_input_status</term>
53372      <listitem><para>
53373   get input status. Same as the status field in the v4l2_input
53374   struct.
53375      </para></listitem>
53376    </varlistentry>
53377    <varlistentry>      <term>s_stream</term>
53378      <listitem><para>
53379   used to notify the driver that a video stream will start or has
53380   stopped.
53381      </para></listitem>
53382    </varlistentry>
53383    <varlistentry>      <term>cropcap</term>
53384      <listitem><para>
53385   callback for VIDIOC_CROPCAP ioctl handler code.
53386      </para></listitem>
53387    </varlistentry>
53388    <varlistentry>      <term>g_crop</term>
53389      <listitem><para>
53390   callback for VIDIOC_G_CROP ioctl handler code.
53391      </para></listitem>
53392    </varlistentry>
53393    <varlistentry>      <term>s_crop</term>
53394      <listitem><para>
53395   callback for VIDIOC_S_CROP ioctl handler code.
53396      </para></listitem>
53397    </varlistentry>
53398    <varlistentry>      <term>g_parm</term>
53399      <listitem><para>
53400   callback for VIDIOC_G_PARM ioctl handler code.
53401      </para></listitem>
53402    </varlistentry>
53403    <varlistentry>      <term>s_parm</term>
53404      <listitem><para>
53405   callback for VIDIOC_S_PARM ioctl handler code.
53406      </para></listitem>
53407    </varlistentry>
53408    <varlistentry>      <term>g_frame_interval</term>
53409      <listitem><para>
53410   callback for VIDIOC_G_FRAMEINTERVAL ioctl handler code.
53411      </para></listitem>
53412    </varlistentry>
53413    <varlistentry>      <term>s_frame_interval</term>
53414      <listitem><para>
53415   callback for VIDIOC_S_FRAMEINTERVAL ioctl handler code.
53416      </para></listitem>
53417    </varlistentry>
53418    <varlistentry>      <term>s_dv_timings</term>
53419      <listitem><para>
53420   Set custom dv timings in the sub device. This is used
53421   when sub device is capable of setting detailed timing information
53422   in the hardware to generate/detect the video signal.
53423      </para></listitem>
53424    </varlistentry>
53425    <varlistentry>      <term>g_dv_timings</term>
53426      <listitem><para>
53427   Get custom dv timings in the sub device.
53428      </para></listitem>
53429    </varlistentry>
53430    <varlistentry>      <term>query_dv_timings</term>
53431      <listitem><para>
53432   callback for VIDIOC_QUERY_DV_TIMINGS ioctl handler code.
53433      </para></listitem>
53434    </varlistentry>
53435    <varlistentry>      <term>g_mbus_config</term>
53436      <listitem><para>
53437   get supported mediabus configurations
53438      </para></listitem>
53439    </varlistentry>
53440    <varlistentry>      <term>s_mbus_config</term>
53441      <listitem><para>
53442   set a certain mediabus configuration. This operation is added
53443   for compatibility with soc-camera drivers and should not be used by new
53444   software.
53445      </para></listitem>
53446    </varlistentry>
53447    <varlistentry>      <term>s_rx_buffer</term>
53448      <listitem><para>
53449   set a host allocated memory buffer for the subdev. The subdev
53450   can adjust <parameter>size</parameter> to a lower value and must not write more data to the
53451   buffer starting at <parameter>data</parameter> than the original value of <parameter>size</parameter>.
53452      </para></listitem>
53453    </varlistentry>
53454  </variablelist>
53455 </refsect1>
53456</refentry>
53457
53458<refentry id="API-struct-v4l2-subdev-vbi-ops">
53459<refentryinfo>
53460 <title>LINUX</title>
53461 <productname>Kernel Hackers Manual</productname>
53462 <date>July 2017</date>
53463</refentryinfo>
53464<refmeta>
53465 <refentrytitle><phrase>struct v4l2_subdev_vbi_ops</phrase></refentrytitle>
53466 <manvolnum>9</manvolnum>
53467 <refmiscinfo class="version">4.4.14</refmiscinfo>
53468</refmeta>
53469<refnamediv>
53470 <refname>struct v4l2_subdev_vbi_ops</refname>
53471 <refpurpose>
53472     Callbacks used when v4l device was opened in video mode via the vbi device node.
53473 </refpurpose>
53474</refnamediv>
53475<refsynopsisdiv>
53476 <title>Synopsis</title>
53477  <programlisting>
53478struct v4l2_subdev_vbi_ops {
53479  int (* decode_vbi_line) (struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
53480  int (* s_vbi_data) (struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
53481  int (* g_vbi_data) (struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
53482  int (* g_sliced_vbi_cap) (struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
53483  int (* s_raw_fmt) (struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
53484  int (* g_sliced_fmt) (struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
53485  int (* s_sliced_fmt) (struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
53486};  </programlisting>
53487</refsynopsisdiv>
53488 <refsect1>
53489  <title>Members</title>
53490  <variablelist>
53491    <varlistentry>      <term>decode_vbi_line</term>
53492      <listitem><para>
53493   video decoders that support sliced VBI need to implement
53494   this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
53495   start of the VBI data that was generated by the decoder. The driver
53496   then parses the sliced VBI data and sets the other fields in the
53497   struct accordingly. The pointer p is updated to point to the start of
53498   the payload which can be copied verbatim into the data field of the
53499   v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
53500   type field is set to 0 on return.
53501      </para></listitem>
53502    </varlistentry>
53503    <varlistentry>      <term>s_vbi_data</term>
53504      <listitem><para>
53505   used to generate VBI signals on a video signal.
53506   v4l2_sliced_vbi_data is filled with the data packets that should be
53507   output. Note that if you set the line field to 0, then that VBI signal
53508   is disabled. If no valid VBI data was found, then the type field is
53509   set to 0 on return.
53510      </para></listitem>
53511    </varlistentry>
53512    <varlistentry>      <term>g_vbi_data</term>
53513      <listitem><para>
53514   used to obtain the sliced VBI packet from a readback register.
53515   Not all video decoders support this. If no data is available because
53516   the readback register contains invalid or erroneous data -EIO is
53517   returned. Note that you must fill in the 'id' member and the 'field'
53518   member (to determine whether CC data from the first or second field
53519   should be obtained).
53520      </para></listitem>
53521    </varlistentry>
53522    <varlistentry>      <term>g_sliced_vbi_cap</term>
53523      <listitem><para>
53524   callback for VIDIOC_SLICED_VBI_CAP ioctl handler code.
53525      </para></listitem>
53526    </varlistentry>
53527    <varlistentry>      <term>s_raw_fmt</term>
53528      <listitem><para>
53529   setup the video encoder/decoder for raw VBI.
53530      </para></listitem>
53531    </varlistentry>
53532    <varlistentry>      <term>g_sliced_fmt</term>
53533      <listitem><para>
53534   retrieve the current sliced VBI settings.
53535      </para></listitem>
53536    </varlistentry>
53537    <varlistentry>      <term>s_sliced_fmt</term>
53538      <listitem><para>
53539   setup the sliced VBI settings.
53540      </para></listitem>
53541    </varlistentry>
53542  </variablelist>
53543 </refsect1>
53544</refentry>
53545
53546<refentry id="API-struct-v4l2-subdev-sensor-ops">
53547<refentryinfo>
53548 <title>LINUX</title>
53549 <productname>Kernel Hackers Manual</productname>
53550 <date>July 2017</date>
53551</refentryinfo>
53552<refmeta>
53553 <refentrytitle><phrase>struct v4l2_subdev_sensor_ops</phrase></refentrytitle>
53554 <manvolnum>9</manvolnum>
53555 <refmiscinfo class="version">4.4.14</refmiscinfo>
53556</refmeta>
53557<refnamediv>
53558 <refname>struct v4l2_subdev_sensor_ops</refname>
53559 <refpurpose>
53560     v4l2-subdev sensor operations
53561 </refpurpose>
53562</refnamediv>
53563<refsynopsisdiv>
53564 <title>Synopsis</title>
53565  <programlisting>
53566struct v4l2_subdev_sensor_ops {
53567  int (* g_skip_top_lines) (struct v4l2_subdev *sd, u32 *lines);
53568  int (* g_skip_frames) (struct v4l2_subdev *sd, u32 *frames);
53569};  </programlisting>
53570</refsynopsisdiv>
53571 <refsect1>
53572  <title>Members</title>
53573  <variablelist>
53574    <varlistentry>      <term>g_skip_top_lines</term>
53575      <listitem><para>
53576   number of lines at the top of the image to be skipped.
53577   This is needed for some sensors, which always corrupt
53578   several top lines of the output image, or which send their
53579   metadata in them.
53580      </para></listitem>
53581    </varlistentry>
53582    <varlistentry>      <term>g_skip_frames</term>
53583      <listitem><para>
53584   number of frames to skip at stream start. This is needed for
53585   buggy sensors that generate faulty frames when they are
53586   turned on.
53587      </para></listitem>
53588    </varlistentry>
53589  </variablelist>
53590 </refsect1>
53591</refentry>
53592
53593<refentry id="API-struct-v4l2-subdev-pad-ops">
53594<refentryinfo>
53595 <title>LINUX</title>
53596 <productname>Kernel Hackers Manual</productname>
53597 <date>July 2017</date>
53598</refentryinfo>
53599<refmeta>
53600 <refentrytitle><phrase>struct v4l2_subdev_pad_ops</phrase></refentrytitle>
53601 <manvolnum>9</manvolnum>
53602 <refmiscinfo class="version">4.4.14</refmiscinfo>
53603</refmeta>
53604<refnamediv>
53605 <refname>struct v4l2_subdev_pad_ops</refname>
53606 <refpurpose>
53607     v4l2-subdev pad level operations
53608 </refpurpose>
53609</refnamediv>
53610<refsynopsisdiv>
53611 <title>Synopsis</title>
53612  <programlisting>
53613struct v4l2_subdev_pad_ops {
53614  int (* enum_mbus_code) (struct v4l2_subdev *sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_mbus_code_enum *code);
53615  int (* enum_frame_size) (struct v4l2_subdev *sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_frame_size_enum *fse);
53616  int (* enum_frame_interval) (struct v4l2_subdev *sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_frame_interval_enum *fie);
53617  int (* get_fmt) (struct v4l2_subdev *sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_format *format);
53618  int (* set_fmt) (struct v4l2_subdev *sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_format *format);
53619  int (* get_selection) (struct v4l2_subdev *sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_selection *sel);
53620  int (* set_selection) (struct v4l2_subdev *sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_selection *sel);
53621  int (* get_edid) (struct v4l2_subdev *sd, struct v4l2_edid *edid);
53622  int (* set_edid) (struct v4l2_subdev *sd, struct v4l2_edid *edid);
53623  int (* dv_timings_cap) (struct v4l2_subdev *sd,struct v4l2_dv_timings_cap *cap);
53624  int (* enum_dv_timings) (struct v4l2_subdev *sd,struct v4l2_enum_dv_timings *timings);
53625#ifdef CONFIG_MEDIA_CONTROLLER
53626  int (* link_validate) (struct v4l2_subdev *sd, struct media_link *link,struct v4l2_subdev_format *source_fmt,struct v4l2_subdev_format *sink_fmt);
53627#endif
53628  int (* get_frame_desc) (struct v4l2_subdev *sd, unsigned int pad,struct v4l2_mbus_frame_desc *fd);
53629  int (* set_frame_desc) (struct v4l2_subdev *sd, unsigned int pad,struct v4l2_mbus_frame_desc *fd);
53630};  </programlisting>
53631</refsynopsisdiv>
53632 <refsect1>
53633  <title>Members</title>
53634  <variablelist>
53635    <varlistentry>      <term>enum_mbus_code</term>
53636      <listitem><para>
53637   callback for VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl handler
53638   code.
53639      </para></listitem>
53640    </varlistentry>
53641    <varlistentry>      <term>enum_frame_size</term>
53642      <listitem><para>
53643   callback for VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl handler
53644   code.
53645      </para></listitem>
53646    </varlistentry>
53647    <varlistentry>      <term>enum_frame_interval</term>
53648      <listitem><para>
53649   callback for VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL ioctl
53650   handler code.
53651      </para></listitem>
53652    </varlistentry>
53653    <varlistentry>      <term>get_fmt</term>
53654      <listitem><para>
53655   callback for VIDIOC_SUBDEV_G_FMT ioctl handler code.
53656      </para></listitem>
53657    </varlistentry>
53658    <varlistentry>      <term>set_fmt</term>
53659      <listitem><para>
53660   callback for VIDIOC_SUBDEV_S_FMT ioctl handler code.
53661      </para></listitem>
53662    </varlistentry>
53663    <varlistentry>      <term>get_selection</term>
53664      <listitem><para>
53665   callback for VIDIOC_SUBDEV_G_SELECTION ioctl handler code.
53666      </para></listitem>
53667    </varlistentry>
53668    <varlistentry>      <term>set_selection</term>
53669      <listitem><para>
53670   callback for VIDIOC_SUBDEV_S_SELECTION ioctl handler code.
53671      </para></listitem>
53672    </varlistentry>
53673    <varlistentry>      <term>get_edid</term>
53674      <listitem><para>
53675   callback for VIDIOC_SUBDEV_G_EDID ioctl handler code.
53676      </para></listitem>
53677    </varlistentry>
53678    <varlistentry>      <term>set_edid</term>
53679      <listitem><para>
53680   callback for VIDIOC_SUBDEV_S_EDID ioctl handler code.
53681      </para></listitem>
53682    </varlistentry>
53683    <varlistentry>      <term>dv_timings_cap</term>
53684      <listitem><para>
53685   callback for VIDIOC_SUBDEV_DV_TIMINGS_CAP ioctl handler
53686   code.
53687      </para></listitem>
53688    </varlistentry>
53689    <varlistentry>      <term>enum_dv_timings</term>
53690      <listitem><para>
53691   callback for VIDIOC_SUBDEV_ENUM_DV_TIMINGS ioctl handler
53692   code.
53693      </para></listitem>
53694    </varlistentry>
53695    <varlistentry>      <term>link_validate</term>
53696      <listitem><para>
53697   used by the media controller code to check if the links
53698   that belongs to a pipeline can be used for stream.
53699      </para></listitem>
53700    </varlistentry>
53701    <varlistentry>      <term>get_frame_desc</term>
53702      <listitem><para>
53703   get the current low level media bus frame parameters.
53704      </para></listitem>
53705    </varlistentry>
53706    <varlistentry>      <term>set_frame_desc</term>
53707      <listitem><para>
53708   set the low level media bus frame parameters, <parameter>fd</parameter> array
53709   may be adjusted by the subdev driver to device capabilities.
53710      </para></listitem>
53711    </varlistentry>
53712  </variablelist>
53713 </refsect1>
53714</refentry>
53715
53716<!-- include/media/videobuf2-core.h -->
53717<refentry id="API-struct-vb2-mem-ops">
53718<refentryinfo>
53719 <title>LINUX</title>
53720 <productname>Kernel Hackers Manual</productname>
53721 <date>July 2017</date>
53722</refentryinfo>
53723<refmeta>
53724 <refentrytitle><phrase>struct vb2_mem_ops</phrase></refentrytitle>
53725 <manvolnum>9</manvolnum>
53726 <refmiscinfo class="version">4.4.14</refmiscinfo>
53727</refmeta>
53728<refnamediv>
53729 <refname>struct vb2_mem_ops</refname>
53730 <refpurpose>
53731  memory handling/memory allocator operations
53732 </refpurpose>
53733</refnamediv>
53734<refsynopsisdiv>
53735 <title>Synopsis</title>
53736  <programlisting>
53737struct vb2_mem_ops {
53738  void *(* alloc) (void *alloc_ctx, unsigned long size,enum dma_data_direction dma_dir,gfp_t gfp_flags);
53739  void (* put) (void *buf_priv);
53740  struct dma_buf *(* get_dmabuf) (void *buf_priv, unsigned long flags);
53741  void *(* get_userptr) (void *alloc_ctx, unsigned long vaddr,unsigned long size,enum dma_data_direction dma_dir);
53742  void (* put_userptr) (void *buf_priv);
53743  void (* prepare) (void *buf_priv);
53744  void (* finish) (void *buf_priv);
53745  void *(* attach_dmabuf) (void *alloc_ctx, struct dma_buf *dbuf,unsigned long size,enum dma_data_direction dma_dir);
53746  void (* detach_dmabuf) (void *buf_priv);
53747  int (* map_dmabuf) (void *buf_priv);
53748  void (* unmap_dmabuf) (void *buf_priv);
53749  void *(* vaddr) (void *buf_priv);
53750  void *(* cookie) (void *buf_priv);
53751  unsigned int	(* num_users) (void *buf_priv);
53752  int (* mmap) (void *buf_priv, struct vm_area_struct *vma);
53753};  </programlisting>
53754</refsynopsisdiv>
53755 <refsect1>
53756  <title>Members</title>
53757  <variablelist>
53758    <varlistentry>      <term>alloc</term>
53759      <listitem><para>
53760allocate video memory and, optionally, allocator private data,
53761return NULL on failure or a pointer to allocator private,
53762per-buffer data on success; the returned private structure
53763will then be passed as buf_priv argument to other ops in this
53764structure. Additional gfp_flags to use when allocating the
53765are also passed to this operation. These flags are from the
53766gfp_flags field of vb2_queue.
53767      </para></listitem>
53768    </varlistentry>
53769    <varlistentry>      <term>put</term>
53770      <listitem><para>
53771inform the allocator that the buffer will no longer be used;
53772usually will result in the allocator freeing the buffer (if
53773no other users of this buffer are present); the buf_priv
53774argument is the allocator private per-buffer structure
53775previously returned from the alloc callback.
53776      </para></listitem>
53777    </varlistentry>
53778    <varlistentry>      <term>get_dmabuf</term>
53779      <listitem><para>
53780acquire userspace memory for a hardware operation; used for
53781DMABUF memory types.
53782      </para></listitem>
53783    </varlistentry>
53784    <varlistentry>      <term>get_userptr</term>
53785      <listitem><para>
53786acquire userspace memory for a hardware operation; used for
53787USERPTR memory types; vaddr is the address passed to the
53788videobuf layer when queuing a video buffer of USERPTR type;
53789should return an allocator private per-buffer structure
53790associated with the buffer on success, NULL on failure;
53791the returned private structure will then be passed as buf_priv
53792argument to other ops in this structure.
53793      </para></listitem>
53794    </varlistentry>
53795    <varlistentry>      <term>put_userptr</term>
53796      <listitem><para>
53797inform the allocator that a USERPTR buffer will no longer
53798be used.
53799      </para></listitem>
53800    </varlistentry>
53801    <varlistentry>      <term>prepare</term>
53802      <listitem><para>
53803called every time the buffer is passed from userspace to the
53804driver, useful for cache synchronisation, optional.
53805      </para></listitem>
53806    </varlistentry>
53807    <varlistentry>      <term>finish</term>
53808      <listitem><para>
53809called every time the buffer is passed back from the driver
53810to the userspace, also optional.
53811      </para></listitem>
53812    </varlistentry>
53813    <varlistentry>      <term>attach_dmabuf</term>
53814      <listitem><para>
53815attach a shared struct dma_buf for a hardware operation;
53816used for DMABUF memory types; alloc_ctx is the alloc context
53817dbuf is the shared dma_buf; returns NULL on failure;
53818allocator private per-buffer structure on success;
53819this needs to be used for further accesses to the buffer.
53820      </para></listitem>
53821    </varlistentry>
53822    <varlistentry>      <term>detach_dmabuf</term>
53823      <listitem><para>
53824inform the exporter of the buffer that the current DMABUF
53825buffer is no longer used; the buf_priv argument is the
53826allocator private per-buffer structure previously returned
53827from the attach_dmabuf callback.
53828      </para></listitem>
53829    </varlistentry>
53830    <varlistentry>      <term>map_dmabuf</term>
53831      <listitem><para>
53832request for access to the dmabuf from allocator; the allocator
53833of dmabuf is informed that this driver is going to use the
53834dmabuf.
53835      </para></listitem>
53836    </varlistentry>
53837    <varlistentry>      <term>unmap_dmabuf</term>
53838      <listitem><para>
53839releases access control to the dmabuf - allocator is notified
53840that this driver is done using the dmabuf for now.
53841      </para></listitem>
53842    </varlistentry>
53843    <varlistentry>      <term>vaddr</term>
53844      <listitem><para>
53845return a kernel virtual address to a given memory buffer
53846associated with the passed private structure or NULL if no
53847such mapping exists.
53848      </para></listitem>
53849    </varlistentry>
53850    <varlistentry>      <term>cookie</term>
53851      <listitem><para>
53852return allocator specific cookie for a given memory buffer
53853associated with the passed private structure or NULL if not
53854available.
53855      </para></listitem>
53856    </varlistentry>
53857    <varlistentry>      <term>num_users</term>
53858      <listitem><para>
53859return the current number of users of a memory buffer;
53860return 1 if the videobuf layer (or actually the driver using
53861it) is the only user.
53862      </para></listitem>
53863    </varlistentry>
53864    <varlistentry>      <term>mmap</term>
53865      <listitem><para>
53866setup a userspace mapping for a given memory buffer under
53867the provided virtual memory region.
53868      </para></listitem>
53869    </varlistentry>
53870  </variablelist>
53871 </refsect1>
53872<refsect1>
53873<title>Required ops for USERPTR types</title>
53874<para>
53875   get_userptr, put_userptr.
53876</para>
53877</refsect1>
53878<refsect1>
53879<title>Required ops for MMAP types</title>
53880<para>
53881   alloc, put, num_users, mmap.
53882   Required ops for read/write access types: alloc, put, num_users, vaddr.
53883</para>
53884</refsect1>
53885<refsect1>
53886<title>Required ops for DMABUF types</title>
53887<para>
53888   attach_dmabuf, detach_dmabuf, map_dmabuf,
53889   unmap_dmabuf.
53890</para>
53891</refsect1>
53892</refentry>
53893
53894<refentry id="API-struct-vb2-plane">
53895<refentryinfo>
53896 <title>LINUX</title>
53897 <productname>Kernel Hackers Manual</productname>
53898 <date>July 2017</date>
53899</refentryinfo>
53900<refmeta>
53901 <refentrytitle><phrase>struct vb2_plane</phrase></refentrytitle>
53902 <manvolnum>9</manvolnum>
53903 <refmiscinfo class="version">4.4.14</refmiscinfo>
53904</refmeta>
53905<refnamediv>
53906 <refname>struct vb2_plane</refname>
53907 <refpurpose>
53908     plane information
53909 </refpurpose>
53910</refnamediv>
53911<refsynopsisdiv>
53912 <title>Synopsis</title>
53913  <programlisting>
53914struct vb2_plane {
53915  void * mem_priv;
53916  struct dma_buf * dbuf;
53917  unsigned int dbuf_mapped;
53918  unsigned int bytesused;
53919  unsigned int length;
53920  union m;
53921  unsigned int data_offset;
53922};  </programlisting>
53923</refsynopsisdiv>
53924 <refsect1>
53925  <title>Members</title>
53926  <variablelist>
53927    <varlistentry>      <term>mem_priv</term>
53928      <listitem><para>
53929   private data with this plane
53930      </para></listitem>
53931    </varlistentry>
53932    <varlistentry>      <term>dbuf</term>
53933      <listitem><para>
53934   dma_buf - shared buffer object
53935      </para></listitem>
53936    </varlistentry>
53937    <varlistentry>      <term>dbuf_mapped</term>
53938      <listitem><para>
53939   flag to show whether dbuf is mapped or not
53940      </para></listitem>
53941    </varlistentry>
53942    <varlistentry>      <term>bytesused</term>
53943      <listitem><para>
53944   number of bytes occupied by data in the plane (payload)
53945      </para></listitem>
53946    </varlistentry>
53947    <varlistentry>      <term>length</term>
53948      <listitem><para>
53949   size of this plane (NOT the payload) in bytes
53950      </para></listitem>
53951    </varlistentry>
53952    <varlistentry>      <term>m</term>
53953      <listitem><para>
53954   Union with memtype-specific data (<parameter>offset</parameter>, <parameter>userptr</parameter> or
53955   <parameter>fd</parameter>).
53956      </para></listitem>
53957    </varlistentry>
53958    <varlistentry>      <term>data_offset</term>
53959      <listitem><para>
53960   offset in the plane to the start of data; usually 0,
53961   unless there is a header in front of the data
53962   Should contain enough information to be able to cover all the fields
53963   of struct v4l2_plane at videodev2.h
53964      </para></listitem>
53965    </varlistentry>
53966  </variablelist>
53967 </refsect1>
53968</refentry>
53969
53970<refentry id="API-enum-vb2-io-modes">
53971<refentryinfo>
53972 <title>LINUX</title>
53973 <productname>Kernel Hackers Manual</productname>
53974 <date>July 2017</date>
53975</refentryinfo>
53976<refmeta>
53977 <refentrytitle><phrase>enum vb2_io_modes</phrase></refentrytitle>
53978 <manvolnum>9</manvolnum>
53979 <refmiscinfo class="version">4.4.14</refmiscinfo>
53980</refmeta>
53981<refnamediv>
53982 <refname>enum vb2_io_modes</refname>
53983 <refpurpose>
53984     queue access methods
53985 </refpurpose>
53986</refnamediv>
53987<refsynopsisdiv>
53988 <title>Synopsis</title>
53989  <programlisting>
53990enum vb2_io_modes {
53991  VB2_MMAP,
53992  VB2_USERPTR,
53993  VB2_READ,
53994  VB2_WRITE,
53995  VB2_DMABUF
53996};  </programlisting>
53997</refsynopsisdiv>
53998<refsect1>
53999 <title>Constants</title>
54000  <variablelist>
54001    <varlistentry>      <term>VB2_MMAP</term>
54002      <listitem><para>
54003   driver supports MMAP with streaming API
54004      </para></listitem>
54005    </varlistentry>
54006    <varlistentry>      <term>VB2_USERPTR</term>
54007      <listitem><para>
54008   driver supports USERPTR with streaming API
54009      </para></listitem>
54010    </varlistentry>
54011    <varlistentry>      <term>VB2_READ</term>
54012      <listitem><para>
54013   driver supports <function>read</function> style access
54014      </para></listitem>
54015    </varlistentry>
54016    <varlistentry>      <term>VB2_WRITE</term>
54017      <listitem><para>
54018   driver supports <function>write</function> style access
54019      </para></listitem>
54020    </varlistentry>
54021    <varlistentry>      <term>VB2_DMABUF</term>
54022      <listitem><para>
54023   driver supports DMABUF with streaming API
54024      </para></listitem>
54025    </varlistentry>
54026  </variablelist>
54027</refsect1>
54028</refentry>
54029
54030<refentry id="API-enum-vb2-buffer-state">
54031<refentryinfo>
54032 <title>LINUX</title>
54033 <productname>Kernel Hackers Manual</productname>
54034 <date>July 2017</date>
54035</refentryinfo>
54036<refmeta>
54037 <refentrytitle><phrase>enum vb2_buffer_state</phrase></refentrytitle>
54038 <manvolnum>9</manvolnum>
54039 <refmiscinfo class="version">4.4.14</refmiscinfo>
54040</refmeta>
54041<refnamediv>
54042 <refname>enum vb2_buffer_state</refname>
54043 <refpurpose>
54044     current video buffer state
54045 </refpurpose>
54046</refnamediv>
54047<refsynopsisdiv>
54048 <title>Synopsis</title>
54049  <programlisting>
54050enum vb2_buffer_state {
54051  VB2_BUF_STATE_DEQUEUED,
54052  VB2_BUF_STATE_PREPARING,
54053  VB2_BUF_STATE_PREPARED,
54054  VB2_BUF_STATE_QUEUED,
54055  VB2_BUF_STATE_REQUEUEING,
54056  VB2_BUF_STATE_ACTIVE,
54057  VB2_BUF_STATE_DONE,
54058  VB2_BUF_STATE_ERROR
54059};  </programlisting>
54060</refsynopsisdiv>
54061<refsect1>
54062 <title>Constants</title>
54063  <variablelist>
54064    <varlistentry>      <term>VB2_BUF_STATE_DEQUEUED</term>
54065      <listitem><para>
54066   buffer under userspace control
54067      </para></listitem>
54068    </varlistentry>
54069    <varlistentry>      <term>VB2_BUF_STATE_PREPARING</term>
54070      <listitem><para>
54071   buffer is being prepared in videobuf
54072      </para></listitem>
54073    </varlistentry>
54074    <varlistentry>      <term>VB2_BUF_STATE_PREPARED</term>
54075      <listitem><para>
54076   buffer prepared in videobuf and by the driver
54077      </para></listitem>
54078    </varlistentry>
54079    <varlistentry>      <term>VB2_BUF_STATE_QUEUED</term>
54080      <listitem><para>
54081   buffer queued in videobuf, but not in driver
54082      </para></listitem>
54083    </varlistentry>
54084    <varlistentry>      <term>VB2_BUF_STATE_REQUEUEING</term>
54085      <listitem><para>
54086   re-queue a buffer to the driver
54087      </para></listitem>
54088    </varlistentry>
54089    <varlistentry>      <term>VB2_BUF_STATE_ACTIVE</term>
54090      <listitem><para>
54091   buffer queued in driver and possibly used
54092   in a hardware operation
54093      </para></listitem>
54094    </varlistentry>
54095    <varlistentry>      <term>VB2_BUF_STATE_DONE</term>
54096      <listitem><para>
54097   buffer returned from driver to videobuf, but
54098   not yet dequeued to userspace
54099      </para></listitem>
54100    </varlistentry>
54101    <varlistentry>      <term>VB2_BUF_STATE_ERROR</term>
54102      <listitem><para>
54103   same as above, but the operation on the buffer
54104   has ended with an error, which will be reported
54105   to the userspace when it is dequeued
54106      </para></listitem>
54107    </varlistentry>
54108  </variablelist>
54109</refsect1>
54110</refentry>
54111
54112<refentry id="API-struct-vb2-buffer">
54113<refentryinfo>
54114 <title>LINUX</title>
54115 <productname>Kernel Hackers Manual</productname>
54116 <date>July 2017</date>
54117</refentryinfo>
54118<refmeta>
54119 <refentrytitle><phrase>struct vb2_buffer</phrase></refentrytitle>
54120 <manvolnum>9</manvolnum>
54121 <refmiscinfo class="version">4.4.14</refmiscinfo>
54122</refmeta>
54123<refnamediv>
54124 <refname>struct vb2_buffer</refname>
54125 <refpurpose>
54126     represents a video buffer
54127 </refpurpose>
54128</refnamediv>
54129<refsynopsisdiv>
54130 <title>Synopsis</title>
54131  <programlisting>
54132struct vb2_buffer {
54133  struct vb2_queue * vb2_queue;
54134  unsigned int index;
54135  unsigned int type;
54136  unsigned int memory;
54137  unsigned int num_planes;
54138  struct vb2_plane planes[VB2_MAX_PLANES];
54139};  </programlisting>
54140</refsynopsisdiv>
54141 <refsect1>
54142  <title>Members</title>
54143  <variablelist>
54144    <varlistentry>      <term>vb2_queue</term>
54145      <listitem><para>
54146   the queue to which this driver belongs
54147      </para></listitem>
54148    </varlistentry>
54149    <varlistentry>      <term>index</term>
54150      <listitem><para>
54151   id number of the buffer
54152      </para></listitem>
54153    </varlistentry>
54154    <varlistentry>      <term>type</term>
54155      <listitem><para>
54156   buffer type
54157      </para></listitem>
54158    </varlistentry>
54159    <varlistentry>      <term>memory</term>
54160      <listitem><para>
54161   the method, in which the actual data is passed
54162      </para></listitem>
54163    </varlistentry>
54164    <varlistentry>      <term>num_planes</term>
54165      <listitem><para>
54166   number of planes in the buffer
54167   on an internal driver queue
54168      </para></listitem>
54169    </varlistentry>
54170    <varlistentry>      <term>planes[VB2_MAX_PLANES]</term>
54171      <listitem><para>
54172   private per-plane information; do not change
54173      </para></listitem>
54174    </varlistentry>
54175  </variablelist>
54176 </refsect1>
54177</refentry>
54178
54179<refentry id="API-struct-vb2-ops">
54180<refentryinfo>
54181 <title>LINUX</title>
54182 <productname>Kernel Hackers Manual</productname>
54183 <date>July 2017</date>
54184</refentryinfo>
54185<refmeta>
54186 <refentrytitle><phrase>struct vb2_ops</phrase></refentrytitle>
54187 <manvolnum>9</manvolnum>
54188 <refmiscinfo class="version">4.4.14</refmiscinfo>
54189</refmeta>
54190<refnamediv>
54191 <refname>struct vb2_ops</refname>
54192 <refpurpose>
54193     driver-specific callbacks
54194 </refpurpose>
54195</refnamediv>
54196<refsynopsisdiv>
54197 <title>Synopsis</title>
54198  <programlisting>
54199struct vb2_ops {
54200  int (* queue_setup) (struct vb2_queue *q, const void *parg,unsigned int *num_buffers, unsigned int *num_planes,unsigned int sizes[], void *alloc_ctxs[]);
54201  void (* wait_prepare) (struct vb2_queue *q);
54202  void (* wait_finish) (struct vb2_queue *q);
54203  int (* buf_init) (struct vb2_buffer *vb);
54204  int (* buf_prepare) (struct vb2_buffer *vb);
54205  void (* buf_finish) (struct vb2_buffer *vb);
54206  void (* buf_cleanup) (struct vb2_buffer *vb);
54207  int (* start_streaming) (struct vb2_queue *q, unsigned int count);
54208  void (* stop_streaming) (struct vb2_queue *q);
54209  void (* buf_queue) (struct vb2_buffer *vb);
54210};  </programlisting>
54211</refsynopsisdiv>
54212 <refsect1>
54213  <title>Members</title>
54214  <variablelist>
54215    <varlistentry>      <term>queue_setup</term>
54216      <listitem><para>
54217   called from VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS
54218   handlers before memory allocation, or, if
54219   *num_planes != 0, after the allocation to verify a
54220   smaller number of buffers. Driver should return
54221   the required number of buffers in *num_buffers, the
54222   required number of planes per buffer in *num_planes; the
54223   size of each plane should be set in the sizes[] array
54224   and optional per-plane allocator specific context in the
54225   alloc_ctxs[] array. When called from VIDIOC_REQBUFS,
54226   fmt == NULL, the driver has to use the currently
54227   configured format and *num_buffers is the total number
54228   of buffers, that are being allocated. When called from
54229   VIDIOC_CREATE_BUFS, fmt != NULL and it describes the
54230   target frame format (if the format isn't valid the
54231   callback must return -EINVAL). In this case *num_buffers
54232   are being allocated additionally to q-&gt;num_buffers.
54233      </para></listitem>
54234    </varlistentry>
54235    <varlistentry>      <term>wait_prepare</term>
54236      <listitem><para>
54237   release any locks taken while calling vb2 functions;
54238   it is called before an ioctl needs to wait for a new
54239   buffer to arrive; required to avoid a deadlock in
54240   blocking access type.
54241      </para></listitem>
54242    </varlistentry>
54243    <varlistentry>      <term>wait_finish</term>
54244      <listitem><para>
54245   reacquire all locks released in the previous callback;
54246   required to continue operation after sleeping while
54247   waiting for a new buffer to arrive.
54248      </para></listitem>
54249    </varlistentry>
54250    <varlistentry>      <term>buf_init</term>
54251      <listitem><para>
54252   called once after allocating a buffer (in MMAP case)
54253   or after acquiring a new USERPTR buffer; drivers may
54254   perform additional buffer-related initialization;
54255   initialization failure (return != 0) will prevent
54256   queue setup from completing successfully; optional.
54257      </para></listitem>
54258    </varlistentry>
54259    <varlistentry>      <term>buf_prepare</term>
54260      <listitem><para>
54261   called every time the buffer is queued from userspace
54262   and from the VIDIOC_PREPARE_BUF ioctl; drivers may
54263   perform any initialization required before each
54264   hardware operation in this callback; drivers can
54265   access/modify the buffer here as it is still synced for
54266   the CPU; drivers that support VIDIOC_CREATE_BUFS must
54267   also validate the buffer size; if an error is returned,
54268   the buffer will not be queued in driver; optional.
54269      </para></listitem>
54270    </varlistentry>
54271    <varlistentry>      <term>buf_finish</term>
54272      <listitem><para>
54273   called before every dequeue of the buffer back to
54274   userspace; the buffer is synced for the CPU, so drivers
54275   can access/modify the buffer contents; drivers may
54276   perform any operations required before userspace
54277   accesses the buffer; optional. The buffer state can be
54278      </para></listitem>
54279    </varlistentry>
54280    <varlistentry>      <term>buf_cleanup</term>
54281      <listitem><para>
54282   called once before the buffer is freed; drivers may
54283   perform any additional cleanup; optional.
54284      </para></listitem>
54285    </varlistentry>
54286    <varlistentry>      <term>start_streaming</term>
54287      <listitem><para>
54288   called once to enter 'streaming' state; the driver may
54289   receive buffers with <parameter>buf_queue</parameter> callback before
54290   <parameter>start_streaming</parameter> is called; the driver gets the number
54291   of already queued buffers in count parameter; driver
54292   can return an error if hardware fails, in that case all
54293   buffers that have been already given by the <parameter>buf_queue</parameter>
54294   callback are to be returned by the driver by calling
54295   <parameter>vb2_buffer_done</parameter>(VB2_BUF_STATE_QUEUED).
54296   If you need a minimum number of buffers before you can
54297   start streaming, then set <parameter>min_buffers_needed</parameter> in the
54298   vb2_queue structure. If that is non-zero then
54299   start_streaming won't be called until at least that
54300   many buffers have been queued up by userspace.
54301      </para></listitem>
54302    </varlistentry>
54303    <varlistentry>      <term>stop_streaming</term>
54304      <listitem><para>
54305   called when 'streaming' state must be disabled; driver
54306   should stop any DMA transactions or wait until they
54307   finish and give back all buffers it got from <function>buf_queue</function>
54308   callback by calling <parameter>vb2_buffer_done</parameter>() with either
54309   VB2_BUF_STATE_DONE or VB2_BUF_STATE_ERROR; may use
54310   <function>vb2_wait_for_all_buffers</function> function
54311      </para></listitem>
54312    </varlistentry>
54313    <varlistentry>      <term>buf_queue</term>
54314      <listitem><para>
54315   passes buffer vb to the driver; driver may start
54316   hardware operation on this buffer; driver should give
54317   the buffer back by calling <function>vb2_buffer_done</function> function;
54318   it is allways called after calling STREAMON ioctl;
54319   might be called before start_streaming callback if user
54320   pre-queued buffers before calling STREAMON.
54321      </para></listitem>
54322    </varlistentry>
54323  </variablelist>
54324 </refsect1>
54325<refsect1>
54326<title>one of the following</title>
54327<para>
54328   DONE and ERROR occur while
54329   streaming is in progress, and the PREPARED state occurs
54330   when the queue has been canceled and all pending
54331   buffers are being returned to their default DEQUEUED
54332   state. Typically you only have to do something if the
54333   state is VB2_BUF_STATE_DONE, since in all other cases
54334   the buffer contents will be ignored anyway.
54335</para>
54336</refsect1>
54337</refentry>
54338
54339<refentry id="API-struct-vb2-queue">
54340<refentryinfo>
54341 <title>LINUX</title>
54342 <productname>Kernel Hackers Manual</productname>
54343 <date>July 2017</date>
54344</refentryinfo>
54345<refmeta>
54346 <refentrytitle><phrase>struct vb2_queue</phrase></refentrytitle>
54347 <manvolnum>9</manvolnum>
54348 <refmiscinfo class="version">4.4.14</refmiscinfo>
54349</refmeta>
54350<refnamediv>
54351 <refname>struct vb2_queue</refname>
54352 <refpurpose>
54353     a videobuf queue
54354 </refpurpose>
54355</refnamediv>
54356<refsynopsisdiv>
54357 <title>Synopsis</title>
54358  <programlisting>
54359struct vb2_queue {
54360  unsigned int type;
54361  unsigned int io_modes;
54362  unsigned fileio_read_once:1;
54363  unsigned fileio_write_immediately:1;
54364  unsigned allow_zero_bytesused:1;
54365  struct mutex * lock;
54366  void * owner;
54367  const struct vb2_ops * ops;
54368  const struct vb2_mem_ops * mem_ops;
54369  const struct vb2_buf_ops * buf_ops;
54370  void * drv_priv;
54371  unsigned int buf_struct_size;
54372  u32 timestamp_flags;
54373  gfp_t gfp_flags;
54374  u32 min_buffers_needed;
54375};  </programlisting>
54376</refsynopsisdiv>
54377 <refsect1>
54378  <title>Members</title>
54379  <variablelist>
54380    <varlistentry>      <term>type</term>
54381      <listitem><para>
54382   private buffer type whose content is defined by the vb2-core
54383   caller. For example, for V4L2, it should match
54384   the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h
54385      </para></listitem>
54386    </varlistentry>
54387    <varlistentry>      <term>io_modes</term>
54388      <listitem><para>
54389   supported io methods (see vb2_io_modes enum)
54390      </para></listitem>
54391    </varlistentry>
54392    <varlistentry>      <term>fileio_read_once</term>
54393      <listitem><para>
54394   report EOF after reading the first buffer
54395      </para></listitem>
54396    </varlistentry>
54397    <varlistentry>      <term>fileio_write_immediately</term>
54398      <listitem><para>
54399   queue buffer after each <function>write</function> call
54400      </para></listitem>
54401    </varlistentry>
54402    <varlistentry>      <term>allow_zero_bytesused</term>
54403      <listitem><para>
54404   allow bytesused == 0 to be passed to the driver
54405      </para></listitem>
54406    </varlistentry>
54407    <varlistentry>      <term>lock</term>
54408      <listitem><para>
54409   pointer to a mutex that protects the vb2_queue struct. The
54410   driver can set this to a mutex to let the v4l2 core serialize
54411   the queuing ioctls. If the driver wants to handle locking
54412   itself, then this should be set to NULL. This lock is not used
54413   by the videobuf2 core API.
54414      </para></listitem>
54415    </varlistentry>
54416    <varlistentry>      <term>owner</term>
54417      <listitem><para>
54418   The filehandle that 'owns' the buffers, i.e. the filehandle
54419   that called reqbufs, create_buffers or started fileio.
54420   This field is not used by the videobuf2 core API, but it allows
54421   drivers to easily associate an owner filehandle with the queue.
54422      </para></listitem>
54423    </varlistentry>
54424    <varlistentry>      <term>ops</term>
54425      <listitem><para>
54426   driver-specific callbacks
54427      </para></listitem>
54428    </varlistentry>
54429    <varlistentry>      <term>mem_ops</term>
54430      <listitem><para>
54431   memory allocator specific callbacks
54432      </para></listitem>
54433    </varlistentry>
54434    <varlistentry>      <term>buf_ops</term>
54435      <listitem><para>
54436   callbacks to deliver buffer information
54437   between user-space and kernel-space
54438      </para></listitem>
54439    </varlistentry>
54440    <varlistentry>      <term>drv_priv</term>
54441      <listitem><para>
54442   driver private data
54443      </para></listitem>
54444    </varlistentry>
54445    <varlistentry>      <term>buf_struct_size</term>
54446      <listitem><para>
54447   size of the driver-specific buffer structure;
54448   <quote>0</quote> indicates the driver doesn't want to use a custom buffer
54449   structure type. for example, sizeof(struct vb2_v4l2_buffer)
54450   will be used for v4l2.
54451      </para></listitem>
54452    </varlistentry>
54453    <varlistentry>      <term>timestamp_flags</term>
54454      <listitem><para>
54455   Timestamp flags; V4L2_BUF_FLAG_TIMESTAMP_* and
54456   V4L2_BUF_FLAG_TSTAMP_SRC_*
54457      </para></listitem>
54458    </varlistentry>
54459    <varlistentry>      <term>gfp_flags</term>
54460      <listitem><para>
54461   additional gfp flags used when allocating the buffers.
54462   Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32
54463   to force the buffer allocation to a specific memory zone.
54464      </para></listitem>
54465    </varlistentry>
54466    <varlistentry>      <term>min_buffers_needed</term>
54467      <listitem><para>
54468   the minimum number of buffers needed before
54469   <function>start_streaming</function> can be called. Used when a DMA engine
54470   cannot be started unless at least this number of buffers
54471   have been queued into the driver.
54472      </para></listitem>
54473    </varlistentry>
54474  </variablelist>
54475 </refsect1>
54476</refentry>
54477
54478<refentry id="API-vb2-is-streaming">
54479<refentryinfo>
54480 <title>LINUX</title>
54481 <productname>Kernel Hackers Manual</productname>
54482 <date>July 2017</date>
54483</refentryinfo>
54484<refmeta>
54485 <refentrytitle><phrase>vb2_is_streaming</phrase></refentrytitle>
54486 <manvolnum>9</manvolnum>
54487 <refmiscinfo class="version">4.4.14</refmiscinfo>
54488</refmeta>
54489<refnamediv>
54490 <refname>vb2_is_streaming</refname>
54491 <refpurpose>
54492     return streaming status of the queue
54493 </refpurpose>
54494</refnamediv>
54495<refsynopsisdiv>
54496 <title>Synopsis</title>
54497  <funcsynopsis><funcprototype>
54498   <funcdef>bool <function>vb2_is_streaming </function></funcdef>
54499   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
54500  </funcprototype></funcsynopsis>
54501</refsynopsisdiv>
54502<refsect1>
54503 <title>Arguments</title>
54504 <variablelist>
54505  <varlistentry>
54506   <term><parameter>q</parameter></term>
54507   <listitem>
54508    <para>
54509     videobuf queue
54510    </para>
54511   </listitem>
54512  </varlistentry>
54513 </variablelist>
54514</refsect1>
54515</refentry>
54516
54517<refentry id="API-vb2-fileio-is-active">
54518<refentryinfo>
54519 <title>LINUX</title>
54520 <productname>Kernel Hackers Manual</productname>
54521 <date>July 2017</date>
54522</refentryinfo>
54523<refmeta>
54524 <refentrytitle><phrase>vb2_fileio_is_active</phrase></refentrytitle>
54525 <manvolnum>9</manvolnum>
54526 <refmiscinfo class="version">4.4.14</refmiscinfo>
54527</refmeta>
54528<refnamediv>
54529 <refname>vb2_fileio_is_active</refname>
54530 <refpurpose>
54531     return true if fileio is active.
54532 </refpurpose>
54533</refnamediv>
54534<refsynopsisdiv>
54535 <title>Synopsis</title>
54536  <funcsynopsis><funcprototype>
54537   <funcdef>bool <function>vb2_fileio_is_active </function></funcdef>
54538   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
54539  </funcprototype></funcsynopsis>
54540</refsynopsisdiv>
54541<refsect1>
54542 <title>Arguments</title>
54543 <variablelist>
54544  <varlistentry>
54545   <term><parameter>q</parameter></term>
54546   <listitem>
54547    <para>
54548     videobuf queue
54549    </para>
54550   </listitem>
54551  </varlistentry>
54552 </variablelist>
54553</refsect1>
54554<refsect1>
54555<title>Description</title>
54556<para>
54557   This returns true if <function>read</function> or <function>write</function> is used to stream the data
54558   as opposed to stream I/O. This is almost never an important distinction,
54559   except in rare cases. One such case is that using <function>read</function> or <function>write</function> to
54560   stream a format using V4L2_FIELD_ALTERNATE is not allowed since there
54561   is no way you can pass the field information of each buffer to/from
54562   userspace. A driver that supports this field format should check for
54563   this in the queue_setup op and reject it if this function returns true.
54564</para>
54565</refsect1>
54566</refentry>
54567
54568<refentry id="API-vb2-is-busy">
54569<refentryinfo>
54570 <title>LINUX</title>
54571 <productname>Kernel Hackers Manual</productname>
54572 <date>July 2017</date>
54573</refentryinfo>
54574<refmeta>
54575 <refentrytitle><phrase>vb2_is_busy</phrase></refentrytitle>
54576 <manvolnum>9</manvolnum>
54577 <refmiscinfo class="version">4.4.14</refmiscinfo>
54578</refmeta>
54579<refnamediv>
54580 <refname>vb2_is_busy</refname>
54581 <refpurpose>
54582     return busy status of the queue
54583 </refpurpose>
54584</refnamediv>
54585<refsynopsisdiv>
54586 <title>Synopsis</title>
54587  <funcsynopsis><funcprototype>
54588   <funcdef>bool <function>vb2_is_busy </function></funcdef>
54589   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
54590  </funcprototype></funcsynopsis>
54591</refsynopsisdiv>
54592<refsect1>
54593 <title>Arguments</title>
54594 <variablelist>
54595  <varlistentry>
54596   <term><parameter>q</parameter></term>
54597   <listitem>
54598    <para>
54599     videobuf queue
54600    </para>
54601   </listitem>
54602  </varlistentry>
54603 </variablelist>
54604</refsect1>
54605<refsect1>
54606<title>Description</title>
54607<para>
54608   This function checks if queue has any buffers allocated.
54609</para>
54610</refsect1>
54611</refentry>
54612
54613<refentry id="API-vb2-get-drv-priv">
54614<refentryinfo>
54615 <title>LINUX</title>
54616 <productname>Kernel Hackers Manual</productname>
54617 <date>July 2017</date>
54618</refentryinfo>
54619<refmeta>
54620 <refentrytitle><phrase>vb2_get_drv_priv</phrase></refentrytitle>
54621 <manvolnum>9</manvolnum>
54622 <refmiscinfo class="version">4.4.14</refmiscinfo>
54623</refmeta>
54624<refnamediv>
54625 <refname>vb2_get_drv_priv</refname>
54626 <refpurpose>
54627     return driver private data associated with the queue
54628 </refpurpose>
54629</refnamediv>
54630<refsynopsisdiv>
54631 <title>Synopsis</title>
54632  <funcsynopsis><funcprototype>
54633   <funcdef>void * <function>vb2_get_drv_priv </function></funcdef>
54634   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
54635  </funcprototype></funcsynopsis>
54636</refsynopsisdiv>
54637<refsect1>
54638 <title>Arguments</title>
54639 <variablelist>
54640  <varlistentry>
54641   <term><parameter>q</parameter></term>
54642   <listitem>
54643    <para>
54644     videobuf queue
54645    </para>
54646   </listitem>
54647  </varlistentry>
54648 </variablelist>
54649</refsect1>
54650</refentry>
54651
54652<refentry id="API-vb2-set-plane-payload">
54653<refentryinfo>
54654 <title>LINUX</title>
54655 <productname>Kernel Hackers Manual</productname>
54656 <date>July 2017</date>
54657</refentryinfo>
54658<refmeta>
54659 <refentrytitle><phrase>vb2_set_plane_payload</phrase></refentrytitle>
54660 <manvolnum>9</manvolnum>
54661 <refmiscinfo class="version">4.4.14</refmiscinfo>
54662</refmeta>
54663<refnamediv>
54664 <refname>vb2_set_plane_payload</refname>
54665 <refpurpose>
54666     set bytesused for the plane plane_no
54667 </refpurpose>
54668</refnamediv>
54669<refsynopsisdiv>
54670 <title>Synopsis</title>
54671  <funcsynopsis><funcprototype>
54672   <funcdef>void <function>vb2_set_plane_payload </function></funcdef>
54673   <paramdef><link linkend="API-struct-vb2-buffer">struct vb2_buffer</link> * <parameter>vb</parameter></paramdef>
54674   <paramdef>unsigned int <parameter>plane_no</parameter></paramdef>
54675   <paramdef>unsigned long <parameter>size</parameter></paramdef>
54676  </funcprototype></funcsynopsis>
54677</refsynopsisdiv>
54678<refsect1>
54679 <title>Arguments</title>
54680 <variablelist>
54681  <varlistentry>
54682   <term><parameter>vb</parameter></term>
54683   <listitem>
54684    <para>
54685     buffer for which plane payload should be set
54686    </para>
54687   </listitem>
54688  </varlistentry>
54689  <varlistentry>
54690   <term><parameter>plane_no</parameter></term>
54691   <listitem>
54692    <para>
54693     plane number for which payload should be set
54694    </para>
54695   </listitem>
54696  </varlistentry>
54697  <varlistentry>
54698   <term><parameter>size</parameter></term>
54699   <listitem>
54700    <para>
54701     payload in bytes
54702    </para>
54703   </listitem>
54704  </varlistentry>
54705 </variablelist>
54706</refsect1>
54707</refentry>
54708
54709<refentry id="API-vb2-get-plane-payload">
54710<refentryinfo>
54711 <title>LINUX</title>
54712 <productname>Kernel Hackers Manual</productname>
54713 <date>July 2017</date>
54714</refentryinfo>
54715<refmeta>
54716 <refentrytitle><phrase>vb2_get_plane_payload</phrase></refentrytitle>
54717 <manvolnum>9</manvolnum>
54718 <refmiscinfo class="version">4.4.14</refmiscinfo>
54719</refmeta>
54720<refnamediv>
54721 <refname>vb2_get_plane_payload</refname>
54722 <refpurpose>
54723     get bytesused for the plane plane_no
54724 </refpurpose>
54725</refnamediv>
54726<refsynopsisdiv>
54727 <title>Synopsis</title>
54728  <funcsynopsis><funcprototype>
54729   <funcdef>unsigned long <function>vb2_get_plane_payload </function></funcdef>
54730   <paramdef><link linkend="API-struct-vb2-buffer">struct vb2_buffer</link> * <parameter>vb</parameter></paramdef>
54731   <paramdef>unsigned int <parameter>plane_no</parameter></paramdef>
54732  </funcprototype></funcsynopsis>
54733</refsynopsisdiv>
54734<refsect1>
54735 <title>Arguments</title>
54736 <variablelist>
54737  <varlistentry>
54738   <term><parameter>vb</parameter></term>
54739   <listitem>
54740    <para>
54741     buffer for which plane payload should be set
54742    </para>
54743   </listitem>
54744  </varlistentry>
54745  <varlistentry>
54746   <term><parameter>plane_no</parameter></term>
54747   <listitem>
54748    <para>
54749     plane number for which payload should be set
54750    </para>
54751   </listitem>
54752  </varlistentry>
54753 </variablelist>
54754</refsect1>
54755</refentry>
54756
54757<refentry id="API-vb2-plane-size">
54758<refentryinfo>
54759 <title>LINUX</title>
54760 <productname>Kernel Hackers Manual</productname>
54761 <date>July 2017</date>
54762</refentryinfo>
54763<refmeta>
54764 <refentrytitle><phrase>vb2_plane_size</phrase></refentrytitle>
54765 <manvolnum>9</manvolnum>
54766 <refmiscinfo class="version">4.4.14</refmiscinfo>
54767</refmeta>
54768<refnamediv>
54769 <refname>vb2_plane_size</refname>
54770 <refpurpose>
54771     return plane size in bytes
54772 </refpurpose>
54773</refnamediv>
54774<refsynopsisdiv>
54775 <title>Synopsis</title>
54776  <funcsynopsis><funcprototype>
54777   <funcdef>unsigned long <function>vb2_plane_size </function></funcdef>
54778   <paramdef><link linkend="API-struct-vb2-buffer">struct vb2_buffer</link> * <parameter>vb</parameter></paramdef>
54779   <paramdef>unsigned int <parameter>plane_no</parameter></paramdef>
54780  </funcprototype></funcsynopsis>
54781</refsynopsisdiv>
54782<refsect1>
54783 <title>Arguments</title>
54784 <variablelist>
54785  <varlistentry>
54786   <term><parameter>vb</parameter></term>
54787   <listitem>
54788    <para>
54789     buffer for which plane size should be returned
54790    </para>
54791   </listitem>
54792  </varlistentry>
54793  <varlistentry>
54794   <term><parameter>plane_no</parameter></term>
54795   <listitem>
54796    <para>
54797     plane number for which size should be returned
54798    </para>
54799   </listitem>
54800  </varlistentry>
54801 </variablelist>
54802</refsect1>
54803</refentry>
54804
54805<refentry id="API-vb2-start-streaming-called">
54806<refentryinfo>
54807 <title>LINUX</title>
54808 <productname>Kernel Hackers Manual</productname>
54809 <date>July 2017</date>
54810</refentryinfo>
54811<refmeta>
54812 <refentrytitle><phrase>vb2_start_streaming_called</phrase></refentrytitle>
54813 <manvolnum>9</manvolnum>
54814 <refmiscinfo class="version">4.4.14</refmiscinfo>
54815</refmeta>
54816<refnamediv>
54817 <refname>vb2_start_streaming_called</refname>
54818 <refpurpose>
54819     return streaming status of driver
54820 </refpurpose>
54821</refnamediv>
54822<refsynopsisdiv>
54823 <title>Synopsis</title>
54824  <funcsynopsis><funcprototype>
54825   <funcdef>bool <function>vb2_start_streaming_called </function></funcdef>
54826   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
54827  </funcprototype></funcsynopsis>
54828</refsynopsisdiv>
54829<refsect1>
54830 <title>Arguments</title>
54831 <variablelist>
54832  <varlistentry>
54833   <term><parameter>q</parameter></term>
54834   <listitem>
54835    <para>
54836     videobuf queue
54837    </para>
54838   </listitem>
54839  </varlistentry>
54840 </variablelist>
54841</refsect1>
54842</refentry>
54843
54844<refentry id="API-vb2-clear-last-buffer-dequeued">
54845<refentryinfo>
54846 <title>LINUX</title>
54847 <productname>Kernel Hackers Manual</productname>
54848 <date>July 2017</date>
54849</refentryinfo>
54850<refmeta>
54851 <refentrytitle><phrase>vb2_clear_last_buffer_dequeued</phrase></refentrytitle>
54852 <manvolnum>9</manvolnum>
54853 <refmiscinfo class="version">4.4.14</refmiscinfo>
54854</refmeta>
54855<refnamediv>
54856 <refname>vb2_clear_last_buffer_dequeued</refname>
54857 <refpurpose>
54858     clear last buffer dequeued flag of queue
54859 </refpurpose>
54860</refnamediv>
54861<refsynopsisdiv>
54862 <title>Synopsis</title>
54863  <funcsynopsis><funcprototype>
54864   <funcdef>void <function>vb2_clear_last_buffer_dequeued </function></funcdef>
54865   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
54866  </funcprototype></funcsynopsis>
54867</refsynopsisdiv>
54868<refsect1>
54869 <title>Arguments</title>
54870 <variablelist>
54871  <varlistentry>
54872   <term><parameter>q</parameter></term>
54873   <listitem>
54874    <para>
54875     videobuf queue
54876    </para>
54877   </listitem>
54878  </varlistentry>
54879 </variablelist>
54880</refsect1>
54881</refentry>
54882
54883<!-- include/media/videobuf2-v4l2.h -->
54884<refentry id="API-struct-vb2-v4l2-buffer">
54885<refentryinfo>
54886 <title>LINUX</title>
54887 <productname>Kernel Hackers Manual</productname>
54888 <date>July 2017</date>
54889</refentryinfo>
54890<refmeta>
54891 <refentrytitle><phrase>struct vb2_v4l2_buffer</phrase></refentrytitle>
54892 <manvolnum>9</manvolnum>
54893 <refmiscinfo class="version">4.4.14</refmiscinfo>
54894</refmeta>
54895<refnamediv>
54896 <refname>struct vb2_v4l2_buffer</refname>
54897 <refpurpose>
54898  video buffer information for v4l2
54899 </refpurpose>
54900</refnamediv>
54901<refsynopsisdiv>
54902 <title>Synopsis</title>
54903  <programlisting>
54904struct vb2_v4l2_buffer {
54905  struct vb2_buffer vb2_buf;
54906  __u32 flags;
54907  __u32 field;
54908  struct timeval timestamp;
54909  struct v4l2_timecode timecode;
54910  __u32 sequence;
54911};  </programlisting>
54912</refsynopsisdiv>
54913 <refsect1>
54914  <title>Members</title>
54915  <variablelist>
54916    <varlistentry>      <term>vb2_buf</term>
54917      <listitem><para>
54918video buffer 2
54919      </para></listitem>
54920    </varlistentry>
54921    <varlistentry>      <term>flags</term>
54922      <listitem><para>
54923buffer informational flags
54924      </para></listitem>
54925    </varlistentry>
54926    <varlistentry>      <term>field</term>
54927      <listitem><para>
54928enum v4l2_field; field order of the image in the buffer
54929      </para></listitem>
54930    </varlistentry>
54931    <varlistentry>      <term>timestamp</term>
54932      <listitem><para>
54933frame timestamp
54934      </para></listitem>
54935    </varlistentry>
54936    <varlistentry>      <term>timecode</term>
54937      <listitem><para>
54938frame timecode
54939      </para></listitem>
54940    </varlistentry>
54941    <varlistentry>      <term>sequence</term>
54942      <listitem><para>
54943sequence count of this frame
54944Should contain enough information to be able to cover all the fields
54945of struct v4l2_buffer at videodev2.h
54946      </para></listitem>
54947    </varlistentry>
54948  </variablelist>
54949 </refsect1>
54950</refentry>
54951
54952<refentry id="API-vb2-thread-start">
54953<refentryinfo>
54954 <title>LINUX</title>
54955 <productname>Kernel Hackers Manual</productname>
54956 <date>July 2017</date>
54957</refentryinfo>
54958<refmeta>
54959 <refentrytitle><phrase>vb2_thread_start</phrase></refentrytitle>
54960 <manvolnum>9</manvolnum>
54961 <refmiscinfo class="version">4.4.14</refmiscinfo>
54962</refmeta>
54963<refnamediv>
54964 <refname>vb2_thread_start</refname>
54965 <refpurpose>
54966     start a thread for the given queue.
54967 </refpurpose>
54968</refnamediv>
54969<refsynopsisdiv>
54970 <title>Synopsis</title>
54971  <funcsynopsis><funcprototype>
54972   <funcdef>int <function>vb2_thread_start </function></funcdef>
54973   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
54974   <paramdef>vb2_thread_fnc <parameter>fnc</parameter></paramdef>
54975   <paramdef>void * <parameter>priv</parameter></paramdef>
54976   <paramdef>const char * <parameter>thread_name</parameter></paramdef>
54977  </funcprototype></funcsynopsis>
54978</refsynopsisdiv>
54979<refsect1>
54980 <title>Arguments</title>
54981 <variablelist>
54982  <varlistentry>
54983   <term><parameter>q</parameter></term>
54984   <listitem>
54985    <para>
54986     videobuf queue
54987    </para>
54988   </listitem>
54989  </varlistentry>
54990  <varlistentry>
54991   <term><parameter>fnc</parameter></term>
54992   <listitem>
54993    <para>
54994     callback function
54995    </para>
54996   </listitem>
54997  </varlistentry>
54998  <varlistentry>
54999   <term><parameter>priv</parameter></term>
55000   <listitem>
55001    <para>
55002     priv pointer passed to the callback function
55003    </para>
55004   </listitem>
55005  </varlistentry>
55006  <varlistentry>
55007   <term><parameter>thread_name</parameter></term>
55008   <listitem>
55009    <para>
55010     the name of the thread. This will be prefixed with <quote>vb2-</quote>.
55011    </para>
55012   </listitem>
55013  </varlistentry>
55014 </variablelist>
55015</refsect1>
55016<refsect1>
55017<title>Description</title>
55018<para>
55019   This starts a thread that will queue and dequeue until an error occurs
55020   or <parameter>vb2_thread_stop</parameter> is called.
55021   </para><para>
55022
55023   This function should not be used for anything else but the videobuf2-dvb
55024   support. If you think you have another good use-case for this, then please
55025   contact the linux-media mailinglist first.
55026</para>
55027</refsect1>
55028</refentry>
55029
55030<refentry id="API-vb2-thread-stop">
55031<refentryinfo>
55032 <title>LINUX</title>
55033 <productname>Kernel Hackers Manual</productname>
55034 <date>July 2017</date>
55035</refentryinfo>
55036<refmeta>
55037 <refentrytitle><phrase>vb2_thread_stop</phrase></refentrytitle>
55038 <manvolnum>9</manvolnum>
55039 <refmiscinfo class="version">4.4.14</refmiscinfo>
55040</refmeta>
55041<refnamediv>
55042 <refname>vb2_thread_stop</refname>
55043 <refpurpose>
55044     stop the thread for the given queue.
55045 </refpurpose>
55046</refnamediv>
55047<refsynopsisdiv>
55048 <title>Synopsis</title>
55049  <funcsynopsis><funcprototype>
55050   <funcdef>int <function>vb2_thread_stop </function></funcdef>
55051   <paramdef><link linkend="API-struct-vb2-queue">struct vb2_queue</link> * <parameter>q</parameter></paramdef>
55052  </funcprototype></funcsynopsis>
55053</refsynopsisdiv>
55054<refsect1>
55055 <title>Arguments</title>
55056 <variablelist>
55057  <varlistentry>
55058   <term><parameter>q</parameter></term>
55059   <listitem>
55060    <para>
55061     videobuf queue
55062    </para>
55063   </listitem>
55064  </varlistentry>
55065 </variablelist>
55066</refsect1>
55067</refentry>
55068
55069<!-- include/media/videobuf2-memops.h -->
55070<refentry id="API-struct-vb2-vmarea-handler">
55071<refentryinfo>
55072 <title>LINUX</title>
55073 <productname>Kernel Hackers Manual</productname>
55074 <date>July 2017</date>
55075</refentryinfo>
55076<refmeta>
55077 <refentrytitle><phrase>struct vb2_vmarea_handler</phrase></refentrytitle>
55078 <manvolnum>9</manvolnum>
55079 <refmiscinfo class="version">4.4.14</refmiscinfo>
55080</refmeta>
55081<refnamediv>
55082 <refname>struct vb2_vmarea_handler</refname>
55083 <refpurpose>
55084  common vma refcount tracking handler
55085 </refpurpose>
55086</refnamediv>
55087<refsynopsisdiv>
55088 <title>Synopsis</title>
55089  <programlisting>
55090struct vb2_vmarea_handler {
55091  atomic_t * refcount;
55092  void (* put) (void *arg);
55093  void * arg;
55094};  </programlisting>
55095</refsynopsisdiv>
55096 <refsect1>
55097  <title>Members</title>
55098  <variablelist>
55099    <varlistentry>      <term>refcount</term>
55100      <listitem><para>
55101pointer to refcount entry in the buffer
55102      </para></listitem>
55103    </varlistentry>
55104    <varlistentry>      <term>put</term>
55105      <listitem><para>
55106callback to function that decreases buffer refcount
55107      </para></listitem>
55108    </varlistentry>
55109    <varlistentry>      <term>arg</term>
55110      <listitem><para>
55111argument for <parameter>put</parameter> callback
55112      </para></listitem>
55113    </varlistentry>
55114  </variablelist>
55115 </refsect1>
55116</refentry>
55117
55118     </sect1>
55119     <sect1><title>Digital TV (DVB) devices</title>
55120<!-- drivers/media/dvb-core/dvb_ca_en50221.h -->
55121<refentry id="API-struct-dvb-ca-en50221">
55122<refentryinfo>
55123 <title>LINUX</title>
55124 <productname>Kernel Hackers Manual</productname>
55125 <date>July 2017</date>
55126</refentryinfo>
55127<refmeta>
55128 <refentrytitle><phrase>struct dvb_ca_en50221</phrase></refentrytitle>
55129 <manvolnum>9</manvolnum>
55130 <refmiscinfo class="version">4.4.14</refmiscinfo>
55131</refmeta>
55132<refnamediv>
55133 <refname>struct dvb_ca_en50221</refname>
55134 <refpurpose>
55135  Structure describing a CA interface
55136 </refpurpose>
55137</refnamediv>
55138<refsynopsisdiv>
55139 <title>Synopsis</title>
55140  <programlisting>
55141struct dvb_ca_en50221 {
55142  struct module * owner;
55143  int (* read_attribute_mem) (struct dvb_ca_en50221 *ca,int slot, int address);
55144  int (* write_attribute_mem) (struct dvb_ca_en50221 *ca,int slot, int address, u8 value);
55145  int (* read_cam_control) (struct dvb_ca_en50221 *ca,int slot, u8 address);
55146  int (* write_cam_control) (struct dvb_ca_en50221 *ca,int slot, u8 address, u8 value);
55147  int (* slot_reset) (struct dvb_ca_en50221 *ca, int slot);
55148  int (* slot_shutdown) (struct dvb_ca_en50221 *ca, int slot);
55149  int (* slot_ts_enable) (struct dvb_ca_en50221 *ca, int slot);
55150  int (* poll_slot_status) (struct dvb_ca_en50221 *ca, int slot, int open);
55151  void * data;
55152  void * private;
55153};  </programlisting>
55154</refsynopsisdiv>
55155 <refsect1>
55156  <title>Members</title>
55157  <variablelist>
55158    <varlistentry>      <term>owner</term>
55159      <listitem><para>
55160the module owning this structure
55161      </para></listitem>
55162    </varlistentry>
55163    <varlistentry>      <term>read_attribute_mem</term>
55164      <listitem><para>
55165function for reading attribute memory on the CAM
55166      </para></listitem>
55167    </varlistentry>
55168    <varlistentry>      <term>write_attribute_mem</term>
55169      <listitem><para>
55170function for writing attribute memory on the CAM
55171      </para></listitem>
55172    </varlistentry>
55173    <varlistentry>      <term>read_cam_control</term>
55174      <listitem><para>
55175function for reading the control interface on the CAM
55176      </para></listitem>
55177    </varlistentry>
55178    <varlistentry>      <term>write_cam_control</term>
55179      <listitem><para>
55180function for reading the control interface on the CAM
55181      </para></listitem>
55182    </varlistentry>
55183    <varlistentry>      <term>slot_reset</term>
55184      <listitem><para>
55185function to reset the CAM slot
55186      </para></listitem>
55187    </varlistentry>
55188    <varlistentry>      <term>slot_shutdown</term>
55189      <listitem><para>
55190function to shutdown a CAM slot
55191      </para></listitem>
55192    </varlistentry>
55193    <varlistentry>      <term>slot_ts_enable</term>
55194      <listitem><para>
55195function to enable the Transport Stream on a CAM slot
55196      </para></listitem>
55197    </varlistentry>
55198    <varlistentry>      <term>poll_slot_status</term>
55199      <listitem><para>
55200function to poll slot status. Only necessary if
55201DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set.
55202      </para></listitem>
55203    </varlistentry>
55204    <varlistentry>      <term>data</term>
55205      <listitem><para>
55206private data, used by caller.
55207      </para></listitem>
55208    </varlistentry>
55209    <varlistentry>      <term>private</term>
55210      <listitem><para>
55211Opaque data used by the dvb_ca core. Do not modify!
55212      </para></listitem>
55213    </varlistentry>
55214  </variablelist>
55215 </refsect1>
55216<refsect1>
55217<title>NOTE</title>
55218<para>
55219   the read_*, write_* and poll_slot_status functions will be
55220   called for different slots concurrently and need to use locks where
55221   and if appropriate. There will be no concurrent access to one slot.
55222</para>
55223</refsect1>
55224</refentry>
55225
55226<refentry id="API-dvb-ca-en50221-camchange-irq">
55227<refentryinfo>
55228 <title>LINUX</title>
55229 <productname>Kernel Hackers Manual</productname>
55230 <date>July 2017</date>
55231</refentryinfo>
55232<refmeta>
55233 <refentrytitle><phrase>dvb_ca_en50221_camchange_irq</phrase></refentrytitle>
55234 <manvolnum>9</manvolnum>
55235 <refmiscinfo class="version">4.4.14</refmiscinfo>
55236</refmeta>
55237<refnamediv>
55238 <refname>dvb_ca_en50221_camchange_irq</refname>
55239 <refpurpose>
55240     A CAMCHANGE IRQ has occurred.
55241 </refpurpose>
55242</refnamediv>
55243<refsynopsisdiv>
55244 <title>Synopsis</title>
55245  <funcsynopsis><funcprototype>
55246   <funcdef>void <function>dvb_ca_en50221_camchange_irq </function></funcdef>
55247   <paramdef><link linkend="API-struct-dvb-ca-en50221">struct dvb_ca_en50221</link> * <parameter>pubca</parameter></paramdef>
55248   <paramdef>int <parameter>slot</parameter></paramdef>
55249   <paramdef>int <parameter>change_type</parameter></paramdef>
55250  </funcprototype></funcsynopsis>
55251</refsynopsisdiv>
55252<refsect1>
55253 <title>Arguments</title>
55254 <variablelist>
55255  <varlistentry>
55256   <term><parameter>pubca</parameter></term>
55257   <listitem>
55258    <para>
55259     CA instance.
55260    </para>
55261   </listitem>
55262  </varlistentry>
55263  <varlistentry>
55264   <term><parameter>slot</parameter></term>
55265   <listitem>
55266    <para>
55267     Slot concerned.
55268    </para>
55269   </listitem>
55270  </varlistentry>
55271  <varlistentry>
55272   <term><parameter>change_type</parameter></term>
55273   <listitem>
55274    <para>
55275     One of the DVB_CA_CAMCHANGE_* values
55276    </para>
55277   </listitem>
55278  </varlistentry>
55279 </variablelist>
55280</refsect1>
55281</refentry>
55282
55283<refentry id="API-dvb-ca-en50221-camready-irq">
55284<refentryinfo>
55285 <title>LINUX</title>
55286 <productname>Kernel Hackers Manual</productname>
55287 <date>July 2017</date>
55288</refentryinfo>
55289<refmeta>
55290 <refentrytitle><phrase>dvb_ca_en50221_camready_irq</phrase></refentrytitle>
55291 <manvolnum>9</manvolnum>
55292 <refmiscinfo class="version">4.4.14</refmiscinfo>
55293</refmeta>
55294<refnamediv>
55295 <refname>dvb_ca_en50221_camready_irq</refname>
55296 <refpurpose>
55297     A CAMREADY IRQ has occurred.
55298 </refpurpose>
55299</refnamediv>
55300<refsynopsisdiv>
55301 <title>Synopsis</title>
55302  <funcsynopsis><funcprototype>
55303   <funcdef>void <function>dvb_ca_en50221_camready_irq </function></funcdef>
55304   <paramdef><link linkend="API-struct-dvb-ca-en50221">struct dvb_ca_en50221</link> * <parameter>pubca</parameter></paramdef>
55305   <paramdef>int <parameter>slot</parameter></paramdef>
55306  </funcprototype></funcsynopsis>
55307</refsynopsisdiv>
55308<refsect1>
55309 <title>Arguments</title>
55310 <variablelist>
55311  <varlistentry>
55312   <term><parameter>pubca</parameter></term>
55313   <listitem>
55314    <para>
55315     CA instance.
55316    </para>
55317   </listitem>
55318  </varlistentry>
55319  <varlistentry>
55320   <term><parameter>slot</parameter></term>
55321   <listitem>
55322    <para>
55323     Slot concerned.
55324    </para>
55325   </listitem>
55326  </varlistentry>
55327 </variablelist>
55328</refsect1>
55329</refentry>
55330
55331<refentry id="API-dvb-ca-en50221-frda-irq">
55332<refentryinfo>
55333 <title>LINUX</title>
55334 <productname>Kernel Hackers Manual</productname>
55335 <date>July 2017</date>
55336</refentryinfo>
55337<refmeta>
55338 <refentrytitle><phrase>dvb_ca_en50221_frda_irq</phrase></refentrytitle>
55339 <manvolnum>9</manvolnum>
55340 <refmiscinfo class="version">4.4.14</refmiscinfo>
55341</refmeta>
55342<refnamediv>
55343 <refname>dvb_ca_en50221_frda_irq</refname>
55344 <refpurpose>
55345     An FR or a DA IRQ has occurred.
55346 </refpurpose>
55347</refnamediv>
55348<refsynopsisdiv>
55349 <title>Synopsis</title>
55350  <funcsynopsis><funcprototype>
55351   <funcdef>void <function>dvb_ca_en50221_frda_irq </function></funcdef>
55352   <paramdef><link linkend="API-struct-dvb-ca-en50221">struct dvb_ca_en50221</link> * <parameter>ca</parameter></paramdef>
55353   <paramdef>int <parameter>slot</parameter></paramdef>
55354  </funcprototype></funcsynopsis>
55355</refsynopsisdiv>
55356<refsect1>
55357 <title>Arguments</title>
55358 <variablelist>
55359  <varlistentry>
55360   <term><parameter>ca</parameter></term>
55361   <listitem>
55362    <para>
55363     CA instance.
55364    </para>
55365   </listitem>
55366  </varlistentry>
55367  <varlistentry>
55368   <term><parameter>slot</parameter></term>
55369   <listitem>
55370    <para>
55371     Slot concerned.
55372    </para>
55373   </listitem>
55374  </varlistentry>
55375 </variablelist>
55376</refsect1>
55377</refentry>
55378
55379<refentry id="API-dvb-ca-en50221-init">
55380<refentryinfo>
55381 <title>LINUX</title>
55382 <productname>Kernel Hackers Manual</productname>
55383 <date>July 2017</date>
55384</refentryinfo>
55385<refmeta>
55386 <refentrytitle><phrase>dvb_ca_en50221_init</phrase></refentrytitle>
55387 <manvolnum>9</manvolnum>
55388 <refmiscinfo class="version">4.4.14</refmiscinfo>
55389</refmeta>
55390<refnamediv>
55391 <refname>dvb_ca_en50221_init</refname>
55392 <refpurpose>
55393     Initialise a new DVB CA device.
55394 </refpurpose>
55395</refnamediv>
55396<refsynopsisdiv>
55397 <title>Synopsis</title>
55398  <funcsynopsis><funcprototype>
55399   <funcdef>int <function>dvb_ca_en50221_init </function></funcdef>
55400   <paramdef><link linkend="API-struct-dvb-adapter">struct dvb_adapter</link> * <parameter>dvb_adapter</parameter></paramdef>
55401   <paramdef><link linkend="API-struct-dvb-ca-en50221">struct dvb_ca_en50221</link> * <parameter>ca</parameter></paramdef>
55402   <paramdef>int <parameter>flags</parameter></paramdef>
55403   <paramdef>int <parameter>slot_count</parameter></paramdef>
55404  </funcprototype></funcsynopsis>
55405</refsynopsisdiv>
55406<refsect1>
55407 <title>Arguments</title>
55408 <variablelist>
55409  <varlistentry>
55410   <term><parameter>dvb_adapter</parameter></term>
55411   <listitem>
55412    <para>
55413     DVB adapter to attach the new CA device to.
55414    </para>
55415   </listitem>
55416  </varlistentry>
55417  <varlistentry>
55418   <term><parameter>ca</parameter></term>
55419   <listitem>
55420    <para>
55421     The dvb_ca instance.
55422    </para>
55423   </listitem>
55424  </varlistentry>
55425  <varlistentry>
55426   <term><parameter>flags</parameter></term>
55427   <listitem>
55428    <para>
55429     Flags describing the CA device (DVB_CA_EN50221_FLAG_*).
55430    </para>
55431   </listitem>
55432  </varlistentry>
55433  <varlistentry>
55434   <term><parameter>slot_count</parameter></term>
55435   <listitem>
55436    <para>
55437     Number of slots supported.
55438    </para>
55439   </listitem>
55440  </varlistentry>
55441 </variablelist>
55442</refsect1>
55443<refsect1>
55444<title>Description</title>
55445<para>
55446   <parameter>return</parameter> 0 on success, nonzero on failure
55447</para>
55448</refsect1>
55449</refentry>
55450
55451<refentry id="API-dvb-ca-en50221-release">
55452<refentryinfo>
55453 <title>LINUX</title>
55454 <productname>Kernel Hackers Manual</productname>
55455 <date>July 2017</date>
55456</refentryinfo>
55457<refmeta>
55458 <refentrytitle><phrase>dvb_ca_en50221_release</phrase></refentrytitle>
55459 <manvolnum>9</manvolnum>
55460 <refmiscinfo class="version">4.4.14</refmiscinfo>
55461</refmeta>
55462<refnamediv>
55463 <refname>dvb_ca_en50221_release</refname>
55464 <refpurpose>
55465     Release a DVB CA device.
55466 </refpurpose>
55467</refnamediv>
55468<refsynopsisdiv>
55469 <title>Synopsis</title>
55470  <funcsynopsis><funcprototype>
55471   <funcdef>void <function>dvb_ca_en50221_release </function></funcdef>
55472   <paramdef><link linkend="API-struct-dvb-ca-en50221">struct dvb_ca_en50221</link> * <parameter>ca</parameter></paramdef>
55473  </funcprototype></funcsynopsis>
55474</refsynopsisdiv>
55475<refsect1>
55476 <title>Arguments</title>
55477 <variablelist>
55478  <varlistentry>
55479   <term><parameter>ca</parameter></term>
55480   <listitem>
55481    <para>
55482     The associated dvb_ca instance.
55483    </para>
55484   </listitem>
55485  </varlistentry>
55486 </variablelist>
55487</refsect1>
55488</refentry>
55489
55490<!-- drivers/media/dvb-core/dvb_frontend.h -->
55491<refentry id="API-struct-dvb-frontend-tune-settings">
55492<refentryinfo>
55493 <title>LINUX</title>
55494 <productname>Kernel Hackers Manual</productname>
55495 <date>July 2017</date>
55496</refentryinfo>
55497<refmeta>
55498 <refentrytitle><phrase>struct dvb_frontend_tune_settings</phrase></refentrytitle>
55499 <manvolnum>9</manvolnum>
55500 <refmiscinfo class="version">4.4.14</refmiscinfo>
55501</refmeta>
55502<refnamediv>
55503 <refname>struct dvb_frontend_tune_settings</refname>
55504 <refpurpose>
55505  parameters to adjust frontend tuning
55506 </refpurpose>
55507</refnamediv>
55508<refsynopsisdiv>
55509 <title>Synopsis</title>
55510  <programlisting>
55511struct dvb_frontend_tune_settings {
55512  int min_delay_ms;
55513  int step_size;
55514  int max_drift;
55515};  </programlisting>
55516</refsynopsisdiv>
55517 <refsect1>
55518  <title>Members</title>
55519  <variablelist>
55520    <varlistentry>      <term>min_delay_ms</term>
55521      <listitem><para>
55522minimum delay for tuning, in ms
55523      </para></listitem>
55524    </varlistentry>
55525    <varlistentry>      <term>step_size</term>
55526      <listitem><para>
55527step size between two consecutive frequencies
55528      </para></listitem>
55529    </varlistentry>
55530    <varlistentry>      <term>max_drift</term>
55531      <listitem><para>
55532maximum drift
55533      </para></listitem>
55534    </varlistentry>
55535  </variablelist>
55536 </refsect1>
55537<refsect1>
55538<title>NOTE</title>
55539<para>
55540   step_size is in Hz, for terrestrial/cable or kHz for satellite
55541</para>
55542</refsect1>
55543</refentry>
55544
55545<refentry id="API-struct-dvb-tuner-info">
55546<refentryinfo>
55547 <title>LINUX</title>
55548 <productname>Kernel Hackers Manual</productname>
55549 <date>July 2017</date>
55550</refentryinfo>
55551<refmeta>
55552 <refentrytitle><phrase>struct dvb_tuner_info</phrase></refentrytitle>
55553 <manvolnum>9</manvolnum>
55554 <refmiscinfo class="version">4.4.14</refmiscinfo>
55555</refmeta>
55556<refnamediv>
55557 <refname>struct dvb_tuner_info</refname>
55558 <refpurpose>
55559     Frontend name and min/max ranges/bandwidths
55560 </refpurpose>
55561</refnamediv>
55562<refsynopsisdiv>
55563 <title>Synopsis</title>
55564  <programlisting>
55565struct dvb_tuner_info {
55566  char name[128];
55567  u32 frequency_min;
55568  u32 frequency_max;
55569  u32 frequency_step;
55570  u32 bandwidth_min;
55571  u32 bandwidth_max;
55572  u32 bandwidth_step;
55573};  </programlisting>
55574</refsynopsisdiv>
55575 <refsect1>
55576  <title>Members</title>
55577  <variablelist>
55578    <varlistentry>      <term>name[128]</term>
55579      <listitem><para>
55580   name of the Frontend
55581      </para></listitem>
55582    </varlistentry>
55583    <varlistentry>      <term>frequency_min</term>
55584      <listitem><para>
55585   minimal frequency supported
55586      </para></listitem>
55587    </varlistentry>
55588    <varlistentry>      <term>frequency_max</term>
55589      <listitem><para>
55590   maximum frequency supported
55591      </para></listitem>
55592    </varlistentry>
55593    <varlistentry>      <term>frequency_step</term>
55594      <listitem><para>
55595   frequency step
55596      </para></listitem>
55597    </varlistentry>
55598    <varlistentry>      <term>bandwidth_min</term>
55599      <listitem><para>
55600   minimal frontend bandwidth supported
55601      </para></listitem>
55602    </varlistentry>
55603    <varlistentry>      <term>bandwidth_max</term>
55604      <listitem><para>
55605   maximum frontend bandwidth supported
55606      </para></listitem>
55607    </varlistentry>
55608    <varlistentry>      <term>bandwidth_step</term>
55609      <listitem><para>
55610   frontend bandwidth step
55611      </para></listitem>
55612    </varlistentry>
55613  </variablelist>
55614 </refsect1>
55615<refsect1>
55616<title>NOTE</title>
55617<para>
55618   frequency parameters are in Hz, for terrestrial/cable or kHz for
55619   satellite.
55620</para>
55621</refsect1>
55622</refentry>
55623
55624<refentry id="API-struct-analog-parameters">
55625<refentryinfo>
55626 <title>LINUX</title>
55627 <productname>Kernel Hackers Manual</productname>
55628 <date>July 2017</date>
55629</refentryinfo>
55630<refmeta>
55631 <refentrytitle><phrase>struct analog_parameters</phrase></refentrytitle>
55632 <manvolnum>9</manvolnum>
55633 <refmiscinfo class="version">4.4.14</refmiscinfo>
55634</refmeta>
55635<refnamediv>
55636 <refname>struct analog_parameters</refname>
55637 <refpurpose>
55638     Parameters to tune into an analog/radio channel
55639 </refpurpose>
55640</refnamediv>
55641<refsynopsisdiv>
55642 <title>Synopsis</title>
55643  <programlisting>
55644struct analog_parameters {
55645  unsigned int frequency;
55646  unsigned int mode;
55647  unsigned int audmode;
55648  u64 std;
55649};  </programlisting>
55650</refsynopsisdiv>
55651 <refsect1>
55652  <title>Members</title>
55653  <variablelist>
55654    <varlistentry>      <term>frequency</term>
55655      <listitem><para>
55656   Frequency used by analog TV tuner (either in 62.5 kHz step,
55657   for TV, or 62.5 Hz for radio)
55658      </para></listitem>
55659    </varlistentry>
55660    <varlistentry>      <term>mode</term>
55661      <listitem><para>
55662   Tuner mode, as defined on enum v4l2_tuner_type
55663      </para></listitem>
55664    </varlistentry>
55665    <varlistentry>      <term>audmode</term>
55666      <listitem><para>
55667   Audio mode as defined for the rxsubchans field at videodev2.h,
55668   e. g. V4L2_TUNER_MODE_*
55669      </para></listitem>
55670    </varlistentry>
55671    <varlistentry>      <term>std</term>
55672      <listitem><para>
55673   TV standard bitmap as defined at videodev2.h, e. g. V4L2_STD_*
55674      </para></listitem>
55675    </varlistentry>
55676  </variablelist>
55677 </refsect1>
55678<refsect1>
55679<title>Description</title>
55680<para>
55681   Hybrid tuners should be supported by both V4L2 and DVB APIs. This
55682   struct contains the data that are used by the V4L2 side. To avoid
55683   dependencies from V4L2 headers, all enums here are declared as integers.
55684</para>
55685</refsect1>
55686</refentry>
55687
55688<refentry id="API-enum-dvbfe-algo">
55689<refentryinfo>
55690 <title>LINUX</title>
55691 <productname>Kernel Hackers Manual</productname>
55692 <date>July 2017</date>
55693</refentryinfo>
55694<refmeta>
55695 <refentrytitle><phrase>enum dvbfe_algo</phrase></refentrytitle>
55696 <manvolnum>9</manvolnum>
55697 <refmiscinfo class="version">4.4.14</refmiscinfo>
55698</refmeta>
55699<refnamediv>
55700 <refname>enum dvbfe_algo</refname>
55701 <refpurpose>
55702     defines the algorithm used to tune into a channel
55703 </refpurpose>
55704</refnamediv>
55705<refsynopsisdiv>
55706 <title>Synopsis</title>
55707  <programlisting>
55708enum dvbfe_algo {
55709  DVBFE_ALGO_HW,
55710  DVBFE_ALGO_SW,
55711  DVBFE_ALGO_CUSTOM,
55712  DVBFE_ALGO_RECOVERY
55713};  </programlisting>
55714</refsynopsisdiv>
55715<refsect1>
55716 <title>Constants</title>
55717  <variablelist>
55718    <varlistentry>      <term>DVBFE_ALGO_HW</term>
55719      <listitem><para>
55720   Hardware Algorithm -
55721   Devices that support this algorithm do everything in hardware
55722   and no software support is needed to handle them.
55723   Requesting these devices to LOCK is the only thing required,
55724   device is supposed to do everything in the hardware.
55725      </para></listitem>
55726    </varlistentry>
55727    <varlistentry>      <term>DVBFE_ALGO_SW</term>
55728      <listitem><para>
55729   Software Algorithm -
55730   These are dumb devices, that require software to do everything
55731      </para></listitem>
55732    </varlistentry>
55733    <varlistentry>      <term>DVBFE_ALGO_CUSTOM</term>
55734      <listitem><para>
55735   Customizable Agorithm -
55736   Devices having this algorithm can be customized to have specific
55737   algorithms in the frontend driver, rather than simply doing a
55738   software zig-zag. In this case the zigzag maybe hardware assisted
55739   or it maybe completely done in hardware. In all cases, usage of
55740   this algorithm, in conjunction with the search and track
55741   callbacks, utilizes the driver specific algorithm.
55742      </para></listitem>
55743    </varlistentry>
55744    <varlistentry>      <term>DVBFE_ALGO_RECOVERY</term>
55745      <listitem><para>
55746   Recovery Algorithm -
55747   These devices have AUTO recovery capabilities from LOCK failure
55748      </para></listitem>
55749    </varlistentry>
55750  </variablelist>
55751</refsect1>
55752</refentry>
55753
55754<refentry id="API-enum-dvbfe-search">
55755<refentryinfo>
55756 <title>LINUX</title>
55757 <productname>Kernel Hackers Manual</productname>
55758 <date>July 2017</date>
55759</refentryinfo>
55760<refmeta>
55761 <refentrytitle><phrase>enum dvbfe_search</phrase></refentrytitle>
55762 <manvolnum>9</manvolnum>
55763 <refmiscinfo class="version">4.4.14</refmiscinfo>
55764</refmeta>
55765<refnamediv>
55766 <refname>enum dvbfe_search</refname>
55767 <refpurpose>
55768     search callback possible return status
55769 </refpurpose>
55770</refnamediv>
55771<refsynopsisdiv>
55772 <title>Synopsis</title>
55773  <programlisting>
55774enum dvbfe_search {
55775  DVBFE_ALGO_SEARCH_SUCCESS,
55776  DVBFE_ALGO_SEARCH_ASLEEP,
55777  DVBFE_ALGO_SEARCH_FAILED,
55778  DVBFE_ALGO_SEARCH_INVALID,
55779  DVBFE_ALGO_SEARCH_AGAIN,
55780  DVBFE_ALGO_SEARCH_ERROR
55781};  </programlisting>
55782</refsynopsisdiv>
55783<refsect1>
55784 <title>Constants</title>
55785  <variablelist>
55786    <varlistentry>      <term>DVBFE_ALGO_SEARCH_SUCCESS</term>
55787      <listitem><para>
55788   The frontend search algorithm completed and returned successfully
55789      </para></listitem>
55790    </varlistentry>
55791    <varlistentry>      <term>DVBFE_ALGO_SEARCH_ASLEEP</term>
55792      <listitem><para>
55793   The frontend search algorithm is sleeping
55794      </para></listitem>
55795    </varlistentry>
55796    <varlistentry>      <term>DVBFE_ALGO_SEARCH_FAILED</term>
55797      <listitem><para>
55798   The frontend search for a signal failed
55799      </para></listitem>
55800    </varlistentry>
55801    <varlistentry>      <term>DVBFE_ALGO_SEARCH_INVALID</term>
55802      <listitem><para>
55803   The frontend search algorith was probably supplied with invalid
55804   parameters and the search is an invalid one
55805      </para></listitem>
55806    </varlistentry>
55807    <varlistentry>      <term>DVBFE_ALGO_SEARCH_AGAIN</term>
55808      <listitem><para>
55809   The frontend search algorithm was requested to search again
55810      </para></listitem>
55811    </varlistentry>
55812    <varlistentry>      <term>DVBFE_ALGO_SEARCH_ERROR</term>
55813      <listitem><para>
55814   The frontend search algorithm failed due to some error
55815      </para></listitem>
55816    </varlistentry>
55817  </variablelist>
55818</refsect1>
55819</refentry>
55820
55821<refentry id="API-struct-dvb-tuner-ops">
55822<refentryinfo>
55823 <title>LINUX</title>
55824 <productname>Kernel Hackers Manual</productname>
55825 <date>July 2017</date>
55826</refentryinfo>
55827<refmeta>
55828 <refentrytitle><phrase>struct dvb_tuner_ops</phrase></refentrytitle>
55829 <manvolnum>9</manvolnum>
55830 <refmiscinfo class="version">4.4.14</refmiscinfo>
55831</refmeta>
55832<refnamediv>
55833 <refname>struct dvb_tuner_ops</refname>
55834 <refpurpose>
55835     Tuner information and callbacks
55836 </refpurpose>
55837</refnamediv>
55838<refsynopsisdiv>
55839 <title>Synopsis</title>
55840  <programlisting>
55841struct dvb_tuner_ops {
55842  struct dvb_tuner_info info;
55843  int (* release) (struct dvb_frontend *fe);
55844  int (* init) (struct dvb_frontend *fe);
55845  int (* sleep) (struct dvb_frontend *fe);
55846  int (* suspend) (struct dvb_frontend *fe);
55847  int (* resume) (struct dvb_frontend *fe);
55848  int (* set_params) (struct dvb_frontend *fe);
55849  int (* set_analog_params) (struct dvb_frontend *fe, struct analog_parameters *p);
55850  int (* calc_regs) (struct dvb_frontend *fe, u8 *buf, int buf_len);
55851  int (* set_config) (struct dvb_frontend *fe, void *priv_cfg);
55852  int (* get_frequency) (struct dvb_frontend *fe, u32 *frequency);
55853  int (* get_bandwidth) (struct dvb_frontend *fe, u32 *bandwidth);
55854  int (* get_if_frequency) (struct dvb_frontend *fe, u32 *frequency);
55855#define TUNER_STATUS_LOCKED 1
55856#define TUNER_STATUS_STEREO 2
55857  int (* get_status) (struct dvb_frontend *fe, u32 *status);
55858  int (* get_rf_strength) (struct dvb_frontend *fe, u16 *strength);
55859  int (* get_afc) (struct dvb_frontend *fe, s32 *afc);
55860  int (* set_frequency) (struct dvb_frontend *fe, u32 frequency);
55861  int (* set_bandwidth) (struct dvb_frontend *fe, u32 bandwidth);
55862  int (* set_state) (struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state);
55863  int (* get_state) (struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state);
55864};  </programlisting>
55865</refsynopsisdiv>
55866 <refsect1>
55867  <title>Members</title>
55868  <variablelist>
55869    <varlistentry>      <term>info</term>
55870      <listitem><para>
55871   embedded struct dvb_tuner_info with tuner properties
55872      </para></listitem>
55873    </varlistentry>
55874    <varlistentry>      <term>release</term>
55875      <listitem><para>
55876   callback function called when frontend is dettached.
55877   drivers should free any allocated memory.
55878      </para></listitem>
55879    </varlistentry>
55880    <varlistentry>      <term>init</term>
55881      <listitem><para>
55882   callback function used to initialize the tuner device.
55883      </para></listitem>
55884    </varlistentry>
55885    <varlistentry>      <term>sleep</term>
55886      <listitem><para>
55887   callback function used to put the tuner to sleep.
55888      </para></listitem>
55889    </varlistentry>
55890    <varlistentry>      <term>suspend</term>
55891      <listitem><para>
55892   callback function used to inform that the Kernel will
55893   suspend.
55894      </para></listitem>
55895    </varlistentry>
55896    <varlistentry>      <term>resume</term>
55897      <listitem><para>
55898   callback function used to inform that the Kernel is
55899   resuming from suspend.
55900      </para></listitem>
55901    </varlistentry>
55902    <varlistentry>      <term>set_params</term>
55903      <listitem><para>
55904   callback function used to inform the tuner to tune
55905   into a digital TV channel. The properties to be used
55906   are stored at <parameter>dvb_frontend</parameter>.dtv_property_cache;. The
55907   tuner demod can change the parameters to reflect the
55908   changes needed for the channel to be tuned, and
55909   update statistics.
55910      </para></listitem>
55911    </varlistentry>
55912    <varlistentry>      <term>set_analog_params</term>
55913      <listitem><para>
55914   callback function used to tune into an analog TV
55915   channel on hybrid tuners. It passes <parameter>analog_parameters</parameter>;
55916   to the driver.
55917      </para></listitem>
55918    </varlistentry>
55919    <varlistentry>      <term>calc_regs</term>
55920      <listitem><para>
55921   callback function used to pass register data settings
55922   for simple tuners.
55923      </para></listitem>
55924    </varlistentry>
55925    <varlistentry>      <term>set_config</term>
55926      <listitem><para>
55927   callback function used to send some tuner-specific
55928   parameters.
55929      </para></listitem>
55930    </varlistentry>
55931    <varlistentry>      <term>get_frequency</term>
55932      <listitem><para>
55933   get the actual tuned frequency
55934      </para></listitem>
55935    </varlistentry>
55936    <varlistentry>      <term>get_bandwidth</term>
55937      <listitem><para>
55938   get the bandwitdh used by the low pass filters
55939      </para></listitem>
55940    </varlistentry>
55941    <varlistentry>      <term>get_if_frequency</term>
55942      <listitem><para>
55943   get the Intermediate Frequency, in Hz. For baseband,
55944   should return 0.
55945      </para></listitem>
55946    </varlistentry>
55947    <varlistentry>      <term>get_status</term>
55948      <listitem><para>
55949   returns the frontend lock status
55950      </para></listitem>
55951    </varlistentry>
55952    <varlistentry>      <term>get_rf_strength</term>
55953      <listitem><para>
55954   returns the RF signal strengh. Used mostly to support
55955   analog TV and radio. Digital TV should report, instead,
55956   via DVBv5 API (<parameter>dvb_frontend</parameter>.dtv_property_cache;).
55957      </para></listitem>
55958    </varlistentry>
55959    <varlistentry>      <term>get_afc</term>
55960      <listitem><para>
55961   Used only by analog TV core. Reports the frequency
55962   drift due to AFC.
55963      </para></listitem>
55964    </varlistentry>
55965    <varlistentry>      <term>set_frequency</term>
55966      <listitem><para>
55967   Set a new frequency. Please notice that using
55968   set_params is preferred.
55969      </para></listitem>
55970    </varlistentry>
55971    <varlistentry>      <term>set_bandwidth</term>
55972      <listitem><para>
55973   Set a new frequency. Please notice that using
55974   set_params is preferred.
55975      </para></listitem>
55976    </varlistentry>
55977    <varlistentry>      <term>set_state</term>
55978      <listitem><para>
55979   callback function used on some legacy drivers that
55980   don't implement set_params in order to set properties.
55981   Shouldn't be used on new drivers.
55982      </para></listitem>
55983    </varlistentry>
55984    <varlistentry>      <term>get_state</term>
55985      <listitem><para>
55986   callback function used to get properties by some
55987   legacy drivers that don't implement set_params.
55988   Shouldn't be used on new drivers.
55989      </para></listitem>
55990    </varlistentry>
55991  </variablelist>
55992 </refsect1>
55993<refsect1>
55994<title>NOTE</title>
55995<para>
55996   frequencies used on get_frequency and set_frequency are in Hz for
55997   terrestrial/cable or kHz for satellite.
55998</para>
55999</refsect1>
56000</refentry>
56001
56002<refentry id="API-struct-analog-demod-info">
56003<refentryinfo>
56004 <title>LINUX</title>
56005 <productname>Kernel Hackers Manual</productname>
56006 <date>July 2017</date>
56007</refentryinfo>
56008<refmeta>
56009 <refentrytitle><phrase>struct analog_demod_info</phrase></refentrytitle>
56010 <manvolnum>9</manvolnum>
56011 <refmiscinfo class="version">4.4.14</refmiscinfo>
56012</refmeta>
56013<refnamediv>
56014 <refname>struct analog_demod_info</refname>
56015 <refpurpose>
56016     Information struct for analog TV part of the demod
56017 </refpurpose>
56018</refnamediv>
56019<refsynopsisdiv>
56020 <title>Synopsis</title>
56021  <programlisting>
56022struct analog_demod_info {
56023  char * name;
56024};  </programlisting>
56025</refsynopsisdiv>
56026 <refsect1>
56027  <title>Members</title>
56028  <variablelist>
56029    <varlistentry>      <term>name</term>
56030      <listitem><para>
56031   Name of the analog TV demodulator
56032      </para></listitem>
56033    </varlistentry>
56034  </variablelist>
56035 </refsect1>
56036</refentry>
56037
56038<refentry id="API-struct-analog-demod-ops">
56039<refentryinfo>
56040 <title>LINUX</title>
56041 <productname>Kernel Hackers Manual</productname>
56042 <date>July 2017</date>
56043</refentryinfo>
56044<refmeta>
56045 <refentrytitle><phrase>struct analog_demod_ops</phrase></refentrytitle>
56046 <manvolnum>9</manvolnum>
56047 <refmiscinfo class="version">4.4.14</refmiscinfo>
56048</refmeta>
56049<refnamediv>
56050 <refname>struct analog_demod_ops</refname>
56051 <refpurpose>
56052     Demodulation information and callbacks for analog TV and radio
56053 </refpurpose>
56054</refnamediv>
56055<refsynopsisdiv>
56056 <title>Synopsis</title>
56057  <programlisting>
56058struct analog_demod_ops {
56059  struct analog_demod_info info;
56060  void (* set_params) (struct dvb_frontend *fe,struct analog_parameters *params);
56061  int (* has_signal) (struct dvb_frontend *fe, u16 *signal);
56062  int (* get_afc) (struct dvb_frontend *fe, s32 *afc);
56063  void (* tuner_status) (struct dvb_frontend *fe);
56064  void (* standby) (struct dvb_frontend *fe);
56065  void (* release) (struct dvb_frontend *fe);
56066  int (* i2c_gate_ctrl) (struct dvb_frontend *fe, int enable);
56067  int (* set_config) (struct dvb_frontend *fe, void *priv_cfg);
56068};  </programlisting>
56069</refsynopsisdiv>
56070 <refsect1>
56071  <title>Members</title>
56072  <variablelist>
56073    <varlistentry>      <term>info</term>
56074      <listitem><para>
56075   pointer to struct analog_demod_info
56076      </para></listitem>
56077    </varlistentry>
56078    <varlistentry>      <term>set_params</term>
56079      <listitem><para>
56080   callback function used to inform the demod to set the
56081   demodulator parameters needed to decode an analog or
56082   radio channel. The properties are passed via
56083   struct <parameter>analog_params</parameter>;.
56084      </para></listitem>
56085    </varlistentry>
56086    <varlistentry>      <term>has_signal</term>
56087      <listitem><para>
56088   returns 0xffff if has signal, or 0 if it doesn't.
56089      </para></listitem>
56090    </varlistentry>
56091    <varlistentry>      <term>get_afc</term>
56092      <listitem><para>
56093   Used only by analog TV core. Reports the frequency
56094   drift due to AFC.
56095      </para></listitem>
56096    </varlistentry>
56097    <varlistentry>      <term>tuner_status</term>
56098      <listitem><para>
56099   callback function that returns tuner status bits, e. g.
56100   TUNER_STATUS_LOCKED and TUNER_STATUS_STEREO.
56101      </para></listitem>
56102    </varlistentry>
56103    <varlistentry>      <term>standby</term>
56104      <listitem><para>
56105   set the tuner to standby mode.
56106      </para></listitem>
56107    </varlistentry>
56108    <varlistentry>      <term>release</term>
56109      <listitem><para>
56110   callback function called when frontend is dettached.
56111   drivers should free any allocated memory.
56112      </para></listitem>
56113    </varlistentry>
56114    <varlistentry>      <term>i2c_gate_ctrl</term>
56115      <listitem><para>
56116   controls the I2C gate. Newer drivers should use I2C
56117   mux support instead.
56118      </para></listitem>
56119    </varlistentry>
56120    <varlistentry>      <term>set_config</term>
56121      <listitem><para>
56122   callback function used to send some tuner-specific
56123   parameters.
56124      </para></listitem>
56125    </varlistentry>
56126  </variablelist>
56127 </refsect1>
56128</refentry>
56129
56130<refentry id="API-struct-dvb-frontend-ops">
56131<refentryinfo>
56132 <title>LINUX</title>
56133 <productname>Kernel Hackers Manual</productname>
56134 <date>July 2017</date>
56135</refentryinfo>
56136<refmeta>
56137 <refentrytitle><phrase>struct dvb_frontend_ops</phrase></refentrytitle>
56138 <manvolnum>9</manvolnum>
56139 <refmiscinfo class="version">4.4.14</refmiscinfo>
56140</refmeta>
56141<refnamediv>
56142 <refname>struct dvb_frontend_ops</refname>
56143 <refpurpose>
56144     Demodulation information and callbacks for ditialt TV
56145 </refpurpose>
56146</refnamediv>
56147<refsynopsisdiv>
56148 <title>Synopsis</title>
56149  <programlisting>
56150struct dvb_frontend_ops {
56151  struct dvb_frontend_info info;
56152  u8 delsys[MAX_DELSYS];
56153  void (* release) (struct dvb_frontend* fe);
56154  void (* release_sec) (struct dvb_frontend* fe);
56155  int (* init) (struct dvb_frontend* fe);
56156  int (* sleep) (struct dvb_frontend* fe);
56157  int (* write) (struct dvb_frontend* fe, const u8 buf[], int len);
56158  int (* tune) (struct dvb_frontend* fe,bool re_tune,unsigned int mode_flags,unsigned int *delay,enum fe_status *status);
56159  enum dvbfe_algo (* get_frontend_algo) (struct dvb_frontend *fe);
56160  int (* set_frontend) (struct dvb_frontend *fe);
56161  int (* get_tune_settings) (struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);
56162  int (* get_frontend) (struct dvb_frontend *fe);
56163  int (* read_status) (struct dvb_frontend *fe, enum fe_status *status);
56164  int (* read_ber) (struct dvb_frontend* fe, u32* ber);
56165  int (* read_signal_strength) (struct dvb_frontend* fe, u16* strength);
56166  int (* read_snr) (struct dvb_frontend* fe, u16* snr);
56167  int (* read_ucblocks) (struct dvb_frontend* fe, u32* ucblocks);
56168  int (* diseqc_reset_overload) (struct dvb_frontend* fe);
56169  int (* diseqc_send_master_cmd) (struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
56170  int (* diseqc_recv_slave_reply) (struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply);
56171  int (* diseqc_send_burst) (struct dvb_frontend *fe,enum fe_sec_mini_cmd minicmd);
56172  int (* set_tone) (struct dvb_frontend *fe, enum fe_sec_tone_mode tone);
56173  int (* set_voltage) (struct dvb_frontend *fe,enum fe_sec_voltage voltage);
56174  int (* enable_high_lnb_voltage) (struct dvb_frontend* fe, long arg);
56175  int (* dishnetwork_send_legacy_command) (struct dvb_frontend* fe, unsigned long cmd);
56176  int (* i2c_gate_ctrl) (struct dvb_frontend* fe, int enable);
56177  int (* ts_bus_ctrl) (struct dvb_frontend* fe, int acquire);
56178  int (* set_lna) (struct dvb_frontend *);
56179  enum dvbfe_search (* search) (struct dvb_frontend *fe);
56180  struct dvb_tuner_ops tuner_ops;
56181  struct analog_demod_ops analog_ops;
56182  int (* set_property) (struct dvb_frontend* fe, struct dtv_property* tvp);
56183  int (* get_property) (struct dvb_frontend* fe, struct dtv_property* tvp);
56184};  </programlisting>
56185</refsynopsisdiv>
56186 <refsect1>
56187  <title>Members</title>
56188  <variablelist>
56189    <varlistentry>      <term>info</term>
56190      <listitem><para>
56191   embedded struct dvb_tuner_info with tuner properties
56192      </para></listitem>
56193    </varlistentry>
56194    <varlistentry>      <term>delsys[MAX_DELSYS]</term>
56195      <listitem><para>
56196   Delivery systems supported by the frontend
56197      </para></listitem>
56198    </varlistentry>
56199    <varlistentry>      <term>release</term>
56200      <listitem><para>
56201   callback function called when frontend is dettached.
56202   drivers should free any allocated memory.
56203      </para></listitem>
56204    </varlistentry>
56205    <varlistentry>      <term>release_sec</term>
56206      <listitem><para>
56207   callback function requesting that the Satelite Equipment
56208   Control (SEC) driver to release and free any memory
56209   allocated by the driver.
56210      </para></listitem>
56211    </varlistentry>
56212    <varlistentry>      <term>init</term>
56213      <listitem><para>
56214   callback function used to initialize the tuner device.
56215      </para></listitem>
56216    </varlistentry>
56217    <varlistentry>      <term>sleep</term>
56218      <listitem><para>
56219   callback function used to put the tuner to sleep.
56220      </para></listitem>
56221    </varlistentry>
56222    <varlistentry>      <term>write</term>
56223      <listitem><para>
56224   callback function used by some demod legacy drivers to
56225   allow other drivers to write data into their registers.
56226   Should not be used on new drivers.
56227      </para></listitem>
56228    </varlistentry>
56229    <varlistentry>      <term>tune</term>
56230      <listitem><para>
56231   callback function used by demod drivers that use
56232   <parameter>DVBFE_ALGO_HW</parameter>; to tune into a frequency.
56233      </para></listitem>
56234    </varlistentry>
56235    <varlistentry>      <term>get_frontend_algo</term>
56236      <listitem><para>
56237   returns the desired hardware algorithm.
56238      </para></listitem>
56239    </varlistentry>
56240    <varlistentry>      <term>set_frontend</term>
56241      <listitem><para>
56242   callback function used to inform the demod to set the
56243   parameters for demodulating a digital TV channel.
56244   The properties to be used are stored at
56245   <parameter>dvb_frontend</parameter>.dtv_property_cache;. The demod can change
56246   the parameters to reflect the changes needed for the
56247   channel to be decoded, and update statistics.
56248      </para></listitem>
56249    </varlistentry>
56250    <varlistentry>      <term>get_tune_settings</term>
56251      <listitem><para>
56252   callback function
56253      </para></listitem>
56254    </varlistentry>
56255    <varlistentry>      <term>get_frontend</term>
56256      <listitem><para>
56257   callback function used to inform the parameters
56258   actuall in use. The properties to be used are stored at
56259   <parameter>dvb_frontend</parameter>.dtv_property_cache; and update
56260   statistics. Please notice that it should not return
56261   an error code if the statistics are not available
56262   because the demog is not locked.
56263      </para></listitem>
56264    </varlistentry>
56265    <varlistentry>      <term>read_status</term>
56266      <listitem><para>
56267   returns the locking status of the frontend.
56268      </para></listitem>
56269    </varlistentry>
56270    <varlistentry>      <term>read_ber</term>
56271      <listitem><para>
56272   legacy callback function to return the bit error rate.
56273   Newer drivers should provide such info via DVBv5 API,
56274   e. g. <parameter>set_frontend</parameter>;/<parameter>get_frontend</parameter>;, implementing this
56275   callback only if DVBv3 API compatibility is wanted.
56276      </para></listitem>
56277    </varlistentry>
56278    <varlistentry>      <term>read_signal_strength</term>
56279      <listitem><para>
56280   legacy callback function to return the signal
56281   strength. Newer drivers should provide such info via
56282   DVBv5 API, e. g. <parameter>set_frontend</parameter>;/<parameter>get_frontend</parameter>;,
56283   implementing this callback only if DVBv3 API
56284   compatibility is wanted.
56285      </para></listitem>
56286    </varlistentry>
56287    <varlistentry>      <term>read_snr</term>
56288      <listitem><para>
56289   legacy callback function to return the Signal/Noise
56290   rate. Newer drivers should provide such info via
56291   DVBv5 API, e. g. <parameter>set_frontend</parameter>;/<parameter>get_frontend</parameter>;,
56292   implementing this callback only if DVBv3 API
56293   compatibility is wanted.
56294      </para></listitem>
56295    </varlistentry>
56296    <varlistentry>      <term>read_ucblocks</term>
56297      <listitem><para>
56298   legacy callback function to return the Uncorrected Error
56299   Blocks. Newer drivers should provide such info via
56300   DVBv5 API, e. g. <parameter>set_frontend</parameter>;/<parameter>get_frontend</parameter>;,
56301   implementing this callback only if DVBv3 API
56302   compatibility is wanted.
56303      </para></listitem>
56304    </varlistentry>
56305    <varlistentry>      <term>diseqc_reset_overload</term>
56306      <listitem><para>
56307   callback function to implement the
56308   FE_DISEQC_RESET_OVERLOAD ioctl (only Satellite)
56309      </para></listitem>
56310    </varlistentry>
56311    <varlistentry>      <term>diseqc_send_master_cmd</term>
56312      <listitem><para>
56313   callback function to implement the
56314   FE_DISEQC_SEND_MASTER_CMD ioctl (only Satellite).
56315      </para></listitem>
56316    </varlistentry>
56317    <varlistentry>      <term>diseqc_recv_slave_reply</term>
56318      <listitem><para>
56319   callback function to implement the
56320   FE_DISEQC_RECV_SLAVE_REPLY ioctl (only Satellite)
56321      </para></listitem>
56322    </varlistentry>
56323    <varlistentry>      <term>diseqc_send_burst</term>
56324      <listitem><para>
56325   callback function to implement the
56326   FE_DISEQC_SEND_BURST ioctl (only Satellite).
56327      </para></listitem>
56328    </varlistentry>
56329    <varlistentry>      <term>set_tone</term>
56330      <listitem><para>
56331   callback function to implement the
56332   FE_SET_TONE ioctl (only Satellite).
56333      </para></listitem>
56334    </varlistentry>
56335    <varlistentry>      <term>set_voltage</term>
56336      <listitem><para>
56337   callback function to implement the
56338   FE_SET_VOLTAGE ioctl (only Satellite).
56339      </para></listitem>
56340    </varlistentry>
56341    <varlistentry>      <term>enable_high_lnb_voltage</term>
56342      <listitem><para>
56343   callback function to implement the
56344   FE_ENABLE_HIGH_LNB_VOLTAGE ioctl (only Satellite).
56345      </para></listitem>
56346    </varlistentry>
56347    <varlistentry>      <term>dishnetwork_send_legacy_command</term>
56348      <listitem><para>
56349   callback function to implement the
56350   FE_DISHNETWORK_SEND_LEGACY_CMD ioctl (only Satellite).
56351      </para></listitem>
56352    </varlistentry>
56353    <varlistentry>      <term>i2c_gate_ctrl</term>
56354      <listitem><para>
56355   controls the I2C gate. Newer drivers should use I2C
56356   mux support instead.
56357      </para></listitem>
56358    </varlistentry>
56359    <varlistentry>      <term>ts_bus_ctrl</term>
56360      <listitem><para>
56361   callback function used to take control of the TS bus.
56362      </para></listitem>
56363    </varlistentry>
56364    <varlistentry>      <term>set_lna</term>
56365      <listitem><para>
56366   callback function to power on/off/auto the LNA.
56367      </para></listitem>
56368    </varlistentry>
56369    <varlistentry>      <term>search</term>
56370      <listitem><para>
56371   callback function used on some custom algo search algos.
56372      </para></listitem>
56373    </varlistentry>
56374    <varlistentry>      <term>tuner_ops</term>
56375      <listitem><para>
56376   pointer to struct dvb_tuner_ops
56377      </para></listitem>
56378    </varlistentry>
56379    <varlistentry>      <term>analog_ops</term>
56380      <listitem><para>
56381   pointer to struct analog_demod_ops
56382      </para></listitem>
56383    </varlistentry>
56384    <varlistentry>      <term>set_property</term>
56385      <listitem><para>
56386   callback function to allow the frontend to validade
56387   incoming properties. Should not be used on new drivers.
56388      </para></listitem>
56389    </varlistentry>
56390    <varlistentry>      <term>get_property</term>
56391      <listitem><para>
56392   callback function to allow the frontend to override
56393   outcoming properties. Should not be used on new drivers.
56394      </para></listitem>
56395    </varlistentry>
56396  </variablelist>
56397 </refsect1>
56398</refentry>
56399
56400<refentry id="API-struct-dtv-frontend-properties">
56401<refentryinfo>
56402 <title>LINUX</title>
56403 <productname>Kernel Hackers Manual</productname>
56404 <date>July 2017</date>
56405</refentryinfo>
56406<refmeta>
56407 <refentrytitle><phrase>struct dtv_frontend_properties</phrase></refentrytitle>
56408 <manvolnum>9</manvolnum>
56409 <refmiscinfo class="version">4.4.14</refmiscinfo>
56410</refmeta>
56411<refnamediv>
56412 <refname>struct dtv_frontend_properties</refname>
56413 <refpurpose>
56414     contains a list of properties that are specific to a digital TV standard.
56415 </refpurpose>
56416</refnamediv>
56417<refsynopsisdiv>
56418 <title>Synopsis</title>
56419  <programlisting>
56420struct dtv_frontend_properties {
56421  u32 frequency;
56422  enum fe_modulation modulation;
56423  enum fe_sec_voltage voltage;
56424  enum fe_sec_tone_mode sectone;
56425  enum fe_spectral_inversion inversion;
56426  enum fe_code_rate fec_inner;
56427  enum fe_transmit_mode transmission_mode;
56428  u32 bandwidth_hz;
56429  enum fe_guard_interval guard_interval;
56430  enum fe_hierarchy hierarchy;
56431  u32 symbol_rate;
56432  enum fe_code_rate code_rate_HP;
56433  enum fe_code_rate code_rate_LP;
56434  enum fe_pilot pilot;
56435  enum fe_rolloff rolloff;
56436  enum fe_delivery_system delivery_system;
56437  enum fe_interleaving interleaving;
56438  u8 isdbt_partial_reception;
56439  u8 isdbt_sb_mode;
56440  u8 isdbt_sb_subchannel;
56441  u32 isdbt_sb_segment_idx;
56442  u32 isdbt_sb_segment_count;
56443  u8 isdbt_layer_enabled;
56444  struct layer[3];
56445  u32 stream_id;
56446  u8 atscmh_fic_ver;
56447  u8 atscmh_parade_id;
56448  u8 atscmh_nog;
56449  u8 atscmh_tnog;
56450  u8 atscmh_sgn;
56451  u8 atscmh_prc;
56452  u8 atscmh_rs_frame_mode;
56453  u8 atscmh_rs_frame_ensemble;
56454  u8 atscmh_rs_code_mode_pri;
56455  u8 atscmh_rs_code_mode_sec;
56456  u8 atscmh_sccc_block_mode;
56457  u8 atscmh_sccc_code_mode_a;
56458  u8 atscmh_sccc_code_mode_b;
56459  u8 atscmh_sccc_code_mode_c;
56460  u8 atscmh_sccc_code_mode_d;
56461  u32 lna;
56462  struct dtv_fe_stats strength;
56463  struct dtv_fe_stats cnr;
56464  struct dtv_fe_stats pre_bit_error;
56465  struct dtv_fe_stats pre_bit_count;
56466  struct dtv_fe_stats post_bit_error;
56467  struct dtv_fe_stats post_bit_count;
56468  struct dtv_fe_stats block_error;
56469  struct dtv_fe_stats block_count;
56470};  </programlisting>
56471</refsynopsisdiv>
56472 <refsect1>
56473  <title>Members</title>
56474  <variablelist>
56475    <varlistentry>      <term>frequency</term>
56476      <listitem><para>
56477   frequency in Hz for terrestrial/cable or in kHz for
56478   Satellite
56479      </para></listitem>
56480    </varlistentry>
56481    <varlistentry>      <term>modulation</term>
56482      <listitem><para>
56483   Frontend modulation type
56484      </para></listitem>
56485    </varlistentry>
56486    <varlistentry>      <term>voltage</term>
56487      <listitem><para>
56488   SEC voltage (only Satellite)
56489      </para></listitem>
56490    </varlistentry>
56491    <varlistentry>      <term>sectone</term>
56492      <listitem><para>
56493   SEC tone mode (only Satellite)
56494      </para></listitem>
56495    </varlistentry>
56496    <varlistentry>      <term>inversion</term>
56497      <listitem><para>
56498   Spectral inversion
56499      </para></listitem>
56500    </varlistentry>
56501    <varlistentry>      <term>fec_inner</term>
56502      <listitem><para>
56503   Forward error correction inner Code Rate
56504      </para></listitem>
56505    </varlistentry>
56506    <varlistentry>      <term>transmission_mode</term>
56507      <listitem><para>
56508   Transmission Mode
56509      </para></listitem>
56510    </varlistentry>
56511    <varlistentry>      <term>bandwidth_hz</term>
56512      <listitem><para>
56513   Bandwidth, in Hz. A zero value means that userspace
56514   wants to autodetect.
56515      </para></listitem>
56516    </varlistentry>
56517    <varlistentry>      <term>guard_interval</term>
56518      <listitem><para>
56519   Guard Interval
56520      </para></listitem>
56521    </varlistentry>
56522    <varlistentry>      <term>hierarchy</term>
56523      <listitem><para>
56524   Hierarchy
56525      </para></listitem>
56526    </varlistentry>
56527    <varlistentry>      <term>symbol_rate</term>
56528      <listitem><para>
56529   Symbol Rate
56530      </para></listitem>
56531    </varlistentry>
56532    <varlistentry>      <term>code_rate_HP</term>
56533      <listitem><para>
56534   high priority stream code rate
56535      </para></listitem>
56536    </varlistentry>
56537    <varlistentry>      <term>code_rate_LP</term>
56538      <listitem><para>
56539   low priority stream code rate
56540      </para></listitem>
56541    </varlistentry>
56542    <varlistentry>      <term>pilot</term>
56543      <listitem><para>
56544   Enable/disable/autodetect pilot tones
56545      </para></listitem>
56546    </varlistentry>
56547    <varlistentry>      <term>rolloff</term>
56548      <listitem><para>
56549   Rolloff factor (alpha)
56550      </para></listitem>
56551    </varlistentry>
56552    <varlistentry>      <term>delivery_system</term>
56553      <listitem><para>
56554   FE delivery system (e. g. digital TV standard)
56555      </para></listitem>
56556    </varlistentry>
56557    <varlistentry>      <term>interleaving</term>
56558      <listitem><para>
56559   interleaving
56560      </para></listitem>
56561    </varlistentry>
56562    <varlistentry>      <term>isdbt_partial_reception</term>
56563      <listitem><para>
56564   ISDB-T partial reception (only ISDB standard)
56565      </para></listitem>
56566    </varlistentry>
56567    <varlistentry>      <term>isdbt_sb_mode</term>
56568      <listitem><para>
56569   ISDB-T Sound Broadcast (SB) mode (only ISDB standard)
56570      </para></listitem>
56571    </varlistentry>
56572    <varlistentry>      <term>isdbt_sb_subchannel</term>
56573      <listitem><para>
56574   ISDB-T SB subchannel (only ISDB standard)
56575      </para></listitem>
56576    </varlistentry>
56577    <varlistentry>      <term>isdbt_sb_segment_idx</term>
56578      <listitem><para>
56579   ISDB-T SB segment index (only ISDB standard)
56580      </para></listitem>
56581    </varlistentry>
56582    <varlistentry>      <term>isdbt_sb_segment_count</term>
56583      <listitem><para>
56584   ISDB-T SB segment count (only ISDB standard)
56585      </para></listitem>
56586    </varlistentry>
56587    <varlistentry>      <term>isdbt_layer_enabled</term>
56588      <listitem><para>
56589   ISDB Layer enabled (only ISDB standard)
56590      </para></listitem>
56591    </varlistentry>
56592    <varlistentry>      <term>layer[3]</term>
56593      <listitem><para>
56594   ISDB per-layer data (only ISDB standard)
56595   <parameter>layer</parameter>.segment_count: Segment Count;
56596   <parameter>layer</parameter>.fec:		per layer code rate;
56597   <parameter>layer</parameter>.modulation:	per layer modulation;
56598   <parameter>layer</parameter>.interleaving:	 per layer interleaving.
56599      </para></listitem>
56600    </varlistentry>
56601    <varlistentry>      <term>stream_id</term>
56602      <listitem><para>
56603   If different than zero, enable substream filtering, if
56604   hardware supports (DVB-S2 and DVB-T2).
56605      </para></listitem>
56606    </varlistentry>
56607    <varlistentry>      <term>atscmh_fic_ver</term>
56608      <listitem><para>
56609   Version number of the FIC (Fast Information Channel)
56610   signaling data (only ATSC-M/H)
56611      </para></listitem>
56612    </varlistentry>
56613    <varlistentry>      <term>atscmh_parade_id</term>
56614      <listitem><para>
56615   Parade identification number (only ATSC-M/H)
56616      </para></listitem>
56617    </varlistentry>
56618    <varlistentry>      <term>atscmh_nog</term>
56619      <listitem><para>
56620   Number of MH groups per MH subframe for a designated
56621   parade (only ATSC-M/H)
56622      </para></listitem>
56623    </varlistentry>
56624    <varlistentry>      <term>atscmh_tnog</term>
56625      <listitem><para>
56626   Total number of MH groups including all MH groups
56627   belonging to all MH parades in one MH subframe
56628   (only ATSC-M/H)
56629      </para></listitem>
56630    </varlistentry>
56631    <varlistentry>      <term>atscmh_sgn</term>
56632      <listitem><para>
56633   Start group number (only ATSC-M/H)
56634      </para></listitem>
56635    </varlistentry>
56636    <varlistentry>      <term>atscmh_prc</term>
56637      <listitem><para>
56638   Parade repetition cycle (only ATSC-M/H)
56639      </para></listitem>
56640    </varlistentry>
56641    <varlistentry>      <term>atscmh_rs_frame_mode</term>
56642      <listitem><para>
56643   Reed Solomon (RS) frame mode (only ATSC-M/H)
56644      </para></listitem>
56645    </varlistentry>
56646    <varlistentry>      <term>atscmh_rs_frame_ensemble</term>
56647      <listitem><para>
56648   RS frame ensemble (only ATSC-M/H)
56649      </para></listitem>
56650    </varlistentry>
56651    <varlistentry>      <term>atscmh_rs_code_mode_pri</term>
56652      <listitem><para>
56653   RS code mode pri (only ATSC-M/H)
56654      </para></listitem>
56655    </varlistentry>
56656    <varlistentry>      <term>atscmh_rs_code_mode_sec</term>
56657      <listitem><para>
56658   RS code mode sec (only ATSC-M/H)
56659      </para></listitem>
56660    </varlistentry>
56661    <varlistentry>      <term>atscmh_sccc_block_mode</term>
56662      <listitem><para>
56663   Series Concatenated Convolutional Code (SCCC)
56664   Block Mode (only ATSC-M/H)
56665      </para></listitem>
56666    </varlistentry>
56667    <varlistentry>      <term>atscmh_sccc_code_mode_a</term>
56668      <listitem><para>
56669   SCCC code mode A (only ATSC-M/H)
56670      </para></listitem>
56671    </varlistentry>
56672    <varlistentry>      <term>atscmh_sccc_code_mode_b</term>
56673      <listitem><para>
56674   SCCC code mode B (only ATSC-M/H)
56675      </para></listitem>
56676    </varlistentry>
56677    <varlistentry>      <term>atscmh_sccc_code_mode_c</term>
56678      <listitem><para>
56679   SCCC code mode C (only ATSC-M/H)
56680      </para></listitem>
56681    </varlistentry>
56682    <varlistentry>      <term>atscmh_sccc_code_mode_d</term>
56683      <listitem><para>
56684   SCCC code mode D (only ATSC-M/H)
56685      </para></listitem>
56686    </varlistentry>
56687    <varlistentry>      <term>lna</term>
56688      <listitem><para>
56689   Power ON/OFF/AUTO the Linear Now-noise Amplifier (LNA)
56690      </para></listitem>
56691    </varlistentry>
56692    <varlistentry>      <term>strength</term>
56693      <listitem><para>
56694   DVBv5 API statistics: Signal Strength
56695      </para></listitem>
56696    </varlistentry>
56697    <varlistentry>      <term>cnr</term>
56698      <listitem><para>
56699   DVBv5 API statistics: Signal to Noise ratio of the
56700   (main) carrier
56701      </para></listitem>
56702    </varlistentry>
56703    <varlistentry>      <term>pre_bit_error</term>
56704      <listitem><para>
56705   DVBv5 API statistics: pre-Viterbi bit error count
56706      </para></listitem>
56707    </varlistentry>
56708    <varlistentry>      <term>pre_bit_count</term>
56709      <listitem><para>
56710   DVBv5 API statistics: pre-Viterbi bit count
56711      </para></listitem>
56712    </varlistentry>
56713    <varlistentry>      <term>post_bit_error</term>
56714      <listitem><para>
56715   DVBv5 API statistics: post-Viterbi bit error count
56716      </para></listitem>
56717    </varlistentry>
56718    <varlistentry>      <term>post_bit_count</term>
56719      <listitem><para>
56720   DVBv5 API statistics: post-Viterbi bit count
56721      </para></listitem>
56722    </varlistentry>
56723    <varlistentry>      <term>block_error</term>
56724      <listitem><para>
56725   DVBv5 API statistics: block error count
56726      </para></listitem>
56727    </varlistentry>
56728    <varlistentry>      <term>block_count</term>
56729      <listitem><para>
56730   DVBv5 API statistics: block count
56731      </para></listitem>
56732    </varlistentry>
56733  </variablelist>
56734 </refsect1>
56735<refsect1>
56736<title>NOTE</title>
56737<para>
56738   derivated statistics like Uncorrected Error blocks (UCE) are
56739   calculated on userspace.
56740   </para><para>
56741
56742   Only a subset of the properties are needed for a given delivery system.
56743   For more info, consult the media_api.html with the documentation of the
56744   Userspace API.
56745</para>
56746</refsect1>
56747</refentry>
56748
56749<refentry id="API-struct-dvb-frontend">
56750<refentryinfo>
56751 <title>LINUX</title>
56752 <productname>Kernel Hackers Manual</productname>
56753 <date>July 2017</date>
56754</refentryinfo>
56755<refmeta>
56756 <refentrytitle><phrase>struct dvb_frontend</phrase></refentrytitle>
56757 <manvolnum>9</manvolnum>
56758 <refmiscinfo class="version">4.4.14</refmiscinfo>
56759</refmeta>
56760<refnamediv>
56761 <refname>struct dvb_frontend</refname>
56762 <refpurpose>
56763     Frontend structure to be used on drivers.
56764 </refpurpose>
56765</refnamediv>
56766<refsynopsisdiv>
56767 <title>Synopsis</title>
56768  <programlisting>
56769struct dvb_frontend {
56770  struct dvb_frontend_ops ops;
56771  struct dvb_adapter * dvb;
56772  void * demodulator_priv;
56773  void * tuner_priv;
56774  void * frontend_priv;
56775  void * sec_priv;
56776  void * analog_demod_priv;
56777  struct dtv_frontend_properties dtv_property_cache;
56778#define DVB_FRONTEND_COMPONENT_TUNER 0
56779#define DVB_FRONTEND_COMPONENT_DEMOD 1
56780  int (* callback) (void *adapter_priv, int component, int cmd, int arg);
56781  int id;
56782  unsigned int exit;
56783};  </programlisting>
56784</refsynopsisdiv>
56785 <refsect1>
56786  <title>Members</title>
56787  <variablelist>
56788    <varlistentry>      <term>ops</term>
56789      <listitem><para>
56790   embedded struct dvb_frontend_ops
56791      </para></listitem>
56792    </varlistentry>
56793    <varlistentry>      <term>dvb</term>
56794      <listitem><para>
56795   pointer to struct dvb_adapter
56796      </para></listitem>
56797    </varlistentry>
56798    <varlistentry>      <term>demodulator_priv</term>
56799      <listitem><para>
56800   demod private data
56801      </para></listitem>
56802    </varlistentry>
56803    <varlistentry>      <term>tuner_priv</term>
56804      <listitem><para>
56805   tuner private data
56806      </para></listitem>
56807    </varlistentry>
56808    <varlistentry>      <term>frontend_priv</term>
56809      <listitem><para>
56810   frontend private data
56811      </para></listitem>
56812    </varlistentry>
56813    <varlistentry>      <term>sec_priv</term>
56814      <listitem><para>
56815   SEC private data
56816      </para></listitem>
56817    </varlistentry>
56818    <varlistentry>      <term>analog_demod_priv</term>
56819      <listitem><para>
56820   Analog demod private data
56821      </para></listitem>
56822    </varlistentry>
56823    <varlistentry>      <term>dtv_property_cache</term>
56824      <listitem><para>
56825   embedded struct dtv_frontend_properties
56826      </para></listitem>
56827    </varlistentry>
56828    <varlistentry>      <term>callback</term>
56829      <listitem><para>
56830   callback function used on some drivers to call
56831   either the tuner or the demodulator.
56832      </para></listitem>
56833    </varlistentry>
56834    <varlistentry>      <term>id</term>
56835      <listitem><para>
56836   Frontend ID
56837      </para></listitem>
56838    </varlistentry>
56839    <varlistentry>      <term>exit</term>
56840      <listitem><para>
56841   Used to inform the DVB core that the frontend
56842   thread should exit (usually, means that the hardware
56843   got disconnected.
56844      </para></listitem>
56845    </varlistentry>
56846  </variablelist>
56847 </refsect1>
56848</refentry>
56849
56850<!-- drivers/media/dvb-core/dvb_math.h -->
56851<refentry id="API-intlog2">
56852<refentryinfo>
56853 <title>LINUX</title>
56854 <productname>Kernel Hackers Manual</productname>
56855 <date>July 2017</date>
56856</refentryinfo>
56857<refmeta>
56858 <refentrytitle><phrase>intlog2</phrase></refentrytitle>
56859 <manvolnum>9</manvolnum>
56860 <refmiscinfo class="version">4.4.14</refmiscinfo>
56861</refmeta>
56862<refnamediv>
56863 <refname>intlog2</refname>
56864 <refpurpose>
56865  computes log2 of a value; the result is shifted left by 24 bits
56866 </refpurpose>
56867</refnamediv>
56868<refsynopsisdiv>
56869 <title>Synopsis</title>
56870  <funcsynopsis><funcprototype>
56871   <funcdef>unsigned int <function>intlog2 </function></funcdef>
56872   <paramdef>u32 <parameter>value</parameter></paramdef>
56873  </funcprototype></funcsynopsis>
56874</refsynopsisdiv>
56875<refsect1>
56876 <title>Arguments</title>
56877 <variablelist>
56878  <varlistentry>
56879   <term><parameter>value</parameter></term>
56880   <listitem>
56881    <para>
56882     The value (must be != 0)
56883    </para>
56884   </listitem>
56885  </varlistentry>
56886 </variablelist>
56887</refsect1>
56888<refsect1>
56889<title>to use rational values you can use the following method</title>
56890<para>
56891   intlog2(value) = intlog2(value * 2^x) - x * 2^24
56892</para>
56893</refsect1>
56894<refsect1>
56895<title>Some usecase examples</title>
56896<informalexample><programlisting>
56897   	intlog2(8) will give 3 &lt;&lt; 24 = 3 * 2^24
56898   	intlog2(9) will give 3 &lt;&lt; 24 + ... = 3.16... * 2^24
56899   	intlog2(1.5) = intlog2(3) - 2^24 = 0.584... * 2^24
56900</programlisting></informalexample>
56901</refsect1>
56902<refsect1>
56903<title>return</title>
56904<para>
56905   log2(value) * 2^24
56906</para>
56907</refsect1>
56908</refentry>
56909
56910<refentry id="API-intlog10">
56911<refentryinfo>
56912 <title>LINUX</title>
56913 <productname>Kernel Hackers Manual</productname>
56914 <date>July 2017</date>
56915</refentryinfo>
56916<refmeta>
56917 <refentrytitle><phrase>intlog10</phrase></refentrytitle>
56918 <manvolnum>9</manvolnum>
56919 <refmiscinfo class="version">4.4.14</refmiscinfo>
56920</refmeta>
56921<refnamediv>
56922 <refname>intlog10</refname>
56923 <refpurpose>
56924     computes log10 of a value; the result is shifted left by 24 bits
56925 </refpurpose>
56926</refnamediv>
56927<refsynopsisdiv>
56928 <title>Synopsis</title>
56929  <funcsynopsis><funcprototype>
56930   <funcdef>unsigned int <function>intlog10 </function></funcdef>
56931   <paramdef>u32 <parameter>value</parameter></paramdef>
56932  </funcprototype></funcsynopsis>
56933</refsynopsisdiv>
56934<refsect1>
56935 <title>Arguments</title>
56936 <variablelist>
56937  <varlistentry>
56938   <term><parameter>value</parameter></term>
56939   <listitem>
56940    <para>
56941     The value (must be != 0)
56942    </para>
56943   </listitem>
56944  </varlistentry>
56945 </variablelist>
56946</refsect1>
56947<refsect1>
56948<title>to use rational values you can use the following method</title>
56949<para>
56950   intlog10(value) = intlog10(value * 10^x) - x * 2^24
56951</para>
56952</refsect1>
56953<refsect1>
56954<title>An usecase example</title>
56955<informalexample><programlisting>
56956   	intlog10(1000) will give 3 &lt;&lt; 24 = 3 * 2^24
56957     due to the implementation intlog10(1000) might be not exactly 3 * 2^24
56958
56959   look at intlog2 for similar examples
56960</programlisting></informalexample>
56961</refsect1>
56962<refsect1>
56963<title>return</title>
56964<para>
56965   log10(value) * 2^24
56966</para>
56967</refsect1>
56968</refentry>
56969
56970<!-- drivers/media/dvb-core/dvb_ringbuffer.h -->
56971<refentry id="API-dvb-ringbuffer-pkt-write">
56972<refentryinfo>
56973 <title>LINUX</title>
56974 <productname>Kernel Hackers Manual</productname>
56975 <date>July 2017</date>
56976</refentryinfo>
56977<refmeta>
56978 <refentrytitle><phrase>dvb_ringbuffer_pkt_write</phrase></refentrytitle>
56979 <manvolnum>9</manvolnum>
56980 <refmiscinfo class="version">4.4.14</refmiscinfo>
56981</refmeta>
56982<refnamediv>
56983 <refname>dvb_ringbuffer_pkt_write</refname>
56984 <refpurpose>
56985  Write a packet into the ringbuffer.
56986 </refpurpose>
56987</refnamediv>
56988<refsynopsisdiv>
56989 <title>Synopsis</title>
56990  <funcsynopsis><funcprototype>
56991   <funcdef>ssize_t <function>dvb_ringbuffer_pkt_write </function></funcdef>
56992   <paramdef>struct dvb_ringbuffer * <parameter>rbuf</parameter></paramdef>
56993   <paramdef>u8 * <parameter>buf</parameter></paramdef>
56994   <paramdef>size_t <parameter>len</parameter></paramdef>
56995  </funcprototype></funcsynopsis>
56996</refsynopsisdiv>
56997<refsect1>
56998 <title>Arguments</title>
56999 <variablelist>
57000  <varlistentry>
57001   <term><parameter>rbuf</parameter></term>
57002   <listitem>
57003    <para>
57004     Ringbuffer to write to.
57005    </para>
57006   </listitem>
57007  </varlistentry>
57008  <varlistentry>
57009   <term><parameter>buf</parameter></term>
57010   <listitem>
57011    <para>
57012     Buffer to write.
57013    </para>
57014   </listitem>
57015  </varlistentry>
57016  <varlistentry>
57017   <term><parameter>len</parameter></term>
57018   <listitem>
57019    <para>
57020     Length of buffer (currently limited to 65535 bytes max).
57021     returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL.
57022    </para>
57023   </listitem>
57024  </varlistentry>
57025 </variablelist>
57026</refsect1>
57027</refentry>
57028
57029<refentry id="API-dvb-ringbuffer-pkt-read-user">
57030<refentryinfo>
57031 <title>LINUX</title>
57032 <productname>Kernel Hackers Manual</productname>
57033 <date>July 2017</date>
57034</refentryinfo>
57035<refmeta>
57036 <refentrytitle><phrase>dvb_ringbuffer_pkt_read_user</phrase></refentrytitle>
57037 <manvolnum>9</manvolnum>
57038 <refmiscinfo class="version">4.4.14</refmiscinfo>
57039</refmeta>
57040<refnamediv>
57041 <refname>dvb_ringbuffer_pkt_read_user</refname>
57042 <refpurpose>
57043     Read from a packet in the ringbuffer.
57044 </refpurpose>
57045</refnamediv>
57046<refsynopsisdiv>
57047 <title>Synopsis</title>
57048  <funcsynopsis><funcprototype>
57049   <funcdef>ssize_t <function>dvb_ringbuffer_pkt_read_user </function></funcdef>
57050   <paramdef>struct dvb_ringbuffer * <parameter>rbuf</parameter></paramdef>
57051   <paramdef>size_t <parameter>idx</parameter></paramdef>
57052   <paramdef>int <parameter>offset</parameter></paramdef>
57053   <paramdef>u8 __user * <parameter>buf</parameter></paramdef>
57054   <paramdef>size_t <parameter>len</parameter></paramdef>
57055  </funcprototype></funcsynopsis>
57056</refsynopsisdiv>
57057<refsect1>
57058 <title>Arguments</title>
57059 <variablelist>
57060  <varlistentry>
57061   <term><parameter>rbuf</parameter></term>
57062   <listitem>
57063    <para>
57064     Ringbuffer concerned.
57065    </para>
57066   </listitem>
57067  </varlistentry>
57068  <varlistentry>
57069   <term><parameter>idx</parameter></term>
57070   <listitem>
57071    <para>
57072     Packet index as returned by <function><link linkend="API-dvb-ringbuffer-pkt-next">dvb_ringbuffer_pkt_next</link></function>.
57073    </para>
57074   </listitem>
57075  </varlistentry>
57076  <varlistentry>
57077   <term><parameter>offset</parameter></term>
57078   <listitem>
57079    <para>
57080     Offset into packet to read from.
57081    </para>
57082   </listitem>
57083  </varlistentry>
57084  <varlistentry>
57085   <term><parameter>buf</parameter></term>
57086   <listitem>
57087    <para>
57088     Destination buffer for data.
57089    </para>
57090   </listitem>
57091  </varlistentry>
57092  <varlistentry>
57093   <term><parameter>len</parameter></term>
57094   <listitem>
57095    <para>
57096     Size of destination buffer.
57097    </para>
57098   </listitem>
57099  </varlistentry>
57100 </variablelist>
57101</refsect1>
57102<refsect1>
57103<title>Note</title>
57104<para>
57105   unlike <function>dvb_ringbuffer_read</function>, this does NOT update the read pointer
57106   in the ringbuffer. You must use <function><link linkend="API-dvb-ringbuffer-pkt-dispose">dvb_ringbuffer_pkt_dispose</link></function> to mark a
57107   packet as no longer required.
57108</para>
57109</refsect1>
57110<refsect1>
57111<title>Description</title>
57112<para>
57113   returns Number of bytes read, or -EFAULT.
57114</para>
57115</refsect1>
57116</refentry>
57117
57118<refentry id="API-dvb-ringbuffer-pkt-read">
57119<refentryinfo>
57120 <title>LINUX</title>
57121 <productname>Kernel Hackers Manual</productname>
57122 <date>July 2017</date>
57123</refentryinfo>
57124<refmeta>
57125 <refentrytitle><phrase>dvb_ringbuffer_pkt_read</phrase></refentrytitle>
57126 <manvolnum>9</manvolnum>
57127 <refmiscinfo class="version">4.4.14</refmiscinfo>
57128</refmeta>
57129<refnamediv>
57130 <refname>dvb_ringbuffer_pkt_read</refname>
57131 <refpurpose>
57132     Read from a packet in the ringbuffer.
57133 </refpurpose>
57134</refnamediv>
57135<refsynopsisdiv>
57136 <title>Synopsis</title>
57137  <funcsynopsis><funcprototype>
57138   <funcdef>ssize_t <function>dvb_ringbuffer_pkt_read </function></funcdef>
57139   <paramdef>struct dvb_ringbuffer * <parameter>rbuf</parameter></paramdef>
57140   <paramdef>size_t <parameter>idx</parameter></paramdef>
57141   <paramdef>int <parameter>offset</parameter></paramdef>
57142   <paramdef>u8 * <parameter>buf</parameter></paramdef>
57143   <paramdef>size_t <parameter>len</parameter></paramdef>
57144  </funcprototype></funcsynopsis>
57145</refsynopsisdiv>
57146<refsect1>
57147 <title>Arguments</title>
57148 <variablelist>
57149  <varlistentry>
57150   <term><parameter>rbuf</parameter></term>
57151   <listitem>
57152    <para>
57153     Ringbuffer concerned.
57154    </para>
57155   </listitem>
57156  </varlistentry>
57157  <varlistentry>
57158   <term><parameter>idx</parameter></term>
57159   <listitem>
57160    <para>
57161     Packet index as returned by <function><link linkend="API-dvb-ringbuffer-pkt-next">dvb_ringbuffer_pkt_next</link></function>.
57162    </para>
57163   </listitem>
57164  </varlistentry>
57165  <varlistentry>
57166   <term><parameter>offset</parameter></term>
57167   <listitem>
57168    <para>
57169     Offset into packet to read from.
57170    </para>
57171   </listitem>
57172  </varlistentry>
57173  <varlistentry>
57174   <term><parameter>buf</parameter></term>
57175   <listitem>
57176    <para>
57177     Destination buffer for data.
57178    </para>
57179   </listitem>
57180  </varlistentry>
57181  <varlistentry>
57182   <term><parameter>len</parameter></term>
57183   <listitem>
57184    <para>
57185     Size of destination buffer.
57186    </para>
57187   </listitem>
57188  </varlistentry>
57189 </variablelist>
57190</refsect1>
57191<refsect1>
57192<title>Note</title>
57193<para>
57194   unlike <function>dvb_ringbuffer_read_user</function>, this DOES update the read pointer
57195   in the ringbuffer.
57196</para>
57197</refsect1>
57198<refsect1>
57199<title>Description</title>
57200<para>
57201   returns Number of bytes read, or -EFAULT.
57202</para>
57203</refsect1>
57204</refentry>
57205
57206<refentry id="API-dvb-ringbuffer-pkt-dispose">
57207<refentryinfo>
57208 <title>LINUX</title>
57209 <productname>Kernel Hackers Manual</productname>
57210 <date>July 2017</date>
57211</refentryinfo>
57212<refmeta>
57213 <refentrytitle><phrase>dvb_ringbuffer_pkt_dispose</phrase></refentrytitle>
57214 <manvolnum>9</manvolnum>
57215 <refmiscinfo class="version">4.4.14</refmiscinfo>
57216</refmeta>
57217<refnamediv>
57218 <refname>dvb_ringbuffer_pkt_dispose</refname>
57219 <refpurpose>
57220     Dispose of a packet in the ring buffer.
57221 </refpurpose>
57222</refnamediv>
57223<refsynopsisdiv>
57224 <title>Synopsis</title>
57225  <funcsynopsis><funcprototype>
57226   <funcdef>void <function>dvb_ringbuffer_pkt_dispose </function></funcdef>
57227   <paramdef>struct dvb_ringbuffer * <parameter>rbuf</parameter></paramdef>
57228   <paramdef>size_t <parameter>idx</parameter></paramdef>
57229  </funcprototype></funcsynopsis>
57230</refsynopsisdiv>
57231<refsect1>
57232 <title>Arguments</title>
57233 <variablelist>
57234  <varlistentry>
57235   <term><parameter>rbuf</parameter></term>
57236   <listitem>
57237    <para>
57238     Ring buffer concerned.
57239    </para>
57240   </listitem>
57241  </varlistentry>
57242  <varlistentry>
57243   <term><parameter>idx</parameter></term>
57244   <listitem>
57245    <para>
57246     Packet index as returned by <function><link linkend="API-dvb-ringbuffer-pkt-next">dvb_ringbuffer_pkt_next</link></function>.
57247    </para>
57248   </listitem>
57249  </varlistentry>
57250 </variablelist>
57251</refsect1>
57252</refentry>
57253
57254<refentry id="API-dvb-ringbuffer-pkt-next">
57255<refentryinfo>
57256 <title>LINUX</title>
57257 <productname>Kernel Hackers Manual</productname>
57258 <date>July 2017</date>
57259</refentryinfo>
57260<refmeta>
57261 <refentrytitle><phrase>dvb_ringbuffer_pkt_next</phrase></refentrytitle>
57262 <manvolnum>9</manvolnum>
57263 <refmiscinfo class="version">4.4.14</refmiscinfo>
57264</refmeta>
57265<refnamediv>
57266 <refname>dvb_ringbuffer_pkt_next</refname>
57267 <refpurpose>
57268     Get the index of the next packet in a ringbuffer.
57269 </refpurpose>
57270</refnamediv>
57271<refsynopsisdiv>
57272 <title>Synopsis</title>
57273  <funcsynopsis><funcprototype>
57274   <funcdef>ssize_t <function>dvb_ringbuffer_pkt_next </function></funcdef>
57275   <paramdef>struct dvb_ringbuffer * <parameter>rbuf</parameter></paramdef>
57276   <paramdef>size_t <parameter>idx</parameter></paramdef>
57277   <paramdef>size_t * <parameter>pktlen</parameter></paramdef>
57278  </funcprototype></funcsynopsis>
57279</refsynopsisdiv>
57280<refsect1>
57281 <title>Arguments</title>
57282 <variablelist>
57283  <varlistentry>
57284   <term><parameter>rbuf</parameter></term>
57285   <listitem>
57286    <para>
57287     Ringbuffer concerned.
57288    </para>
57289   </listitem>
57290  </varlistentry>
57291  <varlistentry>
57292   <term><parameter>idx</parameter></term>
57293   <listitem>
57294    <para>
57295     Previous packet index, or -1 to return the first packet index.
57296    </para>
57297   </listitem>
57298  </varlistentry>
57299  <varlistentry>
57300   <term><parameter>pktlen</parameter></term>
57301   <listitem>
57302    <para>
57303     On success, will be updated to contain the length of the packet in bytes.
57304     returns Packet index (if &gt;=0), or -1 if no packets available.
57305    </para>
57306   </listitem>
57307  </varlistentry>
57308 </variablelist>
57309</refsect1>
57310</refentry>
57311
57312<!-- drivers/media/dvb-core/dvbdev.h -->
57313<refentry id="API-struct-dvb-adapter">
57314<refentryinfo>
57315 <title>LINUX</title>
57316 <productname>Kernel Hackers Manual</productname>
57317 <date>July 2017</date>
57318</refentryinfo>
57319<refmeta>
57320 <refentrytitle><phrase>struct dvb_adapter</phrase></refentrytitle>
57321 <manvolnum>9</manvolnum>
57322 <refmiscinfo class="version">4.4.14</refmiscinfo>
57323</refmeta>
57324<refnamediv>
57325 <refname>struct dvb_adapter</refname>
57326 <refpurpose>
57327  represents a Digital TV adapter using Linux DVB API
57328 </refpurpose>
57329</refnamediv>
57330<refsynopsisdiv>
57331 <title>Synopsis</title>
57332  <programlisting>
57333struct dvb_adapter {
57334  int num;
57335  struct list_head list_head;
57336  struct list_head device_list;
57337  const char * name;
57338  u8 proposed_mac[6];
57339  void * priv;
57340  struct device * device;
57341  struct module * module;
57342  int mfe_shared;
57343  struct dvb_device * mfe_dvbdev;
57344  struct mutex mfe_lock;
57345#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
57346  struct media_device * mdev;
57347#endif
57348};  </programlisting>
57349</refsynopsisdiv>
57350 <refsect1>
57351  <title>Members</title>
57352  <variablelist>
57353    <varlistentry>      <term>num</term>
57354      <listitem><para>
57355Number of the adapter
57356      </para></listitem>
57357    </varlistentry>
57358    <varlistentry>      <term>list_head</term>
57359      <listitem><para>
57360List with the DVB adapters
57361      </para></listitem>
57362    </varlistentry>
57363    <varlistentry>      <term>device_list</term>
57364      <listitem><para>
57365List with the DVB devices
57366      </para></listitem>
57367    </varlistentry>
57368    <varlistentry>      <term>name</term>
57369      <listitem><para>
57370Name of the adapter
57371      </para></listitem>
57372    </varlistentry>
57373    <varlistentry>      <term>proposed_mac[6]</term>
57374      <listitem><para>
57375proposed MAC address for the adapter
57376      </para></listitem>
57377    </varlistentry>
57378    <varlistentry>      <term>priv</term>
57379      <listitem><para>
57380private data
57381      </para></listitem>
57382    </varlistentry>
57383    <varlistentry>      <term>device</term>
57384      <listitem><para>
57385pointer to struct device
57386      </para></listitem>
57387    </varlistentry>
57388    <varlistentry>      <term>module</term>
57389      <listitem><para>
57390pointer to struct module
57391      </para></listitem>
57392    </varlistentry>
57393    <varlistentry>      <term>mfe_shared</term>
57394      <listitem><para>
57395mfe shared: indicates mutually exclusive frontends
57396Thie usage of this flag is currently deprecated
57397      </para></listitem>
57398    </varlistentry>
57399    <varlistentry>      <term>mfe_dvbdev</term>
57400      <listitem><para>
57401Frontend device in use, in the case of MFE
57402      </para></listitem>
57403    </varlistentry>
57404    <varlistentry>      <term>mfe_lock</term>
57405      <listitem><para>
57406Lock to prevent using the other frontends when MFE is
57407used.
57408      </para></listitem>
57409    </varlistentry>
57410    <varlistentry>      <term>mdev</term>
57411      <listitem><para>
57412pointer to struct media_device, used when the media
57413controller is used.
57414      </para></listitem>
57415    </varlistentry>
57416  </variablelist>
57417 </refsect1>
57418</refentry>
57419
57420<refentry id="API-struct-dvb-device">
57421<refentryinfo>
57422 <title>LINUX</title>
57423 <productname>Kernel Hackers Manual</productname>
57424 <date>July 2017</date>
57425</refentryinfo>
57426<refmeta>
57427 <refentrytitle><phrase>struct dvb_device</phrase></refentrytitle>
57428 <manvolnum>9</manvolnum>
57429 <refmiscinfo class="version">4.4.14</refmiscinfo>
57430</refmeta>
57431<refnamediv>
57432 <refname>struct dvb_device</refname>
57433 <refpurpose>
57434     represents a DVB device node
57435 </refpurpose>
57436</refnamediv>
57437<refsynopsisdiv>
57438 <title>Synopsis</title>
57439  <programlisting>
57440struct dvb_device {
57441  struct list_head list_head;
57442  const struct file_operations * fops;
57443  struct dvb_adapter * adapter;
57444  int type;
57445  int minor;
57446  u32 id;
57447  int readers;
57448  int writers;
57449  int users;
57450  wait_queue_head_t wait_queue;
57451  int (* kernel_ioctl) (struct file *file, unsigned int cmd, void *arg);
57452#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
57453  const char * name;
57454  struct media_entity * entity;
57455  struct media_pad * pads;
57456#endif
57457  void * priv;
57458};  </programlisting>
57459</refsynopsisdiv>
57460 <refsect1>
57461  <title>Members</title>
57462  <variablelist>
57463    <varlistentry>      <term>list_head</term>
57464      <listitem><para>
57465   List head with all DVB devices
57466      </para></listitem>
57467    </varlistentry>
57468    <varlistentry>      <term>fops</term>
57469      <listitem><para>
57470   pointer to struct file_operations
57471      </para></listitem>
57472    </varlistentry>
57473    <varlistentry>      <term>adapter</term>
57474      <listitem><para>
57475   pointer to the adapter that holds this device node
57476      </para></listitem>
57477    </varlistentry>
57478    <varlistentry>      <term>type</term>
57479      <listitem><para>
57480   type of the device: DVB_DEVICE_SEC, DVB_DEVICE_FRONTEND,
57481   DVB_DEVICE_DEMUX, DVB_DEVICE_DVR, DVB_DEVICE_CA, DVB_DEVICE_NET
57482      </para></listitem>
57483    </varlistentry>
57484    <varlistentry>      <term>minor</term>
57485      <listitem><para>
57486   devnode minor number. Major number is always DVB_MAJOR.
57487      </para></listitem>
57488    </varlistentry>
57489    <varlistentry>      <term>id</term>
57490      <listitem><para>
57491   device ID number, inside the adapter
57492      </para></listitem>
57493    </varlistentry>
57494    <varlistentry>      <term>readers</term>
57495      <listitem><para>
57496   Initialized by the caller. Each call to <function>open</function> in Read Only mode
57497   decreases this counter by one.
57498      </para></listitem>
57499    </varlistentry>
57500    <varlistentry>      <term>writers</term>
57501      <listitem><para>
57502   Initialized by the caller. Each call to <function>open</function> in Read/Write
57503   mode decreases this counter by one.
57504      </para></listitem>
57505    </varlistentry>
57506    <varlistentry>      <term>users</term>
57507      <listitem><para>
57508   Initialized by the caller. Each call to <function>open</function> in any mode
57509   decreases this counter by one.
57510      </para></listitem>
57511    </varlistentry>
57512    <varlistentry>      <term>wait_queue</term>
57513      <listitem><para>
57514   wait queue, used to wait for certain events inside one of
57515   the DVB API callers
57516      </para></listitem>
57517    </varlistentry>
57518    <varlistentry>      <term>kernel_ioctl</term>
57519      <listitem><para>
57520   callback function used to handle ioctl calls from userspace.
57521      </para></listitem>
57522    </varlistentry>
57523    <varlistentry>      <term>name</term>
57524      <listitem><para>
57525   Name to be used for the device at the Media Controller
57526      </para></listitem>
57527    </varlistentry>
57528    <varlistentry>      <term>entity</term>
57529      <listitem><para>
57530   pointer to struct media_entity associated with the device node
57531      </para></listitem>
57532    </varlistentry>
57533    <varlistentry>      <term>pads</term>
57534      <listitem><para>
57535   pointer to struct media_pad associated with <parameter>entity</parameter>;
57536      </para></listitem>
57537    </varlistentry>
57538    <varlistentry>      <term>priv</term>
57539      <listitem><para>
57540   private data
57541      </para></listitem>
57542    </varlistentry>
57543  </variablelist>
57544 </refsect1>
57545<refsect1>
57546<title>Description</title>
57547<para>
57548   This structure is used by the DVB core (frontend, CA, net, demux) in
57549   order to create the device nodes. Usually, driver should not initialize
57550   this struct diretly.
57551</para>
57552</refsect1>
57553</refentry>
57554
57555<refentry id="API-dvb-register-adapter">
57556<refentryinfo>
57557 <title>LINUX</title>
57558 <productname>Kernel Hackers Manual</productname>
57559 <date>July 2017</date>
57560</refentryinfo>
57561<refmeta>
57562 <refentrytitle><phrase>dvb_register_adapter</phrase></refentrytitle>
57563 <manvolnum>9</manvolnum>
57564 <refmiscinfo class="version">4.4.14</refmiscinfo>
57565</refmeta>
57566<refnamediv>
57567 <refname>dvb_register_adapter</refname>
57568 <refpurpose>
57569     Registers a new DVB adapter
57570 </refpurpose>
57571</refnamediv>
57572<refsynopsisdiv>
57573 <title>Synopsis</title>
57574  <funcsynopsis><funcprototype>
57575   <funcdef>int <function>dvb_register_adapter </function></funcdef>
57576   <paramdef><link linkend="API-struct-dvb-adapter">struct dvb_adapter</link> * <parameter>adap</parameter></paramdef>
57577   <paramdef>const char * <parameter>name</parameter></paramdef>
57578   <paramdef>struct module * <parameter>module</parameter></paramdef>
57579   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>device</parameter></paramdef>
57580   <paramdef>short * <parameter>adapter_nums</parameter></paramdef>
57581  </funcprototype></funcsynopsis>
57582</refsynopsisdiv>
57583<refsect1>
57584 <title>Arguments</title>
57585 <variablelist>
57586  <varlistentry>
57587   <term><parameter>adap</parameter></term>
57588   <listitem>
57589    <para>
57590     pointer to struct dvb_adapter
57591    </para>
57592   </listitem>
57593  </varlistentry>
57594  <varlistentry>
57595   <term><parameter>name</parameter></term>
57596   <listitem>
57597    <para>
57598     Adapter's name
57599    </para>
57600   </listitem>
57601  </varlistentry>
57602  <varlistentry>
57603   <term><parameter>module</parameter></term>
57604   <listitem>
57605    <para>
57606     initialized with THIS_MODULE at the caller
57607    </para>
57608   </listitem>
57609  </varlistentry>
57610  <varlistentry>
57611   <term><parameter>device</parameter></term>
57612   <listitem>
57613    <para>
57614     pointer to struct device that corresponds to the device driver
57615    </para>
57616   </listitem>
57617  </varlistentry>
57618  <varlistentry>
57619   <term><parameter>adapter_nums</parameter></term>
57620   <listitem>
57621    <para>
57622     Array with a list of the numbers for <parameter>dvb_register_adapter</parameter>;
57623     to select among them. Typically, initialized with:
57624     DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nums)
57625    </para>
57626   </listitem>
57627  </varlistentry>
57628 </variablelist>
57629</refsect1>
57630</refentry>
57631
57632<refentry id="API-dvb-unregister-adapter">
57633<refentryinfo>
57634 <title>LINUX</title>
57635 <productname>Kernel Hackers Manual</productname>
57636 <date>July 2017</date>
57637</refentryinfo>
57638<refmeta>
57639 <refentrytitle><phrase>dvb_unregister_adapter</phrase></refentrytitle>
57640 <manvolnum>9</manvolnum>
57641 <refmiscinfo class="version">4.4.14</refmiscinfo>
57642</refmeta>
57643<refnamediv>
57644 <refname>dvb_unregister_adapter</refname>
57645 <refpurpose>
57646     Unregisters a DVB adapter
57647 </refpurpose>
57648</refnamediv>
57649<refsynopsisdiv>
57650 <title>Synopsis</title>
57651  <funcsynopsis><funcprototype>
57652   <funcdef>int <function>dvb_unregister_adapter </function></funcdef>
57653   <paramdef><link linkend="API-struct-dvb-adapter">struct dvb_adapter</link> * <parameter>adap</parameter></paramdef>
57654  </funcprototype></funcsynopsis>
57655</refsynopsisdiv>
57656<refsect1>
57657 <title>Arguments</title>
57658 <variablelist>
57659  <varlistentry>
57660   <term><parameter>adap</parameter></term>
57661   <listitem>
57662    <para>
57663     pointer to struct dvb_adapter
57664    </para>
57665   </listitem>
57666  </varlistentry>
57667 </variablelist>
57668</refsect1>
57669</refentry>
57670
57671<refentry id="API-dvb-register-device">
57672<refentryinfo>
57673 <title>LINUX</title>
57674 <productname>Kernel Hackers Manual</productname>
57675 <date>July 2017</date>
57676</refentryinfo>
57677<refmeta>
57678 <refentrytitle><phrase>dvb_register_device</phrase></refentrytitle>
57679 <manvolnum>9</manvolnum>
57680 <refmiscinfo class="version">4.4.14</refmiscinfo>
57681</refmeta>
57682<refnamediv>
57683 <refname>dvb_register_device</refname>
57684 <refpurpose>
57685     Registers a new DVB device
57686 </refpurpose>
57687</refnamediv>
57688<refsynopsisdiv>
57689 <title>Synopsis</title>
57690  <funcsynopsis><funcprototype>
57691   <funcdef>int <function>dvb_register_device </function></funcdef>
57692   <paramdef><link linkend="API-struct-dvb-adapter">struct dvb_adapter</link> * <parameter>adap</parameter></paramdef>
57693   <paramdef>struct dvb_device ** <parameter>pdvbdev</parameter></paramdef>
57694   <paramdef><link linkend="API-struct-dvb-device">const struct dvb_device</link> * <parameter>template</parameter></paramdef>
57695   <paramdef>void * <parameter>priv</parameter></paramdef>
57696   <paramdef>int <parameter>type</parameter></paramdef>
57697  </funcprototype></funcsynopsis>
57698</refsynopsisdiv>
57699<refsect1>
57700 <title>Arguments</title>
57701 <variablelist>
57702  <varlistentry>
57703   <term><parameter>adap</parameter></term>
57704   <listitem>
57705    <para>
57706     pointer to struct dvb_adapter
57707    </para>
57708   </listitem>
57709  </varlistentry>
57710  <varlistentry>
57711   <term><parameter>pdvbdev</parameter></term>
57712   <listitem>
57713    <para>
57714     pointer to the place where the new struct dvb_device will be
57715     stored
57716    </para>
57717   </listitem>
57718  </varlistentry>
57719  <varlistentry>
57720   <term><parameter>template</parameter></term>
57721   <listitem>
57722    <para>
57723     Template used to create <structname>pdvbdev</structname>;
57724    </para>
57725   </listitem>
57726  </varlistentry>
57727  <varlistentry>
57728   <term><parameter>priv</parameter></term>
57729   <listitem>
57730    <para>
57731     private data
57732    </para>
57733   </listitem>
57734  </varlistentry>
57735  <varlistentry>
57736   <term><parameter>type</parameter></term>
57737   <listitem>
57738    <para>
57739     type of the device: DVB_DEVICE_SEC, DVB_DEVICE_FRONTEND,
57740     DVB_DEVICE_DEMUX, DVB_DEVICE_DVR, DVB_DEVICE_CA, DVB_DEVICE_NET
57741    </para>
57742   </listitem>
57743  </varlistentry>
57744 </variablelist>
57745</refsect1>
57746</refentry>
57747
57748<refentry id="API-dvb-unregister-device">
57749<refentryinfo>
57750 <title>LINUX</title>
57751 <productname>Kernel Hackers Manual</productname>
57752 <date>July 2017</date>
57753</refentryinfo>
57754<refmeta>
57755 <refentrytitle><phrase>dvb_unregister_device</phrase></refentrytitle>
57756 <manvolnum>9</manvolnum>
57757 <refmiscinfo class="version">4.4.14</refmiscinfo>
57758</refmeta>
57759<refnamediv>
57760 <refname>dvb_unregister_device</refname>
57761 <refpurpose>
57762     Unregisters a DVB device
57763 </refpurpose>
57764</refnamediv>
57765<refsynopsisdiv>
57766 <title>Synopsis</title>
57767  <funcsynopsis><funcprototype>
57768   <funcdef>void <function>dvb_unregister_device </function></funcdef>
57769   <paramdef><link linkend="API-struct-dvb-device">struct dvb_device</link> * <parameter>dvbdev</parameter></paramdef>
57770  </funcprototype></funcsynopsis>
57771</refsynopsisdiv>
57772<refsect1>
57773 <title>Arguments</title>
57774 <variablelist>
57775  <varlistentry>
57776   <term><parameter>dvbdev</parameter></term>
57777   <listitem>
57778    <para>
57779     pointer to struct dvb_device
57780    </para>
57781   </listitem>
57782  </varlistentry>
57783 </variablelist>
57784</refsect1>
57785</refentry>
57786
57787	<sect1><title>Digital TV Demux API</title>
57788	    <para>The kernel demux API defines a driver-internal interface for
57789	    registering low-level, hardware specific driver to a hardware
57790	    independent demux layer. It is only of interest for Digital TV
57791	    device driver writers. The header file for this API is named
57792	    <constant>demux.h</constant> and located in
57793	    <constant>drivers/media/dvb-core</constant>.</para>
57794
57795	<para>The demux API should be implemented for each demux in the
57796	system. It is used to select the TS source of a demux and to manage
57797	the demux resources. When the demux client allocates a resource via
57798	the demux API, it receives a pointer to the API of that
57799	resource.</para>
57800	<para>Each demux receives its TS input from a DVB front-end or from
57801	memory, as set via this demux API. In a system with more than one
57802	front-end, the API can be used to select one of the DVB front-ends
57803	as a TS source for a demux, unless this is fixed in the HW platform.
57804	The demux API only controls front-ends regarding to their connections
57805	with demuxes; the APIs used to set the other front-end parameters,
57806	such as tuning, are not defined in this document.</para>
57807	<para>The functions that implement the abstract interface demux should
57808	be defined static or module private and registered to the Demux
57809	core for external access. It is not necessary to implement every
57810	function in the struct <constant>dmx_demux</constant>. For example,
57811	a demux interface might support Section filtering, but not PES
57812	filtering. The API client is expected to check the value of any
57813	function pointer before calling the function: the value of NULL means
57814	that the &#8220;function is not available&#8221;.</para>
57815	<para>Whenever the functions of the demux API modify shared data,
57816	the possibilities of lost update and race condition problems should
57817	be addressed, e.g. by protecting parts of code with mutexes.</para>
57818	<para>Note that functions called from a bottom half context must not
57819	sleep. Even a simple memory allocation without using GFP_ATOMIC can
57820	result in a kernel thread being put to sleep if swapping is needed.
57821	For example, the Linux kernel calls the functions of a network device
57822	interface from a bottom half context. Thus, if a demux API function
57823	is called from network device code, the function must not sleep.
57824	</para>
57825    </sect1>
57826
57827    <section id="demux_callback_api">
57828	<title>Demux Callback API</title>
57829	<para>This kernel-space API comprises the callback functions that
57830	deliver filtered data to the demux client. Unlike the other DVB
57831	kABIs, these functions are provided by the client and called from
57832	the demux code.</para>
57833	<para>The function pointers of this abstract interface are not
57834	packed into a structure as in the other demux APIs, because the
57835	callback functions are registered and used independent of each
57836	other. As an example, it is possible for the API client to provide
57837	several callback functions for receiving TS packets and no
57838	callbacks for PES packets or sections.</para>
57839	<para>The functions that implement the callback API need not be
57840	re-entrant: when a demux driver calls one of these functions,
57841	the driver is not allowed to call the function again before
57842	the original call returns. If a callback is triggered by a
57843	hardware interrupt, it is recommended to use the Linux
57844	&#8220;bottom half&#8221; mechanism or start a tasklet instead of
57845	making the callback function call directly from a hardware
57846	interrupt.</para>
57847	<para>This mechanism is implemented by
57848	<link linkend='API-dmx-ts-cb'>dmx_ts_cb()</link> and
57849	<link linkend='API-dmx-section-cb'>dmx_section_cb()</link>.</para>
57850    </section>
57851
57852<!-- drivers/media/dvb-core/demux.h -->
57853<refentry id="API-enum-ts-filter-type">
57854<refentryinfo>
57855 <title>LINUX</title>
57856 <productname>Kernel Hackers Manual</productname>
57857 <date>July 2017</date>
57858</refentryinfo>
57859<refmeta>
57860 <refentrytitle><phrase>enum ts_filter_type</phrase></refentrytitle>
57861 <manvolnum>9</manvolnum>
57862 <refmiscinfo class="version">4.4.14</refmiscinfo>
57863</refmeta>
57864<refnamediv>
57865 <refname>enum ts_filter_type</refname>
57866 <refpurpose>
57867  filter type bitmap for dmx_ts_feed.<function>set</function>
57868 </refpurpose>
57869</refnamediv>
57870<refsynopsisdiv>
57871 <title>Synopsis</title>
57872  <programlisting>
57873enum ts_filter_type {
57874  TS_PACKET,
57875  TS_PAYLOAD_ONLY,
57876  TS_DECODER,
57877  TS_DEMUX
57878};  </programlisting>
57879</refsynopsisdiv>
57880<refsect1>
57881 <title>Constants</title>
57882  <variablelist>
57883    <varlistentry>      <term>TS_PACKET</term>
57884      <listitem><para>
57885Send TS packets (188 bytes) to callback (default).
57886      </para></listitem>
57887    </varlistentry>
57888    <varlistentry>      <term>TS_PAYLOAD_ONLY</term>
57889      <listitem><para>
57890In case TS_PACKET is set, only send the TS payload
57891(&lt;=184 bytes per packet) to callback
57892      </para></listitem>
57893    </varlistentry>
57894    <varlistentry>      <term>TS_DECODER</term>
57895      <listitem><para>
57896Send stream to built-in decoder (if present).
57897      </para></listitem>
57898    </varlistentry>
57899    <varlistentry>      <term>TS_DEMUX</term>
57900      <listitem><para>
57901In case TS_PACKET is set, send the TS to the demux
57902device, not to the dvr device
57903      </para></listitem>
57904    </varlistentry>
57905  </variablelist>
57906</refsect1>
57907</refentry>
57908
57909<refentry id="API-struct-dmx-ts-feed">
57910<refentryinfo>
57911 <title>LINUX</title>
57912 <productname>Kernel Hackers Manual</productname>
57913 <date>July 2017</date>
57914</refentryinfo>
57915<refmeta>
57916 <refentrytitle><phrase>struct dmx_ts_feed</phrase></refentrytitle>
57917 <manvolnum>9</manvolnum>
57918 <refmiscinfo class="version">4.4.14</refmiscinfo>
57919</refmeta>
57920<refnamediv>
57921 <refname>struct dmx_ts_feed</refname>
57922 <refpurpose>
57923     Structure that contains a TS feed filter
57924 </refpurpose>
57925</refnamediv>
57926<refsynopsisdiv>
57927 <title>Synopsis</title>
57928  <programlisting>
57929struct dmx_ts_feed {
57930  int is_filtering;
57931  struct dmx_demux * parent;
57932  void * priv;
57933  int (* set) (struct dmx_ts_feed *feed,u16 pid,int type,enum dmx_ts_pes pes_type,size_t circular_buffer_size,struct timespec timeout);
57934  int (* start_filtering) (struct dmx_ts_feed *feed);
57935  int (* stop_filtering) (struct dmx_ts_feed *feed);
57936};  </programlisting>
57937</refsynopsisdiv>
57938 <refsect1>
57939  <title>Members</title>
57940  <variablelist>
57941    <varlistentry>      <term>is_filtering</term>
57942      <listitem><para>
57943   Set to non-zero when filtering in progress
57944      </para></listitem>
57945    </varlistentry>
57946    <varlistentry>      <term>parent</term>
57947      <listitem><para>
57948   pointer to struct dmx_demux
57949      </para></listitem>
57950    </varlistentry>
57951    <varlistentry>      <term>priv</term>
57952      <listitem><para>
57953   pointer to private data of the API client
57954      </para></listitem>
57955    </varlistentry>
57956    <varlistentry>      <term>set</term>
57957      <listitem><para>
57958   sets the TS filter
57959      </para></listitem>
57960    </varlistentry>
57961    <varlistentry>      <term>start_filtering</term>
57962      <listitem><para>
57963   starts TS filtering
57964      </para></listitem>
57965    </varlistentry>
57966    <varlistentry>      <term>stop_filtering</term>
57967      <listitem><para>
57968   stops TS filtering
57969      </para></listitem>
57970    </varlistentry>
57971  </variablelist>
57972 </refsect1>
57973<refsect1>
57974<title>Description</title>
57975<para>
57976   A TS feed is typically mapped to a hardware PID filter on the demux chip.
57977   Using this API, the client can set the filtering properties to start/stop
57978   filtering TS packets on a particular TS feed.
57979</para>
57980</refsect1>
57981</refentry>
57982
57983<refentry id="API-struct-dmx-section-filter">
57984<refentryinfo>
57985 <title>LINUX</title>
57986 <productname>Kernel Hackers Manual</productname>
57987 <date>July 2017</date>
57988</refentryinfo>
57989<refmeta>
57990 <refentrytitle><phrase>struct dmx_section_filter</phrase></refentrytitle>
57991 <manvolnum>9</manvolnum>
57992 <refmiscinfo class="version">4.4.14</refmiscinfo>
57993</refmeta>
57994<refnamediv>
57995 <refname>struct dmx_section_filter</refname>
57996 <refpurpose>
57997     Structure that describes a section filter
57998 </refpurpose>
57999</refnamediv>
58000<refsynopsisdiv>
58001 <title>Synopsis</title>
58002  <programlisting>
58003struct dmx_section_filter {
58004  u8 filter_value[DMX_MAX_FILTER_SIZE];
58005  u8 filter_mask[DMX_MAX_FILTER_SIZE];
58006  u8 filter_mode[DMX_MAX_FILTER_SIZE];
58007  struct dmx_section_feed * parent;
58008  void * priv;
58009};  </programlisting>
58010</refsynopsisdiv>
58011 <refsect1>
58012  <title>Members</title>
58013  <variablelist>
58014    <varlistentry>      <term>filter_value[DMX_MAX_FILTER_SIZE]</term>
58015      <listitem><para>
58016   Contains up to 16 bytes (128 bits) of the TS section header
58017   that will be matched by the section filter
58018      </para></listitem>
58019    </varlistentry>
58020    <varlistentry>      <term>filter_mask[DMX_MAX_FILTER_SIZE]</term>
58021      <listitem><para>
58022   Contains a 16 bytes (128 bits) filter mask with the bits
58023   specified by <parameter>filter_value</parameter> that will be used on the filter
58024   match logic.
58025      </para></listitem>
58026    </varlistentry>
58027    <varlistentry>      <term>filter_mode[DMX_MAX_FILTER_SIZE]</term>
58028      <listitem><para>
58029   Contains a 16 bytes (128 bits) filter mode.
58030      </para></listitem>
58031    </varlistentry>
58032    <varlistentry>      <term>parent</term>
58033      <listitem><para>
58034   Pointer to struct dmx_section_feed.
58035      </para></listitem>
58036    </varlistentry>
58037    <varlistentry>      <term>priv</term>
58038      <listitem><para>
58039   Pointer to private data of the API client.
58040      </para></listitem>
58041    </varlistentry>
58042  </variablelist>
58043 </refsect1>
58044<refsect1>
58045<title>Description</title>
58046<para>
58047   </para><para>
58048
58049   The <parameter>filter_mask</parameter> controls which bits of <parameter>filter_value</parameter> are compared with
58050   the section headers/payload. On a binary value of 1 in filter_mask, the
58051   corresponding bits are compared. The filter only accepts sections that are
58052   equal to filter_value in all the tested bit positions.
58053</para>
58054</refsect1>
58055</refentry>
58056
58057<refentry id="API-struct-dmx-section-feed">
58058<refentryinfo>
58059 <title>LINUX</title>
58060 <productname>Kernel Hackers Manual</productname>
58061 <date>July 2017</date>
58062</refentryinfo>
58063<refmeta>
58064 <refentrytitle><phrase>struct dmx_section_feed</phrase></refentrytitle>
58065 <manvolnum>9</manvolnum>
58066 <refmiscinfo class="version">4.4.14</refmiscinfo>
58067</refmeta>
58068<refnamediv>
58069 <refname>struct dmx_section_feed</refname>
58070 <refpurpose>
58071     Structure that contains a section feed filter
58072 </refpurpose>
58073</refnamediv>
58074<refsynopsisdiv>
58075 <title>Synopsis</title>
58076  <programlisting>
58077struct dmx_section_feed {
58078  int is_filtering;
58079  struct dmx_demux * parent;
58080  void * priv;
58081  int check_crc;
58082  int (* set) (struct dmx_section_feed *feed,u16 pid,size_t circular_buffer_size,int check_crc);
58083  int (* allocate_filter) (struct dmx_section_feed *feed,struct dmx_section_filter **filter);
58084  int (* release_filter) (struct dmx_section_feed *feed,struct dmx_section_filter *filter);
58085  int (* start_filtering) (struct dmx_section_feed *feed);
58086  int (* stop_filtering) (struct dmx_section_feed *feed);
58087};  </programlisting>
58088</refsynopsisdiv>
58089 <refsect1>
58090  <title>Members</title>
58091  <variablelist>
58092    <varlistentry>      <term>is_filtering</term>
58093      <listitem><para>
58094   Set to non-zero when filtering in progress
58095      </para></listitem>
58096    </varlistentry>
58097    <varlistentry>      <term>parent</term>
58098      <listitem><para>
58099   pointer to struct dmx_demux
58100      </para></listitem>
58101    </varlistentry>
58102    <varlistentry>      <term>priv</term>
58103      <listitem><para>
58104   pointer to private data of the API client
58105      </para></listitem>
58106    </varlistentry>
58107    <varlistentry>      <term>check_crc</term>
58108      <listitem><para>
58109   If non-zero, check the CRC values of filtered sections.
58110      </para></listitem>
58111    </varlistentry>
58112    <varlistentry>      <term>set</term>
58113      <listitem><para>
58114   sets the section filter
58115      </para></listitem>
58116    </varlistentry>
58117    <varlistentry>      <term>allocate_filter</term>
58118      <listitem><para>
58119   This function is used to allocate a section filter on
58120   the demux. It should only be called when no filtering
58121   is in progress on this section feed. If a filter cannot
58122   be allocated, the function fails with -ENOSPC.
58123      </para></listitem>
58124    </varlistentry>
58125    <varlistentry>      <term>release_filter</term>
58126      <listitem><para>
58127   This function releases all the resources of a
58128   previously allocated section filter. The function
58129   should not be called while filtering is in progress
58130   on this section feed. After calling this function,
58131   the caller should not try to dereference the filter
58132   pointer.
58133      </para></listitem>
58134    </varlistentry>
58135    <varlistentry>      <term>start_filtering</term>
58136      <listitem><para>
58137   starts section filtering
58138      </para></listitem>
58139    </varlistentry>
58140    <varlistentry>      <term>stop_filtering</term>
58141      <listitem><para>
58142   stops section filtering
58143      </para></listitem>
58144    </varlistentry>
58145  </variablelist>
58146 </refsect1>
58147<refsect1>
58148<title>Description</title>
58149<para>
58150   A TS feed is typically mapped to a hardware PID filter on the demux chip.
58151   Using this API, the client can set the filtering properties to start/stop
58152   filtering TS packets on a particular TS feed.
58153</para>
58154</refsect1>
58155</refentry>
58156
58157<refentry id="API-dmx-ts-cb">
58158<refentryinfo>
58159 <title>LINUX</title>
58160 <productname>Kernel Hackers Manual</productname>
58161 <date>July 2017</date>
58162</refentryinfo>
58163<refmeta>
58164 <refentrytitle><phrase>dmx_ts_cb</phrase></refentrytitle>
58165 <manvolnum>9</manvolnum>
58166 <refmiscinfo class="version">4.4.14</refmiscinfo>
58167</refmeta>
58168<refnamediv>
58169 <refname>dmx_ts_cb</refname>
58170 <refpurpose>
58171     DVB demux TS filter callback function prototype
58172 </refpurpose>
58173</refnamediv>
58174<refsynopsisdiv>
58175 <title>Synopsis</title>
58176  <funcsynopsis><funcprototype>
58177   <funcdef>int <function>dmx_ts_cb </function></funcdef>
58178   <paramdef>const u8 * <parameter>buffer1</parameter></paramdef>
58179   <paramdef>size_t <parameter>buffer1_length</parameter></paramdef>
58180   <paramdef>const u8 * <parameter>buffer2</parameter></paramdef>
58181   <paramdef>size_t <parameter>buffer2_length</parameter></paramdef>
58182   <paramdef><link linkend="API-struct-dmx-ts-feed">struct dmx_ts_feed</link> * <parameter>source</parameter></paramdef>
58183  </funcprototype></funcsynopsis>
58184</refsynopsisdiv>
58185<refsect1>
58186 <title>Arguments</title>
58187 <variablelist>
58188  <varlistentry>
58189   <term><parameter>buffer1</parameter></term>
58190   <listitem>
58191    <para>
58192     Pointer to the start of the filtered TS packets.
58193    </para>
58194   </listitem>
58195  </varlistentry>
58196  <varlistentry>
58197   <term><parameter>buffer1_length</parameter></term>
58198   <listitem>
58199    <para>
58200     Length of the TS data in buffer1.
58201    </para>
58202   </listitem>
58203  </varlistentry>
58204  <varlistentry>
58205   <term><parameter>buffer2</parameter></term>
58206   <listitem>
58207    <para>
58208     Pointer to the tail of the filtered TS packets, or NULL.
58209    </para>
58210   </listitem>
58211  </varlistentry>
58212  <varlistentry>
58213   <term><parameter>buffer2_length</parameter></term>
58214   <listitem>
58215    <para>
58216     Length of the TS data in buffer2.
58217    </para>
58218   </listitem>
58219  </varlistentry>
58220  <varlistentry>
58221   <term><parameter>source</parameter></term>
58222   <listitem>
58223    <para>
58224     Indicates which TS feed is the source of the callback.
58225    </para>
58226   </listitem>
58227  </varlistentry>
58228 </variablelist>
58229</refsect1>
58230<refsect1>
58231<title>Description</title>
58232<para>
58233   This function callback prototype, provided by the client of the demux API,
58234   is called from the demux code. The function is only called when filtering
58235   on ae TS feed has been enabled using the <function>start_filtering</function> function at
58236   the <structname><link linkend="API-struct-dmx-demux">dmx_demux</link></structname>.
58237   Any TS packets that match the filter settings are copied to a circular
58238   buffer. The filtered TS packets are delivered to the client using this
58239   callback function. The size of the circular buffer is controlled by the
58240   circular_buffer_size parameter of the <structname><link linkend="API-struct-dmx-ts-feed">dmx_ts_feed</link></structname>.<parameter>set</parameter> function.
58241   It is expected that the <parameter>buffer1</parameter> and <parameter>buffer2</parameter> callback parameters point to
58242   addresses within the circular buffer, but other implementations are also
58243   possible. Note that the called party should not try to free the memory
58244   the <parameter>buffer1</parameter> and <parameter>buffer2</parameter> parameters point to.
58245   </para><para>
58246
58247   When this function is called, the <parameter>buffer1</parameter> parameter typically points to
58248   the start of the first undelivered TS packet within a circular buffer.
58249   The <parameter>buffer2</parameter> buffer parameter is normally NULL, except when the received
58250   TS packets have crossed the last address of the circular buffer and
58251   ”wrapped” to the beginning of the buffer. In the latter case the <parameter>buffer1</parameter>
58252   parameter would contain an address within the circular buffer, while the
58253   <parameter>buffer2</parameter> parameter would contain the first address of the circular buffer.
58254   The number of bytes delivered with this function (i.e. <parameter>buffer1_length</parameter> +
58255   <parameter>buffer2_length</parameter>) is usually equal to the value of callback_length parameter
58256   given in the <function>set</function> function, with one exception: if a timeout occurs before
58257   receiving callback_length bytes of TS data, any undelivered packets are
58258   immediately delivered to the client by calling this function. The timeout
58259   duration is controlled by the <function>set</function> function in the TS Feed API.
58260   </para><para>
58261
58262   If a TS packet is received with errors that could not be fixed by the
58263   TS-level forward error correction (FEC), the Transport_error_indicator
58264   flag of the TS packet header should be set. The TS packet should not be
58265   discarded, as the error can possibly be corrected by a higher layer
58266   protocol. If the called party is slow in processing the callback, it
58267   is possible that the circular buffer eventually fills up. If this happens,
58268   the demux driver should discard any TS packets received while the buffer
58269   is full and return -EOVERFLOW.
58270   </para><para>
58271
58272   The type of data returned to the callback can be selected by the
58273   <structname><link linkend="API-struct-dmx-ts-feed">dmx_ts_feed</link></structname>.<parameter>set</parameter> function. The type parameter decides if the raw
58274   TS packet (TS_PACKET) or just the payload (TS_PACKET|TS_PAYLOAD_ONLY)
58275   should be returned. If additionally the TS_DECODER bit is set the stream
58276   will also be sent to the hardware MPEG decoder.
58277</para>
58278</refsect1>
58279<refsect1>
58280<title>Return</title>
58281<para>
58282   0, on success;
58283   -EOVERFLOW, on buffer overflow.
58284</para>
58285</refsect1>
58286</refentry>
58287
58288<refentry id="API-dmx-section-cb">
58289<refentryinfo>
58290 <title>LINUX</title>
58291 <productname>Kernel Hackers Manual</productname>
58292 <date>July 2017</date>
58293</refentryinfo>
58294<refmeta>
58295 <refentrytitle><phrase>dmx_section_cb</phrase></refentrytitle>
58296 <manvolnum>9</manvolnum>
58297 <refmiscinfo class="version">4.4.14</refmiscinfo>
58298</refmeta>
58299<refnamediv>
58300 <refname>dmx_section_cb</refname>
58301 <refpurpose>
58302     DVB demux TS filter callback function prototype
58303 </refpurpose>
58304</refnamediv>
58305<refsynopsisdiv>
58306 <title>Synopsis</title>
58307  <funcsynopsis><funcprototype>
58308   <funcdef>int <function>dmx_section_cb </function></funcdef>
58309   <paramdef>const u8 * <parameter>buffer1</parameter></paramdef>
58310   <paramdef>size_t <parameter>buffer1_len</parameter></paramdef>
58311   <paramdef>const u8 * <parameter>buffer2</parameter></paramdef>
58312   <paramdef>size_t <parameter>buffer2_len</parameter></paramdef>
58313   <paramdef><link linkend="API-struct-dmx-section-filter">struct dmx_section_filter</link> * <parameter>source</parameter></paramdef>
58314  </funcprototype></funcsynopsis>
58315</refsynopsisdiv>
58316<refsect1>
58317 <title>Arguments</title>
58318 <variablelist>
58319  <varlistentry>
58320   <term><parameter>buffer1</parameter></term>
58321   <listitem>
58322    <para>
58323     Pointer to the start of the filtered section, e.g.
58324     within the circular buffer of the demux driver.
58325    </para>
58326   </listitem>
58327  </varlistentry>
58328  <varlistentry>
58329   <term><parameter>buffer1_len</parameter></term>
58330   <listitem>
58331    <para>
58332     Length of the filtered section data in <parameter>buffer1</parameter>,
58333     including headers and CRC.
58334    </para>
58335   </listitem>
58336  </varlistentry>
58337  <varlistentry>
58338   <term><parameter>buffer2</parameter></term>
58339   <listitem>
58340    <para>
58341     Pointer to the tail of the filtered section data,
58342     or NULL. Useful to handle the wrapping of a
58343     circular buffer.
58344    </para>
58345   </listitem>
58346  </varlistentry>
58347  <varlistentry>
58348   <term><parameter>buffer2_len</parameter></term>
58349   <listitem>
58350    <para>
58351     Length of the filtered section data in <parameter>buffer2</parameter>,
58352     including headers and CRC.
58353    </para>
58354   </listitem>
58355  </varlistentry>
58356  <varlistentry>
58357   <term><parameter>source</parameter></term>
58358   <listitem>
58359    <para>
58360     Indicates which section feed is the source of the
58361     callback.
58362    </para>
58363   </listitem>
58364  </varlistentry>
58365 </variablelist>
58366</refsect1>
58367<refsect1>
58368<title>Description</title>
58369<para>
58370   This function callback prototype, provided by the client of the demux API,
58371   is called from the demux code. The function is only called when
58372   filtering of sections has been enabled using the function
58373   <structname><link linkend="API-struct-dmx-ts-feed">dmx_ts_feed</link></structname>.<parameter>start_filtering</parameter>. When the demux driver has received a
58374   complete section that matches at least one section filter, the client
58375   is notified via this callback function. Normally this function is called
58376   for each received section; however, it is also possible to deliver
58377   multiple sections with one callback, for example when the system load
58378   is high. If an error occurs while receiving a section, this
58379   function should be called with the corresponding error type set in the
58380   success field, whether or not there is data to deliver. The Section Feed
58381   implementation should maintain a circular buffer for received sections.
58382   However, this is not necessary if the Section Feed API is implemented as
58383   a client of the TS Feed API, because the TS Feed implementation then
58384   buffers the received data. The size of the circular buffer can be
58385   configured using the <structname><link linkend="API-struct-dmx-ts-feed">dmx_ts_feed</link></structname>.<parameter>set</parameter> function in the Section Feed API.
58386   If there is no room in the circular buffer when a new section is received,
58387   the section must be discarded. If this happens, the value of the success
58388   parameter should be DMX_OVERRUN_ERROR on the next callback.
58389</para>
58390</refsect1>
58391</refentry>
58392
58393<refentry id="API-enum-dmx-frontend-source">
58394<refentryinfo>
58395 <title>LINUX</title>
58396 <productname>Kernel Hackers Manual</productname>
58397 <date>July 2017</date>
58398</refentryinfo>
58399<refmeta>
58400 <refentrytitle><phrase>enum dmx_frontend_source</phrase></refentrytitle>
58401 <manvolnum>9</manvolnum>
58402 <refmiscinfo class="version">4.4.14</refmiscinfo>
58403</refmeta>
58404<refnamediv>
58405 <refname>enum dmx_frontend_source</refname>
58406 <refpurpose>
58407     Used to identify the type of frontend
58408 </refpurpose>
58409</refnamediv>
58410<refsynopsisdiv>
58411 <title>Synopsis</title>
58412  <programlisting>
58413enum dmx_frontend_source {
58414  DMX_MEMORY_FE,
58415  DMX_FRONTEND_0
58416};  </programlisting>
58417</refsynopsisdiv>
58418<refsect1>
58419 <title>Constants</title>
58420  <variablelist>
58421    <varlistentry>      <term>DMX_MEMORY_FE</term>
58422      <listitem><para>
58423   The source of the demux is memory. It means that
58424   the MPEG-TS to be filtered comes from userspace,
58425   via <function>write</function> syscall.
58426      </para></listitem>
58427    </varlistentry>
58428    <varlistentry>      <term>DMX_FRONTEND_0</term>
58429      <listitem><para>
58430   The source of the demux is a frontend connected
58431   to the demux.
58432      </para></listitem>
58433    </varlistentry>
58434  </variablelist>
58435</refsect1>
58436</refentry>
58437
58438<refentry id="API-struct-dmx-frontend">
58439<refentryinfo>
58440 <title>LINUX</title>
58441 <productname>Kernel Hackers Manual</productname>
58442 <date>July 2017</date>
58443</refentryinfo>
58444<refmeta>
58445 <refentrytitle><phrase>struct dmx_frontend</phrase></refentrytitle>
58446 <manvolnum>9</manvolnum>
58447 <refmiscinfo class="version">4.4.14</refmiscinfo>
58448</refmeta>
58449<refnamediv>
58450 <refname>struct dmx_frontend</refname>
58451 <refpurpose>
58452     Structure that lists the frontends associated with a demux
58453 </refpurpose>
58454</refnamediv>
58455<refsynopsisdiv>
58456 <title>Synopsis</title>
58457  <programlisting>
58458struct dmx_frontend {
58459  struct list_head connectivity_list;
58460  enum dmx_frontend_source source;
58461};  </programlisting>
58462</refsynopsisdiv>
58463 <refsect1>
58464  <title>Members</title>
58465  <variablelist>
58466    <varlistentry>      <term>connectivity_list</term>
58467      <listitem><para>
58468   List of front-ends that can be connected to a
58469   particular demux;
58470      </para></listitem>
58471    </varlistentry>
58472    <varlistentry>      <term>source</term>
58473      <listitem><para>
58474   Type of the frontend.
58475      </para></listitem>
58476    </varlistentry>
58477  </variablelist>
58478 </refsect1>
58479<refsect1>
58480<title>FIXME</title>
58481<para>
58482   this structure should likely be replaced soon by some
58483   media-controller based logic.
58484</para>
58485</refsect1>
58486</refentry>
58487
58488<refentry id="API-enum-dmx-demux-caps">
58489<refentryinfo>
58490 <title>LINUX</title>
58491 <productname>Kernel Hackers Manual</productname>
58492 <date>July 2017</date>
58493</refentryinfo>
58494<refmeta>
58495 <refentrytitle><phrase>enum dmx_demux_caps</phrase></refentrytitle>
58496 <manvolnum>9</manvolnum>
58497 <refmiscinfo class="version">4.4.14</refmiscinfo>
58498</refmeta>
58499<refnamediv>
58500 <refname>enum dmx_demux_caps</refname>
58501 <refpurpose>
58502     MPEG-2 TS Demux capabilities bitmap
58503 </refpurpose>
58504</refnamediv>
58505<refsynopsisdiv>
58506 <title>Synopsis</title>
58507  <programlisting>
58508enum dmx_demux_caps {
58509  DMX_TS_FILTERING,
58510  DMX_SECTION_FILTERING,
58511  DMX_MEMORY_BASED_FILTERING
58512};  </programlisting>
58513</refsynopsisdiv>
58514<refsect1>
58515 <title>Constants</title>
58516  <variablelist>
58517    <varlistentry>      <term>DMX_TS_FILTERING</term>
58518      <listitem><para>
58519   set if TS filtering is supported;
58520      </para></listitem>
58521    </varlistentry>
58522    <varlistentry>      <term>DMX_SECTION_FILTERING</term>
58523      <listitem><para>
58524   set if section filtering is supported;
58525      </para></listitem>
58526    </varlistentry>
58527    <varlistentry>      <term>DMX_MEMORY_BASED_FILTERING</term>
58528      <listitem><para>
58529   set if <function>write</function> available.
58530      </para></listitem>
58531    </varlistentry>
58532  </variablelist>
58533</refsect1>
58534<refsect1>
58535<title>Description</title>
58536<para>
58537   Those flags are OR'ed in the <structname><link linkend="API-struct-dmx-demux">dmx_demux</link></structname>.<structname>capabilities</structname> field
58538</para>
58539</refsect1>
58540</refentry>
58541
58542<refentry id="API-struct-dmx-demux">
58543<refentryinfo>
58544 <title>LINUX</title>
58545 <productname>Kernel Hackers Manual</productname>
58546 <date>July 2017</date>
58547</refentryinfo>
58548<refmeta>
58549 <refentrytitle><phrase>struct dmx_demux</phrase></refentrytitle>
58550 <manvolnum>9</manvolnum>
58551 <refmiscinfo class="version">4.4.14</refmiscinfo>
58552</refmeta>
58553<refnamediv>
58554 <refname>struct dmx_demux</refname>
58555 <refpurpose>
58556     Structure that contains the demux capabilities and callbacks.
58557 </refpurpose>
58558</refnamediv>
58559<refsynopsisdiv>
58560 <title>Synopsis</title>
58561  <programlisting>
58562struct dmx_demux {
58563  enum dmx_demux_caps capabilities;
58564  struct dmx_frontend * frontend;
58565  void * priv;
58566  int (* open) (struct dmx_demux *demux);
58567  int (* close) (struct dmx_demux *demux);
58568  int (* write) (struct dmx_demux *demux, const char __user *buf,size_t count);
58569  int (* allocate_ts_feed) (struct dmx_demux *demux,struct dmx_ts_feed **feed,dmx_ts_cb callback);
58570  int (* release_ts_feed) (struct dmx_demux *demux,struct dmx_ts_feed *feed);
58571  int (* allocate_section_feed) (struct dmx_demux *demux,struct dmx_section_feed **feed,dmx_section_cb callback);
58572  int (* release_section_feed) (struct dmx_demux *demux,struct dmx_section_feed *feed);
58573  int (* add_frontend) (struct dmx_demux *demux,struct dmx_frontend *frontend);
58574  int (* remove_frontend) (struct dmx_demux *demux,struct dmx_frontend *frontend);
58575  struct list_head *(* get_frontends) (struct dmx_demux *demux);
58576  int (* connect_frontend) (struct dmx_demux *demux,struct dmx_frontend *frontend);
58577  int (* disconnect_frontend) (struct dmx_demux *demux);
58578  int (* get_pes_pids) (struct dmx_demux *demux, u16 *pids);
58579};  </programlisting>
58580</refsynopsisdiv>
58581 <refsect1>
58582  <title>Members</title>
58583  <variablelist>
58584    <varlistentry>      <term>capabilities</term>
58585      <listitem><para>
58586   Bitfield of capability flags.
58587      </para></listitem>
58588    </varlistentry>
58589    <varlistentry>      <term>frontend</term>
58590      <listitem><para>
58591   Front-end connected to the demux
58592      </para></listitem>
58593    </varlistentry>
58594    <varlistentry>      <term>priv</term>
58595      <listitem><para>
58596   Pointer to private data of the API client
58597      </para></listitem>
58598    </varlistentry>
58599    <varlistentry>      <term>open</term>
58600      <listitem><para>
58601   This function reserves the demux for use by the caller and, if
58602   necessary, initializes the demux. When the demux is no longer needed,
58603   the function <parameter>close</parameter> should be called. It should be possible for
58604   multiple clients to access the demux at the same time. Thus, the
58605   function implementation should increment the demux usage count when
58606   <parameter>open</parameter> is called and decrement it when <parameter>close</parameter> is called.
58607   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58608   instance data.
58609   It returns
58610   0 on success;
58611   -EUSERS, if maximum usage count was reached;
58612   -EINVAL, on bad parameter.
58613      </para></listitem>
58614    </varlistentry>
58615    <varlistentry>      <term>close</term>
58616      <listitem><para>
58617   This function reserves the demux for use by the caller and, if
58618   necessary, initializes the demux. When the demux is no longer needed,
58619   the function <parameter>close</parameter> should be called. It should be possible for
58620   multiple clients to access the demux at the same time. Thus, the
58621   function implementation should increment the demux usage count when
58622   <parameter>open</parameter> is called and decrement it when <parameter>close</parameter> is called.
58623   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58624   instance data.
58625   It returns
58626   0 on success;
58627   -ENODEV, if demux was not in use (e. g. no users);
58628   -EINVAL, on bad parameter.
58629      </para></listitem>
58630    </varlistentry>
58631    <varlistentry>      <term>write</term>
58632      <listitem><para>
58633   This function provides the demux driver with a memory buffer
58634   containing TS packets. Instead of receiving TS packets from the DVB
58635   front-end, the demux driver software will read packets from memory.
58636   Any clients of this demux with active TS, PES or Section filters will
58637   receive filtered data via the Demux callback API (see 0). The function
58638   returns when all the data in the buffer has been consumed by the demux.
58639   Demux hardware typically cannot read TS from memory. If this is the
58640   case, memory-based filtering has to be implemented entirely in software.
58641   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58642   instance data.
58643   The <parameter>buf</parameter> function parameter contains a pointer to the TS data in
58644   kernel-space memory.
58645   The <parameter>count</parameter> function parameter contains the length of the TS data.
58646   It returns
58647   0 on success;
58648   -ERESTARTSYS, if mutex lock was interrupted;
58649   -EINTR, if a signal handling is pending;
58650   -ENODEV, if demux was removed;
58651   -EINVAL, on bad parameter.
58652      </para></listitem>
58653    </varlistentry>
58654    <varlistentry>      <term>allocate_ts_feed</term>
58655      <listitem><para>
58656   Allocates a new TS feed, which is used to filter the TS
58657   packets carrying a certain PID. The TS feed normally corresponds to a
58658   hardware PID filter on the demux chip.
58659   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58660   instance data.
58661   The <parameter>feed</parameter> function parameter contains a pointer to the TS feed API and
58662   instance data.
58663   The <parameter>callback</parameter> function parameter contains a pointer to the callback
58664   function for passing received TS packet.
58665   It returns
58666   0 on success;
58667   -ERESTARTSYS, if mutex lock was interrupted;
58668   -EBUSY, if no more TS feeds is available;
58669   -EINVAL, on bad parameter.
58670      </para></listitem>
58671    </varlistentry>
58672    <varlistentry>      <term>release_ts_feed</term>
58673      <listitem><para>
58674   Releases the resources allocated with <parameter>allocate_ts_feed</parameter>.
58675   Any filtering in progress on the TS feed should be stopped before
58676   calling this function.
58677   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58678   instance data.
58679   The <parameter>feed</parameter> function parameter contains a pointer to the TS feed API and
58680   instance data.
58681   It returns
58682   0 on success;
58683   -EINVAL on bad parameter.
58684      </para></listitem>
58685    </varlistentry>
58686    <varlistentry>      <term>allocate_section_feed</term>
58687      <listitem><para>
58688   Allocates a new section feed, i.e. a demux resource
58689   for filtering and receiving sections. On platforms with hardware
58690   support for section filtering, a section feed is directly mapped to
58691   the demux HW. On other platforms, TS packets are first PID filtered in
58692   hardware and a hardware section filter then emulated in software. The
58693   caller obtains an API pointer of type dmx_section_feed_t as an out
58694   parameter. Using this API the caller can set filtering parameters and
58695   start receiving sections.
58696   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58697   instance data.
58698   The <parameter>feed</parameter> function parameter contains a pointer to the TS feed API and
58699   instance data.
58700   The <parameter>callback</parameter> function parameter contains a pointer to the callback
58701   function for passing received TS packet.
58702   It returns
58703   0 on success;
58704   -EBUSY, if no more TS feeds is available;
58705   -EINVAL, on bad parameter.
58706      </para></listitem>
58707    </varlistentry>
58708    <varlistentry>      <term>release_section_feed</term>
58709      <listitem><para>
58710   Releases the resources allocated with
58711   <parameter>allocate_section_feed</parameter>, including allocated filters. Any filtering in
58712   progress on the section feed should be stopped before calling this
58713   function.
58714   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58715   instance data.
58716   The <parameter>feed</parameter> function parameter contains a pointer to the TS feed API and
58717   instance data.
58718   It returns
58719   0 on success;
58720   -EINVAL, on bad parameter.
58721      </para></listitem>
58722    </varlistentry>
58723    <varlistentry>      <term>add_frontend</term>
58724      <listitem><para>
58725   Registers a connectivity between a demux and a front-end,
58726   i.e., indicates that the demux can be connected via a call to
58727   <parameter>connect_frontend</parameter> to use the given front-end as a TS source. The
58728   client of this function has to allocate dynamic or static memory for
58729   the frontend structure and initialize its fields before calling this
58730   function. This function is normally called during the driver
58731   initialization. The caller must not free the memory of the frontend
58732   struct before successfully calling <parameter>remove_frontend</parameter>.
58733   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58734   instance data.
58735   The <parameter>frontend</parameter> function parameter contains a pointer to the front-end
58736   instance data.
58737   It returns
58738   0 on success;
58739   -EINVAL, on bad parameter.
58740      </para></listitem>
58741    </varlistentry>
58742    <varlistentry>      <term>remove_frontend</term>
58743      <listitem><para>
58744   Indicates that the given front-end, registered by a call
58745   to <parameter>add_frontend</parameter>, can no longer be connected as a TS source by this
58746   demux. The function should be called when a front-end driver or a demux
58747   driver is removed from the system. If the front-end is in use, the
58748   function fails with the return value of -EBUSY. After successfully
58749   calling this function, the caller can free the memory of the frontend
58750   struct if it was dynamically allocated before the <parameter>add_frontend</parameter>
58751   operation.
58752   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58753   instance data.
58754   The <parameter>frontend</parameter> function parameter contains a pointer to the front-end
58755   instance data.
58756   It returns
58757   0 on success;
58758   -ENODEV, if the front-end was not found,
58759   -EINVAL, on bad parameter.
58760      </para></listitem>
58761    </varlistentry>
58762    <varlistentry>      <term>get_frontends</term>
58763      <listitem><para>
58764   Provides the APIs of the front-ends that have been
58765   registered for this demux. Any of the front-ends obtained with this
58766   call can be used as a parameter for <parameter>connect_frontend</parameter>. The include
58767   file demux.h contains the macro <function>DMX_FE_ENTRY</function> for converting an
58768   element of the generic type struct <structname>list_head</structname> * to the type
58769   struct <structname><link linkend="API-struct-dmx-frontend">dmx_frontend</link></structname> *. The caller must not free the memory of any of
58770   the elements obtained via this function call.
58771   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58772   instance data.
58773   It returns a struct list_head pointer to the list of front-end
58774   interfaces, or NULL in the case of an empty list.
58775      </para></listitem>
58776    </varlistentry>
58777    <varlistentry>      <term>connect_frontend</term>
58778      <listitem><para>
58779   Connects the TS output of the front-end to the input of
58780   the demux. A demux can only be connected to a front-end registered to
58781   the demux with the function <parameter>add_frontend</parameter>. It may or may not be
58782   possible to connect multiple demuxes to the same front-end, depending
58783   on the capabilities of the HW platform. When not used, the front-end
58784   should be released by calling <parameter>disconnect_frontend</parameter>.
58785   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58786   instance data.
58787   The <parameter>frontend</parameter> function parameter contains a pointer to the front-end
58788   instance data.
58789   It returns
58790   0 on success;
58791   -EINVAL, on bad parameter.
58792      </para></listitem>
58793    </varlistentry>
58794    <varlistentry>      <term>disconnect_frontend</term>
58795      <listitem><para>
58796   Disconnects the demux and a front-end previously
58797   connected by a <parameter>connect_frontend</parameter> call.
58798   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58799   instance data.
58800   It returns
58801   0 on success;
58802   -EINVAL on bad parameter.
58803      </para></listitem>
58804    </varlistentry>
58805    <varlistentry>      <term>get_pes_pids</term>
58806      <listitem><para>
58807   Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0,
58808   DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0.
58809   The <parameter>demux</parameter> function parameter contains a pointer to the demux API and
58810   instance data.
58811   The <parameter>pids</parameter> function parameter contains an array with five u16 elements
58812   where the PIDs will be stored.
58813   It returns
58814   0 on success;
58815   -EINVAL on bad parameter.
58816      </para></listitem>
58817    </varlistentry>
58818  </variablelist>
58819 </refsect1>
58820</refentry>
58821
58822    </sect1>
58823    <sect1><title>Remote Controller devices</title>
58824<!-- include/media/rc-core.h -->
58825<refentry id="API-struct-rc-scancode-filter">
58826<refentryinfo>
58827 <title>LINUX</title>
58828 <productname>Kernel Hackers Manual</productname>
58829 <date>July 2017</date>
58830</refentryinfo>
58831<refmeta>
58832 <refentrytitle><phrase>struct rc_scancode_filter</phrase></refentrytitle>
58833 <manvolnum>9</manvolnum>
58834 <refmiscinfo class="version">4.4.14</refmiscinfo>
58835</refmeta>
58836<refnamediv>
58837 <refname>struct rc_scancode_filter</refname>
58838 <refpurpose>
58839  Filter scan codes.
58840 </refpurpose>
58841</refnamediv>
58842<refsynopsisdiv>
58843 <title>Synopsis</title>
58844  <programlisting>
58845struct rc_scancode_filter {
58846  u32 data;
58847  u32 mask;
58848};  </programlisting>
58849</refsynopsisdiv>
58850 <refsect1>
58851  <title>Members</title>
58852  <variablelist>
58853    <varlistentry>      <term>data</term>
58854      <listitem><para>
58855Scancode data to match.
58856      </para></listitem>
58857    </varlistentry>
58858    <varlistentry>      <term>mask</term>
58859      <listitem><para>
58860Mask of bits of scancode to compare.
58861      </para></listitem>
58862    </varlistentry>
58863  </variablelist>
58864 </refsect1>
58865</refentry>
58866
58867<refentry id="API-enum-rc-filter-type">
58868<refentryinfo>
58869 <title>LINUX</title>
58870 <productname>Kernel Hackers Manual</productname>
58871 <date>July 2017</date>
58872</refentryinfo>
58873<refmeta>
58874 <refentrytitle><phrase>enum rc_filter_type</phrase></refentrytitle>
58875 <manvolnum>9</manvolnum>
58876 <refmiscinfo class="version">4.4.14</refmiscinfo>
58877</refmeta>
58878<refnamediv>
58879 <refname>enum rc_filter_type</refname>
58880 <refpurpose>
58881     Filter type constants.
58882 </refpurpose>
58883</refnamediv>
58884<refsynopsisdiv>
58885 <title>Synopsis</title>
58886  <programlisting>
58887enum rc_filter_type {
58888  RC_FILTER_NORMAL,
58889  RC_FILTER_WAKEUP,
58890  RC_FILTER_MAX
58891};  </programlisting>
58892</refsynopsisdiv>
58893<refsect1>
58894 <title>Constants</title>
58895  <variablelist>
58896    <varlistentry>      <term>RC_FILTER_NORMAL</term>
58897      <listitem><para>
58898   Filter for normal operation.
58899      </para></listitem>
58900    </varlistentry>
58901    <varlistentry>      <term>RC_FILTER_WAKEUP</term>
58902      <listitem><para>
58903   Filter for waking from suspend.
58904      </para></listitem>
58905    </varlistentry>
58906    <varlistentry>      <term>RC_FILTER_MAX</term>
58907      <listitem><para>
58908   Number of filter types.
58909      </para></listitem>
58910    </varlistentry>
58911  </variablelist>
58912</refsect1>
58913</refentry>
58914
58915<refentry id="API-struct-rc-dev">
58916<refentryinfo>
58917 <title>LINUX</title>
58918 <productname>Kernel Hackers Manual</productname>
58919 <date>July 2017</date>
58920</refentryinfo>
58921<refmeta>
58922 <refentrytitle><phrase>struct rc_dev</phrase></refentrytitle>
58923 <manvolnum>9</manvolnum>
58924 <refmiscinfo class="version">4.4.14</refmiscinfo>
58925</refmeta>
58926<refnamediv>
58927 <refname>struct rc_dev</refname>
58928 <refpurpose>
58929     represents a remote control device
58930 </refpurpose>
58931</refnamediv>
58932<refsynopsisdiv>
58933 <title>Synopsis</title>
58934  <programlisting>
58935struct rc_dev {
58936  struct device dev;
58937  const struct attribute_group * sysfs_groups[5];
58938  const char * input_name;
58939  const char * input_phys;
58940  struct input_id input_id;
58941  char * driver_name;
58942  const char * map_name;
58943  struct rc_map rc_map;
58944  struct mutex lock;
58945  unsigned int minor;
58946  struct ir_raw_event_ctrl * raw;
58947  struct input_dev * input_dev;
58948  enum rc_driver_type driver_type;
58949  bool idle;
58950  u64 allowed_protocols;
58951  u64 enabled_protocols;
58952  u64 allowed_wakeup_protocols;
58953  u64 enabled_wakeup_protocols;
58954  struct rc_scancode_filter scancode_filter;
58955  struct rc_scancode_filter scancode_wakeup_filter;
58956  u32 scancode_mask;
58957  u32 users;
58958  void * priv;
58959  spinlock_t keylock;
58960  bool keypressed;
58961  unsigned long keyup_jiffies;
58962  struct timer_list timer_keyup;
58963  u32 last_keycode;
58964  enum rc_type last_protocol;
58965  u32 last_scancode;
58966  u8 last_toggle;
58967  u32 timeout;
58968  u32 min_timeout;
58969  u32 max_timeout;
58970  u32 rx_resolution;
58971  u32 tx_resolution;
58972  int (* change_protocol) (struct rc_dev *dev, u64 *rc_type);
58973  int (* change_wakeup_protocol) (struct rc_dev *dev, u64 *rc_type);
58974  int (* open) (struct rc_dev *dev);
58975  void (* close) (struct rc_dev *dev);
58976  int (* s_tx_mask) (struct rc_dev *dev, u32 mask);
58977  int (* s_tx_carrier) (struct rc_dev *dev, u32 carrier);
58978  int (* s_tx_duty_cycle) (struct rc_dev *dev, u32 duty_cycle);
58979  int (* s_rx_carrier_range) (struct rc_dev *dev, u32 min, u32 max);
58980  int (* tx_ir) (struct rc_dev *dev, unsigned *txbuf, unsigned n);
58981  void (* s_idle) (struct rc_dev *dev, bool enable);
58982  int (* s_learning_mode) (struct rc_dev *dev, int enable);
58983  int (* s_carrier_report) (struct rc_dev *dev, int enable);
58984  int (* s_filter) (struct rc_dev *dev,struct rc_scancode_filter *filter);
58985  int (* s_wakeup_filter) (struct rc_dev *dev,struct rc_scancode_filter *filter);
58986};  </programlisting>
58987</refsynopsisdiv>
58988 <refsect1>
58989  <title>Members</title>
58990  <variablelist>
58991    <varlistentry>      <term>dev</term>
58992      <listitem><para>
58993   driver model's view of this device
58994      </para></listitem>
58995    </varlistentry>
58996    <varlistentry>      <term>sysfs_groups[5]</term>
58997      <listitem><para>
58998   sysfs attribute groups
58999      </para></listitem>
59000    </varlistentry>
59001    <varlistentry>      <term>input_name</term>
59002      <listitem><para>
59003   name of the input child device
59004      </para></listitem>
59005    </varlistentry>
59006    <varlistentry>      <term>input_phys</term>
59007      <listitem><para>
59008   physical path to the input child device
59009      </para></listitem>
59010    </varlistentry>
59011    <varlistentry>      <term>input_id</term>
59012      <listitem><para>
59013   id of the input child device (struct input_id)
59014      </para></listitem>
59015    </varlistentry>
59016    <varlistentry>      <term>driver_name</term>
59017      <listitem><para>
59018   name of the hardware driver which registered this device
59019      </para></listitem>
59020    </varlistentry>
59021    <varlistentry>      <term>map_name</term>
59022      <listitem><para>
59023   name of the default keymap
59024      </para></listitem>
59025    </varlistentry>
59026    <varlistentry>      <term>rc_map</term>
59027      <listitem><para>
59028   current scan/key table
59029      </para></listitem>
59030    </varlistentry>
59031    <varlistentry>      <term>lock</term>
59032      <listitem><para>
59033   used to ensure we've filled in all protocol details before
59034   anyone can call show_protocols or store_protocols
59035      </para></listitem>
59036    </varlistentry>
59037    <varlistentry>      <term>minor</term>
59038      <listitem><para>
59039   unique minor remote control device number
59040      </para></listitem>
59041    </varlistentry>
59042    <varlistentry>      <term>raw</term>
59043      <listitem><para>
59044   additional data for raw pulse/space devices
59045      </para></listitem>
59046    </varlistentry>
59047    <varlistentry>      <term>input_dev</term>
59048      <listitem><para>
59049   the input child device used to communicate events to userspace
59050      </para></listitem>
59051    </varlistentry>
59052    <varlistentry>      <term>driver_type</term>
59053      <listitem><para>
59054   specifies if protocol decoding is done in hardware or software
59055      </para></listitem>
59056    </varlistentry>
59057    <varlistentry>      <term>idle</term>
59058      <listitem><para>
59059   used to keep track of RX state
59060      </para></listitem>
59061    </varlistentry>
59062    <varlistentry>      <term>allowed_protocols</term>
59063      <listitem><para>
59064   bitmask with the supported RC_BIT_* protocols
59065      </para></listitem>
59066    </varlistentry>
59067    <varlistentry>      <term>enabled_protocols</term>
59068      <listitem><para>
59069   bitmask with the enabled RC_BIT_* protocols
59070      </para></listitem>
59071    </varlistentry>
59072    <varlistentry>      <term>allowed_wakeup_protocols</term>
59073      <listitem><para>
59074   bitmask with the supported RC_BIT_* wakeup protocols
59075      </para></listitem>
59076    </varlistentry>
59077    <varlistentry>      <term>enabled_wakeup_protocols</term>
59078      <listitem><para>
59079   bitmask with the enabled RC_BIT_* wakeup protocols
59080      </para></listitem>
59081    </varlistentry>
59082    <varlistentry>      <term>scancode_filter</term>
59083      <listitem><para>
59084   scancode filter
59085      </para></listitem>
59086    </varlistentry>
59087    <varlistentry>      <term>scancode_wakeup_filter</term>
59088      <listitem><para>
59089   scancode wakeup filters
59090      </para></listitem>
59091    </varlistentry>
59092    <varlistentry>      <term>scancode_mask</term>
59093      <listitem><para>
59094   some hardware decoders are not capable of providing the full
59095   scancode to the application. As this is a hardware limit, we can't do
59096   anything with it. Yet, as the same keycode table can be used with other
59097   devices, a mask is provided to allow its usage. Drivers should generally
59098   leave this field in blank
59099      </para></listitem>
59100    </varlistentry>
59101    <varlistentry>      <term>users</term>
59102      <listitem><para>
59103   number of current users of the device
59104      </para></listitem>
59105    </varlistentry>
59106    <varlistentry>      <term>priv</term>
59107      <listitem><para>
59108   driver-specific data
59109      </para></listitem>
59110    </varlistentry>
59111    <varlistentry>      <term>keylock</term>
59112      <listitem><para>
59113   protects the remaining members of the struct
59114      </para></listitem>
59115    </varlistentry>
59116    <varlistentry>      <term>keypressed</term>
59117      <listitem><para>
59118   whether a key is currently pressed
59119      </para></listitem>
59120    </varlistentry>
59121    <varlistentry>      <term>keyup_jiffies</term>
59122      <listitem><para>
59123   time (in jiffies) when the current keypress should be released
59124      </para></listitem>
59125    </varlistentry>
59126    <varlistentry>      <term>timer_keyup</term>
59127      <listitem><para>
59128   timer for releasing a keypress
59129      </para></listitem>
59130    </varlistentry>
59131    <varlistentry>      <term>last_keycode</term>
59132      <listitem><para>
59133   keycode of last keypress
59134      </para></listitem>
59135    </varlistentry>
59136    <varlistentry>      <term>last_protocol</term>
59137      <listitem><para>
59138   protocol of last keypress
59139      </para></listitem>
59140    </varlistentry>
59141    <varlistentry>      <term>last_scancode</term>
59142      <listitem><para>
59143   scancode of last keypress
59144      </para></listitem>
59145    </varlistentry>
59146    <varlistentry>      <term>last_toggle</term>
59147      <listitem><para>
59148   toggle value of last command
59149      </para></listitem>
59150    </varlistentry>
59151    <varlistentry>      <term>timeout</term>
59152      <listitem><para>
59153   optional time after which device stops sending data
59154      </para></listitem>
59155    </varlistentry>
59156    <varlistentry>      <term>min_timeout</term>
59157      <listitem><para>
59158   minimum timeout supported by device
59159      </para></listitem>
59160    </varlistentry>
59161    <varlistentry>      <term>max_timeout</term>
59162      <listitem><para>
59163   maximum timeout supported by device
59164      </para></listitem>
59165    </varlistentry>
59166    <varlistentry>      <term>rx_resolution</term>
59167      <listitem><para>
59168   resolution (in ns) of input sampler
59169      </para></listitem>
59170    </varlistentry>
59171    <varlistentry>      <term>tx_resolution</term>
59172      <listitem><para>
59173   resolution (in ns) of output sampler
59174      </para></listitem>
59175    </varlistentry>
59176    <varlistentry>      <term>change_protocol</term>
59177      <listitem><para>
59178   allow changing the protocol used on hardware decoders
59179      </para></listitem>
59180    </varlistentry>
59181    <varlistentry>      <term>change_wakeup_protocol</term>
59182      <listitem><para>
59183   allow changing the protocol used for wakeup
59184   filtering
59185      </para></listitem>
59186    </varlistentry>
59187    <varlistentry>      <term>open</term>
59188      <listitem><para>
59189   callback to allow drivers to enable polling/irq when IR input device
59190   is opened.
59191      </para></listitem>
59192    </varlistentry>
59193    <varlistentry>      <term>close</term>
59194      <listitem><para>
59195   callback to allow drivers to disable polling/irq when IR input device
59196   is opened.
59197      </para></listitem>
59198    </varlistentry>
59199    <varlistentry>      <term>s_tx_mask</term>
59200      <listitem><para>
59201   set transmitter mask (for devices with multiple tx outputs)
59202      </para></listitem>
59203    </varlistentry>
59204    <varlistentry>      <term>s_tx_carrier</term>
59205      <listitem><para>
59206   set transmit carrier frequency
59207      </para></listitem>
59208    </varlistentry>
59209    <varlistentry>      <term>s_tx_duty_cycle</term>
59210      <listitem><para>
59211   set transmit duty cycle (0% - 100%)
59212      </para></listitem>
59213    </varlistentry>
59214    <varlistentry>      <term>s_rx_carrier_range</term>
59215      <listitem><para>
59216   inform driver about carrier it is expected to handle
59217      </para></listitem>
59218    </varlistentry>
59219    <varlistentry>      <term>tx_ir</term>
59220      <listitem><para>
59221   transmit IR
59222      </para></listitem>
59223    </varlistentry>
59224    <varlistentry>      <term>s_idle</term>
59225      <listitem><para>
59226   enable/disable hardware idle mode, upon which,
59227   device doesn't interrupt host until it sees IR pulses
59228      </para></listitem>
59229    </varlistentry>
59230    <varlistentry>      <term>s_learning_mode</term>
59231      <listitem><para>
59232   enable wide band receiver used for learning
59233      </para></listitem>
59234    </varlistentry>
59235    <varlistentry>      <term>s_carrier_report</term>
59236      <listitem><para>
59237   enable carrier reports
59238      </para></listitem>
59239    </varlistentry>
59240    <varlistentry>      <term>s_filter</term>
59241      <listitem><para>
59242   set the scancode filter
59243      </para></listitem>
59244    </varlistentry>
59245    <varlistentry>      <term>s_wakeup_filter</term>
59246      <listitem><para>
59247   set the wakeup scancode filter
59248      </para></listitem>
59249    </varlistentry>
59250  </variablelist>
59251 </refsect1>
59252</refentry>
59253
59254<!-- include/media/lirc_dev.h -->
59255<refentry id="API-struct-lirc-driver">
59256<refentryinfo>
59257 <title>LINUX</title>
59258 <productname>Kernel Hackers Manual</productname>
59259 <date>July 2017</date>
59260</refentryinfo>
59261<refmeta>
59262 <refentrytitle><phrase>struct lirc_driver</phrase></refentrytitle>
59263 <manvolnum>9</manvolnum>
59264 <refmiscinfo class="version">4.4.14</refmiscinfo>
59265</refmeta>
59266<refnamediv>
59267 <refname>struct lirc_driver</refname>
59268 <refpurpose>
59269  Defines the parameters on a LIRC driver
59270 </refpurpose>
59271</refnamediv>
59272<refsynopsisdiv>
59273 <title>Synopsis</title>
59274  <programlisting>
59275struct lirc_driver {
59276  char name[40];
59277  int minor;
59278  __u32 code_length;
59279  unsigned int buffer_size;
59280  int sample_rate;
59281  __u32 features;
59282  unsigned int chunk_size;
59283  void * data;
59284  int min_timeout;
59285  int max_timeout;
59286  int (* add_to_buf) (void *data, struct lirc_buffer *buf);
59287  struct lirc_buffer * rbuf;
59288  int (* set_use_inc) (void *data);
59289  void (* set_use_dec) (void *data);
59290  struct rc_dev * rdev;
59291  const struct file_operations * fops;
59292  struct device * dev;
59293  struct module * owner;
59294};  </programlisting>
59295</refsynopsisdiv>
59296 <refsect1>
59297  <title>Members</title>
59298  <variablelist>
59299    <varlistentry>      <term>name[40]</term>
59300      <listitem><para>
59301this string will be used for logs
59302      </para></listitem>
59303    </varlistentry>
59304    <varlistentry>      <term>minor</term>
59305      <listitem><para>
59306indicates minor device (/dev/lirc) number for
59307registered driver if caller fills it with negative
59308value, then the first free minor number will be used
59309(if available).
59310      </para></listitem>
59311    </varlistentry>
59312    <varlistentry>      <term>code_length</term>
59313      <listitem><para>
59314length of the remote control key code expressed in bits.
59315      </para></listitem>
59316    </varlistentry>
59317    <varlistentry>      <term>buffer_size</term>
59318      <listitem><para>
59319Number of FIFO buffers with <parameter>chunk_size</parameter> size. If zero,
59320creates a buffer with BUFLEN size (16 bytes).
59321      </para></listitem>
59322    </varlistentry>
59323    <varlistentry>      <term>sample_rate</term>
59324      <listitem><para>
59325if zero, the device will wait for an event with a new
59326code to be parsed. Otherwise, specifies the sample
59327rate for polling. Value should be between 0
59328and HZ. If equal to HZ, it would mean one polling per
59329second.
59330      </para></listitem>
59331    </varlistentry>
59332    <varlistentry>      <term>features</term>
59333      <listitem><para>
59334lirc compatible hardware features, like LIRC_MODE_RAW,
59335LIRC_CAN_*, as defined at include/media/lirc.h.
59336      </para></listitem>
59337    </varlistentry>
59338    <varlistentry>      <term>chunk_size</term>
59339      <listitem><para>
59340Size of each FIFO buffer.
59341      </para></listitem>
59342    </varlistentry>
59343    <varlistentry>      <term>data</term>
59344      <listitem><para>
59345it may point to any driver data and this pointer will
59346be passed to all callback functions.
59347      </para></listitem>
59348    </varlistentry>
59349    <varlistentry>      <term>min_timeout</term>
59350      <listitem><para>
59351Minimum timeout for record. Valid only if
59352LIRC_CAN_SET_REC_TIMEOUT is defined.
59353      </para></listitem>
59354    </varlistentry>
59355    <varlistentry>      <term>max_timeout</term>
59356      <listitem><para>
59357Maximum timeout for record. Valid only if
59358LIRC_CAN_SET_REC_TIMEOUT is defined.
59359      </para></listitem>
59360    </varlistentry>
59361    <varlistentry>      <term>add_to_buf</term>
59362      <listitem><para>
59363add_to_buf will be called after specified period of the
59364time or triggered by the external event, this behavior
59365depends on value of the sample_rate this function will
59366be called in user context. This routine should return
593670 if data was added to the buffer and -ENODATA if none
59368was available. This should add some number of bits
59369evenly divisible by code_length to the buffer.
59370      </para></listitem>
59371    </varlistentry>
59372    <varlistentry>      <term>rbuf</term>
59373      <listitem><para>
59374if not NULL, it will be used as a read buffer, you will
59375have to write to the buffer by other means, like irq's
59376(see also lirc_serial.c).
59377      </para></listitem>
59378    </varlistentry>
59379    <varlistentry>      <term>set_use_inc</term>
59380      <listitem><para>
59381set_use_inc will be called after device is opened
59382      </para></listitem>
59383    </varlistentry>
59384    <varlistentry>      <term>set_use_dec</term>
59385      <listitem><para>
59386set_use_dec will be called after device is closed
59387      </para></listitem>
59388    </varlistentry>
59389    <varlistentry>      <term>rdev</term>
59390      <listitem><para>
59391Pointed to struct rc_dev associated with the LIRC
59392device.
59393      </para></listitem>
59394    </varlistentry>
59395    <varlistentry>      <term>fops</term>
59396      <listitem><para>
59397file_operations for drivers which don't fit the current
59398driver model.
59399Some ioctl's can be directly handled by lirc_dev if the
59400driver's ioctl function is NULL or if it returns
59401-ENOIOCTLCMD (see also lirc_serial.c).
59402      </para></listitem>
59403    </varlistentry>
59404    <varlistentry>      <term>dev</term>
59405      <listitem><para>
59406pointer to the struct device associated with the LIRC
59407device.
59408      </para></listitem>
59409    </varlistentry>
59410    <varlistentry>      <term>owner</term>
59411      <listitem><para>
59412the module owning this struct
59413      </para></listitem>
59414    </varlistentry>
59415  </variablelist>
59416 </refsect1>
59417</refentry>
59418
59419    </sect1>
59420    <sect1><title>Media Controller devices</title>
59421<!-- include/media/media-device.h -->
59422<refentry id="API-struct-media-device">
59423<refentryinfo>
59424 <title>LINUX</title>
59425 <productname>Kernel Hackers Manual</productname>
59426 <date>July 2017</date>
59427</refentryinfo>
59428<refmeta>
59429 <refentrytitle><phrase>struct media_device</phrase></refentrytitle>
59430 <manvolnum>9</manvolnum>
59431 <refmiscinfo class="version">4.4.14</refmiscinfo>
59432</refmeta>
59433<refnamediv>
59434 <refname>struct media_device</refname>
59435 <refpurpose>
59436  Media device
59437 </refpurpose>
59438</refnamediv>
59439<refsynopsisdiv>
59440 <title>Synopsis</title>
59441  <programlisting>
59442struct media_device {
59443  struct device * dev;
59444  struct media_devnode devnode;
59445  char model[32];
59446  char serial[40];
59447  char bus_info[32];
59448  u32 hw_revision;
59449  u32 driver_version;
59450  u32 entity_id;
59451  struct list_head entities;
59452  spinlock_t lock;
59453  struct mutex graph_mutex;
59454  int (* link_notify) (struct media_link *link, u32 flags,unsigned int notification);
59455};  </programlisting>
59456</refsynopsisdiv>
59457 <refsect1>
59458  <title>Members</title>
59459  <variablelist>
59460    <varlistentry>      <term>dev</term>
59461      <listitem><para>
59462Parent device
59463      </para></listitem>
59464    </varlistentry>
59465    <varlistentry>      <term>devnode</term>
59466      <listitem><para>
59467Media device node
59468      </para></listitem>
59469    </varlistentry>
59470    <varlistentry>      <term>model[32]</term>
59471      <listitem><para>
59472Device model name
59473      </para></listitem>
59474    </varlistentry>
59475    <varlistentry>      <term>serial[40]</term>
59476      <listitem><para>
59477Device serial number (optional)
59478      </para></listitem>
59479    </varlistentry>
59480    <varlistentry>      <term>bus_info[32]</term>
59481      <listitem><para>
59482Unique and stable device location identifier
59483      </para></listitem>
59484    </varlistentry>
59485    <varlistentry>      <term>hw_revision</term>
59486      <listitem><para>
59487Hardware device revision
59488      </para></listitem>
59489    </varlistentry>
59490    <varlistentry>      <term>driver_version</term>
59491      <listitem><para>
59492Device driver version
59493      </para></listitem>
59494    </varlistentry>
59495    <varlistentry>      <term>entity_id</term>
59496      <listitem><para>
59497ID of the next entity to be registered
59498      </para></listitem>
59499    </varlistentry>
59500    <varlistentry>      <term>entities</term>
59501      <listitem><para>
59502List of registered entities
59503      </para></listitem>
59504    </varlistentry>
59505    <varlistentry>      <term>lock</term>
59506      <listitem><para>
59507Entities list lock
59508      </para></listitem>
59509    </varlistentry>
59510    <varlistentry>      <term>graph_mutex</term>
59511      <listitem><para>
59512Entities graph operation lock
59513      </para></listitem>
59514    </varlistentry>
59515    <varlistentry>      <term>link_notify</term>
59516      <listitem><para>
59517Link state change notification callback
59518      </para></listitem>
59519    </varlistentry>
59520  </variablelist>
59521 </refsect1>
59522<refsect1>
59523<title>Description</title>
59524<para>
59525   This structure represents an abstract high-level media device. It allows easy
59526   access to entities and provides basic media device-level support. The
59527   structure can be allocated directly or embedded in a larger structure.
59528   </para><para>
59529
59530   The parent <parameter>dev</parameter> is a physical device. It must be set before registering the
59531   media device.
59532   </para><para>
59533
59534   <parameter>model</parameter> is a descriptive model name exported through sysfs. It doesn't have to
59535   be unique.
59536</para>
59537</refsect1>
59538</refentry>
59539
59540<!-- include/media/media-devnode.h -->
59541<refentry id="API-struct-media-devnode">
59542<refentryinfo>
59543 <title>LINUX</title>
59544 <productname>Kernel Hackers Manual</productname>
59545 <date>July 2017</date>
59546</refentryinfo>
59547<refmeta>
59548 <refentrytitle><phrase>struct media_devnode</phrase></refentrytitle>
59549 <manvolnum>9</manvolnum>
59550 <refmiscinfo class="version">4.4.14</refmiscinfo>
59551</refmeta>
59552<refnamediv>
59553 <refname>struct media_devnode</refname>
59554 <refpurpose>
59555  Media device node
59556 </refpurpose>
59557</refnamediv>
59558<refsynopsisdiv>
59559 <title>Synopsis</title>
59560  <programlisting>
59561struct media_devnode {
59562  const struct media_file_operations * fops;
59563  struct device dev;
59564  struct cdev cdev;
59565  struct device * parent;
59566  int minor;
59567  unsigned long flags;
59568  void (* release) (struct media_devnode *mdev);
59569};  </programlisting>
59570</refsynopsisdiv>
59571 <refsect1>
59572  <title>Members</title>
59573  <variablelist>
59574    <varlistentry>      <term>fops</term>
59575      <listitem><para>
59576pointer to struct media_file_operations with media device ops
59577      </para></listitem>
59578    </varlistentry>
59579    <varlistentry>      <term>dev</term>
59580      <listitem><para>
59581struct device pointer for the media controller device
59582      </para></listitem>
59583    </varlistentry>
59584    <varlistentry>      <term>cdev</term>
59585      <listitem><para>
59586struct cdev pointer character device
59587      </para></listitem>
59588    </varlistentry>
59589    <varlistentry>      <term>parent</term>
59590      <listitem><para>
59591parent device
59592      </para></listitem>
59593    </varlistentry>
59594    <varlistentry>      <term>minor</term>
59595      <listitem><para>
59596device node minor number
59597      </para></listitem>
59598    </varlistentry>
59599    <varlistentry>      <term>flags</term>
59600      <listitem><para>
59601flags, combination of the MEDIA_FLAG_* constants
59602      </para></listitem>
59603    </varlistentry>
59604    <varlistentry>      <term>release</term>
59605      <listitem><para>
59606release callback called at the end of <function>media_devnode_release</function>
59607      </para></listitem>
59608    </varlistentry>
59609  </variablelist>
59610 </refsect1>
59611<refsect1>
59612<title>Description</title>
59613<para>
59614   This structure represents a media-related device node.
59615   </para><para>
59616
59617   The <parameter>parent</parameter> is a physical device. It must be set by core or device drivers
59618   before registering the node.
59619</para>
59620</refsect1>
59621</refentry>
59622
59623<!-- include/media/media-entity.h -->
59624<refentry id="API-struct-media-entity-operations">
59625<refentryinfo>
59626 <title>LINUX</title>
59627 <productname>Kernel Hackers Manual</productname>
59628 <date>July 2017</date>
59629</refentryinfo>
59630<refmeta>
59631 <refentrytitle><phrase>struct media_entity_operations</phrase></refentrytitle>
59632 <manvolnum>9</manvolnum>
59633 <refmiscinfo class="version">4.4.14</refmiscinfo>
59634</refmeta>
59635<refnamediv>
59636 <refname>struct media_entity_operations</refname>
59637 <refpurpose>
59638  Media entity operations
59639 </refpurpose>
59640</refnamediv>
59641<refsynopsisdiv>
59642 <title>Synopsis</title>
59643  <programlisting>
59644struct media_entity_operations {
59645  int (* link_setup) (struct media_entity *entity,const struct media_pad *local,const struct media_pad *remote, u32 flags);
59646  int (* link_validate) (struct media_link *link);
59647};  </programlisting>
59648</refsynopsisdiv>
59649 <refsect1>
59650  <title>Members</title>
59651  <variablelist>
59652    <varlistentry>      <term>link_setup</term>
59653      <listitem><para>
59654Notify the entity of link changes. The operation can
59655return an error, in which case link setup will be
59656cancelled. Optional.
59657      </para></listitem>
59658    </varlistentry>
59659    <varlistentry>      <term>link_validate</term>
59660      <listitem><para>
59661Return whether a link is valid from the entity point of
59662view. The <function>media_entity_pipeline_start</function> function
59663validates all links by calling this operation. Optional.
59664      </para></listitem>
59665    </varlistentry>
59666  </variablelist>
59667 </refsect1>
59668</refentry>
59669
59670    </sect1>
59671
59672  </chapter>
59673
59674  <chapter id="uart16x50">
59675     <title>16x50 UART Driver</title>
59676<!-- drivers/tty/serial/serial_core.c -->
59677<refentry id="API-uart-update-timeout">
59678<refentryinfo>
59679 <title>LINUX</title>
59680 <productname>Kernel Hackers Manual</productname>
59681 <date>July 2017</date>
59682</refentryinfo>
59683<refmeta>
59684 <refentrytitle><phrase>uart_update_timeout</phrase></refentrytitle>
59685 <manvolnum>9</manvolnum>
59686 <refmiscinfo class="version">4.4.14</refmiscinfo>
59687</refmeta>
59688<refnamediv>
59689 <refname>uart_update_timeout</refname>
59690 <refpurpose>
59691  update per-port FIFO timeout.
59692 </refpurpose>
59693</refnamediv>
59694<refsynopsisdiv>
59695 <title>Synopsis</title>
59696  <funcsynopsis><funcprototype>
59697   <funcdef>void <function>uart_update_timeout </function></funcdef>
59698   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
59699   <paramdef>unsigned int <parameter>cflag</parameter></paramdef>
59700   <paramdef>unsigned int <parameter>baud</parameter></paramdef>
59701  </funcprototype></funcsynopsis>
59702</refsynopsisdiv>
59703<refsect1>
59704 <title>Arguments</title>
59705 <variablelist>
59706  <varlistentry>
59707   <term><parameter>port</parameter></term>
59708   <listitem>
59709    <para>
59710     uart_port structure describing the port
59711    </para>
59712   </listitem>
59713  </varlistentry>
59714  <varlistentry>
59715   <term><parameter>cflag</parameter></term>
59716   <listitem>
59717    <para>
59718     termios cflag value
59719    </para>
59720   </listitem>
59721  </varlistentry>
59722  <varlistentry>
59723   <term><parameter>baud</parameter></term>
59724   <listitem>
59725    <para>
59726     speed of the port
59727    </para>
59728   </listitem>
59729  </varlistentry>
59730 </variablelist>
59731</refsect1>
59732<refsect1>
59733<title>Description</title>
59734<para>
59735   Set the port FIFO timeout value.  The <parameter>cflag</parameter> value should
59736   reflect the actual hardware settings.
59737</para>
59738</refsect1>
59739</refentry>
59740
59741<refentry id="API-uart-get-baud-rate">
59742<refentryinfo>
59743 <title>LINUX</title>
59744 <productname>Kernel Hackers Manual</productname>
59745 <date>July 2017</date>
59746</refentryinfo>
59747<refmeta>
59748 <refentrytitle><phrase>uart_get_baud_rate</phrase></refentrytitle>
59749 <manvolnum>9</manvolnum>
59750 <refmiscinfo class="version">4.4.14</refmiscinfo>
59751</refmeta>
59752<refnamediv>
59753 <refname>uart_get_baud_rate</refname>
59754 <refpurpose>
59755     return baud rate for a particular port
59756 </refpurpose>
59757</refnamediv>
59758<refsynopsisdiv>
59759 <title>Synopsis</title>
59760  <funcsynopsis><funcprototype>
59761   <funcdef>unsigned int <function>uart_get_baud_rate </function></funcdef>
59762   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
59763   <paramdef>struct ktermios * <parameter>termios</parameter></paramdef>
59764   <paramdef>struct ktermios * <parameter>old</parameter></paramdef>
59765   <paramdef>unsigned int <parameter>min</parameter></paramdef>
59766   <paramdef>unsigned int <parameter>max</parameter></paramdef>
59767  </funcprototype></funcsynopsis>
59768</refsynopsisdiv>
59769<refsect1>
59770 <title>Arguments</title>
59771 <variablelist>
59772  <varlistentry>
59773   <term><parameter>port</parameter></term>
59774   <listitem>
59775    <para>
59776     uart_port structure describing the port in question.
59777    </para>
59778   </listitem>
59779  </varlistentry>
59780  <varlistentry>
59781   <term><parameter>termios</parameter></term>
59782   <listitem>
59783    <para>
59784     desired termios settings.
59785    </para>
59786   </listitem>
59787  </varlistentry>
59788  <varlistentry>
59789   <term><parameter>old</parameter></term>
59790   <listitem>
59791    <para>
59792     old termios (or NULL)
59793    </para>
59794   </listitem>
59795  </varlistentry>
59796  <varlistentry>
59797   <term><parameter>min</parameter></term>
59798   <listitem>
59799    <para>
59800     minimum acceptable baud rate
59801    </para>
59802   </listitem>
59803  </varlistentry>
59804  <varlistentry>
59805   <term><parameter>max</parameter></term>
59806   <listitem>
59807    <para>
59808     maximum acceptable baud rate
59809    </para>
59810   </listitem>
59811  </varlistentry>
59812 </variablelist>
59813</refsect1>
59814<refsect1>
59815<title>Description</title>
59816<para>
59817   Decode the termios structure into a numeric baud rate,
59818   taking account of the magic 38400 baud rate (with spd_*
59819   flags), and mapping the <constant>B0</constant> rate to 9600 baud.
59820   </para><para>
59821
59822   If the new baud rate is invalid, try the old termios setting.
59823   If it's still invalid, we try 9600 baud.
59824   </para><para>
59825
59826   Update the <parameter>termios</parameter> structure to reflect the baud rate
59827   we're actually going to be using. Don't do this for the case
59828   where B0 is requested (<quote>hang up</quote>).
59829</para>
59830</refsect1>
59831</refentry>
59832
59833<refentry id="API-uart-get-divisor">
59834<refentryinfo>
59835 <title>LINUX</title>
59836 <productname>Kernel Hackers Manual</productname>
59837 <date>July 2017</date>
59838</refentryinfo>
59839<refmeta>
59840 <refentrytitle><phrase>uart_get_divisor</phrase></refentrytitle>
59841 <manvolnum>9</manvolnum>
59842 <refmiscinfo class="version">4.4.14</refmiscinfo>
59843</refmeta>
59844<refnamediv>
59845 <refname>uart_get_divisor</refname>
59846 <refpurpose>
59847     return uart clock divisor
59848 </refpurpose>
59849</refnamediv>
59850<refsynopsisdiv>
59851 <title>Synopsis</title>
59852  <funcsynopsis><funcprototype>
59853   <funcdef>unsigned int <function>uart_get_divisor </function></funcdef>
59854   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
59855   <paramdef>unsigned int <parameter>baud</parameter></paramdef>
59856  </funcprototype></funcsynopsis>
59857</refsynopsisdiv>
59858<refsect1>
59859 <title>Arguments</title>
59860 <variablelist>
59861  <varlistentry>
59862   <term><parameter>port</parameter></term>
59863   <listitem>
59864    <para>
59865     uart_port structure describing the port.
59866    </para>
59867   </listitem>
59868  </varlistentry>
59869  <varlistentry>
59870   <term><parameter>baud</parameter></term>
59871   <listitem>
59872    <para>
59873     desired baud rate
59874    </para>
59875   </listitem>
59876  </varlistentry>
59877 </variablelist>
59878</refsect1>
59879<refsect1>
59880<title>Description</title>
59881<para>
59882   Calculate the uart clock divisor for the port.
59883</para>
59884</refsect1>
59885</refentry>
59886
59887<refentry id="API-uart-console-write">
59888<refentryinfo>
59889 <title>LINUX</title>
59890 <productname>Kernel Hackers Manual</productname>
59891 <date>July 2017</date>
59892</refentryinfo>
59893<refmeta>
59894 <refentrytitle><phrase>uart_console_write</phrase></refentrytitle>
59895 <manvolnum>9</manvolnum>
59896 <refmiscinfo class="version">4.4.14</refmiscinfo>
59897</refmeta>
59898<refnamediv>
59899 <refname>uart_console_write</refname>
59900 <refpurpose>
59901     write a console message to a serial port
59902 </refpurpose>
59903</refnamediv>
59904<refsynopsisdiv>
59905 <title>Synopsis</title>
59906  <funcsynopsis><funcprototype>
59907   <funcdef>void <function>uart_console_write </function></funcdef>
59908   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
59909   <paramdef>const char * <parameter>s</parameter></paramdef>
59910   <paramdef>unsigned int <parameter>count</parameter></paramdef>
59911   <paramdef>void (*<parameter>putchar</parameter>)
59912     <funcparams>struct uart_port *, int</funcparams></paramdef>
59913  </funcprototype></funcsynopsis>
59914</refsynopsisdiv>
59915<refsect1>
59916 <title>Arguments</title>
59917 <variablelist>
59918  <varlistentry>
59919   <term><parameter>port</parameter></term>
59920   <listitem>
59921    <para>
59922     the port to write the message
59923    </para>
59924   </listitem>
59925  </varlistentry>
59926  <varlistentry>
59927   <term><parameter>s</parameter></term>
59928   <listitem>
59929    <para>
59930     array of characters
59931    </para>
59932   </listitem>
59933  </varlistentry>
59934  <varlistentry>
59935   <term><parameter>count</parameter></term>
59936   <listitem>
59937    <para>
59938     number of characters in string to write
59939    </para>
59940   </listitem>
59941  </varlistentry>
59942  <varlistentry>
59943   <term><parameter>putchar</parameter></term>
59944   <listitem>
59945    <para>
59946     function to write character to port
59947    </para>
59948   </listitem>
59949  </varlistentry>
59950 </variablelist>
59951</refsect1>
59952</refentry>
59953
59954<refentry id="API-uart-parse-earlycon">
59955<refentryinfo>
59956 <title>LINUX</title>
59957 <productname>Kernel Hackers Manual</productname>
59958 <date>July 2017</date>
59959</refentryinfo>
59960<refmeta>
59961 <refentrytitle><phrase>uart_parse_earlycon</phrase></refentrytitle>
59962 <manvolnum>9</manvolnum>
59963 <refmiscinfo class="version">4.4.14</refmiscinfo>
59964</refmeta>
59965<refnamediv>
59966 <refname>uart_parse_earlycon</refname>
59967 <refpurpose>
59968     Parse earlycon options
59969 </refpurpose>
59970</refnamediv>
59971<refsynopsisdiv>
59972 <title>Synopsis</title>
59973  <funcsynopsis><funcprototype>
59974   <funcdef>int <function>uart_parse_earlycon </function></funcdef>
59975   <paramdef>char * <parameter>p</parameter></paramdef>
59976   <paramdef>unsigned char * <parameter>iotype</parameter></paramdef>
59977   <paramdef>unsigned long * <parameter>addr</parameter></paramdef>
59978   <paramdef>char ** <parameter>options</parameter></paramdef>
59979  </funcprototype></funcsynopsis>
59980</refsynopsisdiv>
59981<refsect1>
59982 <title>Arguments</title>
59983 <variablelist>
59984  <varlistentry>
59985   <term><parameter>p</parameter></term>
59986   <listitem>
59987    <para>
59988     ptr to 2nd field (ie., just beyond '&lt;name&gt;,')
59989    </para>
59990   </listitem>
59991  </varlistentry>
59992  <varlistentry>
59993   <term><parameter>iotype</parameter></term>
59994   <listitem>
59995    <para>
59996     ptr for decoded iotype (out)
59997    </para>
59998   </listitem>
59999  </varlistentry>
60000  <varlistentry>
60001   <term><parameter>addr</parameter></term>
60002   <listitem>
60003    <para>
60004     ptr for decoded mapbase/iobase (out)
60005    </para>
60006   </listitem>
60007  </varlistentry>
60008  <varlistentry>
60009   <term><parameter>options</parameter></term>
60010   <listitem>
60011    <para>
60012     ptr for &lt;options&gt; field; NULL if not present (out)
60013    </para>
60014   </listitem>
60015  </varlistentry>
60016 </variablelist>
60017</refsect1>
60018<refsect1>
60019<title>Description</title>
60020<para>
60021   Decodes earlycon kernel command line parameters of the form
60022   earlycon=&lt;name&gt;,io|mmio|mmio32|mmio32be|mmio32native,&lt;addr&gt;,&lt;options&gt;
60023   console=&lt;name&gt;,io|mmio|mmio32|mmio32be|mmio32native,&lt;addr&gt;,&lt;options&gt;
60024   </para><para>
60025
60026   The optional form
60027   earlycon=&lt;name&gt;,0x&lt;addr&gt;,&lt;options&gt;
60028   console=&lt;name&gt;,0x&lt;addr&gt;,&lt;options&gt;
60029   is also accepted; the returned <parameter>iotype</parameter> will be UPIO_MEM.
60030   </para><para>
60031
60032   Returns 0 on success or -EINVAL on failure
60033</para>
60034</refsect1>
60035</refentry>
60036
60037<refentry id="API-uart-parse-options">
60038<refentryinfo>
60039 <title>LINUX</title>
60040 <productname>Kernel Hackers Manual</productname>
60041 <date>July 2017</date>
60042</refentryinfo>
60043<refmeta>
60044 <refentrytitle><phrase>uart_parse_options</phrase></refentrytitle>
60045 <manvolnum>9</manvolnum>
60046 <refmiscinfo class="version">4.4.14</refmiscinfo>
60047</refmeta>
60048<refnamediv>
60049 <refname>uart_parse_options</refname>
60050 <refpurpose>
60051     Parse serial port baud/parity/bits/flow control.
60052 </refpurpose>
60053</refnamediv>
60054<refsynopsisdiv>
60055 <title>Synopsis</title>
60056  <funcsynopsis><funcprototype>
60057   <funcdef>void <function>uart_parse_options </function></funcdef>
60058   <paramdef>char * <parameter>options</parameter></paramdef>
60059   <paramdef>int * <parameter>baud</parameter></paramdef>
60060   <paramdef>int * <parameter>parity</parameter></paramdef>
60061   <paramdef>int * <parameter>bits</parameter></paramdef>
60062   <paramdef>int * <parameter>flow</parameter></paramdef>
60063  </funcprototype></funcsynopsis>
60064</refsynopsisdiv>
60065<refsect1>
60066 <title>Arguments</title>
60067 <variablelist>
60068  <varlistentry>
60069   <term><parameter>options</parameter></term>
60070   <listitem>
60071    <para>
60072     pointer to option string
60073    </para>
60074   </listitem>
60075  </varlistentry>
60076  <varlistentry>
60077   <term><parameter>baud</parameter></term>
60078   <listitem>
60079    <para>
60080     pointer to an 'int' variable for the baud rate.
60081    </para>
60082   </listitem>
60083  </varlistentry>
60084  <varlistentry>
60085   <term><parameter>parity</parameter></term>
60086   <listitem>
60087    <para>
60088     pointer to an 'int' variable for the parity.
60089    </para>
60090   </listitem>
60091  </varlistentry>
60092  <varlistentry>
60093   <term><parameter>bits</parameter></term>
60094   <listitem>
60095    <para>
60096     pointer to an 'int' variable for the number of data bits.
60097    </para>
60098   </listitem>
60099  </varlistentry>
60100  <varlistentry>
60101   <term><parameter>flow</parameter></term>
60102   <listitem>
60103    <para>
60104     pointer to an 'int' variable for the flow control character.
60105    </para>
60106   </listitem>
60107  </varlistentry>
60108 </variablelist>
60109</refsect1>
60110<refsect1>
60111<title>Description</title>
60112<para>
60113   uart_parse_options decodes a string containing the serial console
60114   options.  The format of the string is &lt;baud&gt;&lt;parity&gt;&lt;bits&gt;&lt;flow&gt;,
60115</para>
60116</refsect1>
60117<refsect1>
60118<title>eg</title>
60119<para>
60120   115200n8r
60121</para>
60122</refsect1>
60123</refentry>
60124
60125<refentry id="API-uart-set-options">
60126<refentryinfo>
60127 <title>LINUX</title>
60128 <productname>Kernel Hackers Manual</productname>
60129 <date>July 2017</date>
60130</refentryinfo>
60131<refmeta>
60132 <refentrytitle><phrase>uart_set_options</phrase></refentrytitle>
60133 <manvolnum>9</manvolnum>
60134 <refmiscinfo class="version">4.4.14</refmiscinfo>
60135</refmeta>
60136<refnamediv>
60137 <refname>uart_set_options</refname>
60138 <refpurpose>
60139     setup the serial console parameters
60140 </refpurpose>
60141</refnamediv>
60142<refsynopsisdiv>
60143 <title>Synopsis</title>
60144  <funcsynopsis><funcprototype>
60145   <funcdef>int <function>uart_set_options </function></funcdef>
60146   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
60147   <paramdef>struct console * <parameter>co</parameter></paramdef>
60148   <paramdef>int <parameter>baud</parameter></paramdef>
60149   <paramdef>int <parameter>parity</parameter></paramdef>
60150   <paramdef>int <parameter>bits</parameter></paramdef>
60151   <paramdef>int <parameter>flow</parameter></paramdef>
60152  </funcprototype></funcsynopsis>
60153</refsynopsisdiv>
60154<refsect1>
60155 <title>Arguments</title>
60156 <variablelist>
60157  <varlistentry>
60158   <term><parameter>port</parameter></term>
60159   <listitem>
60160    <para>
60161     pointer to the serial ports uart_port structure
60162    </para>
60163   </listitem>
60164  </varlistentry>
60165  <varlistentry>
60166   <term><parameter>co</parameter></term>
60167   <listitem>
60168    <para>
60169     console pointer
60170    </para>
60171   </listitem>
60172  </varlistentry>
60173  <varlistentry>
60174   <term><parameter>baud</parameter></term>
60175   <listitem>
60176    <para>
60177     baud rate
60178    </para>
60179   </listitem>
60180  </varlistentry>
60181  <varlistentry>
60182   <term><parameter>parity</parameter></term>
60183   <listitem>
60184    <para>
60185     parity character - 'n' (none), 'o' (odd), 'e' (even)
60186    </para>
60187   </listitem>
60188  </varlistentry>
60189  <varlistentry>
60190   <term><parameter>bits</parameter></term>
60191   <listitem>
60192    <para>
60193     number of data bits
60194    </para>
60195   </listitem>
60196  </varlistentry>
60197  <varlistentry>
60198   <term><parameter>flow</parameter></term>
60199   <listitem>
60200    <para>
60201     flow control character - 'r' (rts)
60202    </para>
60203   </listitem>
60204  </varlistentry>
60205 </variablelist>
60206</refsect1>
60207</refentry>
60208
60209<refentry id="API-uart-register-driver">
60210<refentryinfo>
60211 <title>LINUX</title>
60212 <productname>Kernel Hackers Manual</productname>
60213 <date>July 2017</date>
60214</refentryinfo>
60215<refmeta>
60216 <refentrytitle><phrase>uart_register_driver</phrase></refentrytitle>
60217 <manvolnum>9</manvolnum>
60218 <refmiscinfo class="version">4.4.14</refmiscinfo>
60219</refmeta>
60220<refnamediv>
60221 <refname>uart_register_driver</refname>
60222 <refpurpose>
60223     register a driver with the uart core layer
60224 </refpurpose>
60225</refnamediv>
60226<refsynopsisdiv>
60227 <title>Synopsis</title>
60228  <funcsynopsis><funcprototype>
60229   <funcdef>int <function>uart_register_driver </function></funcdef>
60230   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
60231  </funcprototype></funcsynopsis>
60232</refsynopsisdiv>
60233<refsect1>
60234 <title>Arguments</title>
60235 <variablelist>
60236  <varlistentry>
60237   <term><parameter>drv</parameter></term>
60238   <listitem>
60239    <para>
60240     low level driver structure
60241    </para>
60242   </listitem>
60243  </varlistentry>
60244 </variablelist>
60245</refsect1>
60246<refsect1>
60247<title>Description</title>
60248<para>
60249   Register a uart driver with the core driver.  We in turn register
60250   with the tty layer, and initialise the core driver per-port state.
60251   </para><para>
60252
60253   We have a proc file in /proc/tty/driver which is named after the
60254   normal driver.
60255   </para><para>
60256
60257   drv-&gt;port should be NULL, and the per-port structures should be
60258   registered using uart_add_one_port after this call has succeeded.
60259</para>
60260</refsect1>
60261</refentry>
60262
60263<refentry id="API-uart-unregister-driver">
60264<refentryinfo>
60265 <title>LINUX</title>
60266 <productname>Kernel Hackers Manual</productname>
60267 <date>July 2017</date>
60268</refentryinfo>
60269<refmeta>
60270 <refentrytitle><phrase>uart_unregister_driver</phrase></refentrytitle>
60271 <manvolnum>9</manvolnum>
60272 <refmiscinfo class="version">4.4.14</refmiscinfo>
60273</refmeta>
60274<refnamediv>
60275 <refname>uart_unregister_driver</refname>
60276 <refpurpose>
60277     remove a driver from the uart core layer
60278 </refpurpose>
60279</refnamediv>
60280<refsynopsisdiv>
60281 <title>Synopsis</title>
60282  <funcsynopsis><funcprototype>
60283   <funcdef>void <function>uart_unregister_driver </function></funcdef>
60284   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
60285  </funcprototype></funcsynopsis>
60286</refsynopsisdiv>
60287<refsect1>
60288 <title>Arguments</title>
60289 <variablelist>
60290  <varlistentry>
60291   <term><parameter>drv</parameter></term>
60292   <listitem>
60293    <para>
60294     low level driver structure
60295    </para>
60296   </listitem>
60297  </varlistentry>
60298 </variablelist>
60299</refsect1>
60300<refsect1>
60301<title>Description</title>
60302<para>
60303   Remove all references to a driver from the core driver.  The low
60304   level driver must have removed all its ports via the
60305   <function><link linkend="API-uart-remove-one-port">uart_remove_one_port</link></function> if it registered them with <function><link linkend="API-uart-add-one-port">uart_add_one_port</link></function>.
60306   (ie, drv-&gt;port == NULL)
60307</para>
60308</refsect1>
60309</refentry>
60310
60311<refentry id="API-uart-add-one-port">
60312<refentryinfo>
60313 <title>LINUX</title>
60314 <productname>Kernel Hackers Manual</productname>
60315 <date>July 2017</date>
60316</refentryinfo>
60317<refmeta>
60318 <refentrytitle><phrase>uart_add_one_port</phrase></refentrytitle>
60319 <manvolnum>9</manvolnum>
60320 <refmiscinfo class="version">4.4.14</refmiscinfo>
60321</refmeta>
60322<refnamediv>
60323 <refname>uart_add_one_port</refname>
60324 <refpurpose>
60325     attach a driver-defined port structure
60326 </refpurpose>
60327</refnamediv>
60328<refsynopsisdiv>
60329 <title>Synopsis</title>
60330  <funcsynopsis><funcprototype>
60331   <funcdef>int <function>uart_add_one_port </function></funcdef>
60332   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
60333   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
60334  </funcprototype></funcsynopsis>
60335</refsynopsisdiv>
60336<refsect1>
60337 <title>Arguments</title>
60338 <variablelist>
60339  <varlistentry>
60340   <term><parameter>drv</parameter></term>
60341   <listitem>
60342    <para>
60343     pointer to the uart low level driver structure for this port
60344    </para>
60345   </listitem>
60346  </varlistentry>
60347  <varlistentry>
60348   <term><parameter>uport</parameter></term>
60349   <listitem>
60350    <para>
60351     uart port structure to use for this port.
60352    </para>
60353   </listitem>
60354  </varlistentry>
60355 </variablelist>
60356</refsect1>
60357<refsect1>
60358<title>Description</title>
60359<para>
60360   This allows the driver to register its own uart_port structure
60361   with the core driver.  The main purpose is to allow the low
60362   level uart drivers to expand uart_port, rather than having yet
60363   more levels of structures.
60364</para>
60365</refsect1>
60366</refentry>
60367
60368<refentry id="API-uart-remove-one-port">
60369<refentryinfo>
60370 <title>LINUX</title>
60371 <productname>Kernel Hackers Manual</productname>
60372 <date>July 2017</date>
60373</refentryinfo>
60374<refmeta>
60375 <refentrytitle><phrase>uart_remove_one_port</phrase></refentrytitle>
60376 <manvolnum>9</manvolnum>
60377 <refmiscinfo class="version">4.4.14</refmiscinfo>
60378</refmeta>
60379<refnamediv>
60380 <refname>uart_remove_one_port</refname>
60381 <refpurpose>
60382     detach a driver defined port structure
60383 </refpurpose>
60384</refnamediv>
60385<refsynopsisdiv>
60386 <title>Synopsis</title>
60387  <funcsynopsis><funcprototype>
60388   <funcdef>int <function>uart_remove_one_port </function></funcdef>
60389   <paramdef>struct uart_driver * <parameter>drv</parameter></paramdef>
60390   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
60391  </funcprototype></funcsynopsis>
60392</refsynopsisdiv>
60393<refsect1>
60394 <title>Arguments</title>
60395 <variablelist>
60396  <varlistentry>
60397   <term><parameter>drv</parameter></term>
60398   <listitem>
60399    <para>
60400     pointer to the uart low level driver structure for this port
60401    </para>
60402   </listitem>
60403  </varlistentry>
60404  <varlistentry>
60405   <term><parameter>uport</parameter></term>
60406   <listitem>
60407    <para>
60408     uart port structure for this port
60409    </para>
60410   </listitem>
60411  </varlistentry>
60412 </variablelist>
60413</refsect1>
60414<refsect1>
60415<title>Description</title>
60416<para>
60417   This unhooks (and hangs up) the specified port structure from the
60418   core driver.  No further calls will be made to the low-level code
60419   for this port.
60420</para>
60421</refsect1>
60422</refentry>
60423
60424<refentry id="API-uart-handle-dcd-change">
60425<refentryinfo>
60426 <title>LINUX</title>
60427 <productname>Kernel Hackers Manual</productname>
60428 <date>July 2017</date>
60429</refentryinfo>
60430<refmeta>
60431 <refentrytitle><phrase>uart_handle_dcd_change</phrase></refentrytitle>
60432 <manvolnum>9</manvolnum>
60433 <refmiscinfo class="version">4.4.14</refmiscinfo>
60434</refmeta>
60435<refnamediv>
60436 <refname>uart_handle_dcd_change</refname>
60437 <refpurpose>
60438     handle a change of carrier detect state
60439 </refpurpose>
60440</refnamediv>
60441<refsynopsisdiv>
60442 <title>Synopsis</title>
60443  <funcsynopsis><funcprototype>
60444   <funcdef>void <function>uart_handle_dcd_change </function></funcdef>
60445   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
60446   <paramdef>unsigned int <parameter>status</parameter></paramdef>
60447  </funcprototype></funcsynopsis>
60448</refsynopsisdiv>
60449<refsect1>
60450 <title>Arguments</title>
60451 <variablelist>
60452  <varlistentry>
60453   <term><parameter>uport</parameter></term>
60454   <listitem>
60455    <para>
60456     uart_port structure for the open port
60457    </para>
60458   </listitem>
60459  </varlistentry>
60460  <varlistentry>
60461   <term><parameter>status</parameter></term>
60462   <listitem>
60463    <para>
60464     new carrier detect status, nonzero if active
60465    </para>
60466   </listitem>
60467  </varlistentry>
60468 </variablelist>
60469</refsect1>
60470<refsect1>
60471<title>Description</title>
60472<para>
60473   Caller must hold uport-&gt;lock
60474</para>
60475</refsect1>
60476</refentry>
60477
60478<refentry id="API-uart-handle-cts-change">
60479<refentryinfo>
60480 <title>LINUX</title>
60481 <productname>Kernel Hackers Manual</productname>
60482 <date>July 2017</date>
60483</refentryinfo>
60484<refmeta>
60485 <refentrytitle><phrase>uart_handle_cts_change</phrase></refentrytitle>
60486 <manvolnum>9</manvolnum>
60487 <refmiscinfo class="version">4.4.14</refmiscinfo>
60488</refmeta>
60489<refnamediv>
60490 <refname>uart_handle_cts_change</refname>
60491 <refpurpose>
60492     handle a change of clear-to-send state
60493 </refpurpose>
60494</refnamediv>
60495<refsynopsisdiv>
60496 <title>Synopsis</title>
60497  <funcsynopsis><funcprototype>
60498   <funcdef>void <function>uart_handle_cts_change </function></funcdef>
60499   <paramdef>struct uart_port * <parameter>uport</parameter></paramdef>
60500   <paramdef>unsigned int <parameter>status</parameter></paramdef>
60501  </funcprototype></funcsynopsis>
60502</refsynopsisdiv>
60503<refsect1>
60504 <title>Arguments</title>
60505 <variablelist>
60506  <varlistentry>
60507   <term><parameter>uport</parameter></term>
60508   <listitem>
60509    <para>
60510     uart_port structure for the open port
60511    </para>
60512   </listitem>
60513  </varlistentry>
60514  <varlistentry>
60515   <term><parameter>status</parameter></term>
60516   <listitem>
60517    <para>
60518     new clear to send status, nonzero if active
60519    </para>
60520   </listitem>
60521  </varlistentry>
60522 </variablelist>
60523</refsect1>
60524<refsect1>
60525<title>Description</title>
60526<para>
60527   Caller must hold uport-&gt;lock
60528</para>
60529</refsect1>
60530</refentry>
60531
60532<refentry id="API-uart-insert-char">
60533<refentryinfo>
60534 <title>LINUX</title>
60535 <productname>Kernel Hackers Manual</productname>
60536 <date>July 2017</date>
60537</refentryinfo>
60538<refmeta>
60539 <refentrytitle><phrase>uart_insert_char</phrase></refentrytitle>
60540 <manvolnum>9</manvolnum>
60541 <refmiscinfo class="version">4.4.14</refmiscinfo>
60542</refmeta>
60543<refnamediv>
60544 <refname>uart_insert_char</refname>
60545 <refpurpose>
60546     push a char to the uart layer
60547 </refpurpose>
60548</refnamediv>
60549<refsynopsisdiv>
60550 <title>Synopsis</title>
60551  <funcsynopsis><funcprototype>
60552   <funcdef>void <function>uart_insert_char </function></funcdef>
60553   <paramdef>struct uart_port * <parameter>port</parameter></paramdef>
60554   <paramdef>unsigned int <parameter>status</parameter></paramdef>
60555   <paramdef>unsigned int <parameter>overrun</parameter></paramdef>
60556   <paramdef>unsigned int <parameter>ch</parameter></paramdef>
60557   <paramdef>unsigned int <parameter>flag</parameter></paramdef>
60558  </funcprototype></funcsynopsis>
60559</refsynopsisdiv>
60560<refsect1>
60561 <title>Arguments</title>
60562 <variablelist>
60563  <varlistentry>
60564   <term><parameter>port</parameter></term>
60565   <listitem>
60566    <para>
60567     corresponding port
60568    </para>
60569   </listitem>
60570  </varlistentry>
60571  <varlistentry>
60572   <term><parameter>status</parameter></term>
60573   <listitem>
60574    <para>
60575     state of the serial port RX buffer (LSR for 8250)
60576    </para>
60577   </listitem>
60578  </varlistentry>
60579  <varlistentry>
60580   <term><parameter>overrun</parameter></term>
60581   <listitem>
60582    <para>
60583     mask of overrun bits in <parameter>status</parameter>
60584    </para>
60585   </listitem>
60586  </varlistentry>
60587  <varlistentry>
60588   <term><parameter>ch</parameter></term>
60589   <listitem>
60590    <para>
60591     character to push
60592    </para>
60593   </listitem>
60594  </varlistentry>
60595  <varlistentry>
60596   <term><parameter>flag</parameter></term>
60597   <listitem>
60598    <para>
60599     flag for the character (see TTY_NORMAL and friends)
60600    </para>
60601   </listitem>
60602  </varlistentry>
60603 </variablelist>
60604</refsect1>
60605<refsect1>
60606<title>Description</title>
60607<para>
60608   </para><para>
60609
60610   User is responsible to call tty_flip_buffer_push when they are done with
60611   insertion.
60612</para>
60613</refsect1>
60614</refentry>
60615
60616<!-- drivers/tty/serial/8250/8250_core.c -->
60617<refentry id="API-serial8250-get-port">
60618<refentryinfo>
60619 <title>LINUX</title>
60620 <productname>Kernel Hackers Manual</productname>
60621 <date>July 2017</date>
60622</refentryinfo>
60623<refmeta>
60624 <refentrytitle><phrase>serial8250_get_port</phrase></refentrytitle>
60625 <manvolnum>9</manvolnum>
60626 <refmiscinfo class="version">4.4.14</refmiscinfo>
60627</refmeta>
60628<refnamediv>
60629 <refname>serial8250_get_port</refname>
60630 <refpurpose>
60631  retrieve struct uart_8250_port
60632 </refpurpose>
60633</refnamediv>
60634<refsynopsisdiv>
60635 <title>Synopsis</title>
60636  <funcsynopsis><funcprototype>
60637   <funcdef>struct uart_8250_port * <function>serial8250_get_port </function></funcdef>
60638   <paramdef>int <parameter>line</parameter></paramdef>
60639  </funcprototype></funcsynopsis>
60640</refsynopsisdiv>
60641<refsect1>
60642 <title>Arguments</title>
60643 <variablelist>
60644  <varlistentry>
60645   <term><parameter>line</parameter></term>
60646   <listitem>
60647    <para>
60648     serial line number
60649    </para>
60650   </listitem>
60651  </varlistentry>
60652 </variablelist>
60653</refsect1>
60654<refsect1>
60655<title>Description</title>
60656<para>
60657   This function retrieves struct uart_8250_port for the specific line.
60658   This struct *must* *not* be used to perform a 8250 or serial core operation
60659   which is not accessible otherwise. Its only purpose is to make the struct
60660   accessible to the runtime-pm callbacks for context suspend/restore.
60661   The lock assumption made here is none because runtime-pm suspend/resume
60662   callbacks should not be invoked if there is any operation performed on the
60663   port.
60664</para>
60665</refsect1>
60666</refentry>
60667
60668<refentry id="API-serial8250-suspend-port">
60669<refentryinfo>
60670 <title>LINUX</title>
60671 <productname>Kernel Hackers Manual</productname>
60672 <date>July 2017</date>
60673</refentryinfo>
60674<refmeta>
60675 <refentrytitle><phrase>serial8250_suspend_port</phrase></refentrytitle>
60676 <manvolnum>9</manvolnum>
60677 <refmiscinfo class="version">4.4.14</refmiscinfo>
60678</refmeta>
60679<refnamediv>
60680 <refname>serial8250_suspend_port</refname>
60681 <refpurpose>
60682     suspend one serial port
60683 </refpurpose>
60684</refnamediv>
60685<refsynopsisdiv>
60686 <title>Synopsis</title>
60687  <funcsynopsis><funcprototype>
60688   <funcdef>void <function>serial8250_suspend_port </function></funcdef>
60689   <paramdef>int <parameter>line</parameter></paramdef>
60690  </funcprototype></funcsynopsis>
60691</refsynopsisdiv>
60692<refsect1>
60693 <title>Arguments</title>
60694 <variablelist>
60695  <varlistentry>
60696   <term><parameter>line</parameter></term>
60697   <listitem>
60698    <para>
60699     serial line number
60700    </para>
60701   </listitem>
60702  </varlistentry>
60703 </variablelist>
60704</refsect1>
60705<refsect1>
60706<title>Description</title>
60707<para>
60708   Suspend one serial port.
60709</para>
60710</refsect1>
60711</refentry>
60712
60713<refentry id="API-serial8250-resume-port">
60714<refentryinfo>
60715 <title>LINUX</title>
60716 <productname>Kernel Hackers Manual</productname>
60717 <date>July 2017</date>
60718</refentryinfo>
60719<refmeta>
60720 <refentrytitle><phrase>serial8250_resume_port</phrase></refentrytitle>
60721 <manvolnum>9</manvolnum>
60722 <refmiscinfo class="version">4.4.14</refmiscinfo>
60723</refmeta>
60724<refnamediv>
60725 <refname>serial8250_resume_port</refname>
60726 <refpurpose>
60727     resume one serial port
60728 </refpurpose>
60729</refnamediv>
60730<refsynopsisdiv>
60731 <title>Synopsis</title>
60732  <funcsynopsis><funcprototype>
60733   <funcdef>void <function>serial8250_resume_port </function></funcdef>
60734   <paramdef>int <parameter>line</parameter></paramdef>
60735  </funcprototype></funcsynopsis>
60736</refsynopsisdiv>
60737<refsect1>
60738 <title>Arguments</title>
60739 <variablelist>
60740  <varlistentry>
60741   <term><parameter>line</parameter></term>
60742   <listitem>
60743    <para>
60744     serial line number
60745    </para>
60746   </listitem>
60747  </varlistentry>
60748 </variablelist>
60749</refsect1>
60750<refsect1>
60751<title>Description</title>
60752<para>
60753   Resume one serial port.
60754</para>
60755</refsect1>
60756</refentry>
60757
60758<refentry id="API-serial8250-register-8250-port">
60759<refentryinfo>
60760 <title>LINUX</title>
60761 <productname>Kernel Hackers Manual</productname>
60762 <date>July 2017</date>
60763</refentryinfo>
60764<refmeta>
60765 <refentrytitle><phrase>serial8250_register_8250_port</phrase></refentrytitle>
60766 <manvolnum>9</manvolnum>
60767 <refmiscinfo class="version">4.4.14</refmiscinfo>
60768</refmeta>
60769<refnamediv>
60770 <refname>serial8250_register_8250_port</refname>
60771 <refpurpose>
60772     register a serial port
60773 </refpurpose>
60774</refnamediv>
60775<refsynopsisdiv>
60776 <title>Synopsis</title>
60777  <funcsynopsis><funcprototype>
60778   <funcdef>int <function>serial8250_register_8250_port </function></funcdef>
60779   <paramdef>struct uart_8250_port * <parameter>up</parameter></paramdef>
60780  </funcprototype></funcsynopsis>
60781</refsynopsisdiv>
60782<refsect1>
60783 <title>Arguments</title>
60784 <variablelist>
60785  <varlistentry>
60786   <term><parameter>up</parameter></term>
60787   <listitem>
60788    <para>
60789     serial port template
60790    </para>
60791   </listitem>
60792  </varlistentry>
60793 </variablelist>
60794</refsect1>
60795<refsect1>
60796<title>Description</title>
60797<para>
60798   Configure the serial port specified by the request. If the
60799   port exists and is in use, it is hung up and unregistered
60800   first.
60801   </para><para>
60802
60803   The port is then probed and if necessary the IRQ is autodetected
60804   If this fails an error is returned.
60805   </para><para>
60806
60807   On success the port is ready to use and the line number is returned.
60808</para>
60809</refsect1>
60810</refentry>
60811
60812<refentry id="API-serial8250-unregister-port">
60813<refentryinfo>
60814 <title>LINUX</title>
60815 <productname>Kernel Hackers Manual</productname>
60816 <date>July 2017</date>
60817</refentryinfo>
60818<refmeta>
60819 <refentrytitle><phrase>serial8250_unregister_port</phrase></refentrytitle>
60820 <manvolnum>9</manvolnum>
60821 <refmiscinfo class="version">4.4.14</refmiscinfo>
60822</refmeta>
60823<refnamediv>
60824 <refname>serial8250_unregister_port</refname>
60825 <refpurpose>
60826     remove a 16x50 serial port at runtime
60827 </refpurpose>
60828</refnamediv>
60829<refsynopsisdiv>
60830 <title>Synopsis</title>
60831  <funcsynopsis><funcprototype>
60832   <funcdef>void <function>serial8250_unregister_port </function></funcdef>
60833   <paramdef>int <parameter>line</parameter></paramdef>
60834  </funcprototype></funcsynopsis>
60835</refsynopsisdiv>
60836<refsect1>
60837 <title>Arguments</title>
60838 <variablelist>
60839  <varlistentry>
60840   <term><parameter>line</parameter></term>
60841   <listitem>
60842    <para>
60843     serial line number
60844    </para>
60845   </listitem>
60846  </varlistentry>
60847 </variablelist>
60848</refsect1>
60849<refsect1>
60850<title>Description</title>
60851<para>
60852   Remove one serial port.  This may not be called from interrupt
60853   context.  We hand the port back to the our control.
60854</para>
60855</refsect1>
60856</refentry>
60857
60858  </chapter>
60859
60860  <chapter id="fbdev">
60861     <title>Frame Buffer Library</title>
60862
60863     <para>
60864       The frame buffer drivers depend heavily on four data structures.
60865       These structures are declared in include/linux/fb.h.  They are
60866       fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
60867       The last three can be made available to and from userland.
60868     </para>
60869
60870     <para>
60871       fb_info defines the current state of a particular video card.
60872       Inside fb_info, there exists a fb_ops structure which is a
60873       collection of needed functions to make fbdev and fbcon work.
60874       fb_info is only visible to the kernel.
60875     </para>
60876
60877     <para>
60878       fb_var_screeninfo is used to describe the features of a video card
60879       that are user defined.  With fb_var_screeninfo, things such as
60880       depth and the resolution may be defined.
60881     </para>
60882
60883     <para>
60884       The next structure is fb_fix_screeninfo. This defines the
60885       properties of a card that are created when a mode is set and can't
60886       be changed otherwise.  A good example of this is the start of the
60887       frame buffer memory.  This "locks" the address of the frame buffer
60888       memory, so that it cannot be changed or moved.
60889     </para>
60890
60891     <para>
60892       The last structure is fb_monospecs. In the old API, there was
60893       little importance for fb_monospecs. This allowed for forbidden things
60894       such as setting a mode of 800x600 on a fix frequency monitor. With
60895       the new API, fb_monospecs prevents such things, and if used
60896       correctly, can prevent a monitor from being cooked.  fb_monospecs
60897       will not be useful until kernels 2.5.x.
60898     </para>
60899
60900     <sect1><title>Frame Buffer Memory</title>
60901<!-- drivers/video/fbdev/core/fbmem.c -->
60902<refentry id="API-register-framebuffer">
60903<refentryinfo>
60904 <title>LINUX</title>
60905 <productname>Kernel Hackers Manual</productname>
60906 <date>July 2017</date>
60907</refentryinfo>
60908<refmeta>
60909 <refentrytitle><phrase>register_framebuffer</phrase></refentrytitle>
60910 <manvolnum>9</manvolnum>
60911 <refmiscinfo class="version">4.4.14</refmiscinfo>
60912</refmeta>
60913<refnamediv>
60914 <refname>register_framebuffer</refname>
60915 <refpurpose>
60916  registers a frame buffer device
60917 </refpurpose>
60918</refnamediv>
60919<refsynopsisdiv>
60920 <title>Synopsis</title>
60921  <funcsynopsis><funcprototype>
60922   <funcdef>int <function>register_framebuffer </function></funcdef>
60923   <paramdef>struct fb_info * <parameter>fb_info</parameter></paramdef>
60924  </funcprototype></funcsynopsis>
60925</refsynopsisdiv>
60926<refsect1>
60927 <title>Arguments</title>
60928 <variablelist>
60929  <varlistentry>
60930   <term><parameter>fb_info</parameter></term>
60931   <listitem>
60932    <para>
60933     frame buffer info structure
60934    </para>
60935   </listitem>
60936  </varlistentry>
60937 </variablelist>
60938</refsect1>
60939<refsect1>
60940<title>Description</title>
60941<para>
60942   Registers a frame buffer device <parameter>fb_info</parameter>.
60943   </para><para>
60944
60945   Returns negative errno on error, or zero for success.
60946</para>
60947</refsect1>
60948</refentry>
60949
60950<refentry id="API-unregister-framebuffer">
60951<refentryinfo>
60952 <title>LINUX</title>
60953 <productname>Kernel Hackers Manual</productname>
60954 <date>July 2017</date>
60955</refentryinfo>
60956<refmeta>
60957 <refentrytitle><phrase>unregister_framebuffer</phrase></refentrytitle>
60958 <manvolnum>9</manvolnum>
60959 <refmiscinfo class="version">4.4.14</refmiscinfo>
60960</refmeta>
60961<refnamediv>
60962 <refname>unregister_framebuffer</refname>
60963 <refpurpose>
60964     releases a frame buffer device
60965 </refpurpose>
60966</refnamediv>
60967<refsynopsisdiv>
60968 <title>Synopsis</title>
60969  <funcsynopsis><funcprototype>
60970   <funcdef>int <function>unregister_framebuffer </function></funcdef>
60971   <paramdef>struct fb_info * <parameter>fb_info</parameter></paramdef>
60972  </funcprototype></funcsynopsis>
60973</refsynopsisdiv>
60974<refsect1>
60975 <title>Arguments</title>
60976 <variablelist>
60977  <varlistentry>
60978   <term><parameter>fb_info</parameter></term>
60979   <listitem>
60980    <para>
60981     frame buffer info structure
60982    </para>
60983   </listitem>
60984  </varlistentry>
60985 </variablelist>
60986</refsect1>
60987<refsect1>
60988<title>Description</title>
60989<para>
60990   Unregisters a frame buffer device <parameter>fb_info</parameter>.
60991   </para><para>
60992
60993   Returns negative errno on error, or zero for success.
60994   </para><para>
60995
60996   This function will also notify the framebuffer console
60997   to release the driver.
60998   </para><para>
60999
61000   This is meant to be called within a driver's <function>module_exit</function>
61001   function. If this is called outside <function>module_exit</function>, ensure
61002   that the driver implements <function>fb_open</function> and <function>fb_release</function> to
61003   check that no processes are using the device.
61004</para>
61005</refsect1>
61006</refentry>
61007
61008<refentry id="API-fb-set-suspend">
61009<refentryinfo>
61010 <title>LINUX</title>
61011 <productname>Kernel Hackers Manual</productname>
61012 <date>July 2017</date>
61013</refentryinfo>
61014<refmeta>
61015 <refentrytitle><phrase>fb_set_suspend</phrase></refentrytitle>
61016 <manvolnum>9</manvolnum>
61017 <refmiscinfo class="version">4.4.14</refmiscinfo>
61018</refmeta>
61019<refnamediv>
61020 <refname>fb_set_suspend</refname>
61021 <refpurpose>
61022     low level driver signals suspend
61023 </refpurpose>
61024</refnamediv>
61025<refsynopsisdiv>
61026 <title>Synopsis</title>
61027  <funcsynopsis><funcprototype>
61028   <funcdef>void <function>fb_set_suspend </function></funcdef>
61029   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
61030   <paramdef>int <parameter>state</parameter></paramdef>
61031  </funcprototype></funcsynopsis>
61032</refsynopsisdiv>
61033<refsect1>
61034 <title>Arguments</title>
61035 <variablelist>
61036  <varlistentry>
61037   <term><parameter>info</parameter></term>
61038   <listitem>
61039    <para>
61040     framebuffer affected
61041    </para>
61042   </listitem>
61043  </varlistentry>
61044  <varlistentry>
61045   <term><parameter>state</parameter></term>
61046   <listitem>
61047    <para>
61048     0 = resuming, !=0 = suspending
61049    </para>
61050   </listitem>
61051  </varlistentry>
61052 </variablelist>
61053</refsect1>
61054<refsect1>
61055<title>Description</title>
61056<para>
61057   This is meant to be used by low level drivers to
61058   signal suspend/resume to the core &amp; clients.
61059   It must be called with the console semaphore held
61060</para>
61061</refsect1>
61062</refentry>
61063
61064     </sect1>
61065<!--
61066     <sect1><title>Frame Buffer Console</title>
61067X!Edrivers/video/console/fbcon.c
61068     </sect1>
61069-->
61070     <sect1><title>Frame Buffer Colormap</title>
61071<!-- drivers/video/fbdev/core/fbcmap.c -->
61072<refentry id="API-fb-dealloc-cmap">
61073<refentryinfo>
61074 <title>LINUX</title>
61075 <productname>Kernel Hackers Manual</productname>
61076 <date>July 2017</date>
61077</refentryinfo>
61078<refmeta>
61079 <refentrytitle><phrase>fb_dealloc_cmap</phrase></refentrytitle>
61080 <manvolnum>9</manvolnum>
61081 <refmiscinfo class="version">4.4.14</refmiscinfo>
61082</refmeta>
61083<refnamediv>
61084 <refname>fb_dealloc_cmap</refname>
61085 <refpurpose>
61086  deallocate a colormap
61087 </refpurpose>
61088</refnamediv>
61089<refsynopsisdiv>
61090 <title>Synopsis</title>
61091  <funcsynopsis><funcprototype>
61092   <funcdef>void <function>fb_dealloc_cmap </function></funcdef>
61093   <paramdef>struct fb_cmap * <parameter>cmap</parameter></paramdef>
61094  </funcprototype></funcsynopsis>
61095</refsynopsisdiv>
61096<refsect1>
61097 <title>Arguments</title>
61098 <variablelist>
61099  <varlistentry>
61100   <term><parameter>cmap</parameter></term>
61101   <listitem>
61102    <para>
61103     frame buffer colormap structure
61104    </para>
61105   </listitem>
61106  </varlistentry>
61107 </variablelist>
61108</refsect1>
61109<refsect1>
61110<title>Description</title>
61111<para>
61112   Deallocates a colormap that was previously allocated with
61113   <function>fb_alloc_cmap</function>.
61114</para>
61115</refsect1>
61116</refentry>
61117
61118<refentry id="API-fb-copy-cmap">
61119<refentryinfo>
61120 <title>LINUX</title>
61121 <productname>Kernel Hackers Manual</productname>
61122 <date>July 2017</date>
61123</refentryinfo>
61124<refmeta>
61125 <refentrytitle><phrase>fb_copy_cmap</phrase></refentrytitle>
61126 <manvolnum>9</manvolnum>
61127 <refmiscinfo class="version">4.4.14</refmiscinfo>
61128</refmeta>
61129<refnamediv>
61130 <refname>fb_copy_cmap</refname>
61131 <refpurpose>
61132     copy a colormap
61133 </refpurpose>
61134</refnamediv>
61135<refsynopsisdiv>
61136 <title>Synopsis</title>
61137  <funcsynopsis><funcprototype>
61138   <funcdef>int <function>fb_copy_cmap </function></funcdef>
61139   <paramdef>const struct fb_cmap * <parameter>from</parameter></paramdef>
61140   <paramdef>struct fb_cmap * <parameter>to</parameter></paramdef>
61141  </funcprototype></funcsynopsis>
61142</refsynopsisdiv>
61143<refsect1>
61144 <title>Arguments</title>
61145 <variablelist>
61146  <varlistentry>
61147   <term><parameter>from</parameter></term>
61148   <listitem>
61149    <para>
61150     frame buffer colormap structure
61151    </para>
61152   </listitem>
61153  </varlistentry>
61154  <varlistentry>
61155   <term><parameter>to</parameter></term>
61156   <listitem>
61157    <para>
61158     frame buffer colormap structure
61159    </para>
61160   </listitem>
61161  </varlistentry>
61162 </variablelist>
61163</refsect1>
61164<refsect1>
61165<title>Description</title>
61166<para>
61167   Copy contents of colormap from <parameter>from</parameter> to <parameter>to</parameter>.
61168</para>
61169</refsect1>
61170</refentry>
61171
61172<refentry id="API-fb-set-cmap">
61173<refentryinfo>
61174 <title>LINUX</title>
61175 <productname>Kernel Hackers Manual</productname>
61176 <date>July 2017</date>
61177</refentryinfo>
61178<refmeta>
61179 <refentrytitle><phrase>fb_set_cmap</phrase></refentrytitle>
61180 <manvolnum>9</manvolnum>
61181 <refmiscinfo class="version">4.4.14</refmiscinfo>
61182</refmeta>
61183<refnamediv>
61184 <refname>fb_set_cmap</refname>
61185 <refpurpose>
61186     set the colormap
61187 </refpurpose>
61188</refnamediv>
61189<refsynopsisdiv>
61190 <title>Synopsis</title>
61191  <funcsynopsis><funcprototype>
61192   <funcdef>int <function>fb_set_cmap </function></funcdef>
61193   <paramdef>struct fb_cmap * <parameter>cmap</parameter></paramdef>
61194   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
61195  </funcprototype></funcsynopsis>
61196</refsynopsisdiv>
61197<refsect1>
61198 <title>Arguments</title>
61199 <variablelist>
61200  <varlistentry>
61201   <term><parameter>cmap</parameter></term>
61202   <listitem>
61203    <para>
61204     frame buffer colormap structure
61205    </para>
61206   </listitem>
61207  </varlistentry>
61208  <varlistentry>
61209   <term><parameter>info</parameter></term>
61210   <listitem>
61211    <para>
61212     frame buffer info structure
61213    </para>
61214   </listitem>
61215  </varlistentry>
61216 </variablelist>
61217</refsect1>
61218<refsect1>
61219<title>Description</title>
61220<para>
61221   Sets the colormap <parameter>cmap</parameter> for a screen of device <parameter>info</parameter>.
61222   </para><para>
61223
61224   Returns negative errno on error, or zero on success.
61225</para>
61226</refsect1>
61227</refentry>
61228
61229<refentry id="API-fb-default-cmap">
61230<refentryinfo>
61231 <title>LINUX</title>
61232 <productname>Kernel Hackers Manual</productname>
61233 <date>July 2017</date>
61234</refentryinfo>
61235<refmeta>
61236 <refentrytitle><phrase>fb_default_cmap</phrase></refentrytitle>
61237 <manvolnum>9</manvolnum>
61238 <refmiscinfo class="version">4.4.14</refmiscinfo>
61239</refmeta>
61240<refnamediv>
61241 <refname>fb_default_cmap</refname>
61242 <refpurpose>
61243     get default colormap
61244 </refpurpose>
61245</refnamediv>
61246<refsynopsisdiv>
61247 <title>Synopsis</title>
61248  <funcsynopsis><funcprototype>
61249   <funcdef>const struct fb_cmap * <function>fb_default_cmap </function></funcdef>
61250   <paramdef>int <parameter>len</parameter></paramdef>
61251  </funcprototype></funcsynopsis>
61252</refsynopsisdiv>
61253<refsect1>
61254 <title>Arguments</title>
61255 <variablelist>
61256  <varlistentry>
61257   <term><parameter>len</parameter></term>
61258   <listitem>
61259    <para>
61260     size of palette for a depth
61261    </para>
61262   </listitem>
61263  </varlistentry>
61264 </variablelist>
61265</refsect1>
61266<refsect1>
61267<title>Description</title>
61268<para>
61269   Gets the default colormap for a specific screen depth.  <parameter>len</parameter>
61270   is the size of the palette for a particular screen depth.
61271   </para><para>
61272
61273   Returns pointer to a frame buffer colormap structure.
61274</para>
61275</refsect1>
61276</refentry>
61277
61278<refentry id="API-fb-invert-cmaps">
61279<refentryinfo>
61280 <title>LINUX</title>
61281 <productname>Kernel Hackers Manual</productname>
61282 <date>July 2017</date>
61283</refentryinfo>
61284<refmeta>
61285 <refentrytitle><phrase>fb_invert_cmaps</phrase></refentrytitle>
61286 <manvolnum>9</manvolnum>
61287 <refmiscinfo class="version">4.4.14</refmiscinfo>
61288</refmeta>
61289<refnamediv>
61290 <refname>fb_invert_cmaps</refname>
61291 <refpurpose>
61292     invert all defaults colormaps
61293 </refpurpose>
61294</refnamediv>
61295<refsynopsisdiv>
61296 <title>Synopsis</title>
61297  <funcsynopsis><funcprototype>
61298   <funcdef>void <function>fb_invert_cmaps </function></funcdef>
61299   <paramdef> <parameter>void</parameter></paramdef>
61300  </funcprototype></funcsynopsis>
61301</refsynopsisdiv>
61302<refsect1>
61303 <title>Arguments</title>
61304 <variablelist>
61305  <varlistentry>
61306   <term><parameter>void</parameter></term>
61307   <listitem>
61308    <para>
61309     no arguments
61310    </para>
61311   </listitem>
61312  </varlistentry>
61313 </variablelist>
61314</refsect1>
61315<refsect1>
61316<title>Description</title>
61317<para>
61318   </para><para>
61319
61320   Invert all default colormaps.
61321</para>
61322</refsect1>
61323</refentry>
61324
61325     </sect1>
61326<!-- FIXME:
61327  drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment
61328  out until somebody adds docs.  KAO
61329     <sect1><title>Frame Buffer Generic Functions</title>
61330X!Idrivers/video/fbgen.c
61331     </sect1>
61332KAO -->
61333     <sect1><title>Frame Buffer Video Mode Database</title>
61334<!-- drivers/video/fbdev/core/modedb.c -->
61335<refentry id="API-fb-try-mode">
61336<refentryinfo>
61337 <title>LINUX</title>
61338 <productname>Kernel Hackers Manual</productname>
61339 <date>July 2017</date>
61340</refentryinfo>
61341<refmeta>
61342 <refentrytitle><phrase>fb_try_mode</phrase></refentrytitle>
61343 <manvolnum>9</manvolnum>
61344 <refmiscinfo class="version">4.4.14</refmiscinfo>
61345</refmeta>
61346<refnamediv>
61347 <refname>fb_try_mode</refname>
61348 <refpurpose>
61349  test a video mode
61350 </refpurpose>
61351</refnamediv>
61352<refsynopsisdiv>
61353 <title>Synopsis</title>
61354  <funcsynopsis><funcprototype>
61355   <funcdef>int <function>fb_try_mode </function></funcdef>
61356   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
61357   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
61358   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
61359   <paramdef>unsigned int <parameter>bpp</parameter></paramdef>
61360  </funcprototype></funcsynopsis>
61361</refsynopsisdiv>
61362<refsect1>
61363 <title>Arguments</title>
61364 <variablelist>
61365  <varlistentry>
61366   <term><parameter>var</parameter></term>
61367   <listitem>
61368    <para>
61369     frame buffer user defined part of display
61370    </para>
61371   </listitem>
61372  </varlistentry>
61373  <varlistentry>
61374   <term><parameter>info</parameter></term>
61375   <listitem>
61376    <para>
61377     frame buffer info structure
61378    </para>
61379   </listitem>
61380  </varlistentry>
61381  <varlistentry>
61382   <term><parameter>mode</parameter></term>
61383   <listitem>
61384    <para>
61385     frame buffer video mode structure
61386    </para>
61387   </listitem>
61388  </varlistentry>
61389  <varlistentry>
61390   <term><parameter>bpp</parameter></term>
61391   <listitem>
61392    <para>
61393     color depth in bits per pixel
61394    </para>
61395   </listitem>
61396  </varlistentry>
61397 </variablelist>
61398</refsect1>
61399<refsect1>
61400<title>Description</title>
61401<para>
61402   Tries a video mode to test it's validity for device <parameter>info</parameter>.
61403   </para><para>
61404
61405   Returns 1 on success.
61406</para>
61407</refsect1>
61408</refentry>
61409
61410<refentry id="API-fb-delete-videomode">
61411<refentryinfo>
61412 <title>LINUX</title>
61413 <productname>Kernel Hackers Manual</productname>
61414 <date>July 2017</date>
61415</refentryinfo>
61416<refmeta>
61417 <refentrytitle><phrase>fb_delete_videomode</phrase></refentrytitle>
61418 <manvolnum>9</manvolnum>
61419 <refmiscinfo class="version">4.4.14</refmiscinfo>
61420</refmeta>
61421<refnamediv>
61422 <refname>fb_delete_videomode</refname>
61423 <refpurpose>
61424     removed videomode entry from modelist
61425 </refpurpose>
61426</refnamediv>
61427<refsynopsisdiv>
61428 <title>Synopsis</title>
61429  <funcsynopsis><funcprototype>
61430   <funcdef>void <function>fb_delete_videomode </function></funcdef>
61431   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
61432   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
61433  </funcprototype></funcsynopsis>
61434</refsynopsisdiv>
61435<refsect1>
61436 <title>Arguments</title>
61437 <variablelist>
61438  <varlistentry>
61439   <term><parameter>mode</parameter></term>
61440   <listitem>
61441    <para>
61442     videomode to remove
61443    </para>
61444   </listitem>
61445  </varlistentry>
61446  <varlistentry>
61447   <term><parameter>head</parameter></term>
61448   <listitem>
61449    <para>
61450     struct list_head of modelist
61451    </para>
61452   </listitem>
61453  </varlistentry>
61454 </variablelist>
61455</refsect1>
61456<refsect1>
61457<title>NOTES</title>
61458<para>
61459   Will remove all matching mode entries
61460</para>
61461</refsect1>
61462</refentry>
61463
61464<!-- drivers/video/fbdev/core/modedb.c -->
61465<refentry id="API-fb-find-mode">
61466<refentryinfo>
61467 <title>LINUX</title>
61468 <productname>Kernel Hackers Manual</productname>
61469 <date>July 2017</date>
61470</refentryinfo>
61471<refmeta>
61472 <refentrytitle><phrase>fb_find_mode</phrase></refentrytitle>
61473 <manvolnum>9</manvolnum>
61474 <refmiscinfo class="version">4.4.14</refmiscinfo>
61475</refmeta>
61476<refnamediv>
61477 <refname>fb_find_mode</refname>
61478 <refpurpose>
61479  finds a valid video mode
61480 </refpurpose>
61481</refnamediv>
61482<refsynopsisdiv>
61483 <title>Synopsis</title>
61484  <funcsynopsis><funcprototype>
61485   <funcdef>int <function>fb_find_mode </function></funcdef>
61486   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
61487   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
61488   <paramdef>const char * <parameter>mode_option</parameter></paramdef>
61489   <paramdef>const struct fb_videomode * <parameter>db</parameter></paramdef>
61490   <paramdef>unsigned int <parameter>dbsize</parameter></paramdef>
61491   <paramdef>const struct fb_videomode * <parameter>default_mode</parameter></paramdef>
61492   <paramdef>unsigned int <parameter>default_bpp</parameter></paramdef>
61493  </funcprototype></funcsynopsis>
61494</refsynopsisdiv>
61495<refsect1>
61496 <title>Arguments</title>
61497 <variablelist>
61498  <varlistentry>
61499   <term><parameter>var</parameter></term>
61500   <listitem>
61501    <para>
61502     frame buffer user defined part of display
61503    </para>
61504   </listitem>
61505  </varlistentry>
61506  <varlistentry>
61507   <term><parameter>info</parameter></term>
61508   <listitem>
61509    <para>
61510     frame buffer info structure
61511    </para>
61512   </listitem>
61513  </varlistentry>
61514  <varlistentry>
61515   <term><parameter>mode_option</parameter></term>
61516   <listitem>
61517    <para>
61518     string video mode to find
61519    </para>
61520   </listitem>
61521  </varlistentry>
61522  <varlistentry>
61523   <term><parameter>db</parameter></term>
61524   <listitem>
61525    <para>
61526     video mode database
61527    </para>
61528   </listitem>
61529  </varlistentry>
61530  <varlistentry>
61531   <term><parameter>dbsize</parameter></term>
61532   <listitem>
61533    <para>
61534     size of <parameter>db</parameter>
61535    </para>
61536   </listitem>
61537  </varlistentry>
61538  <varlistentry>
61539   <term><parameter>default_mode</parameter></term>
61540   <listitem>
61541    <para>
61542     default video mode to fall back to
61543    </para>
61544   </listitem>
61545  </varlistentry>
61546  <varlistentry>
61547   <term><parameter>default_bpp</parameter></term>
61548   <listitem>
61549    <para>
61550     default color depth in bits per pixel
61551    </para>
61552   </listitem>
61553  </varlistentry>
61554 </variablelist>
61555</refsect1>
61556<refsect1>
61557<title>Description</title>
61558<para>
61559   Finds a suitable video mode, starting with the specified mode
61560   in <parameter>mode_option</parameter> with fallback to <parameter>default_mode</parameter>.  If
61561   <parameter>default_mode</parameter> fails, all modes in the video mode database will
61562   be tried.
61563   </para><para>
61564
61565   Valid mode specifiers for <parameter>mode_option</parameter>:
61566   </para><para>
61567
61568   &lt;xres&gt;x&lt;yres&gt;[M][R][-&lt;bpp&gt;][@&lt;refresh&gt;][i][m] or
61569   &lt;name&gt;[-&lt;bpp&gt;][@&lt;refresh&gt;]
61570   </para><para>
61571
61572   with &lt;xres&gt;, &lt;yres&gt;, &lt;bpp&gt; and &lt;refresh&gt; decimal numbers and
61573   &lt;name&gt; a string.
61574   </para><para>
61575
61576   If 'M' is present after yres (and before refresh/bpp if present),
61577   the function will compute the timings using VESA(tm) Coordinated
61578   Video Timings (CVT).  If 'R' is present after 'M', will compute with
61579   reduced blanking (for flatpanels).  If 'i' is present, compute
61580   interlaced mode.  If 'm' is present, add margins equal to 1.8%
61581   of xres rounded down to 8 pixels, and 1.8% of yres. The char
61582   'i' and 'm' must be after 'M' and 'R'. Example:
61583   </para><para>
61584
61585   1024x768MR-8<parameter>60m</parameter> - Reduced blank with margins at 60Hz.
61586</para>
61587</refsect1>
61588<refsect1>
61589<title>NOTE</title>
61590<para>
61591   The passed struct <parameter>var</parameter> is _not_ cleared!  This allows you
61592   to supply values for e.g. the grayscale and accel_flags fields.
61593   </para><para>
61594
61595   Returns zero for failure, 1 if using specified <parameter>mode_option</parameter>,
61596   2 if using specified <parameter>mode_option</parameter> with an ignored refresh rate,
61597   3 if default mode is used, 4 if fall back to any valid mode.
61598</para>
61599</refsect1>
61600</refentry>
61601
61602<refentry id="API-fb-var-to-videomode">
61603<refentryinfo>
61604 <title>LINUX</title>
61605 <productname>Kernel Hackers Manual</productname>
61606 <date>July 2017</date>
61607</refentryinfo>
61608<refmeta>
61609 <refentrytitle><phrase>fb_var_to_videomode</phrase></refentrytitle>
61610 <manvolnum>9</manvolnum>
61611 <refmiscinfo class="version">4.4.14</refmiscinfo>
61612</refmeta>
61613<refnamediv>
61614 <refname>fb_var_to_videomode</refname>
61615 <refpurpose>
61616     convert fb_var_screeninfo to fb_videomode
61617 </refpurpose>
61618</refnamediv>
61619<refsynopsisdiv>
61620 <title>Synopsis</title>
61621  <funcsynopsis><funcprototype>
61622   <funcdef>void <function>fb_var_to_videomode </function></funcdef>
61623   <paramdef>struct fb_videomode * <parameter>mode</parameter></paramdef>
61624   <paramdef>const struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
61625  </funcprototype></funcsynopsis>
61626</refsynopsisdiv>
61627<refsect1>
61628 <title>Arguments</title>
61629 <variablelist>
61630  <varlistentry>
61631   <term><parameter>mode</parameter></term>
61632   <listitem>
61633    <para>
61634     pointer to struct fb_videomode
61635    </para>
61636   </listitem>
61637  </varlistentry>
61638  <varlistentry>
61639   <term><parameter>var</parameter></term>
61640   <listitem>
61641    <para>
61642     pointer to struct fb_var_screeninfo
61643    </para>
61644   </listitem>
61645  </varlistentry>
61646 </variablelist>
61647</refsect1>
61648</refentry>
61649
61650<refentry id="API-fb-videomode-to-var">
61651<refentryinfo>
61652 <title>LINUX</title>
61653 <productname>Kernel Hackers Manual</productname>
61654 <date>July 2017</date>
61655</refentryinfo>
61656<refmeta>
61657 <refentrytitle><phrase>fb_videomode_to_var</phrase></refentrytitle>
61658 <manvolnum>9</manvolnum>
61659 <refmiscinfo class="version">4.4.14</refmiscinfo>
61660</refmeta>
61661<refnamediv>
61662 <refname>fb_videomode_to_var</refname>
61663 <refpurpose>
61664     convert fb_videomode to fb_var_screeninfo
61665 </refpurpose>
61666</refnamediv>
61667<refsynopsisdiv>
61668 <title>Synopsis</title>
61669  <funcsynopsis><funcprototype>
61670   <funcdef>void <function>fb_videomode_to_var </function></funcdef>
61671   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
61672   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
61673  </funcprototype></funcsynopsis>
61674</refsynopsisdiv>
61675<refsect1>
61676 <title>Arguments</title>
61677 <variablelist>
61678  <varlistentry>
61679   <term><parameter>var</parameter></term>
61680   <listitem>
61681    <para>
61682     pointer to struct fb_var_screeninfo
61683    </para>
61684   </listitem>
61685  </varlistentry>
61686  <varlistentry>
61687   <term><parameter>mode</parameter></term>
61688   <listitem>
61689    <para>
61690     pointer to struct fb_videomode
61691    </para>
61692   </listitem>
61693  </varlistentry>
61694 </variablelist>
61695</refsect1>
61696</refentry>
61697
61698<refentry id="API-fb-mode-is-equal">
61699<refentryinfo>
61700 <title>LINUX</title>
61701 <productname>Kernel Hackers Manual</productname>
61702 <date>July 2017</date>
61703</refentryinfo>
61704<refmeta>
61705 <refentrytitle><phrase>fb_mode_is_equal</phrase></refentrytitle>
61706 <manvolnum>9</manvolnum>
61707 <refmiscinfo class="version">4.4.14</refmiscinfo>
61708</refmeta>
61709<refnamediv>
61710 <refname>fb_mode_is_equal</refname>
61711 <refpurpose>
61712     compare 2 videomodes
61713 </refpurpose>
61714</refnamediv>
61715<refsynopsisdiv>
61716 <title>Synopsis</title>
61717  <funcsynopsis><funcprototype>
61718   <funcdef>int <function>fb_mode_is_equal </function></funcdef>
61719   <paramdef>const struct fb_videomode * <parameter>mode1</parameter></paramdef>
61720   <paramdef>const struct fb_videomode * <parameter>mode2</parameter></paramdef>
61721  </funcprototype></funcsynopsis>
61722</refsynopsisdiv>
61723<refsect1>
61724 <title>Arguments</title>
61725 <variablelist>
61726  <varlistentry>
61727   <term><parameter>mode1</parameter></term>
61728   <listitem>
61729    <para>
61730     first videomode
61731    </para>
61732   </listitem>
61733  </varlistentry>
61734  <varlistentry>
61735   <term><parameter>mode2</parameter></term>
61736   <listitem>
61737    <para>
61738     second videomode
61739    </para>
61740   </listitem>
61741  </varlistentry>
61742 </variablelist>
61743</refsect1>
61744<refsect1>
61745<title>RETURNS</title>
61746<para>
61747   1 if equal, 0 if not
61748</para>
61749</refsect1>
61750</refentry>
61751
61752<refentry id="API-fb-find-best-mode">
61753<refentryinfo>
61754 <title>LINUX</title>
61755 <productname>Kernel Hackers Manual</productname>
61756 <date>July 2017</date>
61757</refentryinfo>
61758<refmeta>
61759 <refentrytitle><phrase>fb_find_best_mode</phrase></refentrytitle>
61760 <manvolnum>9</manvolnum>
61761 <refmiscinfo class="version">4.4.14</refmiscinfo>
61762</refmeta>
61763<refnamediv>
61764 <refname>fb_find_best_mode</refname>
61765 <refpurpose>
61766     find best matching videomode
61767 </refpurpose>
61768</refnamediv>
61769<refsynopsisdiv>
61770 <title>Synopsis</title>
61771  <funcsynopsis><funcprototype>
61772   <funcdef>const struct fb_videomode * <function>fb_find_best_mode </function></funcdef>
61773   <paramdef>const struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
61774   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
61775  </funcprototype></funcsynopsis>
61776</refsynopsisdiv>
61777<refsect1>
61778 <title>Arguments</title>
61779 <variablelist>
61780  <varlistentry>
61781   <term><parameter>var</parameter></term>
61782   <listitem>
61783    <para>
61784     pointer to struct fb_var_screeninfo
61785    </para>
61786   </listitem>
61787  </varlistentry>
61788  <varlistentry>
61789   <term><parameter>head</parameter></term>
61790   <listitem>
61791    <para>
61792     pointer to struct list_head of modelist
61793    </para>
61794   </listitem>
61795  </varlistentry>
61796 </variablelist>
61797</refsect1>
61798<refsect1>
61799<title>RETURNS</title>
61800<para>
61801   struct fb_videomode, NULL if none found
61802</para>
61803</refsect1>
61804<refsect1>
61805<title>IMPORTANT</title>
61806<para>
61807   This function assumes that all modelist entries in
61808   info-&gt;modelist are valid.
61809</para>
61810</refsect1>
61811<refsect1>
61812<title>NOTES</title>
61813<para>
61814   Finds best matching videomode which has an equal or greater dimension than
61815   var-&gt;xres and var-&gt;yres.  If more than 1 videomode is found, will return
61816   the videomode with the highest refresh rate
61817</para>
61818</refsect1>
61819</refentry>
61820
61821<refentry id="API-fb-find-nearest-mode">
61822<refentryinfo>
61823 <title>LINUX</title>
61824 <productname>Kernel Hackers Manual</productname>
61825 <date>July 2017</date>
61826</refentryinfo>
61827<refmeta>
61828 <refentrytitle><phrase>fb_find_nearest_mode</phrase></refentrytitle>
61829 <manvolnum>9</manvolnum>
61830 <refmiscinfo class="version">4.4.14</refmiscinfo>
61831</refmeta>
61832<refnamediv>
61833 <refname>fb_find_nearest_mode</refname>
61834 <refpurpose>
61835     find closest videomode
61836 </refpurpose>
61837</refnamediv>
61838<refsynopsisdiv>
61839 <title>Synopsis</title>
61840  <funcsynopsis><funcprototype>
61841   <funcdef>const struct fb_videomode * <function>fb_find_nearest_mode </function></funcdef>
61842   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
61843   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
61844  </funcprototype></funcsynopsis>
61845</refsynopsisdiv>
61846<refsect1>
61847 <title>Arguments</title>
61848 <variablelist>
61849  <varlistentry>
61850   <term><parameter>mode</parameter></term>
61851   <listitem>
61852    <para>
61853     pointer to struct fb_videomode
61854    </para>
61855   </listitem>
61856  </varlistentry>
61857  <varlistentry>
61858   <term><parameter>head</parameter></term>
61859   <listitem>
61860    <para>
61861     pointer to modelist
61862    </para>
61863   </listitem>
61864  </varlistentry>
61865 </variablelist>
61866</refsect1>
61867<refsect1>
61868<title>Description</title>
61869<para>
61870   Finds best matching videomode, smaller or greater in dimension.
61871   If more than 1 videomode is found, will return the videomode with
61872   the closest refresh rate.
61873</para>
61874</refsect1>
61875</refentry>
61876
61877<refentry id="API-fb-match-mode">
61878<refentryinfo>
61879 <title>LINUX</title>
61880 <productname>Kernel Hackers Manual</productname>
61881 <date>July 2017</date>
61882</refentryinfo>
61883<refmeta>
61884 <refentrytitle><phrase>fb_match_mode</phrase></refentrytitle>
61885 <manvolnum>9</manvolnum>
61886 <refmiscinfo class="version">4.4.14</refmiscinfo>
61887</refmeta>
61888<refnamediv>
61889 <refname>fb_match_mode</refname>
61890 <refpurpose>
61891     find a videomode which exactly matches the timings in var
61892 </refpurpose>
61893</refnamediv>
61894<refsynopsisdiv>
61895 <title>Synopsis</title>
61896  <funcsynopsis><funcprototype>
61897   <funcdef>const struct fb_videomode * <function>fb_match_mode </function></funcdef>
61898   <paramdef>const struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
61899   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
61900  </funcprototype></funcsynopsis>
61901</refsynopsisdiv>
61902<refsect1>
61903 <title>Arguments</title>
61904 <variablelist>
61905  <varlistentry>
61906   <term><parameter>var</parameter></term>
61907   <listitem>
61908    <para>
61909     pointer to struct fb_var_screeninfo
61910    </para>
61911   </listitem>
61912  </varlistentry>
61913  <varlistentry>
61914   <term><parameter>head</parameter></term>
61915   <listitem>
61916    <para>
61917     pointer to struct list_head of modelist
61918    </para>
61919   </listitem>
61920  </varlistentry>
61921 </variablelist>
61922</refsect1>
61923<refsect1>
61924<title>RETURNS</title>
61925<para>
61926   struct fb_videomode, NULL if none found
61927</para>
61928</refsect1>
61929</refentry>
61930
61931<refentry id="API-fb-add-videomode">
61932<refentryinfo>
61933 <title>LINUX</title>
61934 <productname>Kernel Hackers Manual</productname>
61935 <date>July 2017</date>
61936</refentryinfo>
61937<refmeta>
61938 <refentrytitle><phrase>fb_add_videomode</phrase></refentrytitle>
61939 <manvolnum>9</manvolnum>
61940 <refmiscinfo class="version">4.4.14</refmiscinfo>
61941</refmeta>
61942<refnamediv>
61943 <refname>fb_add_videomode</refname>
61944 <refpurpose>
61945     adds videomode entry to modelist
61946 </refpurpose>
61947</refnamediv>
61948<refsynopsisdiv>
61949 <title>Synopsis</title>
61950  <funcsynopsis><funcprototype>
61951   <funcdef>int <function>fb_add_videomode </function></funcdef>
61952   <paramdef>const struct fb_videomode * <parameter>mode</parameter></paramdef>
61953   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
61954  </funcprototype></funcsynopsis>
61955</refsynopsisdiv>
61956<refsect1>
61957 <title>Arguments</title>
61958 <variablelist>
61959  <varlistentry>
61960   <term><parameter>mode</parameter></term>
61961   <listitem>
61962    <para>
61963     videomode to add
61964    </para>
61965   </listitem>
61966  </varlistentry>
61967  <varlistentry>
61968   <term><parameter>head</parameter></term>
61969   <listitem>
61970    <para>
61971     struct list_head of modelist
61972    </para>
61973   </listitem>
61974  </varlistentry>
61975 </variablelist>
61976</refsect1>
61977<refsect1>
61978<title>NOTES</title>
61979<para>
61980   Will only add unmatched mode entries
61981</para>
61982</refsect1>
61983</refentry>
61984
61985<refentry id="API-fb-destroy-modelist">
61986<refentryinfo>
61987 <title>LINUX</title>
61988 <productname>Kernel Hackers Manual</productname>
61989 <date>July 2017</date>
61990</refentryinfo>
61991<refmeta>
61992 <refentrytitle><phrase>fb_destroy_modelist</phrase></refentrytitle>
61993 <manvolnum>9</manvolnum>
61994 <refmiscinfo class="version">4.4.14</refmiscinfo>
61995</refmeta>
61996<refnamediv>
61997 <refname>fb_destroy_modelist</refname>
61998 <refpurpose>
61999     destroy modelist
62000 </refpurpose>
62001</refnamediv>
62002<refsynopsisdiv>
62003 <title>Synopsis</title>
62004  <funcsynopsis><funcprototype>
62005   <funcdef>void <function>fb_destroy_modelist </function></funcdef>
62006   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
62007  </funcprototype></funcsynopsis>
62008</refsynopsisdiv>
62009<refsect1>
62010 <title>Arguments</title>
62011 <variablelist>
62012  <varlistentry>
62013   <term><parameter>head</parameter></term>
62014   <listitem>
62015    <para>
62016     struct list_head of modelist
62017    </para>
62018   </listitem>
62019  </varlistentry>
62020 </variablelist>
62021</refsect1>
62022</refentry>
62023
62024<refentry id="API-fb-videomode-to-modelist">
62025<refentryinfo>
62026 <title>LINUX</title>
62027 <productname>Kernel Hackers Manual</productname>
62028 <date>July 2017</date>
62029</refentryinfo>
62030<refmeta>
62031 <refentrytitle><phrase>fb_videomode_to_modelist</phrase></refentrytitle>
62032 <manvolnum>9</manvolnum>
62033 <refmiscinfo class="version">4.4.14</refmiscinfo>
62034</refmeta>
62035<refnamediv>
62036 <refname>fb_videomode_to_modelist</refname>
62037 <refpurpose>
62038     convert mode array to mode list
62039 </refpurpose>
62040</refnamediv>
62041<refsynopsisdiv>
62042 <title>Synopsis</title>
62043  <funcsynopsis><funcprototype>
62044   <funcdef>void <function>fb_videomode_to_modelist </function></funcdef>
62045   <paramdef>const struct fb_videomode * <parameter>modedb</parameter></paramdef>
62046   <paramdef>int <parameter>num</parameter></paramdef>
62047   <paramdef>struct list_head * <parameter>head</parameter></paramdef>
62048  </funcprototype></funcsynopsis>
62049</refsynopsisdiv>
62050<refsect1>
62051 <title>Arguments</title>
62052 <variablelist>
62053  <varlistentry>
62054   <term><parameter>modedb</parameter></term>
62055   <listitem>
62056    <para>
62057     array of struct fb_videomode
62058    </para>
62059   </listitem>
62060  </varlistentry>
62061  <varlistentry>
62062   <term><parameter>num</parameter></term>
62063   <listitem>
62064    <para>
62065     number of entries in array
62066    </para>
62067   </listitem>
62068  </varlistentry>
62069  <varlistentry>
62070   <term><parameter>head</parameter></term>
62071   <listitem>
62072    <para>
62073     struct list_head of modelist
62074    </para>
62075   </listitem>
62076  </varlistentry>
62077 </variablelist>
62078</refsect1>
62079</refentry>
62080
62081     </sect1>
62082     <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
62083<!-- drivers/video/fbdev/macmodes.c -->
62084<refentry id="API-mac-vmode-to-var">
62085<refentryinfo>
62086 <title>LINUX</title>
62087 <productname>Kernel Hackers Manual</productname>
62088 <date>July 2017</date>
62089</refentryinfo>
62090<refmeta>
62091 <refentrytitle><phrase>mac_vmode_to_var</phrase></refentrytitle>
62092 <manvolnum>9</manvolnum>
62093 <refmiscinfo class="version">4.4.14</refmiscinfo>
62094</refmeta>
62095<refnamediv>
62096 <refname>mac_vmode_to_var</refname>
62097 <refpurpose>
62098  converts vmode/cmode pair to var structure
62099 </refpurpose>
62100</refnamediv>
62101<refsynopsisdiv>
62102 <title>Synopsis</title>
62103  <funcsynopsis><funcprototype>
62104   <funcdef>int <function>mac_vmode_to_var </function></funcdef>
62105   <paramdef>int <parameter>vmode</parameter></paramdef>
62106   <paramdef>int <parameter>cmode</parameter></paramdef>
62107   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
62108  </funcprototype></funcsynopsis>
62109</refsynopsisdiv>
62110<refsect1>
62111 <title>Arguments</title>
62112 <variablelist>
62113  <varlistentry>
62114   <term><parameter>vmode</parameter></term>
62115   <listitem>
62116    <para>
62117     MacOS video mode
62118    </para>
62119   </listitem>
62120  </varlistentry>
62121  <varlistentry>
62122   <term><parameter>cmode</parameter></term>
62123   <listitem>
62124    <para>
62125     MacOS color mode
62126    </para>
62127   </listitem>
62128  </varlistentry>
62129  <varlistentry>
62130   <term><parameter>var</parameter></term>
62131   <listitem>
62132    <para>
62133     frame buffer video mode structure
62134    </para>
62135   </listitem>
62136  </varlistentry>
62137 </variablelist>
62138</refsect1>
62139<refsect1>
62140<title>Description</title>
62141<para>
62142   Converts a MacOS vmode/cmode pair to a frame buffer video
62143   mode structure.
62144   </para><para>
62145
62146   Returns negative errno on error, or zero for success.
62147</para>
62148</refsect1>
62149</refentry>
62150
62151<refentry id="API-mac-map-monitor-sense">
62152<refentryinfo>
62153 <title>LINUX</title>
62154 <productname>Kernel Hackers Manual</productname>
62155 <date>July 2017</date>
62156</refentryinfo>
62157<refmeta>
62158 <refentrytitle><phrase>mac_map_monitor_sense</phrase></refentrytitle>
62159 <manvolnum>9</manvolnum>
62160 <refmiscinfo class="version">4.4.14</refmiscinfo>
62161</refmeta>
62162<refnamediv>
62163 <refname>mac_map_monitor_sense</refname>
62164 <refpurpose>
62165     Convert monitor sense to vmode
62166 </refpurpose>
62167</refnamediv>
62168<refsynopsisdiv>
62169 <title>Synopsis</title>
62170  <funcsynopsis><funcprototype>
62171   <funcdef>int <function>mac_map_monitor_sense </function></funcdef>
62172   <paramdef>int <parameter>sense</parameter></paramdef>
62173  </funcprototype></funcsynopsis>
62174</refsynopsisdiv>
62175<refsect1>
62176 <title>Arguments</title>
62177 <variablelist>
62178  <varlistentry>
62179   <term><parameter>sense</parameter></term>
62180   <listitem>
62181    <para>
62182     Macintosh monitor sense number
62183    </para>
62184   </listitem>
62185  </varlistentry>
62186 </variablelist>
62187</refsect1>
62188<refsect1>
62189<title>Description</title>
62190<para>
62191   Converts a Macintosh monitor sense number to a MacOS
62192   vmode number.
62193   </para><para>
62194
62195   Returns MacOS vmode video mode number.
62196</para>
62197</refsect1>
62198</refentry>
62199
62200<refentry id="API-mac-find-mode">
62201<refentryinfo>
62202 <title>LINUX</title>
62203 <productname>Kernel Hackers Manual</productname>
62204 <date>July 2017</date>
62205</refentryinfo>
62206<refmeta>
62207 <refentrytitle><phrase>mac_find_mode</phrase></refentrytitle>
62208 <manvolnum>9</manvolnum>
62209 <refmiscinfo class="version">4.4.14</refmiscinfo>
62210</refmeta>
62211<refnamediv>
62212 <refname>mac_find_mode</refname>
62213 <refpurpose>
62214     find a video mode
62215 </refpurpose>
62216</refnamediv>
62217<refsynopsisdiv>
62218 <title>Synopsis</title>
62219  <funcsynopsis><funcprototype>
62220   <funcdef>int <function>mac_find_mode </function></funcdef>
62221   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
62222   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
62223   <paramdef>const char * <parameter>mode_option</parameter></paramdef>
62224   <paramdef>unsigned int <parameter>default_bpp</parameter></paramdef>
62225  </funcprototype></funcsynopsis>
62226</refsynopsisdiv>
62227<refsect1>
62228 <title>Arguments</title>
62229 <variablelist>
62230  <varlistentry>
62231   <term><parameter>var</parameter></term>
62232   <listitem>
62233    <para>
62234     frame buffer user defined part of display
62235    </para>
62236   </listitem>
62237  </varlistentry>
62238  <varlistentry>
62239   <term><parameter>info</parameter></term>
62240   <listitem>
62241    <para>
62242     frame buffer info structure
62243    </para>
62244   </listitem>
62245  </varlistentry>
62246  <varlistentry>
62247   <term><parameter>mode_option</parameter></term>
62248   <listitem>
62249    <para>
62250     video mode name (see mac_modedb[])
62251    </para>
62252   </listitem>
62253  </varlistentry>
62254  <varlistentry>
62255   <term><parameter>default_bpp</parameter></term>
62256   <listitem>
62257    <para>
62258     default color depth in bits per pixel
62259    </para>
62260   </listitem>
62261  </varlistentry>
62262 </variablelist>
62263</refsect1>
62264<refsect1>
62265<title>Description</title>
62266<para>
62267   Finds a suitable video mode.  Tries to set mode specified
62268   by <parameter>mode_option</parameter>.  If the name of the wanted mode begins with
62269   'mac', the Mac video mode database will be used, otherwise it
62270   will fall back to the standard video mode database.
62271</para>
62272</refsect1>
62273<refsect1>
62274<title>Note</title>
62275<para>
62276   Function marked as __init and can only be used during
62277   system boot.
62278   </para><para>
62279
62280   Returns error code from fb_find_mode (see fb_find_mode
62281   function).
62282</para>
62283</refsect1>
62284</refentry>
62285
62286     </sect1>
62287     <sect1><title>Frame Buffer Fonts</title>
62288        <para>
62289           Refer to the file lib/fonts/fonts.c for more information.
62290        </para>
62291<!-- FIXME: Removed for now since no structured comments in source
62292X!Ilib/fonts/fonts.c
62293-->
62294     </sect1>
62295  </chapter>
62296
62297  <chapter id="input_subsystem">
62298     <title>Input Subsystem</title>
62299     <sect1><title>Input core</title>
62300<!-- include/linux/input.h -->
62301<refentry id="API-struct-input-value">
62302<refentryinfo>
62303 <title>LINUX</title>
62304 <productname>Kernel Hackers Manual</productname>
62305 <date>July 2017</date>
62306</refentryinfo>
62307<refmeta>
62308 <refentrytitle><phrase>struct input_value</phrase></refentrytitle>
62309 <manvolnum>9</manvolnum>
62310 <refmiscinfo class="version">4.4.14</refmiscinfo>
62311</refmeta>
62312<refnamediv>
62313 <refname>struct input_value</refname>
62314 <refpurpose>
62315  input value representation
62316 </refpurpose>
62317</refnamediv>
62318<refsynopsisdiv>
62319 <title>Synopsis</title>
62320  <programlisting>
62321struct input_value {
62322  __u16 type;
62323  __u16 code;
62324  __s32 value;
62325};  </programlisting>
62326</refsynopsisdiv>
62327 <refsect1>
62328  <title>Members</title>
62329  <variablelist>
62330    <varlistentry>      <term>type</term>
62331      <listitem><para>
62332type of value (EV_KEY, EV_ABS, etc)
62333      </para></listitem>
62334    </varlistentry>
62335    <varlistentry>      <term>code</term>
62336      <listitem><para>
62337the value code
62338      </para></listitem>
62339    </varlistentry>
62340    <varlistentry>      <term>value</term>
62341      <listitem><para>
62342the value
62343      </para></listitem>
62344    </varlistentry>
62345  </variablelist>
62346 </refsect1>
62347</refentry>
62348
62349<refentry id="API-struct-input-dev">
62350<refentryinfo>
62351 <title>LINUX</title>
62352 <productname>Kernel Hackers Manual</productname>
62353 <date>July 2017</date>
62354</refentryinfo>
62355<refmeta>
62356 <refentrytitle><phrase>struct input_dev</phrase></refentrytitle>
62357 <manvolnum>9</manvolnum>
62358 <refmiscinfo class="version">4.4.14</refmiscinfo>
62359</refmeta>
62360<refnamediv>
62361 <refname>struct input_dev</refname>
62362 <refpurpose>
62363     represents an input device
62364 </refpurpose>
62365</refnamediv>
62366<refsynopsisdiv>
62367 <title>Synopsis</title>
62368  <programlisting>
62369struct input_dev {
62370  const char * name;
62371  const char * phys;
62372  const char * uniq;
62373  struct input_id id;
62374  unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];
62375  unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
62376  unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
62377  unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
62378  unsigned long absbit[BITS_TO_LONGS(ABS_CNT)];
62379  unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)];
62380  unsigned long ledbit[BITS_TO_LONGS(LED_CNT)];
62381  unsigned long sndbit[BITS_TO_LONGS(SND_CNT)];
62382  unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
62383  unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
62384  unsigned int hint_events_per_packet;
62385  unsigned int keycodemax;
62386  unsigned int keycodesize;
62387  void * keycode;
62388  int (* setkeycode) (struct input_dev *dev,const struct input_keymap_entry *ke,unsigned int *old_keycode);
62389  int (* getkeycode) (struct input_dev *dev,struct input_keymap_entry *ke);
62390  struct ff_device * ff;
62391  unsigned int repeat_key;
62392  struct timer_list timer;
62393  int rep[REP_CNT];
62394  struct input_mt * mt;
62395  struct input_absinfo * absinfo;
62396  unsigned long key[BITS_TO_LONGS(KEY_CNT)];
62397  unsigned long led[BITS_TO_LONGS(LED_CNT)];
62398  unsigned long snd[BITS_TO_LONGS(SND_CNT)];
62399  unsigned long sw[BITS_TO_LONGS(SW_CNT)];
62400  int (* open) (struct input_dev *dev);
62401  void (* close) (struct input_dev *dev);
62402  int (* flush) (struct input_dev *dev, struct file *file);
62403  int (* event) (struct input_dev *dev, unsigned int type, unsigned int code, int value);
62404  struct input_handle __rcu * grab;
62405  spinlock_t event_lock;
62406  struct mutex mutex;
62407  unsigned int users;
62408  bool going_away;
62409  struct device dev;
62410  struct list_head h_list;
62411  struct list_head node;
62412  unsigned int num_vals;
62413  unsigned int max_vals;
62414  struct input_value * vals;
62415  bool devres_managed;
62416};  </programlisting>
62417</refsynopsisdiv>
62418 <refsect1>
62419  <title>Members</title>
62420  <variablelist>
62421    <varlistentry>      <term>name</term>
62422      <listitem><para>
62423   name of the device
62424      </para></listitem>
62425    </varlistentry>
62426    <varlistentry>      <term>phys</term>
62427      <listitem><para>
62428   physical path to the device in the system hierarchy
62429      </para></listitem>
62430    </varlistentry>
62431    <varlistentry>      <term>uniq</term>
62432      <listitem><para>
62433   unique identification code for the device (if device has it)
62434      </para></listitem>
62435    </varlistentry>
62436    <varlistentry>      <term>id</term>
62437      <listitem><para>
62438   id of the device (struct input_id)
62439      </para></listitem>
62440    </varlistentry>
62441    <varlistentry>      <term>propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]</term>
62442      <listitem><para>
62443   bitmap of device properties and quirks
62444      </para></listitem>
62445    </varlistentry>
62446    <varlistentry>      <term>evbit[BITS_TO_LONGS(EV_CNT)]</term>
62447      <listitem><para>
62448   bitmap of types of events supported by the device (EV_KEY,
62449   EV_REL, etc.)
62450      </para></listitem>
62451    </varlistentry>
62452    <varlistentry>      <term>keybit[BITS_TO_LONGS(KEY_CNT)]</term>
62453      <listitem><para>
62454   bitmap of keys/buttons this device has
62455      </para></listitem>
62456    </varlistentry>
62457    <varlistentry>      <term>relbit[BITS_TO_LONGS(REL_CNT)]</term>
62458      <listitem><para>
62459   bitmap of relative axes for the device
62460      </para></listitem>
62461    </varlistentry>
62462    <varlistentry>      <term>absbit[BITS_TO_LONGS(ABS_CNT)]</term>
62463      <listitem><para>
62464   bitmap of absolute axes for the device
62465      </para></listitem>
62466    </varlistentry>
62467    <varlistentry>      <term>mscbit[BITS_TO_LONGS(MSC_CNT)]</term>
62468      <listitem><para>
62469   bitmap of miscellaneous events supported by the device
62470      </para></listitem>
62471    </varlistentry>
62472    <varlistentry>      <term>ledbit[BITS_TO_LONGS(LED_CNT)]</term>
62473      <listitem><para>
62474   bitmap of leds present on the device
62475      </para></listitem>
62476    </varlistentry>
62477    <varlistentry>      <term>sndbit[BITS_TO_LONGS(SND_CNT)]</term>
62478      <listitem><para>
62479   bitmap of sound effects supported by the device
62480      </para></listitem>
62481    </varlistentry>
62482    <varlistentry>      <term>ffbit[BITS_TO_LONGS(FF_CNT)]</term>
62483      <listitem><para>
62484   bitmap of force feedback effects supported by the device
62485      </para></listitem>
62486    </varlistentry>
62487    <varlistentry>      <term>swbit[BITS_TO_LONGS(SW_CNT)]</term>
62488      <listitem><para>
62489   bitmap of switches present on the device
62490      </para></listitem>
62491    </varlistentry>
62492    <varlistentry>      <term>hint_events_per_packet</term>
62493      <listitem><para>
62494   average number of events generated by the
62495   device in a packet (between EV_SYN/SYN_REPORT events). Used by
62496   event handlers to estimate size of the buffer needed to hold
62497   events.
62498      </para></listitem>
62499    </varlistentry>
62500    <varlistentry>      <term>keycodemax</term>
62501      <listitem><para>
62502   size of keycode table
62503      </para></listitem>
62504    </varlistentry>
62505    <varlistentry>      <term>keycodesize</term>
62506      <listitem><para>
62507   size of elements in keycode table
62508      </para></listitem>
62509    </varlistentry>
62510    <varlistentry>      <term>keycode</term>
62511      <listitem><para>
62512   map of scancodes to keycodes for this device
62513      </para></listitem>
62514    </varlistentry>
62515    <varlistentry>      <term>setkeycode</term>
62516      <listitem><para>
62517   optional method to alter current keymap, used to implement
62518   sparse keymaps. If not supplied default mechanism will be used.
62519   The method is being called while holding event_lock and thus must
62520   not sleep
62521      </para></listitem>
62522    </varlistentry>
62523    <varlistentry>      <term>getkeycode</term>
62524      <listitem><para>
62525   optional legacy method to retrieve current keymap.
62526      </para></listitem>
62527    </varlistentry>
62528    <varlistentry>      <term>ff</term>
62529      <listitem><para>
62530   force feedback structure associated with the device if device
62531   supports force feedback effects
62532      </para></listitem>
62533    </varlistentry>
62534    <varlistentry>      <term>repeat_key</term>
62535      <listitem><para>
62536   stores key code of the last key pressed; used to implement
62537   software autorepeat
62538      </para></listitem>
62539    </varlistentry>
62540    <varlistentry>      <term>timer</term>
62541      <listitem><para>
62542   timer for software autorepeat
62543      </para></listitem>
62544    </varlistentry>
62545    <varlistentry>      <term>rep[REP_CNT]</term>
62546      <listitem><para>
62547   current values for autorepeat parameters (delay, rate)
62548      </para></listitem>
62549    </varlistentry>
62550    <varlistentry>      <term>mt</term>
62551      <listitem><para>
62552   pointer to multitouch state
62553      </para></listitem>
62554    </varlistentry>
62555    <varlistentry>      <term>absinfo</term>
62556      <listitem><para>
62557   array of <structname>struct input_absinfo</structname> elements holding information
62558   about absolute axes (current value, min, max, flat, fuzz,
62559   resolution)
62560      </para></listitem>
62561    </varlistentry>
62562    <varlistentry>      <term>key[BITS_TO_LONGS(KEY_CNT)]</term>
62563      <listitem><para>
62564   reflects current state of device's keys/buttons
62565      </para></listitem>
62566    </varlistentry>
62567    <varlistentry>      <term>led[BITS_TO_LONGS(LED_CNT)]</term>
62568      <listitem><para>
62569   reflects current state of device's LEDs
62570      </para></listitem>
62571    </varlistentry>
62572    <varlistentry>      <term>snd[BITS_TO_LONGS(SND_CNT)]</term>
62573      <listitem><para>
62574   reflects current state of sound effects
62575      </para></listitem>
62576    </varlistentry>
62577    <varlistentry>      <term>sw[BITS_TO_LONGS(SW_CNT)]</term>
62578      <listitem><para>
62579   reflects current state of device's switches
62580      </para></listitem>
62581    </varlistentry>
62582    <varlistentry>      <term>open</term>
62583      <listitem><para>
62584   this method is called when the very first user calls
62585   <function><link linkend="API-input-open-device">input_open_device</link></function>. The driver must prepare the device
62586   to start generating events (start polling thread,
62587   request an IRQ, submit URB, etc.)
62588      </para></listitem>
62589    </varlistentry>
62590    <varlistentry>      <term>close</term>
62591      <listitem><para>
62592   this method is called when the very last user calls
62593   <function><link linkend="API-input-close-device">input_close_device</link></function>.
62594      </para></listitem>
62595    </varlistentry>
62596    <varlistentry>      <term>flush</term>
62597      <listitem><para>
62598   purges the device. Most commonly used to get rid of force
62599   feedback effects loaded into the device when disconnecting
62600   from it
62601      </para></listitem>
62602    </varlistentry>
62603    <varlistentry>      <term>event</term>
62604      <listitem><para>
62605   event handler for events sent _to_ the device, like EV_LED
62606   or EV_SND. The device is expected to carry out the requested
62607   action (turn on a LED, play sound, etc.) The call is protected
62608   by <parameter>event_lock</parameter> and must not sleep
62609      </para></listitem>
62610    </varlistentry>
62611    <varlistentry>      <term>grab</term>
62612      <listitem><para>
62613   input handle that currently has the device grabbed (via
62614   EVIOCGRAB ioctl). When a handle grabs a device it becomes sole
62615   recipient for all input events coming from the device
62616      </para></listitem>
62617    </varlistentry>
62618    <varlistentry>      <term>event_lock</term>
62619      <listitem><para>
62620   this spinlock is is taken when input core receives
62621   and processes a new event for the device (in <function><link linkend="API-input-event">input_event</link></function>).
62622   Code that accesses and/or modifies parameters of a device
62623   (such as keymap or absmin, absmax, absfuzz, etc.) after device
62624   has been registered with input core must take this lock.
62625      </para></listitem>
62626    </varlistentry>
62627    <varlistentry>      <term>mutex</term>
62628      <listitem><para>
62629   serializes calls to <function>open</function>, <function>close</function> and <function>flush</function> methods
62630      </para></listitem>
62631    </varlistentry>
62632    <varlistentry>      <term>users</term>
62633      <listitem><para>
62634   stores number of users (input handlers) that opened this
62635   device. It is used by <function><link linkend="API-input-open-device">input_open_device</link></function> and <function><link linkend="API-input-close-device">input_close_device</link></function>
62636   to make sure that dev-&gt;<function>open</function> is only called when the first
62637   user opens device and dev-&gt;<function>close</function> is called when the very
62638   last user closes the device
62639      </para></listitem>
62640    </varlistentry>
62641    <varlistentry>      <term>going_away</term>
62642      <listitem><para>
62643   marks devices that are in a middle of unregistering and
62644   causes input_open_device*() fail with -ENODEV.
62645      </para></listitem>
62646    </varlistentry>
62647    <varlistentry>      <term>dev</term>
62648      <listitem><para>
62649   driver model's view of this device
62650      </para></listitem>
62651    </varlistentry>
62652    <varlistentry>      <term>h_list</term>
62653      <listitem><para>
62654   list of input handles associated with the device. When
62655   accessing the list dev-&gt;mutex must be held
62656      </para></listitem>
62657    </varlistentry>
62658    <varlistentry>      <term>node</term>
62659      <listitem><para>
62660   used to place the device onto input_dev_list
62661      </para></listitem>
62662    </varlistentry>
62663    <varlistentry>      <term>num_vals</term>
62664      <listitem><para>
62665   number of values queued in the current frame
62666      </para></listitem>
62667    </varlistentry>
62668    <varlistentry>      <term>max_vals</term>
62669      <listitem><para>
62670   maximum number of values queued in a frame
62671      </para></listitem>
62672    </varlistentry>
62673    <varlistentry>      <term>vals</term>
62674      <listitem><para>
62675   array of values queued in the current frame
62676      </para></listitem>
62677    </varlistentry>
62678    <varlistentry>      <term>devres_managed</term>
62679      <listitem><para>
62680   indicates that devices is managed with devres framework
62681   and needs not be explicitly unregistered or freed.
62682      </para></listitem>
62683    </varlistentry>
62684  </variablelist>
62685 </refsect1>
62686</refentry>
62687
62688<refentry id="API-struct-input-handler">
62689<refentryinfo>
62690 <title>LINUX</title>
62691 <productname>Kernel Hackers Manual</productname>
62692 <date>July 2017</date>
62693</refentryinfo>
62694<refmeta>
62695 <refentrytitle><phrase>struct input_handler</phrase></refentrytitle>
62696 <manvolnum>9</manvolnum>
62697 <refmiscinfo class="version">4.4.14</refmiscinfo>
62698</refmeta>
62699<refnamediv>
62700 <refname>struct input_handler</refname>
62701 <refpurpose>
62702     implements one of interfaces for input devices
62703 </refpurpose>
62704</refnamediv>
62705<refsynopsisdiv>
62706 <title>Synopsis</title>
62707  <programlisting>
62708struct input_handler {
62709  void * private;
62710  void (* event) (struct input_handle *handle, unsigned int type, unsigned int code, int value);
62711  void (* events) (struct input_handle *handle,const struct input_value *vals, unsigned int count);
62712  bool (* filter) (struct input_handle *handle, unsigned int type, unsigned int code, int value);
62713  bool (* match) (struct input_handler *handler, struct input_dev *dev);
62714  int (* connect) (struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
62715  void (* disconnect) (struct input_handle *handle);
62716  void (* start) (struct input_handle *handle);
62717  bool legacy_minors;
62718  int minor;
62719  const char * name;
62720  const struct input_device_id * id_table;
62721  struct list_head h_list;
62722  struct list_head node;
62723};  </programlisting>
62724</refsynopsisdiv>
62725 <refsect1>
62726  <title>Members</title>
62727  <variablelist>
62728    <varlistentry>      <term>private</term>
62729      <listitem><para>
62730   driver-specific data
62731      </para></listitem>
62732    </varlistentry>
62733    <varlistentry>      <term>event</term>
62734      <listitem><para>
62735   event handler. This method is being called by input core with
62736   interrupts disabled and dev-&gt;event_lock spinlock held and so
62737   it may not sleep
62738      </para></listitem>
62739    </varlistentry>
62740    <varlistentry>      <term>events</term>
62741      <listitem><para>
62742   event sequence handler. This method is being called by
62743   input core with interrupts disabled and dev-&gt;event_lock
62744   spinlock held and so it may not sleep
62745      </para></listitem>
62746    </varlistentry>
62747    <varlistentry>      <term>filter</term>
62748      <listitem><para>
62749   similar to <parameter>event</parameter>; separates normal event handlers from
62750   <quote>filters</quote>.
62751      </para></listitem>
62752    </varlistentry>
62753    <varlistentry>      <term>match</term>
62754      <listitem><para>
62755   called after comparing device's id with handler's id_table
62756   to perform fine-grained matching between device and handler
62757      </para></listitem>
62758    </varlistentry>
62759    <varlistentry>      <term>connect</term>
62760      <listitem><para>
62761   called when attaching a handler to an input device
62762      </para></listitem>
62763    </varlistentry>
62764    <varlistentry>      <term>disconnect</term>
62765      <listitem><para>
62766   disconnects a handler from input device
62767      </para></listitem>
62768    </varlistentry>
62769    <varlistentry>      <term>start</term>
62770      <listitem><para>
62771   starts handler for given handle. This function is called by
62772   input core right after <function>connect</function> method and also when a process
62773   that <quote>grabbed</quote> a device releases it
62774      </para></listitem>
62775    </varlistentry>
62776    <varlistentry>      <term>legacy_minors</term>
62777      <listitem><para>
62778   set to <constant>true</constant> by drivers using legacy minor ranges
62779      </para></listitem>
62780    </varlistentry>
62781    <varlistentry>      <term>minor</term>
62782      <listitem><para>
62783   beginning of range of 32 legacy minors for devices this driver
62784   can provide
62785      </para></listitem>
62786    </varlistentry>
62787    <varlistentry>      <term>name</term>
62788      <listitem><para>
62789   name of the handler, to be shown in /proc/bus/input/handlers
62790      </para></listitem>
62791    </varlistentry>
62792    <varlistentry>      <term>id_table</term>
62793      <listitem><para>
62794   pointer to a table of input_device_ids this driver can
62795   handle
62796      </para></listitem>
62797    </varlistentry>
62798    <varlistentry>      <term>h_list</term>
62799      <listitem><para>
62800   list of input handles associated with the handler
62801      </para></listitem>
62802    </varlistentry>
62803    <varlistentry>      <term>node</term>
62804      <listitem><para>
62805   for placing the driver onto input_handler_list
62806      </para></listitem>
62807    </varlistentry>
62808  </variablelist>
62809 </refsect1>
62810<refsect1>
62811<title>Description</title>
62812<para>
62813   Input handlers attach to input devices and create input handles. There
62814   are likely several handlers attached to any given input device at the
62815   same time. All of them will get their copy of input event generated by
62816   the device.
62817   </para><para>
62818
62819   The very same structure is used to implement input filters. Input core
62820   allows filters to run first and will not pass event to regular handlers
62821   if any of the filters indicate that the event should be filtered (by
62822   returning <constant>true</constant> from their <function>filter</function> method).
62823   </para><para>
62824
62825   Note that input core serializes calls to <function>connect</function> and <function>disconnect</function>
62826   methods.
62827</para>
62828</refsect1>
62829</refentry>
62830
62831<refentry id="API-struct-input-handle">
62832<refentryinfo>
62833 <title>LINUX</title>
62834 <productname>Kernel Hackers Manual</productname>
62835 <date>July 2017</date>
62836</refentryinfo>
62837<refmeta>
62838 <refentrytitle><phrase>struct input_handle</phrase></refentrytitle>
62839 <manvolnum>9</manvolnum>
62840 <refmiscinfo class="version">4.4.14</refmiscinfo>
62841</refmeta>
62842<refnamediv>
62843 <refname>struct input_handle</refname>
62844 <refpurpose>
62845     links input device with an input handler
62846 </refpurpose>
62847</refnamediv>
62848<refsynopsisdiv>
62849 <title>Synopsis</title>
62850  <programlisting>
62851struct input_handle {
62852  void * private;
62853  int open;
62854  const char * name;
62855  struct input_dev * dev;
62856  struct input_handler * handler;
62857  struct list_head d_node;
62858  struct list_head h_node;
62859};  </programlisting>
62860</refsynopsisdiv>
62861 <refsect1>
62862  <title>Members</title>
62863  <variablelist>
62864    <varlistentry>      <term>private</term>
62865      <listitem><para>
62866   handler-specific data
62867      </para></listitem>
62868    </varlistentry>
62869    <varlistentry>      <term>open</term>
62870      <listitem><para>
62871   counter showing whether the handle is 'open', i.e. should deliver
62872   events from its device
62873      </para></listitem>
62874    </varlistentry>
62875    <varlistentry>      <term>name</term>
62876      <listitem><para>
62877   name given to the handle by handler that created it
62878      </para></listitem>
62879    </varlistentry>
62880    <varlistentry>      <term>dev</term>
62881      <listitem><para>
62882   input device the handle is attached to
62883      </para></listitem>
62884    </varlistentry>
62885    <varlistentry>      <term>handler</term>
62886      <listitem><para>
62887   handler that works with the device through this handle
62888      </para></listitem>
62889    </varlistentry>
62890    <varlistentry>      <term>d_node</term>
62891      <listitem><para>
62892   used to put the handle on device's list of attached handles
62893      </para></listitem>
62894    </varlistentry>
62895    <varlistentry>      <term>h_node</term>
62896      <listitem><para>
62897   used to put the handle on handler's list of handles from which
62898   it gets events
62899      </para></listitem>
62900    </varlistentry>
62901  </variablelist>
62902 </refsect1>
62903</refentry>
62904
62905<refentry id="API-input-set-events-per-packet">
62906<refentryinfo>
62907 <title>LINUX</title>
62908 <productname>Kernel Hackers Manual</productname>
62909 <date>July 2017</date>
62910</refentryinfo>
62911<refmeta>
62912 <refentrytitle><phrase>input_set_events_per_packet</phrase></refentrytitle>
62913 <manvolnum>9</manvolnum>
62914 <refmiscinfo class="version">4.4.14</refmiscinfo>
62915</refmeta>
62916<refnamediv>
62917 <refname>input_set_events_per_packet</refname>
62918 <refpurpose>
62919     tell handlers about the driver event rate
62920 </refpurpose>
62921</refnamediv>
62922<refsynopsisdiv>
62923 <title>Synopsis</title>
62924  <funcsynopsis><funcprototype>
62925   <funcdef>void <function>input_set_events_per_packet </function></funcdef>
62926   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
62927   <paramdef>int <parameter>n_events</parameter></paramdef>
62928  </funcprototype></funcsynopsis>
62929</refsynopsisdiv>
62930<refsect1>
62931 <title>Arguments</title>
62932 <variablelist>
62933  <varlistentry>
62934   <term><parameter>dev</parameter></term>
62935   <listitem>
62936    <para>
62937     the input device used by the driver
62938    </para>
62939   </listitem>
62940  </varlistentry>
62941  <varlistentry>
62942   <term><parameter>n_events</parameter></term>
62943   <listitem>
62944    <para>
62945     the average number of events between calls to <function>input_sync</function>
62946    </para>
62947   </listitem>
62948  </varlistentry>
62949 </variablelist>
62950</refsect1>
62951<refsect1>
62952<title>Description</title>
62953<para>
62954   If the event rate sent from a device is unusually large, use this
62955   function to set the expected event rate. This will allow handlers
62956   to set up an appropriate buffer size for the event stream, in order
62957   to minimize information loss.
62958</para>
62959</refsect1>
62960</refentry>
62961
62962<refentry id="API-struct-ff-device">
62963<refentryinfo>
62964 <title>LINUX</title>
62965 <productname>Kernel Hackers Manual</productname>
62966 <date>July 2017</date>
62967</refentryinfo>
62968<refmeta>
62969 <refentrytitle><phrase>struct ff_device</phrase></refentrytitle>
62970 <manvolnum>9</manvolnum>
62971 <refmiscinfo class="version">4.4.14</refmiscinfo>
62972</refmeta>
62973<refnamediv>
62974 <refname>struct ff_device</refname>
62975 <refpurpose>
62976     force-feedback part of an input device
62977 </refpurpose>
62978</refnamediv>
62979<refsynopsisdiv>
62980 <title>Synopsis</title>
62981  <programlisting>
62982struct ff_device {
62983  int (* upload) (struct input_dev *dev, struct ff_effect *effect,struct ff_effect *old);
62984  int (* erase) (struct input_dev *dev, int effect_id);
62985  int (* playback) (struct input_dev *dev, int effect_id, int value);
62986  void (* set_gain) (struct input_dev *dev, u16 gain);
62987  void (* set_autocenter) (struct input_dev *dev, u16 magnitude);
62988  void (* destroy) (struct ff_device *);
62989  void * private;
62990  unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
62991  struct mutex mutex;
62992  int max_effects;
62993  struct ff_effect * effects;
62994  struct file * effect_owners[];
62995};  </programlisting>
62996</refsynopsisdiv>
62997 <refsect1>
62998  <title>Members</title>
62999  <variablelist>
63000    <varlistentry>      <term>upload</term>
63001      <listitem><para>
63002   Called to upload an new effect into device
63003      </para></listitem>
63004    </varlistentry>
63005    <varlistentry>      <term>erase</term>
63006      <listitem><para>
63007   Called to erase an effect from device
63008      </para></listitem>
63009    </varlistentry>
63010    <varlistentry>      <term>playback</term>
63011      <listitem><para>
63012   Called to request device to start playing specified effect
63013      </para></listitem>
63014    </varlistentry>
63015    <varlistentry>      <term>set_gain</term>
63016      <listitem><para>
63017   Called to set specified gain
63018      </para></listitem>
63019    </varlistentry>
63020    <varlistentry>      <term>set_autocenter</term>
63021      <listitem><para>
63022   Called to auto-center device
63023      </para></listitem>
63024    </varlistentry>
63025    <varlistentry>      <term>destroy</term>
63026      <listitem><para>
63027   called by input core when parent input device is being
63028   destroyed
63029      </para></listitem>
63030    </varlistentry>
63031    <varlistentry>      <term>private</term>
63032      <listitem><para>
63033   driver-specific data, will be freed automatically
63034      </para></listitem>
63035    </varlistentry>
63036    <varlistentry>      <term>ffbit[BITS_TO_LONGS(FF_CNT)]</term>
63037      <listitem><para>
63038   bitmap of force feedback capabilities truly supported by
63039   device (not emulated like ones in input_dev-&gt;ffbit)
63040      </para></listitem>
63041    </varlistentry>
63042    <varlistentry>      <term>mutex</term>
63043      <listitem><para>
63044   mutex for serializing access to the device
63045      </para></listitem>
63046    </varlistentry>
63047    <varlistentry>      <term>max_effects</term>
63048      <listitem><para>
63049   maximum number of effects supported by device
63050      </para></listitem>
63051    </varlistentry>
63052    <varlistentry>      <term>effects</term>
63053      <listitem><para>
63054   pointer to an array of effects currently loaded into device
63055      </para></listitem>
63056    </varlistentry>
63057    <varlistentry>      <term>effect_owners[]</term>
63058      <listitem><para>
63059   array of effect owners; when file handle owning
63060   an effect gets closed the effect is automatically erased
63061      </para></listitem>
63062    </varlistentry>
63063  </variablelist>
63064 </refsect1>
63065<refsect1>
63066<title>Description</title>
63067<para>
63068   Every force-feedback device must implement <function>upload</function> and <function>playback</function>
63069   methods; <function>erase</function> is optional. <function>set_gain</function> and <function>set_autocenter</function> need
63070   only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
63071   bits.
63072   </para><para>
63073
63074   Note that <function>playback</function>, <function>set_gain</function> and <function>set_autocenter</function> are called with
63075   dev-&gt;event_lock spinlock held and interrupts off and thus may not
63076   sleep.
63077</para>
63078</refsect1>
63079</refentry>
63080
63081<!-- drivers/input/input.c -->
63082<refentry id="API-input-event">
63083<refentryinfo>
63084 <title>LINUX</title>
63085 <productname>Kernel Hackers Manual</productname>
63086 <date>July 2017</date>
63087</refentryinfo>
63088<refmeta>
63089 <refentrytitle><phrase>input_event</phrase></refentrytitle>
63090 <manvolnum>9</manvolnum>
63091 <refmiscinfo class="version">4.4.14</refmiscinfo>
63092</refmeta>
63093<refnamediv>
63094 <refname>input_event</refname>
63095 <refpurpose>
63096  report new input event
63097 </refpurpose>
63098</refnamediv>
63099<refsynopsisdiv>
63100 <title>Synopsis</title>
63101  <funcsynopsis><funcprototype>
63102   <funcdef>void <function>input_event </function></funcdef>
63103   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63104   <paramdef>unsigned int <parameter>type</parameter></paramdef>
63105   <paramdef>unsigned int <parameter>code</parameter></paramdef>
63106   <paramdef>int <parameter>value</parameter></paramdef>
63107  </funcprototype></funcsynopsis>
63108</refsynopsisdiv>
63109<refsect1>
63110 <title>Arguments</title>
63111 <variablelist>
63112  <varlistentry>
63113   <term><parameter>dev</parameter></term>
63114   <listitem>
63115    <para>
63116     device that generated the event
63117    </para>
63118   </listitem>
63119  </varlistentry>
63120  <varlistentry>
63121   <term><parameter>type</parameter></term>
63122   <listitem>
63123    <para>
63124     type of the event
63125    </para>
63126   </listitem>
63127  </varlistentry>
63128  <varlistentry>
63129   <term><parameter>code</parameter></term>
63130   <listitem>
63131    <para>
63132     event code
63133    </para>
63134   </listitem>
63135  </varlistentry>
63136  <varlistentry>
63137   <term><parameter>value</parameter></term>
63138   <listitem>
63139    <para>
63140     value of the event
63141    </para>
63142   </listitem>
63143  </varlistentry>
63144 </variablelist>
63145</refsect1>
63146<refsect1>
63147<title>Description</title>
63148<para>
63149   This function should be used by drivers implementing various input
63150   devices to report input events. See also <function><link linkend="API-input-inject-event">input_inject_event</link></function>.
63151</para>
63152</refsect1>
63153<refsect1>
63154<title>NOTE</title>
63155<para>
63156   <function><link linkend="API-input-event">input_event</link></function> may be safely used right after input device was
63157   allocated with <function><link linkend="API-input-allocate-device">input_allocate_device</link></function>, even before it is registered
63158   with <function><link linkend="API-input-register-device">input_register_device</link></function>, but the event will not reach any of the
63159   input handlers. Such early invocation of <function><link linkend="API-input-event">input_event</link></function> may be used
63160   to 'seed' initial state of a switch or initial position of absolute
63161   axis, etc.
63162</para>
63163</refsect1>
63164</refentry>
63165
63166<refentry id="API-input-inject-event">
63167<refentryinfo>
63168 <title>LINUX</title>
63169 <productname>Kernel Hackers Manual</productname>
63170 <date>July 2017</date>
63171</refentryinfo>
63172<refmeta>
63173 <refentrytitle><phrase>input_inject_event</phrase></refentrytitle>
63174 <manvolnum>9</manvolnum>
63175 <refmiscinfo class="version">4.4.14</refmiscinfo>
63176</refmeta>
63177<refnamediv>
63178 <refname>input_inject_event</refname>
63179 <refpurpose>
63180     send input event from input handler
63181 </refpurpose>
63182</refnamediv>
63183<refsynopsisdiv>
63184 <title>Synopsis</title>
63185  <funcsynopsis><funcprototype>
63186   <funcdef>void <function>input_inject_event </function></funcdef>
63187   <paramdef><link linkend="API-struct-input-handle">struct input_handle</link> * <parameter>handle</parameter></paramdef>
63188   <paramdef>unsigned int <parameter>type</parameter></paramdef>
63189   <paramdef>unsigned int <parameter>code</parameter></paramdef>
63190   <paramdef>int <parameter>value</parameter></paramdef>
63191  </funcprototype></funcsynopsis>
63192</refsynopsisdiv>
63193<refsect1>
63194 <title>Arguments</title>
63195 <variablelist>
63196  <varlistentry>
63197   <term><parameter>handle</parameter></term>
63198   <listitem>
63199    <para>
63200     input handle to send event through
63201    </para>
63202   </listitem>
63203  </varlistentry>
63204  <varlistentry>
63205   <term><parameter>type</parameter></term>
63206   <listitem>
63207    <para>
63208     type of the event
63209    </para>
63210   </listitem>
63211  </varlistentry>
63212  <varlistentry>
63213   <term><parameter>code</parameter></term>
63214   <listitem>
63215    <para>
63216     event code
63217    </para>
63218   </listitem>
63219  </varlistentry>
63220  <varlistentry>
63221   <term><parameter>value</parameter></term>
63222   <listitem>
63223    <para>
63224     value of the event
63225    </para>
63226   </listitem>
63227  </varlistentry>
63228 </variablelist>
63229</refsect1>
63230<refsect1>
63231<title>Description</title>
63232<para>
63233   Similar to <function><link linkend="API-input-event">input_event</link></function> but will ignore event if device is
63234   <quote>grabbed</quote> and handle injecting event is not the one that owns
63235   the device.
63236</para>
63237</refsect1>
63238</refentry>
63239
63240<refentry id="API-input-alloc-absinfo">
63241<refentryinfo>
63242 <title>LINUX</title>
63243 <productname>Kernel Hackers Manual</productname>
63244 <date>July 2017</date>
63245</refentryinfo>
63246<refmeta>
63247 <refentrytitle><phrase>input_alloc_absinfo</phrase></refentrytitle>
63248 <manvolnum>9</manvolnum>
63249 <refmiscinfo class="version">4.4.14</refmiscinfo>
63250</refmeta>
63251<refnamediv>
63252 <refname>input_alloc_absinfo</refname>
63253 <refpurpose>
63254     allocates array of input_absinfo structs
63255 </refpurpose>
63256</refnamediv>
63257<refsynopsisdiv>
63258 <title>Synopsis</title>
63259  <funcsynopsis><funcprototype>
63260   <funcdef>void <function>input_alloc_absinfo </function></funcdef>
63261   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63262  </funcprototype></funcsynopsis>
63263</refsynopsisdiv>
63264<refsect1>
63265 <title>Arguments</title>
63266 <variablelist>
63267  <varlistentry>
63268   <term><parameter>dev</parameter></term>
63269   <listitem>
63270    <para>
63271     the input device emitting absolute events
63272    </para>
63273   </listitem>
63274  </varlistentry>
63275 </variablelist>
63276</refsect1>
63277<refsect1>
63278<title>Description</title>
63279<para>
63280   If the absinfo struct the caller asked for is already allocated, this
63281   functions will not do anything.
63282</para>
63283</refsect1>
63284</refentry>
63285
63286<refentry id="API-input-grab-device">
63287<refentryinfo>
63288 <title>LINUX</title>
63289 <productname>Kernel Hackers Manual</productname>
63290 <date>July 2017</date>
63291</refentryinfo>
63292<refmeta>
63293 <refentrytitle><phrase>input_grab_device</phrase></refentrytitle>
63294 <manvolnum>9</manvolnum>
63295 <refmiscinfo class="version">4.4.14</refmiscinfo>
63296</refmeta>
63297<refnamediv>
63298 <refname>input_grab_device</refname>
63299 <refpurpose>
63300     grabs device for exclusive use
63301 </refpurpose>
63302</refnamediv>
63303<refsynopsisdiv>
63304 <title>Synopsis</title>
63305  <funcsynopsis><funcprototype>
63306   <funcdef>int <function>input_grab_device </function></funcdef>
63307   <paramdef><link linkend="API-struct-input-handle">struct input_handle</link> * <parameter>handle</parameter></paramdef>
63308  </funcprototype></funcsynopsis>
63309</refsynopsisdiv>
63310<refsect1>
63311 <title>Arguments</title>
63312 <variablelist>
63313  <varlistentry>
63314   <term><parameter>handle</parameter></term>
63315   <listitem>
63316    <para>
63317     input handle that wants to own the device
63318    </para>
63319   </listitem>
63320  </varlistentry>
63321 </variablelist>
63322</refsect1>
63323<refsect1>
63324<title>Description</title>
63325<para>
63326   When a device is grabbed by an input handle all events generated by
63327   the device are delivered only to this handle. Also events injected
63328   by other input handles are ignored while device is grabbed.
63329</para>
63330</refsect1>
63331</refentry>
63332
63333<refentry id="API-input-release-device">
63334<refentryinfo>
63335 <title>LINUX</title>
63336 <productname>Kernel Hackers Manual</productname>
63337 <date>July 2017</date>
63338</refentryinfo>
63339<refmeta>
63340 <refentrytitle><phrase>input_release_device</phrase></refentrytitle>
63341 <manvolnum>9</manvolnum>
63342 <refmiscinfo class="version">4.4.14</refmiscinfo>
63343</refmeta>
63344<refnamediv>
63345 <refname>input_release_device</refname>
63346 <refpurpose>
63347     release previously grabbed device
63348 </refpurpose>
63349</refnamediv>
63350<refsynopsisdiv>
63351 <title>Synopsis</title>
63352  <funcsynopsis><funcprototype>
63353   <funcdef>void <function>input_release_device </function></funcdef>
63354   <paramdef><link linkend="API-struct-input-handle">struct input_handle</link> * <parameter>handle</parameter></paramdef>
63355  </funcprototype></funcsynopsis>
63356</refsynopsisdiv>
63357<refsect1>
63358 <title>Arguments</title>
63359 <variablelist>
63360  <varlistentry>
63361   <term><parameter>handle</parameter></term>
63362   <listitem>
63363    <para>
63364     input handle that owns the device
63365    </para>
63366   </listitem>
63367  </varlistentry>
63368 </variablelist>
63369</refsect1>
63370<refsect1>
63371<title>Description</title>
63372<para>
63373   Releases previously grabbed device so that other input handles can
63374   start receiving input events. Upon release all handlers attached
63375   to the device have their <function>start</function> method called so they have a change
63376   to synchronize device state with the rest of the system.
63377</para>
63378</refsect1>
63379</refentry>
63380
63381<refentry id="API-input-open-device">
63382<refentryinfo>
63383 <title>LINUX</title>
63384 <productname>Kernel Hackers Manual</productname>
63385 <date>July 2017</date>
63386</refentryinfo>
63387<refmeta>
63388 <refentrytitle><phrase>input_open_device</phrase></refentrytitle>
63389 <manvolnum>9</manvolnum>
63390 <refmiscinfo class="version">4.4.14</refmiscinfo>
63391</refmeta>
63392<refnamediv>
63393 <refname>input_open_device</refname>
63394 <refpurpose>
63395     open input device
63396 </refpurpose>
63397</refnamediv>
63398<refsynopsisdiv>
63399 <title>Synopsis</title>
63400  <funcsynopsis><funcprototype>
63401   <funcdef>int <function>input_open_device </function></funcdef>
63402   <paramdef><link linkend="API-struct-input-handle">struct input_handle</link> * <parameter>handle</parameter></paramdef>
63403  </funcprototype></funcsynopsis>
63404</refsynopsisdiv>
63405<refsect1>
63406 <title>Arguments</title>
63407 <variablelist>
63408  <varlistentry>
63409   <term><parameter>handle</parameter></term>
63410   <listitem>
63411    <para>
63412     handle through which device is being accessed
63413    </para>
63414   </listitem>
63415  </varlistentry>
63416 </variablelist>
63417</refsect1>
63418<refsect1>
63419<title>Description</title>
63420<para>
63421   This function should be called by input handlers when they
63422   want to start receive events from given input device.
63423</para>
63424</refsect1>
63425</refentry>
63426
63427<refentry id="API-input-close-device">
63428<refentryinfo>
63429 <title>LINUX</title>
63430 <productname>Kernel Hackers Manual</productname>
63431 <date>July 2017</date>
63432</refentryinfo>
63433<refmeta>
63434 <refentrytitle><phrase>input_close_device</phrase></refentrytitle>
63435 <manvolnum>9</manvolnum>
63436 <refmiscinfo class="version">4.4.14</refmiscinfo>
63437</refmeta>
63438<refnamediv>
63439 <refname>input_close_device</refname>
63440 <refpurpose>
63441     close input device
63442 </refpurpose>
63443</refnamediv>
63444<refsynopsisdiv>
63445 <title>Synopsis</title>
63446  <funcsynopsis><funcprototype>
63447   <funcdef>void <function>input_close_device </function></funcdef>
63448   <paramdef><link linkend="API-struct-input-handle">struct input_handle</link> * <parameter>handle</parameter></paramdef>
63449  </funcprototype></funcsynopsis>
63450</refsynopsisdiv>
63451<refsect1>
63452 <title>Arguments</title>
63453 <variablelist>
63454  <varlistentry>
63455   <term><parameter>handle</parameter></term>
63456   <listitem>
63457    <para>
63458     handle through which device is being accessed
63459    </para>
63460   </listitem>
63461  </varlistentry>
63462 </variablelist>
63463</refsect1>
63464<refsect1>
63465<title>Description</title>
63466<para>
63467   This function should be called by input handlers when they
63468   want to stop receive events from given input device.
63469</para>
63470</refsect1>
63471</refentry>
63472
63473<refentry id="API-input-scancode-to-scalar">
63474<refentryinfo>
63475 <title>LINUX</title>
63476 <productname>Kernel Hackers Manual</productname>
63477 <date>July 2017</date>
63478</refentryinfo>
63479<refmeta>
63480 <refentrytitle><phrase>input_scancode_to_scalar</phrase></refentrytitle>
63481 <manvolnum>9</manvolnum>
63482 <refmiscinfo class="version">4.4.14</refmiscinfo>
63483</refmeta>
63484<refnamediv>
63485 <refname>input_scancode_to_scalar</refname>
63486 <refpurpose>
63487     converts scancode in <structname>struct input_keymap_entry</structname>
63488 </refpurpose>
63489</refnamediv>
63490<refsynopsisdiv>
63491 <title>Synopsis</title>
63492  <funcsynopsis><funcprototype>
63493   <funcdef>int <function>input_scancode_to_scalar </function></funcdef>
63494   <paramdef>const struct input_keymap_entry * <parameter>ke</parameter></paramdef>
63495   <paramdef>unsigned int * <parameter>scancode</parameter></paramdef>
63496  </funcprototype></funcsynopsis>
63497</refsynopsisdiv>
63498<refsect1>
63499 <title>Arguments</title>
63500 <variablelist>
63501  <varlistentry>
63502   <term><parameter>ke</parameter></term>
63503   <listitem>
63504    <para>
63505     keymap entry containing scancode to be converted.
63506    </para>
63507   </listitem>
63508  </varlistentry>
63509  <varlistentry>
63510   <term><parameter>scancode</parameter></term>
63511   <listitem>
63512    <para>
63513     pointer to the location where converted scancode should
63514     be stored.
63515    </para>
63516   </listitem>
63517  </varlistentry>
63518 </variablelist>
63519</refsect1>
63520<refsect1>
63521<title>Description</title>
63522<para>
63523   This function is used to convert scancode stored in <structname>struct keymap_entry</structname>
63524   into scalar form understood by legacy keymap handling methods. These
63525   methods expect scancodes to be represented as 'unsigned int'.
63526</para>
63527</refsect1>
63528</refentry>
63529
63530<refentry id="API-input-get-keycode">
63531<refentryinfo>
63532 <title>LINUX</title>
63533 <productname>Kernel Hackers Manual</productname>
63534 <date>July 2017</date>
63535</refentryinfo>
63536<refmeta>
63537 <refentrytitle><phrase>input_get_keycode</phrase></refentrytitle>
63538 <manvolnum>9</manvolnum>
63539 <refmiscinfo class="version">4.4.14</refmiscinfo>
63540</refmeta>
63541<refnamediv>
63542 <refname>input_get_keycode</refname>
63543 <refpurpose>
63544     retrieve keycode currently mapped to a given scancode
63545 </refpurpose>
63546</refnamediv>
63547<refsynopsisdiv>
63548 <title>Synopsis</title>
63549  <funcsynopsis><funcprototype>
63550   <funcdef>int <function>input_get_keycode </function></funcdef>
63551   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63552   <paramdef>struct input_keymap_entry * <parameter>ke</parameter></paramdef>
63553  </funcprototype></funcsynopsis>
63554</refsynopsisdiv>
63555<refsect1>
63556 <title>Arguments</title>
63557 <variablelist>
63558  <varlistentry>
63559   <term><parameter>dev</parameter></term>
63560   <listitem>
63561    <para>
63562     input device which keymap is being queried
63563    </para>
63564   </listitem>
63565  </varlistentry>
63566  <varlistentry>
63567   <term><parameter>ke</parameter></term>
63568   <listitem>
63569    <para>
63570     keymap entry
63571    </para>
63572   </listitem>
63573  </varlistentry>
63574 </variablelist>
63575</refsect1>
63576<refsect1>
63577<title>Description</title>
63578<para>
63579   This function should be called by anyone interested in retrieving current
63580   keymap. Presently evdev handlers use it.
63581</para>
63582</refsect1>
63583</refentry>
63584
63585<refentry id="API-input-set-keycode">
63586<refentryinfo>
63587 <title>LINUX</title>
63588 <productname>Kernel Hackers Manual</productname>
63589 <date>July 2017</date>
63590</refentryinfo>
63591<refmeta>
63592 <refentrytitle><phrase>input_set_keycode</phrase></refentrytitle>
63593 <manvolnum>9</manvolnum>
63594 <refmiscinfo class="version">4.4.14</refmiscinfo>
63595</refmeta>
63596<refnamediv>
63597 <refname>input_set_keycode</refname>
63598 <refpurpose>
63599     attribute a keycode to a given scancode
63600 </refpurpose>
63601</refnamediv>
63602<refsynopsisdiv>
63603 <title>Synopsis</title>
63604  <funcsynopsis><funcprototype>
63605   <funcdef>int <function>input_set_keycode </function></funcdef>
63606   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63607   <paramdef>const struct input_keymap_entry * <parameter>ke</parameter></paramdef>
63608  </funcprototype></funcsynopsis>
63609</refsynopsisdiv>
63610<refsect1>
63611 <title>Arguments</title>
63612 <variablelist>
63613  <varlistentry>
63614   <term><parameter>dev</parameter></term>
63615   <listitem>
63616    <para>
63617     input device which keymap is being updated
63618    </para>
63619   </listitem>
63620  </varlistentry>
63621  <varlistentry>
63622   <term><parameter>ke</parameter></term>
63623   <listitem>
63624    <para>
63625     new keymap entry
63626    </para>
63627   </listitem>
63628  </varlistentry>
63629 </variablelist>
63630</refsect1>
63631<refsect1>
63632<title>Description</title>
63633<para>
63634   This function should be called by anyone needing to update current
63635   keymap. Presently keyboard and evdev handlers use it.
63636</para>
63637</refsect1>
63638</refentry>
63639
63640<refentry id="API-input-reset-device">
63641<refentryinfo>
63642 <title>LINUX</title>
63643 <productname>Kernel Hackers Manual</productname>
63644 <date>July 2017</date>
63645</refentryinfo>
63646<refmeta>
63647 <refentrytitle><phrase>input_reset_device</phrase></refentrytitle>
63648 <manvolnum>9</manvolnum>
63649 <refmiscinfo class="version">4.4.14</refmiscinfo>
63650</refmeta>
63651<refnamediv>
63652 <refname>input_reset_device</refname>
63653 <refpurpose>
63654     reset/restore the state of input device
63655 </refpurpose>
63656</refnamediv>
63657<refsynopsisdiv>
63658 <title>Synopsis</title>
63659  <funcsynopsis><funcprototype>
63660   <funcdef>void <function>input_reset_device </function></funcdef>
63661   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63662  </funcprototype></funcsynopsis>
63663</refsynopsisdiv>
63664<refsect1>
63665 <title>Arguments</title>
63666 <variablelist>
63667  <varlistentry>
63668   <term><parameter>dev</parameter></term>
63669   <listitem>
63670    <para>
63671     input device whose state needs to be reset
63672    </para>
63673   </listitem>
63674  </varlistentry>
63675 </variablelist>
63676</refsect1>
63677<refsect1>
63678<title>Description</title>
63679<para>
63680   This function tries to reset the state of an opened input device and
63681   bring internal state and state if the hardware in sync with each other.
63682   We mark all keys as released, restore LED state, repeat rate, etc.
63683</para>
63684</refsect1>
63685</refentry>
63686
63687<refentry id="API-input-allocate-device">
63688<refentryinfo>
63689 <title>LINUX</title>
63690 <productname>Kernel Hackers Manual</productname>
63691 <date>July 2017</date>
63692</refentryinfo>
63693<refmeta>
63694 <refentrytitle><phrase>input_allocate_device</phrase></refentrytitle>
63695 <manvolnum>9</manvolnum>
63696 <refmiscinfo class="version">4.4.14</refmiscinfo>
63697</refmeta>
63698<refnamediv>
63699 <refname>input_allocate_device</refname>
63700 <refpurpose>
63701     allocate memory for new input device
63702 </refpurpose>
63703</refnamediv>
63704<refsynopsisdiv>
63705 <title>Synopsis</title>
63706  <funcsynopsis><funcprototype>
63707   <funcdef><link linkend="API-struct-input-dev">struct input_dev</link> * <function>input_allocate_device </function></funcdef>
63708   <paramdef> <parameter>void</parameter></paramdef>
63709  </funcprototype></funcsynopsis>
63710</refsynopsisdiv>
63711<refsect1>
63712 <title>Arguments</title>
63713 <variablelist>
63714  <varlistentry>
63715   <term><parameter>void</parameter></term>
63716   <listitem>
63717    <para>
63718     no arguments
63719    </para>
63720   </listitem>
63721  </varlistentry>
63722 </variablelist>
63723</refsect1>
63724<refsect1>
63725<title>Description</title>
63726<para>
63727   </para><para>
63728
63729   Returns prepared struct input_dev or <constant>NULL</constant>.
63730</para>
63731</refsect1>
63732<refsect1>
63733<title>NOTE</title>
63734<para>
63735   Use <function><link linkend="API-input-free-device">input_free_device</link></function> to free devices that have not been
63736   registered; <function><link linkend="API-input-unregister-device">input_unregister_device</link></function> should be used for already
63737   registered devices.
63738</para>
63739</refsect1>
63740</refentry>
63741
63742<refentry id="API-devm-input-allocate-device">
63743<refentryinfo>
63744 <title>LINUX</title>
63745 <productname>Kernel Hackers Manual</productname>
63746 <date>July 2017</date>
63747</refentryinfo>
63748<refmeta>
63749 <refentrytitle><phrase>devm_input_allocate_device</phrase></refentrytitle>
63750 <manvolnum>9</manvolnum>
63751 <refmiscinfo class="version">4.4.14</refmiscinfo>
63752</refmeta>
63753<refnamediv>
63754 <refname>devm_input_allocate_device</refname>
63755 <refpurpose>
63756     allocate managed input device
63757 </refpurpose>
63758</refnamediv>
63759<refsynopsisdiv>
63760 <title>Synopsis</title>
63761  <funcsynopsis><funcprototype>
63762   <funcdef><link linkend="API-struct-input-dev">struct input_dev</link> * <function>devm_input_allocate_device </function></funcdef>
63763   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
63764  </funcprototype></funcsynopsis>
63765</refsynopsisdiv>
63766<refsect1>
63767 <title>Arguments</title>
63768 <variablelist>
63769  <varlistentry>
63770   <term><parameter>dev</parameter></term>
63771   <listitem>
63772    <para>
63773     device owning the input device being created
63774    </para>
63775   </listitem>
63776  </varlistentry>
63777 </variablelist>
63778</refsect1>
63779<refsect1>
63780<title>Description</title>
63781<para>
63782   Returns prepared struct input_dev or <constant>NULL</constant>.
63783   </para><para>
63784
63785   Managed input devices do not need to be explicitly unregistered or
63786   freed as it will be done automatically when owner device unbinds from
63787   its driver (or binding fails). Once managed input device is allocated,
63788   it is ready to be set up and registered in the same fashion as regular
63789   input device. There are no special devm_input_device_[un]<function>register</function>
63790   variants, regular ones work with both managed and unmanaged devices,
63791   should you need them. In most cases however, managed input device need
63792   not be explicitly unregistered or freed.
63793</para>
63794</refsect1>
63795<refsect1>
63796<title>NOTE</title>
63797<para>
63798   the owner device is set up as parent of input device and users
63799   should not override it.
63800</para>
63801</refsect1>
63802</refentry>
63803
63804<refentry id="API-input-free-device">
63805<refentryinfo>
63806 <title>LINUX</title>
63807 <productname>Kernel Hackers Manual</productname>
63808 <date>July 2017</date>
63809</refentryinfo>
63810<refmeta>
63811 <refentrytitle><phrase>input_free_device</phrase></refentrytitle>
63812 <manvolnum>9</manvolnum>
63813 <refmiscinfo class="version">4.4.14</refmiscinfo>
63814</refmeta>
63815<refnamediv>
63816 <refname>input_free_device</refname>
63817 <refpurpose>
63818     free memory occupied by input_dev structure
63819 </refpurpose>
63820</refnamediv>
63821<refsynopsisdiv>
63822 <title>Synopsis</title>
63823  <funcsynopsis><funcprototype>
63824   <funcdef>void <function>input_free_device </function></funcdef>
63825   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63826  </funcprototype></funcsynopsis>
63827</refsynopsisdiv>
63828<refsect1>
63829 <title>Arguments</title>
63830 <variablelist>
63831  <varlistentry>
63832   <term><parameter>dev</parameter></term>
63833   <listitem>
63834    <para>
63835     input device to free
63836    </para>
63837   </listitem>
63838  </varlistentry>
63839 </variablelist>
63840</refsect1>
63841<refsect1>
63842<title>Description</title>
63843<para>
63844   This function should only be used if <function><link linkend="API-input-register-device">input_register_device</link></function>
63845   was not called yet or if it failed. Once device was registered
63846   use <function><link linkend="API-input-unregister-device">input_unregister_device</link></function> and memory will be freed once last
63847   reference to the device is dropped.
63848   </para><para>
63849
63850   Device should be allocated by <function><link linkend="API-input-allocate-device">input_allocate_device</link></function>.
63851</para>
63852</refsect1>
63853<refsect1>
63854<title>NOTE</title>
63855<para>
63856   If there are references to the input device then memory
63857   will not be freed until last reference is dropped.
63858</para>
63859</refsect1>
63860</refentry>
63861
63862<refentry id="API-input-set-capability">
63863<refentryinfo>
63864 <title>LINUX</title>
63865 <productname>Kernel Hackers Manual</productname>
63866 <date>July 2017</date>
63867</refentryinfo>
63868<refmeta>
63869 <refentrytitle><phrase>input_set_capability</phrase></refentrytitle>
63870 <manvolnum>9</manvolnum>
63871 <refmiscinfo class="version">4.4.14</refmiscinfo>
63872</refmeta>
63873<refnamediv>
63874 <refname>input_set_capability</refname>
63875 <refpurpose>
63876     mark device as capable of a certain event
63877 </refpurpose>
63878</refnamediv>
63879<refsynopsisdiv>
63880 <title>Synopsis</title>
63881  <funcsynopsis><funcprototype>
63882   <funcdef>void <function>input_set_capability </function></funcdef>
63883   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63884   <paramdef>unsigned int <parameter>type</parameter></paramdef>
63885   <paramdef>unsigned int <parameter>code</parameter></paramdef>
63886  </funcprototype></funcsynopsis>
63887</refsynopsisdiv>
63888<refsect1>
63889 <title>Arguments</title>
63890 <variablelist>
63891  <varlistentry>
63892   <term><parameter>dev</parameter></term>
63893   <listitem>
63894    <para>
63895     device that is capable of emitting or accepting event
63896    </para>
63897   </listitem>
63898  </varlistentry>
63899  <varlistentry>
63900   <term><parameter>type</parameter></term>
63901   <listitem>
63902    <para>
63903     type of the event (EV_KEY, EV_REL, etc...)
63904    </para>
63905   </listitem>
63906  </varlistentry>
63907  <varlistentry>
63908   <term><parameter>code</parameter></term>
63909   <listitem>
63910    <para>
63911     event code
63912    </para>
63913   </listitem>
63914  </varlistentry>
63915 </variablelist>
63916</refsect1>
63917<refsect1>
63918<title>Description</title>
63919<para>
63920   In addition to setting up corresponding bit in appropriate capability
63921   bitmap the function also adjusts dev-&gt;evbit.
63922</para>
63923</refsect1>
63924</refentry>
63925
63926<refentry id="API-input-enable-softrepeat">
63927<refentryinfo>
63928 <title>LINUX</title>
63929 <productname>Kernel Hackers Manual</productname>
63930 <date>July 2017</date>
63931</refentryinfo>
63932<refmeta>
63933 <refentrytitle><phrase>input_enable_softrepeat</phrase></refentrytitle>
63934 <manvolnum>9</manvolnum>
63935 <refmiscinfo class="version">4.4.14</refmiscinfo>
63936</refmeta>
63937<refnamediv>
63938 <refname>input_enable_softrepeat</refname>
63939 <refpurpose>
63940     enable software autorepeat
63941 </refpurpose>
63942</refnamediv>
63943<refsynopsisdiv>
63944 <title>Synopsis</title>
63945  <funcsynopsis><funcprototype>
63946   <funcdef>void <function>input_enable_softrepeat </function></funcdef>
63947   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
63948   <paramdef>int <parameter>delay</parameter></paramdef>
63949   <paramdef>int <parameter>period</parameter></paramdef>
63950  </funcprototype></funcsynopsis>
63951</refsynopsisdiv>
63952<refsect1>
63953 <title>Arguments</title>
63954 <variablelist>
63955  <varlistentry>
63956   <term><parameter>dev</parameter></term>
63957   <listitem>
63958    <para>
63959     input device
63960    </para>
63961   </listitem>
63962  </varlistentry>
63963  <varlistentry>
63964   <term><parameter>delay</parameter></term>
63965   <listitem>
63966    <para>
63967     repeat delay
63968    </para>
63969   </listitem>
63970  </varlistentry>
63971  <varlistentry>
63972   <term><parameter>period</parameter></term>
63973   <listitem>
63974    <para>
63975     repeat period
63976    </para>
63977   </listitem>
63978  </varlistentry>
63979 </variablelist>
63980</refsect1>
63981<refsect1>
63982<title>Description</title>
63983<para>
63984   Enable software autorepeat on the input device.
63985</para>
63986</refsect1>
63987</refentry>
63988
63989<refentry id="API-input-register-device">
63990<refentryinfo>
63991 <title>LINUX</title>
63992 <productname>Kernel Hackers Manual</productname>
63993 <date>July 2017</date>
63994</refentryinfo>
63995<refmeta>
63996 <refentrytitle><phrase>input_register_device</phrase></refentrytitle>
63997 <manvolnum>9</manvolnum>
63998 <refmiscinfo class="version">4.4.14</refmiscinfo>
63999</refmeta>
64000<refnamediv>
64001 <refname>input_register_device</refname>
64002 <refpurpose>
64003     register device with input core
64004 </refpurpose>
64005</refnamediv>
64006<refsynopsisdiv>
64007 <title>Synopsis</title>
64008  <funcsynopsis><funcprototype>
64009   <funcdef>int <function>input_register_device </function></funcdef>
64010   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64011  </funcprototype></funcsynopsis>
64012</refsynopsisdiv>
64013<refsect1>
64014 <title>Arguments</title>
64015 <variablelist>
64016  <varlistentry>
64017   <term><parameter>dev</parameter></term>
64018   <listitem>
64019    <para>
64020     device to be registered
64021    </para>
64022   </listitem>
64023  </varlistentry>
64024 </variablelist>
64025</refsect1>
64026<refsect1>
64027<title>Description</title>
64028<para>
64029   This function registers device with input core. The device must be
64030   allocated with <function><link linkend="API-input-allocate-device">input_allocate_device</link></function> and all it's capabilities
64031   set up before registering.
64032   If function fails the device must be freed with <function><link linkend="API-input-free-device">input_free_device</link></function>.
64033   Once device has been successfully registered it can be unregistered
64034   with <function><link linkend="API-input-unregister-device">input_unregister_device</link></function>; <function><link linkend="API-input-free-device">input_free_device</link></function> should not be
64035   called in this case.
64036   </para><para>
64037
64038   Note that this function is also used to register managed input devices
64039   (ones allocated with <function><link linkend="API-devm-input-allocate-device">devm_input_allocate_device</link></function>). Such managed input
64040   devices need not be explicitly unregistered or freed, their tear down
64041   is controlled by the devres infrastructure. It is also worth noting
64042   that tear down of managed input devices is internally a 2-step process:
64043   registered managed input device is first unregistered, but stays in
64044   memory and can still handle <function><link linkend="API-input-event">input_event</link></function> calls (although events will
64045   not be delivered anywhere). The freeing of managed input device will
64046   happen later, when devres stack is unwound to the point where device
64047   allocation was made.
64048</para>
64049</refsect1>
64050</refentry>
64051
64052<refentry id="API-input-unregister-device">
64053<refentryinfo>
64054 <title>LINUX</title>
64055 <productname>Kernel Hackers Manual</productname>
64056 <date>July 2017</date>
64057</refentryinfo>
64058<refmeta>
64059 <refentrytitle><phrase>input_unregister_device</phrase></refentrytitle>
64060 <manvolnum>9</manvolnum>
64061 <refmiscinfo class="version">4.4.14</refmiscinfo>
64062</refmeta>
64063<refnamediv>
64064 <refname>input_unregister_device</refname>
64065 <refpurpose>
64066     unregister previously registered device
64067 </refpurpose>
64068</refnamediv>
64069<refsynopsisdiv>
64070 <title>Synopsis</title>
64071  <funcsynopsis><funcprototype>
64072   <funcdef>void <function>input_unregister_device </function></funcdef>
64073   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64074  </funcprototype></funcsynopsis>
64075</refsynopsisdiv>
64076<refsect1>
64077 <title>Arguments</title>
64078 <variablelist>
64079  <varlistentry>
64080   <term><parameter>dev</parameter></term>
64081   <listitem>
64082    <para>
64083     device to be unregistered
64084    </para>
64085   </listitem>
64086  </varlistentry>
64087 </variablelist>
64088</refsect1>
64089<refsect1>
64090<title>Description</title>
64091<para>
64092   This function unregisters an input device. Once device is unregistered
64093   the caller should not try to access it as it may get freed at any moment.
64094</para>
64095</refsect1>
64096</refentry>
64097
64098<refentry id="API-input-register-handler">
64099<refentryinfo>
64100 <title>LINUX</title>
64101 <productname>Kernel Hackers Manual</productname>
64102 <date>July 2017</date>
64103</refentryinfo>
64104<refmeta>
64105 <refentrytitle><phrase>input_register_handler</phrase></refentrytitle>
64106 <manvolnum>9</manvolnum>
64107 <refmiscinfo class="version">4.4.14</refmiscinfo>
64108</refmeta>
64109<refnamediv>
64110 <refname>input_register_handler</refname>
64111 <refpurpose>
64112     register a new input handler
64113 </refpurpose>
64114</refnamediv>
64115<refsynopsisdiv>
64116 <title>Synopsis</title>
64117  <funcsynopsis><funcprototype>
64118   <funcdef>int <function>input_register_handler </function></funcdef>
64119   <paramdef><link linkend="API-struct-input-handler">struct input_handler</link> * <parameter>handler</parameter></paramdef>
64120  </funcprototype></funcsynopsis>
64121</refsynopsisdiv>
64122<refsect1>
64123 <title>Arguments</title>
64124 <variablelist>
64125  <varlistentry>
64126   <term><parameter>handler</parameter></term>
64127   <listitem>
64128    <para>
64129     handler to be registered
64130    </para>
64131   </listitem>
64132  </varlistentry>
64133 </variablelist>
64134</refsect1>
64135<refsect1>
64136<title>Description</title>
64137<para>
64138   This function registers a new input handler (interface) for input
64139   devices in the system and attaches it to all input devices that
64140   are compatible with the handler.
64141</para>
64142</refsect1>
64143</refentry>
64144
64145<refentry id="API-input-unregister-handler">
64146<refentryinfo>
64147 <title>LINUX</title>
64148 <productname>Kernel Hackers Manual</productname>
64149 <date>July 2017</date>
64150</refentryinfo>
64151<refmeta>
64152 <refentrytitle><phrase>input_unregister_handler</phrase></refentrytitle>
64153 <manvolnum>9</manvolnum>
64154 <refmiscinfo class="version">4.4.14</refmiscinfo>
64155</refmeta>
64156<refnamediv>
64157 <refname>input_unregister_handler</refname>
64158 <refpurpose>
64159     unregisters an input handler
64160 </refpurpose>
64161</refnamediv>
64162<refsynopsisdiv>
64163 <title>Synopsis</title>
64164  <funcsynopsis><funcprototype>
64165   <funcdef>void <function>input_unregister_handler </function></funcdef>
64166   <paramdef><link linkend="API-struct-input-handler">struct input_handler</link> * <parameter>handler</parameter></paramdef>
64167  </funcprototype></funcsynopsis>
64168</refsynopsisdiv>
64169<refsect1>
64170 <title>Arguments</title>
64171 <variablelist>
64172  <varlistentry>
64173   <term><parameter>handler</parameter></term>
64174   <listitem>
64175    <para>
64176     handler to be unregistered
64177    </para>
64178   </listitem>
64179  </varlistentry>
64180 </variablelist>
64181</refsect1>
64182<refsect1>
64183<title>Description</title>
64184<para>
64185   This function disconnects a handler from its input devices and
64186   removes it from lists of known handlers.
64187</para>
64188</refsect1>
64189</refentry>
64190
64191<refentry id="API-input-handler-for-each-handle">
64192<refentryinfo>
64193 <title>LINUX</title>
64194 <productname>Kernel Hackers Manual</productname>
64195 <date>July 2017</date>
64196</refentryinfo>
64197<refmeta>
64198 <refentrytitle><phrase>input_handler_for_each_handle</phrase></refentrytitle>
64199 <manvolnum>9</manvolnum>
64200 <refmiscinfo class="version">4.4.14</refmiscinfo>
64201</refmeta>
64202<refnamediv>
64203 <refname>input_handler_for_each_handle</refname>
64204 <refpurpose>
64205     handle iterator
64206 </refpurpose>
64207</refnamediv>
64208<refsynopsisdiv>
64209 <title>Synopsis</title>
64210  <funcsynopsis><funcprototype>
64211   <funcdef>int <function>input_handler_for_each_handle </function></funcdef>
64212   <paramdef><link linkend="API-struct-input-handler">struct input_handler</link> * <parameter>handler</parameter></paramdef>
64213   <paramdef>void * <parameter>data</parameter></paramdef>
64214   <paramdef>int (*<parameter>fn</parameter>)
64215     <funcparams>struct input_handle *, void *</funcparams></paramdef>
64216  </funcprototype></funcsynopsis>
64217</refsynopsisdiv>
64218<refsect1>
64219 <title>Arguments</title>
64220 <variablelist>
64221  <varlistentry>
64222   <term><parameter>handler</parameter></term>
64223   <listitem>
64224    <para>
64225     input handler to iterate
64226    </para>
64227   </listitem>
64228  </varlistentry>
64229  <varlistentry>
64230   <term><parameter>data</parameter></term>
64231   <listitem>
64232    <para>
64233     data for the callback
64234    </para>
64235   </listitem>
64236  </varlistentry>
64237  <varlistentry>
64238   <term><parameter>fn</parameter></term>
64239   <listitem>
64240    <para>
64241     function to be called for each handle
64242    </para>
64243   </listitem>
64244  </varlistentry>
64245 </variablelist>
64246</refsect1>
64247<refsect1>
64248<title>Description</title>
64249<para>
64250   Iterate over <parameter>bus</parameter>'s list of devices, and call <parameter>fn</parameter> for each, passing
64251   it <parameter>data</parameter> and stop when <parameter>fn</parameter> returns a non-zero value. The function is
64252   using RCU to traverse the list and therefore may be using in atomic
64253   contexts. The <parameter>fn</parameter> callback is invoked from RCU critical section and
64254   thus must not sleep.
64255</para>
64256</refsect1>
64257</refentry>
64258
64259<refentry id="API-input-register-handle">
64260<refentryinfo>
64261 <title>LINUX</title>
64262 <productname>Kernel Hackers Manual</productname>
64263 <date>July 2017</date>
64264</refentryinfo>
64265<refmeta>
64266 <refentrytitle><phrase>input_register_handle</phrase></refentrytitle>
64267 <manvolnum>9</manvolnum>
64268 <refmiscinfo class="version">4.4.14</refmiscinfo>
64269</refmeta>
64270<refnamediv>
64271 <refname>input_register_handle</refname>
64272 <refpurpose>
64273     register a new input handle
64274 </refpurpose>
64275</refnamediv>
64276<refsynopsisdiv>
64277 <title>Synopsis</title>
64278  <funcsynopsis><funcprototype>
64279   <funcdef>int <function>input_register_handle </function></funcdef>
64280   <paramdef><link linkend="API-struct-input-handle">struct input_handle</link> * <parameter>handle</parameter></paramdef>
64281  </funcprototype></funcsynopsis>
64282</refsynopsisdiv>
64283<refsect1>
64284 <title>Arguments</title>
64285 <variablelist>
64286  <varlistentry>
64287   <term><parameter>handle</parameter></term>
64288   <listitem>
64289    <para>
64290     handle to register
64291    </para>
64292   </listitem>
64293  </varlistentry>
64294 </variablelist>
64295</refsect1>
64296<refsect1>
64297<title>Description</title>
64298<para>
64299   This function puts a new input handle onto device's
64300   and handler's lists so that events can flow through
64301   it once it is opened using <function><link linkend="API-input-open-device">input_open_device</link></function>.
64302   </para><para>
64303
64304   This function is supposed to be called from handler's
64305   <function>connect</function> method.
64306</para>
64307</refsect1>
64308</refentry>
64309
64310<refentry id="API-input-unregister-handle">
64311<refentryinfo>
64312 <title>LINUX</title>
64313 <productname>Kernel Hackers Manual</productname>
64314 <date>July 2017</date>
64315</refentryinfo>
64316<refmeta>
64317 <refentrytitle><phrase>input_unregister_handle</phrase></refentrytitle>
64318 <manvolnum>9</manvolnum>
64319 <refmiscinfo class="version">4.4.14</refmiscinfo>
64320</refmeta>
64321<refnamediv>
64322 <refname>input_unregister_handle</refname>
64323 <refpurpose>
64324     unregister an input handle
64325 </refpurpose>
64326</refnamediv>
64327<refsynopsisdiv>
64328 <title>Synopsis</title>
64329  <funcsynopsis><funcprototype>
64330   <funcdef>void <function>input_unregister_handle </function></funcdef>
64331   <paramdef><link linkend="API-struct-input-handle">struct input_handle</link> * <parameter>handle</parameter></paramdef>
64332  </funcprototype></funcsynopsis>
64333</refsynopsisdiv>
64334<refsect1>
64335 <title>Arguments</title>
64336 <variablelist>
64337  <varlistentry>
64338   <term><parameter>handle</parameter></term>
64339   <listitem>
64340    <para>
64341     handle to unregister
64342    </para>
64343   </listitem>
64344  </varlistentry>
64345 </variablelist>
64346</refsect1>
64347<refsect1>
64348<title>Description</title>
64349<para>
64350   This function removes input handle from device's
64351   and handler's lists.
64352   </para><para>
64353
64354   This function is supposed to be called from handler's
64355   <function>disconnect</function> method.
64356</para>
64357</refsect1>
64358</refentry>
64359
64360<refentry id="API-input-get-new-minor">
64361<refentryinfo>
64362 <title>LINUX</title>
64363 <productname>Kernel Hackers Manual</productname>
64364 <date>July 2017</date>
64365</refentryinfo>
64366<refmeta>
64367 <refentrytitle><phrase>input_get_new_minor</phrase></refentrytitle>
64368 <manvolnum>9</manvolnum>
64369 <refmiscinfo class="version">4.4.14</refmiscinfo>
64370</refmeta>
64371<refnamediv>
64372 <refname>input_get_new_minor</refname>
64373 <refpurpose>
64374     allocates a new input minor number
64375 </refpurpose>
64376</refnamediv>
64377<refsynopsisdiv>
64378 <title>Synopsis</title>
64379  <funcsynopsis><funcprototype>
64380   <funcdef>int <function>input_get_new_minor </function></funcdef>
64381   <paramdef>int <parameter>legacy_base</parameter></paramdef>
64382   <paramdef>unsigned int <parameter>legacy_num</parameter></paramdef>
64383   <paramdef>bool <parameter>allow_dynamic</parameter></paramdef>
64384  </funcprototype></funcsynopsis>
64385</refsynopsisdiv>
64386<refsect1>
64387 <title>Arguments</title>
64388 <variablelist>
64389  <varlistentry>
64390   <term><parameter>legacy_base</parameter></term>
64391   <listitem>
64392    <para>
64393     beginning or the legacy range to be searched
64394    </para>
64395   </listitem>
64396  </varlistentry>
64397  <varlistentry>
64398   <term><parameter>legacy_num</parameter></term>
64399   <listitem>
64400    <para>
64401     size of legacy range
64402    </para>
64403   </listitem>
64404  </varlistentry>
64405  <varlistentry>
64406   <term><parameter>allow_dynamic</parameter></term>
64407   <listitem>
64408    <para>
64409     whether we can also take ID from the dynamic range
64410    </para>
64411   </listitem>
64412  </varlistentry>
64413 </variablelist>
64414</refsect1>
64415<refsect1>
64416<title>Description</title>
64417<para>
64418   This function allocates a new device minor for from input major namespace.
64419   Caller can request legacy minor by specifying <parameter>legacy_base</parameter> and <parameter>legacy_num</parameter>
64420   parameters and whether ID can be allocated from dynamic range if there are
64421   no free IDs in legacy range.
64422</para>
64423</refsect1>
64424</refentry>
64425
64426<refentry id="API-input-free-minor">
64427<refentryinfo>
64428 <title>LINUX</title>
64429 <productname>Kernel Hackers Manual</productname>
64430 <date>July 2017</date>
64431</refentryinfo>
64432<refmeta>
64433 <refentrytitle><phrase>input_free_minor</phrase></refentrytitle>
64434 <manvolnum>9</manvolnum>
64435 <refmiscinfo class="version">4.4.14</refmiscinfo>
64436</refmeta>
64437<refnamediv>
64438 <refname>input_free_minor</refname>
64439 <refpurpose>
64440     release previously allocated minor
64441 </refpurpose>
64442</refnamediv>
64443<refsynopsisdiv>
64444 <title>Synopsis</title>
64445  <funcsynopsis><funcprototype>
64446   <funcdef>void <function>input_free_minor </function></funcdef>
64447   <paramdef>unsigned int <parameter>minor</parameter></paramdef>
64448  </funcprototype></funcsynopsis>
64449</refsynopsisdiv>
64450<refsect1>
64451 <title>Arguments</title>
64452 <variablelist>
64453  <varlistentry>
64454   <term><parameter>minor</parameter></term>
64455   <listitem>
64456    <para>
64457     minor to be released
64458    </para>
64459   </listitem>
64460  </varlistentry>
64461 </variablelist>
64462</refsect1>
64463<refsect1>
64464<title>Description</title>
64465<para>
64466   This function releases previously allocated input minor so that it can be
64467   reused later.
64468</para>
64469</refsect1>
64470</refentry>
64471
64472<!-- drivers/input/ff-core.c -->
64473<refentry id="API-input-ff-upload">
64474<refentryinfo>
64475 <title>LINUX</title>
64476 <productname>Kernel Hackers Manual</productname>
64477 <date>July 2017</date>
64478</refentryinfo>
64479<refmeta>
64480 <refentrytitle><phrase>input_ff_upload</phrase></refentrytitle>
64481 <manvolnum>9</manvolnum>
64482 <refmiscinfo class="version">4.4.14</refmiscinfo>
64483</refmeta>
64484<refnamediv>
64485 <refname>input_ff_upload</refname>
64486 <refpurpose>
64487  upload effect into force-feedback device
64488 </refpurpose>
64489</refnamediv>
64490<refsynopsisdiv>
64491 <title>Synopsis</title>
64492  <funcsynopsis><funcprototype>
64493   <funcdef>int <function>input_ff_upload </function></funcdef>
64494   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64495   <paramdef>struct ff_effect * <parameter>effect</parameter></paramdef>
64496   <paramdef>struct file * <parameter>file</parameter></paramdef>
64497  </funcprototype></funcsynopsis>
64498</refsynopsisdiv>
64499<refsect1>
64500 <title>Arguments</title>
64501 <variablelist>
64502  <varlistentry>
64503   <term><parameter>dev</parameter></term>
64504   <listitem>
64505    <para>
64506     input device
64507    </para>
64508   </listitem>
64509  </varlistentry>
64510  <varlistentry>
64511   <term><parameter>effect</parameter></term>
64512   <listitem>
64513    <para>
64514     effect to be uploaded
64515    </para>
64516   </listitem>
64517  </varlistentry>
64518  <varlistentry>
64519   <term><parameter>file</parameter></term>
64520   <listitem>
64521    <para>
64522     owner of the effect
64523    </para>
64524   </listitem>
64525  </varlistentry>
64526 </variablelist>
64527</refsect1>
64528</refentry>
64529
64530<refentry id="API-input-ff-erase">
64531<refentryinfo>
64532 <title>LINUX</title>
64533 <productname>Kernel Hackers Manual</productname>
64534 <date>July 2017</date>
64535</refentryinfo>
64536<refmeta>
64537 <refentrytitle><phrase>input_ff_erase</phrase></refentrytitle>
64538 <manvolnum>9</manvolnum>
64539 <refmiscinfo class="version">4.4.14</refmiscinfo>
64540</refmeta>
64541<refnamediv>
64542 <refname>input_ff_erase</refname>
64543 <refpurpose>
64544     erase a force-feedback effect from device
64545 </refpurpose>
64546</refnamediv>
64547<refsynopsisdiv>
64548 <title>Synopsis</title>
64549  <funcsynopsis><funcprototype>
64550   <funcdef>int <function>input_ff_erase </function></funcdef>
64551   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64552   <paramdef>int <parameter>effect_id</parameter></paramdef>
64553   <paramdef>struct file * <parameter>file</parameter></paramdef>
64554  </funcprototype></funcsynopsis>
64555</refsynopsisdiv>
64556<refsect1>
64557 <title>Arguments</title>
64558 <variablelist>
64559  <varlistentry>
64560   <term><parameter>dev</parameter></term>
64561   <listitem>
64562    <para>
64563     input device to erase effect from
64564    </para>
64565   </listitem>
64566  </varlistentry>
64567  <varlistentry>
64568   <term><parameter>effect_id</parameter></term>
64569   <listitem>
64570    <para>
64571     id of the effect to be erased
64572    </para>
64573   </listitem>
64574  </varlistentry>
64575  <varlistentry>
64576   <term><parameter>file</parameter></term>
64577   <listitem>
64578    <para>
64579     purported owner of the request
64580    </para>
64581   </listitem>
64582  </varlistentry>
64583 </variablelist>
64584</refsect1>
64585<refsect1>
64586<title>Description</title>
64587<para>
64588   This function erases a force-feedback effect from specified device.
64589   The effect will only be erased if it was uploaded through the same
64590   file handle that is requesting erase.
64591</para>
64592</refsect1>
64593</refentry>
64594
64595<refentry id="API-input-ff-event">
64596<refentryinfo>
64597 <title>LINUX</title>
64598 <productname>Kernel Hackers Manual</productname>
64599 <date>July 2017</date>
64600</refentryinfo>
64601<refmeta>
64602 <refentrytitle><phrase>input_ff_event</phrase></refentrytitle>
64603 <manvolnum>9</manvolnum>
64604 <refmiscinfo class="version">4.4.14</refmiscinfo>
64605</refmeta>
64606<refnamediv>
64607 <refname>input_ff_event</refname>
64608 <refpurpose>
64609     generic handler for force-feedback events
64610 </refpurpose>
64611</refnamediv>
64612<refsynopsisdiv>
64613 <title>Synopsis</title>
64614  <funcsynopsis><funcprototype>
64615   <funcdef>int <function>input_ff_event </function></funcdef>
64616   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64617   <paramdef>unsigned int <parameter>type</parameter></paramdef>
64618   <paramdef>unsigned int <parameter>code</parameter></paramdef>
64619   <paramdef>int <parameter>value</parameter></paramdef>
64620  </funcprototype></funcsynopsis>
64621</refsynopsisdiv>
64622<refsect1>
64623 <title>Arguments</title>
64624 <variablelist>
64625  <varlistentry>
64626   <term><parameter>dev</parameter></term>
64627   <listitem>
64628    <para>
64629     input device to send the effect to
64630    </para>
64631   </listitem>
64632  </varlistentry>
64633  <varlistentry>
64634   <term><parameter>type</parameter></term>
64635   <listitem>
64636    <para>
64637     event type (anything but EV_FF is ignored)
64638    </para>
64639   </listitem>
64640  </varlistentry>
64641  <varlistentry>
64642   <term><parameter>code</parameter></term>
64643   <listitem>
64644    <para>
64645     event code
64646    </para>
64647   </listitem>
64648  </varlistentry>
64649  <varlistentry>
64650   <term><parameter>value</parameter></term>
64651   <listitem>
64652    <para>
64653     event value
64654    </para>
64655   </listitem>
64656  </varlistentry>
64657 </variablelist>
64658</refsect1>
64659</refentry>
64660
64661<refentry id="API-input-ff-create">
64662<refentryinfo>
64663 <title>LINUX</title>
64664 <productname>Kernel Hackers Manual</productname>
64665 <date>July 2017</date>
64666</refentryinfo>
64667<refmeta>
64668 <refentrytitle><phrase>input_ff_create</phrase></refentrytitle>
64669 <manvolnum>9</manvolnum>
64670 <refmiscinfo class="version">4.4.14</refmiscinfo>
64671</refmeta>
64672<refnamediv>
64673 <refname>input_ff_create</refname>
64674 <refpurpose>
64675     create force-feedback device
64676 </refpurpose>
64677</refnamediv>
64678<refsynopsisdiv>
64679 <title>Synopsis</title>
64680  <funcsynopsis><funcprototype>
64681   <funcdef>int <function>input_ff_create </function></funcdef>
64682   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64683   <paramdef>unsigned int <parameter>max_effects</parameter></paramdef>
64684  </funcprototype></funcsynopsis>
64685</refsynopsisdiv>
64686<refsect1>
64687 <title>Arguments</title>
64688 <variablelist>
64689  <varlistentry>
64690   <term><parameter>dev</parameter></term>
64691   <listitem>
64692    <para>
64693     input device supporting force-feedback
64694    </para>
64695   </listitem>
64696  </varlistentry>
64697  <varlistentry>
64698   <term><parameter>max_effects</parameter></term>
64699   <listitem>
64700    <para>
64701     maximum number of effects supported by the device
64702    </para>
64703   </listitem>
64704  </varlistentry>
64705 </variablelist>
64706</refsect1>
64707<refsect1>
64708<title>Description</title>
64709<para>
64710   This function allocates all necessary memory for a force feedback
64711   portion of an input device and installs all default handlers.
64712   <parameter>dev</parameter>-&gt;ffbit should be already set up before calling this function.
64713   Once ff device is created you need to setup its upload, erase,
64714   playback and other handlers before registering input device
64715</para>
64716</refsect1>
64717</refentry>
64718
64719<refentry id="API-input-ff-destroy">
64720<refentryinfo>
64721 <title>LINUX</title>
64722 <productname>Kernel Hackers Manual</productname>
64723 <date>July 2017</date>
64724</refentryinfo>
64725<refmeta>
64726 <refentrytitle><phrase>input_ff_destroy</phrase></refentrytitle>
64727 <manvolnum>9</manvolnum>
64728 <refmiscinfo class="version">4.4.14</refmiscinfo>
64729</refmeta>
64730<refnamediv>
64731 <refname>input_ff_destroy</refname>
64732 <refpurpose>
64733     frees force feedback portion of input device
64734 </refpurpose>
64735</refnamediv>
64736<refsynopsisdiv>
64737 <title>Synopsis</title>
64738  <funcsynopsis><funcprototype>
64739   <funcdef>void <function>input_ff_destroy </function></funcdef>
64740   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64741  </funcprototype></funcsynopsis>
64742</refsynopsisdiv>
64743<refsect1>
64744 <title>Arguments</title>
64745 <variablelist>
64746  <varlistentry>
64747   <term><parameter>dev</parameter></term>
64748   <listitem>
64749    <para>
64750     input device supporting force feedback
64751    </para>
64752   </listitem>
64753  </varlistentry>
64754 </variablelist>
64755</refsect1>
64756<refsect1>
64757<title>Description</title>
64758<para>
64759   This function is only needed in error path as input core will
64760   automatically free force feedback structures when device is
64761   destroyed.
64762</para>
64763</refsect1>
64764</refentry>
64765
64766<!-- drivers/input/ff-memless.c -->
64767<refentry id="API-input-ff-create-memless">
64768<refentryinfo>
64769 <title>LINUX</title>
64770 <productname>Kernel Hackers Manual</productname>
64771 <date>July 2017</date>
64772</refentryinfo>
64773<refmeta>
64774 <refentrytitle><phrase>input_ff_create_memless</phrase></refentrytitle>
64775 <manvolnum>9</manvolnum>
64776 <refmiscinfo class="version">4.4.14</refmiscinfo>
64777</refmeta>
64778<refnamediv>
64779 <refname>input_ff_create_memless</refname>
64780 <refpurpose>
64781  create memoryless force-feedback device
64782 </refpurpose>
64783</refnamediv>
64784<refsynopsisdiv>
64785 <title>Synopsis</title>
64786  <funcsynopsis><funcprototype>
64787   <funcdef>int <function>input_ff_create_memless </function></funcdef>
64788   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
64789   <paramdef>void * <parameter>data</parameter></paramdef>
64790   <paramdef>int (*<parameter>play_effect</parameter>)
64791     <funcparams>struct input_dev *, void *, struct ff_effect *</funcparams></paramdef>
64792  </funcprototype></funcsynopsis>
64793</refsynopsisdiv>
64794<refsect1>
64795 <title>Arguments</title>
64796 <variablelist>
64797  <varlistentry>
64798   <term><parameter>dev</parameter></term>
64799   <listitem>
64800    <para>
64801     input device supporting force-feedback
64802    </para>
64803   </listitem>
64804  </varlistentry>
64805  <varlistentry>
64806   <term><parameter>data</parameter></term>
64807   <listitem>
64808    <para>
64809     driver-specific data to be passed into <parameter>play_effect</parameter>
64810    </para>
64811   </listitem>
64812  </varlistentry>
64813  <varlistentry>
64814   <term><parameter>play_effect</parameter></term>
64815   <listitem>
64816    <para>
64817     driver-specific method for playing FF effect
64818    </para>
64819   </listitem>
64820  </varlistentry>
64821 </variablelist>
64822</refsect1>
64823</refentry>
64824
64825     </sect1>
64826     <sect1><title>Multitouch Library</title>
64827<!-- include/linux/input/mt.h -->
64828<refentry id="API-struct-input-mt-slot">
64829<refentryinfo>
64830 <title>LINUX</title>
64831 <productname>Kernel Hackers Manual</productname>
64832 <date>July 2017</date>
64833</refentryinfo>
64834<refmeta>
64835 <refentrytitle><phrase>struct input_mt_slot</phrase></refentrytitle>
64836 <manvolnum>9</manvolnum>
64837 <refmiscinfo class="version">4.4.14</refmiscinfo>
64838</refmeta>
64839<refnamediv>
64840 <refname>struct input_mt_slot</refname>
64841 <refpurpose>
64842  represents the state of an input MT slot
64843 </refpurpose>
64844</refnamediv>
64845<refsynopsisdiv>
64846 <title>Synopsis</title>
64847  <programlisting>
64848struct input_mt_slot {
64849  int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
64850  unsigned int frame;
64851  unsigned int key;
64852};  </programlisting>
64853</refsynopsisdiv>
64854 <refsect1>
64855  <title>Members</title>
64856  <variablelist>
64857    <varlistentry>      <term>abs[ABS_MT_LAST - ABS_MT_FIRST + 1]</term>
64858      <listitem><para>
64859holds current values of ABS_MT axes for this slot
64860      </para></listitem>
64861    </varlistentry>
64862    <varlistentry>      <term>frame</term>
64863      <listitem><para>
64864last frame at which <function><link linkend="API-input-mt-report-slot-state">input_mt_report_slot_state</link></function> was called
64865      </para></listitem>
64866    </varlistentry>
64867    <varlistentry>      <term>key</term>
64868      <listitem><para>
64869optional driver designation of this slot
64870      </para></listitem>
64871    </varlistentry>
64872  </variablelist>
64873 </refsect1>
64874</refentry>
64875
64876<refentry id="API-struct-input-mt">
64877<refentryinfo>
64878 <title>LINUX</title>
64879 <productname>Kernel Hackers Manual</productname>
64880 <date>July 2017</date>
64881</refentryinfo>
64882<refmeta>
64883 <refentrytitle><phrase>struct input_mt</phrase></refentrytitle>
64884 <manvolnum>9</manvolnum>
64885 <refmiscinfo class="version">4.4.14</refmiscinfo>
64886</refmeta>
64887<refnamediv>
64888 <refname>struct input_mt</refname>
64889 <refpurpose>
64890     state of tracked contacts
64891 </refpurpose>
64892</refnamediv>
64893<refsynopsisdiv>
64894 <title>Synopsis</title>
64895  <programlisting>
64896struct input_mt {
64897  int trkid;
64898  int num_slots;
64899  int slot;
64900  unsigned int flags;
64901  unsigned int frame;
64902  int * red;
64903  struct input_mt_slot slots[];
64904};  </programlisting>
64905</refsynopsisdiv>
64906 <refsect1>
64907  <title>Members</title>
64908  <variablelist>
64909    <varlistentry>      <term>trkid</term>
64910      <listitem><para>
64911   stores MT tracking ID for the next contact
64912      </para></listitem>
64913    </varlistentry>
64914    <varlistentry>      <term>num_slots</term>
64915      <listitem><para>
64916   number of MT slots the device uses
64917      </para></listitem>
64918    </varlistentry>
64919    <varlistentry>      <term>slot</term>
64920      <listitem><para>
64921   MT slot currently being transmitted
64922      </para></listitem>
64923    </varlistentry>
64924    <varlistentry>      <term>flags</term>
64925      <listitem><para>
64926   input_mt operation flags
64927      </para></listitem>
64928    </varlistentry>
64929    <varlistentry>      <term>frame</term>
64930      <listitem><para>
64931   increases every time <function><link linkend="API-input-mt-sync-frame">input_mt_sync_frame</link></function> is called
64932      </para></listitem>
64933    </varlistentry>
64934    <varlistentry>      <term>red</term>
64935      <listitem><para>
64936   reduced cost matrix for in-kernel tracking
64937      </para></listitem>
64938    </varlistentry>
64939    <varlistentry>      <term>slots[]</term>
64940      <listitem><para>
64941   array of slots holding current values of tracked contacts
64942      </para></listitem>
64943    </varlistentry>
64944  </variablelist>
64945 </refsect1>
64946</refentry>
64947
64948<refentry id="API-struct-input-mt-pos">
64949<refentryinfo>
64950 <title>LINUX</title>
64951 <productname>Kernel Hackers Manual</productname>
64952 <date>July 2017</date>
64953</refentryinfo>
64954<refmeta>
64955 <refentrytitle><phrase>struct input_mt_pos</phrase></refentrytitle>
64956 <manvolnum>9</manvolnum>
64957 <refmiscinfo class="version">4.4.14</refmiscinfo>
64958</refmeta>
64959<refnamediv>
64960 <refname>struct input_mt_pos</refname>
64961 <refpurpose>
64962     contact position
64963 </refpurpose>
64964</refnamediv>
64965<refsynopsisdiv>
64966 <title>Synopsis</title>
64967  <programlisting>
64968struct input_mt_pos {
64969  s16 x;
64970  s16 y;
64971};  </programlisting>
64972</refsynopsisdiv>
64973 <refsect1>
64974  <title>Members</title>
64975  <variablelist>
64976    <varlistentry>      <term>x</term>
64977      <listitem><para>
64978   horizontal coordinate
64979      </para></listitem>
64980    </varlistentry>
64981    <varlistentry>      <term>y</term>
64982      <listitem><para>
64983   vertical coordinate
64984      </para></listitem>
64985    </varlistentry>
64986  </variablelist>
64987 </refsect1>
64988</refentry>
64989
64990<!-- drivers/input/input-mt.c -->
64991<refentry id="API-input-mt-init-slots">
64992<refentryinfo>
64993 <title>LINUX</title>
64994 <productname>Kernel Hackers Manual</productname>
64995 <date>July 2017</date>
64996</refentryinfo>
64997<refmeta>
64998 <refentrytitle><phrase>input_mt_init_slots</phrase></refentrytitle>
64999 <manvolnum>9</manvolnum>
65000 <refmiscinfo class="version">4.4.14</refmiscinfo>
65001</refmeta>
65002<refnamediv>
65003 <refname>input_mt_init_slots</refname>
65004 <refpurpose>
65005  initialize MT input slots
65006 </refpurpose>
65007</refnamediv>
65008<refsynopsisdiv>
65009 <title>Synopsis</title>
65010  <funcsynopsis><funcprototype>
65011   <funcdef>int <function>input_mt_init_slots </function></funcdef>
65012   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65013   <paramdef>unsigned int <parameter>num_slots</parameter></paramdef>
65014   <paramdef>unsigned int <parameter>flags</parameter></paramdef>
65015  </funcprototype></funcsynopsis>
65016</refsynopsisdiv>
65017<refsect1>
65018 <title>Arguments</title>
65019 <variablelist>
65020  <varlistentry>
65021   <term><parameter>dev</parameter></term>
65022   <listitem>
65023    <para>
65024     input device supporting MT events and finger tracking
65025    </para>
65026   </listitem>
65027  </varlistentry>
65028  <varlistentry>
65029   <term><parameter>num_slots</parameter></term>
65030   <listitem>
65031    <para>
65032     number of slots used by the device
65033    </para>
65034   </listitem>
65035  </varlistentry>
65036  <varlistentry>
65037   <term><parameter>flags</parameter></term>
65038   <listitem>
65039    <para>
65040     mt tasks to handle in core
65041    </para>
65042   </listitem>
65043  </varlistentry>
65044 </variablelist>
65045</refsect1>
65046<refsect1>
65047<title>Description</title>
65048<para>
65049   This function allocates all necessary memory for MT slot handling
65050   in the input device, prepares the ABS_MT_SLOT and
65051   ABS_MT_TRACKING_ID events for use and sets up appropriate buffers.
65052   Depending on the flags set, it also performs pointer emulation and
65053   frame synchronization.
65054   </para><para>
65055
65056   May be called repeatedly. Returns -EINVAL if attempting to
65057   reinitialize with a different number of slots.
65058</para>
65059</refsect1>
65060</refentry>
65061
65062<refentry id="API-input-mt-destroy-slots">
65063<refentryinfo>
65064 <title>LINUX</title>
65065 <productname>Kernel Hackers Manual</productname>
65066 <date>July 2017</date>
65067</refentryinfo>
65068<refmeta>
65069 <refentrytitle><phrase>input_mt_destroy_slots</phrase></refentrytitle>
65070 <manvolnum>9</manvolnum>
65071 <refmiscinfo class="version">4.4.14</refmiscinfo>
65072</refmeta>
65073<refnamediv>
65074 <refname>input_mt_destroy_slots</refname>
65075 <refpurpose>
65076     frees the MT slots of the input device
65077 </refpurpose>
65078</refnamediv>
65079<refsynopsisdiv>
65080 <title>Synopsis</title>
65081  <funcsynopsis><funcprototype>
65082   <funcdef>void <function>input_mt_destroy_slots </function></funcdef>
65083   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65084  </funcprototype></funcsynopsis>
65085</refsynopsisdiv>
65086<refsect1>
65087 <title>Arguments</title>
65088 <variablelist>
65089  <varlistentry>
65090   <term><parameter>dev</parameter></term>
65091   <listitem>
65092    <para>
65093     input device with allocated MT slots
65094    </para>
65095   </listitem>
65096  </varlistentry>
65097 </variablelist>
65098</refsect1>
65099<refsect1>
65100<title>Description</title>
65101<para>
65102   This function is only needed in error path as the input core will
65103   automatically free the MT slots when the device is destroyed.
65104</para>
65105</refsect1>
65106</refentry>
65107
65108<refentry id="API-input-mt-report-slot-state">
65109<refentryinfo>
65110 <title>LINUX</title>
65111 <productname>Kernel Hackers Manual</productname>
65112 <date>July 2017</date>
65113</refentryinfo>
65114<refmeta>
65115 <refentrytitle><phrase>input_mt_report_slot_state</phrase></refentrytitle>
65116 <manvolnum>9</manvolnum>
65117 <refmiscinfo class="version">4.4.14</refmiscinfo>
65118</refmeta>
65119<refnamediv>
65120 <refname>input_mt_report_slot_state</refname>
65121 <refpurpose>
65122     report contact state
65123 </refpurpose>
65124</refnamediv>
65125<refsynopsisdiv>
65126 <title>Synopsis</title>
65127  <funcsynopsis><funcprototype>
65128   <funcdef>void <function>input_mt_report_slot_state </function></funcdef>
65129   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65130   <paramdef>unsigned int <parameter>tool_type</parameter></paramdef>
65131   <paramdef>bool <parameter>active</parameter></paramdef>
65132  </funcprototype></funcsynopsis>
65133</refsynopsisdiv>
65134<refsect1>
65135 <title>Arguments</title>
65136 <variablelist>
65137  <varlistentry>
65138   <term><parameter>dev</parameter></term>
65139   <listitem>
65140    <para>
65141     input device with allocated MT slots
65142    </para>
65143   </listitem>
65144  </varlistentry>
65145  <varlistentry>
65146   <term><parameter>tool_type</parameter></term>
65147   <listitem>
65148    <para>
65149     the tool type to use in this slot
65150    </para>
65151   </listitem>
65152  </varlistentry>
65153  <varlistentry>
65154   <term><parameter>active</parameter></term>
65155   <listitem>
65156    <para>
65157     true if contact is active, false otherwise
65158    </para>
65159   </listitem>
65160  </varlistentry>
65161 </variablelist>
65162</refsect1>
65163<refsect1>
65164<title>Description</title>
65165<para>
65166   Reports a contact via ABS_MT_TRACKING_ID, and optionally
65167   ABS_MT_TOOL_TYPE. If active is true and the slot is currently
65168   inactive, or if the tool type is changed, a new tracking id is
65169   assigned to the slot. The tool type is only reported if the
65170   corresponding absbit field is set.
65171</para>
65172</refsect1>
65173</refentry>
65174
65175<refentry id="API-input-mt-report-finger-count">
65176<refentryinfo>
65177 <title>LINUX</title>
65178 <productname>Kernel Hackers Manual</productname>
65179 <date>July 2017</date>
65180</refentryinfo>
65181<refmeta>
65182 <refentrytitle><phrase>input_mt_report_finger_count</phrase></refentrytitle>
65183 <manvolnum>9</manvolnum>
65184 <refmiscinfo class="version">4.4.14</refmiscinfo>
65185</refmeta>
65186<refnamediv>
65187 <refname>input_mt_report_finger_count</refname>
65188 <refpurpose>
65189     report contact count
65190 </refpurpose>
65191</refnamediv>
65192<refsynopsisdiv>
65193 <title>Synopsis</title>
65194  <funcsynopsis><funcprototype>
65195   <funcdef>void <function>input_mt_report_finger_count </function></funcdef>
65196   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65197   <paramdef>int <parameter>count</parameter></paramdef>
65198  </funcprototype></funcsynopsis>
65199</refsynopsisdiv>
65200<refsect1>
65201 <title>Arguments</title>
65202 <variablelist>
65203  <varlistentry>
65204   <term><parameter>dev</parameter></term>
65205   <listitem>
65206    <para>
65207     input device with allocated MT slots
65208    </para>
65209   </listitem>
65210  </varlistentry>
65211  <varlistentry>
65212   <term><parameter>count</parameter></term>
65213   <listitem>
65214    <para>
65215     the number of contacts
65216    </para>
65217   </listitem>
65218  </varlistentry>
65219 </variablelist>
65220</refsect1>
65221<refsect1>
65222<title>Description</title>
65223<para>
65224   Reports the contact count via BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP,
65225   BTN_TOOL_TRIPLETAP and BTN_TOOL_QUADTAP.
65226   </para><para>
65227
65228   The input core ensures only the KEY events already setup for
65229   this device will produce output.
65230</para>
65231</refsect1>
65232</refentry>
65233
65234<refentry id="API-input-mt-report-pointer-emulation">
65235<refentryinfo>
65236 <title>LINUX</title>
65237 <productname>Kernel Hackers Manual</productname>
65238 <date>July 2017</date>
65239</refentryinfo>
65240<refmeta>
65241 <refentrytitle><phrase>input_mt_report_pointer_emulation</phrase></refentrytitle>
65242 <manvolnum>9</manvolnum>
65243 <refmiscinfo class="version">4.4.14</refmiscinfo>
65244</refmeta>
65245<refnamediv>
65246 <refname>input_mt_report_pointer_emulation</refname>
65247 <refpurpose>
65248     common pointer emulation
65249 </refpurpose>
65250</refnamediv>
65251<refsynopsisdiv>
65252 <title>Synopsis</title>
65253  <funcsynopsis><funcprototype>
65254   <funcdef>void <function>input_mt_report_pointer_emulation </function></funcdef>
65255   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65256   <paramdef>bool <parameter>use_count</parameter></paramdef>
65257  </funcprototype></funcsynopsis>
65258</refsynopsisdiv>
65259<refsect1>
65260 <title>Arguments</title>
65261 <variablelist>
65262  <varlistentry>
65263   <term><parameter>dev</parameter></term>
65264   <listitem>
65265    <para>
65266     input device with allocated MT slots
65267    </para>
65268   </listitem>
65269  </varlistentry>
65270  <varlistentry>
65271   <term><parameter>use_count</parameter></term>
65272   <listitem>
65273    <para>
65274     report number of active contacts as finger count
65275    </para>
65276   </listitem>
65277  </varlistentry>
65278 </variablelist>
65279</refsect1>
65280<refsect1>
65281<title>Description</title>
65282<para>
65283   Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y and
65284   ABS_PRESSURE. Touchpad finger count is emulated if use_count is true.
65285   </para><para>
65286
65287   The input core ensures only the KEY and ABS axes already setup for
65288   this device will produce output.
65289</para>
65290</refsect1>
65291</refentry>
65292
65293<refentry id="API-input-mt-drop-unused">
65294<refentryinfo>
65295 <title>LINUX</title>
65296 <productname>Kernel Hackers Manual</productname>
65297 <date>July 2017</date>
65298</refentryinfo>
65299<refmeta>
65300 <refentrytitle><phrase>input_mt_drop_unused</phrase></refentrytitle>
65301 <manvolnum>9</manvolnum>
65302 <refmiscinfo class="version">4.4.14</refmiscinfo>
65303</refmeta>
65304<refnamediv>
65305 <refname>input_mt_drop_unused</refname>
65306 <refpurpose>
65307     Inactivate slots not seen in this frame
65308 </refpurpose>
65309</refnamediv>
65310<refsynopsisdiv>
65311 <title>Synopsis</title>
65312  <funcsynopsis><funcprototype>
65313   <funcdef>void <function>input_mt_drop_unused </function></funcdef>
65314   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65315  </funcprototype></funcsynopsis>
65316</refsynopsisdiv>
65317<refsect1>
65318 <title>Arguments</title>
65319 <variablelist>
65320  <varlistentry>
65321   <term><parameter>dev</parameter></term>
65322   <listitem>
65323    <para>
65324     input device with allocated MT slots
65325    </para>
65326   </listitem>
65327  </varlistentry>
65328 </variablelist>
65329</refsect1>
65330<refsect1>
65331<title>Description</title>
65332<para>
65333   Lift all slots not seen since the last call to this function.
65334</para>
65335</refsect1>
65336</refentry>
65337
65338<refentry id="API-input-mt-sync-frame">
65339<refentryinfo>
65340 <title>LINUX</title>
65341 <productname>Kernel Hackers Manual</productname>
65342 <date>July 2017</date>
65343</refentryinfo>
65344<refmeta>
65345 <refentrytitle><phrase>input_mt_sync_frame</phrase></refentrytitle>
65346 <manvolnum>9</manvolnum>
65347 <refmiscinfo class="version">4.4.14</refmiscinfo>
65348</refmeta>
65349<refnamediv>
65350 <refname>input_mt_sync_frame</refname>
65351 <refpurpose>
65352     synchronize mt frame
65353 </refpurpose>
65354</refnamediv>
65355<refsynopsisdiv>
65356 <title>Synopsis</title>
65357  <funcsynopsis><funcprototype>
65358   <funcdef>void <function>input_mt_sync_frame </function></funcdef>
65359   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65360  </funcprototype></funcsynopsis>
65361</refsynopsisdiv>
65362<refsect1>
65363 <title>Arguments</title>
65364 <variablelist>
65365  <varlistentry>
65366   <term><parameter>dev</parameter></term>
65367   <listitem>
65368    <para>
65369     input device with allocated MT slots
65370    </para>
65371   </listitem>
65372  </varlistentry>
65373 </variablelist>
65374</refsect1>
65375<refsect1>
65376<title>Description</title>
65377<para>
65378   Close the frame and prepare the internal state for a new one.
65379   Depending on the flags, marks unused slots as inactive and performs
65380   pointer emulation.
65381</para>
65382</refsect1>
65383</refentry>
65384
65385<refentry id="API-input-mt-assign-slots">
65386<refentryinfo>
65387 <title>LINUX</title>
65388 <productname>Kernel Hackers Manual</productname>
65389 <date>July 2017</date>
65390</refentryinfo>
65391<refmeta>
65392 <refentrytitle><phrase>input_mt_assign_slots</phrase></refentrytitle>
65393 <manvolnum>9</manvolnum>
65394 <refmiscinfo class="version">4.4.14</refmiscinfo>
65395</refmeta>
65396<refnamediv>
65397 <refname>input_mt_assign_slots</refname>
65398 <refpurpose>
65399     perform a best-match assignment
65400 </refpurpose>
65401</refnamediv>
65402<refsynopsisdiv>
65403 <title>Synopsis</title>
65404  <funcsynopsis><funcprototype>
65405   <funcdef>int <function>input_mt_assign_slots </function></funcdef>
65406   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65407   <paramdef>int * <parameter>slots</parameter></paramdef>
65408   <paramdef><link linkend="API-struct-input-mt-pos">const struct input_mt_pos</link> * <parameter>pos</parameter></paramdef>
65409   <paramdef>int <parameter>num_pos</parameter></paramdef>
65410   <paramdef>int <parameter>dmax</parameter></paramdef>
65411  </funcprototype></funcsynopsis>
65412</refsynopsisdiv>
65413<refsect1>
65414 <title>Arguments</title>
65415 <variablelist>
65416  <varlistentry>
65417   <term><parameter>dev</parameter></term>
65418   <listitem>
65419    <para>
65420     input device with allocated MT slots
65421    </para>
65422   </listitem>
65423  </varlistentry>
65424  <varlistentry>
65425   <term><parameter>slots</parameter></term>
65426   <listitem>
65427    <para>
65428     the slot assignment to be filled
65429    </para>
65430   </listitem>
65431  </varlistentry>
65432  <varlistentry>
65433   <term><parameter>pos</parameter></term>
65434   <listitem>
65435    <para>
65436     the position array to match
65437    </para>
65438   </listitem>
65439  </varlistentry>
65440  <varlistentry>
65441   <term><parameter>num_pos</parameter></term>
65442   <listitem>
65443    <para>
65444     number of positions
65445    </para>
65446   </listitem>
65447  </varlistentry>
65448  <varlistentry>
65449   <term><parameter>dmax</parameter></term>
65450   <listitem>
65451    <para>
65452     maximum ABS_MT_POSITION displacement (zero for infinite)
65453    </para>
65454   </listitem>
65455  </varlistentry>
65456 </variablelist>
65457</refsect1>
65458<refsect1>
65459<title>Description</title>
65460<para>
65461   Performs a best match against the current contacts and returns
65462   the slot assignment list. New contacts are assigned to unused
65463   slots.
65464   </para><para>
65465
65466   The assignments are balanced so that all coordinate displacements are
65467   below the euclidian distance dmax. If no such assignment can be found,
65468   some contacts are assigned to unused slots.
65469   </para><para>
65470
65471   Returns zero on success, or negative error in case of failure.
65472</para>
65473</refsect1>
65474</refentry>
65475
65476<refentry id="API-input-mt-get-slot-by-key">
65477<refentryinfo>
65478 <title>LINUX</title>
65479 <productname>Kernel Hackers Manual</productname>
65480 <date>July 2017</date>
65481</refentryinfo>
65482<refmeta>
65483 <refentrytitle><phrase>input_mt_get_slot_by_key</phrase></refentrytitle>
65484 <manvolnum>9</manvolnum>
65485 <refmiscinfo class="version">4.4.14</refmiscinfo>
65486</refmeta>
65487<refnamediv>
65488 <refname>input_mt_get_slot_by_key</refname>
65489 <refpurpose>
65490     return slot matching key
65491 </refpurpose>
65492</refnamediv>
65493<refsynopsisdiv>
65494 <title>Synopsis</title>
65495  <funcsynopsis><funcprototype>
65496   <funcdef>int <function>input_mt_get_slot_by_key </function></funcdef>
65497   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
65498   <paramdef>int <parameter>key</parameter></paramdef>
65499  </funcprototype></funcsynopsis>
65500</refsynopsisdiv>
65501<refsect1>
65502 <title>Arguments</title>
65503 <variablelist>
65504  <varlistentry>
65505   <term><parameter>dev</parameter></term>
65506   <listitem>
65507    <para>
65508     input device with allocated MT slots
65509    </para>
65510   </listitem>
65511  </varlistentry>
65512  <varlistentry>
65513   <term><parameter>key</parameter></term>
65514   <listitem>
65515    <para>
65516     the key of the sought slot
65517    </para>
65518   </listitem>
65519  </varlistentry>
65520 </variablelist>
65521</refsect1>
65522<refsect1>
65523<title>Description</title>
65524<para>
65525   Returns the slot of the given key, if it exists, otherwise
65526   set the key on the first unused slot and return.
65527   </para><para>
65528
65529   If no available slot can be found, -1 is returned.
65530   Note that for this function to work properly, <function><link linkend="API-input-mt-sync-frame">input_mt_sync_frame</link></function> has
65531   to be called at each frame.
65532</para>
65533</refsect1>
65534</refentry>
65535
65536     </sect1>
65537     <sect1><title>Polled input devices</title>
65538<!-- include/linux/input-polldev.h -->
65539<refentry id="API-struct-input-polled-dev">
65540<refentryinfo>
65541 <title>LINUX</title>
65542 <productname>Kernel Hackers Manual</productname>
65543 <date>July 2017</date>
65544</refentryinfo>
65545<refmeta>
65546 <refentrytitle><phrase>struct input_polled_dev</phrase></refentrytitle>
65547 <manvolnum>9</manvolnum>
65548 <refmiscinfo class="version">4.4.14</refmiscinfo>
65549</refmeta>
65550<refnamediv>
65551 <refname>struct input_polled_dev</refname>
65552 <refpurpose>
65553  simple polled input device
65554 </refpurpose>
65555</refnamediv>
65556<refsynopsisdiv>
65557 <title>Synopsis</title>
65558  <programlisting>
65559struct input_polled_dev {
65560  void * private;
65561  void (* open) (struct input_polled_dev *dev);
65562  void (* close) (struct input_polled_dev *dev);
65563  void (* poll) (struct input_polled_dev *dev);
65564  unsigned int poll_interval;
65565  unsigned int poll_interval_max;
65566  unsigned int poll_interval_min;
65567  struct input_dev * input;
65568};  </programlisting>
65569</refsynopsisdiv>
65570 <refsect1>
65571  <title>Members</title>
65572  <variablelist>
65573    <varlistentry>      <term>private</term>
65574      <listitem><para>
65575private driver data.
65576      </para></listitem>
65577    </varlistentry>
65578    <varlistentry>      <term>open</term>
65579      <listitem><para>
65580driver-supplied method that prepares device for polling
65581(enabled the device and maybe flushes device state).
65582      </para></listitem>
65583    </varlistentry>
65584    <varlistentry>      <term>close</term>
65585      <listitem><para>
65586driver-supplied method that is called when device is no
65587longer being polled. Used to put device into low power mode.
65588      </para></listitem>
65589    </varlistentry>
65590    <varlistentry>      <term>poll</term>
65591      <listitem><para>
65592driver-supplied method that polls the device and posts
65593input events (mandatory).
65594      </para></listitem>
65595    </varlistentry>
65596    <varlistentry>      <term>poll_interval</term>
65597      <listitem><para>
65598specifies how often the <function>poll</function> method should be called.
65599Defaults to 500 msec unless overridden when registering the device.
65600      </para></listitem>
65601    </varlistentry>
65602    <varlistentry>      <term>poll_interval_max</term>
65603      <listitem><para>
65604specifies upper bound for the poll interval.
65605Defaults to the initial value of <parameter>poll_interval</parameter>.
65606      </para></listitem>
65607    </varlistentry>
65608    <varlistentry>      <term>poll_interval_min</term>
65609      <listitem><para>
65610specifies lower bound for the poll interval.
65611Defaults to 0.
65612      </para></listitem>
65613    </varlistentry>
65614    <varlistentry>      <term>input</term>
65615      <listitem><para>
65616input device structure associated with the polled device.
65617Must be properly initialized by the driver (id, name, phys, bits).
65618      </para></listitem>
65619    </varlistentry>
65620  </variablelist>
65621 </refsect1>
65622<refsect1>
65623<title>Description</title>
65624<para>
65625   Polled input device provides a skeleton for supporting simple input
65626   devices that do not raise interrupts but have to be periodically
65627   scanned or polled to detect changes in their state.
65628</para>
65629</refsect1>
65630</refentry>
65631
65632<!-- drivers/input/input-polldev.c -->
65633<refentry id="API-input-allocate-polled-device">
65634<refentryinfo>
65635 <title>LINUX</title>
65636 <productname>Kernel Hackers Manual</productname>
65637 <date>July 2017</date>
65638</refentryinfo>
65639<refmeta>
65640 <refentrytitle><phrase>input_allocate_polled_device</phrase></refentrytitle>
65641 <manvolnum>9</manvolnum>
65642 <refmiscinfo class="version">4.4.14</refmiscinfo>
65643</refmeta>
65644<refnamediv>
65645 <refname>input_allocate_polled_device</refname>
65646 <refpurpose>
65647  allocate memory for polled device
65648 </refpurpose>
65649</refnamediv>
65650<refsynopsisdiv>
65651 <title>Synopsis</title>
65652  <funcsynopsis><funcprototype>
65653   <funcdef><link linkend="API-struct-input-polled-dev">struct input_polled_dev</link> * <function>input_allocate_polled_device </function></funcdef>
65654   <paramdef> <parameter>void</parameter></paramdef>
65655  </funcprototype></funcsynopsis>
65656</refsynopsisdiv>
65657<refsect1>
65658 <title>Arguments</title>
65659 <variablelist>
65660  <varlistentry>
65661   <term><parameter>void</parameter></term>
65662   <listitem>
65663    <para>
65664     no arguments
65665    </para>
65666   </listitem>
65667  </varlistentry>
65668 </variablelist>
65669</refsect1>
65670<refsect1>
65671<title>Description</title>
65672<para>
65673   </para><para>
65674
65675   The function allocates memory for a polled device and also
65676   for an input device associated with this polled device.
65677</para>
65678</refsect1>
65679</refentry>
65680
65681<refentry id="API-devm-input-allocate-polled-device">
65682<refentryinfo>
65683 <title>LINUX</title>
65684 <productname>Kernel Hackers Manual</productname>
65685 <date>July 2017</date>
65686</refentryinfo>
65687<refmeta>
65688 <refentrytitle><phrase>devm_input_allocate_polled_device</phrase></refentrytitle>
65689 <manvolnum>9</manvolnum>
65690 <refmiscinfo class="version">4.4.14</refmiscinfo>
65691</refmeta>
65692<refnamediv>
65693 <refname>devm_input_allocate_polled_device</refname>
65694 <refpurpose>
65695     allocate managed polled device
65696 </refpurpose>
65697</refnamediv>
65698<refsynopsisdiv>
65699 <title>Synopsis</title>
65700  <funcsynopsis><funcprototype>
65701   <funcdef><link linkend="API-struct-input-polled-dev">struct input_polled_dev</link> * <function>devm_input_allocate_polled_device </function></funcdef>
65702   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
65703  </funcprototype></funcsynopsis>
65704</refsynopsisdiv>
65705<refsect1>
65706 <title>Arguments</title>
65707 <variablelist>
65708  <varlistentry>
65709   <term><parameter>dev</parameter></term>
65710   <listitem>
65711    <para>
65712     device owning the polled device being created
65713    </para>
65714   </listitem>
65715  </varlistentry>
65716 </variablelist>
65717</refsect1>
65718<refsect1>
65719<title>Description</title>
65720<para>
65721   Returns prepared <structname><link linkend="API-struct-input-polled-dev">struct input_polled_dev</link></structname> or <constant>NULL</constant>.
65722   </para><para>
65723
65724   Managed polled input devices do not need to be explicitly unregistered
65725   or freed as it will be done automatically when owner device unbinds
65726   from * its driver (or binding fails). Once such managed polled device
65727   is allocated, it is ready to be set up and registered in the same
65728   fashion as regular polled input devices (using
65729   <function><link linkend="API-input-register-polled-device">input_register_polled_device</link></function> function).
65730   </para><para>
65731
65732   If you want to manually unregister and free such managed polled devices,
65733   it can be still done by calling <function><link linkend="API-input-unregister-polled-device">input_unregister_polled_device</link></function> and
65734   <function><link linkend="API-input-free-polled-device">input_free_polled_device</link></function>, although it is rarely needed.
65735</para>
65736</refsect1>
65737<refsect1>
65738<title>NOTE</title>
65739<para>
65740   the owner device is set up as parent of input device and users
65741   should not override it.
65742</para>
65743</refsect1>
65744</refentry>
65745
65746<refentry id="API-input-free-polled-device">
65747<refentryinfo>
65748 <title>LINUX</title>
65749 <productname>Kernel Hackers Manual</productname>
65750 <date>July 2017</date>
65751</refentryinfo>
65752<refmeta>
65753 <refentrytitle><phrase>input_free_polled_device</phrase></refentrytitle>
65754 <manvolnum>9</manvolnum>
65755 <refmiscinfo class="version">4.4.14</refmiscinfo>
65756</refmeta>
65757<refnamediv>
65758 <refname>input_free_polled_device</refname>
65759 <refpurpose>
65760     free memory allocated for polled device
65761 </refpurpose>
65762</refnamediv>
65763<refsynopsisdiv>
65764 <title>Synopsis</title>
65765  <funcsynopsis><funcprototype>
65766   <funcdef>void <function>input_free_polled_device </function></funcdef>
65767   <paramdef><link linkend="API-struct-input-polled-dev">struct input_polled_dev</link> * <parameter>dev</parameter></paramdef>
65768  </funcprototype></funcsynopsis>
65769</refsynopsisdiv>
65770<refsect1>
65771 <title>Arguments</title>
65772 <variablelist>
65773  <varlistentry>
65774   <term><parameter>dev</parameter></term>
65775   <listitem>
65776    <para>
65777     device to free
65778    </para>
65779   </listitem>
65780  </varlistentry>
65781 </variablelist>
65782</refsect1>
65783<refsect1>
65784<title>Description</title>
65785<para>
65786   The function frees memory allocated for polling device and drops
65787   reference to the associated input device.
65788</para>
65789</refsect1>
65790</refentry>
65791
65792<refentry id="API-input-register-polled-device">
65793<refentryinfo>
65794 <title>LINUX</title>
65795 <productname>Kernel Hackers Manual</productname>
65796 <date>July 2017</date>
65797</refentryinfo>
65798<refmeta>
65799 <refentrytitle><phrase>input_register_polled_device</phrase></refentrytitle>
65800 <manvolnum>9</manvolnum>
65801 <refmiscinfo class="version">4.4.14</refmiscinfo>
65802</refmeta>
65803<refnamediv>
65804 <refname>input_register_polled_device</refname>
65805 <refpurpose>
65806     register polled device
65807 </refpurpose>
65808</refnamediv>
65809<refsynopsisdiv>
65810 <title>Synopsis</title>
65811  <funcsynopsis><funcprototype>
65812   <funcdef>int <function>input_register_polled_device </function></funcdef>
65813   <paramdef><link linkend="API-struct-input-polled-dev">struct input_polled_dev</link> * <parameter>dev</parameter></paramdef>
65814  </funcprototype></funcsynopsis>
65815</refsynopsisdiv>
65816<refsect1>
65817 <title>Arguments</title>
65818 <variablelist>
65819  <varlistentry>
65820   <term><parameter>dev</parameter></term>
65821   <listitem>
65822    <para>
65823     device to register
65824    </para>
65825   </listitem>
65826  </varlistentry>
65827 </variablelist>
65828</refsect1>
65829<refsect1>
65830<title>Description</title>
65831<para>
65832   The function registers previously initialized polled input device
65833   with input layer. The device should be allocated with call to
65834   <function><link linkend="API-input-allocate-polled-device">input_allocate_polled_device</link></function>. Callers should also set up <function>poll</function>
65835   method and set up capabilities (id, name, phys, bits) of the
65836   corresponding input_dev structure.
65837</para>
65838</refsect1>
65839</refentry>
65840
65841<refentry id="API-input-unregister-polled-device">
65842<refentryinfo>
65843 <title>LINUX</title>
65844 <productname>Kernel Hackers Manual</productname>
65845 <date>July 2017</date>
65846</refentryinfo>
65847<refmeta>
65848 <refentrytitle><phrase>input_unregister_polled_device</phrase></refentrytitle>
65849 <manvolnum>9</manvolnum>
65850 <refmiscinfo class="version">4.4.14</refmiscinfo>
65851</refmeta>
65852<refnamediv>
65853 <refname>input_unregister_polled_device</refname>
65854 <refpurpose>
65855     unregister polled device
65856 </refpurpose>
65857</refnamediv>
65858<refsynopsisdiv>
65859 <title>Synopsis</title>
65860  <funcsynopsis><funcprototype>
65861   <funcdef>void <function>input_unregister_polled_device </function></funcdef>
65862   <paramdef><link linkend="API-struct-input-polled-dev">struct input_polled_dev</link> * <parameter>dev</parameter></paramdef>
65863  </funcprototype></funcsynopsis>
65864</refsynopsisdiv>
65865<refsect1>
65866 <title>Arguments</title>
65867 <variablelist>
65868  <varlistentry>
65869   <term><parameter>dev</parameter></term>
65870   <listitem>
65871    <para>
65872     device to unregister
65873    </para>
65874   </listitem>
65875  </varlistentry>
65876 </variablelist>
65877</refsect1>
65878<refsect1>
65879<title>Description</title>
65880<para>
65881   The function unregisters previously registered polled input
65882   device from input layer. Polling is stopped and device is
65883   ready to be freed with call to <function><link linkend="API-input-free-polled-device">input_free_polled_device</link></function>.
65884</para>
65885</refsect1>
65886</refentry>
65887
65888     </sect1>
65889     <sect1><title>Matrix keyboars/keypads</title>
65890<!-- include/linux/input/matrix_keypad.h -->
65891<refentry id="API-struct-matrix-keymap-data">
65892<refentryinfo>
65893 <title>LINUX</title>
65894 <productname>Kernel Hackers Manual</productname>
65895 <date>July 2017</date>
65896</refentryinfo>
65897<refmeta>
65898 <refentrytitle><phrase>struct matrix_keymap_data</phrase></refentrytitle>
65899 <manvolnum>9</manvolnum>
65900 <refmiscinfo class="version">4.4.14</refmiscinfo>
65901</refmeta>
65902<refnamediv>
65903 <refname>struct matrix_keymap_data</refname>
65904 <refpurpose>
65905  keymap for matrix keyboards
65906 </refpurpose>
65907</refnamediv>
65908<refsynopsisdiv>
65909 <title>Synopsis</title>
65910  <programlisting>
65911struct matrix_keymap_data {
65912  const uint32_t * keymap;
65913  unsigned int keymap_size;
65914};  </programlisting>
65915</refsynopsisdiv>
65916 <refsect1>
65917  <title>Members</title>
65918  <variablelist>
65919    <varlistentry>      <term>keymap</term>
65920      <listitem><para>
65921pointer to array of uint32 values encoded with <function>KEY</function> macro
65922representing keymap
65923      </para></listitem>
65924    </varlistentry>
65925    <varlistentry>      <term>keymap_size</term>
65926      <listitem><para>
65927number of entries (initialized) in this keymap
65928      </para></listitem>
65929    </varlistentry>
65930  </variablelist>
65931 </refsect1>
65932<refsect1>
65933<title>Description</title>
65934<para>
65935   This structure is supposed to be used by platform code to supply
65936   keymaps to drivers that implement matrix-like keypads/keyboards.
65937</para>
65938</refsect1>
65939</refentry>
65940
65941<refentry id="API-struct-matrix-keypad-platform-data">
65942<refentryinfo>
65943 <title>LINUX</title>
65944 <productname>Kernel Hackers Manual</productname>
65945 <date>July 2017</date>
65946</refentryinfo>
65947<refmeta>
65948 <refentrytitle><phrase>struct matrix_keypad_platform_data</phrase></refentrytitle>
65949 <manvolnum>9</manvolnum>
65950 <refmiscinfo class="version">4.4.14</refmiscinfo>
65951</refmeta>
65952<refnamediv>
65953 <refname>struct matrix_keypad_platform_data</refname>
65954 <refpurpose>
65955     platform-dependent keypad data
65956 </refpurpose>
65957</refnamediv>
65958<refsynopsisdiv>
65959 <title>Synopsis</title>
65960  <programlisting>
65961struct matrix_keypad_platform_data {
65962  const struct matrix_keymap_data * keymap_data;
65963  const unsigned int * row_gpios;
65964  const unsigned int * col_gpios;
65965  unsigned int num_row_gpios;
65966  unsigned int num_col_gpios;
65967  unsigned int col_scan_delay_us;
65968  unsigned int debounce_ms;
65969  unsigned int clustered_irq;
65970  unsigned int clustered_irq_flags;
65971  bool active_low;
65972  bool wakeup;
65973  bool no_autorepeat;
65974};  </programlisting>
65975</refsynopsisdiv>
65976 <refsect1>
65977  <title>Members</title>
65978  <variablelist>
65979    <varlistentry>      <term>keymap_data</term>
65980      <listitem><para>
65981   pointer to <structname><link linkend="API-struct-matrix-keymap-data">matrix_keymap_data</link></structname>
65982      </para></listitem>
65983    </varlistentry>
65984    <varlistentry>      <term>row_gpios</term>
65985      <listitem><para>
65986   pointer to array of gpio numbers representing rows
65987      </para></listitem>
65988    </varlistentry>
65989    <varlistentry>      <term>col_gpios</term>
65990      <listitem><para>
65991   pointer to array of gpio numbers reporesenting colums
65992      </para></listitem>
65993    </varlistentry>
65994    <varlistentry>      <term>num_row_gpios</term>
65995      <listitem><para>
65996   actual number of row gpios used by device
65997      </para></listitem>
65998    </varlistentry>
65999    <varlistentry>      <term>num_col_gpios</term>
66000      <listitem><para>
66001   actual number of col gpios used by device
66002      </para></listitem>
66003    </varlistentry>
66004    <varlistentry>      <term>col_scan_delay_us</term>
66005      <listitem><para>
66006   delay, measured in microseconds, that is
66007   needed before we can keypad after activating column gpio
66008      </para></listitem>
66009    </varlistentry>
66010    <varlistentry>      <term>debounce_ms</term>
66011      <listitem><para>
66012   debounce interval in milliseconds
66013      </para></listitem>
66014    </varlistentry>
66015    <varlistentry>      <term>clustered_irq</term>
66016      <listitem><para>
66017   may be specified if interrupts of all row/column GPIOs
66018   are bundled to one single irq
66019      </para></listitem>
66020    </varlistentry>
66021    <varlistentry>      <term>clustered_irq_flags</term>
66022      <listitem><para>
66023   flags that are needed for the clustered irq
66024      </para></listitem>
66025    </varlistentry>
66026    <varlistentry>      <term>active_low</term>
66027      <listitem><para>
66028   gpio polarity
66029      </para></listitem>
66030    </varlistentry>
66031    <varlistentry>      <term>wakeup</term>
66032      <listitem><para>
66033   controls whether the device should be set up as wakeup
66034   source
66035      </para></listitem>
66036    </varlistentry>
66037    <varlistentry>      <term>no_autorepeat</term>
66038      <listitem><para>
66039   disable key autorepeat
66040      </para></listitem>
66041    </varlistentry>
66042  </variablelist>
66043 </refsect1>
66044<refsect1>
66045<title>Description</title>
66046<para>
66047   This structure represents platform-specific data that use used by
66048   matrix_keypad driver to perform proper initialization.
66049</para>
66050</refsect1>
66051</refentry>
66052
66053<refentry id="API-matrix-keypad-parse-of-params">
66054<refentryinfo>
66055 <title>LINUX</title>
66056 <productname>Kernel Hackers Manual</productname>
66057 <date>July 2017</date>
66058</refentryinfo>
66059<refmeta>
66060 <refentrytitle><phrase>matrix_keypad_parse_of_params</phrase></refentrytitle>
66061 <manvolnum>9</manvolnum>
66062 <refmiscinfo class="version">4.4.14</refmiscinfo>
66063</refmeta>
66064<refnamediv>
66065 <refname>matrix_keypad_parse_of_params</refname>
66066 <refpurpose>
66067     Read parameters from matrix-keypad node
66068 </refpurpose>
66069</refnamediv>
66070<refsynopsisdiv>
66071 <title>Synopsis</title>
66072  <funcsynopsis><funcprototype>
66073   <funcdef>int <function>matrix_keypad_parse_of_params </function></funcdef>
66074   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
66075   <paramdef>unsigned int * <parameter>rows</parameter></paramdef>
66076   <paramdef>unsigned int * <parameter>cols</parameter></paramdef>
66077  </funcprototype></funcsynopsis>
66078</refsynopsisdiv>
66079<refsect1>
66080 <title>Arguments</title>
66081 <variablelist>
66082  <varlistentry>
66083   <term><parameter>dev</parameter></term>
66084   <listitem>
66085    <para>
66086     Device containing of_node
66087    </para>
66088   </listitem>
66089  </varlistentry>
66090  <varlistentry>
66091   <term><parameter>rows</parameter></term>
66092   <listitem>
66093    <para>
66094     Returns number of matrix rows
66095    </para>
66096   </listitem>
66097  </varlistentry>
66098  <varlistentry>
66099   <term><parameter>cols</parameter></term>
66100   <listitem>
66101    <para>
66102     Returns number of matrix columns
66103     <parameter>return</parameter> 0 if OK, &lt;0 on error
66104    </para>
66105   </listitem>
66106  </varlistentry>
66107 </variablelist>
66108</refsect1>
66109</refentry>
66110
66111     </sect1>
66112     <sect1><title>Sparse keymap support</title>
66113<!-- include/linux/input/sparse-keymap.h -->
66114<refentry id="API-struct-key-entry">
66115<refentryinfo>
66116 <title>LINUX</title>
66117 <productname>Kernel Hackers Manual</productname>
66118 <date>July 2017</date>
66119</refentryinfo>
66120<refmeta>
66121 <refentrytitle><phrase>struct key_entry</phrase></refentrytitle>
66122 <manvolnum>9</manvolnum>
66123 <refmiscinfo class="version">4.4.14</refmiscinfo>
66124</refmeta>
66125<refnamediv>
66126 <refname>struct key_entry</refname>
66127 <refpurpose>
66128  keymap entry for use in sparse keymap
66129 </refpurpose>
66130</refnamediv>
66131<refsynopsisdiv>
66132 <title>Synopsis</title>
66133  <programlisting>
66134struct key_entry {
66135  int type;
66136  u32 code;
66137  union {unnamed_union};
66138};  </programlisting>
66139</refsynopsisdiv>
66140 <refsect1>
66141  <title>Members</title>
66142  <variablelist>
66143    <varlistentry>      <term>type</term>
66144      <listitem><para>
66145Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END);
66146drivers are allowed to extend the list with their own
66147private definitions.
66148      </para></listitem>
66149    </varlistentry>
66150    <varlistentry>      <term>code</term>
66151      <listitem><para>
66152Device-specific data identifying the button/switch
66153      </para></listitem>
66154    </varlistentry>
66155    <varlistentry>      <term>{unnamed_union}</term>
66156      <listitem><para>
66157anonymous
66158      </para></listitem>
66159    </varlistentry>
66160  </variablelist>
66161 </refsect1>
66162<refsect1>
66163<title>Description</title>
66164<para>
66165   This structure defines an entry in a sparse keymap used by some
66166   input devices for which traditional table-based approach is not
66167   suitable.
66168</para>
66169</refsect1>
66170</refentry>
66171
66172<!-- drivers/input/sparse-keymap.c -->
66173<refentry id="API-sparse-keymap-entry-from-scancode">
66174<refentryinfo>
66175 <title>LINUX</title>
66176 <productname>Kernel Hackers Manual</productname>
66177 <date>July 2017</date>
66178</refentryinfo>
66179<refmeta>
66180 <refentrytitle><phrase>sparse_keymap_entry_from_scancode</phrase></refentrytitle>
66181 <manvolnum>9</manvolnum>
66182 <refmiscinfo class="version">4.4.14</refmiscinfo>
66183</refmeta>
66184<refnamediv>
66185 <refname>sparse_keymap_entry_from_scancode</refname>
66186 <refpurpose>
66187  perform sparse keymap lookup
66188 </refpurpose>
66189</refnamediv>
66190<refsynopsisdiv>
66191 <title>Synopsis</title>
66192  <funcsynopsis><funcprototype>
66193   <funcdef><link linkend="API-struct-key-entry">struct key_entry</link> * <function>sparse_keymap_entry_from_scancode </function></funcdef>
66194   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
66195   <paramdef>unsigned int <parameter>code</parameter></paramdef>
66196  </funcprototype></funcsynopsis>
66197</refsynopsisdiv>
66198<refsect1>
66199 <title>Arguments</title>
66200 <variablelist>
66201  <varlistentry>
66202   <term><parameter>dev</parameter></term>
66203   <listitem>
66204    <para>
66205     Input device using sparse keymap
66206    </para>
66207   </listitem>
66208  </varlistentry>
66209  <varlistentry>
66210   <term><parameter>code</parameter></term>
66211   <listitem>
66212    <para>
66213     Scan code
66214    </para>
66215   </listitem>
66216  </varlistentry>
66217 </variablelist>
66218</refsect1>
66219<refsect1>
66220<title>Description</title>
66221<para>
66222   This function is used to perform <structname><link linkend="API-struct-key-entry">struct key_entry</link></structname> lookup in an
66223   input device using sparse keymap.
66224</para>
66225</refsect1>
66226</refentry>
66227
66228<refentry id="API-sparse-keymap-entry-from-keycode">
66229<refentryinfo>
66230 <title>LINUX</title>
66231 <productname>Kernel Hackers Manual</productname>
66232 <date>July 2017</date>
66233</refentryinfo>
66234<refmeta>
66235 <refentrytitle><phrase>sparse_keymap_entry_from_keycode</phrase></refentrytitle>
66236 <manvolnum>9</manvolnum>
66237 <refmiscinfo class="version">4.4.14</refmiscinfo>
66238</refmeta>
66239<refnamediv>
66240 <refname>sparse_keymap_entry_from_keycode</refname>
66241 <refpurpose>
66242     perform sparse keymap lookup
66243 </refpurpose>
66244</refnamediv>
66245<refsynopsisdiv>
66246 <title>Synopsis</title>
66247  <funcsynopsis><funcprototype>
66248   <funcdef><link linkend="API-struct-key-entry">struct key_entry</link> * <function>sparse_keymap_entry_from_keycode </function></funcdef>
66249   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
66250   <paramdef>unsigned int <parameter>keycode</parameter></paramdef>
66251  </funcprototype></funcsynopsis>
66252</refsynopsisdiv>
66253<refsect1>
66254 <title>Arguments</title>
66255 <variablelist>
66256  <varlistentry>
66257   <term><parameter>dev</parameter></term>
66258   <listitem>
66259    <para>
66260     Input device using sparse keymap
66261    </para>
66262   </listitem>
66263  </varlistentry>
66264  <varlistentry>
66265   <term><parameter>keycode</parameter></term>
66266   <listitem>
66267    <para>
66268     Key code
66269    </para>
66270   </listitem>
66271  </varlistentry>
66272 </variablelist>
66273</refsect1>
66274<refsect1>
66275<title>Description</title>
66276<para>
66277   This function is used to perform <structname><link linkend="API-struct-key-entry">struct key_entry</link></structname> lookup in an
66278   input device using sparse keymap.
66279</para>
66280</refsect1>
66281</refentry>
66282
66283<refentry id="API-sparse-keymap-setup">
66284<refentryinfo>
66285 <title>LINUX</title>
66286 <productname>Kernel Hackers Manual</productname>
66287 <date>July 2017</date>
66288</refentryinfo>
66289<refmeta>
66290 <refentrytitle><phrase>sparse_keymap_setup</phrase></refentrytitle>
66291 <manvolnum>9</manvolnum>
66292 <refmiscinfo class="version">4.4.14</refmiscinfo>
66293</refmeta>
66294<refnamediv>
66295 <refname>sparse_keymap_setup</refname>
66296 <refpurpose>
66297     set up sparse keymap for an input device
66298 </refpurpose>
66299</refnamediv>
66300<refsynopsisdiv>
66301 <title>Synopsis</title>
66302  <funcsynopsis><funcprototype>
66303   <funcdef>int <function>sparse_keymap_setup </function></funcdef>
66304   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
66305   <paramdef><link linkend="API-struct-key-entry">const struct key_entry</link> * <parameter>keymap</parameter></paramdef>
66306   <paramdef>int (*<parameter>setup</parameter>)
66307     <funcparams>struct input_dev *, struct key_entry *</funcparams></paramdef>
66308  </funcprototype></funcsynopsis>
66309</refsynopsisdiv>
66310<refsect1>
66311 <title>Arguments</title>
66312 <variablelist>
66313  <varlistentry>
66314   <term><parameter>dev</parameter></term>
66315   <listitem>
66316    <para>
66317     Input device
66318    </para>
66319   </listitem>
66320  </varlistentry>
66321  <varlistentry>
66322   <term><parameter>keymap</parameter></term>
66323   <listitem>
66324    <para>
66325     Keymap in form of array of <structname><link linkend="API-struct-key-entry">key_entry</link></structname> structures ending
66326     with <constant>KE_END</constant> type entry
66327    </para>
66328   </listitem>
66329  </varlistentry>
66330  <varlistentry>
66331   <term><parameter>setup</parameter></term>
66332   <listitem>
66333    <para>
66334     Function that can be used to adjust keymap entries
66335     depending on device's deeds, may be <constant>NULL</constant>
66336    </para>
66337   </listitem>
66338  </varlistentry>
66339 </variablelist>
66340</refsect1>
66341<refsect1>
66342<title>Description</title>
66343<para>
66344   The function calculates size and allocates copy of the original
66345   keymap after which sets up input device event bits appropriately.
66346   Before destroying input device allocated keymap should be freed
66347   with a call to <function><link linkend="API-sparse-keymap-free">sparse_keymap_free</link></function>.
66348</para>
66349</refsect1>
66350</refentry>
66351
66352<refentry id="API-sparse-keymap-free">
66353<refentryinfo>
66354 <title>LINUX</title>
66355 <productname>Kernel Hackers Manual</productname>
66356 <date>July 2017</date>
66357</refentryinfo>
66358<refmeta>
66359 <refentrytitle><phrase>sparse_keymap_free</phrase></refentrytitle>
66360 <manvolnum>9</manvolnum>
66361 <refmiscinfo class="version">4.4.14</refmiscinfo>
66362</refmeta>
66363<refnamediv>
66364 <refname>sparse_keymap_free</refname>
66365 <refpurpose>
66366     free memory allocated for sparse keymap
66367 </refpurpose>
66368</refnamediv>
66369<refsynopsisdiv>
66370 <title>Synopsis</title>
66371  <funcsynopsis><funcprototype>
66372   <funcdef>void <function>sparse_keymap_free </function></funcdef>
66373   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
66374  </funcprototype></funcsynopsis>
66375</refsynopsisdiv>
66376<refsect1>
66377 <title>Arguments</title>
66378 <variablelist>
66379  <varlistentry>
66380   <term><parameter>dev</parameter></term>
66381   <listitem>
66382    <para>
66383     Input device using sparse keymap
66384    </para>
66385   </listitem>
66386  </varlistentry>
66387 </variablelist>
66388</refsect1>
66389<refsect1>
66390<title>Description</title>
66391<para>
66392   This function is used to free memory allocated by sparse keymap
66393   in an input device that was set up by <function><link linkend="API-sparse-keymap-setup">sparse_keymap_setup</link></function>.
66394</para>
66395</refsect1>
66396<refsect1>
66397<title>NOTE</title>
66398<para>
66399   It is safe to cal this function while input device is
66400   still registered (however the drivers should care not to try to
66401   use freed keymap and thus have to shut off interrupts/polling
66402   before freeing the keymap).
66403</para>
66404</refsect1>
66405</refentry>
66406
66407<refentry id="API-sparse-keymap-report-entry">
66408<refentryinfo>
66409 <title>LINUX</title>
66410 <productname>Kernel Hackers Manual</productname>
66411 <date>July 2017</date>
66412</refentryinfo>
66413<refmeta>
66414 <refentrytitle><phrase>sparse_keymap_report_entry</phrase></refentrytitle>
66415 <manvolnum>9</manvolnum>
66416 <refmiscinfo class="version">4.4.14</refmiscinfo>
66417</refmeta>
66418<refnamediv>
66419 <refname>sparse_keymap_report_entry</refname>
66420 <refpurpose>
66421     report event corresponding to given key entry
66422 </refpurpose>
66423</refnamediv>
66424<refsynopsisdiv>
66425 <title>Synopsis</title>
66426  <funcsynopsis><funcprototype>
66427   <funcdef>void <function>sparse_keymap_report_entry </function></funcdef>
66428   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
66429   <paramdef><link linkend="API-struct-key-entry">const struct key_entry</link> * <parameter>ke</parameter></paramdef>
66430   <paramdef>unsigned int <parameter>value</parameter></paramdef>
66431   <paramdef>bool <parameter>autorelease</parameter></paramdef>
66432  </funcprototype></funcsynopsis>
66433</refsynopsisdiv>
66434<refsect1>
66435 <title>Arguments</title>
66436 <variablelist>
66437  <varlistentry>
66438   <term><parameter>dev</parameter></term>
66439   <listitem>
66440    <para>
66441     Input device for which event should be reported
66442    </para>
66443   </listitem>
66444  </varlistentry>
66445  <varlistentry>
66446   <term><parameter>ke</parameter></term>
66447   <listitem>
66448    <para>
66449     key entry describing event
66450    </para>
66451   </listitem>
66452  </varlistentry>
66453  <varlistentry>
66454   <term><parameter>value</parameter></term>
66455   <listitem>
66456    <para>
66457     Value that should be reported (ignored by <constant>KE_SW</constant> entries)
66458    </para>
66459   </listitem>
66460  </varlistentry>
66461  <varlistentry>
66462   <term><parameter>autorelease</parameter></term>
66463   <listitem>
66464    <para>
66465     Signals whether release event should be emitted for <constant>KE_KEY</constant>
66466     entries right after reporting press event, ignored by all other
66467     entries
66468    </para>
66469   </listitem>
66470  </varlistentry>
66471 </variablelist>
66472</refsect1>
66473<refsect1>
66474<title>Description</title>
66475<para>
66476   This function is used to report input event described by given
66477   <structname><link linkend="API-struct-key-entry">struct key_entry</link></structname>.
66478</para>
66479</refsect1>
66480</refentry>
66481
66482<refentry id="API-sparse-keymap-report-event">
66483<refentryinfo>
66484 <title>LINUX</title>
66485 <productname>Kernel Hackers Manual</productname>
66486 <date>July 2017</date>
66487</refentryinfo>
66488<refmeta>
66489 <refentrytitle><phrase>sparse_keymap_report_event</phrase></refentrytitle>
66490 <manvolnum>9</manvolnum>
66491 <refmiscinfo class="version">4.4.14</refmiscinfo>
66492</refmeta>
66493<refnamediv>
66494 <refname>sparse_keymap_report_event</refname>
66495 <refpurpose>
66496     report event corresponding to given scancode
66497 </refpurpose>
66498</refnamediv>
66499<refsynopsisdiv>
66500 <title>Synopsis</title>
66501  <funcsynopsis><funcprototype>
66502   <funcdef>bool <function>sparse_keymap_report_event </function></funcdef>
66503   <paramdef><link linkend="API-struct-input-dev">struct input_dev</link> * <parameter>dev</parameter></paramdef>
66504   <paramdef>unsigned int <parameter>code</parameter></paramdef>
66505   <paramdef>unsigned int <parameter>value</parameter></paramdef>
66506   <paramdef>bool <parameter>autorelease</parameter></paramdef>
66507  </funcprototype></funcsynopsis>
66508</refsynopsisdiv>
66509<refsect1>
66510 <title>Arguments</title>
66511 <variablelist>
66512  <varlistentry>
66513   <term><parameter>dev</parameter></term>
66514   <listitem>
66515    <para>
66516     Input device using sparse keymap
66517    </para>
66518   </listitem>
66519  </varlistentry>
66520  <varlistentry>
66521   <term><parameter>code</parameter></term>
66522   <listitem>
66523    <para>
66524     Scan code
66525    </para>
66526   </listitem>
66527  </varlistentry>
66528  <varlistentry>
66529   <term><parameter>value</parameter></term>
66530   <listitem>
66531    <para>
66532     Value that should be reported (ignored by <constant>KE_SW</constant> entries)
66533    </para>
66534   </listitem>
66535  </varlistentry>
66536  <varlistentry>
66537   <term><parameter>autorelease</parameter></term>
66538   <listitem>
66539    <para>
66540     Signals whether release event should be emitted for <constant>KE_KEY</constant>
66541     entries right after reporting press event, ignored by all other
66542     entries
66543    </para>
66544   </listitem>
66545  </varlistentry>
66546 </variablelist>
66547</refsect1>
66548<refsect1>
66549<title>Description</title>
66550<para>
66551   This function is used to perform lookup in an input device using sparse
66552   keymap and report corresponding event. Returns <constant>true</constant> if lookup was
66553   successful and <constant>false</constant> otherwise.
66554</para>
66555</refsect1>
66556</refentry>
66557
66558     </sect1>
66559  </chapter>
66560
66561  <chapter id="spi">
66562      <title>Serial Peripheral Interface (SPI)</title>
66563  <para>
66564	SPI is the "Serial Peripheral Interface", widely used with
66565	embedded systems because it is a simple and efficient
66566	interface:  basically a multiplexed shift register.
66567	Its three signal wires hold a clock (SCK, often in the range
66568	of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
66569	a "Master In, Slave Out" (MISO) data line.
66570	SPI is a full duplex protocol; for each bit shifted out the
66571	MOSI line (one per clock) another is shifted in on the MISO line.
66572	Those bits are assembled into words of various sizes on the
66573	way to and from system memory.
66574	An additional chipselect line is usually active-low (nCS);
66575	four signals are normally used for each peripheral, plus
66576	sometimes an interrupt.
66577  </para>
66578  <para>
66579	The SPI bus facilities listed here provide a generalized
66580	interface to declare SPI busses and devices, manage them
66581	according to the standard Linux driver model, and perform
66582	input/output operations.
66583	At this time, only "master" side interfaces are supported,
66584	where Linux talks to SPI peripherals and does not implement
66585	such a peripheral itself.
66586	(Interfaces to support implementing SPI slaves would
66587	necessarily look different.)
66588  </para>
66589  <para>
66590	The programming interface is structured around two kinds of driver,
66591	and two kinds of device.
66592	A "Controller Driver" abstracts the controller hardware, which may
66593	be as simple as a set of GPIO pins or as complex as a pair of FIFOs
66594	connected to dual DMA engines on the other side of the SPI shift
66595	register (maximizing throughput).  Such drivers bridge between
66596	whatever bus they sit on (often the platform bus) and SPI, and
66597	expose the SPI side of their device as a
66598	<structname><link linkend="API-struct-spi-master">struct spi_master</link></structname>.
66599	SPI devices are children of that master, represented as a
66600	<structname><link linkend="API-struct-spi-device">struct spi_device</link></structname> and manufactured from
66601	<structname><link linkend="API-struct-spi-board-info">struct spi_board_info</link></structname> descriptors which
66602	are usually provided by board-specific initialization code.
66603	A <structname><link linkend="API-struct-spi-driver">struct spi_driver</link></structname> is called a
66604	"Protocol Driver", and is bound to a spi_device using normal
66605	driver model calls.
66606  </para>
66607  <para>
66608	The I/O model is a set of queued messages.  Protocol drivers
66609	submit one or more <structname><link linkend="API-struct-spi-message">struct spi_message</link></structname>
66610	objects, which are processed and completed asynchronously.
66611	(There are synchronous wrappers, however.)  Messages are
66612	built from one or more <structname><link linkend="API-struct-spi-transfer">struct spi_transfer</link></structname>
66613	objects, each of which wraps a full duplex SPI transfer.
66614	A variety of protocol tweaking options are needed, because
66615	different chips adopt very different policies for how they
66616	use the bits transferred with SPI.
66617  </para>
66618<!-- include/linux/spi/spi.h -->
66619<refentry id="API-struct-spi-statistics">
66620<refentryinfo>
66621 <title>LINUX</title>
66622 <productname>Kernel Hackers Manual</productname>
66623 <date>July 2017</date>
66624</refentryinfo>
66625<refmeta>
66626 <refentrytitle><phrase>struct spi_statistics</phrase></refentrytitle>
66627 <manvolnum>9</manvolnum>
66628 <refmiscinfo class="version">4.4.14</refmiscinfo>
66629</refmeta>
66630<refnamediv>
66631 <refname>struct spi_statistics</refname>
66632 <refpurpose>
66633  statistics for spi transfers
66634 </refpurpose>
66635</refnamediv>
66636<refsynopsisdiv>
66637 <title>Synopsis</title>
66638  <programlisting>
66639struct spi_statistics {
66640  spinlock_t lock;
66641  unsigned long messages;
66642  unsigned long transfers;
66643  unsigned long errors;
66644  unsigned long timedout;
66645  unsigned long spi_sync;
66646  unsigned long spi_sync_immediate;
66647  unsigned long spi_async;
66648  unsigned long long bytes;
66649  unsigned long long bytes_rx;
66650  unsigned long long bytes_tx;
66651#define SPI_STATISTICS_HISTO_SIZE 17
66652  unsigned long transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE];
66653};  </programlisting>
66654</refsynopsisdiv>
66655 <refsect1>
66656  <title>Members</title>
66657  <variablelist>
66658    <varlistentry>      <term>lock</term>
66659      <listitem><para>
66660lock protecting this structure
66661      </para></listitem>
66662    </varlistentry>
66663    <varlistentry>      <term>messages</term>
66664      <listitem><para>
66665number of spi-messages handled
66666      </para></listitem>
66667    </varlistentry>
66668    <varlistentry>      <term>transfers</term>
66669      <listitem><para>
66670number of spi_transfers handled
66671      </para></listitem>
66672    </varlistentry>
66673    <varlistentry>      <term>errors</term>
66674      <listitem><para>
66675number of errors during spi_transfer
66676      </para></listitem>
66677    </varlistentry>
66678    <varlistentry>      <term>timedout</term>
66679      <listitem><para>
66680number of timeouts during spi_transfer
66681      </para></listitem>
66682    </varlistentry>
66683    <varlistentry>      <term>spi_sync</term>
66684      <listitem><para>
66685number of times spi_sync is used
66686      </para></listitem>
66687    </varlistentry>
66688    <varlistentry>      <term>spi_sync_immediate</term>
66689      <listitem><para>
66690number of times spi_sync is executed immediately
66691in calling context without queuing and scheduling
66692      </para></listitem>
66693    </varlistentry>
66694    <varlistentry>      <term>spi_async</term>
66695      <listitem><para>
66696number of times spi_async is used
66697      </para></listitem>
66698    </varlistentry>
66699    <varlistentry>      <term>bytes</term>
66700      <listitem><para>
66701number of bytes transferred to/from device
66702      </para></listitem>
66703    </varlistentry>
66704    <varlistentry>      <term>bytes_rx</term>
66705      <listitem><para>
66706number of bytes received from device
66707      </para></listitem>
66708    </varlistentry>
66709    <varlistentry>      <term>bytes_tx</term>
66710      <listitem><para>
66711number of bytes sent to device
66712      </para></listitem>
66713    </varlistentry>
66714    <varlistentry>      <term>transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE]</term>
66715      <listitem><para>
66716transfer bytes histogramm
66717      </para></listitem>
66718    </varlistentry>
66719  </variablelist>
66720 </refsect1>
66721</refentry>
66722
66723<refentry id="API-struct-spi-device">
66724<refentryinfo>
66725 <title>LINUX</title>
66726 <productname>Kernel Hackers Manual</productname>
66727 <date>July 2017</date>
66728</refentryinfo>
66729<refmeta>
66730 <refentrytitle><phrase>struct spi_device</phrase></refentrytitle>
66731 <manvolnum>9</manvolnum>
66732 <refmiscinfo class="version">4.4.14</refmiscinfo>
66733</refmeta>
66734<refnamediv>
66735 <refname>struct spi_device</refname>
66736 <refpurpose>
66737     Master side proxy for an SPI slave device
66738 </refpurpose>
66739</refnamediv>
66740<refsynopsisdiv>
66741 <title>Synopsis</title>
66742  <programlisting>
66743struct spi_device {
66744  struct device dev;
66745  struct spi_master * master;
66746  u32 max_speed_hz;
66747  u8 chip_select;
66748  u8 bits_per_word;
66749  u16 mode;
66750#define SPI_CPHA	0x01
66751#define SPI_CPOL	0x02
66752#define SPI_MODE_0	(0|0)
66753#define SPI_MODE_1	(0|SPI_CPHA)
66754#define SPI_MODE_2	(SPI_CPOL|0)
66755#define SPI_MODE_3	(SPI_CPOL|SPI_CPHA)
66756#define SPI_CS_HIGH	0x04
66757#define SPI_LSB_FIRST	0x08
66758#define SPI_3WIRE	0x10
66759#define SPI_LOOP	0x20
66760#define SPI_NO_CS	0x40
66761#define SPI_READY	0x80
66762#define SPI_TX_DUAL	0x100
66763#define SPI_TX_QUAD	0x200
66764#define SPI_RX_DUAL	0x400
66765#define SPI_RX_QUAD	0x800
66766  int irq;
66767  void * controller_state;
66768  void * controller_data;
66769  char modalias[SPI_NAME_SIZE];
66770  int cs_gpio;
66771  struct spi_statistics statistics;
66772};  </programlisting>
66773</refsynopsisdiv>
66774 <refsect1>
66775  <title>Members</title>
66776  <variablelist>
66777    <varlistentry>      <term>dev</term>
66778      <listitem><para>
66779   Driver model representation of the device.
66780      </para></listitem>
66781    </varlistentry>
66782    <varlistentry>      <term>master</term>
66783      <listitem><para>
66784   SPI controller used with the device.
66785      </para></listitem>
66786    </varlistentry>
66787    <varlistentry>      <term>max_speed_hz</term>
66788      <listitem><para>
66789   Maximum clock rate to be used with this chip
66790   (on this board); may be changed by the device's driver.
66791   The spi_transfer.speed_hz can override this for each transfer.
66792      </para></listitem>
66793    </varlistentry>
66794    <varlistentry>      <term>chip_select</term>
66795      <listitem><para>
66796   Chipselect, distinguishing chips handled by <parameter>master</parameter>.
66797      </para></listitem>
66798    </varlistentry>
66799    <varlistentry>      <term>bits_per_word</term>
66800      <listitem><para>
66801   Data transfers involve one or more words; word sizes
66802   like eight or 12 bits are common.  In-memory wordsizes are
66803   powers of two bytes (e.g. 20 bit samples use 32 bits).
66804   This may be changed by the device's driver, or left at the
66805   default (0) indicating protocol words are eight bit bytes.
66806   The spi_transfer.bits_per_word can override this for each transfer.
66807      </para></listitem>
66808    </varlistentry>
66809    <varlistentry>      <term>mode</term>
66810      <listitem><para>
66811   The spi mode defines how data is clocked out and in.
66812   This may be changed by the device's driver.
66813   The <quote>active low</quote> default for chipselect mode can be overridden
66814   (by specifying SPI_CS_HIGH) as can the <quote>MSB first</quote> default for
66815   each word in a transfer (by specifying SPI_LSB_FIRST).
66816      </para></listitem>
66817    </varlistentry>
66818    <varlistentry>      <term>irq</term>
66819      <listitem><para>
66820   Negative, or the number passed to <function>request_irq</function> to receive
66821   interrupts from this device.
66822      </para></listitem>
66823    </varlistentry>
66824    <varlistentry>      <term>controller_state</term>
66825      <listitem><para>
66826   Controller's runtime state
66827      </para></listitem>
66828    </varlistentry>
66829    <varlistentry>      <term>controller_data</term>
66830      <listitem><para>
66831   Board-specific definitions for controller, such as
66832   FIFO initialization parameters; from board_info.controller_data
66833      </para></listitem>
66834    </varlistentry>
66835    <varlistentry>      <term>modalias[SPI_NAME_SIZE]</term>
66836      <listitem><para>
66837   Name of the driver to use with this device, or an alias
66838   for that name.  This appears in the sysfs <quote>modalias</quote> attribute
66839   for driver coldplugging, and in uevents used for hotplugging
66840      </para></listitem>
66841    </varlistentry>
66842    <varlistentry>      <term>cs_gpio</term>
66843      <listitem><para>
66844   gpio number of the chipselect line (optional, -ENOENT when
66845   when not using a GPIO line)
66846      </para></listitem>
66847    </varlistentry>
66848    <varlistentry>      <term>statistics</term>
66849      <listitem><para>
66850   statistics for the spi_device
66851      </para></listitem>
66852    </varlistentry>
66853  </variablelist>
66854 </refsect1>
66855<refsect1>
66856<title>Description</title>
66857<para>
66858   A <parameter>spi_device</parameter> is used to interchange data between an SPI slave
66859   (usually a discrete chip) and CPU memory.
66860   </para><para>
66861
66862   In <parameter>dev</parameter>, the platform_data is used to hold information about this
66863   device that's meaningful to the device's protocol driver, but not
66864   to its controller.  One example might be an identifier for a chip
66865   variant with slightly different functionality; another might be
66866   information about how this particular board wires the chip's pins.
66867</para>
66868</refsect1>
66869</refentry>
66870
66871<refentry id="API-struct-spi-driver">
66872<refentryinfo>
66873 <title>LINUX</title>
66874 <productname>Kernel Hackers Manual</productname>
66875 <date>July 2017</date>
66876</refentryinfo>
66877<refmeta>
66878 <refentrytitle><phrase>struct spi_driver</phrase></refentrytitle>
66879 <manvolnum>9</manvolnum>
66880 <refmiscinfo class="version">4.4.14</refmiscinfo>
66881</refmeta>
66882<refnamediv>
66883 <refname>struct spi_driver</refname>
66884 <refpurpose>
66885     Host side <quote>protocol</quote> driver
66886 </refpurpose>
66887</refnamediv>
66888<refsynopsisdiv>
66889 <title>Synopsis</title>
66890  <programlisting>
66891struct spi_driver {
66892  const struct spi_device_id * id_table;
66893  int (* probe) (struct spi_device *spi);
66894  int (* remove) (struct spi_device *spi);
66895  void (* shutdown) (struct spi_device *spi);
66896  struct device_driver driver;
66897};  </programlisting>
66898</refsynopsisdiv>
66899 <refsect1>
66900  <title>Members</title>
66901  <variablelist>
66902    <varlistentry>      <term>id_table</term>
66903      <listitem><para>
66904   List of SPI devices supported by this driver
66905      </para></listitem>
66906    </varlistentry>
66907    <varlistentry>      <term>probe</term>
66908      <listitem><para>
66909   Binds this driver to the spi device.  Drivers can verify
66910   that the device is actually present, and may need to configure
66911   characteristics (such as bits_per_word) which weren't needed for
66912   the initial configuration done during system setup.
66913      </para></listitem>
66914    </varlistentry>
66915    <varlistentry>      <term>remove</term>
66916      <listitem><para>
66917   Unbinds this driver from the spi device
66918      </para></listitem>
66919    </varlistentry>
66920    <varlistentry>      <term>shutdown</term>
66921      <listitem><para>
66922   Standard shutdown callback used during system state
66923   transitions such as powerdown/halt and kexec
66924      </para></listitem>
66925    </varlistentry>
66926    <varlistentry>      <term>driver</term>
66927      <listitem><para>
66928   SPI device drivers should initialize the name and owner
66929   field of this structure.
66930      </para></listitem>
66931    </varlistentry>
66932  </variablelist>
66933 </refsect1>
66934<refsect1>
66935<title>Description</title>
66936<para>
66937   This represents the kind of device driver that uses SPI messages to
66938   interact with the hardware at the other end of a SPI link.  It's called
66939   a <quote>protocol</quote> driver because it works through messages rather than talking
66940   directly to SPI hardware (which is what the underlying SPI controller
66941   driver does to pass those messages).  These protocols are defined in the
66942   specification for the device(s) supported by the driver.
66943   </para><para>
66944
66945   As a rule, those device protocols represent the lowest level interface
66946   supported by a driver, and it will support upper level interfaces too.
66947   Examples of such upper levels include frameworks like MTD, networking,
66948   MMC, RTC, filesystem character device nodes, and hardware monitoring.
66949</para>
66950</refsect1>
66951</refentry>
66952
66953<refentry id="API-spi-unregister-driver">
66954<refentryinfo>
66955 <title>LINUX</title>
66956 <productname>Kernel Hackers Manual</productname>
66957 <date>July 2017</date>
66958</refentryinfo>
66959<refmeta>
66960 <refentrytitle><phrase>spi_unregister_driver</phrase></refentrytitle>
66961 <manvolnum>9</manvolnum>
66962 <refmiscinfo class="version">4.4.14</refmiscinfo>
66963</refmeta>
66964<refnamediv>
66965 <refname>spi_unregister_driver</refname>
66966 <refpurpose>
66967     reverse effect of spi_register_driver
66968 </refpurpose>
66969</refnamediv>
66970<refsynopsisdiv>
66971 <title>Synopsis</title>
66972  <funcsynopsis><funcprototype>
66973   <funcdef>void <function>spi_unregister_driver </function></funcdef>
66974   <paramdef><link linkend="API-struct-spi-driver">struct spi_driver</link> * <parameter>sdrv</parameter></paramdef>
66975  </funcprototype></funcsynopsis>
66976</refsynopsisdiv>
66977<refsect1>
66978 <title>Arguments</title>
66979 <variablelist>
66980  <varlistentry>
66981   <term><parameter>sdrv</parameter></term>
66982   <listitem>
66983    <para>
66984     the driver to unregister
66985    </para>
66986   </listitem>
66987  </varlistentry>
66988 </variablelist>
66989</refsect1>
66990<refsect1>
66991<title>Context</title>
66992<para>
66993   can sleep
66994</para>
66995</refsect1>
66996</refentry>
66997
66998<refentry id="API-module-spi-driver">
66999<refentryinfo>
67000 <title>LINUX</title>
67001 <productname>Kernel Hackers Manual</productname>
67002 <date>July 2017</date>
67003</refentryinfo>
67004<refmeta>
67005 <refentrytitle><phrase>module_spi_driver</phrase></refentrytitle>
67006 <manvolnum>9</manvolnum>
67007 <refmiscinfo class="version">4.4.14</refmiscinfo>
67008</refmeta>
67009<refnamediv>
67010 <refname>module_spi_driver</refname>
67011 <refpurpose>
67012     Helper macro for registering a SPI driver
67013 </refpurpose>
67014</refnamediv>
67015<refsynopsisdiv>
67016 <title>Synopsis</title>
67017  <funcsynopsis><funcprototype>
67018   <funcdef> <function>module_spi_driver </function></funcdef>
67019   <paramdef> <parameter>__spi_driver</parameter></paramdef>
67020  </funcprototype></funcsynopsis>
67021</refsynopsisdiv>
67022<refsect1>
67023 <title>Arguments</title>
67024 <variablelist>
67025  <varlistentry>
67026   <term><parameter>__spi_driver</parameter></term>
67027   <listitem>
67028    <para>
67029     spi_driver struct
67030    </para>
67031   </listitem>
67032  </varlistentry>
67033 </variablelist>
67034</refsect1>
67035<refsect1>
67036<title>Description</title>
67037<para>
67038   Helper macro for SPI drivers which do not do anything special in module
67039   init/exit. This eliminates a lot of boilerplate. Each module may only
67040   use this macro once, and calling it replaces <function>module_init</function> and <function>module_exit</function>
67041</para>
67042</refsect1>
67043</refentry>
67044
67045<refentry id="API-struct-spi-master">
67046<refentryinfo>
67047 <title>LINUX</title>
67048 <productname>Kernel Hackers Manual</productname>
67049 <date>July 2017</date>
67050</refentryinfo>
67051<refmeta>
67052 <refentrytitle><phrase>struct spi_master</phrase></refentrytitle>
67053 <manvolnum>9</manvolnum>
67054 <refmiscinfo class="version">4.4.14</refmiscinfo>
67055</refmeta>
67056<refnamediv>
67057 <refname>struct spi_master</refname>
67058 <refpurpose>
67059     interface to SPI master controller
67060 </refpurpose>
67061</refnamediv>
67062<refsynopsisdiv>
67063 <title>Synopsis</title>
67064  <programlisting>
67065struct spi_master {
67066  struct device dev;
67067  struct list_head list;
67068  s16 bus_num;
67069  u16 num_chipselect;
67070  u16 dma_alignment;
67071  u16 mode_bits;
67072  u32 bits_per_word_mask;
67073#define SPI_BPW_MASK(bits) BIT((bits) - 1)
67074#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
67075#define SPI_BPW_RANGE_MASK(min# max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
67076  u32 min_speed_hz;
67077  u32 max_speed_hz;
67078  u16 flags;
67079#define SPI_MASTER_HALF_DUPLEX	BIT(0)
67080#define SPI_MASTER_NO_RX	BIT(1)
67081#define SPI_MASTER_NO_TX	BIT(2)
67082#define SPI_MASTER_MUST_RX      BIT(3)
67083#define SPI_MASTER_MUST_TX      BIT(4)
67084  spinlock_t bus_lock_spinlock;
67085  struct mutex bus_lock_mutex;
67086  bool bus_lock_flag;
67087  int (* setup) (struct spi_device *spi);
67088  int (* transfer) (struct spi_device *spi,struct spi_message *mesg);
67089  void (* cleanup) (struct spi_device *spi);
67090  bool (* can_dma) (struct spi_master *master,struct spi_device *spi,struct spi_transfer *xfer);
67091  bool queued;
67092  struct kthread_worker kworker;
67093  struct task_struct * kworker_task;
67094  struct kthread_work pump_messages;
67095  spinlock_t queue_lock;
67096  struct list_head queue;
67097  struct spi_message * cur_msg;
67098  bool idling;
67099  bool busy;
67100  bool running;
67101  bool rt;
67102  bool auto_runtime_pm;
67103  bool cur_msg_prepared;
67104  bool cur_msg_mapped;
67105  struct completion xfer_completion;
67106  size_t max_dma_len;
67107  int (* prepare_transfer_hardware) (struct spi_master *master);
67108  int (* transfer_one_message) (struct spi_master *master,struct spi_message *mesg);
67109  int (* unprepare_transfer_hardware) (struct spi_master *master);
67110  int (* prepare_message) (struct spi_master *master,struct spi_message *message);
67111  int (* unprepare_message) (struct spi_master *master,struct spi_message *message);
67112  void (* set_cs) (struct spi_device *spi, bool enable);
67113  int (* transfer_one) (struct spi_master *master, struct spi_device *spi,struct spi_transfer *transfer);
67114  void (* handle_err) (struct spi_master *master,struct spi_message *message);
67115  int * cs_gpios;
67116  struct spi_statistics statistics;
67117  struct dma_chan * dma_tx;
67118  struct dma_chan * dma_rx;
67119  void * dummy_rx;
67120  void * dummy_tx;
67121};  </programlisting>
67122</refsynopsisdiv>
67123 <refsect1>
67124  <title>Members</title>
67125  <variablelist>
67126    <varlistentry>      <term>dev</term>
67127      <listitem><para>
67128   device interface to this driver
67129      </para></listitem>
67130    </varlistentry>
67131    <varlistentry>      <term>list</term>
67132      <listitem><para>
67133   link with the global spi_master list
67134      </para></listitem>
67135    </varlistentry>
67136    <varlistentry>      <term>bus_num</term>
67137      <listitem><para>
67138   board-specific (and often SOC-specific) identifier for a
67139   given SPI controller.
67140      </para></listitem>
67141    </varlistentry>
67142    <varlistentry>      <term>num_chipselect</term>
67143      <listitem><para>
67144   chipselects are used to distinguish individual
67145   SPI slaves, and are numbered from zero to num_chipselects.
67146   each slave has a chipselect signal, but it's common that not
67147   every chipselect is connected to a slave.
67148      </para></listitem>
67149    </varlistentry>
67150    <varlistentry>      <term>dma_alignment</term>
67151      <listitem><para>
67152   SPI controller constraint on DMA buffers alignment.
67153      </para></listitem>
67154    </varlistentry>
67155    <varlistentry>      <term>mode_bits</term>
67156      <listitem><para>
67157   flags understood by this controller driver
67158      </para></listitem>
67159    </varlistentry>
67160    <varlistentry>      <term>bits_per_word_mask</term>
67161      <listitem><para>
67162   A mask indicating which values of bits_per_word are
67163   supported by the driver. Bit n indicates that a bits_per_word n+1 is
67164   supported. If set, the SPI core will reject any transfer with an
67165   unsupported bits_per_word. If not set, this value is simply ignored,
67166   and it's up to the individual driver to perform any validation.
67167      </para></listitem>
67168    </varlistentry>
67169    <varlistentry>      <term>min_speed_hz</term>
67170      <listitem><para>
67171   Lowest supported transfer speed
67172      </para></listitem>
67173    </varlistentry>
67174    <varlistentry>      <term>max_speed_hz</term>
67175      <listitem><para>
67176   Highest supported transfer speed
67177      </para></listitem>
67178    </varlistentry>
67179    <varlistentry>      <term>flags</term>
67180      <listitem><para>
67181   other constraints relevant to this driver
67182      </para></listitem>
67183    </varlistentry>
67184    <varlistentry>      <term>bus_lock_spinlock</term>
67185      <listitem><para>
67186   spinlock for SPI bus locking
67187      </para></listitem>
67188    </varlistentry>
67189    <varlistentry>      <term>bus_lock_mutex</term>
67190      <listitem><para>
67191   mutex for SPI bus locking
67192      </para></listitem>
67193    </varlistentry>
67194    <varlistentry>      <term>bus_lock_flag</term>
67195      <listitem><para>
67196   indicates that the SPI bus is locked for exclusive use
67197      </para></listitem>
67198    </varlistentry>
67199    <varlistentry>      <term>setup</term>
67200      <listitem><para>
67201   updates the device mode and clocking records used by a
67202   device's SPI controller; protocol code may call this.  This
67203   must fail if an unrecognized or unsupported mode is requested.
67204   It's always safe to call this unless transfers are pending on
67205   the device whose settings are being modified.
67206      </para></listitem>
67207    </varlistentry>
67208    <varlistentry>      <term>transfer</term>
67209      <listitem><para>
67210   adds a message to the controller's transfer queue.
67211      </para></listitem>
67212    </varlistentry>
67213    <varlistentry>      <term>cleanup</term>
67214      <listitem><para>
67215   frees controller-specific state
67216      </para></listitem>
67217    </varlistentry>
67218    <varlistentry>      <term>can_dma</term>
67219      <listitem><para>
67220   determine whether this master supports DMA
67221      </para></listitem>
67222    </varlistentry>
67223    <varlistentry>      <term>queued</term>
67224      <listitem><para>
67225   whether this master is providing an internal message queue
67226      </para></listitem>
67227    </varlistentry>
67228    <varlistentry>      <term>kworker</term>
67229      <listitem><para>
67230   thread struct for message pump
67231      </para></listitem>
67232    </varlistentry>
67233    <varlistentry>      <term>kworker_task</term>
67234      <listitem><para>
67235   pointer to task for message pump kworker thread
67236      </para></listitem>
67237    </varlistentry>
67238    <varlistentry>      <term>pump_messages</term>
67239      <listitem><para>
67240   work struct for scheduling work to the message pump
67241      </para></listitem>
67242    </varlistentry>
67243    <varlistentry>      <term>queue_lock</term>
67244      <listitem><para>
67245   spinlock to syncronise access to message queue
67246      </para></listitem>
67247    </varlistentry>
67248    <varlistentry>      <term>queue</term>
67249      <listitem><para>
67250   message queue
67251      </para></listitem>
67252    </varlistentry>
67253    <varlistentry>      <term>cur_msg</term>
67254      <listitem><para>
67255   the currently in-flight message
67256      </para></listitem>
67257    </varlistentry>
67258    <varlistentry>      <term>idling</term>
67259      <listitem><para>
67260   the device is entering idle state
67261      </para></listitem>
67262    </varlistentry>
67263    <varlistentry>      <term>busy</term>
67264      <listitem><para>
67265   message pump is busy
67266      </para></listitem>
67267    </varlistentry>
67268    <varlistentry>      <term>running</term>
67269      <listitem><para>
67270   message pump is running
67271      </para></listitem>
67272    </varlistentry>
67273    <varlistentry>      <term>rt</term>
67274      <listitem><para>
67275   whether this queue is set to run as a realtime task
67276      </para></listitem>
67277    </varlistentry>
67278    <varlistentry>      <term>auto_runtime_pm</term>
67279      <listitem><para>
67280   the core should ensure a runtime PM reference is held
67281   while the hardware is prepared, using the parent
67282   device for the spidev
67283      </para></listitem>
67284    </varlistentry>
67285    <varlistentry>      <term>cur_msg_prepared</term>
67286      <listitem><para>
67287   spi_prepare_message was called for the currently
67288   in-flight message
67289      </para></listitem>
67290    </varlistentry>
67291    <varlistentry>      <term>cur_msg_mapped</term>
67292      <listitem><para>
67293   message has been mapped for DMA
67294      </para></listitem>
67295    </varlistentry>
67296    <varlistentry>      <term>xfer_completion</term>
67297      <listitem><para>
67298   used by core <function>transfer_one_message</function>
67299      </para></listitem>
67300    </varlistentry>
67301    <varlistentry>      <term>max_dma_len</term>
67302      <listitem><para>
67303   Maximum length of a DMA transfer for the device.
67304      </para></listitem>
67305    </varlistentry>
67306    <varlistentry>      <term>prepare_transfer_hardware</term>
67307      <listitem><para>
67308   a message will soon arrive from the queue
67309   so the subsystem requests the driver to prepare the transfer hardware
67310   by issuing this call
67311      </para></listitem>
67312    </varlistentry>
67313    <varlistentry>      <term>transfer_one_message</term>
67314      <listitem><para>
67315   the subsystem calls the driver to transfer a single
67316   message while queuing transfers that arrive in the meantime. When the
67317   driver is finished with this message, it must call
67318   <function><link linkend="API-spi-finalize-current-message">spi_finalize_current_message</link></function> so the subsystem can issue the next
67319   message
67320      </para></listitem>
67321    </varlistentry>
67322    <varlistentry>      <term>unprepare_transfer_hardware</term>
67323      <listitem><para>
67324   there are currently no more messages on the
67325   queue so the subsystem notifies the driver that it may relax the
67326   hardware by issuing this call
67327      </para></listitem>
67328    </varlistentry>
67329    <varlistentry>      <term>prepare_message</term>
67330      <listitem><para>
67331   set up the controller to transfer a single message,
67332   for example doing DMA mapping.  Called from threaded
67333   context.
67334      </para></listitem>
67335    </varlistentry>
67336    <varlistentry>      <term>unprepare_message</term>
67337      <listitem><para>
67338   undo any work done by <function>prepare_message</function>.
67339      </para></listitem>
67340    </varlistentry>
67341    <varlistentry>      <term>set_cs</term>
67342      <listitem><para>
67343   set the logic level of the chip select line.  May be called
67344   from interrupt context.
67345      </para></listitem>
67346    </varlistentry>
67347    <varlistentry>      <term>transfer_one</term>
67348      <listitem><para>
67349   transfer a single spi_transfer.
67350   - return 0 if the transfer is finished,
67351   - return 1 if the transfer is still in progress. When
67352   the driver is finished with this transfer it must
67353   call <function><link linkend="API-spi-finalize-current-transfer">spi_finalize_current_transfer</link></function> so the subsystem
67354   can issue the next transfer. Note: transfer_one and
67355   transfer_one_message are mutually exclusive; when both
67356   are set, the generic subsystem does not call your
67357   transfer_one callback.
67358      </para></listitem>
67359    </varlistentry>
67360    <varlistentry>      <term>handle_err</term>
67361      <listitem><para>
67362   the subsystem calls the driver to handle an error that occurs
67363   in the generic implementation of <function>transfer_one_message</function>.
67364      </para></listitem>
67365    </varlistentry>
67366    <varlistentry>      <term>cs_gpios</term>
67367      <listitem><para>
67368   Array of GPIOs to use as chip select lines; one per CS
67369   number. Any individual value may be -ENOENT for CS lines that
67370   are not GPIOs (driven by the SPI controller itself).
67371      </para></listitem>
67372    </varlistentry>
67373    <varlistentry>      <term>statistics</term>
67374      <listitem><para>
67375   statistics for the spi_master
67376      </para></listitem>
67377    </varlistentry>
67378    <varlistentry>      <term>dma_tx</term>
67379      <listitem><para>
67380   DMA transmit channel
67381      </para></listitem>
67382    </varlistentry>
67383    <varlistentry>      <term>dma_rx</term>
67384      <listitem><para>
67385   DMA receive channel
67386      </para></listitem>
67387    </varlistentry>
67388    <varlistentry>      <term>dummy_rx</term>
67389      <listitem><para>
67390   dummy receive buffer for full-duplex devices
67391      </para></listitem>
67392    </varlistentry>
67393    <varlistentry>      <term>dummy_tx</term>
67394      <listitem><para>
67395   dummy transmit buffer for full-duplex devices
67396      </para></listitem>
67397    </varlistentry>
67398  </variablelist>
67399 </refsect1>
67400<refsect1>
67401<title>Description</title>
67402<para>
67403   Each SPI master controller can communicate with one or more <parameter>spi_device</parameter>
67404   children.  These make a small bus, sharing MOSI, MISO and SCK signals
67405   but not chip select signals.  Each device may be configured to use a
67406   different clock rate, since those shared signals are ignored unless
67407   the chip is selected.
67408   </para><para>
67409
67410   The driver for an SPI controller manages access to those devices through
67411   a queue of spi_message transactions, copying data between CPU memory and
67412   an SPI slave device.  For each such message it queues, it calls the
67413   message's completion function when the transaction completes.
67414</para>
67415</refsect1>
67416</refentry>
67417
67418<refentry id="API-struct-spi-transfer">
67419<refentryinfo>
67420 <title>LINUX</title>
67421 <productname>Kernel Hackers Manual</productname>
67422 <date>July 2017</date>
67423</refentryinfo>
67424<refmeta>
67425 <refentrytitle><phrase>struct spi_transfer</phrase></refentrytitle>
67426 <manvolnum>9</manvolnum>
67427 <refmiscinfo class="version">4.4.14</refmiscinfo>
67428</refmeta>
67429<refnamediv>
67430 <refname>struct spi_transfer</refname>
67431 <refpurpose>
67432     a read/write buffer pair
67433 </refpurpose>
67434</refnamediv>
67435<refsynopsisdiv>
67436 <title>Synopsis</title>
67437  <programlisting>
67438struct spi_transfer {
67439  const void * tx_buf;
67440  void * rx_buf;
67441  unsigned len;
67442  dma_addr_t tx_dma;
67443  dma_addr_t rx_dma;
67444  struct sg_table tx_sg;
67445  struct sg_table rx_sg;
67446  unsigned cs_change:1;
67447  unsigned tx_nbits:3;
67448  unsigned rx_nbits:3;
67449#define SPI_NBITS_SINGLE	0x01
67450#define SPI_NBITS_DUAL		0x02
67451#define SPI_NBITS_QUAD		0x04
67452  u8 bits_per_word;
67453  u16 delay_usecs;
67454  u32 speed_hz;
67455  struct list_head transfer_list;
67456};  </programlisting>
67457</refsynopsisdiv>
67458 <refsect1>
67459  <title>Members</title>
67460  <variablelist>
67461    <varlistentry>      <term>tx_buf</term>
67462      <listitem><para>
67463   data to be written (dma-safe memory), or NULL
67464      </para></listitem>
67465    </varlistentry>
67466    <varlistentry>      <term>rx_buf</term>
67467      <listitem><para>
67468   data to be read (dma-safe memory), or NULL
67469      </para></listitem>
67470    </varlistentry>
67471    <varlistentry>      <term>len</term>
67472      <listitem><para>
67473   size of rx and tx buffers (in bytes)
67474      </para></listitem>
67475    </varlistentry>
67476    <varlistentry>      <term>tx_dma</term>
67477      <listitem><para>
67478   DMA address of tx_buf, if <parameter>spi_message</parameter>.is_dma_mapped
67479      </para></listitem>
67480    </varlistentry>
67481    <varlistentry>      <term>rx_dma</term>
67482      <listitem><para>
67483   DMA address of rx_buf, if <parameter>spi_message</parameter>.is_dma_mapped
67484      </para></listitem>
67485    </varlistentry>
67486    <varlistentry>      <term>tx_sg</term>
67487      <listitem><para>
67488   Scatterlist for transmit, currently not for client use
67489      </para></listitem>
67490    </varlistentry>
67491    <varlistentry>      <term>rx_sg</term>
67492      <listitem><para>
67493   Scatterlist for receive, currently not for client use
67494      </para></listitem>
67495    </varlistentry>
67496    <varlistentry>      <term>cs_change</term>
67497      <listitem><para>
67498   affects chipselect after this transfer completes
67499      </para></listitem>
67500    </varlistentry>
67501    <varlistentry>      <term>tx_nbits</term>
67502      <listitem><para>
67503   number of bits used for writing. If 0 the default
67504   (SPI_NBITS_SINGLE) is used.
67505      </para></listitem>
67506    </varlistentry>
67507    <varlistentry>      <term>rx_nbits</term>
67508      <listitem><para>
67509   number of bits used for reading. If 0 the default
67510   (SPI_NBITS_SINGLE) is used.
67511      </para></listitem>
67512    </varlistentry>
67513    <varlistentry>      <term>bits_per_word</term>
67514      <listitem><para>
67515   select a bits_per_word other than the device default
67516   for this transfer. If 0 the default (from <parameter>spi_device</parameter>) is used.
67517      </para></listitem>
67518    </varlistentry>
67519    <varlistentry>      <term>delay_usecs</term>
67520      <listitem><para>
67521   microseconds to delay after this transfer before
67522   (optionally) changing the chipselect status, then starting
67523   the next transfer or completing this <parameter>spi_message</parameter>.
67524      </para></listitem>
67525    </varlistentry>
67526    <varlistentry>      <term>speed_hz</term>
67527      <listitem><para>
67528   Select a speed other than the device default for this
67529   transfer. If 0 the default (from <parameter>spi_device</parameter>) is used.
67530      </para></listitem>
67531    </varlistentry>
67532    <varlistentry>      <term>transfer_list</term>
67533      <listitem><para>
67534   transfers are sequenced through <parameter>spi_message</parameter>.transfers
67535      </para></listitem>
67536    </varlistentry>
67537  </variablelist>
67538 </refsect1>
67539<refsect1>
67540<title>Description</title>
67541<para>
67542   SPI transfers always write the same number of bytes as they read.
67543   Protocol drivers should always provide <parameter>rx_buf</parameter> and/or <parameter>tx_buf</parameter>.
67544   In some cases, they may also want to provide DMA addresses for
67545   the data being transferred; that may reduce overhead, when the
67546   underlying driver uses dma.
67547   </para><para>
67548
67549   If the transmit buffer is null, zeroes will be shifted out
67550   while filling <parameter>rx_buf</parameter>.  If the receive buffer is null, the data
67551   shifted in will be discarded.  Only <quote>len</quote> bytes shift out (or in).
67552   It's an error to try to shift out a partial word.  (For example, by
67553   shifting out three bytes with word size of sixteen or twenty bits;
67554   the former uses two bytes per word, the latter uses four bytes.)
67555   </para><para>
67556
67557   In-memory data values are always in native CPU byte order, translated
67558   from the wire byte order (big-endian except with SPI_LSB_FIRST).  So
67559   for example when bits_per_word is sixteen, buffers are 2N bytes long
67560   (<parameter>len</parameter> = 2N) and hold N sixteen bit words in CPU byte order.
67561   </para><para>
67562
67563   When the word size of the SPI transfer is not a power-of-two multiple
67564   of eight bits, those in-memory words include extra bits.  In-memory
67565   words are always seen by protocol drivers as right-justified, so the
67566   undefined (rx) or unused (tx) bits are always the most significant bits.
67567   </para><para>
67568
67569   All SPI transfers start with the relevant chipselect active.  Normally
67570   it stays selected until after the last transfer in a message.  Drivers
67571   can affect the chipselect signal using cs_change.
67572   </para><para>
67573
67574   (i) If the transfer isn't the last one in the message, this flag is
67575   used to make the chipselect briefly go inactive in the middle of the
67576   message.  Toggling chipselect in this way may be needed to terminate
67577   a chip command, letting a single spi_message perform all of group of
67578   chip transactions together.
67579   </para><para>
67580
67581   (ii) When the transfer is the last one in the message, the chip may
67582   stay selected until the next transfer.  On multi-device SPI busses
67583   with nothing blocking messages going to other devices, this is just
67584   a performance hint; starting a message to another device deselects
67585   this one.  But in other cases, this can be used to ensure correctness.
67586   Some devices need protocol transactions to be built from a series of
67587   spi_message submissions, where the content of one message is determined
67588   by the results of previous messages and where the whole transaction
67589   ends when the chipselect goes intactive.
67590   </para><para>
67591
67592   When SPI can transfer in 1x,2x or 4x. It can get this transfer information
67593   from device through <parameter>tx_nbits</parameter> and <parameter>rx_nbits</parameter>. In Bi-direction, these
67594   two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
67595   SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
67596   </para><para>
67597
67598   The code that submits an spi_message (and its spi_transfers)
67599   to the lower layers is responsible for managing its memory.
67600   Zero-initialize every field you don't set up explicitly, to
67601   insulate against future API updates.  After you submit a message
67602   and its transfers, ignore them until its completion callback.
67603</para>
67604</refsect1>
67605</refentry>
67606
67607<refentry id="API-struct-spi-message">
67608<refentryinfo>
67609 <title>LINUX</title>
67610 <productname>Kernel Hackers Manual</productname>
67611 <date>July 2017</date>
67612</refentryinfo>
67613<refmeta>
67614 <refentrytitle><phrase>struct spi_message</phrase></refentrytitle>
67615 <manvolnum>9</manvolnum>
67616 <refmiscinfo class="version">4.4.14</refmiscinfo>
67617</refmeta>
67618<refnamediv>
67619 <refname>struct spi_message</refname>
67620 <refpurpose>
67621     one multi-segment SPI transaction
67622 </refpurpose>
67623</refnamediv>
67624<refsynopsisdiv>
67625 <title>Synopsis</title>
67626  <programlisting>
67627struct spi_message {
67628  struct list_head transfers;
67629  struct spi_device * spi;
67630  unsigned is_dma_mapped:1;
67631  void (* complete) (void *context);
67632  void * context;
67633  unsigned frame_length;
67634  unsigned actual_length;
67635  int status;
67636  struct list_head queue;
67637  void * state;
67638};  </programlisting>
67639</refsynopsisdiv>
67640 <refsect1>
67641  <title>Members</title>
67642  <variablelist>
67643    <varlistentry>      <term>transfers</term>
67644      <listitem><para>
67645   list of transfer segments in this transaction
67646      </para></listitem>
67647    </varlistentry>
67648    <varlistentry>      <term>spi</term>
67649      <listitem><para>
67650   SPI device to which the transaction is queued
67651      </para></listitem>
67652    </varlistentry>
67653    <varlistentry>      <term>is_dma_mapped</term>
67654      <listitem><para>
67655   if true, the caller provided both dma and cpu virtual
67656   addresses for each transfer buffer
67657      </para></listitem>
67658    </varlistentry>
67659    <varlistentry>      <term>complete</term>
67660      <listitem><para>
67661   called to report transaction completions
67662      </para></listitem>
67663    </varlistentry>
67664    <varlistentry>      <term>context</term>
67665      <listitem><para>
67666   the argument to <function>complete</function> when it's called
67667      </para></listitem>
67668    </varlistentry>
67669    <varlistentry>      <term>frame_length</term>
67670      <listitem><para>
67671   the total number of bytes in the message
67672      </para></listitem>
67673    </varlistentry>
67674    <varlistentry>      <term>actual_length</term>
67675      <listitem><para>
67676   the total number of bytes that were transferred in all
67677   successful segments
67678      </para></listitem>
67679    </varlistentry>
67680    <varlistentry>      <term>status</term>
67681      <listitem><para>
67682   zero for success, else negative errno
67683      </para></listitem>
67684    </varlistentry>
67685    <varlistentry>      <term>queue</term>
67686      <listitem><para>
67687   for use by whichever driver currently owns the message
67688      </para></listitem>
67689    </varlistentry>
67690    <varlistentry>      <term>state</term>
67691      <listitem><para>
67692   for use by whichever driver currently owns the message
67693      </para></listitem>
67694    </varlistentry>
67695  </variablelist>
67696 </refsect1>
67697<refsect1>
67698<title>Description</title>
67699<para>
67700   A <parameter>spi_message</parameter> is used to execute an atomic sequence of data transfers,
67701   each represented by a struct spi_transfer.  The sequence is <quote>atomic</quote>
67702   in the sense that no other spi_message may use that SPI bus until that
67703   sequence completes.  On some systems, many such sequences can execute as
67704   as single programmed DMA transfer.  On all systems, these messages are
67705   queued, and might complete after transactions to other devices.  Messages
67706   sent to a given spi_device are always executed in FIFO order.
67707   </para><para>
67708
67709   The code that submits an spi_message (and its spi_transfers)
67710   to the lower layers is responsible for managing its memory.
67711   Zero-initialize every field you don't set up explicitly, to
67712   insulate against future API updates.  After you submit a message
67713   and its transfers, ignore them until its completion callback.
67714</para>
67715</refsect1>
67716</refentry>
67717
67718<refentry id="API-spi-message-init-with-transfers">
67719<refentryinfo>
67720 <title>LINUX</title>
67721 <productname>Kernel Hackers Manual</productname>
67722 <date>July 2017</date>
67723</refentryinfo>
67724<refmeta>
67725 <refentrytitle><phrase>spi_message_init_with_transfers</phrase></refentrytitle>
67726 <manvolnum>9</manvolnum>
67727 <refmiscinfo class="version">4.4.14</refmiscinfo>
67728</refmeta>
67729<refnamediv>
67730 <refname>spi_message_init_with_transfers</refname>
67731 <refpurpose>
67732     Initialize spi_message and append transfers
67733 </refpurpose>
67734</refnamediv>
67735<refsynopsisdiv>
67736 <title>Synopsis</title>
67737  <funcsynopsis><funcprototype>
67738   <funcdef>void <function>spi_message_init_with_transfers </function></funcdef>
67739   <paramdef><link linkend="API-struct-spi-message">struct spi_message</link> * <parameter>m</parameter></paramdef>
67740   <paramdef><link linkend="API-struct-spi-transfer">struct spi_transfer</link> * <parameter>xfers</parameter></paramdef>
67741   <paramdef>unsigned int <parameter>num_xfers</parameter></paramdef>
67742  </funcprototype></funcsynopsis>
67743</refsynopsisdiv>
67744<refsect1>
67745 <title>Arguments</title>
67746 <variablelist>
67747  <varlistentry>
67748   <term><parameter>m</parameter></term>
67749   <listitem>
67750    <para>
67751     spi_message to be initialized
67752    </para>
67753   </listitem>
67754  </varlistentry>
67755  <varlistentry>
67756   <term><parameter>xfers</parameter></term>
67757   <listitem>
67758    <para>
67759     An array of spi transfers
67760    </para>
67761   </listitem>
67762  </varlistentry>
67763  <varlistentry>
67764   <term><parameter>num_xfers</parameter></term>
67765   <listitem>
67766    <para>
67767     Number of items in the xfer array
67768    </para>
67769   </listitem>
67770  </varlistentry>
67771 </variablelist>
67772</refsect1>
67773<refsect1>
67774<title>Description</title>
67775<para>
67776   This function initializes the given spi_message and adds each spi_transfer in
67777   the given array to the message.
67778</para>
67779</refsect1>
67780</refentry>
67781
67782<refentry id="API-spi-write">
67783<refentryinfo>
67784 <title>LINUX</title>
67785 <productname>Kernel Hackers Manual</productname>
67786 <date>July 2017</date>
67787</refentryinfo>
67788<refmeta>
67789 <refentrytitle><phrase>spi_write</phrase></refentrytitle>
67790 <manvolnum>9</manvolnum>
67791 <refmiscinfo class="version">4.4.14</refmiscinfo>
67792</refmeta>
67793<refnamediv>
67794 <refname>spi_write</refname>
67795 <refpurpose>
67796     SPI synchronous write
67797 </refpurpose>
67798</refnamediv>
67799<refsynopsisdiv>
67800 <title>Synopsis</title>
67801  <funcsynopsis><funcprototype>
67802   <funcdef>int <function>spi_write </function></funcdef>
67803   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
67804   <paramdef>const void * <parameter>buf</parameter></paramdef>
67805   <paramdef>size_t <parameter>len</parameter></paramdef>
67806  </funcprototype></funcsynopsis>
67807</refsynopsisdiv>
67808<refsect1>
67809 <title>Arguments</title>
67810 <variablelist>
67811  <varlistentry>
67812   <term><parameter>spi</parameter></term>
67813   <listitem>
67814    <para>
67815     device to which data will be written
67816    </para>
67817   </listitem>
67818  </varlistentry>
67819  <varlistentry>
67820   <term><parameter>buf</parameter></term>
67821   <listitem>
67822    <para>
67823     data buffer
67824    </para>
67825   </listitem>
67826  </varlistentry>
67827  <varlistentry>
67828   <term><parameter>len</parameter></term>
67829   <listitem>
67830    <para>
67831     data buffer size
67832    </para>
67833   </listitem>
67834  </varlistentry>
67835 </variablelist>
67836</refsect1>
67837<refsect1>
67838<title>Context</title>
67839<para>
67840   can sleep
67841</para>
67842</refsect1>
67843<refsect1>
67844<title>Description</title>
67845<para>
67846   This function writes the buffer <parameter>buf</parameter>.
67847   Callable only from contexts that can sleep.
67848</para>
67849</refsect1>
67850<refsect1>
67851<title>Return</title>
67852<para>
67853   zero on success, else a negative error code.
67854</para>
67855</refsect1>
67856</refentry>
67857
67858<refentry id="API-spi-read">
67859<refentryinfo>
67860 <title>LINUX</title>
67861 <productname>Kernel Hackers Manual</productname>
67862 <date>July 2017</date>
67863</refentryinfo>
67864<refmeta>
67865 <refentrytitle><phrase>spi_read</phrase></refentrytitle>
67866 <manvolnum>9</manvolnum>
67867 <refmiscinfo class="version">4.4.14</refmiscinfo>
67868</refmeta>
67869<refnamediv>
67870 <refname>spi_read</refname>
67871 <refpurpose>
67872     SPI synchronous read
67873 </refpurpose>
67874</refnamediv>
67875<refsynopsisdiv>
67876 <title>Synopsis</title>
67877  <funcsynopsis><funcprototype>
67878   <funcdef>int <function>spi_read </function></funcdef>
67879   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
67880   <paramdef>void * <parameter>buf</parameter></paramdef>
67881   <paramdef>size_t <parameter>len</parameter></paramdef>
67882  </funcprototype></funcsynopsis>
67883</refsynopsisdiv>
67884<refsect1>
67885 <title>Arguments</title>
67886 <variablelist>
67887  <varlistentry>
67888   <term><parameter>spi</parameter></term>
67889   <listitem>
67890    <para>
67891     device from which data will be read
67892    </para>
67893   </listitem>
67894  </varlistentry>
67895  <varlistentry>
67896   <term><parameter>buf</parameter></term>
67897   <listitem>
67898    <para>
67899     data buffer
67900    </para>
67901   </listitem>
67902  </varlistentry>
67903  <varlistentry>
67904   <term><parameter>len</parameter></term>
67905   <listitem>
67906    <para>
67907     data buffer size
67908    </para>
67909   </listitem>
67910  </varlistentry>
67911 </variablelist>
67912</refsect1>
67913<refsect1>
67914<title>Context</title>
67915<para>
67916   can sleep
67917</para>
67918</refsect1>
67919<refsect1>
67920<title>Description</title>
67921<para>
67922   This function reads the buffer <parameter>buf</parameter>.
67923   Callable only from contexts that can sleep.
67924</para>
67925</refsect1>
67926<refsect1>
67927<title>Return</title>
67928<para>
67929   zero on success, else a negative error code.
67930</para>
67931</refsect1>
67932</refentry>
67933
67934<refentry id="API-spi-sync-transfer">
67935<refentryinfo>
67936 <title>LINUX</title>
67937 <productname>Kernel Hackers Manual</productname>
67938 <date>July 2017</date>
67939</refentryinfo>
67940<refmeta>
67941 <refentrytitle><phrase>spi_sync_transfer</phrase></refentrytitle>
67942 <manvolnum>9</manvolnum>
67943 <refmiscinfo class="version">4.4.14</refmiscinfo>
67944</refmeta>
67945<refnamediv>
67946 <refname>spi_sync_transfer</refname>
67947 <refpurpose>
67948     synchronous SPI data transfer
67949 </refpurpose>
67950</refnamediv>
67951<refsynopsisdiv>
67952 <title>Synopsis</title>
67953  <funcsynopsis><funcprototype>
67954   <funcdef>int <function>spi_sync_transfer </function></funcdef>
67955   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
67956   <paramdef><link linkend="API-struct-spi-transfer">struct spi_transfer</link> * <parameter>xfers</parameter></paramdef>
67957   <paramdef>unsigned int <parameter>num_xfers</parameter></paramdef>
67958  </funcprototype></funcsynopsis>
67959</refsynopsisdiv>
67960<refsect1>
67961 <title>Arguments</title>
67962 <variablelist>
67963  <varlistentry>
67964   <term><parameter>spi</parameter></term>
67965   <listitem>
67966    <para>
67967     device with which data will be exchanged
67968    </para>
67969   </listitem>
67970  </varlistentry>
67971  <varlistentry>
67972   <term><parameter>xfers</parameter></term>
67973   <listitem>
67974    <para>
67975     An array of spi_transfers
67976    </para>
67977   </listitem>
67978  </varlistentry>
67979  <varlistentry>
67980   <term><parameter>num_xfers</parameter></term>
67981   <listitem>
67982    <para>
67983     Number of items in the xfer array
67984    </para>
67985   </listitem>
67986  </varlistentry>
67987 </variablelist>
67988</refsect1>
67989<refsect1>
67990<title>Context</title>
67991<para>
67992   can sleep
67993</para>
67994</refsect1>
67995<refsect1>
67996<title>Description</title>
67997<para>
67998   Does a synchronous SPI data transfer of the given spi_transfer array.
67999   </para><para>
68000
68001   For more specific semantics see <function><link linkend="API-spi-sync">spi_sync</link></function>.
68002</para>
68003</refsect1>
68004<refsect1>
68005<title>Return</title>
68006<para>
68007   Return: zero on success, else a negative error code.
68008</para>
68009</refsect1>
68010</refentry>
68011
68012<refentry id="API-spi-w8r8">
68013<refentryinfo>
68014 <title>LINUX</title>
68015 <productname>Kernel Hackers Manual</productname>
68016 <date>July 2017</date>
68017</refentryinfo>
68018<refmeta>
68019 <refentrytitle><phrase>spi_w8r8</phrase></refentrytitle>
68020 <manvolnum>9</manvolnum>
68021 <refmiscinfo class="version">4.4.14</refmiscinfo>
68022</refmeta>
68023<refnamediv>
68024 <refname>spi_w8r8</refname>
68025 <refpurpose>
68026     SPI synchronous 8 bit write followed by 8 bit read
68027 </refpurpose>
68028</refnamediv>
68029<refsynopsisdiv>
68030 <title>Synopsis</title>
68031  <funcsynopsis><funcprototype>
68032   <funcdef>ssize_t <function>spi_w8r8 </function></funcdef>
68033   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
68034   <paramdef>u8 <parameter>cmd</parameter></paramdef>
68035  </funcprototype></funcsynopsis>
68036</refsynopsisdiv>
68037<refsect1>
68038 <title>Arguments</title>
68039 <variablelist>
68040  <varlistentry>
68041   <term><parameter>spi</parameter></term>
68042   <listitem>
68043    <para>
68044     device with which data will be exchanged
68045    </para>
68046   </listitem>
68047  </varlistentry>
68048  <varlistentry>
68049   <term><parameter>cmd</parameter></term>
68050   <listitem>
68051    <para>
68052     command to be written before data is read back
68053    </para>
68054   </listitem>
68055  </varlistentry>
68056 </variablelist>
68057</refsect1>
68058<refsect1>
68059<title>Context</title>
68060<para>
68061   can sleep
68062</para>
68063</refsect1>
68064<refsect1>
68065<title>Description</title>
68066<para>
68067   Callable only from contexts that can sleep.
68068</para>
68069</refsect1>
68070<refsect1>
68071<title>Return</title>
68072<para>
68073   the (unsigned) eight bit number returned by the
68074   device, or else a negative error code.
68075</para>
68076</refsect1>
68077</refentry>
68078
68079<refentry id="API-spi-w8r16">
68080<refentryinfo>
68081 <title>LINUX</title>
68082 <productname>Kernel Hackers Manual</productname>
68083 <date>July 2017</date>
68084</refentryinfo>
68085<refmeta>
68086 <refentrytitle><phrase>spi_w8r16</phrase></refentrytitle>
68087 <manvolnum>9</manvolnum>
68088 <refmiscinfo class="version">4.4.14</refmiscinfo>
68089</refmeta>
68090<refnamediv>
68091 <refname>spi_w8r16</refname>
68092 <refpurpose>
68093     SPI synchronous 8 bit write followed by 16 bit read
68094 </refpurpose>
68095</refnamediv>
68096<refsynopsisdiv>
68097 <title>Synopsis</title>
68098  <funcsynopsis><funcprototype>
68099   <funcdef>ssize_t <function>spi_w8r16 </function></funcdef>
68100   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
68101   <paramdef>u8 <parameter>cmd</parameter></paramdef>
68102  </funcprototype></funcsynopsis>
68103</refsynopsisdiv>
68104<refsect1>
68105 <title>Arguments</title>
68106 <variablelist>
68107  <varlistentry>
68108   <term><parameter>spi</parameter></term>
68109   <listitem>
68110    <para>
68111     device with which data will be exchanged
68112    </para>
68113   </listitem>
68114  </varlistentry>
68115  <varlistentry>
68116   <term><parameter>cmd</parameter></term>
68117   <listitem>
68118    <para>
68119     command to be written before data is read back
68120    </para>
68121   </listitem>
68122  </varlistentry>
68123 </variablelist>
68124</refsect1>
68125<refsect1>
68126<title>Context</title>
68127<para>
68128   can sleep
68129</para>
68130</refsect1>
68131<refsect1>
68132<title>Description</title>
68133<para>
68134   The number is returned in wire-order, which is at least sometimes
68135   big-endian.
68136   </para><para>
68137
68138   Callable only from contexts that can sleep.
68139</para>
68140</refsect1>
68141<refsect1>
68142<title>Return</title>
68143<para>
68144   the (unsigned) sixteen bit number returned by the
68145   device, or else a negative error code.
68146</para>
68147</refsect1>
68148</refentry>
68149
68150<refentry id="API-spi-w8r16be">
68151<refentryinfo>
68152 <title>LINUX</title>
68153 <productname>Kernel Hackers Manual</productname>
68154 <date>July 2017</date>
68155</refentryinfo>
68156<refmeta>
68157 <refentrytitle><phrase>spi_w8r16be</phrase></refentrytitle>
68158 <manvolnum>9</manvolnum>
68159 <refmiscinfo class="version">4.4.14</refmiscinfo>
68160</refmeta>
68161<refnamediv>
68162 <refname>spi_w8r16be</refname>
68163 <refpurpose>
68164     SPI synchronous 8 bit write followed by 16 bit big-endian read
68165 </refpurpose>
68166</refnamediv>
68167<refsynopsisdiv>
68168 <title>Synopsis</title>
68169  <funcsynopsis><funcprototype>
68170   <funcdef>ssize_t <function>spi_w8r16be </function></funcdef>
68171   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
68172   <paramdef>u8 <parameter>cmd</parameter></paramdef>
68173  </funcprototype></funcsynopsis>
68174</refsynopsisdiv>
68175<refsect1>
68176 <title>Arguments</title>
68177 <variablelist>
68178  <varlistentry>
68179   <term><parameter>spi</parameter></term>
68180   <listitem>
68181    <para>
68182     device with which data will be exchanged
68183    </para>
68184   </listitem>
68185  </varlistentry>
68186  <varlistentry>
68187   <term><parameter>cmd</parameter></term>
68188   <listitem>
68189    <para>
68190     command to be written before data is read back
68191    </para>
68192   </listitem>
68193  </varlistentry>
68194 </variablelist>
68195</refsect1>
68196<refsect1>
68197<title>Context</title>
68198<para>
68199   can sleep
68200</para>
68201</refsect1>
68202<refsect1>
68203<title>Description</title>
68204<para>
68205   This function is similar to spi_w8r16, with the exception that it will
68206   convert the read 16 bit data word from big-endian to native endianness.
68207   </para><para>
68208
68209   Callable only from contexts that can sleep.
68210</para>
68211</refsect1>
68212<refsect1>
68213<title>Return</title>
68214<para>
68215   the (unsigned) sixteen bit number returned by the device in cpu
68216   endianness, or else a negative error code.
68217</para>
68218</refsect1>
68219</refentry>
68220
68221<refentry id="API-struct-spi-board-info">
68222<refentryinfo>
68223 <title>LINUX</title>
68224 <productname>Kernel Hackers Manual</productname>
68225 <date>July 2017</date>
68226</refentryinfo>
68227<refmeta>
68228 <refentrytitle><phrase>struct spi_board_info</phrase></refentrytitle>
68229 <manvolnum>9</manvolnum>
68230 <refmiscinfo class="version">4.4.14</refmiscinfo>
68231</refmeta>
68232<refnamediv>
68233 <refname>struct spi_board_info</refname>
68234 <refpurpose>
68235     board-specific template for a SPI device
68236 </refpurpose>
68237</refnamediv>
68238<refsynopsisdiv>
68239 <title>Synopsis</title>
68240  <programlisting>
68241struct spi_board_info {
68242  char modalias[SPI_NAME_SIZE];
68243  const void * platform_data;
68244  void * controller_data;
68245  int irq;
68246  u32 max_speed_hz;
68247  u16 bus_num;
68248  u16 chip_select;
68249  u16 mode;
68250};  </programlisting>
68251</refsynopsisdiv>
68252 <refsect1>
68253  <title>Members</title>
68254  <variablelist>
68255    <varlistentry>      <term>modalias[SPI_NAME_SIZE]</term>
68256      <listitem><para>
68257   Initializes spi_device.modalias; identifies the driver.
68258      </para></listitem>
68259    </varlistentry>
68260    <varlistentry>      <term>platform_data</term>
68261      <listitem><para>
68262   Initializes spi_device.platform_data; the particular
68263   data stored there is driver-specific.
68264      </para></listitem>
68265    </varlistentry>
68266    <varlistentry>      <term>controller_data</term>
68267      <listitem><para>
68268   Initializes spi_device.controller_data; some
68269   controllers need hints about hardware setup, e.g. for DMA.
68270      </para></listitem>
68271    </varlistentry>
68272    <varlistentry>      <term>irq</term>
68273      <listitem><para>
68274   Initializes spi_device.irq; depends on how the board is wired.
68275      </para></listitem>
68276    </varlistentry>
68277    <varlistentry>      <term>max_speed_hz</term>
68278      <listitem><para>
68279   Initializes spi_device.max_speed_hz; based on limits
68280   from the chip datasheet and board-specific signal quality issues.
68281      </para></listitem>
68282    </varlistentry>
68283    <varlistentry>      <term>bus_num</term>
68284      <listitem><para>
68285   Identifies which spi_master parents the spi_device; unused
68286   by <function><link linkend="API-spi-new-device">spi_new_device</link></function>, and otherwise depends on board wiring.
68287      </para></listitem>
68288    </varlistentry>
68289    <varlistentry>      <term>chip_select</term>
68290      <listitem><para>
68291   Initializes spi_device.chip_select; depends on how
68292   the board is wired.
68293      </para></listitem>
68294    </varlistentry>
68295    <varlistentry>      <term>mode</term>
68296      <listitem><para>
68297   Initializes spi_device.mode; based on the chip datasheet, board
68298   wiring (some devices support both 3WIRE and standard modes), and
68299   possibly presence of an inverter in the chipselect path.
68300      </para></listitem>
68301    </varlistentry>
68302  </variablelist>
68303 </refsect1>
68304<refsect1>
68305<title>Description</title>
68306<para>
68307   When adding new SPI devices to the device tree, these structures serve
68308   as a partial device template.  They hold information which can't always
68309   be determined by drivers.  Information that <function>probe</function> can establish (such
68310   as the default transfer wordsize) is not included here.
68311   </para><para>
68312
68313   These structures are used in two places.  Their primary role is to
68314   be stored in tables of board-specific device descriptors, which are
68315   declared early in board initialization and then used (much later) to
68316   populate a controller's device tree after the that controller's driver
68317   initializes.  A secondary (and atypical) role is as a parameter to
68318   <function><link linkend="API-spi-new-device">spi_new_device</link></function> call, which happens after those controller drivers
68319   are active in some dynamic board configuration models.
68320</para>
68321</refsect1>
68322</refentry>
68323
68324<refentry id="API-spi-register-board-info">
68325<refentryinfo>
68326 <title>LINUX</title>
68327 <productname>Kernel Hackers Manual</productname>
68328 <date>July 2017</date>
68329</refentryinfo>
68330<refmeta>
68331 <refentrytitle><phrase>spi_register_board_info</phrase></refentrytitle>
68332 <manvolnum>9</manvolnum>
68333 <refmiscinfo class="version">4.4.14</refmiscinfo>
68334</refmeta>
68335<refnamediv>
68336 <refname>spi_register_board_info</refname>
68337 <refpurpose>
68338  register SPI devices for a given board
68339 </refpurpose>
68340</refnamediv>
68341<refsynopsisdiv>
68342 <title>Synopsis</title>
68343  <funcsynopsis><funcprototype>
68344   <funcdef>int <function>spi_register_board_info </function></funcdef>
68345   <paramdef>struct spi_board_info const * <parameter>info</parameter></paramdef>
68346   <paramdef>unsigned <parameter>n</parameter></paramdef>
68347  </funcprototype></funcsynopsis>
68348</refsynopsisdiv>
68349<refsect1>
68350 <title>Arguments</title>
68351 <variablelist>
68352  <varlistentry>
68353   <term><parameter>info</parameter></term>
68354   <listitem>
68355    <para>
68356     array of chip descriptors
68357    </para>
68358   </listitem>
68359  </varlistentry>
68360  <varlistentry>
68361   <term><parameter>n</parameter></term>
68362   <listitem>
68363    <para>
68364     how many descriptors are provided
68365    </para>
68366   </listitem>
68367  </varlistentry>
68368 </variablelist>
68369</refsect1>
68370<refsect1>
68371<title>Context</title>
68372<para>
68373   can sleep
68374</para>
68375</refsect1>
68376<refsect1>
68377<title>Description</title>
68378<para>
68379   Board-specific early init code calls this (probably during arch_initcall)
68380   with segments of the SPI device table.  Any device nodes are created later,
68381   after the relevant parent SPI controller (bus_num) is defined.  We keep
68382   this table of devices forever, so that reloading a controller driver will
68383   not make Linux forget about these hard-wired devices.
68384   </para><para>
68385
68386   Other code can also call this, e.g. a particular add-on board might provide
68387   SPI devices through its expansion connector, so code initializing that board
68388   would naturally declare its SPI devices.
68389   </para><para>
68390
68391   The board info passed can safely be __initdata ... but be careful of
68392   any embedded pointers (platform_data, etc), they're copied as-is.
68393</para>
68394</refsect1>
68395<refsect1>
68396<title>Return</title>
68397<para>
68398   zero on success, else a negative error code.
68399</para>
68400</refsect1>
68401</refentry>
68402
68403<!-- drivers/spi/spi.c -->
68404<refentry id="API---spi-register-driver">
68405<refentryinfo>
68406 <title>LINUX</title>
68407 <productname>Kernel Hackers Manual</productname>
68408 <date>July 2017</date>
68409</refentryinfo>
68410<refmeta>
68411 <refentrytitle><phrase>__spi_register_driver</phrase></refentrytitle>
68412 <manvolnum>9</manvolnum>
68413 <refmiscinfo class="version">4.4.14</refmiscinfo>
68414</refmeta>
68415<refnamediv>
68416 <refname>__spi_register_driver</refname>
68417 <refpurpose>
68418  register a SPI driver
68419 </refpurpose>
68420</refnamediv>
68421<refsynopsisdiv>
68422 <title>Synopsis</title>
68423  <funcsynopsis><funcprototype>
68424   <funcdef>int <function>__spi_register_driver </function></funcdef>
68425   <paramdef>struct module * <parameter>owner</parameter></paramdef>
68426   <paramdef><link linkend="API-struct-spi-driver">struct spi_driver</link> * <parameter>sdrv</parameter></paramdef>
68427  </funcprototype></funcsynopsis>
68428</refsynopsisdiv>
68429<refsect1>
68430 <title>Arguments</title>
68431 <variablelist>
68432  <varlistentry>
68433   <term><parameter>owner</parameter></term>
68434   <listitem>
68435    <para>
68436     owner module of the driver to register
68437    </para>
68438   </listitem>
68439  </varlistentry>
68440  <varlistentry>
68441   <term><parameter>sdrv</parameter></term>
68442   <listitem>
68443    <para>
68444     the driver to register
68445    </para>
68446   </listitem>
68447  </varlistentry>
68448 </variablelist>
68449</refsect1>
68450<refsect1>
68451<title>Context</title>
68452<para>
68453   can sleep
68454</para>
68455</refsect1>
68456<refsect1>
68457<title>Return</title>
68458<para>
68459   zero on success, else a negative error code.
68460</para>
68461</refsect1>
68462</refentry>
68463
68464<refentry id="API-spi-alloc-device">
68465<refentryinfo>
68466 <title>LINUX</title>
68467 <productname>Kernel Hackers Manual</productname>
68468 <date>July 2017</date>
68469</refentryinfo>
68470<refmeta>
68471 <refentrytitle><phrase>spi_alloc_device</phrase></refentrytitle>
68472 <manvolnum>9</manvolnum>
68473 <refmiscinfo class="version">4.4.14</refmiscinfo>
68474</refmeta>
68475<refnamediv>
68476 <refname>spi_alloc_device</refname>
68477 <refpurpose>
68478     Allocate a new SPI device
68479 </refpurpose>
68480</refnamediv>
68481<refsynopsisdiv>
68482 <title>Synopsis</title>
68483  <funcsynopsis><funcprototype>
68484   <funcdef><link linkend="API-struct-spi-device">struct spi_device</link> * <function>spi_alloc_device </function></funcdef>
68485   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
68486  </funcprototype></funcsynopsis>
68487</refsynopsisdiv>
68488<refsect1>
68489 <title>Arguments</title>
68490 <variablelist>
68491  <varlistentry>
68492   <term><parameter>master</parameter></term>
68493   <listitem>
68494    <para>
68495     Controller to which device is connected
68496    </para>
68497   </listitem>
68498  </varlistentry>
68499 </variablelist>
68500</refsect1>
68501<refsect1>
68502<title>Context</title>
68503<para>
68504   can sleep
68505</para>
68506</refsect1>
68507<refsect1>
68508<title>Description</title>
68509<para>
68510   Allows a driver to allocate and initialize a spi_device without
68511   registering it immediately.  This allows a driver to directly
68512   fill the spi_device with device parameters before calling
68513   <function><link linkend="API-spi-add-device">spi_add_device</link></function> on it.
68514   </para><para>
68515
68516   Caller is responsible to call <function><link linkend="API-spi-add-device">spi_add_device</link></function> on the returned
68517   spi_device structure to add it to the SPI master.  If the caller
68518   needs to discard the spi_device without adding it, then it should
68519   call <function>spi_dev_put</function> on it.
68520</para>
68521</refsect1>
68522<refsect1>
68523<title>Return</title>
68524<para>
68525   a pointer to the new device, or NULL.
68526</para>
68527</refsect1>
68528</refentry>
68529
68530<refentry id="API-spi-add-device">
68531<refentryinfo>
68532 <title>LINUX</title>
68533 <productname>Kernel Hackers Manual</productname>
68534 <date>July 2017</date>
68535</refentryinfo>
68536<refmeta>
68537 <refentrytitle><phrase>spi_add_device</phrase></refentrytitle>
68538 <manvolnum>9</manvolnum>
68539 <refmiscinfo class="version">4.4.14</refmiscinfo>
68540</refmeta>
68541<refnamediv>
68542 <refname>spi_add_device</refname>
68543 <refpurpose>
68544     Add spi_device allocated with spi_alloc_device
68545 </refpurpose>
68546</refnamediv>
68547<refsynopsisdiv>
68548 <title>Synopsis</title>
68549  <funcsynopsis><funcprototype>
68550   <funcdef>int <function>spi_add_device </function></funcdef>
68551   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
68552  </funcprototype></funcsynopsis>
68553</refsynopsisdiv>
68554<refsect1>
68555 <title>Arguments</title>
68556 <variablelist>
68557  <varlistentry>
68558   <term><parameter>spi</parameter></term>
68559   <listitem>
68560    <para>
68561     spi_device to register
68562    </para>
68563   </listitem>
68564  </varlistentry>
68565 </variablelist>
68566</refsect1>
68567<refsect1>
68568<title>Description</title>
68569<para>
68570   Companion function to spi_alloc_device.  Devices allocated with
68571   spi_alloc_device can be added onto the spi bus with this function.
68572</para>
68573</refsect1>
68574<refsect1>
68575<title>Return</title>
68576<para>
68577   0 on success; negative errno on failure
68578</para>
68579</refsect1>
68580</refentry>
68581
68582<refentry id="API-spi-new-device">
68583<refentryinfo>
68584 <title>LINUX</title>
68585 <productname>Kernel Hackers Manual</productname>
68586 <date>July 2017</date>
68587</refentryinfo>
68588<refmeta>
68589 <refentrytitle><phrase>spi_new_device</phrase></refentrytitle>
68590 <manvolnum>9</manvolnum>
68591 <refmiscinfo class="version">4.4.14</refmiscinfo>
68592</refmeta>
68593<refnamediv>
68594 <refname>spi_new_device</refname>
68595 <refpurpose>
68596     instantiate one new SPI device
68597 </refpurpose>
68598</refnamediv>
68599<refsynopsisdiv>
68600 <title>Synopsis</title>
68601  <funcsynopsis><funcprototype>
68602   <funcdef><link linkend="API-struct-spi-device">struct spi_device</link> * <function>spi_new_device </function></funcdef>
68603   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
68604   <paramdef><link linkend="API-struct-spi-board-info">struct spi_board_info</link> * <parameter>chip</parameter></paramdef>
68605  </funcprototype></funcsynopsis>
68606</refsynopsisdiv>
68607<refsect1>
68608 <title>Arguments</title>
68609 <variablelist>
68610  <varlistentry>
68611   <term><parameter>master</parameter></term>
68612   <listitem>
68613    <para>
68614     Controller to which device is connected
68615    </para>
68616   </listitem>
68617  </varlistentry>
68618  <varlistentry>
68619   <term><parameter>chip</parameter></term>
68620   <listitem>
68621    <para>
68622     Describes the SPI device
68623    </para>
68624   </listitem>
68625  </varlistentry>
68626 </variablelist>
68627</refsect1>
68628<refsect1>
68629<title>Context</title>
68630<para>
68631   can sleep
68632</para>
68633</refsect1>
68634<refsect1>
68635<title>Description</title>
68636<para>
68637   On typical mainboards, this is purely internal; and it's not needed
68638   after board init creates the hard-wired devices.  Some development
68639   platforms may not be able to use spi_register_board_info though, and
68640   this is exported so that for example a USB or parport based adapter
68641   driver could add devices (which it would learn about out-of-band).
68642</para>
68643</refsect1>
68644<refsect1>
68645<title>Return</title>
68646<para>
68647   the new device, or NULL.
68648</para>
68649</refsect1>
68650</refentry>
68651
68652<refentry id="API-spi-finalize-current-transfer">
68653<refentryinfo>
68654 <title>LINUX</title>
68655 <productname>Kernel Hackers Manual</productname>
68656 <date>July 2017</date>
68657</refentryinfo>
68658<refmeta>
68659 <refentrytitle><phrase>spi_finalize_current_transfer</phrase></refentrytitle>
68660 <manvolnum>9</manvolnum>
68661 <refmiscinfo class="version">4.4.14</refmiscinfo>
68662</refmeta>
68663<refnamediv>
68664 <refname>spi_finalize_current_transfer</refname>
68665 <refpurpose>
68666     report completion of a transfer
68667 </refpurpose>
68668</refnamediv>
68669<refsynopsisdiv>
68670 <title>Synopsis</title>
68671  <funcsynopsis><funcprototype>
68672   <funcdef>void <function>spi_finalize_current_transfer </function></funcdef>
68673   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
68674  </funcprototype></funcsynopsis>
68675</refsynopsisdiv>
68676<refsect1>
68677 <title>Arguments</title>
68678 <variablelist>
68679  <varlistentry>
68680   <term><parameter>master</parameter></term>
68681   <listitem>
68682    <para>
68683     the master reporting completion
68684    </para>
68685   </listitem>
68686  </varlistentry>
68687 </variablelist>
68688</refsect1>
68689<refsect1>
68690<title>Description</title>
68691<para>
68692   Called by SPI drivers using the core <function>transfer_one_message</function>
68693   implementation to notify it that the current interrupt driven
68694   transfer has finished and the next one may be scheduled.
68695</para>
68696</refsect1>
68697</refentry>
68698
68699<refentry id="API-spi-get-next-queued-message">
68700<refentryinfo>
68701 <title>LINUX</title>
68702 <productname>Kernel Hackers Manual</productname>
68703 <date>July 2017</date>
68704</refentryinfo>
68705<refmeta>
68706 <refentrytitle><phrase>spi_get_next_queued_message</phrase></refentrytitle>
68707 <manvolnum>9</manvolnum>
68708 <refmiscinfo class="version">4.4.14</refmiscinfo>
68709</refmeta>
68710<refnamediv>
68711 <refname>spi_get_next_queued_message</refname>
68712 <refpurpose>
68713     called by driver to check for queued messages
68714 </refpurpose>
68715</refnamediv>
68716<refsynopsisdiv>
68717 <title>Synopsis</title>
68718  <funcsynopsis><funcprototype>
68719   <funcdef><link linkend="API-struct-spi-message">struct spi_message</link> * <function>spi_get_next_queued_message </function></funcdef>
68720   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
68721  </funcprototype></funcsynopsis>
68722</refsynopsisdiv>
68723<refsect1>
68724 <title>Arguments</title>
68725 <variablelist>
68726  <varlistentry>
68727   <term><parameter>master</parameter></term>
68728   <listitem>
68729    <para>
68730     the master to check for queued messages
68731    </para>
68732   </listitem>
68733  </varlistentry>
68734 </variablelist>
68735</refsect1>
68736<refsect1>
68737<title>Description</title>
68738<para>
68739   If there are more messages in the queue, the next message is returned from
68740   this call.
68741</para>
68742</refsect1>
68743<refsect1>
68744<title>Return</title>
68745<para>
68746   the next message in the queue, else NULL if the queue is empty.
68747</para>
68748</refsect1>
68749</refentry>
68750
68751<refentry id="API-spi-finalize-current-message">
68752<refentryinfo>
68753 <title>LINUX</title>
68754 <productname>Kernel Hackers Manual</productname>
68755 <date>July 2017</date>
68756</refentryinfo>
68757<refmeta>
68758 <refentrytitle><phrase>spi_finalize_current_message</phrase></refentrytitle>
68759 <manvolnum>9</manvolnum>
68760 <refmiscinfo class="version">4.4.14</refmiscinfo>
68761</refmeta>
68762<refnamediv>
68763 <refname>spi_finalize_current_message</refname>
68764 <refpurpose>
68765     the current message is complete
68766 </refpurpose>
68767</refnamediv>
68768<refsynopsisdiv>
68769 <title>Synopsis</title>
68770  <funcsynopsis><funcprototype>
68771   <funcdef>void <function>spi_finalize_current_message </function></funcdef>
68772   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
68773  </funcprototype></funcsynopsis>
68774</refsynopsisdiv>
68775<refsect1>
68776 <title>Arguments</title>
68777 <variablelist>
68778  <varlistentry>
68779   <term><parameter>master</parameter></term>
68780   <listitem>
68781    <para>
68782     the master to return the message to
68783    </para>
68784   </listitem>
68785  </varlistentry>
68786 </variablelist>
68787</refsect1>
68788<refsect1>
68789<title>Description</title>
68790<para>
68791   Called by the driver to notify the core that the message in the front of the
68792   queue is complete and can be removed from the queue.
68793</para>
68794</refsect1>
68795</refentry>
68796
68797<refentry id="API-spi-alloc-master">
68798<refentryinfo>
68799 <title>LINUX</title>
68800 <productname>Kernel Hackers Manual</productname>
68801 <date>July 2017</date>
68802</refentryinfo>
68803<refmeta>
68804 <refentrytitle><phrase>spi_alloc_master</phrase></refentrytitle>
68805 <manvolnum>9</manvolnum>
68806 <refmiscinfo class="version">4.4.14</refmiscinfo>
68807</refmeta>
68808<refnamediv>
68809 <refname>spi_alloc_master</refname>
68810 <refpurpose>
68811     allocate SPI master controller
68812 </refpurpose>
68813</refnamediv>
68814<refsynopsisdiv>
68815 <title>Synopsis</title>
68816  <funcsynopsis><funcprototype>
68817   <funcdef><link linkend="API-struct-spi-master">struct spi_master</link> * <function>spi_alloc_master </function></funcdef>
68818   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
68819   <paramdef>unsigned <parameter>size</parameter></paramdef>
68820  </funcprototype></funcsynopsis>
68821</refsynopsisdiv>
68822<refsect1>
68823 <title>Arguments</title>
68824 <variablelist>
68825  <varlistentry>
68826   <term><parameter>dev</parameter></term>
68827   <listitem>
68828    <para>
68829     the controller, possibly using the platform_bus
68830    </para>
68831   </listitem>
68832  </varlistentry>
68833  <varlistentry>
68834   <term><parameter>size</parameter></term>
68835   <listitem>
68836    <para>
68837     how much zeroed driver-private data to allocate; the pointer to this
68838     memory is in the driver_data field of the returned device,
68839     accessible with <function>spi_master_get_devdata</function>.
68840    </para>
68841   </listitem>
68842  </varlistentry>
68843 </variablelist>
68844</refsect1>
68845<refsect1>
68846<title>Context</title>
68847<para>
68848   can sleep
68849</para>
68850</refsect1>
68851<refsect1>
68852<title>Description</title>
68853<para>
68854   This call is used only by SPI master controller drivers, which are the
68855   only ones directly touching chip registers.  It's how they allocate
68856   an spi_master structure, prior to calling <function><link linkend="API-spi-register-master">spi_register_master</link></function>.
68857   </para><para>
68858
68859   This must be called from context that can sleep.
68860   </para><para>
68861
68862   The caller is responsible for assigning the bus number and initializing
68863   the master's methods before calling <function><link linkend="API-spi-register-master">spi_register_master</link></function>; and (after errors
68864   adding the device) calling <function>spi_master_put</function> to prevent a memory leak.
68865</para>
68866</refsect1>
68867<refsect1>
68868<title>Return</title>
68869<para>
68870   the SPI master structure on success, else NULL.
68871</para>
68872</refsect1>
68873</refentry>
68874
68875<refentry id="API-spi-register-master">
68876<refentryinfo>
68877 <title>LINUX</title>
68878 <productname>Kernel Hackers Manual</productname>
68879 <date>July 2017</date>
68880</refentryinfo>
68881<refmeta>
68882 <refentrytitle><phrase>spi_register_master</phrase></refentrytitle>
68883 <manvolnum>9</manvolnum>
68884 <refmiscinfo class="version">4.4.14</refmiscinfo>
68885</refmeta>
68886<refnamediv>
68887 <refname>spi_register_master</refname>
68888 <refpurpose>
68889     register SPI master controller
68890 </refpurpose>
68891</refnamediv>
68892<refsynopsisdiv>
68893 <title>Synopsis</title>
68894  <funcsynopsis><funcprototype>
68895   <funcdef>int <function>spi_register_master </function></funcdef>
68896   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
68897  </funcprototype></funcsynopsis>
68898</refsynopsisdiv>
68899<refsect1>
68900 <title>Arguments</title>
68901 <variablelist>
68902  <varlistentry>
68903   <term><parameter>master</parameter></term>
68904   <listitem>
68905    <para>
68906     initialized master, originally from <function><link linkend="API-spi-alloc-master">spi_alloc_master</link></function>
68907    </para>
68908   </listitem>
68909  </varlistentry>
68910 </variablelist>
68911</refsect1>
68912<refsect1>
68913<title>Context</title>
68914<para>
68915   can sleep
68916</para>
68917</refsect1>
68918<refsect1>
68919<title>Description</title>
68920<para>
68921   SPI master controllers connect to their drivers using some non-SPI bus,
68922   such as the platform bus.  The final stage of <function>probe</function> in that code
68923   includes calling <function><link linkend="API-spi-register-master">spi_register_master</link></function> to hook up to this SPI bus glue.
68924   </para><para>
68925
68926   SPI controllers use board specific (often SOC specific) bus numbers,
68927   and board-specific addressing for SPI devices combines those numbers
68928   with chip select numbers.  Since SPI does not directly support dynamic
68929   device identification, boards need configuration tables telling which
68930   chip is at which address.
68931   </para><para>
68932
68933   This must be called from context that can sleep.  It returns zero on
68934   success, else a negative error code (dropping the master's refcount).
68935   After a successful return, the caller is responsible for calling
68936   <function><link linkend="API-spi-unregister-master">spi_unregister_master</link></function>.
68937</para>
68938</refsect1>
68939<refsect1>
68940<title>Return</title>
68941<para>
68942   zero on success, else a negative error code.
68943</para>
68944</refsect1>
68945</refentry>
68946
68947<refentry id="API-devm-spi-register-master">
68948<refentryinfo>
68949 <title>LINUX</title>
68950 <productname>Kernel Hackers Manual</productname>
68951 <date>July 2017</date>
68952</refentryinfo>
68953<refmeta>
68954 <refentrytitle><phrase>devm_spi_register_master</phrase></refentrytitle>
68955 <manvolnum>9</manvolnum>
68956 <refmiscinfo class="version">4.4.14</refmiscinfo>
68957</refmeta>
68958<refnamediv>
68959 <refname>devm_spi_register_master</refname>
68960 <refpurpose>
68961     register managed SPI master controller
68962 </refpurpose>
68963</refnamediv>
68964<refsynopsisdiv>
68965 <title>Synopsis</title>
68966  <funcsynopsis><funcprototype>
68967   <funcdef>int <function>devm_spi_register_master </function></funcdef>
68968   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
68969   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
68970  </funcprototype></funcsynopsis>
68971</refsynopsisdiv>
68972<refsect1>
68973 <title>Arguments</title>
68974 <variablelist>
68975  <varlistentry>
68976   <term><parameter>dev</parameter></term>
68977   <listitem>
68978    <para>
68979     device managing SPI master
68980    </para>
68981   </listitem>
68982  </varlistentry>
68983  <varlistentry>
68984   <term><parameter>master</parameter></term>
68985   <listitem>
68986    <para>
68987     initialized master, originally from <function><link linkend="API-spi-alloc-master">spi_alloc_master</link></function>
68988    </para>
68989   </listitem>
68990  </varlistentry>
68991 </variablelist>
68992</refsect1>
68993<refsect1>
68994<title>Context</title>
68995<para>
68996   can sleep
68997</para>
68998</refsect1>
68999<refsect1>
69000<title>Description</title>
69001<para>
69002   Register a SPI device as with <function><link linkend="API-spi-register-master">spi_register_master</link></function> which will
69003   automatically be unregister
69004</para>
69005</refsect1>
69006<refsect1>
69007<title>Return</title>
69008<para>
69009   zero on success, else a negative error code.
69010</para>
69011</refsect1>
69012</refentry>
69013
69014<refentry id="API-spi-unregister-master">
69015<refentryinfo>
69016 <title>LINUX</title>
69017 <productname>Kernel Hackers Manual</productname>
69018 <date>July 2017</date>
69019</refentryinfo>
69020<refmeta>
69021 <refentrytitle><phrase>spi_unregister_master</phrase></refentrytitle>
69022 <manvolnum>9</manvolnum>
69023 <refmiscinfo class="version">4.4.14</refmiscinfo>
69024</refmeta>
69025<refnamediv>
69026 <refname>spi_unregister_master</refname>
69027 <refpurpose>
69028     unregister SPI master controller
69029 </refpurpose>
69030</refnamediv>
69031<refsynopsisdiv>
69032 <title>Synopsis</title>
69033  <funcsynopsis><funcprototype>
69034   <funcdef>void <function>spi_unregister_master </function></funcdef>
69035   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
69036  </funcprototype></funcsynopsis>
69037</refsynopsisdiv>
69038<refsect1>
69039 <title>Arguments</title>
69040 <variablelist>
69041  <varlistentry>
69042   <term><parameter>master</parameter></term>
69043   <listitem>
69044    <para>
69045     the master being unregistered
69046    </para>
69047   </listitem>
69048  </varlistentry>
69049 </variablelist>
69050</refsect1>
69051<refsect1>
69052<title>Context</title>
69053<para>
69054   can sleep
69055</para>
69056</refsect1>
69057<refsect1>
69058<title>Description</title>
69059<para>
69060   This call is used only by SPI master controller drivers, which are the
69061   only ones directly touching chip registers.
69062   </para><para>
69063
69064   This must be called from context that can sleep.
69065</para>
69066</refsect1>
69067</refentry>
69068
69069<refentry id="API-spi-busnum-to-master">
69070<refentryinfo>
69071 <title>LINUX</title>
69072 <productname>Kernel Hackers Manual</productname>
69073 <date>July 2017</date>
69074</refentryinfo>
69075<refmeta>
69076 <refentrytitle><phrase>spi_busnum_to_master</phrase></refentrytitle>
69077 <manvolnum>9</manvolnum>
69078 <refmiscinfo class="version">4.4.14</refmiscinfo>
69079</refmeta>
69080<refnamediv>
69081 <refname>spi_busnum_to_master</refname>
69082 <refpurpose>
69083     look up master associated with bus_num
69084 </refpurpose>
69085</refnamediv>
69086<refsynopsisdiv>
69087 <title>Synopsis</title>
69088  <funcsynopsis><funcprototype>
69089   <funcdef><link linkend="API-struct-spi-master">struct spi_master</link> * <function>spi_busnum_to_master </function></funcdef>
69090   <paramdef>u16 <parameter>bus_num</parameter></paramdef>
69091  </funcprototype></funcsynopsis>
69092</refsynopsisdiv>
69093<refsect1>
69094 <title>Arguments</title>
69095 <variablelist>
69096  <varlistentry>
69097   <term><parameter>bus_num</parameter></term>
69098   <listitem>
69099    <para>
69100     the master's bus number
69101    </para>
69102   </listitem>
69103  </varlistentry>
69104 </variablelist>
69105</refsect1>
69106<refsect1>
69107<title>Context</title>
69108<para>
69109   can sleep
69110</para>
69111</refsect1>
69112<refsect1>
69113<title>Description</title>
69114<para>
69115   This call may be used with devices that are registered after
69116   arch init time.  It returns a refcounted pointer to the relevant
69117   spi_master (which the caller must release), or NULL if there is
69118   no such master registered.
69119</para>
69120</refsect1>
69121<refsect1>
69122<title>Return</title>
69123<para>
69124   the SPI master structure on success, else NULL.
69125</para>
69126</refsect1>
69127</refentry>
69128
69129<refentry id="API-spi-setup">
69130<refentryinfo>
69131 <title>LINUX</title>
69132 <productname>Kernel Hackers Manual</productname>
69133 <date>July 2017</date>
69134</refentryinfo>
69135<refmeta>
69136 <refentrytitle><phrase>spi_setup</phrase></refentrytitle>
69137 <manvolnum>9</manvolnum>
69138 <refmiscinfo class="version">4.4.14</refmiscinfo>
69139</refmeta>
69140<refnamediv>
69141 <refname>spi_setup</refname>
69142 <refpurpose>
69143     setup SPI mode and clock rate
69144 </refpurpose>
69145</refnamediv>
69146<refsynopsisdiv>
69147 <title>Synopsis</title>
69148  <funcsynopsis><funcprototype>
69149   <funcdef>int <function>spi_setup </function></funcdef>
69150   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
69151  </funcprototype></funcsynopsis>
69152</refsynopsisdiv>
69153<refsect1>
69154 <title>Arguments</title>
69155 <variablelist>
69156  <varlistentry>
69157   <term><parameter>spi</parameter></term>
69158   <listitem>
69159    <para>
69160     the device whose settings are being modified
69161    </para>
69162   </listitem>
69163  </varlistentry>
69164 </variablelist>
69165</refsect1>
69166<refsect1>
69167<title>Context</title>
69168<para>
69169   can sleep, and no requests are queued to the device
69170</para>
69171</refsect1>
69172<refsect1>
69173<title>Description</title>
69174<para>
69175   SPI protocol drivers may need to update the transfer mode if the
69176   device doesn't work with its default.  They may likewise need
69177   to update clock rates or word sizes from initial values.  This function
69178   changes those settings, and must be called from a context that can sleep.
69179   Except for SPI_CS_HIGH, which takes effect immediately, the changes take
69180   effect the next time the device is selected and data is transferred to
69181   or from it.  When this function returns, the spi device is deselected.
69182   </para><para>
69183
69184   Note that this call will fail if the protocol driver specifies an option
69185   that the underlying controller or its driver does not support.  For
69186   example, not all hardware supports wire transfers using nine bit words,
69187   LSB-first wire encoding, or active-high chipselects.
69188</para>
69189</refsect1>
69190<refsect1>
69191<title>Return</title>
69192<para>
69193   zero on success, else a negative error code.
69194</para>
69195</refsect1>
69196</refentry>
69197
69198<refentry id="API-spi-async">
69199<refentryinfo>
69200 <title>LINUX</title>
69201 <productname>Kernel Hackers Manual</productname>
69202 <date>July 2017</date>
69203</refentryinfo>
69204<refmeta>
69205 <refentrytitle><phrase>spi_async</phrase></refentrytitle>
69206 <manvolnum>9</manvolnum>
69207 <refmiscinfo class="version">4.4.14</refmiscinfo>
69208</refmeta>
69209<refnamediv>
69210 <refname>spi_async</refname>
69211 <refpurpose>
69212     asynchronous SPI transfer
69213 </refpurpose>
69214</refnamediv>
69215<refsynopsisdiv>
69216 <title>Synopsis</title>
69217  <funcsynopsis><funcprototype>
69218   <funcdef>int <function>spi_async </function></funcdef>
69219   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
69220   <paramdef><link linkend="API-struct-spi-message">struct spi_message</link> * <parameter>message</parameter></paramdef>
69221  </funcprototype></funcsynopsis>
69222</refsynopsisdiv>
69223<refsect1>
69224 <title>Arguments</title>
69225 <variablelist>
69226  <varlistentry>
69227   <term><parameter>spi</parameter></term>
69228   <listitem>
69229    <para>
69230     device with which data will be exchanged
69231    </para>
69232   </listitem>
69233  </varlistentry>
69234  <varlistentry>
69235   <term><parameter>message</parameter></term>
69236   <listitem>
69237    <para>
69238     describes the data transfers, including completion callback
69239    </para>
69240   </listitem>
69241  </varlistentry>
69242 </variablelist>
69243</refsect1>
69244<refsect1>
69245<title>Context</title>
69246<para>
69247   any (irqs may be blocked, etc)
69248</para>
69249</refsect1>
69250<refsect1>
69251<title>Description</title>
69252<para>
69253   This call may be used in_irq and other contexts which can't sleep,
69254   as well as from task contexts which can sleep.
69255   </para><para>
69256
69257   The completion callback is invoked in a context which can't sleep.
69258   Before that invocation, the value of message-&gt;status is undefined.
69259   When the callback is issued, message-&gt;status holds either zero (to
69260   indicate complete success) or a negative error code.  After that
69261   callback returns, the driver which issued the transfer request may
69262   deallocate the associated memory; it's no longer in use by any SPI
69263   core or controller driver code.
69264   </para><para>
69265
69266   Note that although all messages to a spi_device are handled in
69267   FIFO order, messages may go to different devices in other orders.
69268   Some device might be higher priority, or have various <quote>hard</quote> access
69269   time requirements, for example.
69270   </para><para>
69271
69272   On detection of any fault during the transfer, processing of
69273   the entire message is aborted, and the device is deselected.
69274   Until returning from the associated message completion callback,
69275   no other spi_message queued to that device will be processed.
69276   (This rule applies equally to all the synchronous transfer calls,
69277   which are wrappers around this core asynchronous primitive.)
69278</para>
69279</refsect1>
69280<refsect1>
69281<title>Return</title>
69282<para>
69283   zero on success, else a negative error code.
69284</para>
69285</refsect1>
69286</refentry>
69287
69288<refentry id="API-spi-async-locked">
69289<refentryinfo>
69290 <title>LINUX</title>
69291 <productname>Kernel Hackers Manual</productname>
69292 <date>July 2017</date>
69293</refentryinfo>
69294<refmeta>
69295 <refentrytitle><phrase>spi_async_locked</phrase></refentrytitle>
69296 <manvolnum>9</manvolnum>
69297 <refmiscinfo class="version">4.4.14</refmiscinfo>
69298</refmeta>
69299<refnamediv>
69300 <refname>spi_async_locked</refname>
69301 <refpurpose>
69302     version of spi_async with exclusive bus usage
69303 </refpurpose>
69304</refnamediv>
69305<refsynopsisdiv>
69306 <title>Synopsis</title>
69307  <funcsynopsis><funcprototype>
69308   <funcdef>int <function>spi_async_locked </function></funcdef>
69309   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
69310   <paramdef><link linkend="API-struct-spi-message">struct spi_message</link> * <parameter>message</parameter></paramdef>
69311  </funcprototype></funcsynopsis>
69312</refsynopsisdiv>
69313<refsect1>
69314 <title>Arguments</title>
69315 <variablelist>
69316  <varlistentry>
69317   <term><parameter>spi</parameter></term>
69318   <listitem>
69319    <para>
69320     device with which data will be exchanged
69321    </para>
69322   </listitem>
69323  </varlistentry>
69324  <varlistentry>
69325   <term><parameter>message</parameter></term>
69326   <listitem>
69327    <para>
69328     describes the data transfers, including completion callback
69329    </para>
69330   </listitem>
69331  </varlistentry>
69332 </variablelist>
69333</refsect1>
69334<refsect1>
69335<title>Context</title>
69336<para>
69337   any (irqs may be blocked, etc)
69338</para>
69339</refsect1>
69340<refsect1>
69341<title>Description</title>
69342<para>
69343   This call may be used in_irq and other contexts which can't sleep,
69344   as well as from task contexts which can sleep.
69345   </para><para>
69346
69347   The completion callback is invoked in a context which can't sleep.
69348   Before that invocation, the value of message-&gt;status is undefined.
69349   When the callback is issued, message-&gt;status holds either zero (to
69350   indicate complete success) or a negative error code.  After that
69351   callback returns, the driver which issued the transfer request may
69352   deallocate the associated memory; it's no longer in use by any SPI
69353   core or controller driver code.
69354   </para><para>
69355
69356   Note that although all messages to a spi_device are handled in
69357   FIFO order, messages may go to different devices in other orders.
69358   Some device might be higher priority, or have various <quote>hard</quote> access
69359   time requirements, for example.
69360   </para><para>
69361
69362   On detection of any fault during the transfer, processing of
69363   the entire message is aborted, and the device is deselected.
69364   Until returning from the associated message completion callback,
69365   no other spi_message queued to that device will be processed.
69366   (This rule applies equally to all the synchronous transfer calls,
69367   which are wrappers around this core asynchronous primitive.)
69368</para>
69369</refsect1>
69370<refsect1>
69371<title>Return</title>
69372<para>
69373   zero on success, else a negative error code.
69374</para>
69375</refsect1>
69376</refentry>
69377
69378<refentry id="API-spi-sync">
69379<refentryinfo>
69380 <title>LINUX</title>
69381 <productname>Kernel Hackers Manual</productname>
69382 <date>July 2017</date>
69383</refentryinfo>
69384<refmeta>
69385 <refentrytitle><phrase>spi_sync</phrase></refentrytitle>
69386 <manvolnum>9</manvolnum>
69387 <refmiscinfo class="version">4.4.14</refmiscinfo>
69388</refmeta>
69389<refnamediv>
69390 <refname>spi_sync</refname>
69391 <refpurpose>
69392     blocking/synchronous SPI data transfers
69393 </refpurpose>
69394</refnamediv>
69395<refsynopsisdiv>
69396 <title>Synopsis</title>
69397  <funcsynopsis><funcprototype>
69398   <funcdef>int <function>spi_sync </function></funcdef>
69399   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
69400   <paramdef><link linkend="API-struct-spi-message">struct spi_message</link> * <parameter>message</parameter></paramdef>
69401  </funcprototype></funcsynopsis>
69402</refsynopsisdiv>
69403<refsect1>
69404 <title>Arguments</title>
69405 <variablelist>
69406  <varlistentry>
69407   <term><parameter>spi</parameter></term>
69408   <listitem>
69409    <para>
69410     device with which data will be exchanged
69411    </para>
69412   </listitem>
69413  </varlistentry>
69414  <varlistentry>
69415   <term><parameter>message</parameter></term>
69416   <listitem>
69417    <para>
69418     describes the data transfers
69419    </para>
69420   </listitem>
69421  </varlistentry>
69422 </variablelist>
69423</refsect1>
69424<refsect1>
69425<title>Context</title>
69426<para>
69427   can sleep
69428</para>
69429</refsect1>
69430<refsect1>
69431<title>Description</title>
69432<para>
69433   This call may only be used from a context that may sleep.  The sleep
69434   is non-interruptible, and has no timeout.  Low-overhead controller
69435   drivers may DMA directly into and out of the message buffers.
69436   </para><para>
69437
69438   Note that the SPI device's chip select is active during the message,
69439   and then is normally disabled between messages.  Drivers for some
69440   frequently-used devices may want to minimize costs of selecting a chip,
69441   by leaving it selected in anticipation that the next message will go
69442   to the same chip.  (That may increase power usage.)
69443   </para><para>
69444
69445   Also, the caller is guaranteeing that the memory associated with the
69446   message will not be freed before this call returns.
69447</para>
69448</refsect1>
69449<refsect1>
69450<title>Return</title>
69451<para>
69452   zero on success, else a negative error code.
69453</para>
69454</refsect1>
69455</refentry>
69456
69457<refentry id="API-spi-sync-locked">
69458<refentryinfo>
69459 <title>LINUX</title>
69460 <productname>Kernel Hackers Manual</productname>
69461 <date>July 2017</date>
69462</refentryinfo>
69463<refmeta>
69464 <refentrytitle><phrase>spi_sync_locked</phrase></refentrytitle>
69465 <manvolnum>9</manvolnum>
69466 <refmiscinfo class="version">4.4.14</refmiscinfo>
69467</refmeta>
69468<refnamediv>
69469 <refname>spi_sync_locked</refname>
69470 <refpurpose>
69471     version of spi_sync with exclusive bus usage
69472 </refpurpose>
69473</refnamediv>
69474<refsynopsisdiv>
69475 <title>Synopsis</title>
69476  <funcsynopsis><funcprototype>
69477   <funcdef>int <function>spi_sync_locked </function></funcdef>
69478   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
69479   <paramdef><link linkend="API-struct-spi-message">struct spi_message</link> * <parameter>message</parameter></paramdef>
69480  </funcprototype></funcsynopsis>
69481</refsynopsisdiv>
69482<refsect1>
69483 <title>Arguments</title>
69484 <variablelist>
69485  <varlistentry>
69486   <term><parameter>spi</parameter></term>
69487   <listitem>
69488    <para>
69489     device with which data will be exchanged
69490    </para>
69491   </listitem>
69492  </varlistentry>
69493  <varlistentry>
69494   <term><parameter>message</parameter></term>
69495   <listitem>
69496    <para>
69497     describes the data transfers
69498    </para>
69499   </listitem>
69500  </varlistentry>
69501 </variablelist>
69502</refsect1>
69503<refsect1>
69504<title>Context</title>
69505<para>
69506   can sleep
69507</para>
69508</refsect1>
69509<refsect1>
69510<title>Description</title>
69511<para>
69512   This call may only be used from a context that may sleep.  The sleep
69513   is non-interruptible, and has no timeout.  Low-overhead controller
69514   drivers may DMA directly into and out of the message buffers.
69515   </para><para>
69516
69517   This call should be used by drivers that require exclusive access to the
69518   SPI bus. It has to be preceded by a spi_bus_lock call. The SPI bus must
69519   be released by a spi_bus_unlock call when the exclusive access is over.
69520</para>
69521</refsect1>
69522<refsect1>
69523<title>Return</title>
69524<para>
69525   zero on success, else a negative error code.
69526</para>
69527</refsect1>
69528</refentry>
69529
69530<refentry id="API-spi-bus-lock">
69531<refentryinfo>
69532 <title>LINUX</title>
69533 <productname>Kernel Hackers Manual</productname>
69534 <date>July 2017</date>
69535</refentryinfo>
69536<refmeta>
69537 <refentrytitle><phrase>spi_bus_lock</phrase></refentrytitle>
69538 <manvolnum>9</manvolnum>
69539 <refmiscinfo class="version">4.4.14</refmiscinfo>
69540</refmeta>
69541<refnamediv>
69542 <refname>spi_bus_lock</refname>
69543 <refpurpose>
69544     obtain a lock for exclusive SPI bus usage
69545 </refpurpose>
69546</refnamediv>
69547<refsynopsisdiv>
69548 <title>Synopsis</title>
69549  <funcsynopsis><funcprototype>
69550   <funcdef>int <function>spi_bus_lock </function></funcdef>
69551   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
69552  </funcprototype></funcsynopsis>
69553</refsynopsisdiv>
69554<refsect1>
69555 <title>Arguments</title>
69556 <variablelist>
69557  <varlistentry>
69558   <term><parameter>master</parameter></term>
69559   <listitem>
69560    <para>
69561     SPI bus master that should be locked for exclusive bus access
69562    </para>
69563   </listitem>
69564  </varlistentry>
69565 </variablelist>
69566</refsect1>
69567<refsect1>
69568<title>Context</title>
69569<para>
69570   can sleep
69571</para>
69572</refsect1>
69573<refsect1>
69574<title>Description</title>
69575<para>
69576   This call may only be used from a context that may sleep.  The sleep
69577   is non-interruptible, and has no timeout.
69578   </para><para>
69579
69580   This call should be used by drivers that require exclusive access to the
69581   SPI bus. The SPI bus must be released by a spi_bus_unlock call when the
69582   exclusive access is over. Data transfer must be done by spi_sync_locked
69583   and spi_async_locked calls when the SPI bus lock is held.
69584</para>
69585</refsect1>
69586<refsect1>
69587<title>Return</title>
69588<para>
69589   always zero.
69590</para>
69591</refsect1>
69592</refentry>
69593
69594<refentry id="API-spi-bus-unlock">
69595<refentryinfo>
69596 <title>LINUX</title>
69597 <productname>Kernel Hackers Manual</productname>
69598 <date>July 2017</date>
69599</refentryinfo>
69600<refmeta>
69601 <refentrytitle><phrase>spi_bus_unlock</phrase></refentrytitle>
69602 <manvolnum>9</manvolnum>
69603 <refmiscinfo class="version">4.4.14</refmiscinfo>
69604</refmeta>
69605<refnamediv>
69606 <refname>spi_bus_unlock</refname>
69607 <refpurpose>
69608     release the lock for exclusive SPI bus usage
69609 </refpurpose>
69610</refnamediv>
69611<refsynopsisdiv>
69612 <title>Synopsis</title>
69613  <funcsynopsis><funcprototype>
69614   <funcdef>int <function>spi_bus_unlock </function></funcdef>
69615   <paramdef><link linkend="API-struct-spi-master">struct spi_master</link> * <parameter>master</parameter></paramdef>
69616  </funcprototype></funcsynopsis>
69617</refsynopsisdiv>
69618<refsect1>
69619 <title>Arguments</title>
69620 <variablelist>
69621  <varlistentry>
69622   <term><parameter>master</parameter></term>
69623   <listitem>
69624    <para>
69625     SPI bus master that was locked for exclusive bus access
69626    </para>
69627   </listitem>
69628  </varlistentry>
69629 </variablelist>
69630</refsect1>
69631<refsect1>
69632<title>Context</title>
69633<para>
69634   can sleep
69635</para>
69636</refsect1>
69637<refsect1>
69638<title>Description</title>
69639<para>
69640   This call may only be used from a context that may sleep.  The sleep
69641   is non-interruptible, and has no timeout.
69642   </para><para>
69643
69644   This call releases an SPI bus lock previously obtained by an spi_bus_lock
69645   call.
69646</para>
69647</refsect1>
69648<refsect1>
69649<title>Return</title>
69650<para>
69651   always zero.
69652</para>
69653</refsect1>
69654</refentry>
69655
69656<refentry id="API-spi-write-then-read">
69657<refentryinfo>
69658 <title>LINUX</title>
69659 <productname>Kernel Hackers Manual</productname>
69660 <date>July 2017</date>
69661</refentryinfo>
69662<refmeta>
69663 <refentrytitle><phrase>spi_write_then_read</phrase></refentrytitle>
69664 <manvolnum>9</manvolnum>
69665 <refmiscinfo class="version">4.4.14</refmiscinfo>
69666</refmeta>
69667<refnamediv>
69668 <refname>spi_write_then_read</refname>
69669 <refpurpose>
69670     SPI synchronous write followed by read
69671 </refpurpose>
69672</refnamediv>
69673<refsynopsisdiv>
69674 <title>Synopsis</title>
69675  <funcsynopsis><funcprototype>
69676   <funcdef>int <function>spi_write_then_read </function></funcdef>
69677   <paramdef><link linkend="API-struct-spi-device">struct spi_device</link> * <parameter>spi</parameter></paramdef>
69678   <paramdef>const void * <parameter>txbuf</parameter></paramdef>
69679   <paramdef>unsigned <parameter>n_tx</parameter></paramdef>
69680   <paramdef>void * <parameter>rxbuf</parameter></paramdef>
69681   <paramdef>unsigned <parameter>n_rx</parameter></paramdef>
69682  </funcprototype></funcsynopsis>
69683</refsynopsisdiv>
69684<refsect1>
69685 <title>Arguments</title>
69686 <variablelist>
69687  <varlistentry>
69688   <term><parameter>spi</parameter></term>
69689   <listitem>
69690    <para>
69691     device with which data will be exchanged
69692    </para>
69693   </listitem>
69694  </varlistentry>
69695  <varlistentry>
69696   <term><parameter>txbuf</parameter></term>
69697   <listitem>
69698    <para>
69699     data to be written (need not be dma-safe)
69700    </para>
69701   </listitem>
69702  </varlistentry>
69703  <varlistentry>
69704   <term><parameter>n_tx</parameter></term>
69705   <listitem>
69706    <para>
69707     size of txbuf, in bytes
69708    </para>
69709   </listitem>
69710  </varlistentry>
69711  <varlistentry>
69712   <term><parameter>rxbuf</parameter></term>
69713   <listitem>
69714    <para>
69715     buffer into which data will be read (need not be dma-safe)
69716    </para>
69717   </listitem>
69718  </varlistentry>
69719  <varlistentry>
69720   <term><parameter>n_rx</parameter></term>
69721   <listitem>
69722    <para>
69723     size of rxbuf, in bytes
69724    </para>
69725   </listitem>
69726  </varlistentry>
69727 </variablelist>
69728</refsect1>
69729<refsect1>
69730<title>Context</title>
69731<para>
69732   can sleep
69733</para>
69734</refsect1>
69735<refsect1>
69736<title>Description</title>
69737<para>
69738   This performs a half duplex MicroWire style transaction with the
69739   device, sending txbuf and then reading rxbuf.  The return value
69740   is zero for success, else a negative errno status code.
69741   This call may only be used from a context that may sleep.
69742   </para><para>
69743
69744   Parameters to this routine are always copied using a small buffer;
69745   portable code should never use this for more than 32 bytes.
69746   Performance-sensitive or bulk transfer code should instead use
69747   spi_{async,sync}() calls with dma-safe buffers.
69748</para>
69749</refsect1>
69750<refsect1>
69751<title>Return</title>
69752<para>
69753   zero on success, else a negative error code.
69754</para>
69755</refsect1>
69756</refentry>
69757
69758  </chapter>
69759
69760  <chapter id="i2c">
69761     <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
69762
69763     <para>
69764	I<superscript>2</superscript>C (or without fancy typography, "I2C")
69765	is an acronym for the "Inter-IC" bus, a simple bus protocol which is
69766	widely used where low data rate communications suffice.
69767	Since it's also a licensed trademark, some vendors use another
69768	name (such as "Two-Wire Interface", TWI) for the same bus.
69769	I2C only needs two signals (SCL for clock, SDA for data), conserving
69770	board real estate and minimizing signal quality issues.
69771	Most I2C devices use seven bit addresses, and bus speeds of up
69772	to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
69773	found wide use.
69774	I2C is a multi-master bus; open drain signaling is used to
69775	arbitrate between masters, as well as to handshake and to
69776	synchronize clocks from slower clients.
69777     </para>
69778
69779     <para>
69780	The Linux I2C programming interfaces support only the master
69781	side of bus interactions, not the slave side.
69782	The programming interface is structured around two kinds of driver,
69783	and two kinds of device.
69784	An I2C "Adapter Driver" abstracts the controller hardware; it binds
69785	to a physical device (perhaps a PCI device or platform_device) and
69786	exposes a <structname>struct i2c_adapter</structname> representing
69787	each I2C bus segment it manages.
69788	On each I2C bus segment will be I2C devices represented by a
69789	<structname><link linkend="API-struct-i2c-client">struct i2c_client</link></structname>.  Those devices will
69790	be bound to a <structname><link linkend="API-struct-i2c-driver">struct i2c_driver</link></structname>,
69791	which should follow the standard Linux driver model.
69792	(At this writing, a legacy model is more widely used.)
69793	There are functions to perform various I2C protocol operations; at
69794	this writing all such functions are usable only from task context.
69795     </para>
69796
69797     <para>
69798	The System Management Bus (SMBus) is a sibling protocol.  Most SMBus
69799	systems are also I2C conformant.  The electrical constraints are
69800	tighter for SMBus, and it standardizes particular protocol messages
69801	and idioms.  Controllers that support I2C can also support most
69802	SMBus operations, but SMBus controllers don't support all the protocol
69803	options that an I2C controller will.
69804	There are functions to perform various SMBus protocol operations,
69805	either using I2C primitives or by issuing SMBus commands to
69806	i2c_adapter devices which don't support those I2C operations.
69807     </para>
69808
69809<!-- include/linux/i2c.h -->
69810<refentry id="API-struct-i2c-driver">
69811<refentryinfo>
69812 <title>LINUX</title>
69813 <productname>Kernel Hackers Manual</productname>
69814 <date>July 2017</date>
69815</refentryinfo>
69816<refmeta>
69817 <refentrytitle><phrase>struct i2c_driver</phrase></refentrytitle>
69818 <manvolnum>9</manvolnum>
69819 <refmiscinfo class="version">4.4.14</refmiscinfo>
69820</refmeta>
69821<refnamediv>
69822 <refname>struct i2c_driver</refname>
69823 <refpurpose>
69824  represent an I2C device driver
69825 </refpurpose>
69826</refnamediv>
69827<refsynopsisdiv>
69828 <title>Synopsis</title>
69829  <programlisting>
69830struct i2c_driver {
69831  unsigned int class;
69832  int (* attach_adapter) (struct i2c_adapter *);
69833  int (* probe) (struct i2c_client *, const struct i2c_device_id *);
69834  int (* remove) (struct i2c_client *);
69835  void (* shutdown) (struct i2c_client *);
69836  void (* alert) (struct i2c_client *, unsigned int data);
69837  int (* command) (struct i2c_client *client, unsigned int cmd, void *arg);
69838  struct device_driver driver;
69839  const struct i2c_device_id * id_table;
69840  int (* detect) (struct i2c_client *, struct i2c_board_info *);
69841  const unsigned short * address_list;
69842  struct list_head clients;
69843};  </programlisting>
69844</refsynopsisdiv>
69845 <refsect1>
69846  <title>Members</title>
69847  <variablelist>
69848    <varlistentry>      <term>class</term>
69849      <listitem><para>
69850What kind of i2c device we instantiate (for detect)
69851      </para></listitem>
69852    </varlistentry>
69853    <varlistentry>      <term>attach_adapter</term>
69854      <listitem><para>
69855Callback for bus addition (deprecated)
69856      </para></listitem>
69857    </varlistentry>
69858    <varlistentry>      <term>probe</term>
69859      <listitem><para>
69860Callback for device binding
69861      </para></listitem>
69862    </varlistentry>
69863    <varlistentry>      <term>remove</term>
69864      <listitem><para>
69865Callback for device unbinding
69866      </para></listitem>
69867    </varlistentry>
69868    <varlistentry>      <term>shutdown</term>
69869      <listitem><para>
69870Callback for device shutdown
69871      </para></listitem>
69872    </varlistentry>
69873    <varlistentry>      <term>alert</term>
69874      <listitem><para>
69875Alert callback, for example for the SMBus alert protocol
69876      </para></listitem>
69877    </varlistentry>
69878    <varlistentry>      <term>command</term>
69879      <listitem><para>
69880Callback for bus-wide signaling (optional)
69881      </para></listitem>
69882    </varlistentry>
69883    <varlistentry>      <term>driver</term>
69884      <listitem><para>
69885Device driver model driver
69886      </para></listitem>
69887    </varlistentry>
69888    <varlistentry>      <term>id_table</term>
69889      <listitem><para>
69890List of I2C devices supported by this driver
69891      </para></listitem>
69892    </varlistentry>
69893    <varlistentry>      <term>detect</term>
69894      <listitem><para>
69895Callback for device detection
69896      </para></listitem>
69897    </varlistentry>
69898    <varlistentry>      <term>address_list</term>
69899      <listitem><para>
69900The I2C addresses to probe (for detect)
69901      </para></listitem>
69902    </varlistentry>
69903    <varlistentry>      <term>clients</term>
69904      <listitem><para>
69905List of detected clients we created (for i2c-core use only)
69906      </para></listitem>
69907    </varlistentry>
69908  </variablelist>
69909 </refsect1>
69910<refsect1>
69911<title>Description</title>
69912<para>
69913   The driver.owner field should be set to the module owner of this driver.
69914   The driver.name field should be set to the name of this driver.
69915   </para><para>
69916
69917   For automatic device detection, both <parameter>detect</parameter> and <parameter>address_list</parameter> must
69918   be defined. <parameter>class</parameter> should also be set, otherwise only devices forced
69919   with module parameters will be created. The detect function must
69920   fill at least the name field of the i2c_board_info structure it is
69921   handed upon successful detection, and possibly also the flags field.
69922   </para><para>
69923
69924   If <parameter>detect</parameter> is missing, the driver will still work fine for enumerated
69925   devices. Detected devices simply won't be supported. This is expected
69926   for the many I2C/SMBus devices which can't be detected reliably, and
69927   the ones which can always be enumerated in practice.
69928   </para><para>
69929
69930   The i2c_client structure which is handed to the <parameter>detect</parameter> callback is
69931   not a real i2c_client. It is initialized just enough so that you can
69932   call i2c_smbus_read_byte_data and friends on it. Don't do anything
69933   else with it. In particular, calling dev_dbg and friends on it is
69934   not allowed.
69935</para>
69936</refsect1>
69937</refentry>
69938
69939<refentry id="API-struct-i2c-client">
69940<refentryinfo>
69941 <title>LINUX</title>
69942 <productname>Kernel Hackers Manual</productname>
69943 <date>July 2017</date>
69944</refentryinfo>
69945<refmeta>
69946 <refentrytitle><phrase>struct i2c_client</phrase></refentrytitle>
69947 <manvolnum>9</manvolnum>
69948 <refmiscinfo class="version">4.4.14</refmiscinfo>
69949</refmeta>
69950<refnamediv>
69951 <refname>struct i2c_client</refname>
69952 <refpurpose>
69953     represent an I2C slave device
69954 </refpurpose>
69955</refnamediv>
69956<refsynopsisdiv>
69957 <title>Synopsis</title>
69958  <programlisting>
69959struct i2c_client {
69960  unsigned short flags;
69961  unsigned short addr;
69962  char name[I2C_NAME_SIZE];
69963  struct i2c_adapter * adapter;
69964  struct device dev;
69965  int irq;
69966  struct list_head detected;
69967#if IS_ENABLED(CONFIG_I2C_SLAVE)
69968  i2c_slave_cb_t slave_cb;
69969#endif
69970};  </programlisting>
69971</refsynopsisdiv>
69972 <refsect1>
69973  <title>Members</title>
69974  <variablelist>
69975    <varlistentry>      <term>flags</term>
69976      <listitem><para>
69977   I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
69978   I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking
69979      </para></listitem>
69980    </varlistentry>
69981    <varlistentry>      <term>addr</term>
69982      <listitem><para>
69983   Address used on the I2C bus connected to the parent adapter.
69984      </para></listitem>
69985    </varlistentry>
69986    <varlistentry>      <term>name[I2C_NAME_SIZE]</term>
69987      <listitem><para>
69988   Indicates the type of the device, usually a chip name that's
69989   generic enough to hide second-sourcing and compatible revisions.
69990      </para></listitem>
69991    </varlistentry>
69992    <varlistentry>      <term>adapter</term>
69993      <listitem><para>
69994   manages the bus segment hosting this I2C device
69995      </para></listitem>
69996    </varlistentry>
69997    <varlistentry>      <term>dev</term>
69998      <listitem><para>
69999   Driver model device node for the slave.
70000      </para></listitem>
70001    </varlistentry>
70002    <varlistentry>      <term>irq</term>
70003      <listitem><para>
70004   indicates the IRQ generated by this device (if any)
70005      </para></listitem>
70006    </varlistentry>
70007    <varlistentry>      <term>detected</term>
70008      <listitem><para>
70009   member of an i2c_driver.clients list or i2c-core's
70010   userspace_devices list
70011      </para></listitem>
70012    </varlistentry>
70013    <varlistentry>      <term>slave_cb</term>
70014      <listitem><para>
70015   Callback when I2C slave mode of an adapter is used. The adapter
70016   calls it to pass on slave events to the slave driver.
70017      </para></listitem>
70018    </varlistentry>
70019  </variablelist>
70020 </refsect1>
70021<refsect1>
70022<title>Description</title>
70023<para>
70024   An i2c_client identifies a single device (i.e. chip) connected to an
70025   i2c bus. The behaviour exposed to Linux is defined by the driver
70026   managing the device.
70027</para>
70028</refsect1>
70029</refentry>
70030
70031<refentry id="API-struct-i2c-board-info">
70032<refentryinfo>
70033 <title>LINUX</title>
70034 <productname>Kernel Hackers Manual</productname>
70035 <date>July 2017</date>
70036</refentryinfo>
70037<refmeta>
70038 <refentrytitle><phrase>struct i2c_board_info</phrase></refentrytitle>
70039 <manvolnum>9</manvolnum>
70040 <refmiscinfo class="version">4.4.14</refmiscinfo>
70041</refmeta>
70042<refnamediv>
70043 <refname>struct i2c_board_info</refname>
70044 <refpurpose>
70045     template for device creation
70046 </refpurpose>
70047</refnamediv>
70048<refsynopsisdiv>
70049 <title>Synopsis</title>
70050  <programlisting>
70051struct i2c_board_info {
70052  char type[I2C_NAME_SIZE];
70053  unsigned short flags;
70054  unsigned short addr;
70055  void * platform_data;
70056  struct dev_archdata * archdata;
70057  struct device_node * of_node;
70058  struct fwnode_handle * fwnode;
70059  int irq;
70060};  </programlisting>
70061</refsynopsisdiv>
70062 <refsect1>
70063  <title>Members</title>
70064  <variablelist>
70065    <varlistentry>      <term>type[I2C_NAME_SIZE]</term>
70066      <listitem><para>
70067   chip type, to initialize i2c_client.name
70068      </para></listitem>
70069    </varlistentry>
70070    <varlistentry>      <term>flags</term>
70071      <listitem><para>
70072   to initialize i2c_client.flags
70073      </para></listitem>
70074    </varlistentry>
70075    <varlistentry>      <term>addr</term>
70076      <listitem><para>
70077   stored in i2c_client.addr
70078      </para></listitem>
70079    </varlistentry>
70080    <varlistentry>      <term>platform_data</term>
70081      <listitem><para>
70082   stored in i2c_client.dev.platform_data
70083      </para></listitem>
70084    </varlistentry>
70085    <varlistentry>      <term>archdata</term>
70086      <listitem><para>
70087   copied into i2c_client.dev.archdata
70088      </para></listitem>
70089    </varlistentry>
70090    <varlistentry>      <term>of_node</term>
70091      <listitem><para>
70092   pointer to OpenFirmware device node
70093      </para></listitem>
70094    </varlistentry>
70095    <varlistentry>      <term>fwnode</term>
70096      <listitem><para>
70097   device node supplied by the platform firmware
70098      </para></listitem>
70099    </varlistentry>
70100    <varlistentry>      <term>irq</term>
70101      <listitem><para>
70102   stored in i2c_client.irq
70103      </para></listitem>
70104    </varlistentry>
70105  </variablelist>
70106 </refsect1>
70107<refsect1>
70108<title>Description</title>
70109<para>
70110   I2C doesn't actually support hardware probing, although controllers and
70111   devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's
70112   a device at a given address.  Drivers commonly need more information than
70113   that, such as chip type, configuration, associated IRQ, and so on.
70114   </para><para>
70115
70116   i2c_board_info is used to build tables of information listing I2C devices
70117   that are present.  This information is used to grow the driver model tree.
70118   For mainboards this is done statically using <function><link linkend="API-i2c-register-board-info">i2c_register_board_info</link></function>;
70119   bus numbers identify adapters that aren't yet available.  For add-on boards,
70120   <function><link linkend="API-i2c-new-device">i2c_new_device</link></function> does this dynamically with the adapter already known.
70121</para>
70122</refsect1>
70123</refentry>
70124
70125<refentry id="API-I2C-BOARD-INFO">
70126<refentryinfo>
70127 <title>LINUX</title>
70128 <productname>Kernel Hackers Manual</productname>
70129 <date>July 2017</date>
70130</refentryinfo>
70131<refmeta>
70132 <refentrytitle><phrase>I2C_BOARD_INFO</phrase></refentrytitle>
70133 <manvolnum>9</manvolnum>
70134 <refmiscinfo class="version">4.4.14</refmiscinfo>
70135</refmeta>
70136<refnamediv>
70137 <refname>I2C_BOARD_INFO</refname>
70138 <refpurpose>
70139     macro used to list an i2c device and its address
70140 </refpurpose>
70141</refnamediv>
70142<refsynopsisdiv>
70143 <title>Synopsis</title>
70144  <funcsynopsis><funcprototype>
70145   <funcdef> <function>I2C_BOARD_INFO </function></funcdef>
70146   <paramdef> <parameter>dev_type</parameter></paramdef>
70147   <paramdef> <parameter>dev_addr</parameter></paramdef>
70148  </funcprototype></funcsynopsis>
70149</refsynopsisdiv>
70150<refsect1>
70151 <title>Arguments</title>
70152 <variablelist>
70153  <varlistentry>
70154   <term><parameter>dev_type</parameter></term>
70155   <listitem>
70156    <para>
70157     identifies the device type
70158    </para>
70159   </listitem>
70160  </varlistentry>
70161  <varlistentry>
70162   <term><parameter>dev_addr</parameter></term>
70163   <listitem>
70164    <para>
70165     the device's address on the bus.
70166    </para>
70167   </listitem>
70168  </varlistentry>
70169 </variablelist>
70170</refsect1>
70171<refsect1>
70172<title>Description</title>
70173<para>
70174   This macro initializes essential fields of a struct i2c_board_info,
70175   declaring what has been provided on a particular board.  Optional
70176   fields (such as associated irq, or device-specific platform_data)
70177   are provided using conventional syntax.
70178</para>
70179</refsect1>
70180</refentry>
70181
70182<refentry id="API-struct-i2c-algorithm">
70183<refentryinfo>
70184 <title>LINUX</title>
70185 <productname>Kernel Hackers Manual</productname>
70186 <date>July 2017</date>
70187</refentryinfo>
70188<refmeta>
70189 <refentrytitle><phrase>struct i2c_algorithm</phrase></refentrytitle>
70190 <manvolnum>9</manvolnum>
70191 <refmiscinfo class="version">4.4.14</refmiscinfo>
70192</refmeta>
70193<refnamediv>
70194 <refname>struct i2c_algorithm</refname>
70195 <refpurpose>
70196     represent I2C transfer method
70197 </refpurpose>
70198</refnamediv>
70199<refsynopsisdiv>
70200 <title>Synopsis</title>
70201  <programlisting>
70202struct i2c_algorithm {
70203  int (* master_xfer) (struct i2c_adapter *adap, struct i2c_msg *msgs,int num);
70204  int (* smbus_xfer) (struct i2c_adapter *adap, u16 addr,unsigned short flags, char read_write,u8 command, int size, union i2c_smbus_data *data);
70205  u32 (* functionality) (struct i2c_adapter *);
70206#if IS_ENABLED(CONFIG_I2C_SLAVE)
70207  int (* reg_slave) (struct i2c_client *client);
70208  int (* unreg_slave) (struct i2c_client *client);
70209#endif
70210};  </programlisting>
70211</refsynopsisdiv>
70212 <refsect1>
70213  <title>Members</title>
70214  <variablelist>
70215    <varlistentry>      <term>master_xfer</term>
70216      <listitem><para>
70217   Issue a set of i2c transactions to the given I2C adapter
70218   defined by the msgs array, with num messages available to transfer via
70219   the adapter specified by adap.
70220      </para></listitem>
70221    </varlistentry>
70222    <varlistentry>      <term>smbus_xfer</term>
70223      <listitem><para>
70224   Issue smbus transactions to the given I2C adapter. If this
70225   is not present, then the bus layer will try and convert the SMBus calls
70226   into I2C transfers instead.
70227      </para></listitem>
70228    </varlistentry>
70229    <varlistentry>      <term>functionality</term>
70230      <listitem><para>
70231   Return the flags that this algorithm/adapter pair supports
70232   from the I2C_FUNC_* flags.
70233      </para></listitem>
70234    </varlistentry>
70235    <varlistentry>      <term>reg_slave</term>
70236      <listitem><para>
70237   Register given client to I2C slave mode of this adapter
70238      </para></listitem>
70239    </varlistentry>
70240    <varlistentry>      <term>unreg_slave</term>
70241      <listitem><para>
70242   Unregister given client from I2C slave mode of this adapter
70243      </para></listitem>
70244    </varlistentry>
70245  </variablelist>
70246 </refsect1>
70247<refsect1>
70248<title>The following structs are for those who like to implement new bus drivers</title>
70249<para>
70250   i2c_algorithm is the interface to a class of hardware solutions which can
70251   be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
70252   to name two of the most common.
70253   </para><para>
70254
70255   The return codes from the <parameter>master_xfer</parameter> field should indicate the type of
70256   error code that occurred during the transfer, as documented in the kernel
70257   Documentation file Documentation/i2c/fault-codes.
70258</para>
70259</refsect1>
70260</refentry>
70261
70262<refentry id="API-struct-i2c-bus-recovery-info">
70263<refentryinfo>
70264 <title>LINUX</title>
70265 <productname>Kernel Hackers Manual</productname>
70266 <date>July 2017</date>
70267</refentryinfo>
70268<refmeta>
70269 <refentrytitle><phrase>struct i2c_bus_recovery_info</phrase></refentrytitle>
70270 <manvolnum>9</manvolnum>
70271 <refmiscinfo class="version">4.4.14</refmiscinfo>
70272</refmeta>
70273<refnamediv>
70274 <refname>struct i2c_bus_recovery_info</refname>
70275 <refpurpose>
70276     I2C bus recovery information
70277 </refpurpose>
70278</refnamediv>
70279<refsynopsisdiv>
70280 <title>Synopsis</title>
70281  <programlisting>
70282struct i2c_bus_recovery_info {
70283  int (* recover_bus) (struct i2c_adapter *);
70284  int (* get_scl) (struct i2c_adapter *);
70285  void (* set_scl) (struct i2c_adapter *, int val);
70286  int (* get_sda) (struct i2c_adapter *);
70287  void (* prepare_recovery) (struct i2c_adapter *);
70288  void (* unprepare_recovery) (struct i2c_adapter *);
70289  int scl_gpio;
70290  int sda_gpio;
70291};  </programlisting>
70292</refsynopsisdiv>
70293 <refsect1>
70294  <title>Members</title>
70295  <variablelist>
70296    <varlistentry>      <term>recover_bus</term>
70297      <listitem><para>
70298   Recover routine. Either pass driver's <function>recover_bus</function> routine, or
70299   <function>i2c_generic_scl_recovery</function> or <function>i2c_generic_gpio_recovery</function>.
70300      </para></listitem>
70301    </varlistentry>
70302    <varlistentry>      <term>get_scl</term>
70303      <listitem><para>
70304   This gets current value of SCL line. Mandatory for generic SCL
70305   recovery. Used internally for generic GPIO recovery.
70306      </para></listitem>
70307    </varlistentry>
70308    <varlistentry>      <term>set_scl</term>
70309      <listitem><para>
70310   This sets/clears SCL line. Mandatory for generic SCL recovery. Used
70311   internally for generic GPIO recovery.
70312      </para></listitem>
70313    </varlistentry>
70314    <varlistentry>      <term>get_sda</term>
70315      <listitem><para>
70316   This gets current value of SDA line. Optional for generic SCL
70317   recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO
70318   recovery.
70319      </para></listitem>
70320    </varlistentry>
70321    <varlistentry>      <term>prepare_recovery</term>
70322      <listitem><para>
70323   This will be called before starting recovery. Platform may
70324   configure padmux here for SDA/SCL line or something else they want.
70325      </para></listitem>
70326    </varlistentry>
70327    <varlistentry>      <term>unprepare_recovery</term>
70328      <listitem><para>
70329   This will be called after completing recovery. Platform
70330   may configure padmux here for SDA/SCL line or something else they want.
70331      </para></listitem>
70332    </varlistentry>
70333    <varlistentry>      <term>scl_gpio</term>
70334      <listitem><para>
70335   gpio number of the SCL line. Only required for GPIO recovery.
70336      </para></listitem>
70337    </varlistentry>
70338    <varlistentry>      <term>sda_gpio</term>
70339      <listitem><para>
70340   gpio number of the SDA line. Only required for GPIO recovery.
70341      </para></listitem>
70342    </varlistentry>
70343  </variablelist>
70344 </refsect1>
70345</refentry>
70346
70347<refentry id="API-struct-i2c-adapter-quirks">
70348<refentryinfo>
70349 <title>LINUX</title>
70350 <productname>Kernel Hackers Manual</productname>
70351 <date>July 2017</date>
70352</refentryinfo>
70353<refmeta>
70354 <refentrytitle><phrase>struct i2c_adapter_quirks</phrase></refentrytitle>
70355 <manvolnum>9</manvolnum>
70356 <refmiscinfo class="version">4.4.14</refmiscinfo>
70357</refmeta>
70358<refnamediv>
70359 <refname>struct i2c_adapter_quirks</refname>
70360 <refpurpose>
70361     describe flaws of an i2c adapter
70362 </refpurpose>
70363</refnamediv>
70364<refsynopsisdiv>
70365 <title>Synopsis</title>
70366  <programlisting>
70367struct i2c_adapter_quirks {
70368  u64 flags;
70369  int max_num_msgs;
70370  u16 max_write_len;
70371  u16 max_read_len;
70372  u16 max_comb_1st_msg_len;
70373  u16 max_comb_2nd_msg_len;
70374};  </programlisting>
70375</refsynopsisdiv>
70376 <refsect1>
70377  <title>Members</title>
70378  <variablelist>
70379    <varlistentry>      <term>flags</term>
70380      <listitem><para>
70381   see I2C_AQ_* for possible flags and read below
70382      </para></listitem>
70383    </varlistentry>
70384    <varlistentry>      <term>max_num_msgs</term>
70385      <listitem><para>
70386   maximum number of messages per transfer
70387      </para></listitem>
70388    </varlistentry>
70389    <varlistentry>      <term>max_write_len</term>
70390      <listitem><para>
70391   maximum length of a write message
70392      </para></listitem>
70393    </varlistentry>
70394    <varlistentry>      <term>max_read_len</term>
70395      <listitem><para>
70396   maximum length of a read message
70397      </para></listitem>
70398    </varlistentry>
70399    <varlistentry>      <term>max_comb_1st_msg_len</term>
70400      <listitem><para>
70401   maximum length of the first msg in a combined message
70402      </para></listitem>
70403    </varlistentry>
70404    <varlistentry>      <term>max_comb_2nd_msg_len</term>
70405      <listitem><para>
70406   maximum length of the second msg in a combined message
70407      </para></listitem>
70408    </varlistentry>
70409  </variablelist>
70410 </refsect1>
70411<refsect1>
70412<title>Note about combined messages</title>
70413<para>
70414   Some I2C controllers can only send one message
70415   per transfer, plus something called combined message or write-then-read.
70416   This is (usually) a small write message followed by a read message and
70417   barely enough to access register based devices like EEPROMs. There is a flag
70418   to support this mode. It implies max_num_msg = 2 and does the length checks
70419   with max_comb_*_len because combined message mode usually has its own
70420   limitations. Because of HW implementations, some controllers can actually do
70421   write-then-anything or other variants. To support that, write-then-read has
70422   been broken out into smaller bits like write-first and read-second which can
70423   be combined as needed.
70424</para>
70425</refsect1>
70426</refentry>
70427
70428<refentry id="API-module-i2c-driver">
70429<refentryinfo>
70430 <title>LINUX</title>
70431 <productname>Kernel Hackers Manual</productname>
70432 <date>July 2017</date>
70433</refentryinfo>
70434<refmeta>
70435 <refentrytitle><phrase>module_i2c_driver</phrase></refentrytitle>
70436 <manvolnum>9</manvolnum>
70437 <refmiscinfo class="version">4.4.14</refmiscinfo>
70438</refmeta>
70439<refnamediv>
70440 <refname>module_i2c_driver</refname>
70441 <refpurpose>
70442     Helper macro for registering a I2C driver
70443 </refpurpose>
70444</refnamediv>
70445<refsynopsisdiv>
70446 <title>Synopsis</title>
70447  <funcsynopsis><funcprototype>
70448   <funcdef> <function>module_i2c_driver </function></funcdef>
70449   <paramdef> <parameter>__i2c_driver</parameter></paramdef>
70450  </funcprototype></funcsynopsis>
70451</refsynopsisdiv>
70452<refsect1>
70453 <title>Arguments</title>
70454 <variablelist>
70455  <varlistentry>
70456   <term><parameter>__i2c_driver</parameter></term>
70457   <listitem>
70458    <para>
70459     i2c_driver struct
70460    </para>
70461   </listitem>
70462  </varlistentry>
70463 </variablelist>
70464</refsect1>
70465<refsect1>
70466<title>Description</title>
70467<para>
70468   Helper macro for I2C drivers which do not do anything special in module
70469   init/exit. This eliminates a lot of boilerplate. Each module may only
70470   use this macro once, and calling it replaces <function>module_init</function> and <function>module_exit</function>
70471</para>
70472</refsect1>
70473</refentry>
70474
70475<refentry id="API-i2c-register-board-info">
70476<refentryinfo>
70477 <title>LINUX</title>
70478 <productname>Kernel Hackers Manual</productname>
70479 <date>July 2017</date>
70480</refentryinfo>
70481<refmeta>
70482 <refentrytitle><phrase>i2c_register_board_info</phrase></refentrytitle>
70483 <manvolnum>9</manvolnum>
70484 <refmiscinfo class="version">4.4.14</refmiscinfo>
70485</refmeta>
70486<refnamediv>
70487 <refname>i2c_register_board_info</refname>
70488 <refpurpose>
70489  statically declare I2C devices
70490 </refpurpose>
70491</refnamediv>
70492<refsynopsisdiv>
70493 <title>Synopsis</title>
70494  <funcsynopsis><funcprototype>
70495   <funcdef>int <function>i2c_register_board_info </function></funcdef>
70496   <paramdef>int <parameter>busnum</parameter></paramdef>
70497   <paramdef>struct i2c_board_info const * <parameter>info</parameter></paramdef>
70498   <paramdef>unsigned <parameter>len</parameter></paramdef>
70499  </funcprototype></funcsynopsis>
70500</refsynopsisdiv>
70501<refsect1>
70502 <title>Arguments</title>
70503 <variablelist>
70504  <varlistentry>
70505   <term><parameter>busnum</parameter></term>
70506   <listitem>
70507    <para>
70508     identifies the bus to which these devices belong
70509    </para>
70510   </listitem>
70511  </varlistentry>
70512  <varlistentry>
70513   <term><parameter>info</parameter></term>
70514   <listitem>
70515    <para>
70516     vector of i2c device descriptors
70517    </para>
70518   </listitem>
70519  </varlistentry>
70520  <varlistentry>
70521   <term><parameter>len</parameter></term>
70522   <listitem>
70523    <para>
70524     how many descriptors in the vector; may be zero to reserve
70525     the specified bus number.
70526    </para>
70527   </listitem>
70528  </varlistentry>
70529 </variablelist>
70530</refsect1>
70531<refsect1>
70532<title>Description</title>
70533<para>
70534   Systems using the Linux I2C driver stack can declare tables of board info
70535   while they initialize.  This should be done in board-specific init code
70536   near <function>arch_initcall</function> time, or equivalent, before any I2C adapter driver is
70537   registered.  For example, mainboard init code could define several devices,
70538   as could the init code for each daughtercard in a board stack.
70539   </para><para>
70540
70541   The I2C devices will be created later, after the adapter for the relevant
70542   bus has been registered.  After that moment, standard driver model tools
70543   are used to bind <quote>new style</quote> I2C drivers to the devices.  The bus number
70544   for any device declared using this routine is not available for dynamic
70545   allocation.
70546   </para><para>
70547
70548   The board info passed can safely be __initdata, but be careful of embedded
70549   pointers (for platform_data, functions, etc) since that won't be copied.
70550</para>
70551</refsect1>
70552</refentry>
70553
70554<!-- drivers/i2c/i2c-core.c -->
70555<refentry id="API-i2c-verify-client">
70556<refentryinfo>
70557 <title>LINUX</title>
70558 <productname>Kernel Hackers Manual</productname>
70559 <date>July 2017</date>
70560</refentryinfo>
70561<refmeta>
70562 <refentrytitle><phrase>i2c_verify_client</phrase></refentrytitle>
70563 <manvolnum>9</manvolnum>
70564 <refmiscinfo class="version">4.4.14</refmiscinfo>
70565</refmeta>
70566<refnamediv>
70567 <refname>i2c_verify_client</refname>
70568 <refpurpose>
70569  return parameter as i2c_client, or NULL
70570 </refpurpose>
70571</refnamediv>
70572<refsynopsisdiv>
70573 <title>Synopsis</title>
70574  <funcsynopsis><funcprototype>
70575   <funcdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <function>i2c_verify_client </function></funcdef>
70576   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
70577  </funcprototype></funcsynopsis>
70578</refsynopsisdiv>
70579<refsect1>
70580 <title>Arguments</title>
70581 <variablelist>
70582  <varlistentry>
70583   <term><parameter>dev</parameter></term>
70584   <listitem>
70585    <para>
70586     device, probably from some driver model iterator
70587    </para>
70588   </listitem>
70589  </varlistentry>
70590 </variablelist>
70591</refsect1>
70592<refsect1>
70593<title>Description</title>
70594<para>
70595   When traversing the driver model tree, perhaps using driver model
70596   iterators like <parameter>device_for_each_child</parameter>(), you can't assume very much
70597   about the nodes you find.  Use this function to avoid oopses caused
70598   by wrongly treating some non-I2C device as an i2c_client.
70599</para>
70600</refsect1>
70601</refentry>
70602
70603<refentry id="API-i2c-lock-adapter">
70604<refentryinfo>
70605 <title>LINUX</title>
70606 <productname>Kernel Hackers Manual</productname>
70607 <date>July 2017</date>
70608</refentryinfo>
70609<refmeta>
70610 <refentrytitle><phrase>i2c_lock_adapter</phrase></refentrytitle>
70611 <manvolnum>9</manvolnum>
70612 <refmiscinfo class="version">4.4.14</refmiscinfo>
70613</refmeta>
70614<refnamediv>
70615 <refname>i2c_lock_adapter</refname>
70616 <refpurpose>
70617     Get exclusive access to an I2C bus segment
70618 </refpurpose>
70619</refnamediv>
70620<refsynopsisdiv>
70621 <title>Synopsis</title>
70622  <funcsynopsis><funcprototype>
70623   <funcdef>void <function>i2c_lock_adapter </function></funcdef>
70624   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
70625  </funcprototype></funcsynopsis>
70626</refsynopsisdiv>
70627<refsect1>
70628 <title>Arguments</title>
70629 <variablelist>
70630  <varlistentry>
70631   <term><parameter>adapter</parameter></term>
70632   <listitem>
70633    <para>
70634     Target I2C bus segment
70635    </para>
70636   </listitem>
70637  </varlistentry>
70638 </variablelist>
70639</refsect1>
70640</refentry>
70641
70642<refentry id="API-i2c-unlock-adapter">
70643<refentryinfo>
70644 <title>LINUX</title>
70645 <productname>Kernel Hackers Manual</productname>
70646 <date>July 2017</date>
70647</refentryinfo>
70648<refmeta>
70649 <refentrytitle><phrase>i2c_unlock_adapter</phrase></refentrytitle>
70650 <manvolnum>9</manvolnum>
70651 <refmiscinfo class="version">4.4.14</refmiscinfo>
70652</refmeta>
70653<refnamediv>
70654 <refname>i2c_unlock_adapter</refname>
70655 <refpurpose>
70656     Release exclusive access to an I2C bus segment
70657 </refpurpose>
70658</refnamediv>
70659<refsynopsisdiv>
70660 <title>Synopsis</title>
70661  <funcsynopsis><funcprototype>
70662   <funcdef>void <function>i2c_unlock_adapter </function></funcdef>
70663   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
70664  </funcprototype></funcsynopsis>
70665</refsynopsisdiv>
70666<refsect1>
70667 <title>Arguments</title>
70668 <variablelist>
70669  <varlistentry>
70670   <term><parameter>adapter</parameter></term>
70671   <listitem>
70672    <para>
70673     Target I2C bus segment
70674    </para>
70675   </listitem>
70676  </varlistentry>
70677 </variablelist>
70678</refsect1>
70679</refentry>
70680
70681<refentry id="API-i2c-new-device">
70682<refentryinfo>
70683 <title>LINUX</title>
70684 <productname>Kernel Hackers Manual</productname>
70685 <date>July 2017</date>
70686</refentryinfo>
70687<refmeta>
70688 <refentrytitle><phrase>i2c_new_device</phrase></refentrytitle>
70689 <manvolnum>9</manvolnum>
70690 <refmiscinfo class="version">4.4.14</refmiscinfo>
70691</refmeta>
70692<refnamediv>
70693 <refname>i2c_new_device</refname>
70694 <refpurpose>
70695     instantiate an i2c device
70696 </refpurpose>
70697</refnamediv>
70698<refsynopsisdiv>
70699 <title>Synopsis</title>
70700  <funcsynopsis><funcprototype>
70701   <funcdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <function>i2c_new_device </function></funcdef>
70702   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
70703   <paramdef>struct i2c_board_info const * <parameter>info</parameter></paramdef>
70704  </funcprototype></funcsynopsis>
70705</refsynopsisdiv>
70706<refsect1>
70707 <title>Arguments</title>
70708 <variablelist>
70709  <varlistentry>
70710   <term><parameter>adap</parameter></term>
70711   <listitem>
70712    <para>
70713     the adapter managing the device
70714    </para>
70715   </listitem>
70716  </varlistentry>
70717  <varlistentry>
70718   <term><parameter>info</parameter></term>
70719   <listitem>
70720    <para>
70721     describes one I2C device; bus_num is ignored
70722    </para>
70723   </listitem>
70724  </varlistentry>
70725 </variablelist>
70726</refsect1>
70727<refsect1>
70728<title>Context</title>
70729<para>
70730   can sleep
70731</para>
70732</refsect1>
70733<refsect1>
70734<title>Description</title>
70735<para>
70736   Create an i2c device. Binding is handled through driver model
70737   <function>probe</function>/<function>remove</function> methods.  A driver may be bound to this device when we
70738   return from this function, or any later moment (e.g. maybe hotplugging will
70739   load the driver module).  This call is not appropriate for use by mainboard
70740   initialization logic, which usually runs during an <function>arch_initcall</function> long
70741   before any i2c_adapter could exist.
70742   </para><para>
70743
70744   This returns the new i2c client, which may be saved for later use with
70745   <function><link linkend="API-i2c-unregister-device">i2c_unregister_device</link></function>; or NULL to indicate an error.
70746</para>
70747</refsect1>
70748</refentry>
70749
70750<refentry id="API-i2c-unregister-device">
70751<refentryinfo>
70752 <title>LINUX</title>
70753 <productname>Kernel Hackers Manual</productname>
70754 <date>July 2017</date>
70755</refentryinfo>
70756<refmeta>
70757 <refentrytitle><phrase>i2c_unregister_device</phrase></refentrytitle>
70758 <manvolnum>9</manvolnum>
70759 <refmiscinfo class="version">4.4.14</refmiscinfo>
70760</refmeta>
70761<refnamediv>
70762 <refname>i2c_unregister_device</refname>
70763 <refpurpose>
70764     reverse effect of <function><link linkend="API-i2c-new-device">i2c_new_device</link></function>
70765 </refpurpose>
70766</refnamediv>
70767<refsynopsisdiv>
70768 <title>Synopsis</title>
70769  <funcsynopsis><funcprototype>
70770   <funcdef>void <function>i2c_unregister_device </function></funcdef>
70771   <paramdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <parameter>client</parameter></paramdef>
70772  </funcprototype></funcsynopsis>
70773</refsynopsisdiv>
70774<refsect1>
70775 <title>Arguments</title>
70776 <variablelist>
70777  <varlistentry>
70778   <term><parameter>client</parameter></term>
70779   <listitem>
70780    <para>
70781     value returned from <function><link linkend="API-i2c-new-device">i2c_new_device</link></function>
70782    </para>
70783   </listitem>
70784  </varlistentry>
70785 </variablelist>
70786</refsect1>
70787<refsect1>
70788<title>Context</title>
70789<para>
70790   can sleep
70791</para>
70792</refsect1>
70793</refentry>
70794
70795<refentry id="API-i2c-new-dummy">
70796<refentryinfo>
70797 <title>LINUX</title>
70798 <productname>Kernel Hackers Manual</productname>
70799 <date>July 2017</date>
70800</refentryinfo>
70801<refmeta>
70802 <refentrytitle><phrase>i2c_new_dummy</phrase></refentrytitle>
70803 <manvolnum>9</manvolnum>
70804 <refmiscinfo class="version">4.4.14</refmiscinfo>
70805</refmeta>
70806<refnamediv>
70807 <refname>i2c_new_dummy</refname>
70808 <refpurpose>
70809     return a new i2c device bound to a dummy driver
70810 </refpurpose>
70811</refnamediv>
70812<refsynopsisdiv>
70813 <title>Synopsis</title>
70814  <funcsynopsis><funcprototype>
70815   <funcdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <function>i2c_new_dummy </function></funcdef>
70816   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
70817   <paramdef>u16 <parameter>address</parameter></paramdef>
70818  </funcprototype></funcsynopsis>
70819</refsynopsisdiv>
70820<refsect1>
70821 <title>Arguments</title>
70822 <variablelist>
70823  <varlistentry>
70824   <term><parameter>adapter</parameter></term>
70825   <listitem>
70826    <para>
70827     the adapter managing the device
70828    </para>
70829   </listitem>
70830  </varlistentry>
70831  <varlistentry>
70832   <term><parameter>address</parameter></term>
70833   <listitem>
70834    <para>
70835     seven bit address to be used
70836    </para>
70837   </listitem>
70838  </varlistentry>
70839 </variablelist>
70840</refsect1>
70841<refsect1>
70842<title>Context</title>
70843<para>
70844   can sleep
70845</para>
70846</refsect1>
70847<refsect1>
70848<title>Description</title>
70849<para>
70850   This returns an I2C client bound to the <quote>dummy</quote> driver, intended for use
70851   with devices that consume multiple addresses.  Examples of such chips
70852   include various EEPROMS (like 24c04 and 24c08 models).
70853   </para><para>
70854
70855   These dummy devices have two main uses.  First, most I2C and SMBus calls
70856   except <function><link linkend="API-i2c-transfer">i2c_transfer</link></function> need a client handle; the dummy will be that handle.
70857   And second, this prevents the specified address from being bound to a
70858   different driver.
70859   </para><para>
70860
70861   This returns the new i2c client, which should be saved for later use with
70862   <function><link linkend="API-i2c-unregister-device">i2c_unregister_device</link></function>; or NULL to indicate an error.
70863</para>
70864</refsect1>
70865</refentry>
70866
70867<refentry id="API-i2c-verify-adapter">
70868<refentryinfo>
70869 <title>LINUX</title>
70870 <productname>Kernel Hackers Manual</productname>
70871 <date>July 2017</date>
70872</refentryinfo>
70873<refmeta>
70874 <refentrytitle><phrase>i2c_verify_adapter</phrase></refentrytitle>
70875 <manvolnum>9</manvolnum>
70876 <refmiscinfo class="version">4.4.14</refmiscinfo>
70877</refmeta>
70878<refnamediv>
70879 <refname>i2c_verify_adapter</refname>
70880 <refpurpose>
70881     return parameter as i2c_adapter or NULL
70882 </refpurpose>
70883</refnamediv>
70884<refsynopsisdiv>
70885 <title>Synopsis</title>
70886  <funcsynopsis><funcprototype>
70887   <funcdef>struct i2c_adapter * <function>i2c_verify_adapter </function></funcdef>
70888   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
70889  </funcprototype></funcsynopsis>
70890</refsynopsisdiv>
70891<refsect1>
70892 <title>Arguments</title>
70893 <variablelist>
70894  <varlistentry>
70895   <term><parameter>dev</parameter></term>
70896   <listitem>
70897    <para>
70898     device, probably from some driver model iterator
70899    </para>
70900   </listitem>
70901  </varlistentry>
70902 </variablelist>
70903</refsect1>
70904<refsect1>
70905<title>Description</title>
70906<para>
70907   When traversing the driver model tree, perhaps using driver model
70908   iterators like <parameter>device_for_each_child</parameter>(), you can't assume very much
70909   about the nodes you find.  Use this function to avoid oopses caused
70910   by wrongly treating some non-I2C device as an i2c_adapter.
70911</para>
70912</refsect1>
70913</refentry>
70914
70915<refentry id="API-i2c-add-adapter">
70916<refentryinfo>
70917 <title>LINUX</title>
70918 <productname>Kernel Hackers Manual</productname>
70919 <date>July 2017</date>
70920</refentryinfo>
70921<refmeta>
70922 <refentrytitle><phrase>i2c_add_adapter</phrase></refentrytitle>
70923 <manvolnum>9</manvolnum>
70924 <refmiscinfo class="version">4.4.14</refmiscinfo>
70925</refmeta>
70926<refnamediv>
70927 <refname>i2c_add_adapter</refname>
70928 <refpurpose>
70929     declare i2c adapter, use dynamic bus number
70930 </refpurpose>
70931</refnamediv>
70932<refsynopsisdiv>
70933 <title>Synopsis</title>
70934  <funcsynopsis><funcprototype>
70935   <funcdef>int <function>i2c_add_adapter </function></funcdef>
70936   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
70937  </funcprototype></funcsynopsis>
70938</refsynopsisdiv>
70939<refsect1>
70940 <title>Arguments</title>
70941 <variablelist>
70942  <varlistentry>
70943   <term><parameter>adapter</parameter></term>
70944   <listitem>
70945    <para>
70946     the adapter to add
70947    </para>
70948   </listitem>
70949  </varlistentry>
70950 </variablelist>
70951</refsect1>
70952<refsect1>
70953<title>Context</title>
70954<para>
70955   can sleep
70956</para>
70957</refsect1>
70958<refsect1>
70959<title>Description</title>
70960<para>
70961   This routine is used to declare an I2C adapter when its bus number
70962   doesn't matter or when its bus number is specified by an dt alias.
70963   Examples of bases when the bus number doesn't matter: I2C adapters
70964   dynamically added by USB links or PCI plugin cards.
70965   </para><para>
70966
70967   When this returns zero, a new bus number was allocated and stored
70968   in adap-&gt;nr, and the specified adapter became available for clients.
70969   Otherwise, a negative errno value is returned.
70970</para>
70971</refsect1>
70972</refentry>
70973
70974<refentry id="API-i2c-add-numbered-adapter">
70975<refentryinfo>
70976 <title>LINUX</title>
70977 <productname>Kernel Hackers Manual</productname>
70978 <date>July 2017</date>
70979</refentryinfo>
70980<refmeta>
70981 <refentrytitle><phrase>i2c_add_numbered_adapter</phrase></refentrytitle>
70982 <manvolnum>9</manvolnum>
70983 <refmiscinfo class="version">4.4.14</refmiscinfo>
70984</refmeta>
70985<refnamediv>
70986 <refname>i2c_add_numbered_adapter</refname>
70987 <refpurpose>
70988     declare i2c adapter, use static bus number
70989 </refpurpose>
70990</refnamediv>
70991<refsynopsisdiv>
70992 <title>Synopsis</title>
70993  <funcsynopsis><funcprototype>
70994   <funcdef>int <function>i2c_add_numbered_adapter </function></funcdef>
70995   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
70996  </funcprototype></funcsynopsis>
70997</refsynopsisdiv>
70998<refsect1>
70999 <title>Arguments</title>
71000 <variablelist>
71001  <varlistentry>
71002   <term><parameter>adap</parameter></term>
71003   <listitem>
71004    <para>
71005     the adapter to register (with adap-&gt;nr initialized)
71006    </para>
71007   </listitem>
71008  </varlistentry>
71009 </variablelist>
71010</refsect1>
71011<refsect1>
71012<title>Context</title>
71013<para>
71014   can sleep
71015</para>
71016</refsect1>
71017<refsect1>
71018<title>Description</title>
71019<para>
71020   This routine is used to declare an I2C adapter when its bus number
71021   matters.  For example, use it for I2C adapters from system-on-chip CPUs,
71022   or otherwise built in to the system's mainboard, and where i2c_board_info
71023   is used to properly configure I2C devices.
71024   </para><para>
71025
71026   If the requested bus number is set to -1, then this function will behave
71027   identically to i2c_add_adapter, and will dynamically assign a bus number.
71028   </para><para>
71029
71030   If no devices have pre-been declared for this bus, then be sure to
71031   register the adapter before any dynamically allocated ones.  Otherwise
71032   the required bus ID may not be available.
71033   </para><para>
71034
71035   When this returns zero, the specified adapter became available for
71036   clients using the bus number provided in adap-&gt;nr.  Also, the table
71037   of I2C devices pre-declared using <function><link linkend="API-i2c-register-board-info">i2c_register_board_info</link></function> is scanned,
71038   and the appropriate driver model device nodes are created.  Otherwise, a
71039   negative errno value is returned.
71040</para>
71041</refsect1>
71042</refentry>
71043
71044<refentry id="API-i2c-del-adapter">
71045<refentryinfo>
71046 <title>LINUX</title>
71047 <productname>Kernel Hackers Manual</productname>
71048 <date>July 2017</date>
71049</refentryinfo>
71050<refmeta>
71051 <refentrytitle><phrase>i2c_del_adapter</phrase></refentrytitle>
71052 <manvolnum>9</manvolnum>
71053 <refmiscinfo class="version">4.4.14</refmiscinfo>
71054</refmeta>
71055<refnamediv>
71056 <refname>i2c_del_adapter</refname>
71057 <refpurpose>
71058     unregister I2C adapter
71059 </refpurpose>
71060</refnamediv>
71061<refsynopsisdiv>
71062 <title>Synopsis</title>
71063  <funcsynopsis><funcprototype>
71064   <funcdef>void <function>i2c_del_adapter </function></funcdef>
71065   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
71066  </funcprototype></funcsynopsis>
71067</refsynopsisdiv>
71068<refsect1>
71069 <title>Arguments</title>
71070 <variablelist>
71071  <varlistentry>
71072   <term><parameter>adap</parameter></term>
71073   <listitem>
71074    <para>
71075     the adapter being unregistered
71076    </para>
71077   </listitem>
71078  </varlistentry>
71079 </variablelist>
71080</refsect1>
71081<refsect1>
71082<title>Context</title>
71083<para>
71084   can sleep
71085</para>
71086</refsect1>
71087<refsect1>
71088<title>Description</title>
71089<para>
71090   This unregisters an I2C adapter which was previously registered
71091   by <parameter>i2c_add_adapter</parameter> or <parameter>i2c_add_numbered_adapter</parameter>.
71092</para>
71093</refsect1>
71094</refentry>
71095
71096<refentry id="API-i2c-del-driver">
71097<refentryinfo>
71098 <title>LINUX</title>
71099 <productname>Kernel Hackers Manual</productname>
71100 <date>July 2017</date>
71101</refentryinfo>
71102<refmeta>
71103 <refentrytitle><phrase>i2c_del_driver</phrase></refentrytitle>
71104 <manvolnum>9</manvolnum>
71105 <refmiscinfo class="version">4.4.14</refmiscinfo>
71106</refmeta>
71107<refnamediv>
71108 <refname>i2c_del_driver</refname>
71109 <refpurpose>
71110     unregister I2C driver
71111 </refpurpose>
71112</refnamediv>
71113<refsynopsisdiv>
71114 <title>Synopsis</title>
71115  <funcsynopsis><funcprototype>
71116   <funcdef>void <function>i2c_del_driver </function></funcdef>
71117   <paramdef><link linkend="API-struct-i2c-driver">struct i2c_driver</link> * <parameter>driver</parameter></paramdef>
71118  </funcprototype></funcsynopsis>
71119</refsynopsisdiv>
71120<refsect1>
71121 <title>Arguments</title>
71122 <variablelist>
71123  <varlistentry>
71124   <term><parameter>driver</parameter></term>
71125   <listitem>
71126    <para>
71127     the driver being unregistered
71128    </para>
71129   </listitem>
71130  </varlistentry>
71131 </variablelist>
71132</refsect1>
71133<refsect1>
71134<title>Context</title>
71135<para>
71136   can sleep
71137</para>
71138</refsect1>
71139</refentry>
71140
71141<refentry id="API-i2c-use-client">
71142<refentryinfo>
71143 <title>LINUX</title>
71144 <productname>Kernel Hackers Manual</productname>
71145 <date>July 2017</date>
71146</refentryinfo>
71147<refmeta>
71148 <refentrytitle><phrase>i2c_use_client</phrase></refentrytitle>
71149 <manvolnum>9</manvolnum>
71150 <refmiscinfo class="version">4.4.14</refmiscinfo>
71151</refmeta>
71152<refnamediv>
71153 <refname>i2c_use_client</refname>
71154 <refpurpose>
71155     increments the reference count of the i2c client structure
71156 </refpurpose>
71157</refnamediv>
71158<refsynopsisdiv>
71159 <title>Synopsis</title>
71160  <funcsynopsis><funcprototype>
71161   <funcdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <function>i2c_use_client </function></funcdef>
71162   <paramdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <parameter>client</parameter></paramdef>
71163  </funcprototype></funcsynopsis>
71164</refsynopsisdiv>
71165<refsect1>
71166 <title>Arguments</title>
71167 <variablelist>
71168  <varlistentry>
71169   <term><parameter>client</parameter></term>
71170   <listitem>
71171    <para>
71172     the client being referenced
71173    </para>
71174   </listitem>
71175  </varlistentry>
71176 </variablelist>
71177</refsect1>
71178<refsect1>
71179<title>Description</title>
71180<para>
71181   Each live reference to a client should be refcounted. The driver model does
71182   that automatically as part of driver binding, so that most drivers don't
71183</para>
71184</refsect1>
71185<refsect1>
71186<title>need to do this explicitly</title>
71187<para>
71188   they hold a reference until they're unbound
71189   from the device.
71190   </para><para>
71191
71192   A pointer to the client with the incremented reference counter is returned.
71193</para>
71194</refsect1>
71195</refentry>
71196
71197<refentry id="API-i2c-release-client">
71198<refentryinfo>
71199 <title>LINUX</title>
71200 <productname>Kernel Hackers Manual</productname>
71201 <date>July 2017</date>
71202</refentryinfo>
71203<refmeta>
71204 <refentrytitle><phrase>i2c_release_client</phrase></refentrytitle>
71205 <manvolnum>9</manvolnum>
71206 <refmiscinfo class="version">4.4.14</refmiscinfo>
71207</refmeta>
71208<refnamediv>
71209 <refname>i2c_release_client</refname>
71210 <refpurpose>
71211     release a use of the i2c client structure
71212 </refpurpose>
71213</refnamediv>
71214<refsynopsisdiv>
71215 <title>Synopsis</title>
71216  <funcsynopsis><funcprototype>
71217   <funcdef>void <function>i2c_release_client </function></funcdef>
71218   <paramdef><link linkend="API-struct-i2c-client">struct i2c_client</link> * <parameter>client</parameter></paramdef>
71219  </funcprototype></funcsynopsis>
71220</refsynopsisdiv>
71221<refsect1>
71222 <title>Arguments</title>
71223 <variablelist>
71224  <varlistentry>
71225   <term><parameter>client</parameter></term>
71226   <listitem>
71227    <para>
71228     the client being no longer referenced
71229    </para>
71230   </listitem>
71231  </varlistentry>
71232 </variablelist>
71233</refsect1>
71234<refsect1>
71235<title>Description</title>
71236<para>
71237   Must be called when a user of a client is finished with it.
71238</para>
71239</refsect1>
71240</refentry>
71241
71242<refentry id="API---i2c-transfer">
71243<refentryinfo>
71244 <title>LINUX</title>
71245 <productname>Kernel Hackers Manual</productname>
71246 <date>July 2017</date>
71247</refentryinfo>
71248<refmeta>
71249 <refentrytitle><phrase>__i2c_transfer</phrase></refentrytitle>
71250 <manvolnum>9</manvolnum>
71251 <refmiscinfo class="version">4.4.14</refmiscinfo>
71252</refmeta>
71253<refnamediv>
71254 <refname>__i2c_transfer</refname>
71255 <refpurpose>
71256     unlocked flavor of i2c_transfer
71257 </refpurpose>
71258</refnamediv>
71259<refsynopsisdiv>
71260 <title>Synopsis</title>
71261  <funcsynopsis><funcprototype>
71262   <funcdef>int <function>__i2c_transfer </function></funcdef>
71263   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
71264   <paramdef>struct i2c_msg * <parameter>msgs</parameter></paramdef>
71265   <paramdef>int <parameter>num</parameter></paramdef>
71266  </funcprototype></funcsynopsis>
71267</refsynopsisdiv>
71268<refsect1>
71269 <title>Arguments</title>
71270 <variablelist>
71271  <varlistentry>
71272   <term><parameter>adap</parameter></term>
71273   <listitem>
71274    <para>
71275     Handle to I2C bus
71276    </para>
71277   </listitem>
71278  </varlistentry>
71279  <varlistentry>
71280   <term><parameter>msgs</parameter></term>
71281   <listitem>
71282    <para>
71283     One or more messages to execute before STOP is issued to
71284     terminate the operation; each message begins with a START.
71285    </para>
71286   </listitem>
71287  </varlistentry>
71288  <varlistentry>
71289   <term><parameter>num</parameter></term>
71290   <listitem>
71291    <para>
71292     Number of messages to be executed.
71293    </para>
71294   </listitem>
71295  </varlistentry>
71296 </variablelist>
71297</refsect1>
71298<refsect1>
71299<title>Description</title>
71300<para>
71301   Returns negative errno, else the number of messages executed.
71302   </para><para>
71303
71304   Adapter lock must be held when calling this function. No debug logging
71305   takes place. adap-&gt;algo-&gt;master_xfer existence isn't checked.
71306</para>
71307</refsect1>
71308</refentry>
71309
71310<refentry id="API-i2c-transfer">
71311<refentryinfo>
71312 <title>LINUX</title>
71313 <productname>Kernel Hackers Manual</productname>
71314 <date>July 2017</date>
71315</refentryinfo>
71316<refmeta>
71317 <refentrytitle><phrase>i2c_transfer</phrase></refentrytitle>
71318 <manvolnum>9</manvolnum>
71319 <refmiscinfo class="version">4.4.14</refmiscinfo>
71320</refmeta>
71321<refnamediv>
71322 <refname>i2c_transfer</refname>
71323 <refpurpose>
71324     execute a single or combined I2C message
71325 </refpurpose>
71326</refnamediv>
71327<refsynopsisdiv>
71328 <title>Synopsis</title>
71329  <funcsynopsis><funcprototype>
71330   <funcdef>int <function>i2c_transfer </function></funcdef>
71331   <paramdef>struct i2c_adapter * <parameter>adap</parameter></paramdef>
71332   <paramdef>struct i2c_msg * <parameter>msgs</parameter></paramdef>
71333   <paramdef>int <parameter>num</parameter></paramdef>
71334  </funcprototype></funcsynopsis>
71335</refsynopsisdiv>
71336<refsect1>
71337 <title>Arguments</title>
71338 <variablelist>
71339  <varlistentry>
71340   <term><parameter>adap</parameter></term>
71341   <listitem>
71342    <para>
71343     Handle to I2C bus
71344    </para>
71345   </listitem>
71346  </varlistentry>
71347  <varlistentry>
71348   <term><parameter>msgs</parameter></term>
71349   <listitem>
71350    <para>
71351     One or more messages to execute before STOP is issued to
71352     terminate the operation; each message begins with a START.
71353    </para>
71354   </listitem>
71355  </varlistentry>
71356  <varlistentry>
71357   <term><parameter>num</parameter></term>
71358   <listitem>
71359    <para>
71360     Number of messages to be executed.
71361    </para>
71362   </listitem>
71363  </varlistentry>
71364 </variablelist>
71365</refsect1>
71366<refsect1>
71367<title>Description</title>
71368<para>
71369   Returns negative errno, else the number of messages executed.
71370   </para><para>
71371
71372   Note that there is no requirement that each message be sent to
71373   the same slave address, although that is the most common model.
71374</para>
71375</refsect1>
71376</refentry>
71377
71378<refentry id="API-i2c-master-send">
71379<refentryinfo>
71380 <title>LINUX</title>
71381 <productname>Kernel Hackers Manual</productname>
71382 <date>July 2017</date>
71383</refentryinfo>
71384<refmeta>
71385 <refentrytitle><phrase>i2c_master_send</phrase></refentrytitle>
71386 <manvolnum>9</manvolnum>
71387 <refmiscinfo class="version">4.4.14</refmiscinfo>
71388</refmeta>
71389<refnamediv>
71390 <refname>i2c_master_send</refname>
71391 <refpurpose>
71392     issue a single I2C message in master transmit mode
71393 </refpurpose>
71394</refnamediv>
71395<refsynopsisdiv>
71396 <title>Synopsis</title>
71397  <funcsynopsis><funcprototype>
71398   <funcdef>int <function>i2c_master_send </function></funcdef>
71399   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71400   <paramdef>const char * <parameter>buf</parameter></paramdef>
71401   <paramdef>int <parameter>count</parameter></paramdef>
71402  </funcprototype></funcsynopsis>
71403</refsynopsisdiv>
71404<refsect1>
71405 <title>Arguments</title>
71406 <variablelist>
71407  <varlistentry>
71408   <term><parameter>client</parameter></term>
71409   <listitem>
71410    <para>
71411     Handle to slave device
71412    </para>
71413   </listitem>
71414  </varlistentry>
71415  <varlistentry>
71416   <term><parameter>buf</parameter></term>
71417   <listitem>
71418    <para>
71419     Data that will be written to the slave
71420    </para>
71421   </listitem>
71422  </varlistentry>
71423  <varlistentry>
71424   <term><parameter>count</parameter></term>
71425   <listitem>
71426    <para>
71427     How many bytes to write, must be less than 64k since msg.len is u16
71428    </para>
71429   </listitem>
71430  </varlistentry>
71431 </variablelist>
71432</refsect1>
71433<refsect1>
71434<title>Description</title>
71435<para>
71436   Returns negative errno, or else the number of bytes written.
71437</para>
71438</refsect1>
71439</refentry>
71440
71441<refentry id="API-i2c-master-recv">
71442<refentryinfo>
71443 <title>LINUX</title>
71444 <productname>Kernel Hackers Manual</productname>
71445 <date>July 2017</date>
71446</refentryinfo>
71447<refmeta>
71448 <refentrytitle><phrase>i2c_master_recv</phrase></refentrytitle>
71449 <manvolnum>9</manvolnum>
71450 <refmiscinfo class="version">4.4.14</refmiscinfo>
71451</refmeta>
71452<refnamediv>
71453 <refname>i2c_master_recv</refname>
71454 <refpurpose>
71455     issue a single I2C message in master receive mode
71456 </refpurpose>
71457</refnamediv>
71458<refsynopsisdiv>
71459 <title>Synopsis</title>
71460  <funcsynopsis><funcprototype>
71461   <funcdef>int <function>i2c_master_recv </function></funcdef>
71462   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71463   <paramdef>char * <parameter>buf</parameter></paramdef>
71464   <paramdef>int <parameter>count</parameter></paramdef>
71465  </funcprototype></funcsynopsis>
71466</refsynopsisdiv>
71467<refsect1>
71468 <title>Arguments</title>
71469 <variablelist>
71470  <varlistentry>
71471   <term><parameter>client</parameter></term>
71472   <listitem>
71473    <para>
71474     Handle to slave device
71475    </para>
71476   </listitem>
71477  </varlistentry>
71478  <varlistentry>
71479   <term><parameter>buf</parameter></term>
71480   <listitem>
71481    <para>
71482     Where to store data read from slave
71483    </para>
71484   </listitem>
71485  </varlistentry>
71486  <varlistentry>
71487   <term><parameter>count</parameter></term>
71488   <listitem>
71489    <para>
71490     How many bytes to read, must be less than 64k since msg.len is u16
71491    </para>
71492   </listitem>
71493  </varlistentry>
71494 </variablelist>
71495</refsect1>
71496<refsect1>
71497<title>Description</title>
71498<para>
71499   Returns negative errno, or else the number of bytes read.
71500</para>
71501</refsect1>
71502</refentry>
71503
71504<refentry id="API-i2c-smbus-read-byte">
71505<refentryinfo>
71506 <title>LINUX</title>
71507 <productname>Kernel Hackers Manual</productname>
71508 <date>July 2017</date>
71509</refentryinfo>
71510<refmeta>
71511 <refentrytitle><phrase>i2c_smbus_read_byte</phrase></refentrytitle>
71512 <manvolnum>9</manvolnum>
71513 <refmiscinfo class="version">4.4.14</refmiscinfo>
71514</refmeta>
71515<refnamediv>
71516 <refname>i2c_smbus_read_byte</refname>
71517 <refpurpose>
71518     SMBus <quote>receive byte</quote> protocol
71519 </refpurpose>
71520</refnamediv>
71521<refsynopsisdiv>
71522 <title>Synopsis</title>
71523  <funcsynopsis><funcprototype>
71524   <funcdef>s32 <function>i2c_smbus_read_byte </function></funcdef>
71525   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71526  </funcprototype></funcsynopsis>
71527</refsynopsisdiv>
71528<refsect1>
71529 <title>Arguments</title>
71530 <variablelist>
71531  <varlistentry>
71532   <term><parameter>client</parameter></term>
71533   <listitem>
71534    <para>
71535     Handle to slave device
71536    </para>
71537   </listitem>
71538  </varlistentry>
71539 </variablelist>
71540</refsect1>
71541<refsect1>
71542<title>Description</title>
71543<para>
71544   This executes the SMBus <quote>receive byte</quote> protocol, returning negative errno
71545   else the byte received from the device.
71546</para>
71547</refsect1>
71548</refentry>
71549
71550<refentry id="API-i2c-smbus-write-byte">
71551<refentryinfo>
71552 <title>LINUX</title>
71553 <productname>Kernel Hackers Manual</productname>
71554 <date>July 2017</date>
71555</refentryinfo>
71556<refmeta>
71557 <refentrytitle><phrase>i2c_smbus_write_byte</phrase></refentrytitle>
71558 <manvolnum>9</manvolnum>
71559 <refmiscinfo class="version">4.4.14</refmiscinfo>
71560</refmeta>
71561<refnamediv>
71562 <refname>i2c_smbus_write_byte</refname>
71563 <refpurpose>
71564     SMBus <quote>send byte</quote> protocol
71565 </refpurpose>
71566</refnamediv>
71567<refsynopsisdiv>
71568 <title>Synopsis</title>
71569  <funcsynopsis><funcprototype>
71570   <funcdef>s32 <function>i2c_smbus_write_byte </function></funcdef>
71571   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71572   <paramdef>u8 <parameter>value</parameter></paramdef>
71573  </funcprototype></funcsynopsis>
71574</refsynopsisdiv>
71575<refsect1>
71576 <title>Arguments</title>
71577 <variablelist>
71578  <varlistentry>
71579   <term><parameter>client</parameter></term>
71580   <listitem>
71581    <para>
71582     Handle to slave device
71583    </para>
71584   </listitem>
71585  </varlistentry>
71586  <varlistentry>
71587   <term><parameter>value</parameter></term>
71588   <listitem>
71589    <para>
71590     Byte to be sent
71591    </para>
71592   </listitem>
71593  </varlistentry>
71594 </variablelist>
71595</refsect1>
71596<refsect1>
71597<title>Description</title>
71598<para>
71599   This executes the SMBus <quote>send byte</quote> protocol, returning negative errno
71600   else zero on success.
71601</para>
71602</refsect1>
71603</refentry>
71604
71605<refentry id="API-i2c-smbus-read-byte-data">
71606<refentryinfo>
71607 <title>LINUX</title>
71608 <productname>Kernel Hackers Manual</productname>
71609 <date>July 2017</date>
71610</refentryinfo>
71611<refmeta>
71612 <refentrytitle><phrase>i2c_smbus_read_byte_data</phrase></refentrytitle>
71613 <manvolnum>9</manvolnum>
71614 <refmiscinfo class="version">4.4.14</refmiscinfo>
71615</refmeta>
71616<refnamediv>
71617 <refname>i2c_smbus_read_byte_data</refname>
71618 <refpurpose>
71619     SMBus <quote>read byte</quote> protocol
71620 </refpurpose>
71621</refnamediv>
71622<refsynopsisdiv>
71623 <title>Synopsis</title>
71624  <funcsynopsis><funcprototype>
71625   <funcdef>s32 <function>i2c_smbus_read_byte_data </function></funcdef>
71626   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71627   <paramdef>u8 <parameter>command</parameter></paramdef>
71628  </funcprototype></funcsynopsis>
71629</refsynopsisdiv>
71630<refsect1>
71631 <title>Arguments</title>
71632 <variablelist>
71633  <varlistentry>
71634   <term><parameter>client</parameter></term>
71635   <listitem>
71636    <para>
71637     Handle to slave device
71638    </para>
71639   </listitem>
71640  </varlistentry>
71641  <varlistentry>
71642   <term><parameter>command</parameter></term>
71643   <listitem>
71644    <para>
71645     Byte interpreted by slave
71646    </para>
71647   </listitem>
71648  </varlistentry>
71649 </variablelist>
71650</refsect1>
71651<refsect1>
71652<title>Description</title>
71653<para>
71654   This executes the SMBus <quote>read byte</quote> protocol, returning negative errno
71655   else a data byte received from the device.
71656</para>
71657</refsect1>
71658</refentry>
71659
71660<refentry id="API-i2c-smbus-write-byte-data">
71661<refentryinfo>
71662 <title>LINUX</title>
71663 <productname>Kernel Hackers Manual</productname>
71664 <date>July 2017</date>
71665</refentryinfo>
71666<refmeta>
71667 <refentrytitle><phrase>i2c_smbus_write_byte_data</phrase></refentrytitle>
71668 <manvolnum>9</manvolnum>
71669 <refmiscinfo class="version">4.4.14</refmiscinfo>
71670</refmeta>
71671<refnamediv>
71672 <refname>i2c_smbus_write_byte_data</refname>
71673 <refpurpose>
71674     SMBus <quote>write byte</quote> protocol
71675 </refpurpose>
71676</refnamediv>
71677<refsynopsisdiv>
71678 <title>Synopsis</title>
71679  <funcsynopsis><funcprototype>
71680   <funcdef>s32 <function>i2c_smbus_write_byte_data </function></funcdef>
71681   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71682   <paramdef>u8 <parameter>command</parameter></paramdef>
71683   <paramdef>u8 <parameter>value</parameter></paramdef>
71684  </funcprototype></funcsynopsis>
71685</refsynopsisdiv>
71686<refsect1>
71687 <title>Arguments</title>
71688 <variablelist>
71689  <varlistentry>
71690   <term><parameter>client</parameter></term>
71691   <listitem>
71692    <para>
71693     Handle to slave device
71694    </para>
71695   </listitem>
71696  </varlistentry>
71697  <varlistentry>
71698   <term><parameter>command</parameter></term>
71699   <listitem>
71700    <para>
71701     Byte interpreted by slave
71702    </para>
71703   </listitem>
71704  </varlistentry>
71705  <varlistentry>
71706   <term><parameter>value</parameter></term>
71707   <listitem>
71708    <para>
71709     Byte being written
71710    </para>
71711   </listitem>
71712  </varlistentry>
71713 </variablelist>
71714</refsect1>
71715<refsect1>
71716<title>Description</title>
71717<para>
71718   This executes the SMBus <quote>write byte</quote> protocol, returning negative errno
71719   else zero on success.
71720</para>
71721</refsect1>
71722</refentry>
71723
71724<refentry id="API-i2c-smbus-read-word-data">
71725<refentryinfo>
71726 <title>LINUX</title>
71727 <productname>Kernel Hackers Manual</productname>
71728 <date>July 2017</date>
71729</refentryinfo>
71730<refmeta>
71731 <refentrytitle><phrase>i2c_smbus_read_word_data</phrase></refentrytitle>
71732 <manvolnum>9</manvolnum>
71733 <refmiscinfo class="version">4.4.14</refmiscinfo>
71734</refmeta>
71735<refnamediv>
71736 <refname>i2c_smbus_read_word_data</refname>
71737 <refpurpose>
71738     SMBus <quote>read word</quote> protocol
71739 </refpurpose>
71740</refnamediv>
71741<refsynopsisdiv>
71742 <title>Synopsis</title>
71743  <funcsynopsis><funcprototype>
71744   <funcdef>s32 <function>i2c_smbus_read_word_data </function></funcdef>
71745   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71746   <paramdef>u8 <parameter>command</parameter></paramdef>
71747  </funcprototype></funcsynopsis>
71748</refsynopsisdiv>
71749<refsect1>
71750 <title>Arguments</title>
71751 <variablelist>
71752  <varlistentry>
71753   <term><parameter>client</parameter></term>
71754   <listitem>
71755    <para>
71756     Handle to slave device
71757    </para>
71758   </listitem>
71759  </varlistentry>
71760  <varlistentry>
71761   <term><parameter>command</parameter></term>
71762   <listitem>
71763    <para>
71764     Byte interpreted by slave
71765    </para>
71766   </listitem>
71767  </varlistentry>
71768 </variablelist>
71769</refsect1>
71770<refsect1>
71771<title>Description</title>
71772<para>
71773   This executes the SMBus <quote>read word</quote> protocol, returning negative errno
71774   else a 16-bit unsigned <quote>word</quote> received from the device.
71775</para>
71776</refsect1>
71777</refentry>
71778
71779<refentry id="API-i2c-smbus-write-word-data">
71780<refentryinfo>
71781 <title>LINUX</title>
71782 <productname>Kernel Hackers Manual</productname>
71783 <date>July 2017</date>
71784</refentryinfo>
71785<refmeta>
71786 <refentrytitle><phrase>i2c_smbus_write_word_data</phrase></refentrytitle>
71787 <manvolnum>9</manvolnum>
71788 <refmiscinfo class="version">4.4.14</refmiscinfo>
71789</refmeta>
71790<refnamediv>
71791 <refname>i2c_smbus_write_word_data</refname>
71792 <refpurpose>
71793     SMBus <quote>write word</quote> protocol
71794 </refpurpose>
71795</refnamediv>
71796<refsynopsisdiv>
71797 <title>Synopsis</title>
71798  <funcsynopsis><funcprototype>
71799   <funcdef>s32 <function>i2c_smbus_write_word_data </function></funcdef>
71800   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71801   <paramdef>u8 <parameter>command</parameter></paramdef>
71802   <paramdef>u16 <parameter>value</parameter></paramdef>
71803  </funcprototype></funcsynopsis>
71804</refsynopsisdiv>
71805<refsect1>
71806 <title>Arguments</title>
71807 <variablelist>
71808  <varlistentry>
71809   <term><parameter>client</parameter></term>
71810   <listitem>
71811    <para>
71812     Handle to slave device
71813    </para>
71814   </listitem>
71815  </varlistentry>
71816  <varlistentry>
71817   <term><parameter>command</parameter></term>
71818   <listitem>
71819    <para>
71820     Byte interpreted by slave
71821    </para>
71822   </listitem>
71823  </varlistentry>
71824  <varlistentry>
71825   <term><parameter>value</parameter></term>
71826   <listitem>
71827    <para>
71828     16-bit <quote>word</quote> being written
71829    </para>
71830   </listitem>
71831  </varlistentry>
71832 </variablelist>
71833</refsect1>
71834<refsect1>
71835<title>Description</title>
71836<para>
71837   This executes the SMBus <quote>write word</quote> protocol, returning negative errno
71838   else zero on success.
71839</para>
71840</refsect1>
71841</refentry>
71842
71843<refentry id="API-i2c-smbus-read-block-data">
71844<refentryinfo>
71845 <title>LINUX</title>
71846 <productname>Kernel Hackers Manual</productname>
71847 <date>July 2017</date>
71848</refentryinfo>
71849<refmeta>
71850 <refentrytitle><phrase>i2c_smbus_read_block_data</phrase></refentrytitle>
71851 <manvolnum>9</manvolnum>
71852 <refmiscinfo class="version">4.4.14</refmiscinfo>
71853</refmeta>
71854<refnamediv>
71855 <refname>i2c_smbus_read_block_data</refname>
71856 <refpurpose>
71857     SMBus <quote>block read</quote> protocol
71858 </refpurpose>
71859</refnamediv>
71860<refsynopsisdiv>
71861 <title>Synopsis</title>
71862  <funcsynopsis><funcprototype>
71863   <funcdef>s32 <function>i2c_smbus_read_block_data </function></funcdef>
71864   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71865   <paramdef>u8 <parameter>command</parameter></paramdef>
71866   <paramdef>u8 * <parameter>values</parameter></paramdef>
71867  </funcprototype></funcsynopsis>
71868</refsynopsisdiv>
71869<refsect1>
71870 <title>Arguments</title>
71871 <variablelist>
71872  <varlistentry>
71873   <term><parameter>client</parameter></term>
71874   <listitem>
71875    <para>
71876     Handle to slave device
71877    </para>
71878   </listitem>
71879  </varlistentry>
71880  <varlistentry>
71881   <term><parameter>command</parameter></term>
71882   <listitem>
71883    <para>
71884     Byte interpreted by slave
71885    </para>
71886   </listitem>
71887  </varlistentry>
71888  <varlistentry>
71889   <term><parameter>values</parameter></term>
71890   <listitem>
71891    <para>
71892     Byte array into which data will be read; big enough to hold
71893     the data returned by the slave.  SMBus allows at most 32 bytes.
71894    </para>
71895   </listitem>
71896  </varlistentry>
71897 </variablelist>
71898</refsect1>
71899<refsect1>
71900<title>Description</title>
71901<para>
71902   This executes the SMBus <quote>block read</quote> protocol, returning negative errno
71903   else the number of data bytes in the slave's response.
71904   </para><para>
71905
71906   Note that using this function requires that the client's adapter support
71907   the I2C_FUNC_SMBUS_READ_BLOCK_DATA functionality.  Not all adapter drivers
71908   support this; its emulation through I2C messaging relies on a specific
71909   mechanism (I2C_M_RECV_LEN) which may not be implemented.
71910</para>
71911</refsect1>
71912</refentry>
71913
71914<refentry id="API-i2c-smbus-write-block-data">
71915<refentryinfo>
71916 <title>LINUX</title>
71917 <productname>Kernel Hackers Manual</productname>
71918 <date>July 2017</date>
71919</refentryinfo>
71920<refmeta>
71921 <refentrytitle><phrase>i2c_smbus_write_block_data</phrase></refentrytitle>
71922 <manvolnum>9</manvolnum>
71923 <refmiscinfo class="version">4.4.14</refmiscinfo>
71924</refmeta>
71925<refnamediv>
71926 <refname>i2c_smbus_write_block_data</refname>
71927 <refpurpose>
71928     SMBus <quote>block write</quote> protocol
71929 </refpurpose>
71930</refnamediv>
71931<refsynopsisdiv>
71932 <title>Synopsis</title>
71933  <funcsynopsis><funcprototype>
71934   <funcdef>s32 <function>i2c_smbus_write_block_data </function></funcdef>
71935   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
71936   <paramdef>u8 <parameter>command</parameter></paramdef>
71937   <paramdef>u8 <parameter>length</parameter></paramdef>
71938   <paramdef>const u8 * <parameter>values</parameter></paramdef>
71939  </funcprototype></funcsynopsis>
71940</refsynopsisdiv>
71941<refsect1>
71942 <title>Arguments</title>
71943 <variablelist>
71944  <varlistentry>
71945   <term><parameter>client</parameter></term>
71946   <listitem>
71947    <para>
71948     Handle to slave device
71949    </para>
71950   </listitem>
71951  </varlistentry>
71952  <varlistentry>
71953   <term><parameter>command</parameter></term>
71954   <listitem>
71955    <para>
71956     Byte interpreted by slave
71957    </para>
71958   </listitem>
71959  </varlistentry>
71960  <varlistentry>
71961   <term><parameter>length</parameter></term>
71962   <listitem>
71963    <para>
71964     Size of data block; SMBus allows at most 32 bytes
71965    </para>
71966   </listitem>
71967  </varlistentry>
71968  <varlistentry>
71969   <term><parameter>values</parameter></term>
71970   <listitem>
71971    <para>
71972     Byte array which will be written.
71973    </para>
71974   </listitem>
71975  </varlistentry>
71976 </variablelist>
71977</refsect1>
71978<refsect1>
71979<title>Description</title>
71980<para>
71981   This executes the SMBus <quote>block write</quote> protocol, returning negative errno
71982   else zero on success.
71983</para>
71984</refsect1>
71985</refentry>
71986
71987<refentry id="API-i2c-smbus-xfer">
71988<refentryinfo>
71989 <title>LINUX</title>
71990 <productname>Kernel Hackers Manual</productname>
71991 <date>July 2017</date>
71992</refentryinfo>
71993<refmeta>
71994 <refentrytitle><phrase>i2c_smbus_xfer</phrase></refentrytitle>
71995 <manvolnum>9</manvolnum>
71996 <refmiscinfo class="version">4.4.14</refmiscinfo>
71997</refmeta>
71998<refnamediv>
71999 <refname>i2c_smbus_xfer</refname>
72000 <refpurpose>
72001     execute SMBus protocol operations
72002 </refpurpose>
72003</refnamediv>
72004<refsynopsisdiv>
72005 <title>Synopsis</title>
72006  <funcsynopsis><funcprototype>
72007   <funcdef>s32 <function>i2c_smbus_xfer </function></funcdef>
72008   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
72009   <paramdef>u16 <parameter>addr</parameter></paramdef>
72010   <paramdef>unsigned short <parameter>flags</parameter></paramdef>
72011   <paramdef>char <parameter>read_write</parameter></paramdef>
72012   <paramdef>u8 <parameter>command</parameter></paramdef>
72013   <paramdef>int <parameter>protocol</parameter></paramdef>
72014   <paramdef>union i2c_smbus_data * <parameter>data</parameter></paramdef>
72015  </funcprototype></funcsynopsis>
72016</refsynopsisdiv>
72017<refsect1>
72018 <title>Arguments</title>
72019 <variablelist>
72020  <varlistentry>
72021   <term><parameter>adapter</parameter></term>
72022   <listitem>
72023    <para>
72024     Handle to I2C bus
72025    </para>
72026   </listitem>
72027  </varlistentry>
72028  <varlistentry>
72029   <term><parameter>addr</parameter></term>
72030   <listitem>
72031    <para>
72032     Address of SMBus slave on that bus
72033    </para>
72034   </listitem>
72035  </varlistentry>
72036  <varlistentry>
72037   <term><parameter>flags</parameter></term>
72038   <listitem>
72039    <para>
72040     I2C_CLIENT_* flags (usually zero or I2C_CLIENT_PEC)
72041    </para>
72042   </listitem>
72043  </varlistentry>
72044  <varlistentry>
72045   <term><parameter>read_write</parameter></term>
72046   <listitem>
72047    <para>
72048     I2C_SMBUS_READ or I2C_SMBUS_WRITE
72049    </para>
72050   </listitem>
72051  </varlistentry>
72052  <varlistentry>
72053   <term><parameter>command</parameter></term>
72054   <listitem>
72055    <para>
72056     Byte interpreted by slave, for protocols which use such bytes
72057    </para>
72058   </listitem>
72059  </varlistentry>
72060  <varlistentry>
72061   <term><parameter>protocol</parameter></term>
72062   <listitem>
72063    <para>
72064     SMBus protocol operation to execute, such as I2C_SMBUS_PROC_CALL
72065    </para>
72066   </listitem>
72067  </varlistentry>
72068  <varlistentry>
72069   <term><parameter>data</parameter></term>
72070   <listitem>
72071    <para>
72072     Data to be read or written
72073    </para>
72074   </listitem>
72075  </varlistentry>
72076 </variablelist>
72077</refsect1>
72078<refsect1>
72079<title>Description</title>
72080<para>
72081   This executes an SMBus protocol operation, and returns a negative
72082   errno code else zero on success.
72083</para>
72084</refsect1>
72085</refentry>
72086
72087<refentry id="API-i2c-smbus-read-i2c-block-data-or-emulated">
72088<refentryinfo>
72089 <title>LINUX</title>
72090 <productname>Kernel Hackers Manual</productname>
72091 <date>July 2017</date>
72092</refentryinfo>
72093<refmeta>
72094 <refentrytitle><phrase>i2c_smbus_read_i2c_block_data_or_emulated</phrase></refentrytitle>
72095 <manvolnum>9</manvolnum>
72096 <refmiscinfo class="version">4.4.14</refmiscinfo>
72097</refmeta>
72098<refnamediv>
72099 <refname>i2c_smbus_read_i2c_block_data_or_emulated</refname>
72100 <refpurpose>
72101     read block or emulate
72102 </refpurpose>
72103</refnamediv>
72104<refsynopsisdiv>
72105 <title>Synopsis</title>
72106  <funcsynopsis><funcprototype>
72107   <funcdef>s32 <function>i2c_smbus_read_i2c_block_data_or_emulated </function></funcdef>
72108   <paramdef><link linkend="API-struct-i2c-client">const struct i2c_client</link> * <parameter>client</parameter></paramdef>
72109   <paramdef>u8 <parameter>command</parameter></paramdef>
72110   <paramdef>u8 <parameter>length</parameter></paramdef>
72111   <paramdef>u8 * <parameter>values</parameter></paramdef>
72112  </funcprototype></funcsynopsis>
72113</refsynopsisdiv>
72114<refsect1>
72115 <title>Arguments</title>
72116 <variablelist>
72117  <varlistentry>
72118   <term><parameter>client</parameter></term>
72119   <listitem>
72120    <para>
72121     Handle to slave device
72122    </para>
72123   </listitem>
72124  </varlistentry>
72125  <varlistentry>
72126   <term><parameter>command</parameter></term>
72127   <listitem>
72128    <para>
72129     Byte interpreted by slave
72130    </para>
72131   </listitem>
72132  </varlistentry>
72133  <varlistentry>
72134   <term><parameter>length</parameter></term>
72135   <listitem>
72136    <para>
72137     Size of data block; SMBus allows at most I2C_SMBUS_BLOCK_MAX bytes
72138    </para>
72139   </listitem>
72140  </varlistentry>
72141  <varlistentry>
72142   <term><parameter>values</parameter></term>
72143   <listitem>
72144    <para>
72145     Byte array into which data will be read; big enough to hold
72146     the data returned by the slave.  SMBus allows at most
72147     I2C_SMBUS_BLOCK_MAX bytes.
72148    </para>
72149   </listitem>
72150  </varlistentry>
72151 </variablelist>
72152</refsect1>
72153<refsect1>
72154<title>Description</title>
72155<para>
72156   This executes the SMBus <quote>block read</quote> protocol if supported by the adapter.
72157   If block read is not supported, it emulates it using either word or byte
72158   read protocols depending on availability.
72159   </para><para>
72160
72161   The addresses of the I2C slave device that are accessed with this function
72162   must be mapped to a linear region, so that a block read will have the same
72163   effect as a byte read. Before using this function you must double-check
72164   if the I2C slave does support exchanging a block transfer with a byte
72165   transfer.
72166</para>
72167</refsect1>
72168</refentry>
72169
72170  </chapter>
72171
72172  <chapter id="hsi">
72173     <title>High Speed Synchronous Serial Interface (HSI)</title>
72174
72175     <para>
72176	High Speed Synchronous Serial Interface (HSI) is a
72177	serial interface mainly used for connecting application
72178	engines (APE) with cellular modem engines (CMT) in cellular
72179	handsets.
72180
72181	HSI provides multiplexing for up to 16 logical channels,
72182	low-latency and full duplex communication.
72183     </para>
72184
72185<!-- include/linux/hsi/hsi.h -->
72186<refentry id="API-struct-hsi-channel">
72187<refentryinfo>
72188 <title>LINUX</title>
72189 <productname>Kernel Hackers Manual</productname>
72190 <date>July 2017</date>
72191</refentryinfo>
72192<refmeta>
72193 <refentrytitle><phrase>struct hsi_channel</phrase></refentrytitle>
72194 <manvolnum>9</manvolnum>
72195 <refmiscinfo class="version">4.4.14</refmiscinfo>
72196</refmeta>
72197<refnamediv>
72198 <refname>struct hsi_channel</refname>
72199 <refpurpose>
72200  channel resource used by the hsi clients
72201 </refpurpose>
72202</refnamediv>
72203<refsynopsisdiv>
72204 <title>Synopsis</title>
72205  <programlisting>
72206struct hsi_channel {
72207  unsigned int id;
72208  const char * name;
72209};  </programlisting>
72210</refsynopsisdiv>
72211 <refsect1>
72212  <title>Members</title>
72213  <variablelist>
72214    <varlistentry>      <term>id</term>
72215      <listitem><para>
72216Channel number
72217      </para></listitem>
72218    </varlistentry>
72219    <varlistentry>      <term>name</term>
72220      <listitem><para>
72221Channel name
72222      </para></listitem>
72223    </varlistentry>
72224  </variablelist>
72225 </refsect1>
72226</refentry>
72227
72228<refentry id="API-struct-hsi-config">
72229<refentryinfo>
72230 <title>LINUX</title>
72231 <productname>Kernel Hackers Manual</productname>
72232 <date>July 2017</date>
72233</refentryinfo>
72234<refmeta>
72235 <refentrytitle><phrase>struct hsi_config</phrase></refentrytitle>
72236 <manvolnum>9</manvolnum>
72237 <refmiscinfo class="version">4.4.14</refmiscinfo>
72238</refmeta>
72239<refnamediv>
72240 <refname>struct hsi_config</refname>
72241 <refpurpose>
72242     Configuration for RX/TX HSI modules
72243 </refpurpose>
72244</refnamediv>
72245<refsynopsisdiv>
72246 <title>Synopsis</title>
72247  <programlisting>
72248struct hsi_config {
72249  unsigned int mode;
72250  struct hsi_channel * channels;
72251  unsigned int num_channels;
72252  unsigned int num_hw_channels;
72253  unsigned int speed;
72254  union {unnamed_union};
72255};  </programlisting>
72256</refsynopsisdiv>
72257 <refsect1>
72258  <title>Members</title>
72259  <variablelist>
72260    <varlistentry>      <term>mode</term>
72261      <listitem><para>
72262   Bit transmission mode (STREAM or FRAME)
72263      </para></listitem>
72264    </varlistentry>
72265    <varlistentry>      <term>channels</term>
72266      <listitem><para>
72267   Channel resources used by the client
72268      </para></listitem>
72269    </varlistentry>
72270    <varlistentry>      <term>num_channels</term>
72271      <listitem><para>
72272   Number of channel resources
72273      </para></listitem>
72274    </varlistentry>
72275    <varlistentry>      <term>num_hw_channels</term>
72276      <listitem><para>
72277   Number of channels the transceiver is configured for [1..16]
72278      </para></listitem>
72279    </varlistentry>
72280    <varlistentry>      <term>speed</term>
72281      <listitem><para>
72282   Max bit transmission speed (Kbit/s)
72283      </para></listitem>
72284    </varlistentry>
72285    <varlistentry>      <term>{unnamed_union}</term>
72286      <listitem><para>
72287   anonymous
72288      </para></listitem>
72289    </varlistentry>
72290  </variablelist>
72291 </refsect1>
72292</refentry>
72293
72294<refentry id="API-struct-hsi-board-info">
72295<refentryinfo>
72296 <title>LINUX</title>
72297 <productname>Kernel Hackers Manual</productname>
72298 <date>July 2017</date>
72299</refentryinfo>
72300<refmeta>
72301 <refentrytitle><phrase>struct hsi_board_info</phrase></refentrytitle>
72302 <manvolnum>9</manvolnum>
72303 <refmiscinfo class="version">4.4.14</refmiscinfo>
72304</refmeta>
72305<refnamediv>
72306 <refname>struct hsi_board_info</refname>
72307 <refpurpose>
72308     HSI client board info
72309 </refpurpose>
72310</refnamediv>
72311<refsynopsisdiv>
72312 <title>Synopsis</title>
72313  <programlisting>
72314struct hsi_board_info {
72315  const char * name;
72316  unsigned int hsi_id;
72317  unsigned int port;
72318  struct hsi_config tx_cfg;
72319  struct hsi_config rx_cfg;
72320  void * platform_data;
72321  struct dev_archdata * archdata;
72322};  </programlisting>
72323</refsynopsisdiv>
72324 <refsect1>
72325  <title>Members</title>
72326  <variablelist>
72327    <varlistentry>      <term>name</term>
72328      <listitem><para>
72329   Name for the HSI device
72330      </para></listitem>
72331    </varlistentry>
72332    <varlistentry>      <term>hsi_id</term>
72333      <listitem><para>
72334   HSI controller id where the client sits
72335      </para></listitem>
72336    </varlistentry>
72337    <varlistentry>      <term>port</term>
72338      <listitem><para>
72339   Port number in the controller where the client sits
72340      </para></listitem>
72341    </varlistentry>
72342    <varlistentry>      <term>tx_cfg</term>
72343      <listitem><para>
72344   HSI TX configuration
72345      </para></listitem>
72346    </varlistentry>
72347    <varlistentry>      <term>rx_cfg</term>
72348      <listitem><para>
72349   HSI RX configuration
72350      </para></listitem>
72351    </varlistentry>
72352    <varlistentry>      <term>platform_data</term>
72353      <listitem><para>
72354   Platform related data
72355      </para></listitem>
72356    </varlistentry>
72357    <varlistentry>      <term>archdata</term>
72358      <listitem><para>
72359   Architecture-dependent device data
72360      </para></listitem>
72361    </varlistentry>
72362  </variablelist>
72363 </refsect1>
72364</refentry>
72365
72366<refentry id="API-struct-hsi-client">
72367<refentryinfo>
72368 <title>LINUX</title>
72369 <productname>Kernel Hackers Manual</productname>
72370 <date>July 2017</date>
72371</refentryinfo>
72372<refmeta>
72373 <refentrytitle><phrase>struct hsi_client</phrase></refentrytitle>
72374 <manvolnum>9</manvolnum>
72375 <refmiscinfo class="version">4.4.14</refmiscinfo>
72376</refmeta>
72377<refnamediv>
72378 <refname>struct hsi_client</refname>
72379 <refpurpose>
72380     HSI client attached to an HSI port
72381 </refpurpose>
72382</refnamediv>
72383<refsynopsisdiv>
72384 <title>Synopsis</title>
72385  <programlisting>
72386struct hsi_client {
72387  struct device device;
72388  struct hsi_config tx_cfg;
72389  struct hsi_config rx_cfg;
72390};  </programlisting>
72391</refsynopsisdiv>
72392 <refsect1>
72393  <title>Members</title>
72394  <variablelist>
72395    <varlistentry>      <term>device</term>
72396      <listitem><para>
72397   Driver model representation of the device
72398      </para></listitem>
72399    </varlistentry>
72400    <varlistentry>      <term>tx_cfg</term>
72401      <listitem><para>
72402   HSI TX configuration
72403      </para></listitem>
72404    </varlistentry>
72405    <varlistentry>      <term>rx_cfg</term>
72406      <listitem><para>
72407   HSI RX configuration
72408      </para></listitem>
72409    </varlistentry>
72410  </variablelist>
72411 </refsect1>
72412</refentry>
72413
72414<refentry id="API-struct-hsi-client-driver">
72415<refentryinfo>
72416 <title>LINUX</title>
72417 <productname>Kernel Hackers Manual</productname>
72418 <date>July 2017</date>
72419</refentryinfo>
72420<refmeta>
72421 <refentrytitle><phrase>struct hsi_client_driver</phrase></refentrytitle>
72422 <manvolnum>9</manvolnum>
72423 <refmiscinfo class="version">4.4.14</refmiscinfo>
72424</refmeta>
72425<refnamediv>
72426 <refname>struct hsi_client_driver</refname>
72427 <refpurpose>
72428     Driver associated to an HSI client
72429 </refpurpose>
72430</refnamediv>
72431<refsynopsisdiv>
72432 <title>Synopsis</title>
72433  <programlisting>
72434struct hsi_client_driver {
72435  struct device_driver driver;
72436};  </programlisting>
72437</refsynopsisdiv>
72438 <refsect1>
72439  <title>Members</title>
72440  <variablelist>
72441    <varlistentry>      <term>driver</term>
72442      <listitem><para>
72443   Driver model representation of the driver
72444      </para></listitem>
72445    </varlistentry>
72446  </variablelist>
72447 </refsect1>
72448</refentry>
72449
72450<refentry id="API-struct-hsi-msg">
72451<refentryinfo>
72452 <title>LINUX</title>
72453 <productname>Kernel Hackers Manual</productname>
72454 <date>July 2017</date>
72455</refentryinfo>
72456<refmeta>
72457 <refentrytitle><phrase>struct hsi_msg</phrase></refentrytitle>
72458 <manvolnum>9</manvolnum>
72459 <refmiscinfo class="version">4.4.14</refmiscinfo>
72460</refmeta>
72461<refnamediv>
72462 <refname>struct hsi_msg</refname>
72463 <refpurpose>
72464     HSI message descriptor
72465 </refpurpose>
72466</refnamediv>
72467<refsynopsisdiv>
72468 <title>Synopsis</title>
72469  <programlisting>
72470struct hsi_msg {
72471  struct list_head link;
72472  struct hsi_client * cl;
72473  struct sg_table sgt;
72474  void * context;
72475  void (* complete) (struct hsi_msg *msg);
72476  void (* destructor) (struct hsi_msg *msg);
72477  int status;
72478  unsigned int actual_len;
72479  unsigned int channel;
72480  unsigned int ttype:1;
72481  unsigned int break_frame:1;
72482};  </programlisting>
72483</refsynopsisdiv>
72484 <refsect1>
72485  <title>Members</title>
72486  <variablelist>
72487    <varlistentry>      <term>link</term>
72488      <listitem><para>
72489   Free to use by the current descriptor owner
72490      </para></listitem>
72491    </varlistentry>
72492    <varlistentry>      <term>cl</term>
72493      <listitem><para>
72494   HSI device client that issues the transfer
72495      </para></listitem>
72496    </varlistentry>
72497    <varlistentry>      <term>sgt</term>
72498      <listitem><para>
72499   Head of the scatterlist array
72500      </para></listitem>
72501    </varlistentry>
72502    <varlistentry>      <term>context</term>
72503      <listitem><para>
72504   Client context data associated to the transfer
72505      </para></listitem>
72506    </varlistentry>
72507    <varlistentry>      <term>complete</term>
72508      <listitem><para>
72509   Transfer completion callback
72510      </para></listitem>
72511    </varlistentry>
72512    <varlistentry>      <term>destructor</term>
72513      <listitem><para>
72514   Destructor to free resources when flushing
72515      </para></listitem>
72516    </varlistentry>
72517    <varlistentry>      <term>status</term>
72518      <listitem><para>
72519   Status of the transfer when completed
72520      </para></listitem>
72521    </varlistentry>
72522    <varlistentry>      <term>actual_len</term>
72523      <listitem><para>
72524   Actual length of data transferred on completion
72525      </para></listitem>
72526    </varlistentry>
72527    <varlistentry>      <term>channel</term>
72528      <listitem><para>
72529   Channel were to TX/RX the message
72530      </para></listitem>
72531    </varlistentry>
72532    <varlistentry>      <term>ttype</term>
72533      <listitem><para>
72534   Transfer type (TX if set, RX otherwise)
72535      </para></listitem>
72536    </varlistentry>
72537    <varlistentry>      <term>break_frame</term>
72538      <listitem><para>
72539   if true HSI will send/receive a break frame. Data buffers are
72540   ignored in the request.
72541      </para></listitem>
72542    </varlistentry>
72543  </variablelist>
72544 </refsect1>
72545</refentry>
72546
72547<refentry id="API-struct-hsi-port">
72548<refentryinfo>
72549 <title>LINUX</title>
72550 <productname>Kernel Hackers Manual</productname>
72551 <date>July 2017</date>
72552</refentryinfo>
72553<refmeta>
72554 <refentrytitle><phrase>struct hsi_port</phrase></refentrytitle>
72555 <manvolnum>9</manvolnum>
72556 <refmiscinfo class="version">4.4.14</refmiscinfo>
72557</refmeta>
72558<refnamediv>
72559 <refname>struct hsi_port</refname>
72560 <refpurpose>
72561     HSI port device
72562 </refpurpose>
72563</refnamediv>
72564<refsynopsisdiv>
72565 <title>Synopsis</title>
72566  <programlisting>
72567struct hsi_port {
72568  struct device device;
72569  struct hsi_config tx_cfg;
72570  struct hsi_config rx_cfg;
72571  unsigned int num;
72572  unsigned int shared:1;
72573  int claimed;
72574  struct mutex lock;
72575  int (* async) (struct hsi_msg *msg);
72576  int (* setup) (struct hsi_client *cl);
72577  int (* flush) (struct hsi_client *cl);
72578  int (* start_tx) (struct hsi_client *cl);
72579  int (* stop_tx) (struct hsi_client *cl);
72580  int (* release) (struct hsi_client *cl);
72581  struct atomic_notifier_head n_head;
72582};  </programlisting>
72583</refsynopsisdiv>
72584 <refsect1>
72585  <title>Members</title>
72586  <variablelist>
72587    <varlistentry>      <term>device</term>
72588      <listitem><para>
72589   Driver model representation of the device
72590      </para></listitem>
72591    </varlistentry>
72592    <varlistentry>      <term>tx_cfg</term>
72593      <listitem><para>
72594   Current TX path configuration
72595      </para></listitem>
72596    </varlistentry>
72597    <varlistentry>      <term>rx_cfg</term>
72598      <listitem><para>
72599   Current RX path configuration
72600      </para></listitem>
72601    </varlistentry>
72602    <varlistentry>      <term>num</term>
72603      <listitem><para>
72604   Port number
72605      </para></listitem>
72606    </varlistentry>
72607    <varlistentry>      <term>shared</term>
72608      <listitem><para>
72609   Set when port can be shared by different clients
72610      </para></listitem>
72611    </varlistentry>
72612    <varlistentry>      <term>claimed</term>
72613      <listitem><para>
72614   Reference count of clients which claimed the port
72615      </para></listitem>
72616    </varlistentry>
72617    <varlistentry>      <term>lock</term>
72618      <listitem><para>
72619   Serialize port claim
72620      </para></listitem>
72621    </varlistentry>
72622    <varlistentry>      <term>async</term>
72623      <listitem><para>
72624   Asynchronous transfer callback
72625      </para></listitem>
72626    </varlistentry>
72627    <varlistentry>      <term>setup</term>
72628      <listitem><para>
72629   Callback to set the HSI client configuration
72630      </para></listitem>
72631    </varlistentry>
72632    <varlistentry>      <term>flush</term>
72633      <listitem><para>
72634   Callback to clean the HW state and destroy all pending transfers
72635      </para></listitem>
72636    </varlistentry>
72637    <varlistentry>      <term>start_tx</term>
72638      <listitem><para>
72639   Callback to inform that a client wants to TX data
72640      </para></listitem>
72641    </varlistentry>
72642    <varlistentry>      <term>stop_tx</term>
72643      <listitem><para>
72644   Callback to inform that a client no longer wishes to TX data
72645      </para></listitem>
72646    </varlistentry>
72647    <varlistentry>      <term>release</term>
72648      <listitem><para>
72649   Callback to inform that a client no longer uses the port
72650      </para></listitem>
72651    </varlistentry>
72652    <varlistentry>      <term>n_head</term>
72653      <listitem><para>
72654   Notifier chain for signaling port events to the clients.
72655      </para></listitem>
72656    </varlistentry>
72657  </variablelist>
72658 </refsect1>
72659</refentry>
72660
72661<refentry id="API-struct-hsi-controller">
72662<refentryinfo>
72663 <title>LINUX</title>
72664 <productname>Kernel Hackers Manual</productname>
72665 <date>July 2017</date>
72666</refentryinfo>
72667<refmeta>
72668 <refentrytitle><phrase>struct hsi_controller</phrase></refentrytitle>
72669 <manvolnum>9</manvolnum>
72670 <refmiscinfo class="version">4.4.14</refmiscinfo>
72671</refmeta>
72672<refnamediv>
72673 <refname>struct hsi_controller</refname>
72674 <refpurpose>
72675     HSI controller device
72676 </refpurpose>
72677</refnamediv>
72678<refsynopsisdiv>
72679 <title>Synopsis</title>
72680  <programlisting>
72681struct hsi_controller {
72682  struct device device;
72683  struct module * owner;
72684  unsigned int id;
72685  unsigned int num_ports;
72686  struct hsi_port ** port;
72687};  </programlisting>
72688</refsynopsisdiv>
72689 <refsect1>
72690  <title>Members</title>
72691  <variablelist>
72692    <varlistentry>      <term>device</term>
72693      <listitem><para>
72694   Driver model representation of the device
72695      </para></listitem>
72696    </varlistentry>
72697    <varlistentry>      <term>owner</term>
72698      <listitem><para>
72699   Pointer to the module owning the controller
72700      </para></listitem>
72701    </varlistentry>
72702    <varlistentry>      <term>id</term>
72703      <listitem><para>
72704   HSI controller ID
72705      </para></listitem>
72706    </varlistentry>
72707    <varlistentry>      <term>num_ports</term>
72708      <listitem><para>
72709   Number of ports in the HSI controller
72710      </para></listitem>
72711    </varlistentry>
72712    <varlistentry>      <term>port</term>
72713      <listitem><para>
72714   Array of HSI ports
72715      </para></listitem>
72716    </varlistentry>
72717  </variablelist>
72718 </refsect1>
72719</refentry>
72720
72721<refentry id="API-hsi-id">
72722<refentryinfo>
72723 <title>LINUX</title>
72724 <productname>Kernel Hackers Manual</productname>
72725 <date>July 2017</date>
72726</refentryinfo>
72727<refmeta>
72728 <refentrytitle><phrase>hsi_id</phrase></refentrytitle>
72729 <manvolnum>9</manvolnum>
72730 <refmiscinfo class="version">4.4.14</refmiscinfo>
72731</refmeta>
72732<refnamediv>
72733 <refname>hsi_id</refname>
72734 <refpurpose>
72735     Get HSI controller ID associated to a client
72736 </refpurpose>
72737</refnamediv>
72738<refsynopsisdiv>
72739 <title>Synopsis</title>
72740  <funcsynopsis><funcprototype>
72741   <funcdef>unsigned int <function>hsi_id </function></funcdef>
72742   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
72743  </funcprototype></funcsynopsis>
72744</refsynopsisdiv>
72745<refsect1>
72746 <title>Arguments</title>
72747 <variablelist>
72748  <varlistentry>
72749   <term><parameter>cl</parameter></term>
72750   <listitem>
72751    <para>
72752     Pointer to a HSI client
72753    </para>
72754   </listitem>
72755  </varlistentry>
72756 </variablelist>
72757</refsect1>
72758<refsect1>
72759<title>Description</title>
72760<para>
72761   Return the controller id where the client is attached to
72762</para>
72763</refsect1>
72764</refentry>
72765
72766<refentry id="API-hsi-port-id">
72767<refentryinfo>
72768 <title>LINUX</title>
72769 <productname>Kernel Hackers Manual</productname>
72770 <date>July 2017</date>
72771</refentryinfo>
72772<refmeta>
72773 <refentrytitle><phrase>hsi_port_id</phrase></refentrytitle>
72774 <manvolnum>9</manvolnum>
72775 <refmiscinfo class="version">4.4.14</refmiscinfo>
72776</refmeta>
72777<refnamediv>
72778 <refname>hsi_port_id</refname>
72779 <refpurpose>
72780     Gets the port number a client is attached to
72781 </refpurpose>
72782</refnamediv>
72783<refsynopsisdiv>
72784 <title>Synopsis</title>
72785  <funcsynopsis><funcprototype>
72786   <funcdef>unsigned int <function>hsi_port_id </function></funcdef>
72787   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
72788  </funcprototype></funcsynopsis>
72789</refsynopsisdiv>
72790<refsect1>
72791 <title>Arguments</title>
72792 <variablelist>
72793  <varlistentry>
72794   <term><parameter>cl</parameter></term>
72795   <listitem>
72796    <para>
72797     Pointer to HSI client
72798    </para>
72799   </listitem>
72800  </varlistentry>
72801 </variablelist>
72802</refsect1>
72803<refsect1>
72804<title>Description</title>
72805<para>
72806   Return the port number associated to the client
72807</para>
72808</refsect1>
72809</refentry>
72810
72811<refentry id="API-hsi-setup">
72812<refentryinfo>
72813 <title>LINUX</title>
72814 <productname>Kernel Hackers Manual</productname>
72815 <date>July 2017</date>
72816</refentryinfo>
72817<refmeta>
72818 <refentrytitle><phrase>hsi_setup</phrase></refentrytitle>
72819 <manvolnum>9</manvolnum>
72820 <refmiscinfo class="version">4.4.14</refmiscinfo>
72821</refmeta>
72822<refnamediv>
72823 <refname>hsi_setup</refname>
72824 <refpurpose>
72825     Configure the client's port
72826 </refpurpose>
72827</refnamediv>
72828<refsynopsisdiv>
72829 <title>Synopsis</title>
72830  <funcsynopsis><funcprototype>
72831   <funcdef>int <function>hsi_setup </function></funcdef>
72832   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
72833  </funcprototype></funcsynopsis>
72834</refsynopsisdiv>
72835<refsect1>
72836 <title>Arguments</title>
72837 <variablelist>
72838  <varlistentry>
72839   <term><parameter>cl</parameter></term>
72840   <listitem>
72841    <para>
72842     Pointer to the HSI client
72843    </para>
72844   </listitem>
72845  </varlistentry>
72846 </variablelist>
72847</refsect1>
72848<refsect1>
72849<title>Description</title>
72850<para>
72851   When sharing ports, clients should either relay on a single
72852   client setup or have the same setup for all of them.
72853   </para><para>
72854
72855   Return -errno on failure, 0 on success
72856</para>
72857</refsect1>
72858</refentry>
72859
72860<refentry id="API-hsi-flush">
72861<refentryinfo>
72862 <title>LINUX</title>
72863 <productname>Kernel Hackers Manual</productname>
72864 <date>July 2017</date>
72865</refentryinfo>
72866<refmeta>
72867 <refentrytitle><phrase>hsi_flush</phrase></refentrytitle>
72868 <manvolnum>9</manvolnum>
72869 <refmiscinfo class="version">4.4.14</refmiscinfo>
72870</refmeta>
72871<refnamediv>
72872 <refname>hsi_flush</refname>
72873 <refpurpose>
72874     Flush all pending transactions on the client's port
72875 </refpurpose>
72876</refnamediv>
72877<refsynopsisdiv>
72878 <title>Synopsis</title>
72879  <funcsynopsis><funcprototype>
72880   <funcdef>int <function>hsi_flush </function></funcdef>
72881   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
72882  </funcprototype></funcsynopsis>
72883</refsynopsisdiv>
72884<refsect1>
72885 <title>Arguments</title>
72886 <variablelist>
72887  <varlistentry>
72888   <term><parameter>cl</parameter></term>
72889   <listitem>
72890    <para>
72891     Pointer to the HSI client
72892    </para>
72893   </listitem>
72894  </varlistentry>
72895 </variablelist>
72896</refsect1>
72897<refsect1>
72898<title>Description</title>
72899<para>
72900   This function will destroy all pending hsi_msg in the port and reset
72901   the HW port so it is ready to receive and transmit from a clean state.
72902   </para><para>
72903
72904   Return -errno on failure, 0 on success
72905</para>
72906</refsect1>
72907</refentry>
72908
72909<refentry id="API-hsi-async-read">
72910<refentryinfo>
72911 <title>LINUX</title>
72912 <productname>Kernel Hackers Manual</productname>
72913 <date>July 2017</date>
72914</refentryinfo>
72915<refmeta>
72916 <refentrytitle><phrase>hsi_async_read</phrase></refentrytitle>
72917 <manvolnum>9</manvolnum>
72918 <refmiscinfo class="version">4.4.14</refmiscinfo>
72919</refmeta>
72920<refnamediv>
72921 <refname>hsi_async_read</refname>
72922 <refpurpose>
72923     Submit a read transfer
72924 </refpurpose>
72925</refnamediv>
72926<refsynopsisdiv>
72927 <title>Synopsis</title>
72928  <funcsynopsis><funcprototype>
72929   <funcdef>int <function>hsi_async_read </function></funcdef>
72930   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
72931   <paramdef><link linkend="API-struct-hsi-msg">struct hsi_msg</link> * <parameter>msg</parameter></paramdef>
72932  </funcprototype></funcsynopsis>
72933</refsynopsisdiv>
72934<refsect1>
72935 <title>Arguments</title>
72936 <variablelist>
72937  <varlistentry>
72938   <term><parameter>cl</parameter></term>
72939   <listitem>
72940    <para>
72941     Pointer to the HSI client
72942    </para>
72943   </listitem>
72944  </varlistentry>
72945  <varlistentry>
72946   <term><parameter>msg</parameter></term>
72947   <listitem>
72948    <para>
72949     HSI message descriptor of the transfer
72950    </para>
72951   </listitem>
72952  </varlistentry>
72953 </variablelist>
72954</refsect1>
72955<refsect1>
72956<title>Description</title>
72957<para>
72958   Return -errno on failure, 0 on success
72959</para>
72960</refsect1>
72961</refentry>
72962
72963<refentry id="API-hsi-async-write">
72964<refentryinfo>
72965 <title>LINUX</title>
72966 <productname>Kernel Hackers Manual</productname>
72967 <date>July 2017</date>
72968</refentryinfo>
72969<refmeta>
72970 <refentrytitle><phrase>hsi_async_write</phrase></refentrytitle>
72971 <manvolnum>9</manvolnum>
72972 <refmiscinfo class="version">4.4.14</refmiscinfo>
72973</refmeta>
72974<refnamediv>
72975 <refname>hsi_async_write</refname>
72976 <refpurpose>
72977     Submit a write transfer
72978 </refpurpose>
72979</refnamediv>
72980<refsynopsisdiv>
72981 <title>Synopsis</title>
72982  <funcsynopsis><funcprototype>
72983   <funcdef>int <function>hsi_async_write </function></funcdef>
72984   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
72985   <paramdef><link linkend="API-struct-hsi-msg">struct hsi_msg</link> * <parameter>msg</parameter></paramdef>
72986  </funcprototype></funcsynopsis>
72987</refsynopsisdiv>
72988<refsect1>
72989 <title>Arguments</title>
72990 <variablelist>
72991  <varlistentry>
72992   <term><parameter>cl</parameter></term>
72993   <listitem>
72994    <para>
72995     Pointer to the HSI client
72996    </para>
72997   </listitem>
72998  </varlistentry>
72999  <varlistentry>
73000   <term><parameter>msg</parameter></term>
73001   <listitem>
73002    <para>
73003     HSI message descriptor of the transfer
73004    </para>
73005   </listitem>
73006  </varlistentry>
73007 </variablelist>
73008</refsect1>
73009<refsect1>
73010<title>Description</title>
73011<para>
73012   Return -errno on failure, 0 on success
73013</para>
73014</refsect1>
73015</refentry>
73016
73017<refentry id="API-hsi-start-tx">
73018<refentryinfo>
73019 <title>LINUX</title>
73020 <productname>Kernel Hackers Manual</productname>
73021 <date>July 2017</date>
73022</refentryinfo>
73023<refmeta>
73024 <refentrytitle><phrase>hsi_start_tx</phrase></refentrytitle>
73025 <manvolnum>9</manvolnum>
73026 <refmiscinfo class="version">4.4.14</refmiscinfo>
73027</refmeta>
73028<refnamediv>
73029 <refname>hsi_start_tx</refname>
73030 <refpurpose>
73031     Signal the port that the client wants to start a TX
73032 </refpurpose>
73033</refnamediv>
73034<refsynopsisdiv>
73035 <title>Synopsis</title>
73036  <funcsynopsis><funcprototype>
73037   <funcdef>int <function>hsi_start_tx </function></funcdef>
73038   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73039  </funcprototype></funcsynopsis>
73040</refsynopsisdiv>
73041<refsect1>
73042 <title>Arguments</title>
73043 <variablelist>
73044  <varlistentry>
73045   <term><parameter>cl</parameter></term>
73046   <listitem>
73047    <para>
73048     Pointer to the HSI client
73049    </para>
73050   </listitem>
73051  </varlistentry>
73052 </variablelist>
73053</refsect1>
73054<refsect1>
73055<title>Description</title>
73056<para>
73057   Return -errno on failure, 0 on success
73058</para>
73059</refsect1>
73060</refentry>
73061
73062<refentry id="API-hsi-stop-tx">
73063<refentryinfo>
73064 <title>LINUX</title>
73065 <productname>Kernel Hackers Manual</productname>
73066 <date>July 2017</date>
73067</refentryinfo>
73068<refmeta>
73069 <refentrytitle><phrase>hsi_stop_tx</phrase></refentrytitle>
73070 <manvolnum>9</manvolnum>
73071 <refmiscinfo class="version">4.4.14</refmiscinfo>
73072</refmeta>
73073<refnamediv>
73074 <refname>hsi_stop_tx</refname>
73075 <refpurpose>
73076     Signal the port that the client no longer wants to transmit
73077 </refpurpose>
73078</refnamediv>
73079<refsynopsisdiv>
73080 <title>Synopsis</title>
73081  <funcsynopsis><funcprototype>
73082   <funcdef>int <function>hsi_stop_tx </function></funcdef>
73083   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73084  </funcprototype></funcsynopsis>
73085</refsynopsisdiv>
73086<refsect1>
73087 <title>Arguments</title>
73088 <variablelist>
73089  <varlistentry>
73090   <term><parameter>cl</parameter></term>
73091   <listitem>
73092    <para>
73093     Pointer to the HSI client
73094    </para>
73095   </listitem>
73096  </varlistentry>
73097 </variablelist>
73098</refsect1>
73099<refsect1>
73100<title>Description</title>
73101<para>
73102   Return -errno on failure, 0 on success
73103</para>
73104</refsect1>
73105</refentry>
73106
73107<!-- drivers/hsi/hsi.c -->
73108<refentry id="API-hsi-port-unregister-clients">
73109<refentryinfo>
73110 <title>LINUX</title>
73111 <productname>Kernel Hackers Manual</productname>
73112 <date>July 2017</date>
73113</refentryinfo>
73114<refmeta>
73115 <refentrytitle><phrase>hsi_port_unregister_clients</phrase></refentrytitle>
73116 <manvolnum>9</manvolnum>
73117 <refmiscinfo class="version">4.4.14</refmiscinfo>
73118</refmeta>
73119<refnamediv>
73120 <refname>hsi_port_unregister_clients</refname>
73121 <refpurpose>
73122  Unregister an HSI port
73123 </refpurpose>
73124</refnamediv>
73125<refsynopsisdiv>
73126 <title>Synopsis</title>
73127  <funcsynopsis><funcprototype>
73128   <funcdef>void <function>hsi_port_unregister_clients </function></funcdef>
73129   <paramdef><link linkend="API-struct-hsi-port">struct hsi_port</link> * <parameter>port</parameter></paramdef>
73130  </funcprototype></funcsynopsis>
73131</refsynopsisdiv>
73132<refsect1>
73133 <title>Arguments</title>
73134 <variablelist>
73135  <varlistentry>
73136   <term><parameter>port</parameter></term>
73137   <listitem>
73138    <para>
73139     The HSI port to unregister
73140    </para>
73141   </listitem>
73142  </varlistentry>
73143 </variablelist>
73144</refsect1>
73145</refentry>
73146
73147<refentry id="API-hsi-unregister-controller">
73148<refentryinfo>
73149 <title>LINUX</title>
73150 <productname>Kernel Hackers Manual</productname>
73151 <date>July 2017</date>
73152</refentryinfo>
73153<refmeta>
73154 <refentrytitle><phrase>hsi_unregister_controller</phrase></refentrytitle>
73155 <manvolnum>9</manvolnum>
73156 <refmiscinfo class="version">4.4.14</refmiscinfo>
73157</refmeta>
73158<refnamediv>
73159 <refname>hsi_unregister_controller</refname>
73160 <refpurpose>
73161     Unregister an HSI controller
73162 </refpurpose>
73163</refnamediv>
73164<refsynopsisdiv>
73165 <title>Synopsis</title>
73166  <funcsynopsis><funcprototype>
73167   <funcdef>void <function>hsi_unregister_controller </function></funcdef>
73168   <paramdef><link linkend="API-struct-hsi-controller">struct hsi_controller</link> * <parameter>hsi</parameter></paramdef>
73169  </funcprototype></funcsynopsis>
73170</refsynopsisdiv>
73171<refsect1>
73172 <title>Arguments</title>
73173 <variablelist>
73174  <varlistentry>
73175   <term><parameter>hsi</parameter></term>
73176   <listitem>
73177    <para>
73178     The HSI controller to register
73179    </para>
73180   </listitem>
73181  </varlistentry>
73182 </variablelist>
73183</refsect1>
73184</refentry>
73185
73186<refentry id="API-hsi-register-controller">
73187<refentryinfo>
73188 <title>LINUX</title>
73189 <productname>Kernel Hackers Manual</productname>
73190 <date>July 2017</date>
73191</refentryinfo>
73192<refmeta>
73193 <refentrytitle><phrase>hsi_register_controller</phrase></refentrytitle>
73194 <manvolnum>9</manvolnum>
73195 <refmiscinfo class="version">4.4.14</refmiscinfo>
73196</refmeta>
73197<refnamediv>
73198 <refname>hsi_register_controller</refname>
73199 <refpurpose>
73200     Register an HSI controller and its ports
73201 </refpurpose>
73202</refnamediv>
73203<refsynopsisdiv>
73204 <title>Synopsis</title>
73205  <funcsynopsis><funcprototype>
73206   <funcdef>int <function>hsi_register_controller </function></funcdef>
73207   <paramdef><link linkend="API-struct-hsi-controller">struct hsi_controller</link> * <parameter>hsi</parameter></paramdef>
73208  </funcprototype></funcsynopsis>
73209</refsynopsisdiv>
73210<refsect1>
73211 <title>Arguments</title>
73212 <variablelist>
73213  <varlistentry>
73214   <term><parameter>hsi</parameter></term>
73215   <listitem>
73216    <para>
73217     The HSI controller to register
73218    </para>
73219   </listitem>
73220  </varlistentry>
73221 </variablelist>
73222</refsect1>
73223<refsect1>
73224<title>Description</title>
73225<para>
73226   Returns -errno on failure, 0 on success.
73227</para>
73228</refsect1>
73229</refentry>
73230
73231<refentry id="API-hsi-register-client-driver">
73232<refentryinfo>
73233 <title>LINUX</title>
73234 <productname>Kernel Hackers Manual</productname>
73235 <date>July 2017</date>
73236</refentryinfo>
73237<refmeta>
73238 <refentrytitle><phrase>hsi_register_client_driver</phrase></refentrytitle>
73239 <manvolnum>9</manvolnum>
73240 <refmiscinfo class="version">4.4.14</refmiscinfo>
73241</refmeta>
73242<refnamediv>
73243 <refname>hsi_register_client_driver</refname>
73244 <refpurpose>
73245     Register an HSI client to the HSI bus
73246 </refpurpose>
73247</refnamediv>
73248<refsynopsisdiv>
73249 <title>Synopsis</title>
73250  <funcsynopsis><funcprototype>
73251   <funcdef>int <function>hsi_register_client_driver </function></funcdef>
73252   <paramdef><link linkend="API-struct-hsi-client-driver">struct hsi_client_driver</link> * <parameter>drv</parameter></paramdef>
73253  </funcprototype></funcsynopsis>
73254</refsynopsisdiv>
73255<refsect1>
73256 <title>Arguments</title>
73257 <variablelist>
73258  <varlistentry>
73259   <term><parameter>drv</parameter></term>
73260   <listitem>
73261    <para>
73262     HSI client driver to register
73263    </para>
73264   </listitem>
73265  </varlistentry>
73266 </variablelist>
73267</refsect1>
73268<refsect1>
73269<title>Description</title>
73270<para>
73271   Returns -errno on failure, 0 on success.
73272</para>
73273</refsect1>
73274</refentry>
73275
73276<refentry id="API-hsi-put-controller">
73277<refentryinfo>
73278 <title>LINUX</title>
73279 <productname>Kernel Hackers Manual</productname>
73280 <date>July 2017</date>
73281</refentryinfo>
73282<refmeta>
73283 <refentrytitle><phrase>hsi_put_controller</phrase></refentrytitle>
73284 <manvolnum>9</manvolnum>
73285 <refmiscinfo class="version">4.4.14</refmiscinfo>
73286</refmeta>
73287<refnamediv>
73288 <refname>hsi_put_controller</refname>
73289 <refpurpose>
73290     Free an HSI controller
73291 </refpurpose>
73292</refnamediv>
73293<refsynopsisdiv>
73294 <title>Synopsis</title>
73295  <funcsynopsis><funcprototype>
73296   <funcdef>void <function>hsi_put_controller </function></funcdef>
73297   <paramdef><link linkend="API-struct-hsi-controller">struct hsi_controller</link> * <parameter>hsi</parameter></paramdef>
73298  </funcprototype></funcsynopsis>
73299</refsynopsisdiv>
73300<refsect1>
73301 <title>Arguments</title>
73302 <variablelist>
73303  <varlistentry>
73304   <term><parameter>hsi</parameter></term>
73305   <listitem>
73306    <para>
73307     Pointer to the HSI controller to freed
73308    </para>
73309   </listitem>
73310  </varlistentry>
73311 </variablelist>
73312</refsect1>
73313<refsect1>
73314<title>Description</title>
73315<para>
73316   HSI controller drivers should only use this function if they need
73317   to free their allocated hsi_controller structures before a successful
73318   call to hsi_register_controller. Other use is not allowed.
73319</para>
73320</refsect1>
73321</refentry>
73322
73323<refentry id="API-hsi-alloc-controller">
73324<refentryinfo>
73325 <title>LINUX</title>
73326 <productname>Kernel Hackers Manual</productname>
73327 <date>July 2017</date>
73328</refentryinfo>
73329<refmeta>
73330 <refentrytitle><phrase>hsi_alloc_controller</phrase></refentrytitle>
73331 <manvolnum>9</manvolnum>
73332 <refmiscinfo class="version">4.4.14</refmiscinfo>
73333</refmeta>
73334<refnamediv>
73335 <refname>hsi_alloc_controller</refname>
73336 <refpurpose>
73337     Allocate an HSI controller and its ports
73338 </refpurpose>
73339</refnamediv>
73340<refsynopsisdiv>
73341 <title>Synopsis</title>
73342  <funcsynopsis><funcprototype>
73343   <funcdef><link linkend="API-struct-hsi-controller">struct hsi_controller</link> * <function>hsi_alloc_controller </function></funcdef>
73344   <paramdef>unsigned int <parameter>n_ports</parameter></paramdef>
73345   <paramdef>gfp_t <parameter>flags</parameter></paramdef>
73346  </funcprototype></funcsynopsis>
73347</refsynopsisdiv>
73348<refsect1>
73349 <title>Arguments</title>
73350 <variablelist>
73351  <varlistentry>
73352   <term><parameter>n_ports</parameter></term>
73353   <listitem>
73354    <para>
73355     Number of ports on the HSI controller
73356    </para>
73357   </listitem>
73358  </varlistentry>
73359  <varlistentry>
73360   <term><parameter>flags</parameter></term>
73361   <listitem>
73362    <para>
73363     Kernel allocation flags
73364    </para>
73365   </listitem>
73366  </varlistentry>
73367 </variablelist>
73368</refsect1>
73369<refsect1>
73370<title>Description</title>
73371<para>
73372   Return NULL on failure or a pointer to an hsi_controller on success.
73373</para>
73374</refsect1>
73375</refentry>
73376
73377<refentry id="API-hsi-free-msg">
73378<refentryinfo>
73379 <title>LINUX</title>
73380 <productname>Kernel Hackers Manual</productname>
73381 <date>July 2017</date>
73382</refentryinfo>
73383<refmeta>
73384 <refentrytitle><phrase>hsi_free_msg</phrase></refentrytitle>
73385 <manvolnum>9</manvolnum>
73386 <refmiscinfo class="version">4.4.14</refmiscinfo>
73387</refmeta>
73388<refnamediv>
73389 <refname>hsi_free_msg</refname>
73390 <refpurpose>
73391     Free an HSI message
73392 </refpurpose>
73393</refnamediv>
73394<refsynopsisdiv>
73395 <title>Synopsis</title>
73396  <funcsynopsis><funcprototype>
73397   <funcdef>void <function>hsi_free_msg </function></funcdef>
73398   <paramdef><link linkend="API-struct-hsi-msg">struct hsi_msg</link> * <parameter>msg</parameter></paramdef>
73399  </funcprototype></funcsynopsis>
73400</refsynopsisdiv>
73401<refsect1>
73402 <title>Arguments</title>
73403 <variablelist>
73404  <varlistentry>
73405   <term><parameter>msg</parameter></term>
73406   <listitem>
73407    <para>
73408     Pointer to the HSI message
73409    </para>
73410   </listitem>
73411  </varlistentry>
73412 </variablelist>
73413</refsect1>
73414<refsect1>
73415<title>Description</title>
73416<para>
73417   Client is responsible to free the buffers pointed by the scatterlists.
73418</para>
73419</refsect1>
73420</refentry>
73421
73422<refentry id="API-hsi-alloc-msg">
73423<refentryinfo>
73424 <title>LINUX</title>
73425 <productname>Kernel Hackers Manual</productname>
73426 <date>July 2017</date>
73427</refentryinfo>
73428<refmeta>
73429 <refentrytitle><phrase>hsi_alloc_msg</phrase></refentrytitle>
73430 <manvolnum>9</manvolnum>
73431 <refmiscinfo class="version">4.4.14</refmiscinfo>
73432</refmeta>
73433<refnamediv>
73434 <refname>hsi_alloc_msg</refname>
73435 <refpurpose>
73436     Allocate an HSI message
73437 </refpurpose>
73438</refnamediv>
73439<refsynopsisdiv>
73440 <title>Synopsis</title>
73441  <funcsynopsis><funcprototype>
73442   <funcdef><link linkend="API-struct-hsi-msg">struct hsi_msg</link> * <function>hsi_alloc_msg </function></funcdef>
73443   <paramdef>unsigned int <parameter>nents</parameter></paramdef>
73444   <paramdef>gfp_t <parameter>flags</parameter></paramdef>
73445  </funcprototype></funcsynopsis>
73446</refsynopsisdiv>
73447<refsect1>
73448 <title>Arguments</title>
73449 <variablelist>
73450  <varlistentry>
73451   <term><parameter>nents</parameter></term>
73452   <listitem>
73453    <para>
73454     Number of memory entries
73455    </para>
73456   </listitem>
73457  </varlistentry>
73458  <varlistentry>
73459   <term><parameter>flags</parameter></term>
73460   <listitem>
73461    <para>
73462     Kernel allocation flags
73463    </para>
73464   </listitem>
73465  </varlistentry>
73466 </variablelist>
73467</refsect1>
73468<refsect1>
73469<title>Description</title>
73470<para>
73471   nents can be 0. This mainly makes sense for read transfer.
73472   In that case, HSI drivers will call the complete callback when
73473   there is data to be read without consuming it.
73474   </para><para>
73475
73476   Return NULL on failure or a pointer to an hsi_msg on success.
73477</para>
73478</refsect1>
73479</refentry>
73480
73481<refentry id="API-hsi-async">
73482<refentryinfo>
73483 <title>LINUX</title>
73484 <productname>Kernel Hackers Manual</productname>
73485 <date>July 2017</date>
73486</refentryinfo>
73487<refmeta>
73488 <refentrytitle><phrase>hsi_async</phrase></refentrytitle>
73489 <manvolnum>9</manvolnum>
73490 <refmiscinfo class="version">4.4.14</refmiscinfo>
73491</refmeta>
73492<refnamediv>
73493 <refname>hsi_async</refname>
73494 <refpurpose>
73495     Submit an HSI transfer to the controller
73496 </refpurpose>
73497</refnamediv>
73498<refsynopsisdiv>
73499 <title>Synopsis</title>
73500  <funcsynopsis><funcprototype>
73501   <funcdef>int <function>hsi_async </function></funcdef>
73502   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73503   <paramdef><link linkend="API-struct-hsi-msg">struct hsi_msg</link> * <parameter>msg</parameter></paramdef>
73504  </funcprototype></funcsynopsis>
73505</refsynopsisdiv>
73506<refsect1>
73507 <title>Arguments</title>
73508 <variablelist>
73509  <varlistentry>
73510   <term><parameter>cl</parameter></term>
73511   <listitem>
73512    <para>
73513     HSI client sending the transfer
73514    </para>
73515   </listitem>
73516  </varlistentry>
73517  <varlistentry>
73518   <term><parameter>msg</parameter></term>
73519   <listitem>
73520    <para>
73521     The HSI transfer passed to controller
73522    </para>
73523   </listitem>
73524  </varlistentry>
73525 </variablelist>
73526</refsect1>
73527<refsect1>
73528<title>Description</title>
73529<para>
73530   The HSI message must have the channel, ttype, complete and destructor
73531   fields set beforehand. If nents &gt; 0 then the client has to initialize
73532   also the scatterlists to point to the buffers to write to or read from.
73533   </para><para>
73534
73535   HSI controllers relay on pre-allocated buffers from their clients and they
73536   do not allocate buffers on their own.
73537   </para><para>
73538
73539   Once the HSI message transfer finishes, the HSI controller calls the
73540   complete callback with the status and actual_len fields of the HSI message
73541   updated. The complete callback can be called before returning from
73542   hsi_async.
73543   </para><para>
73544
73545   Returns -errno on failure or 0 on success
73546</para>
73547</refsect1>
73548</refentry>
73549
73550<refentry id="API-hsi-claim-port">
73551<refentryinfo>
73552 <title>LINUX</title>
73553 <productname>Kernel Hackers Manual</productname>
73554 <date>July 2017</date>
73555</refentryinfo>
73556<refmeta>
73557 <refentrytitle><phrase>hsi_claim_port</phrase></refentrytitle>
73558 <manvolnum>9</manvolnum>
73559 <refmiscinfo class="version">4.4.14</refmiscinfo>
73560</refmeta>
73561<refnamediv>
73562 <refname>hsi_claim_port</refname>
73563 <refpurpose>
73564     Claim the HSI client's port
73565 </refpurpose>
73566</refnamediv>
73567<refsynopsisdiv>
73568 <title>Synopsis</title>
73569  <funcsynopsis><funcprototype>
73570   <funcdef>int <function>hsi_claim_port </function></funcdef>
73571   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73572   <paramdef>unsigned int <parameter>share</parameter></paramdef>
73573  </funcprototype></funcsynopsis>
73574</refsynopsisdiv>
73575<refsect1>
73576 <title>Arguments</title>
73577 <variablelist>
73578  <varlistentry>
73579   <term><parameter>cl</parameter></term>
73580   <listitem>
73581    <para>
73582     HSI client that wants to claim its port
73583    </para>
73584   </listitem>
73585  </varlistentry>
73586  <varlistentry>
73587   <term><parameter>share</parameter></term>
73588   <listitem>
73589    <para>
73590     Flag to indicate if the client wants to share the port or not.
73591    </para>
73592   </listitem>
73593  </varlistentry>
73594 </variablelist>
73595</refsect1>
73596<refsect1>
73597<title>Description</title>
73598<para>
73599   Returns -errno on failure, 0 on success.
73600</para>
73601</refsect1>
73602</refentry>
73603
73604<refentry id="API-hsi-release-port">
73605<refentryinfo>
73606 <title>LINUX</title>
73607 <productname>Kernel Hackers Manual</productname>
73608 <date>July 2017</date>
73609</refentryinfo>
73610<refmeta>
73611 <refentrytitle><phrase>hsi_release_port</phrase></refentrytitle>
73612 <manvolnum>9</manvolnum>
73613 <refmiscinfo class="version">4.4.14</refmiscinfo>
73614</refmeta>
73615<refnamediv>
73616 <refname>hsi_release_port</refname>
73617 <refpurpose>
73618     Release the HSI client's port
73619 </refpurpose>
73620</refnamediv>
73621<refsynopsisdiv>
73622 <title>Synopsis</title>
73623  <funcsynopsis><funcprototype>
73624   <funcdef>void <function>hsi_release_port </function></funcdef>
73625   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73626  </funcprototype></funcsynopsis>
73627</refsynopsisdiv>
73628<refsect1>
73629 <title>Arguments</title>
73630 <variablelist>
73631  <varlistentry>
73632   <term><parameter>cl</parameter></term>
73633   <listitem>
73634    <para>
73635     HSI client which previously claimed its port
73636    </para>
73637   </listitem>
73638  </varlistentry>
73639 </variablelist>
73640</refsect1>
73641</refentry>
73642
73643<refentry id="API-hsi-register-port-event">
73644<refentryinfo>
73645 <title>LINUX</title>
73646 <productname>Kernel Hackers Manual</productname>
73647 <date>July 2017</date>
73648</refentryinfo>
73649<refmeta>
73650 <refentrytitle><phrase>hsi_register_port_event</phrase></refentrytitle>
73651 <manvolnum>9</manvolnum>
73652 <refmiscinfo class="version">4.4.14</refmiscinfo>
73653</refmeta>
73654<refnamediv>
73655 <refname>hsi_register_port_event</refname>
73656 <refpurpose>
73657     Register a client to receive port events
73658 </refpurpose>
73659</refnamediv>
73660<refsynopsisdiv>
73661 <title>Synopsis</title>
73662  <funcsynopsis><funcprototype>
73663   <funcdef>int <function>hsi_register_port_event </function></funcdef>
73664   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73665   <paramdef>void (*<parameter>handler</parameter>)
73666     <funcparams>struct hsi_client *, unsigned long</funcparams></paramdef>
73667  </funcprototype></funcsynopsis>
73668</refsynopsisdiv>
73669<refsect1>
73670 <title>Arguments</title>
73671 <variablelist>
73672  <varlistentry>
73673   <term><parameter>cl</parameter></term>
73674   <listitem>
73675    <para>
73676     HSI client that wants to receive port events
73677    </para>
73678   </listitem>
73679  </varlistentry>
73680  <varlistentry>
73681   <term><parameter>handler</parameter></term>
73682   <listitem>
73683    <para>
73684     Event handler callback
73685    </para>
73686   </listitem>
73687  </varlistentry>
73688 </variablelist>
73689</refsect1>
73690<refsect1>
73691<title>Description</title>
73692<para>
73693   Clients should register a callback to be able to receive
73694   events from the ports. Registration should happen after
73695   claiming the port.
73696   The handler can be called in interrupt context.
73697   </para><para>
73698
73699   Returns -errno on error, or 0 on success.
73700</para>
73701</refsect1>
73702</refentry>
73703
73704<refentry id="API-hsi-unregister-port-event">
73705<refentryinfo>
73706 <title>LINUX</title>
73707 <productname>Kernel Hackers Manual</productname>
73708 <date>July 2017</date>
73709</refentryinfo>
73710<refmeta>
73711 <refentrytitle><phrase>hsi_unregister_port_event</phrase></refentrytitle>
73712 <manvolnum>9</manvolnum>
73713 <refmiscinfo class="version">4.4.14</refmiscinfo>
73714</refmeta>
73715<refnamediv>
73716 <refname>hsi_unregister_port_event</refname>
73717 <refpurpose>
73718     Stop receiving port events for a client
73719 </refpurpose>
73720</refnamediv>
73721<refsynopsisdiv>
73722 <title>Synopsis</title>
73723  <funcsynopsis><funcprototype>
73724   <funcdef>int <function>hsi_unregister_port_event </function></funcdef>
73725   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73726  </funcprototype></funcsynopsis>
73727</refsynopsisdiv>
73728<refsect1>
73729 <title>Arguments</title>
73730 <variablelist>
73731  <varlistentry>
73732   <term><parameter>cl</parameter></term>
73733   <listitem>
73734    <para>
73735     HSI client that wants to stop receiving port events
73736    </para>
73737   </listitem>
73738  </varlistentry>
73739 </variablelist>
73740</refsect1>
73741<refsect1>
73742<title>Description</title>
73743<para>
73744   Clients should call this function before releasing their associated
73745   port.
73746   </para><para>
73747
73748   Returns -errno on error, or 0 on success.
73749</para>
73750</refsect1>
73751</refentry>
73752
73753<refentry id="API-hsi-event">
73754<refentryinfo>
73755 <title>LINUX</title>
73756 <productname>Kernel Hackers Manual</productname>
73757 <date>July 2017</date>
73758</refentryinfo>
73759<refmeta>
73760 <refentrytitle><phrase>hsi_event</phrase></refentrytitle>
73761 <manvolnum>9</manvolnum>
73762 <refmiscinfo class="version">4.4.14</refmiscinfo>
73763</refmeta>
73764<refnamediv>
73765 <refname>hsi_event</refname>
73766 <refpurpose>
73767     Notifies clients about port events
73768 </refpurpose>
73769</refnamediv>
73770<refsynopsisdiv>
73771 <title>Synopsis</title>
73772  <funcsynopsis><funcprototype>
73773   <funcdef>int <function>hsi_event </function></funcdef>
73774   <paramdef><link linkend="API-struct-hsi-port">struct hsi_port</link> * <parameter>port</parameter></paramdef>
73775   <paramdef>unsigned long <parameter>event</parameter></paramdef>
73776  </funcprototype></funcsynopsis>
73777</refsynopsisdiv>
73778<refsect1>
73779 <title>Arguments</title>
73780 <variablelist>
73781  <varlistentry>
73782   <term><parameter>port</parameter></term>
73783   <listitem>
73784    <para>
73785     Port where the event occurred
73786    </para>
73787   </listitem>
73788  </varlistentry>
73789  <varlistentry>
73790   <term><parameter>event</parameter></term>
73791   <listitem>
73792    <para>
73793     The event type
73794    </para>
73795   </listitem>
73796  </varlistentry>
73797 </variablelist>
73798</refsect1>
73799<refsect1>
73800<title>Description</title>
73801<para>
73802   Clients should not be concerned about wake line behavior. However, due
73803   to a race condition in HSI HW protocol, clients need to be notified
73804   about wake line changes, so they can implement a workaround for it.
73805</para>
73806</refsect1>
73807<refsect1>
73808<title>Events</title>
73809<para>
73810   HSI_EVENT_START_RX - Incoming wake line high
73811   HSI_EVENT_STOP_RX - Incoming wake line down
73812   </para><para>
73813
73814   Returns -errno on error, or 0 on success.
73815</para>
73816</refsect1>
73817</refentry>
73818
73819<refentry id="API-hsi-get-channel-id-by-name">
73820<refentryinfo>
73821 <title>LINUX</title>
73822 <productname>Kernel Hackers Manual</productname>
73823 <date>July 2017</date>
73824</refentryinfo>
73825<refmeta>
73826 <refentrytitle><phrase>hsi_get_channel_id_by_name</phrase></refentrytitle>
73827 <manvolnum>9</manvolnum>
73828 <refmiscinfo class="version">4.4.14</refmiscinfo>
73829</refmeta>
73830<refnamediv>
73831 <refname>hsi_get_channel_id_by_name</refname>
73832 <refpurpose>
73833     acquire channel id by channel name
73834 </refpurpose>
73835</refnamediv>
73836<refsynopsisdiv>
73837 <title>Synopsis</title>
73838  <funcsynopsis><funcprototype>
73839   <funcdef>int <function>hsi_get_channel_id_by_name </function></funcdef>
73840   <paramdef><link linkend="API-struct-hsi-client">struct hsi_client</link> * <parameter>cl</parameter></paramdef>
73841   <paramdef>char * <parameter>name</parameter></paramdef>
73842  </funcprototype></funcsynopsis>
73843</refsynopsisdiv>
73844<refsect1>
73845 <title>Arguments</title>
73846 <variablelist>
73847  <varlistentry>
73848   <term><parameter>cl</parameter></term>
73849   <listitem>
73850    <para>
73851     HSI client, which uses the channel
73852    </para>
73853   </listitem>
73854  </varlistentry>
73855  <varlistentry>
73856   <term><parameter>name</parameter></term>
73857   <listitem>
73858    <para>
73859     name the channel is known under
73860    </para>
73861   </listitem>
73862  </varlistentry>
73863 </variablelist>
73864</refsect1>
73865<refsect1>
73866<title>Description</title>
73867<para>
73868   Clients can call this function to get the hsi channel ids similar to
73869   requesting IRQs or GPIOs by name. This function assumes the same
73870   channel configuration is used for RX and TX.
73871   </para><para>
73872
73873   Returns -errno on error or channel id on success.
73874</para>
73875</refsect1>
73876</refentry>
73877
73878  </chapter>
73879
73880  <chapter id="pwm">
73881    <title>Pulse-Width Modulation (PWM)</title>
73882    <para>
73883      Pulse-width modulation is a modulation technique primarily used to
73884      control power supplied to electrical devices.
73885    </para>
73886    <para>
73887      The PWM framework provides an abstraction for providers and consumers
73888      of PWM signals. A controller that provides one or more PWM signals is
73889      registered as <structname><link linkend="API-struct-pwm-chip">struct pwm_chip</link></structname>. Providers are
73890      expected to embed this structure in a driver-specific structure. This
73891      structure contains fields that describe a particular chip.
73892    </para>
73893    <para>
73894      A chip exposes one or more PWM signal sources, each of which exposed
73895      as a <structname><link linkend="API-struct-pwm-device">struct pwm_device</link></structname>. Operations can be
73896      performed on PWM devices to control the period, duty cycle, polarity
73897      and active state of the signal.
73898    </para>
73899    <para>
73900      Note that PWM devices are exclusive resources: they can always only be
73901      used by one consumer at a time.
73902    </para>
73903<!-- include/linux/pwm.h -->
73904<refentry id="API-enum-pwm-polarity">
73905<refentryinfo>
73906 <title>LINUX</title>
73907 <productname>Kernel Hackers Manual</productname>
73908 <date>July 2017</date>
73909</refentryinfo>
73910<refmeta>
73911 <refentrytitle><phrase>enum pwm_polarity</phrase></refentrytitle>
73912 <manvolnum>9</manvolnum>
73913 <refmiscinfo class="version">4.4.14</refmiscinfo>
73914</refmeta>
73915<refnamediv>
73916 <refname>enum pwm_polarity</refname>
73917 <refpurpose>
73918  polarity of a PWM signal
73919 </refpurpose>
73920</refnamediv>
73921<refsynopsisdiv>
73922 <title>Synopsis</title>
73923  <programlisting>
73924enum pwm_polarity {
73925  PWM_POLARITY_NORMAL,
73926  PWM_POLARITY_INVERSED
73927};  </programlisting>
73928</refsynopsisdiv>
73929<refsect1>
73930 <title>Constants</title>
73931  <variablelist>
73932    <varlistentry>      <term>PWM_POLARITY_NORMAL</term>
73933      <listitem><para>
73934a high signal for the duration of the duty-
73935cycle, followed by a low signal for the remainder of the pulse
73936period
73937      </para></listitem>
73938    </varlistentry>
73939    <varlistentry>      <term>PWM_POLARITY_INVERSED</term>
73940      <listitem><para>
73941a low signal for the duration of the duty-
73942cycle, followed by a high signal for the remainder of the pulse
73943period
73944      </para></listitem>
73945    </varlistentry>
73946  </variablelist>
73947</refsect1>
73948</refentry>
73949
73950<refentry id="API-struct-pwm-device">
73951<refentryinfo>
73952 <title>LINUX</title>
73953 <productname>Kernel Hackers Manual</productname>
73954 <date>July 2017</date>
73955</refentryinfo>
73956<refmeta>
73957 <refentrytitle><phrase>struct pwm_device</phrase></refentrytitle>
73958 <manvolnum>9</manvolnum>
73959 <refmiscinfo class="version">4.4.14</refmiscinfo>
73960</refmeta>
73961<refnamediv>
73962 <refname>struct pwm_device</refname>
73963 <refpurpose>
73964     PWM channel object
73965 </refpurpose>
73966</refnamediv>
73967<refsynopsisdiv>
73968 <title>Synopsis</title>
73969  <programlisting>
73970struct pwm_device {
73971  const char * label;
73972  unsigned long flags;
73973  unsigned int hwpwm;
73974  unsigned int pwm;
73975  struct pwm_chip * chip;
73976  void * chip_data;
73977  struct mutex lock;
73978  unsigned int period;
73979  unsigned int duty_cycle;
73980  enum pwm_polarity polarity;
73981};  </programlisting>
73982</refsynopsisdiv>
73983 <refsect1>
73984  <title>Members</title>
73985  <variablelist>
73986    <varlistentry>      <term>label</term>
73987      <listitem><para>
73988   name of the PWM device
73989      </para></listitem>
73990    </varlistentry>
73991    <varlistentry>      <term>flags</term>
73992      <listitem><para>
73993   flags associated with the PWM device
73994      </para></listitem>
73995    </varlistentry>
73996    <varlistentry>      <term>hwpwm</term>
73997      <listitem><para>
73998   per-chip relative index of the PWM device
73999      </para></listitem>
74000    </varlistentry>
74001    <varlistentry>      <term>pwm</term>
74002      <listitem><para>
74003   global index of the PWM device
74004      </para></listitem>
74005    </varlistentry>
74006    <varlistentry>      <term>chip</term>
74007      <listitem><para>
74008   PWM chip providing this PWM device
74009      </para></listitem>
74010    </varlistentry>
74011    <varlistentry>      <term>chip_data</term>
74012      <listitem><para>
74013   chip-private data associated with the PWM device
74014      </para></listitem>
74015    </varlistentry>
74016    <varlistentry>      <term>lock</term>
74017      <listitem><para>
74018   used to serialize accesses to the PWM device where necessary
74019      </para></listitem>
74020    </varlistentry>
74021    <varlistentry>      <term>period</term>
74022      <listitem><para>
74023   period of the PWM signal (in nanoseconds)
74024      </para></listitem>
74025    </varlistentry>
74026    <varlistentry>      <term>duty_cycle</term>
74027      <listitem><para>
74028   duty cycle of the PWM signal (in nanoseconds)
74029      </para></listitem>
74030    </varlistentry>
74031    <varlistentry>      <term>polarity</term>
74032      <listitem><para>
74033   polarity of the PWM signal
74034      </para></listitem>
74035    </varlistentry>
74036  </variablelist>
74037 </refsect1>
74038</refentry>
74039
74040<refentry id="API-struct-pwm-ops">
74041<refentryinfo>
74042 <title>LINUX</title>
74043 <productname>Kernel Hackers Manual</productname>
74044 <date>July 2017</date>
74045</refentryinfo>
74046<refmeta>
74047 <refentrytitle><phrase>struct pwm_ops</phrase></refentrytitle>
74048 <manvolnum>9</manvolnum>
74049 <refmiscinfo class="version">4.4.14</refmiscinfo>
74050</refmeta>
74051<refnamediv>
74052 <refname>struct pwm_ops</refname>
74053 <refpurpose>
74054     PWM controller operations
74055 </refpurpose>
74056</refnamediv>
74057<refsynopsisdiv>
74058 <title>Synopsis</title>
74059  <programlisting>
74060struct pwm_ops {
74061  int (* request) (struct pwm_chip *chip, struct pwm_device *pwm);
74062  void (* free) (struct pwm_chip *chip, struct pwm_device *pwm);
74063  int (* config) (struct pwm_chip *chip, struct pwm_device *pwm,int duty_ns, int period_ns);
74064  int (* set_polarity) (struct pwm_chip *chip, struct pwm_device *pwm,enum pwm_polarity polarity);
74065  int (* enable) (struct pwm_chip *chip, struct pwm_device *pwm);
74066  void (* disable) (struct pwm_chip *chip, struct pwm_device *pwm);
74067#ifdef CONFIG_DEBUG_FS
74068  void (* dbg_show) (struct pwm_chip *chip, struct seq_file *s);
74069#endif
74070  struct module * owner;
74071};  </programlisting>
74072</refsynopsisdiv>
74073 <refsect1>
74074  <title>Members</title>
74075  <variablelist>
74076    <varlistentry>      <term>request</term>
74077      <listitem><para>
74078   optional hook for requesting a PWM
74079      </para></listitem>
74080    </varlistentry>
74081    <varlistentry>      <term>free</term>
74082      <listitem><para>
74083   optional hook for freeing a PWM
74084      </para></listitem>
74085    </varlistentry>
74086    <varlistentry>      <term>config</term>
74087      <listitem><para>
74088   configure duty cycles and period length for this PWM
74089      </para></listitem>
74090    </varlistentry>
74091    <varlistentry>      <term>set_polarity</term>
74092      <listitem><para>
74093   configure the polarity of this PWM
74094      </para></listitem>
74095    </varlistentry>
74096    <varlistentry>      <term>enable</term>
74097      <listitem><para>
74098   enable PWM output toggling
74099      </para></listitem>
74100    </varlistentry>
74101    <varlistentry>      <term>disable</term>
74102      <listitem><para>
74103   disable PWM output toggling
74104      </para></listitem>
74105    </varlistentry>
74106    <varlistentry>      <term>dbg_show</term>
74107      <listitem><para>
74108   optional routine to show contents in debugfs
74109      </para></listitem>
74110    </varlistentry>
74111    <varlistentry>      <term>owner</term>
74112      <listitem><para>
74113   helps prevent removal of modules exporting active PWMs
74114      </para></listitem>
74115    </varlistentry>
74116  </variablelist>
74117 </refsect1>
74118</refentry>
74119
74120<refentry id="API-struct-pwm-chip">
74121<refentryinfo>
74122 <title>LINUX</title>
74123 <productname>Kernel Hackers Manual</productname>
74124 <date>July 2017</date>
74125</refentryinfo>
74126<refmeta>
74127 <refentrytitle><phrase>struct pwm_chip</phrase></refentrytitle>
74128 <manvolnum>9</manvolnum>
74129 <refmiscinfo class="version">4.4.14</refmiscinfo>
74130</refmeta>
74131<refnamediv>
74132 <refname>struct pwm_chip</refname>
74133 <refpurpose>
74134     abstract a PWM controller
74135 </refpurpose>
74136</refnamediv>
74137<refsynopsisdiv>
74138 <title>Synopsis</title>
74139  <programlisting>
74140struct pwm_chip {
74141  struct device * dev;
74142  struct list_head list;
74143  const struct pwm_ops * ops;
74144  int base;
74145  unsigned int npwm;
74146  struct pwm_device * pwms;
74147  struct pwm_device * (* of_xlate) (struct pwm_chip *pc,const struct of_phandle_args *args);
74148  unsigned int of_pwm_n_cells;
74149  bool can_sleep;
74150};  </programlisting>
74151</refsynopsisdiv>
74152 <refsect1>
74153  <title>Members</title>
74154  <variablelist>
74155    <varlistentry>      <term>dev</term>
74156      <listitem><para>
74157   device providing the PWMs
74158      </para></listitem>
74159    </varlistentry>
74160    <varlistentry>      <term>list</term>
74161      <listitem><para>
74162   list node for internal use
74163      </para></listitem>
74164    </varlistentry>
74165    <varlistentry>      <term>ops</term>
74166      <listitem><para>
74167   callbacks for this PWM controller
74168      </para></listitem>
74169    </varlistentry>
74170    <varlistentry>      <term>base</term>
74171      <listitem><para>
74172   number of first PWM controlled by this chip
74173      </para></listitem>
74174    </varlistentry>
74175    <varlistentry>      <term>npwm</term>
74176      <listitem><para>
74177   number of PWMs controlled by this chip
74178      </para></listitem>
74179    </varlistentry>
74180    <varlistentry>      <term>pwms</term>
74181      <listitem><para>
74182   array of PWM devices allocated by the framework
74183      </para></listitem>
74184    </varlistentry>
74185    <varlistentry>      <term>of_xlate</term>
74186      <listitem><para>
74187   request a PWM device given a device tree PWM specifier
74188      </para></listitem>
74189    </varlistentry>
74190    <varlistentry>      <term>of_pwm_n_cells</term>
74191      <listitem><para>
74192   number of cells expected in the device tree PWM specifier
74193      </para></listitem>
74194    </varlistentry>
74195    <varlistentry>      <term>can_sleep</term>
74196      <listitem><para>
74197   must be true if the .<function>config</function>, .<function>enable</function> or .<function>disable</function>
74198   operations may sleep
74199      </para></listitem>
74200    </varlistentry>
74201  </variablelist>
74202 </refsect1>
74203</refentry>
74204
74205<!-- drivers/pwm/core.c -->
74206<refentry id="API-pwm-set-chip-data">
74207<refentryinfo>
74208 <title>LINUX</title>
74209 <productname>Kernel Hackers Manual</productname>
74210 <date>July 2017</date>
74211</refentryinfo>
74212<refmeta>
74213 <refentrytitle><phrase>pwm_set_chip_data</phrase></refentrytitle>
74214 <manvolnum>9</manvolnum>
74215 <refmiscinfo class="version">4.4.14</refmiscinfo>
74216</refmeta>
74217<refnamediv>
74218 <refname>pwm_set_chip_data</refname>
74219 <refpurpose>
74220  set private chip data for a PWM
74221 </refpurpose>
74222</refnamediv>
74223<refsynopsisdiv>
74224 <title>Synopsis</title>
74225  <funcsynopsis><funcprototype>
74226   <funcdef>int <function>pwm_set_chip_data </function></funcdef>
74227   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
74228   <paramdef>void * <parameter>data</parameter></paramdef>
74229  </funcprototype></funcsynopsis>
74230</refsynopsisdiv>
74231<refsect1>
74232 <title>Arguments</title>
74233 <variablelist>
74234  <varlistentry>
74235   <term><parameter>pwm</parameter></term>
74236   <listitem>
74237    <para>
74238     PWM device
74239    </para>
74240   </listitem>
74241  </varlistentry>
74242  <varlistentry>
74243   <term><parameter>data</parameter></term>
74244   <listitem>
74245    <para>
74246     pointer to chip-specific data
74247    </para>
74248   </listitem>
74249  </varlistentry>
74250 </variablelist>
74251</refsect1>
74252<refsect1>
74253<title>Returns</title>
74254<para>
74255   0 on success or a negative error code on failure.
74256</para>
74257</refsect1>
74258</refentry>
74259
74260<refentry id="API-pwm-get-chip-data">
74261<refentryinfo>
74262 <title>LINUX</title>
74263 <productname>Kernel Hackers Manual</productname>
74264 <date>July 2017</date>
74265</refentryinfo>
74266<refmeta>
74267 <refentrytitle><phrase>pwm_get_chip_data</phrase></refentrytitle>
74268 <manvolnum>9</manvolnum>
74269 <refmiscinfo class="version">4.4.14</refmiscinfo>
74270</refmeta>
74271<refnamediv>
74272 <refname>pwm_get_chip_data</refname>
74273 <refpurpose>
74274     get private chip data for a PWM
74275 </refpurpose>
74276</refnamediv>
74277<refsynopsisdiv>
74278 <title>Synopsis</title>
74279  <funcsynopsis><funcprototype>
74280   <funcdef>void * <function>pwm_get_chip_data </function></funcdef>
74281   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
74282  </funcprototype></funcsynopsis>
74283</refsynopsisdiv>
74284<refsect1>
74285 <title>Arguments</title>
74286 <variablelist>
74287  <varlistentry>
74288   <term><parameter>pwm</parameter></term>
74289   <listitem>
74290    <para>
74291     PWM device
74292    </para>
74293   </listitem>
74294  </varlistentry>
74295 </variablelist>
74296</refsect1>
74297<refsect1>
74298<title>Returns</title>
74299<para>
74300   A pointer to the chip-private data for the PWM device.
74301</para>
74302</refsect1>
74303</refentry>
74304
74305<refentry id="API-pwmchip-add-with-polarity">
74306<refentryinfo>
74307 <title>LINUX</title>
74308 <productname>Kernel Hackers Manual</productname>
74309 <date>July 2017</date>
74310</refentryinfo>
74311<refmeta>
74312 <refentrytitle><phrase>pwmchip_add_with_polarity</phrase></refentrytitle>
74313 <manvolnum>9</manvolnum>
74314 <refmiscinfo class="version">4.4.14</refmiscinfo>
74315</refmeta>
74316<refnamediv>
74317 <refname>pwmchip_add_with_polarity</refname>
74318 <refpurpose>
74319     register a new PWM chip
74320 </refpurpose>
74321</refnamediv>
74322<refsynopsisdiv>
74323 <title>Synopsis</title>
74324  <funcsynopsis><funcprototype>
74325   <funcdef>int <function>pwmchip_add_with_polarity </function></funcdef>
74326   <paramdef><link linkend="API-struct-pwm-chip">struct pwm_chip</link> * <parameter>chip</parameter></paramdef>
74327   <paramdef><link linkend="API-enum-pwm-polarity">enum pwm_polarity </link><parameter>polarity</parameter></paramdef>
74328  </funcprototype></funcsynopsis>
74329</refsynopsisdiv>
74330<refsect1>
74331 <title>Arguments</title>
74332 <variablelist>
74333  <varlistentry>
74334   <term><parameter>chip</parameter></term>
74335   <listitem>
74336    <para>
74337     the PWM chip to add
74338    </para>
74339   </listitem>
74340  </varlistentry>
74341  <varlistentry>
74342   <term><parameter>polarity</parameter></term>
74343   <listitem>
74344    <para>
74345     initial polarity of PWM channels
74346    </para>
74347   </listitem>
74348  </varlistentry>
74349 </variablelist>
74350</refsect1>
74351<refsect1>
74352<title>Description</title>
74353<para>
74354   Register a new PWM chip. If chip-&gt;base &lt; 0 then a dynamically assigned base
74355   will be used. The initial polarity for all channels is specified by the
74356   <parameter>polarity</parameter> parameter.
74357</para>
74358</refsect1>
74359<refsect1>
74360<title>Returns</title>
74361<para>
74362   0 on success or a negative error code on failure.
74363</para>
74364</refsect1>
74365</refentry>
74366
74367<refentry id="API-pwmchip-add">
74368<refentryinfo>
74369 <title>LINUX</title>
74370 <productname>Kernel Hackers Manual</productname>
74371 <date>July 2017</date>
74372</refentryinfo>
74373<refmeta>
74374 <refentrytitle><phrase>pwmchip_add</phrase></refentrytitle>
74375 <manvolnum>9</manvolnum>
74376 <refmiscinfo class="version">4.4.14</refmiscinfo>
74377</refmeta>
74378<refnamediv>
74379 <refname>pwmchip_add</refname>
74380 <refpurpose>
74381     register a new PWM chip
74382 </refpurpose>
74383</refnamediv>
74384<refsynopsisdiv>
74385 <title>Synopsis</title>
74386  <funcsynopsis><funcprototype>
74387   <funcdef>int <function>pwmchip_add </function></funcdef>
74388   <paramdef><link linkend="API-struct-pwm-chip">struct pwm_chip</link> * <parameter>chip</parameter></paramdef>
74389  </funcprototype></funcsynopsis>
74390</refsynopsisdiv>
74391<refsect1>
74392 <title>Arguments</title>
74393 <variablelist>
74394  <varlistentry>
74395   <term><parameter>chip</parameter></term>
74396   <listitem>
74397    <para>
74398     the PWM chip to add
74399    </para>
74400   </listitem>
74401  </varlistentry>
74402 </variablelist>
74403</refsect1>
74404<refsect1>
74405<title>Description</title>
74406<para>
74407   Register a new PWM chip. If chip-&gt;base &lt; 0 then a dynamically assigned base
74408   will be used. The initial polarity for all channels is normal.
74409</para>
74410</refsect1>
74411<refsect1>
74412<title>Returns</title>
74413<para>
74414   0 on success or a negative error code on failure.
74415</para>
74416</refsect1>
74417</refentry>
74418
74419<refentry id="API-pwmchip-remove">
74420<refentryinfo>
74421 <title>LINUX</title>
74422 <productname>Kernel Hackers Manual</productname>
74423 <date>July 2017</date>
74424</refentryinfo>
74425<refmeta>
74426 <refentrytitle><phrase>pwmchip_remove</phrase></refentrytitle>
74427 <manvolnum>9</manvolnum>
74428 <refmiscinfo class="version">4.4.14</refmiscinfo>
74429</refmeta>
74430<refnamediv>
74431 <refname>pwmchip_remove</refname>
74432 <refpurpose>
74433     remove a PWM chip
74434 </refpurpose>
74435</refnamediv>
74436<refsynopsisdiv>
74437 <title>Synopsis</title>
74438  <funcsynopsis><funcprototype>
74439   <funcdef>int <function>pwmchip_remove </function></funcdef>
74440   <paramdef><link linkend="API-struct-pwm-chip">struct pwm_chip</link> * <parameter>chip</parameter></paramdef>
74441  </funcprototype></funcsynopsis>
74442</refsynopsisdiv>
74443<refsect1>
74444 <title>Arguments</title>
74445 <variablelist>
74446  <varlistentry>
74447   <term><parameter>chip</parameter></term>
74448   <listitem>
74449    <para>
74450     the PWM chip to remove
74451    </para>
74452   </listitem>
74453  </varlistentry>
74454 </variablelist>
74455</refsect1>
74456<refsect1>
74457<title>Description</title>
74458<para>
74459   Removes a PWM chip. This function may return busy if the PWM chip provides
74460   a PWM device that is still requested.
74461</para>
74462</refsect1>
74463<refsect1>
74464<title>Returns</title>
74465<para>
74466   0 on success or a negative error code on failure.
74467</para>
74468</refsect1>
74469</refentry>
74470
74471<refentry id="API-pwm-request">
74472<refentryinfo>
74473 <title>LINUX</title>
74474 <productname>Kernel Hackers Manual</productname>
74475 <date>July 2017</date>
74476</refentryinfo>
74477<refmeta>
74478 <refentrytitle><phrase>pwm_request</phrase></refentrytitle>
74479 <manvolnum>9</manvolnum>
74480 <refmiscinfo class="version">4.4.14</refmiscinfo>
74481</refmeta>
74482<refnamediv>
74483 <refname>pwm_request</refname>
74484 <refpurpose>
74485     request a PWM device
74486 </refpurpose>
74487</refnamediv>
74488<refsynopsisdiv>
74489 <title>Synopsis</title>
74490  <funcsynopsis><funcprototype>
74491   <funcdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <function>pwm_request </function></funcdef>
74492   <paramdef>int <parameter>pwm</parameter></paramdef>
74493   <paramdef>const char * <parameter>label</parameter></paramdef>
74494  </funcprototype></funcsynopsis>
74495</refsynopsisdiv>
74496<refsect1>
74497 <title>Arguments</title>
74498 <variablelist>
74499  <varlistentry>
74500   <term><parameter>pwm</parameter></term>
74501   <listitem>
74502    <para>
74503     global PWM device index
74504    </para>
74505   </listitem>
74506  </varlistentry>
74507  <varlistentry>
74508   <term><parameter>label</parameter></term>
74509   <listitem>
74510    <para>
74511     PWM device label
74512    </para>
74513   </listitem>
74514  </varlistentry>
74515 </variablelist>
74516</refsect1>
74517<refsect1>
74518<title>Description</title>
74519<para>
74520   This function is deprecated, use <function><link linkend="API-pwm-get">pwm_get</link></function> instead.
74521</para>
74522</refsect1>
74523<refsect1>
74524<title>Returns</title>
74525<para>
74526   A pointer to a PWM device or an <function>ERR_PTR</function>-encoded error code on
74527   failure.
74528</para>
74529</refsect1>
74530</refentry>
74531
74532<refentry id="API-pwm-request-from-chip">
74533<refentryinfo>
74534 <title>LINUX</title>
74535 <productname>Kernel Hackers Manual</productname>
74536 <date>July 2017</date>
74537</refentryinfo>
74538<refmeta>
74539 <refentrytitle><phrase>pwm_request_from_chip</phrase></refentrytitle>
74540 <manvolnum>9</manvolnum>
74541 <refmiscinfo class="version">4.4.14</refmiscinfo>
74542</refmeta>
74543<refnamediv>
74544 <refname>pwm_request_from_chip</refname>
74545 <refpurpose>
74546     request a PWM device relative to a PWM chip
74547 </refpurpose>
74548</refnamediv>
74549<refsynopsisdiv>
74550 <title>Synopsis</title>
74551  <funcsynopsis><funcprototype>
74552   <funcdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <function>pwm_request_from_chip </function></funcdef>
74553   <paramdef><link linkend="API-struct-pwm-chip">struct pwm_chip</link> * <parameter>chip</parameter></paramdef>
74554   <paramdef>unsigned int <parameter>index</parameter></paramdef>
74555   <paramdef>const char * <parameter>label</parameter></paramdef>
74556  </funcprototype></funcsynopsis>
74557</refsynopsisdiv>
74558<refsect1>
74559 <title>Arguments</title>
74560 <variablelist>
74561  <varlistentry>
74562   <term><parameter>chip</parameter></term>
74563   <listitem>
74564    <para>
74565     PWM chip
74566    </para>
74567   </listitem>
74568  </varlistentry>
74569  <varlistentry>
74570   <term><parameter>index</parameter></term>
74571   <listitem>
74572    <para>
74573     per-chip index of the PWM to request
74574    </para>
74575   </listitem>
74576  </varlistentry>
74577  <varlistentry>
74578   <term><parameter>label</parameter></term>
74579   <listitem>
74580    <para>
74581     a literal description string of this PWM
74582    </para>
74583   </listitem>
74584  </varlistentry>
74585 </variablelist>
74586</refsect1>
74587<refsect1>
74588<title>Returns</title>
74589<para>
74590   A pointer to the PWM device at the given index of the given PWM
74591   chip. A negative error code is returned if the index is not valid for the
74592   specified PWM chip or if the PWM device cannot be requested.
74593</para>
74594</refsect1>
74595</refentry>
74596
74597<refentry id="API-pwm-free">
74598<refentryinfo>
74599 <title>LINUX</title>
74600 <productname>Kernel Hackers Manual</productname>
74601 <date>July 2017</date>
74602</refentryinfo>
74603<refmeta>
74604 <refentrytitle><phrase>pwm_free</phrase></refentrytitle>
74605 <manvolnum>9</manvolnum>
74606 <refmiscinfo class="version">4.4.14</refmiscinfo>
74607</refmeta>
74608<refnamediv>
74609 <refname>pwm_free</refname>
74610 <refpurpose>
74611     free a PWM device
74612 </refpurpose>
74613</refnamediv>
74614<refsynopsisdiv>
74615 <title>Synopsis</title>
74616  <funcsynopsis><funcprototype>
74617   <funcdef>void <function>pwm_free </function></funcdef>
74618   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
74619  </funcprototype></funcsynopsis>
74620</refsynopsisdiv>
74621<refsect1>
74622 <title>Arguments</title>
74623 <variablelist>
74624  <varlistentry>
74625   <term><parameter>pwm</parameter></term>
74626   <listitem>
74627    <para>
74628     PWM device
74629    </para>
74630   </listitem>
74631  </varlistentry>
74632 </variablelist>
74633</refsect1>
74634<refsect1>
74635<title>Description</title>
74636<para>
74637   This function is deprecated, use <function><link linkend="API-pwm-put">pwm_put</link></function> instead.
74638</para>
74639</refsect1>
74640</refentry>
74641
74642<refentry id="API-pwm-config">
74643<refentryinfo>
74644 <title>LINUX</title>
74645 <productname>Kernel Hackers Manual</productname>
74646 <date>July 2017</date>
74647</refentryinfo>
74648<refmeta>
74649 <refentrytitle><phrase>pwm_config</phrase></refentrytitle>
74650 <manvolnum>9</manvolnum>
74651 <refmiscinfo class="version">4.4.14</refmiscinfo>
74652</refmeta>
74653<refnamediv>
74654 <refname>pwm_config</refname>
74655 <refpurpose>
74656     change a PWM device configuration
74657 </refpurpose>
74658</refnamediv>
74659<refsynopsisdiv>
74660 <title>Synopsis</title>
74661  <funcsynopsis><funcprototype>
74662   <funcdef>int <function>pwm_config </function></funcdef>
74663   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
74664   <paramdef>int <parameter>duty_ns</parameter></paramdef>
74665   <paramdef>int <parameter>period_ns</parameter></paramdef>
74666  </funcprototype></funcsynopsis>
74667</refsynopsisdiv>
74668<refsect1>
74669 <title>Arguments</title>
74670 <variablelist>
74671  <varlistentry>
74672   <term><parameter>pwm</parameter></term>
74673   <listitem>
74674    <para>
74675     PWM device
74676    </para>
74677   </listitem>
74678  </varlistentry>
74679  <varlistentry>
74680   <term><parameter>duty_ns</parameter></term>
74681   <listitem>
74682    <para>
74683     "on" time (in nanoseconds)
74684    </para>
74685   </listitem>
74686  </varlistentry>
74687  <varlistentry>
74688   <term><parameter>period_ns</parameter></term>
74689   <listitem>
74690    <para>
74691     duration (in nanoseconds) of one cycle
74692    </para>
74693   </listitem>
74694  </varlistentry>
74695 </variablelist>
74696</refsect1>
74697<refsect1>
74698<title>Returns</title>
74699<para>
74700   0 on success or a negative error code on failure.
74701</para>
74702</refsect1>
74703</refentry>
74704
74705<refentry id="API-pwm-set-polarity">
74706<refentryinfo>
74707 <title>LINUX</title>
74708 <productname>Kernel Hackers Manual</productname>
74709 <date>July 2017</date>
74710</refentryinfo>
74711<refmeta>
74712 <refentrytitle><phrase>pwm_set_polarity</phrase></refentrytitle>
74713 <manvolnum>9</manvolnum>
74714 <refmiscinfo class="version">4.4.14</refmiscinfo>
74715</refmeta>
74716<refnamediv>
74717 <refname>pwm_set_polarity</refname>
74718 <refpurpose>
74719     configure the polarity of a PWM signal
74720 </refpurpose>
74721</refnamediv>
74722<refsynopsisdiv>
74723 <title>Synopsis</title>
74724  <funcsynopsis><funcprototype>
74725   <funcdef>int <function>pwm_set_polarity </function></funcdef>
74726   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
74727   <paramdef><link linkend="API-enum-pwm-polarity">enum pwm_polarity </link><parameter>polarity</parameter></paramdef>
74728  </funcprototype></funcsynopsis>
74729</refsynopsisdiv>
74730<refsect1>
74731 <title>Arguments</title>
74732 <variablelist>
74733  <varlistentry>
74734   <term><parameter>pwm</parameter></term>
74735   <listitem>
74736    <para>
74737     PWM device
74738    </para>
74739   </listitem>
74740  </varlistentry>
74741  <varlistentry>
74742   <term><parameter>polarity</parameter></term>
74743   <listitem>
74744    <para>
74745     new polarity of the PWM signal
74746    </para>
74747   </listitem>
74748  </varlistentry>
74749 </variablelist>
74750</refsect1>
74751<refsect1>
74752<title>Description</title>
74753<para>
74754   Note that the polarity cannot be configured while the PWM device is
74755   enabled.
74756</para>
74757</refsect1>
74758<refsect1>
74759<title>Returns</title>
74760<para>
74761   0 on success or a negative error code on failure.
74762</para>
74763</refsect1>
74764</refentry>
74765
74766<refentry id="API-pwm-enable">
74767<refentryinfo>
74768 <title>LINUX</title>
74769 <productname>Kernel Hackers Manual</productname>
74770 <date>July 2017</date>
74771</refentryinfo>
74772<refmeta>
74773 <refentrytitle><phrase>pwm_enable</phrase></refentrytitle>
74774 <manvolnum>9</manvolnum>
74775 <refmiscinfo class="version">4.4.14</refmiscinfo>
74776</refmeta>
74777<refnamediv>
74778 <refname>pwm_enable</refname>
74779 <refpurpose>
74780     start a PWM output toggling
74781 </refpurpose>
74782</refnamediv>
74783<refsynopsisdiv>
74784 <title>Synopsis</title>
74785  <funcsynopsis><funcprototype>
74786   <funcdef>int <function>pwm_enable </function></funcdef>
74787   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
74788  </funcprototype></funcsynopsis>
74789</refsynopsisdiv>
74790<refsect1>
74791 <title>Arguments</title>
74792 <variablelist>
74793  <varlistentry>
74794   <term><parameter>pwm</parameter></term>
74795   <listitem>
74796    <para>
74797     PWM device
74798    </para>
74799   </listitem>
74800  </varlistentry>
74801 </variablelist>
74802</refsect1>
74803<refsect1>
74804<title>Returns</title>
74805<para>
74806   0 on success or a negative error code on failure.
74807</para>
74808</refsect1>
74809</refentry>
74810
74811<refentry id="API-pwm-disable">
74812<refentryinfo>
74813 <title>LINUX</title>
74814 <productname>Kernel Hackers Manual</productname>
74815 <date>July 2017</date>
74816</refentryinfo>
74817<refmeta>
74818 <refentrytitle><phrase>pwm_disable</phrase></refentrytitle>
74819 <manvolnum>9</manvolnum>
74820 <refmiscinfo class="version">4.4.14</refmiscinfo>
74821</refmeta>
74822<refnamediv>
74823 <refname>pwm_disable</refname>
74824 <refpurpose>
74825     stop a PWM output toggling
74826 </refpurpose>
74827</refnamediv>
74828<refsynopsisdiv>
74829 <title>Synopsis</title>
74830  <funcsynopsis><funcprototype>
74831   <funcdef>void <function>pwm_disable </function></funcdef>
74832   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
74833  </funcprototype></funcsynopsis>
74834</refsynopsisdiv>
74835<refsect1>
74836 <title>Arguments</title>
74837 <variablelist>
74838  <varlistentry>
74839   <term><parameter>pwm</parameter></term>
74840   <listitem>
74841    <para>
74842     PWM device
74843    </para>
74844   </listitem>
74845  </varlistentry>
74846 </variablelist>
74847</refsect1>
74848</refentry>
74849
74850<refentry id="API-of-pwm-get">
74851<refentryinfo>
74852 <title>LINUX</title>
74853 <productname>Kernel Hackers Manual</productname>
74854 <date>July 2017</date>
74855</refentryinfo>
74856<refmeta>
74857 <refentrytitle><phrase>of_pwm_get</phrase></refentrytitle>
74858 <manvolnum>9</manvolnum>
74859 <refmiscinfo class="version">4.4.14</refmiscinfo>
74860</refmeta>
74861<refnamediv>
74862 <refname>of_pwm_get</refname>
74863 <refpurpose>
74864     request a PWM via the PWM framework
74865 </refpurpose>
74866</refnamediv>
74867<refsynopsisdiv>
74868 <title>Synopsis</title>
74869  <funcsynopsis><funcprototype>
74870   <funcdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <function>of_pwm_get </function></funcdef>
74871   <paramdef>struct device_node * <parameter>np</parameter></paramdef>
74872   <paramdef>const char * <parameter>con_id</parameter></paramdef>
74873  </funcprototype></funcsynopsis>
74874</refsynopsisdiv>
74875<refsect1>
74876 <title>Arguments</title>
74877 <variablelist>
74878  <varlistentry>
74879   <term><parameter>np</parameter></term>
74880   <listitem>
74881    <para>
74882     device node to get the PWM from
74883    </para>
74884   </listitem>
74885  </varlistentry>
74886  <varlistentry>
74887   <term><parameter>con_id</parameter></term>
74888   <listitem>
74889    <para>
74890     consumer name
74891    </para>
74892   </listitem>
74893  </varlistentry>
74894 </variablelist>
74895</refsect1>
74896<refsect1>
74897<title>Description</title>
74898<para>
74899   Returns the PWM device parsed from the phandle and index specified in the
74900   <quote>pwms</quote> property of a device tree node or a negative error-code on failure.
74901   Values parsed from the device tree are stored in the returned PWM device
74902   object.
74903   </para><para>
74904
74905   If con_id is NULL, the first PWM device listed in the <quote>pwms</quote> property will
74906   be requested. Otherwise the <quote>pwm-names</quote> property is used to do a reverse
74907   lookup of the PWM index. This also means that the <quote>pwm-names</quote> property
74908   becomes mandatory for devices that look up the PWM device via the con_id
74909   parameter.
74910</para>
74911</refsect1>
74912<refsect1>
74913<title>Returns</title>
74914<para>
74915   A pointer to the requested PWM device or an <function>ERR_PTR</function>-encoded
74916   error code on failure.
74917</para>
74918</refsect1>
74919</refentry>
74920
74921<refentry id="API-pwm-get">
74922<refentryinfo>
74923 <title>LINUX</title>
74924 <productname>Kernel Hackers Manual</productname>
74925 <date>July 2017</date>
74926</refentryinfo>
74927<refmeta>
74928 <refentrytitle><phrase>pwm_get</phrase></refentrytitle>
74929 <manvolnum>9</manvolnum>
74930 <refmiscinfo class="version">4.4.14</refmiscinfo>
74931</refmeta>
74932<refnamediv>
74933 <refname>pwm_get</refname>
74934 <refpurpose>
74935     look up and request a PWM device
74936 </refpurpose>
74937</refnamediv>
74938<refsynopsisdiv>
74939 <title>Synopsis</title>
74940  <funcsynopsis><funcprototype>
74941   <funcdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <function>pwm_get </function></funcdef>
74942   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
74943   <paramdef>const char * <parameter>con_id</parameter></paramdef>
74944  </funcprototype></funcsynopsis>
74945</refsynopsisdiv>
74946<refsect1>
74947 <title>Arguments</title>
74948 <variablelist>
74949  <varlistentry>
74950   <term><parameter>dev</parameter></term>
74951   <listitem>
74952    <para>
74953     device for PWM consumer
74954    </para>
74955   </listitem>
74956  </varlistentry>
74957  <varlistentry>
74958   <term><parameter>con_id</parameter></term>
74959   <listitem>
74960    <para>
74961     consumer name
74962    </para>
74963   </listitem>
74964  </varlistentry>
74965 </variablelist>
74966</refsect1>
74967<refsect1>
74968<title>Description</title>
74969<para>
74970   Lookup is first attempted using DT. If the device was not instantiated from
74971   a device tree, a PWM chip and a relative index is looked up via a table
74972   supplied by board setup code (see <function>pwm_add_table</function>).
74973   </para><para>
74974
74975   Once a PWM chip has been found the specified PWM device will be requested
74976   and is ready to be used.
74977</para>
74978</refsect1>
74979<refsect1>
74980<title>Returns</title>
74981<para>
74982   A pointer to the requested PWM device or an <function>ERR_PTR</function>-encoded
74983   error code on failure.
74984</para>
74985</refsect1>
74986</refentry>
74987
74988<refentry id="API-pwm-put">
74989<refentryinfo>
74990 <title>LINUX</title>
74991 <productname>Kernel Hackers Manual</productname>
74992 <date>July 2017</date>
74993</refentryinfo>
74994<refmeta>
74995 <refentrytitle><phrase>pwm_put</phrase></refentrytitle>
74996 <manvolnum>9</manvolnum>
74997 <refmiscinfo class="version">4.4.14</refmiscinfo>
74998</refmeta>
74999<refnamediv>
75000 <refname>pwm_put</refname>
75001 <refpurpose>
75002     release a PWM device
75003 </refpurpose>
75004</refnamediv>
75005<refsynopsisdiv>
75006 <title>Synopsis</title>
75007  <funcsynopsis><funcprototype>
75008   <funcdef>void <function>pwm_put </function></funcdef>
75009   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
75010  </funcprototype></funcsynopsis>
75011</refsynopsisdiv>
75012<refsect1>
75013 <title>Arguments</title>
75014 <variablelist>
75015  <varlistentry>
75016   <term><parameter>pwm</parameter></term>
75017   <listitem>
75018    <para>
75019     PWM device
75020    </para>
75021   </listitem>
75022  </varlistentry>
75023 </variablelist>
75024</refsect1>
75025</refentry>
75026
75027<refentry id="API-devm-pwm-get">
75028<refentryinfo>
75029 <title>LINUX</title>
75030 <productname>Kernel Hackers Manual</productname>
75031 <date>July 2017</date>
75032</refentryinfo>
75033<refmeta>
75034 <refentrytitle><phrase>devm_pwm_get</phrase></refentrytitle>
75035 <manvolnum>9</manvolnum>
75036 <refmiscinfo class="version">4.4.14</refmiscinfo>
75037</refmeta>
75038<refnamediv>
75039 <refname>devm_pwm_get</refname>
75040 <refpurpose>
75041     resource managed <function><link linkend="API-pwm-get">pwm_get</link></function>
75042 </refpurpose>
75043</refnamediv>
75044<refsynopsisdiv>
75045 <title>Synopsis</title>
75046  <funcsynopsis><funcprototype>
75047   <funcdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <function>devm_pwm_get </function></funcdef>
75048   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
75049   <paramdef>const char * <parameter>con_id</parameter></paramdef>
75050  </funcprototype></funcsynopsis>
75051</refsynopsisdiv>
75052<refsect1>
75053 <title>Arguments</title>
75054 <variablelist>
75055  <varlistentry>
75056   <term><parameter>dev</parameter></term>
75057   <listitem>
75058    <para>
75059     device for PWM consumer
75060    </para>
75061   </listitem>
75062  </varlistentry>
75063  <varlistentry>
75064   <term><parameter>con_id</parameter></term>
75065   <listitem>
75066    <para>
75067     consumer name
75068    </para>
75069   </listitem>
75070  </varlistentry>
75071 </variablelist>
75072</refsect1>
75073<refsect1>
75074<title>Description</title>
75075<para>
75076   This function performs like <function><link linkend="API-pwm-get">pwm_get</link></function> but the acquired PWM device will
75077   automatically be released on driver detach.
75078</para>
75079</refsect1>
75080<refsect1>
75081<title>Returns</title>
75082<para>
75083   A pointer to the requested PWM device or an <function>ERR_PTR</function>-encoded
75084   error code on failure.
75085</para>
75086</refsect1>
75087</refentry>
75088
75089<refentry id="API-devm-of-pwm-get">
75090<refentryinfo>
75091 <title>LINUX</title>
75092 <productname>Kernel Hackers Manual</productname>
75093 <date>July 2017</date>
75094</refentryinfo>
75095<refmeta>
75096 <refentrytitle><phrase>devm_of_pwm_get</phrase></refentrytitle>
75097 <manvolnum>9</manvolnum>
75098 <refmiscinfo class="version">4.4.14</refmiscinfo>
75099</refmeta>
75100<refnamediv>
75101 <refname>devm_of_pwm_get</refname>
75102 <refpurpose>
75103     resource managed <function><link linkend="API-of-pwm-get">of_pwm_get</link></function>
75104 </refpurpose>
75105</refnamediv>
75106<refsynopsisdiv>
75107 <title>Synopsis</title>
75108  <funcsynopsis><funcprototype>
75109   <funcdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <function>devm_of_pwm_get </function></funcdef>
75110   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
75111   <paramdef>struct device_node * <parameter>np</parameter></paramdef>
75112   <paramdef>const char * <parameter>con_id</parameter></paramdef>
75113  </funcprototype></funcsynopsis>
75114</refsynopsisdiv>
75115<refsect1>
75116 <title>Arguments</title>
75117 <variablelist>
75118  <varlistentry>
75119   <term><parameter>dev</parameter></term>
75120   <listitem>
75121    <para>
75122     device for PWM consumer
75123    </para>
75124   </listitem>
75125  </varlistentry>
75126  <varlistentry>
75127   <term><parameter>np</parameter></term>
75128   <listitem>
75129    <para>
75130     device node to get the PWM from
75131    </para>
75132   </listitem>
75133  </varlistentry>
75134  <varlistentry>
75135   <term><parameter>con_id</parameter></term>
75136   <listitem>
75137    <para>
75138     consumer name
75139    </para>
75140   </listitem>
75141  </varlistentry>
75142 </variablelist>
75143</refsect1>
75144<refsect1>
75145<title>Description</title>
75146<para>
75147   This function performs like <function><link linkend="API-of-pwm-get">of_pwm_get</link></function> but the acquired PWM device will
75148   automatically be released on driver detach.
75149</para>
75150</refsect1>
75151<refsect1>
75152<title>Returns</title>
75153<para>
75154   A pointer to the requested PWM device or an <function>ERR_PTR</function>-encoded
75155   error code on failure.
75156</para>
75157</refsect1>
75158</refentry>
75159
75160<refentry id="API-devm-pwm-put">
75161<refentryinfo>
75162 <title>LINUX</title>
75163 <productname>Kernel Hackers Manual</productname>
75164 <date>July 2017</date>
75165</refentryinfo>
75166<refmeta>
75167 <refentrytitle><phrase>devm_pwm_put</phrase></refentrytitle>
75168 <manvolnum>9</manvolnum>
75169 <refmiscinfo class="version">4.4.14</refmiscinfo>
75170</refmeta>
75171<refnamediv>
75172 <refname>devm_pwm_put</refname>
75173 <refpurpose>
75174     resource managed <function><link linkend="API-pwm-put">pwm_put</link></function>
75175 </refpurpose>
75176</refnamediv>
75177<refsynopsisdiv>
75178 <title>Synopsis</title>
75179  <funcsynopsis><funcprototype>
75180   <funcdef>void <function>devm_pwm_put </function></funcdef>
75181   <paramdef><link linkend="API-struct-device">struct device</link> * <parameter>dev</parameter></paramdef>
75182   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
75183  </funcprototype></funcsynopsis>
75184</refsynopsisdiv>
75185<refsect1>
75186 <title>Arguments</title>
75187 <variablelist>
75188  <varlistentry>
75189   <term><parameter>dev</parameter></term>
75190   <listitem>
75191    <para>
75192     device for PWM consumer
75193    </para>
75194   </listitem>
75195  </varlistentry>
75196  <varlistentry>
75197   <term><parameter>pwm</parameter></term>
75198   <listitem>
75199    <para>
75200     PWM device
75201    </para>
75202   </listitem>
75203  </varlistentry>
75204 </variablelist>
75205</refsect1>
75206<refsect1>
75207<title>Description</title>
75208<para>
75209   Release a PWM previously allocated using <function><link linkend="API-devm-pwm-get">devm_pwm_get</link></function>. Calling this
75210   function is usually not needed because devm-allocated resources are
75211   automatically released on driver detach.
75212</para>
75213</refsect1>
75214</refentry>
75215
75216<refentry id="API-pwm-can-sleep">
75217<refentryinfo>
75218 <title>LINUX</title>
75219 <productname>Kernel Hackers Manual</productname>
75220 <date>July 2017</date>
75221</refentryinfo>
75222<refmeta>
75223 <refentrytitle><phrase>pwm_can_sleep</phrase></refentrytitle>
75224 <manvolnum>9</manvolnum>
75225 <refmiscinfo class="version">4.4.14</refmiscinfo>
75226</refmeta>
75227<refnamediv>
75228 <refname>pwm_can_sleep</refname>
75229 <refpurpose>
75230     report whether PWM access will sleep
75231 </refpurpose>
75232</refnamediv>
75233<refsynopsisdiv>
75234 <title>Synopsis</title>
75235  <funcsynopsis><funcprototype>
75236   <funcdef>bool <function>pwm_can_sleep </function></funcdef>
75237   <paramdef><link linkend="API-struct-pwm-device">struct pwm_device</link> * <parameter>pwm</parameter></paramdef>
75238  </funcprototype></funcsynopsis>
75239</refsynopsisdiv>
75240<refsect1>
75241 <title>Arguments</title>
75242 <variablelist>
75243  <varlistentry>
75244   <term><parameter>pwm</parameter></term>
75245   <listitem>
75246    <para>
75247     PWM device
75248    </para>
75249   </listitem>
75250  </varlistentry>
75251 </variablelist>
75252</refsect1>
75253<refsect1>
75254<title>Returns</title>
75255<para>
75256   True if accessing the PWM can sleep, false otherwise.
75257</para>
75258</refsect1>
75259</refentry>
75260
75261  </chapter>
75262
75263</book>
75264