summaryrefslogtreecommitdiff
path: root/backport
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2013-10-03 16:09:24 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2013-10-21 23:58:37 +0200
commit68909c7ea181975c146883ca0f625407ccd162bd (patch)
tree44c24bc313eea0b69a5337cb014c658b38e33b38 /backport
parent64d167437e37538659e08f8cfc5ad995ed488ffc (diff)
backports: add tty_port_tty_hangup()
This is needed by ./net/bluetooth/rfcomm/tty.c Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'backport')
-rw-r--r--backport/backport-include/linux/tty.h1
-rw-r--r--backport/compat/backport-3.10.c16
2 files changed, 17 insertions, 0 deletions
diff --git a/backport/backport-include/linux/tty.h b/backport/backport-include/linux/tty.h
index 7b57ca1f..88fbfd03 100644
--- a/backport/backport-include/linux/tty.h
+++ b/backport/backport-include/linux/tty.h
@@ -50,6 +50,7 @@ extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
extern void tty_port_tty_wakeup(struct tty_port *port);
+extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal);
#endif
#endif /* __BACKPORT_LINUX_TTY_H */
diff --git a/backport/compat/backport-3.10.c b/backport/compat/backport-3.10.c
index d8b3bc62..4d449607 100644
--- a/backport/compat/backport-3.10.c
+++ b/backport/compat/backport-3.10.c
@@ -108,4 +108,20 @@ void tty_port_tty_wakeup(struct tty_port *port)
}
}
EXPORT_SYMBOL_GPL(tty_port_tty_wakeup);
+
+/**
+ * tty_port_tty_hangup - helper to hang up a tty
+ *
+ * @port: tty port
+ * @check_clocal: hang only ttys with CLOCAL unset?
+ */
+void tty_port_tty_hangup(struct tty_port *port, bool check_clocal)
+{
+ struct tty_struct *tty = tty_port_tty_get(port);
+
+ if (tty && (!check_clocal || !C_CLOCAL(tty)))
+ tty_hangup(tty);
+ tty_kref_put(tty);
+}
+EXPORT_SYMBOL_GPL(tty_port_tty_hangup);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) */