aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pps_kernel.h
diff options
context:
space:
mode:
authorAlexander Gordeev <lasaine@lvk.cs.msu.su>2011-01-12 20:00:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 11:03:19 -0500
commit6f4229b51106cbc859e9d8209b22c8a2ec749e64 (patch)
tree346e08800b0f45330e99c9fae0255c73f1666835 /include/linux/pps_kernel.h
parent3003d55b59aa98aeaff2773df69732b27c0cbf6a (diff)
pps: unify timestamp gathering
Add a helper function to gather timestamps. This way clients don't have to duplicate it. Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su> Acked-by: Rodolfo Giometti <giometti@linux.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/pps_kernel.h')
-rw-r--r--include/linux/pps_kernel.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 65194fe498bb..32aa6763ca1b 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