diff mbox

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

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

Commit Message

Hongbo Zhang Jan. 7, 2016, 7:38 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 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)