RE: [PATCH 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder

2015-09-28 Thread peterpandong
Hi Brian,

Thanks for your reply.

On Fri, Sep 25, 2015 at 06:48:05AM +, Brian Norris < 
computersforpe...@gmail.com >
wrote:
> Hi Peter,
> 
> First of all, thanks for taking the time to try to address my
> long-delayed comments. I hope to give this a proper look soon. (I also
> hope you can fix the email threading soon! I know that's a pain...)

Sorry for bringing inconvenience . I'm working on this now. I'm trying to enable
git-send-email on my server. Once it done, I will resend this series. But 
please look
at this series first if you have time.

> 
> But first, a simpler comment:
> 
> On Fri, Sep 25, 2015 at 06:48:05AM +, Peter Pan 潘栋 (peterpandong)
> wrote:
> > Since struct nand_chip is removed from nand_bbt.c, BBT is now
> > shareable. Both NAND and SPI NAND can use it. So move nand_bbt.c
> > from nand/ foler to mtd/ folder and create MTD_NAND_BBT config.
> > Both NAND and SPI NAND should depend on MTD_NAND_BBT.
> >
> > Signed-off-by: Peter Pan 
> > ---
> >  drivers/mtd/Kconfig |7 +
> >  drivers/mtd/Makefile|1 +
> >  drivers/mtd/nand/Kconfig|2 +-
> >  drivers/mtd/nand/Makefile   |2 +-
> >  drivers/mtd/nand/nand_bbt.c | 1289 
> > ---
> >  drivers/mtd/nand_bbt.c  | 1289
> +++
> >  6 files changed, 1299 insertions(+), 1291 deletions(-)
> >  delete mode 100644 drivers/mtd/nand/nand_bbt.c
> >  create mode 100644 drivers/mtd/nand_bbt.c
> >
> [...]
> > diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
> > deleted file mode 100644
> > index 47c1084..000
> > --- a/drivers/mtd/nand/nand_bbt.c
> > +++ /dev/null
> > @@ -1,1289 +0,0 @@
> 
> [snip deleting entire file]
> 
> > diff --git a/drivers/mtd/nand_bbt.c b/drivers/mtd/nand_bbt.c
> > new file mode 100644
> > index 000..47c1084
> > --- /dev/null
> > +++ b/drivers/mtd/nand_bbt.c
> > @@ -0,0 +1,1289 @@
> 
> [snip adding the whole file again -- exactly the same I hope?]

Yes. The whole file is exactly the same.

> 
> When moving files, it helps if you can use the '-M' (or
> '--find-renames') option to git-format-patch. That will give much
> smaller output that's easier to review. And if you had to change
> anything in the move, it should also help highlight exactly what
> changed, instead of including the entire file "diff".

Thanks a lot for your suggestion. I'm quite new with patch submit.
So please feel free to point out my missing/mistake. Thanks in advance.

> 
> Regards,
> Brian
> 
> P.S. Incidentally, this should also work around your issues with the
> copyright symbol. But then, I suspect that some people have used these
> sorts of non-ASCII characters just to fish out issues with mail
> clients/MTAs like yours :)
N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

RE: [PATCH 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder

2015-09-28 Thread peterpandong
Hi Brian,

Thanks for your reply.

On Fri, Sep 25, 2015 at 06:48:05AM +, Brian Norris < 
computersforpe...@gmail.com >
wrote:
> Hi Peter,
> 
> First of all, thanks for taking the time to try to address my
> long-delayed comments. I hope to give this a proper look soon. (I also
> hope you can fix the email threading soon! I know that's a pain...)

Sorry for bringing inconvenience . I'm working on this now. I'm trying to enable
git-send-email on my server. Once it done, I will resend this series. But 
please look
at this series first if you have time.

> 
> But first, a simpler comment:
> 
> On Fri, Sep 25, 2015 at 06:48:05AM +, Peter Pan 潘栋 (peterpandong)
> wrote:
> > Since struct nand_chip is removed from nand_bbt.c, BBT is now
> > shareable. Both NAND and SPI NAND can use it. So move nand_bbt.c
> > from nand/ foler to mtd/ folder and create MTD_NAND_BBT config.
> > Both NAND and SPI NAND should depend on MTD_NAND_BBT.
> >
> > Signed-off-by: Peter Pan 
> > ---
> >  drivers/mtd/Kconfig |7 +
> >  drivers/mtd/Makefile|1 +
> >  drivers/mtd/nand/Kconfig|2 +-
> >  drivers/mtd/nand/Makefile   |2 +-
> >  drivers/mtd/nand/nand_bbt.c | 1289 
> > ---
> >  drivers/mtd/nand_bbt.c  | 1289
> +++
> >  6 files changed, 1299 insertions(+), 1291 deletions(-)
> >  delete mode 100644 drivers/mtd/nand/nand_bbt.c
> >  create mode 100644 drivers/mtd/nand_bbt.c
> >
> [...]
> > diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
> > deleted file mode 100644
> > index 47c1084..000
> > --- a/drivers/mtd/nand/nand_bbt.c
> > +++ /dev/null
> > @@ -1,1289 +0,0 @@
> 
> [snip deleting entire file]
> 
> > diff --git a/drivers/mtd/nand_bbt.c b/drivers/mtd/nand_bbt.c
> > new file mode 100644
> > index 000..47c1084
> > --- /dev/null
> > +++ b/drivers/mtd/nand_bbt.c
> > @@ -0,0 +1,1289 @@
> 
> [snip adding the whole file again -- exactly the same I hope?]

Yes. The whole file is exactly the same.

> 
> When moving files, it helps if you can use the '-M' (or
> '--find-renames') option to git-format-patch. That will give much
> smaller output that's easier to review. And if you had to change
> anything in the move, it should also help highlight exactly what
> changed, instead of including the entire file "diff".

Thanks a lot for your suggestion. I'm quite new with patch submit.
So please feel free to point out my missing/mistake. Thanks in advance.

> 
> Regards,
> Brian
> 
> P.S. Incidentally, this should also work around your issues with the
> copyright symbol. But then, I suspect that some people have used these
> sorts of non-ASCII characters just to fish out issues with mail
> clients/MTAs like yours :)
N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

Re: [PATCH 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder

2015-09-25 Thread Brian Norris
Hi Peter,

First of all, thanks for taking the time to try to address my
long-delayed comments. I hope to give this a proper look soon. (I also
hope you can fix the email threading soon! I know that's a pain...)

But first, a simpler comment:

On Fri, Sep 25, 2015 at 06:48:05AM +, Peter Pan 潘栋 (peterpandong) wrote:
> Since struct nand_chip is removed from nand_bbt.c, BBT is now
> shareable. Both NAND and SPI NAND can use it. So move nand_bbt.c
> from nand/ foler to mtd/ folder and create MTD_NAND_BBT config.
> Both NAND and SPI NAND should depend on MTD_NAND_BBT.
> 
> Signed-off-by: Peter Pan 
> ---
>  drivers/mtd/Kconfig |7 +
>  drivers/mtd/Makefile|1 +
>  drivers/mtd/nand/Kconfig|2 +-
>  drivers/mtd/nand/Makefile   |2 +-
>  drivers/mtd/nand/nand_bbt.c | 1289 
> ---
>  drivers/mtd/nand_bbt.c  | 1289 
> +++
>  6 files changed, 1299 insertions(+), 1291 deletions(-)
>  delete mode 100644 drivers/mtd/nand/nand_bbt.c
>  create mode 100644 drivers/mtd/nand_bbt.c
> 
[...]
> diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
> deleted file mode 100644
> index 47c1084..000
> --- a/drivers/mtd/nand/nand_bbt.c
> +++ /dev/null
> @@ -1,1289 +0,0 @@

[snip deleting entire file]

> diff --git a/drivers/mtd/nand_bbt.c b/drivers/mtd/nand_bbt.c
> new file mode 100644
> index 000..47c1084
> --- /dev/null
> +++ b/drivers/mtd/nand_bbt.c
> @@ -0,0 +1,1289 @@

[snip adding the whole file again -- exactly the same I hope?]

When moving files, it helps if you can use the '-M' (or
'--find-renames') option to git-format-patch. That will give much
smaller output that's easier to review. And if you had to change
anything in the move, it should also help highlight exactly what
changed, instead of including the entire file "diff".

Regards,
Brian

P.S. Incidentally, this should also work around your issues with the
copyright symbol. But then, I suspect that some people have used these
sorts of non-ASCII characters just to fish out issues with mail
clients/MTAs like yours :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder

2015-09-25 Thread peterpandong
Since struct nand_chip is removed from nand_bbt.c, BBT is now
shareable. Both NAND and SPI NAND can use it. So move nand_bbt.c
from nand/ foler to mtd/ folder and create MTD_NAND_BBT config.
Both NAND and SPI NAND should depend on MTD_NAND_BBT.

Signed-off-by: Peter Pan 
---
 drivers/mtd/Kconfig |7 +
 drivers/mtd/Makefile|1 +
 drivers/mtd/nand/Kconfig|2 +-
 drivers/mtd/nand/Makefile   |2 +-
 drivers/mtd/nand/nand_bbt.c | 1289 ---
 drivers/mtd/nand_bbt.c  | 1289 +++
 6 files changed, 1299 insertions(+), 1291 deletions(-)
 delete mode 100644 drivers/mtd/nand/nand_bbt.c
 create mode 100644 drivers/mtd/nand_bbt.c

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index a03ad29..eb6a33c 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -322,6 +322,13 @@ config MTD_PARTITIONED_MASTER
  the parent of the partition device be the master device, rather than
  what lies behind the master.
 
+config MTD_NAND_BBT
+   tristate "Bad Block Table support for NAND based devices"
+   depends on MTD
+   help
+ Since struct nand_chip is removed from nand_bbt.c, BBT is now
+ shareable. Both NAND and SPI NAND can use it.
+
 source "drivers/mtd/chips/Kconfig"
 
 source "drivers/mtd/maps/Kconfig"
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 99bb9a1..55aed6f 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_SSFDC)   += ssfdc.o
 obj-$(CONFIG_SM_FTL)   += sm_ftl.o
 obj-$(CONFIG_MTD_OOPS) += mtdoops.o
 obj-$(CONFIG_MTD_SWAP) += mtdswap.o
+obj-$(CONFIG_MTD_NAND_BBT) += nand_bbt.o
 
 nftl-objs  := nftlcore.o nftlmount.o
 inftl-objs := inftlcore.o inftlmount.o
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 3324281..6ca3a6f 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -12,7 +12,7 @@ config MTD_NAND_ECC_SMC
 
 menuconfig MTD_NAND
tristate "NAND Device Support"
-   depends on MTD
+   depends on MTD && MTD_NAND_BBT
select MTD_NAND_IDS
select MTD_NAND_ECC
help
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 075a027..c6887d0 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -55,4 +55,4 @@ obj-$(CONFIG_MTD_NAND_SUNXI)  += sunxi_nand.o
 obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
 obj-$(CONFIG_MTD_NAND_BRCMNAND)+= brcmnand/
 
-nand-objs := nand_base.o nand_bbt.o nand_timings.o
+nand-objs := nand_base.o nand_timings.o
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
deleted file mode 100644
index 47c1084..000
--- a/drivers/mtd/nand/nand_bbt.c
+++ /dev/null
@@ -1,1289 +0,0 @@
-/*
- *  Overview:
- *   Bad block table support for the NAND driver
- *
- *  Copyright ? 2004 Thomas Gleixner (t...@linutronix.de)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Description:
- *
- * When nand_scan_bbt is called, then it tries to find the bad block table
- * depending on the options in the BBT descriptor(s). If no flash based BBT
- * (NAND_BBT_USE_FLASH) is specified then the device is scanned for factory
- * marked good / bad blocks. This information is used to create a memory BBT.
- * Once a new bad block is discovered then the "factory" information is updated
- * on the device.
- * If a flash based BBT is specified then the function first tries to find the
- * BBT on flash. If a BBT is found then the contents are read and the memory
- * based BBT is created. If a mirrored BBT is selected then the mirror is
- * searched too and the versions are compared. If the mirror has a greater
- * version number, then the mirror BBT is used to build the memory based BBT.
- * If the tables are not versioned, then we "or" the bad block information.
- * If one of the BBTs is out of date or does not exist it is (re)created.
- * If no BBT exists at all then the device is scanned for factory marked
- * good / bad blocks and the bad block tables are created.
- *
- * For manufacturer created BBTs like the one found on M-SYS DOC devices
- * the BBT is searched and read but never created
- *
- * The auto generated bad block table is located in the last good blocks
- * of the device. The table is mirrored, so it can be updated eventually.
- * The table is marked in the OOB area with an ident pattern and a version
- * number which indicates which of both tables is more up to date. If the NAND
- * controller needs the complete OOB area for the ECC information then the
- * option NAND_BBT_NO_OOB should be used (along with NAND_BBT_USE_FLASH, of
- * course): it moves the ident pattern and the version byte into the data area
- * and the 

Re: [PATCH 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder

2015-09-25 Thread Brian Norris
Hi Peter,

First of all, thanks for taking the time to try to address my
long-delayed comments. I hope to give this a proper look soon. (I also
hope you can fix the email threading soon! I know that's a pain...)

But first, a simpler comment:

On Fri, Sep 25, 2015 at 06:48:05AM +, Peter Pan 潘栋 (peterpandong) wrote:
> Since struct nand_chip is removed from nand_bbt.c, BBT is now
> shareable. Both NAND and SPI NAND can use it. So move nand_bbt.c
> from nand/ foler to mtd/ folder and create MTD_NAND_BBT config.
> Both NAND and SPI NAND should depend on MTD_NAND_BBT.
> 
> Signed-off-by: Peter Pan 
> ---
>  drivers/mtd/Kconfig |7 +
>  drivers/mtd/Makefile|1 +
>  drivers/mtd/nand/Kconfig|2 +-
>  drivers/mtd/nand/Makefile   |2 +-
>  drivers/mtd/nand/nand_bbt.c | 1289 
> ---
>  drivers/mtd/nand_bbt.c  | 1289 
> +++
>  6 files changed, 1299 insertions(+), 1291 deletions(-)
>  delete mode 100644 drivers/mtd/nand/nand_bbt.c
>  create mode 100644 drivers/mtd/nand_bbt.c
> 
[...]
> diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
> deleted file mode 100644
> index 47c1084..000
> --- a/drivers/mtd/nand/nand_bbt.c
> +++ /dev/null
> @@ -1,1289 +0,0 @@

[snip deleting entire file]

> diff --git a/drivers/mtd/nand_bbt.c b/drivers/mtd/nand_bbt.c
> new file mode 100644
> index 000..47c1084
> --- /dev/null
> +++ b/drivers/mtd/nand_bbt.c
> @@ -0,0 +1,1289 @@

[snip adding the whole file again -- exactly the same I hope?]

When moving files, it helps if you can use the '-M' (or
'--find-renames') option to git-format-patch. That will give much
smaller output that's easier to review. And if you had to change
anything in the move, it should also help highlight exactly what
changed, instead of including the entire file "diff".

Regards,
Brian

P.S. Incidentally, this should also work around your issues with the
copyright symbol. But then, I suspect that some people have used these
sorts of non-ASCII characters just to fish out issues with mail
clients/MTAs like yours :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder

2015-09-25 Thread peterpandong
Since struct nand_chip is removed from nand_bbt.c, BBT is now
shareable. Both NAND and SPI NAND can use it. So move nand_bbt.c
from nand/ foler to mtd/ folder and create MTD_NAND_BBT config.
Both NAND and SPI NAND should depend on MTD_NAND_BBT.

Signed-off-by: Peter Pan 
---
 drivers/mtd/Kconfig |7 +
 drivers/mtd/Makefile|1 +
 drivers/mtd/nand/Kconfig|2 +-
 drivers/mtd/nand/Makefile   |2 +-
 drivers/mtd/nand/nand_bbt.c | 1289 ---
 drivers/mtd/nand_bbt.c  | 1289 +++
 6 files changed, 1299 insertions(+), 1291 deletions(-)
 delete mode 100644 drivers/mtd/nand/nand_bbt.c
 create mode 100644 drivers/mtd/nand_bbt.c

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index a03ad29..eb6a33c 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -322,6 +322,13 @@ config MTD_PARTITIONED_MASTER
  the parent of the partition device be the master device, rather than
  what lies behind the master.
 
+config MTD_NAND_BBT
+   tristate "Bad Block Table support for NAND based devices"
+   depends on MTD
+   help
+ Since struct nand_chip is removed from nand_bbt.c, BBT is now
+ shareable. Both NAND and SPI NAND can use it.
+
 source "drivers/mtd/chips/Kconfig"
 
 source "drivers/mtd/maps/Kconfig"
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 99bb9a1..55aed6f 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_SSFDC)   += ssfdc.o
 obj-$(CONFIG_SM_FTL)   += sm_ftl.o
 obj-$(CONFIG_MTD_OOPS) += mtdoops.o
 obj-$(CONFIG_MTD_SWAP) += mtdswap.o
+obj-$(CONFIG_MTD_NAND_BBT) += nand_bbt.o
 
 nftl-objs  := nftlcore.o nftlmount.o
 inftl-objs := inftlcore.o inftlmount.o
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 3324281..6ca3a6f 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -12,7 +12,7 @@ config MTD_NAND_ECC_SMC
 
 menuconfig MTD_NAND
tristate "NAND Device Support"
-   depends on MTD
+   depends on MTD && MTD_NAND_BBT
select MTD_NAND_IDS
select MTD_NAND_ECC
help
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 075a027..c6887d0 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -55,4 +55,4 @@ obj-$(CONFIG_MTD_NAND_SUNXI)  += sunxi_nand.o
 obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
 obj-$(CONFIG_MTD_NAND_BRCMNAND)+= brcmnand/
 
-nand-objs := nand_base.o nand_bbt.o nand_timings.o
+nand-objs := nand_base.o nand_timings.o
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
deleted file mode 100644
index 47c1084..000
--- a/drivers/mtd/nand/nand_bbt.c
+++ /dev/null
@@ -1,1289 +0,0 @@
-/*
- *  Overview:
- *   Bad block table support for the NAND driver
- *
- *  Copyright ? 2004 Thomas Gleixner (t...@linutronix.de)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Description:
- *
- * When nand_scan_bbt is called, then it tries to find the bad block table
- * depending on the options in the BBT descriptor(s). If no flash based BBT
- * (NAND_BBT_USE_FLASH) is specified then the device is scanned for factory
- * marked good / bad blocks. This information is used to create a memory BBT.
- * Once a new bad block is discovered then the "factory" information is updated
- * on the device.
- * If a flash based BBT is specified then the function first tries to find the
- * BBT on flash. If a BBT is found then the contents are read and the memory
- * based BBT is created. If a mirrored BBT is selected then the mirror is
- * searched too and the versions are compared. If the mirror has a greater
- * version number, then the mirror BBT is used to build the memory based BBT.
- * If the tables are not versioned, then we "or" the bad block information.
- * If one of the BBTs is out of date or does not exist it is (re)created.
- * If no BBT exists at all then the device is scanned for factory marked
- * good / bad blocks and the bad block tables are created.
- *
- * For manufacturer created BBTs like the one found on M-SYS DOC devices
- * the BBT is searched and read but never created
- *
- * The auto generated bad block table is located in the last good blocks
- * of the device. The table is mirrored, so it can be updated eventually.
- * The table is marked in the OOB area with an ident pattern and a version
- * number which indicates which of both tables is more up to date. If the NAND
- * controller needs the complete OOB area for the ECC information then the
- * option NAND_BBT_NO_OOB should be used (along with NAND_BBT_USE_FLASH, of
- * course): it moves the ident pattern and the version byte into