use CALL_COMMAND_HANDLER instead of direct calls
By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or even removed in inherited signatures, without requiring revisiting all of the various call sites.
This commit is contained in:
parent
1df5cc18f5
commit
5b6df55a1e
|
@ -259,7 +259,8 @@ COMMAND_HANDLER(handle_flash_bank_command)
|
|||
c->sectors = NULL;
|
||||
c->next = NULL;
|
||||
|
||||
if ((retval = flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
|
||||
retval = CALL_COMMAND_HANDLER(flash_drivers[i]->flash_bank_command, c);
|
||||
if (ERROR_OK != retval)
|
||||
{
|
||||
LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base);
|
||||
free(c);
|
||||
|
|
|
@ -241,7 +241,8 @@ COMMAND_HANDLER(handle_nand_device_command)
|
|||
c->use_raw = 0;
|
||||
c->next = NULL;
|
||||
|
||||
if ((retval = nand_flash_controllers[i]->nand_device_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
|
||||
retval = CALL_COMMAND_HANDLER(nand_flash_controllers[i]->nand_device_command, c);
|
||||
if (ERROR_OK != retval)
|
||||
{
|
||||
LOG_ERROR("'%s' driver rejected nand flash", c->controller->name);
|
||||
free(c);
|
||||
|
|
|
@ -658,7 +658,7 @@ COMMAND_HANDLER(handle_interface_command)
|
|||
* didn't match one of the compiled-in interfaces
|
||||
*/
|
||||
LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]);
|
||||
handle_interface_list_command(cmd_ctx, cmd, args, argc);
|
||||
CALL_COMMAND_HANDLER(handle_interface_list_command);
|
||||
return ERROR_JTAG_INVALID_INTERFACE;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,8 @@ COMMAND_HANDLER(handle_pld_device_command)
|
|||
c->driver = pld_drivers[i];
|
||||
c->next = NULL;
|
||||
|
||||
if (pld_drivers[i]->pld_device_command(cmd_ctx, cmd, args, argc, c) != ERROR_OK)
|
||||
int retval = CALL_COMMAND_HANDLER(pld_drivers[i]->pld_device_command, c);
|
||||
if (ERROR_OK != retval)
|
||||
{
|
||||
LOG_ERROR("'%s' driver rejected pld device", args[0]);
|
||||
free(c);
|
||||
|
|
|
@ -2271,7 +2271,7 @@ COMMAND_HANDLER(handle_gdb_sync_command)
|
|||
/* daemon configuration command gdb_port */
|
||||
COMMAND_HANDLER(handle_gdb_port_command)
|
||||
{
|
||||
return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port);
|
||||
return CALL_COMMAND_HANDLER(server_port_command, &gdb_port);
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_gdb_memory_map_command)
|
||||
|
|
|
@ -172,7 +172,7 @@ int tcl_init(void)
|
|||
|
||||
COMMAND_HANDLER(handle_tcl_port_command)
|
||||
{
|
||||
return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port);
|
||||
return CALL_COMMAND_HANDLER(server_port_command, &tcl_port);
|
||||
}
|
||||
|
||||
int tcl_register_commands(command_context_t *cmd_ctx)
|
||||
|
|
|
@ -608,7 +608,7 @@ int telnet_init(char *banner)
|
|||
/* daemon configuration command telnet_port */
|
||||
COMMAND_HANDLER(handle_telnet_port_command)
|
||||
{
|
||||
return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port);
|
||||
return CALL_COMMAND_HANDLER(server_port_command, &telnet_port);
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_exit_command)
|
||||
|
|
|
@ -2029,7 +2029,8 @@ static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name)
|
|||
#define BOOL_WRAPPER(name, print_name) \
|
||||
COMMAND_HANDLER(arm11_handle_bool_##name) \
|
||||
{ \
|
||||
return arm11_handle_bool(cmd_ctx, cmd, args, argc, &arm11_config_##name, print_name); \
|
||||
return CALL_COMMAND_HANDLER(arm11_handle_bool, \
|
||||
&arm11_config_##name, print_name); \
|
||||
}
|
||||
|
||||
BOOL_WRAPPER(memwrite_burst, "memory write burst mode")
|
||||
|
@ -2186,12 +2187,12 @@ static COMMAND_HELPER(arm11_handle_etm_read_write, bool read)
|
|||
|
||||
COMMAND_HANDLER(arm11_handle_etmr)
|
||||
{
|
||||
return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, true);
|
||||
return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, true);
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(arm11_handle_etmw)
|
||||
{
|
||||
return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, false);
|
||||
return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, false);
|
||||
}
|
||||
|
||||
#define ARM11_HANDLER(x) .x = arm11_##x
|
||||
|
|
|
@ -1271,7 +1271,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
|
|||
case 0:
|
||||
break;
|
||||
case 4:
|
||||
handle_etm_tracemode_command_update(cmd_ctx, cmd, args, argc, &tracemode);
|
||||
CALL_COMMAND_HANDLER(handle_etm_tracemode_command_update, &tracemode);
|
||||
break;
|
||||
default:
|
||||
command_print(cmd_ctx, "usage: configure trace mode "
|
||||
|
|
|
@ -2121,7 +2121,7 @@ COMMAND_HANDLER(handle_halt_command)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
return handle_wait_halt_command(cmd_ctx, cmd, args, argc);
|
||||
return CALL_COMMAND_HANDLER(handle_wait_halt_command);
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_soft_reset_halt_command)
|
||||
|
@ -2410,7 +2410,7 @@ COMMAND_HANDLER(handle_load_image_command)
|
|||
int i;
|
||||
image_t image;
|
||||
|
||||
int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
|
||||
int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
|
||||
&image, &min_address, &max_address);
|
||||
if (ERROR_OK != retval)
|
||||
return retval;
|
||||
|
@ -2701,12 +2701,12 @@ done:
|
|||
|
||||
COMMAND_HANDLER(handle_verify_image_command)
|
||||
{
|
||||
return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 1);
|
||||
return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 1);
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_test_image_command)
|
||||
{
|
||||
return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0);
|
||||
return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 0);
|
||||
}
|
||||
|
||||
static int handle_bp_command_list(struct command_context_s *cmd_ctx)
|
||||
|
@ -4547,7 +4547,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
|
|||
|
||||
image_t image;
|
||||
|
||||
int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc,
|
||||
int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
|
||||
&image, &min_address, &max_address);
|
||||
if (ERROR_OK != retval)
|
||||
return retval;
|
||||
|
|
Loading…
Reference in New Issue