target/cortex_m: change prototype of cortex_m_verify_pointer()
authorPaul Fertser <fercerpav@gmail.com>
Mon, 1 Apr 2019 02:55:27 +0000 (04:55 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 14 May 2019 18:34:49 +0000 (19:34 +0100)
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 cortex_m_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: Icf6d1e5f8b4a3ce115c4253e49769df19a5211ae
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/5061
Tested-by: jenkins
src/target/cortex_m.c

index e8839250456e7979890f5aa0f048d26057ac4c2f..639e09f7eb9334e2dad6ba2fb2a6da651fc43d6b 100644 (file)
@@ -2366,11 +2366,11 @@ static int cortex_m_target_create(struct target *target, Jim_Interp *interp)
 
 /*--------------------------------------------------------------------------*/
 
-static int cortex_m_verify_pointer(struct command_context *cmd_ctx,
+static int cortex_m_verify_pointer(struct command_invocation *cmd,
        struct cortex_m_common *cm)
 {
        if (cm->common_magic != CORTEX_M_COMMON_MAGIC) {
-               command_print(cmd_ctx, "target is not a Cortex-M");
+               command_print(cmd->ctx, "target is not a Cortex-M");
                return ERROR_TARGET_INVALID;
        }
        return ERROR_OK;
@@ -2404,7 +2404,7 @@ COMMAND_HANDLER(handle_cortex_m_vector_catch_command)
                { "reset",      VC_CORERESET, },
        };
 
-       retval = cortex_m_verify_pointer(CMD_CTX, cortex_m);
+       retval = cortex_m_verify_pointer(CMD, cortex_m);
        if (retval != ERROR_OK)
                return retval;
 
@@ -2482,7 +2482,7 @@ COMMAND_HANDLER(handle_cortex_m_mask_interrupts_command)
        const Jim_Nvp *n;
 
 
-       retval = cortex_m_verify_pointer(CMD_CTX, cortex_m);
+       retval = cortex_m_verify_pointer(CMD, cortex_m);
        if (retval != ERROR_OK)
                return retval;
 
@@ -2512,7 +2512,7 @@ COMMAND_HANDLER(handle_cortex_m_reset_config_command)
        int retval;
        char *reset_config;
 
-       retval = cortex_m_verify_pointer(CMD_CTX, cortex_m);
+       retval = cortex_m_verify_pointer(CMD, cortex_m);
        if (retval != ERROR_OK)
                return retval;