Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l: subdev: Return routes set using S_ROUTING

Return the routes set using S_ROUTING back to the user. Also reflect this
in documentation.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Sakari Ailus and committed by
Hans Verkuil
91e99e5a 83a22a07

+13 -6
+2 -5
Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst
··· 44 44 ``VIDIOC_SUBDEV_G_ROUTING`` ioctl and application may enable or disable routes 45 45 with the ``VIDIOC_SUBDEV_S_ROUTING`` ioctl, by adding or removing routes and 46 46 setting or clearing flags of the ``flags`` field of a struct 47 - :c:type:`v4l2_subdev_route`. 47 + :c:type:`v4l2_subdev_route`. Similarly to ``VIDIOC_SUBDEV_G_ROUTING``, also 48 + ``VIDIOC_SUBDEV_S_ROUTING`` returns the routes back to the user. 48 49 49 50 All stream configurations are reset when ``VIDIOC_SUBDEV_S_ROUTING`` is called. 50 51 This means that the userspace must reconfigure all stream formats and selections ··· 153 152 On success 0 is returned, on error -1 and the ``errno`` variable is set 154 153 appropriately. The generic error codes are described at the 155 154 :ref:`Generic Error Codes <gen-errors>` chapter. 156 - 157 - ENOSPC 158 - The application provided ``num_routes`` is not big enough to contain 159 - all the available routes the subdevice exposes. 160 155 161 156 EINVAL 162 157 The sink or source pad identifiers reference a non-existing pad or reference
+11 -1
drivers/media/v4l2-core/v4l2-subdev.c
··· 1017 1017 krouting.len_routes = routing->len_routes; 1018 1018 krouting.routes = routes; 1019 1019 1020 - return v4l2_subdev_call(sd, pad, set_routing, state, 1020 + rval = v4l2_subdev_call(sd, pad, set_routing, state, 1021 1021 routing->which, &krouting); 1022 + if (rval < 0) 1023 + return rval; 1024 + 1025 + memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes, 1026 + state->routing.routes, 1027 + min(state->routing.num_routes, routing->len_routes) * 1028 + sizeof(*state->routing.routes)); 1029 + routing->num_routes = state->routing.num_routes; 1030 + 1031 + return 0; 1022 1032 } 1023 1033 1024 1034 case VIDIOC_SUBDEV_G_CLIENT_CAP: {