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

[PATCH] callout removal: tc_zs

callout removal: tc_zs
parent 392c3148
...@@ -180,12 +180,11 @@ static unsigned char zs_init_regs[16] __initdata = { ...@@ -180,12 +180,11 @@ static unsigned char zs_init_regs[16] __initdata = {
DECLARE_TASK_QUEUE(tq_zs_serial); DECLARE_TASK_QUEUE(tq_zs_serial);
struct tty_driver serial_driver, callout_driver; struct tty_driver serial_driver;
static int serial_refcount; static int serial_refcount;
/* serial subtype definitions */ /* serial subtype definitions */
#define SERIAL_TYPE_NORMAL 1 #define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_CALLOUT 2
/* number of characters left in xmit buffer before we ask for more */ /* number of characters left in xmit buffer before we ask for more */
#define WAKEUP_CHARS 256 #define WAKEUP_CHARS 256
...@@ -526,7 +525,7 @@ static _INLINE_ void status_handle(struct dec_serial *info) ...@@ -526,7 +525,7 @@ static _INLINE_ void status_handle(struct dec_serial *info)
&& info->tty && !C_CLOCAL(info->tty)) { && info->tty && !C_CLOCAL(info->tty)) {
if (stat & DCD) { if (stat & DCD) {
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} else if (!(info->flags & ZILOG_CALLOUT_ACTIVE)) { } else {
tty_hangup(info->tty); tty_hangup(info->tty);
} }
} }
...@@ -1397,8 +1396,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1397,8 +1396,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
*/ */
if (info->flags & ZILOG_NORMAL_ACTIVE) if (info->flags & ZILOG_NORMAL_ACTIVE)
info->normal_termios = *tty->termios; info->normal_termios = *tty->termios;
if (info->flags & ZILOG_CALLOUT_ACTIVE)
info->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.
...@@ -1438,8 +1435,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1438,8 +1435,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
} }
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} }
info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CALLOUT_ACTIVE| info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CLOSING);
ZILOG_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
restore_flags(flags); restore_flags(flags);
} }
...@@ -1492,7 +1488,7 @@ void rs_hangup(struct tty_struct *tty) ...@@ -1492,7 +1488,7 @@ void rs_hangup(struct tty_struct *tty)
shutdown(info); shutdown(info);
info->event = 0; info->event = 0;
info->count = 0; info->count = 0;
info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CALLOUT_ACTIVE); info->flags &= ~ZILOG_NORMAL_ACTIVE;
info->tty = 0; info->tty = 0;
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} }
...@@ -1527,20 +1523,6 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1527,20 +1523,6 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
* If this is a callout device, then just make sure the normal * If this is a callout device, then just make sure the normal
* device isn't being used. * device isn't being used.
*/ */
if (tty->driver->subtype == SERIAL_TYPE_CALLOUT) {
if (info->flags & ZILOG_NORMAL_ACTIVE)
return -EBUSY;
if ((info->flags & ZILOG_CALLOUT_ACTIVE) &&
(info->flags & ZILOG_SESSION_LOCKOUT) &&
(info->session != current->session))
return -EBUSY;
if ((info->flags & ZILOG_CALLOUT_ACTIVE) &&
(info->flags & ZILOG_PGRP_LOCKOUT) &&
(info->pgrp != current->pgrp))
return -EBUSY;
info->flags |= ZILOG_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,
...@@ -1548,19 +1530,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1548,19 +1530,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
*/ */
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 (info->flags & ZILOG_CALLOUT_ACTIVE)
return -EBUSY;
info->flags |= ZILOG_NORMAL_ACTIVE; info->flags |= ZILOG_NORMAL_ACTIVE;
return 0; return 0;
} }
if (info->flags & ZILOG_CALLOUT_ACTIVE) {
if (info->normal_termios.c_cflag & CLOCAL)
do_clocal = 1;
} else {
if (tty->termios->c_cflag & CLOCAL) if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1; 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
...@@ -1582,8 +1557,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1582,8 +1557,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
info->blocked_open++; info->blocked_open++;
while (1) { while (1) {
cli(); cli();
if (!(info->flags & ZILOG_CALLOUT_ACTIVE) && if (tty->termios->c_cflag & CBAUD)
(tty->termios->c_cflag & CBAUD))
zs_rtsdtr(info, RTS | DTR, 1); zs_rtsdtr(info, RTS | DTR, 1);
sti(); sti();
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
...@@ -1599,8 +1573,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1599,8 +1573,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
#endif #endif
break; break;
} }
if (!(info->flags & ZILOG_CALLOUT_ACTIVE) && if (!(info->flags & ZILOG_CLOSING) &&
!(info->flags & ZILOG_CLOSING) &&
(do_clocal || (read_zsreg(info->zs_channel, 0) & DCD))) (do_clocal || (read_zsreg(info->zs_channel, 0) & DCD)))
break; break;
if (signal_pending(current)) { if (signal_pending(current)) {
...@@ -1689,10 +1662,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) ...@@ -1689,10 +1662,7 @@ int rs_open(struct tty_struct *tty, struct file * filp)
} }
if ((info->count == 1) && (info->flags & ZILOG_SPLIT_TERMIOS)) { if ((info->count == 1) && (info->flags & ZILOG_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;
change_speed(info); change_speed(info);
} }
#ifdef CONFIG_SERIAL_CONSOLE #ifdef CONFIG_SERIAL_CONSOLE
...@@ -1703,9 +1673,6 @@ int rs_open(struct tty_struct *tty, struct file * filp) ...@@ -1703,9 +1673,6 @@ int rs_open(struct tty_struct *tty, struct file * filp)
} }
#endif #endif
info->session = current->session;
info->pgrp = current->pgrp;
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk("rs_open %s successful...", tty->name); printk("rs_open %s successful...", tty->name);
#endif #endif
...@@ -1910,23 +1877,8 @@ int __init zs_init(void) ...@@ -1910,23 +1877,8 @@ int __init zs_init(void)
serial_driver.break_ctl = rs_break; serial_driver.break_ctl = rs_break;
serial_driver.wait_until_sent = rs_wait_until_sent; serial_driver.wait_until_sent = rs_wait_until_sent;
/*
* The callout device is just like normal device except for
* major number and the subtype code.
*/
callout_driver = serial_driver;
#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
callout_driver.name = "cua/";
#else
callout_driver.name = "cua";
#endif
callout_driver.major = TTYAUX_MAJOR;
callout_driver.subtype = SERIAL_TYPE_CALLOUT;
if (tty_register_driver(&serial_driver)) if (tty_register_driver(&serial_driver))
panic("Couldn't register serial driver\n"); panic("Couldn't register serial driver\n");
if (tty_register_driver(&callout_driver))
panic("Couldn't register callout driver\n");
save_flags(flags); cli(); save_flags(flags); cli();
...@@ -1964,7 +1916,6 @@ int __init zs_init(void) ...@@ -1964,7 +1916,6 @@ int __init zs_init(void)
info->blocked_open = 0; info->blocked_open = 0;
info->tqueue.routine = do_softint; info->tqueue.routine = do_softint;
info->tqueue.data = info; info->tqueue.data = info;
info->callout_termios = callout_driver.init_termios;
info->normal_termios = serial_driver.init_termios; info->normal_termios = serial_driver.init_termios;
init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->close_wait);
...@@ -1972,8 +1923,6 @@ int __init zs_init(void) ...@@ -1972,8 +1923,6 @@ int __init zs_init(void)
info->port, info->irq); info->port, info->irq);
printk(" is a Z85C30 SCC\n"); printk(" is a Z85C30 SCC\n");
tty_register_device(&serial_driver, info->line, NULL); tty_register_device(&serial_driver, info->line, NULL);
tty_register_device(&callout_driver, info->line, NULL);
} }
restore_flags(flags); restore_flags(flags);
......
...@@ -144,8 +144,6 @@ struct dec_serial { ...@@ -144,8 +144,6 @@ struct dec_serial {
int line; int line;
int count; /* # of fd on device */ int count; /* # of fd on device */
int blocked_open; /* # of blocked opens */ int blocked_open; /* # of blocked opens */
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
unsigned char *xmit_buf; unsigned char *xmit_buf;
int xmit_head; int xmit_head;
int xmit_tail; int xmit_tail;
...@@ -153,7 +151,6 @@ struct dec_serial { ...@@ -153,7 +151,6 @@ struct dec_serial {
struct tq_struct tqueue; struct tq_struct tqueue;
struct tq_struct tqueue_hangup; struct tq_struct tqueue_hangup;
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;
}; };
......
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