Rename media_entity_remote_pad() to media_entity_remote_source().
When it is called on a sink pad, return the linked source pad.
When it is called on a source pad, return NULL.
Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
/*
* media_entity_remote_pad -
*/
-struct media_entity_pad *media_entity_remote_pad(struct media_entity_pad *pad)
+struct media_entity_pad *media_entity_remote_source(struct media_entity_pad *pad)
{
unsigned int i;
+ if (!(pad->flags & MEDIA_PAD_FLAG_INPUT))
+ return NULL;
+
for (i = 0; i < pad->entity->info.links; ++i) {
struct media_entity_link *link = &pad->entity->links[i];
if (!(link->flags & MEDIA_LINK_FLAG_ACTIVE))
continue;
- if (link->source == pad)
- return link->sink;
-
if (link->sink == pad)
return link->source;
}
struct media_device *media_open(const char *name, int verbose);
void media_close(struct media_device *media);
-struct media_entity_pad *media_entity_remote_pad(struct media_entity_pad *pad);
+struct media_entity_pad *media_entity_remote_source(struct media_entity_pad *pad);
static inline unsigned int media_entity_type(struct media_entity *entity)
{