aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/ntp.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r--kernel/time/ntp.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 419a52cecd20..33db43a39515 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -165,21 +165,21 @@ static inline void pps_set_freq(s64 freq)
165 165
166static inline int is_error_status(int status) 166static inline int is_error_status(int status)
167{ 167{
168 return (time_status & (STA_UNSYNC|STA_CLOCKERR)) 168 return (status & (STA_UNSYNC|STA_CLOCKERR))
169 /* PPS signal lost when either PPS time or 169 /* PPS signal lost when either PPS time or
170 * PPS frequency synchronization requested 170 * PPS frequency synchronization requested
171 */ 171 */
172 || ((time_status & (STA_PPSFREQ|STA_PPSTIME)) 172 || ((status & (STA_PPSFREQ|STA_PPSTIME))
173 && !(time_status & STA_PPSSIGNAL)) 173 && !(status & STA_PPSSIGNAL))
174 /* PPS jitter exceeded when 174 /* PPS jitter exceeded when
175 * PPS time synchronization requested */ 175 * PPS time synchronization requested */
176 || ((time_status & (STA_PPSTIME|STA_PPSJITTER)) 176 || ((status & (STA_PPSTIME|STA_PPSJITTER))
177 == (STA_PPSTIME|STA_PPSJITTER)) 177 == (STA_PPSTIME|STA_PPSJITTER))
178 /* PPS wander exceeded or calibration error when 178 /* PPS wander exceeded or calibration error when
179 * PPS frequency synchronization requested 179 * PPS frequency synchronization requested
180 */ 180 */
181 || ((time_status & STA_PPSFREQ) 181 || ((status & STA_PPSFREQ)
182 && (time_status & (STA_PPSWANDER|STA_PPSERROR))); 182 && (status & (STA_PPSWANDER|STA_PPSERROR)));
183} 183}
184 184
185static inline void pps_fill_timex(struct timex *txc) 185static inline void pps_fill_timex(struct timex *txc)
@@ -786,8 +786,9 @@ static long hardpps_update_freq(struct pps_normtime freq_norm)
786 time_status |= STA_PPSERROR; 786 time_status |= STA_PPSERROR;
787 pps_errcnt++; 787 pps_errcnt++;
788 pps_dec_freq_interval(); 788 pps_dec_freq_interval();
789 pr_err("hardpps: PPSERROR: interval too long - %ld s\n", 789 printk_deferred(KERN_ERR
790 freq_norm.sec); 790 "hardpps: PPSERROR: interval too long - %ld s\n",
791 freq_norm.sec);
791 return 0; 792 return 0;
792 } 793 }
793 794
@@ -800,7 +801,8 @@ static long hardpps_update_freq(struct pps_normtime freq_norm)
800 delta = shift_right(ftemp - pps_freq, NTP_SCALE_SHIFT); 801 delta = shift_right(ftemp - pps_freq, NTP_SCALE_SHIFT);
801 pps_freq = ftemp; 802 pps_freq = ftemp;
802 if (delta > PPS_MAXWANDER || delta < -PPS_MAXWANDER) { 803 if (delta > PPS_MAXWANDER || delta < -PPS_MAXWANDER) {
803 pr_warning("hardpps: PPSWANDER: change=%ld\n", delta); 804 printk_deferred(KERN_WARNING
805 "hardpps: PPSWANDER: change=%ld\n", delta);
804 time_status |= STA_PPSWANDER; 806 time_status |= STA_PPSWANDER;
805 pps_stbcnt++; 807 pps_stbcnt++;
806 pps_dec_freq_interval(); 808 pps_dec_freq_interval();
@@ -844,8 +846,9 @@ static void hardpps_update_phase(long error)
844 * the time offset is updated. 846 * the time offset is updated.
845 */ 847 */
846 if (jitter > (pps_jitter << PPS_POPCORN)) { 848 if (jitter > (pps_jitter << PPS_POPCORN)) {
847 pr_warning("hardpps: PPSJITTER: jitter=%ld, limit=%ld\n", 849 printk_deferred(KERN_WARNING
848 jitter, (pps_jitter << PPS_POPCORN)); 850 "hardpps: PPSJITTER: jitter=%ld, limit=%ld\n",
851 jitter, (pps_jitter << PPS_POPCORN));
849 time_status |= STA_PPSJITTER; 852 time_status |= STA_PPSJITTER;
850 pps_jitcnt++; 853 pps_jitcnt++;
851 } else if (time_status & STA_PPSTIME) { 854 } else if (time_status & STA_PPSTIME) {
@@ -902,7 +905,7 @@ void __hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
902 time_status |= STA_PPSJITTER; 905 time_status |= STA_PPSJITTER;
903 /* restart the frequency calibration interval */ 906 /* restart the frequency calibration interval */
904 pps_fbase = *raw_ts; 907 pps_fbase = *raw_ts;
905 pr_err("hardpps: PPSJITTER: bad pulse\n"); 908 printk_deferred(KERN_ERR "hardpps: PPSJITTER: bad pulse\n");
906 return; 909 return;
907 } 910 }
908 911
@@ -923,7 +926,10 @@ void __hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
923 926
924static int __init ntp_tick_adj_setup(char *str) 927static int __init ntp_tick_adj_setup(char *str)
925{ 928{
926 ntp_tick_adj = simple_strtol(str, NULL, 0); 929 int rc = kstrtol(str, 0, (long *)&ntp_tick_adj);
930
931 if (rc)
932 return rc;
927 ntp_tick_adj <<= NTP_SCALE_SHIFT; 933 ntp_tick_adj <<= NTP_SCALE_SHIFT;
928 934
929 return 1; 935 return 1;