Commit 85f2f2a809d658c15b574df02ede92090f45a1f2

Authored by Artem Bityutskiy
Committed by David Woodhouse
1 parent b0a31f7b2a

mtd: introduce mtd_sync interface

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Showing 11 changed files with 17 additions and 14 deletions Side-by-side Diff

... ... @@ -651,7 +651,7 @@
651 651 pr_debug("ftl_cs: waiting for transfer "
652 652 "unit to be prepared...\n");
653 653 if (part->mbd.mtd->sync)
654   - part->mbd.mtd->sync(part->mbd.mtd);
  654 + mtd_sync(part->mbd.mtd);
655 655 } else {
656 656 static int ne = 0;
657 657 if (++ne < 5)
drivers/mtd/mtdblock.c
... ... @@ -323,7 +323,7 @@
323 323 if (!--mtdblk->count) {
324 324 /* It was the last usage. Free the cache */
325 325 if (mbd->mtd->sync)
326   - mbd->mtd->sync(mbd->mtd);
  326 + mtd_sync(mbd->mtd);
327 327 vfree(mtdblk->cache_data);
328 328 }
329 329  
... ... @@ -343,7 +343,7 @@
343 343 mutex_unlock(&mtdblk->cache_mutex);
344 344  
345 345 if (dev->mtd->sync)
346   - dev->mtd->sync(dev->mtd);
  346 + mtd_sync(dev->mtd);
347 347 return 0;
348 348 }
349 349  
drivers/mtd/mtdchar.c
... ... @@ -155,7 +155,7 @@
155 155  
156 156 /* Only sync if opened RW */
157 157 if ((file->f_mode & FMODE_WRITE) && mtd->sync)
158   - mtd->sync(mtd);
  158 + mtd_sync(mtd);
159 159  
160 160 iput(mfi->ino);
161 161  
drivers/mtd/mtdconcat.c
... ... @@ -620,7 +620,7 @@
620 620  
621 621 for (i = 0; i < concat->num_subdev; i++) {
622 622 struct mtd_info *subdev = concat->subdev[i];
623   - subdev->sync(subdev);
  623 + mtd_sync(subdev);
624 624 }
625 625 }
626 626  
drivers/mtd/mtdpart.c
... ... @@ -301,7 +301,7 @@
301 301 static void part_sync(struct mtd_info *mtd)
302 302 {
303 303 struct mtd_part *part = PART(mtd);
304   - part->master->sync(part->master);
  304 + mtd_sync(part->master);
305 305 }
306 306  
307 307 static int part_suspend(struct mtd_info *mtd)
drivers/mtd/mtdswap.c
... ... @@ -1048,7 +1048,7 @@
1048 1048 struct mtdswap_dev *d = MTDSWAP_MBD_TO_MTDSWAP(dev);
1049 1049  
1050 1050 if (d->mtd->sync)
1051   - d->mtd->sync(d->mtd);
  1051 + mtd_sync(d->mtd);
1052 1052 return 0;
1053 1053 }
1054 1054  
drivers/mtd/rfd_ftl.c
... ... @@ -449,7 +449,7 @@
449 449  
450 450 /* we have a race if sync doesn't exist */
451 451 if (part->mbd.mtd->sync)
452   - part->mbd.mtd->sync(part->mbd.mtd);
  452 + mtd_sync(part->mbd.mtd);
453 453  
454 454 score = 0x7fffffff; /* MAX_INT */
455 455 best_block = -1;
drivers/mtd/ubi/kapi.c
... ... @@ -715,7 +715,7 @@
715 715 return -ENODEV;
716 716  
717 717 if (ubi->mtd->sync)
718   - ubi->mtd->sync(ubi->mtd);
  718 + mtd_sync(ubi->mtd);
719 719  
720 720 ubi_put_device(ubi);
721 721 return 0;
... ... @@ -337,7 +337,7 @@
337 337 kfree(c->inocache_list);
338 338 jffs2_clear_xattr_subsystem(c);
339 339 if (c->mtd->sync)
340   - c->mtd->sync(c->mtd);
  340 + mtd_sync(c->mtd);
341 341  
342 342 D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
343 343 }
... ... @@ -120,7 +120,7 @@
120 120 struct mtd_info *mtd = logfs_super(sb)->s_mtd;
121 121  
122 122 if (mtd->sync)
123   - mtd->sync(mtd);
  123 + mtd_sync(mtd);
124 124 }
125 125  
126 126 static int logfs_mtd_readpage(void *_sb, struct page *page)
include/linux/mtd/mtd.h
... ... @@ -206,15 +206,13 @@
206 206 size_t len);
207 207 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs,
208 208 unsigned long count, loff_t to, size_t *retlen);
  209 + void (*sync) (struct mtd_info *mtd);
209 210  
210 211 /* Backing device capabilities for this device
211 212 * - provides mmap capabilities
212 213 */
213 214 struct backing_dev_info *backing_dev_info;
214 215  
215   - /* Sync */
216   - void (*sync) (struct mtd_info *mtd);
217   -
218 216 /* Chip-supported device locking */
219 217 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
220 218 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
... ... @@ -379,6 +377,11 @@
379 377 unsigned long count, loff_t to, size_t *retlen)
380 378 {
381 379 return mtd->writev(mtd, vecs, count, to, retlen);
  380 +}
  381 +
  382 +static inline void mtd_sync(struct mtd_info *mtd)
  383 +{
  384 + mtd->sync(mtd);
382 385 }
383 386  
384 387 static inline struct mtd_info *dev_to_mtd(struct device *dev)