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:
Antonio Borneo
2021-12-16 01:59:14 +01:00
parent 5ab74bde06
commit 16cc853bcf
16 changed files with 136 additions and 178 deletions

View File

@@ -201,7 +201,9 @@ struct target {
* and must be detected when symbols are offered */
struct backoff_timer backoff;
int smp; /* add some target attributes for smp support */
struct target_list *head;
struct list_head *smp_targets; /* list all targets in this smp group/cluster
* The head of the list is shared between the
* cluster, thus here there is a pointer */
/* the gdb service is there in case of smp, we have only one gdb server
* for all smp target
* the target attached to the gdb is changing dynamically by changing
@@ -220,8 +222,8 @@ struct target {
};
struct target_list {
struct list_head lh;
struct target *target;
struct target_list *next;
};
struct gdb_fileio_info {