mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-29 18:34:15 +00:00
timekeeping: Move ADJ_SETOFFSET to top level do_adjtimex()
Since ADJ_SETOFFSET adjusts the timekeeping state, process it as part of the top level do_adjtimex() function in timekeeping.c. This avoids deadlocks that could occur once we change the ntp locking rules. 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>
This commit is contained in:
parent
87ace39b71
commit
cef90377fa
2 changed files with 11 additions and 11 deletions
|
@ -666,17 +666,6 @@ int __do_adjtimex(struct timex *txc, struct timespec *ts, s32 *time_tai)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (txc->modes & ADJ_SETOFFSET) {
|
|
||||||
struct timespec delta;
|
|
||||||
delta.tv_sec = txc->time.tv_sec;
|
|
||||||
delta.tv_nsec = txc->time.tv_usec;
|
|
||||||
if (!(txc->modes & ADJ_NANO))
|
|
||||||
delta.tv_nsec *= 1000;
|
|
||||||
result = timekeeping_inject_offset(&delta);
|
|
||||||
if (result)
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
raw_spin_lock_irq(&ntp_lock);
|
raw_spin_lock_irq(&ntp_lock);
|
||||||
|
|
||||||
if (txc->modes & ADJ_ADJTIME) {
|
if (txc->modes & ADJ_ADJTIME) {
|
||||||
|
|
|
@ -1627,6 +1627,17 @@ int do_adjtimex(struct timex *txc)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (txc->modes & ADJ_SETOFFSET) {
|
||||||
|
struct timespec delta;
|
||||||
|
delta.tv_sec = txc->time.tv_sec;
|
||||||
|
delta.tv_nsec = txc->time.tv_usec;
|
||||||
|
if (!(txc->modes & ADJ_NANO))
|
||||||
|
delta.tv_nsec *= 1000;
|
||||||
|
ret = timekeeping_inject_offset(&delta);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
getnstimeofday(&ts);
|
getnstimeofday(&ts);
|
||||||
orig_tai = tai = timekeeping_get_tai_offset();
|
orig_tai = tai = timekeeping_get_tai_offset();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue