diff mbox

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

Message ID 1453884974-24724-3-git-send-email-hongbo.zhang@linaro.org
State Accepted
Commit a3b06f7aa23173616515a34a77ac08be22fd1743
Headers show

Commit Message

Hongbo Zhang Jan. 27, 2016, 8:56 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 | 36 ++++++--------------------------
 1 file changed, 6 insertions(+), 30 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index 2e3726e..113ae63 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -25,12 +25,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"
 
@@ -117,7 +111,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;
@@ -181,8 +175,8 @@  static uint64_t arch_cpu_hz_current(int id)
 
 #elif defined __arm__ || defined __aarch64__
 
-static int cpuinfo_arm(FILE *file ODP_UNUSED,
-odp_system_info_t *sysinfo ODP_UNUSED)
+static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+			      odp_system_info_t *sysinfo ODP_UNUSED)
 {
 	return 0;
 }
@@ -194,7 +188,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;
@@ -240,7 +234,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;
@@ -289,24 +283,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__
@@ -398,7 +374,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);