diff mbox

[API-NEXT] linux-generic: sysinfo: update dummy function to pass validation

Message ID 1445344689-20759-1-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Oct. 20, 2015, 12:38 p.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

In the default dummy function systemcpu(), only cpu_hz[0] and model_str[0]
are set to dummy values, then in the validation code if iterate each CPU,
cores other than core 0 report failure, this patchs pad all the arrays to
default values to pass validation.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Hongbo Zhang Oct. 29, 2015, 10:54 a.m. UTC | #1
Please _DO_NOT_ merge this one;
I have sent out an updated version today: https://patches.linaro.org/55776/


On 20 October 2015 at 20:38,  <hongbo.zhang@freescale.com> wrote:
> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>
> In the default dummy function systemcpu(), only cpu_hz[0] and model_str[0]
> are set to dummy values, then in the validation code if iterate each CPU,
> cores other than core 0 report failure, this patchs pad all the arrays to
> default values to pass validation.
>
> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
> ---
>  platform/linux-generic/odp_system_info.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
> index 8bd1584..0b5378a 100644
> --- a/platform/linux-generic/odp_system_info.c
> +++ b/platform/linux-generic/odp_system_info.c
> @@ -358,7 +358,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
>
>  static int systemcpu(odp_system_info_t *sysinfo)
>  {
> -       int ret;
> +       int ret, i;
>
>         ret = sysconf_cpu_count();
>         if (ret == 0) {
> @@ -371,10 +371,13 @@ static int systemcpu(odp_system_info_t *sysinfo)
>         sysinfo->huge_page_size = huge_page_size();
>
>         /* Dummy values */
> -       sysinfo->cpu_hz[0]       = 1400000000;
>         sysinfo->cache_line_size = 64;
>
> -       strncpy(sysinfo->model_str[0], "UNKNOWN", sizeof(sysinfo->model_str));
> +       for (i = 0; i < MAX_CPU_NUMBER; i++) {
> +               sysinfo->cpu_hz[i]       = 1400000000;
> +               strncpy(sysinfo->model_str[i], "UNKNOWN",
> +                       sizeof(sysinfo->model_str));
> +       }
>
>         return 0;
>  }
> --
> 1.9.1
>
diff mbox

Patch

diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index 8bd1584..0b5378a 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -358,7 +358,7 @@  static int systemcpu(odp_system_info_t *sysinfo)
 
 static int systemcpu(odp_system_info_t *sysinfo)
 {
-	int ret;
+	int ret, i;
 
 	ret = sysconf_cpu_count();
 	if (ret == 0) {
@@ -371,10 +371,13 @@  static int systemcpu(odp_system_info_t *sysinfo)
 	sysinfo->huge_page_size = huge_page_size();
 
 	/* Dummy values */
-	sysinfo->cpu_hz[0]       = 1400000000;
 	sysinfo->cache_line_size = 64;
 
-	strncpy(sysinfo->model_str[0], "UNKNOWN", sizeof(sysinfo->model_str));
+	for (i = 0; i < MAX_CPU_NUMBER; i++) {
+		sysinfo->cpu_hz[i]       = 1400000000;
+		strncpy(sysinfo->model_str[i], "UNKNOWN",
+			sizeof(sysinfo->model_str));
+	}
 
 	return 0;
 }