All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: ksm use pr_err instead of printk
@ 2014-10-01 20:35 ` Paul McQuade
  0 siblings, 0 replies; 6+ messages in thread
From: Paul McQuade @ 2014-10-01 20:35 UTC (permalink / raw)
  To: paulmcquad
  Cc: linux-kernel, linux-mm, neilb, sasha.levin, rientjes, hughd, joe,
	paul.gortmaker, liwanp, n-horiguchi, iamjoonsoo.kim, akpm

WARNING: Prefer: pr_err(...  to printk(KERN_ERR ...

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
---
 mm/ksm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index fb75902..79a26b4 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2310,7 +2310,7 @@ static int __init ksm_init(void)
 
 	ksm_thread = kthread_run(ksm_scan_thread, NULL, "ksmd");
 	if (IS_ERR(ksm_thread)) {
-		printk(KERN_ERR "ksm: creating kthread failed\n");
+		pr_err(KERN_ERR "ksm: creating kthread failed\n");
 		err = PTR_ERR(ksm_thread);
 		goto out_free;
 	}
@@ -2318,7 +2318,7 @@ static int __init ksm_init(void)
 #ifdef CONFIG_SYSFS
 	err = sysfs_create_group(mm_kobj, &ksm_attr_group);
 	if (err) {
-		printk(KERN_ERR "ksm: register sysfs failed\n");
+		pr_err(KERN_ERR "ksm: register sysfs failed\n");
 		kthread_stop(ksm_thread);
 		goto out_free;
 	}
-- 
1.9.1


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

* [PATCH] mm: ksm use pr_err instead of printk
@ 2014-10-01 20:35 ` Paul McQuade
  0 siblings, 0 replies; 6+ messages in thread
From: Paul McQuade @ 2014-10-01 20:35 UTC (permalink / raw)
  To: paulmcquad
  Cc: linux-kernel, linux-mm, neilb, sasha.levin, rientjes, hughd, joe,
	paul.gortmaker, liwanp, n-horiguchi, iamjoonsoo.kim, akpm

