Lines Matching full:handle

510 static int uvc_acquire_privileges(struct uvc_fh *handle)  in uvc_acquire_privileges()  argument
512 /* Always succeed if the handle is already privileged. */ in uvc_acquire_privileges()
513 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_acquire_privileges()
516 /* Check if the device already has a privileged handle. */ in uvc_acquire_privileges()
517 if (atomic_inc_return(&handle->stream->active) != 1) { in uvc_acquire_privileges()
518 atomic_dec(&handle->stream->active); in uvc_acquire_privileges()
522 handle->state = UVC_HANDLE_ACTIVE; in uvc_acquire_privileges()
526 static void uvc_dismiss_privileges(struct uvc_fh *handle) in uvc_dismiss_privileges() argument
528 if (handle->state == UVC_HANDLE_ACTIVE) in uvc_dismiss_privileges()
529 atomic_dec(&handle->stream->active); in uvc_dismiss_privileges()
531 handle->state = UVC_HANDLE_PASSIVE; in uvc_dismiss_privileges()
534 static int uvc_has_privileges(struct uvc_fh *handle) in uvc_has_privileges() argument
536 return handle->state == UVC_HANDLE_ACTIVE; in uvc_has_privileges()
546 struct uvc_fh *handle; in uvc_v4l2_open() local
556 /* Create the device handle. */ in uvc_v4l2_open()
557 handle = kzalloc(sizeof(*handle), GFP_KERNEL); in uvc_v4l2_open()
558 if (handle == NULL) { in uvc_v4l2_open()
569 kfree(handle); in uvc_v4l2_open()
577 v4l2_fh_init(&handle->vfh, &stream->vdev); in uvc_v4l2_open()
578 v4l2_fh_add(&handle->vfh); in uvc_v4l2_open()
579 handle->chain = stream->chain; in uvc_v4l2_open()
580 handle->stream = stream; in uvc_v4l2_open()
581 handle->state = UVC_HANDLE_PASSIVE; in uvc_v4l2_open()
582 file->private_data = handle; in uvc_v4l2_open()
589 struct uvc_fh *handle = file->private_data; in uvc_v4l2_release() local
590 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_release()
594 /* Only free resources if this is a privileged handle. */ in uvc_v4l2_release()
595 if (uvc_has_privileges(handle)) in uvc_v4l2_release()
598 /* Release the file handle. */ in uvc_v4l2_release()
599 uvc_dismiss_privileges(handle); in uvc_v4l2_release()
600 v4l2_fh_del(&handle->vfh); in uvc_v4l2_release()
601 v4l2_fh_exit(&handle->vfh); in uvc_v4l2_release()
602 kfree(handle); in uvc_v4l2_release()
618 struct uvc_fh *handle = file->private_data; in uvc_ioctl_querycap() local
619 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querycap()
620 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querycap()
658 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_cap() local
659 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_cap()
667 struct uvc_fh *handle = fh; in uvc_ioctl_enum_fmt_vid_out() local
668 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_fmt_vid_out()
676 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_cap() local
677 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_cap()
685 struct uvc_fh *handle = fh; in uvc_ioctl_g_fmt_vid_out() local
686 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_fmt_vid_out()
694 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_cap() local
695 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_cap()
698 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_cap()
708 struct uvc_fh *handle = fh; in uvc_ioctl_s_fmt_vid_out() local
709 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_fmt_vid_out()
712 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_fmt_vid_out()
722 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_cap() local
723 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_cap()
732 struct uvc_fh *handle = fh; in uvc_ioctl_try_fmt_vid_out() local
733 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_try_fmt_vid_out()
742 struct uvc_fh *handle = fh; in uvc_ioctl_reqbufs() local
743 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_reqbufs()
746 ret = uvc_acquire_privileges(handle); in uvc_ioctl_reqbufs()
757 uvc_dismiss_privileges(handle); in uvc_ioctl_reqbufs()
765 struct uvc_fh *handle = fh; in uvc_ioctl_querybuf() local
766 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_querybuf()
768 if (!uvc_has_privileges(handle)) in uvc_ioctl_querybuf()
776 struct uvc_fh *handle = fh; in uvc_ioctl_qbuf() local
777 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_qbuf()
779 if (!uvc_has_privileges(handle)) in uvc_ioctl_qbuf()
789 struct uvc_fh *handle = fh; in uvc_ioctl_expbuf() local
790 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_expbuf()
792 if (!uvc_has_privileges(handle)) in uvc_ioctl_expbuf()
800 struct uvc_fh *handle = fh; in uvc_ioctl_dqbuf() local
801 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_dqbuf()
803 if (!uvc_has_privileges(handle)) in uvc_ioctl_dqbuf()
813 struct uvc_fh *handle = fh; in uvc_ioctl_create_bufs() local
814 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_create_bufs()
817 ret = uvc_acquire_privileges(handle); in uvc_ioctl_create_bufs()
827 struct uvc_fh *handle = fh; in uvc_ioctl_streamon() local
828 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamon()
831 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamon()
844 struct uvc_fh *handle = fh; in uvc_ioctl_streamoff() local
845 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_streamoff()
847 if (!uvc_has_privileges(handle)) in uvc_ioctl_streamoff()
860 struct uvc_fh *handle = fh; in uvc_ioctl_enum_input() local
861 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_enum_input()
900 struct uvc_fh *handle = fh; in uvc_ioctl_g_input() local
901 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_input()
928 struct uvc_fh *handle = fh; in uvc_ioctl_s_input() local
929 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_input()
933 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_input()
963 struct uvc_fh *handle = fh; in uvc_ioctl_queryctrl() local
964 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_queryctrl()
972 struct uvc_fh *handle = fh; in uvc_ioctl_query_ext_ctrl() local
973 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_query_ext_ctrl()
1001 struct uvc_fh *handle = fh; in uvc_ioctl_g_ctrl() local
1002 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ctrl()
1014 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ctrl()
1025 struct uvc_fh *handle = fh; in uvc_ioctl_s_ctrl() local
1026 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_ctrl()
1038 ret = uvc_ctrl_set(handle, &xctrl); in uvc_ioctl_s_ctrl()
1040 uvc_ctrl_rollback(handle); in uvc_ioctl_s_ctrl()
1044 ret = uvc_ctrl_commit(handle, &xctrl, 1); in uvc_ioctl_s_ctrl()
1055 struct uvc_fh *handle = fh; in uvc_ioctl_g_ext_ctrls() local
1056 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_g_ext_ctrls()
1084 uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1092 return uvc_ctrl_rollback(handle); in uvc_ioctl_g_ext_ctrls()
1095 static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, in uvc_ioctl_s_try_ext_ctrls() argument
1100 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_s_try_ext_ctrls()
1113 ret = uvc_ctrl_set(handle, ctrl); in uvc_ioctl_s_try_ext_ctrls()
1115 uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1124 return uvc_ctrl_commit(handle, ctrls->controls, ctrls->count); in uvc_ioctl_s_try_ext_ctrls()
1126 return uvc_ctrl_rollback(handle); in uvc_ioctl_s_try_ext_ctrls()
1132 struct uvc_fh *handle = fh; in uvc_ioctl_s_ext_ctrls() local
1134 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, true); in uvc_ioctl_s_ext_ctrls()
1140 struct uvc_fh *handle = fh; in uvc_ioctl_try_ext_ctrls() local
1142 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, false); in uvc_ioctl_try_ext_ctrls()
1148 struct uvc_fh *handle = fh; in uvc_ioctl_querymenu() local
1149 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_querymenu()
1157 struct uvc_fh *handle = fh; in uvc_ioctl_g_selection() local
1158 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_selection()
1191 struct uvc_fh *handle = fh; in uvc_ioctl_g_parm() local
1192 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_g_parm()
1200 struct uvc_fh *handle = fh; in uvc_ioctl_s_parm() local
1201 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_s_parm()
1204 ret = uvc_acquire_privileges(handle); in uvc_ioctl_s_parm()
1214 struct uvc_fh *handle = fh; in uvc_ioctl_enum_framesizes() local
1215 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_framesizes()
1254 struct uvc_fh *handle = fh; in uvc_ioctl_enum_frameintervals() local
1255 struct uvc_streaming *stream = handle->stream; in uvc_ioctl_enum_frameintervals()
1326 struct uvc_fh *handle = fh; in uvc_ioctl_default() local
1327 struct uvc_video_chain *chain = handle->chain; in uvc_ioctl_default()
1432 struct uvc_fh *handle = file->private_data; in uvc_v4l2_compat_ioctl32() local
1445 ret = uvc_ioctl_ctrl_map(handle->chain, &karg.xmap); in uvc_v4l2_compat_ioctl32()
1458 ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry); in uvc_v4l2_compat_ioctl32()
1477 struct uvc_fh *handle = file->private_data; in uvc_v4l2_read() local
1478 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_read()
1486 struct uvc_fh *handle = file->private_data; in uvc_v4l2_mmap() local
1487 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_mmap()
1496 struct uvc_fh *handle = file->private_data; in uvc_v4l2_poll() local
1497 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_poll()
1509 struct uvc_fh *handle = file->private_data; in uvc_v4l2_get_unmapped_area() local
1510 struct uvc_streaming *stream = handle->stream; in uvc_v4l2_get_unmapped_area()