[{"id":5192,"web_url":"https://patchwork.libcamera.org/comment/5192/","msgid":"<20200612103646.GH5957@pendragon.ideasonboard.com>","date":"2020-06-12T10:36:46","subject":"Re: [libcamera-devel] [PATCH v4 2/6] libcamera: camera_manager:\n\tRefactor pipelines creation into separate function","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Thu, Jun 11, 2020 at 05:16:04PM +0000, Umang Jain wrote:\n> This commit introduces no functional changes.\n> Split pipelines creation code into a separate function,\n> so that the function can be re-used for upcoming hotplug\n> functionality in subsequent commits.\n> \n> Also, fixup correct tag for \\todo.\n> \n> Signed-off-by: Umang Jain <email@uajain.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/camera_manager.cpp | 19 +++++++++++++------\n>  1 file changed, 13 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\n> index b8128df..aba5a0c 100644\n> --- a/src/libcamera/camera_manager.cpp\n> +++ b/src/libcamera/camera_manager.cpp\n> @@ -56,6 +56,7 @@ protected:\n>  private:\n>  \tint init();\n>  \tvoid cleanup();\n> +\tvoid createPipelineHandlers();\n\nWe try to declare functions in the same order in the .h and .cpp files\n(the rule is a bit more complex, we can interleave public and private\nfunctions in the .cpp file, but within a group of public or private\nfunctions, we retain the order).\n\nYou can swap cleanup() and createPipelineHandlers() here, or in the .cpp\nfile, up to you.\n\n>  \n>  \tCameraManager *cm_;\n>  \n> @@ -123,12 +124,20 @@ int CameraManager::Private::init()\n>  \tif (!enumerator_ || enumerator_->enumerate())\n>  \t\treturn -ENODEV;\n>  \n> +\tcreatePipelineHandlers();\n> +\n> +\treturn 0;\n> +}\n> +\n> +void CameraManager::Private::createPipelineHandlers()\n> +{\n>  \t/*\n> -\t * TODO: Try to read handlers and order from configuration\n> +\t * \\todo Try to read handlers and order from configuration\n>  \t * file and only fallback on all handlers if there is no\n>  \t * configuration file.\n>  \t */\n> -\tstd::vector<PipelineHandlerFactory *> &factories = PipelineHandlerFactory::factories();\n> +\tstd::vector<PipelineHandlerFactory *> &factories =\n> +\t\tPipelineHandlerFactory::factories();\n>  \n>  \tfor (PipelineHandlerFactory *factory : factories) {\n>  \t\t/*\n> @@ -146,14 +155,12 @@ int CameraManager::Private::init()\n>  \t\t}\n>  \t}\n>  \n> -\t/* TODO: register hot-plug callback here */\n> -\n> -\treturn 0;\n> +\t/* \\todo Register hot-plug callback here */\n>  }\n>  \n>  void CameraManager::Private::cleanup()\n>  {\n> -\t/* TODO: unregister hot-plug callback here */\n> +\t/* \\todo Unregister hot-plug callback here */\n>  \n>  \t/*\n>  \t * Release all references to cameras and pipeline handlers to ensure","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EDC4560C4E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Jun 2020 12:37:07 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6AFD924F;\n\tFri, 12 Jun 2020 12:37:07 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZaEYzTmh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591958227;\n\tbh=ZBsCqupYjmJRB8+hN1hX4jdU2DkOSuM5hSSf1WF8rFA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZaEYzTmhKnHvgv5Y6IGMLZYtWrwzn818MqJ1gq+mZVJJsWfPtnqcXuc1TDlib5pku\n\tEnMg5Uy1VSuyLQrcM9oqUuzJ4L7KS/W5PJ5zEq/dhzXGTQBhvT2yO6cdn3lpwgeCEZ\n\tiEDOnKJzyQ7jz4ttHvjBJHAJoB7TVsgctKFNxVvg=","Date":"Fri, 12 Jun 2020 13:36:46 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <email@uajain.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200612103646.GH5957@pendragon.ideasonboard.com>","References":"<20200611171528.9381-1-email@uajain.com>\n\t<20200611171528.9381-3-email@uajain.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200611171528.9381-3-email@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH v4 2/6] libcamera: camera_manager:\n\tRefactor pipelines creation into separate function","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 12 Jun 2020 10:37:08 -0000"}}]