linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [resend PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level
@ 2018-03-27 18:52 Joe Perches
  2018-05-11 16:29 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2018-03-27 18:52 UTC (permalink / raw)
  To: David Howells; +Cc: David S. Miller, linux-afs, netdev, linux-kernel

When enabled, the current debug logging does not have a KERN_<LEVEL>.
Add KERN_DEBUG to the logging macros.

Miscellanea:

o Remove #define redundancy and neaten the macros a bit

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

Resend of patch: https://lkml.org/lkml/2017/11/30/573

No change in patch.

David Howells is now a listed maintainer for net/rxrpc/ so he should receive
this patch via get_maintainer

 net/rxrpc/ar-internal.h | 75 ++++++++++++++++++-------------------------------
 1 file changed, 28 insertions(+), 47 deletions(-)

diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 416688381eb7..d4b53b2339b3 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -1147,66 +1147,47 @@ static inline bool after_eq(u32 seq1, u32 seq2)
  */
 extern unsigned int rxrpc_debug;
 
-#define dbgprintk(FMT,...) \
-	printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
+#if defined(__KDEBUG) || defined(CONFIG_AF_RXRPC_DEBUG)
+#define dbgprintk(fmt, ...)						\
+	printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
+#else
+#define dbgprintk(fmt, ...)						\
+	no_printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
+#endif
 
-#define kenter(FMT,...)	dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
-#define kleave(FMT,...)	dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
-#define kdebug(FMT,...)	dbgprintk("    "FMT ,##__VA_ARGS__)
-#define kproto(FMT,...)	dbgprintk("### "FMT ,##__VA_ARGS__)
-#define knet(FMT,...)	dbgprintk("@@@ "FMT ,##__VA_ARGS__)
+#define kenter(fmt, ...)	dbgprintk("==> %s(" fmt ")", __func__, ##__VA_ARGS__)
+#define kleave(fmt, ...)	dbgprintk("<== %s()" fmt "", __func__, ##__VA_ARGS__)
+#define kdebug(fmt, ...)	dbgprintk("    " fmt, ##__VA_ARGS__)
+#define kproto(fmt, ...)	dbgprintk("### " fmt, ##__VA_ARGS__)
+#define knet(fmt, ...)		dbgprintk("@@@ " fmt, ##__VA_ARGS__)
 
+#if defined(__KDEBUG) || !defined(CONFIG_AF_RXRPC_DEBUG)
+#define _enter(fmt, ...)	kenter(fmt, ##__VA_ARGS__)
+#define _leave(fmt, ...)	kleave(fmt, ##__VA_ARGS__)
+#define _debug(fmt, ...)	kdebug(fmt, ##__VA_ARGS__)
+#define _proto(fmt, ...)	kproto(fmt, ##__VA_ARGS__)
+#define _net(fmt, ...)		knet(fmt, ##__VA_ARGS__)
 
-#if defined(__KDEBUG)
-#define _enter(FMT,...)	kenter(FMT,##__VA_ARGS__)
-#define _leave(FMT,...)	kleave(FMT,##__VA_ARGS__)
-#define _debug(FMT,...)	kdebug(FMT,##__VA_ARGS__)
-#define _proto(FMT,...)	kproto(FMT,##__VA_ARGS__)
-#define _net(FMT,...)	knet(FMT,##__VA_ARGS__)
+#else
 
-#elif defined(CONFIG_AF_RXRPC_DEBUG)
 #define RXRPC_DEBUG_KENTER	0x01
 #define RXRPC_DEBUG_KLEAVE	0x02
 #define RXRPC_DEBUG_KDEBUG	0x04
 #define RXRPC_DEBUG_KPROTO	0x08
 #define RXRPC_DEBUG_KNET	0x10
 
-#define _enter(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KENTER))	\
-		kenter(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _leave(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KLEAVE))	\
-		kleave(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _debug(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KDEBUG))	\
-		kdebug(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _proto(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KPROTO))	\
-		kproto(FMT,##__VA_ARGS__);		\
+#define RXRPC_DEBUG(TYPE, type, fmt, ...)				\
+do {									\
+	if (unlikely(rxrpc_debug & RXRPC_DEBUG_##TYPE))			\
+		type(fmt, ##__VA_ARGS__);				\
 } while (0)
 
-#define _net(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KNET))	\
-		knet(FMT,##__VA_ARGS__);		\
-} while (0)
+#define _enter(fmt, ...)	RXRPC_DEBUG(KENTER, kenter, fmt, ##__VA_ARGS__)
+#define _leave(fmt, ...)	RXRPC_DEBUG(KLEAVE, kleave, fmt, ##__VA_ARGS__)
+#define _debug(fmt, ...)	RXRPC_DEBUG(KDEBUG, kdebug, fmt, ##__VA_ARGS__)
+#define _proto(fmt, ...)	RXRPC_DEBUG(KPROTO, kproto, fmt, ##__VA_ARGS__)
+#define _net(fmt, ...)		RXRPC_DEBUG(KNET, knet, fmt, ##__VA_ARGS__)
 
-#else
-#define _enter(FMT,...)	no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
-#define _leave(FMT,...)	no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
-#define _debug(FMT,...)	no_printk("    "FMT ,##__VA_ARGS__)
-#define _proto(FMT,...)	no_printk("### "FMT ,##__VA_ARGS__)
-#define _net(FMT,...)	no_printk("@@@ "FMT ,##__VA_ARGS__)
 #endif
 
 /*
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [resend PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level
  2018-03-27 18:52 [resend PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level Joe Perches
@ 2018-05-11 16:29 ` Joe Perches
  2018-11-19 20:35   ` [resend PATCH for 3rd time] " Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2018-05-11 16:29 UTC (permalink / raw)
  To: David Howells; +Cc: David S. Miller, linux-afs, netdev, linux-kernel

On Tue, 2018-03-27 at 11:52 -0700, Joe Perches wrote:
> When enabled, the current debug logging does not have a KERN_<LEVEL>.
> Add KERN_DEBUG to the logging macros.
> 
> Miscellanea:
> 
> o Remove #define redundancy and neaten the macros a bit

ping?

> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> Resend of patch: https://lkml.org/lkml/2017/11/30/573
> 
> No change in patch.
> 
> David Howells is now a listed maintainer for net/rxrpc/ so he should receive
> this patch via get_maintainer
> 
>  net/rxrpc/ar-internal.h | 75 ++++++++++++++++++-------------------------------
>  1 file changed, 28 insertions(+), 47 deletions(-)
> 
> diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
> index 416688381eb7..d4b53b2339b3 100644
> --- a/net/rxrpc/ar-internal.h
> +++ b/net/rxrpc/ar-internal.h
> @@ -1147,66 +1147,47 @@ static inline bool after_eq(u32 seq1, u32 seq2)
>   */
>  extern unsigned int rxrpc_debug;
>  
> -#define dbgprintk(FMT,...) \
> -	printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
> +#if defined(__KDEBUG) || defined(CONFIG_AF_RXRPC_DEBUG)
> +#define dbgprintk(fmt, ...)						\
> +	printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
> +#else
> +#define dbgprintk(fmt, ...)						\
> +	no_printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
> +#endif
>  
> -#define kenter(FMT,...)	dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
> -#define kleave(FMT,...)	dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
> -#define kdebug(FMT,...)	dbgprintk("    "FMT ,##__VA_ARGS__)
> -#define kproto(FMT,...)	dbgprintk("### "FMT ,##__VA_ARGS__)
> -#define knet(FMT,...)	dbgprintk("@@@ "FMT ,##__VA_ARGS__)
> +#define kenter(fmt, ...)	dbgprintk("==> %s(" fmt ")", __func__, ##__VA_ARGS__)
> +#define kleave(fmt, ...)	dbgprintk("<== %s()" fmt "", __func__, ##__VA_ARGS__)
> +#define kdebug(fmt, ...)	dbgprintk("    " fmt, ##__VA_ARGS__)
> +#define kproto(fmt, ...)	dbgprintk("### " fmt, ##__VA_ARGS__)
> +#define knet(fmt, ...)		dbgprintk("@@@ " fmt, ##__VA_ARGS__)
>  
> +#if defined(__KDEBUG) || !defined(CONFIG_AF_RXRPC_DEBUG)
> +#define _enter(fmt, ...)	kenter(fmt, ##__VA_ARGS__)
> +#define _leave(fmt, ...)	kleave(fmt, ##__VA_ARGS__)
> +#define _debug(fmt, ...)	kdebug(fmt, ##__VA_ARGS__)
> +#define _proto(fmt, ...)	kproto(fmt, ##__VA_ARGS__)
> +#define _net(fmt, ...)		knet(fmt, ##__VA_ARGS__)
>  
> -#if defined(__KDEBUG)
> -#define _enter(FMT,...)	kenter(FMT,##__VA_ARGS__)
> -#define _leave(FMT,...)	kleave(FMT,##__VA_ARGS__)
> -#define _debug(FMT,...)	kdebug(FMT,##__VA_ARGS__)
> -#define _proto(FMT,...)	kproto(FMT,##__VA_ARGS__)
> -#define _net(FMT,...)	knet(FMT,##__VA_ARGS__)
> +#else
>  
> -#elif defined(CONFIG_AF_RXRPC_DEBUG)
>  #define RXRPC_DEBUG_KENTER	0x01
>  #define RXRPC_DEBUG_KLEAVE	0x02
>  #define RXRPC_DEBUG_KDEBUG	0x04
>  #define RXRPC_DEBUG_KPROTO	0x08
>  #define RXRPC_DEBUG_KNET	0x10
>  
> -#define _enter(FMT,...)					\
> -do {							\
> -	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KENTER))	\
> -		kenter(FMT,##__VA_ARGS__);		\
> -} while (0)
> -
> -#define _leave(FMT,...)					\
> -do {							\
> -	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KLEAVE))	\
> -		kleave(FMT,##__VA_ARGS__);		\
> -} while (0)
> -
> -#define _debug(FMT,...)					\
> -do {							\
> -	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KDEBUG))	\
> -		kdebug(FMT,##__VA_ARGS__);		\
> -} while (0)
> -
> -#define _proto(FMT,...)					\
> -do {							\
> -	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KPROTO))	\
> -		kproto(FMT,##__VA_ARGS__);		\
> +#define RXRPC_DEBUG(TYPE, type, fmt, ...)				\
> +do {									\
> +	if (unlikely(rxrpc_debug & RXRPC_DEBUG_##TYPE))			\
> +		type(fmt, ##__VA_ARGS__);				\
>  } while (0)
>  
> -#define _net(FMT,...)					\
> -do {							\
> -	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KNET))	\
> -		knet(FMT,##__VA_ARGS__);		\
> -} while (0)
> +#define _enter(fmt, ...)	RXRPC_DEBUG(KENTER, kenter, fmt, ##__VA_ARGS__)
> +#define _leave(fmt, ...)	RXRPC_DEBUG(KLEAVE, kleave, fmt, ##__VA_ARGS__)
> +#define _debug(fmt, ...)	RXRPC_DEBUG(KDEBUG, kdebug, fmt, ##__VA_ARGS__)
> +#define _proto(fmt, ...)	RXRPC_DEBUG(KPROTO, kproto, fmt, ##__VA_ARGS__)
> +#define _net(fmt, ...)		RXRPC_DEBUG(KNET, knet, fmt, ##__VA_ARGS__)
>  
> -#else
> -#define _enter(FMT,...)	no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
> -#define _leave(FMT,...)	no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
> -#define _debug(FMT,...)	no_printk("    "FMT ,##__VA_ARGS__)
> -#define _proto(FMT,...)	no_printk("### "FMT ,##__VA_ARGS__)
> -#define _net(FMT,...)	no_printk("@@@ "FMT ,##__VA_ARGS__)
>  #endif
>  
>  /*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [resend PATCH  for 3rd time] rxrpc: Neaten logging macros and add KERN_DEBUG logging level
  2018-05-11 16:29 ` Joe Perches
@ 2018-11-19 20:35   ` Joe Perches
  2018-11-20  2:57     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2018-11-19 20:35 UTC (permalink / raw)
  To: David Howells; +Cc: David S. Miller, linux-afs, netdev, linux-kernel

When enabled, the current debug logging does not have a KERN_<LEVEL>.
Add KERN_DEBUG to the logging macros.

Miscellanea:
o Remove #define redundancy and neaten the macros a bit> 

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

v3: Remerge into -next, with new file/patch offsets

On Fri, 2018-05-11 at 09:29 -0700, Joe Perches wrote:
> ping?
> > Resend of patch: https://lkml.org/lkml/2017/11/30/573
> > No change in patch.
> > David Howells is now a listed maintainer for net/rxrpc/ so he should receive
> > this patch via get_maintainer

David, is there anything amiss with this patch?

 net/rxrpc/ar-internal.h | 75 ++++++++++++++++++-------------------------------
 1 file changed, 28 insertions(+), 47 deletions(-)

diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index bc628acf4f4f..022cb15dfa00 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -1140,66 +1140,47 @@ static inline bool after_eq(u32 seq1, u32 seq2)
  */
 extern unsigned int rxrpc_debug;
 
-#define dbgprintk(FMT,...) \
-	printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
+#if defined(__KDEBUG) || defined(CONFIG_AF_RXRPC_DEBUG)
+#define dbgprintk(fmt, ...)						\
+	printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
+#else
+#define dbgprintk(fmt, ...)						\
+	no_printk(KERN_DEBUG "[%-6.6s] " fmt "\n", current->comm, ##__VA_ARGS__)
+#endif
 
-#define kenter(FMT,...)	dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
-#define kleave(FMT,...)	dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
-#define kdebug(FMT,...)	dbgprintk("    "FMT ,##__VA_ARGS__)
-#define kproto(FMT,...)	dbgprintk("### "FMT ,##__VA_ARGS__)
-#define knet(FMT,...)	dbgprintk("@@@ "FMT ,##__VA_ARGS__)
+#define kenter(fmt, ...)	dbgprintk("==> %s(" fmt ")", __func__, ##__VA_ARGS__)
+#define kleave(fmt, ...)	dbgprintk("<== %s()" fmt "", __func__, ##__VA_ARGS__)
+#define kdebug(fmt, ...)	dbgprintk("    " fmt, ##__VA_ARGS__)
+#define kproto(fmt, ...)	dbgprintk("### " fmt, ##__VA_ARGS__)
+#define knet(fmt, ...)		dbgprintk("@@@ " fmt, ##__VA_ARGS__)
 
+#if defined(__KDEBUG) || !defined(CONFIG_AF_RXRPC_DEBUG)
+#define _enter(fmt, ...)	kenter(fmt, ##__VA_ARGS__)
+#define _leave(fmt, ...)	kleave(fmt, ##__VA_ARGS__)
+#define _debug(fmt, ...)	kdebug(fmt, ##__VA_ARGS__)
+#define _proto(fmt, ...)	kproto(fmt, ##__VA_ARGS__)
+#define _net(fmt, ...)		knet(fmt, ##__VA_ARGS__)
 
-#if defined(__KDEBUG)
-#define _enter(FMT,...)	kenter(FMT,##__VA_ARGS__)
-#define _leave(FMT,...)	kleave(FMT,##__VA_ARGS__)
-#define _debug(FMT,...)	kdebug(FMT,##__VA_ARGS__)
-#define _proto(FMT,...)	kproto(FMT,##__VA_ARGS__)
-#define _net(FMT,...)	knet(FMT,##__VA_ARGS__)
+#else
 
-#elif defined(CONFIG_AF_RXRPC_DEBUG)
 #define RXRPC_DEBUG_KENTER	0x01
 #define RXRPC_DEBUG_KLEAVE	0x02
 #define RXRPC_DEBUG_KDEBUG	0x04
 #define RXRPC_DEBUG_KPROTO	0x08
 #define RXRPC_DEBUG_KNET	0x10
 
-#define _enter(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KENTER))	\
-		kenter(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _leave(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KLEAVE))	\
-		kleave(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _debug(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KDEBUG))	\
-		kdebug(FMT,##__VA_ARGS__);		\
-} while (0)
-
-#define _proto(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KPROTO))	\
-		kproto(FMT,##__VA_ARGS__);		\
+#define RXRPC_DEBUG(TYPE, type, fmt, ...)				\
+do {									\
+	if (unlikely(rxrpc_debug & RXRPC_DEBUG_##TYPE))			\
+		type(fmt, ##__VA_ARGS__);				\
 } while (0)
 
-#define _net(FMT,...)					\
-do {							\
-	if (unlikely(rxrpc_debug & RXRPC_DEBUG_KNET))	\
-		knet(FMT,##__VA_ARGS__);		\
-} while (0)
+#define _enter(fmt, ...)	RXRPC_DEBUG(KENTER, kenter, fmt, ##__VA_ARGS__)
+#define _leave(fmt, ...)	RXRPC_DEBUG(KLEAVE, kleave, fmt, ##__VA_ARGS__)
+#define _debug(fmt, ...)	RXRPC_DEBUG(KDEBUG, kdebug, fmt, ##__VA_ARGS__)
+#define _proto(fmt, ...)	RXRPC_DEBUG(KPROTO, kproto, fmt, ##__VA_ARGS__)
+#define _net(fmt, ...)		RXRPC_DEBUG(KNET, knet, fmt, ##__VA_ARGS__)
 
-#else
-#define _enter(FMT,...)	no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
-#define _leave(FMT,...)	no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
-#define _debug(FMT,...)	no_printk("    "FMT ,##__VA_ARGS__)
-#define _proto(FMT,...)	no_printk("### "FMT ,##__VA_ARGS__)
-#define _net(FMT,...)	no_printk("@@@ "FMT ,##__VA_ARGS__)
 #endif
 
 /*


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [resend PATCH for 3rd time] rxrpc: Neaten logging macros and add KERN_DEBUG logging level
  2018-11-19 20:35   ` [resend PATCH for 3rd time] " Joe Perches
@ 2018-11-20  2:57     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-20  2:57 UTC (permalink / raw)
  To: joe; +Cc: dhowells, linux-afs, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Mon, 19 Nov 2018 12:35:52 -0800

> When enabled, the current debug logging does not have a KERN_<LEVEL>.
> Add KERN_DEBUG to the logging macros.
> 
> Miscellanea:
> o Remove #define redundancy and neaten the macros a bit> 
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> v3: Remerge into -next, with new file/patch offsets

David, please review and integrate this.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-20  2:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 18:52 [resend PATCH] rxrpc: Neaten logging macros and add KERN_DEBUG logging level Joe Perches
2018-05-11 16:29 ` Joe Perches
2018-11-19 20:35   ` [resend PATCH for 3rd time] " Joe Perches
2018-11-20  2:57     ` David Miller

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).