diff mbox

[v5,API-NEXT,02/12] linux-generic: sysinfo: use uniform call odp_sysinfo_parser

Message ID 1453111808-15762-3-git-send-email-hongbo.zhang@linaro.org
State Superseded
Headers show

Commit Message

Hongbo Zhang Jan. 18, 2016, 10:09 a.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

It is common way that the general top layer calls a uniform interface to
initialize data structrure for different plarform, this patch introduces
odp_sysinfo_parser() instead of using different interfaces for each
platform, and also removes using structure odp_compiler_info_t since both
members inside it become useless now.
This is still another pre-step for separating platform specific codes into
their own arch files.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 34 +++++---------------------------
 1 file changed, 5 insertions(+), 29 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index 8cbdd58..a829b01 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -24,12 +24,6 @@ 
 #include <dirent.h>
 
 
-
-typedef struct {
-	int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
-
-} odp_compiler_info_t;
-
 #define CACHE_LNSZ_FILE \
 	"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
 
@@ -116,7 +110,7 @@  static int huge_page_size(void)
  */
 #if defined __x86_64__ || defined __i386__
 
-static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
 	char str[1024];
 	char *pos;
@@ -180,7 +174,7 @@  static uint64_t arch_cpu_hz_current(int id)
 
 #elif defined __arm__ || defined __aarch64__
 
-static int cpuinfo_arm(FILE *file ODP_UNUSED,
+static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
 odp_system_info_t *sysinfo ODP_UNUSED)
 {
 	return 0;
@@ -193,7 +187,7 @@  static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 #elif defined __OCTEON__
 
-static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
 	char str[1024];
 	char *pos;
@@ -239,7 +233,7 @@  static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 }
 
 #elif defined __powerpc__
-static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
 	char str[1024];
 	char *pos;
@@ -288,24 +282,6 @@  static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 	#error GCC target not found
 #endif
 
-static odp_compiler_info_t compiler_info = {
-	#if defined __x86_64__ || defined __i386__
-	.cpuinfo_parser = cpuinfo_x86
-
-	#elif defined __arm__ || defined __aarch64__
-	.cpuinfo_parser = cpuinfo_arm
-
-	#elif defined __OCTEON__
-	.cpuinfo_parser = cpuinfo_octeon
-
-	#elif defined __powerpc__
-	.cpuinfo_parser = cpuinfo_powerpc
-
-	#else
-	#error GCC target not found
-	#endif
-};
-
 
 #if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \
 defined __powerpc__
@@ -397,7 +373,7 @@  int odp_system_info_init(void)
 		return -1;
 	}
 
-	compiler_info.cpuinfo_parser(file, &odp_global_data.system_info);
+	odp_cpuinfo_parser(file, &odp_global_data.system_info);
 
 	fclose(file);