Commit 5d922361 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: pcxx

callout removal: pcxx
parent 4f6a436f
...@@ -141,11 +141,9 @@ int pcxx_nbios=sizeof(pcxx_bios); ...@@ -141,11 +141,9 @@ int pcxx_nbios=sizeof(pcxx_bios);
#define FEPTIMEOUT 200000 #define FEPTIMEOUT 200000
#define SERIAL_TYPE_NORMAL 1 #define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_CALLOUT 2
#define PCXE_EVENT_HANGUP 1 #define PCXE_EVENT_HANGUP 1
struct tty_driver pcxe_driver; struct tty_driver pcxe_driver;
struct tty_driver pcxe_callout;
static int pcxe_refcount; static int pcxe_refcount;
static struct timer_list pcxx_timer; static struct timer_list pcxx_timer;
...@@ -240,8 +238,6 @@ void cleanup_module() ...@@ -240,8 +238,6 @@ void cleanup_module()
if ((e1 = tty_unregister_driver(&pcxe_driver))) if ((e1 = tty_unregister_driver(&pcxe_driver)))
printk("SERIAL: failed to unregister serial driver (%d)\n", e1); printk("SERIAL: failed to unregister serial driver (%d)\n", e1);
if ((e2 = tty_unregister_driver(&pcxe_callout)))
printk("SERIAL: failed to unregister callout driver (%d)\n",e2);
cleanup_board_resources(); cleanup_board_resources();
kfree(digi_channels); kfree(digi_channels);
...@@ -341,13 +337,8 @@ static int pcxx_waitcarrier(struct tty_struct *tty,struct file *filp,struct chan ...@@ -341,13 +337,8 @@ static int pcxx_waitcarrier(struct tty_struct *tty,struct file *filp,struct chan
int retval = 0; int retval = 0;
int do_clocal = 0; int do_clocal = 0;
if (info->asyncflags & 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;
}
/* /*
* Block waiting for the carrier detect and the line to become free * Block waiting for the carrier detect and the line to become free
...@@ -360,12 +351,10 @@ static int pcxx_waitcarrier(struct tty_struct *tty,struct file *filp,struct chan ...@@ -360,12 +351,10 @@ static int pcxx_waitcarrier(struct tty_struct *tty,struct file *filp,struct chan
for (;;) { for (;;) {
cli(); cli();
if ((info->asyncflags & ASYNC_CALLOUT_ACTIVE) == 0) { globalwinon(info);
globalwinon(info); info->omodem |= DTR|RTS;
info->omodem |= DTR|RTS; fepcmd(info, SETMODEM, DTR|RTS, 0, 10, 1);
fepcmd(info, SETMODEM, DTR|RTS, 0, 10, 1); memoff(info);
memoff(info);
}
sti(); sti();
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if(tty_hung_up_p(filp) || (info->asyncflags & ASYNC_INITIALIZED) == 0) { if(tty_hung_up_p(filp) || (info->asyncflags & ASYNC_INITIALIZED) == 0) {
...@@ -375,8 +364,7 @@ static int pcxx_waitcarrier(struct tty_struct *tty,struct file *filp,struct chan ...@@ -375,8 +364,7 @@ static int pcxx_waitcarrier(struct tty_struct *tty,struct file *filp,struct chan
retval = -ERESTARTSYS; retval = -ERESTARTSYS;
break; break;
} }
if ((info->asyncflags & ASYNC_CALLOUT_ACTIVE) == 0 && if ((info->asyncflags & ASYNC_CLOSING) == 0 &&
(info->asyncflags & ASYNC_CLOSING) == 0 &&
(do_clocal || (info->imodem & info->dcd))) (do_clocal || (info->imodem & info->dcd)))
break; break;
if(signal_pending(current)) { if(signal_pending(current)) {
...@@ -476,56 +464,29 @@ int pcxe_open(struct tty_struct *tty, struct file * filp) ...@@ -476,56 +464,29 @@ int pcxe_open(struct tty_struct *tty, struct file * filp)
else else
return -ERESTARTSYS; return -ERESTARTSYS;
} }
/*
* If this is a callout device, then just make sure the normal if (!(filp->f_flags & O_NONBLOCK)) {
* device isn't being used. /* this has to be set in order for the "block until
*/ * CD" code to work correctly. i'm not sure under
if (tty->driver->subtype == SERIAL_TYPE_CALLOUT) { * what circumstances asyncflags should be set to
if (ch->asyncflags & ASYNC_NORMAL_ACTIVE) * ASYNC_NORMAL_ACTIVE though
return -EBUSY; * brian@ilinx.com
if (ch->asyncflags & ASYNC_CALLOUT_ACTIVE) { */
if ((ch->asyncflags & ASYNC_SESSION_LOCKOUT) &&
(ch->session != current->session))
return -EBUSY;
if((ch->asyncflags & ASYNC_PGRP_LOCKOUT) &&
(ch->pgrp != current->pgrp))
return -EBUSY;
}
ch->asyncflags |= ASYNC_CALLOUT_ACTIVE;
}
else {
if (filp->f_flags & O_NONBLOCK) {
if(ch->asyncflags & ASYNC_CALLOUT_ACTIVE)
return -EBUSY;
}
else {
/* this has to be set in order for the "block until
* CD" code to work correctly. i'm not sure under
* what circumstances asyncflags should be set to
* ASYNC_NORMAL_ACTIVE though
* brian@ilinx.com
*/
ch->asyncflags |= ASYNC_NORMAL_ACTIVE;
if ((retval = pcxx_waitcarrier(tty, filp, ch)) != 0)
return retval;
}
ch->asyncflags |= ASYNC_NORMAL_ACTIVE; ch->asyncflags |= ASYNC_NORMAL_ACTIVE;
if ((retval = pcxx_waitcarrier(tty, filp, ch)) != 0)
return retval;
} }
ch->asyncflags |= ASYNC_NORMAL_ACTIVE;
save_flags(flags); save_flags(flags);
cli(); cli();
if((ch->count == 1) && (ch->asyncflags & ASYNC_SPLIT_TERMIOS)) { if((ch->count == 1) && (ch->asyncflags & ASYNC_SPLIT_TERMIOS)) {
if(tty->driver->subtype == SERIAL_TYPE_NORMAL) *tty->termios = ch->normal_termios;
*tty->termios = ch->normal_termios;
else
*tty->termios = ch->callout_termios;
globalwinon(ch); globalwinon(ch);
pcxxparam(tty,ch); pcxxparam(tty,ch);
memoff(ch); memoff(ch);
} }
ch->session = current->session;
ch->pgrp = current->pgrp;
restore_flags(flags); restore_flags(flags);
return 0; return 0;
} }
...@@ -605,8 +566,6 @@ static void pcxe_close(struct tty_struct * tty, struct file * filp) ...@@ -605,8 +566,6 @@ static void pcxe_close(struct tty_struct * tty, struct file * filp)
*/ */
if(info->asyncflags & ASYNC_NORMAL_ACTIVE) if(info->asyncflags & ASYNC_NORMAL_ACTIVE)
info->normal_termios = *tty->termios; info->normal_termios = *tty->termios;
if(info->asyncflags & ASYNC_CALLOUT_ACTIVE)
info->callout_termios = *tty->termios;
tty->closing = 1; tty->closing = 1;
if(info->asyncflags & ASYNC_INITIALIZED) { if(info->asyncflags & ASYNC_INITIALIZED) {
setup_empty_event(tty,info); setup_empty_event(tty,info);
...@@ -644,8 +603,7 @@ static void pcxe_close(struct tty_struct * tty, struct file * filp) ...@@ -644,8 +603,7 @@ static void pcxe_close(struct tty_struct * tty, struct file * filp)
} }
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} }
info->asyncflags &= ~(ASYNC_NORMAL_ACTIVE| info->asyncflags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
ASYNC_CALLOUT_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
restore_flags(flags); restore_flags(flags);
} }
...@@ -665,7 +623,7 @@ void pcxe_hangup(struct tty_struct *tty) ...@@ -665,7 +623,7 @@ void pcxe_hangup(struct tty_struct *tty)
ch->event = 0; ch->event = 0;
ch->count = 0; ch->count = 0;
ch->tty = NULL; ch->tty = NULL;
ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE;
wake_up_interruptible(&ch->open_wait); wake_up_interruptible(&ch->open_wait);
restore_flags(flags); restore_flags(flags);
} }
...@@ -1257,12 +1215,6 @@ int __init pcxe_init(void) ...@@ -1257,12 +1215,6 @@ int __init pcxe_init(void)
pcxe_driver.start = pcxe_start; pcxe_driver.start = pcxe_start;
pcxe_driver.hangup = pcxe_hangup; pcxe_driver.hangup = pcxe_hangup;
pcxe_callout = pcxe_driver;
pcxe_callout.name = "cud";
pcxe_callout.major = DIGICU_MAJOR;
pcxe_callout.subtype = SERIAL_TYPE_CALLOUT;
pcxe_callout.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
for(crd=0; crd < numcards; crd++) { for(crd=0; crd < numcards; crd++) {
bd = &boards[crd]; bd = &boards[crd];
outb(FEPRST, bd->port); outb(FEPRST, bd->port);
...@@ -1619,7 +1571,6 @@ int __init pcxe_init(void) ...@@ -1619,7 +1571,6 @@ int __init pcxe_init(void)
ch->close_delay = 50; ch->close_delay = 50;
ch->count = 0; ch->count = 0;
ch->blocked_open = 0; ch->blocked_open = 0;
ch->callout_termios = pcxe_callout.init_termios;
ch->normal_termios = pcxe_driver.init_termios; ch->normal_termios = pcxe_driver.init_termios;
init_waitqueue_head(&ch->open_wait); init_waitqueue_head(&ch->open_wait);
init_waitqueue_head(&ch->close_wait); init_waitqueue_head(&ch->close_wait);
...@@ -1651,12 +1602,6 @@ int __init pcxe_init(void) ...@@ -1651,12 +1602,6 @@ int __init pcxe_init(void)
goto cleanup_boards; goto cleanup_boards;
} }
ret = tty_register_driver(&pcxe_callout);
if(ret) {
printk(KERN_ERR "Couldn't register PC/Xe callout\n");
goto cleanup_pcxe_driver;
}
/* /*
* Start up the poller to check for events on all enabled boards * Start up the poller to check for events on all enabled boards
*/ */
...@@ -1760,7 +1705,7 @@ static void doevent(int crd) ...@@ -1760,7 +1705,7 @@ static void doevent(int crd)
if (event & MODEMCHG_IND) { if (event & MODEMCHG_IND) {
ch->imodem = mstat; ch->imodem = mstat;
if (ch->asyncflags & (ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE)) { if (ch->asyncflags & ASYNC_NORMAL_ACTIVE) {
if (ch->asyncflags & ASYNC_CHECK_CD) { if (ch->asyncflags & ASYNC_CHECK_CD) {
if (mstat & ch->dcd) { if (mstat & ch->dcd) {
wake_up_interruptible(&ch->open_wait); wake_up_interruptible(&ch->open_wait);
...@@ -2377,7 +2322,7 @@ static void do_softint(void *private_) ...@@ -2377,7 +2322,7 @@ static void do_softint(void *private_)
if(test_and_clear_bit(PCXE_EVENT_HANGUP, &info->event)) { if(test_and_clear_bit(PCXE_EVENT_HANGUP, &info->event)) {
tty_hangup(tty); tty_hangup(tty);
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
info->asyncflags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); info->asyncflags &= ~ASYNC_NORMAL_ACTIVE;
} }
} }
} }
......
...@@ -68,7 +68,6 @@ struct board_info { ...@@ -68,7 +68,6 @@ struct board_info {
#define FEPTIMEOUT 200000 #define FEPTIMEOUT 200000
#define SERIAL_TYPE_NORMAL 1 #define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_CALLOUT 2
#define PCXE_EVENT_HANGUP 1 #define PCXE_EVENT_HANGUP 1
#define PCXX_MAGIC 0x5c6df104L #define PCXX_MAGIC 0x5c6df104L
...@@ -78,8 +77,6 @@ struct channel { ...@@ -78,8 +77,6 @@ struct channel {
unchar boardnum; unchar boardnum;
unchar channelnum; unchar channelnum;
uint dev; uint dev;
long session;
long pgrp;
struct tty_struct *tty; struct tty_struct *tty;
struct board_info *board; struct board_info *board;
volatile struct board_chan *brdchan; volatile struct board_chan *brdchan;
...@@ -127,7 +124,6 @@ struct channel { ...@@ -127,7 +124,6 @@ struct channel {
ulong c_lflag; ulong c_lflag;
ulong c_oflag; ulong c_oflag;
struct termios normal_termios; struct termios normal_termios;
struct termios callout_termios;
struct digi_struct digiext; struct digi_struct digiext;
ulong dummy[8]; ulong dummy[8];
}; };
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