src/lib: Fix spacing

Fix the following errors and warnings detected by checkpatch.pl:

ERROR: spaces required around that '?' (ctx:WxV)
ERROR: spaces required around that '=' (ctx:VxV)
ERROR: spaces required around that '<' (ctx:VxV)
ERROR: spaces required around that '+=' (ctx:VxV)
ERROR: space required after that ',' (ctx:VxV)
ERROR: space required before the open brace '{'
ERROR: space required after that close brace '}'
ERROR: need consistent spacing around '+' (ctx:WxV)
ERROR: need consistent spacing around '*' (ctx:WxV)
ERROR: need consistent spacing around '&' (ctx:VxW)
ERROR: spaces required around that '?' (ctx:VxW)
ERROR: spaces required around that ':' (ctx:VxW)
ERROR: trailing whitespace
ERROR: space prohibited before that '++' (ctx:WxO)
ERROR: space prohibited before that ',' (ctx:WxW)
ERROR: space prohibited after that '!' (ctx:BxW)
ERROR: spaces prohibited around that '->' (ctx:VxW)
ERROR: space prohibited after that '-' (ctx:WxW)
WARNING: space prohibited before semicolon
WARNING: unnecessary whitespace before a quoted newline
WARNING: missing space after return type

Note that lib/libgcov.c and lib/lzmadecode.c are providing false
positives for ERROR: need consistent spacing around '*' (ctx:WxV)
An example is:
void __gcov_merge_add(gcov_type *counters  __attribute__ ((unused)),
      unsigned int n_counters __attribute__ ((unused))) {}

TEST=Build and run on Galileo Gen2

Change-Id: I0016327a5754018eaeb25bedf42338291632c7c1
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18733
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Lee Leahy 2017-03-09 17:35:28 -08:00 committed by Martin Roth
parent fece39baa5
commit 35af5c47b0
12 changed files with 50 additions and 44 deletions

View File

