summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 14:52:46 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 12:50:01 -0800
commitf1166604f58e842a0bb5a639d6728ce6e2250495 (patch)
treeda7421946576b7071b5ef9df8095efd338f1d68e /drivers/tty
parent6fe18d26b1c33d5cb748f8694ee1a59dc5578da4 (diff)
downloadblackbird-op-linux-f1166604f58e842a0bb5a639d6728ce6e2250495.tar.gz
blackbird-op-linux-f1166604f58e842a0bb5a639d6728ce6e2250495.zip
TTY: amiserial, provide carrier helpers
This is a preparation for a switch to tty_port_block_til_ready. We need amiga_carrier_raised and amiga_dtr_rts. The implementation is taken from startup, shutdown and current block_til_ready. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/amiserial.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 613d6a3908d3..61d74613bd4d 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1623,10 +1623,8 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
local_irq_restore(flags);
port->blocked_open++;
while (1) {
- local_irq_save(flags);
if (tty->termios->c_cflag & CBAUD)
- rtsdtr_ctrl(SER_DTR|SER_RTS);
- local_irq_restore(flags);
+ tty_port_raise_dtr_rts(port);
set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) ||
!(port->flags & ASYNC_INITIALIZED)) {
@@ -1641,7 +1639,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
break;
}
if (!(port->flags & ASYNC_CLOSING) &&
- (do_clocal || (!(ciab.pra & SER_DCD)) ))
+ (do_clocal || tty_port_carrier_raised(port)))
break;
if (signal_pending(current)) {
retval = -ERESTARTSYS;
@@ -1849,6 +1847,32 @@ static const struct tty_operations serial_ops = {
.proc_fops = &rs_proc_fops,
};
+static int amiga_carrier_raised(struct tty_port *port)
+{
+ return !(ciab.pra & SER_DCD);
+}
+
+static void amiga_dtr_rts(struct tty_port *port, int raise)
+{
+ struct serial_state *info = container_of(port, struct serial_state,
+ tport);
+ unsigned long flags;
+
+ if (raise)
+ info->MCR |= SER_DTR|SER_RTS;
+ else
+ info->MCR &= ~(SER_DTR|SER_RTS);
+
+ local_irq_save(flags);
+ rtsdtr_ctrl(info->MCR);
+ local_irq_restore(flags);
+}
+
+static const struct tty_port_operations amiga_port_ops = {
+ .carrier_raised = amiga_carrier_raised,
+ .dtr_rts = amiga_dtr_rts,
+};
+
/*
* The serial driver boot-time initialization code!
*/
@@ -1891,6 +1915,7 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
state->icount.frame = state->icount.parity = 0;
state->icount.overrun = state->icount.brk = 0;
tty_port_init(&state->tport);
+ state->tport.ops = &amiga_port_ops;
printk(KERN_INFO "ttyS0 is the amiga builtin serial port\n");
OpenPOWER on IntegriCloud