diff mbox series

[v12,25/30] media: subdev: use for_each_active_route() in v4l2_link_validate_get_streams()

Message ID 20220727103639.581567-26-tomi.valkeinen@ideasonboard.com
State New
Headers show
Series v4l: routing and streams support | expand

Commit Message

Tomi Valkeinen July 27, 2022, 10:36 a.m. UTC
Use for_each_active_route() in v4l2_link_validate_get_streams().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 97c77b32ca1d..2fc999b1b6c1 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1099,10 +1099,10 @@  static int v4l2_link_validate_get_streams(struct media_link *link,
 {
 	static const u32 default_streams[] = { 0 };
 	struct v4l2_subdev_krouting *routing;
+	struct v4l2_subdev_route *route;
 	struct v4l2_subdev *subdev;
 	u32 num_streams;
 	u32 *streams;
-	unsigned int i;
 	struct v4l2_subdev_state *state;
 	int ret;
 
@@ -1128,16 +1128,12 @@  static int v4l2_link_validate_get_streams(struct media_link *link,
 
 	num_streams = 0;
 
-	for (i = 0; i < routing->num_routes; ++i) {
-		struct v4l2_subdev_route *route = &routing->routes[i];
+	for_each_active_route(routing, route) {
 		int j;
 		u32 route_pad;
 		u32 route_stream;
 		u32 link_pad;
 
-		if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE))
-			continue;
-
 		if (is_source) {
 			route_pad = route->source_pad;
 			route_stream = route->source_stream;