@ -553,10 +553,10 @@ detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
out->mode.va + out->mode.vso + out->mode.vspw, out->mode.va + out->mode.vso + out->mode.vspw,
out->mode.va + out->mode.vbl, out->mode.vborder, out->mode.va + out->mode.vbl, out->mode.vborder,
out->mode.phsync, out->mode.pvsync, out->mode.phsync, out->mode.pvsync,
extra_info.syncmethod, x[17] & 0x80 ?" interlaced" : "", extra_info.syncmethod, x[17] & 0x80 ? " interlaced" : "",
extra_info.stereo); extra_info.stereo);
if (! c->did_detailed_timing) { if (!c->did_detailed_timing) {
printk(BIOS_SPEW, "Did detailed timing\n"); printk(BIOS_SPEW, "Did detailed timing\n");
c->did_detailed_timing = 1; c->did_detailed_timing = 1;
*result_edid = *out; *result_edid = *out;
@ -654,7 +654,7 @@ cea_video_block(unsigned char *x)
int length = x[0] & 0x1f; int length = x[0] & 0x1f;
for (i = 1; i < length; i++) for (i = 1; i < length; i++)
printk(BIOS_SPEW," VIC %02d %s\n", x[i] & 0x7f, printk(BIOS_SPEW, " VIC %02d %s\n", x[i] & 0x7f,
x[i] & 0x80 ? "(native)" : ""); x[i] & 0x80 ? "(native)" : "");
} }
@ -995,7 +995,7 @@ static void dump_breakdown(unsigned char *edid)
printk(BIOS_SPEW, "Extracted contents:\n"); printk(BIOS_SPEW, "Extracted contents:\n");
print_subsection("header", edid, 0, 7); print_subsection("header", edid, 0, 7);
print_subsection("serial number", edid, 8, 17); print_subsection("serial number", edid, 8, 17);
print_subsection("version", edid,18, 19); print_subsection("version", edid, 18, 19);
print_subsection("basic params", edid, 20, 24); print_subsection("basic params", edid, 20, 24);
print_subsection("chroma info", edid, 25, 34); print_subsection("chroma info", edid, 25, 34);
print_subsection("established", edid, 35, 37); print_subsection("established", edid, 35, 37);
@ -1610,7 +1610,7 @@ void set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr)
edid_fb.bits_per_pixel = edid->framebuffer_bits_per_pixel; edid_fb.bits_per_pixel = edid->framebuffer_bits_per_pixel;
edid_fb.reserved_mask_pos = 0; edid_fb.reserved_mask_pos = 0;
edid_fb.reserved_mask_size = 0; edid_fb.reserved_mask_size = 0;
switch (edid->framebuffer_bits_per_pixel){ switch (edid->framebuffer_bits_per_pixel) {
case 32: case 32:
case 24: case 24:
/* packed into 4-byte words */ /* packed into 4-byte words */

View File

@ -129,7 +129,7 @@ static void setbuf(FILE *stream, char *buf)
static void coverage_init(void *unused) static void coverage_init(void *unused)
{ {
extern long __CTOR_LIST__; extern long __CTOR_LIST__;
typedef void (*func_ptr)(void) ; typedef void (*func_ptr)(void);
func_ptr *ctor = (func_ptr *) &__CTOR_LIST__; func_ptr *ctor = (func_ptr *) &__CTOR_LIST__;
if (ctor == NULL) if (ctor == NULL)
return; return;

View File

@ -300,7 +300,7 @@ typedef HOST_WIDEST_INT gcov_type;
#include "gcov-iov.h" #include "gcov-iov.h"
/* Convert a magic or version number to a 4 character string. */ /* Convert a magic or version number to a 4 character string. */
#define GCOV_UNSIGNED2STRING(ARRAY,VALUE) \ #define GCOV_UNSIGNED2STRING(ARRAY, VALUE) \
((ARRAY)[0] = (char)((VALUE) >> 24), \ ((ARRAY)[0] = (char)((VALUE) >> 24), \
(ARRAY)[1] = (char)((VALUE) >> 16), \ (ARRAY)[1] = (char)((VALUE) >> 16), \
(ARRAY)[2] = (char)((VALUE) >> 8), \ (ARRAY)[2] = (char)((VALUE) >> 8), \
@ -387,12 +387,12 @@ typedef HOST_WIDEST_INT gcov_type;
#define GCOV_TAG_MASK(TAG) (((TAG) - 1) ^ (TAG)) #define GCOV_TAG_MASK(TAG) (((TAG) - 1) ^ (TAG))
/* Return nonzero if SUB is an immediate subtag of TAG. */ /* Return nonzero if SUB is an immediate subtag of TAG. */
#define GCOV_TAG_IS_SUBTAG(TAG,SUB) \ #define GCOV_TAG_IS_SUBTAG(TAG, SUB) \
(GCOV_TAG_MASK(TAG) >> 8 == GCOV_TAG_MASK(SUB) \ (GCOV_TAG_MASK(TAG) >> 8 == GCOV_TAG_MASK(SUB) \
&& !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK(TAG))) && !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK(TAG)))
/* Return nonzero if SUB is at a sublevel to TAG. */ /* Return nonzero if SUB is at a sublevel to TAG. */
#define GCOV_TAG_IS_SUBLEVEL(TAG,SUB) \ #define GCOV_TAG_IS_SUBLEVEL(TAG, SUB) \
(GCOV_TAG_MASK(TAG) > GCOV_TAG_MASK(SUB)) (GCOV_TAG_MASK(TAG) > GCOV_TAG_MASK(SUB))
/* Basic block flags. */ /* Basic block flags. */

View File

@ -636,7 +636,7 @@ int imd_entry_remove(const struct imd *imd, const struct imd_entry *entry)
imdr = imd_entry_to_imdr(imd, entry); imdr = imd_entry_to_imdr(imd, entry);
if (imdr == NULL) if (imdr == NULL)
return - 1; return -1;
r = imdr_root(imdr); r = imdr_root(imdr);

View File

@ -600,10 +600,10 @@ static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *hu
i); i);
if (v && x < (1 << (v - 1))) if (v && x < (1 << (v - 1)))
x += (-1 << v) + 1; x += (-1 << v) + 1;
x = x << 16 | (hu-> vals[k] & 0xf0) << 4 | x = x << 16 | (hu->vals[k] & 0xf0) << 4 |
(DECBITS - (i + 1 + v)) | 128; (DECBITS - (i + 1 + v)) | 128;
} else } else
x = v << 16 | (hu-> vals[k] & 0xf0) << 4 | x = v << 16 | (hu->vals[k] & 0xf0) << 4 |
(DECBITS - (i + 1)); (DECBITS - (i + 1));
hu->llvals[c | d] = x; hu->llvals[c | d] = x;
} }
@ -633,11 +633,11 @@ static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen, unsigned char *hu
#define C5IC1 ((PREC)IFIX(0.566454497)) /* c5/c1 */ #define C5IC1 ((PREC)IFIX(0.566454497)) /* c5/c1 */
#define C7IC1 ((PREC)IFIX(0.198912367)) /* c7/c1 */ #define C7IC1 ((PREC)IFIX(0.198912367)) /* c7/c1 */
#define XPP(a,b) (t = a + b, b = a - b, a = t) #define XPP(a, b) (t = a + b, b = a - b, a = t)
#define XMP(a,b) (t = a - b, b = a + b, a = t) #define XMP(a, b) (t = a - b, b = a + b, a = t)
#define XPM(a,b) (t = a + b, b = b - a, a = t) #define XPM(a, b) (t = a + b, b = b - a, a = t)
#define ROT(a,b,s,c) (t = IMULT(a + b, s), \ #define ROT(a, b, s, c) (t = IMULT(a + b, s), \
a = IMULT(a, c - s) + t, \ a = IMULT(a, c - s) + t, \
b = IMULT(b, c + s) - t) b = IMULT(b, c + s) - t)
@ -810,7 +810,7 @@ static void initcol(PREC q[][64])
} }
/* This is optimized for the stupid sun SUNWspro compiler. */ /* This is optimized for the stupid sun SUNWspro compiler. */
#define STORECLAMP(a,x) \ #define STORECLAMP(a, x) \
( \ ( \
(a) = (x), \ (a) = (x), \
(unsigned int)(x) >= 256 ? \ (unsigned int)(x) >= 256 ? \
@ -825,8 +825,8 @@ static void initcol(PREC q[][64])
#define CBCRCG(yin, xin) \ #define CBCRCG(yin, xin) \
( \ ( \
cb = outc[0 +yin*8+xin], \ cb = outc[0 + yin * 8 + xin], \
cr = outc[64+yin*8+xin], \ cr = outc[64 + yin * 8 + xin], \
cg = (50 * cb + 130 * cr + 128) >> 8 \ cg = (50 * cb + 130 * cr + 128) >> 8 \
) )
@ -834,8 +834,8 @@ static void initcol(PREC q[][64])
#define CBCRCG(yin, xin) \ #define CBCRCG(yin, xin) \
( \ ( \
cb = outc[0 +yin*8+xin], \ cb = outc[0 + yin*8 + xin], \
cr = outc[64+yin*8+xin], \ cr = outc[64 + yin*8 + xin], \
cg = (3 * cb + 8 * cr) >> 4 \ cg = (3 * cb + 8 * cr) >> 4 \
) )

View File

@ -248,7 +248,7 @@ buffer_fn_data(const char *filename, const struct gcov_info *gi_ptr,
return &fn_buffer->next; return &fn_buffer->next;
fail: fail:
fprintf(stderr, "profiling:%s:Function %u %s %u \n", filename, fn_ix, fprintf(stderr, "profiling:%s:Function %u %s %u\n", filename, fn_ix,
len ? "cannot allocate" : "counter mismatch", len ? len : ix); len ? "cannot allocate" : "counter mismatch", len ? len : ix);
return (struct gcov_fn_buffer **)free_fn_data(gi_ptr, fn_buffer, ix); return (struct gcov_fn_buffer **)free_fn_data(gi_ptr, fn_buffer, ix);
@ -289,7 +289,7 @@ gcov_version(struct gcov_info *ptr, gcov_unsigned_t version,
fprintf(stderr, fprintf(stderr,
"profiling:%s:Version mismatch - expected %.4s got %.4s\n", "profiling:%s:Version mismatch - expected %.4s got %.4s\n",
filename? filename : ptr->filename, e, v); filename ? filename : ptr->filename, e, v);
return 0; return 0;
} }
return 1; return 1;
@ -603,7 +603,7 @@ gcov_exit(void)
read_error:; read_error:;
fprintf(stderr, "profiling:%s:%s merging\n", gi_filename, fprintf(stderr, "profiling:%s:%s merging\n", gi_filename,
error < 0 ? "Overflow": "Error"); error < 0 ? "Overflow" : "Error");
goto read_fatal; goto read_fatal;
@ -986,7 +986,7 @@ void
__gcov_average_profiler(gcov_type *counters, gcov_type value) __gcov_average_profiler(gcov_type *counters, gcov_type value)
{ {
counters[0] += value; counters[0] += value;
counters[1] ++; counters[1]++;
} }
#endif #endif

View File

@ -37,9 +37,15 @@
: ((((uintptr_t) Buffer & 3) || ((SizeT) (BufferLim - Buffer) <= 4)) ? (*Buffer++) \ : ((((uintptr_t) Buffer & 3) || ((SizeT) (BufferLim - Buffer) <= 4)) ? (*Buffer++) \
: ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), (look_ahead_ptr = 1), look_ahead.raw[0]))) : ((look_ahead.dw = *(UInt32 *)Buffer), (Buffer += 4), (look_ahead_ptr = 1), look_ahead.raw[0])))
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ #define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
{ int i; for (i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) \ { \
| RC_READ_BYTE; }} int i; \
\
for (i = 0; i < 5; i++) { \
RC_TEST; \
Code = (Code << 8) | RC_READ_BYTE; \
} \
}
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } #define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
@ -57,7 +63,7 @@
{ UpdateBit0(p); mi <<= 1; A0; } else \ { UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; } { UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) #define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ;, ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ #define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ \ { \
@ -192,7 +198,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
while (nowPos < outSize) { while (nowPos < outSize) {
CProb *prob; CProb *prob;
UInt32 bound; UInt32 bound;
int posState = (int)((nowPos)& posStateMask); int posState = (int)((nowPos)&posStateMask);
prob = p + IsMatch + (state << kNumPosBitsMax) + posState; prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
IfBit0(prob) { IfBit0(prob) {
@ -346,7 +352,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int mi = 1; int mi = 1;
do { do {
CProb *prob3 = prob + mi; CProb *prob3 = prob + mi;
RC_GET_BIT2(prob3, mi, ; , rep0 |= i); RC_GET_BIT2(prob3, mi, ;, rep0 |= i);
i <<= 1; i <<= 1;
} while (--numDirectBits != 0); } while (--numDirectBits != 0);
} }

View File

@ -42,7 +42,7 @@ typedef struct _CLzmaProperties {
int lc; int lc;
int lp; int lp;
int pb; int pb;
}CLzmaProperties; } CLzmaProperties;
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);

