[PATCH v3 3/3] mtd: block2mtd: Removes PAGE_MASK as a index to partition size

Rodrigo Freire rfreire at redhat.com
Sun Nov 9 04:23:12 PST 2014


From: Felix Fietkau <nbd at openwrt.org>

mtd: block2mtd: Removes PAGE_MASK as a index to partition size

PAGE_MASK is no longer needed with the new term.
This patch keeps the device size aligned with the erase_size.

Signed-off-by: Felix Fietkau <nbd at openwrt.org>
Signed-off-by: Rodrigo Freire <rfreire at redhat.com>
Signed-off-by: Herton Krzesinski <herton at redhat.com>
---
V3: Separated on a single patch
--- a/drivers/mtd/devices/block2mtd.c	2014-11-07 17:40:58.688747820 -0200
+++ b/drivers/mtd/devices/block2mtd.c	2014-11-07 17:41:28.054750893 -0200
@@ -291,8 +291,7 @@ static struct block2mtd_dev *add_device(
 		goto err_destroy_mutex;
 
 	dev->mtd.name = name;
-
-	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
+	dev->mtd.size = dev->blkdev->bd_inode->i_size & ~(erase_size - 1);
 	dev->mtd.erasesize = erase_size;
 	dev->mtd.writesize = 1;
 	dev->mtd.writebufsize = PAGE_SIZE;
---
1.7.1



More information about the linux-mtd mailing list