aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pps_kernel.h20
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/tty_ldisc.h5
3 files changed, 25 insertions, 5 deletions
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 65194fe498b..32aa6763ca1 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -43,6 +43,10 @@ struct pps_source_info {
43 struct device *dev; 43 struct device *dev;
44}; 44};
45 45
46struct pps_event_time {
47 struct timespec ts_real;
48};
49
46/* The main struct */ 50/* The main struct */
47struct pps_device { 51struct pps_device {
48 struct pps_source_info info; /* PSS source info */ 52 struct pps_source_info info; /* PSS source info */
@@ -88,6 +92,20 @@ extern int pps_register_source(struct pps_source_info *info,
88extern void pps_unregister_source(int source); 92extern void pps_unregister_source(int source);
89extern int pps_register_cdev(struct pps_device *pps); 93extern int pps_register_cdev(struct pps_device *pps);
90extern void pps_unregister_cdev(struct pps_device *pps); 94extern void pps_unregister_cdev(struct pps_device *pps);
91extern void pps_event(int source, struct pps_ktime *ts, int event, void *data); 95extern void pps_event(int source, struct pps_event_time *ts, int event,
96 void *data);
97
98static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
99 struct timespec ts)
100{
101 kt->sec = ts.tv_sec;
102 kt->nsec = ts.tv_nsec;
103}
104
105static inline void pps_get_ts(struct pps_event_time *ts)
106{
107 getnstimeofday(&ts->ts_real);
108}
92 109
93#endif /* LINUX_PPS_KERNEL_H */ 110#endif /* LINUX_PPS_KERNEL_H */
111
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a23fa29d4eb..758c5b0c6fd 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -212,6 +212,7 @@
212#include <linux/tty.h> 212#include <linux/tty.h>
213#include <linux/mutex.h> 213#include <linux/mutex.h>
214#include <linux/sysrq.h> 214#include <linux/sysrq.h>
215#include <linux/pps_kernel.h>
215 216
216struct uart_port; 217struct uart_port;
217struct serial_struct; 218struct serial_struct;
@@ -528,10 +529,10 @@ uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
528 struct uart_state *state = uport->state; 529 struct uart_state *state = uport->state;
529 struct tty_port *port = &state->port; 530 struct tty_port *port = &state->port;
530 struct tty_ldisc *ld = tty_ldisc_ref(port->tty); 531 struct tty_ldisc *ld = tty_ldisc_ref(port->tty);
531 struct timespec ts; 532 struct pps_event_time ts;
532 533
533 if (ld && ld->ops->dcd_change) 534 if (ld && ld->ops->dcd_change)
534 getnstimeofday(&ts); 535 pps_get_ts(&ts);
535 536
536 uport->icount.dcd++; 537 uport->icount.dcd++;
537#ifdef CONFIG_HARD_PPS 538#ifdef CONFIG_HARD_PPS
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 526d66f066a..763e061e19f 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -101,7 +101,7 @@
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 * 102 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status, 103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status,
104 * struct timespec *ts) 104 * struct pps_event_time *ts)
105 * 105 *
106 * Tells the discipline that the DCD pin has changed its status and 106 * Tells the discipline that the DCD pin has changed its status and
107 * the relative timestamp. Pointer ts can be NULL. 107 * the relative timestamp. Pointer ts can be NULL.
@@ -109,6 +109,7 @@
109 109
110#include <linux/fs.h> 110#include <linux/fs.h>
111#include <linux/wait.h> 111#include <linux/wait.h>
112#include <linux/pps_kernel.h>
112 113
113struct tty_ldisc_ops { 114struct tty_ldisc_ops {
114 int magic; 115 int magic;
@@ -143,7 +144,7 @@ struct tty_ldisc_ops {
143 char *fp, int count); 144 char *fp, int count);
144 void (*write_wakeup)(struct tty_struct *); 145 void (*write_wakeup)(struct tty_struct *);
145 void (*dcd_change)(struct tty_struct *, unsigned int, 146 void (*dcd_change)(struct tty_struct *, unsigned int,
146 struct timespec *); 147 struct pps_event_time *);
147 148
148 struct module *owner; 149 struct module *owner;
149 150