From: Tom Rini Date: Wed, 1 Jan 2025 01:00:54 +0000 (-0600) Subject: Merge patch series "Add 'trace wipe'" X-Git-Tag: v2025.04-rc1~17^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eb74974de5204835e81b81098dab1591fd99df5;p=pandora-u-boot.git Merge patch series "Add 'trace wipe'" Jerome Forissier says: This short series adds the 'trace wipe' command which clears the trace buffer, allowing to re-start a capture from scratch. Link: https://lore.kernel.org/r/cover.1734093566.git.jerome.forissier@linaro.org --- 2eb74974de5204835e81b81098dab1591fd99df5 diff --cc include/trace.h index 763d6d1255a,782eaae2fc2..2bbaed9ba12 --- a/include/trace.h +++ b/include/trace.h @@@ -100,6 -100,8 +100,8 @@@ void trace_set_enabled(int enabled) int trace_early_init(void); -int trace_clear(void); ++int trace_wipe(void); + /** * Init the trace system * diff --cc lib/trace.c index cabbe47b58a,def9f912c92..1d5f7dec979 --- a/lib/trace.c +++ b/lib/trace.c @@@ -426,6 -417,34 +417,34 @@@ static int notrace trace_init_(void *bu return 0; } + /** + * trace_init() - initialize the tracing system and enable it + * + * @buff: Pointer to trace buffer + * @buff_size: Size of trace buffer + * Return: 0 if ok + */ + int notrace trace_init(void *buff, size_t buff_size) + { + /* If traces are enabled already, we may have early traces to copy */ + return trace_init_(buff, buff_size, trace_enabled, true); + } + + /** - * trace_clear() - clear accumulated traced data ++ * trace_wipe() - clear accumulated traced data + * + * May be called with tracing enabled or disabled. + */ -int notrace trace_clear(void) ++int notrace trace_wipe(void) + { + bool was_enabled = trace_enabled; + + if (trace_enabled) + trace_enabled = 0; + return trace_init_(gd->trace_buff, CONFIG_TRACE_BUFFER_SIZE, + false, was_enabled); + } + #ifdef CONFIG_TRACE_EARLY /** * trace_early_init() - initialize the tracing system for early tracing