diff mbox series

[XEN,for-4.19,v3,1/8] xen: add declarations for variables where needed

Message ID 4d419cbffc84e0f9934794d105705ac64094a54a.1697722648.git.nicola.vetrini@bugseng.com (mailing list archive)
State Superseded
Headers show
Series Fix or deviate various instances of missing declarations | expand

Commit Message

Nicola Vetrini Oct. 19, 2023, 1:39 p.m. UTC
Some variables with external linkage used in C code do not have
a visible declaration where they are defined. Providing such
declaration also resolves violations of MISRA C:2012 Rule 8.4.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
Changes in v2:
- make xenpf_lock static on ARM
Changes in v3:
- moved back code from symbols.h to symbols.c
- dropped two declarations, now deviated
---
 xen/arch/arm/include/asm/setup.h  | 3 +++
 xen/arch/arm/include/asm/smp.h    | 3 +++
 xen/arch/arm/platform_hypercall.c | 2 +-
 xen/arch/x86/cpu/mcheck/mce.c     | 6 +++---
 xen/arch/x86/irq.c                | 2 +-
 xen/include/xen/symbols.h         | 1 +
 6 files changed, 12 insertions(+), 5 deletions(-)

Comments

Stefano Stabellini Oct. 19, 2023, 9:13 p.m. UTC | #1
On Thu, 19 Oct 2023, Nicola Vetrini wrote:
> Some variables with external linkage used in C code do not have
> a visible declaration where they are defined. Providing such
> declaration also resolves violations of MISRA C:2012 Rule 8.4.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
> Changes in v2:
> - make xenpf_lock static on ARM
> Changes in v3:
> - moved back code from symbols.h to symbols.c
> - dropped two declarations, now deviated
> ---
>  xen/arch/arm/include/asm/setup.h  | 3 +++
>  xen/arch/arm/include/asm/smp.h    | 3 +++
>  xen/arch/arm/platform_hypercall.c | 2 +-
>  xen/arch/x86/cpu/mcheck/mce.c     | 6 +++---
>  xen/arch/x86/irq.c                | 2 +-
>  xen/include/xen/symbols.h         | 1 +
>  6 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
> index 98af6f55f5a0..2a2d6114f2eb 100644
> --- a/xen/arch/arm/include/asm/setup.h
> +++ b/xen/arch/arm/include/asm/setup.h
> @@ -184,9 +184,12 @@ int map_range_to_domain(const struct dt_device_node *dev,
>  extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
>  
>  #ifdef CONFIG_ARM_64
> +extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
>  extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
>  #endif
> +extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
>  extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
> +extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
>  extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
>  
>  /* Find where Xen will be residing at runtime and return a PT entry */
> diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
> index 4fabdf5310d8..28bf24a01d95 100644
> --- a/xen/arch/arm/include/asm/smp.h
> +++ b/xen/arch/arm/include/asm/smp.h
> @@ -6,6 +6,9 @@
>  #include <asm/current.h>
>  #endif
>  
> +extern struct init_info init_data;
> +extern unsigned long smp_up_cpu;
> +
>  DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
>  DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
>  
> diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hypercall.c
> index 743687a30390..fde4bc3e5809 100644
> --- a/xen/arch/arm/platform_hypercall.c
> +++ b/xen/arch/arm/platform_hypercall.c
> @@ -17,7 +17,7 @@
>  #include <asm/current.h>
>  #include <asm/event.h>
>  
> -DEFINE_SPINLOCK(xenpf_lock);
> +static DEFINE_SPINLOCK(xenpf_lock);
>  
>  long do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
>  {
> diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
> index 6141b7eb9cf1..e855f958030d 100644
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -1682,13 +1682,13 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>      return ret;
>  }
>  
> -int mcinfo_dumpped;
> +static int mcinfo_dumped;
>  static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc)
>  {
>      struct mc_info *mcip = mctelem_dataptr(mctc);
>  
>      x86_mcinfo_dump(mcip);
> -    mcinfo_dumpped++;
> +    mcinfo_dumped++;
>  
>      return 0;
>  }
> @@ -1702,7 +1702,7 @@ static void mc_panic_dump(void)
>      for_each_online_cpu(cpu)
>          mctelem_process_deferred(cpu, x86_mcinfo_dump_panic,
>                                   mctelem_has_deferred_lmce(cpu));
> -    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", mcinfo_dumpped);
> +    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", mcinfo_dumped);
>  }
>  
>  void mc_panic(const char *s)
> diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
> index 6abfd8162120..604dba94b052 100644
> --- a/xen/arch/x86/irq.c
> +++ b/xen/arch/x86/irq.c
> @@ -43,7 +43,7 @@ int __read_mostly opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_DEFAULT;
>  static unsigned char __read_mostly irq_max_guests;
>  integer_param("irq-max-guests", irq_max_guests);
>  
> -vmask_t global_used_vector_map;
> +static vmask_t global_used_vector_map;
>  
>  struct irq_desc __read_mostly *irq_desc = NULL;
>  
> diff --git a/xen/include/xen/symbols.h b/xen/include/xen/symbols.h
> index 20bbb28ef226..1b2863663aa0 100644
> --- a/xen/include/xen/symbols.h
> +++ b/xen/include/xen/symbols.h
> @@ -33,4 +33,5 @@ struct symbol_offset {
>      uint32_t stream; /* .. in the compressed stream.*/
>      uint32_t addr;   /* .. and in the fixed size address array. */
>  };
> +
>  #endif /*_XEN_SYMBOLS_H*/

