diff options
author | Asaf Vertz <asaf.vertz@tandemg.com> | 2014-12-14 03:49:47 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-01-27 09:55:28 -0200 |
commit | 3edd59abb0ad2142954eff6bb430a9020477f539 (patch) | |
tree | f00ddbb2d9f6aa17d33e58e9b09c0054b677b278 /drivers/media | |
parent | a6c896c1b25d17e3098dbc295434925a04a5911e (diff) |
[media] media: stb0899_drv: use time_after()
To be future-proof and for better readability the time comparisons are
modified to use time_after() instead of plain, error-prone math.
Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb-frontends/stb0899_drv.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c index 19646fbb061d..c73899d3a53d 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.c +++ b/drivers/media/dvb-frontends/stb0899_drv.c @@ -20,6 +20,7 @@ */ #include <linux/init.h> +#include <linux/jiffies.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> @@ -691,7 +692,7 @@ static int stb0899_wait_diseqc_fifo_empty(struct stb0899_state *state, int timeo reg = stb0899_read_reg(state, STB0899_DISSTATUS); if (!STB0899_GETFIELD(FIFOFULL, reg)) break; - if ((jiffies - start) > timeout) { + if (time_after(jiffies, start + timeout)) { dprintk(state->verbose, FE_ERROR, 1, "timed out !!"); return -ETIMEDOUT; } @@ -733,7 +734,7 @@ static int stb0899_wait_diseqc_rxidle(struct stb0899_state *state, int timeout) while (!STB0899_GETFIELD(RXEND, reg)) { reg = stb0899_read_reg(state, STB0899_DISRX_ST0); - if (jiffies - start > timeout) { + if (time_after(jiffies, start + timeout)) { dprintk(state->verbose, FE_ERROR, 1, "timed out!!"); return -ETIMEDOUT; } @@ -782,7 +783,7 @@ static int stb0899_wait_diseqc_txidle(struct stb0899_state *state, int timeout) while (!STB0899_GETFIELD(TXIDLE, reg)) { reg = stb0899_read_reg(state, STB0899_DISSTATUS); - if (jiffies - start > timeout) { + if (time_after(jiffies, start + timeout)) { dprintk(state->verbose, FE_ERROR, 1, "timed out!!"); return -ETIMEDOUT; } |