staging: gdm72xx: Replace comparisons on jiffies values with wrap-safe functions
authorMichalis Pappas <mpappas@fastmail.fm>
Fri, 9 May 2014 10:08:21 +0000 (18:08 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 May 2014 19:12:51 +0000 (12:12 -0700)
Fixes the following checkpatch.pl issue:

WARNING: Comparing jiffies is almost always wrong; prefer time_after,
time_before and friends

Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm72xx/gdm_usb.c
drivers/staging/gdm72xx/sdio_boot.c

index 20539d809397dfdfb247a1974a0cc88139cc12b3..9ddf8f58d87bbd6b4c43810f960072ceb747d084 100644 (file)
@@ -730,7 +730,7 @@ static int k_mode_thread(void *arg)
                        spin_unlock_irqrestore(&k_lock, flags2);
 
                        expire = jiffies + K_WAIT_TIME;
-                       while (jiffies < expire)
+                       while (time_before(jiffies, expire))
                                schedule_timeout(K_WAIT_TIME);
 
                        spin_lock_irqsave(&rx->lock, flags);
index cbe5dcfc2ac9f36233a8bc0755c2d6898472add6..2c02842ac5da1c5f5981b7c3686ed45aaae30bba 100644 (file)
@@ -41,11 +41,11 @@ static u8 *tx_buf;
 
 static int ack_ready(struct sdio_func *func)
 {
-       unsigned long start = jiffies;
+       unsigned long wait = jiffies + HZ;
        u8 val;
        int ret;
 
-       while ((jiffies - start) < HZ) {
+       while (time_before(jiffies, wait)) {
                val = sdio_readb(func, 0x13, &ret);
                if (val & 0x01)
                        return 1;