Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Ramakrishnan Muthukrishnan <ramakrmu@cisco.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Ramakrishnan Muthukrishnan and committed by
Mauro Carvalho Chehab
b7284bb0 c41ad9c3

+14 -14
+2 -4
drivers/media/v4l2-core/v4l2-dev.c
··· 563 563 /* vfl_type and vfl_dir independent ioctls */ 564 564 565 565 SET_VALID_IOCTL(ops, VIDIOC_QUERYCAP, vidioc_querycap); 566 - if (ops->vidioc_g_priority || 567 - test_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags)) 566 + if (ops->vidioc_g_priority) 568 567 set_bit(_IOC_NR(VIDIOC_G_PRIORITY), valid_ioctls); 569 - if (ops->vidioc_s_priority || 570 - test_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags)) 568 + if (ops->vidioc_s_priority) 571 569 set_bit(_IOC_NR(VIDIOC_S_PRIORITY), valid_ioctls); 572 570 SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon); 573 571 SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff);
+9 -4
drivers/media/v4l2-core/v4l2-fh.c
··· 37 37 fh->ctrl_handler = vdev->ctrl_handler; 38 38 INIT_LIST_HEAD(&fh->list); 39 39 set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); 40 + /* 41 + * determine_valid_ioctls() does not know if struct v4l2_fh 42 + * is used by this driver, but here we do. So enable the 43 + * prio ioctls here. 44 + */ 45 + set_bit(_IOC_NR(VIDIOC_G_PRIORITY), vdev->valid_ioctls); 46 + set_bit(_IOC_NR(VIDIOC_S_PRIORITY), vdev->valid_ioctls); 40 47 fh->prio = V4L2_PRIORITY_UNSET; 41 48 init_waitqueue_head(&fh->wait); 42 49 INIT_LIST_HEAD(&fh->available); ··· 56 49 { 57 50 unsigned long flags; 58 51 59 - if (test_bit(V4L2_FL_USE_FH_PRIO, &fh->vdev->flags)) 60 - v4l2_prio_open(fh->vdev->prio, &fh->prio); 52 + v4l2_prio_open(fh->vdev->prio, &fh->prio); 61 53 spin_lock_irqsave(&fh->vdev->fh_lock, flags); 62 54 list_add(&fh->list, &fh->vdev->fh_list); 63 55 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); ··· 84 78 spin_lock_irqsave(&fh->vdev->fh_lock, flags); 85 79 list_del_init(&fh->list); 86 80 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); 87 - if (test_bit(V4L2_FL_USE_FH_PRIO, &fh->vdev->flags)) 88 - v4l2_prio_close(fh->vdev->prio, fh->prio); 81 + v4l2_prio_close(fh->vdev->prio, fh->prio); 89 82 } 90 83 EXPORT_SYMBOL_GPL(v4l2_fh_del); 91 84
+3 -6
drivers/media/v4l2-core/v4l2-ioctl.c
··· 2190 2190 const struct v4l2_ioctl_info *info; 2191 2191 void *fh = file->private_data; 2192 2192 struct v4l2_fh *vfh = NULL; 2193 - int use_fh_prio = 0; 2194 2193 int debug = vfd->debug; 2195 2194 long ret = -ENOTTY; 2196 2195 ··· 2199 2200 return ret; 2200 2201 } 2201 2202 2202 - if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { 2203 + if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) 2203 2204 vfh = file->private_data; 2204 - use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags); 2205 - } 2206 2205 2207 2206 if (v4l2_is_known_ioctl(cmd)) { 2208 2207 info = &v4l2_ioctls[_IOC_NR(cmd)]; ··· 2209 2212 !((info->flags & INFO_FL_CTRL) && vfh && vfh->ctrl_handler)) 2210 2213 goto done; 2211 2214 2212 - if (use_fh_prio && (info->flags & INFO_FL_PRIO)) { 2215 + if (vfh && (info->flags & INFO_FL_PRIO)) { 2213 2216 ret = v4l2_prio_check(vfd->prio, vfh->prio); 2214 2217 if (ret) 2215 2218 goto done; ··· 2234 2237 ret = -ENOTTY; 2235 2238 } else { 2236 2239 ret = ops->vidioc_default(file, fh, 2237 - use_fh_prio ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0, 2240 + vfh ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0, 2238 2241 cmd, arg); 2239 2242 } 2240 2243