From 0b5678f21f17024b4f7f6bd67d0d382481751d86 Mon Sep 17 00:00:00 2001 From: Lee Leahy Date: Thu, 16 Mar 2017 16:01:40 -0700 Subject: arch/x86: Fix most of remaining issues detected by checkpatch Fix the following errors and warnings detected by checkpatch.pl: ERROR: do not use assignment in if condition ERROR: trailing statements should be on next line ERROR: Macros with complex values should be enclosed in parentheses ERROR: switch and case should be at the same indent WARNING: char * array declaration might be better as static const WARNING: else is not generally useful after a break or return WARNING: storage class should be at the beginning of the declaration WARNING: void function return statements are not generally useful WARNING: break is not useful after a goto or return WARNING: Single statement macros should not use a do {} while (0) loop WARNING: sizeof *t should be sizeof(*t) WARNING: Comparisons should place the constant on the right side of the test TEST=Build and run on Galileo Gen2 Change-Id: I39d49790c5eaeedec5051e1fab0b1279275f6e7f Signed-off-by: Lee Leahy Reviewed-on: https://review.coreboot.org/18865 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/arch/x86/include/arch/cpu.h | 2 +- src/arch/x86/include/arch/early_variables.h | 9 ++++----- src/arch/x86/include/arch/ebda.h | 6 +++--- src/arch/x86/include/arch/smp/spinlock.h | 3 ++- src/arch/x86/include/arch/stages.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/arch/x86/include') diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index e59eb32678..06e4435699 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -249,7 +249,7 @@ static inline void get_fms(struct cpuinfo_x86 *c, uint32_t tfms) * is the symbol jumped to for each stage after bootblock using * cache-as-ram. */ -void asmlinkage car_stage_entry(void); +asmlinkage void car_stage_entry(void); /* * Support setting up a stack frame consisting of MTRR information diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h index b48848e4a3..a21781996e 100644 --- a/src/arch/x86/include/arch/early_variables.h +++ b/src/arch/x86/include/arch/early_variables.h @@ -54,11 +54,10 @@ void *car_sync_var_ptr(void *var); /* Get and set a primitive type global variable. */ #define car_get_var(var) \ - *(typeof(var) *)car_get_var_ptr(&(var)) + (*(typeof(var) *)car_get_var_ptr(&(var))) #define car_sync_var(var) \ - *(typeof(var) *)car_sync_var_ptr(&(var)) -#define car_set_var(var, val) \ - do { car_get_var(var) = (val); } while (0) + (*(typeof(var) *)car_sync_var_ptr(&(var))) +#define car_set_var(var, val) car_get_var(var) = (val) static inline size_t car_data_size(void) { @@ -76,7 +75,7 @@ static inline size_t car_object_offset(void *ptr) static inline void *car_get_var_ptr(void *var) { return var; } #define car_get_var(var) (var) #define car_sync_var(var) (var) -#define car_set_var(var, val) do { (var) = (val); } while (0) +#define car_set_var(var, val) (var) = (val) #endif #endif diff --git a/src/arch/x86/include/arch/ebda.h b/src/arch/x86/include/arch/ebda.h index 116603437c..cd25ccaba1 100644 --- a/src/arch/x86/include/arch/ebda.h +++ b/src/arch/x86/include/arch/ebda.h @@ -18,9 +18,9 @@ #define __ARCH_EBDA_H #define X86_BDA_SIZE 0x200 -#define X86_BDA_BASE (void *)0x400 -#define X86_EBDA_SEGMENT (void *)0x40e -#define X86_EBDA_LOWMEM (void *)0x413 +#define X86_BDA_BASE ((void *)0x400) +#define X86_EBDA_SEGMENT ((void *)0x40e) +#define X86_EBDA_LOWMEM ((void *)0x413) #define DEFAULT_EBDA_LOWMEM (1024 << 10) #define DEFAULT_EBDA_SEGMENT 0xF600 diff --git a/src/arch/x86/include/arch/smp/spinlock.h b/src/arch/x86/include/arch/smp/spinlock.h index 716de15d15..1c1def1252 100644 --- a/src/arch/x86/include/arch/smp/spinlock.h +++ b/src/arch/x86/include/arch/smp/spinlock.h @@ -39,7 +39,8 @@ void initialize_romstage_microcode_cbfs_lock(void); #define SPIN_LOCK_UNLOCKED { 1 } #ifndef __PRE_RAM__ -#define DECLARE_SPIN_LOCK(x) static spinlock_t x = SPIN_LOCK_UNLOCKED; +#define DECLARE_SPIN_LOCK(x) \ + static spinlock_t x = SPIN_LOCK_UNLOCKED; #else #define DECLARE_SPIN_LOCK(x) #endif diff --git a/src/arch/x86/include/arch/stages.h b/src/arch/x86/include/arch/stages.h index 49921ae0e1..5716030274 100644 --- a/src/arch/x86/include/arch/stages.h +++ b/src/arch/x86/include/arch/stages.h @@ -18,6 +18,6 @@ #include -void asmlinkage copy_and_run(void); +asmlinkage void copy_and_run(void); #endif -- cgit v1.2.3