[RFC PATCH v2 04/12] rv: Remove trailing whitespace from tracepoint string

Gabriele Monaco posted 12 patches 9 months ago
There is a newer version of this series
[RFC PATCH v2 04/12] rv: Remove trailing whitespace from tracepoint string
Posted by Gabriele Monaco 9 months ago
RV event tracepoints print a line with the format:
    "event_xyz: S0 x event -> S1 "
    "event_xyz: S1 x event -> S0 (final)"

While printing an event leading to a non-final state, the line
has a trailing white space (visible above before the closing ").

Adapt the format string not to print the trailing whitespace if we are
not printing "(final)".

Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
 kernel/trace/rv/rv_trace.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/rv/rv_trace.h b/kernel/trace/rv/rv_trace.h
index 422b75f58891..18fa0e358a30 100644
--- a/kernel/trace/rv/rv_trace.h
+++ b/kernel/trace/rv/rv_trace.h
@@ -29,11 +29,11 @@ DECLARE_EVENT_CLASS(event_da_monitor,
 		__entry->final_state		= final_state;
 	),
 
-	TP_printk("%s x %s -> %s %s",
+	TP_printk("%s x %s -> %s%s",
 		__entry->state,
 		__entry->event,
 		__entry->next_state,
-		__entry->final_state ? "(final)" : "")
+		__entry->final_state ? " (final)" : "")
 );
 
 DECLARE_EVENT_CLASS(error_da_monitor,
@@ -90,12 +90,12 @@ DECLARE_EVENT_CLASS(event_da_monitor_id,
 		__entry->final_state		= final_state;
 	),
 
-	TP_printk("%d: %s x %s -> %s %s",
+	TP_printk("%d: %s x %s -> %s%s",
 		__entry->id,
 		__entry->state,
 		__entry->event,
 		__entry->next_state,
-		__entry->final_state ? "(final)" : "")
+		__entry->final_state ? " (final)" : "")
 );
 
 DECLARE_EVENT_CLASS(error_da_monitor_id,
-- 
2.49.0
Re: [RFC PATCH v2 04/12] rv: Remove trailing whitespace from tracepoint string
Posted by Nam Cao 8 months, 3 weeks ago
On Wed, May 14, 2025 at 10:43:06AM +0200, Gabriele Monaco wrote:
> RV event tracepoints print a line with the format:
>     "event_xyz: S0 x event -> S1 "
>     "event_xyz: S1 x event -> S0 (final)"
> 
> While printing an event leading to a non-final state, the line
> has a trailing white space (visible above before the closing ").
> 
> Adapt the format string not to print the trailing whitespace if we are
> not printing "(final)".
> 
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>

Reviewed-by: Nam Cao <namcao@linutronix.de>