ntp: Cleanup formatting of code
authorAnna-Maria Behnsen <anna-maria@linutronix.de>
Wed, 11 Sep 2024 13:17:40 +0000 (15:17 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 2 Oct 2024 14:53:38 +0000 (16:53 +0200)
Code is partially formatted in a creative way which makes reading
harder. Examples are function calls over several lines where the
indentation does not start at the same height then the open bracket after
the function name.

Improve formatting but do not make a functional change.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-4-2d52f4e13476@linutronix.de
kernel/time/ntp.c

index e78d3cd1ec321b04e4a18f40baf6b0d08f4f33e5..bf2f6ee23a2ece05deef263fa11dfd0d333e4986 100644 (file)
@@ -428,8 +428,7 @@ int second_overflow(time64_t secs)
                } else if (secs == ntp_next_leap_sec) {
                        leap = -1;
                        time_state = TIME_OOP;
-                       printk(KERN_NOTICE
-                               "Clock: inserting leap second 23:59:60 UTC\n");
+                       pr_notice("Clock: inserting leap second 23:59:60 UTC\n");
                }
                break;
        case TIME_DEL:
@@ -440,8 +439,7 @@ int second_overflow(time64_t secs)
                        leap = 1;
                        ntp_next_leap_sec = TIME64_MAX;
                        time_state = TIME_WAIT;
-                       printk(KERN_NOTICE
-                               "Clock: deleting leap second 23:59:59 UTC\n");
+                       pr_notice("Clock: deleting leap second 23:59:59 UTC\n");
                }
                break;
        case TIME_OOP:
@@ -842,10 +840,8 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts,
                        txc->tai--;
                        txc->time.tv_sec++;
                }
-               if ((time_state == TIME_OOP) &&
-                                       (ts->tv_sec == ntp_next_leap_sec)) {
+               if ((time_state == TIME_OOP) && (ts->tv_sec == ntp_next_leap_sec))
                        result = TIME_WAIT;
-               }
        }
 
        return result;
@@ -952,9 +948,8 @@ static long hardpps_update_freq(struct pps_normtime freq_norm)
                time_status |= STA_PPSERROR;
                pps_errcnt++;
                pps_dec_freq_interval();
-               printk_deferred(KERN_ERR
-                       "hardpps: PPSERROR: interval too long - %lld s\n",
-                       freq_norm.sec);
+               printk_deferred(KERN_ERR "hardpps: PPSERROR: interval too long - %lld s\n",
+                               freq_norm.sec);
                return 0;
        }
 
@@ -968,8 +963,7 @@ static long hardpps_update_freq(struct pps_normtime freq_norm)
        delta = shift_right(ftemp - pps_freq, NTP_SCALE_SHIFT);
        pps_freq = ftemp;
        if (delta > PPS_MAXWANDER || delta < -PPS_MAXWANDER) {
-               printk_deferred(KERN_WARNING
-                               "hardpps: PPSWANDER: change=%ld\n", delta);
+               printk_deferred(KERN_WARNING "hardpps: PPSWANDER: change=%ld\n", delta);
                time_status |= STA_PPSWANDER;
                pps_stbcnt++;
                pps_dec_freq_interval();
@@ -985,13 +979,11 @@ static long hardpps_update_freq(struct pps_normtime freq_norm)
        delta_mod = delta;
        if (delta_mod < 0)
                delta_mod = -delta_mod;
-       pps_stabil += (div_s64(((s64)delta_mod) <<
-                               (NTP_SCALE_SHIFT - SHIFT_USEC),
-                               NSEC_PER_USEC) - pps_stabil) >> PPS_INTMIN;
+       pps_stabil += (div_s64(((s64)delta_mod) << (NTP_SCALE_SHIFT - SHIFT_USEC),
+                              NSEC_PER_USEC) - pps_stabil) >> PPS_INTMIN;
 
        /* If enabled, the system clock frequency is updated */
-       if ((time_status & STA_PPSFREQ) != 0 &&
-           (time_status & STA_FREQHOLD) == 0) {
+       if ((time_status & STA_PPSFREQ) && !(time_status & STA_FREQHOLD)) {
                time_freq = pps_freq;
                ntp_update_frequency();
        }
@@ -1015,15 +1007,13 @@ static void hardpps_update_phase(long error)
         * the time offset is updated.
         */
        if (jitter > (pps_jitter << PPS_POPCORN)) {
-               printk_deferred(KERN_WARNING
-                               "hardpps: PPSJITTER: jitter=%ld, limit=%ld\n",
+               printk_deferred(KERN_WARNING "hardpps: PPSJITTER: jitter=%ld, limit=%ld\n",
                                jitter, (pps_jitter << PPS_POPCORN));
                time_status |= STA_PPSJITTER;
                pps_jitcnt++;
        } else if (time_status & STA_PPSTIME) {
                /* Correct the time using the phase offset */
-               time_offset = div_s64(((s64)correction) << NTP_SCALE_SHIFT,
-                               NTP_INTERVAL_FREQ);
+               time_offset = div_s64(((s64)correction) << NTP_SCALE_SHIFT, NTP_INTERVAL_FREQ);
                /* Cancel running adjtime() */
                time_adjust = 0;
        }
@@ -1072,9 +1062,8 @@ void __hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_t
         * Check that the signal is in the range
         * [1s - MAXFREQ us, 1s + MAXFREQ us], otherwise reject it
         */
-       if ((freq_norm.sec == 0) ||
-                       (freq_norm.nsec > MAXFREQ * freq_norm.sec) ||
-                       (freq_norm.nsec < -MAXFREQ * freq_norm.sec)) {
+       if ((freq_norm.sec == 0) || (freq_norm.nsec > MAXFREQ * freq_norm.sec) ||
+           (freq_norm.nsec < -MAXFREQ * freq_norm.sec)) {
                time_status |= STA_PPSJITTER;
                /* Restart the frequency calibration interval */
                pps_fbase = *raw_ts;