public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/4] mtd: atmel_nand: use dev_err() instead of printk()
@ 2013-12-20  8:17 Jingoo Han
  2013-12-20  8:18 ` [PATCH 2/4] mtd: fsmc_nand: use dev_warn() " Jingoo Han
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jingoo Han @ 2013-12-20  8:17 UTC (permalink / raw)
  To: 'Brian Norris'
  Cc: linux-mtd, 'Jingoo Han', 'David Woodhouse',
	'Josh Wu'

Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/mtd/nand/atmel_nand.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 59f08c4..354ca6d 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1962,7 +1962,7 @@ static int atmel_nand_probe(struct platform_device *pdev)
 	/* Allocate memory for the device structure (and zero it) */
 	host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
 	if (!host) {
-		printk(KERN_ERR "atmel_nand: failed to allocate device structure.\n");
+		dev_err(&pdev->dev, "atmel_nand: failed to allocate device structure.\n");
 		return -ENOMEM;
 	}
 
@@ -2062,14 +2062,14 @@ static int atmel_nand_probe(struct platform_device *pdev)
 		}
 
 		if (gpio_get_value(host->board.det_pin)) {
-			printk(KERN_INFO "No SmartMedia card inserted.\n");
+			dev_info(&pdev->dev, "No SmartMedia card inserted.\n");
 			res = -ENXIO;
 			goto err_no_card;
 		}
 	}
 
 	if (host->board.on_flash_bbt || on_flash_bbt) {
-		printk(KERN_INFO "atmel_nand: Use On Flash BBT\n");
+		dev_info(&pdev->dev, "atmel_nand: Use On Flash BBT\n");
 		nand_chip->bbt_options |= NAND_BBT_USE_FLASH;
 	}
 
-- 
1.7.10.4

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

* [PATCH 2/4] mtd: fsmc_nand: use dev_warn() instead of printk()
  2013-12-20  8:17 [PATCH 1/4] mtd: atmel_nand: use dev_err() instead of printk() Jingoo Han
@ 2013-12-20  8:18 ` Jingoo Han
  2013-12-20  8:59   ` Linus Walleij
  2013-12-20  8:20 ` [PATCH 3/4] mtd: orion_nand: use dev_err() " Jingoo Han
  2013-12-20  8:22 ` [PATCH 4/4] mtd: sharpsl: " Jingoo Han
  2 siblings, 1 reply; 7+ messages in thread
From: Jingoo Han @ 2013-12-20  8:18 UTC (permalink / raw)
  To: 'Brian Norris'
  Cc: linux-mtd, 'Linus Walleij', 'Jingoo Han',
	'David Woodhouse'

Use dev_warn() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/mtd/nand/fsmc_nand.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 8b27522..ee65b98 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -1108,8 +1108,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 			host->ecc_place = &fsmc_ecc4_lp_place;
 			break;
 		default:
-			printk(KERN_WARNING "No oob scheme defined for "
-			       "oobsize %d\n", mtd->oobsize);
+			dev_warn(&pdev->dev, "No oob scheme defined for oobsize %d\n",
+				 mtd->oobsize);
 			BUG();
 		}
 	} else {
@@ -1124,8 +1124,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 			nand->ecc.layout = &fsmc_ecc1_128_layout;
 			break;
 		default:
-			printk(KERN_WARNING "No oob scheme defined for "
-			       "oobsize %d\n", mtd->oobsize);
+			dev_warn(&pdev->dev, "No oob scheme defined for oobsize %d\n",
+				 mtd->oobsize);
 			BUG();
 		}
 	}
-- 
1.7.10.4

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

* [PATCH 3/4] mtd: orion_nand: use dev_err() instead of printk()
  2013-12-20  8:17 [PATCH 1/4] mtd: atmel_nand: use dev_err() instead of printk() Jingoo Han
  2013-12-20  8:18 ` [PATCH 2/4] mtd: fsmc_nand: use dev_warn() " Jingoo Han
