From 6beb6280af985e79094501af5cb66d1a33019544 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 22 Dec 2024 17:13:59 +0100 Subject: [PATCH] adapter: drop command 'adapter transports' The commit 93f2afa45f4c ("initial "transport" framework") that added the transport framework in 2010 was overly optimistic on the possibility to dynamically add, at runtime, a new adapter and to specify with the command 'adapter transports' the list of the transports supported by the new adapter. Such feature has never become part of OpenOCD, and the command above has never become useful nor ever been used. Drop the command 'adapter transports' and its documentation. Drop the helper 'transport_list_parse', now unused. Change-Id: Ie3d71c74d068fba802839b116bb9bc9af77cc83d Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/8671 Reviewed-by: Tomas Vanek Tested-by: jenkins --- doc/openocd.texi | 6 ----- src/jtag/adapter.c | 26 --------------------- src/transport/transport.c | 48 --------------------------------------- src/transport/transport.h | 2 -- 4 files changed, 82 deletions(-) diff --git a/doc/openocd.texi b/doc/openocd.texi index 140d0f8c7..9ff524b74 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2415,12 +2415,6 @@ target. List the debug adapter drivers that have been built into the running copy of OpenOCD. @end deffn -@deffn {Config Command} {adapter transports} transport_name+ -Specifies the transports supported by this debug adapter. -The adapter driver builds-in similar knowledge; use this only -when external configuration (such as jumpering) changes what -the hardware can support. -@end deffn @anchor{adapter gpio} @deffn {Config Command} {adapter gpio [ @ diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c index 04942f753..db3d3b0fe 100644 --- a/src/jtag/adapter.c +++ b/src/jtag/adapter.c @@ -392,25 +392,6 @@ COMMAND_HANDLER(handle_adapter_name) return ERROR_OK; } -COMMAND_HANDLER(adapter_transports_command) -{ - char **transports; - int retval; - - retval = CALL_COMMAND_HANDLER(transport_list_parse, &transports); - if (retval != ERROR_OK) - return retval; - - retval = allow_transports(CMD_CTX, (const char **)transports); - - if (retval != ERROR_OK) { - for (unsigned int i = 0; transports[i]; i++) - free(transports[i]); - free(transports); - } - return retval; -} - COMMAND_HANDLER(handle_adapter_list_command) { if (strcmp(CMD_NAME, "list") == 0 && CMD_ARGC > 0) @@ -1137,13 +1118,6 @@ static const struct command_registration adapter_command_handlers[] = { .usage = "", .chain = adapter_srst_command_handlers, }, - { - .name = "transports", - .handler = adapter_transports_command, - .mode = COMMAND_CONFIG, - .help = "Declare transports the adapter supports.", - .usage = "transport ...", - }, { .name = "usb", .mode = COMMAND_ANY, diff --git a/src/transport/transport.c b/src/transport/transport.c index c7293e7fd..0af136036 100644 --- a/src/transport/transport.c +++ b/src/transport/transport.c @@ -166,54 +166,6 @@ struct transport *get_current_transport(void) * Infrastructure for Tcl interface to transports. */ -/** - * Makes and stores a copy of a set of transports passed as - * parameters to a command. - * - * @param vector where the resulting copy is stored, as an argv-style - * NULL-terminated vector. - */ -COMMAND_HELPER(transport_list_parse, char ***vector) -{ - char **argv; - unsigned int n = CMD_ARGC; - unsigned int j = 0; - - *vector = NULL; - - if (n < 1) - return ERROR_COMMAND_SYNTAX_ERROR; - - /* our return vector must be NULL terminated */ - argv = calloc(n + 1, sizeof(char *)); - if (!argv) - return ERROR_FAIL; - - for (unsigned int i = 0; i < n; i++) { - struct transport *t; - - for (t = transport_list; t; t = t->next) { - if (strcmp(t->name, CMD_ARGV[i]) != 0) - continue; - argv[j++] = strdup(CMD_ARGV[i]); - break; - } - if (!t) { - LOG_ERROR("no such transport '%s'", CMD_ARGV[i]); - goto fail; - } - } - - *vector = argv; - return ERROR_OK; - -fail: - for (unsigned int i = 0; i < n; i++) - free(argv[i]); - free(argv); - return ERROR_FAIL; -} - COMMAND_HANDLER(handle_transport_init) { LOG_DEBUG("%s", __func__); diff --git a/src/transport/transport.h b/src/transport/transport.h index 00d8b07e1..2e3dcc61a 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -77,8 +77,6 @@ struct transport *get_current_transport(void); int transport_register_commands(struct command_context *ctx); -COMMAND_HELPER(transport_list_parse, char ***vector); - int allow_transports(struct command_context *ctx, const char * const *vector); bool transport_is_jtag(void); -- 2.49.0