Re: [PATCH 02/11] mtd: nand_bbt: introduce BBT related data structure
From: Boris Brezillon
Date: Tue Jun 21 2016 - 09:27:32 EST
On Fri, 17 Jun 2016 10:38:27 +0800
Peter Pan <peterpansjtu@xxxxxxxxx> wrote:
> >>
> >> Again, I'm sorry that you had to be the one supporting this transition,
> >> but I don't want to introduce any more quick-and-dirty hacks that we'll
> >> have to maintain until someone decides to tackle the real problem.
> >
> > No sorry needed. I'd like to do the contribution.
>
> I did test on your nand generic patches. And I found two error about nand helper
> functions. Below is my fixing. After my fixing, BBT is functional on
> my platform.
>
Thanks for testing it (and fixing the implementation). I'll try to send
the series after the 4.8 merge window, unless you want to take care of
it and send a version right now.
>
>
> From 2162e8ece4ffa09bb00abe383714a95f4b74aad8 Mon Sep 17 00:00:00 2001
> From: Peter Pan <peterpandong@xxxxxxxxxx>
> Date: Fri, 17 Jun 2016 10:31:59 +0800
> Subject: [PATCH] mtd: nand: fix nand helper function
>
> nand_page_size() and nand_eraseblock_to_offs() return
> fault value. Fix them.
>
> Signed-off-by: Peter Pan <peterpandong@xxxxxxxxxx>
> ---
> include/linux/mtd/nand.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index 583eb40..ffee2a7 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -162,7 +162,7 @@ static inline size_t nand_pages_to_len(struct
> nand_device *nand, int npages)
> */
> static inline size_t nand_page_size(struct nand_device *nand)
> {
> - return nand->memorg.eraseblocksize;
> + return nand->memorg.pagesize;
> }
>
> /**
> @@ -197,7 +197,7 @@ static inline size_t nand_eraseblock_size(struct
> nand_device *nand)
> static inline loff_t nand_eraseblock_to_offs(struct nand_device *nand,
> int block)
> {
> - return (loff_t)nand->memorg.pagesize * block;
> + return (loff_t)nand->memorg.eraseblocksize * block;
> }
>
> /**