media: subdev: Add for_each_active_route() macro
JIRA: https://issues.redhat.com/browse/RHEL-67885 commit 837f92f070f6b7e877143eb168025995688b9756 Author: Jacopo Mondi <jacopo+renesas@jmondi.org> Date: Sun, 17 Oct 2021 20:24:42 +0200 Add a for_each_active_route() macro to replace the repeated pattern of iterating on the active routes of a routing table. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Kate Hsuan <hpa@redhat.com>
This commit is contained in:
parent
bd07faf4c9
commit
3cd03b9cd8
|
@ -140,6 +140,7 @@ ForEachMacros:
|
|||
- 'for_each_active_dev_scope'
|
||||
- 'for_each_active_drhd_unit'
|
||||
- 'for_each_active_iommu'
|
||||
- 'for_each_active_route'
|
||||
- 'for_each_aggr_pgid'
|
||||
- 'for_each_available_child_of_node'
|
||||
- 'for_each_bio'
|
||||
|
|
|
@ -1239,6 +1239,26 @@ int v4l2_subdev_set_routing(struct v4l2_subdev *sd,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_subdev_set_routing);
|
||||
|
||||
struct v4l2_subdev_route *
|
||||
__v4l2_subdev_next_active_route(const struct v4l2_subdev_krouting *routing,
|
||||
struct v4l2_subdev_route *route)
|
||||
{
|
||||
if (route)
|
||||
++route;
|
||||
else
|
||||
route = &routing->routes[0];
|
||||
|
||||
for (; route < routing->routes + routing->num_routes; ++route) {
|
||||
if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE))
|
||||
continue;
|
||||
|
||||
return route;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__v4l2_subdev_next_active_route);
|
||||
|
||||
#endif /* CONFIG_VIDEO_V4L2_SUBDEV_API */
|
||||
|
||||
#endif /* CONFIG_MEDIA_CONTROLLER */
|
||||
|
|
|
@ -1440,6 +1440,19 @@ int v4l2_subdev_set_routing(struct v4l2_subdev *sd,
|
|||
struct v4l2_subdev_state *state,
|
||||
const struct v4l2_subdev_krouting *routing);
|
||||
|
||||
struct v4l2_subdev_route *
|
||||
__v4l2_subdev_next_active_route(const struct v4l2_subdev_krouting *routing,
|
||||
struct v4l2_subdev_route *route);
|
||||
|
||||
/**
|
||||
* for_each_active_route - iterate on all active routes of a routing table
|
||||
* @routing: The routing table
|
||||
* @route: The route iterator
|
||||
*/
|
||||
#define for_each_active_route(routing, route) \
|
||||
for ((route) = NULL; \
|
||||
((route) = __v4l2_subdev_next_active_route((routing), (route)));)
|
||||
|
||||
#endif /* CONFIG_VIDEO_V4L2_SUBDEV_API */
|
||||
|
||||
#endif /* CONFIG_MEDIA_CONTROLLER */
|
||||
|
|
Loading…
Reference in New Issue