diff options
author | Alexander Gordeev <lasaine@lvk.cs.msu.su> | 2011-01-13 04:00:50 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 19:03:19 +0300 |
commit | 6f4229b51106cbc859e9d8209b22c8a2ec749e64 (patch) | |
tree | 346e08800b0f45330e99c9fae0255c73f1666835 /include/linux/pps_kernel.h | |
parent | 3003d55b59aa98aeaff2773df69732b27c0cbf6a (diff) | |
download | linux-6f4229b51106cbc859e9d8209b22c8a2ec749e64.tar.xz |
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.h | 20 |
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 { struct device *dev; }; +struct pps_event_time { + struct timespec ts_real; +}; + /* The main struct */ struct pps_device { struct pps_source_info info; /* PSS source info */ @@ -88,6 +92,20 @@ extern int pps_register_source(struct pps_source_info *info, extern void pps_unregister_source(int source); extern int pps_register_cdev(struct pps_device *pps); extern void pps_unregister_cdev(struct pps_device *pps); -extern void pps_event(int source, struct pps_ktime *ts, int event, void *data); +extern void pps_event(int source, struct pps_event_time *ts, int event, + void *data); + +static inline void timespec_to_pps_ktime(struct pps_ktime *kt, + struct timespec ts) +{ + kt->sec = ts.tv_sec; + kt->nsec = ts.tv_nsec; +} + +static inline void pps_get_ts(struct pps_event_time *ts) +{ + getnstimeofday(&ts->ts_real); +} #endif /* LINUX_PPS_KERNEL_H */ + |