[PATCH] mtd/core.c: fix MTDPGALG

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Dec 31 07:56:04 EST 2011


introduced in commit f76ad819e4971094
drivers/mtd: cosmetic changes

it's supposed to the invert of the writesize - 1

Cc: Robert Jarzmik <robert.jarzmik at free.fr>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
Hi,

	Robert please test more carefully next time

	I spend time to debug this while working on at91 nand boot :(

Best Regards,
J.
 drivers/mtd/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 55d845d..f25863d 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -49,7 +49,7 @@ static 	ssize_t mtd_read(struct cdev *cdev, void* buf, size_t count,
 }
 
 #define NOTALIGNED(x) (x & (mtd->writesize - 1)) != 0
-#define MTDPGALG(x) ((x) & (mtd->writesize - 1))
+#define MTDPGALG(x) ((x) & ~(mtd->writesize - 1))
 
 #ifdef CONFIG_MTD_WRITE
 static int all_ff(const void *buf, int len)
-- 
1.7.7




More information about the barebox mailing list