aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtd_blkdevs.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
commit67577927e8d7a1f4b09b4992df640eadc6aacb36 (patch)
tree2e9efe6b5745965faf0dcc084d4613d9356263f9 /drivers/mtd/mtd_blkdevs.c
parent6fe4c590313133ebd5dadb769031489ff178ece1 (diff)
parent51f00a471ce8f359627dd99aeac322947a0e491b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Conflicts: drivers/mtd/mtd_blkdevs.c Merge Grant's device-tree bits so that we can apply the subsequent fixes. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r--drivers/mtd/mtd_blkdevs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 63790e975d20..f9329794f3b5 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -29,7 +29,6 @@
29#include <linux/blkdev.h> 29#include <linux/blkdev.h>
30#include <linux/blkpg.h> 30#include <linux/blkpg.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/smp_lock.h>
33#include <linux/hdreg.h> 32#include <linux/hdreg.h>
34#include <linux/init.h> 33#include <linux/init.h>
35#include <linux/mutex.h> 34#include <linux/mutex.h>
@@ -38,6 +37,7 @@
38 37
39#include "mtdcore.h" 38#include "mtdcore.h"
40 39
40static DEFINE_MUTEX(mtd_blkdevs_mutex);
41static LIST_HEAD(blktrans_majors); 41static LIST_HEAD(blktrans_majors);
42static DEFINE_MUTEX(blktrans_ref_mutex); 42static DEFINE_MUTEX(blktrans_ref_mutex);
43 43
@@ -185,6 +185,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
185 if (!dev) 185 if (!dev)
186 return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/ 186 return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/
187 187
188 mutex_lock(&mtd_blkdevs_mutex);
188 mutex_lock(&dev->lock); 189 mutex_lock(&dev->lock);
189 190
190 if (dev->open++) 191 if (dev->open++)
@@ -201,6 +202,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
201unlock: 202unlock:
202 mutex_unlock(&dev->lock); 203 mutex_unlock(&dev->lock);
203 blktrans_dev_put(dev); 204 blktrans_dev_put(dev);
205 mutex_unlock(&mtd_blkdevs_mutex);
204 return ret; 206 return ret;
205} 207}
206 208
@@ -212,6 +214,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode)
212 if (!dev) 214 if (!dev)
213 return ret; 215 return ret;
214 216
217 mutex_lock(&mtd_blkdevs_mutex);
215 mutex_lock(&dev->lock); 218 mutex_lock(&dev->lock);
216 219
217 if (--dev->open) 220 if (--dev->open)
@@ -227,6 +230,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode)
227unlock: 230unlock:
228 mutex_unlock(&dev->lock); 231 mutex_unlock(&dev->lock);
229 blktrans_dev_put(dev); 232 blktrans_dev_put(dev);
233 mutex_unlock(&mtd_blkdevs_mutex);
230 return ret; 234 return ret;
231} 235}
232 236
@@ -259,6 +263,7 @@ static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
259 if (!dev) 263 if (!dev)
260 return ret; 264 return ret;
261 265
266 mutex_lock(&mtd_blkdevs_mutex);
262 mutex_lock(&dev->lock); 267 mutex_lock(&dev->lock);
263 268
264 if (!dev->mtd) 269 if (!dev->mtd)
@@ -273,6 +278,7 @@ static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
273 } 278 }
274unlock: 279unlock:
275 mutex_unlock(&dev->lock); 280 mutex_unlock(&dev->lock);
281 mutex_unlock(&mtd_blkdevs_mutex);
276 blktrans_dev_put(dev); 282 blktrans_dev_put(dev);
277 return ret; 283 return ret;
278} 284}