ptp: provide the clock's adjusted frequency
authorRichard Cochran <richardcochran@gmail.com>
Sat, 22 Sep 2012 07:02:02 +0000 (07:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 22 Sep 2012 19:42:08 +0000 (15:42 -0400)
If the timex.mode field indicates a query, then we provide the value of
the current frequency adjustment.

[ Get rid of extraneous empty lines -DaveM ]

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_clock.c

index 67e628ee0365c161cfd2b90658051396fba842d1..c470ddf1a6fa878a0e6dca07de3bdd662d9e76c0 100644 (file)
@@ -143,11 +143,12 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx)
                kt = timespec_to_ktime(ts);
                delta = ktime_to_ns(kt);
                err = ops->adjtime(ops, delta);
-
        } else if (tx->modes & ADJ_FREQUENCY) {
-
                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;