Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 327cf292 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by David Woodhouse
Browse files

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: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 1dbebd32
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -650,7 +650,6 @@ static int reclaim_block(partition_t *part)
	    if (queued) {
		pr_debug("ftl_cs: waiting for transfer "
		      "unit to be prepared...\n");
		if (part->mbd.mtd->sync)
		mtd_sync(part->mbd.mtd);
	    } else {
		static int ne = 0;
+2 −5
Original line number Diff line number Diff line
@@ -322,7 +322,6 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd)

	if (!--mtdblk->count) {
		/* It was the last usage. Free the cache */
		if (mbd->mtd->sync)
		mtd_sync(mbd->mtd);
		vfree(mtdblk->cache_data);
	}
@@ -341,8 +340,6 @@ static int mtdblock_flush(struct mtd_blktrans_dev *dev)
	mutex_lock(&mtdblk->cache_mutex);
	write_cached_data(mtdblk);
	mutex_unlock(&mtdblk->cache_mutex);

	if (dev->mtd->sync)
	mtd_sync(dev->mtd);
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ static int mtdchar_close(struct inode *inode, struct file *file)
	pr_debug("MTD_close\n");

	/* Only sync if opened RW */
	if ((file->f_mode & FMODE_WRITE) && mtd->sync)
	if ((file->f_mode & FMODE_WRITE))
		mtd_sync(mtd);

	iput(mfi->ino);
+1 −2
Original line number Diff line number Diff line
@@ -1047,7 +1047,6 @@ static int mtdswap_flush(struct mtd_blktrans_dev *dev)
{
	struct mtdswap_dev *d = MTDSWAP_MBD_TO_MTDSWAP(dev);

	if (d->mtd->sync)
	mtd_sync(d->mtd);
	return 0;
}
+1 −2
Original line number Diff line number Diff line
@@ -448,7 +448,6 @@ static int reclaim_block(struct partition *part, u_long *old_sector)
	int rc;

	/* we have a race if sync doesn't exist */
	if (part->mbd.mtd->sync)
	mtd_sync(part->mbd.mtd);

	score = 0x7fffffff; /* MAX_INT */
Loading