Re: [PATCH 4/7] media: i2c: st-mipid02: use active state to store pad formats

From: Sakari Ailus
Date: Tue Nov 28 2023 - 01:47:43 EST


On Sat, Nov 25, 2023 at 07:20:52PM +0100, Alain Volmat wrote:
> Store formats information within pad allowing to simplify further more
> the driver (mutex / format store within the driver structure no more
> necessary).
>
> Signed-off-by: Alain Volmat <alain.volmat@xxxxxxxxxxx>

Applied with the following diff:

diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index 7af209905d7b..2cc07b3ed0da 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -563,8 +563,8 @@ static const struct v4l2_mbus_framefmt default_fmt = {
.height = 480,
};

-static int mipid02_init_cfg(struct v4l2_subdev *sd,
- struct v4l2_subdev_state *state)
+static int mipid02_init_state(struct v4l2_subdev *sd,
+ struct v4l2_subdev_state *state)
{
*v4l2_subdev_state_get_format(state, MIPID02_SINK_0) = default_fmt;
/* MIPID02_SINK_1 isn't supported yet */
@@ -642,7 +642,6 @@ static const struct v4l2_subdev_video_ops mipid02_video_ops = {
};

static const struct v4l2_subdev_pad_ops mipid02_pad_ops = {
- .init_cfg = mipid02_init_cfg,
.enum_mbus_code = mipid02_enum_mbus_code,
.get_fmt = v4l2_subdev_get_fmt,
.set_fmt = mipid02_set_fmt,
@@ -653,6 +652,10 @@ static const struct v4l2_subdev_ops mipid02_subdev_ops = {
.pad = &mipid02_pad_ops,
};

+static const struct v4l2_subdev_internal_ops mipid02_subdev_internal_ops = {
+ .init_state = mipid02_init_state,
+};
+
static const struct media_entity_operations mipid02_subdev_entity_ops = {
.link_validate = v4l2_subdev_link_validate,
};
@@ -851,6 +854,7 @@ static int mipid02_probe(struct i2c_client *client)

bridge->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
bridge->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
+ bridge->sd.internal_ops = &mipid02_subdev_internal_ops;
bridge->sd.entity.ops = &mipid02_subdev_entity_ops;
bridge->pad[0].flags = MEDIA_PAD_FL_SINK;
bridge->pad[1].flags = MEDIA_PAD_FL_SINK;

--
Sakari Ailus