Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pps: events reporting fix up

PPS events must be recorded according to PPS's mode settings.

If a process asks for (i.e.) capture-assert events only, when the PPS
client calls the pps_event() function to save the current PPS event, we
should verify the event type and then discard unwanted ones.

Also, without this patch userland processes waiting for a specific PPS
event (assert or clear but not both) may be awakened at wrong time.

Signed-off-by: Rodolfo Giometti <giometti@linux.it>
Tested-by: William S. Brasher <billb958@door.net>
Tested-by: Reg Clemens <clemens@dwf.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Rodolfo Giometti and committed by
Linus Torvalds
276b282e cbf83cc5

+15 -5
+15 -5
drivers/pps/kapi.c
··· 271 271 { 272 272 struct pps_device *pps; 273 273 unsigned long flags; 274 + int captured = 0; 274 275 275 276 if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) { 276 277 printk(KERN_ERR "pps: unknown event (%x) for source %d\n", ··· 294 293 295 294 /* Check the event */ 296 295 pps->current_mode = pps->params.mode; 297 - if (event & PPS_CAPTUREASSERT) { 296 + if ((event & PPS_CAPTUREASSERT) & 297 + (pps->params.mode & PPS_CAPTUREASSERT)) { 298 298 /* We have to add an offset? */ 299 299 if (pps->params.mode & PPS_OFFSETASSERT) 300 300 pps_add_offset(ts, &pps->params.assert_off_tu); ··· 305 303 pps->assert_sequence++; 306 304 pr_debug("capture assert seq #%u for source %d\n", 307 305 pps->assert_sequence, source); 306 + 307 + captured = ~0; 308 308 } 309 - if (event & PPS_CAPTURECLEAR) { 309 + if ((event & PPS_CAPTURECLEAR) & 310 + (pps->params.mode & PPS_CAPTURECLEAR)) { 310 311 /* We have to add an offset? */ 311 312 if (pps->params.mode & PPS_OFFSETCLEAR) 312 313 pps_add_offset(ts, &pps->params.clear_off_tu); ··· 319 314 pps->clear_sequence++; 320 315 pr_debug("capture clear seq #%u for source %d\n", 321 316 pps->clear_sequence, source); 317 + 318 + captured = ~0; 322 319 } 323 320 324 - pps->go = ~0; 325 - wake_up_interruptible(&pps->queue); 321 + /* Wake up iif captured somthing */ 322 + if (captured) { 323 + pps->go = ~0; 324 + wake_up_interruptible(&pps->queue); 326 325 327 - kill_fasync(&pps->async_queue, SIGIO, POLL_IN); 326 + kill_fasync(&pps->async_queue, SIGIO, POLL_IN); 327 + } 328 328 329 329 spin_unlock_irqrestore(&pps->lock, flags); 330 330