diff mbox

[v5,API-NEXT,08/12] api: cpu: make frequency API return 0 on failure

Message ID 1453111808-15762-9-git-send-email-hongbo.zhang@linaro.org
State New
Headers show

Commit Message

Hongbo Zhang Jan. 18, 2016, 10:10 a.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

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 <hongbo.zhang@linaro.org>
---
 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 mbox

Patch

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 d8f36a4..cb5626e 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 @@  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 cc75b96..fd3cb0a 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 3f8743c..c471a82 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/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/x86/odp_sysinfo_parse.c b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 85cc34c..71c7c9f 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -66,5 +66,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 4ab17aa..c9cdcb4 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -233,7 +233,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)