Lines Matching refs:handle

444 static int uvc_acquire_privileges(struct uvc_fh *handle)  in uvc_acquire_privileges()  argument
447 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_acquire_privileges()
451 if (atomic_inc_return(&handle->stream->active) != 1) { in uvc_acquire_privileges()
452 atomic_dec(&handle->stream->active); in uvc_acquire_privileges()
456 handle->state = UVC_HANDLE_ACTIVE; in uvc_acquire_privileges()
460 static void uvc_dismiss_privileges(struct uvc_fh *handle) in uvc_dismiss_privileges() argument
462 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_dismiss_privileges()
463 atomic_dec(&handle->stream->active); in uvc_dismiss_privileges()
465 handle->state = UVC_HANDLE_PASSIVE; in uvc_dismiss_privileges()
468 static int uvc_has_privileges(struct uvc_fh *handle) in uvc_has_privileges() argument
470 return handle->state == UVC_HANDLE_ACTIVE; in uvc_has_privileges()
480 struct uvc_fh *handle; in uvc_v4l2_open() local
491 handle = kzalloc(sizeof *handle, GFP_KERNEL); in uvc_v4l2_open()
492 if (handle == NULL) { in uvc_v4l2_open()
503 kfree(handle); in uvc_v4l2_open()
511 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
512 v4l2_fh_add(&handle->vfh); in uvc_v4l2_open()
513 handle->chain = stream->chain; in uvc_v4l2_open()
514 handle->stream = stream; in uvc_v4l2_open()
515 handle->state = UVC_HANDLE_PASSIVE; in uvc_v4l2_open()
516 file->private_data = handle; in uvc_v4l2_open()
523 struct uvc_fh *handle = file->private_data; in uvc_v4l2_release() local
524 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release()
529 if (uvc_has_privileges(handle)) in uvc_v4l2_release()
533 uvc_dismiss_privileges(handle); in uvc_v4l2_release()
534 v4l2_fh_del(&handle->vfh); in uvc_v4l2_release()
535 v4l2_fh_exit(&handle->vfh); in uvc_v4l2_release()
536 kfree(handle); in uvc_v4l2_release()
552 struct uvc_fh *handle = file->private_data; in uvc_ioctl_querycap() local
553 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querycap()
554 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap()
596 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_cap() local
597 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap()
605 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_out() local
606 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out()
614 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_cap() local
615 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap()
623 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_out() local
624 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out()
632 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_cap() local
633 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap()
636 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_cap()
646 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_out() local
647 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out()
650 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_out()
660 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_cap() local
661 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap()
670 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_out() local
671 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out()
680 struct uvc_fh *handle = fh; in uvc_ioctl_reqbufs() local
681 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs()
684 ret = uvc_acquire_privileges(handle); in uvc_ioctl_reqbufs()
695 uvc_dismiss_privileges(handle); in uvc_ioctl_reqbufs()
703 struct uvc_fh *handle = fh; in uvc_ioctl_querybuf() local
704 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf()
706 if (!uvc_has_privileges(handle)) in uvc_ioctl_querybuf()
714 struct uvc_fh *handle = fh; in uvc_ioctl_qbuf() local
715 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf()
717 if (!uvc_has_privileges(handle)) in uvc_ioctl_qbuf()
726 struct uvc_fh *handle = fh; in uvc_ioctl_expbuf() local
727 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_expbuf()
729 if (!uvc_has_privileges(handle)) in uvc_ioctl_expbuf()
737 struct uvc_fh *handle = fh; in uvc_ioctl_dqbuf() local
738 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf()
740 if (!uvc_has_privileges(handle)) in uvc_ioctl_dqbuf()
750 struct uvc_fh *handle = fh; in uvc_ioctl_create_bufs() local
751 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs()
754 ret = uvc_acquire_privileges(handle); in uvc_ioctl_create_bufs()
764 struct uvc_fh *handle = fh; in uvc_ioctl_streamon() local
765 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon()
768 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamon()
781 struct uvc_fh *handle = fh; in uvc_ioctl_streamoff() local
782 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff()
784 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamoff()
797 struct uvc_fh *handle = fh; in uvc_ioctl_enum_input() local
798 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_enum_input()
837 struct uvc_fh *handle = fh; in uvc_ioctl_g_input() local
838 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_input()
860 struct uvc_fh *handle = fh; in uvc_ioctl_s_input() local
861 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_input()
865 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_input()
888 struct uvc_fh *handle = fh; in uvc_ioctl_queryctrl() local
889 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_queryctrl()
897 struct uvc_fh *handle = fh; in uvc_ioctl_query_ext_ctrl() local
898 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_query_ext_ctrl()
926 struct uvc_fh *handle = fh; in uvc_ioctl_g_ctrl() local
927 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ctrl()
939 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ctrl()
950 struct uvc_fh *handle = fh; in uvc_ioctl_s_ctrl() local
951 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_ctrl()
965 uvc_ctrl_rollback(handle); in uvc_ioctl_s_ctrl()
969 ret = uvc_ctrl_commit(handle, &xctrl, 1); in uvc_ioctl_s_ctrl()
980 struct uvc_fh *handle = fh; in uvc_ioctl_g_ext_ctrls() local
981 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ext_ctrls()
993 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1001 return uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1004 static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, in uvc_ioctl_s_try_ext_ctrls() argument
1009 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_try_ext_ctrls()
1020 uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1029 return uvc_ctrl_commit(handle, ctrls->controls, ctrls->count); in uvc_ioctl_s_try_ext_ctrls()
1031 return uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1037 struct uvc_fh *handle = fh; in uvc_ioctl_s_ext_ctrls() local
1039 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, true); in uvc_ioctl_s_ext_ctrls()
1045 struct uvc_fh *handle = fh; in uvc_ioctl_try_ext_ctrls() local
1047 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, false); in uvc_ioctl_try_ext_ctrls()
1053 struct uvc_fh *handle = fh; in uvc_ioctl_querymenu() local
1054 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querymenu()
1062 struct uvc_fh *handle = fh; in uvc_ioctl_g_selection() local
1063 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection()
1096 struct uvc_fh *handle = fh; in uvc_ioctl_g_parm() local
1097 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm()
1105 struct uvc_fh *handle = fh; in uvc_ioctl_s_parm() local
1106 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm()
1109 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_parm()
1119 struct uvc_fh *handle = fh; in uvc_ioctl_enum_framesizes() local
1120 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes()
1148 struct uvc_fh *handle = fh; in uvc_ioctl_enum_frameintervals() local
1149 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals()
1220 struct uvc_fh *handle = fh; in uvc_ioctl_default() local
1221 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_default()
1445 struct uvc_fh *handle = file->private_data; in uvc_v4l2_mmap() local
1446 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap()
1455 struct uvc_fh *handle = file->private_data; in uvc_v4l2_poll() local
1456 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll()
1468 struct uvc_fh *handle = file->private_data; in uvc_v4l2_get_unmapped_area() local
1469 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area()