tracing/ath: 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.430339634@goodmis.org

Cc: Kalle Valo <kvalo@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.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: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: ath11k@lists.infradead.org
Acked-by: default avatarKalle Valo <kvalo@kernel.org>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 8d7f5df0
...@@ -52,15 +52,12 @@ DECLARE_EVENT_CLASS(ath10k_log_event, ...@@ -52,15 +52,12 @@ DECLARE_EVENT_CLASS(ath10k_log_event,
TP_STRUCT__entry( TP_STRUCT__entry(
__string(device, dev_name(ar->dev)) __string(device, dev_name(ar->dev))
__string(driver, dev_driver_string(ar->dev)) __string(driver, dev_driver_string(ar->dev))
__dynamic_array(char, msg, ATH10K_MSG_MAX) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(device, dev_name(ar->dev)); __assign_str(device, dev_name(ar->dev));
__assign_str(driver, dev_driver_string(ar->dev)); __assign_str(driver, dev_driver_string(ar->dev));
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
ATH10K_MSG_MAX,
vaf->fmt,
*vaf->va) >= ATH10K_MSG_MAX);
), ),
TP_printk( TP_printk(
"%s %s %s", "%s %s %s",
...@@ -92,16 +89,13 @@ TRACE_EVENT(ath10k_log_dbg, ...@@ -92,16 +89,13 @@ TRACE_EVENT(ath10k_log_dbg,
__string(device, dev_name(ar->dev)) __string(device, dev_name(ar->dev))
__string(driver, dev_driver_string(ar->dev)) __string(driver, dev_driver_string(ar->dev))
__field(unsigned int, level) __field(unsigned int, level)
__dynamic_array(char, msg, ATH10K_MSG_MAX) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(device, dev_name(ar->dev)); __assign_str(device, dev_name(ar->dev));
__assign_str(driver, dev_driver_string(ar->dev)); __assign_str(driver, dev_driver_string(ar->dev));
__entry->level = level; __entry->level = level;
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
ATH10K_MSG_MAX,
vaf->fmt,
*vaf->va) >= ATH10K_MSG_MAX);
), ),
TP_printk( TP_printk(
"%s %s %s", "%s %s %s",
......
...@@ -126,15 +126,12 @@ DECLARE_EVENT_CLASS(ath11k_log_event, ...@@ -126,15 +126,12 @@ DECLARE_EVENT_CLASS(ath11k_log_event,
TP_STRUCT__entry( TP_STRUCT__entry(
__string(device, dev_name(ab->dev)) __string(device, dev_name(ab->dev))
__string(driver, dev_driver_string(ab->dev)) __string(driver, dev_driver_string(ab->dev))
__dynamic_array(char, msg, ATH11K_MSG_MAX) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(device, dev_name(ab->dev)); __assign_str(device, dev_name(ab->dev));
__assign_str(driver, dev_driver_string(ab->dev)); __assign_str(driver, dev_driver_string(ab->dev));
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
ATH11K_MSG_MAX,
vaf->fmt,
*vaf->va) >= ATH11K_MSG_MAX);
), ),
TP_printk( TP_printk(
"%s %s %s", "%s %s %s",
......
...@@ -253,13 +253,10 @@ DECLARE_EVENT_CLASS(ath6kl_log_event, ...@@ -253,13 +253,10 @@ DECLARE_EVENT_CLASS(ath6kl_log_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, ATH6KL_MSG_MAX) __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);
ATH6KL_MSG_MAX,
vaf->fmt,
*vaf->va) >= ATH6KL_MSG_MAX);
), ),
TP_printk("%s", __get_str(msg)) TP_printk("%s", __get_str(msg))
); );
...@@ -284,14 +281,11 @@ TRACE_EVENT(ath6kl_log_dbg, ...@@ -284,14 +281,11 @@ TRACE_EVENT(ath6kl_log_dbg,
TP_ARGS(level, vaf), TP_ARGS(level, vaf),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned int, level) __field(unsigned int, level)
__dynamic_array(char, msg, ATH6KL_MSG_MAX) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__entry->level = level; __entry->level = level;
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
ATH6KL_MSG_MAX,
vaf->fmt,
*vaf->va) >= ATH6KL_MSG_MAX);
), ),
TP_printk("%s", __get_str(msg)) TP_printk("%s", __get_str(msg))
); );
......
...@@ -40,16 +40,13 @@ TRACE_EVENT(ath_log, ...@@ -40,16 +40,13 @@ TRACE_EVENT(ath_log,
TP_STRUCT__entry( TP_STRUCT__entry(
__string(device, wiphy_name(wiphy)) __string(device, wiphy_name(wiphy))
__string(driver, KBUILD_MODNAME) __string(driver, KBUILD_MODNAME)
__dynamic_array(char, msg, ATH_DBG_MAX_LEN) __vstring(msg, vaf->fmt, vaf->va)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(device, wiphy_name(wiphy)); __assign_str(device, wiphy_name(wiphy));
__assign_str(driver, KBUILD_MODNAME); __assign_str(driver, KBUILD_MODNAME);
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), __assign_vstr(msg, vaf->fmt, vaf->va);
ATH_DBG_MAX_LEN,
vaf->fmt,
*vaf->va) >= ATH_DBG_MAX_LEN);
), ),
TP_printk( TP_printk(
......
...@@ -70,13 +70,10 @@ DECLARE_EVENT_CLASS(wil6210_log_event, ...@@ -70,13 +70,10 @@ DECLARE_EVENT_CLASS(wil6210_log_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, WIL6210_MSG_MAX) __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);
WIL6210_MSG_MAX,
vaf->fmt,
*vaf->va) >= WIL6210_MSG_MAX);
), ),
TP_printk("%s", __get_str(msg)) TP_printk("%s", __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