media: entity: Add media_entity_has_route() function

This is a wrapper around the media entity has_route operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
State: pending
This commit is contained in:
Laurent Pinchart
2014-03-26 04:01:46 +01:00
committed by Michal Simek
parent e75720bc65
commit 2ffcaf17d5
2 changed files with 32 additions and 0 deletions

View File

@@ -314,6 +314,35 @@ static struct media_entity *stack_pop(struct media_graph *graph)
#define link_top(en) ((en)->stack[(en)->top].link)
#define stack_top(en) ((en)->stack[(en)->top].entity)
/**
* media_entity_has_route - Check if two entity pads are connected internally
* @entity: The entity
* @pad0: The first pad index
* @pad1: The second pad index
*
* This function can be used to check whether two pads of an entity are
* connected internally in the entity.
*
* The caller must hold entity->source->parent->mutex.
*
* Return: true if the pads are connected internally and false otherwise.
*/
bool media_entity_has_route(struct media_entity *entity, unsigned int pad0,
unsigned int pad1)
{
if (pad0 >= entity->num_pads || pad1 >= entity->num_pads)
return false;
if (pad0 == pad1)
return true;
if (!entity->ops || !entity->ops->has_route)
return true;
return entity->ops->has_route(entity, pad0, pad1);
}
EXPORT_SYMBOL_GPL(media_entity_has_route);
/**
* media_graph_walk_init - Allocate resources for graph walk
* @graph: Media graph structure that will be used to walk the graph

View File

@@ -1110,6 +1110,9 @@ __must_check int media_graph_walk_init(
*/
void media_graph_walk_cleanup(struct media_graph *graph);
bool media_entity_has_route(struct media_entity *entity, unsigned int sink,
unsigned int source);
/**
* media_graph_walk_start - Start walking the media graph at a
* given entity