diff mbox

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

Message ID 1453281662-31499-9-git-send-email-hongbo.zhang@linaro.org
State Superseded
Headers show

Commit Message

Hongbo Zhang Jan. 20, 2016, 9:20 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 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 264ab28..b6e0e2c 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 fe13f40..83d88ca 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)