[PATCH 5/8] backports: add tty_port_tty_hangup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is needed by ./net/bluetooth/rfcomm/tty.c

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/tty.h |    1 +
 backport/compat/backport-3.10.c       |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/backport/backport-include/linux/tty.h b/backport/backport-include/linux/tty.h
index 7b57ca1..88fbfd0 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 d8b3bc6..4d44960 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)) */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux