From patchwork Tue Nov 8 12:54:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 37950 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c45vJ-0000mc-LM; Tue, 08 Nov 2016 12:54:45 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-5) with esmtp id 1c45vH-0006k4-6X; Tue, 08 Nov 2016 13:54:45 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932584AbcKHMyk (ORCPT + 1 other); Tue, 8 Nov 2016 07:54:40 -0500 Received: from mga04.intel.com ([192.55.52.120]:47026 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932477AbcKHMyk (ORCPT ); Tue, 8 Nov 2016 07:54:40 -0500 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 08 Nov 2016 04:54:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,462,1473145200"; d="scan'208";a="188984388" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga004.fm.intel.com with ESMTP; 08 Nov 2016 04:54:38 -0800 Received: from nauris.fi.intel.com (nauris.localdomain [192.168.240.2]) by paasikivi.fi.intel.com (Postfix) with ESMTP id 65B7B2006B; Tue, 8 Nov 2016 14:54:37 +0200 (EET) Received: by nauris.fi.intel.com (Postfix, from userid 1000) id 7B79620148; Tue, 8 Nov 2016 14:54:28 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: niklas.soderlund@ragnatech.se, Laurent Pinchart Subject: [PATCH 1/1] media: entity: Add media_entity_has_route() function Date: Tue, 8 Nov 2016 14:54:28 +0200 Message-Id: <1478609668-1117-1-git-send-email-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20161108124238.GM3217@valkosipuli.retiisi.org.uk> References: <20161108124238.GM3217@valkosipuli.retiisi.org.uk> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.11.8.124516 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_NEGATE 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CP_URI_IN_BODY 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MULTIPLE_RCPTS_CC_X2 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0' From: Laurent Pinchart This is a wrapper around the media entity has_route operation. Signed-off-by: Laurent Pinchart Signed-off-by: Michal Simek Signed-off-by: Sakari Ailus --- 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