Merge master.kernel.org:/home/rmk/linux-2.6-serial

+57 -47
+20 -10
drivers/serial/8250.c
··· 2454 2454 .resume = serial8250_resume, 2455 2455 .driver = { 2456 2456 .name = "serial8250", 2457 + .owner = THIS_MODULE, 2457 2458 }, 2458 2459 }; 2459 2460 ··· 2595 2594 if (ret) 2596 2595 goto out; 2597 2596 2598 - serial8250_isa_devs = platform_device_register_simple("serial8250", 2599 - PLAT8250_DEV_LEGACY, NULL, 0); 2600 - if (IS_ERR(serial8250_isa_devs)) { 2601 - ret = PTR_ERR(serial8250_isa_devs); 2602 - goto unreg; 2597 + ret = platform_driver_register(&serial8250_isa_driver); 2598 + if (ret) 2599 + goto unreg_uart_drv; 2600 + 2601 + serial8250_isa_devs = platform_device_alloc("serial8250", 2602 + PLAT8250_DEV_LEGACY); 2603 + if (!serial8250_isa_devs) { 2604 + ret = -ENOMEM; 2605 + goto unreg_plat_drv; 2603 2606 } 2607 + 2608 + ret = platform_device_add(serial8250_isa_devs); 2609 + if (ret) 2610 + goto put_dev; 2604 2611 2605 2612 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); 2606 2613 2607 - ret = platform_driver_register(&serial8250_isa_driver); 2608 - if (ret == 0) 2609 - goto out; 2614 + goto out; 2610 2615 2611 - platform_device_unregister(serial8250_isa_devs); 2612 - unreg: 2616 + put_dev: 2617 + platform_device_put(serial8250_isa_devs); 2618 + unreg_plat_drv: 2619 + platform_driver_unregister(&serial8250_isa_driver); 2620 + unreg_uart_drv: 2613 2621 uart_unregister_driver(&serial8250_reg); 2614 2622 out: 2615 2623 return ret;
+1 -1
drivers/serial/Kconfig
··· 847 847 848 848 config SERIAL_M32R_PLDSIO 849 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 851 default n 852 852 help 853 853 Say Y here if you want to use the M32R serial controller
+4 -5
drivers/serial/pmac_zilog.c
··· 69 69 #include <asm/pmac_feature.h> 70 70 #include <asm/dbdma.h> 71 71 #include <asm/macio.h> 72 - #include <asm/semaphore.h> 73 72 74 73 #if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 75 74 #define SUPPORT_SYSRQ ··· 1592 1593 state = pmz_uart_reg.state + uap->port.line; 1593 1594 1594 1595 mutex_lock(&pmz_irq_mutex); 1595 - down(&state->sem); 1596 + mutex_lock(&state->mutex); 1596 1597 1597 1598 spin_lock_irqsave(&uap->port.lock, flags); 1598 1599 ··· 1623 1624 /* Shut the chip down */ 1624 1625 pmz_set_scc_power(uap, 0); 1625 1626 1626 - up(&state->sem); 1627 + mutex_unlock(&state->mutex); 1627 1628 mutex_unlock(&pmz_irq_mutex); 1628 1629 1629 1630 pmz_debug("suspend, switching complete\n"); ··· 1652 1653 state = pmz_uart_reg.state + uap->port.line; 1653 1654 1654 1655 mutex_lock(&pmz_irq_mutex); 1655 - down(&state->sem); 1656 + mutex_lock(&state->mutex); 1656 1657 1657 1658 spin_lock_irqsave(&uap->port.lock, flags); 1658 1659 if (!ZS_IS_OPEN(uap) && !ZS_IS_CONS(uap)) { ··· 1684 1685 } 1685 1686 1686 1687 bail: 1687 - up(&state->sem); 1688 + mutex_unlock(&state->mutex); 1688 1689 mutex_unlock(&pmz_irq_mutex); 1689 1690 1690 1691 /* Right now, we deal with delay by blocking here, I'll be
+30 -30
drivers/serial/serial_core.c
··· 638 638 * module insertion/removal doesn't change anything 639 639 * under us. 640 640 */ 641 - down(&state->sem); 641 + mutex_lock(&state->mutex); 642 642 643 643 change_irq = new_serial.irq != port->irq; 644 644 ··· 797 797 } else 798 798 retval = uart_startup(state, 1); 799 799 exit: 800 - up(&state->sem); 800 + mutex_unlock(&state->mutex); 801 801 return retval; 802 802 } 803 803 ··· 834 834 struct uart_port *port = state->port; 835 835 int result = -EIO; 836 836 837 - down(&state->sem); 837 + mutex_lock(&state->mutex); 838 838 if ((!file || !tty_hung_up_p(file)) && 839 839 !(tty->flags & (1 << TTY_IO_ERROR))) { 840 840 result = port->mctrl; ··· 843 843 result |= port->ops->get_mctrl(port); 844 844 spin_unlock_irq(&port->lock); 845 845 } 846 - up(&state->sem); 846 + mutex_unlock(&state->mutex); 847 847 848 848 return result; 849 849 } ··· 856 856 struct uart_port *port = state->port; 857 857 int ret = -EIO; 858 858 859 - down(&state->sem); 859 + mutex_lock(&state->mutex); 860 860 if ((!file || !tty_hung_up_p(file)) && 861 861 !(tty->flags & (1 << TTY_IO_ERROR))) { 862 862 uart_update_mctrl(port, set, clear); 863 863 ret = 0; 864 864 } 865 - up(&state->sem); 865 + mutex_unlock(&state->mutex); 866 866 return ret; 867 867 } 868 868 ··· 873 873 874 874 BUG_ON(!kernel_locked()); 875 875 876 - down(&state->sem); 876 + mutex_lock(&state->mutex); 877 877 878 878 if (port->type != PORT_UNKNOWN) 879 879 port->ops->break_ctl(port, break_state); 880 880 881 - up(&state->sem); 881 + mutex_unlock(&state->mutex); 882 882 } 883 883 884 884 static int uart_do_autoconfig(struct uart_state *state) ··· 894 894 * changing, and hence any extra opens of the port while 895 895 * we're auto-configuring. 896 896 */ 897 - if (down_interruptible(&state->sem)) 897 + if (mutex_lock_interruptible(&state->mutex)) 898 898 return -ERESTARTSYS; 899 899 900 900 ret = -EBUSY; ··· 920 920 921 921 ret = uart_startup(state, 1); 922 922 } 923 - up(&state->sem); 923 + mutex_unlock(&state->mutex); 924 924 return ret; 925 925 } 926 926 ··· 1074 1074 if (ret != -ENOIOCTLCMD) 1075 1075 goto out; 1076 1076 1077 - down(&state->sem); 1077 + mutex_lock(&state->mutex); 1078 1078 1079 1079 if (tty_hung_up_p(filp)) { 1080 1080 ret = -EIO; ··· 1098 1098 } 1099 1099 } 1100 1100 out_up: 1101 - up(&state->sem); 1101 + mutex_unlock(&state->mutex); 1102 1102 out: 1103 1103 return ret; 1104 1104 } ··· 1186 1186 1187 1187 DPRINTK("uart_close(%d) called\n", port->line); 1188 1188 1189 - down(&state->sem); 1189 + mutex_lock(&state->mutex); 1190 1190 1191 1191 if (tty_hung_up_p(filp)) 1192 1192 goto done; ··· 1260 1260 wake_up_interruptible(&state->info->open_wait); 1261 1261 1262 1262 done: 1263 - up(&state->sem); 1263 + mutex_unlock(&state->mutex); 1264 1264 } 1265 1265 1266 1266 static void uart_wait_until_sent(struct tty_struct *tty, int timeout) ··· 1334 1334 BUG_ON(!kernel_locked()); 1335 1335 DPRINTK("uart_hangup(%d)\n", state->port->line); 1336 1336 1337 - down(&state->sem); 1337 + mutex_lock(&state->mutex); 1338 1338 if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { 1339 1339 uart_flush_buffer(tty); 1340 1340 uart_shutdown(state); ··· 1344 1344 wake_up_interruptible(&state->info->open_wait); 1345 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 1447 if (mctrl & TIOCM_CAR) 1448 1448 break; 1449 1449 1450 - up(&state->sem); 1450 + mutex_unlock(&state->mutex); 1451 1451 schedule(); 1452 - down(&state->sem); 1452 + mutex_lock(&state->mutex); 1453 1453 1454 1454 if (signal_pending(current)) 1455 1455 break; ··· 1475 1475 1476 1476 mutex_lock(&port_mutex); 1477 1477 state = drv->state + line; 1478 - if (down_interruptible(&state->sem)) { 1478 + if (mutex_lock_interruptible(&state->mutex)) { 1479 1479 state = ERR_PTR(-ERESTARTSYS); 1480 1480 goto out; 1481 1481 } ··· 1483 1483 state->count++; 1484 1484 if (!state->port) { 1485 1485 state->count--; 1486 - up(&state->sem); 1486 + mutex_unlock(&state->mutex); 1487 1487 state = ERR_PTR(-ENXIO); 1488 1488 goto out; 1489 1489 } ··· 1504 1504 (unsigned long)state); 1505 1505 } else { 1506 1506 state->count--; 1507 - up(&state->sem); 1507 + mutex_unlock(&state->mutex); 1508 1508 state = ERR_PTR(-ENOMEM); 1509 1509 } 1510 1510 } ··· 1571 1571 if (tty_hung_up_p(filp)) { 1572 1572 retval = -EAGAIN; 1573 1573 state->count--; 1574 - up(&state->sem); 1574 + mutex_unlock(&state->mutex); 1575 1575 goto fail; 1576 1576 } 1577 1577 ··· 1591 1591 */ 1592 1592 if (retval == 0) 1593 1593 retval = uart_block_til_ready(filp, state); 1594 - up(&state->sem); 1594 + mutex_unlock(&state->mutex); 1595 1595 1596 1596 /* 1597 1597 * If this is the first open to succeed, adjust things to suit. ··· 1867 1867 { 1868 1868 struct uart_state *state = drv->state + port->line; 1869 1869 1870 - down(&state->sem); 1870 + mutex_lock(&state->mutex); 1871 1871 1872 1872 if (state->info && state->info->flags & UIF_INITIALIZED) { 1873 1873 struct uart_ops *ops = port->ops; ··· 1896 1896 1897 1897 uart_change_pm(state, 3); 1898 1898 1899 - up(&state->sem); 1899 + mutex_unlock(&state->mutex); 1900 1900 1901 1901 return 0; 1902 1902 } ··· 1905 1905 { 1906 1906 struct uart_state *state = drv->state + port->line; 1907 1907 1908 - down(&state->sem); 1908 + mutex_lock(&state->mutex); 1909 1909 1910 1910 uart_change_pm(state, 0); 1911 1911 ··· 1954 1954 } 1955 1955 } 1956 1956 1957 - up(&state->sem); 1957 + mutex_unlock(&state->mutex); 1958 1958 1959 1959 return 0; 1960 1960 } ··· 2049 2049 if (info && info->tty) 2050 2050 tty_vhangup(info->tty); 2051 2051 2052 - down(&state->sem); 2052 + mutex_lock(&state->mutex); 2053 2053 2054 2054 state->info = NULL; 2055 2055 ··· 2072 2072 kfree(info); 2073 2073 } 2074 2074 2075 - up(&state->sem); 2075 + mutex_unlock(&state->mutex); 2076 2076 } 2077 2077 2078 2078 static struct tty_operations uart_ops = { ··· 2161 2161 state->close_delay = 500; /* .5 seconds */ 2162 2162 state->closing_wait = 30000; /* 30 seconds */ 2163 2163 2164 - init_MUTEX(&state->sem); 2164 + mutex_init(&state->mutex); 2165 2165 } 2166 2166 2167 2167 retval = tty_register_driver(normal);
+2 -1
include/linux/serial_core.h
··· 136 136 #include <linux/spinlock.h> 137 137 #include <linux/sched.h> 138 138 #include <linux/tty.h> 139 + #include <linux/mutex.h> 139 140 140 141 struct uart_port; 141 142 struct uart_info; ··· 285 284 struct uart_info *info; 286 285 struct uart_port *port; 287 286 288 - struct semaphore sem; 287 + struct mutex mutex; 289 288 }; 290 289 291 290 #define UART_XMIT_SIZE PAGE_SIZE