Patchwork [net-next,2/3] ptp: provide the clock's adjusted frequency

login
register
mail settings
Submitter Richard Cochran
Date Sept. 21, 2012, 5 p.m.
Message ID <fa133ada6c2f42ebe4f83998b7f3480b1a3b1f26.1348245523.git.richardcochran@gmail.com>
Download mbox | patch
Permalink /patch/185839/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Richard Cochran - Sept. 21, 2012, 5 p.m.
If the timex.mode field indicates a query, then we provide the value of
the current frequency adjustment.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/ptp/ptp_clock.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index fbd7104..6e47450 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -148,6 +148,11 @@  static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx)
 
 		err = ops->adjfreq(ops, scaled_ppm_to_ppb(tx->freq));
 		ptp->dialed_frequency = tx->freq;
+
+	} else if (tx->modes == 0) {
+
+		tx->freq = ptp->dialed_frequency;
+		err = 0;
 	}
 
 	return err;