linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ramoops: add new line to printks
@ 2011-05-28 14:48 Marco Stornelli
  2011-06-07 16:52 ` Marco Stornelli
  0 siblings, 1 reply; 8+ messages in thread
From: Marco Stornelli @ 2011-05-28 14:48 UTC (permalink / raw)
  To: Linux Kernel; +Cc: xiyou.wangcong, stevie.trujillo, kyungmin.park

From: Marco Stornelli <marco.stornelli@gmail.com>

Add new line to each printk.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---

diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index bf5f9f6..6662c1b 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -111,14 +111,14 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	int err = -EINVAL;
 
 	if (!pdata->mem_size) {
-		printk(KERN_ERR "ramoops: invalid size specification");
+		printk(KERN_ERR "ramoops: invalid size specification\n");
 		goto fail3;
 	}
 
 	rounddown_pow_of_two(pdata->mem_size);
 
 	if (pdata->mem_size < RECORD_SIZE) {
-		printk(KERN_ERR "ramoops: size too small");
+		printk(KERN_ERR "ramoops: size too small\n");
 		goto fail3;
 	}
 
@@ -128,21 +128,21 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	cxt->phys_addr = pdata->mem_address;
 
 	if (!request_mem_region(cxt->phys_addr, cxt->size, "ramoops")) {
-		printk(KERN_ERR "ramoops: request mem region failed");
+		printk(KERN_ERR "ramoops: request mem region failed\n");
 		err = -EINVAL;
 		goto fail3;
 	}
 
 	cxt->virt_addr = ioremap(cxt->phys_addr,  cxt->size);
 	if (!cxt->virt_addr) {
-		printk(KERN_ERR "ramoops: ioremap failed");
+		printk(KERN_ERR "ramoops: ioremap failed\n");
 		goto fail2;
 	}
 
 	cxt->dump.dump = ramoops_do_dump;
 	err = kmsg_dump_register(&cxt->dump);
 	if (err) {
-		printk(KERN_ERR "ramoops: registering kmsg dumper failed");
+		printk(KERN_ERR "ramoops: registering kmsg dumper failed\n");
 		goto fail1;
 	}
 
@@ -161,7 +161,7 @@ static int __exit ramoops_remove(struct platform_device *pdev)
 	struct ramoops_context *cxt = &oops_cxt;
 
 	if (kmsg_dump_unregister(&cxt->dump) < 0)
-		printk(KERN_WARNING "ramoops: could not unregister kmsg_dumper");
+		printk(KERN_WARNING "ramoops: could not unregister kmsg_dumper\n");
 
 	iounmap(cxt->virt_addr);
 	release_mem_region(cxt->phys_addr, cxt->size);


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

* [PATCH 2/2] ramoops: add new line to printks
  2011-05-28 14:48 [PATCH 2/2] ramoops: add new line to printks Marco Stornelli
@ 2011-06-07 16:52 ` Marco Stornelli
  2011-06-08 16:02   ` Américo Wang
  2011-06-08 16:22   ` Joe Perches
  0 siblings, 2 replies; 8+ messages in thread
From: Marco Stornelli @ 2011-06-07 16:52 UTC (permalink / raw)
  To: Linux Kernel; +Cc: xiyou.wangcong, stevie.trujillo, kyungmin.park

From: Marco Stornelli <marco.stornelli@gmail.com>

Add new line to each printk.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
CC: Kyungmin Park <kyungmin.park@samsung.com>
CC: Américo Wang <xiyou.wangcong@gmail.com>
Reported-by: Stevie Trujillo <stevie.trujillo@gmail.com>
---
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index df092e1..20e9d3e 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -111,14 +111,14 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	int err = -EINVAL;
 
 	if (!pdata->mem_size) {
-		printk(KERN_ERR "ramoops: invalid size specification");
+		printk(KERN_ERR "ramoops: invalid size specification\n");
 		goto fail3;
 	}
 
 	rounddown_pow_of_two(pdata->mem_size);
 
 	if (pdata->mem_size < RECORD_SIZE) {
-		printk(KERN_ERR "ramoops: size too small");
+		printk(KERN_ERR "ramoops: size too small\n");
 		goto fail3;
 	}
 
