]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/stp: Remove leap second support
authorSven Schnelle <svens@linux.ibm.com>
Fri, 25 Apr 2025 08:39:44 +0000 (10:39 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Mon, 21 Jul 2025 10:41:55 +0000 (12:41 +0200)
With moving time steering to userspace, there's no need
to handle leap seconds inside the kernel. Remove it.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/kernel/time.c

index 02c7bebd0b3cad0e3fa1da4fe4abfc8c5f37387c..5a021b6dbb3ab38966baaa62933b2411fcfc5d90 100644 (file)
@@ -558,81 +558,6 @@ static int stp_sync_clock(void *data)
        return 0;
 }
 
-static int stp_clear_leap(void)
-{
-       struct __kernel_timex txc;
-       int ret;
-
-       memset(&txc, 0, sizeof(txc));
-
-       ret = do_adjtimex(&txc);
-       if (ret < 0)
-               return ret;
-
-       txc.modes = ADJ_STATUS;
-       txc.status &= ~(STA_INS|STA_DEL);
-       return do_adjtimex(&txc);
-}
-
-static void stp_check_leap(void)
-{
-       struct stp_stzi stzi;
-       struct stp_lsoib *lsoib = &stzi.lsoib;
-       struct __kernel_timex txc;
-       int64_t timediff;
-       int leapdiff, ret;
-
-       if (!stp_info.lu || !check_sync_clock()) {
-               /*
-                * Either a scheduled leap second was removed by the operator,
-                * or STP is out of sync. In both cases, clear the leap second
-                * kernel flags.
-                */
-               if (stp_clear_leap() < 0)
-                       pr_err("failed to clear leap second flags\n");
-               return;
-       }
-
-       if (chsc_stzi(stp_page, &stzi, sizeof(stzi))) {
-               pr_err("stzi failed\n");
-               return;
-       }
-
-       timediff = tod_to_ns(lsoib->nlsout - get_tod_clock()) / NSEC_PER_SEC;
-       leapdiff = lsoib->nlso - lsoib->also;
-
-       if (leapdiff != 1 && leapdiff != -1) {
-               pr_err("Cannot schedule %d leap seconds\n", leapdiff);
-               return;
-       }
-
-       if (timediff < 0) {
-               if (stp_clear_leap() < 0)
-                       pr_err("failed to clear leap second flags\n");
-       } else if (timediff < 7200) {
-               memset(&txc, 0, sizeof(txc));
-               ret = do_adjtimex(&txc);
-               if (ret < 0)
-                       return;
-
-               txc.modes = ADJ_STATUS;
-               if (leapdiff > 0)
-                       txc.status |= STA_INS;
-               else
-                       txc.status |= STA_DEL;
-               ret = do_adjtimex(&txc);
-               if (ret < 0)
-                       pr_err("failed to set leap second flags\n");
-               /* arm Timer to clear leap second flags */
-               mod_timer(&stp_timer, jiffies + secs_to_jiffies(14400));
-       } else {
-               /* The day the leap second is scheduled for hasn't been reached. Retry
-                * in one hour.
-                */
-               mod_timer(&stp_timer, jiffies + secs_to_jiffies(3600));
-       }
-}
-
 /*
  * STP work. Check for the STP state and take over the clock
  * synchronization if the STP clock source is usable.
@@ -674,8 +599,6 @@ static void stp_work_fn(struct work_struct *work)
                 * Retry after a second.
                 */
                mod_timer(&stp_timer, jiffies + msecs_to_jiffies(MSEC_PER_SEC));
-       else if (stp_info.lu)
-               stp_check_leap();
 
 out_unlock:
        mutex_unlock(&stp_mutex);