From patchwork Tue Jan 19 10:17:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 59972 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2484937lbb; Tue, 19 Jan 2016 02:23:49 -0800 (PST) X-Received: by 10.55.204.80 with SMTP id r77mr38022327qki.25.1453199029747; Tue, 19 Jan 2016 02:23:49 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 107si36796450qgo.100.2016.01.19.02.23.49; Tue, 19 Jan 2016 02:23:49 -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 2C5B561722; Tue, 19 Jan 2016 10:23:49 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=dXsRbWSU; 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 BB94061794; Tue, 19 Jan 2016 10:19:11 +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 1E0BC61684; Tue, 19 Jan 2016 10:19:05 +0000 (UTC) Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by lists.linaro.org (Postfix) with ESMTPS id 3043B61684 for ; Tue, 19 Jan 2016 10:17:47 +0000 (UTC) Received: by mail-pf0-f178.google.com with SMTP id e65so173608132pfe.0 for ; Tue, 19 Jan 2016 02:17:47 -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=P0ORbMUQVODJL4TKHvRQRIPcr4qa9jDuEYG+SqOHq6k=; b=dXsRbWSUTz8+CQmRM80NPg0Uy8GTOpH/pmPMsvL1KAlSpOGYHGygDytu8VYPJNl9nc CI1nzQ5N6mIQQv8bZgqxsL8obc0Ed9ZokkWQ+t/hqNIgXgoA0MqlI3gBx/+QQiI2eIj4 6LSrnBgn7gOnFdd6CjFz+WQIKdYiHd1UVukq0= 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=P0ORbMUQVODJL4TKHvRQRIPcr4qa9jDuEYG+SqOHq6k=; b=NyaUKKzF0+zAjNi7iYUdMmJGH5+usL1od/K2FqiK4u0DeX8PU86vK/ugjfMhj89u4q 9OYOoBU/8oyQrloNSVgidgYXFuDQ8UUQbcJ4Az8fpFpGArPfKKWkPsm4debeo5WEuyzz faTLtmb7WOpUOP59ovZCbH+F1sa+vfffRwYr+0ZqTW5ZsY2Yin7+lL1VYibOn1g5yWPu zlAFz7uf4enJLOiL9zL5aqnYwjSI5jj/7wZ5UJKJCK7ww9EWIgXleHZIa+4EfpSThulV kqjLFoN9Sh4ezmiQ4oPqXofUJB7hwz7n4/rMjX91LWCWe/Brv11Tn6fWdmTWpt479+u1 eXqg== X-Gm-Message-State: ALoCoQnRFmXgegSGf3a1AYBHEPpV+tfxp6IBr/keAj2oZhGasl1sGn08HI4mZkB4LEFM2L4SzK16ARVd4ToZ22d1YFcYhVxtzQ== X-Received: by 10.98.0.7 with SMTP id 7mr42163675pfa.5.1453198666547; Tue, 19 Jan 2016 02:17:46 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id k74sm40313374pfb.30.2016.01.19.02.17.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 02:17:45 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Tue, 19 Jan 2016 18:17:09 +0800 Message-Id: <1453198633-24365-9-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453198633-24365-1-git-send-email-hongbo.zhang@linaro.org> References: <1453198633-24365-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v6 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 4cbaf58..eaee24b 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 881dd2d..8ff6f48 100644 --- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c @@ -15,5 +15,5 @@ int odp_cpuinfo_parser(FILE *file 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 d855637..8e8a9d0 100644 --- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c @@ -49,5 +49,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 5a6063a..fadd1d1 100644 --- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c @@ -48,5 +48,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 e2931cb..831a53a 100644 --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c @@ -68,5 +68,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 e4992b5..de187a0 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -241,7 +241,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)