aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-14 22:44:39 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-14 22:44:39 -0500
commit650eec5e04468d0611a60e6098464b7c43981552 (patch)
treededaf6f64ced34391a085f8c1148c1cf9f593ea6 /drivers/serial
parent150a631fc55e33df28a6846371e7f86e9e75e8cb (diff)
parent7493a314cb83797ce612a577475aacaedc553fed (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-serial
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/8250.c30
-rw-r--r--drivers/serial/Kconfig2
-rw-r--r--drivers/serial/pmac_zilog.c9
-rw-r--r--drivers/serial/serial_core.c60
4 files changed, 55 insertions, 46 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index fb610c3634a4..d9ce8c549416 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2454,6 +2454,7 @@ static struct platform_driver serial8250_isa_driver = {
2454 .resume = serial8250_resume, 2454 .resume = serial8250_resume,
2455 .driver = { 2455 .driver = {
2456 .name = "serial8250", 2456 .name = "serial8250",
2457 .owner = THIS_MODULE,
2457 }, 2458 },
2458}; 2459};
2459 2460
@@ -2594,21 +2595,30 @@ static int __init serial8250_init(void)
2594 if (ret) 2595 if (ret)
2595 goto out; 2596 goto out;
2596 2597
2597 serial8250_isa_devs = platform_device_register_simple("serial8250", 2598 ret = platform_driver_register(&serial8250_isa_driver);
2598 PLAT8250_DEV_LEGACY, NULL, 0); 2599 if (ret)
2599 if (IS_ERR(serial8250_isa_devs)) { 2600 goto unreg_uart_drv;
2600 ret = PTR_ERR(serial8250_isa_devs); 2601
2601 goto unreg; 2602 serial8250_isa_devs = platform_device_alloc("serial8250",
2603 PLAT8250_DEV_LEGACY);
2604 if (!serial8250_isa_devs) {
2605 ret = -ENOMEM;
2606 goto unreg_plat_drv;
2602 } 2607 }
2603 2608
2609 ret = platform_device_add(serial8250_isa_devs);
2610 if (ret)
2611 goto put_dev;
2612
2604 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); 2613 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
2605 2614
2606 ret = platform_driver_register(&serial8250_isa_driver); 2615 goto out;
2607 if (ret == 0)
2608 goto out;
2609 2616
2610 platform_device_unregister(serial8250_isa_devs); 2617 put_dev:
2611 unreg: 2618 platform_device_put(serial8250_isa_devs);
2619 unreg_plat_drv:
2620 platform_driver_unregister(&serial8250_isa_driver);
2621 unreg_uart_drv:
2612 uart_unregister_driver(&serial8250_reg); 2622 uart_unregister_driver(&serial8250_reg);
2613 out: 2623 out:
2614 return ret; 2624 return ret;
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index e0685a520514..5e7199f7b59c 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -847,7 +847,7 @@ config SERIAL_M32R_SIO_CONSOLE
847 847
848config SERIAL_M32R_PLDSIO 848config SERIAL_M32R_PLDSIO
849 bool "M32R SIO I/F on a PLD" 849 bool "M32R SIO I/F on a PLD"
850 depends on SERIAL_M32R_SIO=y && (PLAT_OPSPUT || PALT_USRV || PLAT_M32700UT) 850 depends on SERIAL_M32R_SIO=y && (PLAT_OPSPUT || PLAT_USRV || PLAT_M32700UT)
851 default n 851 default n
852 help 852 help
853 Say Y here if you want to use the M32R serial controller 853 Say Y here if you want to use the M32R serial controller
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 5f52883e64d2..4e03a87f3fb4 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -69,7 +69,6 @@
69#include <asm/pmac_feature.h> 69#include <asm/pmac_feature.h>
70#include <asm/dbdma.h> 70#include <asm/dbdma.h>
71#include <asm/macio.h> 71#include <asm/macio.h>
72#include <asm/semaphore.h>
73 72
74#if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 73#if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
75#define SUPPORT_SYSRQ 74#define SUPPORT_SYSRQ
@@ -1593,7 +1592,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
1593 state = pmz_uart_reg.state + uap->port.line; 1592 state = pmz_uart_reg.state + uap->port.line;
1594 1593
1595 mutex_lock(&pmz_irq_mutex); 1594 mutex_lock(&pmz_irq_mutex);
1596 down(&state->sem); 1595 mutex_lock(&state->mutex);
1597 1596
1598 spin_lock_irqsave(&uap->port.lock, flags); 1597 spin_lock_irqsave(&uap->port.lock, flags);
1599 1598
@@ -1624,7 +1623,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
1624 /* Shut the chip down */ 1623 /* Shut the chip down */
1625 pmz_set_scc_power(uap, 0); 1624 pmz_set_scc_power(uap, 0);
1626 1625
1627 up(&state->sem); 1626 mutex_unlock(&state->mutex);
1628 mutex_unlock(&pmz_irq_mutex); 1627 mutex_unlock(&pmz_irq_mutex);
1629 1628
1630 pmz_debug("suspend, switching complete\n"); 1629 pmz_debug("suspend, switching complete\n");
@@ -1653,7 +1652,7 @@ static int pmz_resume(struct macio_dev *mdev)
1653 state = pmz_uart_reg.state + uap->port.line; 1652 state = pmz_uart_reg.state + uap->port.line;
1654 1653
1655 mutex_lock(&pmz_irq_mutex); 1654 mutex_lock(&pmz_irq_mutex);
1656 down(&state->sem); 1655 mutex_lock(&state->mutex);
1657 1656
1658 spin_lock_irqsave(&uap->port.lock, flags); 1657 spin_lock_irqsave(&uap->port.lock, flags);
1659 if (!ZS_IS_OPEN(uap) && !ZS_IS_CONS(uap)) { 1658 if (!ZS_IS_OPEN(uap) && !ZS_IS_CONS(uap)) {
@@ -1685,7 +1684,7 @@ static int pmz_resume(struct macio_dev *mdev)
1685 } 1684 }
1686 1685
1687 bail: 1686 bail:
1688 up(&state->sem); 1687 mutex_unlock(&state->mutex);
1689 mutex_unlock(&pmz_irq_mutex); 1688 mutex_unlock(&pmz_irq_mutex);
1690 1689
1691 /* Right now, we deal with delay by blocking here, I'll be 1690 /* Right now, we deal with delay by blocking here, I'll be
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 2ca620900bcc..943770470b9d 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -638,7 +638,7 @@ static int uart_set_info(struct uart_state *state,
638 * module insertion/removal doesn't change anything 638 * module insertion/removal doesn't change anything
639 * under us. 639 * under us.
640 */ 640 */
641 down(&state->sem); 641 mutex_lock(&state->mutex);
642 642
643 change_irq = new_serial.irq != port->irq; 643 change_irq = new_serial.irq != port->irq;
644 644
@@ -797,7 +797,7 @@ static int uart_set_info(struct uart_state *state,
797 } else 797 } else
798 retval = uart_startup(state, 1); 798 retval = uart_startup(state, 1);
799 exit: 799 exit:
800 up(&state->sem); 800 mutex_unlock(&state->mutex);
801 return retval; 801 return retval;
802} 802}
803 803
@@ -834,7 +834,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
834 struct uart_port *port = state->port; 834 struct uart_port *port = state->port;
835 int result = -EIO; 835 int result = -EIO;
836 836
837 down(&state->sem); 837 mutex_lock(&state->mutex);
838 if ((!file || !tty_hung_up_p(file)) && 838 if ((!file || !tty_hung_up_p(file)) &&
839 !(tty->flags & (1 << TTY_IO_ERROR))) { 839 !(tty->flags & (1 << TTY_IO_ERROR))) {
840 result = port->mctrl; 840 result = port->mctrl;
@@ -843,7 +843,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
843 result |= port->ops->get_mctrl(port); 843 result |= port->ops->get_mctrl(port);
844 spin_unlock_irq(&port->lock); 844 spin_unlock_irq(&port->lock);
845 } 845 }
846 up(&state->sem); 846 mutex_unlock(&state->mutex);
847 847
848 return result; 848 return result;
849} 849}
@@ -856,13 +856,13 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
856 struct uart_port *port = state->port; 856 struct uart_port *port = state->port;
857 int ret = -EIO; 857 int ret = -EIO;
858 858
859 down(&state->sem); 859 mutex_lock(&state->mutex);
860 if ((!file || !tty_hung_up_p(file)) && 860 if ((!file || !tty_hung_up_p(file)) &&
861 !(tty->flags & (1 << TTY_IO_ERROR))) { 861 !(tty->flags & (1 << TTY_IO_ERROR))) {
862 uart_update_mctrl(port, set, clear); 862 uart_update_mctrl(port, set, clear);
863 ret = 0; 863 ret = 0;
864 } 864 }
865 up(&state->sem); 865 mutex_unlock(&state->mutex);
866 return ret; 866 return ret;
867} 867}
868 868
@@ -873,12 +873,12 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state)
873 873
874 BUG_ON(!kernel_locked()); 874 BUG_ON(!kernel_locked());
875 875
876 down(&state->sem); 876 mutex_lock(&state->mutex);
877 877
878 if (port->type != PORT_UNKNOWN) 878 if (port->type != PORT_UNKNOWN)
879 port->ops->break_ctl(port, break_state); 879 port->ops->break_ctl(port, break_state);
880 880
881 up(&state->sem); 881 mutex_unlock(&state->mutex);
882} 882}
883 883
884static int uart_do_autoconfig(struct uart_state *state) 884static int uart_do_autoconfig(struct uart_state *state)
@@ -894,7 +894,7 @@ static int uart_do_autoconfig(struct uart_state *state)
894 * changing, and hence any extra opens of the port while 894 * changing, and hence any extra opens of the port while
895 * we're auto-configuring. 895 * we're auto-configuring.
896 */ 896 */
897 if (down_interruptible(&state->sem)) 897 if (mutex_lock_interruptible(&state->mutex))
898 return -ERESTARTSYS; 898 return -ERESTARTSYS;
899 899
900 ret = -EBUSY; 900 ret = -EBUSY;
@@ -920,7 +920,7 @@ static int uart_do_autoconfig(struct uart_state *state)
920 920
921 ret = uart_startup(state, 1); 921 ret = uart_startup(state, 1);
922 } 922 }
923 up(&state->sem); 923 mutex_unlock(&state->mutex);
924 return ret; 924 return ret;
925} 925}
926 926
@@ -1074,7 +1074,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1074 if (ret != -ENOIOCTLCMD) 1074 if (ret != -ENOIOCTLCMD)
1075 goto out; 1075 goto out;
1076 1076
1077 down(&state->sem); 1077 mutex_lock(&state->mutex);
1078 1078
1079 if (tty_hung_up_p(filp)) { 1079 if (tty_hung_up_p(filp)) {
1080 ret = -EIO; 1080 ret = -EIO;
@@ -1098,7 +1098,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1098 } 1098 }
1099 } 1099 }
1100 out_up: 1100 out_up:
1101 up(&state->sem); 1101 mutex_unlock(&state->mutex);
1102 out: 1102 out:
1103 return ret; 1103 return ret;
1104} 1104}
@@ -1186,7 +1186,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1186 1186
1187 DPRINTK("uart_close(%d) called\n", port->line); 1187 DPRINTK("uart_close(%d) called\n", port->line);
1188 1188
1189 down(&state->sem); 1189 mutex_lock(&state->mutex);
1190 1190
1191 if (tty_hung_up_p(filp)) 1191 if (tty_hung_up_p(filp))
1192 goto done; 1192 goto done;
@@ -1260,7 +1260,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1260 wake_up_interruptible(&state->info->open_wait); 1260 wake_up_interruptible(&state->info->open_wait);
1261 1261
1262 done: 1262 done:
1263 up(&state->sem); 1263 mutex_unlock(&state->mutex);
1264} 1264}
1265 1265
1266static void uart_wait_until_sent(struct tty_struct *tty, int timeout) 1266static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
@@ -1334,7 +1334,7 @@ static void uart_hangup(struct tty_struct *tty)
1334 BUG_ON(!kernel_locked()); 1334 BUG_ON(!kernel_locked());
1335 DPRINTK("uart_hangup(%d)\n", state->port->line); 1335 DPRINTK("uart_hangup(%d)\n", state->port->line);
1336 1336
1337 down(&state->sem); 1337 mutex_lock(&state->mutex);
1338 if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { 1338 if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) {
1339 uart_flush_buffer(tty); 1339 uart_flush_buffer(tty);
1340 uart_shutdown(state); 1340 uart_shutdown(state);
@@ -1344,7 +1344,7 @@ static void uart_hangup(struct tty_struct *tty)
1344 wake_up_interruptible(&state->info->open_wait); 1344 wake_up_interruptible(&state->info->open_wait);
1345 wake_up_interruptible(&state->info->delta_msr_wait); 1345 wake_up_interruptible(&state->info->delta_msr_wait);
1346 } 1346 }
1347 up(&state->sem); 1347 mutex_unlock(&state->mutex);
1348} 1348}
1349 1349
1350/* 1350/*
@@ -1447,9 +1447,9 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1447 if (mctrl & TIOCM_CAR) 1447 if (mctrl & TIOCM_CAR)
1448 break; 1448 break;
1449 1449
1450 up(&state->sem); 1450 mutex_unlock(&state->mutex);
1451 schedule(); 1451 schedule();
1452 down(&state->sem); 1452 mutex_lock(&state->mutex);
1453 1453
1454 if (signal_pending(current)) 1454 if (signal_pending(current))
1455 break; 1455 break;
@@ -1475,7 +1475,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
1475 1475
1476 mutex_lock(&port_mutex); 1476 mutex_lock(&port_mutex);
1477 state = drv->state + line; 1477 state = drv->state + line;
1478 if (down_interruptible(&state->sem)) { 1478 if (mutex_lock_interruptible(&state->mutex)) {
1479 state = ERR_PTR(-ERESTARTSYS); 1479 state = ERR_PTR(-ERESTARTSYS);
1480 goto out; 1480 goto out;
1481 } 1481 }
@@ -1483,7 +1483,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
1483 state->count++; 1483 state->count++;
1484 if (!state->port) { 1484 if (!state->port) {
1485 state->count--; 1485 state->count--;
1486 up(&state->sem); 1486 mutex_unlock(&state->mutex);
1487 state = ERR_PTR(-ENXIO); 1487 state = ERR_PTR(-ENXIO);
1488 goto out; 1488 goto out;
1489 } 1489 }
@@ -1504,7 +1504,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
1504 (unsigned long)state); 1504 (unsigned long)state);
1505 } else { 1505 } else {
1506 state->count--; 1506 state->count--;
1507 up(&state->sem); 1507 mutex_unlock(&state->mutex);
1508 state = ERR_PTR(-ENOMEM); 1508 state = ERR_PTR(-ENOMEM);
1509 } 1509 }
1510 } 1510 }
@@ -1571,7 +1571,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1571 if (tty_hung_up_p(filp)) { 1571 if (tty_hung_up_p(filp)) {
1572 retval = -EAGAIN; 1572 retval = -EAGAIN;
1573 state->count--; 1573 state->count--;
1574 up(&state->sem); 1574 mutex_unlock(&state->mutex);
1575 goto fail; 1575 goto fail;
1576 } 1576 }
1577 1577
@@ -1591,7 +1591,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1591 */ 1591 */
1592 if (retval == 0) 1592 if (retval == 0)
1593 retval = uart_block_til_ready(filp, state); 1593 retval = uart_block_til_ready(filp, state);
1594 up(&state->sem); 1594 mutex_unlock(&state->mutex);
1595 1595
1596 /* 1596 /*
1597 * If this is the first open to succeed, adjust things to suit. 1597 * If this is the first open to succeed, adjust things to suit.
@@ -1867,7 +1867,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1867{ 1867{
1868 struct uart_state *state = drv->state + port->line; 1868 struct uart_state *state = drv->state + port->line;
1869 1869
1870 down(&state->sem); 1870 mutex_lock(&state->mutex);
1871 1871
1872 if (state->info && state->info->flags & UIF_INITIALIZED) { 1872 if (state->info && state->info->flags & UIF_INITIALIZED) {
1873 struct uart_ops *ops = port->ops; 1873 struct uart_ops *ops = port->ops;
@@ -1896,7 +1896,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1896 1896
1897 uart_change_pm(state, 3); 1897 uart_change_pm(state, 3);
1898 1898
1899 up(&state->sem); 1899 mutex_unlock(&state->mutex);
1900 1900
1901 return 0; 1901 return 0;
1902} 1902}
@@ -1905,7 +1905,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
1905{ 1905{
1906 struct uart_state *state = drv->state + port->line; 1906 struct uart_state *state = drv->state + port->line;
1907 1907
1908 down(&state->sem); 1908 mutex_lock(&state->mutex);
1909 1909
1910 uart_change_pm(state, 0); 1910 uart_change_pm(state, 0);
1911 1911
@@ -1954,7 +1954,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
1954 } 1954 }
1955 } 1955 }
1956 1956
1957 up(&state->sem); 1957 mutex_unlock(&state->mutex);
1958 1958
1959 return 0; 1959 return 0;
1960} 1960}
@@ -2049,7 +2049,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state)
2049 if (info && info->tty) 2049 if (info && info->tty)
2050 tty_vhangup(info->tty); 2050 tty_vhangup(info->tty);
2051 2051
2052 down(&state->sem); 2052 mutex_lock(&state->mutex);
2053 2053
2054 state->info = NULL; 2054 state->info = NULL;
2055 2055
@@ -2072,7 +2072,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state)
2072 kfree(info); 2072 kfree(info);
2073 } 2073 }
2074 2074
2075 up(&state->sem); 2075 mutex_unlock(&state->mutex);
2076} 2076}
2077 2077
2078static struct tty_operations uart_ops = { 2078static struct tty_operations uart_ops = {
@@ -2161,7 +2161,7 @@ int uart_register_driver(struct uart_driver *drv)
2161 state->close_delay = 500; /* .5 seconds */ 2161 state->close_delay = 500; /* .5 seconds */
2162 state->closing_wait = 30000; /* 30 seconds */ 2162 state->closing_wait = 30000; /* 30 seconds */
2163 2163
2164 init_MUTEX(&state->sem); 2164 mutex_init(&state->mutex);
2165 } 2165 }
2166 2166
2167 retval = tty_register_driver(normal); 2167 retval = tty_register_driver(normal);