From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Miquel Raynal <miquel.raynal@free-electrons.com>
Cc: Richard Weinberger <richard@nod.at>,
linux-mtd@lists.infradead.org,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v5] mtd: nand: Use standard large page OOB layout when using NAND_ECC_NONE
Date: Fri, 22 Sep 2017 12:06:10 +0200 [thread overview]
Message-ID: <20170922120610.0700434a@bbrezillon> (raw)
In-Reply-To: <20170826151915.28400-1-miquel.raynal@free-electrons.com>
On Sat, 26 Aug 2017 17:19:15 +0200
Miquel Raynal <miquel.raynal@free-electrons.com> wrote:
> Use the core's large page OOB layout functions when not reserving any
> space for ECC bytes in the OOB layout. Fix ->nand_ooblayout_ecc_lp()
> to return -ERANGE instead of a zero length in this case.
>
Applied.
Thanks,
Boris
> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
> ---
> drivers/mtd/nand/nand_base.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index c5221795a1e8..39894c3f0fd5 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -115,7 +115,7 @@ static int nand_ooblayout_ecc_lp(struct mtd_info *mtd, int section,
> struct nand_chip *chip = mtd_to_nand(mtd);
> struct nand_ecc_ctrl *ecc = &chip->ecc;
>
> - if (section)
> + if (section || !ecc->total)
> return -ERANGE;
>
> oobregion->length = ecc->total;
> @@ -4649,6 +4649,19 @@ int nand_scan_tail(struct mtd_info *mtd)
> mtd_set_ooblayout(mtd, &nand_ooblayout_lp_hamming_ops);
> break;
> default:
> + /*
> + * Expose the whole OOB area to users if ECC_NONE
> + * is passed. We could do that for all kind of
> + * ->oobsize, but we must keep the old large/small
> + * page with ECC layout when ->oobsize <= 128 for
> + * compatibility reasons.
> + */
> + if (ecc->mode == NAND_ECC_NONE) {
> + mtd_set_ooblayout(mtd,
> + &nand_ooblayout_lp_ops);
> + break;
> + }
> +
> WARN(1, "No oob scheme defined for oobsize %d\n",
> mtd->oobsize);
> ret = -EINVAL;
prev parent reply other threads:[~2017-09-22 10:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-26 15:19 [PATCH v5] mtd: nand: Use standard large page OOB layout when using NAND_ECC_NONE Miquel Raynal
2017-09-22 10:06 ` Boris Brezillon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170922120610.0700434a@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@free-electrons.com \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox