History

media: v4l: fix uapi mpeg slice params definition

We get a headers_check warning about the newly defined ioctl command structures: ./usr/include/linux/v4l2-controls.h:1105: found __[us]{8,16,32,64} type without #include <linux/types.h> This is resolved by including linux/types.h, as suggested by the warning, but there is another problem: Three of the four structures have an odd number of __u8 headers, but are aligned to 32 bit in the v4l2_ctrl_mpeg2_slice_params, so we get an implicit padding byte for each one. To solve that, let's add explicit padding that can be set to zero and verified in the kernel. Fixes: c27bb30e7b6d ("media: v4l: Add definitions for MPEG-2 slice format and metadata")

Arnd Bergmann committed 8 years ago

Commit df18bfd1 parent dafb7f92 files · +10 −2Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/v4l2-controls.h+5−2
@@ -47,11 +47,11 @@ · 46 unmodified lines
4747 * videodev2.h.
4848 */
4949
50−#include <linux/types.h>
51−
5250 #ifndef __LINUX_V4L2_CONTROLS_H
5351 #define __LINUX_V4L2_CONTROLS_H
5452
53+#include <linux/types.h>
54+
5555 /* Control classes */
5656 #define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
5757 #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
@@ -1112,6 +1112,7 @@ struct v4l2_mpeg2_sequence { · 1054 unmodified lines
11121112 __u8 profile_and_level_indication;
11131113 __u8 progressive_sequence;
11141114 __u8 chroma_format;
1115+ __u8 pad;
11151116 };
11161117
11171118 struct v4l2_mpeg2_picture {
@@ -1130,6 +1131,7 @@ struct v4l2_mpeg2_picture { · 12 unmodified lines
11301131 __u8 alternate_scan;
11311132 __u8 repeat_first_field;
11321133 __u8 progressive_frame;
1134+ __u8 pad;
11331135 };
11341136
11351137 struct v4l2_ctrl_mpeg2_slice_params {
@@ -1144,6 +1146,7 @@ struct v4l2_ctrl_mpeg2_slice_params { · 8 unmodified lines
11441146
11451147 __u8 backward_ref_index;
11461148 __u8 forward_ref_index;
1149+ __u8 pad;
11471150 };
11481151
11491152 struct v4l2_ctrl_mpeg2_quantization {