xref: /linux/Documentation/userspace-api/media/v4l/func-munmap.rst (revision 6870112c46c867f50cd27570860a05bd82614b5c)
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/userspace-api/media/fdl-appendix.rst.
7..
8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10.. _func-munmap:
11
12*************
13V4L2 munmap()
14*************
15
16Name
17====
18
19v4l2-munmap - Unmap device memory
20
21
22Synopsis
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
34Arguments
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
50Description
51===========
52
53Unmaps a previously with the :ref:`mmap() <func-mmap>` function mapped
54buffer and frees it, if possible.
55
56
57Return Value
58============
59
60On success :ref:`munmap() <func-munmap>` returns 0, on failure -1 and the
61``errno`` variable is set appropriately:
62
63EINVAL
64    The ``start`` or ``length`` is incorrect, or no buffers have been
65    mapped yet.
66