Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1431255 > unrolled thread
| Started by | Joe Perches <joe@perches.com> |
|---|---|
| First post | 2016-06-26 00:50 +0200 |
| Last post | 2016-07-08 12:00 +0200 |
| Articles | 6 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Joe Perches <joe@perches.com> - 2016-06-26 00:50 +0200
Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Larry Finger <Larry.Finger@lwfinger.net> - 2016-06-27 02:20 +0200
Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Larry Finger <Larry.Finger@lwfinger.net> - 2016-06-28 03:00 +0200
Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Joe Perches <joe@perches.com> - 2016-06-28 06:00 +0200
Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Larry Finger <Larry.Finger@lwfinger.net> - 2016-06-28 16:30 +0200
Re: rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size Kalle Valo <kvalo@codeaurora.org> - 2016-07-08 12:00 +0200
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-06-26 00:50 +0200 |
| Subject | [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size |
| Message-ID | <rO4yJ-31n-1@gated-at.bofh.it> |
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>
---
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 { \
--
2.8.0.rc4.16.g56331f8
[toc] | [next] | [standalone]
| From | Larry Finger <Larry.Finger@lwfinger.net> |
|---|---|
| Date | 2016-06-27 02:20 +0200 |
| Subject | Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size |
| Message-ID | <rOsrn-1le-1@gated-at.bofh.it> |
| In reply to | #1431255 |
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>
> ---
> drivers/net/wireless/realtek/rtlwifi/debug.c | 25 +++++++++++++++++++++++++
> drivers/net/wireless/realtek/rtlwifi/debug.h | 17 +++++++++--------
> 2 files changed, 34 insertions(+), 8 deletions(-)
This change is a good one.
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Thanks,
Larry
>
> 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 { \
>
[toc] | [prev] | [next] | [standalone]
| From | Larry Finger <Larry.Finger@lwfinger.net> |
|---|---|
| Date | 2016-06-28 03:00 +0200 |
| Subject | Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size |
| Message-ID | <rOPxD-7Th-7@gated-at.bofh.it> |
| In reply to | #1431255 |
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 { \
>
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-06-28 06:00 +0200 |
| Subject | Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size |
| Message-ID | <rOSlP-1qN-3@gated-at.bofh.it> |
| In reply to | #1432376 |
On Mon, 2016-06-27 at 19:53 -0500, Larry Finger wrote:
> 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.
Confused a bit. What breaks again?
debug.h:
#ifdef CONFIG_RTLWIFI_DEBUG
[]
__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, ...) \
_rtl_dbg_trace(rtlpriv, comp, level, \
KBUILD_MODNAME, fmt, ##__VA_ARGS__)
[]
#else
[]
__printf(4, 5)
static inline void RT_TRACE(struct rtl_priv *rtlpriv,
int comp, int level,
const char *fmt, ...)
{
}
[]
#endif
[toc] | [prev] | [next] | [standalone]
| From | Larry Finger <Larry.Finger@lwfinger.net> |
|---|---|
| Date | 2016-06-28 16:30 +0200 |
| Subject | Re: [PATCH] rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size |
| Message-ID | <rP2bv-8gz-7@gated-at.bofh.it> |
| In reply to | #1432442 |
On 06/27/2016 10:55 PM, Joe Perches wrote: > On Mon, 2016-06-27 at 19:53 -0500, Larry Finger wrote: >> 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. > > Confused a bit. What breaks again? Nothing breaks and your patch is OK. I had ported it to a GitHub repo of these drivers, which had a different debug.h. That led to the missing global when CONFIG_RTLWIFI_DEBUG was not defined. That has now been fixed. Sorry for the confusion. Larry
[toc] | [prev] | [next] | [standalone]
| From | Kalle Valo <kvalo@codeaurora.org> |
|---|---|
| Date | 2016-07-08 12:00 +0200 |
| Subject | Re: rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size |
| Message-ID | <rSAJH-318-1@gated-at.bofh.it> |
| In reply to | #1431255 |
Joe Perches <joe@perches.com> 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> > Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Thanks, 1 patch applied to wireless-drivers-next.git: 9ce221915a94 rtlwifi: Create _rtl_dbg_trace function to reduce RT_TRACE code size -- Sent by pwcli https://patchwork.kernel.org/patch/9198897/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web