diff mbox series

[2/2] media: entity: Use dedicated data link iterator

Message ID 20220621163457.766496-3-djrscally@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add iterator for an entity's data links | expand

Commit Message

Daniel Scally June 21, 2022, 4:34 p.m. UTC
Where iteration over links for an entity is clearly assuming that
all of those links are data links, use the new iterator to guarantee
that that assumption is met.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
 drivers/media/mc/mc-entity.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart June 22, 2022, 9:18 a.m. UTC | #1
Hi Dan,

Thank you for the patch.

On Tue, Jun 21, 2022 at 05:34:57PM +0100, Daniel Scally wrote:
> Where iteration over links for an entity is clearly assuming that
> all of those links are data links, use the new iterator to guarantee
> that that assumption is met.
> 
> Signed-off-by: Daniel Scally <djrscally@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/mc/mc-entity.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
> index 11f5207f73aa..f46690fd141d 100644
> --- a/drivers/media/mc/mc-entity.c
> +++ b/drivers/media/mc/mc-entity.c
> @@ -449,7 +449,7 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
>  		bitmap_zero(active, entity->num_pads);
>  		bitmap_fill(has_no_links, entity->num_pads);
>  
> -		list_for_each_entry(link, &entity->links, list) {
> +		for_each_media_entity_data_link(entity, link) {
>  			struct media_pad *pad = link->sink->entity == entity
>  						? link->sink : link->source;
>  
> @@ -888,7 +888,7 @@ media_entity_find_link(struct media_pad *source, struct media_pad *sink)
>  {
>  	struct media_link *link;
>  
> -	list_for_each_entry(link, &source->entity->links, list) {
> +	for_each_media_entity_data_link(source->entity, link) {
>  		if (link->source->entity == source->entity &&
>  		    link->source->index == source->index &&
>  		    link->sink->entity == sink->entity &&
> @@ -904,7 +904,7 @@ struct media_pad *media_entity_remote_pad(const struct media_pad *pad)
>  {
>  	struct media_link *link;
>  
> -	list_for_each_entry(link, &pad->entity->links, list) {
> +	for_each_media_entity_data_link(pad->entity, link) {
>  		if (!(link->flags & MEDIA_LNK_FL_ENABLED))
>  			continue;
>
diff mbox series

Patch

diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
index 11f5207f73aa..f46690fd141d 100644
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -449,7 +449,7 @@  __must_check int __media_pipeline_start(struct media_entity *entity,
 		bitmap_zero(active, entity->num_pads);
 		bitmap_fill(has_no_links, entity->num_pads);
 
-		list_for_each_entry(link, &entity->links, list) {
+		for_each_media_entity_data_link(entity, link) {
 			struct media_pad *pad = link->sink->entity == entity
 						? link->sink : link->source;
 
@@ -888,7 +888,7 @@  media_entity_find_link(struct media_pad *source, struct media_pad *sink)
 {
 	struct media_link *link;
 
-	list_for_each_entry(link, &source->entity->links, list) {
+	for_each_media_entity_data_link(source->entity, link) {
 		if (link->source->entity == source->entity &&
 		    link->source->index == source->index &&
 		    link->sink->entity == sink->entity &&
@@ -904,7 +904,7 @@  struct media_pad *media_entity_remote_pad(const struct media_pad *pad)
 {
 	struct media_link *link;
 
-	list_for_each_entry(link, &pad->entity->links, list) {
+	for_each_media_entity_data_link(pad->entity, link) {
 		if (!(link->flags & MEDIA_LNK_FL_ENABLED))
 			continue;