diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-12-21 10:33:37 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-02-06 08:31:51 +0100 |
commit | d10ac51e8a047e613bee8309739d122e48e00bcb (patch) | |
tree | 3d8ae0b5bb3db7aa45f90562fdfa1fcb4cf2bcc4 /drivers/media/mc/mc-entity.c | |
parent | d7ff69139908842adf824be4f50c7e9ac5886c04 (diff) | |
download | linux-d10ac51e8a047e613bee8309739d122e48e00bcb.tar.gz linux-d10ac51e8a047e613bee8309739d122e48e00bcb.tar.bz2 linux-d10ac51e8a047e613bee8309739d122e48e00bcb.zip |
media: mc: entity: Add pad iterator for media_pipeline
Add a media_pipeline_for_each_pad() macro to iterate over pads in a
pipeline. This should be used by driver as a replacement of the
media_graph_walk API, as iterating over the media_pipeline uses the
cached list of pads and is thus more efficient.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/mc/mc-entity.c')
-rw-r--r-- | drivers/media/mc/mc-entity.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 6ec2092d7f80..83797d6b1753 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -945,6 +945,24 @@ out: } EXPORT_SYMBOL_GPL(media_pipeline_alloc_start); +struct media_pad * +__media_pipeline_pad_iter_next(struct media_pipeline *pipe, + struct media_pipeline_pad_iter *iter, + struct media_pad *pad) +{ + if (!pad) + iter->cursor = pipe->pads.next; + + if (iter->cursor == &pipe->pads) + return NULL; + + pad = list_entry(iter->cursor, struct media_pipeline_pad, list)->pad; + iter->cursor = iter->cursor->next; + + return pad; +} +EXPORT_SYMBOL_GPL(__media_pipeline_pad_iter_next); + /* ----------------------------------------------------------------------------- * Links management */ |