From b22da3d8526a935aa31e086e63f60ff3246cb61c Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Sat, 09 Dec 2023 07:24:11 +0000 Subject: [PATCH] add stmac read mac form eeprom --- kernel/drivers/staging/most/video/video.c | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) diff --git a/kernel/drivers/staging/most/video/video.c b/kernel/drivers/staging/most/video/video.c index ad7e28a..829df89 100644 --- a/kernel/drivers/staging/most/video/video.c +++ b/kernel/drivers/staging/most/video/video.c @@ -20,12 +20,11 @@ #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-fh.h> - -#include "most/core.h" +#include <linux/most.h> #define V4L2_CMP_MAX_INPUT 1 -static struct core_component comp; +static struct most_component comp; struct most_video_dev { struct most_interface *iface; @@ -54,7 +53,7 @@ }; static struct list_head video_devices = LIST_HEAD_INIT(video_devices); -static struct spinlock list_lock; +static DEFINE_SPINLOCK(list_lock); static inline bool data_ready(struct most_video_dev *mdev) { @@ -74,7 +73,7 @@ struct comp_fh *fh; switch (vdev->vfl_type) { - case VFL_TYPE_GRABBER: + case VFL_TYPE_VIDEO: break; default: return -EINVAL; @@ -250,11 +249,6 @@ strlcpy(cap->card, "MOST", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "%s", mdev->iface->description); - - cap->capabilities = - V4L2_CAP_READWRITE | - V4L2_CAP_TUNER | - V4L2_CAP_VIDEO_CAPTURE; return 0; } @@ -366,6 +360,7 @@ .release = video_device_release, .ioctl_ops = &video_ioctl_ops, .tvnorms = V4L2_STD_UNKNOWN, + .device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE, }; /**************************************************************************/ @@ -428,7 +423,7 @@ /* Register the v4l2 device */ video_set_drvdata(mdev->vdev, mdev); - ret = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1); + ret = video_register_device(mdev->vdev, VFL_TYPE_VIDEO, -1); if (ret) { v4l2_err(&mdev->v4l2_dev, "video_register_device failed (%d)\n", ret); @@ -453,7 +448,8 @@ } static int comp_probe_channel(struct most_interface *iface, int channel_idx, - struct most_channel_config *ccfg, char *name) + struct most_channel_config *ccfg, char *name, + char *args) { int ret; struct most_video_dev *mdev = get_comp_dev(iface, channel_idx); @@ -530,7 +526,8 @@ return 0; } -static struct core_component comp = { +static struct most_component comp = { + .mod = THIS_MODULE, .name = "video", .probe_channel = comp_probe_channel, .disconnect_channel = comp_disconnect_channel, @@ -539,8 +536,17 @@ static int __init comp_init(void) { - spin_lock_init(&list_lock); - return most_register_component(&comp); + int err; + + err = most_register_component(&comp); + if (err) + return err; + err = most_register_configfs_subsys(&comp); + if (err) { + most_deregister_component(&comp); + return err; + } + return 0; } static void __exit comp_exit(void) @@ -565,6 +571,7 @@ } spin_unlock_irq(&list_lock); + most_deregister_configfs_subsys(&comp); most_deregister_component(&comp); BUG_ON(!list_empty(&video_devices)); } -- Gitblit v1.6.2