lkml.org 
[lkml]   [2016]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/11] mtd: nand: use new BBT API instead of old ones
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

\
 
 \ /
  Last update: 2016-03-25 10:01    [W:0.115 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site