2013-09-04 08:53:30

by Paul Chavent

[permalink] [raw]
Subject: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

Signed-off-by: Paul Chavent <[email protected]>
---
drivers/pps/pps.c | 57 +++++++++++++++++++++++++++++--------------------------
1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 7173e3a..86ff57e 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -152,35 +152,38 @@ static long pps_cdev_ioctl(struct file *file,
if (err)
return -EFAULT;

- 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;
+ 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;
+ }
}
- }

- /* 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 */
--
1.7.12.1


2013-09-06 07:14:17

by Rodolfo Giometti

[permalink] [raw]
Subject: Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

On Wed, Sep 04, 2013 at 10:20:38AM +0200, Paul Chavent wrote:
> Signed-off-by: Paul Chavent <[email protected]>

Acked: Rodolfo Giometti <[email protected]>

--

GNU/Linux Solutions e-mail: [email protected]
Linux Device Driver [email protected]
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - http://www.consulenti-ict.it

2013-10-11 08:49:32

by Paul Chavent

[permalink] [raw]
Subject: Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

Hi.

I haven't had any feedback for weeks. I join a patch with more details
in the commit message if needed.

Do you know someone responsible to apply PPS patches ?

Regards.

Paul.

On 09/06/2013 08:55 AM, Rodolfo Giometti wrote:
> On Wed, Sep 04, 2013 at 10:20:38AM +0200, Paul Chavent wrote:
>> Signed-off-by: Paul Chavent <[email protected]>
>
> Acked: Rodolfo Giometti <[email protected]>
>


Attachments:
0001-pps-add-non-blocking-option-to-PPS_FETCH-ioctl.patch (2.46 kB)

2013-10-11 08:56:57

by Rodolfo Giometti

[permalink] [raw]
Subject: Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

On Fri, Oct 11, 2013 at 10:42:56AM +0200, Paul Chavent wrote:
> Hi.
>
> I haven't had any feedback for weeks. I join a patch with more
> details in the commit message if needed.

If I well remember I already acked this patch. So please add my
Acked-by line to the patch.

> Do you know someone responsible to apply PPS patches ?

Andrew Morton

Ciao,

Rodolfo

--

GNU/Linux Solutions e-mail: [email protected]
Linux Device Driver [email protected]
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - http://www.consulenti-ict.it