From patchwork Fri Jul 3 15:45:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 50643 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 338B222916 for ; Fri, 3 Jul 2015 15:48:10 +0000 (UTC) Received: by lagh6 with SMTP id h6sf29676084lag.0 for ; Fri, 03 Jul 2015 08:48:09 -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=+gmdCOHPmA5eONKvZRRiods3LHX1Fa7zkCEpje59IMA=; b=l0EJbS988RAm/CAOC88CHQBgDYj/gcoZbAvE0uXiCtE69sQ23RwTYjdwXlD58IDyBm /bPCnOgNphGtWLw0cgR+9JYSoAkuWzqqkZeH34pYqO+lRexuR/X0yYjcH++RgKhf36X2 K6gFYeo7t3R3RethytMJLsDSQh8pLhJx7dfD+QL8ONwSk2NOVjKdXpexUhNjUlVGhu9b jVnSSGrkE8Q5+Sf3RKT4akQHEOwzk8O9eoL1v4FjnPVMUj7ctjcKkFEf5T/4YboTAbQt 5YUWybMlejMswNfRAWBXXT0J01QPgllxryPqp9R4JRdWqKQAHcIkkscTXS9uY0yWAnEK uZVg== X-Gm-Message-State: ALoCoQlcv+v8qB7ShUInB4Q2uZJ+oOMERUnV2JCH9XYv8aTOaJRl4A6T0NIyUwDfsfFVTueonBeb X-Received: by 10.194.58.164 with SMTP id s4mr22990719wjq.3.1435938489059; Fri, 03 Jul 2015 08:48:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.40 with SMTP id v8ls462315laj.88.gmail; Fri, 03 Jul 2015 08:48:08 -0700 (PDT) X-Received: by 10.112.29.110 with SMTP id j14mr36298212lbh.5.1435938488632; Fri, 03 Jul 2015 08:48:08 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id to6si7515500lbb.131.2015.07.03.08.48.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jul 2015 08:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagx9 with SMTP id x9so89752039lag.1 for ; Fri, 03 Jul 2015 08:48:08 -0700 (PDT) X-Received: by 10.112.42.50 with SMTP id k18mr33573686lbl.76.1435938488351; Fri, 03 Jul 2015 08:48:08 -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 hn6csp113807lbb; Fri, 3 Jul 2015 08:48:07 -0700 (PDT) X-Received: by 10.140.164.147 with SMTP id k141mr55519115qhk.62.1435938486914; Fri, 03 Jul 2015 08:48:06 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 189si10727668qhr.113.2015.07.03.08.47.36; Fri, 03 Jul 2015 08:48:06 -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 AB51F61D23; Fri, 3 Jul 2015 15:47:36 +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 BADD861D34; Fri, 3 Jul 2015 15:46:33 +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 C236C61D23; Fri, 3 Jul 2015 15:46:27 +0000 (UTC) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by lists.linaro.org (Postfix) with ESMTPS id F2F4061D30 for ; Fri, 3 Jul 2015 15:45:58 +0000 (UTC) Received: by lagh6 with SMTP id h6so89631198lag.2 for ; Fri, 03 Jul 2015 08:45:58 -0700 (PDT) X-Received: by 10.112.39.71 with SMTP id n7mr36421981lbk.44.1435938357962; Fri, 03 Jul 2015 08:45:57 -0700 (PDT) Received: from erachmi-VirtualBox.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by mx.google.com with ESMTPSA id fb5sm2416637lbc.35.2015.07.03.08.45.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jul 2015 08:45:57 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Fri, 3 Jul 2015 17:45:38 +0200 Message-Id: <1435938340-7512-4-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435938340-7512-1-git-send-email-christophe.milard@linaro.org> References: <1435938340-7512-1-git-send-email-christophe.milard@linaro.org> X-Topics: timers patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 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.43 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 | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 3ab395d..9efb360 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -225,25 +225,26 @@ 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 +252,15 @@ 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 +283,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 +324,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 +393,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 +485,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 +510,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 */