[PATCH] 3c523: use time_after macro From: Marcelo Feitoza Parisi It deals with wrapping correctly and is nicer to read. Signed-off-by: Marcelo Feitoza Parisi Signed-off-by: Alexey Dobriyan Index: linux-kj/drivers/net/3c523.c =================================================================== --- linux-kj.orig/drivers/net/3c523.c 2005-10-28 16:25:06.000000000 +0400 +++ linux-kj/drivers/net/3c523.c 2005-10-28 16:30:49.000000000 +0400 @@ -105,6 +105,7 @@ #include #include #include +#include #include #include @@ -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)) {