Spurious change.

Aside from this:

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Nicola Vetrini Oct. 20, 2023, 7:07 a.m. UTC | #2
On 19/10/2023 23:13, Stefano Stabellini wrote:
> On Thu, 19 Oct 2023, Nicola Vetrini wrote:
>> Some variables with external linkage used in C code do not have
>> a visible declaration where they are defined. Providing such
>> declaration also resolves violations of MISRA C:2012 Rule 8.4.
>> 
>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>> ---
>> Changes in v2:
>> - make xenpf_lock static on ARM
>> Changes in v3:
>> - moved back code from symbols.h to symbols.c
>> - dropped two declarations, now deviated
>> ---
>>  xen/arch/arm/include/asm/setup.h  | 3 +++
>>  xen/arch/arm/include/asm/smp.h    | 3 +++
>>  xen/arch/arm/platform_hypercall.c | 2 +-
>>  xen/arch/x86/cpu/mcheck/mce.c     | 6 +++---
>>  xen/arch/x86/irq.c                | 2 +-
>>  xen/include/xen/symbols.h         | 1 +
>>  6 files changed, 12 insertions(+), 5 deletions(-)
>> 
>> diff --git a/xen/arch/arm/include/asm/setup.h 
>> b/xen/arch/arm/include/asm/setup.h
>> index 98af6f55f5a0..2a2d6114f2eb 100644
>> --- a/xen/arch/arm/include/asm/setup.h
>> +++ b/xen/arch/arm/include/asm/setup.h
>> @@ -184,9 +184,12 @@ int map_range_to_domain(const struct 
>> dt_device_node *dev,
>>  extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
>> 
>>  #ifdef CONFIG_ARM_64
>> +extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
>>  extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
>>  #endif
>> +extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
>>  extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
>> +extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
>>  extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
>> 
>>  /* Find where Xen will be residing at runtime and return a PT entry 
>> */
>> diff --git a/xen/arch/arm/include/asm/smp.h 
>> b/xen/arch/arm/include/asm/smp.h
>> index 4fabdf5310d8..28bf24a01d95 100644
>> --- a/xen/arch/arm/include/asm/smp.h
>> +++ b/xen/arch/arm/include/asm/smp.h
>> @@ -6,6 +6,9 @@
>>  #include <asm/current.h>
>>  #endif
>> 
>> +extern struct init_info init_data;
>> +extern unsigned long smp_up_cpu;
>> +
>>  DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
>>  DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
>> 
>> diff --git a/xen/arch/arm/platform_hypercall.c 
>> b/xen/arch/arm/platform_hypercall.c
>> index 743687a30390..fde4bc3e5809 100644
>> --- a/xen/arch/arm/platform_hypercall.c
>> +++ b/xen/arch/arm/platform_hypercall.c
>> @@ -17,7 +17,7 @@
>>  #include <asm/current.h>
>>  #include <asm/event.h>
>> 
>> -DEFINE_SPINLOCK(xenpf_lock);
>> +static DEFINE_SPINLOCK(xenpf_lock);
>> 
>>  long do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) 
>> u_xenpf_op)
>>  {
>> diff --git a/xen/arch/x86/cpu/mcheck/mce.c 
>> b/xen/arch/x86/cpu/mcheck/mce.c
>> index 6141b7eb9cf1..e855f958030d 100644
>> --- a/xen/arch/x86/cpu/mcheck/mce.c
>> +++ b/xen/arch/x86/cpu/mcheck/mce.c
>> @@ -1682,13 +1682,13 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) 
>> u_xen_mc)
>>      return ret;
>>  }
>> 
>> -int mcinfo_dumpped;
>> +static int mcinfo_dumped;
>>  static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc)
>>  {
>>      struct mc_info *mcip = mctelem_dataptr(mctc);
>> 
>>      x86_mcinfo_dump(mcip);
>> -    mcinfo_dumpped++;
>> +    mcinfo_dumped++;
>> 
>>      return 0;
>>  }
>> @@ -1702,7 +1702,7 @@ static void mc_panic_dump(void)
>>      for_each_online_cpu(cpu)
>>          mctelem_process_deferred(cpu, x86_mcinfo_dump_panic,
>>                                   mctelem_has_deferred_lmce(cpu));
>> -    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", 
>> mcinfo_dumpped);
>> +    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", 
>> mcinfo_dumped);
>>  }
>> 
>>  void mc_panic(const char *s)
>> diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
>> index 6abfd8162120..604dba94b052 100644
>> --- a/xen/arch/x86/irq.c
>> +++ b/xen/arch/x86/irq.c
>> @@ -43,7 +43,7 @@ int __read_mostly opt_irq_vector_map = 
>> OPT_IRQ_VECTOR_MAP_DEFAULT;
>>  static unsigned char __read_mostly irq_max_guests;
>>  integer_param("irq-max-guests", irq_max_guests);
>> 
>> -vmask_t global_used_vector_map;
>> +static vmask_t global_used_vector_map;
>> 
>>  struct irq_desc __read_mostly *irq_desc = NULL;
>> 
>> diff --git a/xen/include/xen/symbols.h b/xen/include/xen/symbols.h
>> index 20bbb28ef226..1b2863663aa0 100644
>> --- a/xen/include/xen/symbols.h
>> +++ b/xen/include/xen/symbols.h
>> @@ -33,4 +33,5 @@ struct symbol_offset {
>>      uint32_t stream; /* .. in the compressed stream.*/
>>      uint32_t addr;   /* .. and in the fixed size address array. */
>>  };
>> +
>>  #endif /*_XEN_SYMBOLS_H*/
> 
> Spurious change.
> 
> Aside from this:
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

