public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
	hverkuil@xs4all.nl, javier@osg.samsung.com,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH v2 16/22] v4l: vsp1: Use media entity enumeration API
Date: Sat, 12 Dec 2015 13:31:57 -0200	[thread overview]
Message-ID: <20151212133157.0f4b4a7a@recife.lan> (raw)
In-Reply-To: <1448824823-10372-17-git-send-email-sakari.ailus@iki.fi>

Em Sun, 29 Nov 2015 21:20:17 +0200
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> From: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/media/platform/vsp1/vsp1_video.c | 45 ++++++++++++++++++++++----------
>  1 file changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> index ce10d86..b3fd2be 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -311,24 +311,35 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
>  					 struct vsp1_rwpf *output)
>  {
>  	struct vsp1_entity *entity;
> -	unsigned int entities = 0;
> +	struct media_entity_enum entities;

Again, entities is a bad name ;) we're reserving this name to
mean media_v2_entity. Using it with some other type makes
thinks confusing.

>  	struct media_pad *pad;
> +	int rval;
>  	bool bru_found = false;
>  
>  	input->location.left = 0;
>  	input->location.top = 0;
>  
> +	rval = media_entity_enum_init(
> +		&entities, input->entity.pads[RWPF_PAD_SOURCE].graph_obj.mdev);

Just put it on a single line. This kind of line breakage doesn't look nice ;)

> +	if (rval)
> +		return rval;
> +
>  	pad = media_entity_remote_pad(&input->entity.pads[RWPF_PAD_SOURCE]);
>  
>  	while (1) {
> -		if (pad == NULL)
> -			return -EPIPE;
> +		if (pad == NULL) {
> +			rval = -EPIPE;
> +			goto out;
> +		}
>  
>  		/* We've reached a video node, that shouldn't have happened. */
> -		if (!is_media_entity_v4l2_subdev(pad->entity))
> -			return -EPIPE;
> +		if (!is_media_entity_v4l2_subdev(pad->entity)) {
> +			rval = -EPIPE;
> +			goto out;
> +		}
>  
> -		entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> +		entity = to_vsp1_entity(
> +			media_entity_to_v4l2_subdev(pad->entity));
>  
>  		/* A BRU is present in the pipeline, store the compose rectangle
>  		 * location in the input RPF for use when configuring the RPF.
> @@ -351,15 +362,18 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
>  			break;
>  
>  		/* Ensure the branch has no loop. */
> -		if (entities & (1 << media_entity_id(&entity->subdev.entity)))
> -			return -EPIPE;
> -
> -		entities |= 1 << media_entity_id(&entity->subdev.entity);
> +		if (media_entity_enum_test_and_set(&entities,
> +						   &entity->subdev.entity)) {
> +			rval = -EPIPE;
> +			goto out;
> +		}
>  
>  		/* UDS can't be chained. */
>  		if (entity->type == VSP1_ENTITY_UDS) {
> -			if (pipe->uds)
> -				return -EPIPE;
> +			if (pipe->uds) {
> +				rval = -EPIPE;
> +				goto out;
> +			}
>  
>  			pipe->uds = entity;
>  			pipe->uds_input = bru_found ? pipe->bru
> @@ -377,9 +391,12 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
>  
>  	/* The last entity must be the output WPF. */
>  	if (entity != &output->entity)
> -		return -EPIPE;
> +		rval = -EPIPE;
>  
> -	return 0;
> +out:
> +	media_entity_enum_cleanup(&entities);
> +
> +	return rval;
>  }
>  
>  static void __vsp1_pipeline_cleanup(struct vsp1_pipeline *pipe)

  reply	other threads:[~2015-12-12 15:32 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-29 19:20 [PATCH v2 00/22] Unrestricted media entity ID range support Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 01/22] media: Enforce single entity->pipe in a pipeline Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 02/22] media: Introduce internal index for media entities Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 03/22] media: Add an API to manage entity enumerations Sakari Ailus
2015-12-12 15:09   ` Mauro Carvalho Chehab
2015-12-13 22:12     ` Sakari Ailus
2015-12-14  0:54       ` Mauro Carvalho Chehab
2015-12-15 23:16         ` Sakari Ailus
2015-12-16  8:04           ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 04/22] media: Move struct media_entity_graph definition up Sakari Ailus
2015-12-12 15:12   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 05/22] media: Add KernelDoc documentation for struct media_entity_graph Sakari Ailus
2015-12-12 15:15   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 06/22] media: Move media graph state for streamon/off to the pipeline Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 07/22] media: Amend media graph walk API by init and cleanup functions Sakari Ailus
2015-12-12 15:18   ` Mauro Carvalho Chehab
2015-12-12 15:19   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 08/22] media: Use the new media_entity_graph_walk_start() Sakari Ailus
2015-12-12 15:18   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 09/22] v4l: omap3isp: Use the new media_entity_graph_walk_start() interface Sakari Ailus
2015-12-12 15:20   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 10/22] v4l: exynos4-is: " Sakari Ailus
2015-12-12 15:21   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 11/22] v4l: xilinx: " Sakari Ailus
2015-12-12 15:22   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 12/22] v4l: vsp1: " Sakari Ailus
2015-12-12 15:24   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 13/22] media: Use entity enums in graph walk Sakari Ailus
2015-12-12 15:25   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 14/22] media: Keep using the same graph walk object for a given pipeline Sakari Ailus
2015-12-12 15:26   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 15/22] v4l: omap3isp: Use media entity enumeration API Sakari Ailus
2015-12-12 15:29   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 16/22] v4l: vsp1: " Sakari Ailus
2015-12-12 15:31   ` Mauro Carvalho Chehab [this message]
2015-11-29 19:20 ` [PATCH v2 17/22] staging: v4l: omap4iss: Fix sub-device power management code Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 18/22] staging: v4l: omap4iss: Use media entity enum API Sakari Ailus
2015-12-12 15:33   ` Mauro Carvalho Chehab
2015-11-29 19:20 ` [PATCH v2 19/22] staging: v4l: omap4iss: Use the new media_entity_graph_walk_start() interface Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 20/22] staging: v4l: davinci_vpbe: " Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 21/22] media: Rename MEDIA_ENTITY_ENUM_MAX_ID as MEDIA_ENTITY_ENUM_STACK_ALLOC Sakari Ailus
2015-11-29 19:20 ` [PATCH v2 22/22] media: Update media graph walk documentation for the changed API Sakari Ailus
2015-12-12 15:35   ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151212133157.0f4b4a7a@recife.lan \
    --to=mchehab@osg.samsung.com \
    --cc=hverkuil@xs4all.nl \
    --cc=javier@osg.samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox