From patchwork Thu Feb 2 12:16:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9551729 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EC5F60405 for ; Thu, 2 Feb 2017 12:17:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22041280CF for ; Thu, 2 Feb 2017 12:17:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1694C28456; Thu, 2 Feb 2017 12:17:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DD0C280CF for ; Thu, 2 Feb 2017 12:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751517AbdBBMRR (ORCPT ); Thu, 2 Feb 2017 07:17:17 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:34896 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbdBBMRQ (ORCPT ); Thu, 2 Feb 2017 07:17:16 -0500 Received: by mail-lf0-f67.google.com with SMTP id v186so1226146lfa.2 for ; Thu, 02 Feb 2017 04:17:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DHkWtewEN3rpThHGC2u/rFHjCIEdQ/IvgTnSDuGsYHU=; b=pt94A7sTBwx5GYf+FVCuEI5nJRGItQWfAsUvU1GEYvBg/+CMh3gwBR33sqFgM2gZfV OrILocpA9Zfj2pF0QiePmQZ4i+egpnuRTwNLRKKrhjU3+4Bn9FDjcBeZm7DprD9xpBvQ nHjOALl9SWeI/77ME1+oNlp73hMQOlSvOCsAliBI1blHTT9rSVT0CHnXH6RFH15Qv7S/ iQ1Cy6+zJHzOegPm9lvnZfLVWkd7Pc0QV+zSiZmT+D6mvRrrle/vhStoWH2JdYS1XNPj EueJl/TdrAx7QQ1L4WzotS+kkrEbqmyQY+zNL1lmnTJvazVSIkCpnRrdmoWny9HB1Z02 BhMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DHkWtewEN3rpThHGC2u/rFHjCIEdQ/IvgTnSDuGsYHU=; b=XFNqSsJwbd6PS+QekPBPs1IgTnlr1I9FI6l/dcixTLqpPhp6cnewN/7kh4oG5F5XQU Z+7vQ0zMakLqUt2SSyxKRmdzZdx9zfyFDNbUpCWQJ432c49loSIWgmRaW3JkDTfp9YOF xXa9OSlk025S0EUFEqpke4W5osb68hIjvMEV81JEmhElN1aK6/xXF7cg0fCvMsaGQRgK 8+N3ai1hWChKiXpO5xtRZ1AN5fpJ7OE5HRQkXlDwhbjoywShil+Ob7PGAcilGvUodVRN b/veVRv/UV7uCKF8+syu0OrI/R4lZs/BmWqvUyjn+pFq947o6GSnnPEr4h4HW8xSiQTP 0ATA== X-Gm-Message-State: AIkVDXJRsIQr3obM9geGTea6P57NPFvrz2EEANwTs4QSxifCV4shsQhulTUqSaC+PE9c+Q== X-Received: by 10.25.204.197 with SMTP id c188mr2488762lfg.107.1486037834610; Thu, 02 Feb 2017 04:17:14 -0800 (PST) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t10sm2878398lja.48.2017.02.02.04.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Feb 2017 04:17:14 -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 V2 1/7] brcmfmac: switch to C function (__brcmf_err) for printing errors Date: Thu, 2 Feb 2017 13:16:53 +0100 Message-Id: <20170202121659.21130-1-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)