On 03/10/2023 15:08, Sakari Ailus wrote:
Add trivial S_ROUTING IOCTL support for drivers where routing is static.
Essentially this means returning the same information G_ROUTING call would
have done.
Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
drivers/media/v4l2-core/v4l2-subdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index dd48e7e549fb..7d7028de581a 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -894,6 +894,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
struct v4l2_subdev_krouting krouting = {};
unsigned int i;
+ if (!v4l2_subdev_has_op(sd, pad, set_routing))
+ goto do_vidioc_subdev_g_routing;
+
if (!v4l2_subdev_enable_streams_api)
return -ENOIOCTLCMD;
@@ -939,6 +942,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
routing->which, &krouting);
if (rval < 0)
return rval;
+do_vidioc_subdev_g_routing:
+ ;
}
fallthrough;
As Hans mentioned in an earlier comment, the code would perhaps be more
readable if the s_routing ioctl code would just handle the g_routing
part itself. Or we could have a helper function, called by both
s_routing and g_routing. It looks very confusing with these patches.
Tomi