From: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx> Use the new subdev state cleanup macros. Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx> --- drivers/media/i2c/ds90ub913.c | 11 +++-------- drivers/media/i2c/ds90ub953.c | 11 +++-------- drivers/media/i2c/ds90ub960.c | 27 ++++++++------------------- 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c index ca9bb29dab89..7a53b68db1b4 100644 --- a/drivers/media/i2c/ds90ub913.c +++ b/drivers/media/i2c/ds90ub913.c @@ -351,7 +351,6 @@ static int ub913_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, const struct v4l2_subdev_krouting *routing; struct v4l2_mbus_frame_desc source_fd; struct v4l2_subdev_route *route; - struct v4l2_subdev_state *state; int ret; if (pad != UB913_PAD_SOURCE) @@ -364,7 +363,7 @@ static int ub913_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL; - state = v4l2_subdev_lock_and_get_active_state(sd); + CLASS(v4l2_subdev_lock_and_get_active_state, state)(sd); routing = &state->routing; @@ -382,8 +381,7 @@ static int ub913_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, if (i == source_fd.num_entries) { dev_err(&priv->client->dev, "Failed to find stream from source frame desc\n"); - ret = -EPIPE; - goto out_unlock; + return -EPIPE; } fd->entry[fd->num_entries].stream = route->source_stream; @@ -395,10 +393,7 @@ static int ub913_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, fd->num_entries++; } -out_unlock: - v4l2_subdev_unlock_state(state); - - return ret; + return 0; } static int ub913_set_fmt(struct v4l2_subdev *sd, diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index 16f88db14981..131b1523c3a5 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -488,7 +488,6 @@ static int ub953_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, struct ub953_data *priv = sd_to_ub953(sd); struct v4l2_mbus_frame_desc source_fd; struct v4l2_subdev_route *route; - struct v4l2_subdev_state *state; int ret; if (pad != UB953_PAD_SOURCE) @@ -501,7 +500,7 @@ static int ub953_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; - state = v4l2_subdev_lock_and_get_active_state(sd); + CLASS(v4l2_subdev_lock_and_get_active_state, state)(sd); for_each_active_route(&state->routing, route) { struct v4l2_mbus_frame_desc_entry *source_entry = NULL; @@ -520,8 +519,7 @@ static int ub953_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, if (!source_entry) { dev_err(&priv->client->dev, "Failed to find stream from source frame desc\n"); - ret = -EPIPE; - goto out_unlock; + return -EPIPE; } fd->entry[fd->num_entries].stream = route->source_stream; @@ -536,10 +534,7 @@ static int ub953_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, fd->num_entries++; } -out_unlock: - v4l2_subdev_unlock_state(state); - - return ret; + return 0; } static int ub953_set_fmt(struct v4l2_subdev *sd, diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index ffe5f25f8647..e873611bf5c7 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -2777,7 +2777,6 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, { struct ub960_data *priv = sd_to_ub960(sd); struct v4l2_subdev_route *route; - struct v4l2_subdev_state *state; int ret = 0; struct device *dev = &priv->client->dev; u8 vc_map[UB960_MAX_RX_NPORTS] = {}; @@ -2787,7 +2786,7 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; - state = v4l2_subdev_lock_and_get_active_state(&priv->sd); + CLASS(v4l2_subdev_lock_and_get_active_state, state)(&priv->sd); ub960_get_vc_maps(priv, state, vc_map); @@ -2810,7 +2809,7 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, dev_err(dev, "Failed to get source frame desc for pad %u\n", route->sink_pad); - goto out_unlock; + return ret; } for (i = 0; i < source_fd.num_entries; i++) { @@ -2823,8 +2822,7 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, if (!source_entry) { dev_err(dev, "Failed to find stream from source frame desc\n"); - ret = -EPIPE; - goto out_unlock; + return -EPIPE; } fd->entry[fd->num_entries].stream = route->source_stream; @@ -2844,16 +2842,13 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, fmt = v4l2_subdev_state_get_format(state, pad, route->source_stream); - if (!fmt) { - ret = -EINVAL; - goto out_unlock; - } + if (!fmt) + return -EINVAL; ub960_fmt = ub960_find_format(fmt->code); if (!ub960_fmt) { dev_err(dev, "Unable to find format\n"); - ret = -EINVAL; - goto out_unlock; + return -EINVAL; } fd->entry[fd->num_entries].bus.csi2.dt = @@ -2863,10 +2858,7 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, fd->num_entries++; } -out_unlock: - v4l2_subdev_unlock_state(state); - - return ret; + return 0; } static int ub960_set_fmt(struct v4l2_subdev *sd, @@ -2944,14 +2936,13 @@ static int ub960_log_status(struct v4l2_subdev *sd) { struct ub960_data *priv = sd_to_ub960(sd); struct device *dev = &priv->client->dev; - struct v4l2_subdev_state *state; unsigned int nport; unsigned int i; u16 v16 = 0; u8 v = 0; u8 id[UB960_SR_FPD3_RX_ID_LEN]; - state = v4l2_subdev_lock_and_get_active_state(sd); + CLASS(v4l2_subdev_lock_and_get_active_state, state)(sd); for (i = 0; i < sizeof(id); i++) ub960_read(priv, UB960_SR_FPD3_RX_ID(i), &id[i]); @@ -3078,8 +3069,6 @@ static int ub960_log_status(struct v4l2_subdev *sd) } } - v4l2_subdev_unlock_state(state); - return 0; } -- 2.43.0