Lines Matching refs:handle
521 static int uvc_acquire_privileges(struct uvc_fh *handle) in uvc_acquire_privileges() argument
524 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_acquire_privileges()
528 if (atomic_inc_return(&handle->stream->active) != 1) { in uvc_acquire_privileges()
529 atomic_dec(&handle->stream->active); in uvc_acquire_privileges()
533 handle->state = UVC_HANDLE_ACTIVE; in uvc_acquire_privileges()
537 static void uvc_dismiss_privileges(struct uvc_fh *handle) in uvc_dismiss_privileges() argument
539 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_dismiss_privileges()
540 atomic_dec(&handle->stream->active); in uvc_dismiss_privileges()
542 handle->state = UVC_HANDLE_PASSIVE; in uvc_dismiss_privileges()
545 static int uvc_has_privileges(struct uvc_fh *handle) in uvc_has_privileges() argument
547 return handle->state == UVC_HANDLE_ACTIVE; in uvc_has_privileges()
557 struct uvc_fh *handle; in uvc_v4l2_open() local
568 handle = kzalloc(sizeof(*handle), GFP_KERNEL); in uvc_v4l2_open()
569 if (handle == NULL) { in uvc_v4l2_open()
580 kfree(handle); in uvc_v4l2_open()
588 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
589 v4l2_fh_add(&handle->vfh); in uvc_v4l2_open()
590 handle->chain = stream->chain; in uvc_v4l2_open()
591 handle->stream = stream; in uvc_v4l2_open()
592 handle->state = UVC_HANDLE_PASSIVE; in uvc_v4l2_open()
593 file->private_data = handle; in uvc_v4l2_open()
600 struct uvc_fh *handle = file->private_data; in uvc_v4l2_release() local
601 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release()
606 if (uvc_has_privileges(handle)) in uvc_v4l2_release()
610 uvc_dismiss_privileges(handle); in uvc_v4l2_release()
611 v4l2_fh_del(&handle->vfh); in uvc_v4l2_release()
612 v4l2_fh_exit(&handle->vfh); in uvc_v4l2_release()
613 kfree(handle); in uvc_v4l2_release()
629 struct uvc_fh *handle = file->private_data; in uvc_ioctl_querycap() local
630 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querycap()
631 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap()
667 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_cap() local
668 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap()
676 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_out() local
677 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out()
685 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_cap() local
686 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap()
694 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_out() local
695 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out()
703 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_cap() local
704 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap()
707 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_cap()
717 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_out() local
718 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out()
721 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_out()
731 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_cap() local
732 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap()
741 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_out() local
742 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out()
751 struct uvc_fh *handle = fh; in uvc_ioctl_reqbufs() local
752 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs()
755 ret = uvc_acquire_privileges(handle); in uvc_ioctl_reqbufs()
766 uvc_dismiss_privileges(handle); in uvc_ioctl_reqbufs()
774 struct uvc_fh *handle = fh; in uvc_ioctl_querybuf() local
775 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf()
777 if (!uvc_has_privileges(handle)) in uvc_ioctl_querybuf()
785 struct uvc_fh *handle = fh; in uvc_ioctl_qbuf() local
786 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf()
788 if (!uvc_has_privileges(handle)) in uvc_ioctl_qbuf()
798 struct uvc_fh *handle = fh; in uvc_ioctl_expbuf() local
799 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_expbuf()
801 if (!uvc_has_privileges(handle)) in uvc_ioctl_expbuf()
809 struct uvc_fh *handle = fh; in uvc_ioctl_dqbuf() local
810 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf()
812 if (!uvc_has_privileges(handle)) in uvc_ioctl_dqbuf()
822 struct uvc_fh *handle = fh; in uvc_ioctl_create_bufs() local
823 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs()
826 ret = uvc_acquire_privileges(handle); in uvc_ioctl_create_bufs()
836 struct uvc_fh *handle = fh; in uvc_ioctl_streamon() local
837 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon()
840 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamon()
853 struct uvc_fh *handle = fh; in uvc_ioctl_streamoff() local
854 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff()
856 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamoff()
869 struct uvc_fh *handle = fh; in uvc_ioctl_enum_input() local
870 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_enum_input()
911 struct uvc_fh *handle = fh; in uvc_ioctl_g_input() local
912 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_input()
939 struct uvc_fh *handle = fh; in uvc_ioctl_s_input() local
940 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_input()
944 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_input()
974 struct uvc_fh *handle = fh; in uvc_ioctl_queryctrl() local
975 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_queryctrl()
983 struct uvc_fh *handle = fh; in uvc_ioctl_query_ext_ctrl() local
984 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_query_ext_ctrl()
1031 struct uvc_fh *handle = fh; in uvc_ioctl_g_ext_ctrls() local
1032 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ext_ctrls()
1064 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1072 return uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1075 static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, in uvc_ioctl_s_try_ext_ctrls() argument
1080 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_try_ext_ctrls()
1093 ret = uvc_ctrl_set(handle, ctrl); in uvc_ioctl_s_try_ext_ctrls()
1095 uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1105 return uvc_ctrl_commit(handle, ctrls->controls, ctrls->count); in uvc_ioctl_s_try_ext_ctrls()
1107 return uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1113 struct uvc_fh *handle = fh; in uvc_ioctl_s_ext_ctrls() local
1115 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_S_EXT_CTRLS); in uvc_ioctl_s_ext_ctrls()
1121 struct uvc_fh *handle = fh; in uvc_ioctl_try_ext_ctrls() local
1123 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_TRY_EXT_CTRLS); in uvc_ioctl_try_ext_ctrls()
1129 struct uvc_fh *handle = fh; in uvc_ioctl_querymenu() local
1130 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querymenu()
1138 struct uvc_fh *handle = fh; in uvc_ioctl_g_selection() local
1139 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection()
1172 struct uvc_fh *handle = fh; in uvc_ioctl_g_parm() local
1173 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm()
1181 struct uvc_fh *handle = fh; in uvc_ioctl_s_parm() local
1182 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm()
1185 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_parm()
1195 struct uvc_fh *handle = fh; in uvc_ioctl_enum_framesizes() local
1196 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes()
1235 struct uvc_fh *handle = fh; in uvc_ioctl_enum_frameintervals() local
1236 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals()
1307 struct uvc_fh *handle = fh; in uvc_ioctl_default() local
1308 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_default()
1413 struct uvc_fh *handle = file->private_data; in uvc_v4l2_compat_ioctl32() local
1426 ret = uvc_ioctl_ctrl_map(handle->chain, &karg.xmap); in uvc_v4l2_compat_ioctl32()
1439 ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry); in uvc_v4l2_compat_ioctl32()
1458 struct uvc_fh *handle = file->private_data; in uvc_v4l2_read() local
1459 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_read()
1467 struct uvc_fh *handle = file->private_data; in uvc_v4l2_mmap() local
1468 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap()
1477 struct uvc_fh *handle = file->private_data; in uvc_v4l2_poll() local
1478 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll()
1490 struct uvc_fh *handle = file->private_data; in uvc_v4l2_get_unmapped_area() local
1491 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area()