From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
To: benh@kernel.crashing.org, jslaby@suse.cz, gregkh@linuxfoundation.org
Cc: linux-s390@vger.kernel.org, heiko.carstens@de.ibm.com,
linux-kernel@vger.kernel.org, brueckner@linux.vnet.com,
schwidefsky@de.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 1/2] tty/hvc_console: Add DTR/RTS callback to handle HUPCL control
Date: Tue, 2 Jul 2013 17:07:14 +0200 [thread overview]
Message-ID: <1372777635-10423-2-git-send-email-brueckner@linux.vnet.ibm.com> (raw)
In-Reply-To: <1372777635-10423-1-git-send-email-brueckner@linux.vnet.ibm.com>
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>
---
drivers/tty/hvc/hvc_console.c | 11 ++++++++++-
drivers/tty/hvc/hvc_console.h | 3 +++
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index eb255e8..9eba119 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -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);
diff --git a/drivers/tty/hvc/hvc_console.h b/drivers/tty/hvc/hvc_console.h
index 674d23c..9131019 100644
--- a/drivers/tty/hvc/hvc_console.h
+++ b/drivers/tty/hvc/hvc_console.h
@@ -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) */
--
1.7.5.4
next prev parent reply other threads:[~2013-07-02 15:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 15:07 [PATCH 0/2] hvc_console: Add DTR/RTS callbacks to handle HUPCL conditions Hendrik Brueckner
2013-07-02 15:07 ` Hendrik Brueckner [this message]
2013-10-11 7:15 ` [PATCH 1/2] tty/hvc_console: Add DTR/RTS callback to handle HUPCL control Benjamin Herrenschmidt
2013-10-11 12:47 ` Hendrik Brueckner
2013-10-11 20:43 ` Benjamin Herrenschmidt
2013-10-15 15:36 ` Hendrik Brueckner
2013-10-15 20:47 ` Benjamin Herrenschmidt
2013-10-16 9:04 ` Hendrik Brueckner
2013-10-16 23:21 ` Benjamin Herrenschmidt
2013-10-17 8:16 ` Hendrik Brueckner
2013-07-02 15:07 ` [PATCH 2/2] tty/hvc_iucv: Disconnect IUCV connection when lowering DTR Hendrik Brueckner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372777635-10423-2-git-send-email-brueckner@linux.vnet.ibm.com \
--to=brueckner@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=brueckner@linux.vnet.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).