aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/time/timekeeping.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d10bd734b151..f93f60cd97ad 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1618,9 +1618,10 @@ EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset);
1618 */ 1618 */
1619int do_adjtimex(struct timex *txc) 1619int do_adjtimex(struct timex *txc)
1620{ 1620{
1621 struct timekeeper *tk = &timekeeper;
1621 unsigned long flags; 1622 unsigned long flags;
1622 struct timespec ts; 1623 struct timespec ts;
1623 s32 tai, orig_tai; 1624 s32 tai;
1624 int ret; 1625 int ret;
1625 1626
1626 /* Validate the data before disabling interrupts */ 1627 /* Validate the data before disabling interrupts */
@@ -1640,19 +1641,17 @@ int do_adjtimex(struct timex *txc)
1640 } 1641 }
1641 1642
1642 getnstimeofday(&ts); 1643 getnstimeofday(&ts);
1643 orig_tai = tai = timekeeping_get_tai_offset();
1644 1644
1645 raw_spin_lock_irqsave(&timekeeper_lock, flags); 1645 raw_spin_lock_irqsave(&timekeeper_lock, flags);
1646 write_seqcount_begin(&timekeeper_seq); 1646 write_seqcount_begin(&timekeeper_seq);
1647 1647
1648 tai = tk->tai_offset;
1648 ret = __do_adjtimex(txc, &ts, &tai); 1649 ret = __do_adjtimex(txc, &ts, &tai);
1649 1650
1651 __timekeeping_set_tai_offset(tk, tai);
1650 write_seqcount_end(&timekeeper_seq); 1652 write_seqcount_end(&timekeeper_seq);
1651 raw_spin_unlock_irqrestore(&timekeeper_lock, flags); 1653 raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
1652 1654
1653 if (tai != orig_tai)
1654 timekeeping_set_tai_offset(tai);
1655
1656 return ret; 1655 return ret;
1657} 1656}
1658 1657