diff mbox

mtd: adapt writebufsize calculation for concat

Message ID 1295887542-22785-1-git-send-email-holger.brunck@keymile.com
State Accepted
Commit 771df61949cf2d6ae9ff07e209c80693cdbc9302
Headers show

Commit Message

Holger Brunck Jan. 24, 2011, 4:45 p.m. UTC
If different chips with different writebufsize are concatenated,
the writebufsize from the concat device has to be taken from
the device with the largest writebuffer. This writebufsize
is used later on in the UBI layer for the min I/O size.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
---
 drivers/mtd/mtdconcat.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

Comments

Artem Bityutskiy Jan. 29, 2011, 4:22 p.m. UTC | #1
On Mon, 2011-01-24 at 17:45 +0100, Holger Brunck wrote:
> If different chips with different writebufsize are concatenated,
> the writebufsize from the concat device has to be taken from
> the device with the largest writebuffer. This writebufsize
> is used later on in the UBI layer for the min I/O size.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>

Pushed to l2-mtd-2.6.git, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index b84dadb..951883d 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -733,6 +733,7 @@  struct mtd_info *mtd_concat_create(struct mtd_info *subdev[],	/* subdevices to c
 	struct mtd_concat *concat;
 	uint32_t max_erasesize, curr_erasesize;
 	int num_erase_region;
+	int max_writebufsize = 0;
 
 	printk(KERN_NOTICE "Concatenating MTD devices:\n");
 	for (i = 0; i < num_devs; i++)
@@ -759,7 +760,12 @@  struct mtd_info *mtd_concat_create(struct mtd_info *subdev[],	/* subdevices to c
 	concat->mtd.size = subdev[0]->size;
 	concat->mtd.erasesize = subdev[0]->erasesize;
 	concat->mtd.writesize = subdev[0]->writesize;
-	concat->mtd.writebufsize = subdev[0]->writebufsize;
+
+	for (i = 0; i < num_devs; i++)
+		if (max_writebufsize < subdev[i]->writebufsize)
+			max_writebufsize = subdev[i]->writebufsize;
+	concat->mtd.writebufsize = max_writebufsize;
+
 	concat->mtd.subpage_sft = subdev[0]->subpage_sft;
 	concat->mtd.oobsize = subdev[0]->oobsize;
 	concat->mtd.oobavail = subdev[0]->oobavail;