aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2011-12-23 12:35:30 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:25:47 -0500
commit7086c19d07429d697057587caf1e5e0345442d16 (patch)
tree3a892182dba0847de32ef79b1fe1d46d8b1b5de8
parentead995f8d4da1e2f1ef40b0e5f4133fee38a3d3d (diff)
mtd: introduce mtd_block_isbad interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c3
-rw-r--r--drivers/mtd/inftlmount.c3
-rw-r--r--drivers/mtd/mtdchar.c2
-rw-r--r--drivers/mtd/mtdconcat.c2
-rw-r--r--drivers/mtd/mtdoops.c4
-rw-r--r--drivers/mtd/mtdpart.c5
-rw-r--r--drivers/mtd/mtdswap.c4
-rw-r--r--drivers/mtd/nftlmount.c3
-rw-r--r--drivers/mtd/redboot.c4
-rw-r--r--drivers/mtd/ssfdc.c4
-rw-r--r--drivers/mtd/tests/mtd_oobtest.c2
-rw-r--r--drivers/mtd/tests/mtd_pagetest.c2
-rw-r--r--drivers/mtd/tests/mtd_readtest.c2
-rw-r--r--drivers/mtd/tests/mtd_speedtest.c2
-rw-r--r--drivers/mtd/tests/mtd_stresstest.c2
-rw-r--r--drivers/mtd/tests/mtd_subpagetest.c2
-rw-r--r--drivers/mtd/tests/mtd_torturetest.c3
-rw-r--r--drivers/mtd/ubi/io.c2
-rw-r--r--fs/jffs2/scan.c2
-rw-r--r--fs/logfs/dev_mtd.c4
-rw-r--r--include/linux/mtd/mtd.h7
21 files changed, 34 insertions, 30 deletions
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
index 011bddbf073f..b34438e026be 100644
--- a/arch/cris/arch-v32/drivers/axisflashmap.c
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -404,8 +404,7 @@ static int __init init_axis_flash(void)
404 */ 404 */
405 int blockstat; 405 int blockstat;
406 do { 406 do {
407 blockstat = main_mtd->block_isbad(main_mtd, 407 blockstat = mtd_block_isbad(main_mtd, ptable_sector);
408 ptable_sector);
409 if (blockstat < 0) 408 if (blockstat < 0)
410 ptable_sector = 0; /* read error */ 409 ptable_sector = 0; /* read error */
411 else if (blockstat) 410 else if (blockstat)
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 9bfbca5d88d6..38519401196b 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -306,7 +306,8 @@ static int find_boot_record(struct INFTLrecord *inftl)
306 /* If any of the physical eraseblocks are bad, don't 306 /* If any of the physical eraseblocks are bad, don't
307 use the unit. */ 307 use the unit. */
308 for (physblock = 0; physblock < inftl->EraseSize; physblock += inftl->mbd.mtd->erasesize) { 308 for (physblock = 0; physblock < inftl->EraseSize; physblock += inftl->mbd.mtd->erasesize) {
309 if (inftl->mbd.mtd->block_isbad(inftl->mbd.mtd, i * inftl->EraseSize + physblock)) 309 if (mtd_block_isbad(inftl->mbd.mtd,
310 i * inftl->EraseSize + physblock))
310 inftl->PUtable[i] = BLOCK_RESERVED; 311 inftl->PUtable[i] = BLOCK_RESERVED;
311 } 312 }
312 } 313 }
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 6d598b23cf3a..a499bf7a8214 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -886,7 +886,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
886 if (!mtd->block_isbad) 886 if (!mtd->block_isbad)
887 ret = -EOPNOTSUPP; 887 ret = -EOPNOTSUPP;
888 else 888 else
889 return mtd->block_isbad(mtd, offs); 889 return mtd_block_isbad(mtd, offs);
890 break; 890 break;
891 } 891 }
892 892
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 4b7f825ce015..d0db5e61d5af 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -667,7 +667,7 @@ static int concat_block_isbad(struct mtd_info *mtd, loff_t ofs)
667 continue; 667 continue;
668 } 668 }
669 669
670 res = subdev->block_isbad(subdev, ofs); 670 res = mtd_block_isbad(subdev, ofs);
671 break; 671 break;
672 } 672 }
673 673
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 7be2018ffbcc..bc43d2f7272c 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -170,7 +170,7 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
170 } 170 }
171 171
172 while (mtd->block_isbad) { 172 while (mtd->block_isbad) {
173 ret = mtd->block_isbad(mtd, cxt->nextpage * record_size); 173 ret = mtd_block_isbad(mtd, cxt->nextpage * record_size);
174 if (!ret) 174 if (!ret)
175 break; 175 break;
176 if (ret < 0) { 176 if (ret < 0) {
@@ -254,7 +254,7 @@ static void find_next_position(struct mtdoops_context *cxt)
254 254
255 for (page = 0; page < cxt->oops_pages; page++) { 255 for (page = 0; page < cxt->oops_pages; page++) {
256 if (mtd->block_isbad && 256 if (mtd->block_isbad &&
257 mtd->block_isbad(mtd, page * record_size)) 257 mtd_block_isbad(mtd, page * record_size))
258 continue; 258 continue;
259 /* Assume the page is used */ 259 /* Assume the page is used */
260 mark_page_used(cxt, page); 260 mark_page_used(cxt, page);
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 8610750852ac..0e7dfc79d337 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -322,7 +322,7 @@ static int part_block_isbad(struct mtd_info *mtd, loff_t ofs)
322 if (ofs >= mtd->size) 322 if (ofs >= mtd->size)
323 return -EINVAL; 323 return -EINVAL;
324 ofs += part->offset; 324 ofs += part->offset;
325 return part->master->block_isbad(part->master, ofs); 325 return mtd_block_isbad(part->master, ofs);
326} 326}
327 327
328static int part_block_markbad(struct mtd_info *mtd, loff_t ofs) 328static int part_block_markbad(struct mtd_info *mtd, loff_t ofs)
@@ -553,8 +553,7 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
553 uint64_t offs = 0; 553 uint64_t offs = 0;
554 554
555 while (offs < slave->mtd.size) { 555 while (offs < slave->mtd.size) {
556 if (master->block_isbad(master, 556 if (mtd_block_isbad(master, offs + slave->offset))
557 offs + slave->offset))
558 slave->mtd.ecc_stats.badblocks++; 557 slave->mtd.ecc_stats.badblocks++;
559 offs += slave->mtd.erasesize; 558 offs += slave->mtd.erasesize;
560 } 559 }
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index cb794e761012..87aa0a6323c3 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -343,7 +343,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb)
343 offset = mtdswap_eb_offset(d, eb); 343 offset = mtdswap_eb_offset(d, eb);
344 344
345 /* Check first if the block is bad. */ 345 /* Check first if the block is bad. */
346 if (d->mtd->block_isbad && d->mtd->block_isbad(d->mtd, offset)) 346 if (d->mtd->block_isbad && mtd_block_isbad(d->mtd, offset))
347 return MTDSWAP_SCANNED_BAD; 347 return MTDSWAP_SCANNED_BAD;
348 348
349 ops.ooblen = 2 * d->mtd->ecclayout->oobavail; 349 ops.ooblen = 2 * d->mtd->ecclayout->oobavail;
@@ -1061,7 +1061,7 @@ static unsigned int mtdswap_badblocks(struct mtd_info *mtd, uint64_t size)
1061 1061
1062 if (mtd->block_isbad) 1062 if (mtd->block_isbad)
1063 for (offset = 0; offset < size; offset += mtd->erasesize) 1063 for (offset = 0; offset < size; offset += mtd->erasesize)
1064 if (mtd->block_isbad(mtd, offset)) 1064 if (mtd_block_isbad(mtd, offset))
1065 badcnt++; 1065 badcnt++;
1066 1066
1067 return badcnt; 1067 return badcnt;
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c
index b068dc8a3666..156af9f87961 100644
--- a/drivers/mtd/nftlmount.c
+++ b/drivers/mtd/nftlmount.c
@@ -242,7 +242,8 @@ The new DiskOnChip driver already scanned the bad block table. Just query it.
242 if (buf[i & (SECTORSIZE - 1)] != 0xff) 242 if (buf[i & (SECTORSIZE - 1)] != 0xff)
243 nftl->ReplUnitTable[i] = BLOCK_RESERVED; 243 nftl->ReplUnitTable[i] = BLOCK_RESERVED;
244#endif 244#endif
245 if (nftl->mbd.mtd->block_isbad(nftl->mbd.mtd, i * nftl->EraseSize)) 245 if (mtd_block_isbad(nftl->mbd.mtd,
246 i * nftl->EraseSize))
246 nftl->ReplUnitTable[i] = BLOCK_RESERVED; 247 nftl->ReplUnitTable[i] = BLOCK_RESERVED;
247 } 248 }
248 249
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index 623d9b86d0d9..09bb81ea3a7e 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -79,7 +79,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
79 if ( directory < 0 ) { 79 if ( directory < 0 ) {
80 offset = master->size + directory * master->erasesize; 80 offset = master->size + directory * master->erasesize;
81 while (master->block_isbad && 81 while (master->block_isbad &&
82 master->block_isbad(master, offset)) { 82 mtd_block_isbad(master, offset)) {
83 if (!offset) { 83 if (!offset) {
84 nogood: 84 nogood:
85 printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n"); 85 printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
@@ -90,7 +90,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
90 } else { 90 } else {
91 offset = directory * master->erasesize; 91 offset = directory * master->erasesize;
92 while (master->block_isbad && 92 while (master->block_isbad &&
93 master->block_isbad(master, offset)) { 93 mtd_block_isbad(master, offset)) {
94 offset += master->erasesize; 94 offset += master->erasesize;
95 if (offset == master->size) 95 if (offset == master->size)
96 goto nogood; 96 goto nogood;
diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c
index 0e6881338357..ab2a52a039c3 100644
--- a/drivers/mtd/ssfdc.c
+++ b/drivers/mtd/ssfdc.c
@@ -122,7 +122,7 @@ static int get_valid_cis_sector(struct mtd_info *mtd)
122 * is not SSFDC formatted 122 * is not SSFDC formatted
123 */ 123 */
124 for (k = 0, offset = 0; k < 4; k++, offset += mtd->erasesize) { 124 for (k = 0, offset = 0; k < 4; k++, offset += mtd->erasesize) {
125 if (!mtd->block_isbad(mtd, offset)) { 125 if (mtd_block_isbad(mtd, offset)) {
126 ret = mtd_read(mtd, offset, SECTOR_SIZE, &retlen, 126 ret = mtd_read(mtd, offset, SECTOR_SIZE, &retlen,
127 sect_buf); 127 sect_buf);
128 128
@@ -255,7 +255,7 @@ static int build_logical_block_map(struct ssfdcr_record *ssfdc)
255 for (phys_block = ssfdc->cis_block + 1; phys_block < ssfdc->map_len; 255 for (phys_block = ssfdc->cis_block + 1; phys_block < ssfdc->map_len;
256 phys_block++) { 256 phys_block++) {
257 offset = (unsigned long)phys_block * ssfdc->erase_size; 257 offset = (unsigned long)phys_block * ssfdc->erase_size;
258 if (mtd->block_isbad(mtd, offset)) 258 if (mtd_block_isbad(mtd, offset))
259 continue; /* skip bad blocks */ 259 continue; /* skip bad blocks */
260 260
261 ret = read_raw_oob(mtd, offset, oob_buf); 261 ret = read_raw_oob(mtd, offset, oob_buf);
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
index 81113885e086..ed9b62827f1b 100644
--- a/drivers/mtd/tests/mtd_oobtest.c
+++ b/drivers/mtd/tests/mtd_oobtest.c
@@ -329,7 +329,7 @@ static int is_block_bad(int ebnum)
329 int ret; 329 int ret;
330 loff_t addr = ebnum * mtd->erasesize; 330 loff_t addr = ebnum * mtd->erasesize;
331 331
332 ret = mtd->block_isbad(mtd, addr); 332 ret = mtd_block_isbad(mtd, addr);
333 if (ret) 333 if (ret)
334 printk(PRINT_PREF "block %d is bad\n", ebnum); 334 printk(PRINT_PREF "block %d is bad\n", ebnum);
335 return ret; 335 return ret;
diff --git a/drivers/mtd/tests/mtd_pagetest.c b/drivers/mtd/tests/mtd_pagetest.c
index 83da97e54f97..8024eaf4c1ac 100644
--- a/drivers/mtd/tests/mtd_pagetest.c
+++ b/drivers/mtd/tests/mtd_pagetest.c
@@ -469,7 +469,7 @@ static int is_block_bad(int ebnum)
469 loff_t addr = ebnum * mtd->erasesize; 469 loff_t addr = ebnum * mtd->erasesize;
470 int ret; 470 int ret;
471 471
472 ret = mtd->block_isbad(mtd, addr); 472 ret = mtd_block_isbad(mtd, addr);
473 if (ret) 473 if (ret)
474 printk(PRINT_PREF "block %d is bad\n", ebnum); 474 printk(PRINT_PREF "block %d is bad\n", ebnum);
475 return ret; 475 return ret;
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c
index 5eaeada84284..ad5fd0df86ee 100644
--- a/drivers/mtd/tests/mtd_readtest.c
+++ b/drivers/mtd/tests/mtd_readtest.c
@@ -132,7 +132,7 @@ static int is_block_bad(int ebnum)
132 loff_t addr = ebnum * mtd->erasesize; 132 loff_t addr = ebnum * mtd->erasesize;
133 int ret; 133 int ret;
134 134
135 ret = mtd->block_isbad(mtd, addr); 135 ret = mtd_block_isbad(mtd, addr);
136 if (ret) 136 if (ret)
137 printk(PRINT_PREF "block %d is bad\n", ebnum); 137 printk(PRINT_PREF "block %d is bad\n", ebnum);
138 return ret; 138 return ret;
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c
index c7b18e189082..ecb287847505 100644
--- a/drivers/mtd/tests/mtd_speedtest.c
+++ b/drivers/mtd/tests/mtd_speedtest.c
@@ -296,7 +296,7 @@ static int is_block_bad(int ebnum)
296 loff_t addr = ebnum * mtd->erasesize; 296 loff_t addr = ebnum * mtd->erasesize;
297 int ret; 297 int ret;
298 298
299 ret = mtd->block_isbad(mtd, addr); 299 ret = mtd_block_isbad(mtd, addr);
300 if (ret) 300 if (ret)
301 printk(PRINT_PREF "block %d is bad\n", ebnum); 301 printk(PRINT_PREF "block %d is bad\n", ebnum);
302 return ret; 302 return ret;
diff --git a/drivers/mtd/tests/mtd_stresstest.c b/drivers/mtd/tests/mtd_stresstest.c
index f8aac4b7e59a..4789c0ee3e9a 100644
--- a/drivers/mtd/tests/mtd_stresstest.c
+++ b/drivers/mtd/tests/mtd_stresstest.c
@@ -132,7 +132,7 @@ static int is_block_bad(int ebnum)
132 loff_t addr = ebnum * mtd->erasesize; 132 loff_t addr = ebnum * mtd->erasesize;
133 int ret; 133 int ret;
134 134
135 ret = mtd->block_isbad(mtd, addr); 135 ret = mtd_block_isbad(mtd, addr);
136 if (ret) 136 if (ret)
137 printk(PRINT_PREF "block %d is bad\n", ebnum); 137 printk(PRINT_PREF "block %d is bad\n", ebnum);
138 return ret; 138 return ret;
diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c
index b90c01036b49..4b873d49fe6a 100644
--- a/drivers/mtd/tests/mtd_subpagetest.c
+++ b/drivers/mtd/tests/mtd_subpagetest.c
@@ -344,7 +344,7 @@ static int is_block_bad(int ebnum)
344 loff_t addr = ebnum * mtd->erasesize; 344 loff_t addr = ebnum * mtd->erasesize;
345 int ret; 345 int ret;
346 346
347 ret = mtd->block_isbad(mtd, addr); 347 ret = mtd_block_isbad(mtd, addr);
348 if (ret) 348 if (ret)
349 printk(PRINT_PREF "block %d is bad\n", ebnum); 349 printk(PRINT_PREF "block %d is bad\n", ebnum);
350 return ret; 350 return ret;
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index dd34a519fa7a..30c4ed9855ec 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -292,8 +292,7 @@ static int __init tort_init(void)
292 memset(&bad_ebs[0], 0, sizeof(int) * ebcnt); 292 memset(&bad_ebs[0], 0, sizeof(int) * ebcnt);
293 if (mtd->block_isbad) { 293 if (mtd->block_isbad) {
294 for (i = eb; i < eb + ebcnt; i++) { 294 for (i = eb; i < eb + ebcnt; i++) {
295 err = mtd->block_isbad(mtd, 295 err = mtd_block_isbad(mtd, (loff_t)i * mtd->erasesize);
296 (loff_t)i * mtd->erasesize);
297 296
298 if (err < 0) { 297 if (err < 0) {
299 printk(PRINT_PREF "block_isbad() returned %d " 298 printk(PRINT_PREF "block_isbad() returned %d "
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 8d832fc9e9e4..a1b683ad639e 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -634,7 +634,7 @@ int ubi_io_is_bad(const struct ubi_device *ubi, int pnum)
634 if (ubi->bad_allowed) { 634 if (ubi->bad_allowed) {
635 int ret; 635 int ret;
636 636
637 ret = mtd->block_isbad(mtd, (loff_t)pnum * ubi->peb_size); 637 ret = mtd_block_isbad(mtd, (loff_t)pnum * ubi->peb_size);
638 if (ret < 0) 638 if (ret < 0)
639 ubi_err("error %d while checking if PEB %d is bad", 639 ubi_err("error %d while checking if PEB %d is bad",
640 ret, pnum); 640 ret, pnum);
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 72f3960f44a9..83e1665e2574 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -455,7 +455,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
455 if (jffs2_cleanmarker_oob(c)) { 455 if (jffs2_cleanmarker_oob(c)) {
456 int ret; 456 int ret;
457 457
458 if (c->mtd->block_isbad(c->mtd, jeb->offset)) 458 if (mtd_block_isbad(c->mtd, jeb->offset))
459 return BLK_STATE_BADBLOCK; 459 return BLK_STATE_BADBLOCK;
460 460
461 ret = jffs2_check_nand_cleanmarker(c, jeb); 461 ret = jffs2_check_nand_cleanmarker(c, jeb);
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index 0ca7a07db6c1..136c7360a9b6 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -157,7 +157,7 @@ static struct page *logfs_mtd_find_first_sb(struct super_block *sb, u64 *ofs)
157 return NULL; 157 return NULL;
158 158
159 *ofs = 0; 159 *ofs = 0;
160 while (mtd->block_isbad(mtd, *ofs)) { 160 while (mtd_block_isbad(mtd, *ofs)) {
161 *ofs += mtd->erasesize; 161 *ofs += mtd->erasesize;
162 if (*ofs >= mtd->size) 162 if (*ofs >= mtd->size)
163 return NULL; 163 return NULL;
@@ -177,7 +177,7 @@ static struct page *logfs_mtd_find_last_sb(struct super_block *sb, u64 *ofs)
177 return NULL; 177 return NULL;
178 178
179 *ofs = mtd->size - mtd->erasesize; 179 *ofs = mtd->size - mtd->erasesize;
180 while (mtd->block_isbad(mtd, *ofs)) { 180 while (mtd_block_isbad(mtd, *ofs)) {
181 *ofs -= mtd->erasesize; 181 *ofs -= mtd->erasesize;
182 if (*ofs <= 0) 182 if (*ofs <= 0)
183 return NULL; 183 return NULL;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index d6b4aa177505..a307ad093a54 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -210,6 +210,7 @@ struct mtd_info {
210 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 210 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
211 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 211 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
212 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 212 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
213 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
213 int (*suspend) (struct mtd_info *mtd); 214 int (*suspend) (struct mtd_info *mtd);
214 void (*resume) (struct mtd_info *mtd); 215 void (*resume) (struct mtd_info *mtd);
215 216
@@ -219,7 +220,6 @@ struct mtd_info {
219 struct backing_dev_info *backing_dev_info; 220 struct backing_dev_info *backing_dev_info;
220 221
221 /* Bad block management functions */ 222 /* Bad block management functions */
222 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
223 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 223 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
224 224
225 struct notifier_block reboot_notifier; /* default mode before reboot */ 225 struct notifier_block reboot_notifier; /* default mode before reboot */
@@ -406,6 +406,11 @@ static inline void mtd_resume(struct mtd_info *mtd)
406 mtd->resume(mtd); 406 mtd->resume(mtd);
407} 407}
408 408
409static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
410{
411 return mtd->block_isbad(mtd, ofs);
412}
413
409static inline struct mtd_info *dev_to_mtd(struct device *dev) 414static inline struct mtd_info *dev_to_mtd(struct device *dev)
410{ 415{
411 return dev ? dev_get_drvdata(dev) : NULL; 416 return dev ? dev_get_drvdata(dev) : NULL;