diff options
-rw-r--r-- | drivers/mfd/ucb1x00-core.c | 27 | ||||
-rw-r--r-- | drivers/mmc/mmc_block.c | 11 |
2 files changed, 20 insertions, 18 deletions
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index b42e0fbab59b..aff83f966803 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -24,13 +24,14 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/mutex.h> | ||
27 | 28 | ||
28 | #include <asm/dma.h> | 29 | #include <asm/dma.h> |
29 | #include <asm/hardware.h> | 30 | #include <asm/hardware.h> |
30 | 31 | ||
31 | #include "ucb1x00.h" | 32 | #include "ucb1x00.h" |
32 | 33 | ||
33 | static DECLARE_MUTEX(ucb1x00_sem); | 34 | static DEFINE_MUTEX(ucb1x00_mutex); |
34 | static LIST_HEAD(ucb1x00_drivers); | 35 | static LIST_HEAD(ucb1x00_drivers); |
35 | static LIST_HEAD(ucb1x00_devices); | 36 | static LIST_HEAD(ucb1x00_devices); |
36 | 37 | ||
@@ -521,12 +522,12 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
521 | goto err_irq; | 522 | goto err_irq; |
522 | 523 | ||
523 | INIT_LIST_HEAD(&ucb->devs); | 524 | INIT_LIST_HEAD(&ucb->devs); |
524 | down(&ucb1x00_sem); | 525 | mutex_lock(&ucb1x00_mutex); |
525 | list_add(&ucb->node, &ucb1x00_devices); | 526 | list_add(&ucb->node, &ucb1x00_devices); |
526 | list_for_each_entry(drv, &ucb1x00_drivers, node) { | 527 | list_for_each_entry(drv, &ucb1x00_drivers, node) { |
527 | ucb1x00_add_dev(ucb, drv); | 528 | ucb1x00_add_dev(ucb, drv); |
528 | } | 529 | } |
529 | up(&ucb1x00_sem); | 530 | mutex_unlock(&ucb1x00_mutex); |
530 | goto out; | 531 | goto out; |
531 | 532 | ||
532 | err_irq: | 533 | err_irq: |
@@ -544,13 +545,13 @@ static void ucb1x00_remove(struct mcp *mcp) | |||
544 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 545 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); |
545 | struct list_head *l, *n; | 546 | struct list_head *l, *n; |
546 | 547 | ||
547 | down(&ucb1x00_sem); | 548 | mutex_lock(&ucb1x00_mutex); |
548 | list_del(&ucb->node); | 549 | list_del(&ucb->node); |
549 | list_for_each_safe(l, n, &ucb->devs) { | 550 | list_for_each_safe(l, n, &ucb->devs) { |
550 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, dev_node); | 551 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, dev_node); |
551 | ucb1x00_remove_dev(dev); | 552 | ucb1x00_remove_dev(dev); |
552 | } | 553 | } |
553 | up(&ucb1x00_sem); | 554 | mutex_unlock(&ucb1x00_mutex); |
554 | 555 | ||
555 | free_irq(ucb->irq, ucb); | 556 | free_irq(ucb->irq, ucb); |
556 | class_device_unregister(&ucb->cdev); | 557 | class_device_unregister(&ucb->cdev); |
@@ -561,12 +562,12 @@ int ucb1x00_register_driver(struct ucb1x00_driver *drv) | |||
561 | struct ucb1x00 *ucb; | 562 | struct ucb1x00 *ucb; |
562 | 563 | ||
563 | INIT_LIST_HEAD(&drv->devs); | 564 | INIT_LIST_HEAD(&drv->devs); |
564 | down(&ucb1x00_sem); | 565 | mutex_lock(&ucb1x00_mutex); |
565 | list_add(&drv->node, &ucb1x00_drivers); | 566 | list_add(&drv->node, &ucb1x00_drivers); |
566 | list_for_each_entry(ucb, &ucb1x00_devices, node) { | 567 | list_for_each_entry(ucb, &ucb1x00_devices, node) { |
567 | ucb1x00_add_dev(ucb, drv); | 568 | ucb1x00_add_dev(ucb, drv); |
568 | } | 569 | } |
569 | up(&ucb1x00_sem); | 570 | mutex_unlock(&ucb1x00_mutex); |
570 | return 0; | 571 | return 0; |
571 | } | 572 | } |
572 | 573 | ||
@@ -574,13 +575,13 @@ void ucb1x00_unregister_driver(struct ucb1x00_driver *drv) | |||
574 | { | 575 | { |
575 | struct list_head *n, *l; | 576 | struct list_head *n, *l; |
576 | 577 | ||
577 | down(&ucb1x00_sem); | 578 | mutex_lock(&ucb1x00_mutex); |
578 | list_del(&drv->node); | 579 | list_del(&drv->node); |
579 | list_for_each_safe(l, n, &drv->devs) { | 580 | list_for_each_safe(l, n, &drv->devs) { |
580 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, drv_node); | 581 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, drv_node); |
581 | ucb1x00_remove_dev(dev); | 582 | ucb1x00_remove_dev(dev); |
582 | } | 583 | } |
583 | up(&ucb1x00_sem); | 584 | mutex_unlock(&ucb1x00_mutex); |
584 | } | 585 | } |
585 | 586 | ||
586 | static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) | 587 | static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) |
@@ -588,12 +589,12 @@ static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) | |||
588 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 589 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); |
589 | struct ucb1x00_dev *dev; | 590 | struct ucb1x00_dev *dev; |
590 | 591 | ||
591 | down(&ucb1x00_sem); | 592 | mutex_lock(&ucb1x00_mutex); |
592 | list_for_each_entry(dev, &ucb->devs, dev_node) { | 593 | list_for_each_entry(dev, &ucb->devs, dev_node) { |
593 | if (dev->drv->suspend) | 594 | if (dev->drv->suspend) |
594 | dev->drv->suspend(dev, state); | 595 | dev->drv->suspend(dev, state); |
595 | } | 596 | } |
596 | up(&ucb1x00_sem); | 597 | mutex_unlock(&ucb1x00_mutex); |
597 | return 0; | 598 | return 0; |
598 | } | 599 | } |
599 | 600 | ||
@@ -602,12 +603,12 @@ static int ucb1x00_resume(struct mcp *mcp) | |||
602 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 603 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); |
603 | struct ucb1x00_dev *dev; | 604 | struct ucb1x00_dev *dev; |
604 | 605 | ||
605 | down(&ucb1x00_sem); | 606 | mutex_lock(&ucb1x00_mutex); |
606 | list_for_each_entry(dev, &ucb->devs, dev_node) { | 607 | list_for_each_entry(dev, &ucb->devs, dev_node) { |
607 | if (dev->drv->resume) | 608 | if (dev->drv->resume) |
608 | dev->drv->resume(dev); | 609 | dev->drv->resume(dev); |
609 | } | 610 | } |
610 | up(&ucb1x00_sem); | 611 | mutex_unlock(&ucb1x00_mutex); |
611 | return 0; | 612 | return 0; |
612 | } | 613 | } |
613 | 614 | ||
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index f2c42b13945d..9b7c37e0e574 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/kdev_t.h> | 28 | #include <linux/kdev_t.h> |
29 | #include <linux/blkdev.h> | 29 | #include <linux/blkdev.h> |
30 | #include <linux/devfs_fs_kernel.h> | 30 | #include <linux/devfs_fs_kernel.h> |
31 | #include <linux/mutex.h> | ||
31 | 32 | ||
32 | #include <linux/mmc/card.h> | 33 | #include <linux/mmc/card.h> |
33 | #include <linux/mmc/protocol.h> | 34 | #include <linux/mmc/protocol.h> |
@@ -57,33 +58,33 @@ struct mmc_blk_data { | |||
57 | unsigned int read_only; | 58 | unsigned int read_only; |
58 | }; | 59 | }; |
59 | 60 | ||
60 | static DECLARE_MUTEX(open_lock); | 61 | static DEFINE_MUTEX(open_lock); |
61 | 62 | ||
62 | static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) | 63 | static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) |
63 | { | 64 | { |
64 | struct mmc_blk_data *md; | 65 | struct mmc_blk_data *md; |
65 | 66 | ||
66 | down(&open_lock); | 67 | mutex_lock(&open_lock); |
67 | md = disk->private_data; | 68 | md = disk->private_data; |
68 | if (md && md->usage == 0) | 69 | if (md && md->usage == 0) |
69 | md = NULL; | 70 | md = NULL; |
70 | if (md) | 71 | if (md) |
71 | md->usage++; | 72 | md->usage++; |
72 | up(&open_lock); | 73 | mutex_unlock(&open_lock); |
73 | 74 | ||
74 | return md; | 75 | return md; |
75 | } | 76 | } |
76 | 77 | ||
77 | static void mmc_blk_put(struct mmc_blk_data *md) | 78 | static void mmc_blk_put(struct mmc_blk_data *md) |
78 | { | 79 | { |
79 | down(&open_lock); | 80 | mutex_lock(&open_lock); |
80 | md->usage--; | 81 | md->usage--; |
81 | if (md->usage == 0) { | 82 | if (md->usage == 0) { |
82 | put_disk(md->disk); | 83 | put_disk(md->disk); |
83 | mmc_cleanup_queue(&md->queue); | 84 | mmc_cleanup_queue(&md->queue); |
84 | kfree(md); | 85 | kfree(md); |
85 | } | 86 | } |
86 | up(&open_lock); | 87 | mutex_unlock(&open_lock); |
87 | } | 88 | } |
88 | 89 | ||
89 | static int mmc_blk_open(struct inode *inode, struct file *filp) | 90 | static int mmc_blk_open(struct inode *inode, struct file *filp) |