Commit 9ef4b4f9 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: amiserial

callout removal: amiserial
parent 6be5e2cb
...@@ -102,13 +102,12 @@ static char *serial_version = "4.30"; ...@@ -102,13 +102,12 @@ static char *serial_version = "4.30";
static char *serial_name = "Amiga-builtin serial driver"; static char *serial_name = "Amiga-builtin serial driver";
static struct tty_driver serial_driver, callout_driver; static struct tty_driver serial_driver;
static int serial_refcount; static int serial_refcount;
/* serial subtype definitions */ /* serial subtype definitions */
#ifndef SERIAL_TYPE_NORMAL #ifndef SERIAL_TYPE_NORMAL
#define SERIAL_TYPE_NORMAL 1 #define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_CALLOUT 2
#endif #endif
/* number of characters left in xmit buffer before we ask for more */ /* number of characters left in xmit buffer before we ask for more */
...@@ -448,8 +447,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info) ...@@ -448,8 +447,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info)
#endif #endif
if (!(status & SER_DCD)) if (!(status & SER_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))) {
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk("doing serial hangup..."); printk("doing serial hangup...");
#endif #endif
...@@ -1567,8 +1565,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1567,8 +1565,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
*/ */
if (info->flags & ASYNC_NORMAL_ACTIVE) if (info->flags & ASYNC_NORMAL_ACTIVE)
info->state->normal_termios = *tty->termios; info->state->normal_termios = *tty->termios;
if (info->flags & ASYNC_CALLOUT_ACTIVE)
info->state->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.
...@@ -1613,8 +1609,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1613,8 +1609,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 &= ~(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);
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -1698,7 +1693,7 @@ static void rs_hangup(struct tty_struct *tty) ...@@ -1698,7 +1693,7 @@ static void rs_hangup(struct tty_struct *tty)
shutdown(info); shutdown(info);
info->event = 0; info->event = 0;
state->count = 0; state->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);
} }
...@@ -1737,44 +1732,18 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1737,44 +1732,18 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
#endif #endif
} }
/*
* If this is a callout device, then just make sure the normal
* device isn't being used.
*/
if (tty->driver->subtype == SERIAL_TYPE_CALLOUT) {
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 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 (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 (state->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
...@@ -1798,8 +1767,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1798,8 +1767,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
info->blocked_open++; info->blocked_open++;
while (1) { while (1) {
local_irq_save(flags); local_irq_save(flags);
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && if (tty->termios->c_cflag & CBAUD)
(tty->termios->c_cflag & CBAUD))
rtsdtr_ctrl(SER_DTR|SER_RTS); rtsdtr_ctrl(SER_DTR|SER_RTS);
local_irq_restore(flags); local_irq_restore(flags);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
...@@ -1815,8 +1783,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -1815,8 +1783,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
#endif #endif
break; break;
} }
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && if (!(info->flags & ASYNC_CLOSING) &&
!(info->flags & ASYNC_CLOSING) &&
(do_clocal || (!(ciab.pra & SER_DCD)) )) (do_clocal || (!(ciab.pra & SER_DCD)) ))
break; break;
if (signal_pending(current)) { if (signal_pending(current)) {
...@@ -1957,14 +1924,9 @@ static int rs_open(struct tty_struct *tty, struct file * filp) ...@@ -1957,14 +1924,9 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
if ((info->state->count == 1) && if ((info->state->count == 1) &&
(info->flags & ASYNC_SPLIT_TERMIOS)) { (info->flags & ASYNC_SPLIT_TERMIOS)) {
if (tty->driver->subtype == SERIAL_TYPE_NORMAL)
*tty->termios = info->state->normal_termios; *tty->termios = info->state->normal_termios;
else
*tty->termios = info->state->callout_termios;
change_speed(info, 0); change_speed(info, 0);
} }
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);
...@@ -2150,21 +2112,8 @@ static int __init rs_init(void) ...@@ -2150,21 +2112,8 @@ static int __init rs_init(void)
serial_driver.wait_until_sent = rs_wait_until_sent; serial_driver.wait_until_sent = rs_wait_until_sent;
serial_driver.read_proc = rs_read_proc; serial_driver.read_proc = rs_read_proc;
/*
* The callout device is just like normal device except for
* major number and the subtype code.
*/
callout_driver = serial_driver;
callout_driver.name = "cua";
callout_driver.major = TTYAUX_MAJOR;
callout_driver.subtype = SERIAL_TYPE_CALLOUT;
callout_driver.read_proc = 0;
callout_driver.proc_entry = 0;
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");
state = rs_table; state = rs_table;
state->magic = SSTATE_MAGIC; state->magic = SSTATE_MAGIC;
...@@ -2173,7 +2122,6 @@ static int __init rs_init(void) ...@@ -2173,7 +2122,6 @@ static int __init rs_init(void)
state->custom_divisor = 0; state->custom_divisor = 0;
state->close_delay = 5*HZ/10; state->close_delay = 5*HZ/10;
state->closing_wait = 30*HZ; state->closing_wait = 30*HZ;
state->callout_termios = callout_driver.init_termios;
state->normal_termios = serial_driver.init_termios; state->normal_termios = serial_driver.init_termios;
state->icount.cts = state->icount.dsr = state->icount.cts = state->icount.dsr =
state->icount.rng = state->icount.dcd = 0; state->icount.rng = state->icount.dcd = 0;
...@@ -2229,9 +2177,6 @@ static __exit void rs_exit(void) ...@@ -2229,9 +2177,6 @@ static __exit void rs_exit(void)
if ((e1 = tty_unregister_driver(&serial_driver))) if ((e1 = tty_unregister_driver(&serial_driver)))
printk("SERIAL: failed to unregister serial driver (%d)\n", printk("SERIAL: failed to unregister serial driver (%d)\n",
e1); e1);
if ((e2 = tty_unregister_driver(&callout_driver)))
printk("SERIAL: failed to unregister callout driver (%d)\n",
e2);
if (info) { if (info) {
rs_table[0].info = NULL; rs_table[0].info = NULL;
......
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