linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel()
@ 2015-05-18 18:42 Leon Romanovsky
  2015-05-18 18:45 ` Leon Romanovsky
  2015-05-18 22:27 ` Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Leon Romanovsky @ 2015-05-18 18:42 UTC (permalink / raw)
  To: dhowells, akpm, aarcange; +Cc: linux-mm, linux-kernel, 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.

Signed-off-by: Leon Romanovsky <leon@leon.nu>
---
 mm/nommu.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index e544508..7e5986b6 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -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


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

* Re: [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel()
  2015-05-18 18:42 [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel() Leon Romanovsky
@ 2015-05-18 18:45 ` Leon Romanovsky
  2015-05-18 22:27 ` Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2015-05-18 18:45 UTC (permalink / raw)
  To: dhowells, Andrew Morton, aarcange; +Cc: Linux-MM, linux-kernel, Leon Romanovsky

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

On Mon, May 18, 2015 at 9:42 PM, Leon Romanovsky <leon@leon.nu> 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.
>
> Signed-off-by: Leon Romanovsky <leon@leon.nu>
> ---
>  mm/nommu.c |   18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/mm/nommu.c b/mm/nommu.c
> index e544508..7e5986b6 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -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
>



-- 
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | leon@leon.nu

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

* Re: [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel()
  2015-05-18 18:42 [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel() Leon Romanovsky
  2015-05-18 18:45 ` Leon Romanovsky
@ 2015-05-18 22:27 ` Andrew Morton
  2015-05-19  5:20   ` Leon Romanovsky
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2015-05-18 22:27 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: dhowells, aarcange, linux-mm, linux-kernel

On Mon, 18 May 2015 21:42:06 +0300 Leon Romanovsky <leon@leon.nu> 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.


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

* Re: [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel()
  2015-05-18 22:27 ` Andrew Morton
@ 2015-05-19  5:20   ` Leon Romanovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2015-05-19  5:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: dhowells, aarcange, Linux-MM, linux-kernel

On Tue, May 19, 2015 at 1:27 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Mon, 18 May 2015 21:42:06 +0300 Leon Romanovsky <leon@leon.nu> 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.

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

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


-- 
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | leon@leon.nu

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

* [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel()
@ 2015-05-18 18:32 Leon Romanovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2015-05-18 18:32 UTC (permalink / raw)
  To: dhowells, akpm, aarcange; +Cc: linux-mm, linux-kernel, 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.

Signed-off-by: Leon Romanovsky <leon@leon.nu>
---
 mm/nommu.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index e544508..7e5986b6 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -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


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

end of thread, other threads:[~2015-05-19  5:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18 18:42 [PATCH] mm: nommu: convert kenter/kleave/kdebug macros to use pr_devel() Leon Romanovsky
2015-05-18 18:45 ` Leon Romanovsky
2015-05-18 22:27 ` Andrew Morton
2015-05-19  5:20   ` Leon Romanovsky
  -- strict thread matches above, loose matches on Subject: below --
2015-05-18 18:32 Leon Romanovsky

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