diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2020-05-10 19:35:56 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-04-18 15:33:30 +0100 |
commit | 41c95aa4ea1506a951dad0147f6cd4b8d7043358 (patch) | |
tree | f573214b497914549a9b81872dc528f0b70c7870 /src/flash/nor | |
parent | 428938993742f4f961cdc948593d9553f721c321 (diff) | |
download | riscv-openocd-41c95aa4ea1506a951dad0147f6cd4b8d7043358.zip riscv-openocd-41c95aa4ea1506a951dad0147f6cd4b8d7043358.tar.gz riscv-openocd-41c95aa4ea1506a951dad0147f6cd4b8d7043358.tar.bz2 |
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>
Diffstat (limited to 'src/flash/nor')
-rw-r--r-- | src/flash/nor/esirisc_flash.c | 4 | ||||
-rw-r--r-- | src/flash/nor/tcl.c | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/flash/nor/esirisc_flash.c b/src/flash/nor/esirisc_flash.c index 88f00bc..24e8117 100644 --- a/src/flash/nor/esirisc_flash.c +++ b/src/flash/nor/esirisc_flash.c @@ -109,7 +109,6 @@ static const struct command_registration esirisc_flash_command_handlers[]; FLASH_BANK_COMMAND_HANDLER(esirisc_flash_bank_command) { struct esirisc_flash_bank *esirisc_info; - struct command *esirisc_cmd; if (CMD_ARGC < 9) return ERROR_COMMAND_SYNTAX_ERROR; @@ -123,8 +122,7 @@ FLASH_BANK_COMMAND_HANDLER(esirisc_flash_bank_command) bank->driver_priv = esirisc_info; /* register commands using existing esirisc context */ - esirisc_cmd = command_find_in_context(CMD_CTX, "esirisc"); - register_commands(CMD_CTX, esirisc_cmd, esirisc_flash_command_handlers); + register_commands(CMD_CTX, "esirisc", esirisc_flash_command_handlers); return ERROR_OK; } diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 66b9a4c..3f737ac 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -1248,8 +1248,7 @@ static int flash_init_drivers(struct command_context *cmd_ctx) if (!flash_bank_list()) return ERROR_OK; - struct command *parent = command_find_in_context(cmd_ctx, "flash"); - return register_commands(cmd_ctx, parent, flash_exec_command_handlers); + return register_commands(cmd_ctx, "flash", flash_exec_command_handlers); } COMMAND_HANDLER(handle_flash_bank_command) |