src/lib: Add "int" following "unsigned"

Fix the following warning detected by checkpatch.pl:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

The remaining 37 warnings in gcov-io.c and libgcov.c are all false
positives generated by checkpatch detecting a symbol or function name
ending in _unsigned.

TEST=Build and run on Galileo Gen2

Change-Id: I9f1b71993caca8b3eb3f643525534a937d365ab3
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18695
Tested-by: build bot (Jenkins)
Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Lee Leahy
2017-03-08 16:34:12 -08:00
parent eaee1d8a5f
commit 75b859978a
9 changed files with 81 additions and 81 deletions

View File

@ -84,10 +84,10 @@ size_t b64_decode(const uint8_t *input_data,
uint8_t *output_data)
{
struct buffer_descriptor bd;
unsigned interim = 0;
unsigned int interim = 0;
size_t output_size = 0;
/* count of processed input bits, modulo log2(64) */
unsigned bit_count = 0;
unsigned int bit_count = 0;
/*
* Keep the context on the stack to make things easier if this needs

View File

@ -14,7 +14,7 @@
* GNU General Public License for more details.
*/
static void print_debug_pci_dev(unsigned dev)
static void print_debug_pci_dev(unsigned int dev)
{
printk(BIOS_DEBUG, "PCI: %02x:%02x.%x",
(dev >> 16) & 0xff, (dev >> 11) & 0x1f, (dev >> 8) & 7);
@ -37,7 +37,7 @@ static inline void print_pci_devices(void)
}
}
static void dump_pci_device(unsigned dev)
static void dump_pci_device(unsigned int dev)
{
int i;
print_debug_pci_dev(dev);
@ -71,7 +71,7 @@ static inline void dump_pci_devices(void)
}
static inline void dump_io_resources(unsigned port)
static inline void dump_io_resources(unsigned int port)
{
int i;
printk(BIOS_DEBUG, "%04x:\n", port);

View File

@ -1,14 +1,14 @@
#include <delay.h>
void mdelay(unsigned msecs)
void mdelay(unsigned int msecs)
{
unsigned i;
unsigned int i;
for(i = 0; i < msecs; i++) {
udelay(1000);
}
}
void delay(unsigned secs)
void delay(unsigned int secs)
{
unsigned i;
unsigned int i;
for(i = 0; i < secs; i++) {
mdelay(1000);
}

View File

@ -25,12 +25,12 @@ permissions described in the GCC Runtime Library Exception, version
another source file, after having #included gcov-io.h. */
#if !IN_GCOV
static void gcov_write_block (unsigned);
static gcov_unsigned_t *gcov_write_words (unsigned);
static void gcov_write_block (unsigned int);
static gcov_unsigned_t *gcov_write_words (unsigned int);
#endif
static const gcov_unsigned_t *gcov_read_words (unsigned);
static const gcov_unsigned_t *gcov_read_words (unsigned int);
#if !IN_LIBGCOV
static void gcov_allocate (unsigned);
static void gcov_allocate (unsigned int);
#endif
static inline gcov_unsigned_t from_file (gcov_unsigned_t value)
@ -198,7 +198,7 @@ gcov_magic (gcov_unsigned_t magic, gcov_unsigned_t expected)
#if !IN_LIBGCOV
static void
gcov_allocate (unsigned length)
gcov_allocate (unsigned int length)
{
size_t new_size = gcov_var.alloc;
@ -216,7 +216,7 @@ gcov_allocate (unsigned length)
/* Write out the current block, if needs be. */
static void
gcov_write_block (unsigned size)
gcov_write_block (unsigned int size)
{
if (fwrite (gcov_var.buffer, size << 2, 1, gcov_var.file) != 1)
gcov_var.error = 1;
@ -228,7 +228,7 @@ gcov_write_block (unsigned size)
pointer to those bytes, or NULL on failure. */
static gcov_unsigned_t *
gcov_write_words (unsigned words)
gcov_write_words (unsigned int words)
{
gcov_unsigned_t *result;
@ -288,8 +288,8 @@ gcov_write_counter (gcov_type value)
GCOV_LINKAGE void
gcov_write_string (const char *string)
{
unsigned length = 0;
unsigned alloc = 0;
unsigned int length = 0;
unsigned int alloc = 0;
gcov_unsigned_t *buffer;
if (string)
@ -330,7 +330,7 @@ gcov_write_tag (gcov_unsigned_t tag)
GCOV_LINKAGE void
gcov_write_length (gcov_position_t position)
{
unsigned offset;
unsigned int offset;
gcov_unsigned_t length;
gcov_unsigned_t *buffer;
@ -364,7 +364,7 @@ gcov_write_tag_length (gcov_unsigned_t tag, gcov_unsigned_t length)
GCOV_LINKAGE void
gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
{
unsigned ix;
unsigned int ix;
const struct gcov_ctr_summary *csum;
gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH);
@ -386,10 +386,10 @@ gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
NULL on failure (read past EOF). */
static const gcov_unsigned_t *
gcov_read_words (unsigned words)
gcov_read_words (unsigned int words)
{
const gcov_unsigned_t *result;
unsigned excess = gcov_var.length - gcov_var.offset;
unsigned int excess = gcov_var.length - gcov_var.offset;
gcc_assert (gcov_var.mode > 0);
if (excess < words)
@ -472,7 +472,7 @@ gcov_read_counter (void)
GCOV_LINKAGE const char *
gcov_read_string (void)
{
unsigned length = gcov_read_unsigned ();
unsigned int length = gcov_read_unsigned ();
if (!length)
return 0;
@ -484,7 +484,7 @@ gcov_read_string (void)
GCOV_LINKAGE void
gcov_read_summary (struct gcov_summary *summary)
{
unsigned ix;
unsigned int ix;
struct gcov_ctr_summary *csum;
summary->checksum = gcov_read_unsigned ();

View File

@ -181,8 +181,8 @@ permissions described in the GCC Runtime Library Exception, version
/* About the target */
#if BITS_PER_UNIT == 8
typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
typedef unsigned int gcov_unsigned_t __attribute__ ((mode (SI)));
typedef unsigned int gcov_position_t __attribute__ ((mode (SI)));
#if LONG_LONG_TYPE_SIZE > 32
typedef signed gcov_type __attribute__ ((mode (DI)));
#else
@ -190,16 +190,16 @@ typedef signed gcov_type __attribute__ ((mode (SI)));
#endif
#else
#if BITS_PER_UNIT == 16
typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI)));
typedef unsigned gcov_position_t __attribute__ ((mode (HI)));
typedef unsigned int gcov_unsigned_t __attribute__ ((mode (HI)));
typedef unsigned int gcov_position_t __attribute__ ((mode (HI)));
#if LONG_LONG_TYPE_SIZE > 32
typedef signed gcov_type __attribute__ ((mode (SI)));
#else
typedef signed gcov_type __attribute__ ((mode (HI)));
#endif
#else
typedef unsigned gcov_unsigned_t __attribute__ ((mode (QI)));
typedef unsigned gcov_position_t __attribute__ ((mode (QI)));
typedef unsigned int gcov_unsigned_t __attribute__ ((mode (QI)));
typedef unsigned int gcov_position_t __attribute__ ((mode (QI)));
#if LONG_LONG_TYPE_SIZE > 32
typedef signed gcov_type __attribute__ ((mode (HI)));
#else
@ -218,8 +218,8 @@ typedef signed gcov_type __attribute__ ((mode (QI)));
#else /* !IN_LIBGCOV */
/* About the host */
typedef unsigned gcov_unsigned_t;
typedef unsigned gcov_position_t;
typedef unsigned int gcov_unsigned_t;
typedef unsigned int gcov_position_t;
/* gcov_type is typedef'd elsewhere for the compiler */
#if IN_GCOV
#define GCOV_LINKAGE static
@ -376,7 +376,7 @@ typedef HOST_WIDEST_INT gcov_type;
(GCOV_TAG_COUNTER_BASE + ((gcov_unsigned_t)(COUNT) << 17))
/* Convert a tag to a counter. */
#define GCOV_COUNTER_FOR_TAG(TAG) \
((unsigned)(((TAG) - GCOV_TAG_COUNTER_BASE) >> 17))
((unsigned int)(((TAG) - GCOV_TAG_COUNTER_BASE) >> 17))
/* Check whether a tag is a counter tag. */
#define GCOV_TAG_IS_COUNTER(TAG) \
(!((TAG) & 0xFFFF) && GCOV_COUNTER_FOR_TAG (TAG) < GCOV_COUNTERS)
@ -463,7 +463,7 @@ struct gcov_info
gcov_merge_fn merge[GCOV_COUNTERS]; /* merge functions (null for
unused) */
unsigned n_functions; /* number of functions */
unsigned int n_functions; /* number of functions */
const struct gcov_fn_info *const *functions; /* pointer to pointers
to function information */
};
@ -477,20 +477,20 @@ extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
#endif
/* The merge function that just sums the counters. */
extern void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
extern void __gcov_merge_add (gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The merge function to choose the most common value. */
extern void __gcov_merge_single (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
extern void __gcov_merge_single (gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The merge function to choose the most common difference between
consecutive values. */
extern void __gcov_merge_delta (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
extern void __gcov_merge_delta (gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The merge function that just ors the counters together. */
extern void __gcov_merge_ior (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
extern void __gcov_merge_ior (gcov_type *, unsigned int) ATTRIBUTE_HIDDEN;
/* The profiler functions. */
extern void __gcov_interval_profiler (gcov_type *, gcov_type, int, unsigned);
extern void __gcov_interval_profiler (gcov_type *, gcov_type, int, unsigned int);
extern void __gcov_pow2_profiler (gcov_type *, gcov_type);
extern void __gcov_one_value_profiler (gcov_type *, gcov_type);
extern void __gcov_indirect_call_profiler (gcov_type *, gcov_type, void *, void *);
@ -520,9 +520,9 @@ GCOV_LINKAGE struct gcov_var
{
FILE *file;
gcov_position_t start; /* Position of first byte of block */
unsigned offset; /* Read/write position within the block. */
unsigned length; /* Read limit in the block. */
unsigned overread; /* Number of words overread. */
unsigned int offset; /* Read/write position within the block. */
unsigned int length; /* Read limit in the block. */
unsigned int overread; /* Number of words overread. */
int error; /* < 0 overflow, > 0 disk error. */
int mode; /* < 0 writing, > 0 reading */
#if IN_LIBGCOV

View File

@ -8,14 +8,14 @@ static void dump_spd_registers(const struct mem_controller *ctrl)
int i;
printk(BIOS_DEBUG, "\n");
for(i = 0; i < 4; i++) {
unsigned device;
unsigned int device;
device = ctrl->channel0[i];
if (device) {
int j;
printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
for(j = 0; j < 256; j++) {
int status;
unsigned char byte;
unsigned int char byte;
if ((j & 0xf) == 0)
printk(BIOS_DEBUG, "\n%02x: ", j);
status = spd_read_byte(device, j);
@ -34,7 +34,7 @@ static void dump_spd_registers(const struct mem_controller *ctrl)
printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device);
for(j = 0; j < 256; j++) {
int status;
unsigned char byte;
unsigned int char byte;
if ((j & 0xf) == 0)
printk(BIOS_DEBUG, "\n%02x: ");
status = spd_read_byte(device, j);
@ -53,7 +53,7 @@ static void dump_spd_registers(const struct mem_controller *ctrl)
#if 0
void dump_spd_registers(void)
{
unsigned device;
unsigned int device;
device = SMBUS_MEM_DEVICE_START;
printk(BIOS_DEBUG, "\n");
while(device <= SMBUS_MEM_DEVICE_END) {
@ -61,7 +61,7 @@ void dump_spd_registers(void)
int i;
printk(BIOS_DEBUG, "dimm %02x", device);
for(i = 0; (i < 256) && (status == 0); i++) {
unsigned char byte;
unsigned int char byte;
if ((i % 20) == 0) {
printk(BIOS_DEBUG, "\n%3d: ", i);
}

View File

@ -79,17 +79,17 @@ void __gcov_flush (void) {}
#ifdef L_gcov_merge_add
void __gcov_merge_add (gcov_type *counters __attribute__ ((unused)),
unsigned n_counters __attribute__ ((unused))) {}
unsigned int n_counters __attribute__ ((unused))) {}
#endif
#ifdef L_gcov_merge_single
void __gcov_merge_single (gcov_type *counters __attribute__ ((unused)),
unsigned n_counters __attribute__ ((unused))) {}
unsigned int n_counters __attribute__ ((unused))) {}
#endif
#ifdef L_gcov_merge_delta
void __gcov_merge_delta (gcov_type *counters __attribute__ ((unused)),
unsigned n_counters __attribute__ ((unused))) {}
unsigned int n_counters __attribute__ ((unused))) {}
#endif
#else
@ -103,7 +103,7 @@ void __gcov_merge_delta (gcov_type *counters __attribute__ ((unused)),
#endif
#else
void __gcov_merge_add(gcov_type *counters __attribute__ ((unused)),
unsigned n_counters __attribute__ ((unused))) {}
unsigned int n_counters __attribute__ ((unused))) {}
#endif /* __COREBOOT__ */
#ifdef L_gcov
@ -112,7 +112,7 @@ void __gcov_merge_add(gcov_type *counters __attribute__ ((unused)),
struct gcov_fn_buffer
{
struct gcov_fn_buffer *next;
unsigned fn_ix;
unsigned int fn_ix;
struct gcov_fn_info info;
/* note gcov_fn_info ends in a trailing array. */
};
@ -177,10 +177,10 @@ create_file_directory (char *filename)
static struct gcov_fn_buffer *
free_fn_data (const struct gcov_info *gi_ptr, struct gcov_fn_buffer *buffer,
unsigned limit)
unsigned int limit)
{
struct gcov_fn_buffer *next;
unsigned ix, n_ctr = 0;
unsigned int ix, n_ctr = 0;
if (!buffer)
return 0;
@ -195,11 +195,11 @@ free_fn_data (const struct gcov_info *gi_ptr, struct gcov_fn_buffer *buffer,
static struct gcov_fn_buffer **
buffer_fn_data (const char *filename, const struct gcov_info *gi_ptr,
struct gcov_fn_buffer **end_ptr, unsigned fn_ix)
struct gcov_fn_buffer **end_ptr, unsigned int fn_ix)
{
unsigned n_ctrs = 0, ix = 0;
unsigned int n_ctrs = 0, ix = 0;
struct gcov_fn_buffer *fn_buffer;
unsigned len;
unsigned int len;
for (ix = GCOV_COUNTERS; ix--;)
if (gi_ptr->merge[ix])
@ -260,11 +260,11 @@ fail:
static gcov_unsigned_t
crc32_unsigned (gcov_unsigned_t crc32, gcov_unsigned_t value)
{
unsigned ix;
unsigned int ix;
for (ix = 32; ix--; value <<= 1)
{
unsigned feedback;
unsigned int feedback;
feedback = (value ^ crc32) & 0x80000000 ? 0x04c11db7 : 0;
crc32 <<= 1;
@ -314,7 +314,7 @@ gcov_exit (void)
struct gcov_summary all_prg; /* summary for all instances of program. */
struct gcov_ctr_summary *cs_ptr;
const struct gcov_ctr_info *ci_ptr;
unsigned t_ix;
unsigned int t_ix;
int f_ix = 0;
gcov_unsigned_t c_num;
const char *gcov_prefix;
@ -331,7 +331,7 @@ gcov_exit (void)
crc32 = crc32_unsigned (crc32, gi_ptr->stamp);
crc32 = crc32_unsigned (crc32, gi_ptr->n_functions);
for (f_ix = 0; (unsigned)f_ix != gi_ptr->n_functions; f_ix++)
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions; f_ix++)
{
gfi_ptr = gi_ptr->functions[f_ix];
@ -408,7 +408,7 @@ gcov_exit (void)
/* Now merge each file. */
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
{
unsigned n_counts;
unsigned int n_counts;
struct gcov_summary prg; /* summary for this object over all
program. */
struct gcov_ctr_summary *cs_prg, *cs_tprg, *cs_all;
@ -519,7 +519,7 @@ gcov_exit (void)
}
/* Merge execution counts for each function. */
for (f_ix = 0; (unsigned)f_ix != gi_ptr->n_functions;
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions;
f_ix++, tag = gcov_read_unsigned ())
{
gfi_ptr = gi_ptr->functions[f_ix];
@ -658,11 +658,11 @@ gcov_exit (void)
gcov_seek (eof_pos);
/* Write execution counts for each function. */
for (f_ix = 0; (unsigned)f_ix != gi_ptr->n_functions; f_ix++)
for (f_ix = 0; (unsigned int)f_ix != gi_ptr->n_functions; f_ix++)
{
unsigned buffered = 0;
unsigned int buffered = 0;
if (fn_buffer && fn_buffer->fn_ix == (unsigned)f_ix)
if (fn_buffer && fn_buffer->fn_ix == (unsigned int)f_ix)
{
/* Buffered data from another program. */
buffered = 1;
@ -757,11 +757,11 @@ __gcov_flush (void)
gcov_exit ();
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
{
unsigned f_ix;
unsigned int f_ix;
for (f_ix = 0; f_ix < gi_ptr->n_functions; f_ix++)
{
unsigned t_ix;
unsigned int t_ix;
const struct gcov_fn_info *gfi_ptr = gi_ptr->functions[f_ix];
if (!gfi_ptr || gfi_ptr->key != gi_ptr)
@ -786,7 +786,7 @@ __gcov_flush (void)
an array COUNTERS of N_COUNTERS old counters and it reads the same number
of counters from the gcov file. */
void
__gcov_merge_add (gcov_type *counters, unsigned n_counters)
__gcov_merge_add (gcov_type *counters, unsigned int n_counters)
{
for (; n_counters; counters++, n_counters--)
*counters += gcov_read_counter ();
@ -798,7 +798,7 @@ __gcov_merge_add (gcov_type *counters, unsigned n_counters)
an array COUNTERS of N_COUNTERS old counters and it reads the same number
of counters from the gcov file. */
void
__gcov_merge_ior (gcov_type *counters, unsigned n_counters)
__gcov_merge_ior (gcov_type *counters, unsigned int n_counters)
{
for (; n_counters; counters++, n_counters--)
*counters |= gcov_read_counter ();
@ -817,9 +817,9 @@ __gcov_merge_ior (gcov_type *counters, unsigned n_counters)
* -- total number of evaluations of the value
*/
void
__gcov_merge_single (gcov_type *counters, unsigned n_counters)
__gcov_merge_single (gcov_type *counters, unsigned int n_counters)
{
unsigned i, n_measures;
unsigned int i, n_measures;
gcov_type value, counter, all;
gcc_assert (!(n_counters % 3));
@ -857,9 +857,9 @@ __gcov_merge_single (gcov_type *counters, unsigned n_counters)
* -- total number of evaluations of the value
*/
void
__gcov_merge_delta (gcov_type *counters, unsigned n_counters)
__gcov_merge_delta (gcov_type *counters, unsigned int n_counters)
{
unsigned i, n_measures;
unsigned int i, n_measures;
gcov_type value, counter, all;
gcc_assert (!(n_counters % 4));
@ -893,7 +893,7 @@ __gcov_merge_delta (gcov_type *counters, unsigned n_counters)
void
__gcov_interval_profiler (gcov_type *counters, gcov_type value,
int start, unsigned steps)
int start, unsigned int steps)
{
gcov_type delta = value - start;
if (delta < 0)
@ -1030,7 +1030,7 @@ int
__gcov_execl (const char *path, char *arg, ...)
{
va_list ap, aq;
unsigned i, length;
unsigned int i, length;
char **args;
__gcov_flush ();
@ -1061,7 +1061,7 @@ int
__gcov_execlp (const char *path, char *arg, ...)
{
va_list ap, aq;
unsigned i, length;
unsigned int i, length;
char **args;
__gcov_flush ();
@ -1092,7 +1092,7 @@ int
__gcov_execle (const char *path, char *arg, ...)
{
va_list ap, aq;
unsigned i, length;
unsigned int i, length;
char **args;
char **envp;

View File

@ -228,7 +228,7 @@ static void idle_thread_init(void)
/* Don't inline this function so the timeout_callback won't have its storage
* space on the stack cleaned up before the call to schedule(). */
static int __attribute__((noinline))
thread_yield_timed_callback(struct timeout_callback *tocb, unsigned microsecs)
thread_yield_timed_callback(struct timeout_callback *tocb, unsigned int microsecs)
{
tocb->priv = current_thread();
tocb->callback = thread_resume_from_timeout;
@ -337,7 +337,7 @@ int thread_run_until(void (*func)(void *), void *arg,
return 0;
}
int thread_yield_microseconds(unsigned microsecs)
int thread_yield_microseconds(unsigned int microsecs)
{
struct thread *current;
struct timeout_callback tocb;

View File

@ -20,7 +20,7 @@
__attribute__((weak)) void init_timer() { /* do nothing */ }
void udelay(unsigned usec)
void udelay(unsigned int usec)
{
struct stopwatch sw;