From: Spencer Oliver Date: Mon, 25 Feb 2013 16:52:00 +0000 (+0000) Subject: target: use common target_name to access target::cmd_name member X-Git-Tag: v0.7.0-rc1~69 X-Git-Url: https://repo.or.cz/w/openocd.git/commitdiff_plain/dcfa3ac7c7e116d5ff70f7c69d4eff80b3495443 target: use common target_name to access target::cmd_name member Change-Id: I203b89ef25a072c3b00b504483d5f2a83477fad6 Signed-off-by: Spencer Oliver Reviewed-on: http://openocd.zylin.com/1182 Tested-by: jenkins Reviewed-by: Mathias Küster Reviewed-by: Andreas Fritiofson --- diff --git a/src/target/armv7a.c b/src/target/armv7a.c index e95e99b07..532b0b27e 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -549,7 +549,7 @@ static int armv7a_read_mpidr(struct target *target) armv7a->multi_processor_system = (mpidr >> 30) & 1; armv7a->cluster_id = (mpidr >> 8) & 0xf; armv7a->cpu_id = mpidr & 0x3; - LOG_INFO("%s cluster %x core %x %s", target->cmd_name, + LOG_INFO("%s cluster %x core %x %s", target_name(target), armv7a->cluster_id, armv7a->cpu_id, armv7a->multi_processor_system == 0 ? "multi core" : "mono core"); diff --git a/src/target/target.c b/src/target/target.c index d768fda7e..e964f5224 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -379,9 +379,9 @@ struct target *get_target(const char *id) /* try as tcltarget name */ for (target = all_targets; target; target = target->next) { - if (target->cmd_name == NULL) + if (target_name(target) == NULL) continue; - if (strcmp(id, target->cmd_name) == 0) + if (strcmp(id, target_name(target)) == 0) return target; } @@ -395,7 +395,7 @@ struct target *get_target(const char *id) for (target = all_targets; target; target = target->next) { if (target->target_number == (int)num) { LOG_WARNING("use '%s' as target identifier, not '%u'", - target->cmd_name, num); + target_name(target), num); return target; } } @@ -982,7 +982,7 @@ int target_add_breakpoint(struct target *target, struct breakpoint *breakpoint) { if ((target->state != TARGET_HALTED) && (breakpoint->type != BKPT_HARD)) { - LOG_WARNING("target %s is not halted", target->cmd_name); + LOG_WARNING("target %s is not halted", target_name(target)); return ERROR_TARGET_NOT_HALTED; } return target->type->add_breakpoint(target, breakpoint); @@ -992,7 +992,7 @@ int target_add_context_breakpoint(struct target *target, struct breakpoint *breakpoint) { if (target->state != TARGET_HALTED) { - LOG_WARNING("target %s is not halted", target->cmd_name); + LOG_WARNING("target %s is not halted", target_name(target)); return ERROR_TARGET_NOT_HALTED; } return target->type->add_context_breakpoint(target, breakpoint); @@ -1002,7 +1002,7 @@ int target_add_hybrid_breakpoint(struct target *target, struct breakpoint *breakpoint) { if (target->state != TARGET_HALTED) { - LOG_WARNING("target %s is not halted", target->cmd_name); + LOG_WARNING("target %s is not halted", target_name(target)); return ERROR_TARGET_NOT_HALTED; } return target->type->add_hybrid_breakpoint(target, breakpoint); @@ -1018,7 +1018,7 @@ int target_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { if (target->state != TARGET_HALTED) { - LOG_WARNING("target %s is not halted", target->cmd_name); + LOG_WARNING("target %s is not halted", target_name(target)); return ERROR_TARGET_NOT_HALTED; } return target->type->add_watchpoint(target, watchpoint); @@ -5071,7 +5071,7 @@ static int jim_target_current(Jim_Interp *interp, int argc, Jim_Obj *const *argv struct command_context *cmd_ctx = current_command_context(interp); assert(cmd_ctx != NULL); - Jim_SetResultString(interp, get_current_target(cmd_ctx)->cmd_name, -1); + Jim_SetResultString(interp, target_name(get_current_target(cmd_ctx)), -1); return JIM_OK; }