summaryrefslogtreecommitdiff
path: root/drivers/media/mc/mc-entity.c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2023-04-25 13:23:00 +0300
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-05-25 16:21:22 +0200
commit4fd463e9389f9c5ea00a327b4ff01daf5869e774 (patch)
tree2252d50132ff64ca13f7df7fa95098ea84b85317 /drivers/media/mc/mc-entity.c
parent7ab9484332d9688df1ce4b87d3adfcb4ded9b903 (diff)
downloadlwn-4fd463e9389f9c5ea00a327b4ff01daf5869e774.tar.gz
lwn-4fd463e9389f9c5ea00a327b4ff01daf5869e774.zip
media: mc: Make media_get_pad_index() use pad type flag
Use the pad flag specifying the pad type instead of a boolean in preparation for internal source pads. Also make the loop variable unsigned. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/mc/mc-entity.c')
-rw-r--r--drivers/media/mc/mc-entity.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
index 8d6e7a68975a..83468d4a440b 100644
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -1052,25 +1052,19 @@ static void __media_entity_remove_link(struct media_entity *entity,
kfree(link);
}
-int media_get_pad_index(struct media_entity *entity, bool is_sink,
+int media_get_pad_index(struct media_entity *entity, u32 pad_type,
enum media_pad_signal_type sig_type)
{
- int i;
- bool pad_is_sink;
+ unsigned int i;
if (!entity)
return -EINVAL;
for (i = 0; i < entity->num_pads; i++) {
- if (entity->pads[i].flags & MEDIA_PAD_FL_SINK)
- pad_is_sink = true;
- else if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
- pad_is_sink = false;
- else
- continue; /* This is an error! */
-
- if (pad_is_sink != is_sink)
+ if ((entity->pads[i].flags &
+ (MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_SOURCE)) != pad_type)
continue;
+
if (entity->pads[i].sig_type == sig_type)
return i;
}