From 3f1d472055bbe914c9e54715fdbf2272851e23ff Mon Sep 17 00:00:00 2001 From: Mariusz Skamra Date: Fri, 26 May 2017 15:00:47 +0200 Subject: [PATCH] ktime: Simplify ktime_compare implementation ktime_sub can be used here instread of two conditional checks. Signed-off-by: Mariusz Skamra Signed-off-by: Thomas Gleixner Acked-by: Kuppuswamy Sathyanarayanan Link: http://lkml.kernel.org/r/1495803647-9504-1-git-send-email-mariuszx.skamra@intel.com --- include/linux/ktime.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 0c8bd45c8206..04817b1ca019 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -108,11 +108,7 @@ static inline ktime_t timeval_to_ktime(struct timeval tv) */ static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2) { - if (cmp1 < cmp2) - return -1; - if (cmp1 > cmp2) - return 1; - return 0; + return ktime_sub(cmp1, cmp2); } /** -- 2.20.1