aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2012-07-12 11:06:24 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 20:43:25 -0400
commit26ddcbcca3057125a0e5f3901b06439a20869640 (patch)
tree00a0fe47765d6874ce3cf4a147ffb92a229f316d
parenta4de5f058c56a3cc72dc31dabc548eab100e3d2d (diff)
[media] Use a named union in struct v4l2_ioctl_info
Hi Mauro, struct v4l2_ioctl_info uses an anonymous union, which is initialized in the v4l2_ioctls table. Unfortunately gcc < 4.6 uses a non-standard syntax for that, so trying to compile v4l2-ioctl.c with an older gcc will fail. It is possible to work around this by testing the gcc version, but in this case it is easier to make the union named since it is used in only a few places. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Randy Dunlap <rdunlap@xenotime.net> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/v4l2-ioctl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 0f54f8efe66..c3b7b5f59b3 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1891,7 +1891,7 @@ struct v4l2_ioctl_info {
1891 u32 offset; 1891 u32 offset;
1892 int (*func)(const struct v4l2_ioctl_ops *ops, 1892 int (*func)(const struct v4l2_ioctl_ops *ops,
1893 struct file *file, void *fh, void *p); 1893 struct file *file, void *fh, void *p);
1894 }; 1894 } u;
1895 void (*debug)(const void *arg, bool write_only); 1895 void (*debug)(const void *arg, bool write_only);
1896}; 1896};
1897 1897
@@ -1916,7 +1916,7 @@ struct v4l2_ioctl_info {
1916 .ioctl = _ioctl, \ 1916 .ioctl = _ioctl, \
1917 .flags = _flags | INFO_FL_STD, \ 1917 .flags = _flags | INFO_FL_STD, \
1918 .name = #_ioctl, \ 1918 .name = #_ioctl, \
1919 .offset = offsetof(struct v4l2_ioctl_ops, _vidioc), \ 1919 .u.offset = offsetof(struct v4l2_ioctl_ops, _vidioc), \
1920 .debug = _debug, \ 1920 .debug = _debug, \
1921 } 1921 }
1922 1922
@@ -1925,7 +1925,7 @@ struct v4l2_ioctl_info {
1925 .ioctl = _ioctl, \ 1925 .ioctl = _ioctl, \
1926 .flags = _flags | INFO_FL_FUNC, \ 1926 .flags = _flags | INFO_FL_FUNC, \
1927 .name = #_ioctl, \ 1927 .name = #_ioctl, \
1928 .func = _func, \ 1928 .u.func = _func, \
1929 .debug = _debug, \ 1929 .debug = _debug, \
1930 } 1930 }
1931 1931
@@ -2124,11 +2124,11 @@ static long __video_do_ioctl(struct file *file,
2124 if (info->flags & INFO_FL_STD) { 2124 if (info->flags & INFO_FL_STD) {
2125 typedef int (*vidioc_op)(struct file *file, void *fh, void *p); 2125 typedef int (*vidioc_op)(struct file *file, void *fh, void *p);
2126 const void *p = vfd->ioctl_ops; 2126 const void *p = vfd->ioctl_ops;
2127 const vidioc_op *vidioc = p + info->offset; 2127 const vidioc_op *vidioc = p + info->u.offset;
2128 2128
2129 ret = (*vidioc)(file, fh, arg); 2129 ret = (*vidioc)(file, fh, arg);
2130 } else if (info->flags & INFO_FL_FUNC) { 2130 } else if (info->flags & INFO_FL_FUNC) {
2131 ret = info->func(ops, file, fh, arg); 2131 ret = info->u.func(ops, file, fh, arg);
2132 } else if (!ops->vidioc_default) { 2132 } else if (!ops->vidioc_default) {
2133 ret = -ENOTTY; 2133 ret = -ENOTTY;
2134 } else { 2134 } else {