hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/media/usb/usbtv/usbtv-video.c
....@@ -600,12 +600,9 @@
600600 {
601601 struct usbtv *dev = video_drvdata(file);
602602
603
- strlcpy(cap->driver, "usbtv", sizeof(cap->driver));
604
- strlcpy(cap->card, "usbtv", sizeof(cap->card));
603
+ strscpy(cap->driver, "usbtv", sizeof(cap->driver));
604
+ strscpy(cap->card, "usbtv", sizeof(cap->card));
605605 usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
606
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE;
607
- cap->device_caps |= V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
608
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
609606 return 0;
610607 }
611608
....@@ -616,10 +613,10 @@
616613
617614 switch (i->index) {
618615 case USBTV_COMPOSITE_INPUT:
619
- strlcpy(i->name, "Composite", sizeof(i->name));
616
+ strscpy(i->name, "Composite", sizeof(i->name));
620617 break;
621618 case USBTV_SVIDEO_INPUT:
622
- strlcpy(i->name, "S-Video", sizeof(i->name));
619
+ strscpy(i->name, "S-Video", sizeof(i->name));
623620 break;
624621 default:
625622 return -EINVAL;
....@@ -636,8 +633,6 @@
636633 if (f->index > 0)
637634 return -EINVAL;
638635
639
- strlcpy(f->description, "16 bpp YUY2, 4:2:2, packed",
640
- sizeof(f->description));
641636 f->pixelformat = V4L2_PIX_FMT_YUYV;
642637 return 0;
643638 }
....@@ -877,7 +872,6 @@
877872
878873 v4l2_device_unregister(&usbtv->v4l2_dev);
879874 v4l2_ctrl_handler_free(&usbtv->ctrl);
880
- vb2_queue_release(&usbtv->vb2q);
881875 kfree(usbtv);
882876 }
883877
....@@ -935,7 +929,7 @@
935929 }
936930
937931 /* Video structure */
938
- strlcpy(usbtv->vdev.name, "usbtv", sizeof(usbtv->vdev.name));
932
+ strscpy(usbtv->vdev.name, "usbtv", sizeof(usbtv->vdev.name));
939933 usbtv->vdev.v4l2_dev = &usbtv->v4l2_dev;
940934 usbtv->vdev.release = video_device_release_empty;
941935 usbtv->vdev.fops = &usbtv_fops;
....@@ -943,8 +937,10 @@
943937 usbtv->vdev.tvnorms = USBTV_TV_STD;
944938 usbtv->vdev.queue = &usbtv->vb2q;
945939 usbtv->vdev.lock = &usbtv->v4l2_lock;
940
+ usbtv->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
941
+ V4L2_CAP_STREAMING;
946942 video_set_drvdata(&usbtv->vdev, usbtv);
947
- ret = video_register_device(&usbtv->vdev, VFL_TYPE_GRABBER, -1);
943
+ ret = video_register_device(&usbtv->vdev, VFL_TYPE_VIDEO, -1);
948944 if (ret < 0) {
949945 dev_warn(usbtv->dev, "Could not register video device\n");
950946 goto vdev_fail;
....@@ -957,7 +953,6 @@
957953 v4l2_fail:
958954 ctrl_fail:
959955 v4l2_ctrl_handler_free(&usbtv->ctrl);
960
- vb2_queue_release(&usbtv->vb2q);
961956
962957 return ret;
963958 }
....@@ -968,7 +963,7 @@
968963 mutex_lock(&usbtv->v4l2_lock);
969964
970965 usbtv_stop(usbtv);
971
- video_unregister_device(&usbtv->vdev);
966
+ vb2_video_unregister_device(&usbtv->vdev);
972967 v4l2_device_disconnect(&usbtv->v4l2_dev);
973968
974969 mutex_unlock(&usbtv->v4l2_lock);