aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-04-02 07:53:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 14:16:54 -0400
commit48decc1c743fa4eb5ba5dd3f556e7fcbefe65440 (patch)
treee187f0d295549a39e96e004d5215ac8ab180c8b2 /drivers/isdn
parented722ead61e3776cbcda3805bb872ff2b856d3b9 (diff)
TTY: isdn, add tty_port
And use tty_port->flags now. Other members will follow. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Karsten Keil <isdn@linux-pingi.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/i4l/isdn_tty.c60
1 files changed, 31 insertions, 29 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 74b05188c18f..8ba526dc98bc 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -1046,20 +1046,20 @@ isdn_tty_change_speed(modem_info *info)
1046 1046
1047 /* CTS flow control flag and modem status interrupts */ 1047 /* CTS flow control flag and modem status interrupts */
1048 if (cflag & CRTSCTS) { 1048 if (cflag & CRTSCTS) {
1049 info->flags |= ASYNC_CTS_FLOW; 1049 info->port.flags |= ASYNC_CTS_FLOW;
1050 } else 1050 } else
1051 info->flags &= ~ASYNC_CTS_FLOW; 1051 info->port.flags &= ~ASYNC_CTS_FLOW;
1052 if (cflag & CLOCAL) 1052 if (cflag & CLOCAL)
1053 info->flags &= ~ASYNC_CHECK_CD; 1053 info->port.flags &= ~ASYNC_CHECK_CD;
1054 else { 1054 else {
1055 info->flags |= ASYNC_CHECK_CD; 1055 info->port.flags |= ASYNC_CHECK_CD;
1056 } 1056 }
1057} 1057}
1058 1058
1059static int 1059static int
1060isdn_tty_startup(modem_info *info) 1060isdn_tty_startup(modem_info *info)
1061{ 1061{
1062 if (info->flags & ASYNC_INITIALIZED) 1062 if (info->port.flags & ASYNC_INITIALIZED)
1063 return 0; 1063 return 0;
1064 isdn_lock_drivers(); 1064 isdn_lock_drivers();
1065#ifdef ISDN_DEBUG_MODEM_OPEN 1065#ifdef ISDN_DEBUG_MODEM_OPEN
@@ -1076,7 +1076,7 @@ isdn_tty_startup(modem_info *info)
1076 */ 1076 */
1077 isdn_tty_change_speed(info); 1077 isdn_tty_change_speed(info);
1078 1078
1079 info->flags |= ASYNC_INITIALIZED; 1079 info->port.flags |= ASYNC_INITIALIZED;
1080 info->msr |= (UART_MSR_DSR | UART_MSR_CTS); 1080 info->msr |= (UART_MSR_DSR | UART_MSR_CTS);
1081 info->send_outstanding = 0; 1081 info->send_outstanding = 0;
1082 return 0; 1082 return 0;
@@ -1089,7 +1089,7 @@ isdn_tty_startup(modem_info *info)
1089static void 1089static void
1090isdn_tty_shutdown(modem_info *info) 1090isdn_tty_shutdown(modem_info *info)
1091{ 1091{
1092 if (!(info->flags & ASYNC_INITIALIZED)) 1092 if (!(info->port.flags & ASYNC_INITIALIZED))
1093 return; 1093 return;
1094#ifdef ISDN_DEBUG_MODEM_OPEN 1094#ifdef ISDN_DEBUG_MODEM_OPEN
1095 printk(KERN_DEBUG "Shutting down isdnmodem port %d ....\n", info->line); 1095 printk(KERN_DEBUG "Shutting down isdnmodem port %d ....\n", info->line);
@@ -1109,7 +1109,7 @@ isdn_tty_shutdown(modem_info *info)
1109 if (info->tty) 1109 if (info->tty)
1110 set_bit(TTY_IO_ERROR, &info->tty->flags); 1110 set_bit(TTY_IO_ERROR, &info->tty->flags);
1111 1111
1112 info->flags &= ~ASYNC_INITIALIZED; 1112 info->port.flags &= ~ASYNC_INITIALIZED;
1113} 1113}
1114 1114
1115/* isdn_tty_write() is the main send-routine. It is called from the upper 1115/* isdn_tty_write() is the main send-routine. It is called from the upper
@@ -1496,11 +1496,11 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1496 * until it's done, and then try again. 1496 * until it's done, and then try again.
1497 */ 1497 */
1498 if (tty_hung_up_p(filp) || 1498 if (tty_hung_up_p(filp) ||
1499 (info->flags & ASYNC_CLOSING)) { 1499 (info->port.flags & ASYNC_CLOSING)) {
1500 if (info->flags & ASYNC_CLOSING) 1500 if (info->port.flags & ASYNC_CLOSING)
1501 interruptible_sleep_on(&info->close_wait); 1501 interruptible_sleep_on(&info->close_wait);
1502#ifdef MODEM_DO_RESTART 1502#ifdef MODEM_DO_RESTART
1503 if (info->flags & ASYNC_HUP_NOTIFY) 1503 if (info->port.flags & ASYNC_HUP_NOTIFY)
1504 return -EAGAIN; 1504 return -EAGAIN;
1505 else 1505 else
1506 return -ERESTARTSYS; 1506 return -ERESTARTSYS;
@@ -1514,7 +1514,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1514 */ 1514 */
1515 if ((filp->f_flags & O_NONBLOCK) || 1515 if ((filp->f_flags & O_NONBLOCK) ||
1516 (tty->flags & (1 << TTY_IO_ERROR))) { 1516 (tty->flags & (1 << TTY_IO_ERROR))) {
1517 info->flags |= ASYNC_NORMAL_ACTIVE; 1517 info->port.flags |= ASYNC_NORMAL_ACTIVE;
1518 return 0; 1518 return 0;
1519 } 1519 }
1520 if (tty->termios->c_cflag & CLOCAL) 1520 if (tty->termios->c_cflag & CLOCAL)
@@ -1538,9 +1538,9 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1538 while (1) { 1538 while (1) {
1539 set_current_state(TASK_INTERRUPTIBLE); 1539 set_current_state(TASK_INTERRUPTIBLE);
1540 if (tty_hung_up_p(filp) || 1540 if (tty_hung_up_p(filp) ||
1541 !(info->flags & ASYNC_INITIALIZED)) { 1541 !(info->port.flags & ASYNC_INITIALIZED)) {
1542#ifdef MODEM_DO_RESTART 1542#ifdef MODEM_DO_RESTART
1543 if (info->flags & ASYNC_HUP_NOTIFY) 1543 if (info->port.flags & ASYNC_HUP_NOTIFY)
1544 retval = -EAGAIN; 1544 retval = -EAGAIN;
1545 else 1545 else
1546 retval = -ERESTARTSYS; 1546 retval = -ERESTARTSYS;
@@ -1549,7 +1549,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1549#endif 1549#endif
1550 break; 1550 break;
1551 } 1551 }
1552 if (!(info->flags & ASYNC_CLOSING) && 1552 if (!(info->port.flags & ASYNC_CLOSING) &&
1553 (do_clocal || (info->msr & UART_MSR_DCD))) { 1553 (do_clocal || (info->msr & UART_MSR_DCD))) {
1554 break; 1554 break;
1555 } 1555 }
@@ -1574,7 +1574,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1574#endif 1574#endif
1575 if (retval) 1575 if (retval)
1576 return retval; 1576 return retval;
1577 info->flags |= ASYNC_NORMAL_ACTIVE; 1577 info->port.flags |= ASYNC_NORMAL_ACTIVE;
1578 return 0; 1578 return 0;
1579} 1579}
1580 1580
@@ -1600,6 +1600,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
1600 info->count++; 1600 info->count++;
1601 tty->driver_data = info; 1601 tty->driver_data = info;
1602 info->tty = tty; 1602 info->tty = tty;
1603 tty->port = &info->port;
1603 /* 1604 /*
1604 * Start up serial port 1605 * Start up serial port
1605 */ 1606 */
@@ -1664,7 +1665,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
1664#endif 1665#endif
1665 return; 1666 return;
1666 } 1667 }
1667 info->flags |= ASYNC_CLOSING; 1668 info->port.flags |= ASYNC_CLOSING;
1668 1669
1669 tty->closing = 1; 1670 tty->closing = 1;
1670 /* 1671 /*
@@ -1673,7 +1674,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
1673 * interrupt driver to stop checking the data ready bit in the 1674 * interrupt driver to stop checking the data ready bit in the
1674 * line status register. 1675 * line status register.
1675 */ 1676 */
1676 if (info->flags & ASYNC_INITIALIZED) { 1677 if (info->port.flags & ASYNC_INITIALIZED) {
1677 tty_wait_until_sent_from_close(tty, 3000); /* 30 seconds timeout */ 1678 tty_wait_until_sent_from_close(tty, 3000); /* 30 seconds timeout */
1678 /* 1679 /*
1679 * Before we drop DTR, make sure the UART transmitter 1680 * Before we drop DTR, make sure the UART transmitter
@@ -1698,7 +1699,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
1698 msleep_interruptible(500); 1699 msleep_interruptible(500);
1699 wake_up_interruptible(&info->open_wait); 1700 wake_up_interruptible(&info->open_wait);
1700 } 1701 }
1701 info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); 1702 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
1702 wake_up_interruptible(&info->close_wait); 1703 wake_up_interruptible(&info->close_wait);
1703#ifdef ISDN_DEBUG_MODEM_OPEN 1704#ifdef ISDN_DEBUG_MODEM_OPEN
1704 printk(KERN_DEBUG "isdn_tty_close normal exit\n"); 1705 printk(KERN_DEBUG "isdn_tty_close normal exit\n");
@@ -1717,7 +1718,7 @@ isdn_tty_hangup(struct tty_struct *tty)
1717 return; 1718 return;
1718 isdn_tty_shutdown(info); 1719 isdn_tty_shutdown(info);
1719 info->count = 0; 1720 info->count = 0;
1720 info->flags &= ~ASYNC_NORMAL_ACTIVE; 1721 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1721 info->tty = NULL; 1722 info->tty = NULL;
1722 wake_up_interruptible(&info->open_wait); 1723 wake_up_interruptible(&info->open_wait);
1723} 1724}
@@ -1881,6 +1882,7 @@ isdn_tty_modem_init(void)
1881 goto err_unregister; 1882 goto err_unregister;
1882 } 1883 }
1883#endif 1884#endif
1885 tty_port_init(&info->port);
1884 spin_lock_init(&info->readlock); 1886 spin_lock_init(&info->readlock);
1885 sprintf(info->last_cause, "0000"); 1887 sprintf(info->last_cause, "0000");
1886 sprintf(info->last_num, "none"); 1888 sprintf(info->last_num, "none");
@@ -2055,12 +2057,12 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
2055#ifdef ISDN_DEBUG_MODEM_ICALL 2057#ifdef ISDN_DEBUG_MODEM_ICALL
2056 printk(KERN_DEBUG "m_fi: match1 wret=%d\n", wret); 2058 printk(KERN_DEBUG "m_fi: match1 wret=%d\n", wret);
2057 printk(KERN_DEBUG "m_fi: idx=%d flags=%08lx drv=%d ch=%d usg=%d\n", idx, 2059 printk(KERN_DEBUG "m_fi: idx=%d flags=%08lx drv=%d ch=%d usg=%d\n", idx,
2058 info->flags, info->isdn_driver, info->isdn_channel, 2060 info->port.flags, info->isdn_driver,
2059 dev->usage[idx]); 2061 info->isdn_channel, dev->usage[idx]);
2060#endif 2062#endif
2061 if ( 2063 if (
2062#ifndef FIX_FILE_TRANSFER 2064#ifndef FIX_FILE_TRANSFER
2063 (info->flags & ASYNC_NORMAL_ACTIVE) && 2065 (info->port.flags & ASYNC_NORMAL_ACTIVE) &&
2064#endif 2066#endif
2065 (info->isdn_driver == -1) && 2067 (info->isdn_driver == -1) &&
2066 (info->isdn_channel == -1) && 2068 (info->isdn_channel == -1) &&
@@ -2099,7 +2101,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
2099 return (wret == 2) ? 3 : 0; 2101 return (wret == 2) ? 3 : 0;
2100} 2102}
2101 2103
2102#define TTY_IS_ACTIVE(info) (info->flags & ASYNC_NORMAL_ACTIVE) 2104#define TTY_IS_ACTIVE(info) (info->port.flags & ASYNC_NORMAL_ACTIVE)
2103 2105
2104int 2106int
2105isdn_tty_stat_callback(int i, isdn_ctrl *c) 2107isdn_tty_stat_callback(int i, isdn_ctrl *c)
@@ -2318,7 +2320,7 @@ isdn_tty_at_cout(char *msg, modem_info *info)
2318 2320
2319 spin_lock_irqsave(&info->readlock, flags); 2321 spin_lock_irqsave(&info->readlock, flags);
2320 tty = info->tty; 2322 tty = info->tty;
2321 if ((info->flags & ASYNC_CLOSING) || (!tty)) { 2323 if ((info->port.flags & ASYNC_CLOSING) || (!tty)) {
2322 spin_unlock_irqrestore(&info->readlock, flags); 2324 spin_unlock_irqrestore(&info->readlock, flags);
2323 return; 2325 return;
2324 } 2326 }
@@ -2468,13 +2470,13 @@ isdn_tty_modem_result(int code, modem_info *info)
2468 case RESULT_NO_CARRIER: 2470 case RESULT_NO_CARRIER:
2469#ifdef ISDN_DEBUG_MODEM_HUP 2471#ifdef ISDN_DEBUG_MODEM_HUP
2470 printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n", 2472 printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n",
2471 (info->flags & ASYNC_CLOSING), 2473 (info->port.flags & ASYNC_CLOSING),
2472 (!info->tty)); 2474 (!info->tty));
2473#endif 2475#endif
2474 m->mdmreg[REG_RINGCNT] = 0; 2476 m->mdmreg[REG_RINGCNT] = 0;
2475 del_timer(&info->nc_timer); 2477 del_timer(&info->nc_timer);
2476 info->ncarrier = 0; 2478 info->ncarrier = 0;
2477 if ((info->flags & ASYNC_CLOSING) || (!info->tty)) 2479 if ((info->port.flags & ASYNC_CLOSING) || (!info->tty))
2478 return; 2480 return;
2479 2481
2480#ifdef CONFIG_ISDN_AUDIO 2482#ifdef CONFIG_ISDN_AUDIO
@@ -2607,10 +2609,10 @@ isdn_tty_modem_result(int code, modem_info *info)
2607 } 2609 }
2608 } 2610 }
2609 if (code == RESULT_NO_CARRIER) { 2611 if (code == RESULT_NO_CARRIER) {
2610 if ((info->flags & ASYNC_CLOSING) || (!info->tty)) 2612 if ((info->port.flags & ASYNC_CLOSING) || (!info->tty))
2611 return; 2613 return;
2612 2614
2613 if (info->flags & ASYNC_CHECK_CD) 2615 if (info->port.flags & ASYNC_CHECK_CD)
2614 tty_hangup(info->tty); 2616 tty_hangup(info->tty);
2615 } 2617 }
2616} 2618}