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

+36 -35
+6 -5
drivers/serial/8250.c
··· 41 #include <linux/serial.h> 42 #include <linux/serial_8250.h> 43 #include <linux/nmi.h> 44 45 #include <asm/io.h> 46 #include <asm/irq.h> ··· 2468 * 16x50 serial ports to be configured at run-time, to support PCMCIA 2469 * modems and PCI multiport cards. 2470 */ 2471 - static DECLARE_MUTEX(serial_sem); 2472 2473 static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *port) 2474 { ··· 2523 if (port->uartclk == 0) 2524 return -EINVAL; 2525 2526 - down(&serial_sem); 2527 2528 uart = serial8250_find_match_or_unused(port); 2529 if (uart) { ··· 2545 if (ret == 0) 2546 ret = uart->port.line; 2547 } 2548 - up(&serial_sem); 2549 2550 return ret; 2551 } ··· 2562 { 2563 struct uart_8250_port *uart = &serial8250_ports[line]; 2564 2565 - down(&serial_sem); 2566 uart_remove_one_port(&serial8250_reg, &uart->port); 2567 if (serial8250_isa_devs) { 2568 uart->port.flags &= ~UPF_BOOT_AUTOCONF; ··· 2572 } else { 2573 uart->port.dev = NULL; 2574 } 2575 - up(&serial_sem); 2576 } 2577 EXPORT_SYMBOL(serial8250_unregister_port); 2578
··· 41 #include <linux/serial.h> 42 #include <linux/serial_8250.h> 43 #include <linux/nmi.h> 44 + #include <linux/mutex.h> 45 46 #include <asm/io.h> 47 #include <asm/irq.h> ··· 2467 * 16x50 serial ports to be configured at run-time, to support PCMCIA 2468 * modems and PCI multiport cards. 2469 */ 2470 + static DEFINE_MUTEX(serial_mutex); 2471 2472 static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *port) 2473 { ··· 2522 if (port->uartclk == 0) 2523 return -EINVAL; 2524 2525 + mutex_lock(&serial_mutex); 2526 2527 uart = serial8250_find_match_or_unused(port); 2528 if (uart) { ··· 2544 if (ret == 0) 2545 ret = uart->port.line; 2546 } 2547 + mutex_unlock(&serial_mutex); 2548 2549 return ret; 2550 } ··· 2561 { 2562 struct uart_8250_port *uart = &serial8250_ports[line]; 2563 2564 + mutex_lock(&serial_mutex); 2565 uart_remove_one_port(&serial8250_reg, &uart->port); 2566 if (serial8250_isa_devs) { 2567 uart->port.flags &= ~UPF_BOOT_AUTOCONF; ··· 2571 } else { 2572 uart->port.dev = NULL; 2573 } 2574 + mutex_unlock(&serial_mutex); 2575 } 2576 EXPORT_SYMBOL(serial8250_unregister_port); 2577
+4 -7
drivers/serial/crisv10.c
··· 442 #include <linux/init.h> 443 #include <asm/uaccess.h> 444 #include <linux/kernel.h> 445 446 #include <asm/io.h> 447 #include <asm/irq.h> ··· 1316 * memory if large numbers of serial ports are open. 1317 */ 1318 static unsigned char *tmp_buf; 1319 - #ifdef DECLARE_MUTEX 1320 - static DECLARE_MUTEX(tmp_buf_sem); 1321 - #else 1322 - static struct semaphore tmp_buf_sem = MUTEX; 1323 - #endif 1324 1325 /* Calculate the chartime depending on baudrate, numbor of bits etc. */ 1326 static void update_char_time(struct e100_serial * info) ··· 3658 * design. 3659 */ 3660 if (from_user) { 3661 - down(&tmp_buf_sem); 3662 while (1) { 3663 int c1; 3664 c = CIRC_SPACE_TO_END(info->xmit.head, ··· 3689 count -= c; 3690 ret += c; 3691 } 3692 - up(&tmp_buf_sem); 3693 } else { 3694 cli(); 3695 while (count) {
··· 442 #include <linux/init.h> 443 #include <asm/uaccess.h> 444 #include <linux/kernel.h> 445 + #include <linux/mutex.h> 446 447 #include <asm/io.h> 448 #include <asm/irq.h> ··· 1315 * memory if large numbers of serial ports are open. 1316 */ 1317 static unsigned char *tmp_buf; 1318 + static DEFINE_MUTEX(tmp_buf_mutex); 1319 1320 /* Calculate the chartime depending on baudrate, numbor of bits etc. */ 1321 static void update_char_time(struct e100_serial * info) ··· 3661 * design. 3662 */ 3663 if (from_user) { 3664 + mutex_lock(&tmp_buf_mutex); 3665 while (1) { 3666 int c1; 3667 c = CIRC_SPACE_TO_END(info->xmit.head, ··· 3692 count -= c; 3693 ret += c; 3694 } 3695 + mutex_unlock(&tmp_buf_mutex); 3696 } else { 3697 cli(); 3698 while (count) {
+12 -11
drivers/serial/pmac_zilog.c
··· 60 #include <linux/pmu.h> 61 #include <linux/bitops.h> 62 #include <linux/sysrq.h> 63 #include <asm/sections.h> 64 #include <asm/io.h> 65 #include <asm/irq.h> ··· 97 */ 98 static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS]; 99 static int pmz_ports_count; 100 - static DECLARE_MUTEX(pmz_irq_sem); 101 102 static struct uart_driver pmz_uart_reg = { 103 .owner = THIS_MODULE, ··· 923 if (uap->node == NULL) 924 return -ENODEV; 925 926 - down(&pmz_irq_sem); 927 928 uap->flags |= PMACZILOG_FLAG_IS_OPEN; 929 ··· 941 dev_err(&uap->dev->ofdev.dev, 942 "Unable to register zs interrupt handler.\n"); 943 pmz_set_scc_power(uap, 0); 944 - up(&pmz_irq_sem); 945 return -ENXIO; 946 } 947 948 - up(&pmz_irq_sem); 949 950 /* Right now, we deal with delay by blocking here, I'll be 951 * smarter later on ··· 982 if (uap->node == NULL) 983 return; 984 985 - down(&pmz_irq_sem); 986 987 /* Release interrupt handler */ 988 free_irq(uap->port.irq, uap); ··· 1003 1004 if (ZS_IS_CONS(uap) || ZS_IS_ASLEEP(uap)) { 1005 spin_unlock_irqrestore(&port->lock, flags); 1006 - up(&pmz_irq_sem); 1007 return; 1008 } 1009 ··· 1020 1021 spin_unlock_irqrestore(&port->lock, flags); 1022 1023 - up(&pmz_irq_sem); 1024 1025 pmz_debug("pmz: shutdown() done.\n"); 1026 } ··· 1592 1593 state = pmz_uart_reg.state + uap->port.line; 1594 1595 - down(&pmz_irq_sem); 1596 down(&state->sem); 1597 1598 spin_lock_irqsave(&uap->port.lock, flags); ··· 1625 pmz_set_scc_power(uap, 0); 1626 1627 up(&state->sem); 1628 - up(&pmz_irq_sem); 1629 1630 pmz_debug("suspend, switching complete\n"); 1631 ··· 1652 1653 state = pmz_uart_reg.state + uap->port.line; 1654 1655 - down(&pmz_irq_sem); 1656 down(&state->sem); 1657 1658 spin_lock_irqsave(&uap->port.lock, flags); ··· 1686 1687 bail: 1688 up(&state->sem); 1689 - up(&pmz_irq_sem); 1690 1691 /* Right now, we deal with delay by blocking here, I'll be 1692 * smarter later on
··· 60 #include <linux/pmu.h> 61 #include <linux/bitops.h> 62 #include <linux/sysrq.h> 63 + #include <linux/mutex.h> 64 #include <asm/sections.h> 65 #include <asm/io.h> 66 #include <asm/irq.h> ··· 96 */ 97 static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS]; 98 static int pmz_ports_count; 99 + static DEFINE_MUTEX(pmz_irq_mutex); 100 101 static struct uart_driver pmz_uart_reg = { 102 .owner = THIS_MODULE, ··· 922 if (uap->node == NULL) 923 return -ENODEV; 924 925 + mutex_lock(&pmz_irq_mutex); 926 927 uap->flags |= PMACZILOG_FLAG_IS_OPEN; 928 ··· 940 dev_err(&uap->dev->ofdev.dev, 941 "Unable to register zs interrupt handler.\n"); 942 pmz_set_scc_power(uap, 0); 943 + mutex_unlock(&pmz_irq_mutex); 944 return -ENXIO; 945 } 946 947 + mutex_unlock(&pmz_irq_mutex); 948 949 /* Right now, we deal with delay by blocking here, I'll be 950 * smarter later on ··· 981 if (uap->node == NULL) 982 return; 983 984 + mutex_lock(&pmz_irq_mutex); 985 986 /* Release interrupt handler */ 987 free_irq(uap->port.irq, uap); ··· 1002 1003 if (ZS_IS_CONS(uap) || ZS_IS_ASLEEP(uap)) { 1004 spin_unlock_irqrestore(&port->lock, flags); 1005 + mutex_unlock(&pmz_irq_mutex); 1006 return; 1007 } 1008 ··· 1019 1020 spin_unlock_irqrestore(&port->lock, flags); 1021 1022 + mutex_unlock(&pmz_irq_mutex); 1023 1024 pmz_debug("pmz: shutdown() done.\n"); 1025 } ··· 1591 1592 state = pmz_uart_reg.state + uap->port.line; 1593 1594 + mutex_lock(&pmz_irq_mutex); 1595 down(&state->sem); 1596 1597 spin_lock_irqsave(&uap->port.lock, flags); ··· 1624 pmz_set_scc_power(uap, 0); 1625 1626 up(&state->sem); 1627 + mutex_unlock(&pmz_irq_mutex); 1628 1629 pmz_debug("suspend, switching complete\n"); 1630 ··· 1651 1652 state = pmz_uart_reg.state + uap->port.line; 1653 1654 + mutex_lock(&pmz_irq_mutex); 1655 down(&state->sem); 1656 1657 spin_lock_irqsave(&uap->port.lock, flags); ··· 1685 1686 bail: 1687 up(&state->sem); 1688 + mutex_unlock(&pmz_irq_mutex); 1689 1690 /* Right now, we deal with delay by blocking here, I'll be 1691 * smarter later on
+8 -7
drivers/serial/serial_core.c
··· 33 #include <linux/device.h> 34 #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ 35 #include <linux/delay.h> 36 37 #include <asm/irq.h> 38 #include <asm/uaccess.h> ··· 48 /* 49 * This is used to lock changes in serial line configuration. 50 */ 51 - static DECLARE_MUTEX(port_sem); 52 53 #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) 54 ··· 1473 { 1474 struct uart_state *state; 1475 1476 - down(&port_sem); 1477 state = drv->state + line; 1478 if (down_interruptible(&state->sem)) { 1479 state = ERR_PTR(-ERESTARTSYS); ··· 1510 } 1511 1512 out: 1513 - up(&port_sem); 1514 return state; 1515 } 1516 ··· 2220 2221 state = drv->state + port->line; 2222 2223 - down(&port_sem); 2224 if (state->port) { 2225 ret = -EINVAL; 2226 goto out; ··· 2256 register_console(port->cons); 2257 2258 out: 2259 - up(&port_sem); 2260 2261 return ret; 2262 } ··· 2280 printk(KERN_ALERT "Removing wrong port: %p != %p\n", 2281 state->port, port); 2282 2283 - down(&port_sem); 2284 2285 /* 2286 * Remove the devices from devfs ··· 2289 2290 uart_unconfigure_port(drv, state); 2291 state->port = NULL; 2292 - up(&port_sem); 2293 2294 return 0; 2295 }
··· 33 #include <linux/device.h> 34 #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ 35 #include <linux/delay.h> 36 + #include <linux/mutex.h> 37 38 #include <asm/irq.h> 39 #include <asm/uaccess.h> ··· 47 /* 48 * This is used to lock changes in serial line configuration. 49 */ 50 + static DEFINE_MUTEX(port_mutex); 51 52 #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) 53 ··· 1472 { 1473 struct uart_state *state; 1474 1475 + mutex_lock(&port_mutex); 1476 state = drv->state + line; 1477 if (down_interruptible(&state->sem)) { 1478 state = ERR_PTR(-ERESTARTSYS); ··· 1509 } 1510 1511 out: 1512 + mutex_unlock(&port_mutex); 1513 return state; 1514 } 1515 ··· 2219 2220 state = drv->state + port->line; 2221 2222 + mutex_lock(&port_mutex); 2223 if (state->port) { 2224 ret = -EINVAL; 2225 goto out; ··· 2255 register_console(port->cons); 2256 2257 out: 2258 + mutex_unlock(&port_mutex); 2259 2260 return ret; 2261 } ··· 2279 printk(KERN_ALERT "Removing wrong port: %p != %p\n", 2280 state->port, port); 2281 2282 + mutex_lock(&port_mutex); 2283 2284 /* 2285 * Remove the devices from devfs ··· 2288 2289 uart_unconfigure_port(drv, state); 2290 state->port = NULL; 2291 + mutex_unlock(&port_mutex); 2292 2293 return 0; 2294 }
+6 -5
drivers/serial/serial_txx9.c
··· 52 #include <linux/tty_flip.h> 53 #include <linux/serial_core.h> 54 #include <linux/serial.h> 55 56 #include <asm/io.h> 57 #include <asm/irq.h> ··· 1019 uart_resume_port(&serial_txx9_reg, &serial_txx9_ports[line].port); 1020 } 1021 1022 - static DECLARE_MUTEX(serial_txx9_sem); 1023 1024 /** 1025 * serial_txx9_register_port - register a serial port ··· 1038 struct uart_txx9_port *uart; 1039 int ret = -ENOSPC; 1040 1041 - down(&serial_txx9_sem); 1042 for (i = 0; i < UART_NR; i++) { 1043 uart = &serial_txx9_ports[i]; 1044 if (uart->port.type == PORT_UNKNOWN) ··· 1059 if (ret == 0) 1060 ret = uart->port.line; 1061 } 1062 - up(&serial_txx9_sem); 1063 return ret; 1064 } 1065 ··· 1074 { 1075 struct uart_txx9_port *uart = &serial_txx9_ports[line]; 1076 1077 - down(&serial_txx9_sem); 1078 uart_remove_one_port(&serial_txx9_reg, &uart->port); 1079 uart->port.flags = 0; 1080 uart->port.type = PORT_UNKNOWN; ··· 1083 uart->port.membase = 0; 1084 uart->port.dev = NULL; 1085 uart_add_one_port(&serial_txx9_reg, &uart->port); 1086 - up(&serial_txx9_sem); 1087 } 1088 1089 /*
··· 52 #include <linux/tty_flip.h> 53 #include <linux/serial_core.h> 54 #include <linux/serial.h> 55 + #include <linux/mutex.h> 56 57 #include <asm/io.h> 58 #include <asm/irq.h> ··· 1018 uart_resume_port(&serial_txx9_reg, &serial_txx9_ports[line].port); 1019 } 1020 1021 + static DEFINE_MUTEX(serial_txx9_mutex); 1022 1023 /** 1024 * serial_txx9_register_port - register a serial port ··· 1037 struct uart_txx9_port *uart; 1038 int ret = -ENOSPC; 1039 1040 + mutex_lock(&serial_txx9_mutex); 1041 for (i = 0; i < UART_NR; i++) { 1042 uart = &serial_txx9_ports[i]; 1043 if (uart->port.type == PORT_UNKNOWN) ··· 1058 if (ret == 0) 1059 ret = uart->port.line; 1060 } 1061 + mutex_unlock(&serial_txx9_mutex); 1062 return ret; 1063 } 1064 ··· 1073 { 1074 struct uart_txx9_port *uart = &serial_txx9_ports[line]; 1075 1076 + mutex_lock(&serial_txx9_mutex); 1077 uart_remove_one_port(&serial_txx9_reg, &uart->port); 1078 uart->port.flags = 0; 1079 uart->port.type = PORT_UNKNOWN; ··· 1082 uart->port.membase = 0; 1083 uart->port.dev = NULL; 1084 uart_add_one_port(&serial_txx9_reg, &uart->port); 1085 + mutex_unlock(&serial_txx9_mutex); 1086 } 1087 1088 /*