diff options
Diffstat (limited to 'drivers/media/video/v4l2-fh.c')
-rw-r--r-- | drivers/media/video/v4l2-fh.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c index 717f71e6370e..122822d2b8b2 100644 --- a/drivers/media/video/v4l2-fh.c +++ b/drivers/media/video/v4l2-fh.c | |||
@@ -29,23 +29,18 @@ | |||
29 | #include <media/v4l2-event.h> | 29 | #include <media/v4l2-event.h> |
30 | #include <media/v4l2-ioctl.h> | 30 | #include <media/v4l2-ioctl.h> |
31 | 31 | ||
32 | int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) | 32 | void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) |
33 | { | 33 | { |
34 | fh->vdev = vdev; | 34 | fh->vdev = vdev; |
35 | /* Inherit from video_device. May be overridden by the driver. */ | ||
36 | fh->ctrl_handler = vdev->ctrl_handler; | ||
35 | INIT_LIST_HEAD(&fh->list); | 37 | INIT_LIST_HEAD(&fh->list); |
36 | set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); | 38 | set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); |
37 | fh->prio = V4L2_PRIORITY_UNSET; | 39 | fh->prio = V4L2_PRIORITY_UNSET; |
38 | 40 | init_waitqueue_head(&fh->wait); | |
39 | /* | 41 | INIT_LIST_HEAD(&fh->available); |
40 | * fh->events only needs to be initialized if the driver | 42 | INIT_LIST_HEAD(&fh->subscribed); |
41 | * supports the VIDIOC_SUBSCRIBE_EVENT ioctl. | 43 | fh->sequence = -1; |
42 | */ | ||
43 | if (vdev->ioctl_ops && vdev->ioctl_ops->vidioc_subscribe_event) | ||
44 | return v4l2_event_init(fh); | ||
45 | |||
46 | fh->events = NULL; | ||
47 | |||
48 | return 0; | ||
49 | } | 44 | } |
50 | EXPORT_SYMBOL_GPL(v4l2_fh_init); | 45 | EXPORT_SYMBOL_GPL(v4l2_fh_init); |
51 | 46 | ||
@@ -91,10 +86,8 @@ void v4l2_fh_exit(struct v4l2_fh *fh) | |||
91 | { | 86 | { |
92 | if (fh->vdev == NULL) | 87 | if (fh->vdev == NULL) |
93 | return; | 88 | return; |
94 | 89 | v4l2_event_unsubscribe_all(fh); | |
95 | fh->vdev = NULL; | 90 | fh->vdev = NULL; |
96 | |||
97 | v4l2_event_free(fh); | ||
98 | } | 91 | } |
99 | EXPORT_SYMBOL_GPL(v4l2_fh_exit); | 92 | EXPORT_SYMBOL_GPL(v4l2_fh_exit); |
100 | 93 | ||