Commit f18d8e07 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 458aa4a6
...@@ -855,6 +855,11 @@ static void v4l_print_newline(const void *arg, bool write_only) ...@@ -855,6 +855,11 @@ static void v4l_print_newline(const void *arg, bool write_only)
pr_cont("\n"); pr_cont("\n");
} }
static void v4l_print_default(const void *arg, bool write_only)
{
pr_cont("driver-specific ioctl\n");
}
static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
{ {
__u32 i; __u32 i;
...@@ -1839,12 +1844,6 @@ struct v4l2_ioctl_info { ...@@ -1839,12 +1844,6 @@ struct v4l2_ioctl_info {
sizeof(((struct v4l2_struct *)0)->field)) << 16) sizeof(((struct v4l2_struct *)0)->field)) << 16)
#define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16) #define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16)
#define IOCTL_INFO(_ioctl, _flags) [_IOC_NR(_ioctl)] = { \
.ioctl = _ioctl, \
.flags = _flags, \
.name = #_ioctl, \
}
#define IOCTL_INFO_STD(_ioctl, _vidioc, _debug, _flags) \ #define IOCTL_INFO_STD(_ioctl, _vidioc, _debug, _flags) \
[_IOC_NR(_ioctl)] = { \ [_IOC_NR(_ioctl)] = { \
.ioctl = _ioctl, \ .ioctl = _ioctl, \
...@@ -2028,12 +2027,12 @@ static long __video_do_ioctl(struct file *file, ...@@ -2028,12 +2027,12 @@ static long __video_do_ioctl(struct file *file,
} else { } else {
default_info.ioctl = cmd; default_info.ioctl = cmd;
default_info.flags = 0; default_info.flags = 0;
default_info.debug = NULL; default_info.debug = v4l_print_default;
info = &default_info; info = &default_info;
} }
write_only = _IOC_DIR(cmd) == _IOC_WRITE; write_only = _IOC_DIR(cmd) == _IOC_WRITE;
if (info->debug && write_only && vfd->debug > V4L2_DEBUG_IOCTL) { if (write_only && vfd->debug > V4L2_DEBUG_IOCTL) {
v4l_print_ioctl(vfd->name, cmd); v4l_print_ioctl(vfd->name, cmd);
pr_cont(": "); pr_cont(": ");
info->debug(arg, write_only); info->debug(arg, write_only);
...@@ -2044,21 +2043,15 @@ static long __video_do_ioctl(struct file *file, ...@@ -2044,21 +2043,15 @@ static long __video_do_ioctl(struct file *file,
const vidioc_op *vidioc = p + info->offset; const vidioc_op *vidioc = p + info->offset;
ret = (*vidioc)(file, fh, arg); ret = (*vidioc)(file, fh, arg);
goto done;
} else if (info->flags & INFO_FL_FUNC) { } else if (info->flags & INFO_FL_FUNC) {
ret = info->func(ops, file, fh, arg); ret = info->func(ops, file, fh, arg);
goto done; } else if (!ops->vidioc_default) {
} ret = -ENOTTY;
} else {
switch (cmd) { ret = ops->vidioc_default(file, fh,
default: use_fh_prio ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0,
if (!ops->vidioc_default)
break;
ret = ops->vidioc_default(file, fh, use_fh_prio ?
v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0,
cmd, arg); cmd, arg);
break; }
} /* switch */
done: done:
if (vfd->debug) { if (vfd->debug) {
...@@ -2073,8 +2066,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -2073,8 +2066,6 @@ static long __video_do_ioctl(struct file *file,
pr_cont(": error %ld\n", ret); pr_cont(": error %ld\n", ret);
else if (vfd->debug == V4L2_DEBUG_IOCTL) else if (vfd->debug == V4L2_DEBUG_IOCTL)
pr_cont("\n"); pr_cont("\n");
else if (!info->debug)
return ret;
else if (_IOC_DIR(cmd) == _IOC_NONE) else if (_IOC_DIR(cmd) == _IOC_NONE)
info->debug(arg, write_only); info->debug(arg, write_only);
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment