Skip to contentSkip to conversation

mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel()

PATCH In review Leon Romanovsky 2 participants 4 messages May 18, 2015 – May 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel()

kenter/kleave/kdebug are wrapper macros to print functions flow and debug information. This set was written before pr_devel() was introduced, so it was controlled by "#if 0" construction.

This patch refactors the current macros to use general pr_devel() functions which won't be compiled in if "#define DEBUG" is not declared prior to that macros.

---
 mm/nommu.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
mm/nommu.c +6 -12
index e544508..7e5986b6 100644
@@ -42,21 +42,15 @@
 #include <asm/mmu_context.h>
 #include "internal.h"
 
-#if 0
-#define kenter(FMT, ...) \
-	printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
-#define kleave(FMT, ...) \
-	printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
-#define kdebug(FMT, ...) \
-	printk(KERN_DEBUG "xxx" FMT"yyy\n", ##__VA_ARGS__)
-#else
+/*
+ * Relies on "#define DEBUG" construction to print them
+ */
 #define kenter(FMT, ...) \
-	no_printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
+	pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__)
 #define kleave(FMT, ...) \
-	no_printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
+	pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
 #define kdebug(FMT, ...) \
-	no_printk(KERN_DEBUG FMT"\n", ##__VA_ARGS__)
-#endif
+	pr_devel("xxx" FMT"yyy\n", ##__VA_ARGS__)
 
 void *high_memory;
 EXPORT_SYMBOL(high_memory);
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

Sorry for this multiple resend, my mail client hid from me part of subject line :(

Quoted 48 lines · Leon Romanovsky

kenter/kleave/kdebug are wrapper macros to print functions flow and debug information. This set was written before pr_devel() was introduced, so it was controlled by "#if 0" construction.

This patch refactors the current macros to use general pr_devel() functions which won't be compiled in if "#define DEBUG" is not declared prior to that macros.

---
 mm/nommu.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
mm/nommu.c +6 -13
index e544508..7e5986b6 100644
@@ -42,21 +42,15 @@
 #include <asm/mmu_context.h>
 #include "internal.h"
 
-#if 0
-#define kenter(FMT, ...) \
-       printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
-#define kleave(FMT, ...) \
-       printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
-#define kdebug(FMT, ...) \
-       printk(KERN_DEBUG "xxx" FMT"yyy\n", ##__VA_ARGS__)
-#else
+/*
+ * Relies on "#define DEBUG" construction to print them
+ */
 #define kenter(FMT, ...) \
-       no_printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
+       pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__)
 #define kleave(FMT, ...) \
-       no_printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
+       pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
 #define kdebug(FMT, ...) \
-       no_printk(KERN_DEBUG FMT"\n", ##__VA_ARGS__)
-#endif
+       pr_devel("xxx" FMT"yyy\n", ##__VA_ARGS__)
 
 void *high_memory;
 EXPORT_SYMBOL(high_memory);
--

1.7.9.5

Signature · 8 lines
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | [email protected]

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#2 lore raw
In reply to Leon Romanovsky
Quoted 7 lines · On Mon, 18 May 2015 21:42:06 +0300 Leon Romanovsky <[email protected]> wrote:

kenter/kleave/kdebug are wrapper macros to print functions flow and debug information. This set was written before pr_devel() was introduced, so it was controlled by "#if 0" construction.

This patch refactors the current macros to use general pr_devel() functions which won't be compiled in if "#define DEBUG" is not declared prior to that macros.

I doubt if anyone has used these in a decade and only a tenth of the mm/nommu.c code is actually wired up to use the macros.

I'd suggest just removing it all. If someone later has a need, they can add their own pr_devel() calls.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 6 lines · Andrew Morton
Quoted 4 lines · On Mon, 18 May 2015 21:42:06 +0300 Leon Romanovsky <[email protected]> wrote:

kenter/kleave/kdebug are wrapper macros to print functions flow and debug information. This set was written before pr_devel() was introduced, so it was controlled by "#if 0" construction.

Quoted 6 lines
Quoted 3 lines

This patch refactors the current macros to use general pr_devel() functions which won't be compiled in if "#define DEBUG" is not declared prior to that macros.

I doubt if anyone has used these in a decade and only a tenth of the mm/nommu.c code is actually wired up to use the macros.

A couple of days before, the question "how to handle such code" [1] was raised by me. Later, Joe Perches suggested to add into consideration the "delete option" [2].

Quoted 2 lines

I'd suggest just removing it all. If someone later has a need, they can add their own pr_devel() calls.

My patch followed the preference of initial author (David Howells [3] and [4]).

Please advise how should I proceed with it.

[1] [RFC] Refactor kenter/kleave/kdebug macros -
https://lkml.org/lkml/2015/5/16/279
[2] https://lkml.org/lkml/2015/5/16/280
[3] https://lkml.org/lkml/2015/5/18/199
[4] https://lkml.org/lkml/2015/5/18/457

Thanks.

Signature · 8 lines
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | [email protected]

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>