{"id":806130,"url":"http://patchwork.ozlabs.org/api/patches/806130/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-mtd/patch/20170826151915.28400-1-miquel.raynal@free-electrons.com/","project":{"id":3,"url":"http://patchwork.ozlabs.org/api/projects/3/?format=json","name":"Linux MTD development","link_name":"linux-mtd","list_id":"linux-mtd.lists.infradead.org","list_email":"linux-mtd@lists.infradead.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170826151915.28400-1-miquel.raynal@free-electrons.com>","list_archive_url":null,"date":"2017-08-26T15:19:15","name":"[v5] mtd: nand: Use standard large page OOB layout when using NAND_ECC_NONE","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"4ebf28886063aedd5edb3aee3a09907f40cfb3d7","submitter":{"id":71917,"url":"http://patchwork.ozlabs.org/api/people/71917/?format=json","name":"Miquel Raynal","email":"miquel.raynal@free-electrons.com"},"delegate":{"id":58324,"url":"http://patchwork.ozlabs.org/api/users/58324/?format=json","username":"bbrezillon","first_name":"Boris","last_name":"Brezillon","email":"boris.brezillon@free-electrons.com"},"mbox":"http://patchwork.ozlabs.org/project/linux-mtd/patch/20170826151915.28400-1-miquel.raynal@free-electrons.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/806130/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/806130/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"VNUu2N/4\"; \n\tdkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xfhZ96JQrz9t5R\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 27 Aug 2017 01:21:05 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dlctK-0001gw-Dd; Sat, 26 Aug 2017 15:20:54 +0000","from mail.free-electrons.com ([62.4.15.54])\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dlcss-0000g0-C3\n\tfor linux-mtd@lists.infradead.org; Sat, 26 Aug 2017 15:20:28 +0000","by mail.free-electrons.com (Postfix, from userid 110)\n\tid 2AB4520A2E; Sat, 26 Aug 2017 17:20:02 +0200 (CEST)","from localhost.localdomain\n\t(AToulouse-657-1-1021-148.w90-11.abo.wanadoo.fr [90.11.227.148])\n\tby mail.free-electrons.com (Postfix) with ESMTPSA id 9CF80209E7;\n\tSat, 26 Aug 2017 17:19:51 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:\n\tSubject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:\n\tReferences:List-Owner; bh=tgUk3MyaXrVf0BUwdnjVAeK7NEL84/AZKheV2xRPWyI=;\n\tb=VNU\n\tu2N/4GY4Qdpcc4xtfaUKQ2LHCPKjiQN1f3S4hOAv/B1fJwfL+oPyVcjkh0/yAleTT+XQ/2FI7Fe6v\n\t862kSJopZNlS4XSziQ45jcr6vI8+Ict8AMJQQPTxld7lvpsgYj+QxtvYC1FE7xzWOV7i5o8BiO4Nh\n\tJPdxeTUdKf4MLKooTQdhITfOlFovY3Mhbd/aVoHci2kRwYlVpLmvOsD8/8Xz/cSyPexyJlX0xFxG9\n\tb8ufl2DBqzm1gpLItSdBcHI1zk6ahGLW0zD/aqri4kASNT837ZdgQzSB4XWBL5I3j2+ViTKr0zdVV\n\tRXIoTlMDGCy/9/wBo8kQcbU0L2r9Eag==;","X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tmail.free-electrons.com","X-Spam-Level":"","X-Spam-Status":"No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT,\n\tURIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0","From":"Miquel Raynal <miquel.raynal@free-electrons.com>","To":"Boris Brezillon <boris.brezillon@free-electrons.com>,\n\tRichard Weinberger <richard@nod.at>, linux-mtd@lists.infradead.org","Subject":"[PATCH v5] mtd: nand: Use standard large page OOB layout when using\n\tNAND_ECC_NONE","Date":"Sat, 26 Aug 2017 17:19:15 +0200","Message-Id":"<20170826151915.28400-1-miquel.raynal@free-electrons.com>","X-Mailer":"git-send-email 2.11.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170826_082026_561533_7FE35415 ","X-CRM114-Status":"GOOD (  13.07  )","X-Spam-Score":"-1.9 (-)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-1.9 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,\n\tlinux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,\n\tMiquel Raynal <miquel.raynal@free-electrons.com>,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tDavid Woodhouse <dwmw2@infradead.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"Use the core's large page OOB layout functions when not reserving any\nspace for ECC bytes in the OOB layout. Fix ->nand_ooblayout_ecc_lp()\nto return -ERANGE instead of a zero length in this case.\n\nSigned-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>\n---\n drivers/mtd/nand/nand_base.c | 15 ++++++++++++++-\n 1 file changed, 14 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c\nindex c5221795a1e8..39894c3f0fd5 100644\n--- a/drivers/mtd/nand/nand_base.c\n+++ b/drivers/mtd/nand/nand_base.c\n@@ -115,7 +115,7 @@ static int nand_ooblayout_ecc_lp(struct mtd_info *mtd, int section,\n \tstruct nand_chip *chip = mtd_to_nand(mtd);\n \tstruct nand_ecc_ctrl *ecc = &chip->ecc;\n \n-\tif (section)\n+\tif (section || !ecc->total)\n \t\treturn -ERANGE;\n \n \toobregion->length = ecc->total;\n@@ -4649,6 +4649,19 @@ int nand_scan_tail(struct mtd_info *mtd)\n \t\t\tmtd_set_ooblayout(mtd, &nand_ooblayout_lp_hamming_ops);\n \t\t\tbreak;\n \t\tdefault:\n+\t\t\t/*\n+\t\t\t * Expose the whole OOB area to users if ECC_NONE\n+\t\t\t * is passed. We could do that for all kind of\n+\t\t\t * ->oobsize, but we must keep the old large/small\n+\t\t\t * page with ECC layout when ->oobsize <= 128 for\n+\t\t\t * compatibility reasons.\n+\t\t\t */\n+\t\t\tif (ecc->mode == NAND_ECC_NONE) {\n+\t\t\t\tmtd_set_ooblayout(mtd,\n+\t\t\t\t\t\t&nand_ooblayout_lp_ops);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tWARN(1, \"No oob scheme defined for oobsize %d\\n\",\n \t\t\t\tmtd->oobsize);\n \t\t\tret = -EINVAL;\n","prefixes":["v5"]}