[PATCH v12 24/30] media: subdev: use for_each_active_route() in v4l2_subdev_init_stream_configs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use for_each_active_route() in v4l2_subdev_init_stream_configs().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index f3219c8a6317..97c77b32ca1d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -929,8 +929,8 @@ static int
 v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_configs,
 				const struct v4l2_subdev_krouting *routing)
 {
+	struct v4l2_subdev_route *route;
 	u32 num_configs = 0;
-	unsigned int i;
 	u32 format_idx = 0;
 
 	kvfree(stream_configs->configs);
@@ -938,12 +938,7 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config
 	stream_configs->num_configs = 0;
 
 	/* Count number of formats needed */
-	for (i = 0; i < routing->num_routes; ++i) {
-		struct v4l2_subdev_route *route = &routing->routes[i];
-
-		if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE))
-			continue;
-
+	for_each_active_route(routing, route) {
 		/*
 		 * Each route needs a format on both ends of the route, except
 		 * for source streams which only need one format.
@@ -968,13 +963,9 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config
 	 * Fill in the 'pad' and stream' value for each item in the array from
 	 * the routing table
 	 */
-	for (i = 0; i < routing->num_routes; ++i) {
-		struct v4l2_subdev_route *route = &routing->routes[i];
+	for_each_active_route(routing, route) {
 		u32 idx;
 
-		if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE))
-			continue;
-
 		if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_SOURCE)) {
 			idx = format_idx++;
 
-- 
2.34.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux