diff options
author | Alexander Gordeev <lasaine@lvk.cs.msu.su> | 2011-01-12 20:00:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:19 -0500 |
commit | 6f4229b51106cbc859e9d8209b22c8a2ec749e64 (patch) | |
tree | 346e08800b0f45330e99c9fae0255c73f1666835 /drivers/pps/kapi.c | |
parent | 3003d55b59aa98aeaff2773df69732b27c0cbf6a (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 'drivers/pps/kapi.c')
-rw-r--r-- | drivers/pps/kapi.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index 3f89f5eba81c..b431d83b824a 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
@@ -268,11 +268,12 @@ EXPORT_SYMBOL(pps_unregister_source); | |||
268 | * pps->info.echo(source, event, data); | 268 | * pps->info.echo(source, event, data); |
269 | */ | 269 | */ |
270 | 270 | ||
271 | void pps_event(int source, struct pps_ktime *ts, int event, void *data) | 271 | void pps_event(int source, struct pps_event_time *ts, int event, void *data) |
272 | { | 272 | { |
273 | struct pps_device *pps; | 273 | struct pps_device *pps; |
274 | unsigned long flags; | 274 | unsigned long flags; |
275 | int captured = 0; | 275 | int captured = 0; |
276 | struct pps_ktime ts_real; | ||
276 | 277 | ||
277 | if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) { | 278 | if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) { |
278 | printk(KERN_ERR "pps: unknown event (%x) for source %d\n", | 279 | printk(KERN_ERR "pps: unknown event (%x) for source %d\n", |
@@ -284,8 +285,10 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
284 | if (!pps) | 285 | if (!pps) |
285 | return; | 286 | return; |
286 | 287 | ||
287 | pr_debug("PPS event on source %d at %llu.%06u\n", | 288 | pr_debug("PPS event on source %d at %ld.%09ld\n", |
288 | pps->id, (unsigned long long) ts->sec, ts->nsec); | 289 | pps->id, ts->ts_real.tv_sec, ts->ts_real.tv_nsec); |
290 | |||
291 | timespec_to_pps_ktime(&ts_real, ts->ts_real); | ||
289 | 292 | ||
290 | spin_lock_irqsave(&pps->lock, flags); | 293 | spin_lock_irqsave(&pps->lock, flags); |
291 | 294 | ||
@@ -299,10 +302,11 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
299 | (pps->params.mode & PPS_CAPTUREASSERT)) { | 302 | (pps->params.mode & PPS_CAPTUREASSERT)) { |
300 | /* We have to add an offset? */ | 303 | /* We have to add an offset? */ |
301 | if (pps->params.mode & PPS_OFFSETASSERT) | 304 | if (pps->params.mode & PPS_OFFSETASSERT) |
302 | pps_add_offset(ts, &pps->params.assert_off_tu); | 305 | pps_add_offset(&ts_real, |
306 | &pps->params.assert_off_tu); | ||
303 | 307 | ||
304 | /* Save the time stamp */ | 308 | /* Save the time stamp */ |
305 | pps->assert_tu = *ts; | 309 | pps->assert_tu = ts_real; |
306 | pps->assert_sequence++; | 310 | pps->assert_sequence++; |
307 | pr_debug("capture assert seq #%u for source %d\n", | 311 | pr_debug("capture assert seq #%u for source %d\n", |
308 | pps->assert_sequence, source); | 312 | pps->assert_sequence, source); |
@@ -313,10 +317,11 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
313 | (pps->params.mode & PPS_CAPTURECLEAR)) { | 317 | (pps->params.mode & PPS_CAPTURECLEAR)) { |
314 | /* We have to add an offset? */ | 318 | /* We have to add an offset? */ |
315 | if (pps->params.mode & PPS_OFFSETCLEAR) | 319 | if (pps->params.mode & PPS_OFFSETCLEAR) |
316 | pps_add_offset(ts, &pps->params.clear_off_tu); | 320 | pps_add_offset(&ts_real, |
321 | &pps->params.clear_off_tu); | ||
317 | 322 | ||
318 | /* Save the time stamp */ | 323 | /* Save the time stamp */ |
319 | pps->clear_tu = *ts; | 324 | pps->clear_tu = ts_real; |
320 | pps->clear_sequence++; | 325 | pps->clear_sequence++; |
321 | pr_debug("capture clear seq #%u for source %d\n", | 326 | pr_debug("capture clear seq #%u for source %d\n", |
322 | pps->clear_sequence, source); | 327 | pps->clear_sequence, source); |