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 <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
Sven Schnelle 2025-04-25 10:39:44 +02:00 committed by Alexander Gordeev
parent 94ecbf1e71
commit 64764cf6d0

View 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);