]> Pileus Git - ~andy/linux/commitdiff
tty/hvc_console: Add DTR/RTS callback to handle HUPCL control
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Tue, 2 Jul 2013 15:07:14 +0000 (17:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jul 2013 22:21:13 +0000 (15:21 -0700)
Introduce a new callback to explicitly handle the HUPCL termios control flag.
This prepares for a follow-up commit for the hvc_iucv device driver to
improve handling when to drop an established network connection.

The callback naming is based on the recently added tty_port interface to
facilitate a potential refactoring of the hvc_console to use tty_port
functions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/hvc/hvc_console.c
drivers/tty/hvc/hvc_console.h

index eb255e807c0662250887beea86a2fb73081a6deb..9eba119bcdd3488d7d7541448a2371497c4d70f4 100644 (file)
@@ -361,7 +361,12 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
                tty->driver_data = NULL;
                tty_port_put(&hp->port);
                printk(KERN_ERR "hvc_open: request_irq failed with rc %d.\n", rc);
-       }
+       } else
+               /* We are ready... raise DTR/RTS */
+               if (C_BAUD(tty))
+                       if (hp->ops->dtr_rts)
+                               hp->ops->dtr_rts(hp, 1);
+
        /* Force wakeup of the polling thread */
        hvc_kick();
 
@@ -393,6 +398,10 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
                /* We are done with the tty pointer now. */
                tty_port_tty_set(&hp->port, NULL);
 
+               if (C_HUPCL(tty))
+                       if (hp->ops->dtr_rts)
+                               hp->ops->dtr_rts(hp, 0);
+
                if (hp->ops->notifier_del)
                        hp->ops->notifier_del(hp, hp->data);
 
index 674d23cb919afaeac34d5bc0c7bc8bbbd38c9c1f..91310198082736e0a5bffb75192b71aa1649764a 100644 (file)
@@ -75,6 +75,9 @@ struct hv_ops {
        /* tiocmget/set implementation */
        int (*tiocmget)(struct hvc_struct *hp);
        int (*tiocmset)(struct hvc_struct *hp, unsigned int set, unsigned int clear);
+
+       /* Callbacks to handle tty ports */
+       void (*dtr_rts)(struct hvc_struct *hp, int raise);
 };
 
 /* Register a vterm and a slot index for use as a console (console_init) */