Lines Matching refs:handle

519 static int uvc_acquire_privileges(struct uvc_fh *handle)  in uvc_acquire_privileges()  argument
522 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_acquire_privileges()
526 if (atomic_inc_return(&handle->stream->active) != 1) { in uvc_acquire_privileges()
527 atomic_dec(&handle->stream->active); in uvc_acquire_privileges()
531 handle->state = UVC_HANDLE_ACTIVE; in uvc_acquire_privileges()
535 static void uvc_dismiss_privileges(struct uvc_fh *handle) in uvc_dismiss_privileges() argument
537 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_dismiss_privileges()
538 atomic_dec(&handle->stream->active); in uvc_dismiss_privileges()
540 handle->state = UVC_HANDLE_PASSIVE; in uvc_dismiss_privileges()
543 static int uvc_has_privileges(struct uvc_fh *handle) in uvc_has_privileges() argument
545 return handle->state == UVC_HANDLE_ACTIVE; in uvc_has_privileges()
555 struct uvc_fh *handle; in uvc_v4l2_open() local
566 handle = kzalloc(sizeof(*handle), GFP_KERNEL); in uvc_v4l2_open()
567 if (handle == NULL) { in uvc_v4l2_open()
578 kfree(handle); in uvc_v4l2_open()
586 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
587 v4l2_fh_add(&handle->vfh); in uvc_v4l2_open()
588 handle->chain = stream->chain; in uvc_v4l2_open()
589 handle->stream = stream; in uvc_v4l2_open()
590 handle->state = UVC_HANDLE_PASSIVE; in uvc_v4l2_open()
591 file->private_data = handle; in uvc_v4l2_open()
598 struct uvc_fh *handle = file->private_data; in uvc_v4l2_release() local
599 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release()
604 if (uvc_has_privileges(handle)) in uvc_v4l2_release()
608 uvc_dismiss_privileges(handle); in uvc_v4l2_release()
609 v4l2_fh_del(&handle->vfh); in uvc_v4l2_release()
610 v4l2_fh_exit(&handle->vfh); in uvc_v4l2_release()
611 kfree(handle); in uvc_v4l2_release()
626 struct uvc_fh *handle = file->private_data; in uvc_ioctl_querycap() local
627 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querycap()
628 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap()
631 strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card)); in uvc_ioctl_querycap()
666 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_cap() local
667 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap()
675 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_out() local
676 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out()
684 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_cap() local
685 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap()
693 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_out() local
694 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out()
702 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_cap() local
703 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap()
706 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_cap()
716 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_out() local
717 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out()
720 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_out()
730 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_cap() local
731 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap()
740 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_out() local
741 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out()
750 struct uvc_fh *handle = fh; in uvc_ioctl_reqbufs() local
751 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs()
754 ret = uvc_acquire_privileges(handle); in uvc_ioctl_reqbufs()
765 uvc_dismiss_privileges(handle); in uvc_ioctl_reqbufs()
773 struct uvc_fh *handle = fh; in uvc_ioctl_querybuf() local
774 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf()
776 if (!uvc_has_privileges(handle)) in uvc_ioctl_querybuf()
784 struct uvc_fh *handle = fh; in uvc_ioctl_qbuf() local
785 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf()
787 if (!uvc_has_privileges(handle)) in uvc_ioctl_qbuf()
797 struct uvc_fh *handle = fh; in uvc_ioctl_expbuf() local
798 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_expbuf()
800 if (!uvc_has_privileges(handle)) in uvc_ioctl_expbuf()
808 struct uvc_fh *handle = fh; in uvc_ioctl_dqbuf() local
809 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf()
811 if (!uvc_has_privileges(handle)) in uvc_ioctl_dqbuf()
821 struct uvc_fh *handle = fh; in uvc_ioctl_create_bufs() local
822 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs()
825 ret = uvc_acquire_privileges(handle); in uvc_ioctl_create_bufs()
835 struct uvc_fh *handle = fh; in uvc_ioctl_streamon() local
836 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon()
839 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamon()
852 struct uvc_fh *handle = fh; in uvc_ioctl_streamoff() local
853 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff()
855 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamoff()
868 struct uvc_fh *handle = fh; in uvc_ioctl_enum_input() local
869 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_enum_input()
908 struct uvc_fh *handle = fh; in uvc_ioctl_g_input() local
909 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_input()
936 struct uvc_fh *handle = fh; in uvc_ioctl_s_input() local
937 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_input()
941 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_input()
971 struct uvc_fh *handle = fh; in uvc_ioctl_queryctrl() local
972 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_queryctrl()
980 struct uvc_fh *handle = fh; in uvc_ioctl_query_ext_ctrl() local
981 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_query_ext_ctrl()
1029 struct uvc_fh *handle = fh; in uvc_ioctl_g_ext_ctrls() local
1030 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ext_ctrls()
1062 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1070 return uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1073 static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, in uvc_ioctl_s_try_ext_ctrls() argument
1078 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_try_ext_ctrls()
1091 ret = uvc_ctrl_set(handle, ctrl); in uvc_ioctl_s_try_ext_ctrls()
1093 uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1103 return uvc_ctrl_commit(handle, ctrls); in uvc_ioctl_s_try_ext_ctrls()
1105 return uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1111 struct uvc_fh *handle = fh; in uvc_ioctl_s_ext_ctrls() local
1113 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_S_EXT_CTRLS); in uvc_ioctl_s_ext_ctrls()
1119 struct uvc_fh *handle = fh; in uvc_ioctl_try_ext_ctrls() local
1121 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_TRY_EXT_CTRLS); in uvc_ioctl_try_ext_ctrls()
1127 struct uvc_fh *handle = fh; in uvc_ioctl_querymenu() local
1128 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querymenu()
1136 struct uvc_fh *handle = fh; in uvc_ioctl_g_selection() local
1137 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection()
1170 struct uvc_fh *handle = fh; in uvc_ioctl_g_parm() local
1171 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm()
1179 struct uvc_fh *handle = fh; in uvc_ioctl_s_parm() local
1180 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm()
1183 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_parm()
1193 struct uvc_fh *handle = fh; in uvc_ioctl_enum_framesizes() local
1194 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes()
1233 struct uvc_fh *handle = fh; in uvc_ioctl_enum_frameintervals() local
1234 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals()
1305 struct uvc_fh *handle = fh; in uvc_ioctl_default() local
1306 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_default()
1411 struct uvc_fh *handle = file->private_data; in uvc_v4l2_compat_ioctl32() local
1424 ret = uvc_ioctl_ctrl_map(handle->chain, &karg.xmap); in uvc_v4l2_compat_ioctl32()
1437 ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry); in uvc_v4l2_compat_ioctl32()
1456 struct uvc_fh *handle = file->private_data; in uvc_v4l2_read() local
1457 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_read()
1465 struct uvc_fh *handle = file->private_data; in uvc_v4l2_mmap() local
1466 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap()
1475 struct uvc_fh *handle = file->private_data; in uvc_v4l2_poll() local
1476 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll()
1488 struct uvc_fh *handle = file->private_data; in uvc_v4l2_get_unmapped_area() local
1489 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area()