From patchwork Thu Jan 7 07:38:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 59270 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp394063lbb; Wed, 6 Jan 2016 23:44:18 -0800 (PST) X-Received: by 10.140.140.80 with SMTP id 77mr71231719qhm.61.1452152658022; Wed, 06 Jan 2016 23:44:18 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a98si80832077qgf.112.2016.01.06.23.44.17; Wed, 06 Jan 2016 23:44:17 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 80481615E3; Thu, 7 Jan 2016 07:44:17 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=YFPrF3gf; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 662CA61C84; Thu, 7 Jan 2016 07:40:41 +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 6DC0A61C84; Thu, 7 Jan 2016 07:40:36 +0000 (UTC) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by lists.linaro.org (Postfix) with ESMTPS id 62CB861C84 for ; Thu, 7 Jan 2016 07:39:09 +0000 (UTC) Received: by mail-pa0-f43.google.com with SMTP id yy13so159604526pab.3 for ; Wed, 06 Jan 2016 23:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UmywHzb0pa1NNYpcfqfZrCVcJnZHi6IG9+nBCG/C4IQ=; b=YFPrF3gfprMvw1gV4Pyqn3D+lD+iOcZYm0fnlmRceV2VgXXXbSKGSRqeeCbkF2+zrA 0zyvVKdfnpskbaAcGtE89ifN49eIm3aE7UQKY+GgfN3uYSaYCZE6twzfM6WiqQICmjey w3P0jQ3KSBUABNkaGQt+xkEBgyI133UKeMsiA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UmywHzb0pa1NNYpcfqfZrCVcJnZHi6IG9+nBCG/C4IQ=; b=XqxL9Ry+d8IBFYjgSI/D/rQQt1QG4r5T2pI7A8jRPgD0QpkYisuwcemTugWChKU/CF nNzvK6ZKyl3/2M5+yQteaIYHA6eJdZmrYQv/LiOJsMZErB4UCsuPBlpWL5VbRZ+el8ok hG2aGnBG61TPMPGdpmzaki/n0MqAAKU0jD8V05KbmQH7JTBuy7RJZtXs+rkfLDE3z2P2 JQZNw22PjHNHlFezhUQLuqurWyCJX2MgdxQKjbmUJvevD7T9IBeGBsNNrY0KVzuxc2Jb 8Os30dPWU+9oNDcLihTHUitwQcrsIR+/7AGWEhd4wr+nPemO/KWE/L7MqyoEH+rzQbml kNsg== X-Gm-Message-State: ALoCoQkQ/UCD3rixRXoJZQyzifJK1He5GxOlmR3G3iA8YLilzppYrk/f6svWM8lIJByqSkmbNsbuZTgB3eXjFiNgJiXojgwpOw== X-Received: by 10.67.14.74 with SMTP id fe10mr150576604pad.151.1452152348750; Wed, 06 Jan 2016 23:39:08 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id tb8sm150067484pab.22.2016.01.06.23.39.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Jan 2016 23:39:07 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Thu, 7 Jan 2016 15:38:29 +0800 Message-Id: <1452152313-27276-9-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452152313-27276-1-git-send-email-hongbo.zhang@linaro.org> References: <1452152313-27276-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v4 API-NEXT 08/12] api: cpu: make frequency API return 0 on failure X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" From: Hongbo Zhang All the CPU frequency API return value type is uint64_t, this patch makes them return 0 on failure instead of -1. Signed-off-by: Hongbo Zhang --- include/odp/api/cpu.h | 4 ++++ platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 2 +- platform/linux-generic/arch/mips64/odp_sysinfo_parse.c | 2 +- platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +- platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +- platform/linux-generic/odp_system_info.c | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 8a804d4..89faa5f 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -71,6 +71,7 @@ const char *odp_cpu_model_str_id(int id); * Returns current frequency of this CPU * * @return CPU frequency in Hz + * @retval 0 on failure */ uint64_t odp_cpu_hz(void); @@ -82,6 +83,7 @@ uint64_t odp_cpu_hz(void); * @param id CPU ID * * @return CPU frequency in Hz + * @retval 0 on failure */ uint64_t odp_cpu_hz_id(int id); @@ -91,6 +93,7 @@ uint64_t odp_cpu_hz_id(int id); * Returns maximum frequency of this CPU * * @return CPU frequency in Hz + * @retval 0 on failure */ uint64_t odp_cpu_hz_max(void); @@ -102,6 +105,7 @@ uint64_t odp_cpu_hz_max(void); * @param id CPU ID * * @return CPU frequency in Hz + * @retval 0 on failure */ uint64_t odp_cpu_hz_max_id(int id); diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c index ba792b2..50abad0 100644 --- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c @@ -16,5 +16,5 @@ odp_system_info_t *sysinfo ODP_UNUSED) uint64_t odp_cpu_hz_current(int id ODP_UNUSED) { - return -1; + return 0; } diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c index 9cedc4f..8b430f5 100644 --- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c @@ -50,5 +50,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) uint64_t odp_cpu_hz_current(int id ODP_UNUSED) { - return -1; + return 0; } diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c index 8d9a8eb..61714f8 100644 --- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c @@ -50,5 +50,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) uint64_t odp_cpu_hz_current(int id ODP_UNUSED) { - return -1; + return 0; } diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c index 2da0b1b..24187f0 100644 --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c @@ -67,5 +67,5 @@ uint64_t odp_cpu_hz_current(int id) if (mhz) return (uint64_t)(mhz * 1000000.0); - return -1; + return 0; } diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index cc84081..ed0897d 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -234,7 +234,7 @@ uint64_t odp_cpu_hz_max_id(int id) if (id >= 0 && id < MAX_CPU_NUMBER) return odp_global_data.system_info.cpu_hz[id]; else - return -1; + return 0; } uint64_t odp_sys_huge_page_size(void)