From patchwork Thu Nov 16 09:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119022 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5336013qgn; Thu, 16 Nov 2017 01:00:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMZphpt6HaSO+cdI2gXHb/16sz5m+oqn4iD3hfgXzMtQE9FZ32Pdd9UwEfX/1wjOVr9Qv7e5 X-Received: by 10.55.95.6 with SMTP id t6mr1310107qkb.47.1510822833803; Thu, 16 Nov 2017 01:00:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510822833; cv=none; d=google.com; s=arc-20160816; b=lJ0tKAm9il9B7eKJ/YRDKrMXZ3oCaM7Olj7CZXIpe2xa8uzcj9ufB96FErp9pUUAV3 q8hsBKb6fzdOGsxaWuJDwUSFAYcrbqPCI/U/urmlIQMRWD6E+pAio+/NgBewkqsE2d3T ktnRtl+++M6f0cX0qjTFOCzUhCuJiZYO7ZguHF8o0itCWJs6G8qrxIFPbKlj24kR29Ze Ej5/vkzuq2B4CNu1Ls5XseZ6ePa9Y8ov9lvqNx2how4FvINinos+pu/FUQso4F6SpQYH b9XD9Kwp71ZY+HsCQDFDDt24CKdc+hPCpS+oBTT5ckQHOQJFIcsqy3/RdBb05Bn3weRu dLJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Wsk4v5S4+zoYPGLilxRF4kwLPcg3YUrpthrkI64NmZE=; b=uG/0P+X3ZUF35fCtpDjME7pidR8+rA2y3N4vTjct4y43ZWs2eikKQGS0LYpFOiuUZn 2OP++W1PKdcFANFrvh/ubVtSWRZjRDDlC94OwCbZ4YmK9bh8OTk/m1Fcbf8+JdNUVxoE iarcbh0XJGkk/y6IUTGo/YQEoaYI0gbUCOmQIyQUX2JJ6lVRwIqB1eHQyxvp1yNSuU0g 8OHlMPu+R0KkMK0HIdCgbV7F5MlxTuxNfFXl5cP/1sOzRpdVLUFUge1osiN1HPO6IWIL cUHRqEusSw/peEtSBFd+2aFgZn9YAHxljJfFWNcB21zlyr6vN3a9DvRNwsYnTY3cUjym VBYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id v1si652679qkd.322.2017.11.16.01.00.32; Thu, 16 Nov 2017 01:00:33 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 76DF0607B2; Thu, 16 Nov 2017 09:00:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 409676073F; Thu, 16 Nov 2017 09:00:23 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BCA6560749; Thu, 16 Nov 2017 09:00:12 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 5D6346068B for ; Thu, 16 Nov 2017 09:00:10 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward100j.mail.yandex.net (Yandex) with ESMTP id CC1DA5D84B03 for ; Thu, 16 Nov 2017 12:00:08 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id mltmyWVJFm-08jOBSEe; Thu, 16 Nov 2017 12:00:08 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id uK4C5BL58q-08H85Tjm; Thu, 16 Nov 2017 12:00:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 16 Nov 2017 12:00:05 +0300 Message-Id: <1510822807-12483-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510822807-12483-1-git-send-email-odpbot@yandex.ru> References: <1510822807-12483-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 297 Subject: [lng-odp] [PATCH 2.0 v1 1/3] frameworks: modular: add static walk through function template X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope SUBSYSTEM_FOREACH_TEMPLATE() generates static walk through functions to invoke subsystem's modules initialization or termination methods. Those functions may be used by a subsystem initialization or termination function if it needs to perform additional operations than subsystem's modules method invocation. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 297 (bogdanPricope:2_0_ops_alloc_pr) ** https://github.com/Linaro/odp/pull/297 ** Patch: https://github.com/Linaro/odp/pull/297.patch ** Base sha: 6cd43041e55bd73a02ca202f835e590b3ad5c354 ** Merge commit sha: 9a2195f21322cf4bcf5f0b7b2fb827746597d8a1 **/ frameworks/modular/odp_module.h | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/frameworks/modular/odp_module.h b/frameworks/modular/odp_module.h index b20501eb2..0514bf5e1 100644 --- a/frameworks/modular/odp_module.h +++ b/frameworks/modular/odp_module.h @@ -202,16 +202,7 @@ struct odp_module_base { static void __attribute__((constructor(102))) \ odp_ ## name ## _module_constructor(void) -/* All subsystems' initialization and termination routines are - * the same, provide template to help generate similar routines - * automatically, examples: - * - * ODP_SUBSYSTEM_FOREACH_TEMPLATE(subsystem, init_global, DBG) - * will generate a function walk through all the modules of the - * subsystem and invoke init_global method for each. - */ -#define ODP_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \ -int odp_ ## subs ##_## method(bool continue_on_errors) \ +#define _SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \ { \ int result = 0; \ ODP_MODULE_CLASS(subs) * mod = NULL; \ @@ -237,6 +228,32 @@ done: \ return result; \ } +/* ODP_SUBSYSTEM_FOREACH_TEMPLATE() generates subsystems + * initialization and termination routines automatically, + * examples: + * + * ODP_SUBSYSTEM_FOREACH_TEMPLATE(subsystem, init_global, DBG) + * will generate a function walk through all the modules of the + * subsystem and invoke init_global method for each. + */ + +#define ODP_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \ +int odp_ ## subs ##_## method(bool continue_on_errors) \ +_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) + +/* SUBSYSTEM_FOREACH_TEMPLATE() generates static walk through + * functions to invoke subsystem's modules initialization or + * termination methods, examples: + * + * SUBSYSTEM_FOREACH_TEMPLATE(subsystem, init_global, DBG) + * will generate a function walk through all the modules of the + * subsystem and invoke init_global method for each. + */ + +#define SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \ +static int subs ##_## method(bool continue_on_errors) \ +_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) + /* Subsystem Modules Registration * * odp_subsystem_register_module() are called by all modules in their