mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-01 23:53:16 -04:00
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>
This commit is contained in:
parent
3003d55b59
commit
6f4229b511
6 changed files with 45 additions and 31 deletions
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue