Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty/hvc_console: Add DTR/RTS callback to handle HUPCL control

Introduce a new callback to explicitly handle the HUPCL termios control flag.
This prepares for a follow-up commit for the hvc_iucv device driver to
improve handling when to drop an established network connection.

The callback naming is based on the recently added tty_port interface to
facilitate a potential refactoring of the hvc_console to use tty_port
functions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Hendrik Brueckner and committed by
Greg Kroah-Hartman
33e745a1 e84f54fc

+13 -1
+10 -1
drivers/tty/hvc/hvc_console.c
··· 361 361 tty->driver_data = NULL; 362 362 tty_port_put(&hp->port); 363 363 printk(KERN_ERR "hvc_open: request_irq failed with rc %d.\n", rc); 364 - } 364 + } else 365 + /* We are ready... raise DTR/RTS */ 366 + if (C_BAUD(tty)) 367 + if (hp->ops->dtr_rts) 368 + hp->ops->dtr_rts(hp, 1); 369 + 365 370 /* Force wakeup of the polling thread */ 366 371 hvc_kick(); 367 372 ··· 397 392 spin_unlock_irqrestore(&hp->port.lock, flags); 398 393 /* We are done with the tty pointer now. */ 399 394 tty_port_tty_set(&hp->port, NULL); 395 + 396 + if (C_HUPCL(tty)) 397 + if (hp->ops->dtr_rts) 398 + hp->ops->dtr_rts(hp, 0); 400 399 401 400 if (hp->ops->notifier_del) 402 401 hp->ops->notifier_del(hp, hp->data);
+3
drivers/tty/hvc/hvc_console.h
··· 75 75 /* tiocmget/set implementation */ 76 76 int (*tiocmget)(struct hvc_struct *hp); 77 77 int (*tiocmset)(struct hvc_struct *hp, unsigned int set, unsigned int clear); 78 + 79 + /* Callbacks to handle tty ports */ 80 + void (*dtr_rts)(struct hvc_struct *hp, int raise); 78 81 }; 79 82 80 83 /* Register a vterm and a slot index for use as a console (console_init) */