tracing/brcm: Use the new __vstring() helper

Instead of open coding a __dynamic_array() with a fixed length (which
defeats the purpose of the dynamic array in the first place). Use the new
__vstring() helper that will use a va_list and only write enough of the
string into the ring buffer that is needed.

Link: https://lkml.kernel.org/r/20220705224749.622796175@goodmis.org

Cc: Arend van Spriel <aspriel@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Franky Lin <franky.lin@broadcom.com>
Cc: Hante Meuleman <hante.meuleman@broadcom.com>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: brcm80211-dev-list.pdl@broadcom.com
Cc: SHA-cyfmac-dev-list@infineon.com
Cc: netdev@vger.kernel.org
Acked-by: default avatarKalle Valo <kvalo@kernel.org>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent c01406f8
...@@ -33,13 +33,11 @@ TRACE_EVENT(brcmf_err, ...@@ -33,13 +33,11 @@ TRACE_EVENT(brcmf_err,
TP_ARGS(func, vaf), TP_ARGS(func, vaf),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(func, func) __string(func, func)
__dynamic_array(char, msg, MAX_MSG_LEN) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(func, func); __assign_str(func, func);
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
), ),
TP_printk("%s: %s", __get_str(func), __get_str(msg)) TP_printk("%s: %s", __get_str(func), __get_str(msg))
); );
...@@ -50,14 +48,12 @@ TRACE_EVENT(brcmf_dbg, ...@@ -50,14 +48,12 @@ TRACE_EVENT(brcmf_dbg,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, level) __field(u32, level)
__string(func, func) __string(func, func)
__dynamic_array(char, msg, MAX_MSG_LEN) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__entry->level = level; __entry->level = level;
__assign_str(func, func); __assign_str(func, func);
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
), ),
TP_printk("%s: %s", __get_str(func), __get_str(msg)) TP_printk("%s: %s", __get_str(func), __get_str(msg))
); );
......
...@@ -28,12 +28,10 @@ DECLARE_EVENT_CLASS(brcms_msg_event, ...@@ -28,12 +28,10 @@ DECLARE_EVENT_CLASS(brcms_msg_event,
TP_PROTO(struct va_format *vaf), TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf), TP_ARGS(vaf),
TP_STRUCT__entry( TP_STRUCT__entry(
__dynamic_array(char, msg, MAX_MSG_LEN) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
), ),
TP_printk("%s", __get_str(msg)) TP_printk("%s", __get_str(msg))
); );
...@@ -64,14 +62,12 @@ TRACE_EVENT(brcms_dbg, ...@@ -64,14 +62,12 @@ TRACE_EVENT(brcms_dbg,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, level) __field(u32, level)
__string(func, func) __string(func, func)
__dynamic_array(char, msg, MAX_MSG_LEN) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__entry->level = level; __entry->level = level;
__assign_str(func, func); __assign_str(func, func);
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
), ),
TP_printk("%s: %s", __get_str(func), __get_str(msg)) TP_printk("%s: %s", __get_str(func), __get_str(msg))
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment