Commit af136ceb authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Ben Hutchings

uvc: Forward compat ioctls to their handlers directly

commit a44323e2 upstream.

The current code goes through a lot of indirection just to call a
known handler.  Simplify it: just call the handlers directly.
Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
[bwh: Backported to 3.16: old code forwarded to uvc_v4l2_ioctl()]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 833d12b2
...@@ -1279,47 +1279,44 @@ static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp, ...@@ -1279,47 +1279,44 @@ static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
static long uvc_v4l2_compat_ioctl32(struct file *file, static long uvc_v4l2_compat_ioctl32(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct uvc_fh *handle = file->private_data;
union { union {
struct uvc_xu_control_mapping xmap; struct uvc_xu_control_mapping xmap;
struct uvc_xu_control_query xqry; struct uvc_xu_control_query xqry;
} karg; } karg;
void __user *up = compat_ptr(arg); void __user *up = compat_ptr(arg);
mm_segment_t old_fs;
long ret; long ret;
switch (cmd) { switch (cmd) {
case UVCIOC_CTRL_MAP32: case UVCIOC_CTRL_MAP32:
cmd = UVCIOC_CTRL_MAP;
ret = uvc_v4l2_get_xu_mapping(&karg.xmap, up); ret = uvc_v4l2_get_xu_mapping(&karg.xmap, up);
if (ret)
return ret;
ret = uvc_ioctl_ctrl_map(handle->chain, &karg.xmap);
if (ret)
return ret;
ret = uvc_v4l2_put_xu_mapping(&karg.xmap, up);
if (ret)
return ret;
break; break;
case UVCIOC_CTRL_QUERY32: case UVCIOC_CTRL_QUERY32:
cmd = UVCIOC_CTRL_QUERY;
ret = uvc_v4l2_get_xu_query(&karg.xqry, up); ret = uvc_v4l2_get_xu_query(&karg.xqry, up);
if (ret)
return ret;
ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry);
if (ret)
return ret;
ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
if (ret)
return ret;
break; break;
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = uvc_v4l2_ioctl(file, cmd, (unsigned long)&karg);
set_fs(old_fs);
if (ret < 0)
return ret;
switch (cmd) {
case UVCIOC_CTRL_MAP:
ret = uvc_v4l2_put_xu_mapping(&karg.xmap, up);
break;
case UVCIOC_CTRL_QUERY:
ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
break;
}
return ret; return ret;
} }
#endif #endif
......
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