This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7558

-- gerrit

commit 8e28f00000e0556819c7f4490631a99ee586210c
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Mon Mar 27 10:43:30 2023 +0200

    target: rewrite command 'arp_halt' as COMMAND_HANDLER
    
    While there, add the missing .usage field.
    
    Change-Id: I748382cafe08443c458ff1d4e47819610cfbf85c
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/target/target.c b/src/target/target.c
index 29c549c54f..fadb17bfe5 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5820,19 +5820,18 @@ static int jim_target_reset(Jim_Interp *interp, int 
argc, Jim_Obj *const *argv)
        return (e == ERROR_OK) ? JIM_OK : JIM_ERR;
 }
 
-static int jim_target_halt(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_target_halt)
 {
-       if (argc != 1) {
-               Jim_WrongNumArgs(interp, 1, argv, "[no parameters]");
-               return JIM_ERR;
+       if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       struct target *target = get_current_target(CMD_CTX);
+       if (!target->tap->enabled) {
+               command_print(CMD, "[TAP is disabled]");
+               return ERROR_FAIL;
        }
-       struct command_context *cmd_ctx = current_command_context(interp);
-       assert(cmd_ctx);
-       struct target *target = get_current_target(cmd_ctx);
-       if (!target->tap->enabled)
-               return jim_target_tap_disabled(interp);
-       int e = target->type->halt(target);
-       return (e == ERROR_OK) ? JIM_OK : JIM_ERR;
+
+       return target->type->halt(target);
 }
 
 static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const 
*argv)
@@ -6106,8 +6105,9 @@ static const struct command_registration 
target_instance_command_handlers[] = {
        {
                .name = "arp_halt",
                .mode = COMMAND_EXEC,
-               .jim_handler = jim_target_halt,
+               .handler = handle_target_halt,
                .help = "used internally for reset processing",
+               .usage = "",
        },
        {
                .name = "arp_waitstate",

-- 

Reply via email to