Skip to content

Commit

Permalink
clock_adjtime: use small lock to protect g_adjtime_ppb g_adjtime_wdog
Browse files Browse the repository at this point in the history
reason:
We would like to replace the critical section with a small lock.

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Dec 11, 2024
1 parent 5607eec commit d88c2de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sched/clock/clock_adjtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

static struct wdog_s g_adjtime_wdog;
static long g_adjtime_ppb;
static spinlock_t g_adjtime_lock = SP_UNLOCKED;

/****************************************************************************
* Private Functions
Expand Down Expand Up @@ -108,7 +109,7 @@ static int adjtime_start(long long adjust_usec)
ppb = -ppb_limit;
}

flags = enter_critical_section();
flags = spin_lock_irqsave(&g_adjtime_lock);

/* Set new adjustment */

Expand All @@ -134,7 +135,7 @@ static int adjtime_start(long long adjust_usec)
wd_cancel(&g_adjtime_wdog);
}

leave_critical_section(flags);
spin_unlock_irqrestore(&g_adjtime_lock, flags);

return ret;
}
Expand Down

0 comments on commit d88c2de

Please sign in to comment.