aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/ucb1x00-core.c27
1 files changed, 14 insertions, 13 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
33static DECLARE_MUTEX(ucb1x00_sem); 34static DEFINE_MUTEX(ucb1x00_mutex);
34static LIST_HEAD(ucb1x00_drivers); 35static LIST_HEAD(ucb1x00_drivers);
35static LIST_HEAD(ucb1x00_devices); 36static 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
586static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) 587static 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