diff mbox series

xen: use time_is_before_eq_jiffies() instead of open coding it

Message ID 1646018104-61415-1-git-send-email-wangqing@vivo.com (mailing list archive)
State Accepted
Commit 393b48b8cdc66e1e2a504e0d934357da3047598c
Headers show
Series xen: use time_is_before_eq_jiffies() instead of open coding it | expand

Commit Message

王擎 Feb. 28, 2022, 3:15 a.m. UTC
From: Wang Qing <wangqing@vivo.com>

Use the helper function time_is_{before,after}_jiffies() to improve
code readability.

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 drivers/xen/balloon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Boris Ostrovsky March 11, 2022, 2:18 p.m. UTC | #1
On 2/27/22 10:15 PM, Qing Wang wrote:
> From: Wang Qing <wangqing@vivo.com>
>
> Use the helper function time_is_{before,after}_jiffies() to improve
> code readability.
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>


Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>


Applied to for-linus-5.18
diff mbox series

Patch

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index a2c4fc49..dfe26fa
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -59,6 +59,7 @@ 
 #include <linux/slab.h>
 #include <linux/sysctl.h>
 #include <linux/moduleparam.h>
+#include <linux/jiffies.h>
 
 #include <asm/page.h>
 #include <asm/tlb.h>
@@ -794,7 +795,7 @@  static int __init balloon_wait_finish(void)
 		if (balloon_state == BP_ECANCELED) {
 			pr_warn_once("Initial ballooning failed, %ld pages need to be freed.\n",
 				     -credit);
-			if (jiffies - last_changed >= HZ * balloon_boot_timeout)
+			if (time_is_before_eq_jiffies(last_changed + HZ * balloon_boot_timeout))
 				panic("Initial ballooning failed!\n");
 		}