From patchwork Wed Dec 3 15:19:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41857 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9DF1F25E66 for ; Wed, 3 Dec 2014 15:19:43 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf9825009eek.3 for ; Wed, 03 Dec 2014 07:19:42 -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=bRcqKyKgVpo4oMDWeqnKCoaVRpAPjUd9WTt1hI2ErIw=; b=jKvZ37KoHXI45nwrr4AmeAXGKI2NVHUjDQXR4DXJPmsHR5tz5HKBmRXz2GN4q0LxEk th99QbyStdvq0pg+ozolspT7IhbOyMyTEQkF2FbKunpLvR3kcYnP36PhTP8zzVLU9Hq9 RaTl4fgsEv//wPKJGWuOuxxx5Ikfv9VS0N968Nx4AVVNHao7zwPHVJo1nGd9ibiK+wf3 IMiN6aKtDSMXt+DS9/3ZEvUC03mtcFMC83o8jqQWwG8Tg/M9FtRz1ZWX5IO85BV4L43n fDN6K9ygLKxV4uJ24RbVi69hdSnUV37fzx3dgj/teVkXsotp03boDvdLcRx2Eky7/4j0 y+SA== X-Gm-Message-State: ALoCoQmFvJDEL/+BG3Hpf4M6i62MwaLBrBszPY4DJuFbvH29crcsk9xkmP2X//OLOBDyrIU/LU6X X-Received: by 10.180.98.39 with SMTP id ef7mr5523671wib.6.1417619982898; Wed, 03 Dec 2014 07:19:42 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.226 with SMTP id z2ls174993lal.5.gmail; Wed, 03 Dec 2014 07:19:42 -0800 (PST) X-Received: by 10.152.5.6 with SMTP id o6mr4926701lao.8.1417619982608; Wed, 03 Dec 2014 07:19:42 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id x7si23285639lag.84.2014.12.03.07.19.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 07:19:42 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id s18so12965882lam.35 for ; Wed, 03 Dec 2014 07:19:42 -0800 (PST) X-Received: by 10.153.7.170 with SMTP id dd10mr4753219lad.44.1417619982498; Wed, 03 Dec 2014 07:19:42 -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 ew9csp682713lbc; Wed, 3 Dec 2014 07:19:41 -0800 (PST) X-Received: by 10.236.202.82 with SMTP id c58mr6184290yho.1.1417619980660; Wed, 03 Dec 2014 07:19:40 -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 g33si17531254qgf.49.2014.12.03.07.19.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 07:19:40 -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 1XwBiL-0006de-8G; Wed, 03 Dec 2014 15:19:37 +0000 Received: from mail-wg0-f47.google.com ([74.125.82.47]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XwBi7-0006cq-4X for lng-odp@lists.linaro.org; Wed, 03 Dec 2014 15:19:23 +0000 Received: by mail-wg0-f47.google.com with SMTP id n12so20018210wgh.6 for ; Wed, 03 Dec 2014 07:19:17 -0800 (PST) X-Received: by 10.194.87.100 with SMTP id w4mr8181145wjz.65.1417619957636; Wed, 03 Dec 2014 07:19:17 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id h8sm37509940wiy.17.2014.12.03.07.19.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 07:19:16 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Wed, 3 Dec 2014 17:19:02 +0200 Message-Id: <1417619942-14233-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417619942-14233-1-git-send-email-taras.kondratiuk@linaro.org> References: <1417619942-14233-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 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.48 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 Reviewed-by: Bill Fischofer Reviewed-by: Mike Holmes --- 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 aa99e29..1f5eaff 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -102,48 +102,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 ODP_DEBUG_PRINT 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. @@ -156,7 +132,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 }