diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-06-22 05:35:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-07-06 16:20:07 -0400 |
commit | f18d8e07b28e2950679edaa4edaa7ce410dd57fc (patch) | |
tree | c02f1ce4446a1843b6b710a189ba6c46778dbefe /drivers/media | |
parent | 458aa4a6922bf4cc22a34adfe3bd56331bbf663e (diff) |
[media] v4l2-ioctl.c: finalize table conversion
Implement the default case which finalizes the table conversion and allows
us to remove the last part of the switch.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 74fe6a2797e8..9ded54b16e88 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -855,6 +855,11 @@ static void v4l_print_newline(const void *arg, bool write_only) | |||
855 | pr_cont("\n"); | 855 | pr_cont("\n"); |
856 | } | 856 | } |
857 | 857 | ||
858 | static void v4l_print_default(const void *arg, bool write_only) | ||
859 | { | ||
860 | pr_cont("driver-specific ioctl\n"); | ||
861 | } | ||
862 | |||
858 | static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) | 863 | static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) |
859 | { | 864 | { |
860 | __u32 i; | 865 | __u32 i; |
@@ -1839,12 +1844,6 @@ struct v4l2_ioctl_info { | |||
1839 | sizeof(((struct v4l2_struct *)0)->field)) << 16) | 1844 | sizeof(((struct v4l2_struct *)0)->field)) << 16) |
1840 | #define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16) | 1845 | #define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16) |
1841 | 1846 | ||
1842 | #define IOCTL_INFO(_ioctl, _flags) [_IOC_NR(_ioctl)] = { \ | ||
1843 | .ioctl = _ioctl, \ | ||
1844 | .flags = _flags, \ | ||
1845 | .name = #_ioctl, \ | ||
1846 | } | ||
1847 | |||
1848 | #define IOCTL_INFO_STD(_ioctl, _vidioc, _debug, _flags) \ | 1847 | #define IOCTL_INFO_STD(_ioctl, _vidioc, _debug, _flags) \ |
1849 | [_IOC_NR(_ioctl)] = { \ | 1848 | [_IOC_NR(_ioctl)] = { \ |
1850 | .ioctl = _ioctl, \ | 1849 | .ioctl = _ioctl, \ |
@@ -2028,12 +2027,12 @@ static long __video_do_ioctl(struct file *file, | |||
2028 | } else { | 2027 | } else { |
2029 | default_info.ioctl = cmd; | 2028 | default_info.ioctl = cmd; |
2030 | default_info.flags = 0; | 2029 | default_info.flags = 0; |
2031 | default_info.debug = NULL; | 2030 | default_info.debug = v4l_print_default; |
2032 | info = &default_info; | 2031 | info = &default_info; |
2033 | } | 2032 | } |
2034 | 2033 | ||
2035 | write_only = _IOC_DIR(cmd) == _IOC_WRITE; | 2034 | write_only = _IOC_DIR(cmd) == _IOC_WRITE; |
2036 | if (info->debug && write_only && vfd->debug > V4L2_DEBUG_IOCTL) { | 2035 | if (write_only && vfd->debug > V4L2_DEBUG_IOCTL) { |
2037 | v4l_print_ioctl(vfd->name, cmd); | 2036 | v4l_print_ioctl(vfd->name, cmd); |
2038 | pr_cont(": "); | 2037 | pr_cont(": "); |
2039 | info->debug(arg, write_only); | 2038 | info->debug(arg, write_only); |
@@ -2044,22 +2043,16 @@ static long __video_do_ioctl(struct file *file, | |||
2044 | const vidioc_op *vidioc = p + info->offset; | 2043 | const vidioc_op *vidioc = p + info->offset; |
2045 | 2044 | ||
2046 | ret = (*vidioc)(file, fh, arg); | 2045 | ret = (*vidioc)(file, fh, arg); |
2047 | goto done; | ||
2048 | } else if (info->flags & INFO_FL_FUNC) { | 2046 | } else if (info->flags & INFO_FL_FUNC) { |
2049 | ret = info->func(ops, file, fh, arg); | 2047 | ret = info->func(ops, file, fh, arg); |
2050 | goto done; | 2048 | } else if (!ops->vidioc_default) { |
2049 | ret = -ENOTTY; | ||
2050 | } else { | ||
2051 | ret = ops->vidioc_default(file, fh, | ||
2052 | use_fh_prio ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0, | ||
2053 | cmd, arg); | ||
2051 | } | 2054 | } |
2052 | 2055 | ||
2053 | switch (cmd) { | ||
2054 | default: | ||
2055 | if (!ops->vidioc_default) | ||
2056 | break; | ||
2057 | ret = ops->vidioc_default(file, fh, use_fh_prio ? | ||
2058 | v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0, | ||
2059 | cmd, arg); | ||
2060 | break; | ||
2061 | } /* switch */ | ||
2062 | |||
2063 | done: | 2056 | done: |
2064 | if (vfd->debug) { | 2057 | if (vfd->debug) { |
2065 | if (write_only && vfd->debug > V4L2_DEBUG_IOCTL) { | 2058 | if (write_only && vfd->debug > V4L2_DEBUG_IOCTL) { |
@@ -2073,8 +2066,6 @@ done: | |||
2073 | pr_cont(": error %ld\n", ret); | 2066 | pr_cont(": error %ld\n", ret); |
2074 | else if (vfd->debug == V4L2_DEBUG_IOCTL) | 2067 | else if (vfd->debug == V4L2_DEBUG_IOCTL) |
2075 | pr_cont("\n"); | 2068 | pr_cont("\n"); |
2076 | else if (!info->debug) | ||
2077 | return ret; | ||
2078 | else if (_IOC_DIR(cmd) == _IOC_NONE) | 2069 | else if (_IOC_DIR(cmd) == _IOC_NONE) |
2079 | info->debug(arg, write_only); | 2070 | info->debug(arg, write_only); |
2080 | else { | 2071 | else { |