This way the pads are always passed to the has_route() op sink pad first.
Makes sense.

Signed-off-by: Sakari Ailus <[email protected]>
---
Hi Niklas,

This should make it easier to implement the has_route() op in drivers.

Feel free to merge this to "[PATCH 02/32] media: entity: Add
media_entity_has_route() function" if you like, or add separately after
the second patch.

 drivers/media/media-entity.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 747adcb..520f3f6 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -254,6 +254,10 @@ bool media_entity_has_route(struct media_entity *entity, 
unsigned int pad0,
        if (!entity->ops || !entity->ops->has_route)
                return true;
 
+       if (entity->pads[pad0].flags & MEDIA_PAD_FL_SOURCE
+           && entity->pads[pad1].flags & MEDIA_PAD_FL_SINK)
+               swap(pad0, pad1);
+
        return entity->ops->has_route(entity, pad0, pad1);
 }
 EXPORT_SYMBOL_GPL(media_entity_has_route);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to