helper/command: pass command prefix to command registration

Replace the "struct command *parent" parameter with a string that
contains the command prefix.
This abstracts the openocd code from the knowledge of the tree of
struct command.
This also makes unused the function command_find_in_context(), so
remove it.

Change-Id: I598d60719cfdc1811ee6f6edfff8a116f82c7ed6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5668
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
This commit is contained in:
Antonio Borneo
2020-05-10 19:35:56 +02:00
parent 4289389937
commit 41c95aa4ea
7 changed files with 30 additions and 32 deletions

View File

@@ -479,8 +479,8 @@ static int nand_init(struct command_context *cmd_ctx)
{
if (!nand_devices)
return ERROR_OK;
struct command *parent = command_find_in_context(cmd_ctx, "nand");
return register_commands(cmd_ctx, parent, nand_exec_command_handlers);
return register_commands(cmd_ctx, "nand", nand_exec_command_handlers);
}
COMMAND_HANDLER(handle_nand_init_command)