Commit 3470b4cd authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: isdn

callout removal: isdn
parent 0facaf29
......@@ -64,10 +64,8 @@ isdn_tty_event_callback(struct isdn_slot *slot, int pr, void *arg)
#ifdef CONFIG_DEVFS_FS
static char *isdn_ttyname_ttyI = "isdn/ttyI%d";
static char *isdn_ttyname_cui = "isdn/cui%d";
#else
static char *isdn_ttyname_ttyI = "ttyI";
static char *isdn_ttyname_cui = "cui";
#endif
struct isdn_modem isdn_mdm;
......@@ -1651,42 +1649,17 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
return -EAGAIN;
#endif
}
/*
* If this is a callout device, then just make sure the normal
* device isn't being used.
*/
if (tty->driver->subtype == ISDN_SERIAL_TYPE_CALLOUT) {
if (info->flags & ISDN_ASYNC_NORMAL_ACTIVE)
return -EBUSY;
if ((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ISDN_ASYNC_SESSION_LOCKOUT) &&
(info->session != current->session))
return -EBUSY;
if ((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ISDN_ASYNC_PGRP_LOCKOUT) &&
(info->pgrp != current->pgrp))
return -EBUSY;
info->flags |= ISDN_ASYNC_CALLOUT_ACTIVE;
return 0;
}
/*
* If non-blocking mode is set, then make the check up front
* and then exit.
*/
if ((filp->f_flags & O_NONBLOCK) ||
(tty->flags & (1 << TTY_IO_ERROR))) {
if (info->flags & ISDN_ASYNC_CALLOUT_ACTIVE)
return -EBUSY;
info->flags |= ISDN_ASYNC_NORMAL_ACTIVE;
return 0;
}
if (info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) {
if (info->normal_termios.c_cflag & CLOCAL)
do_clocal = 1;
} else {
if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;
}
if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;
/*
* Block waiting for the carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
......@@ -1720,8 +1693,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
#endif
break;
}
if (!(info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
!(info->flags & ISDN_ASYNC_CLOSING) &&
if (!(info->flags & ISDN_ASYNC_CLOSING) &&
(do_clocal || (info->msr & UART_MSR_DCD))) {
break;
}
......@@ -1797,14 +1769,9 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
return retval;
}
if ((info->count == 1) && (info->flags & ISDN_ASYNC_SPLIT_TERMIOS)) {
if (tty->driver->subtype == ISDN_SERIAL_TYPE_NORMAL)
*tty->termios = info->normal_termios;
else
*tty->termios = info->callout_termios;
*tty->termios = info->normal_termios;
isdn_tty_change_speed(info);
}
info->session = current->session;
info->pgrp = current->pgrp;
#ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_open ttyi%d successful...\n", info->line);
#endif
......@@ -1865,8 +1832,6 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
*/
if (info->flags & ISDN_ASYNC_NORMAL_ACTIVE)
info->normal_termios = *tty->termios;
if (info->flags & ISDN_ASYNC_CALLOUT_ACTIVE)
info->callout_termios = *tty->termios;
tty->closing = 1;
/*
......@@ -1904,8 +1869,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
schedule_timeout(HZ/2);
wake_up_interruptible(&info->open_wait);
}
info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE |
ISDN_ASYNC_CLOSING);
info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait);
restore_flags(flags);
#ifdef ISDN_DEBUG_MODEM_OPEN
......@@ -1927,7 +1891,7 @@ isdn_tty_hangup(struct tty_struct *tty)
return;
isdn_tty_shutdown(info);
info->count = 0;
info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE);
info->flags &= ~ISDN_ASYNC_NORMAL_ACTIVE;
info->tty = 0;
wake_up_interruptible(&info->open_wait);
}
......@@ -2054,7 +2018,7 @@ isdn_tty_init(void)
m->tty_modem.minor_start = 0;
m->tty_modem.num = ISDN_MAX_CHANNELS;
m->tty_modem.type = TTY_DRIVER_TYPE_SERIAL;
m->tty_modem.subtype = ISDN_SERIAL_TYPE_NORMAL;
m->tty_modem.subtype = SERIAL_TYPE_NORMAL;
m->tty_modem.init_termios = tty_std_termios;
m->tty_modem.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
m->tty_modem.flags = TTY_DRIVER_REAL_RAW;
......@@ -2078,26 +2042,12 @@ isdn_tty_init(void)
m->tty_modem.start = NULL;
m->tty_modem.hangup = isdn_tty_hangup;
m->tty_modem.driver_name = "isdn_tty";
/*
* The callout device is just like normal device except for
* major number and the subtype code.
*/
m->cua_modem = m->tty_modem;
m->cua_modem.name = isdn_ttyname_cui;
m->cua_modem.major = ISDN_TTYAUX_MAJOR;
m->tty_modem.minor_start = 0;
m->cua_modem.subtype = ISDN_SERIAL_TYPE_CALLOUT;
retval = tty_register_driver(&m->tty_modem);
if (retval) {
printk(KERN_WARNING "isdn_tty: Couldn't register modem-device\n");
goto err;
}
retval = tty_register_driver(&m->cua_modem);
if (retval) {
printk(KERN_WARNING "isdn_tty: Couldn't register modem-callout-device\n");
goto err_unregister_tty;
}
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
info = &m->info[i];
#ifdef CONFIG_ISDN_TTY_FAX
......@@ -2121,7 +2071,6 @@ isdn_tty_init(void)
info->x_char = 0;
info->count = 0;
info->blocked_open = 0;
info->callout_termios = m->cua_modem.init_termios;
info->normal_termios = m->tty_modem.init_termios;
init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait);
......@@ -2167,7 +2116,6 @@ isdn_tty_init(void)
#endif
kfree(info->xmit_buf - 4);
}
tty_unregister_driver(&isdn_mdm.cua_modem);
err_unregister_tty:
tty_unregister_driver(&isdn_mdm.tty_modem);
err:
......@@ -2189,7 +2137,6 @@ isdn_tty_exit(void)
#endif
kfree(info->xmit_buf - 4);
}
tty_unregister_driver(&isdn_mdm.cua_modem);
tty_unregister_driver(&isdn_mdm.tty_modem);
}
......@@ -2334,7 +2281,7 @@ isdn_tty_find_icall(struct isdn_slot *slot, setup_parm *setup)
}
#define TTY_IS_ACTIVE(info) \
(info->flags & (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE))
(info->flags & ISDN_ASYNC_NORMAL_ACTIVE)
static int
isdn_tty_stat_callback(struct isdn_slot *slot, isdn_ctrl *c)
......@@ -2833,9 +2780,7 @@ isdn_tty_modem_result(int code, modem_info * info)
}
if (info->tty->ldisc.flush_buffer)
info->tty->ldisc.flush_buffer(info->tty);
if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
(!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
if (info->flags & ISDN_ASYNC_CHECK_CD) {
tty_hangup(info->tty);
}
restore_flags(flags);
......
......@@ -116,7 +116,6 @@ extern void isdn_tty_exit(void);
struct isdn_modem {
int refcount; /* Number of opens */
struct tty_driver tty_modem; /* tty-device */
struct tty_driver cua_modem; /* cua-device */
struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
struct termios *modem_termios[ISDN_MAX_CHANNELS];
struct termios *modem_termios_locked[ISDN_MAX_CHANNELS];
......
......@@ -250,8 +250,6 @@ typedef struct {
#define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
#define ISDN_SERIAL_TYPE_NORMAL 1
#define ISDN_SERIAL_TYPE_CALLOUT 2
#ifdef CONFIG_ISDN_AUDIO
/* For using sk_buffs with audio we need some private variables
......@@ -348,7 +346,6 @@ typedef struct modem_info {
struct timer_list connect_timer; /* waiting for CONNECT */
struct timer_list read_timer; /* read incoming data */
struct termios normal_termios; /* For saving termios structs */
struct termios callout_termios;
wait_queue_head_t open_wait, close_wait;
struct semaphore write_sem;
} modem_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment