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/mtd_blkdevs.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/mtd_blkdevs.c')
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 840dd66ce2dc..458d3c8ae1ee 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -19,12 +19,12 @@ | |||
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/hdreg.h> | 20 | #include <linux/hdreg.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <asm/semaphore.h> | 22 | #include <linux/mutex.h> |
23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
24 | 24 | ||
25 | static LIST_HEAD(blktrans_majors); | 25 | static LIST_HEAD(blktrans_majors); |
26 | 26 | ||
27 | extern struct semaphore mtd_table_mutex; | 27 | extern struct mutex mtd_table_mutex; |
28 | extern struct mtd_info *mtd_table[]; | 28 | extern struct mtd_info *mtd_table[]; |
29 | 29 | ||
30 | struct mtd_blkcore_priv { | 30 | struct mtd_blkcore_priv { |
@@ -122,9 +122,9 @@ static int mtd_blktrans_thread(void *arg) | |||
122 | 122 | ||
123 | spin_unlock_irq(rq->queue_lock); | 123 | spin_unlock_irq(rq->queue_lock); |
124 | 124 | ||
125 | down(&dev->sem); | 125 | mutex_lock(&dev->lock); |
126 | res = do_blktrans_request(tr, dev, req); | 126 | res = do_blktrans_request(tr, dev, req); |
127 | up(&dev->sem); | 127 | mutex_unlock(&dev->lock); |
128 | 128 | ||
129 | spin_lock_irq(rq->queue_lock); | 129 | spin_lock_irq(rq->queue_lock); |
130 | 130 | ||
@@ -235,8 +235,8 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) | |||
235 | int last_devnum = -1; | 235 | int last_devnum = -1; |
236 | struct gendisk *gd; | 236 | struct gendisk *gd; |
237 | 237 | ||
238 | if (!down_trylock(&mtd_table_mutex)) { | 238 | if (!!mutex_trylock(&mtd_table_mutex)) { |
239 | up(&mtd_table_mutex); | 239 | mutex_unlock(&mtd_table_mutex); |
240 | BUG(); | 240 | BUG(); |
241 | } | 241 | } |
242 | 242 | ||
@@ -267,7 +267,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) | |||
267 | return -EBUSY; | 267 | return -EBUSY; |
268 | } | 268 | } |
269 | 269 | ||
270 | init_MUTEX(&new->sem); | 270 | mutex_init(&new->lock); |
271 | list_add_tail(&new->list, &tr->devs); | 271 | list_add_tail(&new->list, &tr->devs); |
272 | added: | 272 | added: |
273 | if (!tr->writesect) | 273 | if (!tr->writesect) |
@@ -313,8 +313,8 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) | |||
313 | 313 | ||
314 | int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old) | 314 | int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old) |
315 | { | 315 | { |
316 | if (!down_trylock(&mtd_table_mutex)) { | 316 | if (!!mutex_trylock(&mtd_table_mutex)) { |
317 | up(&mtd_table_mutex); | 317 | mutex_unlock(&mtd_table_mutex); |
318 | BUG(); | 318 | BUG(); |
319 | } | 319 | } |
320 | 320 | ||
@@ -378,14 +378,14 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) | |||
378 | 378 | ||
379 | memset(tr->blkcore_priv, 0, sizeof(*tr->blkcore_priv)); | 379 | memset(tr->blkcore_priv, 0, sizeof(*tr->blkcore_priv)); |
380 | 380 | ||
381 | down(&mtd_table_mutex); | 381 | mutex_lock(&mtd_table_mutex); |
382 | 382 | ||
383 | ret = register_blkdev(tr->major, tr->name); | 383 | ret = register_blkdev(tr->major, tr->name); |
384 | if (ret) { | 384 | if (ret) { |
385 | printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n", | 385 | printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n", |
386 | tr->name, tr->major, ret); | 386 | tr->name, tr->major, ret); |
387 | kfree(tr->blkcore_priv); | 387 | kfree(tr->blkcore_priv); |
388 | up(&mtd_table_mutex); | 388 | mutex_unlock(&mtd_table_mutex); |
389 | return ret; | 389 | return ret; |
390 | } | 390 | } |
391 | spin_lock_init(&tr->blkcore_priv->queue_lock); | 391 | spin_lock_init(&tr->blkcore_priv->queue_lock); |
@@ -396,7 +396,7 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) | |||
396 | if (!tr->blkcore_priv->rq) { | 396 | if (!tr->blkcore_priv->rq) { |
397 | unregister_blkdev(tr->major, tr->name); | 397 | unregister_blkdev(tr->major, tr->name); |
398 | kfree(tr->blkcore_priv); | 398 | kfree(tr->blkcore_priv); |
399 | up(&mtd_table_mutex); | 399 | mutex_unlock(&mtd_table_mutex); |
400 | return -ENOMEM; | 400 | return -ENOMEM; |
401 | } | 401 | } |
402 | 402 | ||
@@ -407,7 +407,7 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) | |||
407 | blk_cleanup_queue(tr->blkcore_priv->rq); | 407 | blk_cleanup_queue(tr->blkcore_priv->rq); |
408 | unregister_blkdev(tr->major, tr->name); | 408 | unregister_blkdev(tr->major, tr->name); |
409 | kfree(tr->blkcore_priv); | 409 | kfree(tr->blkcore_priv); |
410 | up(&mtd_table_mutex); | 410 | mutex_unlock(&mtd_table_mutex); |
411 | return ret; | 411 | return ret; |
412 | } | 412 | } |
413 | 413 | ||
@@ -419,7 +419,7 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) | |||
419 | tr->add_mtd(tr, mtd_table[i]); | 419 | tr->add_mtd(tr, mtd_table[i]); |
420 | } | 420 | } |
421 | 421 | ||
422 | up(&mtd_table_mutex); | 422 | mutex_unlock(&mtd_table_mutex); |
423 | 423 | ||
424 | return 0; | 424 | return 0; |
425 | } | 425 | } |
@@ -428,7 +428,7 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) | |||
428 | { | 428 | { |
429 | struct list_head *this, *next; | 429 | struct list_head *this, *next; |
430 | 430 | ||
431 | down(&mtd_table_mutex); | 431 | mutex_lock(&mtd_table_mutex); |
432 | 432 | ||
433 | /* Clean up the kernel thread */ | 433 | /* Clean up the kernel thread */ |
434 | tr->blkcore_priv->exiting = 1; | 434 | tr->blkcore_priv->exiting = 1; |
@@ -446,7 +446,7 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) | |||
446 | blk_cleanup_queue(tr->blkcore_priv->rq); | 446 | blk_cleanup_queue(tr->blkcore_priv->rq); |
447 | unregister_blkdev(tr->major, tr->name); | 447 | unregister_blkdev(tr->major, tr->name); |
448 | 448 | ||
449 | up(&mtd_table_mutex); | 449 | mutex_unlock(&mtd_table_mutex); |
450 | 450 | ||
451 | kfree(tr->blkcore_priv); | 451 | kfree(tr->blkcore_priv); |
452 | 452 | ||