Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1364611 > unrolled thread

Re: [PATCH 05/11] mtd: nand: use new BBT API instead of old ones

Started byBoris Brezillon <boris.brezillon@free-electrons.com>
First post2016-03-25 10:00 +0100
Last post2016-03-29 10:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 05/11] mtd: nand: use new BBT API instead of old ones Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-03-25 10:00 +0100
    Re: [PATCH 05/11] mtd: nand: use new BBT API instead of old ones Peter Pan <peterpansjtu@gmail.com> - 2016-03-28 10:20 +0200
      Re: [PATCH 05/11] mtd: nand: use new BBT API instead of old ones Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-03-29 10:10 +0200

#1364611 — Re: [PATCH 05/11] mtd: nand: use new BBT API instead of old ones

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2016-03-25 10:00 +0100
SubjectRe: [PATCH 05/11] mtd: nand: use new BBT API instead of old ones
Message-ID<rgvL4-7AD-11@gated-at.bofh.it>
On Mon, 14 Mar 2016 02:47:58 +0000
Peter Pan <peterpansjtu@gmail.com> wrote:

> Use new BBT APIs (nand_bbt_*()) in NAND. Keep old APIs (nand_*_bbt())
> exist temporarily.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Signed-off-by: Peter Pan <peterpandong@micron.com>
> ---
>  drivers/mtd/nand/docg4.c     |   7 +-
>  drivers/mtd/nand/nand_base.c | 151 ++++++++++++++++++++++++++++++++++++++++---
>  include/linux/mtd/nand.h     |  15 ++++-
>  3 files changed, 160 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index b6facac..6f0e3b9 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c

[...]

> +static int nand_default_bbt(struct mtd_info *mtd)
> +{
> +	struct nand_chip *chip = mtd_to_nand(mtd);
> +	struct nand_bbt *nand_bbt = NULL;
> +	struct nand_chip_layout_info *info =
> +		kzalloc(sizeof(struct nand_chip_layout_info), GFP_KERNEL);

No, this should be directly embedded in nand_chip, and should replace
the numchips/chipsize/... fields declared in there.

> +
> +	if (!info)
> +		return -ENOMEM;
> +
> +	info->numchips = chip->numchips;
> +	info->chipsize = chip->chipsize;
> +	info->chip_shift = chip->chip_shift;
> +	info->bbt_erase_shift = chip->phys_erase_shift;
> +	info->page_shift = chip->page_shift;
> +
> +	if (!chip->badblock_pattern &&
> +		nand_create_factory_badblock_pattern(chip))
> +		return -ENOMEM;
> +
> +	nand_bbt = nand_bbt_create(mtd, &default_bbt_ops,
> +				info, chip->bbt_options,
> +				chip->bbt_td, chip->bbt_md);
> +	if (IS_ERR(nand_bbt))
> +		return PTR_ERR(nand_bbt);
> +	chip->nand_bbt = nand_bbt;
> +
> +	return 0;
> +}



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [next] | [standalone]


#1365381

FromPeter Pan <peterpansjtu@gmail.com>
Date2016-03-28 10:20 +0200
Message-ID<rhAyZ-4dn-1@gated-at.bofh.it>
In reply to#1364611
On Fri, Mar 25, 2016 at 4:51 PM, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> On Mon, 14 Mar 2016 02:47:58 +0000
> Peter Pan <peterpansjtu@gmail.com> wrote:
>
>> Use new BBT APIs (nand_bbt_*()) in NAND. Keep old APIs (nand_*_bbt())
>> exist temporarily.
>>
>> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
>> Signed-off-by: Peter Pan <peterpandong@micron.com>
>> ---
>>  drivers/mtd/nand/docg4.c     |   7 +-
>>  drivers/mtd/nand/nand_base.c | 151 ++++++++++++++++++++++++++++++++++++++++---
>>  include/linux/mtd/nand.h     |  15 ++++-
>>  3 files changed, 160 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index b6facac..6f0e3b9 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>
> [...]
>
>> +static int nand_default_bbt(struct mtd_info *mtd)
>> +{
>> +     struct nand_chip *chip = mtd_to_nand(mtd);
>> +     struct nand_bbt *nand_bbt = NULL;
>> +     struct nand_chip_layout_info *info =
>> +             kzalloc(sizeof(struct nand_chip_layout_info), GFP_KERNEL);
>
> No, this should be directly embedded in nand_chip, and should replace
> the numchips/chipsize/... fields declared in there.

As I said in patch 2, I keep it like this temporarily. Will embedded it in
struct nand_chip later.

Thanks,
Peter Pan

[toc] | [prev] | [next] | [standalone]


#1365979

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2016-03-29 10:10 +0200
Message-ID<rhWST-3dU-21@gated-at.bofh.it>
In reply to#1365381
On Mon, 28 Mar 2016 16:12:08 +0800
Peter Pan <peterpansjtu@gmail.com> wrote:

> On Fri, Mar 25, 2016 at 4:51 PM, Boris Brezillon
> <boris.brezillon@free-electrons.com> wrote:
> > On Mon, 14 Mar 2016 02:47:58 +0000
> > Peter Pan <peterpansjtu@gmail.com> wrote:
> >
> >> Use new BBT APIs (nand_bbt_*()) in NAND. Keep old APIs (nand_*_bbt())
> >> exist temporarily.
> >>
> >> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> >> Signed-off-by: Peter Pan <peterpandong@micron.com>
> >> ---
> >>  drivers/mtd/nand/docg4.c     |   7 +-
> >>  drivers/mtd/nand/nand_base.c | 151 ++++++++++++++++++++++++++++++++++++++++---
> >>  include/linux/mtd/nand.h     |  15 ++++-
> >>  3 files changed, 160 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> >> index b6facac..6f0e3b9 100644
> >> --- a/drivers/mtd/nand/nand_base.c
> >> +++ b/drivers/mtd/nand/nand_base.c
> >
> > [...]
> >
> >> +static int nand_default_bbt(struct mtd_info *mtd)
> >> +{
> >> +     struct nand_chip *chip = mtd_to_nand(mtd);
> >> +     struct nand_bbt *nand_bbt = NULL;
> >> +     struct nand_chip_layout_info *info =
> >> +             kzalloc(sizeof(struct nand_chip_layout_info), GFP_KERNEL);
> >
> > No, this should be directly embedded in nand_chip, and should replace
> > the numchips/chipsize/... fields declared in there.
> 
> As I said in patch 2, I keep it like this temporarily. Will embedded it in
> struct nand_chip later.

Hm, I don't like the idea of duplicating the same information in two
different places, just because we don't want to touch NAND drivers/core
code. I'll have a look, and if it's not too invasive (not sure we have
that much code using those fields), I'd prefer having them patched right
now...


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web