From patchwork Tue Apr 8 10:38:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Santosh Shukla X-Patchwork-Id: 27934 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D7F0020447 for ; Tue, 8 Apr 2014 10:38:47 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id l13sf2474312iga.3 for ; Tue, 08 Apr 2014 03:38:47 -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 :mime-version:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=TXj0bmtfh5VOb6m58QsBzKPyPKDVqvc0EdKolZ9LVpU=; b=EhgVXsfN4xDQOX9/pVtR93arna+F5Djbz8iHxIkNGBLsNKpU9w4Iyx3h8oowPr9GcJ rOrJxpcm/Z7bHqHhwPoI7zpkbmWPMUs1scS7ieuoXHAV7HHiiR0UUieycHA3Rs0oqt/V x/OZ1jwzfpHtX2wB8G2NR6Tr/AiYQLknV5oQFDQX4NE/VHQRIi2mdp8n+rN+NqFEpm5W MOA4DjqUxklGzryIsec4qJrphr5c8Eu3OHBYJ6orzogMpd06n8nDoGFAMkOvlJcXlstz EAPF73HVaK8FiAfSvQRpigzWNWrEQMiJceCIl+7RTES+PuLX2JWuBXc9bw/HAL15t1cX +d1A== X-Gm-Message-State: ALoCoQmj/MdDrCnIQiPJYfpLxR3XlHPwPJ5eBWEdll2Va3MttPAFdHe4c7FBCH5Rj+QY0ie8MUfN X-Received: by 10.42.185.1 with SMTP id cm1mr1338319icb.10.1396953527283; Tue, 08 Apr 2014 03:38:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.72 with SMTP id s66ls157387qgd.11.gmail; Tue, 08 Apr 2014 03:38:47 -0700 (PDT) X-Received: by 10.52.99.168 with SMTP id er8mr1902408vdb.26.1396953527127; Tue, 08 Apr 2014 03:38:47 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id h5si309555vcz.214.2014.04.08.03.38.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 03:38:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so565311veb.23 for ; Tue, 08 Apr 2014 03:38:47 -0700 (PDT) X-Received: by 10.52.34.137 with SMTP id z9mr2126749vdi.12.1396953527046; Tue, 08 Apr 2014 03:38:47 -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.220.12.8 with SMTP id v8csp234253vcv; Tue, 8 Apr 2014 03:38:46 -0700 (PDT) X-Received: by 10.224.3.5 with SMTP id 5mr3210024qal.45.1396953526620; Tue, 08 Apr 2014 03:38:46 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id h5si637311qas.165.2014.04.08.03.38.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 08 Apr 2014 03:38:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WXTO9-0004ei-DE; Tue, 08 Apr 2014 10:36:21 +0000 Received: from mail-pd0-f179.google.com ([209.85.192.179]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WXTO2-0004eY-VW for lng-odp@lists.linaro.org; Tue, 08 Apr 2014 10:36:15 +0000 Received: by mail-pd0-f179.google.com with SMTP id w10so822057pde.24 for ; Tue, 08 Apr 2014 03:38:32 -0700 (PDT) X-Received: by 10.66.136.103 with SMTP id pz7mr3598847pab.140.1396953512662; Tue, 08 Apr 2014 03:38:32 -0700 (PDT) Received: from santosh-Latitude-E5530-non-vPro.mvista.com ([111.93.218.67]) by mx.google.com with ESMTPSA id au16sm8414204pac.27.2014.04.08.03.38.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 03:38:31 -0700 (PDT) From: Santosh Shukla To: lng-odp@lists.linaro.org Date: Tue, 8 Apr 2014 16:08:11 +0530 Message-Id: <1396953491-14194-1-git-send-email-santosh.shukla@linaro.org> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Subject: [lng-odp] [ODP/PATCH v2] Timer: build fix for arm 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: , 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: santosh.shukla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 source/odp_timer.c: In function ‘odp_timer_cancel_tmo’:wq! source/odp_timer.c:136:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 8 has type ‘uint64_t’ [-Werror=format=] ODP_ERR("cancel failed for tim id %d tmo id :%d tick idx %lu\n", id, tmo, tick_idx); odp_timer_ping.c: In function ‘ping_init’: odp_timer_ping.c:257:31: error: cast increases required alignment of target type [-Werror=cast-align] dst_addr.sin_addr.s_addr = *(long *)hname->h_addr; - Move ODP_ERR outside spinlock - Replace ODP_ERR with ODP_DBG, as search_and_delete_tmo() func may fail for valid case like entry in list already deleted by timeout handler which is a valid case but then odp_err messaging is wrong..(pointed out by Ola). The invalid case still fall into same loop and may confuse for now, thus need to identify possible erronoing so to decode error message. I am leaving this open for now (possible errorno in timer implementation) ..will evolve in phases (TODO) Signed-off-by: santosh shukla --- v2 : - Move ODP_ERR outside spinlock - Replace ODP_ERR with ODP_DBG, as search_and_delete_tmo() func may fail for valid case like entry in list already deleted by timeout handler which is a valid case but then odp_err messaging is wrong..(pointed out by Ola). The invalid case still fall into same loop and may confuse for now, thus need to identify possible erronoing so to decode error message. I am leaving this open for now (possible errorno in timer implementation) ..will evolve in phases (TODO) platform/linux-generic/source/odp_timer.c | 17 ++++++++--------- test/api_test/odp_timer_ping.c | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/source/odp_timer.c b/platform/linux-generic/source/odp_timer.c index 075de29..6fb5025 100644 --- a/platform/linux-generic/source/odp_timer.c +++ b/platform/linux-generic/source/odp_timer.c @@ -87,8 +87,8 @@ static timeout_t *rem_tmo(tick_t *tick) /** * Search and delete tmo entry from timeout list - * return 0 : on error.. handle not in list - * 1 : success + * return -1 : on error.. handle not in list + * 0 : success */ static int find_and_del_tmo(timeout_t **tmo, odp_timer_tmo_t handle) { @@ -106,13 +106,12 @@ static int find_and_del_tmo(timeout_t **tmo, odp_timer_tmo_t handle) } } - if (!cur) { - ODP_ERR("Couldn't find the tmo handle (%d)\n", handle); - return 0; - } + if (!cur) + /* couldn't find tmo in list */ + return -1; /* application to free tmo_buf provided by absolute_tmo call */ - return 1; + return 0; } int odp_timer_cancel_tmo(odp_timer_t timer, odp_timer_tmo_t tmo) @@ -132,9 +131,9 @@ int odp_timer_cancel_tmo(odp_timer_t timer, odp_timer_tmo_t tmo) odp_spinlock_lock(&tick->lock); /* search and delete tmo from tick list */ - if (find_and_del_tmo(&tick->list, tmo) == 0) { - ODP_ERR("cancel failed for tim id %d tmo id :%d tick idx %lu\n", id, tmo, tick_idx); + if (find_and_del_tmo(&tick->list, tmo) != 0) { odp_spinlock_unlock(&tick->lock); + ODP_DBG("Couldn't find the tmo (%d) in tick list\n", tmo); return -1; } odp_spinlock_unlock(&tick->lock); diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c index 6c84a56..8b297d8 100644 --- a/test/api_test/odp_timer_ping.c +++ b/test/api_test/odp_timer_ping.c @@ -254,7 +254,7 @@ static int ping_init(int count, char *name[]) bzero(&dst_addr, sizeof(dst_addr)); dst_addr.sin_family = hname->h_addrtype; dst_addr.sin_port = 0; - dst_addr.sin_addr.s_addr = *(long *)hname->h_addr; + dst_addr.sin_addr.s_addr = *(long *)(void *)hname->h_addr; } printf("ping to addr %s\n", name[1]);