* [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
@ 2013-10-11 12:40 Paul Chavent
2013-10-11 19:47 ` Andrew Morton
0 siblings, 1 reply; 11+ messages in thread
From: Paul Chavent @ 2013-10-11 12:40 UTC (permalink / raw)
To: giometti, akpm, linux-kernel; +Cc: Paul Chavent
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.
Signed-off-by: Paul Chavent <paul.chavent@onera.fr>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
---
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
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-10-11 12:40 [PATCH] pps : add non blocking option to PPS_FETCH ioctl Paul Chavent
@ 2013-10-11 19:47 ` Andrew Morton
2013-10-15 10:43 ` Rodolfo Giometti
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2013-10-11 19:47 UTC (permalink / raw)
To: Paul Chavent; +Cc: giometti, linux-kernel, Alexander Gordeev
On Fri, 11 Oct 2013 14:40:32 +0200 Paul Chavent <Paul.Chavent@onera.fr> wrote:
> 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.
Are the PPS ioctls actually documented anywhere?
Documentation/pps/pps.txt is silent.
That's a shame, because it would be nice to have a formal description
of the the PPS_FETCH semantics which leads to an understanding of why
things are the way they are, how PPS_FETCH is supposed to be used, etc.
Also, the presence of such documentation would permit me to bug you for
not having updated it! We need *some* channel for telling people about
the driver, and updates to it. Maybe linuxpps.org has it somewhere,
but I couldn't immediately find it.
Your implementation requires that the file be opened non-blocking. But
I'd have thought that adding a new and separate ioctl mode would be a
cleaner and more flexible implementation - that way an app which wants
both blocking and non-blocking behaviour doesn't need to open the file
twice.
Also, this is actually a non-backward-compatible change for any
application which happened to be opening the file with O_NONBLOCK!
Hopefully there aren't any such applications...
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-10-11 19:47 ` Andrew Morton
@ 2013-10-15 10:43 ` Rodolfo Giometti
2013-10-15 19:55 ` Andrew Morton
0 siblings, 1 reply; 11+ messages in thread
From: Rodolfo Giometti @ 2013-10-15 10:43 UTC (permalink / raw)
To: Andrew Morton; +Cc: Paul Chavent, linux-kernel, Alexander Gordeev
On Fri, Oct 11, 2013 at 12:47:20PM -0700, Andrew Morton wrote:
> On Fri, 11 Oct 2013 14:40:32 +0200 Paul Chavent <Paul.Chavent@onera.fr> wrote:
>
> > 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.
>
> Are the PPS ioctls actually documented anywhere?
> Documentation/pps/pps.txt is silent.
>
> That's a shame, because it would be nice to have a formal description
> of the the PPS_FETCH semantics which leads to an understanding of why
> things are the way they are, how PPS_FETCH is supposed to be used, etc.
>
> Also, the presence of such documentation would permit me to bug you for
> not having updated it! We need *some* channel for telling people about
> the driver, and updates to it. Maybe linuxpps.org has it somewhere,
> but I couldn't immediately find it.
Hi Andrew! Actually RFC 2783 doesn't use ioctls to get access to PPS
data but it defines some functions. LinuxPPS, that is the Linux PPS
implementation, uses ioctls to implement these functions.
If you like having an idea about how these functions are implemented
into LinuxPPS, you can see here:
http://www.linuxpps.org/gitweb/?p=pps-tools;a=blob;f=timepps.h;h=d2628d2d061ea2a3623e57990d9ada62623773cf;hb=5980a044bcdb4c1d1a8b1ecff986fa63719519b3
> Your implementation requires that the file be opened non-blocking. But
> I'd have thought that adding a new and separate ioctl mode would be a
> cleaner and more flexible implementation - that way an app which wants
> both blocking and non-blocking behaviour doesn't need to open the file
> twice.
>
> Also, this is actually a non-backward-compatible change for any
> application which happened to be opening the file with O_NONBLOCK!
> Hopefully there aren't any such applications...
The major application that I know using these layer is NTPD... however
all RFC compliant applications should not use ioctls to get access the
PPS data and this patch should be a "special" case.
Thanks for your time,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-10-15 10:43 ` Rodolfo Giometti
@ 2013-10-15 19:55 ` Andrew Morton
2013-10-16 6:52 ` Paul Chavent
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2013-10-15 19:55 UTC (permalink / raw)
To: Rodolfo Giometti; +Cc: Paul Chavent, linux-kernel, Alexander Gordeev
On Tue, 15 Oct 2013 12:43:50 +0200 Rodolfo Giometti <giometti@enneenne.com> wrote:
> On Fri, Oct 11, 2013 at 12:47:20PM -0700, Andrew Morton wrote:
> > On Fri, 11 Oct 2013 14:40:32 +0200 Paul Chavent <Paul.Chavent@onera.fr> wrote:
> >
> > > 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.
> >
> > Are the PPS ioctls actually documented anywhere?
> > Documentation/pps/pps.txt is silent.
> >
> > That's a shame, because it would be nice to have a formal description
> > of the the PPS_FETCH semantics which leads to an understanding of why
> > things are the way they are, how PPS_FETCH is supposed to be used, etc.
> >
> > Also, the presence of such documentation would permit me to bug you for
> > not having updated it! We need *some* channel for telling people about
> > the driver, and updates to it. Maybe linuxpps.org has it somewhere,
> > but I couldn't immediately find it.
>
> Hi Andrew! Actually RFC 2783 doesn't use ioctls to get access to PPS
> data but it defines some functions. LinuxPPS, that is the Linux PPS
> implementation, uses ioctls to implement these functions.
>
> If you like having an idea about how these functions are implemented
> into LinuxPPS, you can see here:
>
> http://www.linuxpps.org/gitweb/?p=pps-tools;a=blob;f=timepps.h;h=d2628d2d061ea2a3623e57990d9ada62623773cf;hb=5980a044bcdb4c1d1a8b1ecff986fa63719519b3
>
> > Your implementation requires that the file be opened non-blocking. But
> > I'd have thought that adding a new and separate ioctl mode would be a
> > cleaner and more flexible implementation - that way an app which wants
> > both blocking and non-blocking behaviour doesn't need to open the file
> > twice.
> >
> > Also, this is actually a non-backward-compatible change for any
> > application which happened to be opening the file with O_NONBLOCK!
> > Hopefully there aren't any such applications...
>
> The major application that I know using these layer is NTPD... however
> all RFC compliant applications should not use ioctls to get access the
> PPS data and this patch should be a "special" case.
>
Thanks, but this doesn't really address my concerns.
- Where, if anywhere, is the Linux PPS API documented and how do we
communicate changes such as this one to kernel users?
- Why require open(O_NONBLOCK) for this instead of adding a separate
ioctl?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-10-15 19:55 ` Andrew Morton
@ 2013-10-16 6:52 ` Paul Chavent
2013-10-16 7:29 ` Rodolfo Giometti
0 siblings, 1 reply; 11+ messages in thread
From: Paul Chavent @ 2013-10-16 6:52 UTC (permalink / raw)
To: Andrew Morton, Rodolfo Giometti; +Cc: linux-kernel, Alexander Gordeev
On 10/15/2013 09:55 PM, Andrew Morton wrote:
> On Tue, 15 Oct 2013 12:43:50 +0200 Rodolfo Giometti <giometti@enneenne.com> wrote:
>
>> On Fri, Oct 11, 2013 at 12:47:20PM -0700, Andrew Morton wrote:
>>> On Fri, 11 Oct 2013 14:40:32 +0200 Paul Chavent <Paul.Chavent@onera.fr> wrote:
>>>
>>>> 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.
>>>
>>> Are the PPS ioctls actually documented anywhere?
>>> Documentation/pps/pps.txt is silent.
>>>
>>> That's a shame, because it would be nice to have a formal description
>>> of the the PPS_FETCH semantics which leads to an understanding of why
>>> things are the way they are, how PPS_FETCH is supposed to be used, etc.
>>>
>>> Also, the presence of such documentation would permit me to bug you for
>>> not having updated it! We need *some* channel for telling people about
>>> the driver, and updates to it. Maybe linuxpps.org has it somewhere,
>>> but I couldn't immediately find it.
>>
>> Hi Andrew! Actually RFC 2783 doesn't use ioctls to get access to PPS
>> data but it defines some functions. LinuxPPS, that is the Linux PPS
>> implementation, uses ioctls to implement these functions.
>>
>> If you like having an idea about how these functions are implemented
>> into LinuxPPS, you can see here:
>>
>> http://www.linuxpps.org/gitweb/?p=pps-tools;a=blob;f=timepps.h;h=d2628d2d061ea2a3623e57990d9ada62623773cf;hb=5980a044bcdb4c1d1a8b1ecff986fa63719519b3
>>
>>> Your implementation requires that the file be opened non-blocking. But
>>> I'd have thought that adding a new and separate ioctl mode would be a
>>> cleaner and more flexible implementation - that way an app which wants
>>> both blocking and non-blocking behaviour doesn't need to open the file
>>> twice.
>>>
>>> Also, this is actually a non-backward-compatible change for any
>>> application which happened to be opening the file with O_NONBLOCK!
>>> Hopefully there aren't any such applications...
>>
>> The major application that I know using these layer is NTPD... however
>> all RFC compliant applications should not use ioctls to get access the
>> PPS data and this patch should be a "special" case.
>>
>
> Thanks, but this doesn't really address my concerns.
>
> - Where, if anywhere, is the Linux PPS API documented and how do we
> communicate changes such as this one to kernel users?
>
> - Why require open(O_NONBLOCK) for this instead of adding a separate
> ioctl?
>
I would also prefer the separate ioctl. As you said it, it's a bit
annoying to switch from blocking mode to non blocking mode if we need
both mode. But i was not sure about the preferences of the maintainer :
(i) change the api, or (ii) change the behavior with a widely supported
interface (O_NONBLOCK).
I'm certainly not the best person to make the final decision, but i
would like to help you if you need me (write doc, or change this patch).
Cheers.
Paul.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-10-16 6:52 ` Paul Chavent
@ 2013-10-16 7:29 ` Rodolfo Giometti
2013-10-16 7:42 ` Andrew Morton
0 siblings, 1 reply; 11+ messages in thread
From: Rodolfo Giometti @ 2013-10-16 7:29 UTC (permalink / raw)
To: Paul Chavent; +Cc: Andrew Morton, linux-kernel, Alexander Gordeev
On Wed, Oct 16, 2013 at 08:52:47AM +0200, Paul Chavent wrote:
>
> I would also prefer the separate ioctl. As you said it, it's a bit
> annoying to switch from blocking mode to non blocking mode if we
> need both mode. But i was not sure about the preferences of the
> maintainer : (i) change the api, or (ii) change the behavior with a
> widely supported interface (O_NONBLOCK).
As already stated the PPS RFC doesn't use ioctls to manage PPS data so
we can modify ioctls according our needs!
In fact we can modify the LinuxPPS wrapper functions to still remain
RFC compliant. :)
> I'm certainly not the best person to make the final decision, but i
> would like to help you if you need me (write doc, or change this
> patch).
In this scenario I think we can do as Andrew suggests modifying
LinuxPPS docs accordingly... maybe we can add a new file into
linux/Documentation/pps directory describing Linux PPS ioctls and how
they interact with PPS RFC functions.
Andrew, could this be an acceptable solution?
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-10-16 7:29 ` Rodolfo Giometti
@ 2013-10-16 7:42 ` Andrew Morton
0 siblings, 0 replies; 11+ messages in thread
From: Andrew Morton @ 2013-10-16 7:42 UTC (permalink / raw)
To: Rodolfo Giometti; +Cc: Paul Chavent, linux-kernel, Alexander Gordeev
On Wed, 16 Oct 2013 09:29:58 +0200 Rodolfo Giometti <giometti@enneenne.com> wrote:
> On Wed, Oct 16, 2013 at 08:52:47AM +0200, Paul Chavent wrote:
> >
> > I would also prefer the separate ioctl. As you said it, it's a bit
> > annoying to switch from blocking mode to non blocking mode if we
> > need both mode. But i was not sure about the preferences of the
> > maintainer : (i) change the api, or (ii) change the behavior with a
> > widely supported interface (O_NONBLOCK).
>
> As already stated the PPS RFC doesn't use ioctls to manage PPS data so
> we can modify ioctls according our needs!
>
> In fact we can modify the LinuxPPS wrapper functions to still remain
> RFC compliant. :)
Sure. I do think the new ioctl is better than O_NONBLOCK. Are you OK with
that?
> > I'm certainly not the best person to make the final decision, but i
> > would like to help you if you need me (write doc, or change this
> > patch).
>
> In this scenario I think we can do as Andrew suggests modifying
> LinuxPPS docs accordingly... maybe we can add a new file into
> linux/Documentation/pps directory describing Linux PPS ioctls and how
> they interact with PPS RFC functions.
>
> Andrew, could this be an acceptable solution?
Sounds great, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
@ 2013-09-04 8:20 Paul Chavent
2013-09-06 6:55 ` Rodolfo Giometti
0 siblings, 1 reply; 11+ messages in thread
From: Paul Chavent @ 2013-09-04 8:20 UTC (permalink / raw)
To: giometti, linux-kernel; +Cc: Paul Chavent
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 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
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-09-04 8:20 Paul Chavent
@ 2013-09-06 6:55 ` Rodolfo Giometti
2013-10-11 8:42 ` Paul Chavent
0 siblings, 1 reply; 11+ messages in thread
From: Rodolfo Giometti @ 2013-09-06 6:55 UTC (permalink / raw)
To: Paul Chavent; +Cc: linux-kernel
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>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-09-06 6:55 ` Rodolfo Giometti
@ 2013-10-11 8:42 ` Paul Chavent
2013-10-11 8:56 ` Rodolfo Giometti
0 siblings, 1 reply; 11+ messages in thread
From: Paul Chavent @ 2013-10-11 8:42 UTC (permalink / raw)
To: Rodolfo Giometti; +Cc: linux-kernel
[-- 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
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.
2013-10-11 8:42 ` Paul Chavent
@ 2013-10-11 8:56 ` Rodolfo Giometti
0 siblings, 0 replies; 11+ messages in thread
From: Rodolfo Giometti @ 2013-10-11 8:56 UTC (permalink / raw)
To: Paul Chavent; +Cc: linux-kernel
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: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-10-16 7:41 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 12:40 [PATCH] pps : add non blocking option to PPS_FETCH ioctl 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
-- strict thread matches above, loose matches on Subject: below --
2013-09-04 8:20 Paul Chavent
2013-09-06 6:55 ` Rodolfo Giometti
2013-10-11 8:42 ` Paul Chavent
2013-10-11 8:56 ` Rodolfo Giometti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox