aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/pmac_zilog.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/pmac_zilog.c')
-rw-r--r--drivers/serial/pmac_zilog.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index f330d6c0e0df..5f52883e64d2 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -60,6 +60,7 @@
60#include <linux/pmu.h> 60#include <linux/pmu.h>
61#include <linux/bitops.h> 61#include <linux/bitops.h>
62#include <linux/sysrq.h> 62#include <linux/sysrq.h>
63#include <linux/mutex.h>
63#include <asm/sections.h> 64#include <asm/sections.h>
64#include <asm/io.h> 65#include <asm/io.h>
65#include <asm/irq.h> 66#include <asm/irq.h>
@@ -96,7 +97,7 @@ MODULE_LICENSE("GPL");
96 */ 97 */
97static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS]; 98static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS];
98static int pmz_ports_count; 99static int pmz_ports_count;
99static DECLARE_MUTEX(pmz_irq_sem); 100static DEFINE_MUTEX(pmz_irq_mutex);
100 101
101static struct uart_driver pmz_uart_reg = { 102static struct uart_driver pmz_uart_reg = {
102 .owner = THIS_MODULE, 103 .owner = THIS_MODULE,
@@ -922,7 +923,7 @@ static int pmz_startup(struct uart_port *port)
922 if (uap->node == NULL) 923 if (uap->node == NULL)
923 return -ENODEV; 924 return -ENODEV;
924 925
925 down(&pmz_irq_sem); 926 mutex_lock(&pmz_irq_mutex);
926 927
927 uap->flags |= PMACZILOG_FLAG_IS_OPEN; 928 uap->flags |= PMACZILOG_FLAG_IS_OPEN;
928 929
@@ -940,11 +941,11 @@ static int pmz_startup(struct uart_port *port)
940 dev_err(&uap->dev->ofdev.dev, 941 dev_err(&uap->dev->ofdev.dev,
941 "Unable to register zs interrupt handler.\n"); 942 "Unable to register zs interrupt handler.\n");
942 pmz_set_scc_power(uap, 0); 943 pmz_set_scc_power(uap, 0);
943 up(&pmz_irq_sem); 944 mutex_unlock(&pmz_irq_mutex);
944 return -ENXIO; 945 return -ENXIO;
945 } 946 }
946 947
947 up(&pmz_irq_sem); 948 mutex_unlock(&pmz_irq_mutex);
948 949
949 /* Right now, we deal with delay by blocking here, I'll be 950 /* Right now, we deal with delay by blocking here, I'll be
950 * smarter later on 951 * smarter later on
@@ -981,7 +982,7 @@ static void pmz_shutdown(struct uart_port *port)
981 if (uap->node == NULL) 982 if (uap->node == NULL)
982 return; 983 return;
983 984
984 down(&pmz_irq_sem); 985 mutex_lock(&pmz_irq_mutex);
985 986
986 /* Release interrupt handler */ 987 /* Release interrupt handler */
987 free_irq(uap->port.irq, uap); 988 free_irq(uap->port.irq, uap);
@@ -1002,7 +1003,7 @@ static void pmz_shutdown(struct uart_port *port)
1002 1003
1003 if (ZS_IS_CONS(uap) || ZS_IS_ASLEEP(uap)) { 1004 if (ZS_IS_CONS(uap) || ZS_IS_ASLEEP(uap)) {
1004 spin_unlock_irqrestore(&port->lock, flags); 1005 spin_unlock_irqrestore(&port->lock, flags);
1005 up(&pmz_irq_sem); 1006 mutex_unlock(&pmz_irq_mutex);
1006 return; 1007 return;
1007 } 1008 }
1008 1009
@@ -1019,7 +1020,7 @@ static void pmz_shutdown(struct uart_port *port)
1019 1020
1020 spin_unlock_irqrestore(&port->lock, flags); 1021 spin_unlock_irqrestore(&port->lock, flags);
1021 1022
1022 up(&pmz_irq_sem); 1023 mutex_unlock(&pmz_irq_mutex);
1023 1024
1024 pmz_debug("pmz: shutdown() done.\n"); 1025 pmz_debug("pmz: shutdown() done.\n");
1025} 1026}
@@ -1591,7 +1592,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
1591 1592
1592 state = pmz_uart_reg.state + uap->port.line; 1593 state = pmz_uart_reg.state + uap->port.line;
1593 1594
1594 down(&pmz_irq_sem); 1595 mutex_lock(&pmz_irq_mutex);
1595 down(&state->sem); 1596 down(&state->sem);
1596 1597
1597 spin_lock_irqsave(&uap->port.lock, flags); 1598 spin_lock_irqsave(&uap->port.lock, flags);
@@ -1624,7 +1625,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
1624 pmz_set_scc_power(uap, 0); 1625 pmz_set_scc_power(uap, 0);
1625 1626
1626 up(&state->sem); 1627 up(&state->sem);
1627 up(&pmz_irq_sem); 1628 mutex_unlock(&pmz_irq_mutex);
1628 1629
1629 pmz_debug("suspend, switching complete\n"); 1630 pmz_debug("suspend, switching complete\n");
1630 1631
@@ -1651,7 +1652,7 @@ static int pmz_resume(struct macio_dev *mdev)
1651 1652
1652 state = pmz_uart_reg.state + uap->port.line; 1653 state = pmz_uart_reg.state + uap->port.line;
1653 1654
1654 down(&pmz_irq_sem); 1655 mutex_lock(&pmz_irq_mutex);
1655 down(&state->sem); 1656 down(&state->sem);
1656 1657
1657 spin_lock_irqsave(&uap->port.lock, flags); 1658 spin_lock_irqsave(&uap->port.lock, flags);
@@ -1685,7 +1686,7 @@ static int pmz_resume(struct macio_dev *mdev)
1685 1686
1686 bail: 1687 bail:
1687 up(&state->sem); 1688 up(&state->sem);
1688 up(&pmz_irq_sem); 1689 mutex_unlock(&pmz_irq_mutex);
1689 1690
1690 /* Right now, we deal with delay by blocking here, I'll be 1691 /* Right now, we deal with delay by blocking here, I'll be
1691 * smarter later on 1692 * smarter later on