From patchwork Thu Jan 29 22:52:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 43994 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A1F924128 for ; Thu, 29 Jan 2015 22:53:10 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf24830953lbv.1 for ; Thu, 29 Jan 2015 14:53:09 -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=VtPZPv9xucdbpgMWuxwvmfdRsww61x4X96Rq1XD/1dNgQLyByz+N0FBP12dXLD/9Hy lKbTDuQn+C1gEChoKd8Uopui07MLzkH12g62XcNQhsCO5t6tpfJ0GIuuZCHkWtyasG+v wSOkZYc33cy3a5B7W4FIPdoMpxjWWEO8P6Vw7+FbaQ5Hr1bwZJ8yoXlkZP9zLgu9WXo5 Dgk4TErc9TPjUteZ9Tbiqi2elVY4imBmfTODzHvdf8HFBNuSSrAqK6cuZbmzYXBzpM2v 8/ThZhjfkKjd5zelUefwLydC78XCkVYTC96lkvHf/G4LaHiHMCsHTfYB+sLomwF9ASHF VBhQ== X-Gm-Message-State: ALoCoQni0MwBdr/BnVSkoDf6NV+t7E8JsQ9Sk4GeqHHdDbJGp6Z+1FrydcAwKSq7i6LzCCcbY3rL X-Received: by 10.112.35.135 with SMTP id h7mr410006lbj.23.1422571989054; Thu, 29 Jan 2015 14:53:09 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.37 with SMTP id ll5ls396569lac.53.gmail; Thu, 29 Jan 2015 14:53:08 -0800 (PST) X-Received: by 10.152.219.161 with SMTP id pp1mr3779535lac.30.1422571988845; Thu, 29 Jan 2015 14:53:08 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id j6si8791976lab.20.2015.01.29.14.53.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 14:53:08 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id b6so33436834lbj.11 for ; Thu, 29 Jan 2015 14:53:08 -0800 (PST) X-Received: by 10.152.245.44 with SMTP id xl12mr3540797lac.81.1422571988747; Thu, 29 Jan 2015 14:53:08 -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 h5csp95443lbj; Thu, 29 Jan 2015 14:53:08 -0800 (PST) X-Received: by 10.140.41.169 with SMTP id z38mr2462827qgz.56.1422571987342; Thu, 29 Jan 2015 14:53:07 -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 p32si760703qgd.45.2015.01.29.14.53.06 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 14:53:07 -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 1YGxxQ-0008Lg-62; Thu, 29 Jan 2015 22:53:04 +0000 Received: from mail-qg0-f43.google.com ([209.85.192.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YGxxA-0008Kf-2l for lng-odp@lists.linaro.org; Thu, 29 Jan 2015 22:52:48 +0000 Received: by mail-qg0-f43.google.com with SMTP id e89so35542860qgf.2 for ; Thu, 29 Jan 2015 14:52:43 -0800 (PST) X-Received: by 10.140.34.204 with SMTP id l70mr5852452qgl.55.1422571962936; Thu, 29 Jan 2015 14:52:42 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id q5sm8304624qat.47.2015.01.29.14.52.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 14:52:42 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Thu, 29 Jan 2015 17:52:30 -0500 Message-Id: <1422571952-5132-3-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422571952-5132-1-git-send-email-mike.holmes@linaro.org> References: <1422571952-5132-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 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.217.180 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)