diff mbox series

[v4l-utils,4/8] utils: media-ctl: Support changed routing API

Message ID 20240402000033.4007-5-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series Support for the generic line-based metadata support | expand

Commit Message

Laurent Pinchart April 2, 2024, midnight UTC
From: Sakari Ailus <sakari.ailus@linux.intel.com>

Set len_routes of struct v4l2_subdev_routing. ENOSPC error code is no
longer used, i.e. having room for fewer routes than exist in the
configuration is not considered an error anymore.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 utils/media-ctl/libv4l2subdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index c614f4a2e0fd..e0df686e01c7 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -258,7 +258,7 @@  int v4l2_subdev_get_routing(struct media_entity *entity,
 	}
 
 	ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_ROUTING, &routing);
-	if (ret == -1 && errno != ENOSPC)
+	if (ret == -1)
 		return -errno;
 
 	if (!routing.num_routes) {
@@ -272,6 +272,7 @@  int v4l2_subdev_get_routing(struct media_entity *entity,
 		return -ENOMEM;
 
 	routing.routes = (uintptr_t)r;
+	routing.len_routes = routing.num_routes;
 	ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_ROUTING, &routing);
 	if (ret) {
 		free(r);
@@ -292,6 +293,7 @@  int v4l2_subdev_set_routing(struct media_entity *entity,
 		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
 		.routes = (uintptr_t)routes,
 		.num_routes = num_routes,
+		.len_routes = num_routes,
 	};
 	int ret;