From patchwork Tue Feb 3 11:35:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 44218 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D222221513 for ; Tue, 3 Feb 2015 11:36:13 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf25092814wid.3 for ; Tue, 03 Feb 2015 03:36:13 -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=DCDKpEamSsqJpPfLlIFMH9GrUn5L/hcjteQHuG2f/vk=; b=GF5mM9r/Ui2kVOcCiS2w5xr12TuvpLpHtC0R8oj9sBENUxcc6IjDykVgfAOLNVZH8b kAnIzx1NnZeRPVxMvCWOibYqiX0+wetC2eGEHPDirHmM84R/8Ms3AoKdjSaZ1P2iMk8o lNbLuVg+niHJp33CZ83GUWmER8U3BKdMqeB23g1qgSS1hP6FUQUEG3ThFPUyEg2JCdaJ Ag87NnMhVBOcWVaPHBSzagvv9z8K6n0jDdN8tcEwK6tQAJC54U5KfPjzcZ3HBrBan7N/ Mh9H0S+OfAf1FclCKICnqL3sR+tr3ZK/1UNMUrLOjLiUUOPWDBu3a+385bxcaNB1F1XR Wnrw== X-Gm-Message-State: ALoCoQkri8HSHedKTEUNqfem/vRqKbi/qeiejXFJrVKipxDteysXPNMiNdb9kCoE2tgEz+p5utbk X-Received: by 10.194.221.65 with SMTP id qc1mr3027499wjc.7.1422963373094; Tue, 03 Feb 2015 03:36:13 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.42 with SMTP id v10ls133125laj.56.gmail; Tue, 03 Feb 2015 03:36:12 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr24066782laa.80.1422963372860; Tue, 03 Feb 2015 03:36:12 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id p14si18927040lal.67.2015.02.03.03.36.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 03:36:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id ms9so50589543lab.1 for ; Tue, 03 Feb 2015 03:36:12 -0800 (PST) X-Received: by 10.112.41.234 with SMTP id i10mr24040398lbl.25.1422963372745; Tue, 03 Feb 2015 03:36:12 -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.35.133 with SMTP id h5csp1879238lbj; Tue, 3 Feb 2015 03:36:12 -0800 (PST) X-Received: by 10.229.174.70 with SMTP id s6mr8239769qcz.7.1422963371314; Tue, 03 Feb 2015 03:36:11 -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 5si28484900qao.63.2015.02.03.03.36.10 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 03:36:11 -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 1YIbm4-0000HY-Fu; Tue, 03 Feb 2015 11:36:08 +0000 Received: from mail-qa0-f46.google.com ([209.85.216.46]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIbln-0000FS-Qb for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 11:35:51 +0000 Received: by mail-qa0-f46.google.com with SMTP id j7so33340712qaq.5 for ; Tue, 03 Feb 2015 03:35:46 -0800 (PST) X-Received: by 10.224.20.198 with SMTP id g6mr17504084qab.89.1422963346638; Tue, 03 Feb 2015 03:35:46 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id e88sm20973034qgf.22.2015.02.03.03.35.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Feb 2015 03:35:46 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 06:35:26 -0500 Message-Id: <1422963328-31760-4-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422963328-31760-1-git-send-email-mike.holmes@linaro.org> References: <1422963328-31760-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 3/5] api: abort: use globaly stored abort function 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: mike.holmes@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.42 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 Use the abort function stored in the global data structure. Signed-off-by: Mike Holmes --- include/odp/api/init.h | 3 +++ platform/linux-generic/include/odp_debug_internal.h | 4 ++-- platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/odp_init.c | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 4b9296b..c5b4e9b 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -91,6 +91,9 @@ void odp_override_abort(void) ODP_NORETURN; /** Replaceable logging function */ typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...); +/** Replaceable abort function */ +typedef void (*odp_abort_func_t)(void) ODP_NORETURN; + /** ODP initialization data. * Data that is required to initialize the ODP API with the * application specific data such as specifying a logging callback, the log diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index 20b6fcc..2b643eb 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -54,7 +54,7 @@ extern "C" { #define ODP_ASSERT(cond, msg) \ do { if ((ODP_DEBUG == 1) && (!(cond))) { \ ODP_ERR("%s\n", msg); \ - odp_override_abort(); } \ + odp_global_data.abort_fn(); } \ } while (0) /** @@ -86,7 +86,7 @@ extern "C" { #define ODP_ABORT(fmt, ...) \ do { \ ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \ - odp_override_abort(); \ + odp_global_data.abort_fn(); \ } while (0) /** diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 608aafd..9a6e29d 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -22,6 +22,7 @@ extern "C" { struct odp_global_data { odp_log_func_t log_fn; + odp_abort_func_t abort_fn; } odp_global_data; int odp_system_info_init(void); diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 6db05b3..e91e910 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -14,6 +14,7 @@ int odp_init_global(odp_init_t *params ODP_UNUSED, odp_platform_init_t *platform_params ODP_UNUSED) { odp_global_data.log_fn = odp_override_log; + odp_global_data.abort_fn = odp_override_abort; if (params != NULL) { if (params->log_fn != NULL)