Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[cascardo/linux.git] / Documentation / media / uapi / gen-errors.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _gen_errors:
4
5 *******************
6 Generic Error Codes
7 *******************
8
9
10 .. _gen-errors:
11
12 .. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
13
14 .. flat-table:: Generic error codes
15     :header-rows:  0
16     :stub-columns: 0
17     :widths: 1 16
18
19
20     -  .. row 1
21
22        -  ``EAGAIN`` (aka ``EWOULDBLOCK``)
23
24        -  The ioctl can't be handled because the device is in state where it
25           can't perform it. This could happen for example in case where
26           device is sleeping and ioctl is performed to query statistics. It
27           is also returned when the ioctl would need to wait for an event,
28           but the device was opened in non-blocking mode.
29
30     -  .. row 2
31
32        -  ``EBADF``
33
34        -  The file descriptor is not a valid.
35
36     -  .. row 3
37
38        -  ``EBUSY``
39
40        -  The ioctl can't be handled because the device is busy. This is
41           typically return while device is streaming, and an ioctl tried to
42           change something that would affect the stream, or would require
43           the usage of a hardware resource that was already allocated. The
44           ioctl must not be retried without performing another action to fix
45           the problem first (typically: stop the stream before retrying).
46
47     -  .. row 4
48
49        -  ``EFAULT``
50
51        -  There was a failure while copying data from/to userspace, probably
52           caused by an invalid pointer reference.
53
54     -  .. row 5
55
56        -  ``EINVAL``
57
58        -  One or more of the ioctl parameters are invalid or out of the
59           allowed range. This is a widely used error code. See the
60           individual ioctl requests for specific causes.
61
62     -  .. row 6
63
64        -  ``ENODEV``
65
66        -  Device not found or was removed.
67
68     -  .. row 7
69
70        -  ``ENOMEM``
71
72        -  There's not enough memory to handle the desired operation.
73
74     -  .. row 8
75
76        -  ``ENOTTY``
77
78        -  The ioctl is not supported by the driver, actually meaning that
79           the required functionality is not available, or the file
80           descriptor is not for a media device.
81
82     -  .. row 9
83
84        -  ``ENOSPC``
85
86        -  On USB devices, the stream ioctl's can return this error, meaning
87           that this request would overcommit the usb bandwidth reserved for
88           periodic transfers (up to 80% of the USB bandwidth).
89
90     -  .. row 10
91
92        -  ``EPERM``
93
94        -  Permission denied. Can be returned if the device needs write
95           permission, or some special capabilities is needed (e. g. root)
96
97 .. note::
98
99   #. This list is not exaustive; ioctls may return other error codes.
100      Since errors may have side effects such as a driver reset,
101      applications should abort on unexpected errors, or otherwise
102      assume that the device is in a bad state.
103
104   #. Request-specific error codes are listed in the individual
105      requests descriptions.