[PATCH 2/4] media: v4l2-subdev: Use state cleanup macros

Tomi Valkeinen posted 4 patches 2 months, 1 week ago
[PATCH 2/4] media: v4l2-subdev: Use state cleanup macros
Posted by Tomi Valkeinen 2 months, 1 week ago
From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>

Use the new subdev state cleanup macros.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 7c5812d55315..1e701c340d0b 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1478,10 +1478,9 @@ bool v4l2_subdev_has_pad_interdep(struct media_entity *entity,
 {
 	struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
 	struct v4l2_subdev_krouting *routing;
-	struct v4l2_subdev_state *state;
 	unsigned int i;
 
-	state = v4l2_subdev_lock_and_get_active_state(sd);
+	CLASS(v4l2_subdev_lock_and_get_active_state, state)(sd);
 
 	routing = &state->routing;
 
@@ -1492,14 +1491,10 @@ bool v4l2_subdev_has_pad_interdep(struct media_entity *entity,
 			continue;
 
 		if ((route->sink_pad == pad0 && route->source_pad == pad1) ||
-		    (route->source_pad == pad0 && route->sink_pad == pad1)) {
-			v4l2_subdev_unlock_state(state);
+		    (route->source_pad == pad0 && route->sink_pad == pad1))
 			return true;
-		}
 	}
 
-	v4l2_subdev_unlock_state(state);
-
 	return false;
 }
 EXPORT_SYMBOL_GPL(v4l2_subdev_has_pad_interdep);
@@ -2393,7 +2388,6 @@ EXPORT_SYMBOL_GPL(v4l2_subdev_disable_streams);
 
 int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable)
 {
-	struct v4l2_subdev_state *state;
 	struct v4l2_subdev_route *route;
 	struct media_pad *pad;
 	u64 source_mask = 0;
@@ -2419,12 +2413,10 @@ int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable)
 		 * As there's a single source pad, just collect all the source
 		 * streams.
 		 */
-		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)
 			source_mask |= BIT_ULL(route->source_stream);
-
-		v4l2_subdev_unlock_state(state);
 	} else {
 		/*
 		 * For non-streams subdevices, there's a single implicit stream

-- 
2.43.0