From patchwork Wed Jul 8 14:11:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 50883 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B21CB213FD for ; Wed, 8 Jul 2015 14:14:21 +0000 (UTC) Received: by wizo10 with SMTP id o10sf19551954wiz.0 for ; Wed, 08 Jul 2015 07:14:21 -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:delivered-to:from:to:date :message-id:in-reply-to:references: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=fXRpF6WqgRwalDngPvXK0tMHaCTZYevVM+RuLQ5DS8U=; b=RpHnMHrmB10kvdj+h31835aZlzfK3BNOyl+WBRx25YL4W2P9M0iYgWQj33/yJL30or HZrtTVhTvI3yYUWb0sHOu7Mr40aczCOWEVRcvKPo+8oqSFx6ZaOjpZFtxLBPmX31/k26 ILROIWtsLvKy2o0B/cxb4W2QxwfU0kIxdJUi0CGAyB2Y6H8yFeo8JK8imnymR01Q5FiM YgZI/GFofj+X4mWVyjXxKYjHrkLW+u51r7X4dCfS3wVgZsVLtoZRtS/zMS+hPHJrEBLu m8SqqlKxar9DwjU2KWMQe48qiNxnt4usld6arZWDzTr2lF510xPI1RIwuTTNZiQYvfvQ n6Og== X-Gm-Message-State: ALoCoQnb693ZdrPZEnO3/OwQCi83JybEsoU7ozHjOEUD4Rm1x7nn7hEPZ7cMPduoixPYw/u2goac X-Received: by 10.152.37.101 with SMTP id x5mr4958285laj.5.1436364861015; Wed, 08 Jul 2015 07:14:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.2 with SMTP id ls2ls951789lac.51.gmail; Wed, 08 Jul 2015 07:14:20 -0700 (PDT) X-Received: by 10.152.116.39 with SMTP id jt7mr9698780lab.82.1436364860861; Wed, 08 Jul 2015 07:14:20 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id m2si1760430laj.125.2015.07.08.07.14.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2015 07:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lagc2 with SMTP id c2so223428487lag.3 for ; Wed, 08 Jul 2015 07:14:20 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr9918132lbb.35.1436364860717; Wed, 08 Jul 2015 07:14:20 -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.108.230 with SMTP id hn6csp3129663lbb; Wed, 8 Jul 2015 07:14:19 -0700 (PDT) X-Received: by 10.55.31.22 with SMTP id f22mr16383513qkf.33.1436364859156; Wed, 08 Jul 2015 07:14:19 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l66si3111385qgl.9.2015.07.08.07.14.18; Wed, 08 Jul 2015 07:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 2C9C661E03; Wed, 8 Jul 2015 14:14:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 38AA161E6D; Wed, 8 Jul 2015 14:12:12 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5081761D66; Wed, 8 Jul 2015 14:11:57 +0000 (UTC) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by lists.linaro.org (Postfix) with ESMTPS id CB17861D5E for ; Wed, 8 Jul 2015 14:11:55 +0000 (UTC) Received: by lbbpo10 with SMTP id po10so56949447lbb.3 for ; Wed, 08 Jul 2015 07:11:54 -0700 (PDT) X-Received: by 10.152.20.228 with SMTP id q4mr10027254lae.12.1436364714709; Wed, 08 Jul 2015 07:11:54 -0700 (PDT) Received: from erachmi-VirtualBox.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id zf3sm667823lbb.2.2015.07.08.07.11.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jul 2015 07:11:53 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Wed, 8 Jul 2015 16:11:39 +0200 Message-Id: <1436364701-27420-4-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436364701-27420-1-git-send-email-christophe.milard@linaro.org> References: <1436364701-27420-1-git-send-email-christophe.milard@linaro.org> X-Topics: timers patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCHv2 3/5] validation: cosmetic changes in odp_timer.c X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christophe.milard@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.49 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 As preparation before moving the file (next patch) where the whole file will be checked again by check-patch called via check-odp. Some warnings remains about missing blank lines, after variable declarations, but it would not add to readibility when the variables are declared in the function's body. Also a few "line over 80 char" warning remains, but these lines includes strings which should not be split. Signed-off-by: Christophe Milard --- test/validation/odp_timer.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 3ab395d..754bc1e 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -225,25 +225,25 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) if (tim == ODP_TIMER_INVALID) CU_FAIL("odp_timeout_timer() invalid timer"); - if (ttp == NULL) + if (!ttp) CU_FAIL("odp_timeout_user_ptr() null user ptr"); - if (ttp != NULL && ttp->ev2 != ev) + if (ttp && ttp->ev2 != ev) CU_FAIL("odp_timeout_user_ptr() wrong user ptr"); - if (ttp != NULL && ttp->tim != tim) + if (ttp && ttp->tim != tim) CU_FAIL("odp_timeout_timer() wrong timer"); if (stale) { if (odp_timeout_fresh(tmo)) CU_FAIL("Wrong status (fresh) for stale timeout"); /* Stale timeout => local timer must have invalid tick */ - if (ttp != NULL && ttp->tick != TICK_INVALID) + if (ttp && ttp->tick != TICK_INVALID) CU_FAIL("Stale timeout for active timer"); } else { if (!odp_timeout_fresh(tmo)) CU_FAIL("Wrong status (stale) for fresh timeout"); /* Fresh timeout => local timer must have matching tick */ - if (ttp != NULL && ttp->tick != tick) { - LOG_DBG("Wrong tick: expected %"PRIu64" actual %"PRIu64"\n", + if (ttp && ttp->tick != tick) { + LOG_DBG("Wrong tick: expected %" PRIu64 " actual %" PRIu64 "\n", ttp->tick, tick); CU_FAIL("odp_timeout_tick() wrong tick"); } @@ -251,14 +251,14 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) if (tick > odp_timer_current_tick(tp)) CU_FAIL("Timeout delivered early"); if (tick < prev_tick) { - LOG_DBG("Too late tick: %"PRIu64" prev_tick %"PRIu64"\n", + LOG_DBG("Too late tick: %" PRIu64 " prev_tick %" PRIu64"\n", tick, prev_tick); /* We don't report late timeouts using CU_FAIL */ odp_atomic_inc_u32(&ndelivtoolate); } } - if (ttp != NULL) { + if (ttp) { /* Internal error */ CU_ASSERT_FATAL(ttp->ev == ODP_EVENT_INVALID); ttp->ev = ev; @@ -281,7 +281,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) CU_FAIL_FATAL("Queue create failed"); struct test_timer *tt = malloc(sizeof(struct test_timer) * NTIMERS); - if (tt == NULL) + if (!tt) CU_FAIL_FATAL("malloc failed"); /* Prepare all timers */ @@ -322,6 +322,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) uint32_t ntoolate = 0; uint32_t ms; uint64_t prev_tick = odp_timer_current_tick(tp); + for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) { odp_event_t ev; while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) { @@ -390,13 +391,13 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) CU_FAIL("odp_timer_free"); } - LOG_DBG("Thread %u: %"PRIu32" timers set\n", thr, nset); - LOG_DBG("Thread %u: %"PRIu32" timers reset\n", thr, nreset); - LOG_DBG("Thread %u: %"PRIu32" timers cancelled\n", thr, ncancel); - LOG_DBG("Thread %u: %"PRIu32" timers reset/cancelled too late\n", + LOG_DBG("Thread %u: %" PRIu32 " timers set\n", thr, nset); + LOG_DBG("Thread %u: %" PRIu32 " timers reset\n", thr, nreset); + LOG_DBG("Thread %u: %" PRIu32 " timers cancelled\n", thr, ncancel); + LOG_DBG("Thread %u: %" PRIu32 " timers reset/cancelled too late\n", thr, ntoolate); - LOG_DBG("Thread %u: %"PRIu32" timeouts received\n", thr, nrcv); - LOG_DBG("Thread %u: %"PRIu32" stale timeout(s) after odp_timer_free()\n", + LOG_DBG("Thread %u: %" PRIu32 " timeouts received\n", thr, nrcv); + LOG_DBG("Thread %u: %" PRIu32 " stale timeout(s) after odp_timer_free()\n", thr, nstale); /* Delay some more to ensure timeouts for expired timers can be @@ -482,7 +483,7 @@ static void timer_test_odp_timer_all(void) CU_ASSERT(strcmp(tpinfo.name, NAME) == 0); LOG_DBG("#timers..: %u\n", NTIMERS); - LOG_DBG("Tmo range: %u ms (%"PRIu64" ticks)\n", RANGE_MS, + LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS, odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS)); uint64_t tick; @@ -507,7 +508,7 @@ static void timer_test_odp_timer_all(void) /* Wait for worker threads to exit */ odp_cunit_thread_exit(&thrdarg); - LOG_DBG("Number of timeouts delivered/received too late: %"PRIu32"\n", + LOG_DBG("Number of timeouts delivered/received too late: %" PRIu32 "\n", odp_atomic_load_u32(&ndelivtoolate)); /* Check some statistics after the test */