diff options
Diffstat (limited to 'drivers/mtd/devices/block2mtd.c')
-rw-r--r-- | drivers/mtd/devices/block2mtd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 2cf0cc6a4189..f29a6f9df6e7 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -224,7 +224,7 @@ static void block2mtd_free_device(struct block2mtd_dev *dev) | |||
224 | if (dev->blkdev) { | 224 | if (dev->blkdev) { |
225 | invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, | 225 | invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, |
226 | 0, -1); | 226 | 0, -1); |
227 | close_bdev_exclusive(dev->blkdev, FMODE_READ|FMODE_WRITE); | 227 | blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); |
228 | } | 228 | } |
229 | 229 | ||
230 | kfree(dev); | 230 | kfree(dev); |
@@ -234,6 +234,7 @@ static void block2mtd_free_device(struct block2mtd_dev *dev) | |||
234 | /* FIXME: ensure that mtd->size % erase_size == 0 */ | 234 | /* FIXME: ensure that mtd->size % erase_size == 0 */ |
235 | static struct block2mtd_dev *add_device(char *devname, int erase_size) | 235 | static struct block2mtd_dev *add_device(char *devname, int erase_size) |
236 | { | 236 | { |
237 | const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; | ||
237 | struct block_device *bdev; | 238 | struct block_device *bdev; |
238 | struct block2mtd_dev *dev; | 239 | struct block2mtd_dev *dev; |
239 | char *name; | 240 | char *name; |
@@ -246,7 +247,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) | |||
246 | return NULL; | 247 | return NULL; |
247 | 248 | ||
248 | /* Get a handle on the device */ | 249 | /* Get a handle on the device */ |
249 | bdev = open_bdev_exclusive(devname, FMODE_READ|FMODE_WRITE, NULL); | 250 | bdev = blkdev_get_by_path(devname, mode, dev); |
250 | #ifndef MODULE | 251 | #ifndef MODULE |
251 | if (IS_ERR(bdev)) { | 252 | if (IS_ERR(bdev)) { |
252 | 253 | ||
@@ -254,9 +255,8 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) | |||
254 | to resolve the device name by other means. */ | 255 | to resolve the device name by other means. */ |
255 | 256 | ||
256 | dev_t devt = name_to_dev_t(devname); | 257 | dev_t devt = name_to_dev_t(devname); |
257 | if (devt) { | 258 | if (devt) |
258 | bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); | 259 | bdev = blkdev_get_by_dev(devt, mode, dev); |
259 | } | ||
260 | } | 260 | } |
261 | #endif | 261 | #endif |
262 | 262 | ||