@ 2013-12-20  8:20 ` Jingoo Han
  2013-12-21 14:22   ` Ezequiel Garcia
  2013-12-20  8:22 ` [PATCH 4/4] mtd: sharpsl: " Jingoo Han
  2 siblings, 1 reply; 7+ messages in thread
From: Jingoo Han @ 2013-12-20  8:20 UTC (permalink / raw)
  To: 'Brian Norris'
  Cc: linux-mtd, 'Jingoo Han', 'David Woodhouse',
	'Andrew Lunn'

Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/mtd/nand/orion_nand.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index a393a5b..7cd9aed 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -87,7 +87,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 
 	nc = kzalloc(sizeof(struct nand_chip) + sizeof(struct mtd_info), GFP_KERNEL);
 	if (!nc) {
-		printk(KERN_ERR "orion_nand: failed to allocate device structure.\n");
+		dev_err(&pdev->dev, "orion_nand: failed to allocate device structure.\n");
 		ret = -ENOMEM;
 		goto no_res;
 	}
@@ -101,7 +101,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 
 	io_base = ioremap(res->start, resource_size(res));
 	if (!io_base) {
-		printk(KERN_ERR "orion_nand: ioremap failed\n");
+		dev_err(&pdev->dev, "orion_nand: ioremap failed\n");
 		ret = -EIO;
 		goto no_res;
 	}
@@ -110,7 +110,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 		board = devm_kzalloc(&pdev->dev, sizeof(struct orion_nand_data),
 					GFP_KERNEL);
 		if (!board) {
-			printk(KERN_ERR "orion_nand: failed to allocate board structure.\n");
+			dev_err(&pdev->dev, "orion_nand: failed to allocate board structure.\n");
 			ret = -ENOMEM;
 			goto no_res;
 		}
-- 
1.7.10.4

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

* [PATCH 4/4] mtd: sharpsl: use dev_err() instead of printk()
  2013-12-20  8:17 [PATCH 1/4] mtd: atmel_nand: use dev_err() instead of printk() Jingoo Han
  2013-12-20  8:18 ` [PATCH 2/4] mtd: fsmc_nand: use dev_warn() " Jingoo Han
  2013-12-20  8:20 ` [PATCH 3/4] mtd: orion_nand: use dev_err() " Jingoo Han
@ 2013-12-20  8:22 ` Jingoo Han
  2 siblings, 0 replies; 7+ messages in thread
From: Jingoo Han @ 2013-12-20  8:22 UTC (permalink / raw)
  To: 'Brian Norris'
  Cc: linux-mtd, 'Jingoo Han', 'David Woodhouse'

Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/mtd/nand/sharpsl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 87908d7..8522f33 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -122,7 +122,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
 	/* Allocate memory for MTD device structure and private data */
 	sharpsl = kzalloc(sizeof(struct sharpsl_nand), GFP_KERNEL);
 	if (!sharpsl) {
-		printk("Unable to allocate SharpSL NAND MTD device structure.\n");
+		dev_err(&pdev->dev, "Unable to allocate SharpSL NAND MTD device structure.\n");
 		return -ENOMEM;
 	}
 
@@ -136,7 +136,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
 	/* map physical address */
 	sharpsl->io = ioremap(r->start, resource_size(r));
 	if (!sharpsl->io) {
-		printk("ioremap to access Sharp SL NAND chip failed\n");
+		dev_err(&pdev->dev, "ioremap to access Sharp SL NAND chip failed\n");
 		err = -EIO;
 		goto err_ioremap;
 	}
-- 
1.7.10.4

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

* Re: [PATCH 2/4] mtd: fsmc_nand: use dev_warn() instead of printk()
  2013-12-20  8:18 ` [PATCH 2/4] mtd: fsmc_nand: use dev_warn() " Jingoo Han
@ 2013-12-20  8:59   ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2013-12-20  8:59 UTC (permalink / raw)
  To: Jingoo Han; +Cc: linux-mtd@lists.infradead.org, Brian Norris, David Woodhouse

On Fri, Dec 20, 2013 at 9:18 AM, Jingoo Han <jg1.han@samsung.com> wrote:

> Use dev_warn() instead of printk() to provide a better message
> to userspace.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 3/4] mtd: orion_nand: use dev_err() instead of printk()
  2013-12-20  8:20 ` [PATCH 3/4] mtd: orion_nand: use dev_err() " Jingoo Han
@ 2013-12-21 14:22   ` Ezequiel Garcia
  2013-12-26  1:50     ` Jingoo Han
  0 siblings, 1 reply; 7+ messages in thread
From: Ezequiel Garcia @ 2013-12-21 14:22 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'David Woodhouse', 'Brian Norris', linux-mtd,
	'Andrew Lunn'

Hi Jingoo,

Thanks for the cleanup!

I have some extra requests :-)

On Fri, Dec 20, 2013 at 05:20:50PM +0900, Jingoo Han wrote:
[..]
> diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
> index a393a5b..7cd9aed 100644
> --- a/drivers/mtd/nand/orion_nand.c
> +++ b/drivers/mtd/nand/orion_nand.c
> @@ -87,7 +87,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
>  
>  	nc = kzalloc(sizeof(struct nand_chip) + sizeof(struct mtd_info), GFP_KERNEL);
>  	if (!nc) {
> -		printk(KERN_ERR "orion_nand: failed to allocate device structure.\n");
> +		dev_err(&pdev->dev, "orion_nand: failed to allocate device structure.\n");

Instead of this replacement, can you remove the error message entirely?
It's redundant for a driver to print anything after an allocation error, since an
out-of-memory condition will print quite enough information.

(Google for "Joe Perches OOM" and you'll find lots of patches removing this prints).

> @@ -110,7 +110,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
>  		board = devm_kzalloc(&pdev->dev, sizeof(struct orion_nand_data),
>  					GFP_KERNEL);
>  		if (!board) {
> -			printk(KERN_ERR "orion_nand: failed to allocate board structure.\n");
> +			dev_err(&pdev->dev, "orion_nand: failed to allocate board structure.\n");

Ditto.

Thanks!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH 3/4] mtd: orion_nand: use dev_err() instead of printk()
  2013-12-21 14:22   ` Ezequiel Garcia
@ 2013-12-26  1:50     ` Jingoo Han
  0 siblings, 0 replies; 7+ messages in thread
From: Jingoo Han @ 2013-12-26  1:50 UTC (permalink / raw)
  To: 'Ezequiel Garcia'
  Cc: 'Jingoo Han', 'David Woodhouse',
	'Brian Norris', linux-mtd, 'Andrew Lunn'

On Saturday, December 21, 2013 11:22 PM, Ezequiel Garcia wrote:
> 
> Hi Jingoo,
> 
> Thanks for the cleanup!
> 
> I have some extra requests :-)
> 
> On Fri, Dec 20, 2013 at 05:20:50PM +0900, Jingoo Han wrote:
> [..]
> > diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
> > index a393a5b..7cd9aed 100644
> > --- a/drivers/mtd/nand/orion_nand.c
> > +++ b/drivers/mtd/nand/orion_nand.c
> > @@ -87,7 +87,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
> >
> >  	nc = kzalloc(sizeof(struct nand_chip) + sizeof(struct mtd_info), GFP_KERNEL);
> >  	if (!nc) {
> > -		printk(KERN_ERR "orion_nand: failed to allocate device structure.\n");
> > +		dev_err(&pdev->dev, "orion_nand: failed to allocate device structure.\n");
> 
> Instead of this replacement, can you remove the error message entirely?
> It's redundant for a driver to print anything after an allocation error, since an
> out-of-memory condition will print quite enough information.
> 
> (Google for "Joe Perches OOM" and you'll find lots of patches removing this prints).

OK, I see.

I checked the patches about OOM from Joe Perches.
I will send another patch to remove OOM error message,
instead of this patch. Thank you for your comment.

Best regards,
Jingoo Han

> 
> > @@ -110,7 +110,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
> >  		board = devm_kzalloc(&pdev->dev, sizeof(struct orion_nand_data),
> >  					GFP_KERNEL);
> >  		if (!board) {
> > -			printk(KERN_ERR "orion_nand: failed to allocate board structure.\n");
> > +			dev_err(&pdev->dev, "orion_nand: failed to allocate board structure.\n");
> 
> Ditto.
> 
> Thanks!
> --
> Ezequiel García, Free Electrons
> Embedded Linux, Kernel and Android Engineering
> http://free-electrons.com

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

end of thread, other threads:[~2013-12-26  1:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20  8:17 [PATCH 1/4] mtd: atmel_nand: use dev_err() instead of printk() Jingoo Han
2013-12-20  8:18 ` [PATCH 2/4] mtd: fsmc_nand: use dev_warn() " Jingoo Han
2013-12-20  8:59   ` Linus Walleij
2013-12-20  8:20 ` [PATCH 3/4] mtd: orion_nand: use dev_err() " Jingoo Han
2013-12-21 14:22   ` Ezequiel Garcia
2013-12-26  1:50     ` Jingoo Han
2013-12-20  8:22 ` [PATCH 4/4] mtd: sharpsl: " Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox