mtd: atmel_nand: use dev_err() instead of printk()
PATCH 1/4 mtd: atmel_nand: use dev_err() instead of printk()
Use dev_err() instead of printk() to provide a better message to userspace.
--- drivers/mtd/nand/atmel_nand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/atmel_nand.c +3 -3
@@ -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 ; }
Signature · 1 line
1.7.10.4
PATCH 2/4 mtd: fsmc_nand: use dev_warn() instead of printk()
Use dev_warn() instead of printk() to provide a better message to userspace.
--- drivers/mtd/nand/fsmc_nand.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/fsmc_nand.c +4 -4
@@ -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 (); } }
Signature · 1 line
1.7.10.4
Re: [PATCH 2/4] mtd: fsmc_nand: use dev_warn() instead of printk()
Quoted 4 lines · Jingoo Han
Use
dev_warn()instead ofprintk()to provide a better message to userspace.Signed-off-by Jingoo Han <[email protected]>
Yours,
Linus Walleij
PATCH 3/4 mtd: orion_nand: use dev_err() instead of printk()
In reply to Jingoo HanUse dev_err() instead of printk() to provide a better message to userspace.
--- drivers/mtd/nand/orion_nand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/orion_nand.c +3 -3
@@ -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; }
Signature · 1 line
1.7.10.4
Re: [PATCH 3/4] mtd: orion_nand: use dev_err() instead of printk()
Hi Jingoo,
Thanks for the cleanup!
I have some extra requests :-)
On Fri, Dec 20, 2013 at 05:20:50PM +0900, Jingoo Han wrote:
[..]
drivers/mtd/nand/orion_nand.c static int __init orion_nand_probe(struct platform_device *pdev) · line 90
Quoted 10 lines
drivers/mtd/nand/orion_nand.c +1
-1@@ -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).
drivers/mtd/nand/orion_nand.c static int __init orion_nand_probe(struct platform_device *pdev) · line 113
Quoted 6 lines
drivers/mtd/nand/orion_nand.c +1
-1@@ -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!
Signature · 3 lines
Ezequiel García, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
Re: [PATCH 3/4] mtd: orion_nand: use dev_err() instead of printk()
Quoted 24 lines · Ezequiel Garcia
Hi Jingoo,
Thanks for the cleanup!
I have some extra requests :-)
On Fri, Dec 20, 2013 at 05:20:50PM +0900, Jingoo Han wrote:
[..]drivers/mtd/nand/orion_nand.c static int __init orion_nand_probe(struct platform_device *pdev) · line 90
Quoted 10 lines
drivers/mtd/nand/orion_nand.c +1
-1@@ -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.
Quoted 1 line
(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
Quoted 15 lines
drivers/mtd/nand/orion_nand.c static int __init orion_nand_probe(struct platform_device *pdev) · line 113
Quoted 7 lines
drivers/mtd/nand/orion_nand.c +1
-1@@ -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
PATCH 4/4 mtd: sharpsl: use dev_err() instead of printk()
In reply to Jingoo HanUse dev_err() instead of printk() to provide a better message to userspace.
--- drivers/mtd/nand/sharpsl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/sharpsl.c +2 -2
@@ -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; }
Signature · 1 line
1.7.10.4