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

[PATCH] callout removal: riscom8

callout removal: riscom8
parent 7f56f3bc
...@@ -84,10 +84,9 @@ ...@@ -84,10 +84,9 @@
static DECLARE_TASK_QUEUE(tq_riscom); static DECLARE_TASK_QUEUE(tq_riscom);
#define RISCOM_TYPE_NORMAL 1 #define RISCOM_TYPE_NORMAL 1
#define RISCOM_TYPE_CALLOUT 2
static struct riscom_board * IRQ_to_board[16]; static struct riscom_board * IRQ_to_board[16];
static struct tty_driver riscom_driver, riscom_callout_driver; static struct tty_driver riscom_driver;
static int riscom_refcount; static int riscom_refcount;
static struct tty_struct * riscom_table[RC_NBOARD * RC_NPORT]; static struct tty_struct * riscom_table[RC_NBOARD * RC_NPORT];
static struct termios * riscom_termios[RC_NBOARD * RC_NPORT]; static struct termios * riscom_termios[RC_NBOARD * RC_NPORT];
...@@ -550,10 +549,8 @@ static inline void rc_check_modem(struct riscom_board const * bp) ...@@ -550,10 +549,8 @@ static inline void rc_check_modem(struct riscom_board const * bp)
if (mcr & MCR_CDCHG) { if (mcr & MCR_CDCHG) {
if (rc_in(bp, CD180_MSVR) & MSVR_CD) if (rc_in(bp, CD180_MSVR) & MSVR_CD)
wake_up_interruptible(&port->open_wait); wake_up_interruptible(&port->open_wait);
else if (!((port->flags & ASYNC_CALLOUT_ACTIVE) && else
(port->flags & ASYNC_CALLOUT_NOHUP))) {
schedule_task(&port->tqueue_hangup); schedule_task(&port->tqueue_hangup);
}
} }
#ifdef RISCOM_BRAIN_DAMAGED_CTS #ifdef RISCOM_BRAIN_DAMAGED_CTS
...@@ -985,45 +982,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -985,45 +982,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
return -ERESTARTSYS; return -ERESTARTSYS;
} }
/*
* If this is a callout device, then just make sure the normal
* device isn't being used.
*/
if (tty->driver->subtype == RISCOM_TYPE_CALLOUT) {
if (port->flags & ASYNC_NORMAL_ACTIVE)
return -EBUSY;
if ((port->flags & ASYNC_CALLOUT_ACTIVE) &&
(port->flags & ASYNC_SESSION_LOCKOUT) &&
(port->session != current->session))
return -EBUSY;
if ((port->flags & ASYNC_CALLOUT_ACTIVE) &&
(port->flags & ASYNC_PGRP_LOCKOUT) &&
(port->pgrp != current->pgrp))
return -EBUSY;
port->flags |= ASYNC_CALLOUT_ACTIVE;
return 0;
}
/* /*
* If non-blocking mode is set, or the port is not enabled, * If non-blocking mode is set, or the port is not enabled,
* then make the check up front and then exit. * then make the check up front and then exit.
*/ */
if ((filp->f_flags & O_NONBLOCK) || if ((filp->f_flags & O_NONBLOCK) ||
(tty->flags & (1 << TTY_IO_ERROR))) { (tty->flags & (1 << TTY_IO_ERROR))) {
if (port->flags & ASYNC_CALLOUT_ACTIVE)
return -EBUSY;
port->flags |= ASYNC_NORMAL_ACTIVE; port->flags |= ASYNC_NORMAL_ACTIVE;
return 0; return 0;
} }
if (port->flags & ASYNC_CALLOUT_ACTIVE) { if (C_CLOCAL(tty))
if (port->normal_termios.c_cflag & CLOCAL) do_clocal = 1;
do_clocal = 1;
} else {
if (C_CLOCAL(tty))
do_clocal = 1;
}
/* /*
* Block waiting for the carrier detect and the line to become * Block waiting for the 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
...@@ -1042,11 +1013,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1042,11 +1013,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
cli(); cli();
rc_out(bp, CD180_CAR, port_No(port)); rc_out(bp, CD180_CAR, port_No(port));
CD = rc_in(bp, CD180_MSVR) & MSVR_CD; CD = rc_in(bp, CD180_MSVR) & MSVR_CD;
if (!(port->flags & ASYNC_CALLOUT_ACTIVE)) { rc_out(bp, CD180_MSVR, MSVR_RTS);
rc_out(bp, CD180_MSVR, MSVR_RTS); bp->DTR &= ~(1u << port_No(port));
bp->DTR &= ~(1u << port_No(port)); rc_out(bp, RC_DTR, bp->DTR);
rc_out(bp, RC_DTR, bp->DTR);
}
sti(); sti();
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) || if (tty_hung_up_p(filp) ||
...@@ -1057,8 +1026,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1057,8 +1026,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
retval = -ERESTARTSYS; retval = -ERESTARTSYS;
break; break;
} }
if (!(port->flags & ASYNC_CALLOUT_ACTIVE) && if (!(port->flags & ASYNC_CLOSING) &&
!(port->flags & ASYNC_CLOSING) &&
(do_clocal || CD)) (do_clocal || CD))
break; break;
if (signal_pending(current)) { if (signal_pending(current)) {
...@@ -1110,18 +1078,11 @@ static int rc_open(struct tty_struct * tty, struct file * filp) ...@@ -1110,18 +1078,11 @@ static int rc_open(struct tty_struct * tty, struct file * filp)
return error; return error;
if ((port->count == 1) && (port->flags & ASYNC_SPLIT_TERMIOS)) { if ((port->count == 1) && (port->flags & ASYNC_SPLIT_TERMIOS)) {
if (tty->driver->subtype == RISCOM_TYPE_NORMAL) *tty->termios = port->normal_termios;
*tty->termios = port->normal_termios;
else
*tty->termios = port->callout_termios;
save_flags(flags); cli(); save_flags(flags); cli();
rc_change_speed(bp, port); rc_change_speed(bp, port);
restore_flags(flags); restore_flags(flags);
} }
port->session = current->session;
port->pgrp = current->pgrp;
return 0; return 0;
} }
...@@ -1161,8 +1122,6 @@ static void rc_close(struct tty_struct * tty, struct file * filp) ...@@ -1161,8 +1122,6 @@ static void rc_close(struct tty_struct * tty, struct file * filp)
*/ */
if (port->flags & ASYNC_NORMAL_ACTIVE) if (port->flags & ASYNC_NORMAL_ACTIVE)
port->normal_termios = *tty->termios; port->normal_termios = *tty->termios;
if (port->flags & ASYNC_CALLOUT_ACTIVE)
port->callout_termios = *tty->termios;
/* /*
* Now we wait for the transmit buffer to clear; and we notify * Now we wait for the transmit buffer to clear; and we notify
* the line discipline to only process XON/XOFF characters. * the line discipline to only process XON/XOFF characters.
...@@ -1210,8 +1169,7 @@ static void rc_close(struct tty_struct * tty, struct file * filp) ...@@ -1210,8 +1169,7 @@ static void rc_close(struct tty_struct * tty, struct file * filp)
} }
wake_up_interruptible(&port->open_wait); wake_up_interruptible(&port->open_wait);
} }
port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE| port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
ASYNC_CLOSING);
wake_up_interruptible(&port->close_wait); wake_up_interruptible(&port->close_wait);
out: restore_flags(flags); out: restore_flags(flags);
} }
...@@ -1689,7 +1647,7 @@ static void rc_hangup(struct tty_struct * tty) ...@@ -1689,7 +1647,7 @@ static void rc_hangup(struct tty_struct * tty)
rc_shutdown_port(bp, port); rc_shutdown_port(bp, port);
port->event = 0; port->event = 0;
port->count = 0; port->count = 0;
port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); port->flags &= ~ASYNC_NORMAL_ACTIVE;
port->tty = 0; port->tty = 0;
wake_up_interruptible(&port->open_wait); wake_up_interruptible(&port->open_wait);
} }
...@@ -1783,11 +1741,6 @@ static inline int rc_init_drivers(void) ...@@ -1783,11 +1741,6 @@ static inline int rc_init_drivers(void)
riscom_driver.start = rc_start; riscom_driver.start = rc_start;
riscom_driver.hangup = rc_hangup; riscom_driver.hangup = rc_hangup;
riscom_callout_driver = riscom_driver;
riscom_callout_driver.name = "cul";
riscom_callout_driver.major = RISCOM8_CALLOUT_MAJOR;
riscom_callout_driver.subtype = RISCOM_TYPE_CALLOUT;
if ((error = tty_register_driver(&riscom_driver))) { if ((error = tty_register_driver(&riscom_driver))) {
free_page((unsigned long)tmp_buf); free_page((unsigned long)tmp_buf);
printk(KERN_ERR "rc: Couldn't register RISCom/8 driver, " printk(KERN_ERR "rc: Couldn't register RISCom/8 driver, "
...@@ -1795,18 +1748,9 @@ static inline int rc_init_drivers(void) ...@@ -1795,18 +1748,9 @@ static inline int rc_init_drivers(void)
error); error);
return 1; return 1;
} }
if ((error = tty_register_driver(&riscom_callout_driver))) {
free_page((unsigned long)tmp_buf);
tty_unregister_driver(&riscom_driver);
printk(KERN_ERR "rc: Couldn't register RISCom/8 callout "
"driver, error = %d\n",
error);
return 1;
}
memset(rc_port, 0, sizeof(rc_port)); memset(rc_port, 0, sizeof(rc_port));
for (i = 0; i < RC_NPORT * RC_NBOARD; i++) { for (i = 0; i < RC_NPORT * RC_NBOARD; i++) {
rc_port[i].callout_termios = riscom_callout_driver.init_termios;
rc_port[i].normal_termios = riscom_driver.init_termios; rc_port[i].normal_termios = riscom_driver.init_termios;
rc_port[i].magic = RISCOM8_MAGIC; rc_port[i].magic = RISCOM8_MAGIC;
rc_port[i].tqueue.routine = do_softint; rc_port[i].tqueue.routine = do_softint;
...@@ -1831,7 +1775,6 @@ static void rc_release_drivers(void) ...@@ -1831,7 +1775,6 @@ static void rc_release_drivers(void)
remove_bh(RISCOM8_BH); remove_bh(RISCOM8_BH);
free_page((unsigned long)tmp_buf); free_page((unsigned long)tmp_buf);
tty_unregister_driver(&riscom_driver); tty_unregister_driver(&riscom_driver);
tty_unregister_driver(&riscom_callout_driver);
restore_flags(flags); restore_flags(flags);
} }
......
...@@ -74,15 +74,12 @@ struct riscom_port { ...@@ -74,15 +74,12 @@ struct riscom_port {
long event; /* long req'd for set_bit --RR */ long event; /* long req'd for set_bit --RR */
int timeout; int timeout;
int close_delay; int close_delay;
long session;
long pgrp;
unsigned char * xmit_buf; unsigned char * xmit_buf;
int custom_divisor; int custom_divisor;
int xmit_head; int xmit_head;
int xmit_tail; int xmit_tail;
int xmit_cnt; int xmit_cnt;
struct termios normal_termios; struct termios normal_termios;
struct termios callout_termios;
wait_queue_head_t open_wait; wait_queue_head_t open_wait;
wait_queue_head_t close_wait; wait_queue_head_t close_wait;
struct tq_struct tqueue; struct tq_struct tqueue;
......
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