Commit 925fe98a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: synclink_cs

callout removal: synclink_cs
parent 60c2b09d
......@@ -155,14 +155,11 @@ typedef struct _mgslpc_info {
struct mgsl_icount icount;
struct termios normal_termios;
struct termios callout_termios;
struct tty_struct *tty;
int timeout;
int x_char; /* xon/xoff character */
int blocked_open; /* # of blocked opens */
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
unsigned char read_status_mask;
unsigned char ignore_status_mask;
......@@ -500,7 +497,7 @@ MODULE_LICENSE("GPL");
static char *driver_name = "SyncLink PC Card driver";
static char *driver_version = "$Revision: 4.10 $";
static struct tty_driver serial_driver, callout_driver;
static struct tty_driver serial_driver;
static int serial_refcount;
/* number of characters left in xmit buffer before we ask for more */
......@@ -617,8 +614,7 @@ static dev_link_t *mgslpc_attach(void)
memset(serial_table,0,sizeof(struct tty_struct*)*MAX_DEVICE_COUNT);
memset(serial_termios,0,sizeof(struct termios*)*MAX_DEVICE_COUNT);
memset(serial_termios_locked,0,sizeof(struct termios*)*MAX_DEVICE_COUNT);
info->callout_termios = callout_driver.init_termios;
info->normal_termios = serial_driver.init_termios;
return link;
......@@ -1307,7 +1303,7 @@ void dcd_change(MGSLPC_INFO *info)
(info->serial_signals & SerialSignal_DCD) ? "on" : "off");
if (info->serial_signals & SerialSignal_DCD)
wake_up_interruptible(&info->open_wait);
else if (!(info->flags & (ASYNC_CALLOUT_ACTIVE | ASYNC_CALLOUT_NOHUP))) {
else if (!(info->flags & ASYNC_CALLOUT_NOHUP)) {
if (debug_level >= DEBUG_LEVEL_ISR)
printk("doing serial hangup...");
if (info->tty)
......@@ -2589,9 +2585,7 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
*/
if (info->flags & ASYNC_NORMAL_ACTIVE)
info->normal_termios = *tty->termios;
if (info->flags & ASYNC_CALLOUT_ACTIVE)
info->callout_termios = *tty->termios;
/* set tty->closing to notify line discipline to
* only process XON/XOFF characters. Only the N_TTY
* discipline appears to use this (ppp does not).
......@@ -2629,8 +2623,7 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
wake_up_interruptible(&info->open_wait);
}
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|
ASYNC_CLOSING);
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait);
......@@ -2723,7 +2716,7 @@ static void mgslpc_hangup(struct tty_struct *tty)
shutdown(info);
info->count = 0;
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
info->flags &= ~ASYNC_NORMAL_ACTIVE;
info->tty = 0;
wake_up_interruptible(&info->open_wait);
......@@ -2744,40 +2737,16 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
printk("%s(%d):block_til_ready on %s\n",
__FILE__,__LINE__, tty->driver->name );
if (tty->driver->subtype == SERIAL_TYPE_CALLOUT) {
/* this is a callout device */
/* just verify that normal device is not in use */
if (info->flags & ASYNC_NORMAL_ACTIVE)
return -EBUSY;
if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ASYNC_SESSION_LOCKOUT) &&
(info->session != current->session))
return -EBUSY;
if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ASYNC_PGRP_LOCKOUT) &&
(info->pgrp != current->pgrp))
return -EBUSY;
info->flags |= ASYNC_CALLOUT_ACTIVE;
return 0;
}
if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
/* nonblock mode is set or port is not enabled */
/* just verify that callout device is not active */
if (info->flags & ASYNC_CALLOUT_ACTIVE)
return -EBUSY;
info->flags |= ASYNC_NORMAL_ACTIVE;
return 0;
}
if (info->flags & 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;
/* Wait for carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
* this loop, info->count is dropped by one, so that
......@@ -2801,8 +2770,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
info->blocked_open++;
while (1) {
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
(tty->termios->c_cflag & CBAUD)) {
if ((tty->termios->c_cflag & CBAUD)) {
spin_lock_irqsave(&info->lock,flags);
info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
set_signals(info);
......@@ -2821,8 +2789,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
get_signals(info);
spin_unlock_irqrestore(&info->lock,flags);
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
!(info->flags & ASYNC_CLOSING) &&
if (!(info->flags & ASYNC_CLOSING) &&
(do_clocal || (info->serial_signals & SerialSignal_DCD)) ) {
break;
}
......@@ -2926,16 +2893,10 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
if ((info->count == 1) &&
info->flags & ASYNC_SPLIT_TERMIOS) {
if (tty->driver->subtype == SERIAL_TYPE_NORMAL)
*tty->termios = info->normal_termios;
else
*tty->termios = info->callout_termios;
*tty->termios = info->normal_termios;
mgslpc_change_params(info);
}
info->session = current->session;
info->pgrp = current->pgrp;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):mgslpc_open(%s) success\n",
__FILE__,__LINE__, info->device_name);
......@@ -3232,28 +3193,13 @@ static int __init synclink_cs_init(void)
serial_driver.tiocmget = tiocmget;
serial_driver.tiocmset = tiocmset;
/*
* The callout device is just like normal device except for
* major number and the subtype code.
*/
callout_driver = serial_driver;
callout_driver.name = "cuaSLP";
callout_driver.major = cuamajor;
callout_driver.subtype = SERIAL_TYPE_CALLOUT;
callout_driver.read_proc = 0;
callout_driver.proc_entry = 0;
if (tty_register_driver(&serial_driver) < 0)
printk("%s(%d):Couldn't register serial driver\n",
__FILE__,__LINE__);
if (tty_register_driver(&callout_driver) < 0)
printk("%s(%d):Couldn't register callout driver\n",
__FILE__,__LINE__);
printk("%s %s, tty major#%d callout major#%d\n",
printk("%s %s, tty major#%d\n",
driver_name, driver_version,
serial_driver.major, callout_driver.major);
serial_driver.major);
return 0;
}
......@@ -3270,9 +3216,6 @@ static void __exit synclink_cs_exit(void)
if ((rc = tty_unregister_driver(&serial_driver)))
printk("%s(%d) failed to unregister tty driver err=%d\n",
__FILE__,__LINE__,rc);
if ((rc = tty_unregister_driver(&callout_driver)))
printk("%s(%d) failed to unregister callout driver err=%d\n",
__FILE__,__LINE__,rc);
unregister_pccard_driver(&dev_info);
while (dev_list != NULL) {
......
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