[API,NEXT,v5,17/17] linux-generic: update CPU Hz calling functions

Message ID 1442325342-13806-18-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Sept. 15, 2015, 1:55 p.m.
From: Hongbo Zhang <hongbo.zhang@linaro.org>

The previous odp_sys_cpu_hz() is moved to cpu.h and then renamed to
odp_cpu_hz(), but all the calling function of odp{_sys}_cpu_hz() want to
show maximun CPU capacity in fact, so all the odp_sys_cpu_hz() calling
functions are updated to use the newly added odp_cpu_hz_max() instead of
odp_cpu_hz().
This patch updates the linux generic platform codes.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 platform/linux-generic/arch/linux/odp_time_cycles.c | 3 ++-
 platform/linux-generic/odp_time.c                   | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/platform/linux-generic/arch/linux/odp_time_cycles.c b/platform/linux-generic/arch/linux/odp_time_cycles.c
index 4dc0764..ed6e560 100644
--- a/platform/linux-generic/arch/linux/odp_time_cycles.c
+++ b/platform/linux-generic/arch/linux/odp_time_cycles.c
@@ -11,6 +11,7 @@ 
 
 #include <odp/time.h>
 #include <odp/hints.h>
+#include <odp/cpu.h>
 #include <odp/system_info.h>
 #include <odp_debug_internal.h>
 
@@ -27,7 +28,7 @@  uint64_t odp_time_cycles(void)
 	if (ret != 0)
 		ODP_ABORT("clock_gettime failed\n");
 
-	hz  = odp_sys_cpu_hz();
+	hz  = odp_cpu_hz_max();
 	sec = (uint64_t) time.tv_sec;
 	ns  = (uint64_t) time.tv_nsec;
 
diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c
index a08833d..f864ade 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -8,6 +8,7 @@ 
 
 #include <odp/time.h>
 #include <odp/hints.h>
+#include <odp/cpu.h>
 #include <odp/system_info.h>
 
 #define GIGA 1000000000
@@ -22,7 +23,7 @@  uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
 
 uint64_t odp_time_cycles_to_ns(uint64_t cycles)
 {
-	uint64_t hz = odp_sys_cpu_hz();
+	uint64_t hz = odp_cpu_hz_max();
 
 	if (cycles > (UINT64_MAX / GIGA))
 		return (cycles/hz)*GIGA;
@@ -33,7 +34,7 @@  uint64_t odp_time_cycles_to_ns(uint64_t cycles)
 
 uint64_t odp_time_ns_to_cycles(uint64_t ns)
 {
-	uint64_t hz = odp_sys_cpu_hz();
+	uint64_t hz = odp_cpu_hz_max();
 
 	if (ns > (UINT64_MAX / hz))
 		return (ns/GIGA)*hz;