I left it in on purpose, to separate code from the header guard.
Julien Grall Oct. 20, 2023, 7:59 a.m. UTC | #3
Hi,

On 19/10/2023 14:39, Nicola Vetrini wrote:
> Some variables with external linkage used in C code do not have
> a visible declaration where they are defined. Providing such
> declaration also resolves violations of MISRA C:2012 Rule 8.4.

The commit message doesn't match the code in several places.

> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
> Changes in v2:
> - make xenpf_lock static on ARM
> Changes in v3:
> - moved back code from symbols.h to symbols.c
> - dropped two declarations, now deviated
> ---
>   xen/arch/arm/include/asm/setup.h  | 3 +++
>   xen/arch/arm/include/asm/smp.h    | 3 +++
>   xen/arch/arm/platform_hypercall.c | 2 +-
>   xen/arch/x86/cpu/mcheck/mce.c     | 6 +++---
>   xen/arch/x86/irq.c                | 2 +-
>   xen/include/xen/symbols.h         | 1 +
>   6 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
> index 98af6f55f5a0..2a2d6114f2eb 100644
> --- a/xen/arch/arm/include/asm/setup.h
> +++ b/xen/arch/arm/include/asm/setup.h
> @@ -184,9 +184,12 @@ int map_range_to_domain(const struct dt_device_node *dev,
>   extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
>   
>   #ifdef CONFIG_ARM_64
> +extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
>   extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
>   #endif
> +extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
>   extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
> +extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
>   extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
>   
>   /* Find where Xen will be residing at runtime and return a PT entry */
> diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
> index 4fabdf5310d8..28bf24a01d95 100644
> --- a/xen/arch/arm/include/asm/smp.h
> +++ b/xen/arch/arm/include/asm/smp.h
> @@ -6,6 +6,9 @@
>   #include <asm/current.h>
>   #endif
>   
> +extern struct init_info init_data;
> +extern unsigned long smp_up_cpu;
> +
>   DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
>   DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
>   
> diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hypercall.c
> index 743687a30390..fde4bc3e5809 100644
> --- a/xen/arch/arm/platform_hypercall.c
> +++ b/xen/arch/arm/platform_hypercall.c
> @@ -17,7 +17,7 @@
>   #include <asm/current.h>
>   #include <asm/event.h>
>   
> -DEFINE_SPINLOCK(xenpf_lock);
> +static DEFINE_SPINLOCK(xenpf_lock);

The commit message suggest we would add an external definition but here 
you add a 'static'. I am fine the static but it needs to clarify.

>   
>   long do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
>   {
> diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
> index 6141b7eb9cf1..e855f958030d 100644
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -1682,13 +1682,13 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>       return ret;
>   }
>   
> -int mcinfo_dumpped;
> +static int mcinfo_dumped;

Same for the static. But you are also renaming the variable without 
explanation. Yes I know there are a typo, the point here is the commit 
message needs to reflect what you are doing.

>   static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc)
>   {
>       struct mc_info *mcip = mctelem_dataptr(mctc);
>   
>       x86_mcinfo_dump(mcip);
> -    mcinfo_dumpped++;
> +    mcinfo_dumped++;
>   
>       return 0;
>   }
> @@ -1702,7 +1702,7 @@ static void mc_panic_dump(void)
>       for_each_online_cpu(cpu)
>           mctelem_process_deferred(cpu, x86_mcinfo_dump_panic,
>                                    mctelem_has_deferred_lmce(cpu));
> -    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", mcinfo_dumpped);
> +    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", mcinfo_dumped);
>   }
>   
>   void mc_panic(const char *s)
> diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
> index 6abfd8162120..604dba94b052 100644
> --- a/xen/arch/x86/irq.c
> +++ b/xen/arch/x86/irq.c
> @@ -43,7 +43,7 @@ int __read_mostly opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_DEFAULT;
>   static unsigned char __read_mostly irq_max_guests;
>   integer_param("irq-max-guests", irq_max_guests);
>   
> -vmask_t global_used_vector_map;
> +static vmask_t global_used_vector_map;

