media: v4l: subdev: Clear frame descriptor before get_frame_desc
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 15 Sep 2023 11:23:28 +0000 (14:23 +0300)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Sat, 7 Oct 2023 08:55:48 +0000 (10:55 +0200)
Clear frame descriptor before calling transmitter's get_frame_desc() op.
Also remove the corresponding memset() calls from drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/i2c/ds90ub913.c
drivers/media/i2c/ds90ub953.c
drivers/media/i2c/ds90ub960.c
drivers/media/platform/nxp/imx-mipi-csis.c
drivers/media/v4l2-core/v4l2-subdev.c

index 4bfa3b3..8e9ebed 100644 (file)
@@ -362,8 +362,6 @@ static int ub913_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
        if (ret)
                return ret;
 
-       memset(fd, 0, sizeof(*fd));
-
        fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL;
 
        state = v4l2_subdev_lock_and_get_active_state(sd);
index dc394e2..6440223 100644 (file)
@@ -499,8 +499,6 @@ static int ub953_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
        if (ret)
                return ret;
 
-       memset(fd, 0, sizeof(*fd));
-
        fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
 
        state = v4l2_subdev_lock_and_get_active_state(sd);
index 8ba5750..b8f3e5c 100644 (file)
@@ -2786,8 +2786,6 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
        if (!ub960_pad_is_source(priv, pad))
                return -EINVAL;
 
-       memset(fd, 0, sizeof(*fd));
-
        fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
 
        state = v4l2_subdev_lock_and_get_active_state(&priv->sd);
index 5f93712..6cb20b4 100644 (file)
@@ -1114,8 +1114,6 @@ static int mipi_csis_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
        fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL;
        fd->num_entries = 1;
 
-       memset(entry, 0, sizeof(*entry));
-
        entry->flags = 0;
        entry->pixelcode = csis_fmt->code;
        entry->bus.csi2.vc = 0;
index 32b7d9c..9cb04ac 100644 (file)
@@ -306,6 +306,14 @@ static int call_set_selection(struct v4l2_subdev *sd,
               sd->ops->pad->set_selection(sd, state, sel);
 }
 
+static int call_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
+                              struct v4l2_mbus_frame_desc *fd)
+{
+       memset(fd, 0, sizeof(*fd));
+
+       return sd->ops->pad->get_frame_desc(sd, pad, fd);
+}
+
 static inline int check_edid(struct v4l2_subdev *sd,
                             struct v4l2_subdev_edid *edid)
 {
@@ -446,6 +454,7 @@ static const struct v4l2_subdev_pad_ops v4l2_subdev_call_pad_wrappers = {
        .set_edid               = call_set_edid,
        .dv_timings_cap         = call_dv_timings_cap,
        .enum_dv_timings        = call_enum_dv_timings,
+       .get_frame_desc         = call_get_frame_desc,
        .get_mbus_config        = call_get_mbus_config,
 };