From a0880df0ccde8d551fc4d88c455acb2ee0801e26 Mon Sep 17 00:00:00 2001 From: Rodolfo Giometti Date: Wed, 10 Mar 2010 15:23:47 -0800 Subject: pps: serial clients support Adds support, by using the PPS line discipline, for the PPS sources connected with the CD (Carrier Detect) pin of a serial port. [akpm@linux-foundation.org: fix cast size warnings] Signed-off-by: Rodolfo Giometti Cc: David Woodhouse Cc: Greg KH Cc: Alan Cox Cc: Alexander Gordeev Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/serial_core.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/linux/serial_core.h') diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 8c3dd36fe91a..78dd1e7120a9 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -491,9 +491,13 @@ 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 = tty_ldisc_ref(port->tty); + struct timespec ts; - uport->icount.dcd++; + if (ld && ld->ops->dcd_change) + getnstimeofday(&ts); + uport->icount.dcd++; #ifdef CONFIG_HARD_PPS if ((uport->flags & UPF_HARDPPS_CD) && status) hardpps(); @@ -505,6 +509,11 @@ uart_handle_dcd_change(struct uart_port *uport, unsigned int status) else if (port->tty) tty_hangup(port->tty); } + + if (ld && ld->ops->dcd_change) + ld->ops->dcd_change(port->tty, status, &ts); + if (ld) + tty_ldisc_deref(ld); } /** -- cgit v1.2.3