diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-30 09:35:35 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:26:21 -0500 |
commit | 327cf2922b4edf0439b219469722d2a502e37349 (patch) | |
tree | 6fe4c70d0b4693950e7e20286a3b66bab82ac821 /drivers/mtd | |
parent | 1dbebd32562b3c2caeca35960e5cb00bfcc12900 (diff) |
mtd: do not use mtd->sync directly
This patch teaches 'mtd_sync()' to do nothing when the MTD driver does
not have the '->sync()' method, which allows us to remove all direct
'mtd->sync' accesses.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ftl.c | 3 | ||||
-rw-r--r-- | drivers/mtd/mtdblock.c | 7 | ||||
-rw-r--r-- | drivers/mtd/mtdchar.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdswap.c | 3 | ||||
-rw-r--r-- | drivers/mtd/rfd_ftl.c | 3 | ||||
-rw-r--r-- | drivers/mtd/ubi/kapi.c | 4 |
6 files changed, 7 insertions, 15 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index c9c90299c9e2..19d637266fcd 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -650,8 +650,7 @@ static int reclaim_block(partition_t *part) | |||
650 | if (queued) { | 650 | if (queued) { |
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 | mtd_sync(part->mbd.mtd); |
654 | mtd_sync(part->mbd.mtd); | ||
655 | } else { | 654 | } else { |
656 | static int ne = 0; | 655 | static int ne = 0; |
657 | if (++ne < 5) | 656 | if (++ne < 5) |
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index 496e1a6e8029..af6591237b9b 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c | |||
@@ -322,8 +322,7 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd) | |||
322 | 322 | ||
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 | mtd_sync(mbd->mtd); |
326 | mtd_sync(mbd->mtd); | ||
327 | vfree(mtdblk->cache_data); | 326 | vfree(mtdblk->cache_data); |
328 | } | 327 | } |
329 | 328 | ||
@@ -341,9 +340,7 @@ static int mtdblock_flush(struct mtd_blktrans_dev *dev) | |||
341 | mutex_lock(&mtdblk->cache_mutex); | 340 | mutex_lock(&mtdblk->cache_mutex); |
342 | write_cached_data(mtdblk); | 341 | write_cached_data(mtdblk); |
343 | mutex_unlock(&mtdblk->cache_mutex); | 342 | mutex_unlock(&mtdblk->cache_mutex); |
344 | 343 | mtd_sync(dev->mtd); | |
345 | if (dev->mtd->sync) | ||
346 | mtd_sync(dev->mtd); | ||
347 | return 0; | 344 | return 0; |
348 | } | 345 | } |
349 | 346 | ||
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 2020a169ed9c..23a51104aeb5 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -154,7 +154,7 @@ static int mtdchar_close(struct inode *inode, struct file *file) | |||
154 | pr_debug("MTD_close\n"); | 154 | pr_debug("MTD_close\n"); |
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)) |
158 | mtd_sync(mtd); | 158 | mtd_sync(mtd); |
159 | 159 | ||
160 | iput(mfi->ino); | 160 | iput(mfi->ino); |
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index 4441c08b082d..fe4426c1c736 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c | |||
@@ -1047,8 +1047,7 @@ static int mtdswap_flush(struct mtd_blktrans_dev *dev) | |||
1047 | { | 1047 | { |
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 | mtd_sync(d->mtd); |
1051 | mtd_sync(d->mtd); | ||
1052 | return 0; | 1051 | return 0; |
1053 | } | 1052 | } |
1054 | 1053 | ||
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c index 5426d42cdea7..233b946e5d66 100644 --- a/drivers/mtd/rfd_ftl.c +++ b/drivers/mtd/rfd_ftl.c | |||
@@ -448,8 +448,7 @@ static int reclaim_block(struct partition *part, u_long *old_sector) | |||
448 | int rc; | 448 | int rc; |
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 | mtd_sync(part->mbd.mtd); |
452 | mtd_sync(part->mbd.mtd); | ||
453 | 452 | ||
454 | score = 0x7fffffff; /* MAX_INT */ | 453 | score = 0x7fffffff; /* MAX_INT */ |
455 | best_block = -1; | 454 | best_block = -1; |
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 9f265cc1a0d3..9fdb35367fe0 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c | |||
@@ -714,9 +714,7 @@ int ubi_sync(int ubi_num) | |||
714 | if (!ubi) | 714 | if (!ubi) |
715 | return -ENODEV; | 715 | return -ENODEV; |
716 | 716 | ||
717 | if (ubi->mtd->sync) | 717 | mtd_sync(ubi->mtd); |
718 | mtd_sync(ubi->mtd); | ||
719 | |||
720 | ubi_put_device(ubi); | 718 | ubi_put_device(ubi); |
721 | return 0; | 719 | return 0; |
722 | } | 720 | } |