mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Mariusz Skamra <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mariuszx.skamra@intel.com, hpa@zytor.com, tglx@linutronix.de,
	linux-kernel@vger.kernel.org,
	sathyanarayanan.kuppuswamy@intel.com, mingo@kernel.org
Subject: [tip:timers/core] ktime: Simplify ktime_compare implementation
Date: Tue, 20 Jun 2017 12:38:17 -0700	[thread overview]
Message-ID: <tip-3f1d472055bbe914c9e54715fdbf2272851e23ff@git.kernel.org> (raw)
In-Reply-To: <1495803647-9504-1-git-send-email-mariuszx.skamra@intel.com>

Commit-ID:  3f1d472055bbe914c9e54715fdbf2272851e23ff
Gitweb:     http://git.kernel.org/tip/3f1d472055bbe914c9e54715fdbf2272851e23ff
Author:     Mariusz Skamra <mariuszx.skamra@intel.com>
AuthorDate: Fri, 26 May 2017 15:00:47 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
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 <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

---
 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);
 }
 
 /**

  parent reply	other threads:[~2017-06-20 19:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 13:00 [PATCH v2] " 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-bot for Mariusz Skamra [this message]
2017-06-26  6:52 ` [PATCH v2] ktime: Simplify ktime_compare implementation Thierry Reding
2017-06-26  8:45   ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-3f1d472055bbe914c9e54715fdbf2272851e23ff@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mariuszx.skamra@intel.com \
    --cc=mingo@kernel.org \
    --cc=sathyanarayanan.kuppuswamy@intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®