linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Outreachy kernel] [PATCH NAND] mtd: nand: Replace printk() with appropriate dev_*macro()
@ 2018-02-19 13:18 Shreeya Patel
  2018-02-19 15:12 ` [Outreachy kernel] " Boris Brezillon
  0 siblings, 1 reply; 3+ messages in thread
From: Shreeya Patel @ 2018-02-19 13:18 UTC (permalink / raw)
  To: boris.brezillon, richard, dwmw2, computersforpeace, marek.vasut,
	cyrille.pitchen, maximlevitsky, linux-mtd, linux-kernel,
	ezequiel, outreachy-kernel
  Cc: Shreeya Patel

Replace printks having a log level with the appropriate
dev_*macro.
Also, use pdev->dev as it is guaranteed in each case to be
properly initialized when passed into dev_*macro().

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
---
 drivers/mtd/nand/ams-delta.c | 6 ++++--
 drivers/mtd/nand/cafe_nand.c | 5 +++--
 drivers/mtd/nand/sh_flctl.c  | 2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index dcec9cf..2419ca8 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,8 @@ static int ams_delta_init(struct platform_device *pdev)
 	/* Allocate memory for MTD device structure and private data */
 	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
 	if (!this) {
-		printk (KERN_WARNING "Unable to allocate E3 NAND MTD device structure.\n");
+		dev_warn(&pdev->dev,
+			 "Unable to allocate E3 NAND MTD device structure.\n");
 		err = -ENOMEM;
 		goto out;
 	}
@@ -219,7 +220,8 @@ static int ams_delta_init(struct platform_device *pdev)
 		this->dev_ready = ams_delta_nand_ready;
 	} else {
 		this->dev_ready = NULL;
-		printk(KERN_NOTICE "Couldn't request gpio for Delta NAND ready.\n");
+		dev_notice(&pdev->dev,
+			   "Couldn't request gpio for Delta NAND ready.\n");
 	}
 	/* 25 us command delay time */
 	this->chip_delay = 30;
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index bc558c4..51f58ea 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -773,8 +773,9 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 		cafe->nand.bbt_td = &cafe_bbt_main_descr_512;
 		cafe->nand.bbt_md = &cafe_bbt_mirror_descr_512;
 	} else {
-		printk(KERN_WARNING "Unexpected NAND flash writesize %d. Aborting\n",
-		       mtd->writesize);
+		dev_warn(&cafe->pdev->dev,
+			 "Unexpected NAND flash writesize %d. Aborting\n",
+			 mtd->writesize);
 		goto out_free_dma;
 	}
 	cafe->nand.ecc.mode = NAND_ECC_HW_SYNDROME;
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index e7f3c98..c534c49 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -877,7 +877,7 @@ static void flctl_cmdfunc(struct mtd_info *mtd, unsigned int command,
 			else if (!flctl->seqin_column)
 				execmd_write_page_sector(mtd);
 			else
-				printk(KERN_ERR "Invalid address !?\n");
+				dev_err(&flctl->pdev->dev, "Invalid address !?\n");
 			break;
 		}
 		set_cmd_regs(mtd, command, (command << 8) | NAND_CMD_SEQIN);
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
To post to this group, send email to outreachy-kernel@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1519046339-9678-1-git-send-email-shreeya.patel23498%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

* [Outreachy kernel] Re: [PATCH NAND] mtd: nand: Replace printk() with appropriate dev_*macro()
  2018-02-19 13:18 [Outreachy kernel] [PATCH NAND] mtd: nand: Replace printk() with appropriate dev_*macro() Shreeya Patel
@ 2018-02-19 15:12 ` Boris Brezillon
  2018-02-19 19:39   ` Shreeya Patel
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2018-02-19 15:12 UTC (permalink / raw)
  To: Shreeya Patel
  Cc: boris.brezillon, richard, dwmw2, computersforpeace, marek.vasut,
	cyrille.pitchen, maximlevitsky, linux-mtd, linux-kernel,
	ezequiel, outreachy-kernel

On Mon, 19 Feb 2018 18:48:59 +0530
Shreeya Patel <shreeya.patel23498@gmail.com> wrote:

> Replace printks having a log level with the appropriate
> dev_*macro.
> Also, use pdev->dev as it is guaranteed in each case to be
> properly initialized when passed into dev_*macro().
> 
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
> ---
>  drivers/mtd/nand/ams-delta.c | 6 ++++--
>  drivers/mtd/nand/cafe_nand.c | 5 +++--
>  drivers/mtd/nand/sh_flctl.c  | 2 +-
>  3 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
> index dcec9cf..2419ca8 100644
> --- a/drivers/mtd/nand/ams-delta.c
> +++ b/drivers/mtd/nand/ams-delta.c
> @@ -185,7 +185,8 @@ static int ams_delta_init(struct platform_device *pdev)
>  	/* Allocate memory for MTD device structure and private data */
>  	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
>  	if (!this) {
> -		printk (KERN_WARNING "Unable to allocate E3 NAND MTD device structure.\n");
> +		dev_warn(&pdev->dev,
> +			 "Unable to allocate E3 NAND MTD device structure.\n");
>  		err = -ENOMEM;
>  		goto out;
>  	}
> @@ -219,7 +220,8 @@ static int ams_delta_init(struct platform_device *pdev)
>  		this->dev_ready = ams_delta_nand_ready;
>  	} else {
>  		this->dev_ready = NULL;
> -		printk(KERN_NOTICE "Couldn't request gpio for Delta NAND ready.\n");
> +		dev_notice(&pdev->dev,
> +			   "Couldn't request gpio for Delta NAND ready.\n");
>  	}
>  	/* 25 us command delay time */
>  	this->chip_delay = 30;
> diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
> index bc558c4..51f58ea 100644
> --- a/drivers/mtd/nand/cafe_nand.c
> +++ b/drivers/mtd/nand/cafe_nand.c
> @@ -773,8 +773,9 @@ static int cafe_nand_probe(struct pci_dev *pdev,
>  		cafe->nand.bbt_td = &cafe_bbt_main_descr_512;
>  		cafe->nand.bbt_md = &cafe_bbt_mirror_descr_512;
>  	} else {
> -		printk(KERN_WARNING "Unexpected NAND flash writesize %d. Aborting\n",
> -		       mtd->writesize);
> +		dev_warn(&cafe->pdev->dev,
> +			 "Unexpected NAND flash writesize %d. Aborting\n",
> +			 mtd->writesize);
>  		goto out_free_dma;

I see plenty of printk()s (or pr_xxx()s if this patch is applied after
the printk() -> pr_xxx() replacement) that are not converted to
dev_xxx() in this driver. If we start using dev_xxx() it should be used
consistently.

How about we convert all printk()s to pr_xxx()s first (what you do in
your first patch), including those you convert to dev_xxx() here, and
then we consider patching some of the drivers to use dev_xxx() instead
of pr_xxx().

>  	}
>  	cafe->nand.ecc.mode = NAND_ECC_HW_SYNDROME;
> diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
> index e7f3c98..c534c49 100644
> --- a/drivers/mtd/nand/sh_flctl.c
> +++ b/drivers/mtd/nand/sh_flctl.c
> @@ -877,7 +877,7 @@ static void flctl_cmdfunc(struct mtd_info *mtd, unsigned int command,
>  			else if (!flctl->seqin_column)
>  				execmd_write_page_sector(mtd);
>  			else
> -				printk(KERN_ERR "Invalid address !?\n");
> +				dev_err(&flctl->pdev->dev, "Invalid address !?\n");
>  			break;
>  		}
>  		set_cmd_regs(mtd, command, (command << 8) | NAND_CMD_SEQIN);



-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
To post to this group, send email to outreachy-kernel@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20180219161216.4f3ec2f3%40bbrezillon.
For more options, visit https://groups.google.com/d/optout.

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

* [Outreachy kernel] Re: [PATCH NAND] mtd: nand: Replace printk() with appropriate dev_*macro()
  2018-02-19 15:12 ` [Outreachy kernel] " Boris Brezillon
