Commit b7284bb0 authored by Ramakrishnan Muthukrishnan's avatar Ramakrishnan Muthukrishnan Committed by Mauro Carvalho Chehab

[media] media: v4l2-core: remove the use of V4L2_FL_USE_FH_PRIO flag

Since all the drivers that use `struct v4l2_fh' use the core priority
checking instead of doing it themselves, this flag can be removed.

This patch removes the usage of the flag from v4l2-core.
Signed-off-by: default avatarRamakrishnan Muthukrishnan <ramakrmu@cisco.com>
Reviewed-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent c41ad9c3
...@@ -563,11 +563,9 @@ static void determine_valid_ioctls(struct video_device *vdev) ...@@ -563,11 +563,9 @@ static void determine_valid_ioctls(struct video_device *vdev)
/* vfl_type and vfl_dir independent ioctls */ /* vfl_type and vfl_dir independent ioctls */
SET_VALID_IOCTL(ops, VIDIOC_QUERYCAP, vidioc_querycap); SET_VALID_IOCTL(ops, VIDIOC_QUERYCAP, vidioc_querycap);
if (ops->vidioc_g_priority || if (ops->vidioc_g_priority)
test_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags))
set_bit(_IOC_NR(VIDIOC_G_PRIORITY), valid_ioctls); set_bit(_IOC_NR(VIDIOC_G_PRIORITY), valid_ioctls);
if (ops->vidioc_s_priority || if (ops->vidioc_s_priority)
test_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags))
set_bit(_IOC_NR(VIDIOC_S_PRIORITY), valid_ioctls); set_bit(_IOC_NR(VIDIOC_S_PRIORITY), valid_ioctls);
SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon); SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon);
SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff); SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff);
......
...@@ -37,6 +37,13 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) ...@@ -37,6 +37,13 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
fh->ctrl_handler = vdev->ctrl_handler; fh->ctrl_handler = vdev->ctrl_handler;
INIT_LIST_HEAD(&fh->list); INIT_LIST_HEAD(&fh->list);
set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags);
/*
* determine_valid_ioctls() does not know if struct v4l2_fh
* is used by this driver, but here we do. So enable the
* prio ioctls here.
*/
set_bit(_IOC_NR(VIDIOC_G_PRIORITY), vdev->valid_ioctls);
set_bit(_IOC_NR(VIDIOC_S_PRIORITY), vdev->valid_ioctls);
fh->prio = V4L2_PRIORITY_UNSET; fh->prio = V4L2_PRIORITY_UNSET;
init_waitqueue_head(&fh->wait); init_waitqueue_head(&fh->wait);
INIT_LIST_HEAD(&fh->available); INIT_LIST_HEAD(&fh->available);
...@@ -49,7 +56,6 @@ void v4l2_fh_add(struct v4l2_fh *fh) ...@@ -49,7 +56,6 @@ void v4l2_fh_add(struct v4l2_fh *fh)
{ {
unsigned long flags; unsigned long flags;
if (test_bit(V4L2_FL_USE_FH_PRIO, &fh->vdev->flags))
v4l2_prio_open(fh->vdev->prio, &fh->prio); v4l2_prio_open(fh->vdev->prio, &fh->prio);
spin_lock_irqsave(&fh->vdev->fh_lock, flags); spin_lock_irqsave(&fh->vdev->fh_lock, flags);
list_add(&fh->list, &fh->vdev->fh_list); list_add(&fh->list, &fh->vdev->fh_list);
...@@ -78,7 +84,6 @@ void v4l2_fh_del(struct v4l2_fh *fh) ...@@ -78,7 +84,6 @@ void v4l2_fh_del(struct v4l2_fh *fh)
spin_lock_irqsave(&fh->vdev->fh_lock, flags); spin_lock_irqsave(&fh->vdev->fh_lock, flags);
list_del_init(&fh->list); list_del_init(&fh->list);
spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
if (test_bit(V4L2_FL_USE_FH_PRIO, &fh->vdev->flags))
v4l2_prio_close(fh->vdev->prio, fh->prio); v4l2_prio_close(fh->vdev->prio, fh->prio);
} }
EXPORT_SYMBOL_GPL(v4l2_fh_del); EXPORT_SYMBOL_GPL(v4l2_fh_del);
......
...@@ -2190,7 +2190,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -2190,7 +2190,6 @@ static long __video_do_ioctl(struct file *file,
const struct v4l2_ioctl_info *info; const struct v4l2_ioctl_info *info;
void *fh = file->private_data; void *fh = file->private_data;
struct v4l2_fh *vfh = NULL; struct v4l2_fh *vfh = NULL;
int use_fh_prio = 0;
int debug = vfd->debug; int debug = vfd->debug;
long ret = -ENOTTY; long ret = -ENOTTY;
...@@ -2200,10 +2199,8 @@ static long __video_do_ioctl(struct file *file, ...@@ -2200,10 +2199,8 @@ static long __video_do_ioctl(struct file *file,
return ret; return ret;
} }
if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags))
vfh = file->private_data; vfh = file->private_data;
use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
}
if (v4l2_is_known_ioctl(cmd)) { if (v4l2_is_known_ioctl(cmd)) {
info = &v4l2_ioctls[_IOC_NR(cmd)]; info = &v4l2_ioctls[_IOC_NR(cmd)];
...@@ -2212,7 +2209,7 @@ static long __video_do_ioctl(struct file *file, ...@@ -2212,7 +2209,7 @@ static long __video_do_ioctl(struct file *file,
!((info->flags & INFO_FL_CTRL) && vfh && vfh->ctrl_handler)) !((info->flags & INFO_FL_CTRL) && vfh && vfh->ctrl_handler))
goto done; goto done;
if (use_fh_prio && (info->flags & INFO_FL_PRIO)) { if (vfh && (info->flags & INFO_FL_PRIO)) {
ret = v4l2_prio_check(vfd->prio, vfh->prio); ret = v4l2_prio_check(vfd->prio, vfh->prio);
if (ret) if (ret)
goto done; goto done;
...@@ -2237,7 +2234,7 @@ static long __video_do_ioctl(struct file *file, ...@@ -2237,7 +2234,7 @@ static long __video_do_ioctl(struct file *file,
ret = -ENOTTY; ret = -ENOTTY;
} else { } else {
ret = ops->vidioc_default(file, fh, ret = ops->vidioc_default(file, fh,
use_fh_prio ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0, vfh ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0,
cmd, arg); cmd, arg);
} }
......
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