From: Hauke Mehrtens Date: Thu, 3 Oct 2013 14:09:24 +0000 (+0200) Subject: backports: add tty_port_tty_hangup() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=68909c7ea181975c146883ca0f625407ccd162bd;p=openwrt%2Fstaging%2Fblogic.git backports: add tty_port_tty_hangup() This is needed by ./net/bluetooth/rfcomm/tty.c Signed-off-by: Hauke Mehrtens --- diff --git a/backport/backport-include/linux/tty.h b/backport/backport-include/linux/tty.h index 7b57ca1f91c8..88fbfd03242f 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 d8b3bc6216c7..4d449607187b 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)) */