@ 2018-02-19 19:39   ` Shreeya Patel
  0 siblings, 0 replies; 3+ messages in thread
From: Shreeya Patel @ 2018-02-19 19:39 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: boris.brezillon, richard, dwmw2, computersforpeace, marek.vasut,
	cyrille.pitchen, maximlevitsky, linux-mtd, linux-kernel,
	ezequiel, outreachy-kernel

On Mon, 2018-02-19 at 16:12 +0100, Boris Brezillon wrote:
> On Mon, 19 Feb 2018 18:48:59 +0530
> Shreeya Patel <shreeya.patel23498@gmail.com> wrote:
> 
> > 
> > Replace printks having a log level with the appropriate
> > dev_*macro.
> > Also, use pdev->dev as it is guaranteed in each case to be
> > properly initialized when passed into dev_*macro().
> > 
> > Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
> > ---
> >  drivers/mtd/nand/ams-delta.c | 6 ++++--
> >  drivers/mtd/nand/cafe_nand.c | 5 +++--
> >  drivers/mtd/nand/sh_flctl.c  | 2 +-
> >  3 files changed, 8 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-
> > delta.c
> > index dcec9cf..2419ca8 100644
> > --- a/drivers/mtd/nand/ams-delta.c
> > +++ b/drivers/mtd/nand/ams-delta.c
> > @@ -185,7 +185,8 @@ static int ams_delta_init(struct
> > platform_device *pdev)
> >  	/* Allocate memory for MTD device structure and private
> > data */
> >  	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
> >  	if (!this) {
> > -		printk (KERN_WARNING "Unable to allocate E3 NAND
> > MTD device structure.\n");
> > +		dev_warn(&pdev->dev,
> > +			 "Unable to allocate E3 NAND MTD device
> > structure.\n");
> >  		err = -ENOMEM;
> >  		goto out;
> >  	}
> > @@ -219,7 +220,8 @@ static int ams_delta_init(struct
> > platform_device *pdev)
> >  		this->dev_ready = ams_delta_nand_ready;
> >  	} else {
> >  		this->dev_ready = NULL;
> > -		printk(KERN_NOTICE "Couldn't request gpio for
> > Delta NAND ready.\n");
> > +		dev_notice(&pdev->dev,
> > +			   "Couldn't request gpio for Delta NAND
> > ready.\n");
> >  	}
> >  	/* 25 us command delay time */
> >  	this->chip_delay = 30;
> > diff --git a/drivers/mtd/nand/cafe_nand.c
> > b/drivers/mtd/nand/cafe_nand.c
> > index bc558c4..51f58ea 100644
> > --- a/drivers/mtd/nand/cafe_nand.c
> > +++ b/drivers/mtd/nand/cafe_nand.c
> > @@ -773,8 +773,9 @@ static int cafe_nand_probe(struct pci_dev
> > *pdev,
> >  		cafe->nand.bbt_td = &cafe_bbt_main_descr_512;
> >  		cafe->nand.bbt_md = &cafe_bbt_mirror_descr_512;
> >  	} else {
> > -		printk(KERN_WARNING "Unexpected NAND flash
> > writesize %d. Aborting\n",
> > -		       mtd->writesize);
> > +		dev_warn(&cafe->pdev->dev,
> > +			 "Unexpected NAND flash writesize %d.
> > Aborting\n",
> > +			 mtd->writesize);
> >  		goto out_free_dma;
> I see plenty of printk()s (or pr_xxx()s if this patch is applied
> after
> the printk() -> pr_xxx() replacement) that are not converted to
> dev_xxx() in this driver. If we start using dev_xxx() it should be
> used
> consistently.
> 
> How about we convert all printk()s to pr_xxx()s first (what you do in
> your first patch), including those you convert to dev_xxx() here, and
> then we consider patching some of the drivers to use dev_xxx()
> instead
> of pr_xxx().

Yes, this will be better :)
I'll include these changes in my pr_xxx() patch.
Then we will work for dev_xxx().

Thanks

> 
> > 
> >  	}
> >  	cafe->nand.ecc.mode = NAND_ECC_HW_SYNDROME;
> > diff --git a/drivers/mtd/nand/sh_flctl.c
> > b/drivers/mtd/nand/sh_flctl.c
> > index e7f3c98..c534c49 100644
> > --- a/drivers/mtd/nand/sh_flctl.c
> > +++ b/drivers/mtd/nand/sh_flctl.c
> > @@ -877,7 +877,7 @@ static void flctl_cmdfunc(struct mtd_info *mtd,
> > unsigned int command,
> >  			else if (!flctl->seqin_column)
> >  				execmd_write_page_sector(mtd);
> >  			else
> > -				printk(KERN_ERR "Invalid address
> > !?\n");
> > +				dev_err(&flctl->pdev->dev,
> > "Invalid address !?\n");
> >  			break;
> >  		}
> >  		set_cmd_regs(mtd, command, (command << 8) |
> > NAND_CMD_SEQIN);
> 
> 

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
To post to this group, send email to outreachy-kernel@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1519069191.2102.3.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

end of thread, other threads:[~2018-02-19 19:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 13:18 [Outreachy kernel] [PATCH NAND] mtd: nand: Replace printk() with appropriate dev_*macro() Shreeya Patel
2018-02-19 15:12 ` [Outreachy kernel] " Boris Brezillon
2018-02-19 19:39   ` Shreeya Patel

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