From patchwork Sat Jun 25 22:46:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 9198897 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 2F88C608A7 for ; Sat, 25 Jun 2016 22:47:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 224D228530 for ; Sat, 25 Jun 2016 22:47:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1638E28532; Sat, 25 Jun 2016 22:47:19 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 AC8E728531 for ; Sat, 25 Jun 2016 22:47:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751544AbcFYWqv (ORCPT ); Sat, 25 Jun 2016 18:46:51 -0400 Received: from smtprelay0242.hostedemail.com ([216.40.44.242]:40276 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751209AbcFYWqu (ORCPT ); Sat, 25 Jun 2016 18:46:50 -0400 Received: from filter.hostedemail.com (unknown [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id F269D9EA11; Sat, 25 Jun 2016 22:46:47 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: grape47_756c6d8f6121b X-Filterd-Recvd-Size: 3695 Received: from joe-laptop.perches.com (unknown [96.251.125.34]) (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA; Sat, 25 Jun 2016 22:46:46 +0000 (UTC) From: Joe Perches To: Larry Finger , Chaoming Li Cc: Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Date: Sat, 25 Jun 2016 15:46:45 -0700 Message-Id: <90cd7c8f12b51571db565fd496a2fcf610e2e484.1466894688.git.joe@perches.com> X-Mailer: git-send-email 2.8.0.rc4.16.g56331f8 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 This debugging macro can expand to a lot of code. Make it a function to reduce code size. (x86-64 defconfig w/ all rtlwifi drivers and allyesconfig) $ size drivers/net/wireless/realtek/rtlwifi/built-in.o* text data bss dec hex filename 900083 200499 1907 1102489 10d299 drivers/net/wireless/realtek/rtlwifi/built-in.o.defconfig.new 1113597 200499 1907 1316003 1414a3 drivers/net/wireless/realtek/rtlwifi/built-in.o.defconfig.old 1746879 453503 8512 2208894 21b47e drivers/net/wireless/realtek/rtlwifi/built-in.o.new 2051965 503311 8512 2563788 271ecc drivers/net/wireless/realtek/rtlwifi/built-in.o.old Signed-off-by: Joe Perches Acked-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/debug.c | 25 +++++++++++++++++++++++++ drivers/net/wireless/realtek/rtlwifi/debug.h | 17 +++++++++-------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.c b/drivers/net/wireless/realtek/rtlwifi/debug.c index fd25aba..33905bb 100644 --- a/drivers/net/wireless/realtek/rtlwifi/debug.c +++ b/drivers/net/wireless/realtek/rtlwifi/debug.c @@ -48,3 +48,28 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw) /*Init Debug flag enable condition */ } EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init); + +#ifdef CONFIG_RTLWIFI_DEBUG +void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level, + const char *modname, const char *fmt, ...) +{ + if (unlikely((comp & rtlpriv->dbg.global_debugcomponents) && + (level <= rtlpriv->dbg.global_debuglevel))) { + struct va_format vaf; + va_list args; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + printk(KERN_DEBUG "%s:%ps:<%lx-%x> %pV", + modname, __builtin_return_address(0), + in_interrupt(), in_atomic(), + &vaf); + + va_end(args); + } +} +EXPORT_SYMBOL_GPL(_rtl_dbg_trace); +#endif diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.h b/drivers/net/wireless/realtek/rtlwifi/debug.h index fc794b3..6156a79 100644 --- a/drivers/net/wireless/realtek/rtlwifi/debug.h +++ b/drivers/net/wireless/realtek/rtlwifi/debug.h @@ -174,15 +174,16 @@ do { \ } \ } while (0) + +struct rtl_priv; + +__printf(5, 6) +void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level, + const char *modname, const char *fmt, ...); + #define RT_TRACE(rtlpriv, comp, level, fmt, ...) \ -do { \ - if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \ - ((level) <= rtlpriv->dbg.global_debuglevel))) { \ - printk(KERN_DEBUG KBUILD_MODNAME ":%s():<%lx-%x> " fmt, \ - __func__, in_interrupt(), in_atomic(), \ - ##__VA_ARGS__); \ - } \ -} while (0) + _rtl_dbg_trace(rtlpriv, comp, level, \ + KBUILD_MODNAME, fmt, ##__VA_ARGS__) #define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \ do { \