Return-path: Received: from mail-lf0-f66.google.com ([209.85.215.66]:33233 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750869AbdAXPGZ (ORCPT ); Tue, 24 Jan 2017 10:06:25 -0500 Received: by mail-lf0-f66.google.com with SMTP id x1so17836922lff.0 for ; Tue, 24 Jan 2017 07:06:24 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: Arend van Spriel , Franky Lin , Hante Meuleman , Pieter-Paul Giesberts , Franky Lin , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH 1/6] brcmfmac: switch to C function (__brcmf_err) for printing errors Date: Tue, 24 Jan 2017 16:06:07 +0100 Message-Id: <20170124150612.25138-1-zajec5@gmail.com> (sfid-20170124_160634_886612_A727DC00) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-wireless-owner@vger.kernel.org List-ID: From: Rafał Miłecki 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 --- .../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