File 0014-backport-media-v4l2-subdev-Rename-.init_cfg-operatio.patch of Package intel-ipu6
From: You-Sheng Yang <vicamo.yang@canonical.com>
Date: Thu, 22 Feb 2024 14:31:58 +0800
Subject: backport: media: v4l2-subdev: Rename .init_cfg() operation to
.init_state()
BugLink: https://bugs.launchpad.net/bug/2054516
With Linux v6.8-rcX commit 5755be5f15d9 ("media: v4l2-subdev: Rename
.init_cfg() operation to .init_state()"), v4l2_subdev_pad_ops::init_cfg
is moved into v4l2_subdev_internal_ops::init_state.
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
drivers/media/i2c/gc5035.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/media/i2c/gc5035.c b/drivers/media/i2c/gc5035.c
index 812611b..f534a61 100644
--- a/drivers/media/i2c/gc5035.c
+++ b/drivers/media/i2c/gc5035.c
@@ -1694,7 +1694,11 @@ static int gc5035_runtime_suspend(struct device *dev)
return 0;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
static int gc5035_entity_init_cfg(struct v4l2_subdev *subdev,
+#else
+static int gc5035_entity_init_state(struct v4l2_subdev *subdev,
+#endif
struct v4l2_subdev_state *sd_state)
{
struct v4l2_subdev_format fmt = {
@@ -1722,7 +1726,9 @@ static const struct v4l2_subdev_video_ops gc5035_video_ops = {
};
static const struct v4l2_subdev_pad_ops gc5035_pad_ops = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
.init_cfg = gc5035_entity_init_cfg,
+#endif
.enum_mbus_code = gc5035_enum_mbus_code,
.enum_frame_size = gc5035_enum_frame_sizes,
.get_fmt = gc5035_get_fmt,
@@ -1734,6 +1740,12 @@ static const struct v4l2_subdev_ops gc5035_subdev_ops = {
.pad = &gc5035_pad_ops,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
+static const struct v4l2_subdev_internal_ops gc5035_internal_ops = {
+ .init_state = gc5035_entity_init_state,
+};
+#endif
+
static const struct media_entity_operations gc5035_subdev_entity_ops = {
.link_validate = v4l2_subdev_link_validate,
};
@@ -2099,6 +2111,9 @@ static int gc5035_probe(struct i2c_client *client)
mutex_init(&gc5035->mutex);
sd = &gc5035->subdev;
v4l2_i2c_subdev_init(sd, client, &gc5035_subdev_ops);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
+ sd->internal_ops = &gc5035_internal_ops;
+#endif
ret = gc5035_initialize_controls(gc5035);
if (ret) {
dev_err_probe(dev, ret, "Failed to initialize controls\n");