target/smp: use a struct list_head to hold the smp targets
Instead of reinventing a simply linked list, reuse the list helper for the list of targets in a smp cluster. Using the existing helper, that implements a double linked list, makes trivial going through the list in reverse order. Change-Id: Ib36ad2955f15cd2a601b0b9e36ca6d948b12d00f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6783 Tested-by: jenkins
This commit is contained in:
@@ -111,18 +111,18 @@ COMMAND_HANDLER(default_handle_smp_command)
|
||||
}
|
||||
|
||||
if (!strcmp(CMD_ARGV[0], "on")) {
|
||||
foreach_smp_target(head, target->head)
|
||||
foreach_smp_target(head, target->smp_targets)
|
||||
head->target->smp = 1;
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
if (!strcmp(CMD_ARGV[0], "off")) {
|
||||
foreach_smp_target(head, target->head)
|
||||
foreach_smp_target(head, target->smp_targets)
|
||||
head->target->smp = 0;
|
||||
|
||||
/* fixes the target display to the debugger */
|
||||
if (target->head)
|
||||
if (!list_empty(target->smp_targets))
|
||||
target->gdb_service->target = target;
|
||||
|
||||
return ERROR_OK;
|
||||
@@ -135,9 +135,7 @@ COMMAND_HANDLER(handle_smp_gdb_command)
|
||||
{
|
||||
struct target *target = get_current_target(CMD_CTX);
|
||||
int retval = ERROR_OK;
|
||||
struct target_list *head;
|
||||
head = target->head;
|
||||
if (head) {
|
||||
if (!list_empty(target->smp_targets)) {
|
||||
if (CMD_ARGC == 1) {
|
||||
int coreid = 0;
|
||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], coreid);
|
||||
|
||||
Reference in New Issue
Block a user