aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMarcelo Feitoza Parisi <marcelo@feitoza.com.br>2005-07-15 12:59:26 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-15 12:59:26 -0400
commita8178345c4f12f4413e5620fc86a6b0381c41bc9 (patch)
treedd9cb8c953556d539eabd4137032873a6578e988 /drivers/net
parent9d853c3757ef74ded5ae564d68370f22208fb88b (diff)
[WAN]: drivers/net/wan/: use of time_after macro
From: Marcelo Feitoza Parisi <marcelo@feitoza.com.br> 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 <marcelo@feitoza.com.br> Signed-off-by: Domen Puncer <domen@coderock.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wan/sdla_fr.c7
-rw-r--r--drivers/net/wan/sdla_ft1.c3
-rw-r--r--drivers/net/wan/sdla_ppp.c3
-rw-r--r--drivers/net/wan/sdla_x25.c3
-rw-r--r--drivers/net/wan/wanpipe_multppp.c9
5 files changed, 15 insertions, 10 deletions
diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c
index 2efccb0554c0..c5f5e62aab8b 100644
--- a/drivers/net/wan/sdla_fr.c
+++ b/drivers/net/wan/sdla_fr.c
@@ -152,6 +152,7 @@
152#include <asm/io.h> /* for inb(), outb(), etc. */ 152#include <asm/io.h> /* for inb(), outb(), etc. */
153#include <linux/time.h> /* for do_gettimeofday */ 153#include <linux/time.h> /* for do_gettimeofday */
154#include <linux/in.h> /* sockaddr_in */ 154#include <linux/in.h> /* sockaddr_in */
155#include <linux/jiffies.h> /* time_after() macro */
155#include <asm/errno.h> 156#include <asm/errno.h>
156 157
157#include <linux/ip.h> 158#include <linux/ip.h>
@@ -773,7 +774,7 @@ static int update(struct wan_device* wandev)
773 for(;;) { 774 for(;;) {
774 if(card->u.f.update_comms_stats == 0) 775 if(card->u.f.update_comms_stats == 0)
775 break; 776 break;
776 if ((jiffies - timeout) > (1 * HZ)){ 777 if (time_after(jiffies, timeout + 1 * HZ)){
777 card->u.f.update_comms_stats = 0; 778 card->u.f.update_comms_stats = 0;
778 return -EAGAIN; 779 return -EAGAIN;
779 } 780 }
@@ -4799,7 +4800,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
4799{ 4800{
4800 fr_channel_t *chan = dev->priv; 4801 fr_channel_t *chan = dev->priv;
4801 volatile sdla_t *card = chan->card; 4802 volatile sdla_t *card = chan->card;
4802 u32 timeout; 4803 unsigned long timeout;
4803 fr508_flags_t* flags = card->flags; 4804 fr508_flags_t* flags = card->flags;
4804 int reset_critical=0; 4805 int reset_critical=0;
4805 4806
@@ -4821,7 +4822,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
4821 if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG)) 4822 if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG))
4822 break; 4823 break;
4823 4824
4824 if ((jiffies - timeout) > (1 * HZ)){ 4825 if (time_after(jiffies, timeout + 1 * HZ)){
4825 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG; 4826 card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG;
4826 printk(KERN_INFO "%s: Failed to delete DLCI %i\n", 4827 printk(KERN_INFO "%s: Failed to delete DLCI %i\n",
4827 card->devname,chan->dlci); 4828 card->devname,chan->dlci);
diff --git a/drivers/net/wan/sdla_ft1.c b/drivers/net/wan/sdla_ft1.c
index 5e3124856eb0..9d6528a50f7b 100644
--- a/drivers/net/wan/sdla_ft1.c
+++ b/drivers/net/wan/sdla_ft1.c
@@ -29,6 +29,7 @@
29#include <linux/wanrouter.h> /* WAN router definitions */ 29#include <linux/wanrouter.h> /* WAN router definitions */
30#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ 30#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
31#include <linux/if_arp.h> /* ARPHRD_* defines */ 31#include <linux/if_arp.h> /* ARPHRD_* defines */
32#include <linux/jiffies.h> /* time_after() macro */
32 33
33#include <linux/inetdevice.h> 34#include <linux/inetdevice.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -164,7 +165,7 @@ int wpft1_init (sdla_t* card, wandev_conf_t* conf)
164 165
165 timeout = jiffies; 166 timeout = jiffies;
166 while (mb->return_code != 'I') /* Wait 1s for board to initialize */ 167 while (mb->return_code != 'I') /* Wait 1s for board to initialize */
167 if ((jiffies - timeout) > 1*HZ) break; 168 if (time_after(jiffies, timeout + 1*HZ)) break;
168 169
169 if (mb->return_code != 'I') { 170 if (mb->return_code != 'I') {
170 printk(KERN_INFO 171 printk(KERN_INFO
diff --git a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c
index 1761cb68ab48..a4b489cccbbf 100644
--- a/drivers/net/wan/sdla_ppp.c
+++ b/drivers/net/wan/sdla_ppp.c
@@ -101,6 +101,7 @@
101#include <linux/if_arp.h> /* ARPHRD_* defines */ 101#include <linux/if_arp.h> /* ARPHRD_* defines */
102#include <asm/byteorder.h> /* htons(), etc. */ 102#include <asm/byteorder.h> /* htons(), etc. */
103#include <linux/in.h> /* sockaddr_in */ 103#include <linux/in.h> /* sockaddr_in */
104#include <linux/jiffies.h> /* time_after() macro */
104 105
105 106
106#include <asm/uaccess.h> 107#include <asm/uaccess.h>
@@ -482,7 +483,7 @@ static int update(struct wan_device *wandev)
482 if(ppp_priv_area->update_comms_stats == 0){ 483 if(ppp_priv_area->update_comms_stats == 0){
483 break; 484 break;
484 } 485 }
485 if ((jiffies - timeout) > (1 * HZ)){ 486 if (time_after(jiffies, timeout + 1 * HZ)){
486 ppp_priv_area->update_comms_stats = 0; 487 ppp_priv_area->update_comms_stats = 0;
487 ppp_priv_area->timer_int_enabled &= 488 ppp_priv_area->timer_int_enabled &=
488 ~TMR_INT_ENABLED_UPDATE; 489 ~TMR_INT_ENABLED_UPDATE;
diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c
index 3a93d2fd4fbf..8a95d61a2f8f 100644
--- a/drivers/net/wan/sdla_x25.c
+++ b/drivers/net/wan/sdla_x25.c
@@ -91,6 +91,7 @@
91#include <linux/wanrouter.h> /* WAN router definitions */ 91#include <linux/wanrouter.h> /* WAN router definitions */
92#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ 92#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
93#include <linux/workqueue.h> 93#include <linux/workqueue.h>
94#include <linux/jiffies.h> /* time_after() macro */
94#include <asm/byteorder.h> /* htons(), etc. */ 95#include <asm/byteorder.h> /* htons(), etc. */
95#include <asm/atomic.h> 96#include <asm/atomic.h>
96#include <linux/delay.h> /* Experimental delay */ 97#include <linux/delay.h> /* Experimental delay */
@@ -867,7 +868,7 @@ static int update(struct wan_device* wandev)
867 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE)){ 868 if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE)){
868 break; 869 break;
869 } 870 }
870 if ((jiffies-timeout) > 1*HZ){ 871 if (time_after(jiffies, timeout + 1*HZ)){
871 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE; 872 card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE;
872 return -EAGAIN; 873 return -EAGAIN;
873 } 874 }
diff --git a/drivers/net/wan/wanpipe_multppp.c b/drivers/net/wan/wanpipe_multppp.c
index 6aa6987d96cb..812a1183c502 100644
--- a/drivers/net/wan/wanpipe_multppp.c
+++ b/drivers/net/wan/wanpipe_multppp.c
@@ -26,6 +26,7 @@
26#include <linux/wanrouter.h> /* WAN router definitions */ 26#include <linux/wanrouter.h> /* WAN router definitions */
27#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ 27#include <linux/wanpipe.h> /* WANPIPE common user API definitions */
28#include <linux/if_arp.h> /* ARPHRD_* defines */ 28#include <linux/if_arp.h> /* ARPHRD_* defines */
29#include <linux/jiffies.h> /* time_after() macro */
29 30
30#include <linux/in.h> /* sockaddr_in */ 31#include <linux/in.h> /* sockaddr_in */
31#include <linux/inet.h> 32#include <linux/inet.h>
@@ -270,9 +271,9 @@ int wsppp_init (sdla_t* card, wandev_conf_t* conf)
270 ready to accept commands. We expect this to be completed in less 271 ready to accept commands. We expect this to be completed in less
271 than 1 second. */ 272 than 1 second. */
272 273
273 timeout = jiffies; 274 timeout = jiffies + 1 * HZ;
274 while (mb->return_code != 'I') /* Wait 1s for board to initialize */ 275 while (mb->return_code != 'I') /* Wait 1s for board to initialize */
275 if ((jiffies - timeout) > 1*HZ) break; 276 if (time_after(jiffies, timeout)) break;
276 277
277 if (mb->return_code != 'I') { 278 if (mb->return_code != 'I') {
278 printk(KERN_INFO 279 printk(KERN_INFO
@@ -493,11 +494,11 @@ static int update(struct wan_device* wandev)
493 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE; 494 chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE;
494 495
495 /* wait a maximum of 1 second for the statistics to be updated */ 496 /* wait a maximum of 1 second for the statistics to be updated */
496 timeout = jiffies; 497 timeout = jiffies + 1 * HZ;
497 for(;;) { 498 for(;;) {
498 if(chdlc_priv_area->update_comms_stats == 0) 499 if(chdlc_priv_area->update_comms_stats == 0)
499 break; 500 break;
500 if ((jiffies - timeout) > (1 * HZ)){ 501 if (time_after(jiffies, timeout)){
501 chdlc_priv_area->update_comms_stats = 0; 502 chdlc_priv_area->update_comms_stats = 0;
502 chdlc_priv_area->timer_int_enabled &= 503 chdlc_priv_area->timer_int_enabled &=
503 ~TMR_INT_ENABLED_UPDATE; 504 ~TMR_INT_ENABLED_UPDATE;