static void usbtv_stop_streaming(struct vb2_queue *vq) { struct usbtv *usbtv = vb2_get_drv_priv(vq); if (usbtv->udev) usbtv_stop(usbtv); }
static int usbtv_stop_streaming(struct vb2_queue *vq) { struct usbtv *usbtv = vb2_get_drv_priv(vq); if (usbtv->udev == NULL) return -ENODEV; usbtv_stop(usbtv); return 0; }
void usbtv_video_free(struct usbtv *usbtv) { mutex_lock(&usbtv->vb2q_lock); mutex_lock(&usbtv->v4l2_lock); usbtv_stop(usbtv); video_unregister_device(&usbtv->vdev); v4l2_device_disconnect(&usbtv->v4l2_dev); mutex_unlock(&usbtv->v4l2_lock); mutex_unlock(&usbtv->vb2q_lock); v4l2_device_put(&usbtv->v4l2_dev); }
static int usbtv_start(struct usbtv *usbtv) { int i; int ret; usbtv_audio_suspend(usbtv); ret = usb_set_interface(usbtv->udev, 0, 0); if (ret < 0) return ret; ret = usbtv_setup_capture(usbtv); if (ret < 0) return ret; ret = usb_set_interface(usbtv->udev, 0, 1); if (ret < 0) return ret; usbtv_audio_resume(usbtv); for (i = 0; i < USBTV_ISOC_TRANSFERS; i++) { struct urb *ip; ip = usbtv_setup_iso_transfer(usbtv); if (ip == NULL) { ret = -ENOMEM; goto start_fail; } usbtv->isoc_urbs[i] = ip; ret = usb_submit_urb(ip, GFP_KERNEL); if (ret < 0) goto start_fail; } return 0; start_fail: usbtv_stop(usbtv); return ret; }