[API,NEXT,v7,03/14] api: sysinfo: move CPU model API to cpu.h

Message ID 1444734798-29063-4-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Oct. 13, 2015, 11:13 a.m.
From: Hongbo Zhang <hongbo.zhang@linaro.org>

The legacy odp_sys_cpu_model_str() is moved to cpu.h then accordingly
renamed to odp_cpu_model_str(), and all the calling functions are also
updated at same time.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 example/classifier/odp_classifier.c      | 2 +-
 example/generator/odp_generator.c        | 2 +-
 example/ipsec/odp_ipsec.c                | 2 +-
 example/packet/odp_pktio.c               | 2 +-
 example/timer/odp_timer_test.c           | 2 +-
 include/odp/api/cpu.h                    | 9 +++++++++
 include/odp/api/system_info.h            | 7 -------
 platform/linux-generic/odp_system_info.c | 2 +-
 test/api_test/odp_common.c               | 2 +-
 test/performance/odp_atomic.c            | 2 +-
 test/performance/odp_l2fwd.c             | 2 +-
 test/performance/odp_scheduling.c        | 2 +-
 test/validation/system/system.c          | 6 +++---
 test/validation/system/system.h          | 2 +-
 14 files changed, 23 insertions(+), 21 deletions(-)

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 7790313..b98bd46 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -759,7 +759,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 			"Cache line size: %i\n"
 			"CPU count:       %i\n"
 			"\n",
-			odp_version_api_str(), odp_sys_cpu_model_str(),
+			odp_version_api_str(), odp_cpu_model_str(),
 			odp_sys_cpu_hz(), odp_sys_cache_line_size(),
 			odp_cpu_count());
 
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 3bb6c4f..6dd43d6 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -1063,7 +1063,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 6286b0a..5a191ee 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1517,7 +1517,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index ce53ee3..824b755 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -650,7 +650,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 94619e4..2a44862 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -349,7 +349,7 @@  int main(int argc, char *argv[])
 	printf("ODP system info\n");
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
-	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
+	printf("CPU model:       %s\n",        odp_cpu_model_str());
 	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("Max CPU count:   %i\n",        odp_cpu_count());
diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 50a7e3d..554e503 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -46,6 +46,15 @@  int odp_cpu_id(void);
 int odp_cpu_count(void);
 
 /**
+ * CPU model name of this CPU
+ *
+ * Returns the CPU model name of this CPU.
+ *
+ * @return Pointer to CPU model name string
+ */
+const char *odp_cpu_model_str(void);
+
+/**
  * Current CPU cycle count
  *
  * Return current CPU cycle count. Cycle count may not be reset at ODP init
diff --git a/include/odp/api/system_info.h b/include/odp/api/system_info.h
index e55ff6d..1cd883f 100644
--- a/include/odp/api/system_info.h
+++ b/include/odp/api/system_info.h
@@ -45,13 +45,6 @@  uint64_t odp_sys_huge_page_size(void);
 uint64_t odp_sys_page_size(void);
 
 /**
- * CPU model name
- *
- * @return Pointer to CPU model name string
- */
-const char *odp_sys_cpu_model_str(void);
-
-/**
  * Cache line size in bytes
  *
  * @return CPU cache line size in bytes
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index 83226f8..ed6b515 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -389,7 +389,7 @@  uint64_t odp_sys_page_size(void)
 	return odp_global_data.system_info.page_size;
 }
 
-const char *odp_sys_cpu_model_str(void)
+const char *odp_cpu_model_str(void)
 {
 	return odp_global_data.system_info.model_str[0];
 }
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 681d915..2f1f96f 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -41,7 +41,7 @@  void odp_print_system_info(void)
 	printf("ODP system info\n");
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
-	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
+	printf("CPU model:       %s\n",        odp_cpu_model_str());
 	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("CPU count:       %i\n",        odp_cpu_count());
diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c
index 1402a0c..8ba795e 100644
--- a/test/performance/odp_atomic.c
+++ b/test/performance/odp_atomic.c
@@ -337,7 +337,7 @@  void odp_print_system_info(void)
 	printf("ODP system info\n");
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
-	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
+	printf("CPU model:       %s\n",        odp_cpu_model_str());
 	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("CPU count:       %i\n",        odp_cpu_count());
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index e1bd9a8..b7da6e8 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -713,7 +713,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "Cache line size: %i\n"
 	       "CPU count:       %i\n"
 	       "\n",
-	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_sys_cpu_hz(),
 	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index 73eeb72..8a45f3b 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -867,7 +867,7 @@  int main(int argc, char *argv[])
 	printf("ODP system info\n");
 	printf("---------------\n");
 	printf("ODP API version: %s\n",        odp_version_api_str());
-	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
+	printf("CPU model:       %s\n",        odp_cpu_model_str());
 	printf("CPU freq (hz):   %" PRIu64 "\n", odp_sys_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
 	printf("Max CPU count:   %i\n",        odp_cpu_count());
diff --git a/test/validation/system/system.c b/test/validation/system/system.c
index 15f3ac4..0a0aa00 100644
--- a/test/validation/system/system.c
+++ b/test/validation/system/system.c
@@ -49,11 +49,11 @@  void system_test_odp_sys_cache_line_size(void)
 	CU_ASSERT(ODP_CACHE_LINE_SIZE == cache_size);
 }
 
-void system_test_odp_sys_cpu_model_str(void)
+void system_test_odp_cpu_model_str(void)
 {
 	char model[128];
 
-	snprintf(model, 128, "%s", odp_sys_cpu_model_str());
+	snprintf(model, 128, "%s", odp_cpu_model_str());
 	CU_ASSERT(strlen(model) > 0);
 	CU_ASSERT(strlen(model) < 127);
 }
@@ -87,7 +87,7 @@  CU_TestInfo system_suite[] = {
 	_CU_TEST_INFO(system_test_odp_version_numbers),
 	_CU_TEST_INFO(system_test_odp_cpu_count),
 	_CU_TEST_INFO(system_test_odp_sys_cache_line_size),
-	_CU_TEST_INFO(system_test_odp_sys_cpu_model_str),
+	_CU_TEST_INFO(system_test_odp_cpu_model_str),
 	_CU_TEST_INFO(system_test_odp_sys_page_size),
 	_CU_TEST_INFO(system_test_odp_sys_huge_page_size),
 	_CU_TEST_INFO(system_test_odp_sys_cpu_hz),
diff --git a/test/validation/system/system.h b/test/validation/system/system.h
index c8bd2d4..2043a54 100644
--- a/test/validation/system/system.h
+++ b/test/validation/system/system.h
@@ -13,7 +13,7 @@ 
 void system_test_odp_version_numbers(void);
 void system_test_odp_cpu_count(void);
 void system_test_odp_sys_cache_line_size(void);
-void system_test_odp_sys_cpu_model_str(void);
+void system_test_odp_cpu_model_str(void);
 void system_test_odp_sys_page_size(void);
 void system_test_odp_sys_huge_page_size(void);
 void system_test_odp_sys_cpu_hz(void);