hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/staging/most/video/video.c
....@@ -20,12 +20,11 @@
2020 #include <media/v4l2-device.h>
2121 #include <media/v4l2-ctrls.h>
2222 #include <media/v4l2-fh.h>
23
-
24
-#include "most/core.h"
23
+#include <linux/most.h>
2524
2625 #define V4L2_CMP_MAX_INPUT 1
2726
28
-static struct core_component comp;
27
+static struct most_component comp;
2928
3029 struct most_video_dev {
3130 struct most_interface *iface;
....@@ -54,7 +53,7 @@
5453 };
5554
5655 static struct list_head video_devices = LIST_HEAD_INIT(video_devices);
57
-static struct spinlock list_lock;
56
+static DEFINE_SPINLOCK(list_lock);
5857
5958 static inline bool data_ready(struct most_video_dev *mdev)
6059 {
....@@ -74,7 +73,7 @@
7473 struct comp_fh *fh;
7574
7675 switch (vdev->vfl_type) {
77
- case VFL_TYPE_GRABBER:
76
+ case VFL_TYPE_VIDEO:
7877 break;
7978 default:
8079 return -EINVAL;
....@@ -250,11 +249,6 @@
250249 strlcpy(cap->card, "MOST", sizeof(cap->card));
251250 snprintf(cap->bus_info, sizeof(cap->bus_info),
252251 "%s", mdev->iface->description);
253
-
254
- cap->capabilities =
255
- V4L2_CAP_READWRITE |
256
- V4L2_CAP_TUNER |
257
- V4L2_CAP_VIDEO_CAPTURE;
258252 return 0;
259253 }
260254
....@@ -366,6 +360,7 @@
366360 .release = video_device_release,
367361 .ioctl_ops = &video_ioctl_ops,
368362 .tvnorms = V4L2_STD_UNKNOWN,
363
+ .device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE,
369364 };
370365
371366 /**************************************************************************/
....@@ -428,7 +423,7 @@
428423
429424 /* Register the v4l2 device */
430425 video_set_drvdata(mdev->vdev, mdev);
431
- ret = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1);
426
+ ret = video_register_device(mdev->vdev, VFL_TYPE_VIDEO, -1);
432427 if (ret) {
433428 v4l2_err(&mdev->v4l2_dev, "video_register_device failed (%d)\n",
434429 ret);
....@@ -453,7 +448,8 @@
453448 }
454449
455450 static int comp_probe_channel(struct most_interface *iface, int channel_idx,
456
- struct most_channel_config *ccfg, char *name)
451
+ struct most_channel_config *ccfg, char *name,
452
+ char *args)
457453 {
458454 int ret;
459455 struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);
....@@ -530,7 +526,8 @@
530526 return 0;
531527 }
532528
533
-static struct core_component comp = {
529
+static struct most_component comp = {
530
+ .mod = THIS_MODULE,
534531 .name = "video",
535532 .probe_channel = comp_probe_channel,
536533 .disconnect_channel = comp_disconnect_channel,
....@@ -539,8 +536,17 @@
539536
540537 static int __init comp_init(void)
541538 {
542
- spin_lock_init(&list_lock);
543
- return most_register_component(&comp);
539
+ int err;
540
+
541
+ err = most_register_component(&comp);
542
+ if (err)
543
+ return err;
544
+ err = most_register_configfs_subsys(&comp);
545
+ if (err) {
546
+ most_deregister_component(&comp);
547
+ return err;
548
+ }
549
+ return 0;
544550 }
545551
546552 static void __exit comp_exit(void)
....@@ -565,6 +571,7 @@
565571 }
566572 spin_unlock_irq(&list_lock);
567573
574
+ most_deregister_configfs_subsys(&comp);
568575 most_deregister_component(&comp);
569576 BUG_ON(!list_empty(&video_devices));
570577 }