From: Marcelo Feitoza Parisi <[EMAIL PROTECTED]>

Use of the time_after() macro, defined at linux/jiffies.h, which deal
with wrapping correctly and are nicer to read.

Signed-off-by: Marcelo Feitoza Parisi <[EMAIL PROTECTED]>
Signed-off-by: Domen Puncer <[EMAIL PROTECTED]>

---
 3c523.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

Index: quilt/drivers/net/3c523.c
===================================================================
--- quilt.orig/drivers/net/3c523.c
+++ quilt/drivers/net/3c523.c
@@ -105,6 +105,7 @@
 #include <linux/mca-legacy.h>
 #include <linux/ethtool.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/uaccess.h>
 #include <asm/processor.h>
@@ -619,7 +620,7 @@ out:
 static int init586(struct net_device *dev)
 {
        void *ptr;
-       unsigned long s;
+       unsigned long stop;
        int i, result = 0;
        struct priv *p = (struct priv *) dev->priv;
        volatile struct configure_cmd_struct *cfg_cmd;
@@ -656,9 +657,9 @@ static int init586(struct net_device *de
        p->scb->cmd = CUC_START;        /* cmd.-unit start */
        elmc_id_attn586();
 
-       s = jiffies;            /* warning: only active with interrupts on !! */
+       stop = jiffies + msecs_to_jiffies(300);         /* warning: only active 
with interrupts on !! */
        while (!(cfg_cmd->cmd_status & STAT_COMPL)) {
-               if (jiffies - s > 30*HZ/100)
+               if (time_after(jiffies, stop))
                        break;
        }
 
@@ -682,9 +683,9 @@ static int init586(struct net_device *de
        p->scb->cmd = CUC_START;        /* cmd.-unit start */
        elmc_id_attn586();
 
-       s = jiffies;
+       stop = jiffies + msecs_to_jiffies(300);
        while (!(ias_cmd->cmd_status & STAT_COMPL)) {
-               if (jiffies - s > 30*HZ/100)
+               if (time_after(jiffies, stop))
                        break;
        }
 
@@ -707,9 +708,9 @@ static int init586(struct net_device *de
        p->scb->cmd = CUC_START;        /* cmd.-unit start */
        elmc_attn586();
 
-       s = jiffies;
+       stop = jiffies + msecs_to_jiffies(300);
        while (!(tdr_cmd->cmd_status & STAT_COMPL)) {
-               if (jiffies - s > 30*HZ/100) {
+               if (time_after(jiffies, stop)) {
                        printk(KERN_WARNING "%s: %d Problems while running the 
TDR.\n", dev->name, __LINE__);
                        result = 1;
                        break;
@@ -796,9 +797,9 @@ static int init586(struct net_device *de
                        p->scb->cbl_offset = make16(mc_cmd);
                        p->scb->cmd = CUC_START;
                        elmc_id_attn586();
-                       s = jiffies;
+                       stop = jiffies + msecs_to_jiffies(300);
                        while (!(mc_cmd->cmd_status & STAT_COMPL)) {
-                               if (jiffies - s > 30*HZ/100)
+                               if (time_after(jiffies, stop))
                                        break;
                        }
                        if (!(mc_cmd->cmd_status & STAT_COMPL)) {

--
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to