aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/timekeeping.c
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2013-03-22 17:20:03 -0400
committerJohn Stultz <john.stultz@linaro.org>2013-04-04 16:18:16 -0400
commit0b5154fb9040cca94e7d9893384c0e78bfe2d296 (patch)
tree56f00530b6f99159d478ed48771a2fd97b26c5f1 /kernel/time/timekeeping.c
parent06c017fdd4dc48451a29ac37fc1db4a3f86b7f40 (diff)
timekeeping: Simplify tai updating from do_adjtimex
Since we are taking the timekeeping locks, just go ahead and update any tai change directly, rather then dropping the lock and calling a function that will just take it again. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Prarit Bhargava <prarit@redhat.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time/timekeeping.c')
-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