[PATCH v3 3/6] mtd: set the ecc step size for master/slave mtd_info

Gupta, Pekon pekon at ti.com
Mon Aug 12 05:24:24 EDT 2013


> 
> 于 2013年08月12日 15:00, Gupta, Pekon 写道:
> >> Set the ecc step size for master/slave mtd_info{}.
> >>
> >> Signed-off-by: Huang Shijie<b32955 at freescale.com>
> >> ---
> >>   drivers/mtd/mtdpart.c        |    1 +
> >>   drivers/mtd/nand/nand_base.c |    1 +
> >>   2 files changed, 2 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> >> index 3014933..63b42a6 100644
> >> --- a/drivers/mtd/mtdpart.c
> >> +++ b/drivers/mtd/mtdpart.c
> >> @@ -516,6 +516,7 @@ static struct mtd_part *allocate_partition(struct
> >> mtd_info *master,
> >>   	}
> >>
> >>   	slave->mtd.ecclayout = master->ecclayout;
> >> +	slave->mtd.ecc_step = master->ecc_step;
> >>   	slave->mtd.ecc_strength = master->ecc_strength;
> >>   	slave->mtd.bitflip_threshold = master->bitflip_threshold;
> >>
> >> diff --git a/drivers/mtd/nand/nand_base.c
> b/drivers/mtd/nand/nand_base.c
> >> index 8f04fb0..6e4095d 100644
> >> --- a/drivers/mtd/nand/nand_base.c
> >> +++ b/drivers/mtd/nand/nand_base.c
> >> @@ -3788,6 +3788,7 @@ int nand_scan_tail(struct mtd_info *mtd)
> >>   	/* propagate ecc info to mtd_info */
> >>   	mtd->ecclayout = chip->ecc.layout;
> >>   	mtd->ecc_strength = chip->ecc.strength;
> >> +	mtd->ecc_step = chip->ecc.size;
> > [Pekon]: Sorry for noticing this lately..
> > But do you really want to name ecc.*size* as *ecc_step* ?
> Please see :
> http://lists.infradead.org/pipermail/linux-mtd/2013-May/046928.html
> 
> Artem thought the ecc_step is more proper.
> 
[Pekon]: Following Artem's recommendations.. Can this be named as
chip->ecc.size = ecc_step_size.
then chip->ecc.bytes  = ecc_syndrome_size (or ecc_code_size)

In addition, chip->ecc.bytes should also be helpful for userspace
utility to determine how much bytes to reserve in spare-area for ECC.
So exposing that as sysfs entry is also good.

> 
> > Wouldn't it be better to follow same nomenclature everywhere ?
> > Like ' mtd->ecc_size = chip.ecc.size;'
> >
> > Because we also have ecc.steps as another parameter here.
> there is no need to expose the ecc.steps to use space.
> 
> Since the user can get the ecc_step, and pagesize, they can get the
> ecc.steps by:
> (pagesize / ecc_step).
> 
[Pekon]: Agreed, chip->ecc.steps need not be exposed to user-space.
It was mentioned bcoz ecc_step and chip->ecc.steps look similar.


with regards, pekon

> thanks
> Huang Shijie
> > And someone might want to expose it in user-space later.
> > (Just a naming change requested here to keep things in sync..)



More information about the linux-mtd mailing list