diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2012-05-10 02:02:07 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 08:09:02 -0300 |
commit | 6016af82eafcb6e086a8f2a2197b46029a843d68 (patch) | |
tree | a8133e0651a8e0d5d33fbce904471a9c42127b51 /Documentation | |
parent | 121b3ddbe4ad17df77cb7284239be0a63d9a66bd (diff) |
[media] v4l2: use __u32 rather than enums in ioctl() structs
V4L2 uses the enum type in IOCTL arguments in IOCTLs that were defined until
the use of enum was considered less than ideal. Recently Rémi Denis-Courmont
brought up the issue by proposing a patch to convert the enums to unsigned:
<URL:http://www.spinics.net/lists/linux-media/msg46167.html>
This sparked a long discussion where another solution to the issue was
proposed: two sets of IOCTL structures, one with __u32 and the other with
enums, and conversion code between the two:
<URL:http://www.spinics.net/lists/linux-media/msg47168.html>
Both approaches implement a complete solution that resolves the problem. The
first one is simple but requires assuming enums and __u32 are the same in
size (so we won't break the ABI) while the second one is more complex and
less clean but does not require making that assumption.
The issue boils down to whether enums are fundamentally different from __u32
or not, and can the former be substituted by the latter. During the
discussion it was concluded that the __u32 has the same size as enums on all
archs Linux is supported: it has not been shown that replacing those enums
in IOCTL arguments would break neither source or binary compatibility. If no
such reason is found, just replacing the enums with __u32s is the way to go.
This is what this patch does. This patch is slightly different from Remi's
first RFC (link above): it uses __u32 instead of unsigned and also changes
the arguments of VIDIOC_G_PRIORITY and VIDIOC_S_PRIORITY.
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation')
13 files changed, 36 insertions, 29 deletions
diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index b815929b5bb..fd6aca2922b 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml @@ -543,12 +543,13 @@ and can range from zero to the number of buffers allocated with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.</entry> </row> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry></entry> <entry>Type of the buffer, same as &v4l2-format; <structfield>type</structfield> or &v4l2-requestbuffers; -<structfield>type</structfield>, set by the application.</entry> +<structfield>type</structfield>, set by the application. See <xref +linkend="v4l2-buf-type" /></entry> </row> <row> <entry>__u32</entry> @@ -568,7 +569,7 @@ refers to an input stream, applications when an output stream.</entry> linkend="buffer-flags" />.</entry> </row> <row> - <entry>&v4l2-field;</entry> + <entry>__u32</entry> <entry><structfield>field</structfield></entry> <entry></entry> <entry>Indicates the field order of the image in the @@ -630,11 +631,12 @@ bandwidth. These devices identify by not enumerating any video standards, see <xref linkend="standard" />.</para></entry> </row> <row> - <entry>&v4l2-memory;</entry> + <entry>__u32</entry> <entry><structfield>memory</structfield></entry> <entry></entry> <entry>This field must be set by applications and/or drivers -in accordance with the selected I/O method.</entry> +in accordance with the selected I/O method. See <xref linkend="v4l2-memory" + /></entry> </row> <row> <entry>union</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml index 73ae8a6cd00..184cdfc1308 100644 --- a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml +++ b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml @@ -94,16 +94,18 @@ information.</para> <entry>The number of buffers requested or granted.</entry> </row> <row> - <entry>&v4l2-memory;</entry> + <entry>__u32</entry> <entry><structfield>memory</structfield></entry> <entry>Applications set this field to <constant>V4L2_MEMORY_MMAP</constant> or -<constant>V4L2_MEMORY_USERPTR</constant>.</entry> +<constant>V4L2_MEMORY_USERPTR</constant>. See <xref linkend="v4l2-memory" +/></entry> </row> <row> - <entry>&v4l2-format;</entry> + <entry>__u32</entry> <entry><structfield>format</structfield></entry> - <entry>Filled in by the application, preserved by the driver.</entry> + <entry>Filled in by the application, preserved by the driver. + See <xref linkend="v4l2-format" />.</entry> </row> <row> <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml index b4f2f255211..f1bac2c6e97 100644 --- a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml @@ -65,7 +65,7 @@ output.</para> &cs-str; <tbody valign="top"> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>Type of the data stream, set by the application. Only these types are valid here: @@ -73,7 +73,7 @@ Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>, <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> -and higher.</entry> +and higher. See <xref linkend="v4l2-buf-type" />.</entry> </row> <row> <entry>struct <link linkend="v4l2-rect-crop">v4l2_rect</link></entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml index 347d142e743..81ebe48317f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml @@ -71,7 +71,7 @@ the application. This is in no way related to the <structfield> pixelformat</structfield> field.</entry> </row> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>Type of the data stream, set by the application. Only these types are valid here: @@ -81,7 +81,7 @@ Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>, <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> -and higher.</entry> +and higher. See <xref linkend="v4l2-buf-type" />.</entry> </row> <row> <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-crop.xml b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml index 01a50640dce..c4ff3b1887f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-crop.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml @@ -100,14 +100,14 @@ changed and <constant>VIDIOC_S_CROP</constant> returns the &cs-str; <tbody valign="top"> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>Type of the data stream, set by the application. Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>, <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>, <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> -and higher.</entry> +and higher. See <xref linkend="v4l2-buf-type" />.</entry> </row> <row> <entry>&v4l2-rect;</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml index 17fbda15137..52acff193a6 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml @@ -116,7 +116,7 @@ this ioctl.</para> <colspec colname="c4" /> <tbody valign="top"> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry></entry> <entry>Type of the data stream, see <xref diff --git a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml index 66e9a525786..69c178a4d20 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml @@ -95,14 +95,14 @@ the &v4l2-output; <structfield>modulator</structfield> field and the &v4l2-modulator; <structfield>index</structfield> field.</entry> </row> <row> - <entry>&v4l2-tuner-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>The tuner type. This is the same value as in the -&v4l2-tuner; <structfield>type</structfield> field. The type must be set +&v4l2-tuner; <structfield>type</structfield> field. See The type must be set to <constant>V4L2_TUNER_RADIO</constant> for <filename>/dev/radioX</filename> device nodes, and to <constant>V4L2_TUNER_ANALOG_TV</constant> for all others. The field is not applicable to modulators, &ie; ignored -by drivers.</entry> +by drivers. See <xref linkend="v4l2-tuner-type" /></entry> </row> <row> <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-parm.xml b/Documentation/DocBook/media/v4l/vidioc-g-parm.xml index 19b1d85dd66..f83d2cdd118 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-parm.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-parm.xml @@ -75,11 +75,12 @@ devices.</para> &cs-ustr; <tbody valign="top"> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry></entry> <entry>The buffer (stream) type, same as &v4l2-format; -<structfield>type</structfield>, set by the application.</entry> +<structfield>type</structfield>, set by the application. See <xref + linkend="v4l2-buf-type" /></entry> </row> <row> <entry>union</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml b/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml index 71741daaf72..bd015d1563f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml @@ -148,7 +148,7 @@ using the &VIDIOC-S-FMT; ioctl as described in <xref <structfield>service_lines</structfield>[1][0] to zero.</entry> </row> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>Type of the data stream, see <xref linkend="v4l2-buf-type" />. Should be diff --git a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml index 91ec2fb658f..62a1aa200a3 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml @@ -107,7 +107,7 @@ user.<!-- FIXME Video inputs already have a name, the purpose of this field is not quite clear.--></para></entry> </row> <row> - <entry>&v4l2-tuner-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry spanname="hspan">Type of the tuner, see <xref linkend="v4l2-tuner-type" />.</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml index 505f0206e5b..e6645b99655 100644 --- a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml @@ -127,7 +127,7 @@ the first control with a higher ID. Drivers which do not support this flag yet always return an &EINVAL;.</entry> </row> <row> - <entry>&v4l2-ctrl-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>Type of control, see <xref linkend="v4l2-ctrl-type" />.</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml index 7be4b1d29b9..d7c95057bc5 100644 --- a/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml +++ b/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml @@ -92,18 +92,19 @@ streamoff.--></para> <entry>The number of buffers requested or granted.</entry> </row> <row> - <entry>&v4l2-buf-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>Type of the stream or buffers, this is the same as the &v4l2-format; <structfield>type</structfield> field. See <xref linkend="v4l2-buf-type" /> for valid values.</entry> </row> <row> - <entry>&v4l2-memory;</entry> + <entry>__u32</entry> <entry><structfield>memory</structfield></entry> <entry>Applications set this field to <constant>V4L2_MEMORY_MMAP</constant> or -<constant>V4L2_MEMORY_USERPTR</constant>.</entry> +<constant>V4L2_MEMORY_USERPTR</constant>. See <xref linkend="v4l2-memory" +/>.</entry> </row> <row> <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml index 18b1a8266f7..407dfceb71f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml +++ b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml @@ -73,10 +73,11 @@ same value as in the &v4l2-input; <structfield>tuner</structfield> field and the &v4l2-tuner; <structfield>index</structfield> field.</entry> </row> <row> - <entry>&v4l2-tuner-type;</entry> + <entry>__u32</entry> <entry><structfield>type</structfield></entry> <entry>The tuner type. This is the same value as in the -&v4l2-tuner; <structfield>type</structfield> field.</entry> +&v4l2-tuner; <structfield>type</structfield> field. See <xref + linkend="v4l2-tuner-type" /></entry> </row> <row> <entry>__u32</entry> |