From patchwork Tue Jan 24 15:06:07 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: 9535375 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 10F1760434 for ; Tue, 24 Jan 2017 15:06:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04E2D2831C for ; Tue, 24 Jan 2017 15:06:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2E4F20009; Tue, 24 Jan 2017 15:06:41 +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 3636B2831C for ; Tue, 24 Jan 2017 15:06:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751222AbdAXPG1 (ORCPT ); Tue, 24 Jan 2017 10:06:27 -0500 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) 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=kKplgtkz2cBzl+IgKvOfqTrzqiYNDt17PT7tKQ155pRyf3PuF0NVBJTlfdqufFv3PA WAYbJNs8hvFmjbOTD8F165j13OV6zFsbMMNoEZ7bYfLplxiKfO+TtZS8rmjC6QUy3pUo er9xU7Bj1wPj42vedyhr5qbKhLzeIVa4m5tK/LzJP2X3+dB2rNyG0Bg5NoRobJu/mcEm sdVl5Y933g13cADBBK90ZxtQhD+s75puV3na+ZqQe3xDHdLY1CAisckA2NA06x7EFz6I rHlKJPb2qmHqwmNlViUzTp96Hep/fUvJ84s9WVO6dSkknn0EGj4WkOwrAKWVS7/qNlZM sTaQ== 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=s4WLritseijhktv0QuqTx5wEFm/sIt2leZICgJj5pSTIrQKbzWp0iKWq61gZ047Bdz WNFo9XNPl6MZwkRNpoX0oBF+rVEXnIyvznBJbmy7Kok3/b8OA+pzeIrWFFcvBZrGrIfq IptOS2CM7JR8bATJnX6OubXHNClzijh+pP4h0H7W63qiyLrjW3TGrDmZNGQ0pMGhOqA1 knEyYZN8sLTzvdH/ntJvZLBi8PRj8hIdhMgyZBu1kjawHtKDQocKiBurIUGmCNS58k/b N9yD8cM7DQ9J53bA1oa/VDltJDnAmioYO/kLFhf/gNygAXe2Mr3QcImOGuNnJkJkWrWK fn1w== X-Gm-Message-State: AIkVDXJr8aLGYxSPv1Vdx8Qh6Qp38LkISM4dS1FKJiEqkfqG1aAuUgEq3kYVyuTUArW8JQ== X-Received: by 10.25.196.210 with SMTP id u201mr11430297lff.69.1485270383593; Tue, 24 Jan 2017 07:06:23 -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 66sm7485352lfy.42.2017.01.24.07.06.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 07:06:22 -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> 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)