aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/wbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/wbuf.c')
-rw-r--r--fs/jffs2/wbuf.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 355226d8ce29..087c2e438a6d 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -637,17 +637,6 @@ int jffs2_flash_writev(struct jffs2_sb_info *c, const struct kvec *invecs, unsig
637 memset(c->wbuf,0xff,c->wbuf_pagesize); 637 memset(c->wbuf,0xff,c->wbuf_pagesize);
638 } 638 }
639 639
640 /* Fixup the wbuf if we are moving to a new eraseblock. The checks below
641 fail for ECC'd NOR because cleanmarker == 16, so a block starts at
642 xxx0010. */
643 if (jffs2_nor_ecc(c)) {
644 if (((c->wbuf_ofs % c->sector_size) == 0) && !c->wbuf_len) {
645 c->wbuf_ofs = PAGE_DIV(to);
646 c->wbuf_len = PAGE_MOD(to);
647 memset(c->wbuf,0xff,c->wbuf_pagesize);
648 }
649 }
650
651 /* Sanity checks on target address. 640 /* Sanity checks on target address.
652 It's permitted to write at PAD(c->wbuf_len+c->wbuf_ofs), 641 It's permitted to write at PAD(c->wbuf_len+c->wbuf_ofs),
653 and it's permitted to write at the beginning of a new 642 and it's permitted to write at the beginning of a new
@@ -1244,29 +1233,10 @@ void jffs2_dataflash_cleanup(struct jffs2_sb_info *c) {
1244 kfree(c->wbuf); 1233 kfree(c->wbuf);
1245} 1234}
1246 1235
1247int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c) {
1248 /* Cleanmarker is actually larger on the flashes */
1249 c->cleanmarker_size = 16;
1250
1251 /* Initialize write buffer */
1252 init_rwsem(&c->wbuf_sem);
1253 c->wbuf_pagesize = c->mtd->eccsize;
1254 c->wbuf_ofs = 0xFFFFFFFF;
1255
1256 c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
1257 if (!c->wbuf)
1258 return -ENOMEM;
1259
1260 return 0;
1261}
1262
1263void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) {
1264 kfree(c->wbuf);
1265}
1266
1267int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) { 1236int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) {
1268 /* Cleanmarker currently occupies a whole programming region */ 1237 /* Cleanmarker currently occupies whole programming regions,
1269 c->cleanmarker_size = c->mtd->writesize; 1238 * either one or 2 for 8Byte STMicro flashes. */
1239 c->cleanmarker_size = max(16u, c->mtd->writesize);
1270 1240
1271 /* Initialize write buffer */ 1241 /* Initialize write buffer */
1272 init_rwsem(&c->wbuf_sem); 1242 init_rwsem(&c->wbuf_sem);