target/xscale: change prototype of xscale_verify_pointer()

To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should be ready to switch
to CMD as first parameter.

Change prototype of xscale_verify_pointer() to pass CMD instead of
CMD_CTX.

This change was part of http://openocd.zylin.com/1815 from Paul
Fertser and has been extracted and rebased to simplify the review.

Change-Id: Id047fab41ec4f673a46756b0ab901e659e088544
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5064
Tested-by: jenkins
bscan_optimization
Paul Fertser 2019-04-01 03:56:26 +02:00 committed by Tomas Vanek
parent 7b164d21ba
commit 32470a973f
1 changed files with 14 additions and 14 deletions

View File

@ -138,11 +138,11 @@ static int xscale_set_reg_u32(struct reg *reg, uint32_t value)
static const char xscale_not[] = "target is not an XScale"; static const char xscale_not[] = "target is not an XScale";
static int xscale_verify_pointer(struct command_context *cmd_ctx, static int xscale_verify_pointer(struct command_invocation *cmd,
struct xscale_common *xscale) struct xscale_common *xscale)
{ {
if (xscale->common_magic != XSCALE_COMMON_MAGIC) { if (xscale->common_magic != XSCALE_COMMON_MAGIC) {
command_print(cmd_ctx, xscale_not); command_print(cmd->ctx, xscale_not);
return ERROR_TARGET_INVALID; return ERROR_TARGET_INVALID;
} }
return ERROR_OK; return ERROR_OK;
@ -3032,7 +3032,7 @@ COMMAND_HANDLER(xscale_handle_debug_handler_command)
} }
xscale = target_to_xscale(target); xscale = target_to_xscale(target);
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3066,7 +3066,7 @@ COMMAND_HANDLER(xscale_handle_cache_clean_address_command)
return ERROR_FAIL; return ERROR_FAIL;
} }
xscale = target_to_xscale(target); xscale = target_to_xscale(target);
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3086,7 +3086,7 @@ COMMAND_HANDLER(xscale_handle_cache_info_command)
struct xscale_common *xscale = target_to_xscale(target); struct xscale_common *xscale = target_to_xscale(target);
int retval; int retval;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3131,7 +3131,7 @@ COMMAND_HANDLER(xscale_handle_mmu_command)
struct xscale_common *xscale = target_to_xscale(target); struct xscale_common *xscale = target_to_xscale(target);
int retval; int retval;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3161,7 +3161,7 @@ COMMAND_HANDLER(xscale_handle_idcache_command)
struct target *target = get_current_target(CMD_CTX); struct target *target = get_current_target(CMD_CTX);
struct xscale_common *xscale = target_to_xscale(target); struct xscale_common *xscale = target_to_xscale(target);
int retval = xscale_verify_pointer(CMD_CTX, xscale); int retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3222,7 +3222,7 @@ COMMAND_HANDLER(xscale_handle_vector_catch_command)
uint32_t catch = 0; uint32_t catch = 0;
struct reg *dcsr_reg = &xscale->reg_cache->reg_list[XSCALE_DCSR]; struct reg *dcsr_reg = &xscale->reg_cache->reg_list[XSCALE_DCSR];
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3272,7 +3272,7 @@ COMMAND_HANDLER(xscale_handle_vector_table_command)
int err = 0; int err = 0;
int retval; int retval;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3330,7 +3330,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
uint32_t dcsr_value; uint32_t dcsr_value;
int retval; int retval;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3395,7 +3395,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command)
if (CMD_ARGC < 1) if (CMD_ARGC < 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3434,7 +3434,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
struct fileio *file; struct fileio *file;
int retval; int retval;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3482,7 +3482,7 @@ COMMAND_HANDLER(xscale_handle_analyze_trace_buffer_command)
struct xscale_common *xscale = target_to_xscale(target); struct xscale_common *xscale = target_to_xscale(target);
int retval; int retval;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@ -3497,7 +3497,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
struct xscale_common *xscale = target_to_xscale(target); struct xscale_common *xscale = target_to_xscale(target);
int retval; int retval;
retval = xscale_verify_pointer(CMD_CTX, xscale); retval = xscale_verify_pointer(CMD, xscale);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;