diff mbox

[U-Boot,PATCHv3,2/5] mtd: nand: remove nand size print from nand_init function

Message ID 1489738354-306-2-git-send-email-Zhiqiang.Hou@nxp.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

Z.Q. Hou March 17, 2017, 8:12 a.m. UTC
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

Add nand_size() function to move the nand size print into initr_nand().
Remove nand size print from nand_init() to allow other function to call
nand_init() without printing nand size.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
V3:
 - no change

 common/board_r.c        | 1 +
 drivers/mtd/nand/nand.c | 7 +++++--
 include/nand.h          | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

Comments

York Sun March 26, 2017, 6:33 p.m. UTC | #1
On 03/17/2017 01:27 AM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>
> Add nand_size() function to move the nand size print into initr_nand().
> Remove nand size print from nand_init() to allow other function to call
> nand_init() without printing nand size.
>
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> ---
> V3:
>  - no change
>

<snip>

> diff --git a/include/nand.h b/include/nand.h
> index b6eb223..a1f6632 100644
> --- a/include/nand.h
> +++ b/include/nand.h
> @@ -28,6 +28,7 @@
>  #endif
>
>  extern void nand_init(void);
> +extern unsigned long nand_size(void);
>

I don't think you need the "extern" in the header file.
I will fix this one for you.

York
Z.Q. Hou March 27, 2017, 3:08 a.m. UTC | #2
Hi York,

> -----Original Message-----

> From: york sun

> Sent: 2017年3月27日 2:33

> To: Z.Q. Hou <zhiqiang.hou@nxp.com>; u-boot@lists.denx.de;

> oss@buserror.net; Mingkai.hu@freescale.com; sjg@chromium.org;

> jh80.chung@samsung.com; Xiaobo Xie <xiaobo.xie@nxp.com>

> Subject: Re: [PATCHv3 2/5] mtd: nand: remove nand size print from nand_init

> function

> 

> On 03/17/2017 01:27 AM, Zhiqiang Hou wrote:

> > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

> >

> > Add nand_size() function to move the nand size print into initr_nand().

> > Remove nand size print from nand_init() to allow other function to

> > call

> > nand_init() without printing nand size.

> >

> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

> > ---

> > V3:

> >  - no change

> >

> 

> <snip>

> 

> > diff --git a/include/nand.h b/include/nand.h index b6eb223..a1f6632

> > 100644

> > --- a/include/nand.h

> > +++ b/include/nand.h

> > @@ -28,6 +28,7 @@

> >  #endif

> >

> >  extern void nand_init(void);

> > +extern unsigned long nand_size(void);

> >

> 

> I don't think you need the "extern" in the header file.

> I will fix this one for you.


Thanks a lot!

B.R 
Zhiqiang
York Sun March 28, 2017, 5:59 p.m. UTC | #3
On 03/17/2017 01:27 AM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>
> Add nand_size() function to move the nand size print into initr_nand().
> Remove nand size print from nand_init() to allow other function to call
> nand_init() without printing nand size.
>
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> ---
> V3:
>  - no change
>

Applied to fsl-qoriq master, awaiting upstream. Thanks.

York
diff mbox

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 5c9e698..3344913 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -426,6 +426,7 @@  static int initr_nand(void)
 {
 	puts("NAND:  ");
 	nand_init();
+	printf("%lu MiB\n", nand_size() / 1024);
 	return 0;
 }
 #endif
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
index 3ea2dcf..168bac6 100644
--- a/drivers/mtd/nand/nand.c
+++ b/drivers/mtd/nand/nand.c
@@ -131,6 +131,11 @@  static void create_mtd_concat(void)
 }
 #endif
 
+unsigned long nand_size(void)
+{
+	return total_nand_size;
+}
+
 void nand_init(void)
 {
 	static int initialized;
@@ -152,8 +157,6 @@  void nand_init(void)
 		nand_init_chip(i);
 #endif
 
-	printf("%lu MiB\n", total_nand_size / 1024);
-
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
 	/*
 	 * Select the chip in the board/cpu specific driver
diff --git a/include/nand.h b/include/nand.h
index b6eb223..a1f6632 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -28,6 +28,7 @@ 
 #endif
 
 extern void nand_init(void);
+extern unsigned long nand_size(void);
 
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>