From 2379628bcd6c08e472020c78019ce8ea3fce3027 Mon Sep 17 00:00:00 2001
From: Steve Sakoman <steve@sakoman.com>
Date: Mon, 26 Apr 2010 11:17:26 -0700
Subject: [PATCH 43/45] MTD: silence ecc errors on mtdblock0

mtdblock0 is the x-load partition, which uses hw ecc
this confuses linux, which uses sw ecc
this patch silences ecc error messages when linux peeks into mtdblock0
* not for upstream submission *
---
 block/blk-core.c            |    3 ++-
 drivers/mtd/nand/nand_ecc.c |    2 +-
 fs/buffer.c                 |    3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 718897e..c526fde 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1970,7 +1970,8 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
 		req->errors = 0;
 
 	if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) {
-		printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n",
+		if (req->rq_disk && (strcmp(req->rq_disk->disk_name, "mtdblock0") != 0))
+			printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n",
 				req->rq_disk ? req->rq_disk->disk_name : "?",
 				(unsigned long long)blk_rq_pos(req));
 	}
diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index 92320a6..2b86b6d 100644
--- a/drivers/mtd/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
@@ -492,7 +492,7 @@ int __nand_correct_data(unsigned char *buf,
 	if ((bitsperbyte[b0] + bitsperbyte[b1] + bitsperbyte[b2]) == 1)
 		return 1;	/* error in ecc data; no action needed */
 
-	printk(KERN_ERR "uncorrectable error : ");
+//	printk(KERN_ERR "uncorrectable error : ");
 	return -1;
 }
 EXPORT_SYMBOL(__nand_correct_data);
diff --git a/fs/buffer.c b/fs/buffer.c
index 6fa5302..27b3103 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -114,7 +114,8 @@ static int quiet_error(struct buffer_head *bh)
 static void buffer_io_error(struct buffer_head *bh)
 {
 	char b[BDEVNAME_SIZE];
-	printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
+	if (strcmp(bdevname(bh->b_bdev, b), "mtdblock0") != 0)
+		printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
 			bdevname(bh->b_bdev, b),
 			(unsigned long long)bh->b_blocknr);
 }
-- 
1.6.6.1

