aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/isdn/i4l/isdn_tty.c59
-rw-r--r--include/linux/isdn.h12
2 files changed, 30 insertions, 41 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 27f70923c224..bcf4bbe693bc 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -11,6 +11,7 @@
11#undef ISDN_TTY_STAT_DEBUG 11#undef ISDN_TTY_STAT_DEBUG
12 12
13#include <linux/isdn.h> 13#include <linux/isdn.h>
14#include <linux/serial.h> /* ASYNC_* flags */
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
16#include <linux/mutex.h> 17#include <linux/mutex.h>
@@ -1036,20 +1037,20 @@ isdn_tty_change_speed(modem_info *info)
1036 1037
1037 /* CTS flow control flag and modem status interrupts */ 1038 /* CTS flow control flag and modem status interrupts */
1038 if (cflag & CRTSCTS) { 1039 if (cflag & CRTSCTS) {
1039 info->flags |= ISDN_ASYNC_CTS_FLOW; 1040 info->flags |= ASYNC_CTS_FLOW;
1040 } else 1041 } else
1041 info->flags &= ~ISDN_ASYNC_CTS_FLOW; 1042 info->flags &= ~ASYNC_CTS_FLOW;
1042 if (cflag & CLOCAL) 1043 if (cflag & CLOCAL)
1043 info->flags &= ~ISDN_ASYNC_CHECK_CD; 1044 info->flags &= ~ASYNC_CHECK_CD;
1044 else { 1045 else {
1045 info->flags |= ISDN_ASYNC_CHECK_CD; 1046 info->flags |= ASYNC_CHECK_CD;
1046 } 1047 }
1047} 1048}
1048 1049
1049static int 1050static int
1050isdn_tty_startup(modem_info *info) 1051isdn_tty_startup(modem_info *info)
1051{ 1052{
1052 if (info->flags & ISDN_ASYNC_INITIALIZED) 1053 if (info->flags & ASYNC_INITIALIZED)
1053 return 0; 1054 return 0;
1054 isdn_lock_drivers(); 1055 isdn_lock_drivers();
1055#ifdef ISDN_DEBUG_MODEM_OPEN 1056#ifdef ISDN_DEBUG_MODEM_OPEN
@@ -1066,7 +1067,7 @@ isdn_tty_startup(modem_info *info)
1066 */ 1067 */
1067 isdn_tty_change_speed(info); 1068 isdn_tty_change_speed(info);
1068 1069
1069 info->flags |= ISDN_ASYNC_INITIALIZED; 1070 info->flags |= ASYNC_INITIALIZED;
1070 info->msr |= (UART_MSR_DSR | UART_MSR_CTS); 1071 info->msr |= (UART_MSR_DSR | UART_MSR_CTS);
1071 info->send_outstanding = 0; 1072 info->send_outstanding = 0;
1072 return 0; 1073 return 0;
@@ -1079,7 +1080,7 @@ isdn_tty_startup(modem_info *info)
1079static void 1080static void
1080isdn_tty_shutdown(modem_info *info) 1081isdn_tty_shutdown(modem_info *info)
1081{ 1082{
1082 if (!(info->flags & ISDN_ASYNC_INITIALIZED)) 1083 if (!(info->flags & ASYNC_INITIALIZED))
1083 return; 1084 return;
1084#ifdef ISDN_DEBUG_MODEM_OPEN 1085#ifdef ISDN_DEBUG_MODEM_OPEN
1085 printk(KERN_DEBUG "Shutting down isdnmodem port %d ....\n", info->line); 1086 printk(KERN_DEBUG "Shutting down isdnmodem port %d ....\n", info->line);
@@ -1099,7 +1100,7 @@ isdn_tty_shutdown(modem_info *info)
1099 if (info->tty) 1100 if (info->tty)
1100 set_bit(TTY_IO_ERROR, &info->tty->flags); 1101 set_bit(TTY_IO_ERROR, &info->tty->flags);
1101 1102
1102 info->flags &= ~ISDN_ASYNC_INITIALIZED; 1103 info->flags &= ~ASYNC_INITIALIZED;
1103} 1104}
1104 1105
1105/* isdn_tty_write() is the main send-routine. It is called from the upper 1106/* isdn_tty_write() is the main send-routine. It is called from the upper
@@ -1486,11 +1487,11 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1486 * until it's done, and then try again. 1487 * until it's done, and then try again.
1487 */ 1488 */
1488 if (tty_hung_up_p(filp) || 1489 if (tty_hung_up_p(filp) ||
1489 (info->flags & ISDN_ASYNC_CLOSING)) { 1490 (info->flags & ASYNC_CLOSING)) {
1490 if (info->flags & ISDN_ASYNC_CLOSING) 1491 if (info->flags & ASYNC_CLOSING)
1491 interruptible_sleep_on(&info->close_wait); 1492 interruptible_sleep_on(&info->close_wait);
1492#ifdef MODEM_DO_RESTART 1493#ifdef MODEM_DO_RESTART
1493 if (info->flags & ISDN_ASYNC_HUP_NOTIFY) 1494 if (info->flags & ASYNC_HUP_NOTIFY)
1494 return -EAGAIN; 1495 return -EAGAIN;
1495 else 1496 else
1496 return -ERESTARTSYS; 1497 return -ERESTARTSYS;
@@ -1504,7 +1505,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1504 */ 1505 */
1505 if ((filp->f_flags & O_NONBLOCK) || 1506 if ((filp->f_flags & O_NONBLOCK) ||
1506 (tty->flags & (1 << TTY_IO_ERROR))) { 1507 (tty->flags & (1 << TTY_IO_ERROR))) {
1507 info->flags |= ISDN_ASYNC_NORMAL_ACTIVE; 1508 info->flags |= ASYNC_NORMAL_ACTIVE;
1508 return 0; 1509 return 0;
1509 } 1510 }
1510 if (tty->termios->c_cflag & CLOCAL) 1511 if (tty->termios->c_cflag & CLOCAL)
@@ -1528,9 +1529,9 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1528 while (1) { 1529 while (1) {
1529 set_current_state(TASK_INTERRUPTIBLE); 1530 set_current_state(TASK_INTERRUPTIBLE);
1530 if (tty_hung_up_p(filp) || 1531 if (tty_hung_up_p(filp) ||
1531 !(info->flags & ISDN_ASYNC_INITIALIZED)) { 1532 !(info->flags & ASYNC_INITIALIZED)) {
1532#ifdef MODEM_DO_RESTART 1533#ifdef MODEM_DO_RESTART
1533 if (info->flags & ISDN_ASYNC_HUP_NOTIFY) 1534 if (info->flags & ASYNC_HUP_NOTIFY)
1534 retval = -EAGAIN; 1535 retval = -EAGAIN;
1535 else 1536 else
1536 retval = -ERESTARTSYS; 1537 retval = -ERESTARTSYS;
@@ -1539,7 +1540,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1539#endif 1540#endif
1540 break; 1541 break;
1541 } 1542 }
1542 if (!(info->flags & ISDN_ASYNC_CLOSING) && 1543 if (!(info->flags & ASYNC_CLOSING) &&
1543 (do_clocal || (info->msr & UART_MSR_DCD))) { 1544 (do_clocal || (info->msr & UART_MSR_DCD))) {
1544 break; 1545 break;
1545 } 1546 }
@@ -1564,7 +1565,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
1564#endif 1565#endif
1565 if (retval) 1566 if (retval)
1566 return retval; 1567 return retval;
1567 info->flags |= ISDN_ASYNC_NORMAL_ACTIVE; 1568 info->flags |= ASYNC_NORMAL_ACTIVE;
1568 return 0; 1569 return 0;
1569} 1570}
1570 1571
@@ -1661,7 +1662,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
1661 module_put(info->owner); 1662 module_put(info->owner);
1662 return; 1663 return;
1663 } 1664 }
1664 info->flags |= ISDN_ASYNC_CLOSING; 1665 info->flags |= ASYNC_CLOSING;
1665 1666
1666 tty->closing = 1; 1667 tty->closing = 1;
1667 /* 1668 /*
@@ -1670,7 +1671,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
1670 * interrupt driver to stop checking the data ready bit in the 1671 * interrupt driver to stop checking the data ready bit in the
1671 * line status register. 1672 * line status register.
1672 */ 1673 */
1673 if (info->flags & ISDN_ASYNC_INITIALIZED) { 1674 if (info->flags & ASYNC_INITIALIZED) {
1674 tty_wait_until_sent_from_close(tty, 3000); /* 30 seconds timeout */ 1675 tty_wait_until_sent_from_close(tty, 3000); /* 30 seconds timeout */
1675 /* 1676 /*
1676 * Before we drop DTR, make sure the UART transmitter 1677 * Before we drop DTR, make sure the UART transmitter
@@ -1696,7 +1697,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
1696 msleep_interruptible(500); 1697 msleep_interruptible(500);
1697 wake_up_interruptible(&info->open_wait); 1698 wake_up_interruptible(&info->open_wait);
1698 } 1699 }
1699 info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CLOSING); 1700 info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
1700 wake_up_interruptible(&info->close_wait); 1701 wake_up_interruptible(&info->close_wait);
1701#ifdef ISDN_DEBUG_MODEM_OPEN 1702#ifdef ISDN_DEBUG_MODEM_OPEN
1702 printk(KERN_DEBUG "isdn_tty_close normal exit\n"); 1703 printk(KERN_DEBUG "isdn_tty_close normal exit\n");
@@ -1715,7 +1716,7 @@ isdn_tty_hangup(struct tty_struct *tty)
1715 return; 1716 return;
1716 isdn_tty_shutdown(info); 1717 isdn_tty_shutdown(info);
1717 info->count = 0; 1718 info->count = 0;
1718 info->flags &= ~ISDN_ASYNC_NORMAL_ACTIVE; 1719 info->flags &= ~ASYNC_NORMAL_ACTIVE;
1719 info->tty = NULL; 1720 info->tty = NULL;
1720 wake_up_interruptible(&info->open_wait); 1721 wake_up_interruptible(&info->open_wait);
1721} 1722}
@@ -2061,7 +2062,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
2061#endif 2062#endif
2062 if ( 2063 if (
2063#ifndef FIX_FILE_TRANSFER 2064#ifndef FIX_FILE_TRANSFER
2064 (info->flags & ISDN_ASYNC_NORMAL_ACTIVE) && 2065 (info->flags & ASYNC_NORMAL_ACTIVE) &&
2065#endif 2066#endif
2066 (info->isdn_driver == -1) && 2067 (info->isdn_driver == -1) &&
2067 (info->isdn_channel == -1) && 2068 (info->isdn_channel == -1) &&
@@ -2100,7 +2101,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
2100 return (wret == 2) ? 3 : 0; 2101 return (wret == 2) ? 3 : 0;
2101} 2102}
2102 2103
2103#define TTY_IS_ACTIVE(info) (info->flags & ISDN_ASYNC_NORMAL_ACTIVE) 2104#define TTY_IS_ACTIVE(info) (info->flags & ASYNC_NORMAL_ACTIVE)
2104 2105
2105int 2106int
2106isdn_tty_stat_callback(int i, isdn_ctrl *c) 2107isdn_tty_stat_callback(int i, isdn_ctrl *c)
@@ -2319,7 +2320,7 @@ isdn_tty_at_cout(char *msg, modem_info *info)
2319 2320
2320 spin_lock_irqsave(&info->readlock, flags); 2321 spin_lock_irqsave(&info->readlock, flags);
2321 tty = info->tty; 2322 tty = info->tty;
2322 if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) { 2323 if ((info->flags & ASYNC_CLOSING) || (!tty)) {
2323 spin_unlock_irqrestore(&info->readlock, flags); 2324 spin_unlock_irqrestore(&info->readlock, flags);
2324 return; 2325 return;
2325 } 2326 }
@@ -2469,15 +2470,15 @@ isdn_tty_modem_result(int code, modem_info *info)
2469 case RESULT_NO_CARRIER: 2470 case RESULT_NO_CARRIER:
2470#ifdef ISDN_DEBUG_MODEM_HUP 2471#ifdef ISDN_DEBUG_MODEM_HUP
2471 printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n", 2472 printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n",
2472 (info->flags & ISDN_ASYNC_CLOSING), 2473 (info->flags & ASYNC_CLOSING),
2473 (!info->tty)); 2474 (!info->tty));
2474#endif 2475#endif
2475 m->mdmreg[REG_RINGCNT] = 0; 2476 m->mdmreg[REG_RINGCNT] = 0;
2476 del_timer(&info->nc_timer); 2477 del_timer(&info->nc_timer);
2477 info->ncarrier = 0; 2478 info->ncarrier = 0;
2478 if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { 2479 if ((info->flags & ASYNC_CLOSING) || (!info->tty))
2479 return; 2480 return;
2480 } 2481
2481#ifdef CONFIG_ISDN_AUDIO 2482#ifdef CONFIG_ISDN_AUDIO
2482 if (info->vonline & 1) { 2483 if (info->vonline & 1) {
2483#ifdef ISDN_DEBUG_MODEM_VOICE 2484#ifdef ISDN_DEBUG_MODEM_VOICE
@@ -2608,10 +2609,10 @@ isdn_tty_modem_result(int code, modem_info *info)
2608 } 2609 }
2609 } 2610 }
2610 if (code == RESULT_NO_CARRIER) { 2611 if (code == RESULT_NO_CARRIER) {
2611 if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { 2612 if ((info->flags & ASYNC_CLOSING) || (!info->tty))
2612 return; 2613 return;
2613 } 2614
2614 if (info->flags & ISDN_ASYNC_CHECK_CD) 2615 if (info->flags & ASYNC_CHECK_CD)
2615 tty_hangup(info->tty); 2616 tty_hangup(info->tty);
2616 } 2617 }
2617} 2618}
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index d13b76df34b3..1b4b4c1846c5 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -392,20 +392,8 @@ typedef struct isdn_net_dev_s {
392/*======================= Start of ISDN-tty stuff ===========================*/ 392/*======================= Start of ISDN-tty stuff ===========================*/
393 393
394#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */ 394#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
395#define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
396#define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
397#define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
398#define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
399#define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
400#define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
401#define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
402#define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
403#define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
404#define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
405#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */ 395#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
406#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */ 396#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
407#define ISDN_SERIAL_TYPE_NORMAL 1
408#define ISDN_SERIAL_TYPE_CALLOUT 2
409 397
410#ifdef CONFIG_ISDN_AUDIO 398#ifdef CONFIG_ISDN_AUDIO
411/* For using sk_buffs with audio we need some private variables 399/* For using sk_buffs with audio we need some private variables