From patchwork Wed Dec 16 13:32:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 7861771 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BDB259F350 for ; Wed, 16 Dec 2015 13:35:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDA712017D for ; Wed, 16 Dec 2015 13:35:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8E8720272 for ; Wed, 16 Dec 2015 13:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933152AbbLPNez (ORCPT ); Wed, 16 Dec 2015 08:34:55 -0500 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:60618 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933045AbbLPNew (ORCPT ); Wed, 16 Dec 2015 08:34:52 -0500 Received: from lanttu.localdomain (unknown [192.168.15.166]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id EC5A860098; Wed, 16 Dec 2015 15:34:50 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, mchehab@osg.samsung.com, hverkuil@xs4all.nl, javier@osg.samsung.com Subject: [PATCH v3 23/23] media: Update media graph walk documentation for the changed API Date: Wed, 16 Dec 2015 15:32:38 +0200 Message-Id: <1450272758-29446-24-git-send-email-sakari.ailus@iki.fi> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1450272758-29446-1-git-send-email-sakari.ailus@iki.fi> References: <1450272758-29446-1-git-send-email-sakari.ailus@iki.fi> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP media_entity_graph_walk_init() and media_entity_graph_walk_cleanup() are now mandatory. Signed-off-by: Sakari Ailus --- Documentation/media-framework.txt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt index b424de6..738a526 100644 --- a/Documentation/media-framework.txt +++ b/Documentation/media-framework.txt @@ -241,13 +241,22 @@ supported by the graph traversal API. To prevent infinite loops, the graph traversal code limits the maximum depth to MEDIA_ENTITY_ENUM_MAX_DEPTH, currently defined as 16. -Drivers initiate a graph traversal by calling +The graph traversal must be initialised calling + + media_entity_graph_walk_init(struct media_entity_graph *graph); + +The return value of the function must be checked. Should the number of +graph entities exceed the pre-allocated memory, it will also allocate +memory for the enumeration. + +Once initialised, the graph walk may be started by calling media_entity_graph_walk_start(struct media_entity_graph *graph, struct media_entity *entity); -The graph structure, provided by the caller, is initialized to start graph -traversal at the given entity. +The graph structure, provided by the caller, is initialized to start +graph traversal at the given entity. It is possible to start the graph +walk multiple times using the same graph struct. Drivers can then retrieve the next entity by calling @@ -255,8 +264,11 @@ Drivers can then retrieve the next entity by calling When the graph traversal is complete the function will return NULL. -Graph traversal can be interrupted at any moment. No cleanup function call is -required and the graph structure can be freed normally. +Graph traversal can be interrupted at any moment. Once the graph +structure is no longer needed, the resources that have been allocated +by media_entity_graph_walk_init() are released using + + media_entity_graph_walk_cleanup(struct media_entity_graph *graph); Helper functions can be used to find a link between two given pads, or a pad connected to another pad through an enabled link