Same for the static.

>   
>   struct irq_desc __read_mostly *irq_desc = NULL;
>   
> diff --git a/xen/include/xen/symbols.h b/xen/include/xen/symbols.h
> index 20bbb28ef226..1b2863663aa0 100644
> --- a/xen/include/xen/symbols.h
> +++ b/xen/include/xen/symbols.h
> @@ -33,4 +33,5 @@ struct symbol_offset {
>       uint32_t stream; /* .. in the compressed stream.*/
>       uint32_t addr;   /* .. and in the fixed size address array. */
>   };
> +
>   #endif /*_XEN_SYMBOLS_H*/

Cheers,
Jan Beulich Oct. 20, 2023, 8:14 a.m. UTC | #4
On 19.10.2023 15:39, Nicola Vetrini wrote:
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -1682,13 +1682,13 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>      return ret;
>  }
>  
> -int mcinfo_dumpped;
> +static int mcinfo_dumped;
>  static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc)

While there, please also insert the missing blank line between the
two entities.

Jan
Nicola Vetrini Oct. 20, 2023, 8:26 a.m. UTC | #5
On 20/10/2023 09:59, Julien Grall wrote:
> Hi,
> 
> On 19/10/2023 14:39, Nicola Vetrini wrote:
>> Some variables with external linkage used in C code do not have
>> a visible declaration where they are defined. Providing such
>> declaration also resolves violations of MISRA C:2012 Rule 8.4.
> 
> The commit message doesn't match the code in several places.
> 

