Skip to content

Commit

Permalink
ktime: Simplify ktime_compare implementation
Browse files Browse the repository at this point in the history
ktime_sub can be used here instread of two conditional checks.

Signed-off-by: Mariusz Skamra <mariuszx.skamra@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@intel.com>
Link: http://lkml.kernel.org/r/1495803647-9504-1-git-send-email-mariuszx.skamra@intel.com
  • Loading branch information
Mariusz Skamra authored and Thomas Gleixner committed Jun 20, 2017
1 parent e707eb7 commit 3f1d472
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions include/linux/ktime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 3f1d472

Please sign in to comment.