aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/ftl.c2
-rw-r--r--drivers/mtd/mtdblock.c4
-rw-r--r--drivers/mtd/mtdchar.c2
-rw-r--r--drivers/mtd/mtdconcat.c2
-rw-r--r--drivers/mtd/mtdpart.c2
-rw-r--r--drivers/mtd/mtdswap.c2
-rw-r--r--drivers/mtd/rfd_ftl.c2
-rw-r--r--drivers/mtd/ubi/kapi.c2
-rw-r--r--fs/jffs2/super.c2
-rw-r--r--fs/logfs/dev_mtd.c2
-rw-r--r--include/linux/mtd/mtd.h9
11 files changed, 17 insertions, 14 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index d591b1d0a6c1..c9c90299c9e2 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -651,7 +651,7 @@ static int reclaim_block(partition_t *part)
651 pr_debug("ftl_cs: waiting for transfer " 651 pr_debug("ftl_cs: waiting for transfer "
652 "unit to be prepared...\n"); 652 "unit to be prepared...\n");
653 if (part->mbd.mtd->sync) 653 if (part->mbd.mtd->sync)
654 part->mbd.mtd->sync(part->mbd.mtd); 654 mtd_sync(part->mbd.mtd);
655 } else { 655 } else {
656 static int ne = 0; 656 static int ne = 0;
657 if (++ne < 5) 657 if (++ne < 5)
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index ac7f1f1faa2d..496e1a6e8029 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -323,7 +323,7 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd)
323 if (!--mtdblk->count) { 323 if (!--mtdblk->count) {
324 /* It was the last usage. Free the cache */ 324 /* It was the last usage. Free the cache */
325 if (mbd->mtd->sync) 325 if (mbd->mtd->sync)
326 mbd->mtd->sync(mbd->mtd); 326 mtd_sync(mbd->mtd);
327 vfree(mtdblk->cache_data); 327 vfree(mtdblk->cache_data);
328 } 328 }
329 329
@@ -343,7 +343,7 @@ static int mtdblock_flush(struct mtd_blktrans_dev *dev)
343 mutex_unlock(&mtdblk->cache_mutex); 343 mutex_unlock(&mtdblk->cache_mutex);
344 344
345 if (dev->mtd->sync) 345 if (dev->mtd->sync)
346 dev->mtd->sync(dev->mtd); 346 mtd_sync(dev->mtd);
347 return 0; 347 return 0;
348} 348}
349 349
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 86308acb40e0..b5722ecf19d3 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -155,7 +155,7 @@ static int mtdchar_close(struct inode *inode, struct file *file)
155 155
156 /* Only sync if opened RW */ 156 /* Only sync if opened RW */
157 if ((file->f_mode & FMODE_WRITE) && mtd->sync) 157 if ((file->f_mode & FMODE_WRITE) && mtd->sync)
158 mtd->sync(mtd); 158 mtd_sync(mtd);
159 159
160 iput(mfi->ino); 160 iput(mfi->ino);
161 161
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 6fdae191e1ba..cc2336edfe28 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -620,7 +620,7 @@ static void concat_sync(struct mtd_info *mtd)
620 620
621 for (i = 0; i < concat->num_subdev; i++) { 621 for (i = 0; i < concat->num_subdev; i++) {
622 struct mtd_info *subdev = concat->subdev[i]; 622 struct mtd_info *subdev = concat->subdev[i];
623 subdev->sync(subdev); 623 mtd_sync(subdev);
624 } 624 }
625} 625}
626 626
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index c0bfa88c82f3..2b545052795e 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -301,7 +301,7 @@ static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
301static void part_sync(struct mtd_info *mtd) 301static void part_sync(struct mtd_info *mtd)
302{ 302{
303 struct mtd_part *part = PART(mtd); 303 struct mtd_part *part = PART(mtd);
304 part->master->sync(part->master); 304 mtd_sync(part->master);
305} 305}
306 306
307static int part_suspend(struct mtd_info *mtd) 307static int part_suspend(struct mtd_info *mtd)
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index 85797390e3dd..cb794e761012 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1048,7 +1048,7 @@ static int mtdswap_flush(struct mtd_blktrans_dev *dev)
1048 struct mtdswap_dev *d = MTDSWAP_MBD_TO_MTDSWAP(dev); 1048 struct mtdswap_dev *d = MTDSWAP_MBD_TO_MTDSWAP(dev);
1049 1049
1050 if (d->mtd->sync) 1050 if (d->mtd->sync)
1051 d->mtd->sync(d->mtd); 1051 mtd_sync(d->mtd);
1052 return 0; 1052 return 0;
1053} 1053}
1054 1054
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index c594bb7abfa3..5426d42cdea7 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -449,7 +449,7 @@ static int reclaim_block(struct partition *part, u_long *old_sector)
449 449
450 /* we have a race if sync doesn't exist */ 450 /* we have a race if sync doesn't exist */
451 if (part->mbd.mtd->sync) 451 if (part->mbd.mtd->sync)
452 part->mbd.mtd->sync(part->mbd.mtd); 452 mtd_sync(part->mbd.mtd);
453 453
454 score = 0x7fffffff; /* MAX_INT */ 454 score = 0x7fffffff; /* MAX_INT */
455 best_block = -1; 455 best_block = -1;
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index 1a35fc5e3b40..9f265cc1a0d3 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -715,7 +715,7 @@ int ubi_sync(int ubi_num)
715 return -ENODEV; 715 return -ENODEV;
716 716
717 if (ubi->mtd->sync) 717 if (ubi->mtd->sync)
718 ubi->mtd->sync(ubi->mtd); 718 mtd_sync(ubi->mtd);
719 719
720 ubi_put_device(ubi); 720 ubi_put_device(ubi);
721 return 0; 721 return 0;
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index e7e974454115..e78bf3cd1b73 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -337,7 +337,7 @@ static void jffs2_put_super (struct super_block *sb)
337 kfree(c->inocache_list); 337 kfree(c->inocache_list);
338 jffs2_clear_xattr_subsystem(c); 338 jffs2_clear_xattr_subsystem(c);
339 if (c->mtd->sync) 339 if (c->mtd->sync)
340 c->mtd->sync(c->mtd); 340 mtd_sync(c->mtd);
341 341
342 D1(printk(KERN_DEBUG "jffs2_put_super returning\n")); 342 D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
343} 343}
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index 1842440d6564..0ca7a07db6c1 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -120,7 +120,7 @@ static void logfs_mtd_sync(struct super_block *sb)
120 struct mtd_info *mtd = logfs_super(sb)->s_mtd; 120 struct mtd_info *mtd = logfs_super(sb)->s_mtd;
121 121
122 if (mtd->sync) 122 if (mtd->sync)
123 mtd->sync(mtd); 123 mtd_sync(mtd);
124} 124}
125 125
126static int logfs_mtd_readpage(void *_sb, struct page *page) 126static int logfs_mtd_readpage(void *_sb, struct page *page)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 4129cb5c3de4..47ea19c1e523 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -206,15 +206,13 @@ struct mtd_info {
206 size_t len); 206 size_t len);
207 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, 207 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs,
208 unsigned long count, loff_t to, size_t *retlen); 208 unsigned long count, loff_t to, size_t *retlen);
209 void (*sync) (struct mtd_info *mtd);
209 210
210 /* Backing device capabilities for this device 211 /* Backing device capabilities for this device
211 * - provides mmap capabilities 212 * - provides mmap capabilities
212 */ 213 */
213 struct backing_dev_info *backing_dev_info; 214 struct backing_dev_info *backing_dev_info;
214 215
215 /* Sync */
216 void (*sync) (struct mtd_info *mtd);
217
218 /* Chip-supported device locking */ 216 /* Chip-supported device locking */
219 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 217 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
220 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 218 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
@@ -381,6 +379,11 @@ static inline int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
381 return mtd->writev(mtd, vecs, count, to, retlen); 379 return mtd->writev(mtd, vecs, count, to, retlen);
382} 380}
383 381
382static inline void mtd_sync(struct mtd_info *mtd)
383{
384 mtd->sync(mtd);
385}
386
384static inline struct mtd_info *dev_to_mtd(struct device *dev) 387static inline struct mtd_info *dev_to_mtd(struct device *dev)
385{ 388{
386 return dev ? dev_get_drvdata(dev) : NULL; 389 return dev ? dev_get_drvdata(dev) : NULL;