That's true; I'll do a more detailed summary of the changes.
Nicola Vetrini Oct. 20, 2023, 8:26 a.m. UTC | #6
On 20/10/2023 10:14, Jan Beulich wrote:
> On 19.10.2023 15:39, Nicola Vetrini wrote:
>> --- a/xen/arch/x86/cpu/mcheck/mce.c
>> +++ b/xen/arch/x86/cpu/mcheck/mce.c
>> @@ -1682,13 +1682,13 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) 
>> u_xen_mc)
>>      return ret;
>>  }
>> 
>> -int mcinfo_dumpped;
>> +static int mcinfo_dumped;
>>  static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc)
> 
> While there, please also insert the missing blank line between the
> two entities.
> 
> Jan

Sure
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 98af6f55f5a0..2a2d6114f2eb 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -184,9 +184,12 @@  int map_range_to_domain(const struct dt_device_node *dev,
 extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
 
 #ifdef CONFIG_ARM_64
+extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
 extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
 #endif
+extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
 extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
+extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
 extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
 
 /* Find where Xen will be residing at runtime and return a PT entry */
diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
index 4fabdf5310d8..28bf24a01d95 100644
--- a/xen/arch/arm/include/asm/smp.h
+++ b/xen/arch/arm/include/asm/smp.h
@@ -6,6 +6,9 @@ 
 #include <asm/current.h>
 #endif
 
+extern struct init_info init_data;
+extern unsigned long smp_up_cpu;
+
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hypercall.c
index 743687a30390..fde4bc3e5809 100644
--- a/xen/arch/arm/platform_hypercall.c
+++ b/xen/arch/arm/platform_hypercall.c
@@ -17,7 +17,7 @@ 
 #include <asm/current.h>
 #include <asm/event.h>
 
-DEFINE_SPINLOCK(xenpf_lock);
+static DEFINE_SPINLOCK(xenpf_lock);
 
 long do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
 {
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 6141b7eb9cf1..e855f958030d 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -1682,13 +1682,13 @@  long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
     return ret;
 }
 
-int mcinfo_dumpped;
+static int mcinfo_dumped;
 static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc)
 {
     struct mc_info *mcip = mctelem_dataptr(mctc);
 
     x86_mcinfo_dump(mcip);
-    mcinfo_dumpped++;
+    mcinfo_dumped++;
 
     return 0;
 }
@@ -1702,7 +1702,7 @@  static void mc_panic_dump(void)
     for_each_online_cpu(cpu)
         mctelem_process_deferred(cpu, x86_mcinfo_dump_panic,
                                  mctelem_has_deferred_lmce(cpu));
-    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", mcinfo_dumpped);
+    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", mcinfo_dumped);
 }
 
 void mc_panic(const char *s)
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 6abfd8162120..604dba94b052 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -43,7 +43,7 @@  int __read_mostly opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_DEFAULT;
 static unsigned char __read_mostly irq_max_guests;
 integer_param("irq-max-guests", irq_max_guests);
 
-vmask_t global_used_vector_map;
+static vmask_t global_used_vector_map;
 
 struct irq_desc __read_mostly *irq_desc = NULL;
 
diff --git a/xen/include/xen/symbols.h b/xen/include/xen/symbols.h
index 20bbb28ef226..1b2863663aa0 100644
--- a/xen/include/xen/symbols.h
+++ b/xen/include/xen/symbols.h
@@ -33,4 +33,5 @@  struct symbol_offset {
     uint32_t stream; /* .. in the compressed stream.*/
     uint32_t addr;   /* .. and in the fixed size address array. */
 };
+
 #endif /*_XEN_SYMBOLS_H*/