@@ -128,21 +128,21 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	cxt->phys_addr = pdata->mem_address;
 
 	if (!request_mem_region(cxt->phys_addr, cxt->size, "ramoops")) {
-		printk(KERN_ERR "ramoops: request mem region failed");
+		printk(KERN_ERR "ramoops: request mem region failed\n");
 		err = -EINVAL;
 		goto fail3;
 	}
 
 	cxt->virt_addr = ioremap(cxt->phys_addr,  cxt->size);
 	if (!cxt->virt_addr) {
-		printk(KERN_ERR "ramoops: ioremap failed");
+		printk(KERN_ERR "ramoops: ioremap failed\n");
 		goto fail2;
 	}
 
 	cxt->dump.dump = ramoops_do_dump;
 	err = kmsg_dump_register(&cxt->dump);
 	if (err) {
-		printk(KERN_ERR "ramoops: registering kmsg dumper failed");
+		printk(KERN_ERR "ramoops: registering kmsg dumper failed\n");
 		goto fail1;
 	}
 
@@ -161,7 +161,7 @@ static int __exit ramoops_remove(struct platform_device *pdev)
 	struct ramoops_context *cxt = &oops_cxt;
 
 	if (kmsg_dump_unregister(&cxt->dump) < 0)
-		printk(KERN_WARNING "ramoops: could not unregister kmsg_dumper");
+		printk(KERN_WARNING "ramoops: could not unregister kmsg_dumper\n");
 
 	iounmap(cxt->virt_addr);
 	release_mem_region(cxt->phys_addr, cxt->size);

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

* Re: [PATCH 2/2] ramoops: add new line to printks
  2011-06-07 16:52 ` Marco Stornelli
@ 2011-06-08 16:02   ` Américo Wang
  2011-06-08 16:22   ` Joe Perches
  1 sibling, 0 replies; 8+ messages in thread
From: Américo Wang @ 2011-06-08 16:02 UTC (permalink / raw)
  To: Marco Stornelli; +Cc: Linux Kernel, stevie.trujillo, kyungmin.park

On Wed, Jun 8, 2011 at 12:52 AM, Marco Stornelli
<marco.stornelli@gmail.com> wrote:
> From: Marco Stornelli <marco.stornelli@gmail.com>
>
> Add new line to each printk.
>
> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
> CC: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Américo Wang <xiyou.wangcong@gmail.com>
> Reported-by: Stevie Trujillo <stevie.trujillo@gmail.com>

This change is trivial, and it looks good too.

Thanks.

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

* Re: [PATCH 2/2] ramoops: add new line to printks
  2011-06-07 16:52 ` Marco Stornelli
  2011-06-08 16:02   ` Américo Wang
@ 2011-06-08 16:22   ` Joe Perches
  2011-06-08 19:07     ` [PATCH 2/2 v2] ramoops: add new line to each print Marco Stornelli
  1 sibling, 1 reply; 8+ messages in thread
From: Joe Perches @ 2011-06-08 16:22 UTC (permalink / raw)
  To: Marco Stornelli
  Cc: Linux Kernel, xiyou.wangcong, stevie.trujillo, kyungmin.park

On Tue, 2011-06-07 at 18:52 +0200, Marco Stornelli wrote:
> From: Marco Stornelli <marco.stornelli@gmail.com>
> Add new line to each printk.

Perhaps use pr_<level> and pr_fmt instead?
---
 drivers/char/ramoops.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index 1a9f5f6..1283180 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -19,6 +19,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/kmsg_dump.h>
@@ -112,14 +114,14 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	}
 
 	if (!mem_size) {
-		printk(KERN_ERR "ramoops: invalid size specification");
+		pr_err("invalid size specification\n");
 		goto fail3;
 	}
 
 	rounddown_pow_of_two(mem_size);
 
 	if (mem_size < RECORD_SIZE) {
-		printk(KERN_ERR "ramoops: size too small");
+		pr_err("size too small\n");
 		goto fail3;
 	}
 
@@ -129,21 +131,21 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	cxt->phys_addr = mem_address;
 
 	if (!request_mem_region(cxt->phys_addr, cxt->size, "ramoops")) {
-		printk(KERN_ERR "ramoops: request mem region failed");
+		pr_err("request mem region failed\n");
 		err = -EINVAL;
 		goto fail3;
 	}
 
 	cxt->virt_addr = ioremap(cxt->phys_addr,  cxt->size);
 	if (!cxt->virt_addr) {
-		printk(KERN_ERR "ramoops: ioremap failed");
+		pr_err("ioremap failed\n");
 		goto fail2;
 	}
 
 	cxt->dump.dump = ramoops_do_dump;
 	err = kmsg_dump_register(&cxt->dump);
 	if (err) {
-		printk(KERN_ERR "ramoops: registering kmsg dumper failed");
+		pr_err("registering kmsg dumper failed\n");
 		goto fail1;
 	}
 
@@ -162,7 +164,7 @@ static int __exit ramoops_remove(struct platform_device *pdev)
 	struct ramoops_context *cxt = &oops_cxt;
 
 	if (kmsg_dump_unregister(&cxt->dump) < 0)
-		printk(KERN_WARNING "ramoops: could not unregister kmsg_dumper");
+		pr_warn("could not unregister kmsg_dumper\n");
 
 	iounmap(cxt->virt_addr);
 	release_mem_region(cxt->phys_addr, cxt->size);



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

* [PATCH 2/2 v2] ramoops: add new line to each print
  2011-06-08 16:22   ` Joe Perches
