diff options
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx18/cx18-streams.c | 1 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-streams.c | 1 | ||||
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 8 | ||||
-rw-r--r-- | drivers/media/video/v4l2-fh.c | 7 | ||||
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 13 | ||||
-rw-r--r-- | drivers/media/video/vivi.c | 1 |
6 files changed, 18 insertions, 13 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 2d248560770..c6e2ca3b114 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c @@ -207,6 +207,7 @@ static int cx18_prep_dev(struct cx18 *cx, int type) s->video_dev->fops = &cx18_v4l2_enc_fops; s->video_dev->release = video_device_release; s->video_dev->tvnorms = V4L2_STD_ALL; + set_bit(V4L2_FL_USE_FH_PRIO, &s->video_dev->flags); cx18_set_funcs(s->video_dev); return 0; } diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 512607e0cda..94268333655 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -214,6 +214,7 @@ static int ivtv_prep_dev(struct ivtv *itv, int type) s->vdev->fops = ivtv_stream_info[type].fops; s->vdev->release = video_device_release; s->vdev->tvnorms = V4L2_STD_ALL; + set_bit(V4L2_FL_USE_FH_PRIO, &s->vdev->flags); ivtv_set_funcs(s->vdev); return 0; } diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 1898099ec65..498e6742579 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -578,11 +578,9 @@ int __video_register_device(struct video_device *vdev, int type, int nr, vdev->parent = vdev->v4l2_dev->dev; if (vdev->ctrl_handler == NULL) vdev->ctrl_handler = vdev->v4l2_dev->ctrl_handler; - /* If the prio state pointer is NULL, and if the driver doesn't - handle priorities itself, then use the v4l2_device prio - state. */ - if (vdev->prio == NULL && vdev->ioctl_ops && - vdev->ioctl_ops->vidioc_s_priority == NULL) + /* If the prio state pointer is NULL, then use the v4l2_device + prio state. */ + if (vdev->prio == NULL) vdev->prio = &vdev->v4l2_dev->prio; } diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c index 543b3fe6784..717f71e6370 100644 --- a/drivers/media/video/v4l2-fh.c +++ b/drivers/media/video/v4l2-fh.c @@ -35,7 +35,6 @@ int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) INIT_LIST_HEAD(&fh->list); set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); fh->prio = V4L2_PRIORITY_UNSET; - BUG_ON(vdev->prio == NULL); /* * fh->events only needs to be initialized if the driver @@ -54,7 +53,8 @@ void v4l2_fh_add(struct v4l2_fh *fh) { unsigned long flags; - v4l2_prio_open(fh->vdev->prio, &fh->prio); + if (test_bit(V4L2_FL_USE_FH_PRIO, &fh->vdev->flags)) + v4l2_prio_open(fh->vdev->prio, &fh->prio); spin_lock_irqsave(&fh->vdev->fh_lock, flags); list_add(&fh->list, &fh->vdev->fh_list); spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); @@ -82,7 +82,8 @@ void v4l2_fh_del(struct v4l2_fh *fh) spin_lock_irqsave(&fh->vdev->fh_lock, flags); list_del_init(&fh->list); spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); - v4l2_prio_close(fh->vdev->prio, fh->prio); + if (test_bit(V4L2_FL_USE_FH_PRIO, &fh->vdev->flags)) + v4l2_prio_close(fh->vdev->prio, fh->prio); } EXPORT_SYMBOL_GPL(v4l2_fh_del); diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 3e6b6fa5771..a01ed39e6c1 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -541,6 +541,7 @@ static long __video_do_ioctl(struct file *file, void *fh = file->private_data; struct v4l2_fh *vfh = NULL; struct v4l2_format f_copy; + int use_fh_prio = 0; long ret = -EINVAL; if (ops == NULL) { @@ -555,10 +556,12 @@ static long __video_do_ioctl(struct file *file, printk(KERN_CONT "\n"); } - if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) + if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { vfh = file->private_data; + use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags); + } - if (vfh && !ops->vidioc_s_priority) { + if (use_fh_prio) { switch (cmd) { case VIDIOC_S_CTRL: case VIDIOC_S_STD: @@ -620,7 +623,7 @@ static long __video_do_ioctl(struct file *file, if (ops->vidioc_g_priority) { ret = ops->vidioc_g_priority(file, fh, p); - } else if (vfh) { + } else if (use_fh_prio) { *p = v4l2_prio_max(&vfd->v4l2_dev->prio); ret = 0; } @@ -632,7 +635,7 @@ static long __video_do_ioctl(struct file *file, { enum v4l2_priority *p = arg; - if (!ops->vidioc_s_priority && vfh == NULL) + if (!ops->vidioc_s_priority && !use_fh_prio) break; dbgarg(cmd, "setting priority to %d\n", *p); if (ops->vidioc_s_priority) @@ -2187,7 +2190,7 @@ static long __video_do_ioctl(struct file *file, if (!ops->vidioc_default) break; - if (vfh && !ops->vidioc_s_priority) + if (use_fh_prio) valid_prio = v4l2_prio_check(vfd->prio, vfh->prio) >= 0; ret = ops->vidioc_default(file, fh, valid_prio, cmd, arg); break; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 42500bf03a9..2238a613d66 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -1254,6 +1254,7 @@ static int __init vivi_create_instance(int inst) *vfd = vivi_template; vfd->debug = debug; vfd->v4l2_dev = &dev->v4l2_dev; + set_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags); /* * Provide a mutex to v4l2 core. It will be used to protect |