diff options
Diffstat (limited to 'drivers/mtd/devices/block2mtd.c')
-rw-r--r-- | drivers/mtd/devices/block2mtd.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 7ff403b2a0a0..4160b8334c53 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
20 | #include <linux/buffer_head.h> | 20 | #include <linux/buffer_head.h> |
21 | #include <linux/mutex.h> | ||
21 | 22 | ||
22 | #define VERSION "$Revision: 1.30 $" | 23 | #define VERSION "$Revision: 1.30 $" |
23 | 24 | ||
@@ -31,7 +32,7 @@ struct block2mtd_dev { | |||
31 | struct list_head list; | 32 | struct list_head list; |
32 | struct block_device *blkdev; | 33 | struct block_device *blkdev; |
33 | struct mtd_info mtd; | 34 | struct mtd_info mtd; |
34 | struct semaphore write_mutex; | 35 | struct mutex write_mutex; |
35 | }; | 36 | }; |
36 | 37 | ||
37 | 38 | ||
@@ -134,9 +135,9 @@ static int block2mtd_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
134 | int err; | 135 | int err; |
135 | 136 | ||
136 | instr->state = MTD_ERASING; | 137 | instr->state = MTD_ERASING; |
137 | down(&dev->write_mutex); | 138 | mutex_lock(&dev->write_mutex); |
138 | err = _block2mtd_erase(dev, from, len); | 139 | err = _block2mtd_erase(dev, from, len); |
139 | up(&dev->write_mutex); | 140 | mutex_unlock(&dev->write_mutex); |
140 | if (err) { | 141 | if (err) { |
141 | ERROR("erase failed err = %d", err); | 142 | ERROR("erase failed err = %d", err); |
142 | instr->state = MTD_ERASE_FAILED; | 143 | instr->state = MTD_ERASE_FAILED; |
@@ -249,9 +250,9 @@ static int block2mtd_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
249 | if (to + len > mtd->size) | 250 | if (to + len > mtd->size) |
250 | len = mtd->size - to; | 251 | len = mtd->size - to; |
251 | 252 | ||
252 | down(&dev->write_mutex); | 253 | mutex_lock(&dev->write_mutex); |
253 | err = _block2mtd_write(dev, buf, to, len, retlen); | 254 | err = _block2mtd_write(dev, buf, to, len, retlen); |
254 | up(&dev->write_mutex); | 255 | mutex_unlock(&dev->write_mutex); |
255 | if (err > 0) | 256 | if (err > 0) |
256 | err = 0; | 257 | err = 0; |
257 | return err; | 258 | return err; |
@@ -310,7 +311,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) | |||
310 | goto devinit_err; | 311 | goto devinit_err; |
311 | } | 312 | } |
312 | 313 | ||
313 | init_MUTEX(&dev->write_mutex); | 314 | mutex_init(&dev->write_mutex); |
314 | 315 | ||
315 | /* Setup the MTD structure */ | 316 | /* Setup the MTD structure */ |
316 | /* make the name contain the block device in */ | 317 | /* make the name contain the block device in */ |