@ 2011-06-08 19:07     ` Marco Stornelli
  2011-06-08 19:27       ` Joe Perches
  2011-06-08 19:47       ` [PATCH 2/2 v3] " Marco Stornelli
  0 siblings, 2 replies; 8+ messages in thread
From: Marco Stornelli @ 2011-06-08 19:07 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Joe Perches, xiyou.wangcong, stevie.trujillo, kyungmin.park

From: Marco Stornelli <marco.stornelli@gmail.com>

Add new line to each print.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
CC: Kyungmin Park <kyungmin.park@samsung.com>
CC: Américo Wang <xiyou.wangcong@gmail.com>
CC: Joe Perches <joe@perches.com>
Reported-by: Stevie Trujillo <stevie.trujillo@gmail.com>
---
ChangeLog:
- v2: used pr_<level> instead of printk

diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index df092e1..c3bf9b5 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -19,6 +19,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/kmsg_dump.h>
@@ -111,14 +113,14 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	int err = -EINVAL;
 
 	if (!pdata->mem_size) {
-		printk(KERN_ERR "ramoops: invalid size specification");
+		pr_err("invalid size specification\n");
 		goto fail3;
 	}
 
 	rounddown_pow_of_two(pdata->mem_size);
 
 	if (pdata->mem_size < RECORD_SIZE) {
-		printk(KERN_ERR "ramoops: size too small");
+		pr_err("size too small\n");
 		goto fail3;
 	}
 
@@ -128,21 +130,21 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	cxt->phys_addr = pdata->mem_address;
 
 	if (!request_mem_region(cxt->phys_addr, cxt->size, "ramoops")) {
-		printk(KERN_ERR "ramoops: request mem region failed");
+		pr_err("request mem region failed\n");
 		err = -EINVAL;
 		goto fail3;
 	}
 
 	cxt->virt_addr = ioremap(cxt->phys_addr,  cxt->size);
 	if (!cxt->virt_addr) {
-		printk(KERN_ERR "ramoops: ioremap failed");
+		pr_err("ioremap failed\n");
 		goto fail2;
 	}
 
 	cxt->dump.dump = ramoops_do_dump;
 	err = kmsg_dump_register(&cxt->dump);
 	if (err) {
-		printk(KERN_ERR "ramoops: registering kmsg dumper failed");
+		pr_err("registering kmsg dumper failed\n");
 		goto fail1;
 	}
 
@@ -161,7 +163,7 @@ static int __exit ramoops_remove(struct platform_device *pdev)
 	struct ramoops_context *cxt = &oops_cxt;
 
 	if (kmsg_dump_unregister(&cxt->dump) < 0)
-		printk(KERN_WARNING "ramoops: could not unregister kmsg_dumper");
+		pr_warn("could not unregister kmsg_dumper\n");
 
 	iounmap(cxt->virt_addr);
 	release_mem_region(cxt->phys_addr, cxt->size);
@@ -186,6 +188,8 @@ static int __init ramoops_init(void)
 		 * if we didn't find a platform device, we use module parameters
 		 * building platform data on the fly.
 		 */
+		pr_info("platform device not found, "
+			"using module parameters\n");
 		dummy_data = kzalloc(sizeof(struct ramoops_platform_data),
 				     GFP_KERNEL);
 		if (!dummy_data)


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

* Re: [PATCH 2/2 v2] ramoops: add new line to each print
  2011-06-08 19:27       ` Joe Perches
