Commit 08f6df21 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: stallion

callout removal: stallion
parent 1b8b8596
...@@ -121,7 +121,6 @@ static int stl_nrbrds = sizeof(stl_brdconf) / sizeof(stlconf_t); ...@@ -121,7 +121,6 @@ static int stl_nrbrds = sizeof(stl_brdconf) / sizeof(stlconf_t);
#endif #endif
#define STL_DRVTYPSERIAL 1 #define STL_DRVTYPSERIAL 1
#define STL_DRVTYPCALLOUT 2
/* /*
* Set the TX buffer size. Bigger is better, but we don't want * Set the TX buffer size. Bigger is better, but we don't want
...@@ -141,14 +140,11 @@ static char *stl_drvname = "stallion"; ...@@ -141,14 +140,11 @@ static char *stl_drvname = "stallion";
static char *stl_drvversion = "5.6.0"; static char *stl_drvversion = "5.6.0";
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
static char *stl_serialname = "tts/E%d"; static char *stl_serialname = "tts/E%d";
static char *stl_calloutname = "cua/E%d";
#else #else
static char *stl_serialname = "ttyE"; static char *stl_serialname = "ttyE";
static char *stl_calloutname = "cue";
#endif #endif
static struct tty_driver stl_serial; static struct tty_driver stl_serial;
static struct tty_driver stl_callout;
static struct tty_struct *stl_ttys[STL_MAXDEVS]; static struct tty_struct *stl_ttys[STL_MAXDEVS];
static struct termios *stl_termios[STL_MAXDEVS]; static struct termios *stl_termios[STL_MAXDEVS];
static struct termios *stl_termioslocked[STL_MAXDEVS]; static struct termios *stl_termioslocked[STL_MAXDEVS];
...@@ -799,10 +795,9 @@ static void __exit stallion_module_exit(void) ...@@ -799,10 +795,9 @@ static void __exit stallion_module_exit(void)
* hanging onto ports. * hanging onto ports.
*/ */
i = tty_unregister_driver(&stl_serial); i = tty_unregister_driver(&stl_serial);
j = tty_unregister_driver(&stl_callout); if (i) {
if (i || j) {
printk("STALLION: failed to un-register tty driver, " printk("STALLION: failed to un-register tty driver, "
"errno=%d,%d\n", -i, -j); "errno=%d\n", -i);
restore_flags(flags); restore_flags(flags);
return; return;
} }
...@@ -1087,39 +1082,16 @@ static int stl_open(struct tty_struct *tty, struct file *filp) ...@@ -1087,39 +1082,16 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
* previous opens still in effect. If we are a normal serial device * previous opens still in effect. If we are a normal serial device
* then also we might have to wait for carrier. * then also we might have to wait for carrier.
*/ */
if (tty->driver->subtype == STL_DRVTYPCALLOUT) { if (!(filp->f_flags & O_NONBLOCK)) {
if (portp->flags & ASYNC_NORMAL_ACTIVE) if ((rc = stl_waitcarrier(portp, filp)) != 0)
return(-EBUSY); return(rc);
if (portp->flags & ASYNC_CALLOUT_ACTIVE) {
if ((portp->flags & ASYNC_SESSION_LOCKOUT) &&
(portp->session != current->session))
return(-EBUSY);
if ((portp->flags & ASYNC_PGRP_LOCKOUT) &&
(portp->pgrp != current->pgrp))
return(-EBUSY);
}
portp->flags |= ASYNC_CALLOUT_ACTIVE;
} else {
if (filp->f_flags & O_NONBLOCK) {
if (portp->flags & ASYNC_CALLOUT_ACTIVE)
return(-EBUSY);
} else {
if ((rc = stl_waitcarrier(portp, filp)) != 0)
return(rc);
}
portp->flags |= ASYNC_NORMAL_ACTIVE;
} }
portp->flags |= ASYNC_NORMAL_ACTIVE;
if ((portp->refcount == 1) && (portp->flags & ASYNC_SPLIT_TERMIOS)) { if ((portp->refcount == 1) && (portp->flags & ASYNC_SPLIT_TERMIOS)) {
if (tty->driver->subtype == STL_DRVTYPSERIAL) *tty->termios = portp->normaltermios;
*tty->termios = portp->normaltermios;
else
*tty->termios = portp->callouttermios;
stl_setport(portp, tty->termios); stl_setport(portp, tty->termios);
} }
portp->session = current->session;
portp->pgrp = current->pgrp;
return(0); return(0);
} }
...@@ -1142,13 +1114,8 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) ...@@ -1142,13 +1114,8 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp)
rc = 0; rc = 0;
doclocal = 0; doclocal = 0;
if (portp->flags & ASYNC_CALLOUT_ACTIVE) { if (portp->tty->termios->c_cflag & CLOCAL)
if (portp->normaltermios.c_cflag & CLOCAL) doclocal++;
doclocal++;
} else {
if (portp->tty->termios->c_cflag & CLOCAL)
doclocal++;
}
save_flags(flags); save_flags(flags);
cli(); cli();
...@@ -1157,8 +1124,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) ...@@ -1157,8 +1124,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp)
portp->refcount--; portp->refcount--;
for (;;) { for (;;) {
if ((portp->flags & ASYNC_CALLOUT_ACTIVE) == 0) stl_setsignals(portp, 1, 1);
stl_setsignals(portp, 1, 1);
if (tty_hung_up_p(filp) || if (tty_hung_up_p(filp) ||
((portp->flags & ASYNC_INITIALIZED) == 0)) { ((portp->flags & ASYNC_INITIALIZED) == 0)) {
if (portp->flags & ASYNC_HUP_NOTIFY) if (portp->flags & ASYNC_HUP_NOTIFY)
...@@ -1167,8 +1133,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) ...@@ -1167,8 +1133,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp)
rc = -ERESTARTSYS; rc = -ERESTARTSYS;
break; break;
} }
if (((portp->flags & ASYNC_CALLOUT_ACTIVE) == 0) && if (((portp->flags & ASYNC_CLOSING) == 0) &&
((portp->flags & ASYNC_CLOSING) == 0) &&
(doclocal || (portp->sigs & TIOCM_CD))) { (doclocal || (portp->sigs & TIOCM_CD))) {
break; break;
} }
...@@ -1220,8 +1185,6 @@ static void stl_close(struct tty_struct *tty, struct file *filp) ...@@ -1220,8 +1185,6 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
if (portp->flags & ASYNC_NORMAL_ACTIVE) if (portp->flags & ASYNC_NORMAL_ACTIVE)
portp->normaltermios = *tty->termios; portp->normaltermios = *tty->termios;
if (portp->flags & ASYNC_CALLOUT_ACTIVE)
portp->callouttermios = *tty->termios;
/* /*
* May want to wait for any data to drain before closing. The BUSY * May want to wait for any data to drain before closing. The BUSY
...@@ -1260,8 +1223,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp) ...@@ -1260,8 +1223,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
wake_up_interruptible(&portp->open_wait); wake_up_interruptible(&portp->open_wait);
} }
portp->flags &= ~(ASYNC_CALLOUT_ACTIVE | ASYNC_NORMAL_ACTIVE | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
ASYNC_CLOSING);
wake_up_interruptible(&portp->close_wait); wake_up_interruptible(&portp->close_wait);
restore_flags(flags); restore_flags(flags);
} }
...@@ -1838,7 +1800,7 @@ static void stl_hangup(struct tty_struct *tty) ...@@ -1838,7 +1800,7 @@ static void stl_hangup(struct tty_struct *tty)
portp->tx.tail = (char *) NULL; portp->tx.tail = (char *) NULL;
} }
portp->tty = (struct tty_struct *) NULL; portp->tty = (struct tty_struct *) NULL;
portp->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE); portp->flags &= ~ASYNC_NORMAL_ACTIVE;
portp->refcount = 0; portp->refcount = 0;
wake_up_interruptible(&portp->open_wait); wake_up_interruptible(&portp->open_wait);
} }
...@@ -2256,12 +2218,8 @@ static void stl_offintr(void *private) ...@@ -2256,12 +2218,8 @@ static void stl_offintr(void *private)
if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0))
wake_up_interruptible(&portp->open_wait); wake_up_interruptible(&portp->open_wait);
if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) { if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) {
if (portp->flags & ASYNC_CHECK_CD) { if (portp->flags & ASYNC_CHECK_CD)
if (! ((portp->flags & ASYNC_CALLOUT_ACTIVE) && tty_hangup(tty); /* FIXME: module removal race here - AKPM */
(portp->flags & ASYNC_CALLOUT_NOHUP))) {
tty_hangup(tty); /* FIXME: module removal race here - AKPM */
}
}
} }
} }
unlock_kernel(); unlock_kernel();
...@@ -2340,7 +2298,6 @@ static int __init stl_initports(stlbrd_t *brdp, stlpanel_t *panelp) ...@@ -2340,7 +2298,6 @@ static int __init stl_initports(stlbrd_t *brdp, stlpanel_t *panelp)
portp->close_delay = STL_CLOSEDELAY; portp->close_delay = STL_CLOSEDELAY;
portp->closing_wait = 30 * HZ; portp->closing_wait = 30 * HZ;
portp->normaltermios = stl_deftermios; portp->normaltermios = stl_deftermios;
portp->callouttermios = stl_deftermios;
INIT_WORK(&portp->tqueue, stl_offintr, portp); INIT_WORK(&portp->tqueue, stl_offintr, portp);
init_waitqueue_head(&portp->open_wait); init_waitqueue_head(&portp->open_wait);
init_waitqueue_head(&portp->close_wait); init_waitqueue_head(&portp->close_wait);
...@@ -3218,7 +3175,6 @@ int __init stl_init(void) ...@@ -3218,7 +3175,6 @@ int __init stl_init(void)
/* /*
* Set up the tty driver structure and register us as a driver. * Set up the tty driver structure and register us as a driver.
* Also setup the callout tty device.
*/ */
memset(&stl_serial, 0, sizeof(struct tty_driver)); memset(&stl_serial, 0, sizeof(struct tty_driver));
stl_serial.magic = TTY_DRIVER_MAGIC; stl_serial.magic = TTY_DRIVER_MAGIC;
...@@ -3257,16 +3213,8 @@ int __init stl_init(void) ...@@ -3257,16 +3213,8 @@ int __init stl_init(void)
stl_serial.send_xchar = stl_sendxchar; stl_serial.send_xchar = stl_sendxchar;
stl_serial.read_proc = stl_readproc; stl_serial.read_proc = stl_readproc;
stl_callout = stl_serial;
stl_callout.name = stl_calloutname;
stl_callout.major = STL_CALLOUTMAJOR;
stl_callout.subtype = STL_DRVTYPCALLOUT;
stl_callout.read_proc = 0;
if (tty_register_driver(&stl_serial)) if (tty_register_driver(&stl_serial))
printk("STALLION: failed to register serial driver\n"); printk("STALLION: failed to register serial driver\n");
if (tty_register_driver(&stl_callout))
printk("STALLION: failed to register callout driver\n");
return(0); return(0);
} }
......
...@@ -84,8 +84,6 @@ typedef struct stlport { ...@@ -84,8 +84,6 @@ typedef struct stlport {
int refcount; int refcount;
int openwaitcnt; int openwaitcnt;
int brklen; int brklen;
long session;
long pgrp;
unsigned int sigs; unsigned int sigs;
unsigned int rxignoremsk; unsigned int rxignoremsk;
unsigned int rxmarkmsk; unsigned int rxmarkmsk;
...@@ -103,7 +101,6 @@ typedef struct stlport { ...@@ -103,7 +101,6 @@ typedef struct stlport {
wait_queue_head_t close_wait; wait_queue_head_t close_wait;
#endif #endif
struct termios normaltermios; struct termios normaltermios;
struct termios callouttermios;
struct work_struct tqueue; struct work_struct tqueue;
comstats_t stats; comstats_t stats;
stlrq_t tx; stlrq_t tx;
......
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