Commit-ID:  3f1d472055bbe914c9e54715fdbf2272851e23ff
Gitweb:     http://git.kernel.org/tip/3f1d472055bbe914c9e54715fdbf2272851e23ff
Author:     Mariusz Skamra <[email protected]>
AuthorDate: Fri, 26 May 2017 15:00:47 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Tue, 20 Jun 2017 21:33:55 +0200

ktime: Simplify ktime_compare implementation

ktime_sub can be used here instread of two conditional checks.

Signed-off-by: Mariusz Skamra <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Kuppuswamy Sathyanarayanan <[email protected]>
Link: 
http://lkml.kernel.org/r/[email protected]

---
 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 0c8bd45..04817b1 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);
 }
 
 /**

Reply via email to