All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	<linux-mtd@lists.infradead.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>, stable@vger.kernel.org
Subject: [PATCH v3 6/7] mtd: rawnand: tmio: Fix external use of SW Hamming ECC helper
Date: Tue, 13 Apr 2021 18:18:39 +0200	[thread overview]
Message-ID: <20210413161840.345208-7-miquel.raynal@bootlin.com> (raw)
In-Reply-To: <20210413161840.345208-1-miquel.raynal@bootlin.com>

Since the Hamming software ECC engine has been updated to become a
proper and independent ECC engine, it is now mandatory to either
initialize the engine before using any one of his functions or use one
of the bare helpers which only perform the calculations. As there is no
actual need for a proper ECC initialization, let's just use the bare
helper instead of the rawnand one.

Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/tmio_nand.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/tmio_nand.c b/drivers/mtd/nand/raw/tmio_nand.c
index de8e919d0ebe..6d93dd31969b 100644
--- a/drivers/mtd/nand/raw/tmio_nand.c
+++ b/drivers/mtd/nand/raw/tmio_nand.c
@@ -34,6 +34,7 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/mtd/mtd.h>
+#include <linux/mtd/nand-ecc-sw-hamming.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/slab.h>
@@ -292,11 +293,12 @@ static int tmio_nand_correct_data(struct nand_chip *chip, unsigned char *buf,
 	int r0, r1;
 
 	/* assume ecc.size = 512 and ecc.bytes = 6 */
-	r0 = rawnand_sw_hamming_correct(chip, buf, read_ecc, calc_ecc);
+	r0 = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
+				    chip->ecc.size, false);
 	if (r0 < 0)
 		return r0;
-	r1 = rawnand_sw_hamming_correct(chip, buf + 256, read_ecc + 3,
-					calc_ecc + 3);
+	r1 = ecc_sw_hamming_correct(buf + 256, read_ecc + 3, calc_ecc + 3,
+				    chip->ecc.size, false);
 	if (r1 < 0)
 		return r1;
 	return r0 + r1;
-- 
2.27.0


WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	<linux-mtd@lists.infradead.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>, stable@vger.kernel.org
Subject: [PATCH v3 6/7] mtd: rawnand: tmio: Fix external use of SW Hamming ECC helper
Date: Tue, 13 Apr 2021 18:18:39 +0200	[thread overview]
Message-ID: <20210413161840.345208-7-miquel.raynal@bootlin.com> (raw)
In-Reply-To: <20210413161840.345208-1-miquel.raynal@bootlin.com>

Since the Hamming software ECC engine has been updated to become a
proper and independent ECC engine, it is now mandatory to either
initialize the engine before using any one of his functions or use one
of the bare helpers which only perform the calculations. As there is no
actual need for a proper ECC initialization, let's just use the bare
helper instead of the rawnand one.

Fixes: 90ccf0a0192f ("mtd: nand: ecc-hamming: Rename the exported functions")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/tmio_nand.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/tmio_nand.c b/drivers/mtd/nand/raw/tmio_nand.c
index de8e919d0ebe..6d93dd31969b 100644
--- a/drivers/mtd/nand/raw/tmio_nand.c
+++ b/drivers/mtd/nand/raw/tmio_nand.c
@@ -34,6 +34,7 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/mtd/mtd.h>
+#include <linux/mtd/nand-ecc-sw-hamming.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/slab.h>
@@ -292,11 +293,12 @@ static int tmio_nand_correct_data(struct nand_chip *chip, unsigned char *buf,
 	int r0, r1;
 
 	/* assume ecc.size = 512 and ecc.bytes = 6 */
-	r0 = rawnand_sw_hamming_correct(chip, buf, read_ecc, calc_ecc);
+	r0 = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
+				    chip->ecc.size, false);
 	if (r0 < 0)
 		return r0;
-	r1 = rawnand_sw_hamming_correct(chip, buf + 256, read_ecc + 3,
-					calc_ecc + 3);
+	r1 = ecc_sw_hamming_correct(buf + 256, read_ecc + 3, calc_ecc + 3,
+				    chip->ecc.size, false);
 	if (r1 < 0)
 		return r1;
 	return r0 + r1;
-- 
2.27.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2021-04-13 16:27 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 16:18 [PATCH v3 0/7] Fix use of Hamming helpers Miquel Raynal
2021-04-13 16:18 ` [PATCH v3 1/7] mtd: rawnand: cs553x: Fix external use of SW Hamming ECC helper Miquel Raynal
2021-04-13 16:18   ` Miquel Raynal
2021-05-10  9:09   ` Miquel Raynal
2021-05-10  9:09     ` Miquel Raynal
2021-04-13 16:18 ` [PATCH v3 2/7] mtd: rawnand: fsmc: " Miquel Raynal
2021-04-13 16:18   ` Miquel Raynal
2021-05-10  9:09   ` Miquel Raynal
2021-05-10  9:09     ` Miquel Raynal
2021-04-13 16:18 ` [PATCH v3 3/7] mtd: rawnand: lpc32xx_slc: " Miquel Raynal
2021-04-13 16:18   ` Miquel Raynal
2021-04-13 21:13   ` Vladimir Zapolskiy
2021-04-13 21:13     ` Vladimir Zapolskiy
2021-05-10  9:09   ` Miquel Raynal
2021-05-10  9:09     ` Miquel Raynal
2021-04-13 16:18 ` [PATCH v3 4/7] mtd: rawnand: ndfc: " Miquel Raynal
2021-04-13 16:18   ` Miquel Raynal
2021-05-10  9:09   ` Miquel Raynal
2021-05-10  9:09     ` Miquel Raynal
2021-04-13 16:18 ` [PATCH v3 5/7] mtd: rawnand: sharpsl: " Miquel Raynal
2021-04-13 16:18   ` Miquel Raynal
2021-05-10  9:09   ` Miquel Raynal
2021-05-10  9:09     ` Miquel Raynal
2021-04-13 16:18 ` Miquel Raynal [this message]
2021-04-13 16:18   ` [PATCH v3 6/7] mtd: rawnand: tmio: " Miquel Raynal
2021-05-10  9:09   ` Miquel Raynal
2021-05-10  9:09     ` Miquel Raynal
2021-04-13 16:18 ` [PATCH v3 7/7] mtd: rawnand: txx9ndfmc: " Miquel Raynal
2021-04-13 16:18   ` Miquel Raynal
2021-05-10  9:09   ` Miquel Raynal
2021-05-10  9:09     ` Miquel Raynal

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=20210413161840.345208-7-miquel.raynal@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.