public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Chavent <Paul.Chavent@onera.fr>
To: Rodolfo Giometti <giometti@enneenne.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
Date: Fri, 11 Oct 2013 10:42:56 +0200	[thread overview]
Message-ID: <5257BA10.2010607@onera.fr> (raw)
In-Reply-To: <20130906065509.GA6627@enneenne.com>

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

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 <paul.chavent@onera.fr>
>
> Acked: Rodolfo Giometti <giometti@enneenne.com>
>

[-- Attachment #2: 0001-pps-add-non-blocking-option-to-PPS_FETCH-ioctl.patch --]
[-- Type: text/x-patch, Size: 2517 bytes --]

>From 370fca528140f879957a1b717fe9c13855d5c7f7 Mon Sep 17 00:00:00 2001
From: Paul Chavent <paul.chavent@onera.fr>
Date: Wed, 4 Sep 2013 10:09:43 +0200
Subject: [PATCH] pps : add non blocking option to PPS_FETCH ioctl (v2).

This new version add a commit message with more details.

The PPS_FETCH ioctl is blocking still the reception of a pps
event. But, in some case, one may need the last event date
immediately. This patch allow to get the result of PPS_FETCH if the
device has the O_NONBLOCK flag set.

Signed-off-by: Paul Chavent <paul.chavent@onera.fr>
---
 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 2f07cd6..983f50c 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


  reply	other threads:[~2013-10-11  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04  8:20 [PATCH] pps : add non blocking option to PPS_FETCH ioctl Paul Chavent
2013-09-06  6:55 ` Rodolfo Giometti
2013-10-11  8:42   ` Paul Chavent [this message]
2013-10-11  8:56     ` Rodolfo Giometti
  -- strict thread matches above, loose matches on Subject: below --
2013-10-11 12:40 Paul Chavent
2013-10-11 19:47 ` Andrew Morton
2013-10-15 10:43   ` Rodolfo Giometti
2013-10-15 19:55     ` Andrew Morton
2013-10-16  6:52       ` Paul Chavent
2013-10-16  7:29         ` Rodolfo Giometti
2013-10-16  7:42           ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5257BA10.2010607@onera.fr \
    --to=paul.chavent@onera.fr \
    --cc=giometti@enneenne.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox