Skip to content

Commit c38f332

Browse files
author
Kate Hsuan
committed
media: i2c: Use accessors for pad config 'try_*' fields
JIRA: https://issues.redhat.com/browse/RHEL-86821 Conflicts: Due to unspported drivers drivers/media/i2c/ov2680.c drivers/media/i2c/ov6650.c commit fd17e3a Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Date: Mon Oct 23 23:40:10 2023 +0200 The 'try_*' fields of the v4l2_subdev_pad_config structure are meant to be accessed through helper functions. Replace direct access with usage of the v4l2_subdev_get_pad_format(), v4l2_subdev_get_pad_crop() and v4l2_subdev_get_pad_compose() helpers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Kate Hsuan <hpa@redhat.com>
1 parent 2a96a5d commit c38f332

File tree

13 files changed

+18
-18
lines changed

13 files changed

+18
-18
lines changed

drivers/media/i2c/adv7183.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ static int adv7183_set_fmt(struct v4l2_subdev *sd,
443443
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
444444
decoder->fmt = *fmt;
445445
else
446-
sd_state->pads->try_fmt = *fmt;
446+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *fmt;
447447
return 0;
448448
}
449449

drivers/media/i2c/imx274.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,8 @@ static int __imx274_change_compose(struct stimx274 *imx274,
10191019
int best_goodness = INT_MIN;
10201020

10211021
if (which == V4L2_SUBDEV_FORMAT_TRY) {
1022-
cur_crop = &sd_state->pads->try_crop;
1023-
tgt_fmt = &sd_state->pads->try_fmt;
1022+
cur_crop = v4l2_subdev_get_pad_crop(&imx274->sd, sd_state, 0);
1023+
tgt_fmt = v4l2_subdev_get_pad_format(&imx274->sd, sd_state, 0);
10241024
} else {
10251025
cur_crop = &imx274->crop;
10261026
tgt_fmt = &imx274->format;
@@ -1113,7 +1113,7 @@ static int imx274_set_fmt(struct v4l2_subdev *sd,
11131113
*/
11141114
fmt->field = V4L2_FIELD_NONE;
11151115
if (format->which == V4L2_SUBDEV_FORMAT_TRY)
1116-
sd_state->pads->try_fmt = *fmt;
1116+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *fmt;
11171117
else
11181118
imx274->format = *fmt;
11191119

@@ -1144,8 +1144,8 @@ static int imx274_get_selection(struct v4l2_subdev *sd,
11441144
}
11451145

11461146
if (sel->which == V4L2_SUBDEV_FORMAT_TRY) {
1147-
src_crop = &sd_state->pads->try_crop;
1148-
src_fmt = &sd_state->pads->try_fmt;
1147+
src_crop = v4l2_subdev_get_pad_crop(sd, sd_state, 0);
1148+
src_fmt = v4l2_subdev_get_pad_format(sd, sd_state, 0);
11491149
} else {
11501150
src_crop = &imx274->crop;
11511151
src_fmt = &imx274->format;
@@ -1216,7 +1216,7 @@ static int imx274_set_selection_crop(struct stimx274 *imx274,
12161216
sel->r = new_crop;
12171217

12181218
if (sel->which == V4L2_SUBDEV_FORMAT_TRY)
1219-
tgt_crop = &sd_state->pads->try_crop;
1219+
tgt_crop = v4l2_subdev_get_pad_crop(&imx274->sd, sd_state, 0);
12201220
else
12211221
tgt_crop = &imx274->crop;
12221222

drivers/media/i2c/mt9m001.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ static int mt9m001_set_fmt(struct v4l2_subdev *sd,
411411

412412
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
413413
return mt9m001_s_fmt(sd, fmt, mf);
414-
sd_state->pads->try_fmt = *mf;
414+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *mf;
415415
return 0;
416416
}
417417

drivers/media/i2c/mt9m111.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ static int mt9m111_set_fmt(struct v4l2_subdev *sd,
678678
mf->xfer_func = V4L2_XFER_FUNC_DEFAULT;
679679

680680
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
681-
sd_state->pads->try_fmt = *mf;
681+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *mf;
682682
return 0;
683683
}
684684

drivers/media/i2c/mt9t112.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ static int mt9t112_set_fmt(struct v4l2_subdev *sd,
982982

983983
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
984984
return mt9t112_s_fmt(sd, mf);
985-
sd_state->pads->try_fmt = *mf;
985+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *mf;
986986

987987
return 0;
988988
}

drivers/media/i2c/mt9v011.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static int mt9v011_set_fmt(struct v4l2_subdev *sd,
358358

359359
set_res(sd);
360360
} else {
361-
sd_state->pads->try_fmt = *fmt;
361+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *fmt;
362362
}
363363

364364
return 0;

drivers/media/i2c/mt9v111.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ static int mt9v111_set_format(struct v4l2_subdev *subdev,
957957
static int mt9v111_init_state(struct v4l2_subdev *subdev,
958958
struct v4l2_subdev_state *sd_state)
959959
{
960-
sd_state->pads->try_fmt = mt9v111_def_fmt;
960+
*v4l2_subdev_get_pad_format(subdev, sd_state, 0) = mt9v111_def_fmt;
961961

962962
return 0;
963963
}

drivers/media/i2c/ov2640.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
996996
/* select format */
997997
priv->cfmt_code = mf->code;
998998
} else {
999-
sd_state->pads->try_fmt = *mf;
999+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *mf;
10001000
}
10011001
out:
10021002
mutex_unlock(&priv->lock);

drivers/media/i2c/ov772x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
12221222
mf->xfer_func = V4L2_XFER_FUNC_DEFAULT;
12231223

12241224
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
1225-
sd_state->pads->try_fmt = *mf;
1225+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *mf;
12261226
return 0;
12271227
}
12281228

drivers/media/i2c/ov9640.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static int ov9640_set_fmt(struct v4l2_subdev *sd,
547547
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
548548
return ov9640_s_fmt(sd, mf);
549549

550-
sd_state->pads->try_fmt = *mf;
550+
*v4l2_subdev_get_pad_format(sd, sd_state, 0) = *mf;
551551

552552
return 0;
553553
}

0 commit comments

Comments
 (0)