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

[PATCH] callout removal: mips

callout removal: mips
parent 5c00e9af
......@@ -126,7 +126,7 @@ static char *serial_name = "Serial driver";
static DECLARE_TASK_QUEUE(tq_serial);
static struct tty_driver serial_driver, callout_driver;
static struct tty_driver serial_driver;
static int serial_refcount;
static struct timer_list serial_timer;
......@@ -136,7 +136,6 @@ extern unsigned long get_au1000_uart_baud(void);
/* serial subtype definitions */
#ifndef SERIAL_TYPE_NORMAL
#define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_CALLOUT 2
#endif
/* number of characters left in xmit buffer before we ask for more */
......@@ -529,8 +528,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info)
#endif
if (status & UART_MSR_DCD)
wake_up_interruptible(&info->open_wait);
else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ASYNC_CALLOUT_NOHUP))) {
else {
#ifdef SERIAL_DEBUG_OPEN
printk("doing serial hangup...");
#endif
......@@ -1935,8 +1933,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
*/
if (info->flags & ASYNC_NORMAL_ACTIVE)
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
* the line discipline to only process XON/XOFF characters.
......@@ -1976,8 +1972,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
}
wake_up_interruptible(&info->open_wait);
}
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|
ASYNC_CLOSING);
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait);
MOD_DEC_USE_COUNT;
}
......@@ -2066,7 +2061,7 @@ static void rs_hangup(struct tty_struct *tty)
shutdown(info);
info->event = 0;
state->count = 0;
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
info->flags &= ~ASYNC_NORMAL_ACTIVE;
info->tty = 0;
wake_up_interruptible(&info->open_wait);
}
......@@ -2101,45 +2096,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
#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,
* then make the check up front and then exit.
*/
if ((filp->f_flags & O_NONBLOCK) ||
(tty->flags & (1 << TTY_IO_ERROR))) {
if (info->flags & ASYNC_CALLOUT_ACTIVE)
return -EBUSY;
info->flags |= ASYNC_NORMAL_ACTIVE;
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)
do_clocal = 1;
}
if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;
/*
* Block waiting for the carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
......@@ -2162,8 +2131,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
info->blocked_open++;
while (1) {
save_flags(flags); cli();
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
(tty->termios->c_cflag & CBAUD))
if (tty->termios->c_cflag & CBAUD)
serial_out(info, UART_MCR,
serial_inp(info, UART_MCR) |
(UART_MCR_DTR | UART_MCR_RTS));
......@@ -2181,8 +2149,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
#endif
break;
}
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
!(info->flags & ASYNC_CLOSING) &&
if (!(info->flags & ASYNC_CLOSING) &&
(do_clocal || (serial_in(info, UART_MSR) &
UART_MSR_DCD)))
break;
......@@ -2335,10 +2302,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
if ((info->state->count == 1) &&
(info->flags & ASYNC_SPLIT_TERMIOS)) {
if (tty->driver->subtype == SERIAL_TYPE_NORMAL)
*tty->termios = info->state->normal_termios;
else
*tty->termios = info->state->callout_termios;
*tty->termios = info->state->normal_termios;
change_speed(info, 0);
}
#ifdef CONFIG_AU1000_SERIAL_CONSOLE
......@@ -2348,8 +2312,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
change_speed(info, 0);
}
#endif
info->session = current->session;
info->pgrp = current->pgrp;
#ifdef SERIAL_DEBUG_OPEN
printk("rs_open %s successful...", tty->name);
......@@ -2626,26 +2588,9 @@ static int __init rs_init(void)
serial_driver.wait_until_sent = rs_wait_until_sent;
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;
#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;
callout_driver.read_proc = 0;
callout_driver.proc_entry = 0;
if (tty_register_driver(&serial_driver))
panic("Couldn't register serial driver\n");
if (tty_register_driver(&callout_driver))
panic("Couldn't register callout driver\n");
for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) {
state->baud_base = get_au1000_uart_baud();
state->magic = SSTATE_MAGIC;
......@@ -2654,7 +2599,6 @@ static int __init rs_init(void)
state->custom_divisor = 0;
state->close_delay = 5*HZ/10;
state->closing_wait = 30*HZ;
state->callout_termios = callout_driver.init_termios;
state->normal_termios = serial_driver.init_termios;
state->icount.cts = state->icount.dsr =
state->icount.rng = state->icount.dcd = 0;
......@@ -2682,7 +2626,6 @@ static int __init rs_init(void)
state->port, state->irq,
uart_config[state->type].name);
tty_register_device(&serial_driver, state->line, NULL);
tty_register_device(&callout_driver, state->line, NULL);
}
return 0;
}
......@@ -2770,7 +2713,6 @@ int register_serial(struct serial_struct *req)
state->iomem_base ? (unsigned long)state->iomem_base :
state->port, state->irq, uart_config[state->type].name);
tty_register_device(&serial_driver, state->line, NULL);
tty_register_device(&callout_driver, state->line, NULL);
return state->line + SERIAL_DEV_OFFSET;
}
......@@ -2815,9 +2757,6 @@ static void __exit rs_fini(void)
if ((e1 = tty_unregister_driver(&serial_driver)))
printk("serial: failed to unregister serial driver (%d)\n",
e1);
if ((e2 = tty_unregister_driver(&callout_driver)))
printk("serial: failed to unregister callout driver (%d)\n",
e2);
restore_flags(flags);
for (i = 0; i < NR_PORTS; i++) {
......
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