Skip to content

Commit 64764cf

Browse files
svens-s390Alexander Gordeev
authored andcommitted
s390/stp: Remove leap second support
With moving time steering to userspace, there's no need to handle leap seconds inside the kernel. Remove it. Signed-off-by: Sven Schnelle <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 94ecbf1 commit 64764cf

File tree

1 file changed

+0
-77
lines changed

1 file changed

+0
-77
lines changed

arch/s390/kernel/time.c

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -558,81 +558,6 @@ static int stp_sync_clock(void *data)
558558
return 0;
559559
}
560560

561-
static int stp_clear_leap(void)
562-
{
563-
struct __kernel_timex txc;
564-
int ret;
565-
566-
memset(&txc, 0, sizeof(txc));
567-
568-
ret = do_adjtimex(&txc);
569-
if (ret < 0)
570-
return ret;
571-
572-
txc.modes = ADJ_STATUS;
573-
txc.status &= ~(STA_INS|STA_DEL);
574-
return do_adjtimex(&txc);
575-
}
576-
577-
static void stp_check_leap(void)
578-
{
579-
struct stp_stzi stzi;
580-
struct stp_lsoib *lsoib = &stzi.lsoib;
581-
struct __kernel_timex txc;
582-
int64_t timediff;
583-
int leapdiff, ret;
584-
585-
if (!stp_info.lu || !check_sync_clock()) {
586-
/*
587-
* Either a scheduled leap second was removed by the operator,
588-
* or STP is out of sync. In both cases, clear the leap second
589-
* kernel flags.
590-
*/
591-
if (stp_clear_leap() < 0)
592-
pr_err("failed to clear leap second flags\n");
593-
return;
594-
}
595-
596-
if (chsc_stzi(stp_page, &stzi, sizeof(stzi))) {
597-
pr_err("stzi failed\n");
598-
return;
599-
}
600-
601-
timediff = tod_to_ns(lsoib->nlsout - get_tod_clock()) / NSEC_PER_SEC;
602-
leapdiff = lsoib->nlso - lsoib->also;
603-
604-
if (leapdiff != 1 && leapdiff != -1) {
605-
pr_err("Cannot schedule %d leap seconds\n", leapdiff);
606-
return;
607-
}
608-
609-
if (timediff < 0) {
610-
if (stp_clear_leap() < 0)
611-
pr_err("failed to clear leap second flags\n");
612-
} else if (timediff < 7200) {
613-
memset(&txc, 0, sizeof(txc));
614-
ret = do_adjtimex(&txc);
615-
if (ret < 0)
616-
return;
617-
618-
txc.modes = ADJ_STATUS;
619-
if (leapdiff > 0)
620-
txc.status |= STA_INS;
621-
else
622-
txc.status |= STA_DEL;
623-
ret = do_adjtimex(&txc);
624-
if (ret < 0)
625-
pr_err("failed to set leap second flags\n");
626-
/* arm Timer to clear leap second flags */
627-
mod_timer(&stp_timer, jiffies + secs_to_jiffies(14400));
628-
} else {
629-
/* The day the leap second is scheduled for hasn't been reached. Retry
630-
* in one hour.
631-
*/
632-
mod_timer(&stp_timer, jiffies + secs_to_jiffies(3600));
633-
}
634-
}
635-
636561
/*
637562
* STP work. Check for the STP state and take over the clock
638563
* synchronization if the STP clock source is usable.
@@ -674,8 +599,6 @@ static void stp_work_fn(struct work_struct *work)
674599
* Retry after a second.
675600
*/
676601
mod_timer(&stp_timer, jiffies + msecs_to_jiffies(MSEC_PER_SEC));
677-
else if (stp_info.lu)
678-
stp_check_leap();
679602

680603
out_unlock:
681604
mutex_unlock(&stp_mutex);

0 commit comments

Comments
 (0)