netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Chaoming Li <chaoming_li@realsil.com.cn>,
	"John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] rtlwifi: Standardize RT_PRINT_DATA macro and uses
Date: Thu, 05 Jan 2012 08:29:07 -0800	[thread overview]
Message-ID: <1325780947.22154.14.camel@joe2Laptop> (raw)
In-Reply-To: <20120105114314.GD2222@redhat.com>

On Thu, 2012-01-05 at 12:43 +0100, Stanislaw Gruszka wrote:
> Hi Joe

Morning Stanislaw.

> On Wed, Jan 04, 2012 at 07:40:40PM -0800, Joe Perches wrote:
> >  	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
> 
> Since you are working on it, can you also get rid of this DBG_*
> parameter, if rtlwifi maintainers are ok with that? It is additional
> console loglvevel, standard kernel loglevel should be used.

Not quite, all of the RT_PRINT_DATA are emitted at KERN_DEBUG.
These DBG_*s are just a normal debug verbosity level. 

It does seem odd though to have a DBG_EMERG and not always
emit it.

What might also be useful for any embedded use is to add
CONFIG_RTLWIFI_DEBUG to conditionally remove all of the
debug logging code to reduce the largish object size.

This reduces the object size by about 1/3 (250KB)
when CONFIG_RTLWIFI_DEBUG is not set.

$ size drivers/net/wireless/rtlwifi/built-in.o*
   text	   data	    bss	    dec	    hex	filename
 368722	  55333	  94224	 518279	  7e887	drivers/net/wireless/rtlwifi/built-in.o.new
 586904	  55333	 127216	 769453	  bbdad	drivers/net/wireless/rtlwifi/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>

---

 drivers/net/wireless/rtlwifi/Kconfig |    5 +++++
 drivers/net/wireless/rtlwifi/debug.h |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig
index d6c42e6..44b9c0a 100644
--- a/drivers/net/wireless/rtlwifi/Kconfig
+++ b/drivers/net/wireless/rtlwifi/Kconfig
@@ -49,6 +49,11 @@ config RTLWIFI
 	depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE
 	default m
 
+config RTLWIFI_DEBUG
+	tristate "Additional debugging output"
+	depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE
+	default y
+
 config RTL8192C_COMMON
 	tristate
 	depends on RTL8192CE || RTL8192CU
diff --git a/drivers/net/wireless/rtlwifi/debug.h b/drivers/net/wireless/rtlwifi/debug.h
index b024c23..fd5600c 100644
--- a/drivers/net/wireless/rtlwifi/debug.h
+++ b/drivers/net/wireless/rtlwifi/debug.h
@@ -156,6 +156,8 @@ enum dbgp_flag_e {
 	DBGP_TYPE_MAX
 };
 
+#ifdef CONFIG_RTLWIFI_DEBUG
+
 #define RT_ASSERT(_exp, fmt, ...)					\
 do {									\
 	if (!(_exp)) {							\
@@ -195,5 +197,37 @@ do {									\
 	}								\
 } while (0)
 
+#else
+
+struct rtl_priv;
+
+__printf(2, 3)
+static inline void RT_ASSERT(int exp, const char *fmt, ...)
+{
+}
+
+__printf(4, 5)
+static inline void RT_TRACE(struct rtl_priv *rtlpriv,
+			    int comp, int level,
+			    const char *fmt, ...)
+{
+}
+
+__printf(4, 5)
+static inline void RTPRINT(struct rtl_priv *rtlpriv,
+			   int dbgtype, int dbgflag,
+			   const char *fmt, ...)
+{
+}
+
+static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv,
+				 int comp, int level,
+				 const char *titlestring,
+				 const void *hexdata, size_t hexdatalen)
+{
+}
+
+#endif
+
 void rtl_dbgp_flag_init(struct ieee80211_hw *hw);
 #endif

  parent reply	other threads:[~2012-01-05 16:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05  3:40 [PATCH 0/7] rtlwifi: debug macros and uses neatening Joe Perches
2012-01-05  3:40 ` [PATCH 1/7] rtlwifi: Neaten RT_ASSERT, RT_TRACE, RTPRINT, RT_PRINT_DATA macros Joe Perches
2012-01-05 11:25   ` David Laight
2012-01-05  3:40 ` [PATCH 2/7] rtlwifi: Standardize RT_PRINT_DATA macro and uses Joe Perches
2012-01-05 11:43   ` Stanislaw Gruszka
2012-01-05 15:54     ` Larry Finger
2012-01-05 16:29     ` Joe Perches [this message]
2012-01-05 16:44       ` Larry Finger
2012-01-05 16:54         ` Joe Perches
2012-01-05  3:40 ` [PATCH 3/7] rtlwifi: Convert RT_TRACE macro to use ##__VA_ARGS__ Joe Perches
2012-01-05  3:40 ` [PATCH 4/7] rtlwifi: Convert RTPRINT " Joe Perches
2012-01-05  3:40 ` [PATCH 5/7] rtlwifi: Convert RT_ASSERT " Joe Perches
     [not found] ` <cover.1325734202.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2012-01-05  3:40   ` [PATCH 6/7] rtlwifi: Remove duplicate __func__ Joe Perches
2012-01-05  3:40 ` [PATCH 7/7] rtlwifi: Optimize RT_TRACE macro use of KBUILD_MODNAME for size Joe Perches
2012-01-05 19:03 ` [PATCH 0/7] rtlwifi: debug macros and uses neatening Larry Finger

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=1325780947.22154.14.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=chaoming_li@realsil.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgruszka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).