kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [KJ] [PATCH] drivers/net/hp100.c : Use of time_after() macro
@ 2005-04-11 15:05 Marcelo Feitoza Parisi
  2005-04-13 16:09 ` Nish Aravamudan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-04-11 15:05 UTC (permalink / raw)
  To: kernel-janitors

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

-- 
Marcelo Feitoza Parisi            
marcelo at feitoza.com.br
http://marcelo.feitoza.com.br/


Marcelo Feitoza Parisi <marcelo@feitoza.com.br>

--- linux/drivers/net/hp100.c	2005-03-02 04:38:04.000000000 -0300
+++ development/drivers/net/hp100.c	2005-04-09 18:42:14.000000000 -0300
@@ -115,6 +115,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/io.h>
 
@@ -1493,7 +1494,7 @@ static int hp100_start_xmit_bm(struct sk
 		printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
 #endif
 		/* not waited long enough since last tx? */
-		if (jiffies - dev->trans_start < HZ)
+		if (time_after(jiffies, dev->trans_start - HZ))
 			return -EAGAIN;
 
 		if (hp100_check_lan(dev))
@@ -1646,7 +1647,7 @@ static int hp100_start_xmit(struct sk_bu
 		printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i);
 #endif
 		/* not waited long enough since last failed tx try? */
-		if (jiffies - dev->trans_start < HZ) {
+		if (time_after(jiffies, dev->trans_start - HZ)) {
 #ifdef HP100_DEBUG
 			printk("hp100: %s: trans_start timing problem\n",
 			       dev->name);

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [KJ] [PATCH] drivers/net/hp100.c : Use of time_after() macro
  2005-04-11 15:05 [KJ] [PATCH] drivers/net/hp100.c : Use of time_after() macro Marcelo Feitoza Parisi
@ 2005-04-13 16:09 ` Nish Aravamudan
  2005-04-14 21:42 ` [KJ] [PATCH] drivers/net/hp100.c : Use of time_before() macro, Marcelo Feitoza Parisi
  2005-07-08 18:41 ` [KJ] [PATCH] drivers/net/hp100.c : Use of time_before macro Marcelo Feitoza Parisi
  2 siblings, 0 replies; 4+ messages in thread
From: Nish Aravamudan @ 2005-04-13 16:09 UTC (permalink / raw)
  To: kernel-janitors

