Patchwork lib: fwts_virt: fix non-Intel build errors

login
register
mail settings
Submitter Colin King
Date Dec. 7, 2012, 10:09 a.m.
Message ID <1354874993-30383-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/204442/
State Accepted
Headers show

Comments

Colin King - Dec. 7, 2012, 10:09 a.m.
From: Colin Ian King <colin.king@canonical.com>

This fixes a -Wextra build error for non-Intel builds.  This function
is only used in x86 tests so we can just make this function return dummy
values anyway since it is never called on non-x86 systems.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_virt.c | 8 ++++++++
 1 file changed, 8 insertions(+)
Keng-Yu Lin - Dec. 10, 2012, 7:14 a.m.
On Fri, Dec 7, 2012 at 6:09 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This fixes a -Wextra build error for non-Intel builds.  This function
> is only used in x86 tests so we can just make this function return dummy
> values anyway since it is never called on non-x86 systems.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_virt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/src/lib/src/fwts_virt.c b/src/lib/src/fwts_virt.c
> index ad5bec0..3c3831b 100644
> --- a/src/lib/src/fwts_virt.c
> +++ b/src/lib/src/fwts_virt.c
> @@ -58,6 +58,14 @@ void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs)
>                               "=c"(regs->ecx),"=d"(regs->edx)
>                            : "a"(cmd)
>         );
> +#else
> +       /* Non x86 we just fake it */
> +       FWTS_UNUSED(cmd);
> +
> +       regs->eax = 0;
> +       regs->ebx = 0;
> +       regs->ecx = 0;
> +       regs->edx = 0;
>  #endif
>
>         if (cpu != CURRENT_CPU)
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Ivan Hu - Dec. 14, 2012, 12:06 a.m.
On 12/07/2012 06:09 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This fixes a -Wextra build error for non-Intel builds.  This function
> is only used in x86 tests so we can just make this function return dummy
> values anyway since it is never called on non-x86 systems.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_virt.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/src/lib/src/fwts_virt.c b/src/lib/src/fwts_virt.c
> index ad5bec0..3c3831b 100644
> --- a/src/lib/src/fwts_virt.c
> +++ b/src/lib/src/fwts_virt.c
> @@ -58,6 +58,14 @@ void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs)
>                                "=c"(regs->ecx),"=d"(regs->edx)
>   			   : "a"(cmd)
>   	);
> +#else
> +	/* Non x86 we just fake it */
> +	FWTS_UNUSED(cmd);
> +
> +	regs->eax = 0;
> +	regs->ebx = 0;
> +	regs->ecx = 0;
> +	regs->edx = 0;
>   #endif
>
>   	if (cpu != CURRENT_CPU)
>
Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/lib/src/fwts_virt.c b/src/lib/src/fwts_virt.c
index ad5bec0..3c3831b 100644
--- a/src/lib/src/fwts_virt.c
+++ b/src/lib/src/fwts_virt.c
@@ -58,6 +58,14 @@  void fwts_exec_cpuid(const int cpu, const uint32_t cmd, cpu_registers* regs)
                              "=c"(regs->ecx),"=d"(regs->edx)
 			   : "a"(cmd)
 	);
+#else
+	/* Non x86 we just fake it */
+	FWTS_UNUSED(cmd);
+
+	regs->eax = 0;
+	regs->ebx = 0;
+	regs->ecx = 0;
+	regs->edx = 0;
 #endif
 
 	if (cpu != CURRENT_CPU)