openrc@posteo.de has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86052?usp=email )
Change subject: util/nvramtool: Fix spacing issues reported by linter ......................................................................
util/nvramtool: Fix spacing issues reported by linter
Fix for several ERROR:POINTER_LOCATION and many other errors reported by linter.
Change-Id: I5a18a571300c6175ea6c8123e79807afa7a6f084 Signed-off-by: libreandre openrc@posteo.de --- M util/nvramtool/accessors/cmos-hw-unix.c M util/nvramtool/accessors/cmos-mem.c M util/nvramtool/accessors/layout-bin.c M util/nvramtool/accessors/layout-text.c M util/nvramtool/accessors/layout-text.h M util/nvramtool/cbfs.c M util/nvramtool/cbfs.h M util/nvramtool/cli/nvramtool.c M util/nvramtool/cmos_lowlevel.c M util/nvramtool/cmos_lowlevel.h M util/nvramtool/cmos_ops.c M util/nvramtool/cmos_ops.h M util/nvramtool/common.c M util/nvramtool/common.h M util/nvramtool/hexdump.c M util/nvramtool/hexdump.h M util/nvramtool/input_file.c M util/nvramtool/input_file.h M util/nvramtool/layout.c M util/nvramtool/layout.h M util/nvramtool/lbtable.c 21 files changed, 111 insertions(+), 111 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/86052/1
diff --git a/util/nvramtool/accessors/cmos-hw-unix.c b/util/nvramtool/accessors/cmos-hw-unix.c index 101f034..398f4cc 100644 --- a/util/nvramtool/accessors/cmos-hw-unix.c +++ b/util/nvramtool/accessors/cmos-hw-unix.c @@ -23,7 +23,7 @@
static inline void outb(uint8_t value, uint16_t port) { - asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (port)); + asm volatile ("outb %b0,%w1" : : "a" (value), "Nd" (port)); }
static inline uint8_t inb(uint16_t port) @@ -35,7 +35,7 @@
static inline void outw(uint16_t value, uint16_t port) { - asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (port)); + asm volatile ("outw %w0,%w1" : : "a" (value), "Nd" (port)); }
static inline uint16_t inw(uint16_t port) @@ -47,7 +47,7 @@
static inline void outl(uint32_t value, uint16_t port) { - asm volatile ("outl %0,%w1": :"a" (value), "Nd" (port)); + asm volatile ("outl %0,%w1" : : "a" (value), "Nd" (port)); }
static inline uint32_t inl(uint16_t port) @@ -76,7 +76,7 @@ #define INL inl #endif
-static void cmos_hal_init(void* data); +static void cmos_hal_init(void *data); static unsigned char cmos_hal_read(unsigned addr); static void cmos_hal_write(unsigned addr, unsigned char value); static void cmos_set_iopl(int level); diff --git a/util/nvramtool/accessors/cmos-mem.c b/util/nvramtool/accessors/cmos-mem.c index 619a68a..4b9c00a 100644 --- a/util/nvramtool/accessors/cmos-mem.c +++ b/util/nvramtool/accessors/cmos-mem.c @@ -1,12 +1,12 @@ #include <assert.h> #include "cmos_lowlevel.h"
-static void mem_hal_init(void* data); +static void mem_hal_init(void *data); static unsigned char mem_hal_read(unsigned addr); static void mem_hal_write(unsigned addr, unsigned char value); static void mem_set_iopl(int level);
-static unsigned char* mem_hal_data = (unsigned char*)-1; +static unsigned char *mem_hal_data = (unsigned char *)-1; static void mem_hal_init(void *data) { mem_hal_data = data; @@ -14,13 +14,13 @@
static unsigned char mem_hal_read(unsigned index) { - assert(mem_hal_data != (unsigned char*)-1); + assert(mem_hal_data != (unsigned char *)-1); return mem_hal_data[index]; }
static void mem_hal_write(unsigned index, unsigned char value) { - assert(mem_hal_data != (unsigned char*)-1); + assert(mem_hal_data != (unsigned char *)-1); mem_hal_data[index] = value; }
diff --git a/util/nvramtool/accessors/layout-bin.c b/util/nvramtool/accessors/layout-bin.c index 3ae1d6e..d9475ef 100644 --- a/util/nvramtool/accessors/layout-bin.c +++ b/util/nvramtool/accessors/layout-bin.c @@ -16,9 +16,9 @@
static void process_cmos_table(void); static void get_cmos_checksum_info(void); -static void try_convert_checksum_layout(cmos_checksum_layout_t * layout); -static void try_add_cmos_table_enum(cmos_enum_t * cmos_enum); -static void try_add_cmos_table_entry(cmos_entry_t * cmos_entry); +static void try_convert_checksum_layout(cmos_checksum_layout_t *layout); +static void try_add_cmos_table_enum(cmos_enum_t *cmos_enum); +static void try_add_cmos_table_entry(cmos_entry_t *cmos_entry); static const struct cmos_entries *first_cmos_table_entry(void); static const struct cmos_entries *next_cmos_table_entry(const struct cmos_entries *last); diff --git a/util/nvramtool/accessors/layout-text.c b/util/nvramtool/accessors/layout-text.c index acbe7f8..fc29ed6 100644 --- a/util/nvramtool/accessors/layout-text.c +++ b/util/nvramtool/accessors/layout-text.c @@ -6,24 +6,24 @@ #include "cmos_lowlevel.h" #include "reg_expr.h"
-static void process_layout_file(FILE * f); -static void skip_past_start(FILE * f); -static int process_entry(FILE * f, int skip_add); -static int process_enum(FILE * f, int skip_add); -static void process_checksum_info(FILE * f); -static void skip_remaining_lines(FILE * f); -static void create_entry(cmos_entry_t * cmos_entry, +static void process_layout_file(FILE *f); +static void skip_past_start(FILE *f); +static int process_entry(FILE *f, int skip_add); +static int process_enum(FILE *f, int skip_add); +static void process_checksum_info(FILE *f); +static void skip_remaining_lines(FILE *f); +static void create_entry(cmos_entry_t *cmos_entry, const char start_bit_str[], const char length_str[], const char config_str[], const char config_id_str[], const char name_str[]); -static void try_add_layout_file_entry(const cmos_entry_t * cmos_entry); -static void create_enum(cmos_enum_t * cmos_enum, const char id_str[], +static void try_add_layout_file_entry(const cmos_entry_t *cmos_entry); +static void create_enum(cmos_enum_t *cmos_enum, const char id_str[], const char value_str[], const char text_str[]); -static void try_add_cmos_enum(const cmos_enum_t * cmos_enum); +static void try_add_cmos_enum(const cmos_enum_t *cmos_enum); static void set_checksum_info(const char start_str[], const char end_str[], const char index_str[]); static char cmos_entry_char_value(cmos_entry_config_t config); -static int get_layout_file_line(FILE * f, char line[], int line_buf_size); +static int get_layout_file_line(FILE *f, char line[], int line_buf_size); static unsigned string_to_unsigned(const char str[], const char str_name[]); static unsigned long string_to_unsigned_long(const char str[], const char str_name[]); @@ -247,7 +247,7 @@ * Write CMOS layout information to file 'f'. The output is written in the * format that CMOS layout files adhere to. ****************************************************************************/ -void write_cmos_layout(FILE * f) +void write_cmos_layout(FILE *f) { const cmos_entry_t *cmos_entry; const cmos_enum_t *cmos_enum; @@ -283,7 +283,7 @@ * Read CMOS layout information from file 'f' and add it to our internal * repository. ****************************************************************************/ -static void process_layout_file(FILE * f) +static void process_layout_file(FILE *f) { compile_reg_expr(REG_EXTENDED | REG_NEWLINE, blank_or_comment_regex, &blank_or_comment_expr); compile_reg_expr(REG_EXTENDED | REG_NEWLINE, start_entries_regex, &start_entries_expr); @@ -298,7 +298,7 @@ /* Skip past all entries. We will process these later when we * make a second pass through the file. */ - while (!process_entry(f, 1)) ; + while (!process_entry(f, 1));
/* Process all enums, adding them to our internal repository as * we go. */ @@ -309,7 +309,7 @@ exit(1); }
- while (!process_enum(f, 0)) ; + while (!process_enum(f, 0));
/* Go back to start of file. */ line_num = 1; @@ -331,10 +331,10 @@ exit(1); }
- while (!process_entry(f, 0)) ; + while (!process_entry(f, 0));
/* Skip past all enums. They have already been processed. */ - while (!process_enum(f, 1)) ; + while (!process_enum(f, 1));
/* Process CMOS checksum info. */ process_checksum_info(f); @@ -358,7 +358,7 @@ * * Skip past the line that marks the start of the "entries" section. ****************************************************************************/ -static void skip_past_start(FILE * f) +static void skip_past_start(FILE *f) { char line[LINE_BUF_SIZE];
@@ -392,7 +392,7 @@ * of layout information. Return 0 if an entry was found and processed. * Return 1 if there are no more entries. ****************************************************************************/ -static int process_entry(FILE * f, int skip_add) +static int process_entry(FILE *f, int skip_add) { static const size_t N_MATCHES = 6; char line[LINE_BUF_SIZE]; @@ -452,7 +452,7 @@ * repository of layout information. Return 0 if an enumeration was found * and processed. Return 1 if there are no more enumerations. ****************************************************************************/ -static int process_enum(FILE * f, int skip_add) +static int process_enum(FILE *f, int skip_add) { static const size_t N_MATCHES = 4; char line[LINE_BUF_SIZE]; @@ -508,7 +508,7 @@ * * Get line containing CMOS checksum information. ****************************************************************************/ -static void process_checksum_info(FILE * f) +static void process_checksum_info(FILE *f) { static const size_t N_MATCHES = 4; char line[LINE_BUF_SIZE]; @@ -549,7 +549,7 @@ * Get any remaining lines of unprocessed input. Complain if we find a line * that contains anything other than comments and whitespace. ****************************************************************************/ -static void skip_remaining_lines(FILE * f) +static void skip_remaining_lines(FILE *f) { char line[LINE_BUF_SIZE];
@@ -571,7 +571,7 @@ * Create a CMOS entry structure representing the given information. Perform * sanity checking on input parameters. ****************************************************************************/ -static void create_entry(cmos_entry_t * cmos_entry, +static void create_entry(cmos_entry_t *cmos_entry, const char start_bit_str[], const char length_str[], const char config_str[], const char config_id_str[], const char name_str[]) @@ -629,7 +629,7 @@ * Attempt to add the given CMOS entry to our internal repository. Exit with * an error message on failure. ****************************************************************************/ -static void try_add_layout_file_entry(const cmos_entry_t * cmos_entry) +static void try_add_layout_file_entry(const cmos_entry_t *cmos_entry) { const cmos_entry_t *conflict;
@@ -684,7 +684,7 @@ * Create a CMOS enumeration structure representing the given information. * Perform sanity checking on input parameters. ****************************************************************************/ -static void create_enum(cmos_enum_t * cmos_enum, const char id_str[], +static void create_enum(cmos_enum_t *cmos_enum, const char id_str[], const char value_str[], const char text_str[]) { cmos_enum->config_id = string_to_unsigned(id_str, "ID"); @@ -707,7 +707,7 @@ * Attempt to add the given CMOS enum to our internal repository. Exit with * an error message on failure. ****************************************************************************/ -static void try_add_cmos_enum(const cmos_enum_t * cmos_enum) +static void try_add_cmos_enum(const cmos_enum_t *cmos_enum) { switch (add_cmos_enum(cmos_enum)) { case OK: @@ -845,7 +845,7 @@ * array of 'line_buf_size' bytes. Return OK on success or an error code on * failure. ****************************************************************************/ -static int get_layout_file_line(FILE * f, char line[], int line_buf_size) +static int get_layout_file_line(FILE *f, char line[], int line_buf_size) { switch (get_line_from_file(f, line, line_buf_size)) { case OK: diff --git a/util/nvramtool/accessors/layout-text.h b/util/nvramtool/accessors/layout-text.h index db8bf48..98e3c89 100644 --- a/util/nvramtool/accessors/layout-text.h +++ b/util/nvramtool/accessors/layout-text.h @@ -8,7 +8,7 @@
void set_layout_filename(const char filename[]); void get_layout_from_file(void); -void write_cmos_layout(FILE * f); +void write_cmos_layout(FILE *f); void write_cmos_output_bin(const char *binary_filename); void write_cmos_layout_header(const char *header_filename); extern int is_ident(char *str); diff --git a/util/nvramtool/cbfs.c b/util/nvramtool/cbfs.c index cbf95c4..1015d3e 100644 --- a/util/nvramtool/cbfs.c +++ b/util/nvramtool/cbfs.c @@ -17,12 +17,12 @@ #include "cbfs.h" #include "common.h"
-#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) -#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) +#define ALIGN(x, a) __ALIGN_MASK(x,(typeof(x))(a)-1) +#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
static void *cbfs_mapped; static void *cbfs_offset; -static void* virt_to_phys(u32 virt) +static void *virt_to_phys(u32 virt) { return cbfs_offset + virt; } @@ -42,7 +42,7 @@ { struct cbfs_header *header;
- void *ptr = virt_to_phys(*((u32*)virt_to_phys(CBFS_HEADPTR_ADDR))); + void *ptr = virt_to_phys(*((u32 *)virt_to_phys(CBFS_HEADPTR_ADDR))); debug("Check CBFS header at %p\n", ptr); header = (struct cbfs_header *) ptr;
@@ -65,7 +65,7 @@ return NULL; offset = virt_to_phys(0 - ntohl(header->romsize) + ntohl(header->offset));
- int align= ntohl(header->align); + int align = ntohl(header->align);
while(1) { struct cbfs_file *file = (struct cbfs_file *) offset; @@ -79,7 +79,7 @@ debug("CBFS: follow chain: %p + %x + %x + align -> ", offset, foffset, flen);
void *oldoffset = offset; - offset = (void*)ALIGN((uintptr_t)(offset + foffset + flen), align); + offset = (void *)ALIGN((uintptr_t)(offset + foffset + flen), align); debug("%p\n", (void *)offset); if (offset <= oldoffset) return NULL;
diff --git a/util/nvramtool/cbfs.h b/util/nvramtool/cbfs.h index 0bded53..24d6505 100644 --- a/util/nvramtool/cbfs.h +++ b/util/nvramtool/cbfs.h @@ -126,9 +126,9 @@ } __attribute__((packed));
#define CBFS_NAME(_c) (((char *) (_c)) + sizeof(struct cbfs_file)) -#define CBFS_SUBHEADER(_p) ( (void *) ((((u8 *) (_p)) + ntohl((_p)->offset))) ) +#define CBFS_SUBHEADER(_p) ((void *) ((((u8 *) (_p)) + ntohl((_p)->offset))))
-void * cbfs_get_file(const char *name); +void *cbfs_get_file(const char *name); struct cbfs_file *cbfs_find(const char *name); void *cbfs_find_file(const char *name, unsigned int type, unsigned int *len);
diff --git a/util/nvramtool/cli/nvramtool.c b/util/nvramtool/cli/nvramtool.c index 046bd9b..89ec2fc 100644 --- a/util/nvramtool/cli/nvramtool.c +++ b/util/nvramtool/cli/nvramtool.c @@ -45,9 +45,9 @@ static int list_all_params(void); static void list_param_enums(const char name[]); static void set_one_param(const char name[], const char value[]); -static void set_params(FILE * f); +static void set_params(FILE *f); static void parse_assignment(char arg[], const char **name, const char **value); -static int list_cmos_entry(const cmos_entry_t * e, int show_name); +static int list_cmos_entry(const cmos_entry_t *e, int show_name); static uint16_t convert_checksum_value(const char value[]);
static const op_fn_t op_fns[] = { op_show_version, @@ -675,7 +675,7 @@ * * Set coreboot parameters according to the contents of file 'f'. ****************************************************************************/ -static void set_params(FILE * f) +static void set_params(FILE *f) { /* First process the input file. Then perform writes only if there were * no problems processing the input. Either all values will be written * successfully or no values will be written. @@ -725,7 +725,7 @@ * along with its value. On success, return OK. On error, print an error * message and return 1. ****************************************************************************/ -static int list_cmos_entry(const cmos_entry_t * e, int show_name) +static int list_cmos_entry(const cmos_entry_t *e, int show_name) { const cmos_enum_t *p; unsigned long long value; @@ -804,7 +804,7 @@ case CMOS_ENTRY_STRING: w = (char *)(unsigned long)value; while (*w) { - if(!isprint((int)(unsigned char)*w)) { + if (!isprint((int)(unsigned char)*w)) { if (show_name) printf("# Bad value -> %s\n", e->name); else @@ -850,7 +850,7 @@ uint16_t result; int negative;
- for (p = value; isspace((int)(unsigned char)*p); p++) ; + for (p = value; isspace((int)(unsigned char)*p); p++);
negative = (*p == '-'); n = strtoul(value, (char **)&p, 0); diff --git a/util/nvramtool/cmos_lowlevel.c b/util/nvramtool/cmos_lowlevel.c index 8b56164..d986281 100644 --- a/util/nvramtool/cmos_lowlevel.c +++ b/util/nvramtool/cmos_lowlevel.c @@ -20,7 +20,7 @@
void select_hal(hal_t hal, void *data) { - switch(hal) { + switch (hal) { #ifdef CMOS_HAL case HAL_CMOS: current_access = &cmos_hal; @@ -41,10 +41,10 @@ } cmos_bit_op_location_t;
static unsigned cmos_bit_op_strategy(unsigned bit, unsigned bits_left, - cmos_bit_op_location_t * where); -static unsigned char cmos_read_bits(const cmos_bit_op_location_t * where, + cmos_bit_op_location_t *where); +static unsigned char cmos_read_bits(const cmos_bit_op_location_t *where, unsigned nr_bits); -static void cmos_write_bits(const cmos_bit_op_location_t * where, +static void cmos_write_bits(const cmos_bit_op_location_t *where, unsigned nr_bits, unsigned char value); static unsigned char get_bits(unsigned long long value, unsigned bit, unsigned nr_bits); @@ -88,7 +88,7 @@ * Returned value is either (unsigned long long), or malloc()'d (char *) * cast to (unsigned long long) ****************************************************************************/ -unsigned long long cmos_read(const cmos_entry_t * e) +unsigned long long cmos_read(const cmos_entry_t *e) { cmos_bit_op_location_t where; unsigned bit = e->bit, length = e->length; @@ -140,7 +140,7 @@ * The I/O privilege level of the currently executing process must be set * appropriately. ****************************************************************************/ -void cmos_write(const cmos_entry_t * e, unsigned long long value) +void cmos_write(const cmos_entry_t *e, unsigned long long value) { cmos_bit_op_location_t where; unsigned bit = e->bit, length = e->length; @@ -282,7 +282,7 @@ * bits to read or write next. ****************************************************************************/ static unsigned cmos_bit_op_strategy(unsigned bit, unsigned bits_left, - cmos_bit_op_location_t * where) + cmos_bit_op_location_t *where) { unsigned max_bits;
@@ -298,7 +298,7 @@ * Read a chunk of bits from a byte location within CMOS memory. Return the * value represented by the chunk of bits. ****************************************************************************/ -static unsigned char cmos_read_bits(const cmos_bit_op_location_t * where, +static unsigned char cmos_read_bits(const cmos_bit_op_location_t *where, unsigned nr_bits) { return (cmos_read_byte(where->byte_index) >> where->bit_offset) & @@ -311,7 +311,7 @@ * Write a chunk of bits (the low order 'nr_bits' bits of 'value') to an area * within a particular byte of CMOS memory. ****************************************************************************/ -static void cmos_write_bits(const cmos_bit_op_location_t * where, +static void cmos_write_bits(const cmos_bit_op_location_t *where, unsigned nr_bits, unsigned char value) { unsigned char n, mask; diff --git a/util/nvramtool/cmos_lowlevel.h b/util/nvramtool/cmos_lowlevel.h index 3efdbd0..72e0fe1 100644 --- a/util/nvramtool/cmos_lowlevel.h +++ b/util/nvramtool/cmos_lowlevel.h @@ -7,7 +7,7 @@ #include "layout.h"
typedef struct { - void (*init)(void* data); + void (*init)(void *data); unsigned char (*read)(unsigned addr); void (*write)(unsigned addr, unsigned char value); void (*set_iopl)(int level); @@ -20,8 +20,8 @@ #define CMOS_AREA_OVERLAPS_RTC (CMOS_RESULT_START + 1) #define CMOS_AREA_TOO_WIDE (CMOS_RESULT_START + 2)
-unsigned long long cmos_read(const cmos_entry_t * e); -void cmos_write(const cmos_entry_t * e, unsigned long long value); +unsigned long long cmos_read(const cmos_entry_t *e); +void cmos_write(const cmos_entry_t *e, unsigned long long value); unsigned char cmos_read_byte(unsigned index); void cmos_write_byte(unsigned index, unsigned char value); void cmos_read_all(unsigned char data[]); diff --git a/util/nvramtool/cmos_ops.c b/util/nvramtool/cmos_ops.c index 0286309..d5e713f 100644 --- a/util/nvramtool/cmos_ops.c +++ b/util/nvramtool/cmos_ops.c @@ -4,14 +4,14 @@ #include "cmos_ops.h" #include "cmos_lowlevel.h"
-static int prepare_cmos_op_common(const cmos_entry_t * e); +static int prepare_cmos_op_common(const cmos_entry_t *e);
/**************************************************************************** * prepare_cmos_op_common * * Perform a few checks common to both reads and writes. ****************************************************************************/ -static int prepare_cmos_op_common(const cmos_entry_t * e) +static int prepare_cmos_op_common(const cmos_entry_t *e) { int result;
@@ -33,7 +33,7 @@ * sanity checking on 'e'. If a problem was found with e, return an error * code. Else return OK. ****************************************************************************/ -int prepare_cmos_read(const cmos_entry_t * e) +int prepare_cmos_read(const cmos_entry_t *e) { int result;
@@ -61,7 +61,7 @@ * checking on 'value_str'. On error, return an error code. Else store the * numeric equivalent of 'value_str' in '*value' and return OK. ****************************************************************************/ -int prepare_cmos_write(const cmos_entry_t * e, const char value_str[], +int prepare_cmos_write(const cmos_entry_t *e, const char value_str[], unsigned long long *value) { const cmos_enum_t *q; @@ -97,7 +97,7 @@ /* See if the first character of 'value_str' (excluding * any initial whitespace) is a minus sign. */ - for (p = value_str; isspace((int)(unsigned char)*p); p++) ; + for (p = value_str; isspace((int)(unsigned char)*p); p++); negative = (*p == '-');
out = strtoull(value_str, (char **)&p, 0); diff --git a/util/nvramtool/cmos_ops.h b/util/nvramtool/cmos_ops.h index 8c819df..5783c9a 100644 --- a/util/nvramtool/cmos_ops.h +++ b/util/nvramtool/cmos_ops.h @@ -13,8 +13,8 @@ #define CMOS_OP_VALUE_TOO_WIDE (CMOS_OP_RESULT_START + 4) #define CMOS_OP_NO_MATCHING_ENUM (CMOS_OP_RESULT_START + 5)
-int prepare_cmos_read(const cmos_entry_t * e); -int prepare_cmos_write(const cmos_entry_t * e, const char value_str[], +int prepare_cmos_read(const cmos_entry_t *e); +int prepare_cmos_write(const cmos_entry_t *e, const char value_str[], unsigned long long *value); uint16_t cmos_checksum_read(void); void cmos_checksum_write(uint16_t checksum); diff --git a/util/nvramtool/common.c b/util/nvramtool/common.c index 68d2618..5f1eb20 100644 --- a/util/nvramtool/common.c +++ b/util/nvramtool/common.c @@ -14,7 +14,7 @@ * Get a line of input from file 'f'. Store result in 'line' which is an * array of 'line_buf_size' bytes. ****************************************************************************/ -int get_line_from_file(FILE * f, char line[], int line_buf_size) +int get_line_from_file(FILE *f, char line[], int line_buf_size) { if (fgets(line, line_buf_size, f) == NULL) return LINE_EOF; @@ -44,7 +44,7 @@ * Write a usage message to 'outfile'. If 'outfile' is 'stderr' then exit * with a value of 1. Otherwise exit with a value of 0. ****************************************************************************/ -void usage(FILE * outfile) +void usage(FILE *outfile) { fprintf(outfile, "Usage: %s [-y LAYOUT_FILE | -t] PARAMETER ...\n\n" diff --git a/util/nvramtool/common.h b/util/nvramtool/common.h index e15138c..f6f9dad 100644 --- a/util/nvramtool/common.h +++ b/util/nvramtool/common.h @@ -57,8 +57,8 @@ /* version of this program */ extern const char prog_version[];
-int get_line_from_file(FILE * f, char line[], int line_buf_size); +int get_line_from_file(FILE *f, char line[], int line_buf_size); noreturn void out_of_memory(void); -void usage(FILE * outfile); +void usage(FILE *outfile);
#endif /* COMMON_H */ diff --git a/util/nvramtool/hexdump.c b/util/nvramtool/hexdump.c index 1d4fee1..de00d97 100644 --- a/util/nvramtool/hexdump.c +++ b/util/nvramtool/hexdump.c @@ -3,7 +3,7 @@ #include "hexdump.h" #include <ctype.h>
-static void addrprint(FILE * outfile, uint64_t address, int width); +static void addrprint(FILE *outfile, uint64_t address, int width);
/*-------------------------------------------------------------------------- * hexdump @@ -22,7 +22,7 @@ * formatted. *--------------------------------------------------------------------------*/ void hexdump(const void *mem, int bytes, uint64_t addrprint_start, - FILE * outfile, const hexdump_format_t * format) + FILE *outfile, const hexdump_format_t *format) { int bytes_left, index, i; const unsigned char *p; @@ -117,7 +117,7 @@ * width: The number of bytes wide the address should be displayed as. * Must be a value from 1 to 8. *--------------------------------------------------------------------------*/ -static void addrprint(FILE * outfile, uint64_t address, int width) +static void addrprint(FILE *outfile, uint64_t address, int width) { char s[17]; int i; diff --git a/util/nvramtool/hexdump.h b/util/nvramtool/hexdump.h index 2a4e563..4f15b59 100644 --- a/util/nvramtool/hexdump.h +++ b/util/nvramtool/hexdump.h @@ -60,6 +60,6 @@ * formatted. *--------------------------------------------------------------------------*/ void hexdump(const void *mem, int bytes, uint64_t addrprint_start, - FILE * outfile, const hexdump_format_t * format); + FILE * outfile, const hexdump_format_t *format);
#endif /* _HEXDUMP_H */ diff --git a/util/nvramtool/input_file.c b/util/nvramtool/input_file.c index 8d2c9f2..83309f6 100644 --- a/util/nvramtool/input_file.c +++ b/util/nvramtool/input_file.c @@ -8,7 +8,7 @@ #include "reg_expr.h"
static int get_input_file_line(FILE * f, char line[], int line_buf_size); -static unsigned long long try_prepare_cmos_write(const cmos_entry_t * e, +static unsigned long long try_prepare_cmos_write(const cmos_entry_t *e, const char value_str[]);
/* matches either a blank line or a comment line */ @@ -46,7 +46,7 @@ * write operations. Perform sanity checking on all write operations and * exit with an error message if there is a problem. ****************************************************************************/ -cmos_write_t *process_input_file(FILE * f) +cmos_write_t *process_input_file(FILE *f) { static const int LINE_BUF_SIZE = 256; static const size_t N_MATCHES = 4; @@ -126,7 +126,7 @@ * all sanity checks. Perform all write operations, destroying the list as * we go. ****************************************************************************/ -void do_cmos_writes(cmos_write_t * list) +void do_cmos_writes(cmos_write_t *list) { cmos_write_t *item;
@@ -154,7 +154,7 @@ * array of 'line_buf_size' bytes. Return OK on success or an error code on * error. ****************************************************************************/ -static int get_input_file_line(FILE * f, char line[], int line_buf_size) +static int get_input_file_line(FILE *f, char line[], int line_buf_size) { switch (get_line_from_file(f, line, line_buf_size)) { case OK: @@ -185,7 +185,7 @@ * CMOS memory. On success, return the converted value. On error, exit with * an error message. ****************************************************************************/ -static unsigned long long try_prepare_cmos_write(const cmos_entry_t * e, +static unsigned long long try_prepare_cmos_write(const cmos_entry_t *e, const char value_str[]) { unsigned long long value; diff --git a/util/nvramtool/input_file.h b/util/nvramtool/input_file.h index b479e48..4278758 100644 --- a/util/nvramtool/input_file.h +++ b/util/nvramtool/input_file.h @@ -21,8 +21,8 @@ cmos_write_t *next; };
-cmos_write_t *process_input_file(FILE * f); -void do_cmos_writes(cmos_write_t * list); +cmos_write_t *process_input_file(FILE *f); +void do_cmos_writes(cmos_write_t *list);
extern const char assignment_regex[];
diff --git a/util/nvramtool/layout.c b/util/nvramtool/layout.c index 582f14c..1ebd43f 100644 --- a/util/nvramtool/layout.c +++ b/util/nvramtool/layout.c @@ -21,7 +21,7 @@ static void default_cmos_layout_get_fn(void); static int areas_overlap(unsigned area_0_start, unsigned area_0_length, unsigned area_1_start, unsigned area_1_length); -static int entries_overlap(const cmos_entry_t * p, const cmos_entry_t * q); +static int entries_overlap(const cmos_entry_t *p, const cmos_entry_t *q); static const cmos_enum_item_t *find_first_cmos_enum_id(unsigned config_id);
const char checksum_param_name[] = "check_sum"; @@ -71,8 +71,8 @@ * * Return 1 if CMOS entries 'p' and 'q' overlap. Else return 0. ****************************************************************************/ -static inline int entries_overlap(const cmos_entry_t * p, - const cmos_entry_t * q) +static inline int entries_overlap(const cmos_entry_t *p, + const cmos_entry_t *q) { return areas_overlap(p->bit, p->length, q->bit, q->length); } @@ -83,7 +83,7 @@ * Return a pointer to the cmos_entry_item_t that 'p' is embedded within. ****************************************************************************/ static inline const cmos_entry_item_t *cmos_entry_to_const_item - (const cmos_entry_t * p) { + (const cmos_entry_t *p) { static const cmos_entry_t *pos = &((cmos_entry_item_t *) 0)->item; unsigned long offset, address;
@@ -98,7 +98,7 @@ * Return a pointer to the cmos_enum_item_t that 'p' is embedded within. ****************************************************************************/ static inline const cmos_enum_item_t *cmos_enum_to_const_item - (const cmos_enum_t * p) { + (const cmos_enum_t *p) { static const cmos_enum_t *pos = &((cmos_enum_item_t *) 0)->item; unsigned long offset, address;
@@ -136,7 +136,7 @@ * operation fails because 'e' overlaps an existing CMOS entry, '*conflict' * will be set to point to the overlapping entry. ****************************************************************************/ -int add_cmos_entry(const cmos_entry_t * e, const cmos_entry_t ** conflict) +int add_cmos_entry(const cmos_entry_t *e, const cmos_entry_t **conflict) { cmos_entry_item_t *item, *prev, *new_entry;
@@ -165,7 +165,7 @@ */ for (item = cmos_entry_list, prev = NULL; (item != NULL) && (item->item.bit < e->bit); - prev = item, item = item->next) ; + prev = item, item = item->next);
if (prev == NULL) { if (entries_overlap(e, &cmos_entry_list->item)) { @@ -232,7 +232,7 @@ * Return a pointer to next entry in list after 'last' or NULL if no more * entries. ****************************************************************************/ -const cmos_entry_t *next_cmos_entry(const cmos_entry_t * last) +const cmos_entry_t *next_cmos_entry(const cmos_entry_t *last) { const cmos_entry_item_t *last_item, *next_item;
@@ -247,7 +247,7 @@ * Attempt to add CMOS enum 'e' to our internal repository of layout * information. Return OK on success or an error code on failure. ****************************************************************************/ -int add_cmos_enum(const cmos_enum_t * e) +int add_cmos_enum(const cmos_enum_t *e) { cmos_enum_item_t *item, *prev, *new_enum;
@@ -268,7 +268,7 @@ */ for (item = cmos_enum_list, prev = NULL; (item != NULL) && (item->item.config_id < e->config_id); - prev = item, item = item->next) ; + prev = item, item = item->next);
if (item == NULL) { new_enum->next = NULL; @@ -357,7 +357,7 @@ * Return a pointer to next enum in list after 'last' or NULL if no more * enums. ****************************************************************************/ -const cmos_enum_t *next_cmos_enum(const cmos_enum_t * last) +const cmos_enum_t *next_cmos_enum(const cmos_enum_t *last) { const cmos_enum_item_t *last_item, *next_item;
@@ -386,7 +386,7 @@ * Return a pointer to next enum in list after 'last' that matches the * 'config_id' field of 'last' or NULL if there are no more matching enums. ****************************************************************************/ -const cmos_enum_t *next_cmos_enum_id(const cmos_enum_t * last) +const cmos_enum_t *next_cmos_enum_id(const cmos_enum_t *last) { const cmos_enum_item_t *item;
@@ -414,7 +414,7 @@ * bit positions to byte positions. Return OK on success or an error code if * a sanity check fails. ****************************************************************************/ -int checksum_layout_to_bytes(cmos_checksum_layout_t * layout) +int checksum_layout_to_bytes(cmos_checksum_layout_t *layout) { unsigned start, end, index;
@@ -461,7 +461,7 @@ * On entry, '*layout' contains checksum-related layout information expressed * in bytes. Convert this information to bit positions. ****************************************************************************/ -void checksum_layout_to_bits(cmos_checksum_layout_t * layout) +void checksum_layout_to_bits(cmos_checksum_layout_t *layout) { layout->summed_area_start *= 8; layout->summed_area_end = (layout->summed_area_end * 8) + 7; @@ -507,7 +507,7 @@
for (item = cmos_enum_list; (item != NULL) && (item->item.config_id < config_id); - item = item->next) ; + item = item->next);
return ((item == NULL) || (item->item.config_id > config_id)) ? NULL : item; diff --git a/util/nvramtool/layout.h b/util/nvramtool/layout.h index 02652e0..4cb1848 100644 --- a/util/nvramtool/layout.h +++ b/util/nvramtool/layout.h @@ -65,18 +65,18 @@
void register_cmos_layout_get_fn(cmos_layout_get_fn_t fn); void get_cmos_layout(void); -int add_cmos_entry(const cmos_entry_t * e, const cmos_entry_t ** conflict); +int add_cmos_entry(const cmos_entry_t *e, const cmos_entry_t **conflict); const cmos_entry_t *find_cmos_entry(const char name[]); const cmos_entry_t *first_cmos_entry(void); -const cmos_entry_t *next_cmos_entry(const cmos_entry_t * last); -int add_cmos_enum(const cmos_enum_t * e); +const cmos_entry_t *next_cmos_entry(const cmos_entry_t *last); +int add_cmos_enum(const cmos_enum_t *e); const cmos_enum_t *find_cmos_enum(unsigned config_id, unsigned long long value); const cmos_enum_t *first_cmos_enum(void); -const cmos_enum_t *next_cmos_enum(const cmos_enum_t * last); +const cmos_enum_t *next_cmos_enum(const cmos_enum_t *last); const cmos_enum_t *first_cmos_enum_id(unsigned config_id); -const cmos_enum_t *next_cmos_enum_id(const cmos_enum_t * last); +const cmos_enum_t *next_cmos_enum_id(const cmos_enum_t *last); int is_checksum_name(const char name[]); -int checksum_layout_to_bytes(cmos_checksum_layout_t * layout); -void checksum_layout_to_bits(cmos_checksum_layout_t * layout); +int checksum_layout_to_bytes(cmos_checksum_layout_t *layout); +void checksum_layout_to_bits(cmos_checksum_layout_t *layout);
#endif /* LAYOUT_H */ diff --git a/util/nvramtool/lbtable.c b/util/nvramtool/lbtable.c index 6993cc0..44d359d 100644 --- a/util/nvramtool/lbtable.c +++ b/util/nvramtool/lbtable.c @@ -15,7 +15,7 @@ #include "hexdump.h" #include "cbfs.h"
-typedef void (*lbtable_print_fn_t) (const struct lb_record * rec); +typedef void (*lbtable_print_fn_t) (const struct lb_record *rec);
/* This structure represents an item in the coreboot table that may be * displayed using the -l option. @@ -451,7 +451,7 @@ for (p = start; (p <= end) && (end - p >= (sizeof(uint32_t) - 1)); p += 4) { - if (*(uint32_t*)phystov(p) != sig) + if (*(uint32_t *)phystov(p) != sig) continue;
/* We found a valid signature. */