Merge patch series "Add 'trace wipe'"
authorTom Rini <trini@konsulko.com>
Wed, 1 Jan 2025 01:00:54 +0000 (19:00 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 1 Jan 2025 16:40:33 +0000 (10:40 -0600)
Jerome Forissier <jerome.forissier@linaro.org> 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
1  2 
include/trace.h
lib/trace.c

diff --cc 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
@@@ -426,6 -417,34 +417,34 @@@ static int notrace trace_init_(void *bu
        return 0;
  }
  
 - * trace_clear() - clear accumulated traced data
+ /**
+  * 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);
+ }
+ /**
 -int notrace trace_clear(void)
++ * trace_wipe() - clear accumulated traced data
+  *
+  * May be called with tracing enabled or disabled.
+  */
++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