Linux wireless drivers development
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: linux-wireless@vger.kernel.org
Cc: ath6kl-devel@qualcomm.com
Subject: [PATCH 6/7] ath6kl: add tracing support to log functions
Date: Thu, 27 Dec 2012 13:44:52 +0200	[thread overview]
Message-ID: <20121227114452.27069.55695.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20121227114156.27069.30223.stgit@localhost6.localdomain6>

All log messages are now sent through tracing interface as well if
ATH6KL_TRACING is enabled.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/debug.h |    4 +++
 drivers/net/wireless/ath/ath6kl/trace.c |    3 +++
 drivers/net/wireless/ath/ath6kl/trace.h |   37 +++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h
index 06f47f5..b6c7ff1 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -19,6 +19,7 @@
 #define DEBUG_H
 
 #include "hif.h"
+#include "trace.h"
 
 enum ATH6K_DEBUG_MASK {
 	ATH6KL_DBG_CREDIT	= BIT(0),
@@ -63,6 +64,7 @@ static inline __printf(1,2) int ath6kl_info(const char *fmt, ...)
 	va_start(args, fmt);
 	vaf.va = &args;
 	ret = ath6kl_printk(KERN_INFO, "%pV", &vaf);
+	trace_ath6kl_log_info(&vaf);
 	va_end(args);
 
 	return ret;
@@ -79,6 +81,7 @@ static inline __printf(1,2) int ath6kl_err(const char *fmt, ...)
 	va_start(args, fmt);
 	vaf.va = &args;
 	ret = ath6kl_printk(KERN_ERR, "%pV", &vaf);
+	trace_ath6kl_log_err(&vaf);
 	va_end(args);
 
 	return ret;
@@ -95,6 +98,7 @@ static inline __printf(1,2) int ath6kl_warn(const char *fmt, ...)
 	va_start(args, fmt);
 	vaf.va = &args;
 	ret = ath6kl_printk(KERN_WARNING, "%pV", &vaf);
+	trace_ath6kl_log_warn(&vaf);
 	va_end(args);
 
 	return ret;
diff --git a/drivers/net/wireless/ath/ath6kl/trace.c b/drivers/net/wireless/ath/ath6kl/trace.c
index adc74a0..68eece7 100644
--- a/drivers/net/wireless/ath/ath6kl/trace.c
+++ b/drivers/net/wireless/ath/ath6kl/trace.c
@@ -21,3 +21,6 @@
 
 EXPORT_TRACEPOINT_SYMBOL(ath6kl_sdio_wr);
 EXPORT_TRACEPOINT_SYMBOL(ath6kl_sdio_rd);
+EXPORT_TRACEPOINT_SYMBOL(ath6kl_log_info);
+EXPORT_TRACEPOINT_SYMBOL(ath6kl_log_warn);
+EXPORT_TRACEPOINT_SYMBOL(ath6kl_log_err);
diff --git a/drivers/net/wireless/ath/ath6kl/trace.h b/drivers/net/wireless/ath/ath6kl/trace.h
index f5838e0..8278143 100644
--- a/drivers/net/wireless/ath/ath6kl/trace.h
+++ b/drivers/net/wireless/ath/ath6kl/trace.h
@@ -24,6 +24,11 @@ static inline unsigned int ath6kl_get_wmi_id(void *buf, size_t buf_len)
 #undef TRACE_EVENT
 #define TRACE_EVENT(name, proto, ...) \
 static inline void trace_ ## name(proto) {}
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(...)
+#undef DEFINE_EVENT
+#define DEFINE_EVENT(evt_class, name, proto, ...) \
+static inline void trace_ ## name(proto) {}
 #endif /* !CONFIG_ATH6KL_TRACING || __CHECKER__ */
 
 #undef TRACE_SYSTEM
@@ -192,6 +197,38 @@ TRACE_EVENT(ath6kl_htc_tx,
 	)
 );
 
+#define ATH6KL_MSG_MAX 200
+
+DECLARE_EVENT_CLASS(ath6kl_log_event,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf),
+	TP_STRUCT__entry(
+		__dynamic_array(char, msg, ATH6KL_MSG_MAX)
+	),
+	TP_fast_assign(
+		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
+				       ATH6KL_MSG_MAX,
+				       vaf->fmt,
+				       *vaf->va) >= ATH6KL_MSG_MAX);
+	),
+	TP_printk("%s", __get_str(msg))
+);
+
+DEFINE_EVENT(ath6kl_log_event, ath6kl_log_err,
+	     TP_PROTO(struct va_format *vaf),
+	     TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(ath6kl_log_event, ath6kl_log_warn,
+	     TP_PROTO(struct va_format *vaf),
+	     TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(ath6kl_log_event, ath6kl_log_info,
+	     TP_PROTO(struct va_format *vaf),
+	     TP_ARGS(vaf)
+);
+
 #endif /* _ ATH6KL_TRACE_H || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */


  parent reply	other threads:[~2012-12-27 11:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 11:44 [PATCH 0/7] ath6kl: tracing support Kalle Valo
2012-12-27 11:44 ` [PATCH 1/7] ath6kl: add tracing support and tracing points for wmi packets Kalle Valo
2012-12-27 11:44 ` [PATCH 2/7] ath6kl: add tracing points for sdio transfers Kalle Valo
2012-12-27 12:13   ` Johannes Berg
2012-12-27 15:32     ` Kalle Valo
2012-12-27 11:44 ` [PATCH 3/7] ath6kl: add tracing point for hif irqs Kalle Valo
2012-12-27 11:44 ` [PATCH 4/7] ath6kl: adding tracing points for htc_mbox Kalle Valo
2012-12-27 11:44 ` [PATCH 5/7] ath6kl: convert ath6kl_info/err/warn macros to real functions Kalle Valo
2012-12-27 12:19   ` Johannes Berg
2012-12-27 15:47     ` Kalle Valo
2012-12-27 15:55       ` Kalle Valo
2012-12-27 11:44 ` Kalle Valo [this message]
2012-12-27 11:44 ` [PATCH 7/7] ath6kl: add tracing support to debug message macros Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121227114452.27069.55695.stgit@localhost6.localdomain6 \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath6kl-devel@qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox