Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Marek Vasut <marek.vasut@gmail.com>,
	Brian Norris <computersforpeace@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Cyrille Pitchen <cyrille.pitchen@atmel.com>
Subject: Re: [PATCH] mtd: nand: fix write accessor sanity checks
Date: Tue, 7 Mar 2017 12:40:34 +0100	[thread overview]
Message-ID: <20170307124034.59b5b763@bbrezillon> (raw)
In-Reply-To: <1488885839-18470-1-git-send-email-yamada.masahiro@socionext.com>

On Tue,  7 Mar 2017 20:23:59 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:

> If the higher level accessor chip->write_page() is implemented,
> ecc->write_page() and ecc->write_page_raw() are not required.

I'm about to remove the chip->write_page() hook [1], I hope you're not
planning to use it.

[1]https://patchwork.ozlabs.org/patch/729966/

> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/mtd/nand/nand_base.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index a3c0f47..c32e700 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -4585,11 +4585,12 @@ static bool invalid_ecc_page_accessors(struct nand_chip *chip)
>  	 * default helpers are not suitable when the core does not
>  	 * send the READ0/PAGEPROG commands.
>  	 */
> -	return (!ecc->read_page || !ecc->write_page ||
> -		!ecc->read_page_raw || !ecc->write_page_raw ||
> +	return !ecc->read_page || !ecc->read_page_raw ||
>  		(NAND_HAS_SUBPAGE_READ(chip) && !ecc->read_subpage) ||
> -		(NAND_HAS_SUBPAGE_WRITE(chip) && !ecc->write_subpage &&
> -		 ecc->hwctl && ecc->calculate));
> +		(!chip->write_page &&
> +		 (!ecc->write_page || !ecc->write_page_raw ||
> +		  (NAND_HAS_SUBPAGE_WRITE(chip) && !ecc->write_subpage &&
> +		   ecc->hwctl && ecc->calculate)));
>  }
>  
>  /**
> @@ -4699,8 +4700,9 @@ int nand_scan_tail(struct mtd_info *mtd)
>  		if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) &&
>  		    (!ecc->read_page ||
>  		     ecc->read_page == nand_read_page_hwecc ||
> -		     !ecc->write_page ||
> -		     ecc->write_page == nand_write_page_hwecc)) {
> +		     (!chip->write_page &&
> +		      (!ecc->write_page ||
> +		       ecc->write_page == nand_write_page_hwecc)))) {
>  			WARN(1, "No ECC functions supplied; hardware ECC not possible\n");
>  			ret = -EINVAL;
>  			goto err_free;

  reply	other threads:[~2017-03-07 11:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 11:23 [PATCH] mtd: nand: fix write accessor sanity checks Masahiro Yamada
2017-03-07 11:40 ` Boris Brezillon [this message]
2017-03-07 13:03   ` Masahiro Yamada

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=20170307124034.59b5b763@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@atmel.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=yamada.masahiro@socionext.com \
    /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