Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / func-munmap.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _func-munmap:
11
12 *************
13 V4L2 munmap()
14 *************
15
16 Name
17 ====
18
19 v4l2-munmap - Unmap device memory
20
21
22 Synopsis
23 ========
24
25 .. code-block:: c
26
27     #include <unistd.h>
28     #include <sys/mman.h>
29
30
31 .. c:function:: int munmap( void *start, size_t length )
32     :name: v4l2-munmap
33
34 Arguments
35 =========
36
37 ``start``
38     Address of the mapped buffer as returned by the
39     :ref:`mmap() <func-mmap>` function.
40
41 ``length``
42     Length of the mapped buffer. This must be the same value as given to
43     :ref:`mmap() <func-mmap>` and returned by the driver in the struct
44     :c:type:`v4l2_buffer` ``length`` field for the
45     single-planar API and in the struct
46     :c:type:`v4l2_plane` ``length`` field for the
47     multi-planar API.
48
49
50 Description
51 ===========
52
53 Unmaps a previously with the :ref:`mmap() <func-mmap>` function mapped
54 buffer and frees it, if possible.
55
56
57 Return Value
58 ============
59
60 On success :ref:`munmap() <func-munmap>` returns 0, on failure -1 and the
61 ``errno`` variable is set appropriately:
62
63 EINVAL
64     The ``start`` or ``length`` is incorrect, or no buffers have been
65     mapped yet.