On 4/11/05, Marcelo Feitoza Parisi <marcelo@feitoza.com.br> wrote:
> Use of time_after() macro, defined at linux/jiffies.h, which deal with
> wrapping correctly and are nicer to read.
> 
> --
> Marcelo Feitoza Parisi
> marcelo at feitoza.com.br
> http://marcelo.feitoza.com.br/
> 
> Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
> 
> --- linux/drivers/net/hp100.c   2005-03-02 04:38:04.000000000 -0300
> +++ development/drivers/net/hp100.c     2005-04-09 18:42:14.000000000 -0300
> @@ -115,6 +115,7 @@
>  #include <linux/delay.h>
>  #include <linux/init.h>
>  #include <linux/bitops.h>
> +#include <linux/jiffies.h>
> 
>  #include <asm/io.h>
> 
> @@ -1493,7 +1494,7 @@ static int hp100_start_xmit_bm(struct sk
>                 printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
>  #endif
>                 /* not waited long enough since last tx? */
> -               if (jiffies - dev->trans_start < HZ)
> +               if (time_after(jiffies, dev->trans_start - HZ))

<snip>

> -               if (jiffies - dev->trans_start < HZ) {
> +               if (time_after(jiffies, dev->trans_start - HZ)) {

I think these both should be

if (time_before(jiffies, dev->trans_start + HZ))

Thanks,
Nish

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [KJ] [PATCH] drivers/net/hp100.c : Use of time_before() macro,
  2005-04-11 15:05 [KJ] [PATCH] drivers/net/hp100.c : Use of time_after() macro Marcelo Feitoza Parisi
  2005-04-13 16:09 ` Nish Aravamudan
@ 2005-04-14 21:42 ` Marcelo Feitoza Parisi
  2005-07-08 18:41 ` [KJ] [PATCH] drivers/net/hp100.c : Use of time_before macro Marcelo Feitoza Parisi
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-04-14 21:42 UTC (permalink / raw)
  To: kernel-janitors

Again, following Nish's catch, now the patch is using time_before() 
macro, instead of time_after() macro,
that was the way I did before. Both macros are defined at 
linux/jiffies.h. Any problem, please contact-me.

Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>

--- linux/drivers/net/hp100.c   2005-03-02 04:38:04.000000000 -0300
+++ development/drivers/net/hp100.c     2005-04-14 18:39:13.000000000 -0300
@@ -115,6 +115,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>

 #include <asm/io.h>

@@ -1493,7 +1494,7 @@
                printk("hp100: %s: start_xmit_bm: No TX PDL 
available.\n", dev->name);
 #endif
                /* not waited long enough since last tx? */
-               if (jiffies - dev->trans_start < HZ)
+               if (time_before(jiffies, dev->trans_start + HZ))
                        return -EAGAIN;

                if (hp100_check_lan(dev))
@@ -1646,7 +1647,7 @@
                printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", 
dev->name, i);
 #endif
                /* not waited long enough since last failed tx try? */
-               if (jiffies - dev->trans_start < HZ) {
+               if (time_before(jiffies, dev->trans_start + HZ)) {
 #ifdef HP100_DEBUG
                        printk("hp100: %s: trans_start timing problem\n",
                               dev->name);

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [KJ] [PATCH] drivers/net/hp100.c : Use of time_before macro
  2005-04-11 15:05 [KJ] [PATCH] drivers/net/hp100.c : Use of time_after() macro Marcelo Feitoza Parisi
  2005-04-13 16:09 ` Nish Aravamudan
  2005-04-14 21:42 ` [KJ] [PATCH] drivers/net/hp100.c : Use of time_before() macro, Marcelo Feitoza Parisi
@ 2005-07-08 18:41 ` Marcelo Feitoza Parisi
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Feitoza Parisi @ 2005-07-08 18:41 UTC (permalink / raw)
  To: kernel-janitors

Use of time_before() 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>

--- linux/drivers/net/hp100.c   2005-07-07 19:13:15.000000000 -0300
+++ linux-kj/drivers/net/hp100.c        2005-07-07 20:43:38.393191120 -0300
@@ -116,6 +116,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>

 #include <asm/io.h>

@@ -1500,7 +1501,7 @@
                printk(KERN_DEBUG "hp100: %s: start_xmit_bm: No TX PDL
available.\n", dev->name);
 #endif
                /* not waited long enough since last tx? */
-               if (jiffies - dev->trans_start < HZ)
+               if (time_before(jiffies, dev->trans_start + HZ))
                        return -EAGAIN;

                if (hp100_check_lan(dev))
@@ -1653,7 +1654,7 @@
                printk(KERN_DEBUG "hp100: %s: start_xmit: tx free mem 0x%x\n", dev->name, i);
 #endif
                /* not waited long enough since last failed tx try? */
-               if (jiffies - dev->trans_start < HZ) {
+               if (time_before(jiffies, dev->trans_start + HZ)) {
 #ifdef HP100_DEBUG
                        printk(KERN_DEBUG "hp100: %s: trans_start timing
problem\n",
                               dev->name);

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-07-08 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-11 15:05 [KJ] [PATCH] drivers/net/hp100.c : Use of time_after() macro Marcelo Feitoza Parisi
2005-04-13 16:09 ` Nish Aravamudan
2005-04-14 21:42 ` [KJ] [PATCH] drivers/net/hp100.c : Use of time_before() macro, Marcelo Feitoza Parisi
2005-07-08 18:41 ` [KJ] [PATCH] drivers/net/hp100.c : Use of time_before macro Marcelo Feitoza Parisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).