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,
javier@osg.samsung.com, hverkuil@xs4all.nl,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH 17/19] staging: v4l: omap4iss: Use media entity enum API
Date: Wed, 28 Oct 2015 11:01:19 +0900 [thread overview]
Message-ID: <20151028110119.596a3494@concha.lan> (raw)
In-Reply-To: <1445900510-1398-18-git-send-email-sakari.ailus@iki.fi>
Em Tue, 27 Oct 2015 01:01:48 +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>
Where are the comments?
> ---
> drivers/staging/media/omap4iss/iss.c | 15 +++++++++++----
> drivers/staging/media/omap4iss/iss.h | 4 ++--
> drivers/staging/media/omap4iss/iss_video.c | 13 +++++++++++--
> drivers/staging/media/omap4iss/iss_video.h | 4 ++--
> 4 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index c097fd5..7b0561f 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -606,7 +606,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
> * crashed. Mark it as such, the ISS will be reset when
> * applications will release it.
> */
> - iss->crashed |= 1U << media_entity_id(&subdev->entity);
> + media_entity_enum_set(&iss->crashed, &subdev->entity);
> failure = -ETIMEDOUT;
> }
> }
> @@ -641,7 +641,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
> * pipeline won't start anyway (those entities would then likely fail to
> * stop, making the problem worse).
> */
> - if (pipe->entities & iss->crashed)
> + if (media_entity_enum_intersects(&pipe->entities, &iss->crashed))
> return -EIO;
Should return error if the enum sizes are different.
>
> spin_lock_irqsave(&pipe->lock, flags);
> @@ -761,7 +761,8 @@ static int iss_reset(struct iss_device *iss)
> return -ETIMEDOUT;
> }
>
> - iss->crashed = 0;
> + media_entity_enum_zero(&iss->crashed);
> +
> return 0;
> }
>
> @@ -1090,7 +1091,7 @@ void omap4iss_put(struct iss_device *iss)
> * be worth investigating whether resetting the ISP only can't
> * fix the problem in some cases.
> */
> - if (iss->crashed)
> + if (!media_entity_enum_empty(&iss->crashed))
> iss_reset(iss);
> iss_disable_clocks(iss);
> }
> @@ -1490,6 +1491,10 @@ static int iss_probe(struct platform_device *pdev)
> if (ret < 0)
> goto error_modules;
>
> + ret = media_entity_enum_init(&iss->crashed, &iss->media_dev);
> + if (ret)
> + goto error_entities;
> +
> ret = iss_create_pads_links(iss);
> if (ret < 0)
> goto error_entities;
> @@ -1500,6 +1505,7 @@ static int iss_probe(struct platform_device *pdev)
>
> error_entities:
> iss_unregister_entities(iss);
> + media_entity_enum_cleanup(&iss->crashed);
> error_modules:
> iss_cleanup_modules(iss);
> error_iss:
> @@ -1517,6 +1523,7 @@ static int iss_remove(struct platform_device *pdev)
> struct iss_device *iss = platform_get_drvdata(pdev);
>
> iss_unregister_entities(iss);
> + media_entity_enum_cleanup(&iss->crashed);
> iss_cleanup_modules(iss);
>
> return 0;
> diff --git a/drivers/staging/media/omap4iss/iss.h b/drivers/staging/media/omap4iss/iss.h
> index 35df8b4..5dd0d99 100644
> --- a/drivers/staging/media/omap4iss/iss.h
> +++ b/drivers/staging/media/omap4iss/iss.h
> @@ -82,7 +82,7 @@ struct iss_reg {
> /*
> * struct iss_device - ISS device structure.
> * @syscon: Regmap for the syscon register space
> - * @crashed: Bitmask of crashed entities (indexed by entity ID)
> + * @crashed: Crashed entities
> */
> struct iss_device {
> struct v4l2_device v4l2_dev;
> @@ -101,7 +101,7 @@ struct iss_device {
> u64 raw_dmamask;
>
> struct mutex iss_mutex; /* For handling ref_count field */
> - unsigned int crashed;
> + struct media_entity_enum crashed;
> int has_context;
> int ref_count;
>
> diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> index cbe5783..b56f999 100644
> --- a/drivers/staging/media/omap4iss/iss_video.c
> +++ b/drivers/staging/media/omap4iss/iss_video.c
> @@ -761,6 +761,10 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
> if (type != video->type)
> return -EINVAL;
>
> + ret = media_entity_enum_init(&pipe->entities, entity->graph_obj.mdev);
> + if (ret)
> + return ret;
> +
> mutex_lock(&video->stream_lock);
>
> /* Start streaming on the pipeline. No link touching an entity in the
> @@ -771,7 +775,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
> pipe->external = NULL;
> pipe->external_rate = 0;
> pipe->external_bpp = 0;
> - pipe->entities = 0;
>
> if (video->iss->pdata->set_constraints)
> video->iss->pdata->set_constraints(video->iss, true);
> @@ -783,7 +786,7 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
> entity = &video->video.entity;
> media_entity_graph_walk_start(&graph, entity);
> while ((entity = media_entity_graph_walk_next(&graph)))
> - pipe->entities |= 1 << media_entity_id(entity);
> + media_entity_enum_set(&pipe->entities, entity);
>
> /* Verify that the currently configured format matches the output of
> * the connected subdev.
> @@ -854,6 +857,7 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
> }
>
> mutex_unlock(&video->stream_lock);
> +
> return 0;
>
> err_omap4iss_set_stream:
> @@ -866,6 +870,9 @@ err_media_entity_pipeline_start:
> video->queue = NULL;
>
> mutex_unlock(&video->stream_lock);
> +
> + media_entity_enum_cleanup(&pipe->entities);
> +
> return ret;
> }
>
> @@ -903,6 +910,8 @@ iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
> vb2_streamoff(&vfh->queue, type);
> video->queue = NULL;
>
> + media_entity_enum_cleanup(&pipe->entities);
> +
> if (video->iss->pdata->set_constraints)
> video->iss->pdata->set_constraints(video->iss, false);
> media_entity_pipeline_stop(&video->video.entity);
> diff --git a/drivers/staging/media/omap4iss/iss_video.h b/drivers/staging/media/omap4iss/iss_video.h
> index f11fce2..b5d3a96 100644
> --- a/drivers/staging/media/omap4iss/iss_video.h
> +++ b/drivers/staging/media/omap4iss/iss_video.h
> @@ -77,7 +77,7 @@ enum iss_pipeline_state {
>
> /*
> * struct iss_pipeline - An OMAP4 ISS hardware pipeline
> - * @entities: Bitmask of entities in the pipeline (indexed by entity ID)
> + * @entities: Entities in the pipeline
> * @error: A hardware error occurred during capture
> */
> struct iss_pipeline {
> @@ -87,7 +87,7 @@ struct iss_pipeline {
> enum iss_pipeline_stream_state stream_state;
> struct iss_video *input;
> struct iss_video *output;
> - unsigned int entities;
> + struct media_entity_enum entities;
> atomic_t frame_number;
> bool do_propagation; /* of frame number */
> bool error;
--
Cheers,
Mauro
next prev parent reply other threads:[~2015-10-28 2:01 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 23:01 [PATCH 00/19] Unrestricted media entity ID range support Sakari Ailus
2015-10-26 23:01 ` [PATCH 01/19] media: Enforce single entity->pipe in a pipeline Sakari Ailus
2015-10-28 0:18 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 02/19] media: Introduce internal index for media entities Sakari Ailus
2015-10-28 0:20 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 03/19] media: Add an API to manage entity enumerations Sakari Ailus
2015-10-28 2:09 ` Mauro Carvalho Chehab
2015-11-03 22:21 ` Sakari Ailus
2015-10-26 23:01 ` [PATCH 04/19] media: Move struct media_entity_graph definition up Sakari Ailus
2015-10-28 0:36 ` Mauro Carvalho Chehab
2015-11-03 22:22 ` Sakari Ailus
2015-11-29 13:07 ` Sakari Ailus
2015-10-26 23:01 ` [PATCH 05/19] media: Move media graph state for streamon/off to the pipeline Sakari Ailus
2015-10-28 0:38 ` Mauro Carvalho Chehab
2015-11-03 22:23 ` Sakari Ailus
2015-10-26 23:01 ` [PATCH 06/19] media: Amend media graph walk API by init and cleanup functions Sakari Ailus
2015-10-28 2:09 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 07/19] media: Use the new media_entity_graph_walk_start() Sakari Ailus
2015-10-28 0:43 ` Mauro Carvalho Chehab
2015-11-03 22:42 ` Sakari Ailus
2015-10-26 23:01 ` [PATCH 08/19] v4l: omap3isp: Use the new media_entity_graph_walk_start() interface Sakari Ailus
2015-10-26 23:01 ` [PATCH 09/19] v4l: exynos4-is: " Sakari Ailus
2015-10-26 23:01 ` [PATCH 10/19] v4l: xilinx: " Sakari Ailus
2015-10-26 23:01 ` [PATCH 11/19] v4l: vsp1: " Sakari Ailus
2015-10-26 23:01 ` [PATCH 12/19] media: Use entity enums in graph walk Sakari Ailus
2015-10-28 0:48 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 13/19] media: Keep using the same graph walk object for a given pipeline Sakari Ailus
2015-10-28 0:51 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 14/19] v4l: omap3isp: Use media entity enumeration API Sakari Ailus
2015-10-28 1:30 ` Mauro Carvalho Chehab
2015-11-03 22:44 ` Sakari Ailus
2015-10-26 23:01 ` [PATCH 15/19] v4l: vsp1: " Sakari Ailus
2015-10-28 1:33 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 16/19] staging: omap4iss: Fix sub-device power management code Sakari Ailus
2015-10-28 1:59 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 17/19] staging: v4l: omap4iss: Use media entity enum API Sakari Ailus
2015-10-28 2:01 ` Mauro Carvalho Chehab [this message]
2015-10-26 23:01 ` [PATCH 18/19] staging: v4l: omap4iss: Use the new media_entity_graph_walk_start() interface Sakari Ailus
2015-10-28 2:08 ` Mauro Carvalho Chehab
2015-10-26 23:01 ` [PATCH 19/19] media: Rename MEDIA_ENTITY_ENUM_MAX_ID as MEDIA_ENTITY_ENUM_STACK_ALLOC Sakari Ailus
2015-10-28 2:10 ` 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=20151028110119.596a3494@concha.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;
as well as URLs for NNTP newsgroup(s).