WARNING: Prefer: pr_err(...  to printk(KERN_ERR ...

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
---
 mm/ksm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index fb75902..79a26b4 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2310,7 +2310,7 @@ static int __init ksm_init(void)
 
 	ksm_thread = kthread_run(ksm_scan_thread, NULL, "ksmd");
 	if (IS_ERR(ksm_thread)) {
-		printk(KERN_ERR "ksm: creating kthread failed\n");
+		pr_err(KERN_ERR "ksm: creating kthread failed\n");
 		err = PTR_ERR(ksm_thread);
 		goto out_free;
 	}
@@ -2318,7 +2318,7 @@ static int __init ksm_init(void)
 #ifdef CONFIG_SYSFS
 	err = sysfs_create_group(mm_kobj, &ksm_attr_group);
 	if (err) {
-		printk(KERN_ERR "ksm: register sysfs failed\n");
+		pr_err(KERN_ERR "ksm: register sysfs failed\n");
 		kthread_stop(ksm_thread);
 		goto out_free;
 	}
-- 
1.9.1

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

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

* Re: [PATCH] mm: ksm use pr_err instead of printk
  2014-10-01 20:35 ` Paul McQuade
@ 2014-10-01 20:50   ` Andrew Morton
  -1 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2014-10-01 20:50 UTC (permalink / raw)
  To: Paul McQuade
  Cc: linux-kernel, linux-mm, neilb, sasha.levin, rientjes, hughd, joe,
	paul.gortmaker, liwanp, n-horiguchi, iamjoonsoo.kim

On Wed,  1 Oct 2014 21:35:30 +0100 Paul McQuade <paulmcquad@gmail.com> wrote:

> WARNING: Prefer: pr_err(...  to printk(KERN_ERR ...
> 
> Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
> ---
>  mm/ksm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index fb75902..79a26b4 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -2310,7 +2310,7 @@ static int __init ksm_init(void)
>  
>  	ksm_thread = kthread_run(ksm_scan_thread, NULL, "ksmd");
>  	if (IS_ERR(ksm_thread)) {
> -		printk(KERN_ERR "ksm: creating kthread failed\n");
> +		pr_err(KERN_ERR "ksm: creating kthread failed\n");
>  		err = PTR_ERR(ksm_thread);
>  		goto out_free;
>  	}
> @@ -2318,7 +2318,7 @@ static int __init ksm_init(void)
>  #ifdef CONFIG_SYSFS
>  	err = sysfs_create_group(mm_kobj, &ksm_attr_group);
>  	if (err) {
> -		printk(KERN_ERR "ksm: register sysfs failed\n");
> +		pr_err(KERN_ERR "ksm: register sysfs failed\n");
>  		kthread_stop(ksm_thread);
>  		goto out_free;
>  	}

err,

--- a/mm/ksm.c~mm-ksm-use-pr_err-instead-of-printk-fix
+++ a/mm/ksm.c
@@ -2310,7 +2310,7 @@ static int __init ksm_init(void)
 
 	ksm_thread = kthread_run(ksm_scan_thread, NULL, "ksmd");
 	if (IS_ERR(ksm_thread)) {
-		pr_err(KERN_ERR "ksm: creating kthread failed\n");
+		pr_err("ksm: creating kthread failed\n");
 		err = PTR_ERR(ksm_thread);
 		goto out_free;
 	}
@@ -2318,7 +2318,7 @@ static int __init ksm_init(void)
 #ifdef CONFIG_SYSFS
 	err = sysfs_create_group(mm_kobj, &ksm_attr_group);
 	if (err) {
-		pr_err(KERN_ERR "ksm: register sysfs failed\n");
+		pr_err("ksm: register sysfs failed\n");
 		kthread_stop(ksm_thread);
 		goto out_free;
 	}


A quick grep indicates that we have the same mistake in tens of places.
checkpatch rule, please?

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

* Re: [PATCH] mm: ksm use pr_err instead of printk
@ 2014-10-01 20:50   ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2014-10-01 20:50 UTC (permalink / raw)
  To: Paul McQuade
  Cc: linux-kernel, linux-mm, neilb, sasha.levin, rientjes, hughd, joe,
	paul.gortmaker, liwanp, n-horiguchi, iamjoonsoo.kim

On Wed,  1 Oct 2014 21:35:30 +0100 Paul McQuade <paulmcquad@gmail.com> wrote:

> WARNING: Prefer: pr_err(...  to printk(KERN_ERR ...
> 
> Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
> ---
>  mm/ksm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index fb75902..79a26b4 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -2310,7 +2310,7 @@ static int __init ksm_init(void)
>  
>  	ksm_thread = kthread_run(ksm_scan_thread, NULL, "ksmd");
>  	if (IS_ERR(ksm_thread)) {
> -		printk(KERN_ERR "ksm: creating kthread failed\n");
> +		pr_err(KERN_ERR "ksm: creating kthread failed\n");
>  		err = PTR_ERR(ksm_thread);
>  		goto out_free;
>  	}
> @@ -2318,7 +2318,7 @@ static int __init ksm_init(void)
>  #ifdef CONFIG_SYSFS
>  	err = sysfs_create_group(mm_kobj, &ksm_attr_group);
>  	if (err) {
> -		printk(KERN_ERR "ksm: register sysfs failed\n");
> +		pr_err(KERN_ERR "ksm: register sysfs failed\n");
>  		kthread_stop(ksm_thread);
>  		goto out_free;
>  	}

err,

--- a/mm/ksm.c~mm-ksm-use-pr_err-instead-of-printk-fix
+++ a/mm/ksm.c
@@ -2310,7 +2310,7 @@ static int __init ksm_init(void)
 
 	ksm_thread = kthread_run(ksm_scan_thread, NULL, "ksmd");
 	if (IS_ERR(ksm_thread)) {
-		pr_err(KERN_ERR "ksm: creating kthread failed\n");
+		pr_err("ksm: creating kthread failed\n");
 		err = PTR_ERR(ksm_thread);
 		goto out_free;
 	}
@@ -2318,7 +2318,7 @@ static int __init ksm_init(void)
 #ifdef CONFIG_SYSFS
 	err = sysfs_create_group(mm_kobj, &ksm_attr_group);
 	if (err) {
-		pr_err(KERN_ERR "ksm: register sysfs failed\n");
+		pr_err("ksm: register sysfs failed\n");
 		kthread_stop(ksm_thread);
 		goto out_free;
 	}


A quick grep indicates that we have the same mistake in tens of places.
checkpatch rule, please?

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

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

* [PATCH] checkpatch: Warn on logging functions with KERN_<LEVEL>
  2014-10-01 20:50   ` Andrew Morton
@ 2014-10-02  4:08     ` Joe Perches
  -1 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2014-10-02  4:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Paul McQuade, linux-kernel, linux-mm, neilb, sasha.levin,
	rientjes, hughd, paul.gortmaker, liwanp, n-horiguchi,
	iamjoonsoo.kim

Warn on probable misuses of logging functions with KERN_<LEVEL>
like pr_err(KERN_ERR "foo\n");

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Joe Perches <joe@perches.com>

---
> > -		printk(KERN_ERR "ksm: register sysfs failed\n");
> > +		pr_err(KERN_ERR "ksm: register sysfs failed\n");

> A quick grep indicates that we have the same mistake in tens of places.
> checkpatch rule, please?

 scripts/checkpatch.pl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 52a223e..374abf4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4447,6 +4447,17 @@ sub process {
 			}
 		}
 
+# check for logging functions with KERN_<LEVEL>
+		if ($line !~ /printk\s*\(/ &&
+		    $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
+			my $level = $1;
+			if (WARN("UNNECESSARY_KERN_LEVEL",
+				 "Possible unnecessary $level\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$fixlinenr] =~ s/\s*$level\s*//;
+			}
+		}
+
 # check for bad placement of section $InitAttribute (e.g.: __initdata)
 		if ($line =~ /(\b$InitAttribute\b)/) {
 			my $attr = $1;



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

* [PATCH] checkpatch: Warn on logging functions with KERN_<LEVEL>
@ 2014-10-02  4:08     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2014-10-02  4:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Paul McQuade, linux-kernel, linux-mm, neilb, sasha.levin,
	rientjes, hughd, paul.gortmaker, liwanp, n-horiguchi,
	iamjoonsoo.kim

Warn on probable misuses of logging functions with KERN_<LEVEL>
like pr_err(KERN_ERR "foo\n");

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Joe Perches <joe@perches.com>

---
> > -		printk(KERN_ERR "ksm: register sysfs failed\n");
> > +		pr_err(KERN_ERR "ksm: register sysfs failed\n");

> A quick grep indicates that we have the same mistake in tens of places.
> checkpatch rule, please?

 scripts/checkpatch.pl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 52a223e..374abf4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4447,6 +4447,17 @@ sub process {
 			}
 		}
 
+# check for logging functions with KERN_<LEVEL>
+		if ($line !~ /printk\s*\(/ &&
+		    $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
+			my $level = $1;
+			if (WARN("UNNECESSARY_KERN_LEVEL",
+				 "Possible unnecessary $level\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$fixlinenr] =~ s/\s*$level\s*//;
+			}
+		}
+
 # check for bad placement of section $InitAttribute (e.g.: __initdata)
 		if ($line =~ /(\b$InitAttribute\b)/) {
 			my $attr = $1;


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

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

end of thread, other threads:[~2014-10-02  4:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01 20:35 [PATCH] mm: ksm use pr_err instead of printk Paul McQuade
2014-10-01 20:35 ` Paul McQuade
2014-10-01 20:50 ` Andrew Morton
2014-10-01 20:50   ` Andrew Morton
2014-10-02  4:08   ` [PATCH] checkpatch: Warn on logging functions with KERN_<LEVEL> Joe Perches
2014-10-02  4:08     ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.