aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtd_blkdevs.c
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@systec-electronic.com>2012-01-10 07:26:58 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:11:11 -0400
commit70d5098a4b1551864dd7df43f67b7f606a1a6438 (patch)
tree288f6f9cdb1866ea9648c6590448254c40af2c81 /drivers/mtd/mtd_blkdevs.c
parent2ff5e1532dd37e1bd8ac72da3f7f0e2b310102fb (diff)
mtd: mtdblock: call mtd_sync() only if opened for write
Because it is useless to call it if the device is opened in R/O mode, and also harmful: on CFI NOR flash it may block for long time waiting for erase operations to complete is another partition with a R/W file-system on this chip. Artem Bityutskiy: write commit message, amend the patch to match the latest tree (we use mtd_sync(), not mtd->sync() nowadays). Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r--drivers/mtd/mtd_blkdevs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 424ca5f93c6c..f1f06715d4e0 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -233,6 +233,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
233 ret = __get_mtd_device(dev->mtd); 233 ret = __get_mtd_device(dev->mtd);
234 if (ret) 234 if (ret)
235 goto error_release; 235 goto error_release;
236 dev->file_mode = mode;
236 237
237unlock: 238unlock:
238 dev->open++; 239 dev->open++;