Lines Matching defs:handle
578 static int uvc_acquire_privileges(struct uvc_fh *handle)
580 /* Always succeed if the handle is already privileged. */
581 if (handle->state == UVC_HANDLE_ACTIVE)
584 /* Check if the device already has a privileged handle. */
585 if (atomic_inc_return(&handle->stream->active) != 1) {
586 atomic_dec(&handle->stream->active);
590 handle->state = UVC_HANDLE_ACTIVE;
594 static void uvc_dismiss_privileges(struct uvc_fh *handle)
596 if (handle->state == UVC_HANDLE_ACTIVE)
597 atomic_dec(&handle->stream->active);
599 handle->state = UVC_HANDLE_PASSIVE;
602 static int uvc_has_privileges(struct uvc_fh *handle)
604 return handle->state == UVC_HANDLE_ACTIVE;
614 struct uvc_fh *handle;
624 /* Create the device handle. */
625 handle = kzalloc(sizeof(*handle), GFP_KERNEL);
626 if (handle == NULL) {
637 kfree(handle);
645 v4l2_fh_init(&handle->vfh, &stream->vdev);
646 v4l2_fh_add(&handle->vfh);
647 handle->chain = stream->chain;
648 handle->stream = stream;
649 handle->state = UVC_HANDLE_PASSIVE;
650 file->private_data = handle;
657 struct uvc_fh *handle = file->private_data;
658 struct uvc_streaming *stream = handle->stream;
662 /* Only free resources if this is a privileged handle. */
663 if (uvc_has_privileges(handle))
666 /* Release the file handle. */
667 uvc_dismiss_privileges(handle);
668 v4l2_fh_del(&handle->vfh);
669 v4l2_fh_exit(&handle->vfh);
670 kfree(handle);
685 struct uvc_fh *handle = file->private_data;
686 struct uvc_video_chain *chain = handle->chain;
687 struct uvc_streaming *stream = handle->stream;
690 strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card));
723 struct uvc_fh *handle = fh;
724 struct uvc_streaming *stream = handle->stream;
732 struct uvc_fh *handle = fh;
733 struct uvc_streaming *stream = handle->stream;
741 struct uvc_fh *handle = fh;
742 struct uvc_streaming *stream = handle->stream;
750 struct uvc_fh *handle = fh;
751 struct uvc_streaming *stream = handle->stream;
759 struct uvc_fh *handle = fh;
760 struct uvc_streaming *stream = handle->stream;
763 ret = uvc_acquire_privileges(handle);
773 struct uvc_fh *handle = fh;
774 struct uvc_streaming *stream = handle->stream;
777 ret = uvc_acquire_privileges(handle);
787 struct uvc_fh *handle = fh;
788 struct uvc_streaming *stream = handle->stream;
797 struct uvc_fh *handle = fh;
798 struct uvc_streaming *stream = handle->stream;
807 struct uvc_fh *handle = fh;
808 struct uvc_streaming *stream = handle->stream;
811 ret = uvc_acquire_privileges(handle);
822 uvc_dismiss_privileges(handle);
830 struct uvc_fh *handle = fh;
831 struct uvc_streaming *stream = handle->stream;
833 if (!uvc_has_privileges(handle))
841 struct uvc_fh *handle = fh;
842 struct uvc_streaming *stream = handle->stream;
844 if (!uvc_has_privileges(handle))
854 struct uvc_fh *handle = fh;
855 struct uvc_streaming *stream = handle->stream;
857 if (!uvc_has_privileges(handle))
865 struct uvc_fh *handle = fh;
866 struct uvc_streaming *stream = handle->stream;
868 if (!uvc_has_privileges(handle))
878 struct uvc_fh *handle = fh;
879 struct uvc_streaming *stream = handle->stream;
882 ret = uvc_acquire_privileges(handle);
892 struct uvc_fh *handle = fh;
893 struct uvc_streaming *stream = handle->stream;
896 if (!uvc_has_privileges(handle))
909 struct uvc_fh *handle = fh;
910 struct uvc_streaming *stream = handle->stream;
912 if (!uvc_has_privileges(handle))
925 struct uvc_fh *handle = fh;
926 struct uvc_video_chain *chain = handle->chain;
967 struct uvc_fh *handle = fh;
968 struct uvc_video_chain *chain = handle->chain;
995 struct uvc_fh *handle = fh;
996 struct uvc_video_chain *chain = handle->chain;
1000 ret = uvc_acquire_privileges(handle);
1030 struct uvc_fh *handle = fh;
1031 struct uvc_video_chain *chain = handle->chain;
1039 struct uvc_fh *handle = fh;
1040 struct uvc_video_chain *chain = handle->chain;
1087 struct uvc_fh *handle = fh;
1088 struct uvc_video_chain *chain = handle->chain;
1120 uvc_ctrl_rollback(handle);
1128 return uvc_ctrl_rollback(handle);
1131 static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
1136 struct uvc_video_chain *chain = handle->chain;
1149 ret = uvc_ctrl_set(handle, ctrl);
1151 uvc_ctrl_rollback(handle);
1161 return uvc_ctrl_commit(handle, ctrls);
1163 return uvc_ctrl_rollback(handle);
1169 struct uvc_fh *handle = fh;
1171 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_S_EXT_CTRLS);
1177 struct uvc_fh *handle = fh;
1179 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_TRY_EXT_CTRLS);
1185 struct uvc_fh *handle = fh;
1186 struct uvc_video_chain *chain = handle->chain;
1194 struct uvc_fh *handle = fh;
1195 struct uvc_streaming *stream = handle->stream;
1228 struct uvc_fh *handle = fh;
1229 struct uvc_streaming *stream = handle->stream;
1237 struct uvc_fh *handle = fh;
1238 struct uvc_streaming *stream = handle->stream;
1241 ret = uvc_acquire_privileges(handle);
1251 struct uvc_fh *handle = fh;
1252 struct uvc_streaming *stream = handle->stream;
1291 struct uvc_fh *handle = fh;
1292 struct uvc_streaming *stream = handle->stream;
1363 struct uvc_fh *handle = fh;
1364 struct uvc_video_chain *chain = handle->chain;
1469 struct uvc_fh *handle = file->private_data;
1482 ret = uvc_ioctl_xu_ctrl_map(handle->chain, &karg.xmap);
1495 ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry);
1514 struct uvc_fh *handle = file->private_data;
1515 struct uvc_streaming *stream = handle->stream;
1523 struct uvc_fh *handle = file->private_data;
1524 struct uvc_streaming *stream = handle->stream;
1533 struct uvc_fh *handle = file->private_data;
1534 struct uvc_streaming *stream = handle->stream;
1546 struct uvc_fh *handle = file->private_data;
1547 struct uvc_streaming *stream = handle->stream;