aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/serial_core.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-09-02 17:39:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-08 16:23:36 -0700
commitc993257bf7571945201205491de86268437ea174 (patch)
treec70807f1e766e748bf0bbc1c32dc31c30a70fcbf /drivers/tty/serial/serial_core.c
parentserial: 8250: Document serial8250_modem_status() locking (diff)
downloadlinux-dev-c993257bf7571945201205491de86268437ea174.tar.xz
linux-dev-c993257bf7571945201205491de86268437ea174.zip
serial: core: Unwrap tertiary assignment in uart_handle_dcd_change()
Prepare for spin lock assertion; move non-trivial assignment into function body. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r--drivers/tty/serial/serial_core.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index bdc543caf069..5a78f6940760 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2748,12 +2748,15 @@ void uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
{
struct tty_port *port = &uport->state->port;
struct tty_struct *tty = port->tty;
- struct tty_ldisc *ld = tty ? tty_ldisc_ref(tty) : NULL;
+ struct tty_ldisc *ld;
- if (ld) {
- if (ld->ops->dcd_change)
- ld->ops->dcd_change(tty, status);
- tty_ldisc_deref(ld);
+ if (tty) {
+ ld = tty_ldisc_ref(tty);
+ if (ld) {
+ if (ld->ops->dcd_change)
+ ld->ops->dcd_change(tty, status);
+ tty_ldisc_deref(ld);
+ }
}
uport->icount.dcd++;