Commit ef5e4b0b authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: synclink

callout removal: synclink
parent 97f9db15
...@@ -200,14 +200,11 @@ struct mgsl_struct { ...@@ -200,14 +200,11 @@ struct mgsl_struct {
struct mgsl_icount icount; struct mgsl_icount icount;
struct termios normal_termios; struct termios normal_termios;
struct termios callout_termios;
struct tty_struct *tty; struct tty_struct *tty;
int timeout; int timeout;
int x_char; /* xon/xoff character */ int x_char; /* xon/xoff character */
int blocked_open; /* # of blocked opens */ int blocked_open; /* # of blocked opens */
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
u16 read_status_mask; u16 read_status_mask;
u16 ignore_status_mask; u16 ignore_status_mask;
unsigned char *xmit_buf; unsigned char *xmit_buf;
...@@ -891,8 +888,6 @@ static int break_on_load; ...@@ -891,8 +888,6 @@ static int break_on_load;
*/ */
static int ttymajor; static int ttymajor;
static int cuamajor;
/* /*
* Array of user specified options for ISA adapters. * Array of user specified options for ISA adapters.
*/ */
...@@ -907,7 +902,6 @@ static int txholdbufs[MAX_TOTAL_DEVICES]; ...@@ -907,7 +902,6 @@ static int txholdbufs[MAX_TOTAL_DEVICES];
MODULE_PARM(break_on_load,"i"); MODULE_PARM(break_on_load,"i");
MODULE_PARM(ttymajor,"i"); MODULE_PARM(ttymajor,"i");
MODULE_PARM(cuamajor,"i");
MODULE_PARM(io,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i"); MODULE_PARM(io,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i");
MODULE_PARM(irq,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i"); MODULE_PARM(irq,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i");
MODULE_PARM(dma,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i"); MODULE_PARM(dma,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i");
...@@ -940,7 +934,7 @@ static struct pci_driver synclink_pci_driver = { ...@@ -940,7 +934,7 @@ static struct pci_driver synclink_pci_driver = {
.remove = __devexit_p(synclink_remove_one), .remove = __devexit_p(synclink_remove_one),
}; };
static struct tty_driver serial_driver, callout_driver; static struct tty_driver serial_driver;
static int serial_refcount; static int serial_refcount;
/* number of characters left in xmit buffer before we ask for more */ /* number of characters left in xmit buffer before we ask for more */
...@@ -1377,8 +1371,7 @@ void mgsl_isr_io_pin( struct mgsl_struct *info ) ...@@ -1377,8 +1371,7 @@ void mgsl_isr_io_pin( struct mgsl_struct *info )
(status & MISCSTATUS_DCD) ? "on" : "off"); (status & MISCSTATUS_DCD) ? "on" : "off");
if (status & MISCSTATUS_DCD) if (status & MISCSTATUS_DCD)
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) && else {
(info->flags & ASYNC_CALLOUT_NOHUP))) {
if ( debug_level >= DEBUG_LEVEL_ISR ) if ( debug_level >= DEBUG_LEVEL_ISR )
printk("doing serial hangup..."); printk("doing serial hangup...");
if (info->tty) if (info->tty)
...@@ -3218,9 +3211,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp) ...@@ -3218,9 +3211,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
*/ */
if (info->flags & ASYNC_NORMAL_ACTIVE) if (info->flags & ASYNC_NORMAL_ACTIVE)
info->normal_termios = *tty->termios; info->normal_termios = *tty->termios;
if (info->flags & ASYNC_CALLOUT_ACTIVE)
info->callout_termios = *tty->termios;
/* set tty->closing to notify line discipline to /* set tty->closing to notify line discipline to
* only process XON/XOFF characters. Only the N_TTY * only process XON/XOFF characters. Only the N_TTY
* discipline appears to use this (ppp does not). * discipline appears to use this (ppp does not).
...@@ -3258,8 +3249,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp) ...@@ -3258,8 +3249,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} }
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE| info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
...@@ -3369,7 +3359,7 @@ static void mgsl_hangup(struct tty_struct *tty) ...@@ -3369,7 +3359,7 @@ static void mgsl_hangup(struct tty_struct *tty)
shutdown(info); shutdown(info);
info->count = 0; info->count = 0;
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); info->flags &= ~ASYNC_NORMAL_ACTIVE;
info->tty = 0; info->tty = 0;
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
...@@ -3401,40 +3391,15 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -3401,40 +3391,15 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
printk("%s(%d):block_til_ready on %s\n", printk("%s(%d):block_til_ready on %s\n",
__FILE__,__LINE__, tty->driver->name ); __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)){ if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
/* nonblock mode is set or port is not enabled */ /* 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; info->flags |= ASYNC_NORMAL_ACTIVE;
return 0; return 0;
} }
if (info->flags & ASYNC_CALLOUT_ACTIVE) { if (tty->termios->c_cflag & CLOCAL)
if (info->normal_termios.c_cflag & CLOCAL) do_clocal = 1;
do_clocal = 1;
} else {
if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;
}
/* Wait for carrier detect and the line to become /* Wait for carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in * free (i.e., not in use by the callout). While we are in
* this loop, info->count is dropped by one, so that * this loop, info->count is dropped by one, so that
...@@ -3458,8 +3423,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -3458,8 +3423,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
info->blocked_open++; info->blocked_open++;
while (1) { while (1) {
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && if (tty->termios->c_cflag & CBAUD) {
(tty->termios->c_cflag & CBAUD)) {
spin_lock_irqsave(&info->irq_spinlock,flags); spin_lock_irqsave(&info->irq_spinlock,flags);
info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
usc_set_serial_signals(info); usc_set_serial_signals(info);
...@@ -3478,8 +3442,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -3478,8 +3442,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
usc_get_serial_signals(info); usc_get_serial_signals(info);
spin_unlock_irqrestore(&info->irq_spinlock,flags); spin_unlock_irqrestore(&info->irq_spinlock,flags);
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && if (!(info->flags & ASYNC_CLOSING) &&
!(info->flags & ASYNC_CLOSING) &&
(do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) {
break; break;
} }
...@@ -3607,16 +3570,10 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) ...@@ -3607,16 +3570,10 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
if ((info->count == 1) && if ((info->count == 1) &&
info->flags & ASYNC_SPLIT_TERMIOS) { info->flags & ASYNC_SPLIT_TERMIOS) {
if (tty->driver->subtype == SERIAL_TYPE_NORMAL) *tty->termios = info->normal_termios;
*tty->termios = info->normal_termios;
else
*tty->termios = info->callout_termios;
mgsl_change_params(info); mgsl_change_params(info);
} }
info->session = current->session;
info->pgrp = current->pgrp;
if (debug_level >= DEBUG_LEVEL_INFO) if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):mgsl_open(%s) success\n", printk("%s(%d):mgsl_open(%s) success\n",
__FILE__,__LINE__, info->device_name); __FILE__,__LINE__, info->device_name);
...@@ -4548,34 +4505,18 @@ int mgsl_init_tty() ...@@ -4548,34 +4505,18 @@ int mgsl_init_tty()
serial_driver.tiocmget = tiocmget; serial_driver.tiocmget = tiocmget;
serial_driver.tiocmset = tiocmset; 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 = "cuaSL";
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) if (tty_register_driver(&serial_driver) < 0)
printk("%s(%d):Couldn't register serial driver\n", printk("%s(%d):Couldn't register serial driver\n",
__FILE__,__LINE__); __FILE__,__LINE__);
if (tty_register_driver(&callout_driver) < 0) printk("%s %s, tty major#%d\n",
printk("%s(%d):Couldn't register callout driver\n",
__FILE__,__LINE__);
printk("%s %s, tty major#%d callout major#%d\n",
driver_name, driver_version, driver_name, driver_version,
serial_driver.major, callout_driver.major); serial_driver.major);
/* Propagate these values to all device instances */ /* Propagate these values to all device instances */
info = mgsl_device_list; info = mgsl_device_list;
while(info){ while(info){
info->callout_termios = callout_driver.init_termios;
info->normal_termios = serial_driver.init_termios; info->normal_termios = serial_driver.init_termios;
info = info->next_device; info = info->next_device;
} }
...@@ -4671,9 +4612,6 @@ static void __exit synclink_exit(void) ...@@ -4671,9 +4612,6 @@ static void __exit synclink_exit(void)
if ((rc = tty_unregister_driver(&serial_driver))) if ((rc = tty_unregister_driver(&serial_driver)))
printk("%s(%d) failed to unregister tty driver err=%d\n", printk("%s(%d) failed to unregister tty driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
if ((rc = tty_unregister_driver(&callout_driver)))
printk("%s(%d) failed to unregister callout driver err=%d\n",
__FILE__,__LINE__,rc);
info = mgsl_device_list; info = mgsl_device_list;
while(info) { while(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