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
494 handle = kzalloc(sizeof *handle, GFP_KERNEL); in uvc_v4l2_open()
495 if (handle == NULL) { in uvc_v4l2_open()
506 kfree(handle); in uvc_v4l2_open()
514 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
515 v4l2_fh_add(&handle->vfh); in uvc_v4l2_open()
516 handle->chain = stream->chain; in uvc_v4l2_open()
517 handle->stream = stream; in uvc_v4l2_open()
518 handle->state = UVC_HANDLE_PASSIVE; in uvc_v4l2_open()
519 file->private_data = handle; in uvc_v4l2_open()
526 struct uvc_fh *handle = file->private_data; in uvc_v4l2_release() local
527 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release()
532 if (uvc_has_privileges(handle)) in uvc_v4l2_release()
536 uvc_dismiss_privileges(handle); in uvc_v4l2_release()
537 v4l2_fh_del(&handle->vfh); in uvc_v4l2_release()
538 v4l2_fh_exit(&handle->vfh); in uvc_v4l2_release()
539 kfree(handle); in uvc_v4l2_release()
555 struct uvc_fh *handle = file->private_data; in uvc_ioctl_querycap() local
556 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querycap()
557 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap()
599 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_cap() local
600 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap()
608 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_out() local
609 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out()
617 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_cap() local
618 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap()
626 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_out() local
627 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out()
635 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_cap() local
636 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap()
639 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_cap()
649 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_out() local
650 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out()
653 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_out()
663 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_cap() local
664 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap()
673 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_out() local
674 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out()
683 struct uvc_fh *handle = fh; in uvc_ioctl_reqbufs() local
684 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs()
687 ret = uvc_acquire_privileges(handle); in uvc_ioctl_reqbufs()
698 uvc_dismiss_privileges(handle); in uvc_ioctl_reqbufs()
706 struct uvc_fh *handle = fh; in uvc_ioctl_querybuf() local
707 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf()
709 if (!uvc_has_privileges(handle)) in uvc_ioctl_querybuf()
717 struct uvc_fh *handle = fh; in uvc_ioctl_qbuf() local
718 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf()
720 if (!uvc_has_privileges(handle)) in uvc_ioctl_qbuf()
728 struct uvc_fh *handle = fh; in uvc_ioctl_dqbuf() local
729 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf()
731 if (!uvc_has_privileges(handle)) in uvc_ioctl_dqbuf()
741 struct uvc_fh *handle = fh; in uvc_ioctl_create_bufs() local
742 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs()
745 ret = uvc_acquire_privileges(handle); in uvc_ioctl_create_bufs()
755 struct uvc_fh *handle = fh; in uvc_ioctl_streamon() local
756 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon()
759 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamon()
772 struct uvc_fh *handle = fh; in uvc_ioctl_streamoff() local
773 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff()
775 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamoff()
788 struct uvc_fh *handle = fh; in uvc_ioctl_enum_input() local
789 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_enum_input()
828 struct uvc_fh *handle = fh; in uvc_ioctl_g_input() local
829 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_input()
851 struct uvc_fh *handle = fh; in uvc_ioctl_s_input() local
852 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_input()
856 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_input()
879 struct uvc_fh *handle = fh; in uvc_ioctl_queryctrl() local
880 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_queryctrl()
888 struct uvc_fh *handle = fh; in uvc_ioctl_query_ext_ctrl() local
889 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_query_ext_ctrl()
917 struct uvc_fh *handle = fh; in uvc_ioctl_g_ctrl() local
918 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ctrl()
930 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ctrl()
941 struct uvc_fh *handle = fh; in uvc_ioctl_s_ctrl() local
942 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_ctrl()
956 uvc_ctrl_rollback(handle); in uvc_ioctl_s_ctrl()
960 ret = uvc_ctrl_commit(handle, &xctrl, 1); in uvc_ioctl_s_ctrl()
971 struct uvc_fh *handle = fh; in uvc_ioctl_g_ext_ctrls() local
972 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ext_ctrls()
984 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
992 return uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
995 static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, in uvc_ioctl_s_try_ext_ctrls() argument
1000 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_try_ext_ctrls()
1011 uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1020 return uvc_ctrl_commit(handle, ctrls->controls, ctrls->count); in uvc_ioctl_s_try_ext_ctrls()
1022 return uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1028 struct uvc_fh *handle = fh; in uvc_ioctl_s_ext_ctrls() local
1030 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, true); in uvc_ioctl_s_ext_ctrls()
1036 struct uvc_fh *handle = fh; in uvc_ioctl_try_ext_ctrls() local
1038 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, false); in uvc_ioctl_try_ext_ctrls()
1044 struct uvc_fh *handle = fh; in uvc_ioctl_querymenu() local
1045 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querymenu()
1053 struct uvc_fh *handle = fh; in uvc_ioctl_g_selection() local
1054 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection()
1087 struct uvc_fh *handle = fh; in uvc_ioctl_g_parm() local
1088 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm()
1096 struct uvc_fh *handle = fh; in uvc_ioctl_s_parm() local
1097 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm()
1100 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_parm()
1110 struct uvc_fh *handle = fh; in uvc_ioctl_enum_framesizes() local
1111 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes()
1139 struct uvc_fh *handle = fh; in uvc_ioctl_enum_frameintervals() local
1140 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals()
1211 struct uvc_fh *handle = fh; in uvc_ioctl_default() local
1212 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_default()
1382 struct uvc_fh *handle = file->private_data; in uvc_v4l2_compat_ioctl32() local
1395 ret = uvc_ioctl_ctrl_map(handle->chain, &karg.xmap); in uvc_v4l2_compat_ioctl32()
1408 ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry); in uvc_v4l2_compat_ioctl32()
1433 struct uvc_fh *handle = file->private_data; in uvc_v4l2_mmap() local
1434 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap()
1443 struct uvc_fh *handle = file->private_data; in uvc_v4l2_poll() local
1444 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll()
1456 struct uvc_fh *handle = file->private_data; in uvc_v4l2_get_unmapped_area() local
1457 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area()