diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-31 05:29:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:48 -0500 |
commit | 48b192686dd20cb1576ae1d8ccd17a07971ef24a (patch) | |
tree | a4e5f5a74c230439fdbdc895f7874c68bf505565 /drivers/mtd/devices | |
parent | 040d79f906654d55c810313f29c6605593bf21c5 (diff) |
[PATCH] sem2mutex: drivers/mtd/
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r-- | drivers/mtd/devices/blkmtd.c | 10 | ||||
-rw-r--r-- | drivers/mtd/devices/block2mtd.c | 13 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2000.c | 30 |
3 files changed, 27 insertions, 26 deletions
diff --git a/drivers/mtd/devices/blkmtd.c b/drivers/mtd/devices/blkmtd.c index 04f864d238db..d732532635a1 100644 --- a/drivers/mtd/devices/blkmtd.c +++ b/drivers/mtd/devices/blkmtd.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/mtd/mtd.h> | 31 | #include <linux/mtd/mtd.h> |
32 | 32 | #include <linux/mutex.h> | |
33 | 33 | ||
34 | #define err(format, arg...) printk(KERN_ERR "blkmtd: " format "\n" , ## arg) | 34 | #define err(format, arg...) printk(KERN_ERR "blkmtd: " format "\n" , ## arg) |
35 | #define info(format, arg...) printk(KERN_INFO "blkmtd: " format "\n" , ## arg) | 35 | #define info(format, arg...) printk(KERN_INFO "blkmtd: " format "\n" , ## arg) |
@@ -46,7 +46,7 @@ struct blkmtd_dev { | |||
46 | struct list_head list; | 46 | struct list_head list; |
47 | struct block_device *blkdev; | 47 | struct block_device *blkdev; |
48 | struct mtd_info mtd_info; | 48 | struct mtd_info mtd_info; |
49 | struct semaphore wrbuf_mutex; | 49 | struct mutex wrbuf_mutex; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | 52 | ||
@@ -268,7 +268,7 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to, | |||
268 | if(end_len) | 268 | if(end_len) |
269 | pagecnt++; | 269 | pagecnt++; |
270 | 270 | ||
271 | down(&dev->wrbuf_mutex); | 271 | mutex_lock(&dev->wrbuf_mutex); |
272 | 272 | ||
273 | DEBUG(3, "blkmtd: write: start_len = %zd len = %zd end_len = %zd pagecnt = %d\n", | 273 | DEBUG(3, "blkmtd: write: start_len = %zd len = %zd end_len = %zd pagecnt = %d\n", |
274 | start_len, len, end_len, pagecnt); | 274 | start_len, len, end_len, pagecnt); |
@@ -376,7 +376,7 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to, | |||
376 | blkmtd_write_out(bio); | 376 | blkmtd_write_out(bio); |
377 | 377 | ||
378 | DEBUG(2, "blkmtd: write: end, retlen = %zd, err = %d\n", *retlen, err); | 378 | DEBUG(2, "blkmtd: write: end, retlen = %zd, err = %d\n", *retlen, err); |
379 | up(&dev->wrbuf_mutex); | 379 | mutex_unlock(&dev->wrbuf_mutex); |
380 | 380 | ||
381 | if(retlen) | 381 | if(retlen) |
382 | *retlen = thislen; | 382 | *retlen = thislen; |
@@ -659,7 +659,7 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size | |||
659 | memset(dev, 0, sizeof(struct blkmtd_dev)); | 659 | memset(dev, 0, sizeof(struct blkmtd_dev)); |
660 | dev->blkdev = bdev; | 660 | dev->blkdev = bdev; |
661 | if(!readonly) { | 661 | if(!readonly) { |
662 | init_MUTEX(&dev->wrbuf_mutex); | 662 | mutex_init(&dev->wrbuf_mutex); |
663 | } | 663 | } |
664 | 664 | ||
665 | dev->mtd_info.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; | 665 | dev->mtd_info.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; |
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 */ |
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index 0f2c956a90d3..23e7a5c7d2c1 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -606,7 +606,7 @@ static void DoC2k_init(struct mtd_info *mtd) | |||
606 | 606 | ||
607 | this->curfloor = -1; | 607 | this->curfloor = -1; |
608 | this->curchip = -1; | 608 | this->curchip = -1; |
609 | init_MUTEX(&this->lock); | 609 | mutex_init(&this->lock); |
610 | 610 | ||
611 | /* Ident all the chips present. */ | 611 | /* Ident all the chips present. */ |
612 | DoC_ScanChips(this, maxchips); | 612 | DoC_ScanChips(this, maxchips); |
@@ -646,7 +646,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
646 | if (from >= this->totlen) | 646 | if (from >= this->totlen) |
647 | return -EINVAL; | 647 | return -EINVAL; |
648 | 648 | ||
649 | down(&this->lock); | 649 | mutex_lock(&this->lock); |
650 | 650 | ||
651 | *retlen = 0; | 651 | *retlen = 0; |
652 | while (left) { | 652 | while (left) { |
@@ -775,7 +775,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
775 | buf += len; | 775 | buf += len; |
776 | } | 776 | } |
777 | 777 | ||
778 | up(&this->lock); | 778 | mutex_unlock(&this->lock); |
779 | 779 | ||
780 | return ret; | 780 | return ret; |
781 | } | 781 | } |
@@ -804,7 +804,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
804 | if (to >= this->totlen) | 804 | if (to >= this->totlen) |
805 | return -EINVAL; | 805 | return -EINVAL; |
806 | 806 | ||
807 | down(&this->lock); | 807 | mutex_lock(&this->lock); |
808 | 808 | ||
809 | *retlen = 0; | 809 | *retlen = 0; |
810 | while (left) { | 810 | while (left) { |
@@ -874,7 +874,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
874 | printk(KERN_ERR "Error programming flash\n"); | 874 | printk(KERN_ERR "Error programming flash\n"); |
875 | /* Error in programming */ | 875 | /* Error in programming */ |
876 | *retlen = 0; | 876 | *retlen = 0; |
877 | up(&this->lock); | 877 | mutex_unlock(&this->lock); |
878 | return -EIO; | 878 | return -EIO; |
879 | } | 879 | } |
880 | 880 | ||
@@ -936,7 +936,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
936 | printk(KERN_ERR "Error programming flash\n"); | 936 | printk(KERN_ERR "Error programming flash\n"); |
937 | /* Error in programming */ | 937 | /* Error in programming */ |
938 | *retlen = 0; | 938 | *retlen = 0; |
939 | up(&this->lock); | 939 | mutex_unlock(&this->lock); |
940 | return -EIO; | 940 | return -EIO; |
941 | } | 941 | } |
942 | 942 | ||
@@ -957,7 +957,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
957 | 957 | ||
958 | ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x); | 958 | ret = doc_write_oob_nolock(mtd, to, 8, &dummy, x); |
959 | if (ret) { | 959 | if (ret) { |
960 | up(&this->lock); | 960 | mutex_unlock(&this->lock); |
961 | return ret; | 961 | return ret; |
962 | } | 962 | } |
963 | } | 963 | } |
@@ -967,7 +967,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
967 | buf += len; | 967 | buf += len; |
968 | } | 968 | } |
969 | 969 | ||
970 | up(&this->lock); | 970 | mutex_unlock(&this->lock); |
971 | return 0; | 971 | return 0; |
972 | } | 972 | } |
973 | 973 | ||
@@ -1038,7 +1038,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
1038 | int len256 = 0, ret; | 1038 | int len256 = 0, ret; |
1039 | struct Nand *mychip; | 1039 | struct Nand *mychip; |
1040 | 1040 | ||
1041 | down(&this->lock); | 1041 | mutex_lock(&this->lock); |
1042 | 1042 | ||
1043 | mychip = &this->chips[ofs >> this->chipshift]; | 1043 | mychip = &this->chips[ofs >> this->chipshift]; |
1044 | 1044 | ||
@@ -1084,7 +1084,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
1084 | 1084 | ||
1085 | ret = DoC_WaitReady(this); | 1085 | ret = DoC_WaitReady(this); |
1086 | 1086 | ||
1087 | up(&this->lock); | 1087 | mutex_unlock(&this->lock); |
1088 | return ret; | 1088 | return ret; |
1089 | 1089 | ||
1090 | } | 1090 | } |
@@ -1198,10 +1198,10 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
1198 | struct DiskOnChip *this = mtd->priv; | 1198 | struct DiskOnChip *this = mtd->priv; |
1199 | int ret; | 1199 | int ret; |
1200 | 1200 | ||
1201 | down(&this->lock); | 1201 | mutex_lock(&this->lock); |
1202 | ret = doc_write_oob_nolock(mtd, ofs, len, retlen, buf); | 1202 | ret = doc_write_oob_nolock(mtd, ofs, len, retlen, buf); |
1203 | 1203 | ||
1204 | up(&this->lock); | 1204 | mutex_unlock(&this->lock); |
1205 | return ret; | 1205 | return ret; |
1206 | } | 1206 | } |
1207 | 1207 | ||
@@ -1215,10 +1215,10 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
1215 | struct Nand *mychip; | 1215 | struct Nand *mychip; |
1216 | int status; | 1216 | int status; |
1217 | 1217 | ||
1218 | down(&this->lock); | 1218 | mutex_lock(&this->lock); |
1219 | 1219 | ||
1220 | if (ofs & (mtd->erasesize-1) || len & (mtd->erasesize-1)) { | 1220 | if (ofs & (mtd->erasesize-1) || len & (mtd->erasesize-1)) { |
1221 | up(&this->lock); | 1221 | mutex_unlock(&this->lock); |
1222 | return -EINVAL; | 1222 | return -EINVAL; |
1223 | } | 1223 | } |
1224 | 1224 | ||
@@ -1266,7 +1266,7 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
1266 | callback: | 1266 | callback: |
1267 | mtd_erase_callback(instr); | 1267 | mtd_erase_callback(instr); |
1268 | 1268 | ||
1269 | up(&this->lock); | 1269 | mutex_unlock(&this->lock); |
1270 | return 0; | 1270 | return 0; |
1271 | } | 1271 | } |
1272 | 1272 | ||