linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: niklas.soderlund@ragnatech.se,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: [PATCH 1/1] media: entity: Add media_entity_has_route() function
Date: Tue,  8 Nov 2016 14:54:28 +0200	[thread overview]
Message-ID: <1478609668-1117-1-git-send-email-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20161108124238.GM3217@valkosipuli.retiisi.org.uk>

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

This is a wrapper around the media entity has_route operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
Hi Niklas,

There was actually another problem with the Kerneldoc comment related to
the mutex. Fixed that one as well.

Kind regards,
Sakari

 drivers/media/media-entity.c | 16 ++++++++++++++++
 include/media/media-entity.h | 17 +++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 5734bb9..7de08e1 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -242,6 +242,22 @@ EXPORT_SYMBOL_GPL(media_entity_pads_init);
  * Graph traversal
  */
 
+bool media_entity_has_route(struct media_entity *entity, unsigned int pad0,
+			    unsigned int pad1)
+{
+	if (pad0 >= entity->num_pads || pad1 >= entity->num_pads)
+		return false;
+
+	if (pad0 == pad1)
+		return true;
+
+	if (!entity->ops || !entity->ops->has_route)
+		return true;
+
+	return entity->ops->has_route(entity, pad0, pad1);
+}
+EXPORT_SYMBOL_GPL(media_entity_has_route);
+
 static struct media_entity *
 media_entity_other(struct media_entity *entity, struct media_link *link)
 {
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 2060e48..aa8d3c5 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -834,6 +834,23 @@ __must_check int media_entity_graph_walk_init(
 	struct media_entity_graph *graph, struct media_device *mdev);
 
 /**
+ * media_entity_has_route - Check if two entity pads are connected internally
+ *
+ * @entity: The entity
+ * @pad0: The first pad index
+ * @pad1: The second pad index
+ *
+ * This function can be used to check whether two pads of an entity are
+ * connected internally in the entity.
+ *
+ * The caller must hold entity->graph_obj.mdev->mutex.
+ *
+ * Return: true if the pads are connected internally and false otherwise.
+ */
+bool media_entity_has_route(struct media_entity *entity, unsigned int pad0,
+			    unsigned int pad1);
+
+/**
  * media_entity_graph_walk_cleanup - Release resources used by graph walk.
  *
  * @graph: Media graph structure that will be used to walk the graph
-- 
2.7.4


  reply	other threads:[~2016-11-08 12:54 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 13:22 [PATCH 00/32] rcar-vin: Add Gen3 with media controller support Niklas Söderlund
2016-11-02 13:22 ` [PATCH 01/32] media: entity: Add has_route entity operation Niklas Söderlund
2016-11-08 12:43   ` Sakari Ailus
2016-11-02 13:22 ` [PATCH 02/32] media: entity: Add media_entity_has_route() function Niklas Söderlund
2016-11-08 12:42   ` Sakari Ailus
2016-11-08 12:54     ` Sakari Ailus [this message]
2016-11-11 21:08       ` [PATCH 1/1] " Niklas Söderlund
2016-11-02 13:23 ` [PATCH 03/32] media: rcar-vin: reset bytesperline and sizeimage when resetting format Niklas Söderlund
2016-11-02 16:43   ` Sergei Shtylyov
2016-11-02 13:23 ` [PATCH 04/32] media: rcar-vin: use rvin_reset_format() in S_DV_TIMINGS Niklas Söderlund
2016-11-02 13:23 ` [PATCH 05/32] media: rcar-vin: fix how pads are handled for v4l2 subdeivce operations Niklas Söderlund
2016-11-02 13:23 ` [PATCH 06/32] media: rcar-vin: fix standard in input enumeration Niklas Söderlund
2016-11-02 13:23 ` [PATCH 07/32] media: rcar-vin: add wrapper to get rvin_graph_entity Niklas Söderlund
2016-11-02 13:23 ` [PATCH 08/32] media: rcar-vin: move subdev source and sink pad index to rvin_graph_entity Niklas Söderlund
2016-11-02 13:23 ` [PATCH 09/32] media: rcar-vin: move pad number discovery to async complete handler Niklas Söderlund
2016-11-02 13:23 ` [PATCH 10/32] media: rcar-vin: use pad information when verifying media bus format Niklas Söderlund
2016-11-02 13:23 ` [PATCH 11/32] media: rcar-vin: refactor pad lookup code Niklas Söderlund
2016-11-02 13:23 ` [PATCH 12/32] media: rcar-vin: split rvin_s_fmt_vid_cap() Niklas Söderlund
2016-11-02 13:23 ` [PATCH 13/32] media: rcar-vin: register the video device early Niklas Söderlund
2016-11-02 13:23 ` [PATCH 14/32] media: rcar-vin: move chip information to own struct Niklas Söderlund
2016-11-07 12:40   ` Geert Uytterhoeven
2016-11-02 13:23 ` [PATCH 15/32] media: rcar-vin: move max width and height information to chip information Niklas Söderlund
2016-11-02 13:23 ` [PATCH 16/32] media: rcar-vin: change name of video device Niklas Söderlund
2016-11-02 13:23 ` [PATCH 17/32] media: rcar-vin: clarify error message from the digital notifier Niklas Söderlund
2016-11-02 13:23 ` [PATCH 18/32] media: rcar-vin: enable Gen3 hardware configuration Niklas Söderlund
2016-11-02 13:23 ` [PATCH 19/32] media: rcar-vin: add functions to manipulate Gen3 CHSEL value Niklas Söderlund
2016-11-02 13:23 ` [PATCH 20/32] media: rcar-vin: expose a sink pad if we are on Gen3 Niklas Söderlund
2016-11-02 17:15   ` Sergei Shtylyov
2016-11-02 13:23 ` [PATCH 21/32] media: rcar-vin: add group allocator functions Niklas Söderlund
2016-11-02 13:23 ` [PATCH 22/32] media: rcar-vin: add chsel information to rvin_info Niklas Söderlund
2016-11-02 13:23 ` [PATCH 23/32] media: rcar-vin: parse Gen3 OF and setup media graph Niklas Söderlund
2016-11-02 13:23 ` [PATCH 24/32] media: rcar-vin: add link notify for Gen3 Niklas Söderlund
2016-11-02 13:23 ` [PATCH 25/32] media: rcar-vin: enable CSI2 group subdevices in lookup helpers Niklas Söderlund
2016-11-02 13:23 ` [PATCH 26/32] media: rcar-vin: add helpers for bridge Niklas Söderlund
2016-11-02 13:23 ` [PATCH 27/32] media: rcar-vin: start/stop the CSI2 bridge stream Niklas Söderlund
2016-11-02 13:23 ` [PATCH 28/32] media: rcar-vin: propagate format to bridge Niklas Söderlund
2016-11-02 13:23 ` [PATCH 29/32] media: rcar-vin: attach to CSI2 group when the video device is opened Niklas Söderlund
2016-11-02 13:23 ` [PATCH 30/32] media: rcar-vin: add Gen3 devicetree bindings documentation Niklas Söderlund
2016-11-07 12:47   ` Geert Uytterhoeven
2016-11-02 13:23 ` [PATCH 31/32] media: rcar-vin: enable support for r8a7795 Niklas Söderlund
2016-11-07 12:42   ` Geert Uytterhoeven
2016-11-02 13:23 ` [PATCH 32/32] media: rcar-vin: enable support for r8a7796 Niklas Söderlund
2016-11-07 12:44   ` Geert Uytterhoeven

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=1478609668-1117-1-git-send-email-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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).