View File

@ -84,7 +84,7 @@ static int ram_bitset_nodie(unsigned long start)
uint8_t verbose = 0; uint8_t verbose = 0;
printk(BIOS_DEBUG, "DRAM bitset write: 0x%08lx\n", start); printk(BIOS_DEBUG, "DRAM bitset write: 0x%08lx\n", start);
for (idx=0; idx<0x400; idx+=4) { for (idx = 0; idx < 0x400; idx += 4) {
test_pattern(idx, &addr, &value); test_pattern(idx, &addr, &value);
write_phys(start + addr, value); write_phys(start + addr, value);
} }
@ -94,7 +94,7 @@ static int ram_bitset_nodie(unsigned long start)
printk(BIOS_DEBUG, "DRAM bitset verify: 0x%08lx\n", start); printk(BIOS_DEBUG, "DRAM bitset verify: 0x%08lx\n", start);
failures = 0; failures = 0;
for (idx=0; idx<0x400; idx+=4) { for (idx = 0; idx < 0x400; idx += 4) {
test_pattern(idx, &addr, &value); test_pattern(idx, &addr, &value);
value2 = read_phys(start + addr); value2 = read_phys(start + addr);
@ -162,7 +162,7 @@ int ram_check_noprint_nodie(unsigned long start, unsigned long stop)
unsigned short int idx; unsigned short int idx;
unsigned char failed, failures; unsigned char failed, failures;
for (idx=0; idx<0x400; idx+=4) { for (idx = 0; idx < 0x400; idx += 4) {
test_pattern(idx, &addr, &value); test_pattern(idx, &addr, &value);
write_phys(start + addr, value); write_phys(start + addr, value);
} }
@ -171,7 +171,7 @@ int ram_check_noprint_nodie(unsigned long start, unsigned long stop)
phys_memory_barrier(); phys_memory_barrier();
failures = 0; failures = 0;
for (idx=0; idx<0x400; idx+=4) { for (idx = 0; idx < 0x400; idx += 4) {
test_pattern(idx, &addr, &value); test_pattern(idx, &addr, &value);
value2 = read_phys(start + addr); value2 = read_phys(start + addr);
@ -189,19 +189,19 @@ static void __quick_ram_check(uintptr_t dst)
write_phys(dst, 0x55555555); write_phys(dst, 0x55555555);
phys_memory_barrier(); phys_memory_barrier();
if (read_phys(dst) != 0x55555555) if (read_phys(dst) != 0x55555555)
fail=1; fail = 1;
write_phys(dst, 0xaaaaaaaa); write_phys(dst, 0xaaaaaaaa);
phys_memory_barrier(); phys_memory_barrier();
if (read_phys(dst) != 0xaaaaaaaa) if (read_phys(dst) != 0xaaaaaaaa)
fail=1; fail = 1;
write_phys(dst, 0x00000000); write_phys(dst, 0x00000000);
phys_memory_barrier(); phys_memory_barrier();
if (read_phys(dst) != 0x00000000) if (read_phys(dst) != 0x00000000)
fail=1; fail = 1;
write_phys(dst, 0xffffffff); write_phys(dst, 0xffffffff);
phys_memory_barrier(); phys_memory_barrier();
if (read_phys(dst) != 0xffffffff) if (read_phys(dst) != 0xffffffff)
fail=1; fail = 1;
write_phys(dst, backup); write_phys(dst, backup);
if (fail) { if (fail) {

View File

@ -33,7 +33,7 @@ int checkstack(void *top_of_stack, int core)
int i; int i;
u32 *stack = (u32 *) (top_of_stack - stack_size); u32 *stack = (u32 *) (top_of_stack - stack_size);
if (stack[0] != 0xDEADBEEF){ if (stack[0] != 0xDEADBEEF) {
printk(BIOS_ERR, "Stack overrun on CPU%d (address %p overwritten). " printk(BIOS_ERR, "Stack overrun on CPU%d (address %p overwritten). "
"Increase stack from current %zu bytes\n", "Increase stack from current %zu bytes\n",
core, stack, stack_size); core, stack, stack_size);
@ -41,7 +41,7 @@ int checkstack(void *top_of_stack, int core)
return -1; return -1;
} }
for (i = 1; i < stack_size/sizeof(stack[0]); i++){ for (i = 1; i < stack_size/sizeof(stack[0]); i++) {
if (stack[i] == 0xDEADBEEF) if (stack[i] == 0xDEADBEEF)
continue; continue;
printk(BIOS_SPEW, "CPU%d: stack: %p - %p, ", printk(BIOS_SPEW, "CPU%d: stack: %p - %p, ",

View File

@ -186,7 +186,7 @@ static void asmlinkage call_wrapper_block_state(void *arg)
/* Prepare a thread so that it starts by executing thread_entry(thread_arg). /* Prepare a thread so that it starts by executing thread_entry(thread_arg).
* Within thread_entry() it will call func(arg). */ * Within thread_entry() it will call func(arg). */
static void prepare_thread(struct thread *t, void *func, void *arg, static void prepare_thread(struct thread *t, void *func, void *arg,
asmlinkage void(*thread_entry)(void *), asmlinkage void (*thread_entry)(void *),
void *thread_arg) void *thread_arg)
{ {
/* Stash the function and argument to run. */ /* Stash the function and argument to run. */

View File

@ -165,7 +165,7 @@ int timer_sched_callback(struct timeout_callback *tocb, unsigned long us)
{ {
struct mono_time current_time; struct mono_time current_time;
if ((long)us< 0) if ((long)us < 0)
return -1; return -1;
timer_monotonic_get(&current_time); timer_monotonic_get(&current_time);