diff mbox

[V3,9/9] brcmfmac: use dev_err to print errors

Message ID 20170202213321.11591-9-zajec5@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Rafał Miłecki Feb. 2, 2017, 9:33 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

This adds a nice prefix to all error messages making it possible to
identify device they are related to. It's really useful for e.g. home
routers commonly having 2 or even 3 wireless devices.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c     | 3 ++-
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index c0ac7979c9ea..5845a3e5150a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -223,6 +223,7 @@  int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 #ifndef CONFIG_BRCM_TRACING
 void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...)
 {
+	struct device *dev = pub && pub->bus_if ? pub->bus_if->dev : NULL;
 	struct va_format vaf;
 	va_list args;
 
@@ -230,7 +231,7 @@  void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...)
 
 	vaf.fmt = fmt;
 	vaf.va = &args;
-	pr_err("%s: %pV", func, &vaf);
+	dev_err(dev, "%s: %pV", func, &vaf);
 
 	va_end(args);
 }
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
index 329cb65eb78b..393c1b31ed28 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
@@ -25,6 +25,7 @@ 
 
 void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...)
 {
+	struct device *dev = pub && pub->bus_if ? pub->bus_if->dev : NULL;
 	struct va_format vaf = {
 		.fmt = fmt,
 	};
@@ -32,7 +33,7 @@  void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...)
 
 	va_start(args, fmt);
 	vaf.va = &args;
-	pr_err("%s: %pV", func, &vaf);
+	dev_err(dev, "%s: %pV", func, &vaf);
 	trace_brcmf_err(func, &vaf);
 	va_end(args);
 }