summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/s5k5baf.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-12-13 16:00:04 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-12-13 16:52:35 +0100
commit287fe160834acdf9c44e5b73676180c6dbdedf76 (patch)
tree46b10e2d8c2aecd1c7d6240e4c82baceeeb6d823 /drivers/media/i2c/s5k5baf.c
parentmedia: v4l: subdev: Move out subdev state lock macros outside CONFIG_MEDIA_CO... (diff)
downloadlinux-287fe160834acdf9c44e5b73676180c6dbdedf76.tar.xz
linux-287fe160834acdf9c44e5b73676180c6dbdedf76.zip
media: v4l2-subdev: Turn .[gs]_frame_interval into pad operations
The subdev .[gs]_frame_interval are video operations, but they operate on pads (and even on streams). Not only is this confusing, it causes practical issues for drivers as the operations don't receive a subdev state pointer, requiring manual state handling. To improve the situation, turn the operations into pad operations, and extend them to receive a state pointer like other pad operations. While at it, rename the operations to .[gs]et_frame_interval at the same time to match the naming scheme of other pad operations. This isn't strictly necessary, but given that all drivers using those operations need to be modified, handling the rename separately would generate more churn for very little gain (if at all). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-media Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for tegra-video Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/i2c/s5k5baf.c')
-rw-r--r--drivers/media/i2c/s5k5baf.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 03ccfb0e1e11..2fd1ecfeb086 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -1118,8 +1118,9 @@ out:
return ret;
}
-static int s5k5baf_g_frame_interval(struct v4l2_subdev *sd,
- struct v4l2_subdev_frame_interval *fi)
+static int s5k5baf_get_frame_interval(struct v4l2_subdev *sd,
+ struct v4l2_subdev_state *sd_state,
+ struct v4l2_subdev_frame_interval *fi)
{
struct s5k5baf *state = to_s5k5baf(sd);
@@ -1131,8 +1132,8 @@ static int s5k5baf_g_frame_interval(struct v4l2_subdev *sd,
return 0;
}
-static void s5k5baf_set_frame_interval(struct s5k5baf *state,
- struct v4l2_subdev_frame_interval *fi)
+static void __s5k5baf_set_frame_interval(struct s5k5baf *state,
+ struct v4l2_subdev_frame_interval *fi)
{
struct v4l2_fract *i = &fi->interval;
@@ -1155,13 +1156,14 @@ static void s5k5baf_set_frame_interval(struct s5k5baf *state,
state->fiv);
}
-static int s5k5baf_s_frame_interval(struct v4l2_subdev *sd,
- struct v4l2_subdev_frame_interval *fi)
+static int s5k5baf_set_frame_interval(struct v4l2_subdev *sd,
+ struct v4l2_subdev_state *sd_state,
+ struct v4l2_subdev_frame_interval *fi)
{
struct s5k5baf *state = to_s5k5baf(sd);
mutex_lock(&state->lock);
- s5k5baf_set_frame_interval(state, fi);
+ __s5k5baf_set_frame_interval(state, fi);
mutex_unlock(&state->lock);
return 0;
}
@@ -1526,11 +1528,11 @@ static const struct v4l2_subdev_pad_ops s5k5baf_pad_ops = {
.set_fmt = s5k5baf_set_fmt,
.get_selection = s5k5baf_get_selection,
.set_selection = s5k5baf_set_selection,
+ .get_frame_interval = s5k5baf_get_frame_interval,
+ .set_frame_interval = s5k5baf_set_frame_interval,
};
static const struct v4l2_subdev_video_ops s5k5baf_video_ops = {
- .g_frame_interval = s5k5baf_g_frame_interval,
- .s_frame_interval = s5k5baf_s_frame_interval,
.s_stream = s5k5baf_s_stream,
};