@ 2011-06-08 19:24         ` Marco Stornelli
  0 siblings, 0 replies; 8+ messages in thread
From: Marco Stornelli @ 2011-06-08 19:24 UTC (permalink / raw)
  To: Joe Perches; +Cc: Linux Kernel, xiyou.wangcong, stevie.trujillo, kyungmin.park

Il 08/06/2011 21:27, Joe Perches ha scritto:
> On Wed, 2011-06-08 at 21:07 +0200, Marco Stornelli wrote:
>> From: Marco Stornelli<marco.stornelli@gmail.com>
>> Add new line to each print.
>> diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
> []
>> @@ -186,6 +188,8 @@ static int __init ramoops_init(void)
>>   		 * if we didn't find a platform device, we use module parameters
>>   		 * building platform data on the fly.
>>   		 */
>> +		pr_info("platform device not found, "
>> +			"using module parameters\n");
>
> Thanks Marco, I think that looks better.
>
> Trivia:
>
> This fits on a single line and it's not generally a
> good thing to split a format across multiple lines.
>
> cheers, Joe

Mmmm...my editor said 81 cols, so I split the message into two lines. 
I'll check it again.

Marco

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

* Re: [PATCH 2/2 v2] ramoops: add new line to each print
  2011-06-08 19:07     ` [PATCH 2/2 v2] ramoops: add new line to each print Marco Stornelli
@ 2011-06-08 19:27       ` Joe Perches
  2011-06-08 19:24         ` Marco Stornelli
  2011-06-08 19:47       ` [PATCH 2/2 v3] " Marco Stornelli
  1 sibling, 1 reply; 8+ messages in thread
From: Joe Perches @ 2011-06-08 19:27 UTC (permalink / raw)
  To: Marco Stornelli
  Cc: Linux Kernel, xiyou.wangcong, stevie.trujillo, kyungmin.park

On Wed, 2011-06-08 at 21:07 +0200, Marco Stornelli wrote:
> From: Marco Stornelli <marco.stornelli@gmail.com>
> Add new line to each print.
> diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
[]
> @@ -186,6 +188,8 @@ static int __init ramoops_init(void)
>  		 * if we didn't find a platform device, we use module parameters
>  		 * building platform data on the fly.
>  		 */
> +		pr_info("platform device not found, "
> +			"using module parameters\n");

Thanks Marco, I think that looks better.

Trivia:

This fits on a single line and it's not generally a
good thing to split a format across multiple lines.

cheers, Joe


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

* [PATCH 2/2 v3] ramoops: add new line to each print
  2011-06-08 19:07     ` [PATCH 2/2 v2] ramoops: add new line to each print Marco Stornelli
  2011-06-08 19:27       ` Joe Perches
@ 2011-06-08 19:47       ` Marco Stornelli
  1 sibling, 0 replies; 8+ messages in thread
