summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorGeorge Spelvin <linux@horizon.com>2013-02-10 04:44:30 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-13 10:17:06 -0800
commit42381572f586d4da57e7d65e0fcb45422be3ba7b (patch)
treedaf1547e12333175cc72aab0973fb9f09557a79d /drivers/tty
parent593fb1ae457aab28b392ac114f6e3358788da985 (diff)
downloadop-kernel-dev-42381572f586d4da57e7d65e0fcb45422be3ba7b.zip
op-kernel-dev-42381572f586d4da57e7d65e0fcb45422be3ba7b.tar.gz
pps: Additional cleanups in uart_handle_dcd_change
An extension of the previous commit, there is no semantic change here, just fewer lines of source code. Signed-off-by: George Spelvin <linux@horizon.com> Acked-by: Rodolfo Giometti <giometti@enneenne.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/serial_core.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 765be52..6ce40c1 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2723,15 +2723,15 @@ EXPORT_SYMBOL(uart_match_port);
*/
void uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
{
- struct uart_state *state = uport->state;
- struct tty_port *port = &state->port;
- struct tty_ldisc *ld = NULL;
+ struct tty_port *port = &uport->state->port;
struct tty_struct *tty = port->tty;
+ struct tty_ldisc *ld = tty ? tty_ldisc_ref(tty) : NULL;
- if (tty)
- ld = tty_ldisc_ref(tty);
- if (ld && ld->ops->dcd_change)
- ld->ops->dcd_change(tty, status);
+ if (ld) {
+ if (ld->ops->dcd_change)
+ ld->ops->dcd_change(tty, status);
+ tty_ldisc_deref(ld);
+ }
uport->icount.dcd++;
#ifdef CONFIG_HARD_PPS
@@ -2745,9 +2745,6 @@ void uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
else if (tty)
tty_hangup(tty);
}
-
- if (ld)
- tty_ldisc_deref(ld);
}
EXPORT_SYMBOL_GPL(uart_handle_dcd_change);
OpenPOWER on IntegriCloud