From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-fx0-f214.google.com ([209.85.220.214]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NjdCX-00044P-Ti for linux-mtd@lists.infradead.org; Mon, 22 Feb 2010 18:40:18 +0000 Received: by mail-fx0-f214.google.com with SMTP id 6so5096986fxm.2 for ; Mon, 22 Feb 2010 10:40:13 -0800 (PST) From: Maxim Levitsky To: David Woodhouse Subject: [PATCH 08/15] MTD: nand: make MTD_OOB_PLACE work correctly. Date: Mon, 22 Feb 2010 20:39:35 +0200 Message-Id: <1266863982-5258-9-git-send-email-maximlevitsky@gmail.com> In-Reply-To: <1266863982-5258-1-git-send-email-maximlevitsky@gmail.com> References: <1266863982-5258-1-git-send-email-maximlevitsky@gmail.com> Cc: Maxim Levitsky , Alex Dubov , Vitaly Wool , joern , linux-kernel , stanley.miao@windriver.com, linux-mtd , Thomas Gleixner List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MTD_OOB_PLACE is supposed to read/write the raw oob data similiar to the MTD_OOB_RAW however due to a bug, currently it is not possible to read more data that is specified by the oob 'free' regions. Signed-off-by: Maxim Levitsky --- drivers/mtd/nand/nand_base.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 7442b3a..cada4cf 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1420,6 +1420,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, int ret = 0; uint32_t readlen = ops->len; uint32_t oobreadlen = ops->ooblen; + uint32_t max_oobsize = ops->mode == MTD_OOB_AUTO ? + mtd->oobavail : mtd->oobsize; + uint8_t *bufpoi, *oob, *buf; stats = mtd->ecc_stats; @@ -1470,10 +1473,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, buf += bytes; if (unlikely(oob)) { + /* Raw mode does data:oob:data:oob */ if (ops->mode != MTD_OOB_RAW) { int toread = min(oobreadlen, - chip->ecc.layout->oobavail); + max_oobsize); if (toread) { oob = nand_transfer_oob(chip, oob, ops, toread); -- 1.6.3.3