diff options
Diffstat (limited to 'drivers/pps')
| -rw-r--r-- | drivers/pps/kapi.c | 20 | ||||
| -rw-r--r-- | drivers/pps/pps.c | 11 |
2 files changed, 23 insertions, 8 deletions
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index 35a0b192d76..2d414e23d39 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
| @@ -271,6 +271,7 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 271 | { | 271 | { |
| 272 | struct pps_device *pps; | 272 | struct pps_device *pps; |
| 273 | unsigned long flags; | 273 | unsigned long flags; |
| 274 | int captured = 0; | ||
| 274 | 275 | ||
| 275 | if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) { | 276 | if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) { |
| 276 | printk(KERN_ERR "pps: unknown event (%x) for source %d\n", | 277 | printk(KERN_ERR "pps: unknown event (%x) for source %d\n", |
| @@ -293,7 +294,8 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 293 | 294 | ||
| 294 | /* Check the event */ | 295 | /* Check the event */ |
| 295 | pps->current_mode = pps->params.mode; | 296 | pps->current_mode = pps->params.mode; |
| 296 | if (event & PPS_CAPTUREASSERT) { | 297 | if ((event & PPS_CAPTUREASSERT) & |
| 298 | (pps->params.mode & PPS_CAPTUREASSERT)) { | ||
| 297 | /* We have to add an offset? */ | 299 | /* We have to add an offset? */ |
| 298 | if (pps->params.mode & PPS_OFFSETASSERT) | 300 | if (pps->params.mode & PPS_OFFSETASSERT) |
| 299 | pps_add_offset(ts, &pps->params.assert_off_tu); | 301 | pps_add_offset(ts, &pps->params.assert_off_tu); |
| @@ -303,8 +305,11 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 303 | pps->assert_sequence++; | 305 | pps->assert_sequence++; |
| 304 | pr_debug("capture assert seq #%u for source %d\n", | 306 | pr_debug("capture assert seq #%u for source %d\n", |
| 305 | pps->assert_sequence, source); | 307 | pps->assert_sequence, source); |
| 308 | |||
| 309 | captured = ~0; | ||
| 306 | } | 310 | } |
| 307 | if (event & PPS_CAPTURECLEAR) { | 311 | if ((event & PPS_CAPTURECLEAR) & |
| 312 | (pps->params.mode & PPS_CAPTURECLEAR)) { | ||
| 308 | /* We have to add an offset? */ | 313 | /* We have to add an offset? */ |
| 309 | if (pps->params.mode & PPS_OFFSETCLEAR) | 314 | if (pps->params.mode & PPS_OFFSETCLEAR) |
| 310 | pps_add_offset(ts, &pps->params.clear_off_tu); | 315 | pps_add_offset(ts, &pps->params.clear_off_tu); |
| @@ -314,12 +319,17 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 314 | pps->clear_sequence++; | 319 | pps->clear_sequence++; |
| 315 | pr_debug("capture clear seq #%u for source %d\n", | 320 | pr_debug("capture clear seq #%u for source %d\n", |
| 316 | pps->clear_sequence, source); | 321 | pps->clear_sequence, source); |
| 322 | |||
| 323 | captured = ~0; | ||
| 317 | } | 324 | } |
| 318 | 325 | ||
| 319 | pps->go = ~0; | 326 | /* Wake up iif captured somthing */ |
| 320 | wake_up_interruptible(&pps->queue); | 327 | if (captured) { |
| 328 | pps->go = ~0; | ||
| 329 | wake_up_interruptible(&pps->queue); | ||
| 321 | 330 | ||
| 322 | kill_fasync(&pps->async_queue, SIGIO, POLL_IN); | 331 | kill_fasync(&pps->async_queue, SIGIO, POLL_IN); |
| 332 | } | ||
| 323 | 333 | ||
| 324 | spin_unlock_irqrestore(&pps->lock, flags); | 334 | spin_unlock_irqrestore(&pps->lock, flags); |
| 325 | 335 | ||
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c index fea17e7805e..ca5183bdad8 100644 --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c | |||
| @@ -71,9 +71,14 @@ static long pps_cdev_ioctl(struct file *file, | |||
| 71 | case PPS_GETPARAMS: | 71 | case PPS_GETPARAMS: |
| 72 | pr_debug("PPS_GETPARAMS: source %d\n", pps->id); | 72 | pr_debug("PPS_GETPARAMS: source %d\n", pps->id); |
| 73 | 73 | ||
| 74 | /* Return current parameters */ | 74 | spin_lock_irq(&pps->lock); |
| 75 | err = copy_to_user(uarg, &pps->params, | 75 | |
| 76 | sizeof(struct pps_kparams)); | 76 | /* Get the current parameters */ |
| 77 | params = pps->params; | ||
| 78 | |||
| 79 | spin_unlock_irq(&pps->lock); | ||
| 80 | |||
| 81 | err = copy_to_user(uarg, ¶ms, sizeof(struct pps_kparams)); | ||
| 77 | if (err) | 82 | if (err) |
| 78 | return -EFAULT; | 83 | return -EFAULT; |
| 79 | 84 | ||
