linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: <linux-mtd@lists.infradead.org>,
	Bill Pringlemeir <bpringlemeir@nbsps.com>,
	Stefan Agner <stefan@agner.ch>
Subject: Re: [RFC PATCH] mtd: nand: vf610_nfc: use nand_check_erased_ecc_chunk() helper
Date: Wed, 30 Sep 2015 18:52:46 +0200	[thread overview]
Message-ID: <20150930185246.6bfdda29@bbrezillon> (raw)
In-Reply-To: <1443561116-139851-1-git-send-email-computersforpeace@gmail.com>

On Tue, 29 Sep 2015 14:11:56 -0700
Brian Norris <computersforpeace@gmail.com> wrote:

> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> I forgot about this feedback. How does this patch look? Just compile tested.

Looks good to me, but I can't test it either :-).

Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> 
>  drivers/mtd/nand/vf610_nfc.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
> index 42dad8e4b26f..598faf655f5b 100644
> --- a/drivers/mtd/nand/vf610_nfc.c
> +++ b/drivers/mtd/nand/vf610_nfc.c
> @@ -560,7 +560,6 @@ static inline int vf610_nfc_correct_data(struct mtd_info *mtd, uint8_t *dat,
>  	u32 ecc_status_off = NFC_MAIN_AREA(0) + ECC_SRAM_ADDR + ECC_STATUS;
>  	u8 ecc_status;
>  	u8 ecc_count;
> -	int flips;
>  	int flips_threshold = nfc->chip.ecc.strength / 2;
>  
>  	ecc_status = vf610_nfc_read(nfc, ecc_status_off) & 0xff;
> @@ -577,16 +576,9 @@ static inline int vf610_nfc_correct_data(struct mtd_info *mtd, uint8_t *dat,
>  	 * On an erased page, bit count (including OOB) should be zero or
>  	 * at least less then half of the ECC strength.
>  	 */
> -	flips = count_written_bits(dat, nfc->chip.ecc.size, flips_threshold);
> -	flips += count_written_bits(oob, mtd->oobsize, flips_threshold);
> -
> -	if (unlikely(flips > flips_threshold))
> -		return -EINVAL;
> -
> -	/* Erased page. */
> -	memset(dat, 0xff, nfc->chip.ecc.size);
> -	memset(oob, 0xff, mtd->oobsize);
> -	return flips;
> +	return nand_check_erased_ecc_chunk(dat, nfc->chip.ecc.size, oob,
> +					   mtd->oobsize, NULL, 0,
> +					   flips_threshold);
>  }
>  
>  static int vf610_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip,



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-09-30 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 21:11 [RFC PATCH] mtd: nand: vf610_nfc: use nand_check_erased_ecc_chunk() helper Brian Norris
2015-09-30 16:52 ` Boris Brezillon [this message]
2015-10-26 20:12   ` Brian Norris
2015-10-26 20:44     ` Stefan Agner

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=20150930185246.6bfdda29@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=bpringlemeir@nbsps.com \
    --cc=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=stefan@agner.ch \
    /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;
as well as URLs for NNTP newsgroup(s).