* [PATCH] rsxx: fix time comparison
@ 2015-01-07 7:38 Asaf Vertz
0 siblings, 0 replies; only message in thread
From: Asaf Vertz @ 2015-01-07 7:38 UTC (permalink / raw)
To: josh.h.morris; +Cc: pjk1939, linux-kernel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-01-07 7:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-07 7:38 [PATCH] rsxx: fix time comparison Asaf Vertz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.