media: si21xx: use time_after_eq() instead of jiffies judgment
PATCH 1/1 media: si21xx: use time_after_eq() instead of jiffies judgment
From: Wang Qing <[email protected]>
It is better to use time_xxx() directly instead of jiffies judgment for understanding.
--- drivers/media/dvb-frontends/si21xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/si21xx.c +1 -1
@@ -336,7 +336,7 @@ static int si21xx_wait_diseqc_idle(struct si21xx_state *state, int timeout)dprintk ("%s\n" , __func__);while ((si21_readreg (state,LNB_CTRL_REG_1 ) &0x8 ) ==8 ) { -if (jiffies - start > timeout) { +if (time_after (jiffies, start + timeout)) {dprintk ("%s: timeout!!\n" , __func__);return -ETIMEDOUT ; }
Signature · 1 line
2.7.4
Quoted 4 lines · Qing Wang
From: Wang Qing <[email protected]>
It is better to use
time_xxx()directly instead of jiffies judgment for understanding.
[]
drivers/media/dvb-frontends/si21xx.c
Quoted 1 line
drivers/media/dvb-frontends/si21xx.c +0
-0
[]
drivers/media/dvb-frontends/si21xx.c static int si21xx_wait_diseqc_idle(struct si21xx_state *state, int timeout) · line 342
Quoted 9 lines
drivers/media/dvb-frontends/si21xx.c +1
-1@@ -336,7 +336,7 @@ static int si21xx_wait_diseqc_idle(struct si21xx_state *state, int timeout)dprintk ("%s\n" , __func__);while ((si21_readreg (state,LNB_CTRL_REG_1 ) &0x8 ) ==8 ) { -if (jiffies - start > timeout) { +if (time_after (jiffies, start + timeout)) {dprintk ("%s: timeout!!\n" , __func__);return -ETIMEDOUT ; }
Appreciate all the conversions (IMO it should have been sent as a block of patches with a cover letter instead of independent unrelated patches) but wouldn't all of these be simpler and more consistent using a style where the addition is done once and the timeout test is something like:
unsigned long end = jiffies + timeout;
while (foo) {
if (time_after(jiffies, end)) {
error_msg(...)
return -ETIMEDOUT;
}
bar...;
}