From: Asaf Vertz <asaf.vertz@tandemg.com>
To: josh.h.morris@us.ibm.com
Cc: pjk1939@linux.vnet.ibm.com, linux-kernel@vger.kernel.org
Subject: [PATCH] rsxx: fix time comparison
Date: Wed, 7 Jan 2015 09:38:34 +0200 [thread overview]
Message-ID: <20150107073834.GA9215@ubuntu> (raw)
To be future-proof and for better readability the time comparisons are
modified to use time_before() instead of plain, error-prone math.
Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
---
drivers/block/rsxx/core.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index d8b2488..ea527e8 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/reboot.h>
@@ -513,8 +514,8 @@ static void card_event_handler(struct work_struct *work)
static int card_shutdown(struct rsxx_cardinfo *card)
{
unsigned int state;
- signed long start;
- const int timeout = msecs_to_jiffies(120000);
+ unsigned long start;
+ const unsigned long timeout = msecs_to_jiffies(120000);
int st;
/* We can't issue a shutdown if the card is in a transition state */
@@ -524,7 +525,7 @@ static int card_shutdown(struct rsxx_cardinfo *card)
if (st)
return st;
} while (state == CARD_STATE_STARTING &&
- (jiffies - start < timeout));
+ time_before(jiffies, start + timeout));
if (state == CARD_STATE_STARTING)
return -ETIMEDOUT;
@@ -543,7 +544,7 @@ static int card_shutdown(struct rsxx_cardinfo *card)
if (st)
return st;
} while (state != CARD_STATE_SHUTDOWN &&
- (jiffies - start < timeout));
+ time_before(jiffies, start + timeout));
if (state != CARD_STATE_SHUTDOWN)
return -ETIMEDOUT;
--
1.7.0.4
reply other threads:[~2015-01-07 7:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20150107073834.GA9215@ubuntu \
--to=asaf.vertz@tandemg.com \
--cc=josh.h.morris@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pjk1939@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).