mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
media: v4l2-ioctl: Access v4l2_fh from private_data
Now that it is guaranteed that file->private_data is set to point to the
'struct v4l2_fh' initialised by v4l2_fh_add() the v4l2-ioctl layer can
be modified to retrieve the v4l2_fh pointer from the file *.
As the __video_do_ioctl() function, that calls all the handlers modified
by this patch goes as:
static long __video_do_ioctl(struct file *file,
unsigned int cmd, void *arg)
{
void *fh = file->private_data;
...
ret = info->func(ops, file, fh, arg);
}
This patch introduces no functional changes and makes it possible to
remove in future the 'fh' argument to all ioctl handlers.
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
6b79b21e7d
commit
ae76d82230
|
|
@ -2295,7 +2295,7 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops,
|
|||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_query_ext_ctrl qec = {};
|
||||
struct v4l2_queryctrl *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
int ret;
|
||||
|
||||
if (vfh && vfh->ctrl_handler)
|
||||
|
|
@ -2319,7 +2319,7 @@ static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops,
|
|||
{
|
||||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_query_ext_ctrl *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
if (vfh && vfh->ctrl_handler)
|
||||
return v4l2_query_ext_ctrl(vfh->ctrl_handler, p);
|
||||
|
|
@ -2335,7 +2335,7 @@ static int v4l_querymenu(const struct v4l2_ioctl_ops *ops,
|
|||
{
|
||||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_querymenu *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
if (vfh && vfh->ctrl_handler)
|
||||
return v4l2_querymenu(vfh->ctrl_handler, p);
|
||||
|
|
@ -2351,7 +2351,7 @@ static int v4l_g_ctrl(const struct v4l2_ioctl_ops *ops,
|
|||
{
|
||||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_control *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
struct v4l2_ext_controls ctrls;
|
||||
struct v4l2_ext_control ctrl;
|
||||
|
||||
|
|
@ -2382,7 +2382,7 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops,
|
|||
{
|
||||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_control *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
struct v4l2_ext_controls ctrls;
|
||||
struct v4l2_ext_control ctrl;
|
||||
int ret;
|
||||
|
|
@ -2411,7 +2411,7 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops *ops,
|
|||
{
|
||||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_ext_controls *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
p->error_idx = p->count;
|
||||
if (vfh && vfh->ctrl_handler)
|
||||
|
|
@ -2431,7 +2431,7 @@ static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops,
|
|||
{
|
||||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_ext_controls *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
p->error_idx = p->count;
|
||||
if (vfh && vfh->ctrl_handler)
|
||||
|
|
@ -2451,7 +2451,7 @@ static int v4l_try_ext_ctrls(const struct v4l2_ioctl_ops *ops,
|
|||
{
|
||||
struct video_device *vfd = video_devdata(file);
|
||||
struct v4l2_ext_controls *p = arg;
|
||||
struct v4l2_fh *vfh = fh;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
p->error_idx = p->count;
|
||||
if (vfh && vfh->ctrl_handler)
|
||||
|
|
@ -2746,19 +2746,25 @@ static int v4l_dbg_g_chip_info(const struct v4l2_ioctl_ops *ops,
|
|||
static int v4l_dqevent(const struct v4l2_ioctl_ops *ops,
|
||||
struct file *file, void *fh, void *arg)
|
||||
{
|
||||
return v4l2_event_dequeue(fh, arg, file->f_flags & O_NONBLOCK);
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
return v4l2_event_dequeue(vfh, arg, file->f_flags & O_NONBLOCK);
|
||||
}
|
||||
|
||||
static int v4l_subscribe_event(const struct v4l2_ioctl_ops *ops,
|
||||
struct file *file, void *fh, void *arg)
|
||||
{
|
||||
return ops->vidioc_subscribe_event(fh, arg);
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
return ops->vidioc_subscribe_event(vfh, arg);
|
||||
}
|
||||
|
||||
static int v4l_unsubscribe_event(const struct v4l2_ioctl_ops *ops,
|
||||
struct file *file, void *fh, void *arg)
|
||||
{
|
||||
return ops->vidioc_unsubscribe_event(fh, arg);
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
|
||||
return ops->vidioc_unsubscribe_event(vfh, arg);
|
||||
}
|
||||
|
||||
static int v4l_g_sliced_vbi_cap(const struct v4l2_ioctl_ops *ops,
|
||||
|
|
@ -3062,7 +3068,6 @@ static long __video_do_ioctl(struct file *file,
|
|||
bool write_only = false;
|
||||
struct v4l2_ioctl_info default_info;
|
||||
const struct v4l2_ioctl_info *info;
|
||||
void *fh = file->private_data;
|
||||
struct v4l2_fh *vfh = file_to_v4l2_fh(file);
|
||||
int dev_debug = vfd->dev_debug;
|
||||
long ret = -ENOTTY;
|
||||
|
|
@ -3121,11 +3126,11 @@ static long __video_do_ioctl(struct file *file,
|
|||
|
||||
write_only = _IOC_DIR(cmd) == _IOC_WRITE;
|
||||
if (info != &default_info) {
|
||||
ret = info->func(ops, file, fh, arg);
|
||||
ret = info->func(ops, file, vfh, arg);
|
||||
} else if (!ops->vidioc_default) {
|
||||
ret = -ENOTTY;
|
||||
} else {
|
||||
ret = ops->vidioc_default(file, fh,
|
||||
ret = ops->vidioc_default(file, vfh,
|
||||
v4l2_prio_check(vfd->prio, vfh->prio) >= 0,
|
||||
cmd, arg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user