mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"
@ 2024-11-06  6:03 Alexander Shiyan
  2024-11-08  9:57 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2024-11-06  6:03 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

The message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"
is always issued, regardless of the MTD ECC layout used, since it
is executed through "fallthrough" from the previous case statement.

Additionally, if !IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED)
is triggered, the patch calls break, which disables the additional checks.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/mtd/nand/raw/nand_base.c | 35 ++++++++++++++++----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index e586c4cc89..4ecad0a935 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -5671,10 +5671,6 @@ static int nand_set_ecc_on_host_ops(struct nand_chip *chip)
 		fallthrough;
 
 	case NAND_ECC_PLACEMENT_INTERLEAVED:
-		if (!IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED)) {
-			WARN(1, "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled\n");
-			break;
-		}
 		if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) &&
 		    (!ecc->read_page ||
 		     ecc->read_page == nand_read_page_hwecc ||
@@ -5683,19 +5679,24 @@ static int nand_set_ecc_on_host_ops(struct nand_chip *chip)
 			WARN(1, "No ECC functions supplied; hardware ECC not possible\n");
 			return -EINVAL;
 		}
-		/* Use standard syndrome read/write page function? */
-		if (!ecc->read_page)
-			ecc->read_page = nand_read_page_syndrome;
-		if (!ecc->write_page)
-			ecc->write_page = nand_write_page_syndrome;
-		if (!ecc->read_page_raw)
-			ecc->read_page_raw = nand_read_page_raw_syndrome;
-		if (!ecc->write_page_raw)
-			ecc->write_page_raw = nand_write_page_raw_syndrome;
-		if (!ecc->read_oob)
-			ecc->read_oob = nand_read_oob_syndrome;
-		if (!ecc->write_oob)
-			ecc->write_oob = nand_write_oob_syndrome;
+		if (IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED)) {
+			/* Use standard syndrome read/write page function? */
+			if (!ecc->read_page)
+				ecc->read_page = nand_read_page_syndrome;
+			if (!ecc->write_page)
+				ecc->write_page = nand_write_page_syndrome;
+			if (!ecc->read_page_raw)
+				ecc->read_page_raw = nand_read_page_raw_syndrome;
+			if (!ecc->write_page_raw)
+				ecc->write_page_raw = nand_write_page_raw_syndrome;
+			if (!ecc->read_oob)
+				ecc->read_oob = nand_read_oob_syndrome;
+			if (!ecc->write_oob)
+				ecc->write_oob = nand_write_oob_syndrome;
+		} else {
+			if (ecc->placement == NAND_ECC_PLACEMENT_INTERLEAVED)
+				WARN(1, "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled\n");
+		}
 		break;
 
 	default:
-- 
2.39.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"
  2024-11-06  6:03 [PATCH] ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled" Alexander Shiyan
@ 2024-11-08  9:57 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-11-08  9:57 UTC (permalink / raw)
  To: barebox, Alexander Shiyan


On Wed, 06 Nov 2024 09:03:38 +0300, Alexander Shiyan wrote:
> The message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"
> is always issued, regardless of the MTD ECC layout used, since it
> is executed through "fallthrough" from the previous case statement.
> 
> Additionally, if !IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED)
> is triggered, the patch calls break, which disables the additional checks.
> 
> [...]

Applied, thanks!

[1/1] ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"
      https://git.pengutronix.de/cgit/barebox/commit/?id=4ae4449d63fc (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-08  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-06  6:03 [PATCH] ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled" Alexander Shiyan
2024-11-08  9:57 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox