Skip to content

Commit a86fdfc

Browse files
committed
target: drop last instances of 'target->cmd_name'
The helper function 'target_name()' or, better, the log functions 'LOG_TARGET_xxx(target, ...)' should be used in place of taking the target name directly from 'target->cmd_name'. Replace the remaining instances in the code. While there: - address some indentation, - drop trailing punctuation in log message, - replace one LOG WARNING with LOG_TARGET_WARNING. Change-Id: Ie6cf4c174ffe91b975c983e4697c735766267041 Signed-off-by: Antonio Borneo <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8806 Tested-by: jenkins Reviewed-by: zapb <[email protected]>
1 parent 5773ff9 commit a86fdfc

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

src/target/armv7a.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ static int armv7a_read_midr(struct target *target)
101101
armv7a->arch = (midr >> 16) & 0xf;
102102
armv7a->variant = (midr >> 20) & 0xf;
103103
armv7a->implementor = (midr >> 24) & 0xff;
104-
LOG_DEBUG("%s rev %" PRIx32 ", partnum %" PRIx32 ", arch %" PRIx32
105-
", variant %" PRIx32 ", implementor %" PRIx32,
106-
target->cmd_name,
107-
armv7a->rev,
108-
armv7a->partnum,
109-
armv7a->arch,
110-
armv7a->variant,
111-
armv7a->implementor);
104+
LOG_TARGET_DEBUG(target,
105+
"rev %" PRIx32 ", partnum %" PRIx32 ", arch %" PRIx32
106+
", variant %" PRIx32 ", implementor %" PRIx32,
107+
armv7a->rev,
108+
armv7a->partnum,
109+
armv7a->arch,
110+
armv7a->variant,
111+
armv7a->implementor);
112112

113113
done:
114114
dpm->finish(dpm);

src/target/cortex_a.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,14 +2923,12 @@ static int cortex_a_examine_first(struct target *target)
29232923
armv7a->debug_ap->memaccess_tck = 80;
29242924

29252925
if (!target->dbgbase_set) {
2926-
LOG_DEBUG("%s's dbgbase is not set, trying to detect using the ROM table",
2927-
target->cmd_name);
2926+
LOG_TARGET_DEBUG(target, "dbgbase is not set, trying to detect using the ROM table");
29282927
/* Lookup Processor DAP */
29292928
retval = dap_lookup_cs_component(armv7a->debug_ap, ARM_CS_C9_DEVTYPE_CORE_DEBUG,
29302929
&armv7a->debug_base, target->coreid);
29312930
if (retval != ERROR_OK) {
2932-
LOG_ERROR("Can't detect %s's dbgbase from the ROM table; you need to specify it explicitly.",
2933-
target->cmd_name);
2931+
LOG_TARGET_ERROR(target, "Can't detect dbgbase from the ROM table; you need to specify it explicitly");
29342932
return retval;
29352933
}
29362934
LOG_DEBUG("Detected core %" PRId32 " dbgbase: " TARGET_ADDR_FMT,
@@ -2939,8 +2937,9 @@ static int cortex_a_examine_first(struct target *target)
29392937
armv7a->debug_base = target->dbgbase;
29402938

29412939
if ((armv7a->debug_base & (1UL<<31)) == 0)
2942-
LOG_WARNING("Debug base address for target %s has bit 31 set to 0. Access to debug registers will likely fail!\n"
2943-
"Please fix the target configuration.", target_name(target));
2940+
LOG_TARGET_WARNING(target,
2941+
"Debug base address has bit 31 set to 0. Access to debug registers will likely fail!\n"
2942+
"Please fix the target configuration");
29442943

29452944
retval = mem_ap_read_atomic_u32(armv7a->debug_ap,
29462945
armv7a->debug_base + CPUDBG_DIDR, &didr);

src/target/espressif/esp32_apptrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static int esp32_apptrace_wait4halt(struct esp32_apptrace_cmd_ctx *ctx, struct t
649649
if (res != ERROR_OK)
650650
return res;
651651
if (target->state == TARGET_HALTED) {
652-
LOG_USER("%s: HALTED", target->cmd_name);
652+
LOG_TARGET_USER(target, "HALTED");
653653
break;
654654
}
655655
alive_sleep(500);

src/target/espressif/esp_xtensa_apptrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static int esp_xtensa_swdbg_activate(struct target *target, int enab)
277277
xtensa_dm_queue_tdi_idle(&xtensa->dbg_mod);
278278
int res = xtensa_dm_queue_execute(&xtensa->dbg_mod);
279279
if (res != ERROR_OK) {
280-
LOG_ERROR("%s: writing DCR failed!", target->cmd_name);
280+
LOG_TARGET_ERROR(target, "writing DCR failed");
281281
return res;
282282
}
283283

0 commit comments

Comments
 (0)