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/mtdblock.c | |
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/mtdblock.c')
-rw-r--r-- | drivers/mtd/mtdblock.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index e84756644fd..2cef280e388 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c | |||
@@ -19,11 +19,13 @@ | |||
19 | 19 | ||
20 | #include <linux/mtd/mtd.h> | 20 | #include <linux/mtd/mtd.h> |
21 | #include <linux/mtd/blktrans.h> | 21 | #include <linux/mtd/blktrans.h> |
22 | #include <linux/mutex.h> | ||
23 | |||
22 | 24 | ||
23 | static struct mtdblk_dev { | 25 | static struct mtdblk_dev { |
24 | struct mtd_info *mtd; | 26 | struct mtd_info *mtd; |
25 | int count; | 27 | int count; |
26 | struct semaphore cache_sem; | 28 | struct mutex cache_mutex; |
27 | unsigned char *cache_data; | 29 | unsigned char *cache_data; |
28 | unsigned long cache_offset; | 30 | unsigned long cache_offset; |
29 | unsigned int cache_size; | 31 | unsigned int cache_size; |
@@ -284,7 +286,7 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) | |||
284 | mtdblk->count = 1; | 286 | mtdblk->count = 1; |
285 | mtdblk->mtd = mtd; | 287 | mtdblk->mtd = mtd; |
286 | 288 | ||
287 | init_MUTEX (&mtdblk->cache_sem); | 289 | mutex_init(&mtdblk->cache_mutex); |
288 | mtdblk->cache_state = STATE_EMPTY; | 290 | mtdblk->cache_state = STATE_EMPTY; |
289 | if ((mtdblk->mtd->flags & MTD_CAP_RAM) != MTD_CAP_RAM && | 291 | if ((mtdblk->mtd->flags & MTD_CAP_RAM) != MTD_CAP_RAM && |
290 | mtdblk->mtd->erasesize) { | 292 | mtdblk->mtd->erasesize) { |
@@ -306,9 +308,9 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd) | |||
306 | 308 | ||
307 | DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n"); | 309 | DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n"); |
308 | 310 | ||
309 | down(&mtdblk->cache_sem); | 311 | mutex_lock(&mtdblk->cache_mutex); |
310 | write_cached_data(mtdblk); | 312 | write_cached_data(mtdblk); |
311 | up(&mtdblk->cache_sem); | 313 | mutex_unlock(&mtdblk->cache_mutex); |
312 | 314 | ||
313 | if (!--mtdblk->count) { | 315 | if (!--mtdblk->count) { |
314 | /* It was the last usage. Free the device */ | 316 | /* It was the last usage. Free the device */ |
@@ -327,9 +329,9 @@ static int mtdblock_flush(struct mtd_blktrans_dev *dev) | |||
327 | { | 329 | { |
328 | struct mtdblk_dev *mtdblk = mtdblks[dev->devnum]; | 330 | struct mtdblk_dev *mtdblk = mtdblks[dev->devnum]; |
329 | 331 | ||
330 | down(&mtdblk->cache_sem); | 332 | mutex_lock(&mtdblk->cache_mutex); |
331 | write_cached_data(mtdblk); | 333 | write_cached_data(mtdblk); |
332 | up(&mtdblk->cache_sem); | 334 | mutex_unlock(&mtdblk->cache_mutex); |
333 | 335 | ||
334 | if (mtdblk->mtd->sync) | 336 | if (mtdblk->mtd->sync) |
335 | mtdblk->mtd->sync(mtdblk->mtd); | 337 | mtdblk->mtd->sync(mtdblk->mtd); |