mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ktime: Simplify ktime_compare implementation
@ 2017-05-26 13:00 Mariusz Skamra
  2017-06-12  7:04 ` [lkp-robot] [ktime] 02c180b3d0: INFO:ltp-pan_reported_some_tests_FAIL kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mariusz Skamra @ 2017-05-26 13:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, Mariusz Skamra

ktime_sub can be used here instread of two conditional checks.

Signed-off-by: Mariusz Skamra <mariuszx.skamra@intel.com>
Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@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 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);
 }
 
 /**
-- 
2.1.4

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-26  8:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 13:00 [PATCH v2] ktime: Simplify ktime_compare implementation Mariusz Skamra
2017-06-12  7:04 ` [lkp-robot] [ktime] 02c180b3d0: INFO:ltp-pan_reported_some_tests_FAIL kernel test robot
2017-06-20 19:38 ` [tip:timers/core] ktime: Simplify ktime_compare implementation tip-bot for Mariusz Skamra
2017-06-26  6:52 ` [PATCH v2] " Thierry Reding
2017-06-26  8:45   ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®