From patchwork Tue Dec 2 11:27:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41807 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 07C1420672 for ; Tue, 2 Dec 2014 11:28:22 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id u10sf7905688lbd.2 for ; Tue, 02 Dec 2014 03:28:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=m8b5wkvo3k/0/ezNWLaa4gLwQSvnxJFH3GAIr8yaut0=; b=EgGfR0DwWd5hRpcZvsa96+bhu/tkhsYJRdI+fa1GhoOTQLL/JqMBpauoGs1+LnU+Pt id2zwliKkpsAIZjkc2ac5BWhYZYL2Ih04K3kntANxSqsz/HCwpwrMutb77pt4j2d9Evo on95MJU5Lbko9BMSeF/PyW9JBB2Izruwz2BjYj5kYwtTrXV28TPGu6f7hLZx0/QA9zsK hTQ1s52iOyP/3+9G10Kmga1cJiMEYZklIF01zKKk2jRLAacDOxGOtAzQ3o7cQaZ8fPia r4/5G5Y4sv3IiN0I+1Gkj+TTotU5lCR3ySEgww+Rr0UpCx6HVSzvMAL9HRREqULkJFz1 yu8w== X-Gm-Message-State: ALoCoQkvgNKOXt0ocYrXgIWsOwbKsTHnSTw1yYezTFbpXDkgdT/cQL3rgrBO0gTVSte5YYMPz+KT X-Received: by 10.180.8.9 with SMTP id n9mr757077wia.6.1417519700961; Tue, 02 Dec 2014 03:28:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.194 with SMTP id g2ls26245lam.3.gmail; Tue, 02 Dec 2014 03:28:20 -0800 (PST) X-Received: by 10.112.132.2 with SMTP id oq2mr61617366lbb.11.1417519700711; Tue, 02 Dec 2014 03:28:20 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id k12si7566359laa.24.2014.12.02.03.28.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Dec 2014 03:28:20 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id gq15so10383000lab.4 for ; Tue, 02 Dec 2014 03:28:20 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr38071224lal.29.1417519700578; Tue, 02 Dec 2014 03:28:20 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp463262lbc; Tue, 2 Dec 2014 03:28:19 -0800 (PST) X-Received: by 10.224.129.196 with SMTP id p4mr97213717qas.1.1417519699034; Tue, 02 Dec 2014 03:28:19 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j4si23989859qai.6.2014.12.02.03.28.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Dec 2014 03:28:19 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xvlcu-0007DT-Lc; Tue, 02 Dec 2014 11:28:16 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xvlcg-0007Cd-C4 for lng-odp@lists.linaro.org; Tue, 02 Dec 2014 11:28:02 +0000 Received: by mail-lb0-f172.google.com with SMTP id u10so10371557lbd.3 for ; Tue, 02 Dec 2014 03:27:56 -0800 (PST) X-Received: by 10.112.162.41 with SMTP id xx9mr60342584lbb.21.1417519676799; Tue, 02 Dec 2014 03:27:56 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id jg8sm1571875lbc.0.2014.12.02.03.27.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Dec 2014 03:27:56 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Tue, 2 Dec 2014 13:27:47 +0200 Message-Id: <1417519667-7902-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417519667-7902-1-git-send-email-taras.kondratiuk@linaro.org> References: <1417519667-7902-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 2/2] platform: debug: Simplify ODP_LOG() macro X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Move additional functionality out of ODP_LOG. Keep only logging. Signed-off-by: Taras Kondratiuk --- platform/linux-generic/include/api/odp_debug.h | 43 +++++--------------- .../linux-generic/include/odp_debug_internal.h | 6 ++- 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h index 4b51038..13c3939 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -99,48 +99,24 @@ extern int odp_override_log(odp_log_level_e level, const char *fmt, ...); * ODP LOG macro. */ #define ODP_LOG(level, fmt, ...) \ -do { \ - switch (level) { \ - case ODP_LOG_ERR: \ - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_DBG: \ - if (ODP_DEBUG_PRINT == 1) \ - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_PRINT: \ - odp_override_log(level, " " fmt, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_ABORT: \ - odp_override_log(level, "%s:%d:%s(): " fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - abort(); \ - break; \ - case ODP_LOG_UNIMPLEMENTED: \ - odp_override_log(level, \ - "%s:%d:The function %s() is not implemented\n" \ - fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - default: \ - odp_override_log(level, "Unknown LOG level"); \ - break;\ - } \ -} while (0) + odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ + __LINE__, __func__, ##__VA_ARGS__) /** * Log print message when the application calls one of the ODP APIs * specifically for dumping internal data. */ #define ODP_PRINT(fmt, ...) \ - ODP_LOG(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) + odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) /** * Log debug message if DEBUG flag is set. */ #define ODP_DBG(fmt, ...) \ - ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__) + do { \ + if (ODP_DEBUG_PRINT == 1) \ + ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\ + } while (0) /** * Log error message. @@ -153,7 +129,10 @@ do { \ * This function should not return. */ #define ODP_ABORT(fmt, ...) \ - ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__) + do { \ + ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \ + abort(); \ + } while (0) /** * @} diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index a87552f..ee3c543 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -25,8 +25,10 @@ extern "C" { /** * This macro is used to indicate when a given function is not implemented */ -#define ODP_UNIMPLEMENTED(fmt, ...) \ - ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__) +#define ODP_UNIMPLEMENTED() \ + odp_override_log(ODP_LOG_UNIMPLEMENTED, \ + "%s:%d:The function %s() is not implemented\n", \ + __FILE__, __LINE__, __func__) #ifdef __cplusplus }