1 From 5cc898fbcb352b764f8d51c16e10e2eb0056173d Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Wed, 6 Feb 2019 12:28:15 +0100
4 Subject: [PATCH] brcmfmac: modify __brcmf_err() to take bus as a parameter
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 So far __brcmf_err() was using pr_err() which didn't allow identifying
10 device that was affected by an error. It's crucial for systems with more
11 than 1 device supported by brcmfmac (a common case for home routers).
13 This change allows passing struct brcmf_bus to the __brcmf_err(). That
14 struct has been agreed to be the most common one. It allows accessing
15 struct device easily & using dev_err() printing helper.
17 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
18 Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
19 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
21 .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 7 +++++--
22 drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 8 +++++---
23 .../wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 9 +++++++--
24 3 files changed, 17 insertions(+), 7 deletions(-)
26 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
27 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
28 @@ -350,7 +350,7 @@ done:
31 #ifndef CPTCFG_BRCM_TRACING
32 -void __brcmf_err(const char *func, const char *fmt, ...)
33 +void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...)
37 @@ -359,7 +359,10 @@ void __brcmf_err(const char *func, const
41 - pr_err("%s: %pV", func, &vaf);
43 + dev_err(bus->dev, "%s: %pV", func, &vaf);
45 + pr_err("%s: %pV", func, &vaf);
49 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
50 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
53 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
56 -void __brcmf_err(const char *func, const char *fmt, ...);
60 +void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...);
61 /* Macro for error messages. When debugging / tracing the driver all error
62 * messages are important to us.
64 @@ -55,7 +57,7 @@ void __brcmf_err(const char *func, const
65 if (IS_ENABLED(CPTCFG_BRCMDBG) || \
66 IS_ENABLED(CPTCFG_BRCM_TRACING) || \
68 - __brcmf_err(__func__, fmt, ##__VA_ARGS__); \
69 + __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\
72 #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
73 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
74 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
76 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
79 +#include <linux/device.h>
80 #include <linux/module.h> /* bug in tracepoint.h, it should include this */
83 #define CREATE_TRACE_POINTS
85 #include "tracepoint.h"
88 -void __brcmf_err(const char *func, const char *fmt, ...)
89 +void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...)
91 struct va_format vaf = {
93 @@ -30,7 +32,10 @@ void __brcmf_err(const char *func, const
97 - pr_err("%s: %pV", func, &vaf);
99 + dev_err(bus->dev, "%s: %pV", func, &vaf);
101 + pr_err("%s: %pV", func, &vaf);
102 trace_brcmf_err(func, &vaf);