All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com, javier@osg.samsung.com,
	mchehab@osg.samsung.com, hverkuil@xs4all.nl
Subject: [PATCH 09/19] v4l: exynos4-is: Use the new media_entity_graph_walk_start() interface
Date: Tue, 27 Oct 2015 01:01:40 +0200	[thread overview]
Message-ID: <1445900510-1398-10-git-send-email-sakari.ailus@iki.fi> (raw)
In-Reply-To: <1445900510-1398-1-git-send-email-sakari.ailus@iki.fi>

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/platform/exynos4-is/media-dev.c | 31 +++++++++++++++++----------
 drivers/media/platform/exynos4-is/media-dev.h |  1 +
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index d55b4f3..704040c 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -1046,10 +1046,10 @@ static int __fimc_md_modify_pipeline(struct media_entity *entity, bool enable)
 }
 
 /* Locking: called with entity->graph_obj.mdev->graph_mutex mutex held. */
-static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
+static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable,
+				      struct media_entity_graph *graph)
 {
 	struct media_entity *entity_err = entity;
-	struct media_entity_graph graph;
 	int ret;
 
 	/*
@@ -1058,9 +1058,9 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
 	 * through active links. This is needed as we cannot power on/off the
 	 * subdevs in random order.
 	 */
-	media_entity_graph_walk_start(&graph, entity);
+	media_entity_graph_walk_start(graph, entity);
 
-	while ((entity = media_entity_graph_walk_next(&graph))) {
+	while ((entity = media_entity_graph_walk_next(graph))) {
 		if (!is_media_entity_v4l2_io(entity))
 			continue;
 
@@ -1071,10 +1071,11 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
 	}
 
 	return 0;
- err:
-	media_entity_graph_walk_start(&graph, entity_err);
 
-	while ((entity_err = media_entity_graph_walk_next(&graph))) {
+err:
+	media_entity_graph_walk_start(graph, entity_err);
+
+	while ((entity_err = media_entity_graph_walk_next(graph))) {
 		if (!is_media_entity_v4l2_io(entity_err))
 			continue;
 
@@ -1090,21 +1091,29 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
 static int fimc_md_link_notify(struct media_link *link, unsigned int flags,
 				unsigned int notification)
 {
+	struct media_entity_graph *graph =
+		&container_of(link->graph_obj.mdev, struct fimc_md,
+			      media_dev)->link_setup_graph;
 	struct media_entity *sink = link->sink->entity;
 	int ret = 0;
 
 	/* Before link disconnection */
 	if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH) {
+		ret = media_entity_graph_walk_init(graph,
+						   link->graph_obj.mdev);
+		if (ret)
+			return ret;
 		if (!(flags & MEDIA_LNK_FL_ENABLED))
-			ret = __fimc_md_modify_pipelines(sink, false);
+			ret = __fimc_md_modify_pipelines(sink, false, graph);
 #if 0
 		else
 			/* TODO: Link state change validation */
 #endif
 	/* After link activation */
-	} else if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
-		   (link->flags & MEDIA_LNK_FL_ENABLED)) {
-		ret = __fimc_md_modify_pipelines(sink, true);
+	} else if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH) {
+		if (link->flags & MEDIA_LNK_FL_ENABLED)
+			ret = __fimc_md_modify_pipelines(sink, true, graph);
+		media_entity_graph_walk_cleanup(graph);
 	}
 
 	return ret ? -EPIPE : 0;
diff --git a/drivers/media/platform/exynos4-is/media-dev.h b/drivers/media/platform/exynos4-is/media-dev.h
index 9a69913..e80c55d 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -154,6 +154,7 @@ struct fimc_md {
 	bool user_subdev_api;
 	spinlock_t slock;
 	struct list_head pipelines;
+	struct media_entity_graph link_setup_graph;
 };
 
 static inline
-- 
2.1.4


  parent reply	other threads:[~2015-10-26 23:03 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 ` Sakari Ailus [this message]
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
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=1445900510-1398-10-git-send-email-sakari.ailus@iki.fi \
    --to=sakari.ailus@iki.fi \
    --cc=hverkuil@xs4all.nl \
    --cc=javier@osg.samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.