[PATCH] time/hrtimer: Use hrtimer_is_queued instead of accessingtimer bits directly

ying zuxin posted 1 patch 2 years, 7 months ago
kernel/time/hrtimer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] time/hrtimer: Use hrtimer_is_queued instead of accessingtimer bits directly
Posted by ying zuxin 2 years, 7 months ago
hrtimer_is_queued() offers an atomic method to check
whether the timer is on one of the queues, so there is no need
to access the timer bits directly.

Signed-off-by: ying zuxin <yingzuxin@vivo.com>
---
 kernel/time/hrtimer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 238262e4aba7..9ffc54fe58dd 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1047,7 +1047,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
 	if (delta < 0)
 		return 0;
 
-	if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED))
+	if (WARN_ON(hrtimer_is_queued(timer)))
 		return 0;
 
 	if (interval < hrtimer_resolution)
@@ -1701,7 +1701,7 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
 	 * for us already.
 	 */
 	if (restart != HRTIMER_NORESTART &&
-	    !(timer->state & HRTIMER_STATE_ENQUEUED))
+		!hrtimer_is_queued(timer))
 		enqueue_hrtimer(timer, base, HRTIMER_MODE_ABS);
 
 	/*
-- 
2.39.0