From: Marco Stornelli @ 2011-06-08 19:47 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Joe Perches, xiyou.wangcong, stevie.trujillo, kyungmin.park

From: Marco Stornelli <marco.stornelli@gmail.com>

Add new line to each print.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
CC: Kyungmin Park <kyungmin.park@samsung.com>
CC: Américo Wang <xiyou.wangcong@gmail.com>
CC: Joe Perches <joe@perches.com>
Reported-by: Stevie Trujillo <stevie.trujillo@gmail.com>
---
ChangeLog:
- v3: removed double line from pr_info
- v2: used pr_<level> instead of printk
- v1: initial draft

diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index df092e1..5b4a5e1 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -19,6 +19,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/kmsg_dump.h>
@@ -111,14 +113,14 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	int err = -EINVAL;
 
 	if (!pdata->mem_size) {
-		printk(KERN_ERR "ramoops: invalid size specification");
+		pr_err("invalid size specification\n");
 		goto fail3;
 	}
 
 	rounddown_pow_of_two(pdata->mem_size);
 
 	if (pdata->mem_size < RECORD_SIZE) {
-		printk(KERN_ERR "ramoops: size too small");
+		pr_err("size too small\n");
 		goto fail3;
 	}
 
@@ -128,21 +130,21 @@ static int __init ramoops_probe(struct platform_device *pdev)
 	cxt->phys_addr = pdata->mem_address;
 
 	if (!request_mem_region(cxt->phys_addr, cxt->size, "ramoops")) {
-		printk(KERN_ERR "ramoops: request mem region failed");
+		pr_err("request mem region failed\n");
 		err = -EINVAL;
 		goto fail3;
 	}
 
 	cxt->virt_addr = ioremap(cxt->phys_addr,  cxt->size);
 	if (!cxt->virt_addr) {
-		printk(KERN_ERR "ramoops: ioremap failed");
+		pr_err("ioremap failed\n");
 		goto fail2;
 	}
 
 	cxt->dump.dump = ramoops_do_dump;
 	err = kmsg_dump_register(&cxt->dump);
 	if (err) {
-		printk(KERN_ERR "ramoops: registering kmsg dumper failed");
+		pr_err("registering kmsg dumper failed\n");
 		goto fail1;
 	}
 
@@ -161,7 +163,7 @@ static int __exit ramoops_remove(struct platform_device *pdev)
 	struct ramoops_context *cxt = &oops_cxt;
 
 	if (kmsg_dump_unregister(&cxt->dump) < 0)
-		printk(KERN_WARNING "ramoops: could not unregister kmsg_dumper");
+		pr_warn("could not unregister kmsg_dumper\n");
 
 	iounmap(cxt->virt_addr);
 	release_mem_region(cxt->phys_addr, cxt->size);
@@ -186,6 +188,7 @@ static int __init ramoops_init(void)
 		 * if we didn't find a platform device, we use module parameters
 		 * building platform data on the fly.
 		 */
+		pr_info("platform device not found, using module parameters\n");
 		dummy_data = kzalloc(sizeof(struct ramoops_platform_data),
 				     GFP_KERNEL);
 		if (!dummy_data)

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

end of thread, other threads:[~2011-06-08 19:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-28 14:48 [PATCH 2/2] ramoops: add new line to printks Marco Stornelli
2011-06-07 16:52 ` Marco Stornelli
2011-06-08 16:02   ` Américo Wang
2011-06-08 16:22   ` Joe Perches
2011-06-08 19:07     ` [PATCH 2/2 v2] ramoops: add new line to each print Marco Stornelli
2011-06-08 19:27       ` Joe Perches
2011-06-08 19:24         ` Marco Stornelli
2011-06-08 19:47       ` [PATCH 2/2 v3] " Marco Stornelli

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