Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756111AbbLHAAP (ORCPT ); Mon, 7 Dec 2015 19:00:15 -0500 Received: from mail-io0-f179.google.com ([209.85.223.179]:35767 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbbLHAAN (ORCPT ); Mon, 7 Dec 2015 19:00:13 -0500 MIME-Version: 1.0 In-Reply-To: <1449527178-5930-22-git-send-email-boris.brezillon@free-electrons.com> References: <1449527178-5930-1-git-send-email-boris.brezillon@free-electrons.com> <1449527178-5930-22-git-send-email-boris.brezillon@free-electrons.com> From: Julian Calaby Date: Tue, 8 Dec 2015 10:59:53 +1100 Message-ID: Subject: Re: [linux-sunxi] [PATCH 21/23] staging: mt29f_spinand: switch to mtd_ooblayout_ops To: boris.brezillon@free-electrons.com Cc: David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org, Daniel Mack , Haojian Zhuang , Robert Jarzmik , Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, "Mailing List, Arm" , Ralf Baechle , linux-mips@linux-mips.org, Josh Wu , Ezequiel Garcia , Maxime Ripard , Chen-Yu Tsai , linux-sunxi , Stefan Agner , Kyungmin Park , Greg Kroah-Hartman , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , punnaiah choudary kalluri Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2020 Lines: 62 Hi Boris, On Tue, Dec 8, 2015 at 9:26 AM, Boris Brezillon wrote: > Signed-off-by: Boris Brezillon > --- > drivers/staging/mt29f_spinand/mt29f_spinand.c | 44 ++++++++++++++++----------- > 1 file changed, 26 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c > index cb9d5ab..967d50a 100644 > --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c > +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c > @@ -42,23 +42,29 @@ static inline struct spinand_state *mtd_to_state(struct mtd_info *mtd) > static int enable_hw_ecc; > static int enable_read_hw_ecc; > > -static struct nand_ecclayout spinand_oob_64 = { > - .eccbytes = 24, > - .eccpos = { > - 1, 2, 3, 4, 5, 6, > - 17, 18, 19, 20, 21, 22, > - 33, 34, 35, 36, 37, 38, > - 49, 50, 51, 52, 53, 54, }, > - .oobfree = { > - {.offset = 8, > - .length = 8}, > - {.offset = 24, > - .length = 8}, > - {.offset = 40, > - .length = 8}, > - {.offset = 56, > - .length = 8}, > - } > +static int spinand_oob_64_eccpos(struct mtd_info *mtd, int eccbyte) > +{ > + if (eccbyte > 23) > + return -ERANGE; > + > + return ((eccbyte / 6) * 16) + 1; Are you sure this is correct? My reading of this is that we'd get 1 for eccbytes 0 through 5. Would ((eccbyte / 6) * 16) + (eccbyte % 6) + 1 be more correct? Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/