diff mbox

[API-NEXT,v4,04/10] linux-generic: sysinfo: move CPU model API to cpu.h

Message ID 1439278439-11386-5-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Aug. 11, 2015, 7:33 a.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

This patch moves odp_sys_cpu_model_str() to cpu.h and accordingly rename
it to odp_cpu_model_str(). All the calling functions are also updated.

New CPU model APIs for AMP system will be added into this cpu.h too.

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                    | 7 +++++++
 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, 21 insertions(+), 21 deletions(-)

Comments

Savolainen, Petri (Nokia - FI/Espoo) Sept. 3, 2015, 1:35 p.m. UTC | #1
> --- a/include/odp/api/cpu.h
> +++ b/include/odp/api/cpu.h
> @@ -51,6 +51,13 @@ int odp_cpu_count(void);
>  uint64_t odp_cpu_hz(void);
> 
>  /**
> + * CPU model name
> + *
> + * @return Pointer to CPU model name string
> + */
> +const char *odp_cpu_model_str(void);
> +
> +/**
>   * @}
>   */
>


Similarly here, change documentation directly to the final version: "CPU model name of this CPU".

Complete API changes are easier to track (and book keep) from commit log entries, than partial.


-Petri
Hongbo Zhang Sept. 7, 2015, 10:20 a.m. UTC | #2
On 3 September 2015 at 21:35, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolainen@nokia.com> wrote:
>
>> --- a/include/odp/api/cpu.h
>> +++ b/include/odp/api/cpu.h
>> @@ -51,6 +51,13 @@ int odp_cpu_count(void);
>>  uint64_t odp_cpu_hz(void);
>>
>>  /**
>> + * CPU model name
>> + *
>> + * @return Pointer to CPU model name string
>> + */
>> +const char *odp_cpu_model_str(void);
>> +
>> +/**
>>   * @}
>>   */
>>
>
>
> Similarly here, change documentation directly to the final version: "CPU model name of this CPU".
>
Oh, when you use the words "final version" I understand your point,
you meant update the comment at this time in this patch instead of
doing it later, right? if yes you can ignore my previous doubts :(

> Complete API changes are easier to track (and book keep) from commit log entries, than partial.
>
>
> -Petri
>
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 267b6a5..8b68ce0 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -732,7 +732,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_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 ffe462d..2ed4ea2 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -988,7 +988,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_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_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 54e3c98..32a91e4 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1516,7 +1516,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_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_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 a583302..75de6b8 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -628,7 +628,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_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_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 1528715..b7d3dcd 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_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 8ba9c26..7b548ce 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -51,6 +51,13 @@  int odp_cpu_count(void);
 uint64_t odp_cpu_hz(void);
 
 /**
+ * CPU model name
+ *
+ * @return Pointer to CPU model name string
+ */
+const char *odp_cpu_model_str(void);
+
+/**
  * @}
  */
 
diff --git a/include/odp/api/system_info.h b/include/odp/api/system_info.h
index f188b54..bde3a60 100644
--- a/include/odp/api/system_info.h
+++ b/include/odp/api/system_info.h
@@ -38,13 +38,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 3284ae1..8e903b0 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 80ae581..8d05efe 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_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 c2fdc8b..74d4f3a 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_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 0336dc0..6951837 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -641,7 +641,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_cpu_hz(),
+	       odp_version_api_str(), odp_cpu_model_str(), odp_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 9f8535c..a73f013 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -880,7 +880,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_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 f29e310..54cb7c5 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[] = {
 	{"odp version",  system_test_odp_version_numbers},
 	{"odp_cpu_count",  system_test_odp_cpu_count},
 	{"odp_sys_cache_line_size",  system_test_odp_sys_cache_line_size},
-	{"odp_sys_cpu_model_str",  system_test_odp_sys_cpu_model_str},
+	{"odp_cpu_model_str",  system_test_odp_cpu_model_str},
 	{"odp_sys_page_size",  system_test_odp_sys_page_size},
 	{"odp_sys_huge_page_size",  system_test_odp_sys_huge_page_size},
 	{"odp_cpu_hz",  system_test_odp_cpu_hz},
diff --git a/test/validation/system/system.h b/test/validation/system/system.h
index 9790181..d05f104 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_cpu_hz(void);