mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PTP] Implement clock_getres() function correctly
@ 2011-12-04 17:06 Thomas Gleixner
  2011-12-04 17:07 ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2011-12-04 17:06 UTC (permalink / raw)
  To: LKML; +Cc: Richard Cochran, John Stultz

clock_getres() needs to put the resolution into the provided timespec
and return 0 in case of success.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
---
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index cf3f999..6b0c02a 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -101,7 +101,10 @@ static s32 scaled_ppm_to_ppb(long ppm)
 
 static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
 {
-	return 1; /* always round timer functions to one nanosecond */
+	/* Resolution is one nanosecond */
+	*tp.tv_sec = 0;
+	*tp.tv_nsec = 1;
+	return 0;
 }
 
 static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PTP] Implement clock_getres() function correctly
  2011-12-04 17:06 [PTP] Implement clock_getres() function correctly Thomas Gleixner
@ 2011-12-04 17:07 ` Thomas Gleixner
  2011-12-05  7:31   ` Richard Cochran
  2011-12-05 19:02   ` John Stultz
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Gleixner @ 2011-12-04 17:07 UTC (permalink / raw)
  To: LKML; +Cc: Richard Cochran, John Stultz

On Sun, 4 Dec 2011, Thomas Gleixner wrote:

> clock_getres() needs to put the resolution into the provided timespec
> and return 0 in case of success.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: stable@vger.kernel.org

Gah, wrong version.

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index cf3f999..6b0c02a 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -101,7 +101,10 @@ static s32 scaled_ppm_to_ppb(long ppm)
 
 static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
 {
-	return 1; /* always round timer functions to one nanosecond */
+	/* Resolution is one nanosecond */
+	tp->tv_sec = 0;
+	tp->tv_nsec = 1;
+	return 0;
 }
 
 static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PTP] Implement clock_getres() function correctly
  2011-12-04 17:07 ` Thomas Gleixner
@ 2011-12-05  7:31   ` Richard Cochran
  2011-12-05 19:02   ` John Stultz
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Cochran @ 2011-12-05  7:31 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, John Stultz

On Sun, Dec 04, 2011 at 06:07:43PM +0100, Thomas Gleixner wrote:
> On Sun, 4 Dec 2011, Thomas Gleixner wrote:
> 
> > clock_getres() needs to put the resolution into the provided timespec
> > and return 0 in case of success.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Cc: stable@vger.kernel.org
> 
> Gah, wrong version.

Thanks for spotting that weird left over (from the old posix-timer.c
code).

Acked-by: Richard Cochran <richardcochran@gmail.com>

BTW, my email address has changed. Did you see my patch for
MAINTAINERS a few weeks back? It would help when finding the current
email address.

Thanks,
Richard

 
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index cf3f999..6b0c02a 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -101,7 +101,10 @@ static s32 scaled_ppm_to_ppb(long ppm)
>  
>  static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
>  {
> -	return 1; /* always round timer functions to one nanosecond */
> +	/* Resolution is one nanosecond */
> +	tp->tv_sec = 0;
> +	tp->tv_nsec = 1;
> +	return 0;
>  }
>  
>  static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PTP] Implement clock_getres() function correctly
  2011-12-04 17:07 ` Thomas Gleixner
  2011-12-05  7:31   ` Richard Cochran
@ 2011-12-05 19:02   ` John Stultz
  1 sibling, 0 replies; 4+ messages in thread
From: John Stultz @ 2011-12-05 19:02 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Richard Cochran

On Sun, 2011-12-04 at 18:07 +0100, Thomas Gleixner wrote:
> On Sun, 4 Dec 2011, Thomas Gleixner wrote:
> 
> > clock_getres() needs to put the resolution into the provided timespec
> > and return 0 in case of success.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Cc: stable@vger.kernel.org
> 
> Gah, wrong version.
> 
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index cf3f999..6b0c02a 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -101,7 +101,10 @@ static s32 scaled_ppm_to_ppb(long ppm)
> 
>  static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
>  {
> -	return 1; /* always round timer functions to one nanosecond */
> +	/* Resolution is one nanosecond */
> +	tp->tv_sec = 0;
> +	tp->tv_nsec = 1;
> +	return 0;
>  }
> 
>  static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)


Looks good.

Acked-by: John Stultz <john.stultz@linaro.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-05 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-04 17:06 [PTP] Implement clock_getres() function correctly Thomas Gleixner
2011-12-04 17:07 ` Thomas Gleixner
2011-12-05  7:31   ` Richard Cochran
2011-12-05 19:02   ` John Stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®