target: riscv: convert 'unsigned' to 'unsigned int'

Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).

Change-Id: I11f10eddadc21e051c96eb3d4d4c0554a2cddd15
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8483
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2024-09-08 21:23:28 +02:00
parent bcf63ac562
commit 957eb741a0
8 changed files with 121 additions and 121 deletions

View File

@@ -476,7 +476,7 @@ static void riscv_free_registers(struct target *target)
if (target->reg_cache->reg_list) {
free(target->reg_cache->reg_list[0].arch_info);
/* Free the ones we allocated separately. */
for (unsigned i = GDB_REGNO_COUNT; i < target->reg_cache->num_regs; i++)
for (unsigned int i = GDB_REGNO_COUNT; i < target->reg_cache->num_regs; i++)
free(target->reg_cache->reg_list[i].arch_info);
for (unsigned int i = 0; i < target->reg_cache->num_regs; i++)
free(target->reg_cache->reg_list[i].value);
@@ -1583,7 +1583,7 @@ static int riscv_address_translate(struct target *target,
if (result != ERROR_OK)
return result;
unsigned xlen = riscv_xlen(target);
unsigned int xlen = riscv_xlen(target);
mode = get_field(satp_value, RISCV_SATP_MODE(xlen));
switch (mode) {
case SATP_MODE_SV32:
@@ -1927,7 +1927,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params,
GDB_REGNO_PC,
GDB_REGNO_MSTATUS, GDB_REGNO_MEPC, GDB_REGNO_MCAUSE,
};
for (unsigned i = 0; i < ARRAY_SIZE(regnums); i++) {
for (unsigned int i = 0; i < ARRAY_SIZE(regnums); i++) {
enum gdb_regno regno = regnums[i];
riscv_reg_t reg_value;
if (riscv_get_register(target, &reg_value, regno) != ERROR_OK)
@@ -2007,8 +2007,8 @@ static int riscv_checksum_memory(struct target *target,
static const uint8_t *crc_code;
unsigned xlen = riscv_xlen(target);
unsigned crc_code_size;
unsigned int xlen = riscv_xlen(target);
unsigned int crc_code_size;
if (xlen == 32) {
crc_code = riscv32_crc_code;
crc_code_size = sizeof(riscv32_crc_code);
@@ -2187,8 +2187,8 @@ int riscv_openocd_poll(struct target *target)
int halted_hart = -1;
if (target->smp) {
unsigned should_remain_halted = 0;
unsigned should_resume = 0;
unsigned int should_remain_halted = 0;
unsigned int should_resume = 0;
struct target_list *list;
foreach_smp_target(list, target->smp_targets) {
struct target *t = list->target;
@@ -2436,8 +2436,8 @@ static int parse_ranges(struct list_head *ranges, const char *tcl_arg, const cha
/* For backward compatibility, allow multiple parameters within one TCL argument, separated by ',' */
char *arg = strtok(args, ",");
while (arg) {
unsigned low = 0;
unsigned high = 0;
unsigned int low = 0;
unsigned int high = 0;
char *name = NULL;
char *dash = strchr(arg, '-');
@@ -3055,7 +3055,7 @@ static const struct command_registration riscv_command_handlers[] = {
COMMAND_REGISTRATION_DONE
};
static unsigned riscv_xlen_nonconst(struct target *target)
static unsigned int riscv_xlen_nonconst(struct target *target)
{
return riscv_xlen(target);
}
@@ -3194,7 +3194,7 @@ static int riscv_step_rtos_hart(struct target *target)
bool riscv_supports_extension(struct target *target, char letter)
{
RISCV_INFO(r);
unsigned num;
unsigned int num;
if (letter >= 'a' && letter <= 'z')
num = letter - 'a';
else if (letter >= 'A' && letter <= 'Z')
@@ -3204,7 +3204,7 @@ bool riscv_supports_extension(struct target *target, char letter)
return r->misa & BIT(num);
}
unsigned riscv_xlen(const struct target *target)
unsigned int riscv_xlen(const struct target *target)
{
RISCV_INFO(r);
return r->xlen;
@@ -3778,7 +3778,7 @@ static struct reg_arch_type riscv_reg_arch_type = {
};
struct csr_info {
unsigned number;
unsigned int number;
const char *name;
};
@@ -3958,7 +3958,7 @@ int riscv_init_registers(struct target *target)
};
/* encoding.h does not contain the registers in sorted order. */
qsort(csr_info, ARRAY_SIZE(csr_info), sizeof(*csr_info), cmp_csr_info);
unsigned csr_info_index = 0;
unsigned int csr_info_index = 0;
int custom_within_range = 0;
@@ -4213,7 +4213,7 @@ int riscv_init_registers(struct target *target)
} else if (number >= GDB_REGNO_CSR0 && number <= GDB_REGNO_CSR4095) {
r->group = "csr";
r->feature = &feature_csr;
unsigned csr_number = number - GDB_REGNO_CSR0;
unsigned int csr_number = number - GDB_REGNO_CSR0;
while (csr_info[csr_info_index].number < csr_number &&
csr_info_index < ARRAY_SIZE(csr_info) - 1) {
@@ -4376,7 +4376,7 @@ int riscv_init_registers(struct target *target)
range_list_t *range = list_first_entry(&info->expose_custom, range_list_t, list);
unsigned custom_number = range->low + custom_within_range;
unsigned int custom_number = range->low + custom_within_range;
r->group = "custom";
r->feature = &feature_custom;