aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/mtdchar.c5
-rw-r--r--drivers/mtd/mtdconcat.c2
-rw-r--r--drivers/mtd/mtdoops.c2
-rw-r--r--drivers/mtd/mtdswap.c2
-rw-r--r--fs/jffs2/wbuf.c3
-rw-r--r--include/linux/mtd/mtd.h2
6 files changed, 6 insertions, 10 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 64efcbf087e9..50c6a1e7f675 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -877,10 +877,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
877 877
878 if (copy_from_user(&offs, argp, sizeof(loff_t))) 878 if (copy_from_user(&offs, argp, sizeof(loff_t)))
879 return -EFAULT; 879 return -EFAULT;
880 if (!mtd->block_markbad) 880 return mtd_block_markbad(mtd, offs);
881 ret = -EOPNOTSUPP;
882 else
883 return mtd_block_markbad(mtd, offs);
884 break; 881 break;
885 } 882 }
886 883
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index fbf3cb124a93..1ed5103b219b 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -673,7 +673,7 @@ static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs)
673 struct mtd_concat *concat = CONCAT(mtd); 673 struct mtd_concat *concat = CONCAT(mtd);
674 int i, err = -EINVAL; 674 int i, err = -EINVAL;
675 675
676 if (!concat->subdev[0]->block_markbad) 676 if (!mtd_can_have_bb(concat->subdev[0]))
677 return 0; 677 return 0;
678 678
679 if (ofs > mtd->size) 679 if (ofs > mtd->size)
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index a4c8f67560e0..db8e8272d69b 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -199,7 +199,7 @@ badblock:
199 return; 199 return;
200 } 200 }
201 201
202 if (mtd->block_markbad && ret == -EIO) { 202 if (mtd_can_have_bb(mtd) && ret == -EIO) {
203 ret = mtd_block_markbad(mtd, cxt->nextpage * record_size); 203 ret = mtd_block_markbad(mtd, cxt->nextpage * record_size);
204 if (ret < 0) { 204 if (ret < 0) {
205 printk(KERN_ERR "mtdoops: block_markbad failed, aborting\n"); 205 printk(KERN_ERR "mtdoops: block_markbad failed, aborting\n");
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index 3fc8cb2756c0..c92f0f6bc130 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -274,7 +274,7 @@ static int mtdswap_handle_badblock(struct mtdswap_dev *d, struct swap_eb *eb)
274 eb->root = NULL; 274 eb->root = NULL;
275 275
276 /* badblocks not supported */ 276 /* badblocks not supported */
277 if (!d->mtd->block_markbad) 277 if (!mtd_can_have_bb(d->mtd))
278 return 1; 278 return 1;
279 279
280 offset = mtdswap_eb_offset(d, eb); 280 offset = mtdswap_eb_offset(d, eb);
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index fd96b757433f..30e8f47e8a23 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1130,9 +1130,6 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *
1130 if( ++jeb->bad_count < MAX_ERASE_FAILURES) 1130 if( ++jeb->bad_count < MAX_ERASE_FAILURES)
1131 return 0; 1131 return 0;
1132 1132
1133 if (!c->mtd->block_markbad)
1134 return 1; // What else can we do?
1135
1136 printk(KERN_WARNING "JFFS2: marking eraseblock at %08x\n as bad", bad_offset); 1133 printk(KERN_WARNING "JFFS2: marking eraseblock at %08x\n as bad", bad_offset);
1137 ret = mtd_block_markbad(c->mtd, bad_offset); 1134 ret = mtd_block_markbad(c->mtd, bad_offset);
1138 1135
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 7e35755f6931..1a81fde8f333 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -447,6 +447,8 @@ static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
447 447
448static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs) 448static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
449{ 449{
450 if (!mtd->block_markbad)
451 return -EOPNOTSUPP;
450 return mtd->block_markbad(mtd, ofs); 452 return mtd->block_markbad(mtd, ofs);
451} 453}
452 454