diff options
| author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-23 12:03:12 -0500 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:25:35 -0500 |
| commit | 85f2f2a809d658c15b574df02ede92090f45a1f2 (patch) | |
| tree | 7d4ae7ca646db856aca7f2509c404b9d938fee0b | |
| parent | b0a31f7b2a668f00a8d0546dfeed65fac871b2da (diff) | |
mtd: introduce mtd_sync interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| -rw-r--r-- | drivers/mtd/ftl.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/mtdblock.c | 4 | ||||
| -rw-r--r-- | drivers/mtd/mtdchar.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/mtdconcat.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/mtdpart.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/mtdswap.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/rfd_ftl.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/ubi/kapi.c | 2 | ||||
| -rw-r--r-- | fs/jffs2/super.c | 2 | ||||
| -rw-r--r-- | fs/logfs/dev_mtd.c | 2 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 9 |
11 files changed, 17 insertions, 14 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index d591b1d0a6c..c9c90299c9e 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 ac7f1f1faa2..496e1a6e802 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 86308acb40e..b5722ecf19d 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 6fdae191e1b..cc2336edfe2 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 c0bfa88c82f..2b545052795 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) | |||
| 301 | static void part_sync(struct mtd_info *mtd) | 301 | static 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 | ||
| 307 | static int part_suspend(struct mtd_info *mtd) | 307 | static int part_suspend(struct mtd_info *mtd) |
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index 85797390e3d..cb794e76101 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 c594bb7abfa..5426d42cdea 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 1a35fc5e3b4..9f265cc1a0d 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 e7e97445411..e78bf3cd1b7 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 1842440d656..0ca7a07db6c 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 | ||
| 126 | static int logfs_mtd_readpage(void *_sb, struct page *page) | 126 | static int logfs_mtd_readpage(void *_sb, struct page *page) |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 4129cb5c3de..47ea19c1e52 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 | ||
| 382 | static inline void mtd_sync(struct mtd_info *mtd) | ||
| 383 | { | ||
| 384 | mtd->sync(mtd); | ||
| 385 | } | ||
| 386 | |||
| 384 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | 387 | static 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; |
