+ pps-add-non-blocking-option-to-pps_fetch-ioctl.patch added to -mm tree
Subject: + pps-add-non-blocking-option-to-pps_fetch-ioctl.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Fri, 11 Oct 2013 12:47:26 -0700
The patch titled
Subject: pps : add non blocking option to PPS_FETCH ioctl.
has been added to the -mm tree. Its filename is
pps-add-non-blocking-option-to-pps_fetch-ioctl.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/pps-add-non-blocking-option-to-pps_fetch-ioctl.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/pps-add-non-blocking-option-to-pps_fetch-ioctl.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Paul Chavent <[email protected]>
Subject: pps : add non blocking option to PPS_FETCH ioctl.
The PPS_FETCH ioctl is blocking still the reception of a PPS event. But, in some case, one may immediately need the last event date. This patch allow to get the result of PPS_FETCH if the device has the O_NONBLOCK flag set.
---
drivers/pps/pps.c | 55 +++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 26 deletions(-)
drivers/pps/pps.c renamed from drivers/pps/pps.c~pps-add-non-blocking-option-to-pps_fetch-ioctl +29 -26
@@ -152,35 +152,38 @@ static long pps_cdev_ioctl(struct file *if (err)return -EFAULT ; - ev = pps->last_ev; +if (!(file->f_flags &O_NONBLOCK )) { + ev = pps->last_ev; -/* Manage the timeout */ -if (fdata.timeout.flags &PPS_TIME_INVALID ) - err =wait_event_interruptible (pps->queue, - ev != pps->last_ev); -else { -unsigned long ticks; - -dev_dbg (pps->dev,"timeout %lld.%09d\n" , - (long long ) fdata.timeout.sec, - fdata.timeout.nsec); - ticks = fdata.timeout.sec *HZ ; - ticks += fdata.timeout.nsec / (NSEC_PER_SEC /HZ ); - -if (ticks !=0 ) { - err =wait_event_interruptible_timeout ( - pps->queue, - ev != pps->last_ev, - ticks); -if (err ==0 ) -return -ETIMEDOUT ; +/* Manage the timeout */ +if (fdata.timeout.flags &PPS_TIME_INVALID ) + err =wait_event_interruptible (pps->queue, + ev != pps->last_ev); +else { +unsigned long ticks; + +dev_dbg (pps->dev,"timeout %lld.%09d\n" , + (long long ) fdata.timeout.sec, + fdata.timeout.nsec); + ticks = fdata.timeout.sec *HZ ; + ticks += fdata.timeout.nsec / + (NSEC_PER_SEC /HZ ); + +if (ticks !=0 ) { + err =wait_event_interruptible_timeout ( + pps->queue, + ev != pps->last_ev, + ticks); +if (err ==0 ) +return -ETIMEDOUT ; + } } - } -/* Check for pending signals */ -if (err == -ERESTARTSYS ) { -dev_dbg (pps->dev,"pending signal caught\n" ); -return -EINTR ; +/* Check for pending signals */ +if (err == -ERESTARTSYS ) { +dev_dbg (pps->dev,"pending signal caught\n" ); +return -EINTR ; + } }/* Return the fetched timestamp */
_
Patches currently in -mm which might be from [email protected] are
pps-add-non-blocking-option-to-pps_fetch-ioctl.patch linux-next.patch