From patchwork Wed Mar 18 22:17:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 46001 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 05C602153C for ; Wed, 18 Mar 2015 22:18:16 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf9668448lab.1 for ; Wed, 18 Mar 2015 15:18:15 -0700 (PDT) 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:cc: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=SFYUmn68MEyALyL5ts0/TM7Uk4hVkLfalqunxkesovw=; b=aB3TSFySkC3detXDcXcYkr2CuZuTXH6h5pueBd3Fmk6R055UMZo35Dq9YNNsSYgQVt 9s+XYn0Nd7k/dD+KATQoVOJM7HXdWAykFmF3cgTVhDtZpIZAt7icMJhaHUKmNRmnzcdn YJsw5cEvgAs35fIYssZmoHeS3mmSlbWYsGg50t30ehdfq353mVDcD3I6T0Hlz73d+wDo RBavc8IJb+zA2mE8ebr1nkwoPT6A+4lA0J4Ica6tiiqE8xBIDEBQlJngwFWChjeAM0t0 tpqPz8fAvOJF+mPqL4wVUXDI8kIddq3cN1bJFmfhWvH5A7TcoqirvHCRZobtrXYOwd/N siqg== X-Gm-Message-State: ALoCoQnQ051aHARzCML1BOw97iKV4H3lruA+Zb9HQ+1NoduYu/XMC3HwyXz+Eraiu2ac6sgDUM+i X-Received: by 10.112.162.135 with SMTP id ya7mr11355972lbb.14.1426717094957; Wed, 18 Mar 2015 15:18:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.226 with SMTP id t2ls224641laj.42.gmail; Wed, 18 Mar 2015 15:18:14 -0700 (PDT) X-Received: by 10.152.28.233 with SMTP id e9mr66179936lah.3.1426717094701; Wed, 18 Mar 2015 15:18:14 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id ay8si13848107lbc.178.2015.03.18.15.18.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 15:18:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbsy1 with SMTP id sy1so40215791lbb.1 for ; Wed, 18 Mar 2015 15:18:14 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr67966838lac.56.1426717094597; Wed, 18 Mar 2015 15:18:14 -0700 (PDT) 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 h5csp19717lbj; Wed, 18 Mar 2015 15:18:13 -0700 (PDT) X-Received: by 10.140.148.20 with SMTP id 20mr91701423qhu.67.1426717093237; Wed, 18 Mar 2015 15:18:13 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id d65si17976321qga.93.2015.03.18.15.18.11 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 18 Mar 2015 15:18:13 -0700 (PDT) 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 1YYMHv-00082H-Pk; Wed, 18 Mar 2015 22:18:07 +0000 Received: from mail-qc0-f182.google.com ([209.85.216.182]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YYMHi-00081d-HU for lng-odp@lists.linaro.org; Wed, 18 Mar 2015 22:17:54 +0000 Received: by qcto4 with SMTP id o4so51718644qct.3 for ; Wed, 18 Mar 2015 15:17:49 -0700 (PDT) X-Received: by 10.140.89.146 with SMTP id v18mr88539096qgd.65.1426717069323; Wed, 18 Mar 2015 15:17:49 -0700 (PDT) Received: from mike-desktop.?.holmesfamily.ws (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by mx.google.com with ESMTPSA id m68sm11909417qge.15.2015.03.18.15.17.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2015 15:17:48 -0700 (PDT) From: Mike Holmes To: ola.liljedahl@linaro.org Date: Wed, 18 Mar 2015 18:17:39 -0400 Message-Id: <1426717061-21983-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: timers patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 1/3] linux-generic: timer: convert assert to ODP_ASSERT 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.171 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 ODP implementations should not call assert directly. Signed-off-by: Mike Holmes --- platform/linux-generic/odp_timer.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index b7cb04f..39d7064 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -23,9 +23,7 @@ /* For snprint, POSIX timers and sigevent */ #define _POSIX_C_SOURCE 200112L -#include #include -#include #include #include #include @@ -123,8 +121,9 @@ static void timer_init(odp_timer *tim, /* Teardown when timer is freed */ static void timer_fini(odp_timer *tim, tick_buf_t *tb) { - assert(tb->exp_tck.v == TMO_UNUSED); - assert(tb->tmo_buf == ODP_BUFFER_INVALID); + ODP_ASSERT(tb->exp_tck.v == TMO_UNUSED, "tb->exp_tck.v == TMO_UNUSED"); + ODP_ASSERT(tb->tmo_buf == ODP_BUFFER_INVALID, + "tb->tmo_buf == ODP_BUFFER_INVALID"); tim->queue = ODP_QUEUE_INVALID; tim->user_ptr = NULL; } @@ -137,7 +136,8 @@ static inline uint32_t get_next_free(odp_timer *tim) static inline void set_next_free(odp_timer *tim, uint32_t nf) { - assert(tim->queue == ODP_QUEUE_INVALID); + ODP_ASSERT(tim->queue == ODP_QUEUE_INVALID, + "tim->queue == ODP_QUEUE_INVALID"); /* Reusing 'queue' for next free index */ tim->queue = _odp_cast_scalar(odp_queue_t, nf); } @@ -195,7 +195,7 @@ static inline uint32_t handle_to_idx(odp_timer_t hdl, static inline odp_timer_t tp_idx_to_handle(struct odp_timer_pool_s *tp, uint32_t idx) { - assert(idx < (1U << INDEX_BITS)); + ODP_ASSERT(idx < (1U << INDEX_BITS), "idx < (1U << INDEX_BITS)"); return (tp->tp_idx << INDEX_BITS) | idx; } @@ -281,7 +281,8 @@ static inline odp_timer_t timer_alloc(odp_timer_pool *tp, if (odp_likely(tp->num_alloc < tp->param.num_timers)) { tp->num_alloc++; /* Remove first unused timer from free list */ - assert(tp->first_free != tp->param.num_timers); + ODP_ASSERT(tp->first_free != tp->param.num_timers, + "tp->first_free != tp->param.num_timers"); uint32_t idx = tp->first_free; odp_timer *tim = &tp->timers[idx]; tp->first_free = get_next_free(tim); @@ -322,7 +323,7 @@ static inline odp_buffer_t timer_free(odp_timer_pool *tp, uint32_t idx) odp_spinlock_lock(&tp->lock); set_next_free(tim, tp->first_free); tp->first_free = idx; - assert(tp->num_alloc != 0); + ODP_ASSERT(tp->num_alloc != 0, "tp->num_alloc != 0"); tp->num_alloc--; odp_spinlock_unlock(&tp->lock); @@ -597,7 +598,8 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t tpid, uint64_t tick) unsigned nexp = 0; uint32_t i; - assert(high_wm <= tpid->param.num_timers); + ODP_ASSERT(high_wm <= tpid->param.num_timers, + "high_wm <= tpid->param.num_timers"); for (i = 0; i < high_wm;) { #ifdef __ARM_ARCH /* As a rare occurence, we can outsmart the HW prefetcher