public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger•net>
To: Joe Perches <joe@perches•com>, Chaoming Li <chaoming_li@realsil•com.cn>
Cc: Kalle Valo <kvalo@codeaurora•org>,
	linux-wireless@vger•kernel.org, netdev@vger•kernel.org,
	linux-kernel@vger•kernel.org
Subject: Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size
Date: Mon, 27 Jun 2016 19:53:00 -0500	[thread overview]
Message-ID: <5771CA6C.1060403@lwfinger.net> (raw)
In-Reply-To: <90cd7c8f12b51571db565fd496a2fcf610e2e484.1466894688.git.joe@perches.com>

On 06/25/2016 05:46 PM, Joe Perches wrote:
> 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 <joe@perches•com>

I acked this before; however there is a bug that breaks the build if 
CONFIG_RTLWIFI_DEBUG is not defined. The rest of the code calls 
_rtl_dbg_trace(), but that symbol is never defined. The problem can be fixed in 
debug.c or debug.h.

Larry

> ---
>   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 {									\
>

  parent reply	other threads:[~2016-06-28  0:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25 22:46 [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Joe Perches
2016-06-27  0:19 ` Larry Finger
2016-06-28  0:53 ` Larry Finger [this message]
2016-06-28  3:55   ` Joe Perches
     [not found]     ` <1467086116.24287.11.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2016-06-28 14:19       ` Larry Finger
2016-07-08  9:55 ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5771CA6C.1060403@lwfinger.net \
    --to=larry.finger@lwfinger$(echo .)net \
    --cc=chaoming_li@realsil$(echo .)com.cn \
    --cc=joe@perches$(echo .)com \
    --cc=kvalo@codeaurora$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-wireless@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox