linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] brcmfmac: switch to C function (__brcmf_err) for printing errors
@ 2017-01-24 15:06 Rafał Miłecki
  2017-01-24 15:06 ` [PATCH 2/6] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err Rafał Miłecki
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Rafał Miłecki @ 2017-01-24 15:06 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman,
	Pieter-Paul Giesberts, Franky Lin, linux-wireless,
	brcm80211-dev-list.pdl, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

This will allow extending code and using more detailed messages e.g.
with the help of dev_err. Note that *two separated* brcmf_err macros
were replaced thanks to using a simple CONFIG_BRCMDBG symbol check in
the body.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 19 +++++++++++++++++++
 .../net/wireless/broadcom/brcm80211/brcmfmac/debug.h  | 16 ----------------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index f7c8c2e80349..05fb778ddd0f 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -218,6 +218,25 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 	return err;
 }
 
+#ifndef CONFIG_BRCM_TRACING
+void __brcmf_err(const char *func, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	if (!net_ratelimit() && !IS_ENABLED(CONFIG_BRCMDBG))
+		return;
+
+	va_start(args, fmt);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+	pr_err("%s: %pV", func, &vaf);
+
+	va_end(args);
+}
+#endif
+
 #if defined(CONFIG_BRCM_TRACING) || defined(CONFIG_BRCMDBG)
 void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...)
 {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
index 6687812770cc..5fef79473c87 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
@@ -45,26 +45,10 @@
 #undef pr_fmt
 #define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
 
-/* Macro for error messages. net_ratelimit() is used when driver
- * debugging is not selected. When debugging the driver error
- * messages are as important as other tracing or even more so.
- */
-#ifndef CONFIG_BRCM_TRACING
-#ifdef CONFIG_BRCMDBG
-#define brcmf_err(fmt, ...)	pr_err("%s: " fmt, __func__, ##__VA_ARGS__)
-#else
-#define brcmf_err(fmt, ...)						\
-	do {								\
-		if (net_ratelimit())					\
-			pr_err("%s: " fmt, __func__, ##__VA_ARGS__);	\
-	} while (0)
-#endif
-#else
 __printf(2, 3)
 void __brcmf_err(const char *func, const char *fmt, ...);
 #define brcmf_err(fmt, ...) \
 	__brcmf_err(__func__, fmt, ##__VA_ARGS__)
-#endif
 
 #if defined(DEBUG) || defined(CONFIG_BRCM_TRACING)
 __printf(3, 4)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-25  0:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-24 15:06 [PATCH 1/6] brcmfmac: switch to C function (__brcmf_err) for printing errors Rafał Miłecki
2017-01-24 15:06 ` [PATCH 2/6] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err Rafał Miłecki
2017-01-24 23:41   ` kbuild test robot
2017-01-24 15:06 ` [PATCH 3/6] brcmfmac: pcie: store private pointer to struct brcmf_pub Rafał Miłecki
2017-01-24 15:06 ` [PATCH 4/6] brcmfmac: usb: " Rafał Miłecki
2017-01-24 15:06 ` [PATCH 5/6] brcmfmac: modify all brcmf_err calls adding " Rafał Miłecki
2017-01-24 22:02   ` kbuild test robot
2017-01-24 22:08     ` Rafał Miłecki
2017-01-24 23:55   ` kbuild test robot
2017-01-24 15:06 ` [PATCH 6/6] brcmfmac: use dev_err to print errors Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).