@@ -157,31 +157,31 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
struct v4l2_fh *vfh = file->private_data;
-#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
struct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);
-#endif
+ struct v4l2_ctrl_handler *ctrl_handler = subdev_fh->ctrl_handler
+ ? subdev_fh->ctrl_handler : sd->ctrl_handler;
switch (cmd) {
case VIDIOC_QUERYCTRL:
- return v4l2_subdev_queryctrl(sd, arg);
+ return v4l2_queryctrl(ctrl_handler, arg);
case VIDIOC_QUERYMENU:
- return v4l2_subdev_querymenu(sd, arg);
+ return v4l2_querymenu(ctrl_handler, arg);
case VIDIOC_G_CTRL:
- return v4l2_subdev_g_ctrl(sd, arg);
+ return v4l2_g_ctrl(ctrl_handler, arg);
case VIDIOC_S_CTRL:
- return v4l2_subdev_s_ctrl(sd, arg);
+ return v4l2_s_ctrl(ctrl_handler, arg);
case VIDIOC_G_EXT_CTRLS:
- return v4l2_subdev_g_ext_ctrls(sd, arg);
+ return v4l2_g_ext_ctrls(ctrl_handler, arg);
case VIDIOC_S_EXT_CTRLS:
- return v4l2_subdev_s_ext_ctrls(sd, arg);
+ return v4l2_s_ext_ctrls(ctrl_handler, arg);
case VIDIOC_TRY_EXT_CTRLS:
- return v4l2_subdev_try_ext_ctrls(sd, arg);
+ return v4l2_try_ext_ctrls(ctrl_handler, arg);
case VIDIOC_DQEVENT:
if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
@@ -469,8 +469,8 @@ struct v4l2_subdev_ops {
struct v4l2_subdev_internal_ops {
int (*registered)(struct v4l2_subdev *sd);
void (*unregistered)(struct v4l2_subdev *sd);
- int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
- int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
+ int (*open)(struct v4l2_subdev *sd, struct file *file);
+ int (*close)(struct v4l2_subdev *sd, struct file *file);
};
#define V4L2_SUBDEV_NAME_SIZE 32
@@ -527,6 +527,7 @@ struct v4l2_subdev_fh {
struct v4l2_mbus_framefmt *try_fmt;
struct v4l2_rect *try_crop;
#endif
+ struct v4l2_ctrl_handler *ctrl_handler;
};
#define to_v4l2_subdev_fh(fh) \