Lines Matching refs:fh
21 void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) in v4l2_fh_init() argument
23 fh->vdev = vdev; in v4l2_fh_init()
25 fh->ctrl_handler = vdev->ctrl_handler; in v4l2_fh_init()
26 INIT_LIST_HEAD(&fh->list); in v4l2_fh_init()
27 set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags); in v4l2_fh_init()
35 fh->prio = V4L2_PRIORITY_UNSET; in v4l2_fh_init()
36 init_waitqueue_head(&fh->wait); in v4l2_fh_init()
37 INIT_LIST_HEAD(&fh->available); in v4l2_fh_init()
38 INIT_LIST_HEAD(&fh->subscribed); in v4l2_fh_init()
39 fh->sequence = -1; in v4l2_fh_init()
40 mutex_init(&fh->subscribe_lock); in v4l2_fh_init()
44 void v4l2_fh_add(struct v4l2_fh *fh) in v4l2_fh_add() argument
48 v4l2_prio_open(fh->vdev->prio, &fh->prio); in v4l2_fh_add()
49 spin_lock_irqsave(&fh->vdev->fh_lock, flags); in v4l2_fh_add()
50 list_add(&fh->list, &fh->vdev->fh_list); in v4l2_fh_add()
51 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); in v4l2_fh_add()
58 struct v4l2_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL); in v4l2_fh_open() local
60 filp->private_data = fh; in v4l2_fh_open()
61 if (fh == NULL) in v4l2_fh_open()
63 v4l2_fh_init(fh, vdev); in v4l2_fh_open()
64 v4l2_fh_add(fh); in v4l2_fh_open()
69 void v4l2_fh_del(struct v4l2_fh *fh) in v4l2_fh_del() argument
73 spin_lock_irqsave(&fh->vdev->fh_lock, flags); in v4l2_fh_del()
74 list_del_init(&fh->list); in v4l2_fh_del()
75 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); in v4l2_fh_del()
76 v4l2_prio_close(fh->vdev->prio, fh->prio); in v4l2_fh_del()
80 void v4l2_fh_exit(struct v4l2_fh *fh) in v4l2_fh_exit() argument
82 if (fh->vdev == NULL) in v4l2_fh_exit()
84 v4l_disable_media_source(fh->vdev); in v4l2_fh_exit()
85 v4l2_event_unsubscribe_all(fh); in v4l2_fh_exit()
86 mutex_destroy(&fh->subscribe_lock); in v4l2_fh_exit()
87 fh->vdev = NULL; in v4l2_fh_exit()
93 struct v4l2_fh *fh = filp->private_data; in v4l2_fh_release() local
95 if (fh) { in v4l2_fh_release()
96 v4l2_fh_del(fh); in v4l2_fh_release()
97 v4l2_fh_exit(fh); in v4l2_fh_release()
98 kfree(fh); in v4l2_fh_release()
105 int v4l2_fh_is_singular(struct v4l2_fh *fh) in v4l2_fh_is_singular() argument
110 if (fh == NULL || fh->vdev == NULL) in v4l2_fh_is_singular()
112 spin_lock_irqsave(&fh->vdev->fh_lock, flags); in v4l2_fh_is_singular()
113 is_singular = list_is_singular(&fh->list); in v4l2_fh_is_singular()
114 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); in v4l2_fh_is_singular()